cog

mdtools.structure.cog(ag, pbc=False, cmp='group', make_whole=False, debug=False)[source]

Calculate the center of geometry (a.k.a centroid) of (compounds of) an MDAnalysis AtomGroup.

Parameters:
Returns:

center (numpy.ndarray) – Center of geometry position of each compound in ag. If cmp was set to 'group', the output will be a single position vector of shape (3,). Else, the output will be a 2d array of shape (n, 3) where n is the number of compounds in ag.

Raises:

RuntimeWarning : – If debug is True and the center of geometry of any compound is nan.

See also

MDAnalysis.core.groups.AtomGroup.center()

Weighted center of (compounds of) the group

MDAnalysis.core.groups.AtomGroup.center_of_geometry()

Center of geometry of (compounds of) the group

MDAnalysis.core.groups.AtomGroup.center_of_mass()

Center of mass of (compounds of) the group

mdtools.structure.center()

Different types of centers of (compounds of) an MDAnalysis AtomGroup

mdtools.structure.wcenter()

Weighted center of (compounds of) an MDAnalysis AtomGroup

mdtools.structure.wcenter_pos()

Calculate the weighted center of a position array

mdtools.structure.coc()

Center of charge of (compounds of) an MDAnalysis AtomGroup

mdtools.structure.com()

Center of mass of (compounds of) an MDAnalysis AtomGroup

Notes

This function uses the center_of_geometry() method of the input AtomGroup to calculate the center of geometry.

Todo

Check if it is really necessary to wrap all Atoms back into the primary unit cell before calling center_of_geometry() with unwrap set to True. The currently done back-wrapping is a serious problem, because it implies an inplace change of the Atom coordinates.