Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dpdata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from . import lammps, md, vasp
from .bond_order_system import BondOrderSystem
from .formats import lammps, md, vasp
from .system import LabeledSystem, MultiSystems, System

try:
Expand Down
12 changes: 6 additions & 6 deletions dpdata/bond_order_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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.")
Expand All @@ -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"]]
)
Expand Down
1 change: 1 addition & 0 deletions dpdata/formats/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Format modules for dpdata
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dpdata/abacus/scf.py → dpdata/formats/abacus/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion dpdata/abacus/stru.py → dpdata/formats/abacus/stru.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import numpy as np

from ..unit import LengthConversion
from ...unit import LengthConversion

bohr2ang = LengthConversion("bohr", "angstrom").value()

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions dpdata/amber/md.py → dpdata/formats/amber/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dpdata/cp2k/output.py → dpdata/formats/cp2k/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np

from ..unit import (
from ...unit import (
EnergyConversion,
ForceConversion,
LengthConversion,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions dpdata/gaussian/fchk.py → dpdata/formats/gaussian/fchk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions dpdata/gaussian/log.py → dpdata/formats/gaussian/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion dpdata/gromacs/gro.py → dpdata/formats/gromacs/gro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dpdata/openmx/omx.py → dpdata/formats/openmx/omx.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if TYPE_CHECKING:
from dpdata.utils import FileType

from ..unit import (
from ...unit import (
EnergyConversion,
ForceConversion,
LengthConversion,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np

from ..periodic_table import ELEMENTS
from ...periodic_table import ELEMENTS


def _to_system_data_lower(lines):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dpdata/qe/traj.py → dpdata/formats/qe/traj.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import os

from ..unit import (
from ...unit import (
EnergyConversion,
ForceConversion,
LengthConversion,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dpdata/plugins/3dmol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
14 changes: 7 additions & 7 deletions dpdata/plugins/abacus.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

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.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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
14 changes: 7 additions & 7 deletions dpdata/plugins/amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
)

Expand All @@ -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

Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions dpdata/plugins/cp2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import glob

import dpdata.cp2k.output
from dpdata.cp2k.output import Cp2kSystems
import dpdata.formats.cp2k.output
from dpdata.format import Format
from dpdata.formats.cp2k.output import Cp2kSystems

string_warning = """
Hi, you got an error from dpdata,
Expand Down Expand Up @@ -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
Expand Down
Loading