deepmodeling / dpdata

Manipulating multiple atomic simulation data formats, including DeePMD-kit, VASP, LAMMPS, ABACUS, etc.
https://docs.deepmodeling.com/projects/dpdata/
GNU Lesser General Public License v3.0
188 stars 128 forks source link

[BUG] convesion from cp2k output to deepMD format #673

Open link796 opened 3 weeks ago

link796 commented 3 weeks ago

Bug summary

Hello,

I'm trying to convert the cp2k output file to DeepMD input format, but I keep getting an error even though I have turned on Forces, Print, Trajectories, and so on.

gen = reverse_readfile(filename) if reverse else zopen(filename, "rt")

File "/home1/.local/lib/python3.9/site-packages/monty/io.py", line 46, in zopen _name, ext = os.path.splitext(filename) File "/opt/apps/intel19/python3/3.9.7/lib/python3.9/posixpath.py", line 118, in splitext p = os.fspath(p) TypeError: expected str, bytes or os.PathLike object, not NoneType

cp2k_test.zip

I have added my input and output log files

dpdata Version

0.2.18

Input Files, Running Commands, Error Log, etc.

**import dpdata

x = dpdata.LabeledSystem('aimd', cp2k_outputtname="out.log", fmt='cp2k/aimd_output') x.to('deepmd/npy', 'dpmd_npy')**

I have used above script for reformatting data.

Steps to Reproduce

cp2k_test.zip

Further Information, Files, and Links

No response

MoseyQAQ commented 3 weeks ago

Hi, I have not used the dpdata to convert the CP2K's output, but after checking the related code, I suggest changing x = dpdata.LabeledSystem('aimd', cp2k_outputtname="out.log", fmt='cp2k/aimd_output') to x = dpdata.LabeledSystem('aimd', cp2k_outputtname="/PATH/TO/YOUR/CALCULATION/FLODER, NOT THE LOG FILE", fmt='cp2k/aimd_output')

You can find the reason in the source code at https://github.com/deepmodeling/dpdata/blob/master/dpdata/plugins/cp2k.py

robinzyb commented 3 weeks ago

please install cp2kdata as dpdata plugin and parse your output files using the following code:

import dpdata
cp2kmd_dir = "./cp2k_test/"
cp2kmd_output_name = "out.log"

dp = dpdata.LabeledSystem(cp2kmd_dir, cp2k_output_name=cp2kmd_output_name, fmt="cp2kdata/md", restart=False)
print(dp)

Note that your out.log contains duplicated header until 1147 lines, please delete these information.