Calculate the centre of mass of an atoms object, using the closest images to the origin atom, or first atom if this is not specified. If an index_list is present, just calculate it for that subset of atoms (then the origin atom is the first in this list unless it is specified separately).
Note: Because the origin can be specified separately it need not be one of the atoms in the calculation.