Changeset e65de8 for src


Ignore:
Timestamp:
Jul 25, 2010, 9:43:56 PM (15 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
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    r521bbf re65de8  
    4141  Dialog *dialog = UIFactory::getInstance().makeDialog();
    4242
    43   dialog->queryElement("elements", ValueStorage::getInstance().getDescription("elements"));
     43  dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements"));
    4444  dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start"));
    4545  dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width"));
     
    6767  Vector Point;
    6868  BinPairMap *binmap = NULL;
    69   MoleculeListClass *molecules = World::getInstance().getMolecules();
    7069
    7170  // obtain information
     
    8281  binoutput.open(binoutputname.c_str());
    8382  PairCorrelationMap *correlationmap = NULL;
     83  std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
    8484  if (periodic)
    85     correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges);
     85    correlationmap = PeriodicPairCorrelation(molecules, elements, ranges);
    8686  else
    87     correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements);
     87    correlationmap = PairCorrelation(molecules, elements);
    8888  OutputPairCorrelation(&output, correlationmap);
    8989  binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
  • src/Actions/AnalysisAction/PointCorrelationAction.cpp

    r521bbf re65de8  
    4242
    4343  dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
    44   dialog->queryElement("elements", ValueStorage::getInstance().getDescription("elements"));
     44  dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements"));
    4545  dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start"));
    4646  dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width"));
     
    6868  Vector Point;
    6969  BinPairMap *binmap = NULL;
    70   MoleculeListClass *molecules = World::getInstance().getMolecules();
    7170
    7271  // obtain information
     
    8584  cout << "Point to correlate to is  " << Point << endl;
    8685  CorrelationToPointMap *correlationmap = NULL;
     86  for(std::vector< element *>::iterator iter = elements.begin(); iter != elements.end(); ++iter)
     87    cout << "element is " << (*iter)->symbol << endl;
     88  std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
    8789  if (periodic)
    8890    correlationmap  = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges);
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp

    r521bbf re65de8  
    4242
    4343  dialog->queryMolecule("molecule-by-id", ValueStorage::getInstance().getDescription("molecule-by-id"));
    44   dialog->queryElement("elements", ValueStorage::getInstance().getDescription("elements"));
     44  dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements"));
    4545  dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start"));
    4646  dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width"));
     
    6868  Vector Point;
    6969  BinPairMap *binmap = NULL;
    70   MoleculeListClass *molecules = World::getInstance().getMolecules();
    7170
    7271  // obtain information
     
    9796  const LinkedCell *LCList = NULL;
    9897  // find biggest molecule
    99   int counter  = molecules->ListOfMolecules.size();
    100   bool *Actives = new bool[counter];
    101   counter = 0;
    102   for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    103     Actives[counter++] = (*BigFinder)->ActiveFlag;
    104     (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
    105   }
     98  std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
     99  int counter  = molecules.size();
    106100  LCList = new LinkedCell(Boundary, LCWidth);
    107101  FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
     
    113107  delete LCList;
    114108  OutputCorrelationToSurface(&output, surfacemap);
    115   // re-set ActiveFlag
    116   counter = 0;
    117   for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    118     (*BigFinder)->ActiveFlag = Actives[counter++];
    119   }
    120   delete[] Actives;
    121109  // check whether radius was appropriate
    122110  {
  • src/Actions/MapOfActions.cpp

    r521bbf re65de8  
    196196  DescriptionMap["output"] = "write output files";
    197197  DescriptionMap["set-output"] = "specify output formats";
    198   DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements, element and point or element and surface";
     198  DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements";
    199199  DescriptionMap["parse-xyz"] = "parse xyz file into World";
     200  DescriptionMap["point-correlation"] = "pair correlation analysis between element and point";
    200201  DescriptionMap["principal-axis-system"] = "calculate the principal axis system of the specified molecule";
    201202  DescriptionMap["remove-atom"] = "remove a specified atom";
     
    211212  DescriptionMap["set-output"] = "specify output formats";
    212213  DescriptionMap["subgraph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs";
     214  DescriptionMap["surface-correlation"] = "pair correlation analysis between element and surface";
    213215  DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified";
    214216  DescriptionMap["translate-mol"] = "translate molecule by given vector";
     
    234236  DescriptionMap["MaxDistance"] = "maximum distance in space";
    235237  DescriptionMap["molecule-by-id"] = "index of a molecule";
    236   DescriptionMap["molecule-by-name"] = "name of a molecule";
    237238  DescriptionMap["nonconvex-file"] = "filename of the non-convex envelope";
    238239  DescriptionMap["order"] = "order of a discretization, dissection, ...";
     
    271272  ShortFormMap["nonconvex-envelope"] = "N";
    272273//  ShortFormMap["output"] = "o";
    273   ShortFormMap["pair-correlation"] = "C";
     274//  ShortFormMap["pair-correlation"] = "C";
    274275  ShortFormMap["parse-xyz"] = "p";
    275276  ShortFormMap["remove-atom"] = "r";
     
    312313  TypeMap["output"] = &typeid(void);
    313314  TypeMap["parse-xyz"] = &typeid(std::string);
    314   TypeMap["pair-correlation"] = &typeid(std::string);
     315  TypeMap["pair-correlation"] = &typeid(void);
     316  TypeMap["point-correlation"] = &typeid(void);
    315317  TypeMap["principal-axis-system"] = &typeid(molecule);
    316318  TypeMap["remove-atom"] = &typeid(void);
     
    325327  TypeMap["set-output"] = &typeid(std::vector<std::string>);
    326328  TypeMap["subgraph-dissect"] = &typeid(void);
     329  TypeMap["surface-correlation"] = &typeid(void);
    327330  TypeMap["suspend-in-water"] = &typeid(double);
    328331  TypeMap["translate-mol"] = &typeid(VectorValue);
     
    346349  TypeMap["lengths"] = &typeid(VectorValue);
    347350  TypeMap["MaxDistance"] = &typeid(double);
     351  TypeMap["molecule-by-id"] = &typeid(molecule);
    348352  TypeMap["nonconvex-file"] = &typeid(std::string);
    349353  TypeMap["order"] = &typeid(int);
     
    382386  CurrentValue["bin-width"] = "0.5";
    383387  CurrentValue["fastparsing"] = "0";
    384   CurrentValue["atom-by-id"] = "-1";
    385   CurrentValue["molecule-by-id"] = "-1";
    386388  CurrentValue["periodic"] = "0";
    387389
     
    399401  MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "molecular-volume") );
    400402  MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "pair-correlation") );
     403  MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "point-correlation") );
     404  MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "surface-correlation") );
    401405  MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "principal-axis-system") );
    402406
     
    478482        generic.insert("pair-correlation");
    479483        generic.insert("parse-xyz");
     484  generic.insert("point-correlation");
    480485//  generic.insert("principal-axis-system");
    481486  generic.insert("remove-atom");
     
    494499  generic.insert("set-output");
    495500        generic.insert("subgraph-dissect");
     501  generic.insert("surface-correlation");
    496502  generic.insert("suspend-in-water");
    497503  generic.insert("translate-mol");
     
    522528  hidden.insert("lengths");
    523529  hidden.insert("MaxDistance");
     530  hidden.insert("molecule-by-id");
    524531  hidden.insert("nonconvex-file");
    525532  hidden.insert("order");
     
    624631    CurrentValue.erase(name);
    625632    while (!stream.fail()) {
    626       stream >> atomID;
     633      stream >> atomID >> ws;
    627634      Walker = World::getInstance().getAtom(AtomById(atomID));
    628635      if (Walker != NULL)
    629636        _T.push_back(Walker);
     637      atomID = -1;
     638      Walker = NULL;
    630639    }
    631640  } else
     
    643652    CurrentValue.erase(name);
    644653    while (!stream.fail()) {
    645       stream >> Z;
     654      stream >> Z >> ws;
    646655      elemental = World::getInstance().getPeriode()->FindElement(Z);
    647656      if (elemental != NULL)
    648657        _T.push_back(elemental);
     658      Z = -1;
    649659    }
    650660  } else
     
    662672    CurrentValue.erase(name);
    663673    while (!stream.fail()) {
    664       stream >> molID;
     674      stream >> molID >> ws;
    665675      mol = World::getInstance().getMolecule(MoleculeById(molID));
    666676      if (mol != NULL)
    667677        _T.push_back(mol);
     678      molID = -1;
     679      mol = NULL;
    668680    }
    669681  } else
     
    842854    for (set<string>::iterator OptionRunner = ListRunner->first->begin(); OptionRunner != ListRunner->first->end(); ++OptionRunner) {
    843855      if (hasValue(*OptionRunner)) {
    844         DoLog(0) && (Log() << Verbose(0) << "Adding option " << *OptionRunner << " with type " << TypeMap[*OptionRunner]->name() << " to CommandLineParser." << endl);
     856        DoLog(1) && (Log() << Verbose(1) << "Adding option " << *OptionRunner << " with type " << TypeMap[*OptionRunner]->name() << " to CommandLineParser." << endl);
    845857           switch(TypeEnumMap[TypeMap[*OptionRunner]]) {
    846858          default:
  • src/analysis_correlation.cpp

    r521bbf re65de8  
    2828/** Calculates the pair correlation between given elements.
    2929 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
    30  * \param *molecules list of molecules structure
     30 * \param *molecules vector of molecules
    3131 * \param &elements vector of elements to correlate
    3232 * \return Map of doubles with values the pair of the two atoms.
    3333 */
    34 PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const std::vector<element *> &elements)
     34PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements)
    3535{
    3636  Info FunctionInfo(__func__);
     
    3939  Box &domain = World::getInstance().getDomain();
    4040
    41   if (molecules->ListOfMolecules.empty()) {
     41  if (molecules.empty()) {
    4242    DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
    4343    return outmap;
    4444  }
    45   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
     45  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
    4646    (*MolWalker)->doCountAtoms();
    4747
     
    6464
    6565  outmap = new PairCorrelationMap;
    66   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){
    67     if ((*MolWalker)->ActiveFlag) {
    68       DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    69       eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    70       for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    71         DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    72         for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){
    73           if ((*MolOtherWalker)->ActiveFlag) {
    74             DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
    75             for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
    76               DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
    77               if ((*iter)->getId() < (*runner)->getId()){
    78                 for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    79                   if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    80                     distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node);
    81                     //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
    82                     outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
    83                   }
     66  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){
     67    DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
     68    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     69      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
     70      for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){
     71        DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
     72        for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
     73          DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
     74          if ((*iter)->getId() < (*runner)->getId()){
     75            for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
     76              if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
     77                distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node);
     78                //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
     79                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
    8480              }
    85             }
    8681          }
    8782        }
     
    9994 * \return Map of doubles with values the pair of the two atoms.
    10095 */
    101 PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const int ranges[NDIM] )
     96PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const int ranges[NDIM] )
    10297{
    10398  Info FunctionInfo(__func__);
     
    111106  Vector periodicOtherX;
    112107
    113   if (molecules->ListOfMolecules.empty()) {
     108  if (molecules.empty()) {
    114109    DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
    115110    return outmap;
    116111  }
    117   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
     112  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
    118113    (*MolWalker)->doCountAtoms();
    119114
     
    136131
    137132  outmap = new PairCorrelationMap;
    138   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){
    139     if ((*MolWalker)->ActiveFlag) {
    140       Matrix FullMatrix = World::getInstance().getDomain().getM();
    141       Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
    142       DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    143       eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    144       for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    145         DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    146         periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    147         // go through every range in xyz and get distance
    148         for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    149           for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    150             for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    151               checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    152               for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){
    153                 if ((*MolOtherWalker)->ActiveFlag) {
    154                   DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
    155                   for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
    156                     DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
    157                     if ((*iter)->getId() < (*runner)->getId()){
    158                       for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    159                         if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    160                           periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3
    161                           // go through every range in xyz and get distance
    162                           for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
    163                             for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++)
    164                               for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) {
    165                                 checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX);
    166                                 distance = checkX.distance(checkOtherX);
    167                                 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
    168                                 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
    169                               }
    170                         }
     133  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){
     134    Matrix FullMatrix = World::getInstance().getDomain().getM();
     135    Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
     136    DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
     137    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     138      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
     139      periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     140      // go through every range in xyz and get distance
     141      for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
     142        for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
     143          for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
     144            checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
     145            for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){
     146                DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
     147                for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
     148                  DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
     149                  if ((*iter)->getId() < (*runner)->getId()){
     150                    for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
     151                      if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
     152                        periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3
     153                        // go through every range in xyz and get distance
     154                        for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
     155                          for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++)
     156                            for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) {
     157                              checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX);
     158                              distance = checkX.distance(checkOtherX);
     159                              //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
     160                              outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
     161                            }
     162                      }
    171163                    }
    172164                  }
    173165                }
    174               }
    175             }
    176166      }
    177167    }
     
    187177 * \return Map of dobules with values as pairs of atom and the vector
    188178 */
    189 CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Vector *point )
     179CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point )
    190180{
    191181  Info FunctionInfo(__func__);
     
    194184  Box &domain = World::getInstance().getDomain();
    195185
    196   if (molecules->ListOfMolecules.empty()) {
     186  if (molecules.empty()) {
    197187    DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
    198188    return outmap;
    199189  }
    200   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
     190  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
    201191    (*MolWalker)->doCountAtoms();
    202192  outmap = new CorrelationToPointMap;
    203   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    204     if ((*MolWalker)->ActiveFlag) {
    205       DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    206       for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    207         DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    208         for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    209           if ((*type == NULL) || ((*iter)->type == *type)) {
    210             distance = domain.periodicDistance(*(*iter)->node,*point);
    211             DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    212             outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
    213           }
    214       }
    215     }
     193  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
     194    DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
     195    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     196      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
     197      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
     198        if ((*type == NULL) || ((*iter)->type == *type)) {
     199          distance = domain.periodicDistance(*(*iter)->node,*point);
     200          DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
     201          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
     202        }
     203    }
     204  }
    216205
    217206  return outmap;
     
    225214 * \return Map of dobules with values as pairs of atom and the vector
    226215 */
    227 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] )
     216CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] )
    228217{
    229218  Info FunctionInfo(__func__);
     
    234223  Vector checkX;
    235224
    236   if (molecules->ListOfMolecules.empty()) {
     225  if (molecules.empty()) {
    237226    DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
    238227    return outmap;
    239228  }
    240   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
     229  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
    241230    (*MolWalker)->doCountAtoms();
    242231  outmap = new CorrelationToPointMap;
    243   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    244     if ((*MolWalker)->ActiveFlag) {
    245       Matrix FullMatrix = World::getInstance().getDomain().getM();
    246       Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
    247       DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    248       for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    249         DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    250         for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    251           if ((*type == NULL) || ((*iter)->type == *type)) {
    252             periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    253             // go through every range in xyz and get distance
    254             for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    255               for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    256                 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    257                   checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    258                   distance = checkX.distance(*point);
    259                   DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    260                   outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) );
    261                 }
    262           }
    263       }
    264     }
     232  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
     233    Matrix FullMatrix = World::getInstance().getDomain().getM();
     234    Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
     235    DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
     236    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     237      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
     238      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
     239        if ((*type == NULL) || ((*iter)->type == *type)) {
     240          periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     241          // go through every range in xyz and get distance
     242          for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
     243            for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
     244              for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
     245                checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
     246                distance = checkX.distance(*point);
     247                DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
     248                outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) );
     249              }
     250        }
     251    }
     252  }
    265253
    266254  return outmap;
     
    274262 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
    275263 */
    276 CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )
     264CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )
    277265{
    278266  Info FunctionInfo(__func__);
     
    282270  Vector centroid;
    283271
    284   if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) {
     272  if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) {
    285273    DoeLog(1) && (eLog()<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
    286274    return outmap;
    287275  }
    288   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
     276  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
    289277    (*MolWalker)->doCountAtoms();
    290278  outmap = new CorrelationToSurfaceMap;
    291   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    292     if ((*MolWalker)->ActiveFlag) {
    293       DoLog(1) && (Log() << Verbose(1) << "Current molecule is " << (*MolWalker)->name << "." << endl);
    294       if ((*MolWalker)->empty())
    295         DoLog(1) && (1) && (Log() << Verbose(1) << "\t is empty." << endl);
    296       for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    297         DoLog(1) && (Log() << Verbose(1) << "\tCurrent atom is " << *(*iter) << "." << endl);
    298         for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    299           if ((*type == NULL) || ((*iter)->type == *type)) {
    300             TriangleIntersectionList Intersections((*iter)->node,Surface,LC);
    301             distance = Intersections.GetSmallestDistance();
    302             triangle = Intersections.GetClosestTriangle();
    303             outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) );
    304           }
    305       }
    306     } else {
    307       DoLog(1) && (Log() << Verbose(1) << "molecule " << (*MolWalker)->name << " is not active." << endl);
    308     }
     279  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
     280    DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << (*MolWalker)->name << "." << endl);
     281    if ((*MolWalker)->empty())
     282      DoLog(2) && (2) && (Log() << Verbose(2) << "\t is empty." << endl);
     283    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     284      DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl);
     285      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
     286        if ((*type == NULL) || ((*iter)->type == *type)) {
     287          TriangleIntersectionList Intersections((*iter)->node,Surface,LC);
     288          distance = Intersections.GetSmallestDistance();
     289          triangle = Intersections.GetClosestTriangle();
     290          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) );
     291        }
     292    }
     293  }
    309294
    310295  return outmap;
     
    323308 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
    324309 */
    325 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
     310CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
    326311{
    327312  Info FunctionInfo(__func__);
     
    334319  Vector checkX;
    335320
    336   if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) {
     321  if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) {
    337322    DoLog(1) && (Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
    338323    return outmap;
    339324  }
    340   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
     325  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
    341326    (*MolWalker)->doCountAtoms();
    342327  outmap = new CorrelationToSurfaceMap;
    343328  double ShortestDistance = 0.;
    344329  BoundaryTriangleSet *ShortestTriangle = NULL;
    345   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    346     if ((*MolWalker)->ActiveFlag) {
    347       Matrix FullMatrix = World::getInstance().getDomain().getM();
    348       Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
    349       DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    350       for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    351         DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    352         for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    353           if ((*type == NULL) || ((*iter)->type == *type)) {
    354             periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    355             // go through every range in xyz and get distance
    356             ShortestDistance = -1.;
    357             for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    358               for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    359                 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    360                   checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    361                   TriangleIntersectionList Intersections(&checkX,Surface,LC);
    362                   distance = Intersections.GetSmallestDistance();
    363                   triangle = Intersections.GetClosestTriangle();
    364                   if ((ShortestDistance == -1.) || (distance < ShortestDistance)) {
    365                     ShortestDistance = distance;
    366                     ShortestTriangle = triangle;
    367                   }
     330  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
     331    Matrix FullMatrix = World::getInstance().getDomain().getM();
     332    Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
     333    DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
     334    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     335      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
     336      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
     337        if ((*type == NULL) || ((*iter)->type == *type)) {
     338          periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     339          // go through every range in xyz and get distance
     340          ShortestDistance = -1.;
     341          for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
     342            for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
     343              for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
     344                checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
     345                TriangleIntersectionList Intersections(&checkX,Surface,LC);
     346                distance = Intersections.GetSmallestDistance();
     347                triangle = Intersections.GetClosestTriangle();
     348                if ((ShortestDistance == -1.) || (distance < ShortestDistance)) {
     349                  ShortestDistance = distance;
     350                  ShortestTriangle = triangle;
    368351                }
    369             // insert
    370             outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) );
    371             //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
    372           }
    373       }
    374     }
     352              }
     353          // insert
     354          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) );
     355          //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
     356        }
     357    }
     358  }
    375359
    376360  return outmap;
  • src/analysis_correlation.hpp

    r521bbf re65de8  
    2222// STL headers
    2323#include <map>
     24#include <vector>
    2425
    2526#include "defs.hpp"
     
    3334class element;
    3435class LinkedCell;
    35 class MoleculeListClass;
    3636class Tesselation;
    3737class Vector;
     
    4646/********************************************** declarations *******************************/
    4747
    48 PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const std::vector<element *> &elements);
    49 CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Vector *point );
    50 CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC );
    51 PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const int ranges[NDIM] );
    52 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] );
    53 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] );
     48PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements);
     49CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point );
     50CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC );
     51PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const int ranges[NDIM] );
     52CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] );
     53CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] );
    5454int GetBin ( const double value, const double BinWidth, const double BinStart );
    5555void OutputCorrelation( ofstream * const file, const BinPairMap * const map );
  • 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.