# Function to obtain the mass of all the particles in the simulation box

37 views
Is there a command/function that I can use to obtain the mass of all the particles inside the simulation box or the scene S at a given time or at the end of the simulation?

I know I can get individual ones by using S.dem.par[0].mass for example. But there are some that don't have mass, like the STLs.
Is there a quick command that will give me the mass for all S.dem.par that have mass.
Thanks! Andrew

Hi Andrew, there is no straight function; you can do m=sum([n.dem.mass for n in S.dem.nodes]), that will sum masses of all moving nodes (so STL nodes are out, as those are not in S.dem.nodes, and have zero mass anyway). Cheers, v.