The purpose of this repo's code is to rotate a part of a molecule with the glycosidic bond around C-N bond.
It creates 360 .gjf
files, each file containing a modified molecule.
This is a made-to-order project. It won't be maintained in the future.
The main difficulty when rotating an atom (a point in 3D space) around a C-N bond was that the rotation axis isn't always passing through the origin. I solved this by following this steps:
- Subtract N atom's coordinates from each of the atoms coordinates.
- So the N atom is now in the origin, and the rotation axis is passing through the center.
- Rotate each atom around rotation axis.
- Add N atom's coordinates to each of the atoms coordinates.
- So the N atom is now back in its place.
A better solution to this problem would be to build a graph corresponding to a molecule. This way, if the path from an atom to nitrogen is shorter than to carbon, the atom should be fixed.
Here is an example molecule. You can see the C-N bond in the middle.
The main goal is to rotate all the atoms above the C-N bond, while atoms below have to remained fixed.
On the next image you can see rotation axis painted white, nitrogen atom as the origin point. To determine whether an atom should be rotated, an angle between a vector from the center nitrogene atom to the atom (marked yellow or red) and rotation axis (white) is calculated. If the angle is greater than 100 and less than 290, the atom is below the nitrogen atom and should be fixed.
Software used to display molecules is Chemcraft.