- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Analysis/unittests/CountBondsUnitTest.cpp
r94d5ac6 r833b15 148 148 void CountBondsTest::HydrogenBridgeBondsTest() 149 149 { 150 double *mirror = new double[3];150 double mirror[3]; 151 151 CPPUNIT_ASSERT(mirror != NULL && "could not create array of doubles"); 152 152 for (int i=0;i<3;i++) … … 161 161 cout << "Case 1: offset of (3,0,0), hence angles are (104.5, 0, 75.5, 180) < 30." << endl; 162 162 Translator = Vector(3,0,0); 163 TestMolecule1->Translate( &Translator);163 TestMolecule1->Translate(Translator); 164 164 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 165 165 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, oxygen, NULL) ); 166 166 Translator = Vector(-3,0,0); 167 TestMolecule1->Translate( &Translator);167 TestMolecule1->Translate(Translator); 168 168 169 169 cout << "Case 2: offset of (0,3,0), hence angle are (14.5, 165.5, 90) < 30 (only three, because other 90 is missing due to first H01 only fulfilling H-bond criteria)." << endl; 170 170 Translator = Vector(0,3,0); 171 TestMolecule1->Translate( &Translator);171 TestMolecule1->Translate(Translator); 172 172 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 173 173 Translator = Vector(0,-3,0); 174 TestMolecule1->Translate( &Translator);174 TestMolecule1->Translate(Translator); 175 175 176 176 cout << "Case 3: offset of (0,-3,0) and mirror, hence angle are (165.5, 90, 165.5, 90) > 30." << endl; 177 177 Translator = Vector(0,-3,0); 178 TestMolecule1->Scale( (const double ** const)&mirror);179 TestMolecule1->Translate( &Translator);178 TestMolecule1->Scale(&mirror[0]); 179 TestMolecule1->Translate(Translator); 180 180 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 181 181 Translator = Vector(0,3,0); 182 TestMolecule1->Translate( &Translator);183 TestMolecule1->Scale( (const double ** const)&mirror);182 TestMolecule1->Translate(Translator); 183 TestMolecule1->Scale(&mirror[0]); 184 184 185 185 cout << "Case 4: offset of (2,1,0), hence angle are (78, 26.6, 102, 153.4) < 30." << endl; 186 186 Translator = Vector(2,1,0); 187 TestMolecule1->Translate( &Translator);187 TestMolecule1->Translate(Translator); 188 188 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 189 189 Translator = Vector(-2,-1,0); 190 TestMolecule1->Translate( &Translator);190 TestMolecule1->Translate(Translator); 191 191 192 192 cout << "Case 5: offset of (0,0,3), hence angle are (90, 90, 90, 90) > 30." << endl; 193 193 Translator = Vector(0,0,3); 194 TestMolecule1->Translate( &Translator);194 TestMolecule1->Translate(Translator); 195 195 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 196 196 Translator = Vector(0,0,-3); 197 TestMolecule1->Translate( &Translator);197 TestMolecule1->Translate(Translator); 198 198 199 199 cout << "Case 6: offset of (-3,0,0) and mirror, hence angle are (75.5, 180, 104.5, 180) > 30." << endl; 200 200 Translator = Vector(-3,0,0); 201 TestMolecule1->Scale( (const double ** const)&mirror);202 TestMolecule1->Translate( &Translator);201 TestMolecule1->Scale(&mirror[0]); 202 TestMolecule1->Translate(Translator); 203 203 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 204 204 Translator = Vector(3,0,0); 205 TestMolecule1->Translate( &Translator);206 TestMolecule1->Scale( (const double ** const)&mirror);205 TestMolecule1->Translate(Translator); 206 TestMolecule1->Scale(&mirror[0]); 207 207 208 208 cout << "Case 7: offset of (3,0,0) and mirror, hence angles are (104.5, 0, 104.5, 0) < 30, but interfering hydrogens." << endl; 209 209 Translator = Vector(3,0,0); 210 TestMolecule1->Scale( (const double ** const)&mirror);211 TestMolecule1->Translate( &Translator);210 TestMolecule1->Scale(&mirror[0]); 211 TestMolecule1->Translate(Translator); 212 212 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 213 213 Translator = Vector(-3,0,0); 214 TestMolecule1->Translate( &Translator);215 TestMolecule1->Scale( (const double ** const)&mirror);214 TestMolecule1->Translate(Translator); 215 TestMolecule1->Scale(&mirror[0]); 216 216 217 217 cout << "Case 8: offset of (0,3,0), hence angle are (14.5, 90, 14.5, 90) < 30, but interfering hydrogens." << endl; 218 218 Translator = Vector(0,3,0); 219 TestMolecule1->Scale( (const double ** const)&mirror);220 TestMolecule1->Translate( &Translator);219 TestMolecule1->Scale(&mirror[0]); 220 TestMolecule1->Translate(Translator); 221 221 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 222 222 Translator = Vector(0,-3,0); 223 TestMolecule1->Translate(&Translator); 224 TestMolecule1->Scale((const double ** const)&mirror); 225 226 delete[](mirror); 227 }; 223 TestMolecule1->Translate(Translator); 224 TestMolecule1->Scale(&mirror[0]); 225 };
Note:
See TracChangeset
for help on using the changeset viewer.