From d2f9b47a49c81753a57c4053d4e3641e36280f87 Mon Sep 17 00:00:00 2001 From: OpenClaw Bot Date: Sat, 28 Feb 2026 05:10:55 +0800 Subject: [PATCH 1/7] refactor: reorganize directory structure Move all format directories (abacus, amber, cp2k, deepmd, dftbplus, fhi_aims, gaussian, gromacs, lammps, lmdb, md, openmx, orca, psi4, pwmat, pymatgen, qe, rdkit, siesta, vasp, xyz) into a new formats/ subdirectory. This addresses issue #934. Changes: - Created dpdata/formats/ directory - Moved all format directories to dpdata/formats/ - Updated all import statements throughout the codebase - Updated relative imports in format modules (from .. to from ...) - Updated dpdata/__init__.py to import from new locations - Updated tests/context.py for new import paths The plugins directory remains at the root level as requested. --- dpdata/__init__.py | 2 +- dpdata/bond_order_system.py | 12 ++++---- dpdata/formats/__init__.py | 1 + dpdata/{ => formats}/abacus/__init__.py | 0 dpdata/{ => formats}/abacus/md.py | 0 dpdata/{ => formats}/abacus/relax.py | 0 dpdata/{ => formats}/abacus/scf.py | 2 +- dpdata/{ => formats}/abacus/stru.py | 2 +- dpdata/{ => formats}/amber/__init__.py | 0 dpdata/{ => formats}/amber/mask.py | 0 dpdata/{ => formats}/amber/md.py | 4 +-- dpdata/{ => formats}/amber/sqm.py | 0 dpdata/{ => formats}/cp2k/__init__.py | 0 dpdata/{ => formats}/cp2k/cell.py | 0 dpdata/{ => formats}/cp2k/output.py | 2 +- dpdata/{ => formats}/deepmd/__init__.py | 0 dpdata/{ => formats}/deepmd/comp.py | 0 dpdata/{ => formats}/deepmd/hdf5.py | 0 dpdata/{ => formats}/deepmd/mixed.py | 0 dpdata/{ => formats}/deepmd/raw.py | 0 dpdata/{ => formats}/dftbplus/__init__.py | 0 dpdata/{ => formats}/dftbplus/output.py | 0 dpdata/{ => formats}/fhi_aims/__init__.py | 0 dpdata/{ => formats}/fhi_aims/output.py | 0 dpdata/{ => formats}/gaussian/__init__.py | 0 dpdata/{ => formats}/gaussian/fchk.py | 4 +-- dpdata/{ => formats}/gaussian/gjf.py | 0 dpdata/{ => formats}/gaussian/log.py | 4 +-- dpdata/{ => formats}/gromacs/__init__.py | 0 dpdata/{ => formats}/gromacs/gro.py | 2 +- dpdata/{ => formats}/lammps/__init__.py | 0 dpdata/{ => formats}/lammps/dump.py | 0 dpdata/{ => formats}/lammps/lmp.py | 0 dpdata/{ => formats}/lmdb/__init__.py | 0 dpdata/{ => formats}/lmdb/format.py | 0 dpdata/{ => formats}/md/__init__.py | 0 dpdata/{ => formats}/md/msd.py | 0 dpdata/{ => formats}/md/pbc.py | 0 dpdata/{ => formats}/md/rdf.py | 0 dpdata/{ => formats}/md/water.py | 0 dpdata/{ => formats}/openmx/__init__.py | 0 dpdata/{ => formats}/openmx/omx.py | 2 +- dpdata/{ => formats}/orca/__init__.py | 0 dpdata/{ => formats}/orca/output.py | 0 dpdata/{ => formats}/psi4/__init__.py | 0 dpdata/{ => formats}/psi4/input.py | 0 dpdata/{ => formats}/psi4/output.py | 0 dpdata/{ => formats}/pwmat/__init__.py | 0 dpdata/{ => formats}/pwmat/atomconfig.py | 2 +- dpdata/{ => formats}/pwmat/movement.py | 2 +- dpdata/{ => formats}/pymatgen/__init__.py | 0 dpdata/{ => formats}/pymatgen/molecule.py | 0 dpdata/{ => formats}/pymatgen/structure.py | 0 dpdata/{ => formats}/qe/__init__.py | 0 dpdata/{ => formats}/qe/scf.py | 0 dpdata/{ => formats}/qe/traj.py | 2 +- dpdata/{ => formats}/rdkit/__init__.py | 0 dpdata/{ => formats}/rdkit/sanitize.py | 0 dpdata/{ => formats}/rdkit/utils.py | 0 dpdata/{ => formats}/siesta/__init__.py | 0 dpdata/{ => formats}/siesta/aiMD_output.py | 0 dpdata/{ => formats}/siesta/output.py | 0 dpdata/{ => formats}/vasp/__init__.py | 0 dpdata/{ => formats}/vasp/outcar.py | 0 dpdata/{ => formats}/vasp/poscar.py | 0 dpdata/{ => formats}/vasp/xml.py | 0 dpdata/{ => formats}/xyz/__init__.py | 0 dpdata/{ => formats}/xyz/quip_gap_xyz.py | 0 dpdata/{ => formats}/xyz/xyz.py | 0 dpdata/plugins/3dmol.py | 2 +- dpdata/plugins/abacus.py | 14 ++++----- dpdata/plugins/amber.py | 14 ++++----- dpdata/plugins/cp2k.py | 6 ++-- dpdata/plugins/deepmd.py | 36 +++++++++++----------- dpdata/plugins/dftbplus.py | 2 +- dpdata/plugins/fhi_aims.py | 6 ++-- dpdata/plugins/gaussian.py | 18 +++++------ dpdata/plugins/gromacs.py | 8 ++--- dpdata/plugins/lammps.py | 14 ++++----- dpdata/plugins/lmdb.py | 2 +- dpdata/plugins/openmx.py | 14 ++++----- dpdata/plugins/orca.py | 2 +- dpdata/plugins/psi4.py | 4 +-- dpdata/plugins/pwmat.py | 10 +++--- dpdata/plugins/pymatgen.py | 8 ++--- dpdata/plugins/qe.py | 18 +++++------ dpdata/plugins/rdkit.py | 4 +-- dpdata/plugins/siesta.py | 12 ++++---- dpdata/plugins/vasp.py | 14 ++++----- dpdata/plugins/xyz.py | 4 +-- dpdata/system.py | 6 ++-- tests/context.py | 6 ++-- tests/test_abacus_stru_dump.py | 2 +- tests/test_lammps_lmp_dump.py | 2 +- tests/test_lammps_spin.py | 2 +- tests/test_lmdb.py | 2 +- 96 files changed, 138 insertions(+), 137 deletions(-) create mode 100644 dpdata/formats/__init__.py rename dpdata/{ => formats}/abacus/__init__.py (100%) rename dpdata/{ => formats}/abacus/md.py (100%) rename dpdata/{ => formats}/abacus/relax.py (100%) rename dpdata/{ => formats}/abacus/scf.py (99%) rename dpdata/{ => formats}/abacus/stru.py (99%) rename dpdata/{ => formats}/amber/__init__.py (100%) rename dpdata/{ => formats}/amber/mask.py (100%) rename dpdata/{ => formats}/amber/md.py (98%) rename dpdata/{ => formats}/amber/sqm.py (100%) rename dpdata/{ => formats}/cp2k/__init__.py (100%) rename dpdata/{ => formats}/cp2k/cell.py (100%) rename dpdata/{ => formats}/cp2k/output.py (99%) rename dpdata/{ => formats}/deepmd/__init__.py (100%) rename dpdata/{ => formats}/deepmd/comp.py (100%) rename dpdata/{ => formats}/deepmd/hdf5.py (100%) rename dpdata/{ => formats}/deepmd/mixed.py (100%) rename dpdata/{ => formats}/deepmd/raw.py (100%) rename dpdata/{ => formats}/dftbplus/__init__.py (100%) rename dpdata/{ => formats}/dftbplus/output.py (100%) rename dpdata/{ => formats}/fhi_aims/__init__.py (100%) rename dpdata/{ => formats}/fhi_aims/output.py (100%) rename dpdata/{ => formats}/gaussian/__init__.py (100%) rename dpdata/{ => formats}/gaussian/fchk.py (99%) rename dpdata/{ => formats}/gaussian/gjf.py (100%) rename dpdata/{ => formats}/gaussian/log.py (97%) rename dpdata/{ => formats}/gromacs/__init__.py (100%) rename dpdata/{ => formats}/gromacs/gro.py (98%) rename dpdata/{ => formats}/lammps/__init__.py (100%) rename dpdata/{ => formats}/lammps/dump.py (100%) rename dpdata/{ => formats}/lammps/lmp.py (100%) rename dpdata/{ => formats}/lmdb/__init__.py (100%) rename dpdata/{ => formats}/lmdb/format.py (100%) rename dpdata/{ => formats}/md/__init__.py (100%) rename dpdata/{ => formats}/md/msd.py (100%) rename dpdata/{ => formats}/md/pbc.py (100%) rename dpdata/{ => formats}/md/rdf.py (100%) rename dpdata/{ => formats}/md/water.py (100%) rename dpdata/{ => formats}/openmx/__init__.py (100%) rename dpdata/{ => formats}/openmx/omx.py (99%) rename dpdata/{ => formats}/orca/__init__.py (100%) rename dpdata/{ => formats}/orca/output.py (100%) rename dpdata/{ => formats}/psi4/__init__.py (100%) rename dpdata/{ => formats}/psi4/input.py (100%) rename dpdata/{ => formats}/psi4/output.py (100%) rename dpdata/{ => formats}/pwmat/__init__.py (100%) rename dpdata/{ => formats}/pwmat/atomconfig.py (98%) rename dpdata/{ => formats}/pwmat/movement.py (99%) rename dpdata/{ => formats}/pymatgen/__init__.py (100%) rename dpdata/{ => formats}/pymatgen/molecule.py (100%) rename dpdata/{ => formats}/pymatgen/structure.py (100%) rename dpdata/{ => formats}/qe/__init__.py (100%) rename dpdata/{ => formats}/qe/scf.py (100%) rename dpdata/{ => formats}/qe/traj.py (99%) rename dpdata/{ => formats}/rdkit/__init__.py (100%) rename dpdata/{ => formats}/rdkit/sanitize.py (100%) rename dpdata/{ => formats}/rdkit/utils.py (100%) rename dpdata/{ => formats}/siesta/__init__.py (100%) rename dpdata/{ => formats}/siesta/aiMD_output.py (100%) rename dpdata/{ => formats}/siesta/output.py (100%) rename dpdata/{ => formats}/vasp/__init__.py (100%) rename dpdata/{ => formats}/vasp/outcar.py (100%) rename dpdata/{ => formats}/vasp/poscar.py (100%) rename dpdata/{ => formats}/vasp/xml.py (100%) rename dpdata/{ => formats}/xyz/__init__.py (100%) rename dpdata/{ => formats}/xyz/quip_gap_xyz.py (100%) rename dpdata/{ => formats}/xyz/xyz.py (100%) diff --git a/dpdata/__init__.py b/dpdata/__init__.py index f2cd233ff..3c664179f 100644 --- a/dpdata/__init__.py +++ b/dpdata/__init__.py @@ -1,6 +1,6 @@ from __future__ import annotations -from . import lammps, md, vasp +from .formats import lammps, md, vasp from .bond_order_system import BondOrderSystem from .system import LabeledSystem, MultiSystems, System diff --git a/dpdata/bond_order_system.py b/dpdata/bond_order_system.py index 7a23acca5..db29d6b65 100644 --- a/dpdata/bond_order_system.py +++ b/dpdata/bond_order_system.py @@ -6,11 +6,11 @@ import numpy as np -import dpdata.rdkit.utils -from dpdata.rdkit.sanitize import Sanitizer +import dpdata.formats.rdkit.utils +from dpdata.formats.rdkit.sanitize import Sanitizer from dpdata.system import Axis, DataType, System -# import dpdata.rdkit.mol2 +# import dpdata.formats.rdkit.mol2 class BondOrderSystem(System): @@ -79,7 +79,7 @@ def __init__( self.sanitizer = Sanitizer(sanitize_level, raise_errors, verbose) if data: - mol = dpdata.rdkit.utils.system_data_to_mol(data) + mol = dpdata.formats.rdkit.utils.system_data_to_mol(data) self.from_rdkit_mol(mol) if file_name: self.from_fmt( @@ -161,7 +161,7 @@ def __add__(self, other): # magic method "+" operation # ''' # if isinstance(other, BondOrderSystem): - # if dpdata.rdkit.utils.check_same_molecule(self.rdkit_mol, other.rdkit_mol): + # if dpdata.formats.rdkit.utils.check_same_molecule(self.rdkit_mol, other.rdkit_mol): # self.__class__(self, data=other.data) # else: # raise RuntimeError("The two systems are not of the same topology.") @@ -171,7 +171,7 @@ def __add__(self, other): def from_rdkit_mol(self, rdkit_mol): """Initialize from a rdkit.Chem.rdchem.Mol object.""" rdkit_mol = self.sanitizer.sanitize(rdkit_mol) - self.data = dpdata.rdkit.utils.mol_to_system_data(rdkit_mol) + self.data = dpdata.formats.rdkit.utils.mol_to_system_data(rdkit_mol) self.data["bond_dict"] = dict( [(f"{int(bond[0])}-{int(bond[1])}", bond[2]) for bond in self.data["bonds"]] ) diff --git a/dpdata/formats/__init__.py b/dpdata/formats/__init__.py new file mode 100644 index 000000000..536b023e3 --- /dev/null +++ b/dpdata/formats/__init__.py @@ -0,0 +1 @@ +# Format modules for dpdata diff --git a/dpdata/abacus/__init__.py b/dpdata/formats/abacus/__init__.py similarity index 100% rename from dpdata/abacus/__init__.py rename to dpdata/formats/abacus/__init__.py diff --git a/dpdata/abacus/md.py b/dpdata/formats/abacus/md.py similarity index 100% rename from dpdata/abacus/md.py rename to dpdata/formats/abacus/md.py diff --git a/dpdata/abacus/relax.py b/dpdata/formats/abacus/relax.py similarity index 100% rename from dpdata/abacus/relax.py rename to dpdata/formats/abacus/relax.py diff --git a/dpdata/abacus/scf.py b/dpdata/formats/abacus/scf.py similarity index 99% rename from dpdata/abacus/scf.py rename to dpdata/formats/abacus/scf.py index 167d3067f..991396b65 100644 --- a/dpdata/abacus/scf.py +++ b/dpdata/formats/abacus/scf.py @@ -8,7 +8,7 @@ from dpdata.utils import open_file -from ..unit import LengthConversion, PressureConversion +from ...unit import LengthConversion, PressureConversion from .stru import get_frame_from_stru bohr2ang = LengthConversion("bohr", "angstrom").value() diff --git a/dpdata/abacus/stru.py b/dpdata/formats/abacus/stru.py similarity index 99% rename from dpdata/abacus/stru.py rename to dpdata/formats/abacus/stru.py index 50ec2cb72..0d899695b 100644 --- a/dpdata/abacus/stru.py +++ b/dpdata/formats/abacus/stru.py @@ -6,7 +6,7 @@ import numpy as np -from ..unit import LengthConversion +from ...unit import LengthConversion bohr2ang = LengthConversion("bohr", "angstrom").value() diff --git a/dpdata/amber/__init__.py b/dpdata/formats/amber/__init__.py similarity index 100% rename from dpdata/amber/__init__.py rename to dpdata/formats/amber/__init__.py diff --git a/dpdata/amber/mask.py b/dpdata/formats/amber/mask.py similarity index 100% rename from dpdata/amber/mask.py rename to dpdata/formats/amber/mask.py diff --git a/dpdata/amber/md.py b/dpdata/formats/amber/md.py similarity index 98% rename from dpdata/amber/md.py rename to dpdata/formats/amber/md.py index 06d9e2032..54c8bb8d2 100644 --- a/dpdata/amber/md.py +++ b/dpdata/formats/amber/md.py @@ -5,11 +5,11 @@ import numpy as np -from dpdata.amber.mask import pick_by_amber_mask +from dpdata.formats.amber.mask import pick_by_amber_mask from dpdata.unit import EnergyConversion from dpdata.utils import open_file -from ..periodic_table import ELEMENTS +from ...periodic_table import ELEMENTS kcalmol2eV = EnergyConversion("kcal_mol", "eV").value() symbols = ["X"] + ELEMENTS diff --git a/dpdata/amber/sqm.py b/dpdata/formats/amber/sqm.py similarity index 100% rename from dpdata/amber/sqm.py rename to dpdata/formats/amber/sqm.py diff --git a/dpdata/cp2k/__init__.py b/dpdata/formats/cp2k/__init__.py similarity index 100% rename from dpdata/cp2k/__init__.py rename to dpdata/formats/cp2k/__init__.py diff --git a/dpdata/cp2k/cell.py b/dpdata/formats/cp2k/cell.py similarity index 100% rename from dpdata/cp2k/cell.py rename to dpdata/formats/cp2k/cell.py diff --git a/dpdata/cp2k/output.py b/dpdata/formats/cp2k/output.py similarity index 99% rename from dpdata/cp2k/output.py rename to dpdata/formats/cp2k/output.py index bf575f728..e5ee733c9 100644 --- a/dpdata/cp2k/output.py +++ b/dpdata/formats/cp2k/output.py @@ -7,7 +7,7 @@ import numpy as np -from ..unit import ( +from ...unit import ( EnergyConversion, ForceConversion, LengthConversion, diff --git a/dpdata/deepmd/__init__.py b/dpdata/formats/deepmd/__init__.py similarity index 100% rename from dpdata/deepmd/__init__.py rename to dpdata/formats/deepmd/__init__.py diff --git a/dpdata/deepmd/comp.py b/dpdata/formats/deepmd/comp.py similarity index 100% rename from dpdata/deepmd/comp.py rename to dpdata/formats/deepmd/comp.py diff --git a/dpdata/deepmd/hdf5.py b/dpdata/formats/deepmd/hdf5.py similarity index 100% rename from dpdata/deepmd/hdf5.py rename to dpdata/formats/deepmd/hdf5.py diff --git a/dpdata/deepmd/mixed.py b/dpdata/formats/deepmd/mixed.py similarity index 100% rename from dpdata/deepmd/mixed.py rename to dpdata/formats/deepmd/mixed.py diff --git a/dpdata/deepmd/raw.py b/dpdata/formats/deepmd/raw.py similarity index 100% rename from dpdata/deepmd/raw.py rename to dpdata/formats/deepmd/raw.py diff --git a/dpdata/dftbplus/__init__.py b/dpdata/formats/dftbplus/__init__.py similarity index 100% rename from dpdata/dftbplus/__init__.py rename to dpdata/formats/dftbplus/__init__.py diff --git a/dpdata/dftbplus/output.py b/dpdata/formats/dftbplus/output.py similarity index 100% rename from dpdata/dftbplus/output.py rename to dpdata/formats/dftbplus/output.py diff --git a/dpdata/fhi_aims/__init__.py b/dpdata/formats/fhi_aims/__init__.py similarity index 100% rename from dpdata/fhi_aims/__init__.py rename to dpdata/formats/fhi_aims/__init__.py diff --git a/dpdata/fhi_aims/output.py b/dpdata/formats/fhi_aims/output.py similarity index 100% rename from dpdata/fhi_aims/output.py rename to dpdata/formats/fhi_aims/output.py diff --git a/dpdata/gaussian/__init__.py b/dpdata/formats/gaussian/__init__.py similarity index 100% rename from dpdata/gaussian/__init__.py rename to dpdata/formats/gaussian/__init__.py diff --git a/dpdata/gaussian/fchk.py b/dpdata/formats/gaussian/fchk.py similarity index 99% rename from dpdata/gaussian/fchk.py rename to dpdata/formats/gaussian/fchk.py index 816a999ce..ab882cc21 100644 --- a/dpdata/gaussian/fchk.py +++ b/dpdata/formats/gaussian/fchk.py @@ -9,8 +9,8 @@ if TYPE_CHECKING: from dpdata.utils import FileType -from ..periodic_table import ELEMENTS -from ..unit import ( +from ...periodic_table import ELEMENTS +from ...unit import ( EnergyConversion, ForceConversion, HessianConversion, diff --git a/dpdata/gaussian/gjf.py b/dpdata/formats/gaussian/gjf.py similarity index 100% rename from dpdata/gaussian/gjf.py rename to dpdata/formats/gaussian/gjf.py diff --git a/dpdata/gaussian/log.py b/dpdata/formats/gaussian/log.py similarity index 97% rename from dpdata/gaussian/log.py rename to dpdata/formats/gaussian/log.py index 08a65b9dc..a94141901 100644 --- a/dpdata/gaussian/log.py +++ b/dpdata/formats/gaussian/log.py @@ -9,8 +9,8 @@ if TYPE_CHECKING: from dpdata.utils import FileType -from ..periodic_table import ELEMENTS -from ..unit import EnergyConversion, ForceConversion, LengthConversion +from ...periodic_table import ELEMENTS +from ...unit import EnergyConversion, ForceConversion, LengthConversion length_convert = LengthConversion("bohr", "angstrom").value() energy_convert = EnergyConversion("hartree", "eV").value() diff --git a/dpdata/gromacs/__init__.py b/dpdata/formats/gromacs/__init__.py similarity index 100% rename from dpdata/gromacs/__init__.py rename to dpdata/formats/gromacs/__init__.py diff --git a/dpdata/gromacs/gro.py b/dpdata/formats/gromacs/gro.py similarity index 98% rename from dpdata/gromacs/gro.py rename to dpdata/formats/gromacs/gro.py index fe83e0c5c..0c61544fd 100644 --- a/dpdata/gromacs/gro.py +++ b/dpdata/formats/gromacs/gro.py @@ -11,7 +11,7 @@ if TYPE_CHECKING: from dpdata.utils import FileType -from ..unit import LengthConversion +from ...unit import LengthConversion nm2ang = LengthConversion("nm", "angstrom").value() ang2nm = LengthConversion("angstrom", "nm").value() diff --git a/dpdata/lammps/__init__.py b/dpdata/formats/lammps/__init__.py similarity index 100% rename from dpdata/lammps/__init__.py rename to dpdata/formats/lammps/__init__.py diff --git a/dpdata/lammps/dump.py b/dpdata/formats/lammps/dump.py similarity index 100% rename from dpdata/lammps/dump.py rename to dpdata/formats/lammps/dump.py diff --git a/dpdata/lammps/lmp.py b/dpdata/formats/lammps/lmp.py similarity index 100% rename from dpdata/lammps/lmp.py rename to dpdata/formats/lammps/lmp.py diff --git a/dpdata/lmdb/__init__.py b/dpdata/formats/lmdb/__init__.py similarity index 100% rename from dpdata/lmdb/__init__.py rename to dpdata/formats/lmdb/__init__.py diff --git a/dpdata/lmdb/format.py b/dpdata/formats/lmdb/format.py similarity index 100% rename from dpdata/lmdb/format.py rename to dpdata/formats/lmdb/format.py diff --git a/dpdata/md/__init__.py b/dpdata/formats/md/__init__.py similarity index 100% rename from dpdata/md/__init__.py rename to dpdata/formats/md/__init__.py diff --git a/dpdata/md/msd.py b/dpdata/formats/md/msd.py similarity index 100% rename from dpdata/md/msd.py rename to dpdata/formats/md/msd.py diff --git a/dpdata/md/pbc.py b/dpdata/formats/md/pbc.py similarity index 100% rename from dpdata/md/pbc.py rename to dpdata/formats/md/pbc.py diff --git a/dpdata/md/rdf.py b/dpdata/formats/md/rdf.py similarity index 100% rename from dpdata/md/rdf.py rename to dpdata/formats/md/rdf.py diff --git a/dpdata/md/water.py b/dpdata/formats/md/water.py similarity index 100% rename from dpdata/md/water.py rename to dpdata/formats/md/water.py diff --git a/dpdata/openmx/__init__.py b/dpdata/formats/openmx/__init__.py similarity index 100% rename from dpdata/openmx/__init__.py rename to dpdata/formats/openmx/__init__.py diff --git a/dpdata/openmx/omx.py b/dpdata/formats/openmx/omx.py similarity index 99% rename from dpdata/openmx/omx.py rename to dpdata/formats/openmx/omx.py index 89f853687..16368eb2f 100644 --- a/dpdata/openmx/omx.py +++ b/dpdata/formats/openmx/omx.py @@ -10,7 +10,7 @@ if TYPE_CHECKING: from dpdata.utils import FileType -from ..unit import ( +from ...unit import ( EnergyConversion, ForceConversion, LengthConversion, diff --git a/dpdata/orca/__init__.py b/dpdata/formats/orca/__init__.py similarity index 100% rename from dpdata/orca/__init__.py rename to dpdata/formats/orca/__init__.py diff --git a/dpdata/orca/output.py b/dpdata/formats/orca/output.py similarity index 100% rename from dpdata/orca/output.py rename to dpdata/formats/orca/output.py diff --git a/dpdata/psi4/__init__.py b/dpdata/formats/psi4/__init__.py similarity index 100% rename from dpdata/psi4/__init__.py rename to dpdata/formats/psi4/__init__.py diff --git a/dpdata/psi4/input.py b/dpdata/formats/psi4/input.py similarity index 100% rename from dpdata/psi4/input.py rename to dpdata/formats/psi4/input.py diff --git a/dpdata/psi4/output.py b/dpdata/formats/psi4/output.py similarity index 100% rename from dpdata/psi4/output.py rename to dpdata/formats/psi4/output.py diff --git a/dpdata/pwmat/__init__.py b/dpdata/formats/pwmat/__init__.py similarity index 100% rename from dpdata/pwmat/__init__.py rename to dpdata/formats/pwmat/__init__.py diff --git a/dpdata/pwmat/atomconfig.py b/dpdata/formats/pwmat/atomconfig.py similarity index 98% rename from dpdata/pwmat/atomconfig.py rename to dpdata/formats/pwmat/atomconfig.py index 5f01c8409..11677b0ef 100644 --- a/dpdata/pwmat/atomconfig.py +++ b/dpdata/formats/pwmat/atomconfig.py @@ -3,7 +3,7 @@ import numpy as np -from ..periodic_table import ELEMENTS +from ...periodic_table import ELEMENTS def _to_system_data_lower(lines): diff --git a/dpdata/pwmat/movement.py b/dpdata/formats/pwmat/movement.py similarity index 99% rename from dpdata/pwmat/movement.py rename to dpdata/formats/pwmat/movement.py index ccfd819db..a0f28e64b 100644 --- a/dpdata/pwmat/movement.py +++ b/dpdata/formats/pwmat/movement.py @@ -4,7 +4,7 @@ import numpy as np -from ..periodic_table import ELEMENTS +from ...periodic_table import ELEMENTS def system_info(lines, type_idx_zero=False): diff --git a/dpdata/pymatgen/__init__.py b/dpdata/formats/pymatgen/__init__.py similarity index 100% rename from dpdata/pymatgen/__init__.py rename to dpdata/formats/pymatgen/__init__.py diff --git a/dpdata/pymatgen/molecule.py b/dpdata/formats/pymatgen/molecule.py similarity index 100% rename from dpdata/pymatgen/molecule.py rename to dpdata/formats/pymatgen/molecule.py diff --git a/dpdata/pymatgen/structure.py b/dpdata/formats/pymatgen/structure.py similarity index 100% rename from dpdata/pymatgen/structure.py rename to dpdata/formats/pymatgen/structure.py diff --git a/dpdata/qe/__init__.py b/dpdata/formats/qe/__init__.py similarity index 100% rename from dpdata/qe/__init__.py rename to dpdata/formats/qe/__init__.py diff --git a/dpdata/qe/scf.py b/dpdata/formats/qe/scf.py similarity index 100% rename from dpdata/qe/scf.py rename to dpdata/formats/qe/scf.py diff --git a/dpdata/qe/traj.py b/dpdata/formats/qe/traj.py similarity index 99% rename from dpdata/qe/traj.py rename to dpdata/formats/qe/traj.py index aa12ebb8d..382d3acfa 100644 --- a/dpdata/qe/traj.py +++ b/dpdata/formats/qe/traj.py @@ -13,7 +13,7 @@ import os -from ..unit import ( +from ...unit import ( EnergyConversion, ForceConversion, LengthConversion, diff --git a/dpdata/rdkit/__init__.py b/dpdata/formats/rdkit/__init__.py similarity index 100% rename from dpdata/rdkit/__init__.py rename to dpdata/formats/rdkit/__init__.py diff --git a/dpdata/rdkit/sanitize.py b/dpdata/formats/rdkit/sanitize.py similarity index 100% rename from dpdata/rdkit/sanitize.py rename to dpdata/formats/rdkit/sanitize.py diff --git a/dpdata/rdkit/utils.py b/dpdata/formats/rdkit/utils.py similarity index 100% rename from dpdata/rdkit/utils.py rename to dpdata/formats/rdkit/utils.py diff --git a/dpdata/siesta/__init__.py b/dpdata/formats/siesta/__init__.py similarity index 100% rename from dpdata/siesta/__init__.py rename to dpdata/formats/siesta/__init__.py diff --git a/dpdata/siesta/aiMD_output.py b/dpdata/formats/siesta/aiMD_output.py similarity index 100% rename from dpdata/siesta/aiMD_output.py rename to dpdata/formats/siesta/aiMD_output.py diff --git a/dpdata/siesta/output.py b/dpdata/formats/siesta/output.py similarity index 100% rename from dpdata/siesta/output.py rename to dpdata/formats/siesta/output.py diff --git a/dpdata/vasp/__init__.py b/dpdata/formats/vasp/__init__.py similarity index 100% rename from dpdata/vasp/__init__.py rename to dpdata/formats/vasp/__init__.py diff --git a/dpdata/vasp/outcar.py b/dpdata/formats/vasp/outcar.py similarity index 100% rename from dpdata/vasp/outcar.py rename to dpdata/formats/vasp/outcar.py diff --git a/dpdata/vasp/poscar.py b/dpdata/formats/vasp/poscar.py similarity index 100% rename from dpdata/vasp/poscar.py rename to dpdata/formats/vasp/poscar.py diff --git a/dpdata/vasp/xml.py b/dpdata/formats/vasp/xml.py similarity index 100% rename from dpdata/vasp/xml.py rename to dpdata/formats/vasp/xml.py diff --git a/dpdata/xyz/__init__.py b/dpdata/formats/xyz/__init__.py similarity index 100% rename from dpdata/xyz/__init__.py rename to dpdata/formats/xyz/__init__.py diff --git a/dpdata/xyz/quip_gap_xyz.py b/dpdata/formats/xyz/quip_gap_xyz.py similarity index 100% rename from dpdata/xyz/quip_gap_xyz.py rename to dpdata/formats/xyz/quip_gap_xyz.py diff --git a/dpdata/xyz/xyz.py b/dpdata/formats/xyz/xyz.py similarity index 100% rename from dpdata/xyz/xyz.py rename to dpdata/formats/xyz/xyz.py diff --git a/dpdata/plugins/3dmol.py b/dpdata/plugins/3dmol.py index 56ec25161..d3ce0e9a7 100644 --- a/dpdata/plugins/3dmol.py +++ b/dpdata/plugins/3dmol.py @@ -3,7 +3,7 @@ import numpy as np from dpdata.format import Format -from dpdata.xyz.xyz import coord_to_xyz +from dpdata.formats.xyz.xyz import coord_to_xyz @Format.register("3dmol") diff --git a/dpdata/plugins/abacus.py b/dpdata/plugins/abacus.py index 0423bda58..cdf1ae8ce 100644 --- a/dpdata/plugins/abacus.py +++ b/dpdata/plugins/abacus.py @@ -5,10 +5,10 @@ import numpy as np -import dpdata.abacus.md -import dpdata.abacus.relax -import dpdata.abacus.scf -from dpdata.abacus.stru import get_frame_from_stru, make_unlabeled_stru +import dpdata.formats.abacus.md +import dpdata.formats.abacus.relax +import dpdata.formats.abacus.scf +from dpdata.formats.abacus.stru import get_frame_from_stru, make_unlabeled_stru from dpdata.data_type import Axis, DataType from dpdata.format import Format from dpdata.utils import open_file @@ -90,7 +90,7 @@ def register_move_data(data): class AbacusSCFFormat(Format): # @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, **kwargs): - data = dpdata.abacus.scf.get_frame(file_name) + data = dpdata.formats.abacus.scf.get_frame(file_name) register_mag_data(data) register_move_data(data) return data @@ -102,7 +102,7 @@ def from_labeled_system(self, file_name, **kwargs): class AbacusMDFormat(Format): # @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, **kwargs): - data = dpdata.abacus.md.get_frame(file_name) + data = dpdata.formats.abacus.md.get_frame(file_name) register_mag_data(data) register_move_data(data) return data @@ -114,7 +114,7 @@ def from_labeled_system(self, file_name, **kwargs): class AbacusRelaxFormat(Format): # @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, **kwargs): - data = dpdata.abacus.relax.get_frame(file_name) + data = dpdata.formats.abacus.relax.get_frame(file_name) register_mag_data(data) register_move_data(data) return data diff --git a/dpdata/plugins/amber.py b/dpdata/plugins/amber.py index c51af3465..60cfc393c 100644 --- a/dpdata/plugins/amber.py +++ b/dpdata/plugins/amber.py @@ -4,8 +4,8 @@ import subprocess as sp import tempfile -import dpdata.amber.md -import dpdata.amber.sqm +import dpdata.formats.amber.md +import dpdata.formats.amber.sqm from dpdata.driver import Driver, Minimizer from dpdata.format import Format from dpdata.utils import open_file @@ -26,7 +26,7 @@ def from_system( parm7_file = file_name + ".parm7" if nc_file is None: nc_file = file_name + ".nc" - return dpdata.amber.md.read_amber_traj( + return dpdata.formats.amber.md.read_amber_traj( parm7_file=parm7_file, nc_file=nc_file, use_element_symbols=use_element_symbols, @@ -55,7 +55,7 @@ def from_labeled_system( mden_file = file_name + ".mden" if mdout_file is None: mdout_file = file_name + ".mdout" - return dpdata.amber.md.read_amber_traj( + return dpdata.formats.amber.md.read_amber_traj( parm7_file, nc_file, mdfrc_file, mden_file, mdout_file, use_element_symbols ) @@ -64,11 +64,11 @@ def from_labeled_system( class SQMOutFormat(Format): def from_system(self, fname, **kwargs): """Read from ambertools sqm.out.""" - return dpdata.amber.sqm.parse_sqm_out(fname) + return dpdata.formats.amber.sqm.parse_sqm_out(fname) def from_labeled_system(self, fname, **kwargs): """Read from ambertools sqm.out.""" - data = dpdata.amber.sqm.parse_sqm_out(fname) + data = dpdata.formats.amber.sqm.parse_sqm_out(fname) assert "forces" in list(data.keys()), f"No forces in {fname}" return data @@ -104,7 +104,7 @@ def to_system(self, data, fname=None, frame_idx=0, **kwargs): mult : int, default=1 multiplicity. Only 1 is allowed. """ - return dpdata.amber.sqm.make_sqm_in(data, fname, frame_idx, **kwargs) + return dpdata.formats.amber.sqm.make_sqm_in(data, fname, frame_idx, **kwargs) @Driver.register("sqm") diff --git a/dpdata/plugins/cp2k.py b/dpdata/plugins/cp2k.py index f5c1b5394..3f438ad1f 100644 --- a/dpdata/plugins/cp2k.py +++ b/dpdata/plugins/cp2k.py @@ -2,8 +2,8 @@ import glob -import dpdata.cp2k.output -from dpdata.cp2k.output import Cp2kSystems +import dpdata.formats.cp2k.output +from dpdata.formats.cp2k.output import Cp2kSystems from dpdata.format import Format string_warning = """ @@ -42,7 +42,7 @@ def from_labeled_system(self, file_name, restart=False, **kwargs): data["energies"], data["forces"], tmp_virial, - ) = dpdata.cp2k.output.get_frames(file_name) + ) = dpdata.formats.cp2k.output.get_frames(file_name) if tmp_virial is not None: data["virials"] = tmp_virial return data diff --git a/dpdata/plugins/deepmd.py b/dpdata/plugins/deepmd.py index 860f52d02..24189806a 100644 --- a/dpdata/plugins/deepmd.py +++ b/dpdata/plugins/deepmd.py @@ -6,10 +6,10 @@ import numpy as np import dpdata -import dpdata.deepmd.comp -import dpdata.deepmd.hdf5 -import dpdata.deepmd.mixed -import dpdata.deepmd.raw +import dpdata.formats.deepmd.comp +import dpdata.formats.deepmd.hdf5 +import dpdata.formats.deepmd.mixed +import dpdata.formats.deepmd.raw from dpdata.data_type import Axis, DataType from dpdata.driver import Driver from dpdata.format import Format @@ -45,17 +45,17 @@ def register_spin(): class DeePMDRawFormat(Format): def from_system(self, file_name, type_map=None, **kwargs): register_spin() - return dpdata.deepmd.raw.to_system_data( + return dpdata.formats.deepmd.raw.to_system_data( file_name, type_map=type_map, labels=False ) def to_system(self, data, file_name, **kwargs): """Dump the system in deepmd raw format to directory `file_name`.""" - dpdata.deepmd.raw.dump(file_name, data) + dpdata.formats.deepmd.raw.dump(file_name, data) def from_labeled_system(self, file_name, type_map=None, **kwargs): register_spin() - return dpdata.deepmd.raw.to_system_data( + return dpdata.formats.deepmd.raw.to_system_data( file_name, type_map=type_map, labels=True ) @@ -67,7 +67,7 @@ def from_labeled_system(self, file_name, type_map=None, **kwargs): class DeePMDCompFormat(Format): def from_system(self, file_name, type_map=None, **kwargs): register_spin() - return dpdata.deepmd.comp.to_system_data( + return dpdata.formats.deepmd.comp.to_system_data( file_name, type_map=type_map, labels=False ) @@ -92,11 +92,11 @@ def to_system(self, data, file_name, set_size=5000, prec=np.float64, **kwargs): **kwargs : dict other parameters """ - dpdata.deepmd.comp.dump(file_name, data, set_size=set_size, comp_prec=prec) + dpdata.formats.deepmd.comp.dump(file_name, data, set_size=set_size, comp_prec=prec) def from_labeled_system(self, file_name, type_map=None, **kwargs): register_spin() - return dpdata.deepmd.comp.to_system_data( + return dpdata.formats.deepmd.comp.to_system_data( file_name, type_map=type_map, labels=True ) @@ -130,7 +130,7 @@ class DeePMDMixedFormat(Format): """ def from_system_mix(self, file_name, type_map=None, **kwargs): - return dpdata.deepmd.mixed.to_system_data( + return dpdata.formats.deepmd.mixed.to_system_data( file_name, type_map=type_map, labels=False ) @@ -155,10 +155,10 @@ def to_system( **kwargs : dict other parameters """ - dpdata.deepmd.mixed.dump(file_name, data, set_size=set_size, comp_prec=prec) + dpdata.formats.deepmd.mixed.dump(file_name, data, set_size=set_size, comp_prec=prec) def from_labeled_system_mix(self, file_name, type_map=None, **kwargs): - return dpdata.deepmd.mixed.to_system_data( + return dpdata.formats.deepmd.mixed.to_system_data( file_name, type_map=type_map, labels=True ) @@ -193,7 +193,7 @@ def mix_system(self, *system, type_map, atom_numb_pad=None, **kwargs): >>> import dpdata >>> dpdata.MultiSystems(*systems).to_deepmd_npy_mixed("mixed_dir", atom_numb_pad=8) """ - return dpdata.deepmd.mixed.mix_system( + return dpdata.formats.deepmd.mixed.mix_system( *system, type_map=type_map, atom_numb_pad=atom_numb_pad, **kwargs ) @@ -257,14 +257,14 @@ def _from_system( register_spin() if isinstance(file_name, (h5py.Group, h5py.File)): - return dpdata.deepmd.hdf5.to_system_data( + return dpdata.formats.deepmd.hdf5.to_system_data( file_name, "", type_map=type_map, labels=labels ) elif isinstance(file_name, str): s = file_name.split("#") name = s[1] if len(s) > 1 else "" with h5py.File(s[0], "r") as f: - return dpdata.deepmd.hdf5.to_system_data( + return dpdata.formats.deepmd.hdf5.to_system_data( f, name, type_map=type_map, labels=labels ) else: @@ -357,14 +357,14 @@ def to_system( import h5py if isinstance(file_name, (h5py.Group, h5py.File)): - dpdata.deepmd.hdf5.dump( + dpdata.formats.deepmd.hdf5.dump( file_name, "", data, set_size=set_size, comp_prec=comp_prec ) elif isinstance(file_name, str): s = file_name.split("#") name = s[1] if len(s) > 1 else "" with h5py.File(s[0], "w") as f: - dpdata.deepmd.hdf5.dump( + dpdata.formats.deepmd.hdf5.dump( f, name, data, set_size=set_size, comp_prec=comp_prec ) else: diff --git a/dpdata/plugins/dftbplus.py b/dpdata/plugins/dftbplus.py index 247fedc9e..0001a85e1 100644 --- a/dpdata/plugins/dftbplus.py +++ b/dpdata/plugins/dftbplus.py @@ -2,7 +2,7 @@ import numpy as np -from dpdata.dftbplus.output import read_dftb_plus +from dpdata.formats.dftbplus.output import read_dftb_plus from dpdata.format import Format from dpdata.unit import EnergyConversion, ForceConversion diff --git a/dpdata/plugins/fhi_aims.py b/dpdata/plugins/fhi_aims.py index 3c198aff6..cb403e16a 100644 --- a/dpdata/plugins/fhi_aims.py +++ b/dpdata/plugins/fhi_aims.py @@ -1,6 +1,6 @@ from __future__ import annotations -import dpdata.fhi_aims.output +import dpdata.formats.fhi_aims.output from dpdata.format import Format @@ -20,7 +20,7 @@ def from_labeled_system( data["energies"], data["forces"], tmp_virial, - ) = dpdata.fhi_aims.output.get_frames( + ) = dpdata.formats.fhi_aims.output.get_frames( file_name, md=md, begin=begin, @@ -45,7 +45,7 @@ def from_labeled_system(self, file_name, **kwargs): data["energies"], data["forces"], tmp_virial, - ) = dpdata.fhi_aims.output.get_frames(file_name, md=False, begin=0, step=1) + ) = dpdata.formats.fhi_aims.output.get_frames(file_name, md=False, begin=0, step=1) if tmp_virial is not None: data["virials"] = tmp_virial return data diff --git a/dpdata/plugins/gaussian.py b/dpdata/plugins/gaussian.py index d2c0f7237..bfc8b273d 100644 --- a/dpdata/plugins/gaussian.py +++ b/dpdata/plugins/gaussian.py @@ -7,9 +7,9 @@ import numpy as np -import dpdata.gaussian.fchk -import dpdata.gaussian.gjf -import dpdata.gaussian.log +import dpdata.formats.gaussian.fchk +import dpdata.formats.gaussian.gjf +import dpdata.formats.gaussian.log from dpdata.data_type import Axis, DataType from dpdata.driver import Driver from dpdata.format import Format @@ -35,7 +35,7 @@ def register_hessian_data(data): class GaussianLogFormat(Format): def from_labeled_system(self, file_name: FileType, md=False, **kwargs): try: - return dpdata.gaussian.log.to_system_data(file_name, md=md) + return dpdata.formats.gaussian.log.to_system_data(file_name, md=md) except AssertionError: return {"energies": [], "forces": [], "nopbc": True} @@ -46,7 +46,7 @@ def from_labeled_system( self, file_name: FileType, has_forces=True, has_hessian=True, **kwargs ): try: - data = dpdata.gaussian.fchk.to_system_data( + data = dpdata.formats.gaussian.fchk.to_system_data( file_name, has_forces=has_forces, has_hessian=has_hessian ) register_hessian_data(data) @@ -77,7 +77,7 @@ def from_system(self, file_name: FileType, **kwargs): """ with open_file(file_name) as fp: text = fp.read() - return dpdata.gaussian.gjf.read_gaussian_input(text) + return dpdata.formats.gaussian.gjf.read_gaussian_input(text) def to_system(self, data: dict, file_name: FileType, **kwargs): """Generate Gaussian input file. @@ -89,9 +89,9 @@ def to_system(self, data: dict, file_name: FileType, **kwargs): file_name : str file name **kwargs : dict - Other parameters to make input files. See :meth:`dpdata.gaussian.gjf.make_gaussian_input` + Other parameters to make input files. See :meth:`dpdata.formats.gaussian.gjf.make_gaussian_input` """ - text = dpdata.gaussian.gjf.make_gaussian_input(data, **kwargs) + text = dpdata.formats.gaussian.gjf.make_gaussian_input(data, **kwargs) with open_file(file_name, "w") as fp: fp.write(text) @@ -108,7 +108,7 @@ class GaussianDriver(Driver): gaussian_exec : str, default=g16 path to gaussian program **kwargs : dict - other arguments to make input files. See :meth:`dpdata.gaussian.gjf.make_gaussian_input` + other arguments to make input files. See :meth:`dpdata.formats.gaussian.gjf.make_gaussian_input` Examples -------- diff --git a/dpdata/plugins/gromacs.py b/dpdata/plugins/gromacs.py index a7066bbcc..c2c417df1 100644 --- a/dpdata/plugins/gromacs.py +++ b/dpdata/plugins/gromacs.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING -import dpdata.gromacs.gro +import dpdata.formats.gromacs.gro from dpdata.format import Format from dpdata.utils import open_file @@ -25,7 +25,7 @@ def from_system(self, file_name, format_atom_name=True, **kwargs): **kwargs : dict other parameters """ - return dpdata.gromacs.gro.file_to_system_data( + return dpdata.formats.gromacs.gro.file_to_system_data( file_name, format_atom_name=format_atom_name, **kwargs ) @@ -49,11 +49,11 @@ def to_system( if frame_idx == -1: strs = [] for idx in range(data["coords"].shape[0]): - gro_str = dpdata.gromacs.gro.from_system_data(data, f_idx=idx, **kwargs) + gro_str = dpdata.formats.gromacs.gro.from_system_data(data, f_idx=idx, **kwargs) strs.append(gro_str) gro_str = "\n".join(strs) else: - gro_str = dpdata.gromacs.gro.from_system_data( + gro_str = dpdata.formats.gromacs.gro.from_system_data( data, f_idx=frame_idx, **kwargs ) diff --git a/dpdata/plugins/lammps.py b/dpdata/plugins/lammps.py index b00d4ff0c..c99555fc1 100644 --- a/dpdata/plugins/lammps.py +++ b/dpdata/plugins/lammps.py @@ -4,8 +4,8 @@ import numpy as np -import dpdata.lammps.dump -import dpdata.lammps.lmp +import dpdata.formats.lammps.dump +import dpdata.formats.lammps.lmp from dpdata.data_type import Axis, DataType from dpdata.format import Format from dpdata.utils import open_file @@ -103,7 +103,7 @@ def from_system( """ with open_file(file_name) as fp: lines = [line.rstrip("\n") for line in fp] - data = dpdata.lammps.lmp.to_system_data(lines, type_map, atom_style=atom_style) + data = dpdata.formats.lammps.lmp.to_system_data(lines, type_map, atom_style=atom_style) register_spin(data) register_charge(data) return data @@ -123,7 +123,7 @@ def to_system(self, data, file_name: FileType, frame_idx=0, **kwargs): other parameters """ assert frame_idx < len(data["coords"]) - w_str = dpdata.lammps.lmp.from_system_data(data, frame_idx) + w_str = dpdata.formats.lammps.lmp.from_system_data(data, frame_idx) with open_file(file_name, "w") as fp: fp.write(w_str) @@ -164,8 +164,8 @@ def from_system( dict The system data """ - lines = dpdata.lammps.dump.load_file(file_name, begin=begin, step=step) - data = dpdata.lammps.dump.system_data( + lines = dpdata.formats.lammps.dump.load_file(file_name, begin=begin, step=step) + data = dpdata.formats.lammps.dump.system_data( lines, type_map, unwrap=unwrap, input_file=input_file ) register_spin(data) @@ -188,6 +188,6 @@ def to_system(self, data, file_name: FileType, frame_idx=0, timestep=0, **kwargs other parameters """ assert frame_idx < len(data["coords"]) - w_str = dpdata.lammps.dump.from_system_data(data, frame_idx, timestep) + w_str = dpdata.formats.lammps.dump.from_system_data(data, frame_idx, timestep) with open_file(file_name, "w") as fp: fp.write(w_str) diff --git a/dpdata/plugins/lmdb.py b/dpdata/plugins/lmdb.py index 8391c1fae..5c83dbe21 100644 --- a/dpdata/plugins/lmdb.py +++ b/dpdata/plugins/lmdb.py @@ -1,6 +1,6 @@ from __future__ import annotations from dpdata.format import Format -from dpdata.lmdb.format import LMDBFormat +from dpdata.formats.lmdb.format import LMDBFormat Format.register("lmdb")(LMDBFormat) diff --git a/dpdata/plugins/openmx.py b/dpdata/plugins/openmx.py index 4e16566dc..0413c1faa 100644 --- a/dpdata/plugins/openmx.py +++ b/dpdata/plugins/openmx.py @@ -1,7 +1,7 @@ from __future__ import annotations -import dpdata.md.pbc -import dpdata.openmx.omx +import dpdata.formats.md.pbc +import dpdata.formats.openmx.omx from dpdata.format import Format @@ -35,8 +35,8 @@ def from_system(self, file_name: str, **kwargs) -> dict: fname = f"{file_name}.dat" mdname = f"{file_name}.md" - data, _ = dpdata.openmx.omx.to_system_data(fname, mdname) - data["coords"] = dpdata.md.pbc.apply_pbc( + data, _ = dpdata.formats.openmx.omx.to_system_data(fname, mdname) + data["coords"] = dpdata.formats.md.pbc.apply_pbc( data["coords"], data["cells"], ) @@ -61,12 +61,12 @@ def from_labeled_system(self, file_name: str, **kwargs) -> dict: fname = f"{file_name}.dat" mdname = f"{file_name}.md" - data, cs = dpdata.openmx.omx.to_system_data(fname, mdname) - data["coords"] = dpdata.md.pbc.apply_pbc( + data, cs = dpdata.formats.openmx.omx.to_system_data(fname, mdname) + data["coords"] = dpdata.formats.md.pbc.apply_pbc( data["coords"], data["cells"], ) - data["energies"], data["forces"] = dpdata.openmx.omx.to_system_label( + data["energies"], data["forces"] = dpdata.formats.openmx.omx.to_system_label( fname, mdname ) return data diff --git a/dpdata/plugins/orca.py b/dpdata/plugins/orca.py index 7a0b806c9..2c436be1e 100644 --- a/dpdata/plugins/orca.py +++ b/dpdata/plugins/orca.py @@ -5,7 +5,7 @@ import numpy as np from dpdata.format import Format -from dpdata.orca.output import read_orca_sp_output +from dpdata.formats.orca.output import read_orca_sp_output from dpdata.unit import EnergyConversion, ForceConversion if TYPE_CHECKING: diff --git a/dpdata/plugins/psi4.py b/dpdata/plugins/psi4.py index 2bbfc2321..9aca1b80e 100644 --- a/dpdata/plugins/psi4.py +++ b/dpdata/plugins/psi4.py @@ -5,8 +5,8 @@ import numpy as np from dpdata.format import Format -from dpdata.psi4.input import write_psi4_input -from dpdata.psi4.output import read_psi4_output +from dpdata.formats.psi4.input import write_psi4_input +from dpdata.formats.psi4.output import read_psi4_output from dpdata.unit import EnergyConversion, ForceConversion from dpdata.utils import open_file diff --git a/dpdata/plugins/pwmat.py b/dpdata/plugins/pwmat.py index 38a5bb297..5ee8483c2 100644 --- a/dpdata/plugins/pwmat.py +++ b/dpdata/plugins/pwmat.py @@ -4,8 +4,8 @@ import numpy as np -import dpdata.pwmat.atomconfig -import dpdata.pwmat.movement +import dpdata.formats.pwmat.atomconfig +import dpdata.formats.pwmat.movement from dpdata.format import Format from dpdata.utils import open_file @@ -33,7 +33,7 @@ def from_labeled_system( data["energies"], tmp_force, tmp_virial, - ) = dpdata.pwmat.movement.get_frames( + ) = dpdata.formats.pwmat.movement.get_frames( file_name, begin=begin, step=step, convergence_check=convergence_check ) if tmp_force is not None: @@ -58,7 +58,7 @@ class PwmatAtomconfigFormat(Format): def from_system(self, file_name: FileType, **kwargs): with open_file(file_name) as fp: lines = [line.rstrip("\n") for line in fp] - return dpdata.pwmat.atomconfig.to_system_data(lines) + return dpdata.formats.pwmat.atomconfig.to_system_data(lines) def to_system(self, data, file_name: FileType, frame_idx=0, *args, **kwargs): """Dump the system in pwmat atom.config format. @@ -77,6 +77,6 @@ def to_system(self, data, file_name: FileType, frame_idx=0, *args, **kwargs): other parameters """ assert frame_idx < len(data["coords"]) - w_str = dpdata.pwmat.atomconfig.from_system_data(data, frame_idx) + w_str = dpdata.formats.pwmat.atomconfig.from_system_data(data, frame_idx) with open_file(file_name, "w") as fp: fp.write(w_str) diff --git a/dpdata/plugins/pymatgen.py b/dpdata/plugins/pymatgen.py index b8099a3ab..e9c91fc8a 100644 --- a/dpdata/plugins/pymatgen.py +++ b/dpdata/plugins/pymatgen.py @@ -2,8 +2,8 @@ import numpy as np -import dpdata.pymatgen.molecule -import dpdata.pymatgen.structure +import dpdata.formats.pymatgen.molecule +import dpdata.formats.pymatgen.structure from dpdata.format import Format @@ -24,7 +24,7 @@ def from_system(self, structure, **kwargs) -> dict: dict data dict """ - return dpdata.pymatgen.structure.from_system_data(structure) + return dpdata.formats.pymatgen.structure.from_system_data(structure) def to_system(self, data, **kwargs): """Convert System to Pymatgen Structure obj.""" @@ -56,7 +56,7 @@ def from_system(self, file_name, **kwargs): except ModuleNotFoundError as e: raise ImportError("No module pymatgen.Molecule") from e - return dpdata.pymatgen.molecule.to_system_data(file_name) + return dpdata.formats.pymatgen.molecule.to_system_data(file_name) def to_system(self, data, **kwargs): """Convert System to Pymatgen Molecule obj.""" diff --git a/dpdata/plugins/qe.py b/dpdata/plugins/qe.py index 682bb202e..9230b6b0c 100644 --- a/dpdata/plugins/qe.py +++ b/dpdata/plugins/qe.py @@ -1,8 +1,8 @@ from __future__ import annotations -import dpdata.md.pbc -import dpdata.qe.scf -import dpdata.qe.traj +import dpdata.formats.md.pbc +import dpdata.formats.qe.scf +import dpdata.formats.qe.traj from dpdata.format import Format @@ -10,10 +10,10 @@ class QECPTrajFormat(Format): @Format.post("rot_lower_triangular") def from_system(self, file_name, begin=0, step=1, **kwargs): - data, _ = dpdata.qe.traj.to_system_data( + data, _ = dpdata.formats.qe.traj.to_system_data( file_name + ".in", file_name, begin=begin, step=step ) - data["coords"] = dpdata.md.pbc.apply_pbc( + data["coords"] = dpdata.formats.md.pbc.apply_pbc( data["coords"], data["cells"], ) @@ -21,14 +21,14 @@ def from_system(self, file_name, begin=0, step=1, **kwargs): @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): - data, cs = dpdata.qe.traj.to_system_data( + data, cs = dpdata.formats.qe.traj.to_system_data( file_name + ".in", file_name, begin=begin, step=step ) - data["coords"] = dpdata.md.pbc.apply_pbc( + data["coords"] = dpdata.formats.md.pbc.apply_pbc( data["coords"], data["cells"], ) - data["energies"], data["forces"], es = dpdata.qe.traj.to_system_label( + data["energies"], data["forces"], es = dpdata.formats.qe.traj.to_system_label( file_name + ".in", file_name, begin=begin, step=step ) assert cs == es, "the step key between files are not consistent" @@ -49,7 +49,7 @@ def from_labeled_system(self, file_name, **kwargs): data["energies"], data["forces"], tmp_virial, - ) = dpdata.qe.scf.get_frame(file_name) + ) = dpdata.formats.qe.scf.get_frame(file_name) if tmp_virial is not None: data["virials"] = tmp_virial return data diff --git a/dpdata/plugins/rdkit.py b/dpdata/plugins/rdkit.py index f01b277d6..2b336a165 100644 --- a/dpdata/plugins/rdkit.py +++ b/dpdata/plugins/rdkit.py @@ -1,6 +1,6 @@ from __future__ import annotations -import dpdata.rdkit.utils +import dpdata.formats.rdkit.utils from dpdata.format import Format @@ -31,7 +31,7 @@ def from_bond_order_system(self, file_name, **kwargs): for m in rdkit.Chem.SDMolSupplier(file_name, sanitize=False, removeHs=False) ] if len(mols) > 1: - mol = dpdata.rdkit.utils.combine_molecules(mols) + mol = dpdata.formats.rdkit.utils.combine_molecules(mols) else: mol = mols[0] return mol diff --git a/dpdata/plugins/siesta.py b/dpdata/plugins/siesta.py index 906eeb51f..3404d37c9 100644 --- a/dpdata/plugins/siesta.py +++ b/dpdata/plugins/siesta.py @@ -1,7 +1,7 @@ from __future__ import annotations -import dpdata.siesta.aiMD_output -import dpdata.siesta.output +import dpdata.formats.siesta.aiMD_output +import dpdata.formats.siesta.output from dpdata.format import Format @@ -18,7 +18,7 @@ def from_system(self, file_name, **kwargs): _e, _f, _v, - ) = dpdata.siesta.output.obtain_frame(file_name) + ) = dpdata.formats.siesta.output.obtain_frame(file_name) return data def from_labeled_system(self, file_name, **kwargs): @@ -32,7 +32,7 @@ def from_labeled_system(self, file_name, **kwargs): data["energies"], data["forces"], data["virials"], - ) = dpdata.siesta.output.obtain_frame(file_name) + ) = dpdata.formats.siesta.output.obtain_frame(file_name) return data @@ -50,7 +50,7 @@ def from_system(self, file_name, **kwargs): _e, _f, _v, - ) = dpdata.siesta.aiMD_output.get_aiMD_frame(file_name) + ) = dpdata.formats.siesta.aiMD_output.get_aiMD_frame(file_name) return data def from_labeled_system(self, file_name, **kwargs): @@ -64,5 +64,5 @@ def from_labeled_system(self, file_name, **kwargs): data["energies"], data["forces"], data["virials"], - ) = dpdata.siesta.aiMD_output.get_aiMD_frame(file_name) + ) = dpdata.formats.siesta.aiMD_output.get_aiMD_frame(file_name) return data diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index 49d25ecba..84d3142b6 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -4,9 +4,9 @@ import numpy as np -import dpdata.vasp.outcar -import dpdata.vasp.poscar -import dpdata.vasp.xml +import dpdata.formats.vasp.outcar +import dpdata.formats.vasp.poscar +import dpdata.formats.vasp.xml from dpdata.data_type import Axis, DataType from dpdata.format import Format from dpdata.utils import open_file, uniq_atom_names @@ -36,7 +36,7 @@ class VASPPoscarFormat(Format): def from_system(self, file_name: FileType, **kwargs): with open_file(file_name) as fp: lines = [line.rstrip("\n") for line in fp] - data = dpdata.vasp.poscar.to_system_data(lines) + data = dpdata.formats.vasp.poscar.to_system_data(lines) data = uniq_atom_names(data) register_move_data(data) return data @@ -75,7 +75,7 @@ def to_system(self, data, frame_idx=0, **kwargs): other parameters """ assert frame_idx < len(data["coords"]) - return dpdata.vasp.poscar.from_system_data(data, frame_idx) + return dpdata.formats.vasp.poscar.from_system_data(data, frame_idx) # rotate the system to lammps convention @@ -97,7 +97,7 @@ def from_labeled_system( data["energies"], tmp_force, tmp_virial, - ) = dpdata.vasp.outcar.get_frames( + ) = dpdata.formats.vasp.outcar.get_frames( file_name, begin=begin, step=step, @@ -136,7 +136,7 @@ def from_labeled_system( data["energies"], data["forces"], tmp_virial, - ) = dpdata.vasp.xml.analyze( + ) = dpdata.formats.vasp.xml.analyze( file_name, type_idx_zero=True, begin=begin, diff --git a/dpdata/plugins/xyz.py b/dpdata/plugins/xyz.py index d005f114f..63aaeabe3 100644 --- a/dpdata/plugins/xyz.py +++ b/dpdata/plugins/xyz.py @@ -10,8 +10,8 @@ if TYPE_CHECKING: from dpdata.utils import FileType -from dpdata.xyz.quip_gap_xyz import QuipGapxyzSystems, format_single_frame -from dpdata.xyz.xyz import coord_to_xyz, xyz_to_coord +from dpdata.formats.xyz.quip_gap_xyz import QuipGapxyzSystems, format_single_frame +from dpdata.formats.xyz.xyz import coord_to_xyz, xyz_to_coord @Format.register("xyz") diff --git a/dpdata/system.py b/dpdata/system.py index 6023891ff..7faa4418d 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -17,12 +17,12 @@ import numpy as np import dpdata -import dpdata.md.pbc +import dpdata.formats.md.pbc # ensure all plugins are loaded! import dpdata.plugins import dpdata.plugins.deepmd -from dpdata.amber.mask import load_param_file, pick_by_amber_mask +from dpdata.formats.amber.mask import load_param_file, pick_by_amber_mask from dpdata.data_type import Axis, DataError, DataType, get_data_types from dpdata.driver import Driver, Minimizer from dpdata.format import Format @@ -684,7 +684,7 @@ def extend(self, systems: Iterable[System]): def apply_pbc(self): """Append periodic boundary condition.""" - ncoord = dpdata.md.pbc.dir_coord(self.data["coords"], self.data["cells"]) + ncoord = dpdata.formats.md.pbc.dir_coord(self.data["coords"], self.data["cells"]) ncoord = ncoord % 1 self.data["coords"] = np.matmul(ncoord, self.data["cells"]) diff --git a/tests/context.py b/tests/context.py index 3214e28ea..49b32e5c0 100644 --- a/tests/context.py +++ b/tests/context.py @@ -5,9 +5,9 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import dpdata -import dpdata.gaussian.gjf # noqa: F401 -import dpdata.md.msd # noqa: F401 -import dpdata.md.water # noqa: F401 +import dpdata.formats.gaussian.gjf # noqa: F401 +import dpdata.formats.md.msd # noqa: F401 +import dpdata.formats.md.water # noqa: F401 import dpdata.stat # noqa: F401 import dpdata.system # noqa: F401 diff --git a/tests/test_abacus_stru_dump.py b/tests/test_abacus_stru_dump.py index cf071920d..7b4317c37 100644 --- a/tests/test_abacus_stru_dump.py +++ b/tests/test_abacus_stru_dump.py @@ -7,7 +7,7 @@ from context import dpdata from test_vasp_poscar_dump import myfilecmp -from dpdata.abacus.stru import parse_pos_oneline +from dpdata.formats.abacus.stru import parse_pos_oneline class TestStruDump(unittest.TestCase): diff --git a/tests/test_lammps_lmp_dump.py b/tests/test_lammps_lmp_dump.py index a717c6cfc..86e4b3cdd 100644 --- a/tests/test_lammps_lmp_dump.py +++ b/tests/test_lammps_lmp_dump.py @@ -8,7 +8,7 @@ from context import dpdata from poscars.poscar_ref_oh import TestPOSCARoh -from dpdata.lammps.lmp import rotate_to_lower_triangle +from dpdata.formats.lammps.lmp import rotate_to_lower_triangle TEST_DIR = os.path.dirname(__file__) POSCAR_CONF_LMP = os.path.join(TEST_DIR, "poscars", "conf.lmp") diff --git a/tests/test_lammps_spin.py b/tests/test_lammps_spin.py index d3d58920e..bcb3442b7 100644 --- a/tests/test_lammps_spin.py +++ b/tests/test_lammps_spin.py @@ -7,7 +7,7 @@ import numpy as np from context import dpdata -from dpdata.lammps.dump import get_spin +from dpdata.formats.lammps.dump import get_spin TRAJ_NO_ID = """ITEM: TIMESTEP 0 diff --git a/tests/test_lmdb.py b/tests/test_lmdb.py index ee651edce..bc0fdeecc 100644 --- a/tests/test_lmdb.py +++ b/tests/test_lmdb.py @@ -17,7 +17,7 @@ ) from context import dpdata -from dpdata.lmdb.format import LMDBFrameError, LMDBMetadataError +from dpdata.formats.lmdb.format import LMDBFrameError, LMDBMetadataError class TestLMDBLabeledSystem(unittest.TestCase, CompLabeledSys, IsPBC): From d037542c8a00c9e359852d77e642f2adc0998be2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 28 Feb 2026 03:07:41 +0000 Subject: [PATCH 2/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dpdata/__init__.py | 2 +- dpdata/plugins/abacus.py | 2 +- dpdata/plugins/cp2k.py | 2 +- dpdata/plugins/deepmd.py | 8 ++++++-- dpdata/plugins/dftbplus.py | 2 +- dpdata/plugins/fhi_aims.py | 4 +++- dpdata/plugins/gromacs.py | 4 +++- dpdata/plugins/lammps.py | 4 +++- dpdata/system.py | 6 ++++-- 9 files changed, 23 insertions(+), 11 deletions(-) diff --git a/dpdata/__init__.py b/dpdata/__init__.py index 3c664179f..7daf7b554 100644 --- a/dpdata/__init__.py +++ b/dpdata/__init__.py @@ -1,7 +1,7 @@ from __future__ import annotations -from .formats import lammps, md, vasp from .bond_order_system import BondOrderSystem +from .formats import lammps, md, vasp from .system import LabeledSystem, MultiSystems, System try: diff --git a/dpdata/plugins/abacus.py b/dpdata/plugins/abacus.py index cdf1ae8ce..c8736fe39 100644 --- a/dpdata/plugins/abacus.py +++ b/dpdata/plugins/abacus.py @@ -8,9 +8,9 @@ import dpdata.formats.abacus.md import dpdata.formats.abacus.relax import dpdata.formats.abacus.scf -from dpdata.formats.abacus.stru import get_frame_from_stru, make_unlabeled_stru from dpdata.data_type import Axis, DataType from dpdata.format import Format +from dpdata.formats.abacus.stru import get_frame_from_stru, make_unlabeled_stru from dpdata.utils import open_file if TYPE_CHECKING: diff --git a/dpdata/plugins/cp2k.py b/dpdata/plugins/cp2k.py index 3f438ad1f..61f2eaf9d 100644 --- a/dpdata/plugins/cp2k.py +++ b/dpdata/plugins/cp2k.py @@ -3,8 +3,8 @@ import glob import dpdata.formats.cp2k.output -from dpdata.formats.cp2k.output import Cp2kSystems from dpdata.format import Format +from dpdata.formats.cp2k.output import Cp2kSystems string_warning = """ Hi, you got an error from dpdata, diff --git a/dpdata/plugins/deepmd.py b/dpdata/plugins/deepmd.py index 24189806a..99bd9b237 100644 --- a/dpdata/plugins/deepmd.py +++ b/dpdata/plugins/deepmd.py @@ -92,7 +92,9 @@ def to_system(self, data, file_name, set_size=5000, prec=np.float64, **kwargs): **kwargs : dict other parameters """ - dpdata.formats.deepmd.comp.dump(file_name, data, set_size=set_size, comp_prec=prec) + dpdata.formats.deepmd.comp.dump( + file_name, data, set_size=set_size, comp_prec=prec + ) def from_labeled_system(self, file_name, type_map=None, **kwargs): register_spin() @@ -155,7 +157,9 @@ def to_system( **kwargs : dict other parameters """ - dpdata.formats.deepmd.mixed.dump(file_name, data, set_size=set_size, comp_prec=prec) + dpdata.formats.deepmd.mixed.dump( + file_name, data, set_size=set_size, comp_prec=prec + ) def from_labeled_system_mix(self, file_name, type_map=None, **kwargs): return dpdata.formats.deepmd.mixed.to_system_data( diff --git a/dpdata/plugins/dftbplus.py b/dpdata/plugins/dftbplus.py index 0001a85e1..191576e05 100644 --- a/dpdata/plugins/dftbplus.py +++ b/dpdata/plugins/dftbplus.py @@ -2,8 +2,8 @@ import numpy as np -from dpdata.formats.dftbplus.output import read_dftb_plus from dpdata.format import Format +from dpdata.formats.dftbplus.output import read_dftb_plus from dpdata.unit import EnergyConversion, ForceConversion energy_convert = EnergyConversion("hartree", "eV").value() diff --git a/dpdata/plugins/fhi_aims.py b/dpdata/plugins/fhi_aims.py index cb403e16a..310496e2a 100644 --- a/dpdata/plugins/fhi_aims.py +++ b/dpdata/plugins/fhi_aims.py @@ -45,7 +45,9 @@ def from_labeled_system(self, file_name, **kwargs): data["energies"], data["forces"], tmp_virial, - ) = dpdata.formats.fhi_aims.output.get_frames(file_name, md=False, begin=0, step=1) + ) = dpdata.formats.fhi_aims.output.get_frames( + file_name, md=False, begin=0, step=1 + ) if tmp_virial is not None: data["virials"] = tmp_virial return data diff --git a/dpdata/plugins/gromacs.py b/dpdata/plugins/gromacs.py index c2c417df1..837b6f6d8 100644 --- a/dpdata/plugins/gromacs.py +++ b/dpdata/plugins/gromacs.py @@ -49,7 +49,9 @@ def to_system( if frame_idx == -1: strs = [] for idx in range(data["coords"].shape[0]): - gro_str = dpdata.formats.gromacs.gro.from_system_data(data, f_idx=idx, **kwargs) + gro_str = dpdata.formats.gromacs.gro.from_system_data( + data, f_idx=idx, **kwargs + ) strs.append(gro_str) gro_str = "\n".join(strs) else: diff --git a/dpdata/plugins/lammps.py b/dpdata/plugins/lammps.py index c99555fc1..9a4622659 100644 --- a/dpdata/plugins/lammps.py +++ b/dpdata/plugins/lammps.py @@ -103,7 +103,9 @@ def from_system( """ with open_file(file_name) as fp: lines = [line.rstrip("\n") for line in fp] - data = dpdata.formats.lammps.lmp.to_system_data(lines, type_map, atom_style=atom_style) + data = dpdata.formats.lammps.lmp.to_system_data( + lines, type_map, atom_style=atom_style + ) register_spin(data) register_charge(data) return data diff --git a/dpdata/system.py b/dpdata/system.py index 7faa4418d..f1c44f913 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -22,10 +22,10 @@ # ensure all plugins are loaded! import dpdata.plugins import dpdata.plugins.deepmd -from dpdata.formats.amber.mask import load_param_file, pick_by_amber_mask from dpdata.data_type import Axis, DataError, DataType, get_data_types from dpdata.driver import Driver, Minimizer from dpdata.format import Format +from dpdata.formats.amber.mask import load_param_file, pick_by_amber_mask from dpdata.plugin import Plugin from dpdata.utils import ( add_atom_names, @@ -684,7 +684,9 @@ def extend(self, systems: Iterable[System]): def apply_pbc(self): """Append periodic boundary condition.""" - ncoord = dpdata.formats.md.pbc.dir_coord(self.data["coords"], self.data["cells"]) + ncoord = dpdata.formats.md.pbc.dir_coord( + self.data["coords"], self.data["cells"] + ) ncoord = ncoord % 1 self.data["coords"] = np.matmul(ncoord, self.data["cells"]) From 802d4a02b006cafc94383bd203f3bf41652bb822 Mon Sep 17 00:00:00 2001 From: "njzjz-bot (driven by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5))[bot]" <48687836+njzjz-bot@users.noreply.github.com> Date: Tue, 5 May 2026 09:09:38 +0000 Subject: [PATCH 3/7] fix: update helper imports after format move --- dpdata/__init__.py | 5 ++--- dpdata/formats/cp2k/__init__.py | 5 +++++ dpdata/formats/gaussian/__init__.py | 5 +++++ dpdata/formats/qe/__init__.py | 5 +++++ dpdata/{formats => }/md/__init__.py | 0 dpdata/{formats => }/md/msd.py | 0 dpdata/{formats => }/md/pbc.py | 0 dpdata/{formats => }/md/rdf.py | 0 dpdata/{formats => }/md/water.py | 0 dpdata/plugins/openmx.py | 6 +++--- dpdata/plugins/qe.py | 6 +++--- dpdata/system.py | 6 ++---- tests/context.py | 4 ++-- tests/test_cell_to_low_triangle.py | 19 ++++++++----------- tests/test_gaussian_driver.py | 6 +++--- tests/test_msd.py | 8 +++++--- tests/test_qe_cp_traj.py | 4 +++- tests/test_water_ions.py | 17 +++++++++++------ 18 files changed, 57 insertions(+), 39 deletions(-) rename dpdata/{formats => }/md/__init__.py (100%) rename dpdata/{formats => }/md/msd.py (100%) rename dpdata/{formats => }/md/pbc.py (100%) rename dpdata/{formats => }/md/rdf.py (100%) rename dpdata/{formats => }/md/water.py (100%) diff --git a/dpdata/__init__.py b/dpdata/__init__.py index 7daf7b554..69442385e 100644 --- a/dpdata/__init__.py +++ b/dpdata/__init__.py @@ -1,7 +1,7 @@ from __future__ import annotations +from . import md from .bond_order_system import BondOrderSystem -from .formats import lammps, md, vasp from .system import LabeledSystem, MultiSystems, System try: @@ -9,11 +9,10 @@ except ImportError: from .__about__ import __version__ + __all__ = [ "__version__", - "lammps", "md", - "vasp", "System", "LabeledSystem", "MultiSystems", diff --git a/dpdata/formats/cp2k/__init__.py b/dpdata/formats/cp2k/__init__.py index e69de29bb..f3d05133b 100644 --- a/dpdata/formats/cp2k/__init__.py +++ b/dpdata/formats/cp2k/__init__.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from . import cell, output + +__all__ = ["cell", "output"] diff --git a/dpdata/formats/gaussian/__init__.py b/dpdata/formats/gaussian/__init__.py index e69de29bb..7ebe5e1cb 100644 --- a/dpdata/formats/gaussian/__init__.py +++ b/dpdata/formats/gaussian/__init__.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from . import fchk, gjf, log + +__all__ = ["fchk", "gjf", "log"] diff --git a/dpdata/formats/qe/__init__.py b/dpdata/formats/qe/__init__.py index e69de29bb..35d20788f 100644 --- a/dpdata/formats/qe/__init__.py +++ b/dpdata/formats/qe/__init__.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from . import scf, traj + +__all__ = ["scf", "traj"] diff --git a/dpdata/formats/md/__init__.py b/dpdata/md/__init__.py similarity index 100% rename from dpdata/formats/md/__init__.py rename to dpdata/md/__init__.py diff --git a/dpdata/formats/md/msd.py b/dpdata/md/msd.py similarity index 100% rename from dpdata/formats/md/msd.py rename to dpdata/md/msd.py diff --git a/dpdata/formats/md/pbc.py b/dpdata/md/pbc.py similarity index 100% rename from dpdata/formats/md/pbc.py rename to dpdata/md/pbc.py diff --git a/dpdata/formats/md/rdf.py b/dpdata/md/rdf.py similarity index 100% rename from dpdata/formats/md/rdf.py rename to dpdata/md/rdf.py diff --git a/dpdata/formats/md/water.py b/dpdata/md/water.py similarity index 100% rename from dpdata/formats/md/water.py rename to dpdata/md/water.py diff --git a/dpdata/plugins/openmx.py b/dpdata/plugins/openmx.py index 0413c1faa..dc0af9c2e 100644 --- a/dpdata/plugins/openmx.py +++ b/dpdata/plugins/openmx.py @@ -1,7 +1,7 @@ from __future__ import annotations -import dpdata.formats.md.pbc import dpdata.formats.openmx.omx +import dpdata.md.pbc from dpdata.format import Format @@ -36,7 +36,7 @@ def from_system(self, file_name: str, **kwargs) -> dict: mdname = f"{file_name}.md" data, _ = dpdata.formats.openmx.omx.to_system_data(fname, mdname) - data["coords"] = dpdata.formats.md.pbc.apply_pbc( + data["coords"] = dpdata.md.pbc.apply_pbc( data["coords"], data["cells"], ) @@ -62,7 +62,7 @@ def from_labeled_system(self, file_name: str, **kwargs) -> dict: mdname = f"{file_name}.md" data, cs = dpdata.formats.openmx.omx.to_system_data(fname, mdname) - data["coords"] = dpdata.formats.md.pbc.apply_pbc( + data["coords"] = dpdata.md.pbc.apply_pbc( data["coords"], data["cells"], ) diff --git a/dpdata/plugins/qe.py b/dpdata/plugins/qe.py index 9230b6b0c..b9bd84c0c 100644 --- a/dpdata/plugins/qe.py +++ b/dpdata/plugins/qe.py @@ -1,8 +1,8 @@ from __future__ import annotations -import dpdata.formats.md.pbc import dpdata.formats.qe.scf import dpdata.formats.qe.traj +import dpdata.md.pbc from dpdata.format import Format @@ -13,7 +13,7 @@ def from_system(self, file_name, begin=0, step=1, **kwargs): data, _ = dpdata.formats.qe.traj.to_system_data( file_name + ".in", file_name, begin=begin, step=step ) - data["coords"] = dpdata.formats.md.pbc.apply_pbc( + data["coords"] = dpdata.md.pbc.apply_pbc( data["coords"], data["cells"], ) @@ -24,7 +24,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): data, cs = dpdata.formats.qe.traj.to_system_data( file_name + ".in", file_name, begin=begin, step=step ) - data["coords"] = dpdata.formats.md.pbc.apply_pbc( + data["coords"] = dpdata.md.pbc.apply_pbc( data["coords"], data["cells"], ) diff --git a/dpdata/system.py b/dpdata/system.py index f1c44f913..4150abc89 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -17,7 +17,7 @@ import numpy as np import dpdata -import dpdata.formats.md.pbc +import dpdata.md.pbc # ensure all plugins are loaded! import dpdata.plugins @@ -684,9 +684,7 @@ def extend(self, systems: Iterable[System]): def apply_pbc(self): """Append periodic boundary condition.""" - ncoord = dpdata.formats.md.pbc.dir_coord( - self.data["coords"], self.data["cells"] - ) + ncoord = dpdata.md.pbc.dir_coord(self.data["coords"], self.data["cells"]) ncoord = ncoord % 1 self.data["coords"] = np.matmul(ncoord, self.data["cells"]) diff --git a/tests/context.py b/tests/context.py index 49b32e5c0..85d7c33cf 100644 --- a/tests/context.py +++ b/tests/context.py @@ -6,8 +6,8 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import dpdata import dpdata.formats.gaussian.gjf # noqa: F401 -import dpdata.formats.md.msd # noqa: F401 -import dpdata.formats.md.water # noqa: F401 +import dpdata.md.msd # noqa: F401 +import dpdata.md.water # noqa: F401 import dpdata.stat # noqa: F401 import dpdata.system # noqa: F401 diff --git a/tests/test_cell_to_low_triangle.py b/tests/test_cell_to_low_triangle.py index 34d0a90ae..93a128263 100644 --- a/tests/test_cell_to_low_triangle.py +++ b/tests/test_cell_to_low_triangle.py @@ -3,12 +3,13 @@ import unittest import numpy as np -from context import dpdata + +from dpdata.formats.cp2k.cell import cell_to_low_triangle class TestCellToLowTriangle(unittest.TestCase): def test_func1(self): - cell_1 = dpdata.cp2k.cell.cell_to_low_triangle( + cell_1 = cell_to_low_triangle( 6, 6, 6, np.pi * 1 / 2, np.pi * 1 / 2, np.pi * 1 / 2 ) cell_2 = np.asarray([[6, 0, 0], [0, 6, 0], [0, 0, 6]]) @@ -17,7 +18,7 @@ def test_func1(self): self.assertAlmostEqual(cell_1[ii, jj], cell_2[ii, jj], places=6) def test_func2(self): - cell_1 = dpdata.cp2k.cell.cell_to_low_triangle( + cell_1 = cell_to_low_triangle( 6, 6, 6, np.pi * 1 / 3, np.pi * 1 / 3, np.pi * 1 / 3 ) cell_2 = np.asarray( @@ -28,7 +29,7 @@ def test_func2(self): self.assertAlmostEqual(cell_1[ii, jj], cell_2[ii, jj], places=6) def test_func3(self): - cell_1 = dpdata.cp2k.cell.cell_to_low_triangle( + cell_1 = cell_to_low_triangle( 6, 7, 8, np.pi * 133 / 180, np.pi * 84 / 180, np.pi * 69 / 180 ) cell_2 = np.asarray( @@ -45,21 +46,17 @@ def test_func3(self): def test_func4(self): with self.assertRaises(Exception) as c: - dpdata.cp2k.cell.cell_to_low_triangle( - 0.1, 6, 6, np.pi * 1 / 2, np.pi * 1 / 2, np.pi * 1 / 2 - ) + cell_to_low_triangle(0.1, 6, 6, np.pi * 1 / 2, np.pi * 1 / 2, np.pi * 1 / 2) self.assertTrue("A==0.1" in str(c.exception)) def test_func5(self): with self.assertRaises(Exception) as c: - dpdata.cp2k.cell.cell_to_low_triangle( - 6, 6, 6, np.pi * 3 / 180, np.pi * 1 / 2, np.pi * 1 / 2 - ) + cell_to_low_triangle(6, 6, 6, np.pi * 3 / 180, np.pi * 1 / 2, np.pi * 1 / 2) self.assertTrue("alpha" in str(c.exception)) def test_func6(self): with self.assertRaises(Exception) as c: - dpdata.cp2k.cell.cell_to_low_triangle( + cell_to_low_triangle( 6, 7, 8, np.pi * 153 / 180, np.pi * 84 / 180, np.pi * 69 / 180 ) self.assertTrue("lz^2" in str(c.exception)) diff --git a/tests/test_gaussian_driver.py b/tests/test_gaussian_driver.py index ff1638488..3c28738c1 100644 --- a/tests/test_gaussian_driver.py +++ b/tests/test_gaussian_driver.py @@ -9,6 +9,8 @@ from comp_sys import CompSys, IsNoPBC from context import dpdata +from dpdata.formats.gaussian.gjf import detect_multiplicity + @unittest.skipIf(shutil.which("g16") is None, "g16 is not installed") @unittest.skipIf( @@ -83,9 +85,7 @@ def test_detect_multiplicity(self): self._check_multiplicity(["C", "H"], 2) def _check_multiplicity(self, symbols, multiplicity): - self.assertEqual( - dpdata.gaussian.gjf.detect_multiplicity(np.array(symbols)), multiplicity - ) + self.assertEqual(detect_multiplicity(np.array(symbols)), multiplicity) def tearDown(self): if os.path.exists("gaussian/tmp.gjf"): diff --git a/tests/test_msd.py b/tests/test_msd.py index 5d26db645..9d53ba0fc 100644 --- a/tests/test_msd.py +++ b/tests/test_msd.py @@ -5,6 +5,8 @@ import numpy as np from context import dpdata +from dpdata.md.msd import msd as calc_msd + class TestMSD(unittest.TestCase): def setUp(self): @@ -22,9 +24,9 @@ def setUp(self): def test_msd(self): # print(self.system['atom_types'] == 0) - msd = dpdata.md.msd.msd(self.system) - msd0 = dpdata.md.msd.msd(self.system, self.system["atom_types"] == 0) - msd1 = dpdata.md.msd.msd(self.system, self.system["atom_types"] == 1) + msd = calc_msd(self.system) + msd0 = calc_msd(self.system, self.system["atom_types"] == 0) + msd1 = calc_msd(self.system, self.system["atom_types"] == 1) # print(msd) ncomp = msd.shape[0] for ii in range(ncomp): diff --git a/tests/test_qe_cp_traj.py b/tests/test_qe_cp_traj.py index d6403ff67..a670bd4d0 100644 --- a/tests/test_qe_cp_traj.py +++ b/tests/test_qe_cp_traj.py @@ -5,6 +5,8 @@ import numpy as np from context import dpdata +from dpdata.formats.qe.traj import convert_celldm + bohr2ang = dpdata.unit.LengthConversion("bohr", "angstrom").value() @@ -61,7 +63,7 @@ def setUp(self): class TestConverCellDim(unittest.TestCase): def test_case_null(self): - cell = dpdata.qe.traj.convert_celldm(8, [1, 1, 1]) + cell = convert_celldm(8, [1, 1, 1]) ref = np.eye(3) for ii in range(3): for jj in range(3): diff --git a/tests/test_water_ions.py b/tests/test_water_ions.py index 40c1c143c..34ab21279 100644 --- a/tests/test_water_ions.py +++ b/tests/test_water_ions.py @@ -5,6 +5,13 @@ from context import dpdata +from dpdata.md.water import ( + compute_bonds, + compute_bonds_ase, + compute_bonds_naive, + find_ions, +) + try: import ase # noqa: F401 import ase.neighborlist # noqa: F401 @@ -20,16 +27,14 @@ def setUp(self): self.system.from_lammps_lmp( os.path.join("poscars", "conf.waterion.lmp"), type_map=["O", "H"] ) - self.bonds = dpdata.md.water.compute_bonds( + self.bonds = compute_bonds( self.system.data["cells"][0], self.system.data["coords"][0], self.system.data["atom_types"], ) def test_ions_count(self): - no, noh, noh2, noh3, nh = dpdata.md.water.find_ions( - self.system.data["atom_types"], self.bonds - ) + no, noh, noh2, noh3, nh = find_ions(self.system.data["atom_types"], self.bonds) self.assertEqual(len(no), 0) self.assertEqual(len(noh), 1) self.assertEqual(len(noh2), 125) @@ -46,12 +51,12 @@ def setUp(self): self.system.from_lammps_lmp( os.path.join("poscars", "conf.waterion.lmp"), type_map=["O", "H"] ) - self.bonds = dpdata.md.water.compute_bonds_naive( + self.bonds = compute_bonds_naive( self.system.data["cells"][0], self.system.data["coords"][0], self.system.data["atom_types"], ) - self.bonds_ase = dpdata.md.water.compute_bonds_ase( + self.bonds_ase = compute_bonds_ase( self.system.data["cells"][0], self.system.data["coords"][0], self.system.data["atom_types"], From 9680f7c295cfbd5d1e0d406f966c916841f9232a Mon Sep 17 00:00:00 2001 From: "njzjz-bot (driven by OpenClaw (model: gpt-5.4))[bot]" <48687836+njzjz-bot@users.noreply.github.com> Date: Wed, 6 May 2026 10:31:36 +0000 Subject: [PATCH 4/7] fix: keep legacy helper module imports Add thin compatibility wrappers for dpdata.cp2k, dpdata.gaussian, and dpdata.qe helper modules after moving implementations under dpdata.formats. Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5) --- dpdata/cp2k/__init__.py | 3 +++ dpdata/cp2k/cell.py | 3 +++ dpdata/cp2k/output.py | 3 +++ dpdata/gaussian/__init__.py | 3 +++ dpdata/gaussian/fchk.py | 3 +++ dpdata/gaussian/gjf.py | 3 +++ dpdata/gaussian/log.py | 3 +++ dpdata/qe/__init__.py | 3 +++ dpdata/qe/scf.py | 3 +++ dpdata/qe/traj.py | 3 +++ 10 files changed, 30 insertions(+) create mode 100644 dpdata/cp2k/__init__.py create mode 100644 dpdata/cp2k/cell.py create mode 100644 dpdata/cp2k/output.py create mode 100644 dpdata/gaussian/__init__.py create mode 100644 dpdata/gaussian/fchk.py create mode 100644 dpdata/gaussian/gjf.py create mode 100644 dpdata/gaussian/log.py create mode 100644 dpdata/qe/__init__.py create mode 100644 dpdata/qe/scf.py create mode 100644 dpdata/qe/traj.py diff --git a/dpdata/cp2k/__init__.py b/dpdata/cp2k/__init__.py new file mode 100644 index 000000000..8e66eb10e --- /dev/null +++ b/dpdata/cp2k/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.cp2k import * # noqa: F403 diff --git a/dpdata/cp2k/cell.py b/dpdata/cp2k/cell.py new file mode 100644 index 000000000..5fd326de9 --- /dev/null +++ b/dpdata/cp2k/cell.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.cp2k.cell import * # noqa: F403 diff --git a/dpdata/cp2k/output.py b/dpdata/cp2k/output.py new file mode 100644 index 000000000..b7f4ce4d4 --- /dev/null +++ b/dpdata/cp2k/output.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.cp2k.output import * # noqa: F403 diff --git a/dpdata/gaussian/__init__.py b/dpdata/gaussian/__init__.py new file mode 100644 index 000000000..7b2ae19b5 --- /dev/null +++ b/dpdata/gaussian/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.gaussian import * # noqa: F403 diff --git a/dpdata/gaussian/fchk.py b/dpdata/gaussian/fchk.py new file mode 100644 index 000000000..b41d94ec1 --- /dev/null +++ b/dpdata/gaussian/fchk.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.gaussian.fchk import * # noqa: F403 diff --git a/dpdata/gaussian/gjf.py b/dpdata/gaussian/gjf.py new file mode 100644 index 000000000..c0e3600f2 --- /dev/null +++ b/dpdata/gaussian/gjf.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.gaussian.gjf import * # noqa: F403 diff --git a/dpdata/gaussian/log.py b/dpdata/gaussian/log.py new file mode 100644 index 000000000..750343df4 --- /dev/null +++ b/dpdata/gaussian/log.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.gaussian.log import * # noqa: F403 diff --git a/dpdata/qe/__init__.py b/dpdata/qe/__init__.py new file mode 100644 index 000000000..dc582be29 --- /dev/null +++ b/dpdata/qe/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.qe import * # noqa: F403 diff --git a/dpdata/qe/scf.py b/dpdata/qe/scf.py new file mode 100644 index 000000000..4f461792e --- /dev/null +++ b/dpdata/qe/scf.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.qe.scf import * # noqa: F403 diff --git a/dpdata/qe/traj.py b/dpdata/qe/traj.py new file mode 100644 index 000000000..1b4f67754 --- /dev/null +++ b/dpdata/qe/traj.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.qe.traj import * # noqa: F403 From f628b6e562c8077eee127f2723eed37f588aae35 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 10:32:04 +0000 Subject: [PATCH 5/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_amber_md.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_amber_md.py b/tests/test_amber_md.py index 62b355284..4927aaf8f 100644 --- a/tests/test_amber_md.py +++ b/tests/test_amber_md.py @@ -8,7 +8,6 @@ import numpy as np from comp_sys import CompLabeledSys, IsPBC from context import dpdata - from dpdata.amber.md import cell_lengths_angles_to_cell try: From bb583041fb457c05f089b187a7e50219bac6e680 Mon Sep 17 00:00:00 2001 From: "njzjz-bot (driven by OpenClaw (model: gpt-5.4))[bot]" <48687836+njzjz-bot@users.noreply.github.com> Date: Wed, 6 May 2026 10:38:10 +0000 Subject: [PATCH 6/7] fix: keep legacy format module imports Add thin compatibility wrappers for legacy dpdata. module paths after moving implementations under dpdata.formats. Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5) --- dpdata/abacus/__init__.py | 3 +++ dpdata/abacus/md.py | 3 +++ dpdata/abacus/relax.py | 3 +++ dpdata/abacus/scf.py | 3 +++ dpdata/abacus/stru.py | 3 +++ dpdata/amber/__init__.py | 3 +++ dpdata/amber/mask.py | 3 +++ dpdata/amber/md.py | 3 +++ dpdata/amber/sqm.py | 3 +++ dpdata/deepmd/__init__.py | 3 +++ dpdata/deepmd/comp.py | 3 +++ dpdata/deepmd/hdf5.py | 3 +++ dpdata/deepmd/mixed.py | 3 +++ dpdata/deepmd/raw.py | 3 +++ dpdata/dftbplus/__init__.py | 3 +++ dpdata/dftbplus/output.py | 3 +++ dpdata/fhi_aims/__init__.py | 3 +++ dpdata/fhi_aims/output.py | 3 +++ dpdata/gromacs/__init__.py | 3 +++ dpdata/gromacs/gro.py | 3 +++ dpdata/lammps/__init__.py | 3 +++ dpdata/lammps/dump.py | 3 +++ dpdata/lammps/lmp.py | 3 +++ dpdata/lmdb/__init__.py | 3 +++ dpdata/lmdb/format.py | 3 +++ dpdata/openmx/__init__.py | 3 +++ dpdata/openmx/omx.py | 3 +++ dpdata/orca/__init__.py | 3 +++ dpdata/orca/output.py | 3 +++ dpdata/psi4/__init__.py | 3 +++ dpdata/psi4/input.py | 3 +++ dpdata/psi4/output.py | 3 +++ dpdata/pwmat/__init__.py | 3 +++ dpdata/pwmat/atomconfig.py | 3 +++ dpdata/pwmat/movement.py | 3 +++ dpdata/pymatgen/__init__.py | 3 +++ dpdata/pymatgen/molecule.py | 3 +++ dpdata/pymatgen/structure.py | 3 +++ dpdata/rdkit/__init__.py | 3 +++ dpdata/rdkit/sanitize.py | 3 +++ dpdata/rdkit/utils.py | 3 +++ dpdata/siesta/__init__.py | 3 +++ dpdata/siesta/aiMD_output.py | 3 +++ dpdata/siesta/output.py | 3 +++ dpdata/vasp/__init__.py | 3 +++ dpdata/vasp/outcar.py | 3 +++ dpdata/vasp/poscar.py | 3 +++ dpdata/vasp/xml.py | 3 +++ dpdata/xyz/__init__.py | 3 +++ dpdata/xyz/quip_gap_xyz.py | 3 +++ dpdata/xyz/xyz.py | 3 +++ 51 files changed, 153 insertions(+) create mode 100644 dpdata/abacus/__init__.py create mode 100644 dpdata/abacus/md.py create mode 100644 dpdata/abacus/relax.py create mode 100644 dpdata/abacus/scf.py create mode 100644 dpdata/abacus/stru.py create mode 100644 dpdata/amber/__init__.py create mode 100644 dpdata/amber/mask.py create mode 100644 dpdata/amber/md.py create mode 100644 dpdata/amber/sqm.py create mode 100644 dpdata/deepmd/__init__.py create mode 100644 dpdata/deepmd/comp.py create mode 100644 dpdata/deepmd/hdf5.py create mode 100644 dpdata/deepmd/mixed.py create mode 100644 dpdata/deepmd/raw.py create mode 100644 dpdata/dftbplus/__init__.py create mode 100644 dpdata/dftbplus/output.py create mode 100644 dpdata/fhi_aims/__init__.py create mode 100644 dpdata/fhi_aims/output.py create mode 100644 dpdata/gromacs/__init__.py create mode 100644 dpdata/gromacs/gro.py create mode 100644 dpdata/lammps/__init__.py create mode 100644 dpdata/lammps/dump.py create mode 100644 dpdata/lammps/lmp.py create mode 100644 dpdata/lmdb/__init__.py create mode 100644 dpdata/lmdb/format.py create mode 100644 dpdata/openmx/__init__.py create mode 100644 dpdata/openmx/omx.py create mode 100644 dpdata/orca/__init__.py create mode 100644 dpdata/orca/output.py create mode 100644 dpdata/psi4/__init__.py create mode 100644 dpdata/psi4/input.py create mode 100644 dpdata/psi4/output.py create mode 100644 dpdata/pwmat/__init__.py create mode 100644 dpdata/pwmat/atomconfig.py create mode 100644 dpdata/pwmat/movement.py create mode 100644 dpdata/pymatgen/__init__.py create mode 100644 dpdata/pymatgen/molecule.py create mode 100644 dpdata/pymatgen/structure.py create mode 100644 dpdata/rdkit/__init__.py create mode 100644 dpdata/rdkit/sanitize.py create mode 100644 dpdata/rdkit/utils.py create mode 100644 dpdata/siesta/__init__.py create mode 100644 dpdata/siesta/aiMD_output.py create mode 100644 dpdata/siesta/output.py create mode 100644 dpdata/vasp/__init__.py create mode 100644 dpdata/vasp/outcar.py create mode 100644 dpdata/vasp/poscar.py create mode 100644 dpdata/vasp/xml.py create mode 100644 dpdata/xyz/__init__.py create mode 100644 dpdata/xyz/quip_gap_xyz.py create mode 100644 dpdata/xyz/xyz.py diff --git a/dpdata/abacus/__init__.py b/dpdata/abacus/__init__.py new file mode 100644 index 000000000..c917d8d4c --- /dev/null +++ b/dpdata/abacus/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.abacus import * # noqa: F403 diff --git a/dpdata/abacus/md.py b/dpdata/abacus/md.py new file mode 100644 index 000000000..2474d87db --- /dev/null +++ b/dpdata/abacus/md.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.abacus.md import * # noqa: F403 diff --git a/dpdata/abacus/relax.py b/dpdata/abacus/relax.py new file mode 100644 index 000000000..3d7a40315 --- /dev/null +++ b/dpdata/abacus/relax.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.abacus.relax import * # noqa: F403 diff --git a/dpdata/abacus/scf.py b/dpdata/abacus/scf.py new file mode 100644 index 000000000..2a2479998 --- /dev/null +++ b/dpdata/abacus/scf.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.abacus.scf import * # noqa: F403 diff --git a/dpdata/abacus/stru.py b/dpdata/abacus/stru.py new file mode 100644 index 000000000..3ea68177d --- /dev/null +++ b/dpdata/abacus/stru.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.abacus.stru import * # noqa: F403 diff --git a/dpdata/amber/__init__.py b/dpdata/amber/__init__.py new file mode 100644 index 000000000..6d20c397a --- /dev/null +++ b/dpdata/amber/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.amber import * # noqa: F403 diff --git a/dpdata/amber/mask.py b/dpdata/amber/mask.py new file mode 100644 index 000000000..177b34788 --- /dev/null +++ b/dpdata/amber/mask.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.amber.mask import * # noqa: F403 diff --git a/dpdata/amber/md.py b/dpdata/amber/md.py new file mode 100644 index 000000000..37a1186af --- /dev/null +++ b/dpdata/amber/md.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.amber.md import * # noqa: F403 diff --git a/dpdata/amber/sqm.py b/dpdata/amber/sqm.py new file mode 100644 index 000000000..81db3ee9a --- /dev/null +++ b/dpdata/amber/sqm.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.amber.sqm import * # noqa: F403 diff --git a/dpdata/deepmd/__init__.py b/dpdata/deepmd/__init__.py new file mode 100644 index 000000000..2ee2e6795 --- /dev/null +++ b/dpdata/deepmd/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.deepmd import * # noqa: F403 diff --git a/dpdata/deepmd/comp.py b/dpdata/deepmd/comp.py new file mode 100644 index 000000000..f2da0108a --- /dev/null +++ b/dpdata/deepmd/comp.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.deepmd.comp import * # noqa: F403 diff --git a/dpdata/deepmd/hdf5.py b/dpdata/deepmd/hdf5.py new file mode 100644 index 000000000..9ef1c5a75 --- /dev/null +++ b/dpdata/deepmd/hdf5.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.deepmd.hdf5 import * # noqa: F403 diff --git a/dpdata/deepmd/mixed.py b/dpdata/deepmd/mixed.py new file mode 100644 index 000000000..a730d076b --- /dev/null +++ b/dpdata/deepmd/mixed.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.deepmd.mixed import * # noqa: F403 diff --git a/dpdata/deepmd/raw.py b/dpdata/deepmd/raw.py new file mode 100644 index 000000000..2c7d1d4ed --- /dev/null +++ b/dpdata/deepmd/raw.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.deepmd.raw import * # noqa: F403 diff --git a/dpdata/dftbplus/__init__.py b/dpdata/dftbplus/__init__.py new file mode 100644 index 000000000..0e9a8e392 --- /dev/null +++ b/dpdata/dftbplus/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.dftbplus import * # noqa: F403 diff --git a/dpdata/dftbplus/output.py b/dpdata/dftbplus/output.py new file mode 100644 index 000000000..133adb120 --- /dev/null +++ b/dpdata/dftbplus/output.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.dftbplus.output import * # noqa: F403 diff --git a/dpdata/fhi_aims/__init__.py b/dpdata/fhi_aims/__init__.py new file mode 100644 index 000000000..ac6ca3623 --- /dev/null +++ b/dpdata/fhi_aims/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.fhi_aims import * # noqa: F403 diff --git a/dpdata/fhi_aims/output.py b/dpdata/fhi_aims/output.py new file mode 100644 index 000000000..206a23634 --- /dev/null +++ b/dpdata/fhi_aims/output.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.fhi_aims.output import * # noqa: F403 diff --git a/dpdata/gromacs/__init__.py b/dpdata/gromacs/__init__.py new file mode 100644 index 000000000..7251bb787 --- /dev/null +++ b/dpdata/gromacs/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.gromacs import * # noqa: F403 diff --git a/dpdata/gromacs/gro.py b/dpdata/gromacs/gro.py new file mode 100644 index 000000000..8878ce8ff --- /dev/null +++ b/dpdata/gromacs/gro.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.gromacs.gro import * # noqa: F403 diff --git a/dpdata/lammps/__init__.py b/dpdata/lammps/__init__.py new file mode 100644 index 000000000..3069f9b62 --- /dev/null +++ b/dpdata/lammps/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.lammps import * # noqa: F403 diff --git a/dpdata/lammps/dump.py b/dpdata/lammps/dump.py new file mode 100644 index 000000000..0ac2b31d7 --- /dev/null +++ b/dpdata/lammps/dump.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.lammps.dump import * # noqa: F403 diff --git a/dpdata/lammps/lmp.py b/dpdata/lammps/lmp.py new file mode 100644 index 000000000..30225fcae --- /dev/null +++ b/dpdata/lammps/lmp.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.lammps.lmp import * # noqa: F403 diff --git a/dpdata/lmdb/__init__.py b/dpdata/lmdb/__init__.py new file mode 100644 index 000000000..dd764bd55 --- /dev/null +++ b/dpdata/lmdb/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.lmdb import * # noqa: F403 diff --git a/dpdata/lmdb/format.py b/dpdata/lmdb/format.py new file mode 100644 index 000000000..3db613b44 --- /dev/null +++ b/dpdata/lmdb/format.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.lmdb.format import * # noqa: F403 diff --git a/dpdata/openmx/__init__.py b/dpdata/openmx/__init__.py new file mode 100644 index 000000000..16d07d584 --- /dev/null +++ b/dpdata/openmx/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.openmx import * # noqa: F403 diff --git a/dpdata/openmx/omx.py b/dpdata/openmx/omx.py new file mode 100644 index 000000000..4b0635a96 --- /dev/null +++ b/dpdata/openmx/omx.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.openmx.omx import * # noqa: F403 diff --git a/dpdata/orca/__init__.py b/dpdata/orca/__init__.py new file mode 100644 index 000000000..ff93fd88b --- /dev/null +++ b/dpdata/orca/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.orca import * # noqa: F403 diff --git a/dpdata/orca/output.py b/dpdata/orca/output.py new file mode 100644 index 000000000..be44132cc --- /dev/null +++ b/dpdata/orca/output.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.orca.output import * # noqa: F403 diff --git a/dpdata/psi4/__init__.py b/dpdata/psi4/__init__.py new file mode 100644 index 000000000..06ef58244 --- /dev/null +++ b/dpdata/psi4/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.psi4 import * # noqa: F403 diff --git a/dpdata/psi4/input.py b/dpdata/psi4/input.py new file mode 100644 index 000000000..f151f0a48 --- /dev/null +++ b/dpdata/psi4/input.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.psi4.input import * # noqa: F403 diff --git a/dpdata/psi4/output.py b/dpdata/psi4/output.py new file mode 100644 index 000000000..66f1e33cf --- /dev/null +++ b/dpdata/psi4/output.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.psi4.output import * # noqa: F403 diff --git a/dpdata/pwmat/__init__.py b/dpdata/pwmat/__init__.py new file mode 100644 index 000000000..3a8bde615 --- /dev/null +++ b/dpdata/pwmat/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.pwmat import * # noqa: F403 diff --git a/dpdata/pwmat/atomconfig.py b/dpdata/pwmat/atomconfig.py new file mode 100644 index 000000000..c6b5928d5 --- /dev/null +++ b/dpdata/pwmat/atomconfig.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.pwmat.atomconfig import * # noqa: F403 diff --git a/dpdata/pwmat/movement.py b/dpdata/pwmat/movement.py new file mode 100644 index 000000000..d20575b48 --- /dev/null +++ b/dpdata/pwmat/movement.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.pwmat.movement import * # noqa: F403 diff --git a/dpdata/pymatgen/__init__.py b/dpdata/pymatgen/__init__.py new file mode 100644 index 000000000..eefbaad82 --- /dev/null +++ b/dpdata/pymatgen/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.pymatgen import * # noqa: F403 diff --git a/dpdata/pymatgen/molecule.py b/dpdata/pymatgen/molecule.py new file mode 100644 index 000000000..05467c12d --- /dev/null +++ b/dpdata/pymatgen/molecule.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.pymatgen.molecule import * # noqa: F403 diff --git a/dpdata/pymatgen/structure.py b/dpdata/pymatgen/structure.py new file mode 100644 index 000000000..08e1cf0e9 --- /dev/null +++ b/dpdata/pymatgen/structure.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.pymatgen.structure import * # noqa: F403 diff --git a/dpdata/rdkit/__init__.py b/dpdata/rdkit/__init__.py new file mode 100644 index 000000000..b86820923 --- /dev/null +++ b/dpdata/rdkit/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.rdkit import * # noqa: F403 diff --git a/dpdata/rdkit/sanitize.py b/dpdata/rdkit/sanitize.py new file mode 100644 index 000000000..781a8742a --- /dev/null +++ b/dpdata/rdkit/sanitize.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.rdkit.sanitize import * # noqa: F403 diff --git a/dpdata/rdkit/utils.py b/dpdata/rdkit/utils.py new file mode 100644 index 000000000..124910271 --- /dev/null +++ b/dpdata/rdkit/utils.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.rdkit.utils import * # noqa: F403 diff --git a/dpdata/siesta/__init__.py b/dpdata/siesta/__init__.py new file mode 100644 index 000000000..0210250ed --- /dev/null +++ b/dpdata/siesta/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.siesta import * # noqa: F403 diff --git a/dpdata/siesta/aiMD_output.py b/dpdata/siesta/aiMD_output.py new file mode 100644 index 000000000..04a154aea --- /dev/null +++ b/dpdata/siesta/aiMD_output.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.siesta.aiMD_output import * # noqa: F403 diff --git a/dpdata/siesta/output.py b/dpdata/siesta/output.py new file mode 100644 index 000000000..eb7e383b8 --- /dev/null +++ b/dpdata/siesta/output.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.siesta.output import * # noqa: F403 diff --git a/dpdata/vasp/__init__.py b/dpdata/vasp/__init__.py new file mode 100644 index 000000000..82488a465 --- /dev/null +++ b/dpdata/vasp/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.vasp import * # noqa: F403 diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py new file mode 100644 index 000000000..e5f0b7c71 --- /dev/null +++ b/dpdata/vasp/outcar.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.vasp.outcar import * # noqa: F403 diff --git a/dpdata/vasp/poscar.py b/dpdata/vasp/poscar.py new file mode 100644 index 000000000..c207dd2ae --- /dev/null +++ b/dpdata/vasp/poscar.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.vasp.poscar import * # noqa: F403 diff --git a/dpdata/vasp/xml.py b/dpdata/vasp/xml.py new file mode 100644 index 000000000..808ea7adb --- /dev/null +++ b/dpdata/vasp/xml.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.vasp.xml import * # noqa: F403 diff --git a/dpdata/xyz/__init__.py b/dpdata/xyz/__init__.py new file mode 100644 index 000000000..c43228e18 --- /dev/null +++ b/dpdata/xyz/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.xyz import * # noqa: F403 diff --git a/dpdata/xyz/quip_gap_xyz.py b/dpdata/xyz/quip_gap_xyz.py new file mode 100644 index 000000000..4eca6dc75 --- /dev/null +++ b/dpdata/xyz/quip_gap_xyz.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.xyz.quip_gap_xyz import * # noqa: F403 diff --git a/dpdata/xyz/xyz.py b/dpdata/xyz/xyz.py new file mode 100644 index 000000000..9db695c2a --- /dev/null +++ b/dpdata/xyz/xyz.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +from dpdata.formats.xyz.xyz import * # noqa: F403 From cfdb266ffab43e2cd4416611536999937ecaa67c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 10:38:47 +0000 Subject: [PATCH 7/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_amber_md.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_amber_md.py b/tests/test_amber_md.py index 4927aaf8f..62b355284 100644 --- a/tests/test_amber_md.py +++ b/tests/test_amber_md.py @@ -8,6 +8,7 @@ import numpy as np from comp_sys import CompLabeledSys, IsPBC from context import dpdata + from dpdata.amber.md import cell_lengths_angles_to_cell try: