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/Legacy/oldmenu.cpp

    re87acf r9879f6  
    447447      break;
    448448    case 'b':
    449       second = mol->AskAtom("Enter number of atom as reference point: ");
    450       Log() << Verbose(0) << "Enter radius: ";
    451       cin >> tmp1;
    452       first = mol->start;
    453       second = first->next;
    454       while(second != mol->end) {
    455         first = second;
    456         second = first->next;
    457         if (first->x.DistanceSquared((const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...
    458           mol->RemoveAtom(first);
     449      {
     450        second = mol->AskAtom("Enter number of atom as reference point: ");
     451        Log() << Verbose(0) << "Enter radius: ";
     452        cin >> tmp1;
     453        molecule::iterator runner;
     454        for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
     455          runner = iter++;
     456          if ((*runner)->x.DistanceSquared((const Vector *)&(*runner)->x) > tmp1*tmp1) // distance to first above radius ...
     457            mol->RemoveAtom((*runner));
     458        }
    459459      }
    460460      break;
     
    466466      Log() << Verbose(0) << "Upper boundary: ";
    467467      cin >> tmp2;
    468       first = mol->start;
    469       second = first->next;
    470       while(second != mol->end) {
    471         first = second;
    472         second = first->next;
    473         if ((first->x.x[axis] < tmp1) || (first->x.x[axis] > tmp2)) {// out of boundary ...
    474           //Log() << Verbose(0) << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
    475           mol->RemoveAtom(first);
     468      molecule::iterator runner;
     469      for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
     470        runner = iter++;
     471        if (((*runner)->x.x[axis] < tmp1) || ((*runner)->x.x[axis] > tmp2)) {// out of boundary ...
     472          //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
     473          mol->RemoveAtom((*runner));
    476474        }
    477475      }
     
    516514        min[i] = 0.;
    517515
    518       second = mol->start;
    519       while ((second->next != mol->end)) {
    520         second = second->next; // advance
    521         Z = second->type->Z;
     516      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     517        Z = (*iter)->type->Z;
    522518        tmp1 = 0.;
    523         if (first != second) {
     519        if (first != (*iter)) {
    524520          x.CopyVector((const Vector *)&first->x);
    525           x.SubtractVector((const Vector *)&second->x);
     521          x.SubtractVector((const Vector *)&(*iter)->x);
    526522          tmp1 = x.Norm();
    527523        }
    528524        if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1;
    529         //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl;
     525        //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << ((*iter)->nr << ": " << tmp1 << " a.u." << endl;
    530526      }
    531527      for (int i=MAX_ELEMENTS;i--;)
     
    767763      vectors = new Vector *[count];
    768764      j = 0;
    769       first = mol->start;
    770       while (first->next != mol->end) { // make a list of all atoms with coordinates and element
    771         first = first->next;
    772         Elements[j] = first->type;
    773         vectors[j] = &first->x;
     765      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     766        Elements[j] = (*iter)->type;
     767        vectors[j] = &(*iter)->x;
    774768        j++;
    775769      }
     
    10291023    return;
    10301024  }
    1031   atom *Walker = mol->start;
    10321025
    10331026  // generate some KeySets
     
    10351028  KeySet TestSets[mol->AtomCount+1];
    10361029  i=1;
    1037   while (Walker->next != mol->end) {
    1038     Walker = Walker->next;
     1030  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    10391031    for (int j=0;j<i;j++) {
    1040       TestSets[j].insert(Walker->nr);
     1032      TestSets[j].insert((*iter)->nr);
    10411033    }
    10421034    i++;
     
    10441036  Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;
    10451037  KeySetTestPair test;
    1046   test = TestSets[mol->AtomCount-1].insert(Walker->nr);
    1047   if (test.second) {
    1048     Log() << Verbose(1) << "Insertion worked?!" << endl;
     1038  molecule::const_iterator iter = mol->begin();
     1039  if (iter != mol->end()) {
     1040    test = TestSets[mol->AtomCount-1].insert((*iter)->nr);
     1041    if (test.second) {
     1042      Log() << Verbose(1) << "Insertion worked?!" << endl;
     1043    } else {
     1044      Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
     1045    }
    10491046  } else {
    1050     Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
    1051   }
    1052   TestSets[mol->AtomCount].insert(mol->end->previous->nr);
    1053   TestSets[mol->AtomCount].insert(mol->end->previous->previous->previous->nr);
     1047    eLog() << Verbose(1) << "No atoms to test double insertion." << endl;
     1048  }
    10541049
    10551050  // constructing Graph structure
Note: See TracChangeset for help on using the changeset viewer.