-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RunLmpHDF5 #267
Add RunLmpHDF5 #267
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ | |
) | ||
from .run_lmp import ( | ||
RunLmp, | ||
RunLmpHDF5, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Define The Example: __all__ = [
"CollectData",
"CollRunCaly",
"DiffCSPGen",
"PrepCalyDPOptim",
"PrepCalyInput",
"PrepCalyModelDevi",
"PrepDPTrain",
"PrepLmp",
"PrepRelax",
"RunCalyDPOptim",
"RunCalyModelDevi",
"RunDPTrain",
"RunLmp",
"RunLmpHDF5",
"RunRelax",
"RunRelaxHDF5",
"SelectConfs",
] 🔗 Analysis chainConsider adding RunLmpHDF5 to all if it's part of the public API The addition of If To verify if If __all__ = [
"CollectData",
"CollRunCaly",
"DiffCSPGen",
"PrepCalyDPOptim",
"PrepCalyInput",
"PrepCalyModelDevi",
"PrepDPTrain",
"PrepLmp",
"PrepRelax",
"RunCalyDPOptim",
"RunCalyModelDevi",
"RunDPTrain",
"RunLmp",
"RunLmpHDF5",
"RunRelax",
"RunRelaxHDF5",
"SelectConfs",
] 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for __all__ definition in __init__.py
# Test: Search for __all__ definition
rg --type python '__all__\s*=' dpgen2/op/__init__.py
# If __all__ is not found, suggest adding it
if [ $? -ne 0 ]; then
echo "__all__ not found. Consider adding it with RunLmpHDF5 included."
fi
Length of output: 240 Script: #!/bin/bash
# Description: Check for __all__ definition in __init__.py without specifying file type
# Test: Search for __all__ definition
rg '__all__\s*=' dpgen2/op/__init__.py
# Capture the exit status
if [ $? -ne 0 ]; then
echo "__all__ not found. Consider adding it with RunLmpHDF5 included."
else
echo "__all__ is defined."
fi
Length of output: 195 🧰 Tools🪛 Ruff
|
||
) | ||
from .run_relax import ( | ||
RunRelax, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
Tuple, | ||
) | ||
|
||
import numpy as np | ||
from dargs import ( | ||
Argument, | ||
ArgumentEncoder, | ||
|
@@ -26,6 +27,7 @@ | |
Artifact, | ||
BigParameter, | ||
FatalError, | ||
HDF5Datasets, | ||
OPIOSign, | ||
TransientError, | ||
) | ||
|
@@ -200,7 +202,7 @@ | |
ret_dict = { | ||
"log": work_dir / lmp_log_name, | ||
"traj": work_dir / lmp_traj_name, | ||
"model_devi": work_dir / lmp_model_devi_name, | ||
"model_devi": self.get_model_devi(work_dir / lmp_model_devi_name), | ||
} | ||
plm_output = ( | ||
{"plm_output": work_dir / plm_output_name} | ||
|
@@ -213,13 +215,17 @@ | |
|
||
return OPIO(ret_dict) | ||
|
||
def get_model_devi(self, model_devi_file): | ||
return model_devi_file | ||
|
||
@staticmethod | ||
def lmp_args(): | ||
doc_lmp_cmd = "The command of LAMMPS" | ||
doc_teacher_model = "The teacher model in `Knowledge Distillation`" | ||
doc_shuffle_models = "Randomly pick a model from the group of models to drive theexploration MD simulation" | ||
doc_head = "Select a head from multitask" | ||
doc_use_ele_temp = "Whether to use electronic temperature, 0 for no, 1 for frame temperature, and 2 for atomic temperature" | ||
doc_use_hdf5 = "Use HDF5 to store trajs and model_devis" | ||
return [ | ||
Argument("command", str, optional=True, default="lmp", doc=doc_lmp_cmd), | ||
Argument( | ||
|
@@ -243,6 +249,13 @@ | |
Argument( | ||
"model_frozen_head", str, optional=True, default=None, doc=doc_head | ||
), | ||
Argument( | ||
"use_hdf5", | ||
bool, | ||
optional=True, | ||
default=False, | ||
doc=doc_use_hdf5, | ||
), | ||
Comment on lines
+252
to
+258
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implement logic for The |
||
] | ||
|
||
@staticmethod | ||
|
@@ -374,3 +387,15 @@ | |
for model_devi_file in sorted(model_devi_files): | ||
with open(model_devi_file, "r") as f2: | ||
f.write(f2.read()) | ||
|
||
|
||
class RunLmpHDF5(RunLmp): | ||
@classmethod | ||
def get_output_sign(cls): | ||
output_sign = super().get_output_sign() | ||
output_sign["traj"] = Artifact(HDF5Datasets) | ||
output_sign["model_devi"] = Artifact(HDF5Datasets) | ||
return output_sign | ||
|
||
def get_model_devi(self, model_devi_file): | ||
return np.loadtxt(model_devi_file) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Investigate and address the root cause of the type ignore comment.
The addition of
# type: ignore
suggests a potential type mismatch that's being suppressed. While this allows the code to pass type checking, it may hide underlying issues.Consider investigating the root cause of this type mismatch. If possible, modify the code to resolve the type issue without needing to suppress the type checker. If the suppression is absolutely necessary, add a comment explaining why it's needed and any potential risks.