Forum Navigation
You need to log in to create posts and topics.

Not able to extract computed Total Energy for selected structure type of atoms.


I wanted to extract Total Energy of selected structure type of atom (in my case it is BCC or FCC). I used CNA --> Select type--> Invert slec. --> Delete selc. and then Compute property modifications. But in the export attribute, I can not see the Total energy to write in the table.

Even in starting I edit user-defined column mapping and assign columns for potential energy and kinetic energy(so that I can use these values in Compute modifier).

Do, I have to add a python script to calculate the Total energy to extract it or compute type will work?

I need a table in which I can see how the Total energy of BCC atoms is changing with respect to time.

I'm attaching here 3 frames for reference.


Thank you so much for your time and great support system.





Uploaded files:
  • You need to login to have access to uploads.

Hi Prashant,

with the Compute Property Modifier you can calculate per-particle information only. In your case e.g., to calculate the per-atom total energy you could use that modifier with the following settings:
Output Property -> "Total Energy"
Expression -> "c_my_pe + c_my_ke"

If you open the Data Inspector, you will now see an extra column "Total Energy" appear.

If I understand you correctly you're asking how to calculate and export the sum of a per-atom property for only a selection of atoms. You need to create a global attribute for this using a python script modifier. So, say you want to calculate the sum of the total energy of all bcc atoms: Then, add a python modifier to your pipeline and paste the following modifier function in the script editor:

from import *
import numpy 
def modify(frame, data):
    structure_type = data.particles["Structure Type"]
    data.attributes["Total Energy bcc atoms"] = numpy.sum( data.particles["Total Energy"][ structure_type == 3])

You will now see the attribute "Total Energy bcc atoms" appear in the Data inspector under "Global attributes". You can export this information through the File-Export option "Table of values".



Thanks, Constanze, it workes.