GPUMD IO#

calorine.gpumd.read_dipole(fname)[source]#

Read a GPUMD dipole.out file written by the dump_dipole keyword.

Parameters:

fname (str) – Path to the dipole.out file.

Returns:

DataFrame with columns step (int), mu_x, mu_y, mu_z (dipole moment \(\mu\) for molecules, or polarization P for extended systems, in e·Å).

Return type:

DataFrame

calorine.gpumd.read_dpdt(fname)[source]#

Read a GPUMD dpdt.out file.

The time column is converted from fs (as written by GPUMD) to ps.

Parameters:

fname (str) – Path to the dpdt.out file.

Returns:

DataFrame with columns time (ps), dPx, dPy, dPz (time derivatives of the polarization in e·Å/fs), and Px, Py, Pz (polarization components in e·Å).

Return type:

DataFrame

calorine.gpumd.read_hac(filename, exclude_currents=True, exclude_in_out=True)[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 here.

Parameters:
  • filename (str) – Input file name.

  • exclude_currents (bool) – Do not include currents in output to save memory.

  • exclude_in_out (bool) – Do not include in and out parts of conductivity in output to save memory.

Return type:

DataFrame

calorine.gpumd.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 here.

Parameters:

filename (str) – Input file name.

Return type:

DataFrame

calorine.gpumd.read_mcmd(filename, accumulate=True)[source]#

Parses a Monte Carlo output file in mcmd.out format and returns the content in the form of a DataFrame.

Parameters:
  • filename (str) – Path to file to be parsed.

  • accumulate (bool) – If True the MD steps between subsequent Monte Carlo runs in the same output file will be accumulated.

Return type:

DataFrame

Returns:

DataFrame containing acceptance ratios and concentrations (if available), as well as key Monte Carlo parameters.

calorine.gpumd.read_msd(filename)[source]#

Parses a file in msd.out format from GPUMD and returns the content as a data frame. More information concerning file format, content and units can be found here.

Parameters:

filename (str) – Input file name.

Return type:

DataFrame

calorine.gpumd.read_polarizability(fname, scale=None)[source]#

Read a GPUMD polarizability.out file written by dump_polarizability.

Parameters:
  • fname (str) – Path to the polarizability.out file.

  • scale (float) – Divisor applied to the six susceptibility columns after reading. Should match the normalisation constant used when training the TNEP model. GPUMD writes the total supercell susceptibility \(\chi_\mathrm{cell}\), so dividing by the same value that was used as the training target scale (typically the number of atoms, len(atoms)) recovers the intensive, per-atom quantity expected by get_raman_spectrum(). The step column is not affected. None (default) leaves the data unscaled.

Returns:

DataFrame with columns step (int) and the six independent components xx, yy, zz, xy, yz, xz of the polarizability \(\alpha\) (molecules) or susceptibility \(\chi\) (extended systems), in the same units as the TNEP training data (typically Å^3 or bohr^3 per atom when scale equals the number of atoms). The off-diagonal order follows the GPUMD polarizability.out file (xy, yz, xz).

Return type:

DataFrame

calorine.gpumd.read_runfile(filename)[source]#

Parses a GPUMD input file in run.in format and returns the content in the form a list of keyword-value pairs.

Parameters:

filename (str) – Input file name.

Return type:

List[Tuple[str, list]]

Returns:

List of keyword-value pairs.

calorine.gpumd.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 here.

Parameters:
  • filename (str) – Input file name.

  • natoms (int) – Number of atoms; used to normalize energies.

Return type:

DataFrame

calorine.gpumd.read_thermodynamic_data(directory_name, normalize=False)[source]#

Parses the data in a GPUMD output directory and returns the content in the form of a DataFrame. This function reads the thermo.out, run.in, and model.xyz (optionally) files, and returns the thermodynamic data including the time (in ps), the pressure (in GPa), the side lengths of the simulation cell (in Å), and the volume (in Å:sup:3 or Å:sup:3/atom).

Parameters:
  • directory_name (str) – Path to directory to be parsed.

  • normalize (bool) – Normalize thermodynamic quantities per atom. This requires the model.xyz file to be present.

Return type:

DataFrame

Returns:

DataFrame containing (augmented) thermodynamic data.

calorine.gpumd.read_xyz(filename)[source]#

Reads the structure input file (model.xyz) for GPUMD and returns the structure.

This is a wrapper function around ase.io.read_xyz() since the ASE implementation does not read velocities properly. Specifically, the velocity unit is converted from GPUMD units (Å/fs) to ASE units (1/sqrt(u/eV)).

Parameters:

filename (str) – Name of file from which to read the structure.

Return type:

Atoms

Returns:

Structure as ASE Atoms object with additional per-atom arrays representing atomic masses, velocities etc.

calorine.gpumd.write_runfile(file, parameters)[source]#

Write a file in run.in format to define input parameters for MD simulation.

Parameters:
  • file (Path) – Path to file to be written.

  • parameters (List[Tuple[str, Union[int, float, Tuple[str, float]]]]) – Defines all command-parameter(s) pairs used in run.in file (see GPUMD documentation for a complete list). Values can be either floats, integers, or lists/tuples.

calorine.gpumd.write_xyz(filename, structure, groupings=None)[source]#

Writes a structure into GPUMD input format (model.xyz).

This is a wrapper function around ase.io.write_xyz() since the ASE implementation does not write velocities properly. Specifically, the velocity unit is converted from ASE units (1/sqrt(u/eV)) to GPUMD units (Å/fs).

Parameters:
  • filename (str) – Name of file to which the structure should be written.

  • structure (Atoms) – Input structure.

  • groupings (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.

Raises:

ValueError – Raised if parameters are incompatible.