lammps/lmp format#
lmp format#
Class: LAMMPSLmpFormat
Conversions#
Convert from this format to System#
- dpdata.System(file_name: 'FileType', type_map=None, atom_style='auto', fmt: Literal['lammps/lmp'] = None) dpdata.system.System
- dpdata.System(file_name: 'FileType', type_map=None, atom_style='auto', fmt: Literal['lmp'] = None) dpdata.system.System
- dpdata.System.from_lammps_lmp(file_name: 'FileType', type_map=None, atom_style='auto') dpdata.system.System
- dpdata.System.from_lmp(file_name: 'FileType', type_map=None, atom_style='auto') dpdata.system.System
Load LAMMPS data file to system data format.
This method supports multiple LAMMPS atom styles with automatic charge extraction and maintains backward compatibility. The parser can automatically detect the atom style from the LAMMPS data file header when possible.
- Parameters:
- file_namestr or Path
Path to LAMMPS data file
- type_maplist, optional
Mapping from atom types to element names
- atom_stylestr, optional
The LAMMPS atom style. Default is “auto” which attempts to detect the style automatically from the file. Can also be explicitly set to: atomic, full, charge, bond, angle, molecular, dipole, sphere
- Returns:
- System
converted system
Notes
Atom Style Column Layouts: - atomic: atom-ID atom-type x y z (default) - full: atom-ID molecule-ID atom-type charge x y z - charge: atom-ID atom-type charge x y z - bond: atom-ID molecule-ID atom-type x y z - angle: atom-ID molecule-ID atom-type x y z - molecular: atom-ID molecule-ID atom-type x y z - dipole: atom-ID atom-type charge x y z mux muy muz - sphere: atom-ID atom-type diameter density x y z
Examples
Load LAMMPS data with automatic detection:
>>> system = dpdata.System("data.lmp", type_map=["O", "H"])
Load with specific atom styles:
>>> # Full style with charges and molecule IDs
>>> system = dpdata.System("data.lmp", type_map=["O", "H"], atom_style="full")
>>> print(system["charges"]) # Access extracted charges
>>> # Charge style with charges only
>>> system = dpdata.System("data.lmp", type_map=["O", "H"], atom_style="charge")
>>> # Bond/molecular styles with molecule IDs
>>> system = dpdata.System("data.lmp", type_map=["O", "H"], atom_style="bond")
Convert from System to this format#
- dpdata.System.to(fmt: Literal['lammps/lmp'], file_name: 'FileType', frame_idx=0)
- dpdata.System.to(fmt: Literal['lammps/lmp'], file_name: 'FileType', frame_idx=0)
- dpdata.System.to_lammps_lmp(file_name: 'FileType', frame_idx=0)
- dpdata.System.to_lmp(file_name: 'FileType', frame_idx=0)
Dump the system in lammps data format.
- Parameters:
- file_namestr
The output file name
- frame_idxint
The index of the frame to dump
Convert from LabeledSystem to this format#
- dpdata.LabeledSystem.to(fmt: Literal['lammps/lmp'], file_name: 'FileType', frame_idx=0)
- dpdata.LabeledSystem.to(fmt: Literal['lammps/lmp'], file_name: 'FileType', frame_idx=0)
- dpdata.LabeledSystem.to_lammps_lmp(file_name: 'FileType', frame_idx=0)
- dpdata.LabeledSystem.to_lmp(file_name: 'FileType', frame_idx=0)
Dump the system in lammps data format.
- Parameters:
- file_namestr
The output file name
- frame_idxint
The index of the frame to dump