mir-group / flare

An open-source Python package for creating fast and accurate interatomic potentials.

Home Page:https://mir-group.github.io/flare

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to prepare data from CP2K for use in Flare?

lenardcarroll opened this issue · comments

Hi there, I have this .xyz (frames) file from CP2K: https://raw.githubusercontent.com/lenardcarroll/FLARE_FILES/main/AllPos_10ps.xyz

This .xyz file only contains the energy, not the cell information. How can I prepare this file for use with Flare, because when trying to use with FakeMD or training from an AIMD run, I get several errors? Such as:

"AssertionError: (Cell([0.0, 0.0, 0.0]), array([ True, True, True]))"
OR
"ValueError: cannot convert float NaN to integer"

Kind regards,
Lenard

Hi @lenardcarroll , since flare only takes periodic cell, you can use ase to add a cell information to each frame. For example

from ase.io import read, write
import numpy as np
trj = read("AllPos_10ps.xyz", index=":")
for frame in trj:
    frame.cell = np.eye(3) * 30
write("my_new_traj.xyz", trj, format="extxyz")

Thank you very much, but now I am getting errors of:
"AttributeError: 'NoneType' object has no attribute 'results'"

Check out: https://colab.research.google.com/drive/1QRnrMuwtE76G4zhxIIPx6bjFLsxy1Djq?usp=sharing

Hi @lenardcarroll , you can check this example xyz file for formatting the energy, forces and stress correctly: https://github.com/mir-group/flare/blob/development/tests/test_files/sic_dft.xyz

Properties=species:S:1:pos:R:3:momenta:R:3:forces:R:3 in the header refers to the columns where the "S" means string type and "R" means real number type.

@lenardcarroll I'll close the issue for now, and if you have further questions, you can reopen or comment below