Hello everyone!
I’ve made some DFT calculations with CRYSTAL17 and I would like to create the Atoms objects corresponding to each calculation. Nevertheless, ASE doesn’t read the output files containing the calculated forces, and I need them in the Atoms object to create a Database to use in hiPhive. Is there a way to add these forces “by hand” (something like set_forces) to the Atoms objects? Or, in the same way, create a Database “by hand” with these forces?
The “trick” is to attach a SinglepointCalculator with the forces.
e.g. to create a DB with five Si cells and random forces:
import ase.build
import ase.db
from ase.calculators.singlepoint import SinglePointCalculator
import numpy as np
atoms = ase.build.bulk("Si", cubic=True)
with ase.db.connect("test.db") as db:
for _ in range(5):
atoms.calc = SinglePointCalculator(
atoms,
forces=np.random.random((8, 3)))
db.write(atoms)
1 Like
By the way, ASE can absolutely read forces from a CRYSTAL calculation and I have used it with hiphive before. But this only works if you use the Calculator “properly”, there is not a separate function to read the files.
It would be nice if there was, maybe someone can help refactor it 
1 Like
Thank you! This isn’t clear on the site (at least I didn’t find it), and is good to know that it’s possible!