forked from deepmodeling/deepmd-kit
-
Notifications
You must be signed in to change notification settings - Fork 4
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
65 changed files
with
1,190 additions
and
274 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
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,41 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
from deepmd.dpmodel.descriptor.se_e2_a import ( | ||
DescrptSeA, | ||
) | ||
from deepmd.dpmodel.fitting.ener_fitting import ( | ||
EnergyFittingNet, | ||
) | ||
from deepmd.dpmodel.model.dp_model import ( | ||
DPModel, | ||
) | ||
|
||
|
||
def get_model(data: dict) -> DPModel: | ||
"""Get a DPModel from a dictionary. | ||
Parameters | ||
---------- | ||
data : dict | ||
The data to construct the model. | ||
""" | ||
descriptor_type = data["descriptor"].pop("type") | ||
fitting_type = data["fitting_net"].pop("type") | ||
if descriptor_type == "se_e2_a": | ||
descriptor = DescrptSeA( | ||
**data["descriptor"], | ||
) | ||
else: | ||
raise ValueError(f"Unknown descriptor type {descriptor_type}") | ||
if fitting_type == "ener": | ||
fitting = EnergyFittingNet( | ||
ntypes=descriptor.get_ntypes(), | ||
dim_descrpt=descriptor.get_dim_out(), | ||
**data["fitting_net"], | ||
) | ||
else: | ||
raise ValueError(f"Unknown fitting type {fitting_type}") | ||
return DPModel( | ||
descriptor=descriptor, | ||
fitting=fitting, | ||
type_map=data["type_map"], | ||
) |
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
Oops, something went wrong.