Changeset bbc338
- Timestamp:
- Oct 14, 2009, 11:18:14 AM (15 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:
- db6bf74
- Parents:
- 6cd79d
- Location:
- src/unittests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/AnalysisCorrelationToPointUnitTest.cpp
r6cd79d rbbc338 44 44 hydrogen->Z = 1; 45 45 strcpy(hydrogen->name, "hydrogen"); 46 hydrogen->symbol[0] = 'H'; 46 strcpy(hydrogen->symbol, "H"); 47 47 48 48 49 // construct periodentafel -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
r6cd79d rbbc338 46 46 hydrogen->Z = 1; 47 47 strcpy(hydrogen->name, "hydrogen"); 48 hydrogen->symbol[0] = 'H'; 48 strcpy(hydrogen->symbol, "H"); 49 carbon = new element; 50 carbon->Z = 6; 51 strcpy(carbon->name, "carbon"); 52 strcpy(carbon->symbol, "C"); 49 53 50 54 // construct periodentafel 51 55 tafel = new periodentafel; 52 56 tafel->AddElement(hydrogen); 53 54 // construct molecule (tetraeder of hydrogens) 57 tafel->AddElement(carbon); 58 59 // construct molecule (tetraeder of hydrogens) base 55 60 TestMolecule = new molecule(tafel); 56 61 Walker = new atom(); … … 77 82 Surface = new Tesselation; 78 83 TestMolecule->TesselStruct = Surface; 79 FindNonConvexBorder((ofstream *)&c out, TestMolecule, LC, 2.5, NULL);84 FindNonConvexBorder((ofstream *)&cerr, TestMolecule, LC, 2.5, NULL); 80 85 LC = new LinkedCell(TestMolecule, 5.); 81 86 CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() ); … … 83 88 CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() ); 84 89 90 // add outer atoms 91 Walker = new atom(); 92 Walker->type = carbon; 93 Walker->node->Init(4., 0., 4. ); 94 TestMolecule->AddAtom(Walker); 95 Walker = new atom(); 96 Walker->type = carbon; 97 Walker->node->Init(0., 4., 4. ); 98 TestMolecule->AddAtom(Walker); 99 Walker = new atom(); 100 Walker->type = carbon; 101 Walker->node->Init(4., 4., 0. ); 102 TestMolecule->AddAtom(Walker); 103 // add inner atoms 104 Walker = new atom(); 105 Walker->type = carbon; 106 Walker->node->Init(0.5, 0.5, 0.5 ); 107 TestMolecule->AddAtom(Walker); 108 85 109 // init maps 86 surfacemap = CorrelationToSurface( (ofstream *)&cout, TestMolecule, hydrogen, Surface, LC );110 surfacemap = NULL; 87 111 binmap = NULL; 88 112 … … 109 133 { 110 134 // do the pair correlation 135 surfacemap = CorrelationToSurface( (ofstream *)&cout, TestMolecule, hydrogen, Surface, LC ); 111 136 CPPUNIT_ASSERT( surfacemap != NULL ); 112 137 CPPUNIT_ASSERT_EQUAL( (size_t)4, surfacemap->size() ); 113 138 }; 114 139 115 void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceBinNoRangeTest() 116 { 117 BinPairMap::iterator tester; 140 void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceHydrogenBinNoRangeTest() 141 { 142 BinPairMap::iterator tester; 143 surfacemap = CorrelationToSurface( (ofstream *)&cout, TestMolecule, hydrogen, Surface, LC ); 118 144 // put pair correlation into bins and check with no range 119 145 binmap = BinData( (ofstream *)&cout, surfacemap, 0.5, 0., 0. ); … … 126 152 }; 127 153 128 void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceBinRangeTest() 129 { 130 BinPairMap::iterator tester; 154 void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceHydrogenBinRangeTest() 155 { 156 BinPairMap::iterator tester; 157 surfacemap = CorrelationToSurface( (ofstream *)&cout, TestMolecule, hydrogen, Surface, LC ); 131 158 // ... and check with [0., 2.] range 132 159 binmap = BinData( (ofstream *)&cout, surfacemap, 0.5, 0., 2. ); … … 142 169 }; 143 170 171 void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceCarbonBinNoRangeTest() 172 { 173 BinPairMap::iterator tester; 174 surfacemap = CorrelationToSurface( (ofstream *)&cout, TestMolecule, carbon, Surface, LC ); 175 // put pair correlation into bins and check with no range 176 binmap = BinData( (ofstream *)&cout, surfacemap, 0.5, 0., 0. ); 177 CPPUNIT_ASSERT_EQUAL( (size_t)2, binmap->size() ); 178 OutputCorrelation ( (ofstream *)&cout, binmap ); 179 // inside point is first and must have negative value 180 tester = binmap->lower_bound(2.95); // start depends on the min value and 181 CPPUNIT_ASSERT( tester != binmap->end() ); 182 CPPUNIT_ASSERT_EQUAL( 3, tester->second ); 183 // inner point 184 tester = binmap->lower_bound(0.); 185 CPPUNIT_ASSERT( tester != binmap->end() ); 186 CPPUNIT_ASSERT_EQUAL( 1, tester->second ); 187 }; 188 189 void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceCarbonBinRangeTest() 190 { 191 BinPairMap::iterator tester; 192 surfacemap = CorrelationToSurface( (ofstream *)&cout, TestMolecule, carbon, Surface, LC ); 193 // ... and check with [0., 2.] range 194 binmap = BinData( (ofstream *)&cout, surfacemap, 0.5, -2., 4. ); 195 CPPUNIT_ASSERT_EQUAL( (size_t)13, binmap->size() ); 196 OutputCorrelation ( (ofstream *)&cout, binmap ); 197 // three outside points 198 tester = binmap->find(3.); 199 CPPUNIT_ASSERT( tester != binmap->end() ); 200 CPPUNIT_ASSERT_EQUAL( 3, tester->second ); 201 // inner point 202 tester = binmap->find(0.); 203 CPPUNIT_ASSERT( tester != binmap->end() ); 204 CPPUNIT_ASSERT_EQUAL( 1, tester->second ); 205 206 }; 207 144 208 /********************************************** Main routine **************************************/ 145 209 -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp
r6cd79d rbbc338 23 23 CPPUNIT_TEST_SUITE( AnalysisCorrelationToSurfaceUnitTest ) ; 24 24 CPPUNIT_TEST ( CorrelationToSurfaceTest ); 25 CPPUNIT_TEST ( CorrelationToSurfaceBinNoRangeTest ); 26 CPPUNIT_TEST ( CorrelationToSurfaceBinRangeTest ); 25 CPPUNIT_TEST ( CorrelationToSurfaceHydrogenBinNoRangeTest ); 26 CPPUNIT_TEST ( CorrelationToSurfaceHydrogenBinRangeTest ); 27 CPPUNIT_TEST ( CorrelationToSurfaceCarbonBinNoRangeTest ); 28 CPPUNIT_TEST ( CorrelationToSurfaceCarbonBinRangeTest ); 27 29 CPPUNIT_TEST_SUITE_END(); 28 30 … … 31 33 void tearDown(); 32 34 void CorrelationToSurfaceTest(); 33 void CorrelationToSurfaceBinNoRangeTest(); 34 void CorrelationToSurfaceBinRangeTest(); 35 void CorrelationToSurfaceHydrogenBinNoRangeTest(); 36 void CorrelationToSurfaceHydrogenBinRangeTest(); 37 void CorrelationToSurfaceCarbonBinNoRangeTest(); 38 void CorrelationToSurfaceCarbonBinRangeTest(); 35 39 36 40 private: … … 38 42 molecule *TestMolecule; 39 43 element *hydrogen; 44 element *carbon; 40 45 periodentafel *tafel; 41 46 -
src/unittests/AnalysisPairCorrelationUnitTest.cpp
r6cd79d rbbc338 44 44 hydrogen->Z = 1; 45 45 strcpy(hydrogen->name, "hydrogen"); 46 hydrogen->symbol[0] = 'H';46 strcpy(hydrogen->symbol, "H"); 47 47 48 48 // construct periodentafel
Note:
See TracChangeset
for help on using the changeset viewer.