robinzyb / cp2kdata

cp2k postprocessing tools
https://robinzyb.github.io/cp2kdata/
GNU Lesser General Public License v3.0
52 stars 18 forks source link

Shape might not be the same when using cp2kdata plugin for dpdata #48

Closed Cloudac7 closed 4 months ago

Cloudac7 commented 4 months ago

When parsing unfinished or manually touch EXIT AIMD tasks, it might run into the following issue causing failure in reading. It happens when the length of frames, energies, forces, or virials are not the same, while the expected solution, in my own opinion, is to just drop the last ones and throw out a warning about the dropping, for in detail check.

Traceback (most recent call last):
  File "/public/home/ypliucat/.conda/envs/local/bin/ai2-kit", line 8, in <module>
    sys.exit(main())
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/ai2_kit/main.py", line 123, in main
    Fire(ai2_kit)
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/fire/core.py", line 475, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/ai2_kit/tool/dpdata.py", line 57, in read
    self._read(file, **kwargs)
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/ai2_kit/tool/dpdata.py", line 120, in _read
    system = dpdata.LabeledSystem(data_path, **kwargs)
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/dpdata/system.py", line 183, in __init__
    self.from_fmt(
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/dpdata/system.py", line 220, in from_fmt
    return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/dpdata/system.py", line 1113, in from_fmt_obj
    data = fmtobj.from_labeled_system(file_name, **kwargs)
  File "/public/home/ypliucat/.conda/envs/local/lib/python3.10/site-packages/cp2kdata/dpdata_plugin.py", line 133, in from_labeled_system
    data['virials'] = cp2kmd.stress_tensor_list*volumes/EV_ANG_m3_TO_GPa
ValueError: operands could not be broadcast together with shapes (90,3,3) (89,1,1)

A case for testing is provided. example.tgz

robinzyb commented 4 months ago

resolved by https://github.com/robinzyb/cp2kdata/pull/50