Changeset 257c77 for src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
- Timestamp:
- Jun 17, 2010, 2:55:56 PM (16 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, Candidate_v1.7.0, Candidate_v1.7.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:
- b47bfc
- Parents:
- 992fd7 (diff), 5f5a7b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
r992fd7 r257c77 17 17 #include "AnalysisCorrelationToSurfaceUnitTest.hpp" 18 18 19 #include "World.hpp"20 19 #include "atom.hpp" 21 20 #include "boundary.hpp" … … 26 25 #include "tesselation.hpp" 27 26 #include "World.hpp" 27 #include "Helpers/Assert.hpp" 28 28 29 29 #include "Helpers/Assert.hpp" … … 40 40 void AnalysisCorrelationToSurfaceUnitTest::setUp() 41 41 { 42 //ASSERT_DO(Assert::Throw);42 ASSERT_DO(Assert::Throw); 43 43 44 44 atom *Walker = NULL; … … 47 47 TestList = NULL; 48 48 TestSurfaceMolecule = NULL; 49 hydrogen = NULL;50 tafel = NULL;51 49 surfacemap = NULL; 52 50 binmap = NULL; … … 54 52 LC = NULL; 55 53 56 // construct element 57 hydrogen = new element; 58 hydrogen->Z = 1; 59 strcpy(hydrogen->name, "hydrogen"); 60 strcpy(hydrogen->symbol, "H"); 61 carbon = new element; 62 carbon->Z = 6; 63 strcpy(carbon->name, "carbon"); 64 strcpy(carbon->symbol, "C"); 65 66 // construct periodentafel 67 tafel = World::getInstance().getPeriode(); 68 tafel->AddElement(hydrogen); 69 tafel->AddElement(carbon); 54 // prepare element list 55 hydrogen = World::getInstance().getPeriode()->FindElement(1); 56 CPPUNIT_ASSERT(hydrogen != NULL && "hydrogen element not found"); 57 elements.clear(); 70 58 71 59 // construct molecule (tetraeder of hydrogens) base 72 60 TestSurfaceMolecule = World::getInstance().createMolecule(); 61 73 62 Walker = World::getInstance().createAtom(); 74 63 Walker->type = hydrogen; 75 64 *Walker->node = Vector(1., 0., 1. ); 76 77 TestSurfaceMolecule->AddAtom(Walker); 65 TestSurfaceMolecule->AddAtom(Walker); 66 78 67 Walker = World::getInstance().createAtom(); 79 68 Walker->type = hydrogen; 80 69 *Walker->node = Vector(0., 1., 1. ); 81 70 TestSurfaceMolecule->AddAtom(Walker); 71 82 72 Walker = World::getInstance().createAtom(); 83 73 Walker->type = hydrogen; 84 74 *Walker->node = Vector(1., 1., 0. ); 85 75 TestSurfaceMolecule->AddAtom(Walker); 76 86 77 Walker = World::getInstance().createAtom(); 87 78 Walker->type = hydrogen; … … 90 81 91 82 // check that TestMolecule was correctly constructed 92 CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule-> AtomCount, 4 );83 CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->getAtomCount(), 4 ); 93 84 94 85 TestList = World::getInstance().getMolecules(); … … 102 93 103 94 // add outer atoms 95 carbon = World::getInstance().getPeriode()->FindElement(6); 104 96 TestSurfaceMolecule = World::getInstance().createMolecule(); 105 97 Walker = World::getInstance().createAtom(); … … 107 99 *Walker->node = Vector(4., 0., 4. ); 108 100 TestSurfaceMolecule->AddAtom(Walker); 101 109 102 Walker = World::getInstance().createAtom(); 110 103 Walker->type = carbon; 111 104 *Walker->node = Vector(0., 4., 4. ); 112 105 TestSurfaceMolecule->AddAtom(Walker); 106 113 107 Walker = World::getInstance().createAtom(); 114 108 Walker->type = carbon; 115 109 *Walker->node = Vector(4., 4., 0. ); 116 110 TestSurfaceMolecule->AddAtom(Walker); 111 117 112 // add inner atoms 118 113 Walker = World::getInstance().createAtom(); … … 120 115 *Walker->node = Vector(0.5, 0.5, 0.5 ); 121 116 TestSurfaceMolecule->AddAtom(Walker); 117 122 118 TestSurfaceMolecule->ActiveFlag = true; 123 119 TestList->insert(TestSurfaceMolecule); … … 141 137 delete(LC); 142 138 World::purgeInstance(); 143 MemoryUsageObserver::purgeInstance();144 139 logger::purgeInstance(); 145 140 }; … … 150 145 void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest() 151 146 { 152 CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule-> AtomCount);147 CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->getAtomCount() ); 153 148 CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() ); 154 149 CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() ); … … 160 155 { 161 156 // do the pair correlation 162 surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC ); 157 elements.push_back(hydrogen); 158 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 163 159 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 164 160 CPPUNIT_ASSERT( surfacemap != NULL ); … … 169 165 { 170 166 BinPairMap::iterator tester; 171 surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC ); 167 elements.push_back(hydrogen); 168 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 172 169 // put pair correlation into bins and check with no range 173 170 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); … … 184 181 { 185 182 BinPairMap::iterator tester; 186 surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC ); 183 elements.push_back(hydrogen); 184 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 187 185 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 188 186 // ... and check with [0., 2.] range … … 202 200 { 203 201 BinPairMap::iterator tester; 204 surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC ); 202 elements.push_back(carbon); 203 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 205 204 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 206 205 // put pair correlation into bins and check with no range … … 221 220 { 222 221 BinPairMap::iterator tester; 223 surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC ); 222 elements.push_back(carbon); 223 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 224 224 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 225 225 // ... and check with [0., 2.] range
Note:
See TracChangeset
for help on using the changeset viewer.
