Skip to content

Commit

Permalink
Merge branch 'devel' into add_dpa1
Browse files Browse the repository at this point in the history
  • Loading branch information
HydrogenSulfate committed Nov 29, 2024
2 parents ac479ed + a11f264 commit 3e64196
Show file tree
Hide file tree
Showing 83 changed files with 320 additions and 384 deletions.
56 changes: 28 additions & 28 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
exclude: ^source/3rdparty
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.7.4
rev: v0.8.0
hooks:
- id: ruff
args: ["--fix"]
Expand Down Expand Up @@ -60,18 +60,18 @@ repos:
- id: blacken-docs
# C++
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.3
rev: v19.1.4
hooks:
- id: clang-format
exclude: ^(source/3rdparty|source/lib/src/gpu/cudart/.+\.inc|.+\.ipynb$)
# markdown, yaml, CSS, javascript
# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: v4.0.0-alpha.8
# hooks:
# - id: prettier
# types_or: [markdown, yaml, css]
# # workflow files cannot be modified by pre-commit.ci
# exclude: ^(source/3rdparty|\.github/workflows|\.clang-format)
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [markdown, yaml, css]
# workflow files cannot be modified by pre-commit.ci
exclude: ^(source/3rdparty|\.github/workflows|\.clang-format)
# Shell
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.10.0-1
Expand All @@ -83,25 +83,25 @@ repos:
hooks:
- id: cmake-format
#- id: cmake-lint
# - repo: https://github.com/njzjz/mirrors-bibtex-tidy
# rev: v1.13.0
# hooks:
# - id: bibtex-tidy
# args:
# - --curly
# - --numeric
# - --align=13
# - --blank-lines
# # disable sort: the order of keys and fields has explict meanings
# #- --sort=key
# - --duplicates=key,doi,citation,abstract
# - --merge=combine
# #- --sort-fields
# #- --strip-comments
# - --trailing-commas
# - --encode-urls
# - --remove-empty-fields
# - --wrap=80
- repo: https://github.com/njzjz/mirrors-bibtex-tidy
rev: v1.13.0
hooks:
- id: bibtex-tidy
args:
- --curly
- --numeric
- --align=13
- --blank-lines
# disable sort: the order of keys and fields has explict meanings
#- --sort=key
- --duplicates=key,doi,citation,abstract
- --merge=combine
#- --sort-fields
#- --strip-comments
- --trailing-commas
- --encode-urls
- --remove-empty-fields
- --wrap=80
# license header
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
Expand Down
2 changes: 1 addition & 1 deletion deepmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def DeepPotential(*args, **kwargs):


__all__ = [
"__version__",
"DeepPotential",
"__version__",
]
12 changes: 6 additions & 6 deletions deepmd/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
)

__all__ = [
"select_idx_map",
"make_default_mesh",
"j_loader",
"VALID_ACTIVATION",
"VALID_PRECISION",
"expand_sys_str",
"get_np_precision",
"VALID_PRECISION",
"VALID_ACTIVATION",
"j_loader",
"make_default_mesh",
"select_idx_map",
]

_PRECISION = Literal["default", "float16", "float32", "float64"]
Expand All @@ -63,9 +63,9 @@
if TYPE_CHECKING:
_DICT_VAL = TypeVar("_DICT_VAL")
__all__ += [
"_ACTIVATION",
"_DICT_VAL",
"_PRECISION",
"_ACTIVATION",
]


Expand Down
12 changes: 6 additions & 6 deletions deepmd/dpmodel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
)

__all__ = [
"DPModelCommon",
"PRECISION_DICT",
"DEFAULT_PRECISION",
"NativeOP",
"ModelOutputDef",
"PRECISION_DICT",
"DPModelCommon",
"FittingOutputDef",
"ModelOutputDef",
"NativeOP",
"OutputVariableDef",
"model_check_output",
"fitting_check_output",
"get_reduce_name",
"get_deriv_name",
"get_hessian_name",
"get_reduce_name",
"model_check_output",
]


Expand Down
12 changes: 6 additions & 6 deletions deepmd/dpmodel/atomic_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
)

