Files
rdkit/External/YAeHMOP/test1.cpp
Greg Landrum 0eb983a09d WIP: optional integration with YAeHMOP (#2335)
* stub for YAeHMOP integration

* switch to using catch for the test

* first steps towards calling from rdkit

* switch to using some smart pointers

* runs, but has unpredictable seg faults. Needs valgrinding

* cleanup

* allow hacky linux builds too

* start using unique_ptrs for memory management

* don't find princ axes by default
Support probably isn't compiled in.

* save computed properties

* additional cleanup

* start working on a smarter way to get the code

* start making the cmake externalproject support work

* seems to work

* does not work yet

* this actually seems to build and work on linux

* theoretically more robust

* handle the parameter file

* first wrapper

* try to get mac builds working too

* initial pass at including reduced charge and overlap population matrices

* update docs

* backup commit

* switch to using cmake to handle the C++ spec

* switch to using a results object for the eHT calculations

* support fermi and total E
2019-03-24 08:07:50 +01:00

64 lines
1.8 KiB
C++

//
// Copyright (C) 2018 Greg Landrum
//
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do
// this in one cpp file per test
#include "catch.hpp"
#include <GraphMol/RDKitBase.h>
#include "EHTTools.h"
#include <GraphMol/FileParsers/FileParsers.h>
using namespace RDKit;
#if 1
TEST_CASE("methanol", "[basics]") {
std::string pathName = getenv("RDBASE");
pathName += "/External/YAeHMOP/test_data/";
bool sanitize = true;
bool removeHs = false;
std::unique_ptr<RWMol> mol(
MolFileToMol(pathName + "methanol.mol", sanitize, removeHs));
REQUIRE(mol);
REQUIRE(mol->getNumAtoms() == 6);
EHTTools::EHTResults res;
REQUIRE(EHTTools::runMol(*mol, res));
}
#endif
#if 1
TEST_CASE("benzene", "[basics]") {
std::string pathName = getenv("RDBASE");
pathName += "/External/YAeHMOP/test_data/";
bool sanitize = true;
bool removeHs = false;
std::unique_ptr<RWMol> mol(
MolFileToMol(pathName + "benzene.mol", sanitize, removeHs));
REQUIRE(mol);
REQUIRE(mol->getNumAtoms() == 12);
EHTTools::EHTResults res;
REQUIRE(EHTTools::runMol(*mol, res));
for (unsigned int i = 0; i < 6; ++i) {
CHECK(res.atomicCharges[i] == Approx(-0.026).margin(0.001));
}
for (unsigned int i = 6; i < 12; ++i) {
CHECK(res.atomicCharges[i] == Approx(0.026).margin(0.001));
}
CHECK(res.totalEnergy == Approx(-535.026).margin(0.001));
CHECK(res.fermiEnergy == Approx(-12.804).margin(0.001));
}
#endif
#if 1
TEST_CASE("phenol", "[basics]") {
std::string pathName = getenv("RDBASE");
pathName += "/External/YAeHMOP/test_data/";
bool sanitize = true;
bool removeHs = false;
std::unique_ptr<RWMol> mol(
MolFileToMol(pathName + "phenol.mol", sanitize, removeHs));
REQUIRE(mol);
REQUIRE(mol->getNumAtoms() == 13);
EHTTools::EHTResults res;
REQUIRE(EHTTools::runMol(*mol, res));
}
#endif