Structure.center_of_mass#

Structure.center_of_mass(weight_type='atomic_weight')[source]#

Calculate the center of mass of the structure.

Parameters:
weight_typestr, optional

The type of weights to return. This can either be ‘atomic_weight’, ‘atomic_number’, or ‘euqual’. Defaults to ‘atomic_weight’

Returns:
NDArray

The center of mass of the structure.

Examples

>>> from importlib_resources import files
>>> from tme import Structure
>>> fname = str(files("tests.data").joinpath("Structures/5khe.cif"))
>>> structure = Structure.from_file(filename=fname)
>>> structure.center_of_mass()
array([-0.89391639, 29.94908928, -2.64736741])