[Top][All Lists]

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

Re: vectorial manipulation

From: Jean-Noël Grad
Subject: Re: vectorial manipulation
Date: Sat, 29 Jan 2022 14:10:42 +0100
User-agent: Roundcube Webmail/1.3.17

Dear Shammi Babar,

You can use the following solution:

p = system.part[0]
v = np.copy(p.v)
v[1] += 0.2
p.v = v

You can wrap this solution in a function to make the pypresso script more readable. Here is a minimal working example:

import espressomd
import numpy as np

def update_particle_velocity(system, pid, v):
    p = system.part[pid]
    p.v = np.copy(p.v) + v

system = espressomd.System(box_l=[10, 10, 10])
system.part.add(id=1, pos=[0, 0, 0], v=[0, 0, 0])
update_particle_velocity(system, 1, [0.1, 0.2, 0.3])


On 2022-01-29 12:50, Shammi Babar wrote:
dear espresso users,

I have a question about vectorial particle properties in espresso. in
fact I need to replace velocity of some specified particles with new
values during simulation, but as explained in user guide: (section 4.3.1)
it is not allowed and will result in an error.
could you please help me solve this issue?


reply via email to

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