Skip to content

Commit 9936003

Browse files
amcadmusHan Wang
andauthored
fix issue #381. (#383)
The returned system should be of the same type as the perturbed system Co-authored-by: Han Wang <[email protected]>
1 parent 7a1eea9 commit 9936003

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dpdata/system.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,11 @@ def perturb(self,
810810
perturbed_system : System
811811
The perturbed_system. It contains `pert_num` * frame_num of the input system frames.
812812
"""
813+
if type(self) is not dpdata.System:
814+
raise RuntimeError(
815+
f'Using method perturb() of an instance of {type(self)}. '
816+
f'Must use method perturb() of the instance of class dpdata.System.'
817+
)
813818
perturbed_system = System()
814819
nframes = self.get_nframes()
815820
for ii in range(nframes):

0 commit comments

Comments
 (0)