Ignore:
Timestamp:
Nov 7, 2017, 7:34:54 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
ForceAnnealing_with_BondGraph_continued_betteresults
Children:
0f9726
Parents:
645bed
git-author:
Frederik Heber <frederik.heber@…> (09/11/17 17:03:27)
git-committer:
Frederik Heber <frederik.heber@…> (11/07/17 07:34:54)
Message:

Readded step-world-time to StructuralOptimization.

  • adapted ForceAnnealing and its Action accordingly, i.e. they receive the old time step as the current step.
  • TESTFIX: needed to add "--step-world-time 1" to ForceAnnealing regression test, results then remained exactly the same.
File:
1 edited

Legend:

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

    r645bed r5a289c  
    9494      params.DampingFactor.get());
    9595  size_t CurrentStep = WorldTime::getInstance().getTime();
     96  if (CurrentStep == 0) {
     97    ELOG(1, "WorldTime must be at least at step 1 already, use step-world-time if necessary.");
     98    return Action::failure;
     99  }
    96100
    97   // parse forces into current step
     101  // parse forces into last step (assuming we stepped on already)
    98102  if (!params.forcesfile.get().string().empty()) {
    99103    LOG(1, "Parsing forces file.");
    100     if (!optimizer.parseForcesFile(params.forcesfile.get().string().c_str(), CurrentStep))
     104    if (!optimizer.parseForcesFile(params.forcesfile.get().string().c_str(), CurrentStep-1))
    101105      LOG(2, "File " << params.forcesfile.get() << " not found.");
    102106    else
     
    104108  }
    105109
    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 
    125110  // perform optimization step
    126111  LOG(1, "Structural optimization.");
    127   optimizer(CurrentStep, 1, params.UseBondGraph.get());
     112  optimizer(CurrentStep-1, 1, params.UseBondGraph.get());
    128113  STATUS("Successfully optimized structure by one step.");
    129114
Note: See TracChangeset for help on using the changeset viewer.