.. _DeePMDMixedFormat:

deepmd/npy/mixed format
=======================

Class: :class:`DeePMDMixedFormat <dpdata.plugins.deepmd.DeePMDMixedFormat>`


Mixed type numpy format for DeePMD-kit.
Under this format, systems with the same number of atoms but different formula can be put together
for a larger system, especially when the frame numbers in systems are sparse.
This also helps to mixture the type information together for model training with type embedding network.















.. rubric:: Examples

Dump a MultiSystems into a mixed type numpy directory:

>>> import dpdata
>>> dpdata.MultiSystems(*systems).to_deepmd_npy_mixed("mixed_dir")

Dump with ``atom_numb_pad`` to reduce the number of subdirectories.
Systems are padded with virtual atoms (type -1) so that atom counts are
rounded up to the nearest multiple of the given number:

>>> dpdata.MultiSystems(*systems).to_deepmd_npy_mixed("mixed_dir", atom_numb_pad=8)

Load a mixed type data into a MultiSystems:

>>> import dpdata
>>> dpdata.MultiSystems().load_systems_from_file("mixed_dir", fmt="deepmd/npy/mixed")


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

.. _DeePMDMixedFormat_to_system:

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

.. py:function:: dpdata.System.to(fmt: Literal['deepmd/npy/mixed'], file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>)
   :noindex:
.. py:function:: dpdata.System.to_deepmd_npy_mixed(file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>)
   :noindex:

   
Dump the system in deepmd mixed type format (numpy binary) to `folder`.

The frames were already split to different systems, so these frames can be dumped to one single subfolders
    named as `folder/set.000`, containing less than `set_size` frames.

:Parameters:

    **file_name** : str
        The output folder

    **set_size** : int, default=2000
        set size

    **prec** : {numpy.float32, numpy.float64}
        The floating point precision of the compressed data


















.. _DeePMDMixedFormat_to_labeled_system:

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

.. py:function:: dpdata.LabeledSystem.to(fmt: Literal['deepmd/npy/mixed'], file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>)
   :noindex:
.. py:function:: dpdata.LabeledSystem.to_deepmd_npy_mixed(file_name, set_size: 'int' = 2000, prec=<class 'numpy.float64'>)
   :noindex:

   
Dump the system in deepmd mixed type format (numpy binary) to `folder`.

The frames were already split to different systems, so these frames can be dumped to one single subfolders
    named as `folder/set.000`, containing less than `set_size` frames.

:Parameters:

    **file_name** : str
        The output folder

    **set_size** : int, default=2000
        set size

    **prec** : {numpy.float32, numpy.float64}
        The floating point precision of the compressed data


















.. _DeePMDMixedFormat_from_multi_systems:

Convert from this format to MultiSystems
````````````````````````````````````````

.. py:function:: dpdata.MultiSystems.from_deepmd_npy_mixed(directory) -> dpdata.system.MultiSystems
   :noindex:

   
Convert this format to :class:`MultiSystems`.


:Parameters:

    **directory** : str
        directory of systems



:Returns:

    MultiSystems
        converted system















.. _DeePMDMixedFormat_to_multi_systems:

Convert from MultiSystems to this format
````````````````````````````````````````

.. py:function:: dpdata.MultiSystems.to(fmt: Literal['deepmd/npy/mixed'], directory) -> dpdata.system.MultiSystems
   :noindex:
.. py:function:: dpdata.MultiSystems.to_deepmd_npy_mixed(directory) -> dpdata.system.MultiSystems
   :noindex:

   
Convert :class:`MultiSystems` to this format.


:Parameters:

    **directory** : str
        directory to save systems



:Returns:

    MultiSystems
        this system













