pele.utils.rbtools.CoordsAdapter#

class pele.utils.rbtools.CoordsAdapter(nrigid=0, natoms=0, nlattice=0, coords=None)[source]#

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)

Methods

copy()

updateCoords(coords)

update the coordinate array

Attributes

coords

coordinate array

lattice

array view for lattice coordinates of dimension [nlattice]

natoms

number of single atoms

nlattice

number of lattice degrees of freedom

nrigid

number of rigid bodies

posAtoms

array view for atom positions of dimension [3,nrigid]

posRigid

array view for rigid body positions of dimension [3,nrigid]

rotRigid

array view for rigid body rotations of dimension [3,nrigid]