Bonding particles with the same tag

Asked by Mark S. Bentley

Hi all,

I have created a particle geometry file externally - for reasons of simplicity I have not specified bond information in my gengeo data file, but I have given each set of particles that I want to bond the same tag. I was hoping to simply provide bond information for each group in ESyS itself. For example, my geometry file starts:

LSMGeometry 1.2
BoundingBox 0.0 0.0 0.0 0.4 0.4 0.4
PeriodicBoundaries 0 0 0
Dimension 3D

BeginParticles
Simple
2649
0.140498417209 0.073768842645 0.333217954691 0.01 0 0
0.145826845507 0.0871316544102 0.328970236057 0.005 1 0
0.146519892077 0.0739052805102 0.341200637518 0.005 2 0

I know that each set of 3 particles with the same tag are physically in contact, so I simply want to connect them all with a stiff bond. Is it possible to direct use createConnections(...) to do this?

I tried retrieving a particle list from the sim, looping through to get a list of particles with the same tag, and then using the connection finder, but I run into a type mismatch between SimpleSphere (specified in the geometry file) and NRotSphere (specified in the simulation), i.e.:

particlelist=sim.getParticleList()

taglist=[]
for particle in particlelist:
    taglist.append(particle.getTag())

numclumps=max(taglist)
plist=[]

for clump in range(numclumps):
    del plist[:]

    # make a list of particles with given clumpID/tag
    for particle in particlelist:
        if particle.getTag() == clump:
            plist.append(particle)

    # bond particles together with bondTag = clumpID:
    sim.createConnections(
     ConnectionFinder(
          maxDist = min(radius_list)*0.1,
         bondTag = taglist[clump],
         pList = plist
        )
    )

This fails in the call to ConnectionFinder with:

"No registered converter was able to extract a C++ reference to type esys::lsm::SimpleSpherePy from this Python object of type NRotSphere".

Any advice on how to bond groups of particles with the same tag would be greatly appreciated!

Many thanks in advance, Mark

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
SteffenAbe
Solved:
Last query:
Last reply:
Revision history for this message
SteffenAbe (s-abe) said :
#1

Hi Mark,

> I was hoping to simply provide bond information for each group in ESyS itself.
Not sure if there is an easy way to do this inside ESyS, but its easy to do in GenGeo. The function to do it is MNTable3D::generateClusterBonds(groupID,tolerance,bondTag1,bondTag2). groupID and tolerance have the usual meaning (i.e. the same is in generateBonds(..) ). bondTag1 is the tag for the bonds between particles with the same particle tag (i.e. within your clusters) and bondTag2 is used for the bonds between particles with different particle tags.
If you don't want bonds between the clusters, just don't assign any interaction to the "bondTag2" bonds.

Steffen

Revision history for this message
Mark S. Bentley (msbentley) said :
#2

Thanks for the reply Steffen!

Is there also a way to read an existing GenGeo data file (as in my example above) *into* GenGeo for further processing?

I found the function MNTable3D::insertFromRawFile(...) but as far as I can see that just imports raw particle data as x, y, z, r and hence I lose the tag info. I cannot be sure from my initial packing that some "clumps" may not be very close together, and so I was hoping to bond each cluster to be safe.

It may just be easier to try and write the bond information to my GenGeo data file in the code that generates my clusters, but I figured since there were ESyS functions for bonding proximate particles I would do it there if possible.

Anyway, I'll take another look at GenGeo and see if I can use more functions there!

Regards, Mark

Revision history for this message
Best SteffenAbe (s-abe) said :
#3

Hi Mark,

> Is there also a way to read an existing GenGeo data file
> (as in my example above) *into* GenGeo for further processing?
Yes - in fact I regularly need to do this. See attached code fragment:

-----
from GenGeo import *
import sys

infilename=sys.argv[1]

## -- read old file ---
# open file
infile=open(infilename)

# read & throw away header 1st line (version info)
infile.readline()

# read 2nd line -> boundin box info
bbx_info=infile.readline().split()

xmin=float(bbx_info[1])
ymin=float(bbx_info[2])
zmin=float(bbx_info[3])
xmax=float(bbx_info[4])
ymax=float(bbx_info[5])
zmax=float(bbx_info[6])

# bounding box corners
minPoint = Vector3(xmin,ymin,zmin)
maxPoint = Vector3(xmax,ymax,zmax)

print "bounding box:", minPoint, maxPoint

# neighbour table
mntable = MNTable3D (minPoint,maxPoint,2.5*maxRadius,1)

# read & throw away header lines 3-6
for i in range(4):
    infile.readline()

# read line 7 (nr. of particles)
l=infile.readline().split()
nparts=int(l[0])

# read particles
for i in range(nparts):
    l=infile.readline().split()
    # position
    x=float(l[0])
    y=float(l[1])
    z=float(l[2])
    r=float(l[3]) # radius
    id=int(l[4]) # id
    tag=int(l[5]) # tag

    sph=Sphere(Vector3(x,y,z),r)
    sph.setTag(tag)
    mntable.insert(sph,0)

# close file
infile.close()

---
This code will get you to the point where all the particles from the existing GenGeo file are inserted into the neighour table and you can do with them what you like. For example add clustered bonds...

Steffen

Revision history for this message
Mark S. Bentley (msbentley) said :
#4

Thanks SteffenAbe, that solved my question.