Changeset 833b15 for src/Analysis/unittests
- Timestamp:
- Sep 9, 2014, 7:42:32 PM (11 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- a090e3
- Parents:
- 2d701e
- git-author:
- Frederik Heber <heber@…> (09/01/14 15:54:02)
- git-committer:
- Frederik Heber <heber@…> (09/09/14 19:42:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Analysis/unittests/CountBondsUnitTest.cpp
r2d701e 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.