IO functions¶
There functions for reading and writing input and output files (see e.g., calorine.io.convert_gpumd_run_to_traj()
, calorine.io.read_xyz()
, calorine.io.write_xyz()
).
There are also functions for reading individual kappa.out
and thermo.out
files (calorine.io.read_kappa()
and calorine.io.read_thermo()
), series of those files (calorine.io.read_kappas()
and calorine.io.read_thermos()
) as well as configuration files (calorine.io.read_settings()
).
Thermal conductivity runs¶
When organizing results from many thermal conductivity runs it is recommended to use ASE databases.
calorine provides specific functions for this purpose (calorine.io.update_database()
and calorine.io.read_from_database()
).
For these functions to operate smoothly the GPUMD runs ought to be organized in a directory structured as follows:
<runpath>
├── xyz.in
├── run.in
├── 01
│ ├── kappa.out
│ └── thermo.out
├── 02
│ ├── kappa.out
│ └── thermo.out
├── 03
│ ├── kappa.out
│ └── thermo.out
⋮
The subdirectory names (01
, 02
… in the example above) are imaterial.
Alternatively one can also read the settings from a Python module (named config
) instead of the GPUMD configuration file (named run.in
).
The calorine.io.update_database()
function parses such a directory structure and turns it into a database entry:
index = update_database('runs.db', 'gpumd_runs/T300')
The entry can be subsequently read and unpacked using the calorine.io.read_from_database()
function as follows:
db = connect('runs.db')
row = db.get(id=1)
settings, kappas, thermos = read_from_database(row)
Module¶
- calorine.io.read_hac(filename)[source]¶
Parses a file in
hac.out
format from GPUMD and returns the content as a data frame. More information concerning file format, content and units can be found at https://gpumd.zheyongfan.org/index.php/The_hac.out_output_file.- Parameters
filename (
str
) – input file name- Return type
DataFrame
- calorine.io.read_kappa(filename)[source]¶
Parses a file in
kappa.out
format from GPUMD and returns the content as a data frame. More information concerning file format, content and units can be found at https://gpumd.zheyongfan.org/index.php/The_kappa.out_output_file.- Parameters
filename (
str
) – input file name- Return type
DataFrame
- calorine.io.read_loss(filename)[source]¶
Parses a file in
loss.out
format from GPUMD and returns the content as a data frame. More information concerning file format, content and units can be found at https://gpumd.zheyongfan.org/index.php/The_output_files_for_the_nep_executable#The_loss.out_file.- Parameters
filename (
str
) – input file name- Return type
DataFrame
- calorine.io.read_nep(filename)[source]¶
Parses a file in
nep.txt
format from GPUMD and returns the content as a tuple of a dict and a list. The dict contains the information contained in the header, whereas the list contains the weights and rescaling factors.- Parameters
filename (
str
) – input file name- Return type
Tuple
[Dict
[str
,tuple
],List
[float
]]
- calorine.io.read_settings(filename)[source]¶
Returns the settings from a configuration file as a dictionary.
- Parameters
filename (
str
) – input file name- Return type
dict
- calorine.io.read_thermo(filename, natoms=1)[source]¶
Parses a file in
thermo.out
format from GPUMD and returns the content as a data frame. More information concerning file format, content and units can be found at https://gpumd.zheyongfan.org/index.php/The_thermo.out_output_file.- Parameters
filename (
str
) – input file namenatoms (
int
) – number of atoms; used to normalize energies
- Return type
DataFrame
- calorine.io.read_xyz(filename)[source]¶
Read the structure input file (
xyz.in
) for GPUMD and return the structure along with run input parameters from the file.- Parameters
filename (
str
) – Name of file from which to read the structure- Return type
tuple comprising the structure and the parameters from the first row of the file
- calorine.io.write_xyz(filename, structure, maximum_neighbors=None, cutoff=None, groupings=None, use_triclinic=False)[source]¶
Writes a structure into GPUMD input format (
xyz.in
).- Parameters
filename (
str
) – Name of file to which the structure should be writtenstructure (
Atoms
) – Input structuremaximum_neighbors (
Optional
[int
]) – Maximum number of neighbors any atom can ever have (not relevant when using force constant potentials)cutoff (
Optional
[float
]) – Initial cutoff distance used for building the neighbor list (not relevant when using force constant potentials)groupings (
Optional
[List
[List
[List
[int
]]]]) – Groups into which the individual atoms should be divided in the form of a list of list of lists. Specifically, the outer list corresponds to the grouping methods, of which there can be three at the most, which contains a list of groups in the form of lists of site indices. The sum of the lengths of the latter must be the same as the total number of atoms.use_triclinic (
bool
) – Use format for triclinic cells
- Raises
ValueError – Raised if parameters are incompatible