.. _AbacusSTRUFormat:

abacus/stru format
==================

Aliases
-------

``abacus/stru``, ``stru``

Implementation: :class:`AbacusSTRUFormat <dpdata.plugins.abacus.AbacusSTRUFormat>`

Overview
--------


ABACUS structure file.

`ABACUS <https://abacus.ustc.edu.cn/>`_ (Atomic-orbital Based Ab-initio
Computation at UStc) is an open-source DFT package based on LCAO and
plane-wave basis sets.

``STRU`` stores the cell, species, coordinates, pseudopotential/orbital
references, and optional movement or magnetic-moment fields for one
ABACUS configuration. This format reads and writes unlabeled
:class:`dpdata.System` objects.
















Quick examples
--------------

The examples use the preferred alias ``abacus/stru``; any alias listed above is equivalent.

.. code-block:: python

   import dpdata
   
   # Geometry-only data
   system = dpdata.System("input_file", fmt="abacus/stru")
   
   # Write geometry-only data
   system.to("abacus/stru", "output_path")

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

.. _AbacusSTRUFormat_from_system:

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

.. py:function:: dpdata.System(file_name, fmt: Literal['abacus/stru'] = None, **kwargs) -> dpdata.system.System
   :noindex:
.. py:function:: dpdata.System(file_name, fmt: Literal['stru'] = None, **kwargs) -> dpdata.system.System
   :noindex:
.. py:function:: dpdata.System.from_abacus_stru(file_name, **kwargs) -> dpdata.system.System
   :noindex:
.. py:function:: dpdata.System.from_stru(file_name, **kwargs) -> dpdata.system.System
   :noindex:

   
Load one ABACUS ``STRU`` file.


:Parameters:

    **file_name** : str or os.PathLike
        Input ``STRU`` file.

    **\*\*kwargs** : dict
        Additional format arguments accepted for API compatibility.



:Returns:

    System
        converted system















.. _AbacusSTRUFormat_to_system:

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

.. py:function:: dpdata.System.to(fmt: Literal['abacus/stru'], file_name: 'FileType', frame_idx=0, **kwargs)
   :noindex:
.. py:function:: dpdata.System.to(fmt: Literal['stru'], file_name: 'FileType', frame_idx=0, **kwargs)
   :noindex:
.. py:function:: dpdata.System.to_abacus_stru(file_name: 'FileType', frame_idx=0, **kwargs)
   :noindex:
.. py:function:: dpdata.System.to_stru(file_name: 'FileType', frame_idx=0, **kwargs)
   :noindex:

   
Dump the system into ABACUS STRU format file.


:Parameters:

    **file_name** : str
        The output file name

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

    **\*\*kwargs** : dict
        Additional STRU fields described below.






:Other Parameters:

    **pp_file** : list[str] or dict[str, str], optional
        Pseudopotential file for each atom type.

    **numerical_orbital** : list[str] or dict[str, str], optional
        Numerical orbital file for each atom type.

    **numerical_descriptor** : str, optional
        Numerical descriptor file used by ABACUS.

    **mass** : list[float], optional
        Atomic mass for each atom type.

    **move** : array-like, optional
        Per-frame, per-atom Cartesian movement flags.

    **velocity** : array-like, optional
        Initial Cartesian velocity for each atom.

    **mag** : array-like, optional
        Scalar or vector magnetic moment for each atom.

    **angle1, angle2** : array-like, optional
        Polar and azimuthal magnetic-moment angles for noncollinear spins.

    **sc** : array-like, optional
        Spin-constraint flags.

    **lambda_** : array-like, optional
        Spin-constraint lambda values.

    **link_file** : bool, default=False
        Write basenames and create symbolic links for referenced files.












.. _AbacusSTRUFormat_to_labeled_system:

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

.. py:function:: dpdata.LabeledSystem.to(fmt: Literal['abacus/stru'], file_name: 'FileType', frame_idx=0, **kwargs)
   :noindex:
.. py:function:: dpdata.LabeledSystem.to(fmt: Literal['stru'], file_name: 'FileType', frame_idx=0, **kwargs)
   :noindex:
.. py:function:: dpdata.LabeledSystem.to_abacus_stru(file_name: 'FileType', frame_idx=0, **kwargs)
   :noindex:
.. py:function:: dpdata.LabeledSystem.to_stru(file_name: 'FileType', frame_idx=0, **kwargs)
   :noindex:

   
Dump the system into ABACUS STRU format file.


:Parameters:

    **file_name** : str
        The output file name

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

    **\*\*kwargs** : dict
        Additional STRU fields described below.






:Other Parameters:

    **pp_file** : list[str] or dict[str, str], optional
        Pseudopotential file for each atom type.

    **numerical_orbital** : list[str] or dict[str, str], optional
        Numerical orbital file for each atom type.

    **numerical_descriptor** : str, optional
        Numerical descriptor file used by ABACUS.

    **mass** : list[float], optional
        Atomic mass for each atom type.

    **move** : array-like, optional
        Per-frame, per-atom Cartesian movement flags.

    **velocity** : array-like, optional
        Initial Cartesian velocity for each atom.

    **mag** : array-like, optional
        Scalar or vector magnetic moment for each atom.

    **angle1, angle2** : array-like, optional
        Polar and azimuthal magnetic-moment angles for noncollinear spins.

    **sc** : array-like, optional
        Spin-constraint flags.

    **lambda_** : array-like, optional
        Spin-constraint lambda values.

    **link_file** : bool, default=False
        Write basenames and create symbolic links for referenced files.










