gpumd

Calculations - calc

thermo.gpumd.calc.hnemd_spectral_decomp(dt, Nc, Fmax, Fe, T, A, Nc_conv=None, shc=None, directory='')[source]

Computes the spectral decomposition from HNEMD between two groups of atoms.

Args:
dt (float):
Sample period (in fs) of SHC method
Nc (int):
Maximum number of correlation steps
Fmax (float):
Maximum frequency (THz) to compute spectral decomposition to
Fe (float):
HNEMD force in (1/A)
T (float):
HNEMD run temperature (in K)
A (float):
Area (nm^2) that heat flows over
Nc_conv (int):
Number of correlations steps to use for calculation
shc (dict):
Dictionary from load_shc if already created
directory (str):
Directory to load ‘shc.out’ file from (dir. of simulation)
Returns:
out (dict):
Dictionary with the spectral decomposition
thermo.gpumd.calc.running_ave(kappa, time)[source]

Gets running average

Reads and returns the structure input file from GPUMD.

Args:
kappa (ndarray):
Raw thermal conductivity
time (ndarray):
Time vector that kappa was sampled at
Returns:
out (ndarray):
Running average of kappa input

Data Loaders - data

thermo.gpumd.data.load_dos(points_per_run, num_run=1, average=False, directory='', filename='dos.out')[source]

Loads data from dos.out GPUMD output file

Args:
points_per_run (int or list(int)):
Number of frequency points the DOS is computed for. For num_run>1, a list can be provided to specify number of points in each run if they are different. Otherwise, it is assumed that the same number of points are used per run
num_run (int):
Number of DOS runs in the dos.out file
average (bool):
Averages all of the runs to a single output. Default is False. Only works if points_per_run is an int.
directory (str):
Directory to load ‘dos.out’ file from (dir. of simulation)
filename (str):
File to load DOS from. Default is dos.out
Returns:
out (dict(dict)):

Dictonary with DOS data. The outermost dictionary stores each individual run. Each run is a dictionary with keys:

  • nu (THz)
  • DOS_x (1/THz)
  • DOS_y (1/THz)
  • DOS_z (1/THz)

If average=True, this will also be stored as a run with the same run keys.

thermo.gpumd.data.load_hac(directory='', filename='hac.out')[source]

Loads data from hac.out GPUMD output file which contains the heat-current autocorrelation and running thermal conductivity values

filename (str):
File to load hac from. Default is hac.out

Created for GPUMD-v1.9

hacf - (ev^3/amu) k - (W/m/K) t - (ps)

out keys:

  • hacf_xi
  • hacf_xo
  • hacf_x: ave. of i/o components
  • hacf_yi
  • hacf_yo
  • hacf_y: ave of i/o components
  • hacf_z
  • k_xi
  • k_xo
  • k_x: ave of i/o components
  • k_yi
  • k_yo
  • k_y: ave of i/o components
  • k_z
  • k_i: ave of x/y components
  • k_o: ave of x/y components
  • k: ave of all in-plane components
  • t: correlation time
Args:
directory (str):
Directory to load ‘hac.out’ file from (dir. of simulation)
Returns:
out (dict):
A dictionary with keys corresponding to the columns in ‘hac.out’ with some additional keys for aggregated values (see description)
thermo.gpumd.data.load_kappa(directory='', filename='kappa.out')[source]

Loads data from kappa.out GPUMD output file which contains HNEMD kappa

out keys:

  • kx_in
  • kx_out
  • ky_in
  • ky_out
  • kz
Args:
directory (str):
Directory to load ‘kappa.out’ file from (dir. of simulation)
filename (str):
File to load kappa from. Default is kappa.out
Returns:
out (dict):
A dictionary with keys corresponding to the columns in ‘kappa.out’
thermo.gpumd.data.load_sdc(Nc, num_run=1, average=False, directory='', filename='sdc.out')[source]

Loads data from sdc.out GPUMD output file

