- Thanks to [Timothy Ryan Rogers](https://github.com/tryanrogers1)
# Introduction
This FitMol Fortran program is designed to perform a rotation on a molecule such that it minimizes the RMSD of its coordinates with respect to a __reference__ molecule.
# Compiling
Before running the program, you should compile the `FitMol.f90` file, using a suitable Fortran compiler. Examples of possible compile commands are:
```
ifort FitMol.f90 -o fitmol.exe
gfortran FitMol.f90 -o fitmol.exe
```
# Running
## interactive
After compiling, this is how to use the `fitmol` program interactively(See more details following, regarding how to prepare the input file):
1. Call the program via `./fitmol.exe`
2. Program will ask for name of the input `.xyz` file.
3. Enter the name, less the `.xyz` extension.
4. Program will ask if you want to fit now.
5. Enter `y` and return.
This program will then print to the screen the rotation matrix determined for the test molecule, as well as some other information.
### multiple fitting
More than one molecule can be fitted at the same time. To do this, the first molecule
in the `.xyz` file must be the reference molecule. As many other molecules as you wish can
be concatenated below it.
### center
By default, the center of rotation is the geometrical center of the molecule in each `.xyz` file. If you want to use a different center of rotation, make the first character(s) of the `.xyz` comment line match the atom number you wish to use.
For example, the following file has only two molecules in it, and is requesting that `fitmol` use the 4th atom as the center of rotation:
```c
5
4 ref
C -1.48058263 0.37621359 0.00000000
H -1.12392821 -0.63259642 0.00000000
H -1.12390979 0.88061178 0.87365150
H -1.12390979 0.88061178 -0.87365150
H -2.55058263 0.37622677 0.00000000
5
rot-1
C -4.44483465 5.42771734 3.70387923
H -3.62171823 5.47750008 4.38571575
H -5.24576124 4.87701765 4.15125653
H -4.77786291 6.41821850 3.47388006
H -4.13399585 4.93813311 2.80466484
```
### weighting
Additionally, if you wish to give special weight/importance to certain atoms during the fitting/rotation, you can list their weight(s) next to them in the reference structure.
For example, the following file is letting `fitmol` use the center of geometry as the center of rotation, but has given special weight to the `C` atom:
```c
5
4 ref
C -1.48058263 0.37621359 0.00000000 20.0
H -1.12392821 -0.63259642 0.00000000 1.0
H -1.12390979 0.88061178 0.87365150 1.0
H -1.12390979 0.88061178 -0.87365150 1.0
H -2.55058263 0.37622677 0.00000000 1.0
5
rot-1
C -4.44483465 5.42771734 3.70387923
H -3.62171823 5.47750008 4.38571575
H -5.24576124 4.87701765 4.15125653
H -4.77786291 6.41821850 3.47388006
H -4.13399585 4.93813311 2.80466484
```
### output
The program will produce an output file called `all molecules should have the same numner of atoms.
3. fitting and RMSD calculation use different set of atoms.