Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 2, 2023
1 parent f42e1a4 commit 21dbbf8
Show file tree
Hide file tree
Showing 133 changed files with 361 additions and 241 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import subprocess as sp
import sys
from datetime import date

sys.path.insert(0, os.path.abspath(".."))
Expand Down
5 changes: 2 additions & 3 deletions docs/make_format.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import csv
from typing import Any
from collections import defaultdict
from typing import Any

# ensure all plugins are loaded!
import dpdata.plugins
from dpdata.driver import Driver, Minimizer
from dpdata.format import Format
from dpdata.driver import Driver
from dpdata.driver import Minimizer
from dpdata.system import get_cls_name


Expand Down
8 changes: 2 additions & 6 deletions dpdata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from . import vasp
from . import lammps
from . import md
from .system import System
from .system import LabeledSystem
from .system import MultiSystems
from . import lammps, md, vasp
from .system import LabeledSystem, MultiSystems, System

try:
from ._version import version as __version__
Expand Down
15 changes: 9 additions & 6 deletions dpdata/abacus/md.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import os
import re
import sys
import warnings
from ast import dump
import os, sys

import numpy as np

from .scf import (
ry2ev,
bohr2ang,
kbar2evperang3,
get_block,
get_geometry_in,
get_cell,
get_coords,
get_geometry_in,
kbar2evperang3,
ry2ev,
)
import re
import warnings

# Read in geometries from an ABACUS MD trajectory.
# The atomic coordinates are read in from generated files in OUT.XXXX.
Expand Down
7 changes: 5 additions & 2 deletions dpdata/abacus/relax.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os, sys
import os
import sys

import numpy as np
from .scf import bohr2ang, kbar2evperang3, get_geometry_in, get_cell, get_coords

from .scf import bohr2ang, get_cell, get_coords, get_geometry_in, kbar2evperang3

# Read in geometries from an ABACUS RELAX(CELL-RELAX) trajectory in OUT.XXXX/runnning_relax/cell-relax.log.

Expand Down
9 changes: 6 additions & 3 deletions dpdata/abacus/scf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import os, sys
import numpy as np
from ..unit import EnergyConversion, PressureConversion, LengthConversion
import os
import re
import sys

import numpy as np

from ..unit import EnergyConversion, LengthConversion, PressureConversion

bohr2ang = LengthConversion("bohr", "angstrom").value()
ry2ev = EnergyConversion("rydberg", "eV").value()
Expand Down
7 changes: 5 additions & 2 deletions dpdata/amber/md.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import re
import os
from scipy.io import netcdf
import re

import numpy as np
from scipy.io import netcdf

from dpdata.amber.mask import pick_by_amber_mask
from dpdata.unit import EnergyConversion

from ..periodic_table import ELEMENTS

kcalmol2eV = EnergyConversion("kcal_mol", "eV").value()
Expand Down
1 change: 1 addition & 0 deletions dpdata/amber/sqm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

from dpdata.periodic_table import ELEMENTS
from dpdata.unit import EnergyConversion

Expand Down
5 changes: 3 additions & 2 deletions dpdata/ase_calculator.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from typing import List, Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, List, Optional

from ase.calculators.calculator import (
Calculator,
all_changes,
PropertyNotImplementedError,
all_changes,
)

import dpdata

from .driver import Driver

if TYPE_CHECKING:
Expand Down
10 changes: 6 additions & 4 deletions dpdata/bond_order_system.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#%%
# Bond Order System
import numpy as np
from dpdata.system import System, LabeledSystem, load_format, DataType, Axis
import dpdata.rdkit.utils
from dpdata.rdkit.sanitize import Sanitizer, SanitizeError
from copy import deepcopy

import numpy as np
from rdkit.Chem import Conformer

import dpdata.rdkit.utils
from dpdata.rdkit.sanitize import SanitizeError, Sanitizer
from dpdata.system import Axis, DataType, LabeledSystem, System, load_format

# import dpdata.rdkit.mol2


Expand Down
2 changes: 1 addition & 1 deletion dpdata/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional

from . import __version__
from .system import System, LabeledSystem, MultiSystems
from .system import LabeledSystem, MultiSystems, System


def dpdata_parser() -> argparse.ArgumentParser:
Expand Down
5 changes: 3 additions & 2 deletions dpdata/cp2k/cell.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#%%
import numpy as np
from collections import OrderedDict
import re
from collections import OrderedDict

import numpy as np


def cell_to_low_triangle(A, B, C, alpha, beta, gamma):
Expand Down
7 changes: 4 additions & 3 deletions dpdata/cp2k/output.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#%%
import numpy as np
import re
from collections import OrderedDict

import numpy as np
from scipy.constants import R
from .cell import cell_to_low_triangle

from ..unit import (
EnergyConversion,
LengthConversion,
ForceConversion,
LengthConversion,
PressureConversion,
)
from .cell import cell_to_low_triangle

#%%
AU_TO_ANG = LengthConversion("bohr", "angstrom").value()
Expand Down
6 changes: 5 additions & 1 deletion dpdata/deepmd/comp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import os, glob, shutil
import glob
import os
import shutil

import numpy as np

from .raw import load_type


Expand Down
2 changes: 0 additions & 2 deletions dpdata/deepmd/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

import h5py
import numpy as np

from wcmatch.glob import globfilter


__all__ = ["to_system_data", "dump"]


Expand Down
1 change: 1 addition & 0 deletions dpdata/deepmd/raw.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