__all__ = [
"make_base_atomic_model",
"BaseAtomicModel",
"DPAtomicModel",
"DPEnergyAtomicModel",
"PairTabAtomicModel",
"LinearEnergyAtomicModel",
"DPZBLLinearEnergyAtomicModel",
"DPDOSAtomicModel",
"DPPolarAtomicModel",
"DPDipoleAtomicModel",
"DPEnergyAtomicModel",
"DPPolarAtomicModel",
"DPZBLLinearEnergyAtomicModel",
"LinearEnergyAtomicModel",
"PairTabAtomicModel",
"make_base_atomic_model",
]
4 changes: 2 additions & 2 deletions deepmd/dpmodel/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ def safe_cast_array(


__all__ = [
"GLOBAL_NP_FLOAT_PRECISION",
"DEFAULT_PRECISION",
"GLOBAL_ENER_FLOAT_PRECISION",
"GLOBAL_NP_FLOAT_PRECISION",
"PRECISION_DICT",
"RESERVED_PRECISON_DICT",
"DEFAULT_PRECISION",
"NativeOP",
]
8 changes: 4 additions & 4 deletions deepmd/dpmodel/descriptor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
)

__all__ = [
"DescrptDPA1",
"DescrptDPA2",
"DescrptHybrid",
"DescrptSeA",
"DescrptSeAttenV2",
"DescrptSeR",
"DescrptSeT",
"DescrptSeTTebd",
"DescrptDPA1",
"DescrptSeAttenV2",
"DescrptDPA2",
"DescrptHybrid",
"make_base_descriptor",
]
6 changes: 3 additions & 3 deletions deepmd/dpmodel/fitting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
)

__all__ = [
"InvarFitting",
"make_base_fitting",
"DOSFittingNet",
"DipoleFitting",
"EnergyFittingNet",
"InvarFitting",
"PolarFitting",
"DOSFittingNet",
"PropertyFittingNet",
"make_base_fitting",
]
2 changes: 1 addition & 1 deletion deepmd/dpmodel/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
)

__all__ = [
"DPModelCommon",
"EnergyModel",
"PropertyModel",
"DPModelCommon",
"SpinModel",
"make_model",
]
26 changes: 13 additions & 13 deletions deepmd/dpmodel/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@
)

