mstk.topology.LammpsData¶
- class mstk.topology.LammpsData(file, improper_center=None, **kwargs)¶
Generate topology from Lammps data file.
Atom masses, types, charges, connectivity, unit cell and atom positions are parsed. The velocities and force field parameters are ignored.
The string of atom types are assumed to be the comment after the mass. If such comment is not provided, then the string of atom types will be ‘AT1’, ‘AT2’… If any atom type has mass smaller than 1.0 and atom type comment started with ‘D’, then it will be treated as Drude particle. e.g.
>>> Masses >>> 1 1.008 # HC >>> 2 16.00 # OH >>> 3 0.800 # D
HC and OH will be treated as the atom type string of the first and second atom types. The third atom type will be treated as Drude particle.
Care should be taken for the impropers. The central atom for impropers in mstk is the first atom. But in Lammps data file, the central atom can be the first, second or third atom, depending on the improper_style. The argument improper_center controls which atom should be treated as the center atom, which is set to 1 by default.
- Parameters:
file (str) –
improper_center ([1, 2, 3, 4]) –
kwargs (dict) –
Ignored –
Examples
>>> lammps = LammpsData('data.lmp') >>> topology = lammps.topology
For improper_style cvff, the central atom is the third. Then the LammpsData should be loaded as
>>> lammps = LammpsData('data.lmp', improper_center=3)
- n_atom_type¶
Number of atom types
- Type:
int
- type_names¶
Names of these atom types
- Type:
list of str
- type_masses¶
Masses of these atom types
- Type:
list of float
- xlo¶
The origin of the cell in x direction. Not really useful
- Type:
float
- ylo¶
The origin of the cell in z direction. Not really useful
- Type:
float
- zlo¶
The origin of the cell in z direction. Not really useful
- Type:
float
Methods
__init__(file[, improper_center])