File Inputs and Outputs

This module consists of simple input/output functions for atomic structures, trajectories, etc. Most of the functionality can be found elsewhere in gpyumd, but some may find the functions convenient.

List of all methods

gpyumd.io.read_gpumd(atom_symbols: Optional[List[str]] = None, gpumd_file: str = 'xyz.in', directory: Optional[str] = None) GpumdAtoms[source]

Reads and returns the structure input file from GPUMD.

Parameters
  • atom_symbols – List of atom symbols used in the xyz.in file. Ex: [‘Mo’, ‘S’, ‘Si’, ‘O’]. Uses GPUMD type directly, if not provided.

  • gpumd_file – Name of structure file

  • directory – Directory of output

Returns

GpumdAtoms

gpyumd.io.read_movie(filename: str = 'movie.xyz', directory: Optional[str] = None, atom_symbols: Optional[List[Union[str, int]]] = None) List[GpumdAtoms][source]

Reads the trajectory from GPUMD run and creates a list of ASE atoms.

Parameters
  • filename – Name of the file that holds the GPUMD trajectory.

  • directory – Directory of output. Assumes the in_file and movie.xyz file are in the same directory.

  • atom_symbols – List of atom symbols/atomic number used in the xyz.in file. Ex: [‘Mo’, ‘S’, ‘Si’, ‘O’]. Uses GPUMD type directly, if not provided.

Returns

List of GpumdAtoms

gpyumd.io.write_basis(gpumd_atoms: GpumdAtoms, filename: str = 'basis.in', directory: Optional[str] = None) None[source]

Creates the basis.in file. Atoms passed to this must already have the basis of every atom defined. Related: atoms.add_basis, atoms.repeat

Parameters
  • gpumd_atoms – Atoms of unit cell used to generate basis.in

  • filename – File to save the structure data to

  • directory – Directory to store output

gpyumd.io.write_gpumd(gpumd_atoms: GpumdAtoms, use_velocity: bool = False, gpumd_file: str = 'xyz.in', directory: Optional[str] = None) None[source]

Creates and xyz.in file. Note: both max_neighbors and cutoff must be set for the file to be written.

Parameters
  • gpumd_atoms – The structure to write to file.

  • use_velocity – Whether or not to set the velocities in the xyz.in file.

  • gpumd_file – File to save the structure data to

  • directory – Directory to store output

gpyumd.io.write_kpoints(gpumd_atoms: GpumdAtoms, path: str = 'G', npoints: int = 1, special_points: Optional[Mapping[str, Sequence[float]]] = None, filename: str = 'kpoints.in', directory: Optional[str] = None) Tuple[ndarray, None, List[str]][source]

Creates the file “kpoints.in”, which specifies the kpoints needed for the ‘phonon’ keyword

Parameters
  • gpumd_atoms – Unit cell to use for phonon calculation

  • path – String of special point names defining the path, e.g. ‘GXL’

  • npoints – Number of points in total. Note that at least one point is added for each special point in the path

  • special_points – Map of special points to scaled kpoint coordinates. For example {'G': [0, 0, 0], 'X': [1, 0, 0]}

  • filename – File to save the structure data to

  • directory – Directory to store output

Returns

kpoints converted to x-coordinates, x-coordinates of the high

symmetry points, labels of those points.