Ignore:
Timestamp:
Jan 2, 2012, 1:34:28 PM (13 years ago)
Author:
Frederik Heber <heber@…>
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:
c8f6b6
Parents:
d78531
git-author:
Frederik Heber <heber@…> (12/19/11 18:09:49)
git-committer:
Frederik Heber <heber@…> (01/02/12 13:34:28)
Message:

Added new descriptor AtomOfMolecule.

  • also added new unit test function.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Descriptors/unittests/AtomDescriptorUnitTest.cpp

    rd78531 rb49568  
    2727#include <Descriptors/AtomDescriptor.hpp>
    2828#include <Descriptors/AtomIdDescriptor.hpp>
     29#include <Descriptors/AtomOfMoleculeDescriptor.hpp>
    2930
    3031#include "World.hpp"
    3132#include "Atom/atom.hpp"
     33#include "molecule.hpp"
    3234
    3335#ifdef HAVE_TESTRUNNER
     
    118120  CPPUNIT_ASSERT(!testAtom);
    119121}
     122void AtomDescriptorTest::AtomOfMoleculeTest(){
     123  // test Atoms from boundaries and middle of the set
     124  atom* testAtom;
     125  testAtom = World::getInstance().getAtom(AtomById(atomIds[0]));
     126  CPPUNIT_ASSERT(testAtom);
     127  CPPUNIT_ASSERT_EQUAL( atomIds[0], testAtom->getId());
     128
     129  // create some molecule and associate atom to it
     130  testAtom->setType(1);
     131  molecule * newmol = World::getInstance().createMolecule();
     132  newmol->AddAtom(testAtom);
     133  CPPUNIT_ASSERT_EQUAL(newmol->getId(), testAtom->getMolecule()->getId());
     134
     135  // get atom by descriptor
     136  World::AtomComposite atoms = World::getInstance().getAllAtoms(AtomOfMolecule(newmol->getId()));
     137  CPPUNIT_ASSERT_EQUAL( (size_t)1, atoms.size() );
     138  CPPUNIT_ASSERT_EQUAL( (*atoms.begin())->getId(), testAtom->getId() );
     139
     140  // remove molecule again
     141  World::getInstance().destroyMolecule(newmol);
     142}
    120143void AtomDescriptorTest::AtomCalcTest(){
    121144  // test some elementary set operations
Note: See TracChangeset for help on using the changeset viewer.