Skip to content

Commit

Permalink
fix bug: cannot set property default_mesh o DeepmdDataSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiahsinChu committed Nov 15, 2024
1 parent 440bb82 commit 9117518
Showing 1 changed file with 13 additions and 6 deletions.
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 @@ def __init__(
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 @@ def _load_test(self, ntests=-1):
@lru_cache(maxsize=None)
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

0 comments on commit 9117518

Please sign in to comment.