Ignore:
Timestamp:
Mar 5, 2010, 10:16:47 AM (16 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, Candidate_v1.7.0, 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:
d3347e
Parents:
e87acf
git-author:
Frederik Heber <heber@…> (03/05/10 10:08:44)
git-committer:
Frederik Heber <heber@…> (03/05/10 10:16:47)
Message:

Huge Refactoring due to class molecule now being an STL container.

  • molecule::start and molecule::end were dropped. Hence, the usual construct Walker = start while (Walker->next != end) {

Walker = walker->next
...

}
was changed to
for (molecule::iterator iter = begin(); iter != end(); ++iter) {

...

}
and (*iter) used instead of Walker.

  • Two build errors remain (beside some more in folder Actions, Patterns and unittest) in molecule_pointcloud.cpp and molecule.cpp
  • lists.cpp was deleted as specialization of atom* was not needed anymore
  • link, unlink, add, remove, removewithoutcheck all are not needed for atoms anymore, just for bonds (where first, last entries remain in molecule)
  • CreateFatherLookupTable() was put back into class molecule.
  • molecule::InternalPointer is now an iterator
  • class PointCloud: GoToPrevious() and GetTerminalPoint() were dropped as not needed.
  • some new STL functions in class molecule: size(), empty(), erase(), find() and insert()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/analysis_correlation.cpp

    re87acf r9879f6  
    4141    if ((*MolWalker)->ActiveFlag) {
    4242      eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    43       atom *Walker = (*MolWalker)->start;
    44       while (Walker->next != (*MolWalker)->end) {
    45         Walker = Walker->next;
    46         Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    47         if ((type1 == NULL) || (Walker->type == type1)) {
     43      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     44        Log() << Verbose(3) << "Current atom is " << *(*iter) << "." << endl;
     45        if ((type1 == NULL) || ((*iter)->type == type1)) {
    4846          for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++)
    4947            if ((*MolOtherWalker)->ActiveFlag) {
    5048              Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;
    51               atom *OtherWalker = (*MolOtherWalker)->start;
    52               while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker
    53                 OtherWalker = OtherWalker->next;
    54                 Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;
    55                 if (Walker->nr < OtherWalker->nr)
    56                   if ((type2 == NULL) || (OtherWalker->type == type2)) {
    57                     distance = Walker->node->PeriodicDistance(OtherWalker->node, (*MolWalker)->cell_size);
    58                     //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
    59                     outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
     49              for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
     50                Log() << Verbose(3) << "Current otheratom is " << *(*runner) << "." << endl;
     51                if ((*iter)->nr < (*runner)->nr)
     52                  if ((type2 == NULL) || ((*runner)->type == type2)) {
     53                    distance = (*iter)->node->PeriodicDistance((*runner)->node, (*MolWalker)->cell_size);
     54                    //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
     55                    outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
    6056                  }
    6157              }
     
    9995      double * FullInverseMatrix = InverseMatrix(FullMatrix);
    10096      eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    101       atom *Walker = (*MolWalker)->start;
    102       while (Walker->next != (*MolWalker)->end) {
    103         Walker = Walker->next;
    104         Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    105         if ((type1 == NULL) || (Walker->type == type1)) {
    106           periodicX.CopyVector(Walker->node);
     97      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     98        Log() << Verbose(3) << "Current atom is " << *(*iter) << "." << endl;
     99        if ((type1 == NULL) || ((*iter)->type == type1)) {
     100          periodicX.CopyVector((*iter)->node);
    107101          periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
    108102          // go through every range in xyz and get distance
     
    116110                  if ((*MolOtherWalker)->ActiveFlag) {
    117111                    Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;
    118                     atom *OtherWalker = (*MolOtherWalker)->start;
    119                     while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker
    120                       OtherWalker = OtherWalker->next;
    121                       Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;
    122                       if (Walker->nr < OtherWalker->nr)
    123                         if ((type2 == NULL) || (OtherWalker->type == type2)) {
    124                           periodicOtherX.CopyVector(OtherWalker->node);
     112                    for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
     113                      Log() << Verbose(3) << "Current otheratom is " << *(*runner) << "." << endl;
     114                      if ((*iter)->nr < (*runner)->nr)
     115                        if ((type2 == NULL) || ((*runner)->type == type2)) {
     116                          periodicOtherX.CopyVector((*runner)->node);
    125117                          periodicOtherX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
    126118                          // go through every range in xyz and get distance
     
    132124                                checkOtherX.MatrixMultiplication(FullMatrix);
    133125                                distance = checkX.Distance(&checkOtherX);
    134                                 //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
    135                                 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
     126                                //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
     127                                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
    136128                              }
    137129                        }
     
    169161    if ((*MolWalker)->ActiveFlag) {
    170162      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    171       atom *Walker = (*MolWalker)->start;
    172       while (Walker->next != (*MolWalker)->end) {
    173         Walker = Walker->next;
    174         Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    175         if ((type == NULL) || (Walker->type == type)) {
    176           distance = Walker->node->PeriodicDistance(point, (*MolWalker)->cell_size);
     163      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     164        Log() << Verbose(3) << "Current atom is " << *(*iter) << "." << endl;
     165        if ((type == NULL) || ((*iter)->type == type)) {
     166          distance = (*iter)->node->PeriodicDistance(point, (*MolWalker)->cell_size);
    177167          Log() << Verbose(4) << "Current distance is " << distance << "." << endl;
    178           outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
     168          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
    179169        }
    180170      }
     
    211201      double * FullInverseMatrix = InverseMatrix(FullMatrix);
    212202      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    213       atom *Walker = (*MolWalker)->start;
    214       while (Walker->next != (*MolWalker)->end) {
    215         Walker = Walker->next;
    216         Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    217         if ((type == NULL) || (Walker->type == type)) {
    218           periodicX.CopyVector(Walker->node);
     203      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     204        Log() << Verbose(3) << "Current atom is " << *(*iter) << "." << endl;
     205        if ((type == NULL) || ((*iter)->type == type)) {
     206          periodicX.CopyVector((*iter)->node);
    219207          periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
    220208          // go through every range in xyz and get distance
     
    227215                distance = checkX.Distance(point);
    228216                Log() << Verbose(4) << "Current distance is " << distance << "." << endl;
    229                 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
     217                outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
    230218              }
    231219        }
     
    262250    if ((*MolWalker)->ActiveFlag) {
    263251      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    264       atom *Walker = (*MolWalker)->start;
    265       while (Walker->next != (*MolWalker)->end) {
    266         Walker = Walker->next;
    267         Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    268         if ((type == NULL) || (Walker->type == type)) {
    269           triangle = Surface->FindClosestTriangleToVector(Walker->node, LC );
     252      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     253        Log() << Verbose(3) << "Current atom is " << *(*iter) << "." << endl;
     254        if ((type == NULL) || ((*iter)->type == type)) {
     255          triangle = Surface->FindClosestTriangleToVector((*iter)->node, LC );
    270256          if (triangle != NULL) {
    271             distance = DistanceToTrianglePlane(Walker->node, triangle);
    272             outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
     257            distance = DistanceToTrianglePlane((*iter)->node, triangle);
     258            outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) );
    273259          }
    274260        }
     
    315301      double * FullInverseMatrix = InverseMatrix(FullMatrix);
    316302      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    317       atom *Walker = (*MolWalker)->start;
    318       while (Walker->next != (*MolWalker)->end) {
    319         Walker = Walker->next;
    320         Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    321         if ((type == NULL) || (Walker->type == type)) {
    322           periodicX.CopyVector(Walker->node);
     303      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     304        Log() << Verbose(3) << "Current atom is " << *(*iter) << "." << endl;
     305        if ((type == NULL) || ((*iter)->type == type)) {
     306          periodicX.CopyVector((*iter)->node);
    323307          periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
    324308          // go through every range in xyz and get distance
     
    339323          // insert
    340324          ShortestDistance = sqrt(ShortestDistance);
    341           outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (Walker, ShortestTriangle) ) );
    342           //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
     325          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> ((*iter), ShortestTriangle) ) );
     326          //Log() << Verbose(1) << "INFO: Inserting " << (*iter) << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
    343327        }
    344328      }
Note: See TracChangeset for help on using the changeset viewer.