Args:
Nc (int or list(int)):
Number of time correlation points the VAC/SDC is computed for. For num_run>1, a list can be provided to specify number of points in each run if they are different. Otherwise, it is assumed that the same number of points are used per run
num_run (int):
Number of SDC runs in the sdc.out file
average (bool):
Averages all of the runs to a single output. Default is False. Only works if points_per_run is an int.
directory (str):
Directory to load ‘sdc.out’ file from (dir. of simulation)
filename (str):
File to load SDC from. Default is sdc.out
Returns:
sdc (dict(dict)):

Dictionary with SDC data. The outermost dictionary stores each individual run. Each run is a dictionary with keys:

  • t (ps)
  • SDC_x (Angstrom^2/ps)
  • SDC_y (Angstrom^2/ps)
  • SDC_z (Angstrom^2/ps)

If average=True, this will also be stored as a run with the same run keys.

vac (dict(dict)):

Dictonary with VAC data. The outermost dictionary stores each individual run. Each run is a dictionary with keys:

  • t (ps)
  • VAC_x (Angstrom^2/ps^2)
  • VAC_y (Angstrom^2/ps^2)
  • VAC_z (Angstrom^2/ps^2)

If average=True, this will also be stored as a run with the same run keys.

thermo.gpumd.data.load_shc(Nc, directory='', filename='shc.out')[source]

Loads the data from shc.out GPUMD output file

Args:
Nc (int):
Maximum number of correlation steps
directory (str):
Directory to load ‘shc.out’ file from (dir. of simulation)
filename (str):
File to load SHC from. Default is shc.out
Returns:
out (dict):
Dictionary of in- and out-of-plane shc results (average)
thermo.gpumd.data.load_vac(Nc, num_run=1, average=False, directory='', filename='mvac.out')[source]

Loads data from mvac.out GPUMD output file

Args:
Nc (int or list(int)):
Number of time correlation points the VAC is computed for. For num_run>1, a list can be provided to specify number of points in each run if they are different. Otherwise, it is assumed that the same number of points are used per run
num_run (int):
Number of VAC runs in the mvac.out file
average (bool):
Averages all of the runs to a single output. Default is False. Only works if points_per_run is an int.
directory (str):
Directory to load ‘mvac.out’ file from (dir. of simulation)
filename (str):
File to load VAC from. Default is mvac.out
Returns:
out (dict(dict)):

Dictonary with VAC data. The outermost dictionary stores each individual run. Each run is a dictionary with keys:

  • t (ps)
  • VAC_x (Angstrom^2/ps^2)
  • VAC_y (Angstrom^2/ps^2)
  • VAC_z (Angstrom^2/ps^2)

If average=True, this will also be stored as a run with the same run keys.

Input/Output - io

thermo.gpumd.io.ase_atoms_to_gpumd(atoms, M, cutoff, gpumd_file='xyz.in', sort_key=None, order=None, group_index=None)[source]

Converts ASE atoms to GPUMD compatible position file

Args:
atoms (ase.Atoms):
Atoms to write to gpumd file
M (int):
Maximum number of neighbors for one atom
cutoff (float):
Initial cutoff distance for building the neighbor list
gpumd_file (str):
File to save the structure data to
sort_key (str):
How to sort atoms (‘group’, ‘type’, ‘layer’). Default is None.
order (list(type)):
List to sort by. Provide str for ‘type’, and int for ‘group’ and ‘layer’
group_index (int):
Selects the group to sort in the output.
thermo.gpumd.io.convert_gpumd_atoms(in_file='xyz.in', out_filename='in.xyz', format='xyz', atom_types=None)[source]

Converts the GPUMD input structure file to any compatible ASE output structure file. Warning: Info dictionary may not be preserved.

Args:
in_file (str):
GPUMD position file to get structure from
out_filename (str):
Name of output file after conversion
format (str):
ASE supported output format
atom_types (list(str)):
List of atom types (elements).
thermo.gpumd.io.convert_gpumd_trajectory(traj_file='xyz.out', out_filename='out.xyz', in_file='xyz.in', format='xyz')[source]

Converts GPUMD trajectory to any compatible ASE output. Default: xyz

