Accessing particle position according to their tags.

27 views
Skip to first unread message

Avishek Kumar

unread,
Mar 18, 2023, 10:57:30 PM3/18/23
to hoomd-users
Hi HOOMD Users,

I need to change the particle positions in the middle of the simulation. But, it shows an Index Error when I perform,

system=hoomd.init.read_snapshot(snap)
particleaddinsim=system.particles.add('newparticle')
addtaginsim=system.particles.get(particleaddinsim)
addtaginsim.position=[1,2,3]
print(system.particles[addtaginsim.tag].position)

On printing, I get an Index error. 

Following the above issue, I have two queries:-

1. "system.particles[addtaginsim.tag]" --- Are particle positions accessed according to their tags or by index here?

2. If it is accessed by the index, then how can we edit the position of particles depending on their tags? As we know, the particle tags are static, so I need to change the particle positions depending on their tags.

I am new to HOOMD, so facing this minor problem. Kindly guide me in understanding this concept.

Thanks and Regards,
Avishek Kumar

Tim Moore

unread,
Mar 19, 2023, 9:44:08 PM3/19/23
to hoomd...@googlegroups.com
Avishek,

This topic is covered in the tutorials, specifically "Parallel Simulation with MPI."

Best,
Tim

--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/a09f1781-3f7e-4bb4-8c41-f69a16097d52n%40googlegroups.com.


--
Tim Moore
Reply all
Reply to author
Forward
0 new messages