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

Error in converting cp2k v2023.1 MD trajectory #15

Closed
PolyuWeldingSpock opened this issue Jul 17, 2023 · 10 comments
Closed

Error in converting cp2k v2023.1 MD trajectory #15

PolyuWeldingSpock opened this issue Jul 17, 2023 · 10 comments
Assignees

Comments

@PolyuWeldingSpock
Copy link

Hi,

I am trying to convert AIMD trajectory with cp2kdata to get datasets for deepmd. my cp2k version is 2023.1 and cp2kdata version is 0.4.1. I have put my .out, .ener,frc.xyz and pos.xyz into same dictionary but still get err:

--- You are parsing data using package Cp2kData ---
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/dpdata/system.py", line 281, in __init__
    self.from_fmt(
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/dpdata/system.py", line 318, in from_fmt
    return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/dpdata/system.py", line 1162, in from_fmt_obj
    data = fmtobj.from_labeled_system(file_name, **kwargs)
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/cp2kdata/dpdata_plugin.py", line 71, in from_labeled_system
    cp2kmd = Cp2kOutput(output_file=cp2k_output_name, run_type="MD", path_prefix=path_prefix)
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/cp2kdata/output.py", line 83, in __init__
    self.Cp2kInfo = parse_cp2k_info(self.filename)
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/cp2kdata/block_parser/header_info.py", line 24, in parse_cp2k_info
    return Cp2kInfo(version=cp2k_info["version"][0][0][0])
IndexError: list index out of range

Here is the command I used:

import dpdata
from dpdata import System, LabeledSystem, MultiSystems
data=LabeledSystem('./xyz_3/', cp2k_output_name='cp2k.log', fmt="cp2kdata/md")

For now I have not figure out the reason. Hope you can help me. thanks!

@PolyuWeldingSpock
Copy link
Author

Here is my cp2k file. Please check.
cp2k_test.zip

@PolyuWeldingSpock
Copy link
Author

Another error occurred as below:

>>> import dpdata
>>> dp = dpdata.LabeledSystem('.', cp2k_output_name="*", fmt="cp2kdata/md")
--- You are parsing data using package Cp2kData ---
Obtian Energies From ./xyz-1.ener
Obtian Structures From ./xyz-pos-1.xyz
Obtian Froces From ./xyz-frc-1.xyz
Missing the atomic kind informations, atom names are true chemical symbols.
No cell information, please check if your inputs are correct.
--- You are parsing data using package Cp2kData ---
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/dpdata/system.py", line 281, in __init__
    self.from_fmt(
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/dpdata/system.py", line 318, in from_fmt
    return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/dpdata/system.py", line 1169, in from_fmt_obj
    self.check_data()
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/dpdata/system.py", line 305, in check_data
    dd.check(self)
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/dpdata/system.py", line 118, in check
    raise DataError(
dpdata.system.DataError: Type of cells is NoneType, but expected ndarray

It is very strange that if I type exact name of my output (cp2k.log) but not "*", the first error occurred.

@robinzyb
Copy link
Owner

have you tried 0.4.2 in devel branch?

@PolyuWeldingSpock
Copy link
Author

have you tried 0.4.2 in devel branch?

Sorry, I cloned the devel branch and it still showed 0.4.1. I cannot find the 0.4.2.

@robinzyb
Copy link
Owner

have a look at git usage. You need checkout to devel branch

@PolyuWeldingSpock
Copy link
Author

have a look at git usage. You need checkout to devel branch

Hi, I tried 0.4.2 and it make new error. PRINT_LEVEL was set to MEDIUM and frc.xyz was also generated.

>>> import dpdata
>>> dp = dpdata.LabeledSystem('./xyz_2', cp2k_output_name="std.out", fmt="cp2kdata/md")
--- You are parsing data using package Cp2kData ---
You are reading cell information from ./xyz_2/std.out
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/dpdata/system.py", line 281, in __init__
    self.from_fmt(
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/dpdata/system.py", line 318, in from_fmt
    return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/dpdata/system.py", line 1162, in from_fmt_obj
    data = fmtobj.from_labeled_system(file_name, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/cp2kdata/dpdata_plugin.py", line 73, in from_labeled_system
    cp2kmd = Cp2kOutput(output_file=cp2k_output_name, run_type="MD", path_prefix=path_prefix)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/cp2kdata/output.py", line 83, in __init__
    parse_run_type()
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/cp2kdata/output.py", line 311, in parse_md
    self.init_atomic_coordinates, self.atom_kind_list, self.chemical_symbols = parse_init_atomic_coordinates(
                                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/polyucmp/anaconda3/envs/biantieyuan/lib/python3.11/site-packages/cp2kdata/block_parser/coordinates.py", line 33, in parse_init_atomic_coordinates
    for x, y, z in zip(*match.captures("x", "y", "z")):
                        ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'captures'

I upload my file in this Onedrive link since it is too big. https://1drv.ms/u/s!AtO91yh6_pLhg7BB7OnE5Cl8p7Cwbw?e=8ILfEi

@PolyuWeldingSpock
Copy link
Author

Hi, today i found that cp2kdata 0.4.2 can also not parse output of cp2k v8.1. Here is the error message:

import dpdata
dp = dpdata.LabeledSystem('./xyz_4', cp2k_output_name="std.out", fmt="cp2kdata/md")
--- You are parsing data using package Cp2kData ---
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/dpdata/system.py", line 281, in __init__
    self.from_fmt(
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/dpdata/system.py", line 318, in from_fmt
    return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/dpdata/system.py", line 1162, in from_fmt_obj
    data = fmtobj.from_labeled_system(file_name, **kwargs)
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/cp2kdata/dpdata_plugin.py", line 73, in from_labeled_system
    cp2kmd = Cp2kOutput(output_file=cp2k_output_name, run_type="MD", path_prefix=path_prefix)
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/cp2kdata/output.py", line 83, in __init__
    parse_run_type()
  File "/home/polyucmp/anaconda3/envs/deepmd/lib/python3.10/site-packages/cp2kdata/output.py", line 335, in parse_md
    self.num_frames = len(self.energies_list)
AttributeError: 'Cp2kOutput' object has no attribute 'energies_list'. Did you mean: 'get_energies_list'?

xyz_4(1).zip
i also upload my file. Please check.

@link89
Copy link
Contributor

link89 commented Sep 7, 2023

@PolyuWeldingSpock You may try if this works for you https://github.com/link89/cp2kdata/tree/fix-2023-support

@PolyuWeldingSpock
Copy link
Author

@PolyuWeldingSpock You may try if this works for you https://github.com/link89/cp2kdata/tree/fix-2023-support

Thanks for your help. I will try!

@robinzyb
Copy link
Owner

robinzyb commented Sep 7, 2023

Thanks @link89 , @PolyuWeldingSpock if it works please close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants