[ase-users] reading externally-calculated energies

Jens Jørgen Mortensen jjmo at dtu.dk
Tue Feb 20 08:41:41 CET 2018


Den 19-02-2018 kl. 22:15 skrev Efrem Braun via ase-users:
> 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 <http://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 <http://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)
>

Try adding this after the set_pbc line:

     E = atoms.info['E']
     atoms.calc = SinglePointCalculator(atoms, energy=E)

And add an import like this: "from ase.calculators.singlepoint import 
SinglePointCalculator".

Jens Jørgen

> 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 <http://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
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20180220/16a581ce/attachment.html>


More information about the ase-users mailing list