Skip to content

Commit ca9a236

Browse files
ouput difference position if cp.pos is inconsistent with cp.cel (#327)
1 parent 814a1e2 commit ca9a236

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dpdata/qe/traj.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,16 @@ def to_system_data(input_name, prefix, begin = 0, step = 1) :
198198
begin = begin,
199199
step = step,
200200
convert = length_convert)
201-
assert(csteps == tmp_steps), "the step key between files are not consistent"
201+
if csteps != tmp_steps:
202+
csteps.append(None)
203+
tmp_steps.append(None)
204+
for int_id in range(len(csteps)):
205+
if csteps[int_id] != tmp_steps[int_id]:
206+
break
207+
step_id = begin + int_id*step
208+
raise RuntimeError(f"the step key between files are not consistent. "
209+
f"The difference locates at step: {step_id}, "
210+
f".pos is {csteps[int_id]}, .cel is {tmp_steps[int_id]}")
202211
except FileNotFoundError :
203212
data['cells'] = np.tile(cell, (data['coords'].shape[0], 1, 1))
204213
return data, csteps

0 commit comments

Comments
 (0)