Welcome to ask.woodem.org. You may post when you login through your GitHub account.

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

0 votes
asked Sep 1, 2016 by andrewDEM (340 points)
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

1 Answer

0 votes
answered Sep 3, 2016 by eudoxos (49,030 points)
selected Oct 21, 2016 by eudoxos
Best answer

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.