Changeset 12f16c for src/Actions


Ignore:
Timestamp:
Apr 10, 2018, 6:43:12 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
Children:
efd020
Parents:
2bb3be
git-author:
Frederik Heber <frederik.heber@…> (08/02/17 21:22:15)
git-committer:
Frederik Heber <frederik.heber@…> (04/10/18 06:43:12)
Message:

ForceAnnealing first parses forces, then copies step and finally optimizes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MoleculeAction/ForceAnnealingAction.cpp

    r2bb3be r12f16c  
    8585  }
    8686
    87   size_t CurrentStep = WorldTime::getInstance().getTime();
    88   {
    89     // copy current time step to new one and and proceed on this one
    90     for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection();
    91         iter != World::getInstance().endAtomSelection();
    92         ++iter) {
    93       atom * const Walker = iter->second;
    94       Walker->setPositionAtStep(CurrentStep+1,
    95           Walker->getPositionAtStep(CurrentStep));
    96       if (!params.forcesfile.get().string().empty()) {
    97         // don't use forces or velocities from old step
    98         Walker->setAtomicVelocityAtStep(CurrentStep+1, zeroVec);
    99         Walker->setAtomicForceAtStep(CurrentStep+1, zeroVec);
    100       } else {
    101         // force have already been calculated, hence copy them
    102         Walker->setAtomicVelocityAtStep(CurrentStep+1,
    103             Walker->getAtomicVelocityAtStep(CurrentStep));
    104         Walker->setAtomicForceAtStep(CurrentStep+1,
    105             Walker->getAtomicForceAtStep(CurrentStep));
    106       }
    107     }
    108     // increment to next time step: re-creates bond graph
    109     ++CurrentStep;
    110     World::getInstance().setTime(CurrentStep);
    111   }
     87  // instantiate optimizer
    11288  ForceAnnealing<std::vector<atom *> > optimizer(
    11389      set,
     
    11793      params.MaxDistance.get(),
    11894      params.DampingFactor.get());
    119   // parse forces into next step
     95  size_t CurrentStep = WorldTime::getInstance().getTime();
     96
     97  // parse forces into current step
    12098  if (!params.forcesfile.get().string().empty()) {
    12199    LOG(1, "Parsing forces file.");
     
    126104  }
    127105
     106  // copy current time step to new one and and proceed on this one
     107  {
     108    for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection();
     109        iter != World::getInstance().endAtomSelection();
     110        ++iter) {
     111      atom * const Walker = iter->second;
     112      Walker->setPositionAtStep(CurrentStep+1,
     113          Walker->getPositionAtStep(CurrentStep));
     114      // force have already been calculated, hence copy them
     115      Walker->setAtomicVelocityAtStep(CurrentStep+1,
     116          Walker->getAtomicVelocityAtStep(CurrentStep));
     117      Walker->setAtomicForceAtStep(CurrentStep+1,
     118          Walker->getAtomicForceAtStep(CurrentStep));
     119    }
     120    // increment to next time step: re-creates bond graph
     121    ++CurrentStep;
     122    World::getInstance().setTime(CurrentStep);
     123  }
     124
    128125  // perform optimization step
    129126  LOG(1, "Structural optimization.");
    130127  optimizer(CurrentStep, 1, params.UseBondGraph.get());
    131128  STATUS("Successfully optimized structure by one step.");
    132 
    133 //  // increment to next time step
    134 //  World::getInstance().setTime(CurrentStep+1);
    135129
    136130  std::vector<AtomicInfo> RedoInfo;
Note: See TracChangeset for help on using the changeset viewer.