Function symmetry::symm_cmass

Function Documentation

void symmetry::symm_cmass(int natoms, const std::vector<int> &nat, const std::vector<double> &wt, const std::vector<std::vector<double>> &coord, double &wmol, double &cmx, double &cmy, double &cmz)

Calculates the center of mass of a molecule.

Computes the center of mass coordinates and total molecular weight using atomic masses.

Parameters:
  • natoms – Number of atoms in the molecule

  • nat – Vector of atomic numbers for each atom

  • wt – Vector of atomic weights for each atom

  • coord – 3D coordinates of atoms (vector of vectors, size 3 x natoms)

  • wmol – Output: Total molecular weight

  • cmx – Output: X-coordinate of center of mass

  • cmy – Output: Y-coordinate of center of mass

  • cmz – Output: Z-coordinate of center of mass