Changeset 7b4e67
- Timestamp:
- Apr 10, 2018, 6:43:30 AM (7 years ago)
- Branches:
- AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
- Children:
- f433ec
- Parents:
- c1c6cb
- git-author:
- Frederik Heber <frederik.heber@…> (06/29/17 15:46:02)
- git-committer:
- Frederik Heber <frederik.heber@…> (04/10/18 06:43:30)
- Location:
- src/Dynamics/unittests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Dynamics/unittests/BondVectorsUnitTest.cpp
rc1c6cb r7b4e67 67 67 // failing asserts should be thrown 68 68 ASSERT_DO(Assert::Throw); 69 70 setVerbosity(4); 69 71 70 72 // create an atom … … 258 260 // calculate weights 259 261 BondVectors::weights_t weights = bv->getWeightsForAtomAtStep(*atoms[center], WorldTime::getTime()); 260 LOG(2, "DEBUG: triangle weights are " << weights);262 LOG(2, "DEBUG: Triangle weights are " << weights); 261 263 // check number of weights 262 264 CPPUNIT_ASSERT_EQUAL( weights.size(), (size_t)3 ); … … 265 267 CPPUNIT_ASSERT( fabs(weight_sum - 2.) < 1e-10 ); 266 268 } 269 270 /** Test whether calculating weights works on complex config 271 * 272 */ 273 void BondVectorsTest::weights_complexTest() 274 { 275 // gather atoms 276 atomvector += atoms[center], atoms[left], atoms[right], atoms[top], atoms[topright], atoms [bottomright]; 277 // create bonds 278 bondvector += 279 atoms[center]->addBond(atoms[left]), 280 atoms[center]->addBond(atoms[right]), 281 atoms[center]->addBond(atoms[top]), 282 atoms[center]->addBond(atoms[topright]), 283 atoms[center]->addBond(atoms[bottomright]); 284 // prepare bondvectors 285 bv->setFromAtomRange< std::vector<atom *> >(atomvector.begin(), atomvector.end(), WorldTime::getTime()); 286 // calculate weights 287 BondVectors::weights_t weights = bv->getWeightsForAtomAtStep(*atoms[center], WorldTime::getTime()); 288 LOG(2, "DEBUG: Complex weights are " << weights); 289 // check number of weights 290 CPPUNIT_ASSERT_EQUAL( weights.size(), (size_t)5 ); 291 // check sum of weights: one linear independent, two dependent vectors = 1 + 2*0.5 292 const double weight_sum = std::accumulate(weights.begin(), weights.end(), 0.); 293 CPPUNIT_ASSERT( fabs(weight_sum - 2.) < 1e-10 ); 294 } -
src/Dynamics/unittests/BondVectorsUnitTest.hpp
rc1c6cb r7b4e67 35 35 CPPUNIT_TEST ( weights_rightangleTest ); 36 36 CPPUNIT_TEST ( weights_triangleTest ); 37 CPPUNIT_TEST ( weights_complexTest ); 37 38 CPPUNIT_TEST_SUITE_END(); 38 39 … … 45 46 void weights_rightangleTest(); 46 47 void weights_triangleTest(); 48 void weights_complexTest(); 47 49 48 50 private: -
src/Dynamics/unittests/Makefile.am
rc1c6cb r7b4e67 10 10 DYNAMICSTESTS = \ 11 11 BondVectorsUnitTest 12 13 XFAIL_TESTS += BondVectorsUnitTest 12 14 13 15 TESTS += $(DYNAMICSTESTS)
Note:
See TracChangeset
for help on using the changeset viewer.