lammps

Calculations - calc

thermo.lammps.calc.autocorr(f, max_lag)[source]

Computes a fast autocorrelation function and returns up to max_lag

Args:
f (ndarray):
Vector for autocorrelation
max_lag (float):
Lag at which to calculate up to
Returns:
out (ndarray):
Autocorrelation vector
thermo.lammps.calc.get_GKTC(**kwargs)[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=tot_time

Keyword Arguments:

  • 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]
  • log (string):
    This is the path of the log file. This is only used if the dt keyword is not provided as it tries to extract the timestep from the logs
  • 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 [ps]
  • 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
  • srate (float):
    This is related to rate, as it is the heat flux sampling rate in units of simulation time. This does not need to be provided if rate is already provided. Defaults are based on rate and dt. Units of [ns]
  • tau (int):
    max lag time to integrate over. This is in units of [ps]
Args:
**kwargs (dict):
List of args above
Returns:

out (dict):

  • 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 (ndarra): time [ps]
  • directory (str): directory of results
  • log (str): name of log file
  • dt (float): timestep [ps]
  • tot_time (float): total simulated time [ps]
  • tau (int): Lag time [ps]
  • 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(**kwargs)[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.

out keys:

Args:

**kwargs (dict):

  • 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:

out (dict):

  • Jx (list)
  • Jy (list)
  • Jz (list)
  • rate (float)

Data Loaders - data

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:
dt (list(flaat)):
The timesteps found in log_file in [ps]
thermo.lammps.data.get_sim_dimensions(lammpstrj_file)[source]

Reads a LAMMPS trajectory file and extracts simulation dimensions.

Args:
lammpstrj_file (str):
LAMMPS trajectory file to extract dimensions from
Returns:
out (dict): - x (list(float)): x-dimension [angstroms] - y (list(float)): y-dimension [angstroms] - z (list(float)): z-dimension [angstroms] - area (list(float)): [angstroms^2] - volume (list(float)): [anstroms^3]

Input/Output - io

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