Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
link796 opened this issue Jun 10, 2024 · 2 comments
Open

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

link796 opened this issue Jun 10, 2024 · 2 comments

Comments

@link796
Copy link

link796 commented Jun 10, 2024

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

@link796 link796 added the bug Something isn't working label Jun 10, 2024
@MoseyQAQ
Copy link
Contributor

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
Copy link
Collaborator

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.

@robinzyb robinzyb added cp2k and removed bug Something isn't working labels Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants