Simulation Class¶
This module contains the simulation class and associated functions which are meant to encapsulate a LAMMPS simulation.
-
class
simulation_class.
Simulation
(init_file, datafile, dumpfile, temp, max_disp=1.0, type_lengths=(5, 13), numtrials=5, anchortype=2, restart=False, parallel=False)[source]¶ This class encapsulates a LAMMPS simulation including its associated molecules and computes and fixes.
- Parameters
init_file (str) – The file name of the initialization LAMMPS file. This file contains all the force field parameters computes and fixes that one wishes to specify for the LAMMPS simulation.
datafile (str) – The LAMMPS data file which contains the coordinates of the atoms and bond, angle, and dihedral information.
dumpfile (str) – The filename of the file which one wishes to dump the XYZ information of the simulation.
temp (float) – The temperature which one wishes to run the simulation.
exclude (binary) – A binary value that determines whether any interactions are excluded in the simulation.
numtrials (int) – The number of trial rotations for each regrowth step in the configurationally biased moves
restart (binary) – A binary value that determines whether this is a new simulation or a restart of a previous simulation.
-
dump_atoms
()[source]¶ Dump the atom XYZ info to the dumpfile specified in the Simulation’s dumpfile variable.
-
dump_group
(group_name, filename)[source]¶ Dumps the atoms of the specified group to an XYZ file specified by filename
- Parameters
group_name (str) – The group ID of the group of atoms that one wishes to dump
filename (str) – The name of the file that the group of atoms will be dumped to. As the specified format is XYZ it is a good idea to append .xyz to the end of the filename.
-
getRandomMolecule
()[source]¶ Returns a randomly selected molecule from the LAMMPS datafile associated with the given instance.
-
get_atom_coords
()[source]¶ Returns positions of each atom in a Nx3 array
- Returns
atom_coords – A Nx3 array with each row representing an atom and the columns containing the x, ym and z coordinates in that order.
- Return type
float array
-
initializeComputes
(lmp)[source]¶ Initializes the LAMMPS computes that one wishes to use in the simulation.
-
initializeGroups
(lmp)[source]¶ Initialize the LAMMPS groups that one wishes to use in the simulation.
-
minimize
(force_tol=0.001, e_tol=1e-05, max_iter=200)[source]¶ Minimizes the system using LAMMPS minimize function.
- Parameters
force_tol (float, optional) – The force tolerance used in the minimization routine.
e_tol (float, optional) – The energy tolerance used in the minimization routine.
max_iter (int, optional) – The maximum allowed iterations in the minimization procedure.