Ignore:
Timestamp:
Apr 3, 2012, 7:55:43 AM (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:
ebc499
Parents:
8de597
git-author:
Frederik Heber <heber@…> (03/23/12 08:40:39)
git-committer:
Frederik Heber <heber@…> (04/03/12 07:55:43)
Message:

Added AtomOrderDescription along with SelectionAtomByOrder.

File:
1 edited

Legend:

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

    r8de597 r61c364  
    2828#include <Descriptors/AtomIdDescriptor.hpp>
    2929#include <Descriptors/AtomOfMoleculeDescriptor.hpp>
     30#include <Descriptors/AtomOrderDescriptor.hpp>
    3031#include <Descriptors/AtomsWithinDistanceOfDescriptor.hpp>
    3132
     
    153154}
    154155
     156void AtomDescriptorTest::AtomOrderTest()
     157{
     158  atom* testAtom;
     159
     160  // test in normal order: 1, 2, ...
     161  for(int i=1;i<=ATOM_COUNT;++i){
     162    testAtom = World::getInstance().getAtom(AtomByOrder(i));
     163    CPPUNIT_ASSERT_EQUAL( atomIds[i-1], testAtom->getId());
     164  }
     165
     166  // test in reverse order: -1, -2, ...
     167  for(int i=1; i<= ATOM_COUNT;++i){
     168    testAtom = World::getInstance().getAtom(AtomByOrder(-i));
     169    CPPUNIT_ASSERT_EQUAL( atomIds[(int)ATOM_COUNT-i], testAtom->getId());
     170  }
     171
     172  // test from outside of set
     173  testAtom = World::getInstance().getAtom(AtomByOrder(ATOM_COUNT+1));
     174  CPPUNIT_ASSERT(!testAtom);
     175  testAtom = World::getInstance().getAtom(AtomByOrder(-ATOM_COUNT-1));
     176  CPPUNIT_ASSERT(!testAtom);
     177}
     178
     179
    155180std::set<atomId_t> getDistanceList(const double distance, const Vector &position, atom **list)
    156181{
     
    172197  return testlist;
    173198}
     199
     200//void AtomDescriptorTest::AtomsShapeTest()
     201//{
     202//  // align atoms along an axis
     203//  for(int i=0;i<ATOM_COUNT;++i) {
     204//    atoms[i]->setPosition(Vector((double)i, 0., 0.));
     205//    //std::cout << "atoms[" << i << "]: " << atoms[i]->getId() << " at " << atoms[i]->getPosition() << std::endl;
     206//  }
     207//
     208//  // get atom by descriptor ...
     209//  // ... from origin up to 2.5
     210//  {
     211//    const double distance = 1.5;
     212//    Vector position(0.,0.,0.);
     213//    Shape s = Sphere(position, distance);
     214//    World::AtomComposite atomlist = World::getInstance().getAllAtoms(AtomsByShape(s));
     215//    CPPUNIT_ASSERT_EQUAL( (size_t)2, atomlist.size() );
     216//    std::set<atomId_t> reflist = getDistanceList(distance, position, atoms);
     217//    std::set<atomId_t> testlist = getIdList(atomlist);
     218//    CPPUNIT_ASSERT_EQUAL( reflist, testlist );
     219//  }
     220//  // ... from (4,0,0) up to 2.9 (i.e. more shells or different view)
     221//  {
     222//    const double distance = 2.9;
     223//    Vector position(4.,0.,0.);
     224//    Shape s = Sphere(position, distance);
     225//    World::AtomComposite atomlist = World::getInstance().getAllAtoms(AtomsByShape(s));
     226//    CPPUNIT_ASSERT_EQUAL( (size_t)5, atomlist.size() );
     227//    std::set<atomId_t> reflist = getDistanceList(distance, position, atoms);
     228//    std::set<atomId_t> testlist = getIdList(atomlist);
     229//    CPPUNIT_ASSERT_EQUAL( reflist, testlist );
     230//  }
     231//  // ... from (10,0,0) up to 1.5
     232//  {
     233//    const double distance = 1.5;
     234//    Vector *position = new Vector(10.,0.,0.);
     235//    Shape s = Sphere(position, distance);
     236//    World::AtomComposite atomlist = World::getInstance().getAllAtoms(AtomsByShape(s));
     237//    CPPUNIT_ASSERT_EQUAL( (size_t)1, atomlist.size() );
     238//    std::set<atomId_t> reflist = getDistanceList(distance, *position, atoms);
     239//    std::set<atomId_t> testlist = getIdList(atomlist);
     240//    CPPUNIT_ASSERT_EQUAL( reflist, testlist );
     241//    delete position;
     242//  }
     243//}
    174244
    175245void AtomDescriptorTest::AtomsWithinDistanceOfTest()
Note: See TracChangeset for help on using the changeset viewer.