I am trying to write a Python/C++ code that reads in a *.xyz file and varies the interatomic distances, angles etc. between distinct atoms in a molecule. In other words, a complete new structure with varied bond lengths should be generated. It's clear to me how to calculate the distance in cartesian coordinates between two points (atoms) P and Q.
For a better understanding I used this Methanol structure provided by the Avogadro suite:
6
H 0.84754 0.03474 1.03453
C 0.35048 0.00675 0.06084
H 0.63507 0.89276 -0.52007
H 0.66294 -0.89338 -0.48283
O -1.01083 -0.00823 0.36439
H -1.48520 -0.03263 -0.45685
However, when I manually vary the bond length between the atoms C-O by 0.1 Angstrom in Avogadro, e.g., in Methanol I have difficulties understanding how to find the new cartesian coordinates that are translated/transformed in the newly generated structure:
6
H 0.94513 0.03581 1.01277
C 0.44807 0.00782 0.03908
H 0.73266 0.89383 -0.54183
H 0.76053 -0.89231 -0.50459
O -1.01083 -0.00823 0.36439
H -1.48520 -0.03263 -0.45685
Could someone explain to me the mathematical step for generating this new set of cartesian coordinates or direct me to an example?
By looking into the Header files of Avogadro, I can tell that computationally one needs to or can use the API, i.e., the main module of Eigen which allows dense matrix and array manipulation.
I am grateful for any help!