-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
402 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
from deepmd.jax.common import ( | ||
to_jax_array, | ||
) | ||
from deepmd.jax.utils.exclude_mask import ( | ||
AtomExcludeMask, | ||
PairExcludeMask, | ||
) | ||
|
||
|
||
def base_atomic_model_set_attr(name, value): | ||
if name in {"out_bias", "out_std"}: | ||
value = to_jax_array(value) | ||
elif name == "pair_excl" and value is not None: | ||
value = PairExcludeMask(value.ntypes, value.exclude_types) | ||
elif name == "atom_excl" and value is not None: | ||
value = AtomExcludeMask(value.ntypes, value.exclude_types) | ||
return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
from typing import ( | ||
Any, | ||
) | ||
|
||
from deepmd.dpmodel.atomic_model.dp_atomic_model import DPAtomicModel as DPAtomicModelDP | ||
from deepmd.jax.atomic_model.base_atomic_model import ( | ||
base_atomic_model_set_attr, | ||
) | ||
from deepmd.jax.common import ( | ||
flax_module, | ||
) | ||
from deepmd.jax.descriptor.base_descriptor import ( | ||
BaseDescriptor, | ||
) | ||
from deepmd.jax.fitting.base_fitting import ( | ||
BaseFitting, | ||
) | ||
|
||
|
||
@flax_module | ||
class DPAtomicModel(DPAtomicModelDP): | ||
base_descriptor_cls = BaseDescriptor | ||
"""The base descriptor class.""" | ||
base_fitting_cls = BaseFitting | ||
"""The base fitting class.""" | ||
|
||
def __setattr__(self, name: str, value: Any) -> None: | ||
value = base_atomic_model_set_attr(name, value) | ||
return super().__setattr__(name, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
from deepmd.jax.descriptor.dpa1 import ( | ||
DescrptDPA1, | ||
) | ||
from deepmd.jax.descriptor.se_e2_a import ( | ||
DescrptSeA, | ||
) | ||
|
||
__all__ = [ | ||
"DescrptSeA", | ||
"DescrptDPA1", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
from deepmd.dpmodel.descriptor.make_base_descriptor import ( | ||
make_base_descriptor, | ||
) | ||
from deepmd.jax.env import ( | ||
jnp, | ||
) | ||
|
||
BaseDescriptor = make_base_descriptor(jnp.ndarray) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
from deepmd.jax.fitting.fitting import ( | ||
DOSFittingNet, | ||
EnergyFittingNet, | ||
) | ||
|
||
__all__ = [ | ||
"EnergyFittingNet", | ||
"DOSFittingNet", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
from deepmd.dpmodel.fitting.make_base_fitting import ( | ||
make_base_fitting, | ||
) | ||
from deepmd.jax.env import ( | ||
jnp, | ||
) | ||
|
||
BaseFitting = make_base_fitting(jnp.ndarray) |
Oops, something went wrong.