get complete particle from particle ID

Asked by Lukas Liebisch


I'm looking for a function that takes the ID of a particle and returns the complete particle. Something like
particle = function(particleID)

The description of getParticleList makes it sound like it does the job, but it doesn't.
particleList = getParticleList([particleID])
seems to only work for SimpleSpheres, because when I use RotSpheres I get an error:
TypeError: No registered converter was able to extract a C++ reference to type esys::lsm::SimpleSpherePy from this Python object of type RotSphere

Any suggestions?

More context: Checkpointers save bond information as
ID1 ID2 BondTag
I am trying to recreate those bonds after loading the information from a checkpointer file. The ConnectionFinder looks something like
 maxDist = someNumber,
 bondTag = BondTag,
 pList = getParticleList([ID1,ID2]))
but as I said, the part with getParticleList doesn't work.

Best Regards,

edit: Actually the problem is that ConnectionFinder only takes SimpleSphere objects and not RotSphere objects. Had I read the documentation more carefully I wouldn't have asked the question.

Question information

English Edit question
ESyS-Particle Edit question
No assignee Edit question
Solved by:
Lukas Liebisch
Last query:
Last reply:
Revision history for this message
Lukas Liebisch (lliebisch) said :

problem changed

Revision history for this message
Dion Weatherley (d-weatherley) said :

Hi Lukas,

It sounds like you have resolved this question yourself. In any case, thought I'd suggest two possible alternative solutions for reconstructing particles and bonds from a checkpoint file:

1) use dump2geo

dump2geo works in a similar manner as dump2vtk except that it will convert checkpoint files into ESyS-Particle geometry files; the same format that GenGeo produces. These can then be imported into a new ESyS-Particle simulation using sim.readGeometry(..). One downside of this is that information on current particle state (e.g. current velocity of particles) and bonded interaction state is lost. In some cases, this is fine as only the simulation geometry is needed in the new ESyS-Particle simulation.

2) use a RestartCheckpointer instead

If particle and bond state information needs to be recovered in the new simulation, best to use ESyS-Particle's checkpoint-restart feature. This will require adding a RestartCheckpointer to the first simulation using sim.restartCheckpointer(..) and then using sim.loadCheckpoint(..) in the second simulation. Note that it is often necessary to first create the interaction groups in the second simulation script before loading the RestartCheckpoint file.

Also, it is worth mentioning that ConnectionFinder is now deprecated. It is part of ESyS-Particle's in-simulation geometry creation tools (including for example, RandomBoxPacker). These tools are now quite outdated and users are encouraged to use GenGeo instead.

I hope this helps.