lammps

Calculations

thermo.lammps.calc.get_GKTC(directory='.', T=300, vol=1, dt=None, rate=None, tau=None, heatflux_file='heat_out.heatflux', mat_file='heat_flux.mat')[source]

Gets the thermal conductivity vs. time profile using the Green-Kubo formalism. thermal conductivity vector and time vector. Assumptions with no info given by user: dt = 1 fs, vol = 1, T=300, rate=dt, tau=total time

Args:
directory (string):
This is the directory in which the simulation results are located. If not provided, the current directory is used.
T (float):
This is the temperature at which the equlibrium simulation was run at. If not provided, T=300 is used. Units are in [K]
vol (float):
This is the volume of the simulation system. If not provided, vol=1 is used. Units are [angstroms^3].
dt (float):
This is the timestep of the green-kubo part of the simulation. If not provided, dt=1 fs is used. units are in [fs]
rate (int):
This is the rate at which the heat flux is sampled. This is in number of timesteps. If not provided, we assume we sample once per timestep so, rate=dt
tau (int):
max lag time to integrate over. This is in units of [ns]
heatflux_file (str): Filename of heatflux output. If not provided
‘heat_out.heatflux’ is used.
mat_file (str): MATLAB file to load, if exists. If not provided,
‘heat_flux.mat’ will be used. Also used as filename for saved MATLAB file.
Returns:
dict: kx, ky, kz, t, directory, dt, tot_time, tau, T, vol, srate, jxjx, jyjy, jzjz

Output keys:

  • kx (ndarray): x-direction thermal conductivity [W/m/K]
  • ky (ndarray): y-direction thermal conductivity [W/m/K]
  • kz (ndarray): z-direction thermal conductivity [W/m/K]
  • t (ndarray): time [ns]
  • directory (str): directory of results
  • dt (float): timestep [fs]
  • tot_time (float): total simulated time [ns]
  • tau (int): Lag time [ns]
  • T (float): [K]
  • vol (float): Volume of simulation cell [angstroms^3]
  • srate (float): See above
  • jxjx (ndarray): x-direction heat flux autocorrelation
  • jyjy (ndarray): y-direction heat flux autocorrelation
  • jzjz (ndarray): z-direction heat flux autocorrelation
thermo.lammps.calc.get_heat_flux(directory='.', heatflux_file='heat_out.heatflux', mat_file='heat_flux.mat')[source]

Gets the heat flux from a LAMMPS EMD simulation. Creates a compressed .mat file if only in text form. Loads .mat form if exists.

Args:
directory (str): This is the directory in which the simulation results
are located. If not provided, the current directory is used.
heatflux_file (str): Filename of heatflux output. If not provided
‘heat_out.heatflux’ is used.
mat_file (str): MATLAB file to load, if exists. If not provided,
‘heat_flux.mat’ will be used. Also used as filename for saved MATLAB file.
Returns:
dict:Jx (list), Jy (list), Jz (list), rate (float)

Data Loaders

thermo.lammps.data.extract_dt(log_file)[source]

Finds all time steps given in the lammps output log

Args:
log_file (str):
LAMMPS log file to examine
Returns:
list(float): The timesteps found in log_file in [ps]
thermo.lammps.data.get_dimensions(filename, directory=None)[source]

Gets the dimensions of a 3D simulation from a LAMMPS trajectory.

Args:
filename (str):
LAMMPS trajectory file to extract dimensions from
directory (str):
The directory the trajectory file is found in
Returns:
dict: Dictionary with keys given in the table below
Output dictionary
key x y z A V xy xz yz
units distance distance distance distance2 distance3 distance distance distance

Input/Output

thermo.lammps.io.ase_atoms_to_lammps(atoms, out_file='atoms.data', add_masses=True)[source]

Converts ASE atoms to a lammps data file.

Args:
atoms (ase.Atoms):
Atoms to write to lammps data file
gpumd_file (str):
File to save the structure data to