### Verify dpdata Installation Source: https://docs.deepmodeling.com/projects/dpdata/en/master/installation Execute the dpdata command with the --version flag to confirm successful installation and check the installed version. ```bash dpdata --version ``` -------------------------------- ### Install dpdata via Pip, Conda, or Source Source: https://docs.deepmodeling.com/projects/dpdata/en/master/installation Install the dpdata library using common package managers. Ensure Python 3.8+ is installed. Options include pip, conda (from conda-forge), or cloning the repository and installing from source. ```bash pip install dpdata ``` ```bash conda install -c conda-forge dpdata ``` ```bash git clone https://github.com/deepmodeling/dpdata && pip install ./dpdata ``` -------------------------------- ### Initialize BondOrderSystem from Files Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/bond_order_system Demonstrates how to initialize a BondOrderSystem object by reading chemical data from .mol or .sdf files. This functionality requires the rdkit library to be installed. ```python import dpdata system_1 = dpdata.BondOrderSystem( "tests/bond_order/CH3OH.mol", fmt="mol" ) # read from .mol file system_2 = dpdata.BondOrderSystem( "tests/bond_order/methane.sdf", fmt="sdf" ) # read from .sdf file ``` -------------------------------- ### SQMDriver Example Usage Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.plugins Demonstrates how to use the SQMDriver to predict properties of a system, specifically using the DFTB3 method. This example shows a common workflow for setting up and running calculations via the driver. ```python >>> labeled_system = system.predict(theory="DFTB3", driver="sqm") ``` -------------------------------- ### Import dpdata Module Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/system Imports the dpdata library, which is necessary for all subsequent operations. This is the first step in using dpdata for data manipulation. ```python import dpdata ``` -------------------------------- ### Access System Data Properties Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/system Demonstrates accessing various properties stored within dpdata.System or dpdata.LabeledSystem objects using dictionary-like key access. ```python coords = d_outcar["coords"] ``` -------------------------------- ### Replicate System Configuration Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/system Creates a super cell of the current atom configuration by replicating the system along specified dimensions. ```python dpdata.System("./POSCAR").replicate( ( 1, 2, 3, ) ) ``` -------------------------------- ### dpdata System and LabeledSystem Properties Reference Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/system Provides a reference for properties accessible via the `[]` operator on dpdata.System and dpdata.LabeledSystem objects, detailing their type, dimensions, and whether they are considered labels. ```APIDOC System/LabeledSystem Properties: Access data using the `[]` operator with the property key. | key | type | dimension | are labels | description | |---------------|---------------|---------------|------------|-------------------------------------------------| | 'atom_names' | list of str | ntypes | False | The name of each atom type | | 'atom_numbs' | list of int | ntypes | False | The number of atoms of each atom type | | 'atom_types' | np.ndarray | natoms | False | Array assigning type to each atom | | 'cells' | np.ndarray | nframes x 3x3 | False | The cell tensor of each frame | | 'coords' | np.ndarray | nframes x natoms x 3 | False | The atom coordinates | | 'energies' | np.ndarray | nframes | True | The frame energies | | 'forces' | np.ndarray | nframes x natoms x 3 | True | The atom forces | | 'virials' | np.ndarray | nframes x 3x3 | True | The virial tensor of each frame | ``` -------------------------------- ### Get Frames from FHI-aims Output (Python) Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.fhi_aims Extracts molecular frames from an FHI-aims output file. This function is crucial for trajectory analysis, allowing users to iterate through different atomic configurations. It supports specifying the starting frame, step size, and convergence checks. ```python def get_frames(fname, md=True, begin=0, step=1, convergence_check=True): """Gets frames from FHI-aims output file. Args: fname: The filename of the FHI-aims output. md: Boolean, whether to use markdown formatting. begin: The starting frame index. step: The step size between frames. convergence_check: Boolean, whether to perform convergence checks. Returns: A list of frames, where each frame is a dictionary or object containing atomic information. """ ``` -------------------------------- ### DeePMDHDF5Format: Example Usage Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.plugins Provides an example of how to use the dpdata library to convert data from a DeePMD NPY format to DeePMD HDF5 format. ```Python import dpdata dpdata.MultiSystems().from_deepmd_npy("data").to_deepmd_hdf5("data.hdf5") ``` -------------------------------- ### Loading and Inspecting MultiSystems Data Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/multi Demonstrates loading data into `MultiSystems` from directories and single files using `from_dir` and `from_file`, and inspecting the loaded data and individual systems. Includes examples for loading from specific files or directories with wildcards, printing system information, and accessing/dumping individual system data. ```python # load data xyz_multi_systems = dpdata.MultiSystems.from_file( file_name="tests/xyz/xyz_unittest.xyz", fmt="quip/gap/xyz" ) vasp_multi_systems = dpdata.MultiSystems.from_dir( dir_name="./mgal_outcar", file_name="OUTCAR", fmt="vasp/outcar" ) # use wildcard vasp_multi_systems = dpdata.MultiSystems.from_dir( dir_name="./mgal_outcar", file_name="*OUTCAR", fmt="vasp/outcar" ) # print the multi_system infomation print(xyz_multi_systems) print(xyz_multi_systems.systems) # return a dictionaries # print the system infomation print(xyz_multi_systems.systems["B1C9"].data) # dump a system's data to ./my_work_dir/B1C9_raw folder xyz_multi_systems.systems["B1C9"].to_deepmd_raw("./my_work_dir/B1C9_raw") # dump all systems xyz_multi_systems.to_deepmd_raw("./my_deepmd_data/") ``` -------------------------------- ### Dump MultiSystems to HDF5 Example Source: https://docs.deepmodeling.com/projects/dpdata/en/master/_sources/formats/DeePMDHDF5Format Example demonstrating how to dump a MultiSystems object to a DeePMD HDF5 file using the dpdata library. ```python import dpdata dpdata.MultiSystems().from_deepmd_npy("data").to_deepmd_hdf5("data.hdf5") ``` -------------------------------- ### dpdata.LabeledSystem Constructor and from_gaussian_log Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/GaussianLogFormat Provides documentation for initializing dpdata.LabeledSystem objects, including a general constructor and a specific method for loading data from Gaussian log files. These methods handle file parsing and system object creation. ```APIDOC dpdata.LabeledSystem(*file_name: 'FileType'*, *md=False*, *fmt: Literal['gaussian/log'] = None*) → [dpdata.system.LabeledSystem](../api/dpdata.html#dpdata.system.LabeledSystem "dpdata.system.LabeledSystem") - Initializes a LabeledSystem object by reading data from a specified file. - Parameters: - file_name: The path or file object to read data from. Type: FileType. - md: A boolean flag, defaults to False. Its specific purpose is context-dependent. - fmt: Specifies the format of the input file. Defaults to None. Supports 'gaussian/log'. - Returns: An instance of dpdata.system.LabeledSystem. dpdata.LabeledSystem.from_gaussian_log(*file_name: 'FileType'*, *md=False*) → [dpdata.system.LabeledSystem](../api/dpdata.html#dpdata.system.LabeledSystem "dpdata.system.LabeledSystem") - A convenience method to create a LabeledSystem object specifically from a Gaussian log file. - This is equivalent to calling the constructor with fmt='gaussian/log'. - Parameters: - file_name: The path or file object to the Gaussian log file. Type: FileType. - md: A boolean flag, defaults to False. - Returns: An instance of dpdata.system.LabeledSystem populated with data from the log file. ``` -------------------------------- ### DPData XYZFormat Example Usage Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.plugins A Python doctest example demonstrating how to use the `to` method of a DPData system object to convert it to the 'xyz' format and save it to a file. ```python >>> s.to("xyz", "a.xyz") ``` -------------------------------- ### dpdata System and LabeledSystem Conversion API Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/QECPTrajFormat API documentation for creating dpdata System and LabeledSystem objects from various file formats. This includes the main constructors and specific class methods for loading data, such as from_qe_cp_traj. ```APIDOC dpdata.System(*file_name*, *begin=0*, *step=1*, *fmt: Literal['qe/cp/traj'] = None*) - Constructor for creating a dpdata System object. - Parameters: - file_name: Path to the input data file. - begin: Starting frame index (default: 0). - step: Frame step size (default: 1). - fmt: Data format specifier (default: None, can be 'qe/cp/traj'). - Returns: A dpdata.system.System object. dpdata.System.from_qe_cp_traj(*file_name*, *begin=0*, *step=1*) - Class method to convert data from QE CP trajectory format to System. - Parameters: - file_name: Path to the QE CP trajectory file. - begin: Starting frame index (default: 0). - step: Frame step size (default: 1). - Returns: A dpdata.system.System object. dpdata.LabeledSystem(*file_name*, *begin=0*, *step=1*, *fmt: Literal['qe/cp/traj'] = None*) - Constructor for creating a dpdata LabeledSystem object. - Parameters: - file_name: Path to the input data file. - begin: Starting frame index (default: 0). - step: Frame step size (default: 1). - fmt: Data format specifier (default: None, can be 'qe/cp/traj'). - Returns: A dpdata.system.LabeledSystem object. dpdata.LabeledSystem.from_qe_cp_traj(*file_name*, *begin=0*, *step=1*) - Class method to convert data from QE CP trajectory format to LabeledSystem. - Parameters: - file_name: Path to the QE CP trajectory file. - begin: Starting frame index (default: 0). - step: Frame step size (default: 1). - Returns: A dpdata.system.LabeledSystem object. ``` -------------------------------- ### Initialize BondOrderSystem from RDKit Mol Object Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/bond_order_system Shows how to initialize a BondOrderSystem directly from an RDKit Mol object. This is useful when working with molecules already loaded or manipulated using the RDKit library. ```python from rdkit import Chem from rdkit.Chem import AllChem import dpdata mol = Chem.MolFromSmiles("CC") mol = Chem.AddHs(mol) AllChem.EmbedMultipleConfs(mol, 10) system = dpdata.BondOrderSystem(rdkit_mol=mol) ``` -------------------------------- ### dpdata.driver.Minimizer.get_minimizer Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Gets a specific minimizer instance. This is a static method of the Minimizer class. ```APIDOC get_minimizer(minimizer_type: str, **kwargs) Returns an instance of a specified minimizer. Parameters: minimizer_type: The type of minimizer to instantiate (e.g., 'lbfgs'). **kwargs: Arguments for the minimizer constructor. Returns: A Minimizer object. ``` -------------------------------- ### dpdata.System.get_natoms Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Gets the total number of atoms in a system. This method is available for System and its subclasses. ```APIDOC get_natoms() Returns the total number of atoms in the system. This method is part of the System class. Returns: An integer representing the number of atoms. ``` -------------------------------- ### dpdata API Documentation Overview Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/QECPTrajFormat Provides an overview of the dpdata package's API structure, detailing sub-packages for various computational chemistry and materials science tools. This serves as a central entry point for exploring the library's functionalities. ```APIDOC dpdata package - dpdata.abacus package - dpdata.amber package - dpdata.cp2k package - dpdata.deepmd package - dpdata.dftbplus package - dpdata.fhi_aims package - dpdata.gaussian package - dpdata.gromacs package - dpdata.lammps package - dpdata.openmx package - dpdata.orca package - dpdata.plugins package - dpdata.psi4 package - dpdata.pwmat package - dpdata.pymatgen package - dpdata.qe package - dpdata.rdkit package - dpdata.siesta package - dpdata.vasp package - dpdata.xyz package ``` -------------------------------- ### dpdata.driver.Minimizer.get_minimizers Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Gets a list of available minimizer types. This is a static method of the Minimizer class. ```APIDOC get_minimizers() Returns a list of available minimizer types. This is a static method of the Minimizer class. Returns: A list of strings, where each string is a supported minimizer type. ``` -------------------------------- ### dpdata.cp2k.output.Cp2kSystems.get_log_block_generator Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Gets a generator for log blocks from CP2K output. This is a method of the Cp2kSystems class. ```APIDOC get_log_block_generator() Returns a generator for parsing log blocks from CP2K output. This method is part of the Cp2kSystems class. Returns: A generator object. ``` -------------------------------- ### Python: dpdata.BondOrderSystem Constructor and from_mol_file Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/MolFormat This section details how to initialize or load data into the dpdata.BondOrderSystem class. It covers constructors and static methods for importing data, specifically mentioning .mol file formats. The methods accept file names and optional format specifiers. ```APIDOC dpdata.BondOrderSystem(*file_name*, fmt: Literal['mol_file'] = None) Converts data from a specified file format to BondOrderSystem. Parameters: file_name: The path to the input file. fmt: The format of the input file, defaults to 'mol_file'. Returns: An instance of dpdata.bond_order_system.BondOrderSystem. dpdata.BondOrderSystem(*file_name*, fmt: Literal['mol'] = None) Converts data from a specified file format to BondOrderSystem. Parameters: file_name: The path to the input file. fmt: The format of the input file, defaults to 'mol'. Returns: An instance of dpdata.bond_order_system.BondOrderSystem. dpdata.BondOrderSystem.from_mol_file(*file_name*) A class method to create a BondOrderSystem instance from a .mol file. Parameters: file_name: The path to the .mol input file. Returns: An instance of dpdata.bond_order_system.BondOrderSystem. dpdata.BondOrderSystem.from_mol(*file_name*) A class method to create a BondOrderSystem instance from a .mol file. Parameters: file_name: The path to the .mol input file. Returns: An instance of dpdata.bond_order_system.BondOrderSystem. ``` -------------------------------- ### dpdata.System.get_ntypes Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Gets the total number of atom types in a system. This method is available for System and its subclasses. ```APIDOC get_ntypes() Returns the total number of distinct atom types in the system. This method is part of the System class. Returns: An integer representing the number of atom types. ``` -------------------------------- ### Create System from QUIP GAP XYZ Files Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Methods to create DPData System objects from QUIP (Quantum Mechanical Interatomic Potentials) GAP XYZ files. These files typically contain atomic configurations and energies/forces, suitable for training interatomic potentials. ```APIDOC dpdata.system.System.from_quip_gap_xyz(filename) - Creates a System object from a QUIP GAP XYZ file. - Parameters: - filename: Path to the QUIP GAP XYZ file. - Returns: A dpdata.system.System object. dpdata.system.System.from_quip_gap_xyz_file(filename) - Creates a System object from a QUIP GAP XYZ file (alias for from_quip_gap_xyz). - Parameters: - filename: Path to the QUIP GAP XYZ file. - Returns: A dpdata.system.System object. ``` -------------------------------- ### QuipGapxyzSystems Class Methods Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.xyz Documentation for methods within the QuipGapxyzSystems class, designed to handle QuipGapxyzFile operations. Includes static methods for processing XYZ frame data. ```APIDOC dpdata.xyz.quip_gap_xyz.QuipGapxyzSystems: Bases: object deal with QuipGapxyzFile. Methods: get_block_generator() Description: Retrieves a block generator. Signature: get_block_generator() handle_single_xyz_frame(lines) Description: Handles a single frame from XYZ file lines. Signature: static handle_single_xyz_frame(lines) Parameters: lines: Input lines from the XYZ file. ``` -------------------------------- ### dpdata.MultiSystems.get_nframes Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Gets the total number of frames in a MultiSystems object. This method is available for MultiSystems and its subclasses. ```APIDOC get_nframes() Returns the total number of frames stored in the MultiSystems object. This method is part of the MultiSystems class. Returns: An integer representing the number of frames. ``` -------------------------------- ### XYZ Format Conversion Example Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/XYZFormat Demonstrates how to convert a system object to the XYZ file format using the dpdata library. ```python >>> s.to("xyz", "a.xyz") ``` -------------------------------- ### Pymatgen Molecule Conversion Source: https://docs.deepmodeling.com/projects/dpdata/en/master/_modules/dpdata/plugins/pymatgen Handles conversion between dpdata System format and Pymatgen Molecule objects. The `from_system` method processes a file to create a dpdata System, while `to_system` converts dpdata System data into a list of Pymatgen Molecules. Requires pymatgen to be installed. ```python @Format.register("pymatgen/molecule") class PyMatgenMoleculeFormat(Format): @Format.post("remove_pbc") def from_system(self, file_name, **kwargs): """Convert file to System using Pymatgen Molecule.""" try: from pymatgen.core import Molecule # noqa: F401 except ModuleNotFoundError as e: raise ImportError("No module pymatgen.Molecule") from e return dpdata.pymatgen.molecule.to_system_data(file_name) def to_system(self, data, **kwargs): """Convert System to Pymatgen Molecule obj.""" molecules = [] try: from pymatgen.core import Molecule except ModuleNotFoundError as e: raise ImportError("No module pymatgen.Molecule") from e species = [] for name, numb in zip(data["atom_names"], data["atom_numbs"]): species.extend([name] * numb) data = dpdata.system.remove_pbc(data) for ii in range(np.array(data["coords"]).shape[0]): molecule = Molecule(species, data["coords"][ii]) molecules.append(molecule) return molecules ``` -------------------------------- ### Load gromacs/gro format into dpdata.System Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/GromacsGroFormat This section covers loading data from gromacs .gro files into dpdata.System objects. It details the constructor and a specific class method for this purpose, including parameters for file input and atom name formatting. ```APIDOC dpdata.System(*file_name*, *format_atom_name=True*, *fmt: Literal['gromacs/gro'] = None*) Constructs a System object from a file. Parameters: file_name: The input file name. format_atom_name: Whether to format the atom name (default: True). fmt: The format of the input file (default: None, inferred). Returns: dpdata.system.System: The loaded system object. dpdata.System(*file_name*, *format_atom_name=True*, *fmt: Literal['gro'] = None*) Constructs a System object from a file. Parameters: file_name: The input file name. format_atom_name: Whether to format the atom name (default: True). fmt: The format of the input file (default: None, inferred). Returns: dpdata.system.System: The loaded system object. dpdata.System.from_gromacs_gro(*file_name*, *format_atom_name=True*) Loads a gromacs .gro file into a System object. Parameters: file_name: The input file name. format_atom_name: Whether to format the atom name (default: True). Returns: dpdata.system.System: The loaded system object. dpdata.System.from_gro(*file_name*, *format_atom_name=True*) Loads a .gro file into a System object. Parameters: file_name: The input file name. format_atom_name: Whether to format the atom name (default: True). Returns: dpdata.system.System: The loaded system object. Description: Loads gromacs .gro files. Supports formatting atom names. Returns a System object. ``` -------------------------------- ### Py3DMolFormat Class and Conversions Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/Py3DMolFormat Documentation for the 3Dmol format, detailing the Py3DMolFormat class and its conversion capabilities. Requires the py3Dmol library to be installed. ```APIDOC Class: dpdata.plugins.3dmol.Py3DMolFormat Description: 3DMol format. Dependencies: py3Dmol must be installed. Conversions: - Convert from System to this format - Convert from LabeledSystem to this format ``` -------------------------------- ### dpdata API Documentation Overview Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/DeePMDCompFormat Provides an entry point to the dpdata library's API documentation, listing various sub-packages that handle specific data formats and functionalities. ```APIDOC dpdata package API Documentation This section provides an overview of the dpdata package's API, detailing its various sub-packages. Sub-packages: - dpdata.abacus - dpdata.amber - dpdata.cp2k - dpdata.deepmd - dpdata.dftbplus - dpdata.fhi_aims - dpdata.gaussian - dpdata.gromacs - dpdata.lammps - dpdata.openmx - dpdata.orca - dpdata.plugins - dpdata.psi4 - dpdata.pwmat - dpdata.pymatgen - dpdata.qe - dpdata.rdkit - dpdata.siesta - dpdata.vasp - dpdata.xyz ``` -------------------------------- ### Dump Labeled Data to DeepMD Raw Format Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/system Dumps data from a LabeledSystem object to the deepmd-kit raw data format. ```python d_outcar.to("deepmd/raw", "dpmd_raw") ``` -------------------------------- ### Gaussian Input File Handling (dpdata.gaussian.gjf) Source: https://docs.deepmodeling.com/projects/dpdata/en/master/_modules/dpdata/plugins/gaussian Provides functionality to read Gaussian input files (.gjf) and generate them from system data. The `to_system` method uses `dpdata.gaussian.gjf.make_gaussian_input`. ```python from dpdata.driver import Driver from dpdata.format import Format from dpdata.utils import open_file @Format.register("gaussian/gjf") class GaussiaGJFFormat(Format): """Gaussian input file.""" def from_system(self, file_name: FileType, **kwargs): """Read Gaussian input file. Parameters ---------- file_name : str file name **kwargs : dict keyword arguments """ with open_file(file_name) as fp: text = fp.read() return dpdata.gaussian.gjf.read_gaussian_input(text) def to_system(self, data: dict, file_name: FileType, **kwargs): """Generate Gaussian input file. Parameters ---------- data : dict system data file_name : str file name **kwargs : dict Other parameters to make input files. See :meth:`dpdata.gaussian.gjf.make_gaussian_input` """ text = dpdata.gaussian.gjf.make_gaussian_input(data, **kwargs) with open_file(file_name, "w") as fp: fp.write(text) ``` -------------------------------- ### Create System from Quantum ESPRESSO Outputs Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Methods to create DPData System objects from Quantum ESPRESSO (QE) calculation outputs, specifically CP trajectory files and PW SCF outputs. These are useful for converting DFT simulation data into a format suitable for machine learning potentials. ```APIDOC dpdata.system.System.from_qe_cp_traj(filename) - Creates a System object from a Quantum ESPRESSO CP trajectory file. - Parameters: - filename: Path to the QE CP trajectory file. - Returns: A dpdata.system.System object. dpdata.system.System.from_qe_pw_scf(filename) - Creates a System object from a Quantum ESPRESSO PW SCF output file. - Parameters: - filename: Path to the QE PW SCF output file. - Returns: A dpdata.system.System object. ``` -------------------------------- ### Dump MultiSystems to HDF5 Source: https://docs.deepmodeling.com/projects/dpdata/en/master/formats/DeePMDHDF5Format Example demonstrating how to convert data from a DeePMD-npy format to a DeePMD-kit HDF5 file using the dpdata library. ```python import dpdata dpdata.MultiSystems().from_deepmd_npy("data").to_deepmd_hdf5("data.hdf5") ``` -------------------------------- ### Dump Data to VASP POSCAR Format Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/system Dumps a specific frame from a System or LabeledSystem object to a VASP POSCAR file format. ```python d_outcar.to("vasp/poscar", "POSCAR", frame_idx=-1) ``` -------------------------------- ### dpdata System Creation Methods Source: https://docs.deepmodeling.com/projects/dpdata/en/master/genindex Provides methods for creating dpdata System objects from various computational chemistry output formats. These methods are available across LabeledSystem, MultiSystems, and System classes, allowing flexible data loading. ```APIDOC dpdata.System.from_3dmol(data, **kwargs) Creates a System object from 3dmol data. dpdata.System.from_abacus_lcao_md(data, **kwargs) Creates a System object from ABACUS LCAO MD output. dpdata.System.from_abacus_lcao_relax(data, **kwargs) Creates a System object from ABACUS LCAO relax output. dpdata.System.from_abacus_lcao_scf(data, **kwargs) Creates a System object from ABACUS LCAO SCF output. dpdata.System.from_abacus_md(data, **kwargs) Creates a System object from ABACUS MD output. dpdata.System.from_abacus_pw_md(data, **kwargs) Creates a System object from ABACUS PW MD output. Parameters: data: The input data source (e.g., file path, dictionary). **kwargs: Additional keyword arguments for specific format parsing. Returns: A dpdata System object. ``` -------------------------------- ### Dump Data to LAMMPS Format Source: https://docs.deepmodeling.com/projects/dpdata/en/master/systems/system Dumps a specific frame from a System or LabeledSystem object to a LAMMPS input file format ('lammps/lmp'). ```python d_outcar.to("lammps/lmp", "conf.lmp", frame_idx=0) ``` -------------------------------- ### System Class Initialization and Basic Properties Source: https://docs.deepmodeling.com/projects/dpdata/en/master/_modules/dpdata/system This section covers the core methods for retrieving fundamental properties of the System object, such as the number of frames, atoms, atom names, and atom numbers. These methods provide essential metadata about the simulated system. ```python class System: # ... other methods ... def get_atom_names(self) -> list[str]: """Returns name of atoms.""" return self.data["atom_names"] def get_atom_types(self) -> np.ndarray: """Returns type of atoms.""" return self.data["atom_types"] def get_atom_numbs(self) -> list[int]: """Returns number of atoms.""" return self.data["atom_numbs"] def get_nframes(self) -> int: """Returns number of frames in the system.""" return len(self.data["cells"]) def get_natoms(self) -> int: """Returns total number of atoms in the system.""" return len(self.data["atom_types"]) def get_ntypes(self) -> int: """Returns number of atom types.""" # Assuming get_ntypes is intended to return the count of unique atom types # This implementation is inferred as the method body was missing. return len(set(self.get_atom_types())) ``` -------------------------------- ### DeePMDHDF5Format: Get Registered To Methods Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.plugins Retrieves a list of all registered 'to' methods available for data conversion. This method is part of the format management system. ```APIDOC dpdata.plugins.deepmd.DeePMDHDF5Format.get_to_methods() Get all registered to methods. ``` -------------------------------- ### Load Systems from File (Python) Source: https://docs.deepmodeling.com/projects/dpdata/en/master/_modules/dpdata/system The `from_file` class method provides a convenient way to create and populate a `MultiSystems` object by loading data from a single file. It requires the file name and the format of the data, accepting additional keyword arguments for the loading process. ```python @classmethod def from_file(cls, file_name, fmt: str, **kwargs: Any): """Load systems from a single file. Parameters ---------- file_name : str The path to the file containing system data. fmt : str The format of the data file (e.g., 'xyz', 'cif'). **kwargs : Any Additional keyword arguments to pass to the loading function. Returns ------- MultiSystems A MultiSystems object populated with data from the file. """ multi_systems = cls() multi_systems.load_systems_from_file(file_name=file_name, fmt=fmt, **kwargs) return multi_systems ``` -------------------------------- ### DeePMDHDF5Format: Get Registered From Methods Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.plugins Retrieves a list of all registered 'from' methods available for data conversion. This method is part of the format management system. ```APIDOC dpdata.plugins.deepmd.DeePMDHDF5Format.get_from_methods() Get all registered from methods. ``` -------------------------------- ### DPData SQMINFormat Class and Methods Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.plugins Provides API documentation for the `SQMINFormat` class, which handles input/output for semi-empirical calculations in SQM software. It details various conversion methods (from/to BondOrderSystem, LabeledSystem, MultiSystems, System) and specific methods like `to_system`. ```APIDOC class SQMINFormat(Format) Bases: Format Methods: MultiModes(): File mode for MultiSystems. from_bond_order_system(file_name, **kwargs): Implement BondOrderSystem.from that converts from this format to BondOrderSystem. from_labeled_system(file_name, **kwargs): Implement LabeledSystem.from that converts from this format to LabeledSystem. from_multi_systems(directory, **kwargs): Implement MultiSystems.from that converts from this format to MultiSystems. from_system(file_name, **kwargs): Implement System.from that converts from this format to System. get_formats(): Get all registered formats. get_from_methods(): Get all registered from methods. get_to_methods(): Get all registered to methods. mix_system(*system, type_map, **kwargs): Mix the systems into mixed_type ones according to the unified given type_map. post(func_name): Register a post function for from method. register(key): Register a format plugin. register_from(key): Register a from method if the target method name is not default. register_to(key): Register a to method if the target method name is not default. to_bond_order_system(data, rdkit_mol, *args, ...): Implement BondOrderSystem.to that converts from BondOrderSystem to this format. to_labeled_system(data, *args, **kwargs): Implement LabeledSystem.to that converts from LabeledSystem to this format. to_multi_systems(formulas, directory, **kwargs): Implement MultiSystems.to that converts from MultiSystems to this format. to_system(data[, fname, frame_idx]): Generate input files for semi-emperical calculation in sqm software. ``` -------------------------------- ### DeePMDHDF5Format: Get Registered Formats Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.plugins Retrieves a list of all registered format plugins within the dpdata library. This method is part of the format management system. ```APIDOC dpdata.plugins.deepmd.DeePMDHDF5Format.get_formats() Get all registered formats. ``` -------------------------------- ### DPData Abacus Plugin API Documentation Source: https://docs.deepmodeling.com/projects/dpdata/en/master/api/dpdata.plugins API documentation for the DPData Abacus plugin, detailing methods for loading and dumping system data in ABACUS STRU format. Includes parameter descriptions, return types, and usage examples. ```APIDOC from_system(file_name, **kwargs) Description: Implement System.from that converts from this format to System. Parameters: file_name (str): file name, i.e. the first argument **kwargs (dict): keyword arguments that will be passed from the method Returns: data (dict): system data, whose keys are defined in System.DTYPES to_system(data, file_name: FileType, frame_idx=0, **kwargs) Description: Dump the system into ABACUS STRU format file. Parameters: data (dict): System data file_name (str): The output file name frame_idx (int): The index of the frame to dump (defaults to 0) **kwargs (dict): other parameters register_mag_data(data) Description: Registers magnetic data. register_move_data(data) Description: Registers move data. ```