Code to Calculate the Center of Mass (CoM) and produce xyz file with CoM
- What the program does?
- 1. The script can read an XYZ or Gausslain log file and extract its coordinates
- 2. Then it calculates the center of mass (CoM) from those coordinates
- 3. It then saves the file_with_COM.xyz to the current directory with a dummy atom (X) with CoM corordinates
Running the python Script
- Running the script is very simple. Simply save the script as center-of-mass_calculation.py and run it as follows (considering your molecule file is water.log)
python3 center-of-mass_calculation.py water.log
- It will produce a file named water_with_CoM.xyz that will have a dummy atom X for showing the center of mass.