sampledoc

StructureContainer Class API

Class data structures for atomic data

class structureContainer.StructureContainer(ptclC=None, bondC=None, angleC=None, dihC=None, impC=None, verbose=True)[source]

Data structure for describing a collection of Particles that have associated Bond, Angle, Dihedral descriptions

The contained ParticleContainer object has a special role... this object is a dictionary that tracks the globalIDs for all particles in this Structure.

GlobalIDs for a structure should be unique. All gid-s referred to by the BondContainer, AngleContainer etc should be consistent.

This class will also contain data related to global parameters for a simulation (eg box length, pressure, temperature.....)

compressPtclIDs()[source]

Replace all particle IDs such that if there are N particles in structure the particle ID’s run from 1...N. Tracks these changes for all other (bond, angle, dihedral) containers that reference particleIDs

dump(filePrefix)[source]

Dump a pickled version of this object

Args:
filePrefix (str): name of pickle file. will dump filePrefix.pkl
expandLatVec(percent)[source]

Expand lattice vector by a certain percent NOTE: needs to consider units

getBoxLengths()[source]

Return: list of cartesian box lengths [units ?]

getDensity()[source]

Calculate density of system in AMU/A^3 and convert to g/cm^3 NOTE: mass units contained in PtclConatiner

getLatVec()[source]

Get lattice vector NOTE: needs to consider units

getPtclNum()[source]

Return number of particles in a structure

getPtclPositions()[source]

Return list of indexed particle positions

Return: (list) [ [1, 0.5, 0.1, 12.0],
[2, 0.4, 33.3, -0.1] .....]
getSubStructure(ptclIDList, particlesOnly=False)[source]

Return a new Structure object with partcleID’s in input list Preserves IDs of particles (and any bonds, angles, dihedrals...) Bonds, angles, dihedrals... etc are included if and ONLY if all the particles of which it consists is in the ptclIDList

Args:
ptclIDList (list): global particles ID’s for which to return structure particlesOnly (bool): Flag for including ParticleContainer only (executes faster) Default includes any angles, bonds, dihedrals
Return:
New StructureContainer() object. IDs in new object are unique
getTotMass()[source]

Calculate total mass of system NOTE: needs to consider units

getVolume_c()[source]

Calculate volume of Orthorhombic unit cell Method: none cubic Volume = ( v_i x v_j ) . v_k / cubic Volume =v_i v_j v_k

readOutput(fileName)[source]

This is the ‘effective’ base class interface for a method that reads in an external output file and populates an instance of this class object

This method should be redefined for each kind of file types (typically defined by simulation version eg LAMMPS, Gaussian etc) The derived classes must implement the following:

def readOutput(self, fileName): ... ... return None

Args:
fileName (str) string of filename to input
restore(pickleName)[source]

Restore state of object from a pickled file. Sets information in an instance of this class

Args:
pickleName (str): Complete name of pickle file.
setBoxLengths(bLs)[source]

Set length of cartesian box size... [ [xmin, xmax], [ymin, ymax]...]

Args:
bLs (list) box lengths (x,y,z) values
setLatVec(latvec)[source]

Set lattice vector

Args:
latvec (list): 3-element lattice vector
setPtclPositions(ptclPosList)[source]

Reset all particle positions from an indexed list

Args:
ptclPosList (list) [ [1, 0.5, 0.1, 12.0],
[2, 0.4, 33.3, -0.1] .....]
writeInput(fileName)[source]

This is the ‘effective’ base class interface for a method that writes an input file based on the internal attributes of an instance of the StructureContainer

This method should be redefined for each kind of file types (typically defined by simulation version eg LAMMPS, Gaussian etc) The derived classes must implement the following:

def writeOutput(self, fileName): ... ... return None

Args:
fileName (str) string of filename to input