Changeset efd020 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:
8c6b68
Parents:
12f16c
git-author:
Frederik Heber <frederik.heber@…> (09/11/17 17:03:27)
git-committer:
Frederik Heber <frederik.heber@…> (04/10/18 06:43:12)
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.
Location:
src/Actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/StructuralOptimizationAction.cpp

    r12f16c refd020  
    6969  prototype_actions.addAction(AR.getActionByName(std::string("fragment-automation")).clone());
    7070  prototype_actions.addAction(AR.getActionByName(std::string("analyse-fragment-results")).clone());
     71  prototype_actions.addAction(AR.getActionByName(std::string("step-world-time")).clone());
    7172  prototype_actions.addAction(AR.getActionByName(std::string("force-annealing")).clone());
    7273  prototype_actions.addAction(AR.getActionByName(std::string("output")).clone());
  • src/Actions/MoleculeAction/ForceAnnealingAction.cpp

    r12f16c refd020  
    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.