deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
163 stars 128 forks source link

Can trajectory files, such as MD_dump, be converted to the .xyz format? #5022

Open qinrui-oss opened 2 weeks ago

qinrui-oss commented 2 weeks ago

Background

After running a Molecular Dynamics (MD) simulation, it is often necessary to parse the output files to calculate the Mean Square Displacement (MSD). The output file, MD_dump, contains essential information such as time, position, and velocity. However, most post-processing tools, such as VMD, GROMACS, and Python MDAnalysis, cannot directly read the MD_dump file, which makes further analysis inconvenient.

Describe the solution you'd like

It would be more convenient if the trajectory file could be generated in the .xyz format after the MD simulation. The .xyz file can be read by VMD and Python MDAnalysis, and it can be converted to the g96 format using ASE. This g96 format can then be further converted to the trr format using GROMACS for calculating the MSD.

Task list only for developers

Notice Possible Changes of Behavior (Reminder only for developers)

No response

Notice any changes of core modules (Reminder only for developers)

No response

Notice Possible Changes of Core Modules (Reminder only for developers)

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

QuantumMisaka commented 2 weeks ago

I recommend extxyz format to store energy ,atom force, stress, atom velocity and other information, and which can be viewed in ASE and Ovito

Introduction to extxyz https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz

Also, if extxyz is too large, we can consider an binary format (like .npy in dpdata ?)

qinrui-oss commented 2 weeks ago

, You're right, converting the trajectory file to the .extxyz format is better because it can store more information. It would also be great if ASE-Abacus could convert the MD_dump file to the .extxyz format.

QuantumMisaka commented 2 weeks ago

@YuLiu98 @kirk0830 @pxlxingliang Any comments ?

YuLiu98 commented 1 week ago

I recommend extxyz format to store energy ,atom force, stress, atom velocity and other information, and which can be viewed in ASE and Ovito

Introduction to extxyz https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz

Also, if extxyz is too large, we can consider an binary format (like .npy in dpdata ?)

We should be careful about changing the format of MD output files. We have changed it many times in the past few versions, which often leads to incompatibility of post-processing software such as dpdata. I agree with changing the format, but the premise is that everyone can reach a consensus before doing so.

QuantumMisaka commented 1 week ago

@YuLiu98 I think so, so change its format to a usually used format may help. ASE have the capability to deal with extxyz, also I've opened an issue in dpdata related to extxyz https://github.com/deepmodeling/dpdata/issues/708

QuantumMisaka commented 1 week ago

@qinrui-oss ase can deal with extxyz format originally, but ASE-ABACUS cannot deal with MD_dump file. ASE-ABACUS interface have a very weird way to deal with MD data:

After molecular dynamics calculations, the log file 'running_md.log' can be read. If the 'STRUMD*' files are not continuous (e.g. 'STRU_MD_0', 'STRU_MD_5', 'STRU_MD_10'...), the index parameter of read should be as a slice object. For example, when using the command read('running_md.log', index=slice(0, 15, 5), format='abacus-out') to parse 'running_md.log', 'STRU_MD_0', 'STRU_MD_5' and 'STRU_MD_10' will be read.

I think that some change is needed

@1041176461 any comments ?

kirk0830 commented 1 week ago

I have read above discussion. I think a better idea is to give freedom to user to select format of file he/she wants, instead of changing one again and again. So in principle we can support extxyz, xyz, cif, md_dump, etc.

1041176461 commented 1 week ago

@QuantumMisaka ASE-ABACUS has already supported MD_dump 2 month ago, please see this issue(https://gitlab.com/1041176461/ase-abacus/-/issues/31)