__all__ = [
"EnvMat",
"make_multilayer_network",
"make_embedding_network",
"make_fitting_network",
"AtomExcludeMask",
"EmbeddingNet",
"EnvMat",
"FittingNet",
"NativeLayer",
"NativeNet",
"NetworkCollection",
"load_dp_model",
"save_dp_model",
"traverse_model_dict",
"build_neighbor_list",
"nlist_distinguish_types",
"get_multiple_nlist_key",
"PairExcludeMask",
"build_multiple_neighbor_list",
"build_neighbor_list",
"extend_coord_with_ghosts",
"normalize_coord",
"get_multiple_nlist_key",
"inter2phys",
"load_dp_model",
"make_embedding_network",
"make_fitting_network",
"make_multilayer_network",
"nlist_distinguish_types",
"normalize_coord",
"phys2inter",
"save_dp_model",
"to_face_distance",
"AtomExcludeMask",
"PairExcludeMask",
"traverse_model_dict",
]
16 changes: 8 additions & 8 deletions deepmd/entrypoints/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,9 @@ def test_dos(
frame_output = np.hstack((test_out, pred_out))

save_txt_file(
detail_path.with_suffix(".dos.out.%.d" % ii),
detail_path.with_suffix(f".dos.out.{ii}"),
frame_output,
header="%s - %.d: data_dos pred_dos" % (system, ii),
header=f"{system} - {ii}: data_dos pred_dos",
append=append_detail,
)

Expand All @@ -718,9 +718,9 @@ def test_dos(
frame_output = np.hstack((test_out, pred_out))

save_txt_file(
detail_path.with_suffix(".ados.out.%.d" % ii),
detail_path.with_suffix(f".ados.out.{ii}"),
frame_output,
header="%s - %.d: data_ados pred_ados" % (system, ii),
header=f"{system} - {ii}: data_ados pred_ados",
append=append_detail,
)

Expand Down Expand Up @@ -860,9 +860,9 @@ def test_property(
frame_output = np.hstack((test_out, pred_out))

save_txt_file(
detail_path.with_suffix(".property.out.%.d" % ii),
detail_path.with_suffix(f".property.out.{ii}"),
frame_output,
header="%s - %.d: data_property pred_property" % (system, ii),
header=f"{system} - {ii}: data_property pred_property",
append=append_detail,
)

Expand All @@ -874,9 +874,9 @@ def test_property(
frame_output = np.hstack((test_out, pred_out))

save_txt_file(
detail_path.with_suffix(".aproperty.out.%.d" % ii),
detail_path.with_suffix(f".aproperty.out.{ii}"),
frame_output,
header="%s - %.d: data_aproperty pred_aproperty" % (system, ii),
header=f"{system} - {ii}: data_aproperty pred_aproperty",
append=append_detail,
)

Expand Down
8 changes: 4 additions & 4 deletions deepmd/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
import deepmd.lib

__all__ = [
"GLOBAL_NP_FLOAT_PRECISION",
"GLOBAL_ENER_FLOAT_PRECISION",
"global_float_prec",
"GLOBAL_CONFIG",
"SHARED_LIB_MODULE",
"GLOBAL_ENER_FLOAT_PRECISION",
"GLOBAL_NP_FLOAT_PRECISION",
"SHARED_LIB_DIR",
"SHARED_LIB_MODULE",
"global_float_prec",
]

log = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions deepmd/infer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
)

__all__ = [
"DeepPot",
"calc_model_devi",
"DeepEval",
"DeepPot",
"DeepPotential",
"calc_model_devi",
]


Expand Down
6 changes: 2 additions & 4 deletions deepmd/infer/deep_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,7 @@ def _standard_input(self, coords, cells, atom_types, fparam, aparam, mixed_type)
fparam = np.tile(fparam.reshape([-1]), [nframes, 1])
else:
raise RuntimeError(
"got wrong size of frame param, should be either %d x %d or %d"
% (nframes, fdim, fdim)
f"got wrong size of frame param, should be either {nframes} x {fdim} or {fdim}"
)
if aparam is not None:
fdim = self.get_dim_aparam()
Expand All @@ -516,8 +515,7 @@ def _standard_input(self, coords, cells, atom_types, fparam, aparam, mixed_type)
aparam = np.tile(aparam.reshape([-1]), [nframes, natoms])
else:
raise RuntimeError(
"got wrong size of frame param, should be either %d x %d x %d or %d x %d or %d"
% (nframes, natoms, fdim, natoms, fdim, fdim)
f"got wrong size of frame param, should be either {nframes} x {natoms} x {fdim} or {natoms} x {fdim} or {fdim}"
)
return coords, cells, atom_types, fparam, aparam, nframes, natoms

Expand Down
8 changes: 4 additions & 4 deletions deepmd/infer/model_devi.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,16 @@ def write_model_devi_out(
assert devi.shape[1] == 8
else:
assert devi.shape[1] > 8
header = "%s\n%10s" % (header, "step")
header = f"{header}\n{'step':10s}"
for item in "vf":
header += "%19s%19s%19s" % (
header += "{:19s}{:19s}{:19s}".format(
f"max_devi_{item}",
f"min_devi_{item}",
f"avg_devi_{item}",
)
header += "%19s" % "devi_e"
header += f'{"devi_e":19s}'
if atomic:
header += "%19s" % "atm_devi_f(N)"
header += f"{'atm_devi_f(N)':19s}"
with open(fname, "ab") as fp:
np.savetxt(
fp,
Expand Down
8 changes: 4 additions & 4 deletions deepmd/jax/descriptor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
)

__all__ = [
"DescrptDPA1",
"DescrptDPA2",
"DescrptHybrid",
"DescrptSeA",
"DescrptSeAttenV2",
"DescrptSeR",
"DescrptSeT",
"DescrptSeTTebd",
"DescrptDPA1",
"DescrptSeAttenV2",
"DescrptDPA2",
"DescrptHybrid",
]
Loading

0 comments on commit 3e64196

Please sign in to comment.