File: PartialChargeDescriptors_test.C

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 239,848 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; makefile: 93
file content (117 lines) | stat: -rw-r--r-- 3,103 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//

#include <BALL/CONCEPT/classTest.h>
#include <BALLTestConfig.h>

///////////////////////////

#include <BALL/QSAR/partialChargeDescriptors.h>
#include <BALL/FORMAT/SDFile.h>
#include <BALL/FORMAT/HINFile.h>
#include <BALL/KERNEL/system.h>
#include <BALL/KERNEL/molecule.h>
#include <BALL/KERNEL/PTE.h>

///////////////////////////

START_TEST(SimpleDescriptors)

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

using namespace BALL;

	SDFile infile(BALL_TEST_DATA_PATH(descriptors_test.sdf));
	System S;
	infile >> S;

	Molecule * molecule;
	Size limit = S.countMolecules();


///////////////////////
CHECK(TotalPositivePartialCharge)
	TotalPositivePartialCharge tppc;
	S.apply(tppc);

	PRECISION(0.0001)
	double results[] = {0.318341, 0.370549, 0.426301, 0.435711, 1.42026, 1.64172, 0.190191, 0.32429, 0};
	for (Size i=0;i!=limit;++i) 
	{
		molecule = S.getMolecule(i);
		TEST_EQUAL(molecule->hasProperty("TotalPositivePartialCharge"), true);
		if (molecule->hasProperty("TotalPositivePartialCharge"))
		{
			double value = molecule->getProperty("TotalPositivePartialCharge").getDouble();
			TEST_REAL_EQUAL(value, results[i]);
		}
	}

RESULT


///////////////////////////////////
CHECK(TotalNegativePartialCharge)
	TotalNegativePartialCharge tnpc;
	S.apply(tnpc);

	PRECISION(0.0001)
	double results[] = {-0.318341, -0.370549, -0.426301, -0.435711, -1.42026, -1.64172, -0.190191, -0.32429, 0};
	for (Size i=0;i!=limit;++i)
	{
		molecule = S.getMolecule(i);
		TEST_EQUAL(molecule->hasProperty("TotalNegativePartialCharge"), true);
		if (molecule->hasProperty("TotalNegativePartialCharge"))
		{
			double value = molecule->getProperty("TotalNegativePartialCharge").getDouble();
			TEST_REAL_EQUAL(value, results[i])
		}
	}

RESULT


//////////////////////////////////
CHECK(RelPositivePartialCharge)
	RelPositivePartialCharge rppc;
	S.apply(rppc);

	double results[] = {0.0833333, 0.166667, 0.0727568, 0.142361, 0.140169, 0.26484, 0.654438, 0.193613, 0};
	for (Size i=0;i!=limit;++i)
	{
		molecule = S.getMolecule(i);
		TEST_EQUAL(molecule->hasProperty("RelPositivePartialCharge"), true)
		if (molecule->hasProperty("RelPositivePartialCharge"))
		{
			double value = molecule->getProperty("RelPositivePartialCharge").getDouble();
			TEST_REAL_EQUAL(value, results[i])
		}
	}

RESULT


///////////////////////////////////
CHECK(RelNegativePartialCharge)
	RelNegativePartialCharge rnpc;
	S.apply(rnpc);

	double results[] = {0.166667, 0.166667, 0.163618, 0.140565, 0.173074, 0.163544, 0.333333, 0.190254, 0};
	for (Size i=0;i!=limit;++i)
	{
		molecule = S.getMolecule(i);
		TEST_EQUAL(molecule->hasProperty("RelNegativePartialCharge"), true)
		if (molecule->hasProperty("RelNegativePartialCharge"))
		{
			double value = molecule->getProperty("RelNegativePartialCharge").getDouble();
			TEST_REAL_EQUAL(value, results[i])
		}
	}

RESULT

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST