pele.utils.rbtools#
- class pele.utils.rbtools.CoordsAdapter[source]
-
class CoordsAdapter:Wrapper to access coordinate array for rigid body systems
The CoordsAdapter is a wrapper for a coords array. It creates views to directly access rigid body position & rotations, atom positions and lattice coordinates. This offers a convenient way to access coorinates without the hazzle of indexing
- Example:
>>> import numpy as np >>> from pele.utils.rbtools import CoordsAdapter >>> >>> nrigid = 10 >>> coords = np.zeros(6*nrigid) >>> ca = CoordsAdapter(nrigid=nrigid, coords=coords) >>> >>> ca.posRigid[0] = np.random.random(3) >>> ca.rotRigid[0] = np.random.random(3)
- CoordsAdapter.__init__()[source]
-
def __init__(self, nrigid=0, natoms=0, nlattice=0, coords=None):initialise the coordinate wrapper
Initialises the coordinate wrapper. The coordinates array can be either specified directly in the constructor or later changed via updateCoords.
- Parameters:
nrigid (int) – number of rigid bodies
natoms (int) – number of single atoms
nlattice (int) – number of lattice degrees of freedom
coords (
numpy.ndarray) – the coordinate array