MTK++ Latest version: 0.2.0

Tutorials

A Molecular Mechanics Calculation

// - MOLECULE OBJECTS
#include "vector3d.h"
#include "Molecule/collection.h"
#include "Molecule/molecule.h"
#include "Molecule/atom.h"
#include "Molecule/bond.h"

// - ELEMENT PARSERS
#include "Parsers/elementParser.h"

// - INPUT FILE PARSER
#include "Parsers/pdbParser.h"

// - PARAMETER, ATOM TYPE, STANDARD LIBRARY
#include "Parsers/paramParser.h"
#include "Parsers/atomTypeParser.h"
#include "Parsers/stdLibParser.h"

// - ATOM TYPER
#include "Molecule/atomTyper.h"

// - CONNECTIVITY
#include "Molecule/connections.h"

// - AMBER
#include "MM/amber.h"

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>

using namespace std;

int main (int argc, char **argv) 
{
    if (argc < 2 ){
      fprintf(stderr, "usage: %s <pdb> \n", argv[0] );
      return 1;
    }
    string pdbNAME = argv[1];

    // Get the environment variable MTKppDIR
    string MTKppDIR = getenv("MTKppDIR");

    // CREATE A NEW COLLECTION
    collection* pCollection = new collection();

    // READ ELEMENT INFORMATION FROM XML
    elementParser* pElementParser = new elementParser(pCollection->pElements);
    string elementXmlFile = MTKppDIR+"data/elements.xml";
    pElementParser->Read(elementXmlFile);

    // READ PARAMETER INFORMATION FROM XML
    pCollection->addParameters();
    paramParser* pParamParser = new paramParser(pCollection->getParameters());
    string parameterXmlFile = MTKppDIR+"data/parm94.xml";
    pParamParser->Read(parameterXmlFile);

    // READ ATOM TYPE INFORMATION FROM XML
    pCollection->addAtomTypes();
    atomTypeParser* pAtomTypeParser = new atomTypeParser(pCollection->getAtomTypes());
    string atomTypesXmlFile = MTKppDIR+"data/atomtypes.xml";
    pAtomTypeParser->Read(atomTypesXmlFile);

     // READ STANDARD LIBRARIES FROM XML
    pCollection->addStdLibrary();
    stdLibParser* pStdLibParser = new stdLibParser(pCollection->getStdLibrary());
    string stdLibXmlFile = MTKppDIR+"data/aminont94.xml";
    pStdLibParser->Read(stdLibXmlFile);
    stdLibXmlFile = MTKppDIR+"data/amino94.xml";
    pStdLibParser->Read(stdLibXmlFile);
    stdLibXmlFile = MTKppDIR+"data/aminoct94.xml";
    pStdLibParser->Read(stdLibXmlFile);

    // READ PDB FILE
    pdbParser* pPdbParser = new pdbParser();
    pPdbParser->Read(pdbNAME,pCollection);

    // ATOM TYPE THE PDB FILE
    atomTyper* pAtomTyper = new atomTyper();
    pAtomTyper->atomTypeByLib(pCollection);

    // ASSIGN ALL BONDS, ANGLES, TORSIONS, AND IMPROPERS
    connections* pConnections = new connections(pCollection);
    pConnections->run();

    // CREATE AN AMBER OBJECT
    amber* pAmber = new amber(pCollection);

    // DEFINE THE POTENTIAL TO BE USED
    // HERE BOND, ANGLE, TORSION, IMPROPER, NONBONDED, AND HBOND ARE CALCULATED
    pAmber->setPotential(1,1,1,1,1,1);

    // CALCULATE MM ENERGY
    pAmber->calcEnergy();

    // PRINT ENERGY INFORMATION TO THE SCREEN
    pAmber->printEnergy();

    // CLEAN UP
    delete pCollection;
    delete pPdbParser;
    delete pParamParser;
    delete pAtomTypeParser;
    delete pStdLibParser;
    delete pAtomTyper;

    return 0;
}

To Protonation A Molecule With MTK++

// - MOLECULE OBJECT
#include "Molecule/collection.h"
#include "Molecule/molecule.h"
#include "Molecule/atom.h"
#include "Molecule/bond.h"
#include "Molecule/torsion.h"
#include "Molecule/element.h"
#include "Molecule/connections.h"

// - 3D VECTOR OBJECT
#include "vector3d.h"

// - PARSERS
#include "Parsers/elementParser.h"
#include "Parsers/molParser.h"

using namespace std;

int main (int argc, char **argv)
{
    if (argc < 3 ){
      fprintf(stderr, "usage: %s <input file> <output mol file> \n", argv[0] );
      return 1;
    }
    string MTKppDIR = getenv("MTKppDIR");

    string inputFile = argv[1];
    string outputFile = argv[2];

    // CREATE A COLLECTION OF MOLECULES
    collection* pCollection = new collection();

    // READ ELEMENTS
    elementParser* pElementParser = new elementParser(pCollection->pElements);
    string elementXmlFile = MTKppDIR+"data/elements.xml";
    pElementParser->Read(elementXmlFile);

    // READ MOL FILE
    molParser* pMolParser = new molParser();
    pMolParser->Read(inputFile,pCollection);

    molecule* pMolecule = pCollection->getMolecule(1);

    // DETERMINE RINGS
    pMolecule->determineRings();

    // ADD HYDROGENS
    pMolecule->addHydrogens();

    // WRITE PROTONATED MOLECULE
    pMolParser->Write(outputFile,pMolecule);

    // - Clean up - //
    delete pCollection;
    delete pMolParser;

    return 0;
}

Generated on Fri Dec 23 2011 09:28:54 for MTK++ by Doxygen 1.7.5.1