import numpy as np


Expand Down
5 changes: 3 additions & 2 deletions dpdata/driver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Driver plugin system."""
from typing import Callable, List, Union, TYPE_CHECKING
from .plugin import Plugin
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Callable, List, Union

from .plugin import Plugin

if TYPE_CHECKING:
import ase
Expand Down
3 changes: 2 additions & 1 deletion dpdata/fhi_aims/output.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import numpy as np
import re
import warnings

import numpy as np

latt_patt = "\|\s+([0-9]{1,}[.][0-9]*)\s+([0-9]{1,}[.][0-9]*)\s+([0-9]{1,}[.][0-9]*)"
pos_patt_first = "\|\s+[0-9]{1,}[:]\s\w+\s(\w+)(\s.*[-]?[0-9]{1,}[.][0-9]*)(\s+[-]?[0-9]{1,}[.][0-9]*)(\s+[-]?[0-9]{1,}[.][0-9]*)"
pos_patt_other = "\s+[a][t][o][m]\s+([-]?[0-9]{1,}[.][0-9]*)\s+([-]?[0-9]{1,}[.][0-9]*)\s+([-]?[0-9]{1,}[.][0-9]*)\s+(\w{1,2})"
Expand Down
2 changes: 1 addition & 1 deletion dpdata/format.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Implement the format plugin system."""
import os
from collections import abc
from abc import ABC
from collections import abc

from .plugin import Plugin

Expand Down
5 changes: 3 additions & 2 deletions dpdata/gaussian/gjf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# under LGPL 3.0 license
"""Generate Gaussian input file."""

from typing import Optional, List, Tuple, Union
import uuid
import itertools
import uuid
import warnings
from typing import List, Optional, Tuple, Union

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
Expand Down
3 changes: 2 additions & 1 deletion dpdata/gaussian/log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
from ..unit import LengthConversion, EnergyConversion, ForceConversion

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
2 changes: 2 additions & 0 deletions dpdata/gromacs/gro.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
import re

import numpy as np

from ..unit import LengthConversion

nm2ang = LengthConversion("nm", "angstrom").value()
Expand Down
7 changes: 5 additions & 2 deletions dpdata/lammps/dump.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env python3

import os, sys
import os
import sys

import numpy as np

lib_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(lib_path)
import lmp
import warnings

import lmp


class UnwrapWarning(UserWarning):
pass
Expand Down
1 change: 1 addition & 0 deletions dpdata/md/msd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

from .pbc import system_pbc_shift


Expand Down
2 changes: 1 addition & 1 deletion dpdata/md/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def _compute_rdf_1frame(box, posis, atype, sel_type=[None, None], max_r=5, nbins
if type(sel_type[1]) is not list:
sel_type[1] = [sel_type[1]]
natoms = len(posis)
from ase import Atoms
import ase.neighborlist
from ase import Atoms

atoms = Atoms(positions=posis, cell=box, pbc=[1, 1, 1])
nlist = ase.neighborlist.NeighborList(
Expand Down
6 changes: 3 additions & 3 deletions dpdata/md/water.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from .pbc import posi_diff
from .pbc import posi_shift

from .pbc import posi_diff, posi_shift


def compute_bonds(box, posis, atype, oh_sel=[0, 1], max_roh=1.3, uniq_hbond=True):
Expand All @@ -17,8 +17,8 @@ def compute_bonds(box, posis, atype, oh_sel=[0, 1], max_roh=1.3, uniq_hbond=True

def compute_bonds_ase(box, posis, atype, oh_sel=[0, 1], max_roh=1.3, uniq_hbond=True):
natoms = len(posis)
from ase import Atoms
import ase.neighborlist
from ase import Atoms

atoms = Atoms(positions=posis, cell=box, pbc=[1, 1, 1])
nlist = ase.neighborlist.NeighborList(
Expand Down
3 changes: 2 additions & 1 deletion dpdata/periodic_table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path
from monty.serialization import loadfn, dumpfn

from monty.serialization import dumpfn, loadfn

fpdt = str(Path(__file__).absolute().parent / "periodic_table.json")
_pdt = loadfn(fpdt)
Expand Down
1 change: 1 addition & 0 deletions dpdata/plugins/3dmol.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Tuple

import numpy as np

from dpdata.format import Format
Expand Down
2 changes: 1 addition & 1 deletion dpdata/plugins/abacus.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dpdata.abacus.scf
import dpdata.abacus.md
import dpdata.abacus.relax
import dpdata.abacus.scf
from dpdata.format import Format


Expand Down
4 changes: 2 additions & 2 deletions dpdata/plugins/amber.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import tempfile
import os
import subprocess as sp
import tempfile

import dpdata.amber.md
import dpdata.amber.sqm
from dpdata.format import Format
from dpdata.driver import Driver, Minimizer
from dpdata.format import Format


@Format.register("amber/md")
Expand Down
8 changes: 5 additions & 3 deletions dpdata/plugins/ase.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Optional, TYPE_CHECKING, Type
from dpdata.driver import Driver, Minimizer
from dpdata.format import Format
from typing import TYPE_CHECKING, Optional, Type

import numpy as np

import dpdata
from dpdata.driver import Driver, Minimizer
from dpdata.format import Format

try:
import ase.io
Expand Down
3 changes: 2 additions & 1 deletion dpdata/plugins/cp2k.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dpdata.cp2k.output
import glob

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

Expand Down
Loading

0 comments on commit 21dbbf8

Please sign in to comment.