gblearn.lammps¶
Functions for interacting with LAMMPS dump files.
Functions
make_lattice (box) |
Constructs a lattice array compatible with ASE using the box dimensions specified in a lammps format. |
Classes
Dump (filepath[, stepfilter]) |
Represents a dump file that could potentially have more than one timestep. |
Timestep (filepath[, index, openf, stepfilter]) |
Represents a single time step in a LAMMPS dump file. |
API Documentation¶
Functions for interacting with LAMMPS dump files.
-
class
gblearn.lammps.
Dump
(filepath, stepfilter=None)[source] Represents a dump file that could potentially have more than one timestep.
Parameters: - filepath (str) – full path to the LAMMPS dump file to extract the time step from.
- stepfilter (list) – of int timestep values that should be parsed. If the next timestep encountered is not in this list, it will be ignored.
-
steps
¶ dict – keys are int timestep ids; values are
Timestep
.
-
dump
(filename, mode=’w’, rebox=False)[source] Dumps the specified structure to file in the LAMMPS format.
Parameters:
-
class
gblearn.lammps.
Timestep
(filepath, index=0, openf=None, stepfilter=None)[source] Represents a single time step in a LAMMPS dump file.
Parameters: - filepath (str) – full path to the LAMMPS dump file to extract the time step from.
- index (int) – index of the time step in the dump file.
- openf (file) – open file object for sequential instantiation of multiple time steps.
- stepfilter (list) – of int timestep values that should be parsed. If the next timestep encountered is not in this list, it will be ignored.
-
types
¶ numpy.ndarray – integer types of the atoms in the list.
-
ids
¶ numpy.ndarray – integer atom ids; has same length as len(self).
-
xyz
¶ numpy.ndarray – with shape (len(self), 3); float positions of the atoms in the time step.
-
periodic
¶ list – of bool specifying whether the x, y, or z directions are periodic (for the box).
-
box
¶ numpy.ndarray – with shape (3, 2) specifying the lo and hi bounds of the box in each direction. The box can also have shape (3, 3) to support non-orthogonal box vectors.
-
extras
¶ list – of str indicating extra atomic parameters that are available in this time step.
-
dump
(filename, mode=’a’, rebox=False)[source] Dumps the specified structure to file in the LAMMPS format.
Parameters:
-
gb
(Z=None, method=’median’, pattr=’c_csd’, extras=True, soapargs={}, **kwargs)[source] Returns the grain boundary for this time step.
Parameters: - Z (int or list) – element code(s) for the atomic species.
- method (str) – one of [‘median’].
- pattr (str) – name of an attribute in
extras
to pass as the selection parameter of the routine. - extras (bool) – when True, include extra attributes in the new GB structure.
- soapargs (dict) – initialization parameters for the
gblearn.soap.SOAPCalculator
instance for the GB. - kwargs (dict) – additional arguments passed to the atom selection
function. For median, see
gblearn.selection.median()
for the arguments. For cna* seegblearn.selection.cna_max()
.
Returns: - instance with only those atoms that appear
to be at the boundary.
Return type: gblearn.gb.GrainBoundary
-
gbids
(method=’median’, pattr=None, **kwargs)[source] Returns the indices of the atoms that lie at the grain boundary.
Parameters: Returns: - of integer indices of atoms in this timestep that are
considered to lie on the boundary.
Return type: numpy.ndarray
Examples
Retrieve the positions of the atoms that lie at the boundary using the median centro-symmetry parameter values.
>>> from gblearn.lammps import Timestep >>> t0 = Timestep("lammps.dump") >>> ids = t0.gbids() >>> xyz = t0.xyz[ids,:]
-
gblearn.lammps.
make_lattice
(box)[source] Constructs a lattice array compatible with ASE using the box dimensions specified in a lammps format. This was contributed by Jonathan Priedeman.
Parameters: box (numpy.ndarray) – box dimensions in cartesian directions in format lo hi. Shape (3, 2). Also supports tricilinic boxes when shape (3, 3) is specified.