Closed robinzyb closed 8 months ago
556 didn't throw any errors though
I don't know how he wrote the code for dpdata, however, I got errors when I use his files.
import dpdata
dpdata.LabeledSystem(file_name="./55-20rfj2", fmt="cp2k/aimd_output")
{
"name": "PendingDeprecationWarning",
"message": "
Hi, you got an error from dpdata,
please check if your cp2k files include full information,
otherwise its version is not supported by dpdata.
Try use dpdata plugin from cp2kdata package,
for details, please refer to
https://robinzyb.github.io/cp2kdata/
",
"stack": "---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
File ~/anaconda3/envs/ectoolkit/lib/python3.8/site-packages/dpdata/plugins/cp2k.py:22, in CP2KAIMDOutputFormat.from_labeled_system(self, file_name, restart, **kwargs)
21 xyz_file = sorted(glob.glob(f\"{file_name}/*pos*.xyz\"))[0]
---> 22 log_file = sorted(glob.glob(f\"{file_name}/*.log\"))[0]
23 print(tuple(Cp2kSystems(log_file, xyz_file, restart)))
IndexError: list index out of range
During handling of the above exception, another exception occurred:
PendingDeprecationWarning Traceback (most recent call last)
/Users/robinzhuang/workdir/tmp/cp2kdata_testspace/Untitled-1.ipynb Cell 2 line 2
<a href='vscode-notebook-cell:/Users/robinzhuang/workdir/tmp/cp2kdata_testspace/Untitled-1.ipynb#W1sZmlsZQ%3D%3D?line=0'>1</a> import dpdata
----> <a href='vscode-notebook-cell:/Users/robinzhuang/workdir/tmp/cp2kdata_testspace/Untitled-1.ipynb#W1sZmlsZQ%3D%3D?line=1'>2</a> dpdata.LabeledSystem(file_name=\"./55-20rfj2\", fmt=\"cp2k/aimd_output\")
File ~/anaconda3/envs/ectoolkit/lib/python3.8/site-packages/dpdata/system.py:281, in System.__init__(self, file_name, fmt, type_map, begin, step, data, convergence_check, **kwargs)
279 if file_name is None:
280 return
--> 281 self.from_fmt(
282 file_name,
283 fmt,
284 type_map=type_map,
285 begin=begin,
286 step=step,
287 convergence_check=convergence_check,
288 **kwargs,
289 )
291 if type_map is not None:
292 self.apply_type_map(type_map)
File ~/anaconda3/envs/ectoolkit/lib/python3.8/site-packages/dpdata/system.py:318, in System.from_fmt(self, file_name, fmt, **kwargs)
316 if fmt == \"auto\":
317 fmt = os.path.basename(file_name).split(\".\")[-1].lower()
--> 318 return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
File ~/anaconda3/envs/ectoolkit/lib/python3.8/site-packages/dpdata/system.py:1162, in LabeledSystem.from_fmt_obj(self, fmtobj, file_name, **kwargs)
1161 def from_fmt_obj(self, fmtobj, file_name, **kwargs):
-> 1162 data = fmtobj.from_labeled_system(file_name, **kwargs)
1163 if data:
1164 if isinstance(data, (list, tuple)):
File ~/anaconda3/envs/ectoolkit/lib/python3.8/site-packages/dpdata/plugins/cp2k.py:27, in CP2KAIMDOutputFormat.from_labeled_system(self, file_name, restart, **kwargs)
25 return tuple(Cp2kSystems(log_file, xyz_file, restart))
26 except :
---> 27 raise PendingDeprecationWarning(string_warning)
PendingDeprecationWarning:
Hi, you got an error from dpdata,
please check if your cp2k files include full information,
otherwise its version is not supported by dpdata.
Try use dpdata plugin from cp2kdata package,
for details, please refer to
https://robinzyb.github.io/cp2kdata/
"
}
Firstly, move 1.out
to 1.log
as *.log
is hard-coded in the code. (There should be an argument to adjust it.)
mv 1.out 1.log
Then there are no errors anymore. Catching an exception will not work.
>>> import dpdata
>>> dpdata.LabeledSystem(file_name="./", fmt="cp2k/aimd_output")
Data Summary
Labeled System
-------------------
Frame Numbers : 0
Atom Numbers : 0
Including Virials : No
Element List :
-------------------
The old code returns empty dict even if nothing is matched. Extra lines are added to raise StopIteration when all matches is failed.
@robinzyb, we only use Squash merge.
I squashed and recommitted this PR in 7fb45d88452886572edba7f48269c79fb84fb22e and force-pushed to the devel branch.
@robinzyb, we only use Squash merge.
sorry. didn't know the procedure. How should I do next?
How should I do next?
Nothing, as I've manually resolved it. But next time, you'd better select "squash and merge".
Codecov Report
Attention:
6 lines
in your changes are missing coverage. Please review.Additional details and impacted files
```diff @@ Coverage Diff @@ ## devel #558 +/- ## ========================================== - Coverage 82.90% 82.85% -0.06% ========================================== Files 73 73 Lines 6541 6556 +15 ========================================== + Hits 5423 5432 +9 - Misses 1118 1124 +6 ``` | [Files](https://app.codecov.io/gh/deepmodeling/dpdata/pull/558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepmodeling) | Coverage Δ | | |---|---|---| | [dpdata/cp2k/output.py](https://app.codecov.io/gh/deepmodeling/dpdata/pull/558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepmodeling#diff-ZHBkYXRhL2NwMmsvb3V0cHV0LnB5) | `97.28% <75.00%> (-0.56%)` | :arrow_down: | | [dpdata/plugins/cp2k.py](https://app.codecov.io/gh/deepmodeling/dpdata/pull/558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepmodeling#diff-ZHBkYXRhL3BsdWdpbnMvY3Ayay5weQ==) | `84.00% <69.23%> (-16.00%)` | :arrow_down: |:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.