docs: def center_of_mass(entity, geometric=False):
      """
      Returns gravitic [default] or geometric center of mass of an Entity.
      Geometric assumes all masses are equal (geometric=True)
      """
      
      # Structure, Model, Chain, Residue
      if isinstance(entity, Entity.Entity):
          atom_list = entity.get_atoms()
      # List of Residues, added 2018-03-17 by Nathan
      elif hasattr(entity, '__iter__') and [x for x in entity if x.level == 'R']:
          atom_list = []
          for res in entity:
              atom_list.extend(list(res.get_atoms()))
      # List of Atoms
      elif hasattr(entity, '__iter__') and [x for x in entity if x.level == 'A']:
          atom_list = entity
      else: # Some other weirdo object
          raise ValueError("Center of Mass can only be calculated from the following objects:\n"
                              "Structure, Model, Chain, Residue, list of Atoms.")
      
      masses = []
      positions = [ [], [], [] ] # [ [X1, X2, ..] , [Y1, Y2, ...] , [Z1, Z2, ...] ]
      
      for atom in atom_list:
          masses.append(atom.mass)
          
          for i, coord in enumerate(np.array(atom.coord).tolist()):
              positions[i].append(coord)
  
      # If there is a single atom with undefined mass complain loudly.
      if 'ukn' in set(masses) and not geometric:
          raise ValueError("Some Atoms don't have an element assigned.\n"
                           "Try adding them manually or calculate the geometrical center of mass instead.")
      
      if geometric:
          return [sum(coord_list)/len(masses) for coord_list in positions]
      else:       
          w_pos = [ [], [], [] ]
          for atom_index, atom_mass in enumerate(masses):
              w_pos[0].append(positions[0][atom_index]*atom_mass)
              w_pos[1].append(positions[1][atom_index]*atom_mass)
              w_pos[2].append(positions[2][atom_index]*atom_mass)
  
          return [sum(coord_list)/sum(masses) for coord_list in w_pos]