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
|
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#include <BALL/CONCEPT/classTest.h>
///////////////////////////
#include <BALL/STRUCTURE/analyticalSES.h>
#include <BALL/KERNEL/fragment.h>
///////////////////////////
START_TEST(AnalyticalSES)
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
using namespace BALL;
CHECK(calculateSESArea(const AtomContainer& fragment, float probe_radius))
Fragment f;
Atom a1, a2;
a1.setRadius(1.0);
a2.setRadius(1.0);
a2.setPosition(Vector3(10.0, 0.0, 0.0));
f.insert(a1);
f.insert(a2);
float area = calculateSESArea(f, 1.5);
PRECISION(0.001)
TEST_REAL_EQUAL(area, 25.13274)
a2.setPosition(Vector3(1.0, 0.0, 0.0));
area = calculateSESArea(f, 1.5);
TEST_REAL_EQUAL(area, 18.722)
RESULT
CHECK(calculateSESAtomAreas(const AtomContainer& fragment, HashMap<Atom*, float>& atom_areas, float probe_radius))
Fragment f;
Atom a1, a2;
a1.setRadius(1.0);
a2.setRadius(1.0);
a2.setPosition(Vector3(10.0, 0.0, 0.0));
f.insert(a1);
f.insert(a2);
HashMap<const Atom*, float> atom_areas;
float area = calculateSESAtomAreas(f, atom_areas, 1.5);
PRECISION(0.001)
TEST_REAL_EQUAL(area, 25.13274)
// verify the contents of the hash map
TEST_EQUAL(atom_areas.size(), 2)
TEST_EQUAL(atom_areas.has(&a1), true)
TEST_EQUAL(atom_areas.has(&a2), true)
// verify the atom surface fractions
TEST_REAL_EQUAL(atom_areas[&a1], 12.56637)
TEST_REAL_EQUAL(atom_areas[&a2], 12.56637)
// second case: overlapping atoms -> adds toroidal surface patches
a2.setPosition(Vector3(1.0, 0.0, 0.0));
area = calculateSESAtomAreas(f, atom_areas, 1.5);
TEST_REAL_EQUAL(area, 18.722)
// verify the contents of the hash map
TEST_EQUAL(atom_areas.size(), 2)
TEST_EQUAL(atom_areas.has(&a1), true)
TEST_EQUAL(atom_areas.has(&a2), true)
// verify the atom surface fractions
TEST_REAL_EQUAL(atom_areas[&a1], 9.361)
TEST_REAL_EQUAL(atom_areas[&a2], 9.361)
// third case: three overlapping atoms -> adds concaver surface patches
// the three atoms form a equilateral triangle
float x = cos(Angle(30, false));
float y = sin(Angle(30, false));
a1.setPosition(Vector3(0.0, 1.0, 0.0));
a2.setPosition(Vector3( x, -y, 0.0));
Atom a3;
a3.setPosition(Vector3(-x, -y, 0.0));
a3.setRadius(1.0);
f.insert(a3);
area = calculateSESAtomAreas(f, atom_areas, 1.5);
TEST_REAL_EQUAL(area, 30.5307)
// verify the contents of the hash map
TEST_EQUAL(atom_areas.size(), 3)
TEST_EQUAL(atom_areas.has(&a1), true)
TEST_EQUAL(atom_areas.has(&a2), true)
TEST_EQUAL(atom_areas.has(&a3), true)
// verify the atom surface fractions
TEST_REAL_EQUAL(atom_areas[&a1], 10.1769)
TEST_REAL_EQUAL(atom_areas[&a2], 10.1769)
TEST_REAL_EQUAL(atom_areas[&a3], 10.1769)
RESULT
CHECK(calculateSESVolume(const AtomContainer& fragment, float probe_radius))
Fragment f;
Atom a1, a2;
a1.setRadius(1.0);
a2.setRadius(1.0);
a2.setPosition(Vector3(10.0, 0.0, 0.0));
f.insert(a1);
f.insert(a2);
float volume = calculateSESVolume(f, 1.5);
PRECISION(0.001)
TEST_REAL_EQUAL(volume, 8.37758)
a2.setPosition(Vector3(1.0, 0.0, 0.0));
volume = calculateSESVolume(f, 1.5);
TEST_REAL_EQUAL(volume, 7.16437)
RESULT
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST
|