Skip to content

Rotate molecule with the glycosidic bond around C-N bond

License

Notifications You must be signed in to change notification settings

andrewyazura/rotate-molecules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SWUbanner

Rotate molecules

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.

Note

This is a made-to-order project. It won't be maintained in the future.

Main problem

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:

  1. Subtract N atom's coordinates from each of the atoms coordinates.
    1. So the N atom is now in the origin, and the rotation axis is passing through the center.
  2. Rotate each atom around rotation axis.
  3. Add N atom's coordinates to each of the atoms coordinates.
    1. So the N atom is now back in its place.

A better approach

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.

Example

Here is an example molecule. You can see the C-N bond in the middle.

Preview

Front view:

image

Side view:

image

The main goal is to rotate all the atoms above the C-N bond, while atoms below have to remained fixed.

Preview

image

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.

Preview

image

Result

rotate-molecule

Endnote

Software used to display molecules is Chemcraft.

About

Rotate molecule with the glycosidic bond around C-N bond

Topics

Resources

License

Stars

Watchers

Forks

Languages