Args:
traj_file (str):
Trajetory from GPUMD
out_filename (str):
File in which final trajectory should be saved
in_file (str):
Original stucture input file to GPUMD. Needed to get atom numbers/types
format (str):
ASE supported format
thermo.gpumd.io.import_trajectory(filename='movie.xyz', in_file=None, atom_types=None)[source]

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

Args:
filename (str):
Name of the file that holds the GPUMD trajectory.
in_file (str):
Name of the original structure input file. Not required, but can help load extra information not included in trajectory output.
atom_types (list(str)):
List of atom types (elements).
Returns:
traj (list(ase.Atoms)):
A list of ASE atoms objects.
thermo.gpumd.io.lammps_atoms_to_gpumd(filename, M, cutoff, style='atomic', gpumd_file='xyz.in')[source]

Converts a lammps data file to GPUMD compatible position file

Args:
filename (str):
LAMMPS data file name
M (int):
Maximum number of neighbors for one atom
cutoff (float):
Initial cutoff distance for building the neighbor list
style (str):
Atom style used in LAMMPS data file
gpumd_file (str):
File to save the structure data to
thermo.gpumd.io.load_xyz(filename='xyz.in', atom_types=None)[source]

Reads and returns the structure input file from GPUMD.

Args:
filename (str):
Name of structure file
atom_types (list(str)):
List of atom types (elements).
Returns:
atoms (ase.Atoms):
ASE atoms object with x,y,z, mass, group, type, cell, and PBCs from input file. group is stored in tag, atom type may not correspond to correct atomic symbol
M (int):
Max number of neighbor atoms
cutoff (float):
Initial cutoff for neighbor list build

Preprocessing - preproc

thermo.gpumd.preproc.add_group_by_position(split, atoms, direction)[source]

Assigns groups to all atoms based on its position. Only works in one direction as it is used for NEMD. Returns a bookkeeping parameter, but atoms will be udated in-place.

Args:
split (list(float)):
List of boundaries. First element should be lower boundary of sim. box in specified direction and the last the upper.
atoms (ase.Atoms):
Atoms to group
direction (str):
Which direction the split will work.
Returns:
counts (int)
A list of number of atoms in each group.
thermo.gpumd.preproc.add_group_by_type(atoms, groups)[source]

Assigns groups to all atoms based on atom types. Returns a bookkeeping parameter, but atoms will be udated in-place.

Args:
atoms (ase.Atoms):
Atoms to group
types (dict):
Dictionary with types for keys and group as a value. Only one group allowed per atom. Assumed groups are integers starting at 0 and increasing in steps of 1. Ex. range(0,10).
Returns:
counts (int)
A list of number of atoms in each group.
thermo.gpumd.preproc.assign_layer_by_position(split, atoms, direction)[source]

Assigns layers to all atoms based on its position. Only works in one direction. Similar to group but only one layer can be assigned to an atom. Returns a bookkeeping parameter, but atoms will be udated in-place.

Args:
split (list(float)):
List of boundaries. First element should be lower boundary of sim. box in specified direction and the last the upper.
atoms (ase.Atoms):
Atoms to assign layers to
direction (str):
Which direction the split will work
Returns:
counts (int)
A list of number of atoms in each layer
thermo.gpumd.preproc.assign_layer_by_type(atoms, layers)[source]

Assigns a layer to all atoms based on atom types. Returns a bookkeeping parameter, but atoms will be udated in-place.

Args:
atoms (ase.Atoms):
Atoms to assign layer to.
types (dict):
Dictionary with types for keys and layer as a value. Only one layer allowed per atom. Assumed layers are integers starting at 0 and increasing in steps of 1. Ex. range(0,10)
Returns:
counts (int)
A list of number of atoms in each layer.
thermo.gpumd.preproc.set_velocities(atoms, custom=None)[source]

Sets the ‘velocity’ part of the atoms to be used in GPUMD. Custom velocities must be provided. They must also be in the units of eV^(1/2) amu^(-1/2)

Args:
atoms (ase.Atoms):
Atoms to assign velocities to.
custom (list(list)):
list of len(atoms) with each element made from a 3-element list for [vx, vy, vz]