.. _LAMMPSLmpFormat:

lammps/lmp format
=================

lmp format
==========

Class: :class:`LAMMPSLmpFormat <dpdata.plugins.lammps.LAMMPSLmpFormat>`

Conversions
-----------

.. _LAMMPSLmpFormat_from_system:

Convert from this format to System
``````````````````````````````````

.. py:function:: dpdata.System(file_name: 'FileType', type_map=None, atom_style='auto', fmt: Literal['lammps/lmp'] = None) -> dpdata.system.System
   :noindex:
.. py:function:: dpdata.System(file_name: 'FileType', type_map=None, atom_style='auto', fmt: Literal['lmp'] = None) -> dpdata.system.System
   :noindex:
.. py:function:: dpdata.System.from_lammps_lmp(file_name: 'FileType', type_map=None, atom_style='auto') -> dpdata.system.System
   :noindex:
.. py:function:: dpdata.System.from_lmp(file_name: 'FileType', type_map=None, atom_style='auto') -> dpdata.system.System
   :noindex:

   
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_name** : str or Path
        Path to LAMMPS data file

    **type_map** : list, optional
        Mapping from atom types to element names

    **atom_style** : str, 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








.. rubric:: 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


.. rubric:: 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")





.. _LAMMPSLmpFormat_to_system:

Convert from System to this format
``````````````````````````````````

.. py:function:: dpdata.System.to(fmt: Literal['lammps/lmp'], file_name: 'FileType', frame_idx=0)
   :noindex:
.. py:function:: dpdata.System.to(fmt: Literal['lammps/lmp'], file_name: 'FileType', frame_idx=0)
   :noindex:
.. py:function:: dpdata.System.to_lammps_lmp(file_name: 'FileType', frame_idx=0)
   :noindex:
.. py:function:: dpdata.System.to_lmp(file_name: 'FileType', frame_idx=0)
   :noindex:

   
Dump the system in lammps data format.


:Parameters:

    **file_name** : str
        The output file name

    **frame_idx** : int
        The index of the frame to dump


















.. _LAMMPSLmpFormat_to_labeled_system:

Convert from LabeledSystem to this format
`````````````````````````````````````````

.. py:function:: dpdata.LabeledSystem.to(fmt: Literal['lammps/lmp'], file_name: 'FileType', frame_idx=0)
   :noindex:
.. py:function:: dpdata.LabeledSystem.to(fmt: Literal['lammps/lmp'], file_name: 'FileType', frame_idx=0)
   :noindex:
.. py:function:: dpdata.LabeledSystem.to_lammps_lmp(file_name: 'FileType', frame_idx=0)
   :noindex:
.. py:function:: dpdata.LabeledSystem.to_lmp(file_name: 'FileType', frame_idx=0)
   :noindex:

   
Dump the system in lammps data format.


:Parameters:

    **file_name** : str
        The output file name

    **frame_idx** : int
        The index of the frame to dump
















