Changeset 982e6d
- Timestamp:
- Nov 12, 2017, 8:48:39 AM (7 years ago)
- Branches:
- ForceAnnealing_with_BondGraph_continued_betteresults
- Children:
- 06b7d9
- Parents:
- 1fdf5a
- git-author:
- Frederik Heber <frederik.heber@…> (06/29/17 15:46:02)
- git-committer:
- Frederik Heber <frederik.heber@…> (11/12/17 08:48:39)
- Location:
- src/Dynamics/unittests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Dynamics/unittests/BondVectorsUnitTest.cpp
r1fdf5a r982e6d 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
r1fdf5a r982e6d 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
r1fdf5a r982e6d 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.