Changeset d74077 for src/unittests/LinkedCellUnitTest.cpp
- Timestamp:
- Jul 31, 2010, 3:23:10 PM (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, Candidate_v1.7.0, 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:
- 8f4df1
- Parents:
- 5fbaeb
- File:
-
- 1 edited
-
src/unittests/LinkedCellUnitTest.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/LinkedCellUnitTest.cpp
r5fbaeb rd74077 50 50 Walker = World::getInstance().createAtom(); 51 51 CPPUNIT_ASSERT(Walker != NULL && "could not create atom"); 52 Walker-> type = hydrogen;53 *Walker->node = Vector(x, y, z);52 Walker->setType(hydrogen); 53 Walker->setPosition(Vector(x, y, z )); 54 54 TestMolecule->AddAtom(Walker); 55 55 } … … 192 192 atom *newAtom = World::getInstance().createAtom(); 193 193 newAtom->setName("test"); 194 newAtom-> x= Vector(1,1,1);194 newAtom->setPosition(Vector(1,1,1)); 195 195 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) ); 196 196 World::getInstance().destroyAtom(newAtom); … … 199 199 newAtom = World::getInstance().createAtom(); 200 200 newAtom->setName("test"); 201 newAtom-> x = Vector(0,-1,0);201 newAtom->setPosition(Vector(0,-1,0)); 202 202 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) ); 203 203 World::getInstance().destroyAtom(newAtom); … … 216 216 for (double z=0.5;z<3;z+=1.) { 217 217 tester = Vector(x,y,z); 218 CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector( &tester) );218 CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) ); 219 219 } 220 220 // check corners of each cell … … 224 224 tester= Vector(x,y,z); 225 225 cout << "Tester is at " << tester << "." << endl; 226 CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector( &tester) );226 CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) ); 227 227 } 228 228 // check out of bounds … … 232 232 tester = Vector(x,y,z); 233 233 cout << "The following test is supposed to fail and produce an ERROR." << endl; 234 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector( &tester) );234 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) ); 235 235 } 236 236 // check nonsense vectors 237 237 tester= Vector(-423598,3245978,29349); 238 238 cout << "The following test is supposed to fail and produce an ERROR." << endl; 239 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector( &tester) );239 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) ); 240 240 }; 241 241 … … 249 249 250 250 tester= Vector(0.5,0.5,0.5); 251 LC->SetIndexToVector( &tester);251 LC->SetIndexToVector(tester); 252 252 LC->GetNeighbourBounds(lower, upper); 253 253 for (int i=0;i<NDIM;i++) … … 268 268 // get all atoms 269 269 tester= Vector(1.5,1.5,1.5); 270 CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector( &tester) );270 CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) ); 271 271 ListOfPoints = LC->GetallNeighbours(); 272 272 size = ListOfPoints->size(); … … 285 285 // get all atoms in one corner 286 286 tester= Vector(0.5, 0.5, 0.5); 287 CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector( &tester) );287 CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) ); 288 288 ListOfPoints = LC->GetallNeighbours(); 289 289 size=ListOfPoints->size(); 290 290 CPPUNIT_ASSERT_EQUAL( (size_t)8, size ); 291 291 for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){ 292 if (((*iter)-> x[0] <2) && ((*iter)->x[1] <2) && ((*iter)->x[2]<2)) {292 if (((*iter)->at(0) <2) && ((*iter)->at(1) <2) && ((*iter)->at(2) <2)) { 293 293 ListOfPoints->remove(*iter); 294 294 size--; … … 303 303 // get all atoms from one corner 304 304 tester = Vector(0.5, 0.5, 0.5); 305 CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector( &tester) );305 CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) ); 306 306 ListOfPoints = LC->GetallNeighbours(3); 307 307 size=ListOfPoints->size(); … … 329 329 // get all points around central arom with radius 1. 330 330 tester= Vector(1.5,1.5,1.5); 331 CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector( &tester) );331 CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) ); 332 332 ListOfPoints = LC->GetPointsInsideSphere(1., &tester); 333 333 size = ListOfPoints->size(); 334 334 CPPUNIT_ASSERT_EQUAL( (size_t)7, size ); 335 335 for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){ 336 if (((*iter)-> x.DistanceSquared(tester) - 1.) < MYEPSILON ) {336 if (((*iter)->DistanceSquared(tester) - 1.) < MYEPSILON ) { 337 337 ListOfPoints->remove(*iter); 338 338 size--;
Note:
See TracChangeset
for help on using the changeset viewer.
