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/molecule_dynamics.cpp

    re87acf r9879f6  
    2727  gsl_matrix *A = gsl_matrix_alloc(NDIM,NDIM);
    2828  gsl_vector *x = gsl_vector_alloc(NDIM);
    29   atom * Runner = mol->start;
    3029  atom *Sprinter = NULL;
    3130  Vector trajectory1, trajectory2, normal, TestVector;
    3231  double Norm1, Norm2, tmp, result = 0.;
    3332
    34   while (Runner->next != mol->end) {
    35     Runner = Runner->next;
    36     if (Runner == Walker) // hence, we only go up to the Walker, not beyond (similar to i=0; i<j; i++)
     33  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     34    if ((*iter) == Walker) // hence, we only go up to the Walker, not beyond (similar to i=0; i<j; i++)
    3735      break;
    3836    // determine normalized trajectories direction vector (n1, n2)
     
    4240    trajectory1.Normalize();
    4341    Norm1 = trajectory1.Norm();
    44     Sprinter = Params.PermutationMap[Runner->nr];   // find second target point
     42    Sprinter = Params.PermutationMap[(*iter)->nr];   // find second target point
    4543    trajectory2.CopyVector(&Sprinter->Trajectory.R.at(Params.endstep));
    46     trajectory2.SubtractVector(&Runner->Trajectory.R.at(Params.startstep));
     44    trajectory2.SubtractVector(&(*iter)->Trajectory.R.at(Params.startstep));
    4745    trajectory2.Normalize();
    4846    Norm2 = trajectory1.Norm();
    4947    // check whether either is zero()
    5048    if ((Norm1 < MYEPSILON) && (Norm2 < MYEPSILON)) {
    51       tmp = Walker->Trajectory.R.at(Params.startstep).Distance(&Runner->Trajectory.R.at(Params.startstep));
     49      tmp = Walker->Trajectory.R.at(Params.startstep).Distance(&(*iter)->Trajectory.R.at(Params.startstep));
    5250    } else if (Norm1 < MYEPSILON) {
    5351      Sprinter = Params.PermutationMap[Walker->nr];   // find first target point
    5452      trajectory1.CopyVector(&Sprinter->Trajectory.R.at(Params.endstep));  // copy first offset
    55       trajectory1.SubtractVector(&Runner->Trajectory.R.at(Params.startstep));  // subtract second offset
     53      trajectory1.SubtractVector(&(*iter)->Trajectory.R.at(Params.startstep));  // subtract second offset
    5654      trajectory2.Scale( trajectory1.ScalarProduct(&trajectory2) ); // trajectory2 is scaled to unity, hence we don't need to divide by anything
    5755      trajectory1.SubtractVector(&trajectory2);   // project the part in norm direction away
    5856      tmp = trajectory1.Norm();  // remaining norm is distance
    5957    } else if (Norm2 < MYEPSILON) {
    60       Sprinter = Params.PermutationMap[Runner->nr];   // find second target point
     58      Sprinter = Params.PermutationMap[(*iter)->nr];   // find second target point
    6159      trajectory2.CopyVector(&Sprinter->Trajectory.R.at(Params.endstep));  // copy second offset
    6260      trajectory2.SubtractVector(&Walker->Trajectory.R.at(Params.startstep));  // subtract first offset
     
    6563      tmp = trajectory2.Norm();  // remaining norm is distance
    6664    } else if ((fabs(trajectory1.ScalarProduct(&trajectory2)/Norm1/Norm2) - 1.) < MYEPSILON) { // check whether they're linear dependent
    67   //        Log() << Verbose(3) << "Both trajectories of " << *Walker << " and " << *Runner << " are linear dependent: ";
     65  //        Log() << Verbose(3) << "Both trajectories of " << *Walker << " and " << *(*iter) << " are linear dependent: ";
    6866  //        Log() << Verbose(0) << trajectory1;
    6967  //        Log() << Verbose(0) << " and ";
    7068  //        Log() << Verbose(0) << trajectory2;
    71       tmp = Walker->Trajectory.R.at(Params.startstep).Distance(&Runner->Trajectory.R.at(Params.startstep));
     69      tmp = Walker->Trajectory.R.at(Params.startstep).Distance(&(*iter)->Trajectory.R.at(Params.startstep));
    7270  //        Log() << Verbose(0) << " with distance " << tmp << "." << endl;
    7371    } else { // determine distance by finding minimum distance
    74   //        Log() << Verbose(3) << "Both trajectories of " << *Walker << " and " << *Runner << " are linear independent ";
     72  //        Log() << Verbose(3) << "Both trajectories of " << *Walker << " and " << *(*iter) << " are linear independent ";
    7573  //        Log() << Verbose(0) << endl;
    7674  //        Log() << Verbose(0) << "First Trajectory: ";
     
    8886        gsl_matrix_set(A, 1, i, trajectory2.x[i]);
    8987        gsl_matrix_set(A, 2, i, normal.x[i]);
    90         gsl_vector_set(x,i, (Walker->Trajectory.R.at(Params.startstep).x[i] - Runner->Trajectory.R.at(Params.startstep).x[i]));
     88        gsl_vector_set(x,i, (Walker->Trajectory.R.at(Params.startstep).x[i] - (*iter)->Trajectory.R.at(Params.startstep).x[i]));
    9189      }
    9290      // solve the linear system by Householder transformations
     
    9694  //        Log() << Verbose(0) << " with distance " << tmp << "." << endl;
    9795      // test whether we really have the intersection (by checking on c_1 and c_2)
    98       TestVector.CopyVector(&Runner->Trajectory.R.at(Params.startstep));
     96      TestVector.CopyVector(&(*iter)->Trajectory.R.at(Params.startstep));
    9997      trajectory2.Scale(gsl_vector_get(x,1));
    10098      TestVector.AddVector(&trajectory2);
     
    131129{
    132130  double result = 0.;
    133   atom * Runner = mol->start;
    134   while (Runner->next != mol->end) {
    135     Runner = Runner->next;
    136     if ((Params.PermutationMap[Walker->nr] == Params.PermutationMap[Runner->nr]) && (Walker->nr < Runner->nr)) {
     131  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     132    if ((Params.PermutationMap[Walker->nr] == Params.PermutationMap[(*iter)->nr]) && (Walker->nr < (*iter)->nr)) {
    137133  //    atom *Sprinter = PermutationMap[Walker->nr];
    138   //        Log() << Verbose(0) << *Walker << " and " << *Runner << " are heading to the same target at ";
     134  //        Log() << Verbose(0) << *Walker << " and " << *(*iter) << " are heading to the same target at ";
    139135  //        Log() << Verbose(0) << Sprinter->Trajectory.R.at(endstep);
    140136  //        Log() << Verbose(0) << ", penalting." << endl;
     
    167163  // go through every atom
    168164  atom *Runner = NULL;
    169   atom *Walker = start;
    170   while (Walker->next != end) {
    171     Walker = Walker->next;
     165  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    172166    // first term: distance to target
    173     Runner = Params.PermutationMap[Walker->nr];   // find target point
    174     tmp = (Walker->Trajectory.R.at(Params.startstep).Distance(&Runner->Trajectory.R.at(Params.endstep)));
     167    Runner = Params.PermutationMap[(*iter)->nr];   // find target point
     168    tmp = ((*iter)->Trajectory.R.at(Params.startstep).Distance(&Runner->Trajectory.R.at(Params.endstep)));
    175169    tmp *= Params.IsAngstroem ? 1. : 1./AtomicLengthToAngstroem;
    176170    result += Params.PenaltyConstants[0] * tmp;
     
    178172
    179173    // second term: sum of distances to other trajectories
    180     result += SumDistanceOfTrajectories(Walker, this, Params);
     174    result += SumDistanceOfTrajectories((*iter), this, Params);
    181175
    182176    // third term: penalty for equal targets
    183     result += PenalizeEqualTargets(Walker, this, Params);
     177    result += PenalizeEqualTargets((*iter), this, Params);
    184178  }
    185179
     
    224218  }
    225219
    226   atom *Runner = NULL;
    227   atom *Walker = mol->start;
    228   while (Walker->next != mol->end) {
    229     Walker = Walker->next;
    230     Runner = mol->start;
    231     while(Runner->next != mol->end) {
    232       Runner = Runner->next;
    233       Params.DistanceList[Walker->nr]->insert( DistancePair(Walker->Trajectory.R.at(Params.startstep).Distance(&Runner->Trajectory.R.at(Params.endstep)), Runner) );
     220  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     221    for (molecule::const_iterator runner = mol->begin(); runner != mol->end(); ++runner) {
     222      Params.DistanceList[(*iter)->nr]->insert( DistancePair((*iter)->Trajectory.R.at(Params.startstep).Distance(&(*runner)->Trajectory.R.at(Params.endstep)), (*runner)) );
    234223    }
    235224  }
     
    243232void CreateInitialLists(molecule *mol, struct EvaluatePotential &Params)
    244233{
    245   atom *Walker = mol->start;
    246   while (Walker->next != mol->end) {
    247     Walker = Walker->next;
    248     Params.StepList[Walker->nr] = Params.DistanceList[Walker->nr]->begin();    // stores the step to the next iterator that could be a possible next target
    249     Params.PermutationMap[Walker->nr] = Params.DistanceList[Walker->nr]->begin()->second;   // always pick target with the smallest distance
    250     Params.DoubleList[Params.DistanceList[Walker->nr]->begin()->second->nr]++;            // increase this target's source count (>1? not injective)
    251     Params.DistanceIterators[Walker->nr] = Params.DistanceList[Walker->nr]->begin();    // and remember which one we picked
    252     Log() << Verbose(2) << *Walker << " starts with distance " << Params.DistanceList[Walker->nr]->begin()->first << "." << endl;
     234  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     235    Params.StepList[(*iter)->nr] = Params.DistanceList[(*iter)->nr]->begin();    // stores the step to the next iterator that could be a possible next target
     236    Params.PermutationMap[(*iter)->nr] = Params.DistanceList[(*iter)->nr]->begin()->second;   // always pick target with the smallest distance
     237    Params.DoubleList[Params.DistanceList[(*iter)->nr]->begin()->second->nr]++;            // increase this target's source count (>1? not injective)
     238    Params.DistanceIterators[(*iter)->nr] = Params.DistanceList[(*iter)->nr]->begin();    // and remember which one we picked
     239    Log() << Verbose(2) << *(*iter) << " starts with distance " << Params.DistanceList[(*iter)->nr]->begin()->first << "." << endl;
    253240  }
    254241};
     
    291278void MakeInjectivePermutation(molecule *mol, struct EvaluatePotential &Params)
    292279{
    293   atom *Walker = mol->start;
     280  molecule::const_iterator iter = mol->begin();
    294281  DistanceMap::iterator NewBase;
    295282  double Potential = fabs(mol->ConstrainedPotential(Params));
    296283
     284  if (mol->empty()) {
     285    eLog() << Verbose(1) << "Molecule is empty." << endl;
     286    return;
     287  }
    297288  while ((Potential) > Params.PenaltyConstants[2]) {
    298289    PrintPermutationMap(mol->AtomCount, Params);
    299     Walker = Walker->next;
    300     if (Walker == mol->end) // round-robin at the end
    301       Walker = mol->start->next;
    302     if (Params.DoubleList[Params.DistanceIterators[Walker->nr]->second->nr] <= 1)  // no need to make those injective that aren't
     290    iter++;
     291    if (iter == mol->end()) // round-robin at the end
     292      iter = mol->begin();
     293    if (Params.DoubleList[Params.DistanceIterators[(*iter)->nr]->second->nr] <= 1)  // no need to make those injective that aren't
    303294      continue;
    304295    // now, try finding a new one
    305     Potential = TryNextNearestNeighbourForInjectivePermutation(mol, Walker, Potential, Params);
     296    Potential = TryNextNearestNeighbourForInjectivePermutation(mol, (*iter), Potential, Params);
    306297  }
    307298  for (int i=mol->AtomCount; i--;) // now each single entry in the DoubleList should be <=1
     
    350341  Params.StepList = Malloc<DistanceMap::iterator>(AtomCount, "molecule::MinimiseConstrainedPotential: Params.*StepList");
    351342  int round;
    352   atom *Walker = NULL, *Runner = NULL, *Sprinter = NULL;
     343  atom *Sprinter = NULL;
    353344  DistanceMap::iterator Rider, Strider;
    354345
     
    377368    Log() << Verbose(2) << "Starting round " << ++round << ", at current potential " << OldPotential << " ... " << endl;
    378369    OlderPotential = OldPotential;
     370    molecule::const_iterator iter;
    379371    do {
    380       Walker = start;
    381       while (Walker->next != end) { // pick one
    382         Walker = Walker->next;
     372      iter = begin();
     373      for (; iter != end(); ++iter) {
    383374        PrintPermutationMap(AtomCount, Params);
    384         Sprinter = Params.DistanceIterators[Walker->nr]->second;   // store initial partner
    385         Strider = Params.DistanceIterators[Walker->nr];  //remember old iterator
    386         Params.DistanceIterators[Walker->nr] = Params.StepList[Walker->nr];
    387         if (Params.DistanceIterators[Walker->nr] == Params.DistanceList[Walker->nr]->end()) {// stop, before we run through the list and still on
    388           Params.DistanceIterators[Walker->nr] == Params.DistanceList[Walker->nr]->begin();
     375        Sprinter = Params.DistanceIterators[(*iter)->nr]->second;   // store initial partner
     376        Strider = Params.DistanceIterators[(*iter)->nr];  //remember old iterator
     377        Params.DistanceIterators[(*iter)->nr] = Params.StepList[(*iter)->nr];
     378        if (Params.DistanceIterators[(*iter)->nr] == Params.DistanceList[(*iter)->nr]->end()) {// stop, before we run through the list and still on
     379          Params.DistanceIterators[(*iter)->nr] == Params.DistanceList[(*iter)->nr]->begin();
    389380          break;
    390381        }
    391         //Log() << Verbose(2) << "Current Walker: " << *Walker << " with old/next candidate " << *Sprinter << "/" << *DistanceIterators[Walker->nr]->second << "." << endl;
     382        //Log() << Verbose(2) << "Current Walker: " << *(*iter) << " with old/next candidate " << *Sprinter << "/" << *DistanceIterators[(*iter)->nr]->second << "." << endl;
    392383        // find source of the new target
    393         Runner = start->next;
    394         while(Runner != end) { // find the source whose toes we might be stepping on (Walker's new target should be in use by another already)
    395           if (Params.PermutationMap[Runner->nr] == Params.DistanceIterators[Walker->nr]->second) {
    396             //Log() << Verbose(2) << "Found the corresponding owner " << *Runner << " to " << *PermutationMap[Runner->nr] << "." << endl;
     384        molecule::const_iterator runner = begin();
     385        for (; runner != end(); ++runner) { // find the source whose toes we might be stepping on (Walker's new target should be in use by another already)
     386          if (Params.PermutationMap[(*runner)->nr] == Params.DistanceIterators[(*iter)->nr]->second) {
     387            //Log() << Verbose(2) << "Found the corresponding owner " << *(*runner) << " to " << *PermutationMap[(*runner)->nr] << "." << endl;
    397388            break;
    398389          }
    399           Runner = Runner->next;
    400390        }
    401         if (Runner != end) { // we found the other source
     391        if (runner != end()) { // we found the other source
    402392          // then look in its distance list for Sprinter
    403           Rider = Params.DistanceList[Runner->nr]->begin();
    404           for (; Rider != Params.DistanceList[Runner->nr]->end(); Rider++)
     393          Rider = Params.DistanceList[(*runner)->nr]->begin();
     394          for (; Rider != Params.DistanceList[(*runner)->nr]->end(); Rider++)
    405395            if (Rider->second == Sprinter)
    406396              break;
    407           if (Rider != Params.DistanceList[Runner->nr]->end()) { // if we have found one
    408             //Log() << Verbose(2) << "Current Other: " << *Runner << " with old/next candidate " << *PermutationMap[Runner->nr] << "/" << *Rider->second << "." << endl;
     397          if (Rider != Params.DistanceList[(*runner)->nr]->end()) { // if we have found one
     398            //Log() << Verbose(2) << "Current Other: " << *(*runner) << " with old/next candidate " << *PermutationMap[(*runner)->nr] << "/" << *Rider->second << "." << endl;
    409399            // exchange both
    410             Params.PermutationMap[Walker->nr] = Params.DistanceIterators[Walker->nr]->second; // put next farther distance into PermutationMap
    411             Params.PermutationMap[Runner->nr] = Sprinter;  // and hand the old target to its respective owner
     400            Params.PermutationMap[(*iter)->nr] = Params.DistanceIterators[(*iter)->nr]->second; // put next farther distance into PermutationMap
     401            Params.PermutationMap[(*runner)->nr] = Sprinter;  // and hand the old target to its respective owner
    412402            PrintPermutationMap(AtomCount, Params);
    413403            // calculate the new potential
     
    416406            if (Potential > OldPotential) { // we made everything worse! Undo ...
    417407              //Log() << Verbose(3) << "Nay, made the potential worse: " << Potential << " vs. " << OldPotential << "!" << endl;
    418               //Log() << Verbose(3) << "Setting " << *Runner << "'s source to " << *Params.DistanceIterators[Runner->nr]->second << "." << endl;
     408              //Log() << Verbose(3) << "Setting " << *(*runner) << "'s source to " << *Params.DistanceIterators[(*runner)->nr]->second << "." << endl;
    419409              // Undo for Runner (note, we haven't moved the iteration yet, we may use this)
    420               Params.PermutationMap[Runner->nr] = Params.DistanceIterators[Runner->nr]->second;
     410              Params.PermutationMap[(*runner)->nr] = Params.DistanceIterators[(*runner)->nr]->second;
    421411              // Undo for Walker
    422               Params.DistanceIterators[Walker->nr] = Strider;  // take next farther distance target
    423               //Log() << Verbose(3) << "Setting " << *Walker << "'s source to " << *Params.DistanceIterators[Walker->nr]->second << "." << endl;
    424               Params.PermutationMap[Walker->nr] = Params.DistanceIterators[Walker->nr]->second;
     412              Params.DistanceIterators[(*iter)->nr] = Strider;  // take next farther distance target
     413              //Log() << Verbose(3) << "Setting " << *(*iter) << "'s source to " << *Params.DistanceIterators[(*iter)->nr]->second << "." << endl;
     414              Params.PermutationMap[(*iter)->nr] = Params.DistanceIterators[(*iter)->nr]->second;
    425415            } else {
    426               Params.DistanceIterators[Runner->nr] = Rider;  // if successful also move the pointer in the iterator list
     416              Params.DistanceIterators[(*runner)->nr] = Rider;  // if successful also move the pointer in the iterator list
    427417              Log() << Verbose(3) << "Found a better permutation, new potential is " << Potential << " vs." << OldPotential << "." << endl;
    428418              OldPotential = Potential;
     
    434424            //Log() << Verbose(0) << endl;
    435425          } else {
    436             eLog() << Verbose(1) << *Runner << " was not the owner of " << *Sprinter << "!" << endl;
     426            eLog() << Verbose(1) << *(*runner) << " was not the owner of " << *Sprinter << "!" << endl;
    437427            exit(255);
    438428          }
    439429        } else {
    440           Params.PermutationMap[Walker->nr] = Params.DistanceIterators[Walker->nr]->second; // new target has no source!
     430          Params.PermutationMap[(*iter)->nr] = Params.DistanceIterators[(*iter)->nr]->second; // new target has no source!
    441431        }
    442         Params.StepList[Walker->nr]++; // take next farther distance target
     432        Params.StepList[(*iter)->nr]++; // take next farther distance target
    443433      }
    444     } while (Walker->next != end);
     434    } while (++iter != end());
    445435  } while ((OlderPotential - OldPotential) > 1e-3);
    446436  Log() << Verbose(1) << "done." << endl;
     
    489479  // Get the Permutation Map by MinimiseConstrainedPotential
    490480  atom **PermutationMap = NULL;
    491   atom *Walker = NULL, *Sprinter = NULL;
     481  atom *Sprinter = NULL;
    492482  if (!MapByIdentity)
    493483    MinimiseConstrainedPotential(PermutationMap, startstep, endstep, configuration.GetIsAngstroem());
     
    508498    mol = World::get()->createMolecule();
    509499    MoleculePerStep->insert(mol);
    510     Walker = start;
    511     while (Walker->next != end) {
    512       Walker = Walker->next;
     500    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    513501      // add to molecule list
    514       Sprinter = mol->AddCopyAtom(Walker);
     502      Sprinter = mol->AddCopyAtom((*iter));
    515503      for (int n=NDIM;n--;) {
    516         Sprinter->x.x[n] = Walker->Trajectory.R.at(startstep).x[n] + (PermutationMap[Walker->nr]->Trajectory.R.at(endstep).x[n] - Walker->Trajectory.R.at(startstep).x[n])*((double)step/(double)MaxSteps);
     504        Sprinter->x.x[n] = (*iter)->Trajectory.R.at(startstep).x[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep).x[n] - (*iter)->Trajectory.R.at(startstep).x[n])*((double)step/(double)MaxSteps);
    517505        // add to Trajectories
    518506        //Log() << Verbose(3) << step << ">=" << MDSteps-1 << endl;
    519507        if (step < MaxSteps) {
    520           Walker->Trajectory.R.at(step).x[n] = Walker->Trajectory.R.at(startstep).x[n] + (PermutationMap[Walker->nr]->Trajectory.R.at(endstep).x[n] - Walker->Trajectory.R.at(startstep).x[n])*((double)step/(double)MaxSteps);
    521           Walker->Trajectory.U.at(step).x[n] = 0.;
    522           Walker->Trajectory.F.at(step).x[n] = 0.;
     508          (*iter)->Trajectory.R.at(step).x[n] = (*iter)->Trajectory.R.at(startstep).x[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep).x[n] - (*iter)->Trajectory.R.at(startstep).x[n])*((double)step/(double)MaxSteps);
     509          (*iter)->Trajectory.U.at(step).x[n] = 0.;
     510          (*iter)->Trajectory.F.at(step).x[n] = 0.;
    523511        }
    524512      }
Note: See TracChangeset for help on using the changeset viewer.