Changeset e65de8 for src/unittests


Ignore:
Timestamp:
Jul 25, 2010, 9:43:56 PM (14 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:
a8a010
Parents:
521bbf
Message:

Fixed all correlations for new selected sets of molecules.

  • MapOfActions: added missing action names point-correlation and surface-correlation.
  • BUGFIX: AnalysisPairCorrelationAction::createDialog() - needs to query for multiple element_s_.
  • BUGFIX: MapOfActions::queryCurrentValue() - added values twice, due to ..ID or Z was not set to -1 after push_back.
  • TESTFIX: Analysis/* all needed --select-all-molecules in front.
  • TESTFIX: Analysis/4 need additional --unselect-molecule-by-id 207 to avoid correlating againts itself.
  • TESTFIX: changed all correlation unit tests, i.e. replaced TestList by allMolecules from getSelectedMolecules().
  • analysis_correlation.[ch]pp:
    • Replaced MoleculeListClass by const std::vector<molecule *>
    • ActiveFlag check is removed, we hand over getSelectedMolecules() from World (or any other vector of molecules) instead.
Location:
src/unittests
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    r521bbf re65de8  
    1616#include "analysis_correlation.hpp"
    1717#include "AnalysisCorrelationToPointUnitTest.hpp"
     18
     19#include "Descriptors/MoleculeDescriptor.hpp"
    1820
    1921#include "atom.hpp"
     
    3840
    3941  // init private all pointers to zero
    40   TestList = NULL;
    4142  TestMolecule = NULL;
    4243  pointmap = NULL;
     
    7172  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
    7273
    73   TestList = World::getInstance().getMolecules();
    74   TestList->insert(TestMolecule);
    7574  TestMolecule->ActiveFlag = true;
    7675
     
    7978
    8079  // init maps
    81   pointmap = CorrelationToPoint( (MoleculeListClass * const)TestList, elements, (const Vector *)point );
     80  World::getInstance().selectAllMolecules(AllMolecules());
     81  allMolecules = World::getInstance().getSelectedMolecules();
     82  CPPUNIT_ASSERT_EQUAL( (size_t) 1, allMolecules.size());
     83  pointmap = CorrelationToPoint( allMolecules, elements, (const Vector *)point );
    8284  binmap = NULL;
    8385
  • src/unittests/AnalysisCorrelationToPointUnitTest.hpp

    r521bbf re65de8  
    3535private:
    3636
    37       MoleculeListClass *TestList;
     37      std::vector<molecule *> allMolecules;
    3838      molecule *TestMolecule;
    3939      element *hydrogen;
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r521bbf re65de8  
    1616#include "analysis_correlation.hpp"
    1717#include "AnalysisCorrelationToSurfaceUnitTest.hpp"
     18
     19#include "Descriptors/MoleculeDescriptor.hpp"
    1820
    1921#include "atom.hpp"
     
    4547
    4648  // init private all pointers to zero
    47   TestList = NULL;
    4849  TestSurfaceMolecule = NULL;
    4950  surfacemap = NULL;
     
    8384  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->getAtomCount(), 4 );
    8485
    85   TestList = World::getInstance().getMolecules();
    8686  TestSurfaceMolecule->ActiveFlag = true;
    87   TestList->insert(TestSurfaceMolecule);
    8887
    8988  // init tesselation and linked cell
     
    116115  TestSurfaceMolecule->AddAtom(Walker);
    117116
    118   TestSurfaceMolecule->ActiveFlag = true;
    119   TestList->insert(TestSurfaceMolecule);
     117  World::getInstance().selectAllMolecules(AllMolecules());
     118  allMolecules = World::getInstance().getSelectedMolecules();
     119  CPPUNIT_ASSERT_EQUAL( (size_t) 2, allMolecules.size());
    120120
    121121  // init maps
     
    146146{
    147147  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->getAtomCount() );
    148   CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );
     148  CPPUNIT_ASSERT_EQUAL( (size_t)2, allMolecules.size() );
    149149  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
    150150  CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
     
    156156  // do the pair correlation
    157157  elements.push_back(hydrogen);
    158   surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );
     158  surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC );
    159159//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    160160  CPPUNIT_ASSERT( surfacemap != NULL );
     
    166166  BinPairMap::iterator tester;
    167167  elements.push_back(hydrogen);
    168   surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );
     168  surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC );
    169169  // put pair correlation into bins and check with no range
    170170//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
     
    182182  BinPairMap::iterator tester;
    183183  elements.push_back(hydrogen);
    184   surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );
     184  surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC );
    185185//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    186186  // ... and check with [0., 2.] range
     
    201201  BinPairMap::iterator tester;
    202202  elements.push_back(carbon);
    203   surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );
     203  surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC );
    204204//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    205205  // put pair correlation into bins and check with no range
     
    221221  BinPairMap::iterator tester;
    222222  elements.push_back(carbon);
    223   surfacemap = CorrelationToSurface( TestList, elements, Surface, LC );
     223  surfacemap = CorrelationToSurface( allMolecules, elements, Surface, LC );
    224224//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    225225  // ... and check with [0., 2.] range
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp

    r521bbf re65de8  
    4343private:
    4444
    45       MoleculeListClass *TestList;
     45      std::vector<molecule *> allMolecules;
    4646      molecule *TestSurfaceMolecule;
    4747      element *hydrogen;
  • src/unittests/AnalysisPairCorrelationUnitTest.cpp

    r521bbf re65de8  
    1616#include "analysis_correlation.hpp"
    1717#include "AnalysisPairCorrelationUnitTest.hpp"
     18
     19#include "Descriptors/MoleculeDescriptor.hpp"
    1820
    1921#include "World.hpp"
     
    4244
    4345  // init private all pointers to zero
    44   TestList = NULL;
    4546  TestMolecule = NULL;
    4647  correlationmap = NULL;
     
    7677  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
    7778
    78   TestList = World::getInstance().getMolecules();
    79   TestMolecule->ActiveFlag = true;
    80   TestList->insert(TestMolecule);
    81 
    8279  // init maps
    83   correlationmap = PairCorrelation( TestList, elements);
     80  World::getInstance().selectAllMolecules(AllMolecules());
     81  allMolecules = World::getInstance().getSelectedMolecules();
     82  CPPUNIT_ASSERT_EQUAL( (size_t) 1, allMolecules.size());
     83  correlationmap = PairCorrelation( allMolecules, elements);
    8484  binmap = NULL;
    8585
  • src/unittests/AnalysisPairCorrelationUnitTest.hpp

    r521bbf re65de8  
    3535private:
    3636
    37       MoleculeListClass *TestList;
     37      std::vector<molecule *> allMolecules;
    3838      molecule *TestMolecule;
    3939      element *hydrogen;
Note: See TracChangeset for help on using the changeset viewer.