PDielec.Utilities¶
Utility Functions.
A set of utility functions that may be used anywhere in the package.
Attributes¶
Functions¶
|
Determine the simulation program from a given filename. |
|
Get the appropriate output reader based on the simulation program and, if specified, the quantum mechanical program. |
|
Print 4x4 matrices or 4 vectors. |
Module Contents¶
- PDielec.Utilities.find_program_from_name(filename)[source]¶
Determine the simulation program from a given filename.
Parameters¶
- filenamestr
The complete path (absolute or relative) to a file.
Returns¶
- str
The program name that was used to calculate the frequencies.
Notes¶
This function examines the file extension and, in some cases, the presence of specific files in the same directory, to determine the associated simulation program. It recognizes files from several popular materials simulation programs, such as ‘phonopy’, ‘gulp’, ‘vasp’, and others.
Examples¶
program = find_program_from_name('./data/structure.castep') print(program) # Output: "castep" program = find_program_from_name('path/to/simulation/phonopy.yaml') print(program) # Output: "phonopy"
- PDielec.Utilities.get_reader(name, program)[source]¶
Get the appropriate output reader based on the simulation program and, if specified, the quantum mechanical program.
This function is designed to create an output reader object for various simulation programs (like CASTEP, VASP, etc.) and, for phonopy simulations, it can additionally create a quantum mechanical output reader based on the specified quantum mechanical program.
Parameters¶
- namestr
The primary filepath or name associated with the output file(s).
- programstr
The name of the simulation program. Supported values are ‘castep’, ‘vasp’, ‘gulp’, ‘crystal’, ‘abinit’, ‘qe’, and ‘phonopy’.
Returns¶
- object
An instance of the appropriate output reader class based on the input program
Examples¶
>>> reader = get_reader("output.log", "castep") >>> reader = get_reader("output", "phonopy")
- PDielec.Utilities.printsp(name, matrix)[source]¶
Print 4x4 matrices or 4 vectors.
Parameters¶
- namestring
The name of the matrix
- matrix4x4 or 4 array
The matrix to be printed
Returns¶
None
Notes¶
None
- PDielec.Utilities.logger¶