-
I'm encountering an issue when trying to convert CP2K AIMD simulation data to the dpdata format using 1. cp2k output fileThe relevant CP2K input snippet: @SET SYSNAME molten_oxide
@SET CELL 14.8752
&GLOBAL
PRINT_LEVEL LOW
PROJECT_NAME ${SYSNAME}
RUN_TYPE MD
&END GLOBAL
&FORCE_EVAL
METHOD QS
STRESS_TENSOR ANALYTICAL
&DFT
......
&END DFT
&SUBSYS
......
&END SUBSYS
&END FORCE_EVAL
&MOTION
&MD
......
&END MD
&PRINT
&TRAJECTORY
FILENAME =${SYSNAME}.pos.xyz
FORMAT XYZ
UNIT angstrom
&EACH
MD 10
&END EACH
&END TRAJECTORY
&FORCES
FILENAME =${SYSNAME}.frc.xyz
FORMAT XYZ
UNIT amu*angstrom/fs^2
&EACH
MD 10
&END EACH
&END FORCES
&CELL
FILENAME =${SYSNAME}.cell
&EACH
MD 10
&END EACH
&END CELL
&END PRINT
&END MOTION The following output files are generated and are available:
These files contain all the essential information (atomic coordinates, forces, energies, and cell parameters) needed for training a DeepMD potential. 2. Problem Encountered:When I attempt to load the data using dpdata.LabeledSystem with
import dpdata
import numpy as np
data = dpdata.LabeledSystem('./', cp2k_output_name='tem.out', fmt='cp2kdata/md')
total_frames = len(data)
print(f'# frame number {total_frames}')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\sun78\anaconda3\lib\site-packages\dpdata\system.py", line 197, in __init__
self.from_fmt(
File "C:\Users\sun78\anaconda3\lib\site-packages\dpdata\system.py", line 234, in from_fmt
return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
File "C:\Users\sun78\anaconda3\lib\site-packages\dpdata\system.py", line 1226, in from_fmt_obj
data = fmtobj.from_labeled_system(file_name, **kwargs)
File "C:\Users\sun78\anaconda3\lib\site-packages\cp2kdata\dpdata_plugin.py", line 92, in from_labeled_system
cp2kmd = Cp2kOutput(output_file=cp2k_output_name,
File "C:\Users\sun78\anaconda3\lib\site-packages\cp2kdata\output.py", line 78, in __init__
raise ValueError(
ValueError: please provide cp2k output file with MEDIUM print level. Print Level Low doesn't provide necessary information for initialize the cp2kdata class. I noticed a similar discussion #723 where users had
import numpy as np
import dpdata
cells = np.array([[14.8752, 0, 0],
[0, 14.8752, 0],
[0, 0, 14.8752]])
data = dpdata.LabeledSystem("./",
cp2k_output_name=None,
cells=cells,
fmt="cp2kdata/md")
total_frames = len(data)
print(f'# frame number {total_frames} ')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\sun78\anaconda3\lib\site-packages\dpdata\system.py", line 197, in __init__
self.from_fmt(
File "C:\Users\sun78\anaconda3\lib\site-packages\dpdata\system.py", line 234, in from_fmt
return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
File "C:\Users\sun78\anaconda3\lib\site-packages\dpdata\system.py", line 1224, in from_fmt_obj
data = fmtobj.from_labeled_system(file_name, **kwargs)
File "C:\Users\sun78\anaconda3\lib\site-packages\cp2kdata\dpdata_plugin.py", line 92, in from_labeled_system
cp2kmd = Cp2kOutput(output_file=cp2k_output_name,
File "C:\Users\sun78\anaconda3\lib\site-packages\cp2kdata\output.py", line 119, in __init__
parse_run_type()
File "C:\Users\sun78\anaconda3\lib\site-packages\cp2kdata\output.py", line 373, in parse_md
self.md_info = parse_md_info(self.filename)
File "C:\Users\sun78\anaconda3\lib\site-packages\cp2kdata\block_parser\header_info.py", line 165, in parse_md_info
md_info = regrep(
File "C:\Users\sun78\anaconda3\lib\site-packages\monty\re.py", line 36, in regrep
gen = reverse_readfile(filename) if reverse else zopen(filename, "rt")
File "C:\Users\sun78\anaconda3\lib\site-packages\monty\io.py", line 37, in zopen
name, ext = os.path.splitext(filename)
File "C:\Users\sun78\anaconda3\lib\ntpath.py", line 204, in splitext
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType This second error seems to occur because cp2kdata still tries to process
Could you please provide guidance for this issue? It would be very helpful for users who have accumulated AIMD data with Versions:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
This is indeed a bug. I have fixed it. Please updated cp2kdata to v0.7.3 |
Beta Was this translation helpful? Give feedback.
There is no bug in the code
The folder strucutre is as follows:
. ├── B2O3-frc-1.xyz ├── B2O3-pos-1.xyz ├── B2O3.cell ├── OT.inp
*-pos-*
and*-frc-*
files can be detected. don't forget the-
.-1.ener
file out of folder since it has different frame numbers from-pos-