A Fortran code of converting bond lengths to Cartersian coordinates.
Converting Cartesian coordinates to bond lengths is simpler than the inverse convert. The bond-Cart transformation is intuitively straight-forward but hard to realize.
The first difficulty I met is how to solve the fourth coordinates if we knew three coordinates and three lengths, which confused me for many days. Actually this is a common transformation in GIS called trilateration.
The second difficulty I didn't solve is how to deal with the colinear condition. If three or more atoms are in one line, there will not be a solution for the fourth point, although the condition is rare.
- The first atom was placed at the origin.
- The second atom was placed at the x axis.
- The third atom was placed at the xOy plane.
- The fourth was placed at the positive half Z axis.
- Then other atoms was solved one by one.
The core subroutine is bonCar
. The number of bond lengths, bond lengths, the number of atoms are required.
Intel Fortran Compiler is needed. No more prerequisite.
- Clone this repository.
make