Changeset 9879f6 for src/boundary.cpp


Ignore:
Timestamp:
Mar 5, 2010, 10:16:47 AM (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:
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/boundary.cpp

    re87acf r9879f6  
    140140{
    141141        Info FunctionInfo(__func__);
    142   atom *Walker = NULL;
    143142  PointMap PointsOnBoundary;
    144143  LineMap LinesOnBoundary;
     
    166165
    167166    // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours
    168     Walker = mol->start;
    169     while (Walker->next != mol->end) {
    170       Walker = Walker->next;
    171       ProjectedVector.CopyVector(&Walker->x);
     167    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     168      ProjectedVector.CopyVector(&(*iter)->x);
    172169      ProjectedVector.SubtractVector(MolCenter);
    173170      ProjectedVector.ProjectOntoPlane(&AxisVector);
     
    184181        angle = 2. * M_PI - angle;
    185182      }
    186       Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
    187       BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker)));
     183      Log() << Verbose(1) << "Inserting " << *(*iter) << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
     184      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, (*iter))));
    188185      if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
    189186        Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl;
    190187        Log() << Verbose(2) << "Present vector: " << *BoundaryTestPair.first->second.second << endl;
    191         Log() << Verbose(2) << "New vector: " << *Walker << endl;
     188        Log() << Verbose(2) << "New vector: " << *(*iter) << endl;
    192189        const double ProjectedVectorNorm = ProjectedVector.NormSquared();
    193190        if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) {
    194191          BoundaryTestPair.first->second.first = ProjectedVectorNorm;
    195           BoundaryTestPair.first->second.second = Walker;
     192          BoundaryTestPair.first->second.second = (*iter);
    196193          Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl;
    197194        } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) {
    198           helper.CopyVector(&Walker->x);
     195          helper.CopyVector(&(*iter)->x);
    199196          helper.SubtractVector(MolCenter);
    200197          const double oldhelperNorm = helper.NormSquared();
     
    202199          helper.SubtractVector(MolCenter);
    203200          if (helper.NormSquared() < oldhelperNorm) {
    204             BoundaryTestPair.first->second.second = Walker;
     201            BoundaryTestPair.first->second.second = (*iter);
    205202            Log() << Verbose(2) << "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "." << endl;
    206203          } else {
     
    705702  int repetition[NDIM] = { 1, 1, 1 };
    706703  int TotalNoClusters = 1;
    707   atom *Walker = NULL;
    708704  double totalmass = 0.;
    709705  double clustervolume = 0.;
     
    729725
    730726  // sum up the atomic masses
    731   Walker = mol->start;
    732   while (Walker->next != mol->end) {
    733       Walker = Walker->next;
    734       totalmass += Walker->type->mass;
     727  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     728      totalmass += (*iter)->type->mass;
    735729  }
    736730  Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl;
     
    811805  Vector FillerDistance;
    812806  double FillIt = false;
    813   atom *Walker = NULL;
    814807  bond *Binder = NULL;
    815808  int i = 0;
     
    884877
    885878          // go through all atoms
    886           Walker = filler->start;
    887           while (Walker->next != filler->end) {
    888             Walker = Walker->next;
     879          for (molecule::const_iterator iter = filler->begin(); iter != filler->end(); ++iter) {
    889880            // copy atom ...
    890             CopyAtoms[Walker->nr] = Walker->clone();
     881            CopyAtoms[(*iter)->nr] = (*iter)->clone();
    891882
    892883            // create atomic random translation vector ...
     
    913904            // ... and put at new position
    914905            if (DoRandomRotation)
    915               CopyAtoms[Walker->nr]->x.MatrixMultiplication(Rotations);
    916             CopyAtoms[Walker->nr]->x.AddVector(&AtomTranslations);
    917             CopyAtoms[Walker->nr]->x.AddVector(&FillerTranslations);
    918             CopyAtoms[Walker->nr]->x.AddVector(&CurrentPosition);
     906              CopyAtoms[(*iter)->nr]->x.MatrixMultiplication(Rotations);
     907            CopyAtoms[(*iter)->nr]->x.AddVector(&AtomTranslations);
     908            CopyAtoms[(*iter)->nr]->x.AddVector(&FillerTranslations);
     909            CopyAtoms[(*iter)->nr]->x.AddVector(&CurrentPosition);
    919910
    920911            // insert into Filling
    921912
    922913            // FIXME: gives completely different results if CopyAtoms[..] used instead of Walker, why???
    923             Log() << Verbose(4) << "Filling atom " << *Walker << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[Walker->nr]->x) << "." << endl;
    924             Filling->AddAtom(CopyAtoms[Walker->nr]);
     914            Log() << Verbose(4) << "Filling atom " << *(*iter) << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl;
     915            Filling->AddAtom(CopyAtoms[(*iter)->nr]);
    925916          }
    926917
     
    10361027//  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
    10371028//  //->InsertStraddlingPoints(mol, LCList);
    1038 //  mol->GoToFirst();
     1029//  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    10391030//  class TesselPoint *Runner = NULL;
    1040 //  while (!mol->IsEnd()) {
    1041 //    Runner = mol->GetPoint();
     1031//    Runner = *iter;
    10421032//    Log() << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl;
    10431033//    if (!->IsInnerPoint(Runner, LCList)) {
     
    10471037//      Log() << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl;
    10481038//    }
    1049 //    mol->GoToNext();
    10501039//  }
    10511040
Note: See TracChangeset for help on using the changeset viewer.