How to sort ase xyz file according to ascending order of energies
Amitcuhp opened this issue · 4 comments
Amitcuhp commented
How to sort ase xyz file in ascending order of energies
Amitcuhp commented
Very thankful to you in advance
bernstei commented
This is a general python question, no specific to extxyz or libAtoms.
More or less:
python -c 'import ase.io<http://ase.io>; ase.io<http://ase.io>.write("outfile.xyz<http://outfile.xyz>", sorted(ase.io<http://ase.io>.read("infile.xyz<http://infile.xyz>", ":"), key=lambda at: at.info<http://at.info>["energy"]))'
(assuming the energy is in the info key "energy")
jameskermode commented
Thanks Noam. I tried to edit out the bogus links above, but it seems email replies don't support Markdown. Here's a copy-pastable version
python -c 'import ase.io; ase.io.write("outfile.xyz", sorted(ase.io.read("infile.xyz", ":"), key=lambda at: at.info["energy"]))'
Amitcuhp commented
Thanks for your help. I am very thankful to you.
Can you tell me one think more please:
How to add values to all the energies .
in simple words , i want to add 200 to all energies values...can u help