Index: src/Actions/MoleculeAction/RotateAroundBondAction.cpp
===================================================================
--- src/Actions/MoleculeAction/RotateAroundBondAction.cpp	(revision 9a1e35cf043e51e1d12ecec3a0e8dedf7f0e7ee8)
+++ src/Actions/MoleculeAction/RotateAroundBondAction.cpp	(revision 9eed14556f43d3d76fbfe103498906d6bf32e9f0)
@@ -44,4 +44,6 @@
 
 #include "Actions/UndoRedoHelpers.hpp"
+#include "Graph/CyclicStructureAnalysis.hpp"
+#include "Graph/DepthFirstSearchAnalysis.hpp"
 
 #include "Atom/atom.hpp"
@@ -57,5 +59,19 @@
 #include "RotateAroundBondAction.def"
 #include "Action_impl_pre.hpp"
+
 /** =========== define the function ====================== */
+static bool IsBondContainedInCycle(const bond::ptr &_bond)
+{
+  // get the BackEdgeStack from somewhere
+  DepthFirstSearchAnalysis DFS;
+  DFS();
+  DFS.CyclicBondAnalysis();
+//  std::deque<bond::ptr> BackEdgeStack = DFS.getBackEdgeStack();
+//  // then we analyse the cycles and get them
+//  CyclicStructureAnalysis CycleAnalysis(ExcludeHydrogen); // hydrogens never contained in cycles
+//  CycleAnalysis(&BackEdgeStack);
+  return _bond->Cyclic;
+}
+
 ActionState::ptr MoleculeRotateAroundBondAction::performCall()
 {
@@ -74,4 +90,8 @@
   if (mol != atoms[1]->getMolecule()) {
     STATUS("The two selected atoms must belong to the same molecule.");
+    return Action::failure;
+  }
+  if (IsBondContainedInCycle(atoms[0]->getBond(atoms[1]))) {
+    STATUS("The given bond is contained in a cycle, cannot rotate!");
     return Action::failure;
   }
Index: tests/regression/Molecules/RotateAroundBond/pre/test_cycle.pdb
===================================================================
--- tests/regression/Molecules/RotateAroundBond/pre/test_cycle.pdb	(revision 9eed14556f43d3d76fbfe103498906d6bf32e9f0)
+++ tests/regression/Molecules/RotateAroundBond/pre/test_cycle.pdb	(revision 9eed14556f43d3d76fbfe103498906d6bf32e9f0)
@@ -0,0 +1,38 @@
+REMARK created by molecuilder on Tue Feb 19 10:09:37 2013, time step 0
+ATOM      1 C01 0non 01          1.816  -1.445   0.001  0.00  0.00           C 0
+ATOM      2 C02 0non 01          0.511  -0.691   0.002  0.00  0.00           C 0
+ATOM      3 C03 0non 01          0.511   0.691   0.000  0.00  0.00           C 0
+ATOM      4 C04 0non 01         -0.686  -1.382  -0.002  0.00  0.00           C 0
+ATOM      5 C05 0non 01          1.816   1.445  -0.002  0.00  0.00           C 0
+ATOM      6 C06 0non 01         -0.686   1.382   0.000  0.00  0.00           C 0
+ATOM      7 C07 0non 01         -1.883  -0.691  -0.001  0.00  0.00           C 0
+ATOM      8 C08 0non 01         -1.883   0.691   0.002  0.00  0.00           C 0
+ATOM      9 H01 0non 01          2.132  -1.625   1.029  0.00  0.00           H 0
+ATOM     10 H02 0non 01          1.685  -2.398  -0.511  0.00  0.00           H 0
+ATOM     11 H03 0non 01          2.575  -0.856  -0.514  0.00  0.00           H 0
+ATOM     12 H04 0non 01         -0.686  -2.462  -0.005  0.00  0.00           H 0
+ATOM     13 H05 0non 01          2.130   1.625  -1.030  0.00  0.00           H 0
+ATOM     14 H06 0non 01          1.686   2.398   0.511  0.00  0.00           H 0
+ATOM     15 H07 0non 01          2.576   0.856   0.512  0.00  0.00           H 0
+ATOM     16 H08 0non 01         -0.686   2.462  -0.001  0.00  0.00           H 0
+ATOM     17 H09 0non 01         -2.819  -1.231  -0.005  0.00  0.00           H 0
+ATOM     18 H10 0non 01         -2.819   1.231   0.003  0.00  0.00           H 0
+CONECT    1    2    9   10   11                                                 
+CONECT    2    1    3    4                                                      
+CONECT    3    2    5    6                                                      
+CONECT    4    2    7   12                                                      
+CONECT    5    3   13   14   15                                                 
+CONECT    6    3    8   16                                                      
+CONECT    7    4    8   17                                                      
+CONECT    8    6    7   18                                                      
+CONECT    9    1                                                                
+CONECT   10    1                                                                
+CONECT   11    1                                                                
+CONECT   12    4                                                                
+CONECT   13    5                                                                
+CONECT   14    5                                                                
+CONECT   15    5                                                                
+CONECT   16    6                                                                
+CONECT   17    7                                                                
+CONECT   18    8                                                                
+END
Index: tests/regression/Molecules/RotateAroundBond/testsuite-molecules-rotate-around-bond.at
===================================================================
--- tests/regression/Molecules/RotateAroundBond/testsuite-molecules-rotate-around-bond.at	(revision 9a1e35cf043e51e1d12ecec3a0e8dedf7f0e7ee8)
+++ tests/regression/Molecules/RotateAroundBond/testsuite-molecules-rotate-around-bond.at	(revision 9eed14556f43d3d76fbfe103498906d6bf32e9f0)
@@ -76,2 +76,12 @@
 
 AT_CLEANUP
+
+AT_SETUP([Molecules - Rotate around bond fails for cycles])
+AT_KEYWORDS([molecules rotate-around-bond cycle])
+
+file=test_cycle.pdb
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Molecules/RotateAroundBond/pre/test_cycle.pdb $file], 0)
+AT_CHECK([chmod u+w $file], 0)
+AT_CHECK([../../molecuilder -i $file --select-atom-by-id 1 2 --rotate-around-bond 90.], 5, [stdout], [stderr])
+
+AT_CLEANUP
