-
Notifications
You must be signed in to change notification settings - Fork 35
support spin #286
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
base: master
Are you sure you want to change the base?
support spin #286
Changes from all commits
bf0e41e
aa87afc
dbd7d1c
e864ffc
e913707
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 |
---|---|---|
|
@@ -42,9 +42,14 @@ def __init__( | |
self, | ||
nopbc: bool = False, | ||
use_ele_temp: int = 0, | ||
lammps_input_file: str = None, # type: ignore | ||
): | ||
self.nopbc = nopbc | ||
self.use_ele_temp = use_ele_temp | ||
if lammps_input_file is not None: | ||
self.lammps_input = Path(lammps_input_file).read_text() | ||
else: | ||
self.lammps_input = None | ||
|
||
def get_model_devi( | ||
self, | ||
|
@@ -74,6 +79,11 @@ def _load_one_model_devi(self, fname, model_devi): | |
model_devi.add(DeviManager.MAX_DEVI_F, dd[:, 4]) # type: ignore | ||
model_devi.add(DeviManager.MIN_DEVI_F, dd[:, 5]) # type: ignore | ||
model_devi.add(DeviManager.AVG_DEVI_F, dd[:, 6]) # type: ignore | ||
# assume the 7-9 columns are for MF | ||
if dd.shape[1] >= 10: # type: ignore | ||
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. It seems to be better to judge from the lammps input if the spin model deviation is expected to be output or not. |
||
model_devi.add(DeviManager.MAX_DEVI_MF, dd[:, 7]) # type: ignore | ||
model_devi.add(DeviManager.MIN_DEVI_MF, dd[:, 8]) # type: ignore | ||
model_devi.add(DeviManager.AVG_DEVI_MF, dd[:, 9]) # type: ignore | ||
|
||
def get_ele_temp(self, optional_outputs): | ||
ele_temp = [] | ||
|
@@ -117,13 +127,21 @@ def get_confs( | |
|
||
traj_fmt = "lammps/dump" | ||
ms = dpdata.MultiSystems(type_map=type_map) | ||
if self.lammps_input is not None: | ||
lammps_input_file = "lammps_input.in" | ||
Path(lammps_input_file).write_text(self.lammps_input) | ||
Comment on lines
+130
to
+132
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. What is the purpose of dumping the lammps input script? |
||
else: | ||
lammps_input_file = None | ||
for ii in range(ntraj): | ||
if len(id_selected[ii]) > 0: | ||
if isinstance(trajs[ii], HDF5Dataset): | ||
traj = StringIO(trajs[ii].get_data()) # type: ignore | ||
else: | ||
traj = trajs[ii] | ||
ss = dpdata.System(traj, fmt=traj_fmt, type_map=type_map) | ||
# for spin job, need to read input file to get the key of the spin data | ||
ss = dpdata.System( | ||
traj, fmt=traj_fmt, type_map=type_map, input_file=lammps_input_file | ||
) | ||
ss.nopbc = self.nopbc | ||
if ele_temp: | ||
self.set_ele_temp(ss, ele_temp[ii]) | ||
|
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.
Unused import detected.
The
LmpSpinTaskGroup
import is not used within this file according to static analysis.Consider removing this import if it's not needed or add a comment explaining why it's included for future reference.
- LmpSpinTaskGroup,
📝 Committable suggestion
🧰 Tools
🪛 Ruff (0.11.9)
84-84:
dpgen2.exploration.task.LmpSpinTaskGroup
imported but unusedRemove unused import
(F401)
🤖 Prompt for AI Agents