Implementation of a force field for molecular geometery optimization, based on the MMFF94 by Thomas a. Halgren. Can only be applied to saturated alkanes.
Clone the repository using the following command:
git clone https://github.com/username/ForceField.git
Navigate to the directory where you cloned the repository:
cd ForceField
Compile the code using the provided makefile:
make all
Use the CL executable ff, found in the bin folder after compilation.
./ff filename.txt
#include "../include/input.h"
#include "../include/utility.h"
#include "../include/energy.h"
#include "../include/optimizers.h"
int main()
{
Molecule Mol(filepath);
// Get input coordinates
arma::mat Initial_Mol_Coordinates = Mol.getMoleculeCoordinates();
// Get atoms
int atoms = Mol.getNumberOfAtoms();
// Calculate initial energy
calcEnergy Mol_energy(&Mol);
std::cout << "Initial Mol Energy: " << std::endl;
std::cout << Mol_energy.total(Initial_Mol_Coordinates, false) << std::endl;
// Export initial coordinates (to compare with output)
Mol_energy.export_sdf(Initial_Mol_Coordinates, "mol_input");
// Optimize structure and output final energy and export the final output
//arma::mat output = Mol_energy.BFGS(0.0001);
arma::mat output = BFGS(Initial_Mol_Coordinates, 0.0001, atoms, Mol_energy);
Mol_energy.total(output);
Mol_energy.export_sdf(output, "mol_out");
}
Forcefield depends on the linear algebra library Armadillo.
View the current input format required by navigating to data/methane_optimal.txt.
- The first line contains the number of atoms in the molecule
- The next set of lines are the x, y, z coordinates for each atom and the element symbol.
- Then comes the bonding information for the atoms (bonding i to j, with bond type) (1=single, 2=double, 3=triple)
- After bonding information asterisks seperate the structural information including angles, dihedrals, stretch-bend, vanderwaals, etc.
- Calculate structure information interactions including angles, dihedrals, stretch-bending, etc on the fly.
- Extend the forcefield to all atom types featured in the MMFF94 full implementation.