Particle Class API

Class data structures for atomic data

class particles.Particle(pos=[0.0, 0.0, 0.0], type='blank', charge=0.0, mass=1.0)[source]

Data structure for describing any localized object in QM/MD simulations A ‘Particle’ has a position and type specifiers

Note, for an object p1 of Particle type
p1.__dict__ returns a dictionary of all class members

Current use cases include: atoms, united-atoms and ‘beads’

Possible tags: ELN = [], ASYMB = [], CTYPE = [], CHARGES = [], R = [], VEL = []
ATYPE = [], AMASS = [], MOLNUMB = [], RING_NUMB = [], RESID = [], RESN = [], CHARN = [], UNITNUMB = [], UNITTYPE = []
isTagEqualTo(key, valList)[source]

Check if tags[key]= any of the values in valList. Exits if key not in dictionary

key dictionary key valList (list) dictionary values

Returns: true if tagsDict[key]=value for any value in valueList


Define custom dictionary for id tags (eg {“molnum”:1,}) Leaving type tag as a default

td (dictionary)
class particles.ParticleContainer(idList=[], verbose=False)[source]

Main data structure for holding Particle objects. Map of global particle ID (integer) to Particle object instances


Dump a pickled version of this object

filePrefix (str): name of pickle file. will dump filePrefix.pkl

Return particles whose dictionary tags match all specified key,values The search dictionary criteria is that ALL key,value pairs must match (the logic is {key1:value1} AND {key2:value2}.....

searchDict (dict) dictionary of search pairs {keyTag:valTag}....

Returns: list of particle gid’s that satisfy search


Return a map of type to (typeIndex, mass, charge) Method assigns a type index and checkes for consistency

dictionary of {type:[typeIndex, mass, charge], ....}

Append ‘Particle’ object to this container. Updates globalID for container by incrementing the maxgid member. Performs deep copy of ptcl so container is managing memory

ptcl (Particle) correctly initialized Particle object
  1. One can imagine extra conditions on distances between ptcl being inserted and current particles.
  2. This could check for uniqueness of all globalID’s and throw error for copies
replaceID(findID, newID)[source]

Replace global particle ID with another value. Attempts to make rational checks about new IDs

findGID (int) ptcl ID to search newGID (int) ptcl ID to replace findGID with
Errors if
  • findGID not found
  • newGID already present

Generate a scatter plot of particle positions