Skip to content
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

fix bug: cannot set property default_mesh of DeepmdDataSystem #4360

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions deepmd_utils/utils/data_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
self.system_dirs = systems
self.nsystems = len(self.system_dirs)
self.data_systems = []
self._default_mesh = None
for ii in self.system_dirs:
self.data_systems.append(
DeepmdData(
Expand Down Expand Up @@ -233,12 +234,18 @@
@lru_cache(maxsize=None)
ChiahsinChu marked this conversation as resolved.
Show resolved Hide resolved
def default_mesh(self) -> List[np.ndarray]:
"""Mesh for each system."""
return [
make_default_mesh(
self.data_systems[ii].pbc, self.data_systems[ii].mixed_type
)
for ii in range(self.nsystems)
]
if self._default_mesh is None:
self._default_mesh = [
make_default_mesh(
self.data_systems[ii].pbc, self.data_systems[ii].mixed_type
)
for ii in range(self.nsystems)
]
return self._default_mesh

@default_mesh.setter
def default_mesh(self, value: List[np.ndarray]):
self._default_mesh = value

Check warning on line 248 in deepmd_utils/utils/data_system.py

View check run for this annotation

Codecov / codecov/patch

deepmd_utils/utils/data_system.py#L248

Added line #L248 was not covered by tests

def compute_energy_shift(self, rcond=None, key="energy"):
sys_ener = []
Expand Down
Loading