1
/**********************************************************************
2
logppsa.cpp - Unit tests for Open Babel OBLogP and OBPSA class
4
Copyright (C) 2007 Tim Vandermmeersch
6
This file is part of the Open Babel project.
7
For more information, see <http://openbabel.sourceforge.net/>
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation version 2 of the License.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
***********************************************************************/
19
// used to set import/export for Cygwin DLLs
24
#include <openbabel/babelconfig.h>
25
#include <openbabel/mol.h>
26
#include <openbabel/obconversion.h>
27
#include <openbabel/groupcontrib.h>
33
using namespace OpenBabel;
35
int main(int argc,char *argv[])
37
// turn off slow sync with C-style output (we don't use it anyway).
38
std::ios::sync_with_stdio(false);
42
cout << "Usage: logp_psa" << endl;
43
cout << " Unit tests for OBLogP and OBPSA " << endl;
47
cout << "# Unit tests for OBLogP and OBPSA \n";
49
// the number of tests for "prove"
52
OBConversion obConversion;
53
obConversion.SetInAndOutFormats("smi", "mdl");
56
OBDescriptor* obLogP = OBDescriptor::FindType("logP");
57
OBDescriptor* obPSA = OBDescriptor::FindType("TPSA");
60
cout << "ok 1\n"; // for loading tests
62
obConversion.ReadString(&obMol, "Oc1ccccc1OC");
65
logP = obLogP->Predict(&obMol);
66
if (IsNear(logP , 1.4008)) { // value from JOELib2
67
cout << "ok 2 # " << logP << '\n';
69
cout << "not ok 2 # " << logP << '\n';
72
psa = obPSA->Predict(&obMol);
73
if (IsNear(psa , 29.46)) { // value from JOELib2
74
cout << "ok 3 # " << psa << '\n';
76
cout << "not ok 3 # " << psa << '\n';
79
obConversion.ReadString(&obMol, "c1ccccc1CBr");
82
logP = obLogP->Predict(&obMol);
83
if (IsNear(logP, 2.5815)) { // Value from JOELib2
84
cout << "ok 4 # " << logP << '\n';
86
cout << "not ok 4 # " << logP << '\n';
89
psa = obPSA->Predict(&obMol);
90
if (IsNear(psa, 0.0)) { // Value from JOELib2
91
cout << "ok 5 # " << psa << '\n';
93
cout << "not ok 5 # " << psa << '\n';
96
obConversion.ReadString(&obMol, "Cc1ccccc1NC(=O)C");
99
logP = obLogP->Predict(&obMol);
100
if (IsNear(logP, 2.0264)) { // JOELib2 = 1.9534, more H added on N
101
cout << "ok 6 # " << logP << '\n';
103
cout << "not ok 6 # " << logP << '\n';
106
psa = obPSA->Predict(&obMol);
107
if (IsNear(psa, 29.1)) { // Value from JOELib2
108
cout << "ok 7 # " << psa << '\n';
110
cout << "not ok 7 # " << psa << '\n';