Changeset 5e17bf for src/Actions


Ignore:
Timestamp:
Jun 20, 2017, 7:58:37 PM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChangeBugEmailaddress, ChemicalSpaceEvaluator, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph_documentation, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_oldresults, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps
Children:
536b13
Parents:
788dce
git-author:
Frederik Heber <heber@…> (03/22/17 16:06:01)
git-committer:
Frederik Heber <frederik.heber@…> (06/20/17 19:58:37)
Message:

Added test in RotateAroundBondAction whether given bond is cyclic.

  • TESTS: also added regression test.
File:
1 edited

Legend:

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

    r788dce r5e17bf  
    4444
    4545#include "Actions/UndoRedoHelpers.hpp"
     46#include "Graph/CyclicStructureAnalysis.hpp"
     47#include "Graph/DepthFirstSearchAnalysis.hpp"
    4648
    4749#include "Atom/atom.hpp"
     
    5759#include "RotateAroundBondAction.def"
    5860#include "Action_impl_pre.hpp"
     61
    5962/** =========== define the function ====================== */
     63static bool IsBondContainedInCycle(const bond::ptr &_bond)
     64{
     65  // get the BackEdgeStack from somewhere
     66  DepthFirstSearchAnalysis DFS;
     67  DFS();
     68  DFS.CyclicBondAnalysis();
     69//  std::deque<bond::ptr> BackEdgeStack = DFS.getBackEdgeStack();
     70//  // then we analyse the cycles and get them
     71//  CyclicStructureAnalysis CycleAnalysis(ExcludeHydrogen); // hydrogens never contained in cycles
     72//  CycleAnalysis(&BackEdgeStack);
     73  return _bond->Cyclic;
     74}
     75
    6076ActionState::ptr MoleculeRotateAroundBondAction::performCall()
    6177{
     
    7490  if (mol != atoms[1]->getMolecule()) {
    7591    STATUS("The two selected atoms must belong to the same molecule.");
     92    return Action::failure;
     93  }
     94  if (IsBondContainedInCycle(atoms[0]->getBond(atoms[1]))) {
     95    STATUS("The given bond is contained in a cycle, cannot rotate!");
    7696    return Action::failure;
    7797  }
Note: See TracChangeset for help on using the changeset viewer.