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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#include <BALL/CONCEPT/classTest.h>
#include <BALLTestConfig.h>
///////////////////////////
#include <BALL/NMR/EFShiftProcessor.h>
#include <BALL/FORMAT/HINFile.h>
#include <BALL/FORMAT/PDBFile.h>
#include <BALL/STRUCTURE/defaultProcessors.h>
#include <BALL/KERNEL/PTE.h>
///////////////////////////
START_TEST(EFShiftProcessor)
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
using namespace BALL;
EFShiftProcessor* sp = 0;
CHECK(EFShiftProcessor::EFShiftProcessor() throw())
sp = new EFShiftProcessor;
TEST_NOT_EQUAL(sp, 0)
RESULT
CHECK(EFShiftProcessor::~EFShiftProcessor() throw())
delete sp;
RESULT
CHECK(EFShiftProcessor::EFShiftProcessor(const EFShiftProcessor& processor) throw())
//?????
RESULT
CHECK(EFShiftProcessor::init() throw())
//?????
RESULT
CHECK(EFShiftProcessor::start() throw())
//?????
RESULT
CHECK(EFShiftProcessor::Processor::Result operator () (Composite& composite) throw())
//?????
RESULT
CHECK(EFShiftProcessor::finish() throw())
//?????
RESULT
HINFile f(BALL_TEST_DATA_PATH(EFShiftProcessor_test.hin));
System S;
f >> S;
ClearChargeProcessor clear_charge;
S.apply(clear_charge);
Parameters parameters(BALL_TEST_DATA_PATH(EFShiftProcessor_test.ini));
CHECK(charge assignment)
EFShiftProcessor sp;
sp.setParameters(parameters);
sp.init();
TEST_EQUAL(S.countAtoms(), 31)
if (S.countAtoms() == 31)
{
S.apply(sp);
AtomIterator atom_it = S.beginAtom();
TEST_REAL_EQUAL(atom_it->getCharge(), -0.354167)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.333333)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), -0.479167)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), -0.354167)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.145833)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.333333)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), -0.479167)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), -0.354167)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.145833)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.333333)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), -0.479167)
atom_it++;
TEST_REAL_EQUAL(atom_it->getCharge(), 0.0)
}
RESULT
CHECK(chemical shifts)
PRECISION(0.0001)
EFShiftProcessor sp;
sp.setParameters(parameters);
sp.init();
TEST_EQUAL(S.countAtoms(), 31)
if (S.countAtoms() == 31)
{
S.apply(sp);
AtomIterator atom_it = S.beginAtom();
Position i = 0;
for (; +atom_it; ++atom_it)
{
if (atom_it->hasProperty(EFShiftProcessor::PROPERTY__EF_SHIFT))
{
float shift = atom_it->getProperty(EFShiftProcessor::PROPERTY__EF_SHIFT).getFloat();
STATUS("shift of " << atom_it->getFullName() << ": " << shift)
switch (i++)
{
case 0: TEST_REAL_EQUAL(shift, -0.02835) break;
case 1: TEST_REAL_EQUAL(shift, -0.01370) break;
case 2: TEST_REAL_EQUAL(shift, -0.01314) break;
case 3: TEST_REAL_EQUAL(shift, -0.01759) break;
case 4: TEST_REAL_EQUAL(shift, -0.04398) break;
case 5: TEST_REAL_EQUAL(shift, 0.03422) break;
case 6: TEST_REAL_EQUAL(shift, -0.04594) break;
case 7: TEST_REAL_EQUAL(shift, -0.03188) break;
case 8: TEST_REAL_EQUAL(shift, -0.03139) break;
case 9: TEST_REAL_EQUAL(shift, -0.03043) break;
case 10: TEST_REAL_EQUAL(shift, 0.00699) break;
case 11: TEST_REAL_EQUAL(shift, 0.01749) break;
case 12: TEST_REAL_EQUAL(shift, -0.03506) break;
case 13: TEST_REAL_EQUAL(shift, 0.11131) break;
}
}
}
}
RESULT
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST
|