espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: net force applied on an object


From: Jean-Noël Grad
Subject: Re: net force applied on an object
Date: Sat, 18 Dec 2021 16:32:41 +0100
User-agent: Roundcube Webmail/1.3.17

Dear Shammi,

To expand on Martin's excellent answer, you may also be interested in the Observables framework, which allows recording forces either manually in a python loop, or automatically as a function of time using the TimeSeries accumulator [1] with the ParticleForces observable [2]. If you need to write the force to a file automatically, there is also the H5md writer [3].

Best,
JN

[1] https://espressomd.github.io/doc4.1.4/analysis.html#time-series
[2] https://espressomd.github.io/doc4.1.4/espressomd.html#espressomd.observables.ParticleForces
[3] https://espressomd.github.io/doc4.1.4/io.html#writing-h5md-files

On 2021-12-18 11:15, Martin Kaiser wrote:
Dear Shammi,

in the documentation,

https://espressomd.github.io/doc4.1.4/particles.html

at point 4.3, you will find the command to access particle properties,
which includes the force. In general the syntax is:

system.part[<INDEX>].<PROPERTY>

so for the force:

system.part[<INDEX>].f

This will give you an array of 3 values, which are the force in each
spatial direction, x, y and z.
You can simply use the numpy function:

numpy.linalg.norm(force)

,where "force" is the array returned by espresso, to get the
magnitude.
Do this after each integration, or save the force values to a file, to
do this analysis later for each time step.

Best,
Martin
On Dec 18, 2021 09:07, Shammi Babar <babarshammi@gmail.com> wrote:

dear users,

how to output net force applied on a particle at each step of
simulation?

thanks



reply via email to

[Prev in Thread] Current Thread [Next in Thread]