[ase-users] reading externally-calculated energies

Efrem Braun efrem.braun at berkeley.edu
Mon Feb 19 22:15:57 CET 2018


Hello,

I used CP2K outside of ASE to run an ab-initio MD simulation, and I had it
print the system's configurations and energies as an xyz file. The first
two timesteps of this xyz file are:
$ cat example.xyz
     3
 i =        0, time =        0.000, E =     -5465.5196498106
  C         4.7753151998        1.4886642032        5.9515672483
  C         0.8642611428        4.2998370820        5.3928988465
  C         3.0466930517        4.1336654269        6.7372427573
     3
 i =        10, time =        5.000, E =     -5464.9735639414
  C         4.8155298134        1.4733826364        5.9468561636
  C         0.8488805807        4.2922470670        5.3836244585
  C         3.0342523925        4.1219859976        6.7176807277

I'd like to read this into ASE and have it be a trajectory file so I can
use ASE for some post-processing work. I can easily read in the file with:
$ cat ase_script.py
a = read('example.xyz', index=':', format='xyz')
traj = Trajectory('example.traj', mode='w')
for atoms in a:
    atoms.set_cell([[10, 0, 0], [0, 10, 0], [0, 0, 10]])
    atoms.set_pbc((True,True,True))
    traj.write(atoms)

However, I also want ASE to know the energy of each configuration, since I
already calculated it and I don't want to have to call the CP2K
calculator's get_potential_energy() method since this would be a waste of
computational resources. In a dream world, ASE would read the comment lines
of the example.xyz file into the Atoms object, but I figure that I will
probably have to do some post-processing on my own to set the energy for
each Atoms object.

My problem:
I can't find any method like a set_potential_energy() for the Atoms object.
Is there any way to do what I'm trying to do?
Efrem Braun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20180219/aed6beee/attachment.html>


More information about the ase-users mailing list