diff --git a/CHANGELOG b/CHANGELOG
index 11de4c2e7e1f23520de4dd278d4241fcb400866d..e84d5d8477d5716928a9dc259de629d94fc6a199 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,5 +7,4 @@ Changelog
 
 Release 1.0
 --------------------------------------------------------------------------------
- * initial release of ProMod3
- 
\ No newline at end of file
+ * initial release of ProMod3 for use in productive instances of SMNG
diff --git a/doc/html/_modules/index.html b/doc/html/_modules/index.html
index 84cb5c4efc3e617d1792c89b074bac44855eede0..c1ed878ea483e00eb65138a9f3a4e5dd2f8c5a87 100644
--- a/doc/html/_modules/index.html
+++ b/doc/html/_modules/index.html
@@ -50,9 +50,11 @@
 <li><a href="FRMRotamerGroup.html">FRMRotamerGroup</a></li>
 <li><a href="FragDB.html">FragDB</a></li>
 <li><a href="Fragger.html">Fragger</a></li>
+<li><a href="FraggerMap.html">FraggerMap</a></li>
 <li><a href="FragmentSampler.html">FragmentSampler</a></li>
 <li><a href="Frame.html">Frame</a></li>
 <li><a href="FrameResidue.html">FrameResidue</a></li>
+<li><a href="FullGapExtender.html">FullGapExtender</a></li>
 <li><a href="GapExtender.html">GapExtender</a></li>
 <li><a href="Graph.html">Graph</a></li>
 <li><a href="KIC.html">KIC</a></li>
@@ -68,6 +70,7 @@
 <li><a href="RotamerLib.html">RotamerLib</a></li>
 <li><a href="RotamerLibEntry.html">RotamerLibEntry</a></li>
 <li><a href="ScoringGapExtender.html">ScoringGapExtender</a></li>
+<li><a href="ShiftExtension.html">ShiftExtension</a></li>
 <li><a href="SoftSampler.html">SoftSampler</a></li>
 <li><a href="StructuralGap.html">StructuralGap</a></li>
 <li><a href="StructureDB.html">StructureDB</a></li>
@@ -75,10 +78,12 @@
 <li><a href="promod3.html">promod3</a></li>
 <ul><li><a href="promod3/core/helper.html">promod3.core.helper</a></li>
 <li><a href="promod3/core/pm3argparse.html">promod3.core.pm3argparse</a></li>
+<li><a href="promod3/loop/_fragger.html">promod3.loop._fragger</a></li>
 <li><a href="promod3/loop/_loop.html">promod3.loop._loop</a></li>
 <li><a href="promod3/modelling/_closegaps.html">promod3.modelling._closegaps</a></li>
 <li><a href="promod3/modelling/_modelling.html">promod3.modelling._modelling</a></li>
 <li><a href="promod3/modelling/_pipeline.html">promod3.modelling._pipeline</a></li>
+<li><a href="promod3/modelling/_ring_punches.html">promod3.modelling._ring_punches</a></li>
 <li><a href="promod3/sidechain/_reconstruct_sidechains.html">promod3.sidechain._reconstruct_sidechains</a></li>
 <li><a href="promod3/sidechain/_sidechain.html">promod3.sidechain._sidechain</a></li>
 </ul><li><a href="test_actions.html">test_actions</a></li>
@@ -113,7 +118,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/_modules/promod3.html b/doc/html/_modules/promod3.html
index e54deac726f7a6c98d6369d9e954c3e38b82c24b..70f7c40272d77b1773c94fc9b92397e4b9a8b86e 100644
--- a/doc/html/_modules/promod3.html
+++ b/doc/html/_modules/promod3.html
@@ -38,6 +38,10 @@
           <div class="body" role="main">
             
   <h1>Source code for promod3</h1><div class="highlight"><pre>
+<span class="c"># enable access to loop and modelling via &quot;import promod3&quot;</span>
+<span class="kn">import</span> <span class="nn">promod3.loop</span>
+<span class="kn">import</span> <span class="nn">promod3.modelling</span>
+
 <span class="c"># load compounds library</span>
 <span class="c"># That way we do not need to call our scripts with the OST starter and are more</span>
 <span class="c"># flexible.</span>
@@ -71,6 +75,9 @@
 <span class="k">if</span> <span class="ow">not</span> <span class="n">conop</span><span class="o">.</span><span class="n">GetDefaultLib</span><span class="p">():</span>
     <span class="n">SetCompoundsChemlib</span><span class="p">()</span>
 
+<span class="c"># set version</span>
+<span class="n">__version__</span> <span class="o">=</span> <span class="s">&quot;0.1.0&quot;</span>
+
 <span class="n">__all__</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;SetCompoundsChemlib&#39;</span><span class="p">,)</span>
 
 <span class="c">#  LocalWords:  OST os ost conop io SetCompoundsChemlib CHEMLIB param chemlib</span>
@@ -109,7 +116,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/_modules/promod3/core/helper.html b/doc/html/_modules/promod3/core/helper.html
index 766b65160c547ebd7a519bee683c98c29cf1bbc9..6905c84c7583cc5334720ce8291e6fbe70a4dbe7 100644
--- a/doc/html/_modules/promod3/core/helper.html
+++ b/doc/html/_modules/promod3/core/helper.html
@@ -232,7 +232,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/_modules/promod3/core/pm3argparse.html b/doc/html/_modules/promod3/core/pm3argparse.html
index 1e8bf8e5d716c5bd4a69c500a59953a047438610..db0f4066a29295bb92426ba695d5a4e94e3d2755 100644
--- a/doc/html/_modules/promod3/core/pm3argparse.html
+++ b/doc/html/_modules/promod3/core/pm3argparse.html
@@ -595,7 +595,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/_modules/promod3/loop/_fragger.html b/doc/html/_modules/promod3/loop/_fragger.html
new file mode 100644
index 0000000000000000000000000000000000000000..62ec47cd0bf83314897f85edc1ee4ae067ecb4ae
--- /dev/null
+++ b/doc/html/_modules/promod3/loop/_fragger.html
@@ -0,0 +1,424 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>promod3.loop._fragger &mdash; ProMod3 0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../_static/alabaster.css" type="text/css" />
+    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../',
+        VERSION:     '0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../_static/doctools.js"></script>
+    <link rel="top" title="ProMod3 0 documentation" href="../../../index.html" />
+    <link rel="up" title="promod3" href="../../promod3.html" />
+   
+  
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
+
+  </head>
+  <body role="document">  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body" role="main">
+            
+  <h1>Source code for promod3.loop._fragger</h1><div class="highlight"><pre>
+<span class="sd">&#39;&#39;&#39;Python functionality to generate fraggers.&#39;&#39;&#39;</span>
+
+<span class="c"># internal</span>
+<span class="kn">from</span> <span class="nn">_loop</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="c"># external</span>
+<span class="kn">from</span> <span class="nn">ost.conop</span> <span class="kn">import</span> <span class="n">OneLetterCodeToResidueName</span>
+
+<span class="k">def</span> <span class="nf">_AssembleTorsionSamplers</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">,</span>
+                             <span class="n">torsion_sampler_coil</span><span class="p">,</span>
+                             <span class="n">torsion_sampler_helix</span><span class="p">,</span>
+                             <span class="n">torsion_sampler_extended</span><span class="p">):</span>
+
+    <span class="n">samplers</span> <span class="o">=</span> <span class="p">[</span><span class="n">torsion_sampler_coil</span><span class="p">]</span><span class="o">*</span><span class="nb">len</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">)):</span>
+        <span class="k">if</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">GetPrediction</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;H&#39;</span> <span class="ow">and</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">GetConfidence</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">6</span><span class="p">:</span>
+            <span class="n">samplers</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">torsion_sampler_helix</span>  
+        <span class="k">if</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">GetPrediction</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;E&#39;</span> <span class="ow">and</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">GetConfidence</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">6</span><span class="p">:</span>
+            <span class="n">samplers</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">torsion_sampler_extended</span>
+    <span class="k">return</span> <span class="n">samplers</span>
+
+<span class="k">def</span> <span class="nf">_GenerateFragger</span><span class="p">(</span><span class="n">prof</span><span class="p">,</span><span class="n">psipred_pred</span><span class="p">,</span>
+                     <span class="n">num_fragments</span><span class="p">,</span>
+                     <span class="n">rmsd_thresh</span><span class="p">,</span>
+                     <span class="n">ss_agreement_weight</span><span class="p">,</span>
+                     <span class="n">sequence_profile_weight</span><span class="p">,</span>
+                     <span class="n">structure_profile_weight</span><span class="p">,</span>
+                     <span class="n">torsion_weight</span><span class="p">,</span>
+                     <span class="n">aa_before</span><span class="p">,</span>
+                     <span class="n">aa_after</span><span class="p">,</span>
+                     <span class="n">structure_db</span><span class="p">,</span>
+                     <span class="n">torsion_sampler_coil</span><span class="p">,</span>
+                     <span class="n">torsion_sampler_helix</span><span class="p">,</span>
+                     <span class="n">torsion_sampler_extended</span><span class="p">):</span>
+    
+    <span class="n">torsion_samplers</span> <span class="o">=</span> <span class="n">_AssembleTorsionSamplers</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">,</span>
+                                                <span class="n">torsion_sampler_coil</span><span class="p">,</span>
+                                                <span class="n">torsion_sampler_helix</span><span class="p">,</span>
+                                                <span class="n">torsion_sampler_extended</span><span class="p">)</span>
+
+    <span class="n">fragger</span> <span class="o">=</span> <span class="n">Fragger</span><span class="p">(</span><span class="n">prof</span><span class="o">.</span><span class="n">sequence</span><span class="p">)</span>
+    <span class="n">fragger</span><span class="o">.</span><span class="n">AddSSAgreeParameters</span><span class="p">(</span><span class="n">ss_agreement_weight</span><span class="p">,</span><span class="n">psipred_pred</span><span class="p">)</span>
+    <span class="n">fragger</span><span class="o">.</span><span class="n">AddSequenceProfileParameters</span><span class="p">(</span><span class="n">sequence_profile_weight</span><span class="p">,</span><span class="n">prof</span><span class="p">)</span>
+    <span class="n">fragger</span><span class="o">.</span><span class="n">AddStructureProfileParameters</span><span class="p">(</span><span class="n">structure_profile_weight</span><span class="p">,</span><span class="n">prof</span><span class="p">)</span>
+    <span class="n">fragger</span><span class="o">.</span><span class="n">AddTorsionProbabilityParameters</span><span class="p">(</span><span class="n">torsion_weight</span><span class="p">,</span><span class="n">torsion_samplers</span><span class="p">,</span>
+                                            <span class="n">aa_before</span><span class="p">,</span><span class="n">aa_after</span><span class="p">)</span>
+
+    <span class="n">fragger</span><span class="o">.</span><span class="n">Fill</span><span class="p">(</span><span class="n">structure_db</span><span class="p">,</span><span class="n">rmsd_thresh</span><span class="p">,</span><span class="n">num_fragments</span><span class="p">)</span>
+
+    <span class="k">return</span> <span class="n">fragger</span>
+
+
+<span class="k">def</span> <span class="nf">GenerateFragger</span><span class="p">(</span><span class="n">prof</span><span class="p">,</span> <span class="n">psipred_pred</span><span class="p">,</span> 
+                    <span class="n">num_fragments</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span>
+                    <span class="n">rmsd_thresh</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">,</span> 
+                    <span class="n">ss_agreement_weight</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span> 
+                    <span class="n">sequence_profile_weight</span> <span class="o">=</span> <span class="mf">0.8</span><span class="p">,</span> 
+                    <span class="n">structure_profile_weight</span> <span class="o">=</span> <span class="mf">2.0</span><span class="p">,</span>
+                    <span class="n">torsion_weight</span> <span class="o">=</span> <span class="mf">13.0</span><span class="p">,</span>
+                    <span class="n">aa_before</span> <span class="o">=</span> <span class="s">&quot;ALA&quot;</span><span class="p">,</span>
+                    <span class="n">aa_after</span> <span class="o">=</span> <span class="s">&quot;ALA&quot;</span><span class="p">,</span>
+                    <span class="n">structure_db</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                    <span class="n">torsion_sampler_coil</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                    <span class="n">torsion_sampler_helix</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                    <span class="n">torsion_sampler_extended</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>
+
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">prof</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">):</span>
+        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Length of profile must be consistent with Psipred!&quot;</span><span class="p">)</span>
+
+    <span class="k">if</span> <span class="n">structure_db</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">structure_db</span> <span class="o">=</span> <span class="n">LoadStructureDB</span><span class="p">()</span>
+
+    <span class="k">if</span> <span class="n">torsion_sampler_coil</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">torsion_sampler_coil</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerCoil</span><span class="p">()</span>
+
+    <span class="k">if</span> <span class="n">torsion_sampler_helix</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">torsion_sampler_helix</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerHelical</span><span class="p">()</span>
+
+    <span class="k">if</span> <span class="n">torsion_sampler_extended</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">torsion_sampler_extended</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerExtended</span><span class="p">()</span>
+
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">aa_before</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+        <span class="c">#seems to be a one_letter_code, let&#39;s try our best</span>
+        <span class="n">aa_before</span> <span class="o">=</span> <span class="n">OneLetterCodeToResidueName</span><span class="p">(</span><span class="n">aa_before</span><span class="p">)</span>
+
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">aa_after</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+        <span class="c">#seems to be a one_letter_code, let&#39;s try our best</span>
+        <span class="n">aa_after</span> <span class="o">=</span> <span class="n">OneLetterCodeToResidueName</span><span class="p">(</span><span class="n">aa_after</span><span class="p">)</span>
+
+    <span class="k">return</span> <span class="n">_GenerateFragger</span><span class="p">(</span><span class="n">prof</span><span class="p">,</span> <span class="n">psipred_pred</span><span class="p">,</span> 
+                            <span class="n">num_fragments</span><span class="p">,</span>
+                            <span class="n">rmsd_thresh</span><span class="p">,</span> 
+                            <span class="n">ss_agreement_weight</span><span class="p">,</span> 
+                            <span class="n">sequence_profile_weight</span><span class="p">,</span> 
+                            <span class="n">structure_profile_weight</span><span class="p">,</span>
+                            <span class="n">torsion_weight</span><span class="p">,</span>
+                            <span class="n">aa_before</span><span class="p">,</span>
+                            <span class="n">aa_after</span><span class="p">,</span>
+                            <span class="n">structure_db</span><span class="p">,</span>
+                            <span class="n">torsion_sampler_coil</span><span class="p">,</span>
+                            <span class="n">torsion_sampler_helix</span><span class="p">,</span>
+                            <span class="n">torsion_sampler_extended</span><span class="p">)</span>
+
+
+<span class="k">def</span> <span class="nf">GenerateFraggerList</span><span class="p">(</span><span class="n">prof</span><span class="p">,</span> <span class="n">psipred_pred</span><span class="p">,</span>
+                        <span class="n">fragment_length</span> <span class="o">=</span> <span class="mi">9</span><span class="p">,</span>
+                        <span class="n">fragments_per_position</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span>
+                        <span class="n">rmsd_thresh</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">,</span> 
+                        <span class="n">ss_agreement_weight</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span> 
+                        <span class="n">sequence_profile_weight</span> <span class="o">=</span> <span class="mf">0.8</span><span class="p">,</span> 
+                        <span class="n">structure_profile_weight</span> <span class="o">=</span> <span class="mf">2.0</span><span class="p">,</span>
+                        <span class="n">torsion_weight</span> <span class="o">=</span> <span class="mf">13.0</span><span class="p">,</span>
+                        <span class="n">structure_db</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                        <span class="n">torsion_sampler_coil</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                        <span class="n">torsion_sampler_helix</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                        <span class="n">torsion_sampler_extended</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>
+
+
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">prof</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">):</span>
+        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Length of profile must be consistent with Psipred!&quot;</span><span class="p">)</span>
+
+    <span class="k">if</span> <span class="n">structure_db</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">structure_db</span> <span class="o">=</span> <span class="n">LoadStructureDB</span><span class="p">()</span>
+
+    <span class="k">if</span> <span class="n">torsion_sampler_coil</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">torsion_sampler_coil</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerCoil</span><span class="p">()</span>
+
+    <span class="k">if</span> <span class="n">torsion_sampler_helix</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">torsion_sampler_helix</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerHelical</span><span class="p">()</span>
+
+    <span class="k">if</span> <span class="n">torsion_sampler_extended</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">torsion_sampler_extended</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerExtended</span><span class="p">()</span>
+
+    <span class="n">sequence</span> <span class="o">=</span> <span class="n">prof</span><span class="o">.</span><span class="n">sequence</span>
+    <span class="n">num_positions</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span> <span class="o">-</span> <span class="n">fragment_length</span> <span class="o">+</span> <span class="mi">1</span>
+
+    <span class="n">fragger_list</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+
+    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">num_positions</span><span class="p">):</span>
+
+        <span class="n">aa_before</span> <span class="o">=</span> <span class="s">&quot;ALA&quot;</span>
+        <span class="n">aa_after</span> <span class="o">=</span> <span class="s">&quot;ALA&quot;</span>
+
+        <span class="k">if</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">aa_before</span> <span class="o">=</span> <span class="n">OneLetterCodeToResidueName</span><span class="p">(</span><span class="n">sequence</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
+
+        <span class="k">if</span> <span class="n">i</span> <span class="o">+</span> <span class="n">fragment_length</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">sequence</span><span class="p">):</span>
+            <span class="n">aa_after</span> <span class="o">=</span> <span class="n">OneLetterCodeToResidueName</span><span class="p">(</span><span class="n">sequence</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="n">fragment_length</span><span class="p">])</span>
+
+        <span class="n">sub_prof</span> <span class="o">=</span> <span class="n">prof</span><span class="o">.</span><span class="n">Extract</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">i</span><span class="o">+</span><span class="n">fragment_length</span><span class="p">)</span>
+        <span class="n">sub_psipred_pred</span> <span class="o">=</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">Extract</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">i</span><span class="o">+</span><span class="n">fragment_length</span><span class="p">)</span>
+
+        <span class="n">fragger</span> <span class="o">=</span> <span class="n">_GenerateFragger</span><span class="p">(</span><span class="n">sub_prof</span><span class="p">,</span> <span class="n">sub_psipred_pred</span><span class="p">,</span> 
+                                   <span class="n">fragments_per_position</span><span class="p">,</span>
+                                   <span class="n">rmsd_thresh</span><span class="p">,</span> 
+                                   <span class="n">ss_agreement_weight</span><span class="p">,</span> 
+                                   <span class="n">sequence_profile_weight</span><span class="p">,</span> 
+                                   <span class="n">structure_profile_weight</span><span class="p">,</span>
+                                   <span class="n">torsion_weight</span><span class="p">,</span>
+                                   <span class="n">aa_before</span><span class="p">,</span>
+                                   <span class="n">aa_after</span><span class="p">,</span>
+                                   <span class="n">structure_db</span><span class="p">,</span>
+                                   <span class="n">torsion_sampler_coil</span><span class="p">,</span>
+                                   <span class="n">torsion_sampler_helix</span><span class="p">,</span>
+                                   <span class="n">torsion_sampler_extended</span><span class="p">)</span>
+
+        <span class="n">fragger_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fragger</span><span class="p">)</span>
+
+    <span class="k">return</span> <span class="n">fragger_list</span>
+
+<div class="viewcode-block" id="FraggerHandle"><a class="viewcode-back" href="../../../loop/structure_db.html#promod3.loop.FraggerHandle">[docs]</a><span class="k">class</span> <span class="nc">FraggerHandle</span><span class="p">:</span>
+    <span class="sd">&#39;&#39;&#39;Handler for Fragger objects linked to a specific chain.</span>
+
+<span class="sd">    Fragments are chosen by a combined score of SSAgree, TorsionProbability,</span>
+<span class="sd">    SequenceProfile and StructureProfile (see :class:`Fragger` for details).</span>
+
+<span class="sd">    :param prof: Sequence profile for this chain.</span>
+<span class="sd">    :type prof:  :class:`ost.seq.ProfileHandle`</span>
+<span class="sd">    :param psipred_pred: Psipred prediction for this chain.</span>
+<span class="sd">    :type psipred_pred:  :class:`ost.seq.PsipredPrediction`</span>
+<span class="sd">    :param fragment_length: Length (num. residues) of fragments to be extracted.</span>
+<span class="sd">    :type fragment_length:  :class:`int`</span>
+<span class="sd">    :param fragments_per_position: Number of fragments to be extracted at each</span>
+<span class="sd">                                   position.</span>
+<span class="sd">    :type fragments_per_position:  :class:`int`</span>
+<span class="sd">    :param rmsd_thresh: To guarantee structural diversity, no pair of fragments</span>
+<span class="sd">                        at a given position will have RMSD below `rmsd_thresh`.</span>
+<span class="sd">    :type rmsd_thresh:  :class:`float`</span>
+<span class="sd">    :param ss_agreement_weight: Linear weight for SSAgree score.</span>
+<span class="sd">    :type ss_agreement_weight:  :class:`float`</span>
+<span class="sd">    :param sequence_profile_weight: Linear weight for SequenceProfile score.</span>
+<span class="sd">    :type sequence_profile_weight:  :class:`float`</span>
+<span class="sd">    :param structure_profile_weight: Linear weight for StructureProfile score.</span>
+<span class="sd">    :type structure_profile_weight:  :class:`float`</span>
+<span class="sd">    :param torsion_weight: Linear weight for TorsionProbability score.</span>
+<span class="sd">    :type torsion_weight:  :class:`float`</span>
+<span class="sd">    :param structure_db: Source of structural data</span>
+<span class="sd">    :type structure_db:  :class:`StructureDB`</span>
+<span class="sd">    :param torsion_sampler_coil: Torsion sampler for coil residues.</span>
+<span class="sd">    :type torsion_sampler_coil:  :class:`TorsionSampler`</span>
+<span class="sd">    :param torsion_sampler_helix: Torsion sampler for helical residues.</span>
+<span class="sd">    :type torsion_sampler_helix:  :class:`TorsionSampler`</span>
+<span class="sd">    :param torsion_sampler_extended: Torsion sampler for extended residues.</span>
+<span class="sd">    :type torsion_sampler_extended:  :class:`TorsionSampler`</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prof</span><span class="p">,</span> <span class="n">psipred_pred</span><span class="p">,</span>
+                 <span class="n">fragment_length</span> <span class="o">=</span> <span class="mi">9</span><span class="p">,</span>
+                 <span class="n">fragments_per_position</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span>
+                 <span class="n">rmsd_thresh</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">,</span> 
+                 <span class="n">ss_agreement_weight</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span> 
+                 <span class="n">sequence_profile_weight</span> <span class="o">=</span> <span class="mf">0.8</span><span class="p">,</span> 
+                 <span class="n">structure_profile_weight</span> <span class="o">=</span> <span class="mf">2.0</span><span class="p">,</span>
+                 <span class="n">torsion_weight</span> <span class="o">=</span> <span class="mf">13.0</span><span class="p">,</span>
+                 <span class="n">structure_db</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">torsion_sampler_coil</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">torsion_sampler_helix</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">torsion_sampler_extended</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>
+        <span class="c"># check</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">prof</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">):</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Length of profile must be consistent with Psipred!&quot;</span><span class="p">)</span>
+        <span class="c"># keep all objects</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">prof</span> <span class="o">=</span> <span class="n">prof</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">psipred_pred</span> <span class="o">=</span> <span class="n">psipred_pred</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fragment_length</span> <span class="o">=</span> <span class="n">fragment_length</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fragments_per_position</span> <span class="o">=</span> <span class="n">fragments_per_position</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rmsd_thresh</span> <span class="o">=</span> <span class="n">rmsd_thresh</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">ss_agreement_weight</span> <span class="o">=</span> <span class="n">ss_agreement_weight</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sequence_profile_weight</span> <span class="o">=</span> <span class="n">sequence_profile_weight</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">structure_profile_weight</span> <span class="o">=</span> <span class="n">structure_profile_weight</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">torsion_weight</span> <span class="o">=</span> <span class="n">torsion_weight</span>
+        <span class="k">if</span> <span class="n">structure_db</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structure_db</span> <span class="o">=</span> <span class="n">LoadStructureDB</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structure_db</span> <span class="o">=</span> <span class="n">structure_db</span>
+        <span class="k">if</span> <span class="n">torsion_sampler_coil</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_coil</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerCoil</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_coil</span> <span class="o">=</span> <span class="n">torsion_sampler_coil</span>
+        <span class="k">if</span> <span class="n">torsion_sampler_helix</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_helix</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerHelical</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_helix</span> <span class="o">=</span> <span class="n">torsion_sampler_helix</span>
+        <span class="k">if</span> <span class="n">torsion_sampler_extended</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_extended</span> <span class="o">=</span> <span class="n">LoadTorsionSamplerExtended</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_extended</span> <span class="o">=</span> <span class="n">torsion_sampler_extended</span>
+        <span class="c"># extract stuff</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sequence</span> <span class="o">=</span> <span class="n">prof</span><span class="o">.</span><span class="n">sequence</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">samplers</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_coil</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">psipred_pred</span><span class="p">)):</span>
+            <span class="k">if</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">GetPrediction</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;H&#39;</span> \
+               <span class="ow">and</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">GetConfidence</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">6</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">samplers</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_helix</span>  
+            <span class="k">if</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">GetPrediction</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;E&#39;</span> \
+               <span class="ow">and</span> <span class="n">psipred_pred</span><span class="o">.</span><span class="n">GetConfidence</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">6</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">samplers</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">torsion_sampler_extended</span>
+        <span class="c"># prepare map</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fragger_map</span> <span class="o">=</span> <span class="n">FraggerMap</span><span class="p">()</span>
+
+<div class="viewcode-block" id="FraggerHandle.Get"><a class="viewcode-back" href="../../../loop/structure_db.html#promod3.loop.FraggerHandle.Get">[docs]</a>    <span class="k">def</span> <span class="nf">Get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">frag_pos</span><span class="p">):</span>
+        <span class="sd">&#39;&#39;&#39;Get fragger for sequence at index frag_pos..frag_pos+frag_length-1.</span>
+
+<span class="sd">        :param frag_pos: Start-index (note that sequence-indexing starts at 0)</span>
+<span class="sd">        :type frag_pos:  :class`int`</span>
+<span class="sd">        :return: A :class:`Fragger` object.</span>
+<span class="sd">        :raises: :exc:`~exceptions.ValueError` if index out-of-bounds.</span>
+<span class="sd">        &#39;&#39;&#39;</span>
+        <span class="c"># this is for ranges (i.e. last touched index is end_pos-1)</span>
+        <span class="n">end_pos</span> <span class="o">=</span> <span class="n">frag_pos</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">fragment_length</span>
+        <span class="c"># check</span>
+        <span class="k">if</span> <span class="n">frag_pos</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">end_pos</span> <span class="o">&gt;</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sequence</span><span class="p">):</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Invalid fragment position &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">frag_pos</span><span class="p">))</span>
+        <span class="c"># get</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">fragger_map</span><span class="o">.</span><span class="n">Contains</span><span class="p">(</span><span class="n">frag_pos</span><span class="p">):</span>
+            <span class="c"># get aa_before</span>
+            <span class="k">if</span> <span class="n">frag_pos</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">olc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sequence</span><span class="p">[</span><span class="n">frag_pos</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">olc</span> <span class="o">=</span> <span class="s">&#39;A&#39;</span>
+            <span class="n">aa_before</span> <span class="o">=</span> <span class="n">OneLetterCodeToResidueName</span><span class="p">(</span><span class="n">olc</span><span class="p">)</span>
+            <span class="c"># get aa_after</span>
+            <span class="k">if</span> <span class="n">end_pos</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sequence</span><span class="p">):</span>
+                <span class="n">olc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sequence</span><span class="p">[</span><span class="n">end_pos</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">olc</span> <span class="o">=</span> <span class="s">&#39;A&#39;</span>
+            <span class="n">aa_after</span> <span class="o">=</span> <span class="n">OneLetterCodeToResidueName</span><span class="p">(</span><span class="n">olc</span><span class="p">)</span>
+            <span class="c"># get subsets of profiles, psipred and samplers</span>
+            <span class="n">sub_prof</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prof</span><span class="o">.</span><span class="n">Extract</span><span class="p">(</span><span class="n">frag_pos</span><span class="p">,</span> <span class="n">end_pos</span><span class="p">)</span>
+            <span class="n">sub_pp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">psipred_pred</span><span class="o">.</span><span class="n">Extract</span><span class="p">(</span><span class="n">frag_pos</span><span class="p">,</span> <span class="n">end_pos</span><span class="p">)</span>
+            <span class="n">sub_ts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">samplers</span><span class="p">[</span><span class="n">frag_pos</span><span class="p">:</span><span class="n">end_pos</span><span class="p">]</span>
+            <span class="c"># get fragger</span>
+            <span class="n">fragger</span> <span class="o">=</span> <span class="n">Fragger</span><span class="p">(</span><span class="n">sub_prof</span><span class="o">.</span><span class="n">sequence</span><span class="p">)</span>
+            <span class="n">fragger</span><span class="o">.</span><span class="n">AddSSAgreeParameters</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ss_agreement_weight</span><span class="p">,</span> <span class="n">sub_pp</span><span class="p">)</span>
+            <span class="n">fragger</span><span class="o">.</span><span class="n">AddSequenceProfileParameters</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sequence_profile_weight</span><span class="p">,</span>
+                                                 <span class="n">sub_prof</span><span class="p">)</span>
+            <span class="n">fragger</span><span class="o">.</span><span class="n">AddStructureProfileParameters</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_profile_weight</span><span class="p">,</span>
+                                                  <span class="n">sub_prof</span><span class="p">)</span>
+            <span class="n">fragger</span><span class="o">.</span><span class="n">AddTorsionProbabilityParameters</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">torsion_weight</span><span class="p">,</span> <span class="n">sub_ts</span><span class="p">,</span>
+                                                    <span class="n">aa_before</span><span class="p">,</span> <span class="n">aa_after</span><span class="p">)</span>
+            <span class="n">fragger</span><span class="o">.</span><span class="n">Fill</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure_db</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">rmsd_thresh</span><span class="p">,</span>
+                         <span class="bp">self</span><span class="o">.</span><span class="n">fragments_per_position</span><span class="p">)</span>
+            <span class="c"># keep cached</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fragger_map</span><span class="p">[</span><span class="n">frag_pos</span><span class="p">]</span> <span class="o">=</span> <span class="n">fragger</span>
+        <span class="c"># get it back</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">fragger_map</span><span class="p">[</span><span class="n">frag_pos</span><span class="p">]</span>
+</div>
+<div class="viewcode-block" id="FraggerHandle.GetList"><a class="viewcode-back" href="../../../loop/structure_db.html#promod3.loop.FraggerHandle.GetList">[docs]</a>    <span class="k">def</span> <span class="nf">GetList</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos_start</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">pos_end</span><span class="o">=-</span><span class="mi">1</span><span class="p">):</span>
+        <span class="sd">&#39;&#39;&#39;Get List of fragments covering sequence indices pos_start..pos_end.</span>
+
+<span class="sd">        This will return an empty list if range is smaller than fragment_length.</span>
+
+<span class="sd">        :param pos_start: Start-index (note that sequence-indexing starts at 0)</span>
+<span class="sd">        :type pos_start:  :class`int`</span>
+<span class="sd">        :param pos_end: End-index or -1 if it should go to the sequence-end.</span>
+<span class="sd">        :type pos_end:  :class`int`</span>
+<span class="sd">        :return: A :class:`list` of :class:`Fragger` objects.</span>
+<span class="sd">        :raises: :exc:`~exceptions.ValueError` if indices out-of-bounds.</span>
+<span class="sd">        &#39;&#39;&#39;</span>
+        <span class="k">if</span> <span class="n">pos_end</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">pos_end</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sequence</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>
+        <span class="n">fragger_list</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">frag_pos</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">pos_start</span><span class="p">,</span> <span class="n">pos_end</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">fragment_length</span> <span class="o">+</span> <span class="mi">2</span><span class="p">):</span>
+            <span class="n">fragger_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Get</span><span class="p">(</span><span class="n">frag_pos</span><span class="p">))</span>
+        <span class="k">return</span> <span class="n">fragger_list</span>
+</div>
+<div class="viewcode-block" id="FraggerHandle.SaveCached"><a class="viewcode-back" href="../../../loop/structure_db.html#promod3.loop.FraggerHandle.SaveCached">[docs]</a>    <span class="k">def</span> <span class="nf">SaveCached</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span>
+        <span class="sd">&#39;&#39;&#39;Save cached fraggers.&#39;&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fragger_map</span><span class="o">.</span><span class="n">Save</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="FraggerHandle.LoadCached"><a class="viewcode-back" href="../../../loop/structure_db.html#promod3.loop.FraggerHandle.LoadCached">[docs]</a>    <span class="k">def</span> <span class="nf">LoadCached</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span>
+        <span class="sd">&#39;&#39;&#39;Load fragger objects stored with :meth:`SaveCached`.</span>
+<span class="sd">        Note that here we require that the same structure db is set as was</span>
+<span class="sd">        used when `filename` was saved.&#39;&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fragger_map</span> <span class="o">=</span> <span class="n">FraggerMap</span><span class="o">.</span><span class="n">Load</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure_db</span><span class="p">)</span>
+
+<span class="c"># these methods will be exported into module</span></div></div>
+<span class="n">__all__</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;GenerateFragger&#39;</span><span class="p">,</span> <span class="s">&#39;GenerateFraggerList&#39;</span><span class="p">,</span> <span class="s">&#39;FraggerHandle&#39;</span><span class="p">,)</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
+        <div class="sphinxsidebarwrapper"><div class="relations">
+<h3>Related Topics</h3>
+<ul>
+  <li><a href="../../../index.html">Documentation overview</a><ul>
+  <li><a href="../../index.html">Module code</a><ul>
+  <li><a href="../../promod3.html">promod3</a><ul>
+  </ul></li>
+  </ul></li>
+  </ul></li>
+</ul>
+</div>
+<div id="searchbox" style="display: none" role="search">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="footer">
+      &copy;2016, Bienchen.
+      
+      |
+      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>
+      
+    </div>
+
+    
+
+    
+  </body>
+</html>
\ No newline at end of file
diff --git a/doc/html/_modules/promod3/modelling/_closegaps.html b/doc/html/_modules/promod3/modelling/_closegaps.html
index 77cf51dc9decd7720663d5d3f95d3fe9aebea51b..8485d69972232aee9e94e6d08302a42a48a96db1 100644
--- a/doc/html/_modules/promod3/modelling/_closegaps.html
+++ b/doc/html/_modules/promod3/modelling/_closegaps.html
@@ -43,12 +43,230 @@
 <span class="sd">as argument.</span>
 <span class="sd">&#39;&#39;&#39;</span>
 
+<span class="c"># internal</span>
+<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span><span class="p">,</span> <span class="n">sidechain</span>
+<span class="kn">from</span> <span class="nn">_modelling</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="kn">from</span> <span class="nn">_ring_punches</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="c"># external</span>
 <span class="kn">import</span> <span class="nn">ost</span>
-<span class="c">#pylint: disable=no-name-in-module</span>
-<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">_modelling</span> <span class="k">as</span> <span class="n">modelling</span>
-<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
 <span class="kn">import</span> <span class="nn">sys</span>
 
+<span class="c">###############################################################################</span>
+<span class="c"># helper functions</span>
+<span class="k">def</span> <span class="nf">_GetGapExtender</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">,</span> <span class="n">use_scoring_extender</span><span class="p">,</span>
+                    <span class="n">use_full_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">max_length</span><span class="o">=-</span><span class="mi">1</span><span class="p">):</span>
+    <span class="c"># return appropriate gap extender</span>
+    <span class="n">actual_chain_idx</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
+    <span class="k">if</span> <span class="n">use_scoring_extender</span><span class="p">:</span>
+        <span class="c"># get extender_penalties (note: changes as gaps filled)</span>
+        <span class="n">extender_penalties</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.0</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">])</span>
+        <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span><span class="o">.</span><span class="n">residues</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">GetSecStructure</span><span class="p">()</span><span class="o">.</span><span class="n">IsHelical</span><span class="p">()</span> <span class="ow">or</span> \
+               <span class="n">r</span><span class="o">.</span><span class="n">GetSecStructure</span><span class="p">()</span><span class="o">.</span><span class="n">IsExtended</span><span class="p">():</span>
+                <span class="n">num</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+                <span class="n">extender_penalties</span><span class="p">[</span><span class="n">num</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
+        <span class="c"># setup scoring extender</span>
+        <span class="k">if</span> <span class="n">use_full_extender</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">ScoringGapExtender</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">,</span>
+                                      <span class="n">extender_penalties</span><span class="p">,</span>
+                                      <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">],</span>
+                                      <span class="n">max_length</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">ScoringGapExtender</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">,</span>
+                                      <span class="n">extender_penalties</span><span class="p">,</span>
+                                      <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">])</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">use_full_extender</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">FullGapExtender</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">,</span>
+                                   <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">],</span>
+                                   <span class="n">max_length</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">GapExtender</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">,</span>
+                               <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">])</span>
+
+<span class="k">def</span> <span class="nf">_GetWeights</span><span class="p">():</span>
+    <span class="c"># weights optimized by Niklaus Johner</span>
+    <span class="n">weights</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
+    <span class="n">weights</span><span class="p">[</span><span class="s">&quot;hbond&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>
+    <span class="n">weights</span><span class="p">[</span><span class="s">&quot;clash&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.08880086</span>
+    <span class="n">weights</span><span class="p">[</span><span class="s">&quot;torsion&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.69712072</span>
+    <span class="n">weights</span><span class="p">[</span><span class="s">&quot;reduced&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">2.13535565</span>
+    <span class="n">weights</span><span class="p">[</span><span class="s">&quot;cbeta&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">3.59177335</span>
+    <span class="n">weights</span><span class="p">[</span><span class="s">&quot;cb_packing&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.17280667</span>
+    <span class="k">return</span> <span class="n">weights</span>
+
+<span class="k">def</span> <span class="nf">_CloseLoopFrame</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">,</span> <span class="n">actual_candidates</span><span class="p">,</span>
+                    <span class="n">actual_extended_gaps</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Rank candidates with &quot;frame-approach&quot;.</span>
+<span class="sd">    All found candidates are extended prior to scoring so they match in size.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="c"># get chain for gap</span>
+    <span class="n">actual_chain_idx</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
+    <span class="n">actual_chain</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>
+    <span class="c"># get min_res_num, max_after_resnum</span>
+    <span class="n">min_before_resnum</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">maxint</span>
+    <span class="n">max_after_resnum</span> <span class="o">=</span> <span class="o">-</span><span class="n">sys</span><span class="o">.</span><span class="n">maxint</span><span class="o">-</span><span class="mi">1</span>
+    <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">actual_extended_gaps</span><span class="p">:</span>
+        <span class="n">min_before_resnum</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span>
+                                <span class="n">g</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">())</span>
+        <span class="n">max_after_resnum</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">max_after_resnum</span><span class="p">,</span>
+                               <span class="n">g</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">())</span>
+    
+    <span class="c"># all loop candidates will be scored along the full max. extension ever</span>
+    <span class="c"># reached in the search before, so we build an overall frame, where we</span>
+    <span class="c"># insert the loops</span>
+    <span class="n">frame_seq</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>\
+                <span class="p">[</span><span class="n">min_before_resnum</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="n">max_after_resnum</span><span class="p">]</span>
+    <span class="n">frame_backbone_list</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)</span>
+    <span class="n">actual_res_num</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">mol</span><span class="o">.</span><span class="n">ResNum</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)):</span>
+        <span class="n">actual_res</span> <span class="o">=</span> <span class="n">actual_chain</span><span class="o">.</span><span class="n">FindResidue</span><span class="p">(</span><span class="n">actual_res_num</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">actual_res</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
+            <span class="n">frame_backbone</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">Backbone</span><span class="p">(</span><span class="n">actual_res</span><span class="p">,</span> <span class="n">frame_seq</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+            <span class="n">frame_backbone_list</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">frame_backbone</span>
+        <span class="n">actual_res_num</span> <span class="o">+=</span> <span class="mi">1</span>
+
+    <span class="n">final_loop_candidates</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoopCandidates</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)</span>
+
+    <span class="c"># prepare loop candidates for scoring</span>
+    <span class="n">back_mapper</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+    <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">loop_candidates</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">actual_candidates</span><span class="p">):</span>
+        <span class="n">start_index</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>\
+                      <span class="o">-</span> <span class="n">min_before_resnum</span>
+        <span class="k">for</span> <span class="n">j</span><span class="p">,</span> <span class="n">loop_candidate</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">loop_candidates</span><span class="p">):</span>
+            <span class="n">actual_frame_backbone_list</span> <span class="o">=</span> <span class="n">frame_backbone_list</span>
+            <span class="n">actual_frame_backbone_list</span><span class="o">.</span><span class="n">ReplaceFragment</span><span class="p">(</span>
+                <span class="n">loop_candidate</span><span class="o">.</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">start_index</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
+            <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">actual_frame_backbone_list</span><span class="p">)</span>
+            <span class="n">back_mapper</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span>
+
+    <span class="c"># score them</span>
+    <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">AttachScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">)</span>
+    <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateCombinedScores</span><span class="p">(</span><span class="n">_GetWeights</span><span class="p">(),</span>
+                                                  <span class="n">min_before_resnum</span><span class="p">,</span>
+                                                  <span class="n">actual_chain_idx</span><span class="p">)</span>
+
+    <span class="c"># compare scores</span>
+    <span class="n">min_score</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">)</span>
+    <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
+    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">)):</span>
+        <span class="n">score</span> <span class="o">=</span> <span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">combined_score</span>
+        <span class="k">if</span> <span class="n">score</span> <span class="o">&lt;</span> <span class="n">min_score</span><span class="p">:</span>
+            <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="n">i</span>
+            <span class="n">min_score</span> <span class="o">=</span> <span class="n">score</span>
+
+    <span class="n">ost</span><span class="o">.</span><span class="n">LogVerbose</span><span class="p">(</span><span class="s">&quot;Gap </span><span class="si">%s</span><span class="s"> - </span><span class="si">%d</span><span class="s"> candidates, best (min) score </span><span class="si">%g</span><span class="s">&quot;</span> <span class="o">%</span>
+                   <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">),</span> <span class="n">min_score</span><span class="p">))</span>
+
+    <span class="c"># finally resolve loop</span>
+    <span class="k">if</span> <span class="n">optimal_candidate</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+        <span class="n">idx_a</span> <span class="o">=</span> <span class="n">back_mapper</span><span class="p">[</span><span class="n">optimal_candidate</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">idx_b</span> <span class="o">=</span> <span class="n">back_mapper</span><span class="p">[</span><span class="n">optimal_candidate</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
+        <span class="c"># update model</span>
+        <span class="n">start_resnum</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">]</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span>
+        <span class="n">bb_list</span> <span class="o">=</span> <span class="n">actual_candidates</span><span class="p">[</span><span class="n">idx_a</span><span class="p">][</span><span class="n">idx_b</span><span class="p">]</span><span class="o">.</span><span class="n">bb_list</span>
+        <span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">],</span> <span class="n">start_resnum</span><span class="p">)</span>
+        <span class="c"># update scorer</span>
+        <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">start_resnum</span><span class="p">,</span> <span class="n">actual_chain_idx</span><span class="p">)</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Resolved </span><span class="si">%s</span><span class="s"> by filling </span><span class="si">%s</span><span class="s"> (</span><span class="si">%d</span><span class="s"> candidates)&quot;</span> <span class="o">%</span> \
+                    <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span>
+                     <span class="nb">str</span><span class="p">(</span><span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">]),</span>
+                     <span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">)))</span>
+        <span class="c"># will return -1 if last gap removed</span>
+        <span class="k">return</span> <span class="n">ClearGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">])</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed at loop insertion (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">))</span>
+        <span class="k">return</span> <span class="o">-</span><span class="mi">2</span>
+
+
+<span class="k">def</span> <span class="nf">_CloseLoopBare</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">,</span> <span class="n">actual_candidates</span><span class="p">,</span>
+                   <span class="n">actual_extended_gaps</span><span class="p">,</span> <span class="n">penalize_length</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Rank candidates directly.</span>
+<span class="sd">    All candidates are scored directly and optionally penalized for gap length.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="c"># get chain for gap</span>
+    <span class="n">actual_chain_idx</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
+    <span class="n">actual_chain</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>
+    
+    <span class="c"># score loops as they are</span>
+    <span class="n">weights</span> <span class="o">=</span> <span class="n">_GetWeights</span><span class="p">()</span>
+    <span class="n">min_score</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">)</span>
+    <span class="n">optimal_gap</span> <span class="o">=</span> <span class="bp">None</span>
+    <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="bp">None</span>
+    <span class="n">n_candidates</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">loop_candidates</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">actual_candidates</span><span class="p">):</span>
+        <span class="n">n_candidates</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="n">loop_candidates</span><span class="p">)</span>
+        <span class="c"># score them</span>
+        <span class="n">before_resnum</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+        <span class="n">loop_candidates</span><span class="o">.</span><span class="n">AttachScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">)</span>
+        <span class="n">loop_candidates</span><span class="o">.</span><span class="n">CalculateCombinedScores</span><span class="p">(</span><span class="n">weights</span><span class="p">,</span>
+                                                <span class="n">before_resnum</span><span class="p">,</span>
+                                                <span class="n">actual_chain_idx</span><span class="p">)</span>
+        <span class="c"># any good ones?</span>
+        <span class="n">gap_length</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">length</span>
+        <span class="k">for</span> <span class="n">loop_candidate</span> <span class="ow">in</span> <span class="n">loop_candidates</span><span class="p">:</span>
+            <span class="c"># penalized by gap length?</span>
+            <span class="k">if</span> <span class="n">penalize_length</span><span class="p">:</span>
+                <span class="n">score</span> <span class="o">=</span> <span class="n">loop_candidate</span><span class="o">.</span><span class="n">combined_score</span> <span class="o">*</span> <span class="n">gap_length</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">score</span> <span class="o">=</span> <span class="n">loop_candidate</span><span class="o">.</span><span class="n">combined_score</span>
+            <span class="k">if</span> <span class="n">score</span> <span class="o">&lt;</span> <span class="n">min_score</span><span class="p">:</span>
+                <span class="n">optimal_gap</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
+                <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="n">loop_candidate</span>
+                <span class="n">min_score</span> <span class="o">=</span> <span class="n">score</span>
+
+    <span class="n">ost</span><span class="o">.</span><span class="n">LogVerbose</span><span class="p">(</span><span class="s">&quot;Gap </span><span class="si">%s</span><span class="s"> - </span><span class="si">%d</span><span class="s"> candidates, best (min) score </span><span class="si">%g</span><span class="s">&quot;</span> <span class="o">%</span>
+                   <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span> <span class="n">n_candidates</span><span class="p">,</span> <span class="n">min_score</span><span class="p">))</span>
+
+    <span class="c"># finally resolve loop</span>
+    <span class="k">if</span> <span class="n">optimal_candidate</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="c"># update model</span>
+        <span class="n">start_resnum</span> <span class="o">=</span> <span class="n">optimal_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span>
+        <span class="n">bb_list</span> <span class="o">=</span> <span class="n">optimal_candidate</span><span class="o">.</span><span class="n">bb_list</span>
+        <span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">],</span> <span class="n">start_resnum</span><span class="p">)</span>
+        <span class="c"># update scorer</span>
+        <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">start_resnum</span><span class="p">,</span> <span class="n">actual_chain_idx</span><span class="p">)</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Resolved </span><span class="si">%s</span><span class="s"> by filling </span><span class="si">%s</span><span class="s"> (</span><span class="si">%d</span><span class="s"> candidates)&quot;</span> <span class="o">%</span> \
+                    <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">optimal_gap</span><span class="p">),</span> <span class="n">n_candidates</span><span class="p">))</span>
+        <span class="c"># will return -1 if last gap removed</span>
+        <span class="k">return</span> <span class="n">ClearGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">optimal_gap</span><span class="p">)</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed at loop insertion (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">))</span>
+        <span class="k">return</span> <span class="o">-</span><span class="mi">2</span>
+
+<span class="k">def</span> <span class="nf">_CloseLoop</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">,</span> <span class="n">actual_candidates</span><span class="p">,</span>
+               <span class="n">actual_extended_gaps</span><span class="p">,</span> <span class="n">variant</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Choose best scoring loop candidate and close loop in mhandle.</span>
+<span class="sd">    :param scorer: scorer dedicated to this model</span>
+<span class="sd">    :param gap_orig: Gap we actually wanted to close</span>
+<span class="sd">    :param actual_candidates: List of LoopCandidates</span>
+<span class="sd">    :param actual_extended_gaps: List of gaps (same size as actual_candidates)</span>
+<span class="sd">    :param variant: 0 = _CloseLoopFrame</span>
+<span class="sd">                    1 = _CloseLoopBare(penalize_length=False)</span>
+<span class="sd">                    2 = _CloseLoopBare(penalize_length=True)</span>
+<span class="sd">    :return: gap-index as returned by ClearGaps or -2 if fail.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="c"># check consistency</span>
+    <span class="n">N</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">actual_extended_gaps</span><span class="p">)</span>
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">actual_candidates</span><span class="p">)</span> <span class="o">!=</span> <span class="n">N</span><span class="p">:</span>
+        <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&quot;Inconsistent list-lengths in _CloseLoop &quot;</span> \
+                           <span class="s">&quot;(</span><span class="si">%d</span><span class="s">, </span><span class="si">%d</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">actual_candidates</span><span class="p">),</span> <span class="n">N</span><span class="p">))</span>
+    <span class="c"># check for empty candidate list</span>
+    <span class="k">if</span> <span class="n">N</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed at loop insertion (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">))</span>
+        <span class="k">return</span> <span class="o">-</span><span class="mi">2</span>
+    <span class="c"># choose variant</span>
+    <span class="k">if</span> <span class="n">variant</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="k">return</span> <span class="n">_CloseLoopFrame</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">,</span> <span class="n">actual_candidates</span><span class="p">,</span>
+                               <span class="n">actual_extended_gaps</span><span class="p">)</span>
+    <span class="k">elif</span> <span class="n">variant</span> <span class="ow">in</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">]:</span>
+        <span class="k">return</span> <span class="n">_CloseLoopBare</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">,</span> <span class="n">actual_candidates</span><span class="p">,</span>
+                              <span class="n">actual_extended_gaps</span><span class="p">,</span> <span class="n">variant</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&quot;Unknown variant </span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">variant</span><span class="p">);</span>
+
+<span class="c">###############################################################################</span>
+
 <div class="viewcode-block" id="SetupBackboneScorer"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.SetupBackboneScorer">[docs]</a><span class="k">def</span> <span class="nf">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">):</span>
     <span class="sd">&#39;&#39;&#39;Get a scorer for medling with backbones.</span>
 
@@ -61,15 +279,13 @@
 <span class="sd">    :rtype: :class:`~promod3.loop.BackboneLoopScorer`</span>
 <span class="sd">    &#39;&#39;&#39;</span>
     <span class="n">scorer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadBackboneLoopScorer</span><span class="p">()</span>
-    <span class="n">seqres</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
-    <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">:</span>
-        <span class="n">seqres</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">s</span><span class="o">.</span><span class="n">GetString</span><span class="p">())</span>
-    <span class="n">scorer</span><span class="o">.</span><span class="n">Initialize</span><span class="p">(</span><span class="n">seqres</span><span class="p">)</span>
+    <span class="n">scorer</span><span class="o">.</span><span class="n">Initialize</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">)</span>
     <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
     <span class="k">return</span> <span class="n">scorer</span>
 </div>
-<div class="viewcode-block" id="CloseSmallDeletions"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.CloseSmallDeletions">[docs]</a><span class="k">def</span> <span class="nf">CloseSmallDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">extension_steps</span><span class="o">=</span><span class="mi">9</span><span class="p">,</span> <span class="n">clash_thresh</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span>
-                        <span class="n">e_thresh</span><span class="o">=</span><span class="mi">200</span><span class="p">):</span>
+<div class="viewcode-block" id="CloseSmallDeletions"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.CloseSmallDeletions">[docs]</a><span class="k">def</span> <span class="nf">CloseSmallDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">max_extension</span><span class="o">=</span><span class="mi">9</span><span class="p">,</span> <span class="n">clash_thresh</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span>
+                        <span class="n">e_thresh</span><span class="o">=</span><span class="mi">200</span><span class="p">,</span> <span class="n">use_scoring_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                        <span class="n">use_full_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
     <span class="sd">&#39;&#39;&#39;Close small deletions by relaxing neighbouring residues.</span>
 
 <span class="sd">    Small deletions in the template from the target-template alignment have a</span>
@@ -80,34 +296,7 @@
 
 <span class="sd">    Closed gaps are removed from :attr:`mhandle.gaps`.</span>
 
-<span class="sd">    .. testcode:: closesmalldel</span>
-<span class="sd">        :hide:</span>
-
-<span class="sd">        from promod3 import modelling</span>
-<span class="sd">        from promod3 import loop</span>
-
-<span class="sd">        tpl = ost.io.LoadPDB(&#39;../tests/modelling/data/gly.pdb&#39;)</span>
-<span class="sd">        aln = ost.seq.CreateAlignment(ost.seq.CreateSequence(&#39;trg&#39;, &#39;GGG-GGG&#39;),</span>
-<span class="sd">                                      ost.seq.CreateSequence(&#39;tpl&#39;, &#39;GGGAGGG&#39;))</span>
-<span class="sd">        aln.AttachView(1, tpl.CreateFullView())</span>
-<span class="sd">        mhandle = modelling.BuildRawModel(aln)</span>
-<span class="sd">        assert len(mhandle.gaps) == 1</span>
-<span class="sd">        scorer = modelling.SetupBackboneScorer(mhandle)</span>
-<span class="sd">        modelling.CloseSmallDeletions(mhandle, scorer)</span>
-<span class="sd">        assert len(mhandle.gaps) == 0</span>
-
-<span class="sd">    .. doctest:: closesmalldel</span>
-
-<span class="sd">        import ost</span>
-<span class="sd">        from promod3 import modelling</span>
-<span class="sd">        from promod3 import loop</span>
-
-<span class="sd">        tpl = ost.io.LoadPDB(&#39;gly.pdb&#39;)</span>
-<span class="sd">        aln = ost.io.LoadAlignment(&#39;seq.fasta&#39;)</span>
-<span class="sd">        aln.AttachView(1, tpl.CreateFullView())</span>
-<span class="sd">        mhandle = modelling.BuildRawModel(aln)</span>
-<span class="sd">        scorer = modelling.SetupBackboneScorer(mhandle)</span>
-<span class="sd">        modelling.CloseSmallDeletions(mhandle, scorer)</span>
+<span class="sd">    .. literalinclude:: ../../../tests/doc/scripts/modelling_close_small_deletions.py</span>
 
 <span class="sd">    :param mhandle: Modelling handle on which to apply change.</span>
 <span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
@@ -116,12 +305,9 @@
 <span class="sd">                   If gaps are closed, the *scorer* is updated.</span>
 <span class="sd">    :type scorer: :class:`~promod3.loop.BackboneLoopScorer`</span>
 
-<span class="sd">    :param extension_steps: Iterations allowed for gap extension. This does not</span>
-<span class="sd">                            directly mean &#39;extended size of gap&#39; but no. of</span>
-<span class="sd">                            attempts to extend. Extension works like trying to</span>
-<span class="sd">                            increase left, then right, then try more on the</span>
-<span class="sd">                            left side again...</span>
-<span class="sd">    :type extension_steps: :class:`int`</span>
+<span class="sd">    :param max_extension: Maximal number of gap extension steps to perform</span>
+<span class="sd">                          (see :class:`GapExtender`)</span>
+<span class="sd">    :type max_extension: :class:`int`</span>
 
 <span class="sd">    :param clash_thresh: Threshold for the clash score, acceptance means being</span>
 <span class="sd">                         lower than this.</span>
@@ -129,7 +315,31 @@
 
 <span class="sd">    :param e_thresh: Potential energy should be lower than this.</span>
 <span class="sd">    :type e_thresh: :class:`float`</span>
+
+<span class="sd">    :param use_scoring_extender: True = use :class:`ScoringGapExtender` instead</span>
+<span class="sd">                                 of :class:`GapExtender`.</span>
+<span class="sd">                                 The gap is penalized according as</span>
+<span class="sd">                                 0.8*length + sum(helices) + sum(sheets).</span>
+<span class="sd">                                 For the scondary-structure-penalty to work,</span>
+<span class="sd">                                 the model-template must have the appropriate</span>
+<span class="sd">                                 information before :func:`BuildRawModel` is</span>
+<span class="sd">                                 called (e.g. with :mod:`ost.bindings.dssp`).</span>
+<span class="sd">    :type use_scoring_extender:  :class:`bool`</span>
+
+<span class="sd">    :param use_full_extender: True = use :class:`FullGapExtender` instead of</span>
+<span class="sd">                              of :class:`GapExtender`. Also works in combination</span>
+<span class="sd">                              with `use_scoring_extender`. This allows the gap</span>
+<span class="sd">                              extender to skip neighboring gaps and to correctly</span>
+<span class="sd">                              handle gaps close to termini.</span>
+<span class="sd">    :type use_full_extender:  :class:`bool`</span>
 <span class="sd">    &#39;&#39;&#39;</span>
+
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to close small deletions (no. of gap(s): </span><span class="si">%d</span><span class="s">).&quot;</span> <span class="o">%</span> \
+                       <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">return</span>
+
     <span class="n">current_gap_index</span> <span class="o">=</span> <span class="mi">0</span>
 
     <span class="c"># iterating mhandle.gaps. The number of gaps may change during the process,</span>
@@ -154,8 +364,11 @@
             <span class="c"># the gap, we get the backbone to be stretched. If no more extension</span>
             <span class="c"># is possible, break out. On first successful relaxation for an</span>
             <span class="c"># extension, we successfully stop.</span>
-            <span class="n">extender</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">GapExtender</span><span class="p">(</span><span class="n">current_gap</span><span class="p">)</span>
-            <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">extension_steps</span><span class="p">):</span>
+            <span class="n">extender</span> <span class="o">=</span> <span class="n">_GetGapExtender</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">current_gap</span><span class="p">,</span>
+                                       <span class="n">use_scoring_extender</span><span class="p">,</span>
+                                       <span class="n">use_full_extender</span><span class="p">,</span>
+                                       <span class="n">max_extension</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">max_extension</span><span class="p">):</span>
                 <span class="k">if</span> <span class="ow">not</span> <span class="n">extender</span><span class="o">.</span><span class="n">Extend</span><span class="p">():</span>
                     <span class="k">break</span>
                 <span class="c"># gather residues for backbone relaxation, check that we get a</span>
@@ -191,13 +404,12 @@
                    <span class="n">potential_e</span> <span class="o">&lt;</span> <span class="n">e_thresh</span> <span class="ow">and</span> \
                    <span class="n">scorer</span><span class="o">.</span><span class="n">TransOmegaTorsions</span><span class="p">(</span><span class="n">bb_list</span><span class="p">):</span>
                     <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Closed: </span><span class="si">%s</span><span class="s"> by relaxing </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
-                                   <span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">current_gap_index</span><span class="p">],</span> <span class="n">current_gap</span><span class="p">))</span>
+                                <span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">current_gap_index</span><span class="p">],</span> <span class="n">current_gap</span><span class="p">))</span>
                     <span class="n">chain</span> <span class="o">=</span> <span class="n">current_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetChain</span><span class="p">()</span>
-                    <span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">chain</span><span class="p">,</span> <span class="n">n_stem_resnum</span><span class="p">,</span>
-                                       <span class="n">current_chain_index</span><span class="p">)</span>
+                    <span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">chain</span><span class="p">,</span> <span class="n">n_stem_resnum</span><span class="p">)</span>
                     <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">n_stem_resnum</span><span class="p">,</span>
                                           <span class="n">current_chain_index</span><span class="p">)</span>
-                    <span class="n">modelling</span><span class="o">.</span><span class="n">ClearGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">current_gap</span><span class="p">)</span>
+                    <span class="n">ClearGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">current_gap</span><span class="p">)</span>
                     <span class="n">success</span> <span class="o">=</span> <span class="bp">True</span>
                     <span class="k">break</span>
 
@@ -215,32 +427,10 @@
 <span class="sd">    stretch of original gaps and the deleted region. Original gaps will be</span>
 <span class="sd">    removed. Stem residues count to the gap, so **A-A-A** has a distance of 0.</span>
 
-<span class="sd">    .. testcode:: mergegapsbydist</span>
-<span class="sd">        :hide:</span>
-
-<span class="sd">        from promod3 import modelling</span>
-
-<span class="sd">        tpl = ost.io.LoadPDB(&#39;../tests/modelling/data/1mcg.pdb&#39;)</span>
-<span class="sd">        aln = ost.seq.CreateAlignment(ost.seq.CreateSequence(&#39;trg&#39;,</span>
-<span class="sd">                                                             &#39;DDFAGDTKNLGHN&#39;),</span>
-<span class="sd">                                      ost.seq.CreateSequence(&#39;tpl&#39;,</span>
-<span class="sd">                                                             &#39;NN----A----LF&#39;))</span>
-<span class="sd">        aln.AttachView(1, tpl.CreateFullView())</span>
-<span class="sd">        mhandle = modelling.BuildRawModel(aln)</span>
-<span class="sd">        assert len(mhandle.gaps) == 2</span>
-<span class="sd">        modelling.MergeGapsByDistance(mhandle, 0)</span>
-<span class="sd">        assert len(mhandle.gaps) == 1</span>
-
-<span class="sd">    .. doctest:: mergegapsbydist</span>
+<span class="sd">    IMPORTANT: we assume here that *mhandle* stores gaps sequentially.</span>
+<span class="sd">    Non-sequential gaps are ignored!</span>
 
-<span class="sd">        import ost</span>
-<span class="sd">        from promod3 import modelling</span>
-
-<span class="sd">        tpl = ost.io.LoadPDB(&#39;1mcg.pdb&#39;)</span>
-<span class="sd">        aln = ost.io.LoadAlignment(&#39;1mcg_aln.fasta&#39;)</span>
-<span class="sd">        aln.AttachView(1, tpl.CreateFullView())</span>
-<span class="sd">        mhandle = modelling.BuildRawModel(aln)</span>
-<span class="sd">        modelling.MergeGapsByDistance(mhandle, 0)</span>
+<span class="sd">    .. literalinclude:: ../../../tests/doc/scripts/modelling_merge_gaps_by_distance.py</span>
 
 <span class="sd">    :param mhandle: Modelling handle on which to apply change.</span>
 <span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
@@ -248,8 +438,12 @@
 <span class="sd">                     merge happens.</span>
 <span class="sd">    :type distance: :class:`int`</span>
 <span class="sd">    &#39;&#39;&#39;</span>
-    <span class="c"># IMPORTANT: the assumption is that ModellingHandle stores gaps</span>
-    <span class="c"># sequentially</span>
+
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to merge </span><span class="si">%d</span><span class="s"> gap(s) with distance </span><span class="si">%d</span><span class="s">.&quot;</span> <span class="o">%</span> \
+                       <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">),</span> <span class="n">distance</span><span class="p">))</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">return</span>
 
     <span class="c"># indicate if we merged gaps and should check for more</span>
     <span class="n">try_again</span> <span class="o">=</span> <span class="bp">True</span>
@@ -262,8 +456,8 @@
         <span class="n">try_again</span> <span class="o">=</span> <span class="bp">False</span>
         <span class="c"># iterate all but the last gap, since we are always looking ahead</span>
         <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">):</span>
-            <span class="n">current_gap</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
-            <span class="n">next_gap</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span>
+            <span class="n">current_gap</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
+            <span class="n">next_gap</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
             <span class="c"># check that we are on the same chain</span>
             <span class="k">if</span> <span class="n">current_gap</span><span class="o">.</span><span class="n">GetChain</span><span class="p">()</span> <span class="o">!=</span> <span class="n">next_gap</span><span class="o">.</span><span class="n">GetChain</span><span class="p">():</span>
                 <span class="k">continue</span>
@@ -273,9 +467,12 @@
             <span class="c"># get the distance between the gaps</span>
             <span class="n">dist</span> <span class="o">=</span> <span class="n">next_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span> \
                    <span class="o">-</span> <span class="n">current_gap</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">dist</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Non-sequential gaps found. Ignoring.&quot;</span><span class="p">)</span>
+                <span class="k">continue</span>
             <span class="k">if</span> <span class="n">dist</span> <span class="o">&lt;=</span> <span class="n">distance</span><span class="p">:</span>
                 <span class="c"># gaps are close enough, combine! combine!</span>
-                <span class="n">modelling</span><span class="o">.</span><span class="n">MergeGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span>
+                <span class="n">MergeGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span>
                 <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Merged gap </span><span class="si">%s</span><span class="s"> and </span><span class="si">%s</span><span class="s"> into </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                <span class="p">(</span><span class="n">current_gap</span><span class="p">,</span> <span class="n">next_gap</span><span class="p">,</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span>
                 <span class="n">try_again</span> <span class="o">=</span> <span class="bp">True</span>
@@ -283,8 +480,10 @@
 </div>
 <div class="viewcode-block" id="FillLoopsByDatabase"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.FillLoopsByDatabase">[docs]</a><span class="k">def</span> <span class="nf">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">,</span>
                         <span class="n">torsion_sampler</span><span class="p">,</span> <span class="n">max_loops_to_search</span><span class="o">=</span><span class="mi">40</span><span class="p">,</span>
+                        <span class="n">min_loops_required</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="n">max_res_extension</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span>
                         <span class="n">extended_search</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">use_scoring_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
-                        <span class="n">max_db_loop_len</span><span class="o">=</span><span class="mi">12</span><span class="p">):</span>
+                        <span class="n">use_full_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">score_variant</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
+                        <span class="n">ring_punch_detection</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>
     <span class="sd">&#39;&#39;&#39;Try to fill up loops from a structural database.</span>
 
 <span class="sd">    Usually this will extend the gaps a bit to match candidates from the</span>
@@ -292,42 +491,7 @@
 <span class="sd">    residues.</span>
 <span class="sd">    This function cannot fill gaps at C- or N-terminal.</span>
 
-<span class="sd">    .. testcode:: fillloopsbydb</span>
-<span class="sd">        :hide:</span>
-
-<span class="sd">        from promod3 import modelling</span>
-<span class="sd">        from promod3 import loop</span>
-
-<span class="sd">        tpl = ost.io.LoadPDB(&#39;../tests/modelling/data/2dbs.pdb&#39;)</span>
-<span class="sd">        aln = ost.seq.CreateAlignment(</span>
-<span class="sd">                    ost.seq.CreateSequence(&#39;trg&#39;, &#39;TLNGFTVPAGNTLV--LNPDKGATVTMA&#39;),</span>
-<span class="sd">                    ost.seq.CreateSequence(&#39;tpl&#39;, &#39;NGGTLLIPNGTYHFLGIQMKSNVHIRVE&#39;))</span>
-
-
-<span class="sd">        aln.AttachView(1, tpl.CreateFullView())</span>
-<span class="sd">        mhandle = modelling.BuildRawModel(aln)</span>
-<span class="sd">        assert len(mhandle.gaps) == 1</span>
-<span class="sd">        scorer = modelling.SetupBackboneScorer(mhandle)</span>
-<span class="sd">        modelling.FillLoopsByDatabase(mhandle, scorer, loop.LoadFragDB(),</span>
-<span class="sd">                                      loop.LoadStructureDB(),</span>
-<span class="sd">                                      loop.LoadTorsionSamplerCoil())</span>
-<span class="sd">        assert len(mhandle.gaps) == 0</span>
-
-<span class="sd">    .. doctest:: fillloopsbydb</span>
-
-<span class="sd">        from promod3 import modelling</span>
-<span class="sd">        from promod3 import loop</span>
-<span class="sd">  </span>
-<span class="sd">        tpl = io.LoadPDB(&#39;2dbs.pdb&#39;)</span>
-<span class="sd">        aln = ost.io.LoadAlignment(&#39;2dbs.fasta&#39;)</span>
-<span class="sd">        aln.AttachView(1, tpl.CreateFullView())</span>
-<span class="sd">  </span>
-<span class="sd">        mhandle = modelling.BuildRawModel(aln)</span>
-<span class="sd">        scorer = modelling.SetupBackboneScorer(mhandle)</span>
-<span class="sd">        modelling.FillLoopsByDatabase(mhandle, scorer, </span>
-<span class="sd">                                      loop.LoadFragDB(),</span>
-<span class="sd">                                      loop.LoadStructureDB(),</span>
-<span class="sd">                                      loop.LoadTorsionSamplerCoil())</span>
+<span class="sd">    .. literalinclude:: ../../../tests/doc/scripts/modelling_fill_loops_by_database.py</span>
 
 <span class="sd">    :param mhandle: Modelling handle on which to apply change.</span>
 <span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
@@ -346,9 +510,25 @@
 <span class="sd">    :type torsion_sampler: :class:`~promod3.loop.TorsionSampler`</span>
 
 <span class="sd">    :param max_loops_to_search: Define how many candidates are &#39;enough&#39; to be</span>
-<span class="sd">                                evaluated per loop.</span>
+<span class="sd">                                evaluated per loop. The actual found candidates</span>
+<span class="sd">                                may be more (if we found &#39;enough&#39;) or less (if</span>
+<span class="sd">                                not enough candidates exist) of this number.</span>
 <span class="sd">    :type max_loops_to_search: :class:`int`</span>
 
+<span class="sd">    :param min_loops_required: Define how many candidates we require to close</span>
+<span class="sd">                               the loop. If we did not find at least this number</span>
+<span class="sd">                               of candidates for a gap, we skip it without</span>
+<span class="sd">                               closing. Can be set to ``max_loops_to_search``</span>
+<span class="sd">                               (or equivalently to -1) to enforce that we only</span>
+<span class="sd">                               close gaps for which we found enough candidates.</span>
+<span class="sd">    :type min_loops_required: :class:`int`</span>
+
+<span class="sd">    :param max_res_extension: Only allow this number of residues to be added to</span>
+<span class="sd">                              the gaps when extending. If set to **-1**, any</span>
+<span class="sd">                              number of residues can be added (as long as the</span>
+<span class="sd">                              `fragment_db` allows it).</span>
+<span class="sd">    :type max_res_extension: :class:`int`</span>
+
 <span class="sd">    :param extended_search: True = more loop candidates are considered.</span>
 <span class="sd">                            The candidate search is done less precisely (see</span>
 <span class="sd">                            :meth:`~promod3.loop.LoopCandidates.FillFromDatabase`).</span>
@@ -358,65 +538,44 @@
 
 <span class="sd">    :param use_scoring_extender: True = use :class:`ScoringGapExtender` instead</span>
 <span class="sd">                                 of :class:`GapExtender`.</span>
-<span class="sd">                                 The gap is penalized according as</span>
-<span class="sd">                                 0.8*length + sum(helices) + sum(sheets).</span>
-<span class="sd">                                 For the scondary-structure-penalty to work,</span>
-<span class="sd">                                 the model-template must have the appropriate</span>
-<span class="sd">                                 information before :func:`BuildRawModel` is</span>
-<span class="sd">                                 called (e.g. with :mod:`ost.bindings.dssp`).</span>
+<span class="sd">                                 See :func:`CloseSmallDeletions`.</span>
 <span class="sd">    :type use_scoring_extender:  :class:`bool`</span>
 
-<span class="sd">    :param max_db_loop_len: Max. len of loops for which a database search makes</span>
-<span class="sd">                            sense. Should correspond to the biggest loop stored</span>
-<span class="sd">                            in the database.</span>
-<span class="sd">    :type max_db_loop_len: :class:`int`</span>
+<span class="sd">    :param use_full_extender: True = use :class:`FullGapExtender` instead of</span>
+<span class="sd">                              :class:`GapExtender`.</span>
+<span class="sd">                              See :func:`CloseSmallDeletions`.</span>
+<span class="sd">    :type use_full_extender:  :class:`bool`</span>
+
+
+<span class="sd">    :param score_variant: How to score loop candidates. Options:</span>
+
+<span class="sd">                          - **0**: put frame of backbone residues enclosing all</span>
+<span class="sd">                            candidates and score frame. This will also &quot;score&quot;</span>
+<span class="sd">                            non-modelled residues!</span>
+<span class="sd">                          - **1**: score candidates directly</span>
+<span class="sd">                          - **2**: like **1** but penalize length of candidate</span>
+<span class="sd">                          </span>
+<span class="sd">    :type score_variant:  :class:`int`</span>
+
+<span class="sd">    :param ring_punch_detection: How to deal with ring punchings. Options:</span>
+
+<span class="sd">                                 - **0**: not at all (fastest)</span>
+<span class="sd">                                 - **1**: check for punchings with existing rings</span>
+<span class="sd">                                 - **2**: check incl. sidechain for loop cand.</span>
+
+<span class="sd">    :type ring_punch_detection:  :class:`int`</span>
 <span class="sd">    &#39;&#39;&#39;</span>
-    <span class="c">#pylint: disable=too-many-branches,too-many-statements</span>
-    <span class="k">class</span> <span class="nc">_Scaler</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
-        <span class="sd">&#39;&#39;&#39;Default values for scaling. No idea where they come from.</span>
-<span class="sd">        &#39;&#39;&#39;</span>
-        <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-            <span class="bp">self</span><span class="o">.</span><span class="n">means</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.91583938</span><span class="p">,</span> <span class="mf">14.27141863</span><span class="p">,</span> <span class="o">-</span><span class="mf">0.34494736</span><span class="p">,</span> <span class="mf">0.05187852</span><span class="p">,</span>
-                          <span class="o">-</span><span class="mf">0.42485733</span><span class="p">]</span>
-            <span class="bp">self</span><span class="o">.</span><span class="n">stds</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.85865826</span><span class="p">,</span> <span class="mf">22.46711872</span><span class="p">,</span> <span class="mf">0.45472138</span><span class="p">,</span> <span class="mf">0.06816782</span><span class="p">,</span>
-                         <span class="mf">0.23995772</span><span class="p">]</span>
-
-        <span class="k">def</span> <span class="nf">transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
-            <span class="sd">&#39;&#39;&#39;Transform features.</span>
-<span class="sd">            &#39;&#39;&#39;</span>
-            <span class="k">return</span> <span class="p">[(</span><span class="n">el</span><span class="o">-</span><span class="n">mean</span><span class="p">)</span><span class="o">/</span><span class="n">std</span> <span class="k">for</span> <span class="n">el</span><span class="p">,</span> <span class="n">mean</span><span class="p">,</span> <span class="n">std</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">means</span><span class="p">,</span>
-                                                           <span class="bp">self</span><span class="o">.</span><span class="n">stds</span><span class="p">)]</span>
-
-    <span class="k">class</span> <span class="nc">_Predictor</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
-        <span class="sd">&#39;&#39;&#39;Default values.</span>
-<span class="sd">        &#39;&#39;&#39;</span>
-        <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-            <span class="bp">self</span><span class="o">.</span><span class="n">coef</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.16402122</span><span class="p">,</span> <span class="mf">0.58500018</span><span class="p">,</span> <span class="mf">0.55604793</span><span class="p">,</span> <span class="mf">0.57530581</span><span class="p">,</span>
-                         <span class="mf">0.25479925</span><span class="p">]</span>
-            <span class="bp">self</span><span class="o">.</span><span class="n">intercept</span> <span class="o">=</span> <span class="mf">2.8872048</span>
-
-        <span class="k">def</span> <span class="nf">predict</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
-            <span class="sd">&#39;&#39;&#39;Calculate score for features.</span>
-<span class="sd">            &#39;&#39;&#39;</span>
-            <span class="n">score</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">intercept</span>
-            <span class="k">for</span> <span class="n">ex</span><span class="p">,</span> <span class="n">coef</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">coef</span><span class="p">):</span>
-                <span class="n">score</span> <span class="o">+=</span> <span class="n">ex</span><span class="o">*</span><span class="n">coef</span>
-            <span class="k">return</span> <span class="n">score</span>
-
-    <span class="c"># setup</span>
-    <span class="n">svm_scaler</span> <span class="o">=</span> <span class="n">_Scaler</span><span class="p">()</span>
-    <span class="n">svm_predictor</span> <span class="o">=</span> <span class="n">_Predictor</span><span class="p">()</span>
-
-    <span class="c"># penalties for ScoringGapExtender</span>
-    <span class="k">if</span> <span class="n">use_scoring_extender</span><span class="p">:</span>
-        <span class="n">extender_penalties</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
-        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">)):</span>
-            <span class="n">extender_penalties</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="mf">0.0</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span>
-            <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">residues</span><span class="p">:</span>
-                <span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">GetSecStructure</span><span class="p">()</span><span class="o">.</span><span class="n">IsHelical</span><span class="p">()</span> <span class="ow">or</span> \
-                   <span class="n">r</span><span class="o">.</span><span class="n">GetSecStructure</span><span class="p">()</span><span class="o">.</span><span class="n">IsExtended</span><span class="p">():</span>
-                    <span class="n">num</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
-                    <span class="n">extender_penalties</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">][</span><span class="n">num</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
+
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to fill </span><span class="si">%d</span><span class="s"> gap(s) by database.&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">return</span>
+
+    <span class="c"># check min_loops_required</span>
+    <span class="k">if</span> <span class="n">min_loops_required</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">min_loops_required</span> <span class="o">=</span> <span class="n">max_loops_to_search</span>
+    <span class="c"># get biggest loop (w/o stems) stored in db</span>
+    <span class="n">max_db_loop_len</span> <span class="o">=</span> <span class="n">fragment_db</span><span class="o">.</span><span class="n">MaxFragLength</span><span class="p">()</span> <span class="o">-</span> <span class="mi">2</span>
 
     <span class="c"># point to the current gap</span>
     <span class="n">gap_idx</span> <span class="o">=</span> <span class="mi">0</span>
@@ -428,9 +587,8 @@
         
         <span class="c"># keep copy of original gap</span>
         <span class="n">gap_orig</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">gap_idx</span><span class="p">]</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
-        <span class="c"># get chain for gap</span>
-        <span class="n">actual_chain_idx</span> <span class="o">=</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
-        <span class="n">actual_chain</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">score_variant</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">gap_ins</span> <span class="o">=</span> <span class="n">CountEnclosedInsertions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">)</span>
 
         <span class="c"># terminal gaps are no loops, database needs 2 stems to work on</span>
         <span class="k">if</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">IsTerminal</span><span class="p">():</span>
@@ -440,25 +598,29 @@
         <span class="c">##################################</span>
         <span class="c"># find loop candidates</span>
         <span class="c">##################################</span>
-        <span class="c"># min/max stem res. numbers</span>
-        <span class="n">min_before_resnum</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">maxint</span>
-        <span class="n">max_after_resnum</span> <span class="o">=</span> <span class="o">-</span><span class="n">sys</span><span class="o">.</span><span class="n">maxint</span><span class="o">-</span><span class="mi">1</span>
         <span class="c"># list of LoopCandidates to fill gap</span>
         <span class="n">actual_candidates</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
         <span class="c"># list of StructuralGap corresponding to actual_candidates</span>
         <span class="n">actual_extended_gaps</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
         <span class="c"># number of loops found (stop if &gt;= max_loops_to_search)</span>
         <span class="n">found_loops</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c"># maximal length for this gap</span>
+        <span class="k">if</span> <span class="n">max_res_extension</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">max_gap_length</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">gap_orig</span><span class="o">.</span><span class="n">length</span> <span class="o">+</span> <span class="n">max_res_extension</span><span class="p">,</span>
+                                 <span class="n">max_db_loop_len</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">max_gap_length</span> <span class="o">=</span> <span class="n">max_db_loop_len</span>
         <span class="c"># currently extended gap and gap-extender</span>
         <span class="n">actual_gap</span> <span class="o">=</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
-        <span class="k">if</span> <span class="n">use_scoring_extender</span><span class="p">:</span>
-            <span class="n">actual_extender</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">ScoringGapExtender</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">,</span>
-                                       <span class="n">extender_penalties</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">])</span>
-        <span class="k">else</span><span class="p">:</span>
-            <span class="n">actual_extender</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">GapExtender</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">)</span>
-        <span class="n">last_gap_length</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">length</span>
+        <span class="n">actual_extender</span> <span class="o">=</span> <span class="n">_GetGapExtender</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">,</span>
+                                          <span class="n">use_scoring_extender</span><span class="p">,</span>
+                                          <span class="n">use_full_extender</span><span class="p">,</span>
+                                          <span class="n">max_gap_length</span><span class="p">)</span>
         <span class="c"># iteratively extend actual_gap until we have enough loops</span>
-        <span class="k">while</span> <span class="n">last_gap_length</span> <span class="o">&lt;=</span> <span class="n">max_db_loop_len</span><span class="p">:</span>
+        <span class="k">while</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">length</span> <span class="o">&lt;=</span> <span class="n">max_gap_length</span><span class="p">:</span>
+            <span class="c"># check if we have enough</span>
+            <span class="k">if</span> <span class="n">found_loops</span> <span class="o">&gt;=</span> <span class="n">max_loops_to_search</span><span class="p">:</span>
+                <span class="k">break</span>
             <span class="c"># extend the gap</span>
             <span class="k">if</span> <span class="ow">not</span> <span class="n">actual_extender</span><span class="o">.</span><span class="n">Extend</span><span class="p">():</span>
                 <span class="k">break</span>
@@ -466,26 +628,16 @@
             <span class="k">if</span> <span class="ow">not</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">or</span> \
                <span class="ow">not</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
                 <span class="k">break</span>
-
-            <span class="c"># TODO (GT): maybe ignore last_gap_length story anyways...</span>
-
-            <span class="c"># check if we have enough and ensure that we add all candidates with same length</span>
-            <span class="k">if</span> <span class="n">found_loops</span> <span class="o">&gt;=</span> <span class="n">max_loops_to_search</span> <span class="ow">and</span> \
-               <span class="p">(</span><span class="n">use_scoring_extender</span> <span class="ow">or</span> <span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">length</span> <span class="o">&gt;</span> <span class="n">last_gap_length</span><span class="p">)):</span>
-                <span class="k">break</span>
+            <span class="c"># skip if we try to merge insertions with score_variant=0</span>
+            <span class="k">if</span> <span class="n">score_variant</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> \
+               <span class="n">CountEnclosedInsertions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">)</span> <span class="o">!=</span> <span class="n">gap_ins</span><span class="p">:</span>
+                <span class="k">continue</span>
 
             <span class="c"># get candidates for the current loop</span>
             <span class="n">candidates</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoopCandidates</span><span class="o">.</span><span class="n">FillFromDatabase</span><span class="p">(</span>
                 <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="p">,</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="p">,</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">,</span>
                 <span class="n">fragment_db</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">,</span> <span class="n">extended_search</span><span class="p">)</span>
 
-            <span class="c"># TODO (GT): this shouldn&#39;t have to be here...</span>
-            <span class="n">last_gap_length</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">length</span>
-            <span class="n">min_before_resnum</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span>
-                                    <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">())</span>
-            <span class="n">max_after_resnum</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">max_after_resnum</span><span class="p">,</span>
-                                   <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">())</span>
-
             <span class="c"># skip gaps with no loop candidates</span>
             <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                 <span class="k">continue</span>
@@ -495,11 +647,16 @@
                 <span class="n">candidates</span><span class="o">.</span><span class="n">ApplyCCD</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="p">,</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="p">,</span>
                                     <span class="n">torsion_sampler</span><span class="p">)</span>
             <span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
-                <span class="c"># ccd requires the residues before and after the stems</span>
-                <span class="c"># to be valid, it could be that we extend too much...</span>
-                <span class="c"># just neglect if that happens, further extension will</span>
-                <span class="c"># fail anyway and causes the extension process to stop/</span>
+                <span class="c"># CCD should work even if no residues exist before and/or after</span>
+                <span class="c"># the stems. If this is not desired, you should skip those gaps.</span>
+                <span class="c"># If anything else fails, the proposed gap is skipped.</span>
+                <span class="n">ost</span><span class="o">.</span><span class="n">LogWarning</span><span class="p">(</span><span class="s">&quot;ApplyCCD failure for &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">))</span>
                 <span class="k">continue</span>
+            <span class="c"># check for ring punchings</span>
+            <span class="k">if</span> <span class="n">ring_punch_detection</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">FilterCandidates</span><span class="p">(</span><span class="n">candidates</span><span class="p">,</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">ring_punch_detection</span> <span class="o">==</span> <span class="mi">2</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">FilterCandidatesWithSC</span><span class="p">(</span><span class="n">candidates</span><span class="p">,</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">)</span>
             <span class="c"># skip if no loop was successfully closed</span>
             <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                 <span class="k">continue</span>
@@ -509,122 +666,47 @@
             <span class="n">actual_extended_gaps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">Copy</span><span class="p">())</span>
             <span class="n">found_loops</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span>
 
-        <span class="c"># check result</span>
-        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">actual_candidates</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
-            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed at loop insertion (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">))</span>
+        <span class="c"># skip if we didn&#39;t find enough</span>
+        <span class="k">if</span> <span class="n">found_loops</span> <span class="o">&lt;</span> <span class="n">min_loops_required</span><span class="p">:</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed at loop insertion (</span><span class="si">%s</span><span class="s">), only </span><span class="si">%d</span><span class="s"> candidates&quot;</span> <span class="o">%</span> \
+                        <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span> <span class="n">found_loops</span><span class="p">))</span>
             <span class="n">gap_idx</span> <span class="o">+=</span> <span class="mi">1</span>
             <span class="k">continue</span>
 
         <span class="c">##################################</span>
-        <span class="c"># all loop candidates will be scored along the full max. extension ever</span>
-        <span class="c"># reached in the search before, so we build an overall frame, where we</span>
-        <span class="c"># insert the loops</span>
-        <span class="c">##################################</span>
-        <span class="n">frame_seq</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>\
-                    <span class="p">[</span><span class="n">min_before_resnum</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="n">max_after_resnum</span><span class="p">]</span>
-        <span class="n">frame_backbone_list</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)</span>
-        <span class="n">actual_res_num</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">mol</span><span class="o">.</span><span class="n">ResNum</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">)</span>
-        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)):</span>
-            <span class="n">actual_res</span> <span class="o">=</span> <span class="n">actual_chain</span><span class="o">.</span><span class="n">FindResidue</span><span class="p">(</span><span class="n">actual_res_num</span><span class="p">)</span>
-            <span class="k">if</span> <span class="n">actual_res</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
-                <span class="n">frame_backbone</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">Backbone</span><span class="p">(</span><span class="n">actual_res</span><span class="p">,</span> <span class="n">frame_seq</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
-                <span class="n">frame_backbone_list</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">frame_backbone</span>
-            <span class="n">actual_res_num</span> <span class="o">+=</span> <span class="mi">1</span>
-
-        <span class="n">final_loop_candidates</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoopCandidates</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)</span>
-
-        <span class="c">##################################</span>
-        <span class="c"># prepare loop candidates for scoring</span>
-        <span class="c">##################################</span>
-        <span class="n">back_mapper</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
-        <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">loop_candidates</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">actual_candidates</span><span class="p">):</span>
-            <span class="n">start_index</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>\
-                          <span class="o">-</span> <span class="n">min_before_resnum</span>
-            <span class="k">for</span> <span class="n">j</span><span class="p">,</span> <span class="n">loop_candidate</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">loop_candidates</span><span class="p">):</span>
-                <span class="n">actual_frame_backbone_list</span> <span class="o">=</span> <span class="n">frame_backbone_list</span>
-                <span class="n">actual_frame_backbone_list</span><span class="o">.</span><span class="n">ReplaceFragment</span><span class="p">(</span>
-                    <span class="n">loop_candidate</span><span class="o">.</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">start_index</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
-                <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">actual_frame_backbone_list</span><span class="p">)</span>
-                <span class="n">back_mapper</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span>
-
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">AttachScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateClashScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                   <span class="n">actual_chain_idx</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateCBetaScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                   <span class="n">actual_chain_idx</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateTorsionScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                     <span class="n">actual_chain_idx</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateCBPackingScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                       <span class="n">actual_chain_idx</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateHBondScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                   <span class="n">actual_chain_idx</span><span class="p">)</span>
-
-        <span class="c">##################################</span>
-        <span class="c"># compare scores</span>
+        <span class="c"># close loop</span>
         <span class="c">##################################</span>
-        <span class="n">min_score</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">)</span>
-        <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
-        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">)):</span>
-            <span class="n">features</span> <span class="o">=</span> <span class="p">[</span><span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">torsion_score</span><span class="p">,</span>
-                        <span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">clash_score</span><span class="p">,</span>
-                        <span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">packing_score</span><span class="p">,</span>
-                        <span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">cbeta_score</span><span class="p">,</span>
-                        <span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">hbond_score</span><span class="p">]</span>
-            <span class="n">scaled_features</span> <span class="o">=</span> <span class="n">svm_scaler</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">features</span><span class="p">)</span>
-            <span class="n">score</span> <span class="o">=</span> <span class="n">svm_predictor</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">scaled_features</span><span class="p">)</span>
-            <span class="k">if</span> <span class="n">score</span> <span class="o">&lt;</span> <span class="n">min_score</span><span class="p">:</span>
-                <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="n">i</span>
-                <span class="n">min_score</span> <span class="o">=</span> <span class="n">score</span>
-        
-        <span class="n">ost</span><span class="o">.</span><span class="n">LogVerbose</span><span class="p">(</span><span class="s">&quot;Gap </span><span class="si">%s</span><span class="s"> - </span><span class="si">%d</span><span class="s"> candidates, best (min) score </span><span class="si">%g</span><span class="s">&quot;</span> <span class="o">%</span>
-                       <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">),</span> <span class="n">min_score</span><span class="p">))</span>
-
-        <span class="c">##################################</span>
-        <span class="c"># finally resolve loop</span>
-        <span class="c">##################################</span>
-        <span class="k">if</span> <span class="n">optimal_candidate</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
-            <span class="n">idx_a</span> <span class="o">=</span> <span class="n">back_mapper</span><span class="p">[</span><span class="n">optimal_candidate</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
-            <span class="n">idx_b</span> <span class="o">=</span> <span class="n">back_mapper</span><span class="p">[</span><span class="n">optimal_candidate</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
-            <span class="c"># update model</span>
-            <span class="n">start_resnum</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">]</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span>
-            <span class="n">bb_list</span> <span class="o">=</span> <span class="n">actual_candidates</span><span class="p">[</span><span class="n">idx_a</span><span class="p">][</span><span class="n">idx_b</span><span class="p">]</span><span class="o">.</span><span class="n">bb_list</span>
-            <span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">],</span>
-                               <span class="n">start_resnum</span><span class="p">,</span> <span class="n">actual_chain_idx</span><span class="p">)</span>
-            <span class="c"># update scorer</span>
-            <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">start_resnum</span><span class="p">,</span> <span class="n">actual_chain_idx</span><span class="p">)</span>
-            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Resolved </span><span class="si">%s</span><span class="s"> by filling </span><span class="si">%s</span><span class="s"> (</span><span class="si">%d</span><span class="s"> candidates)&quot;</span> <span class="o">%</span> \
-                        <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span>
-                         <span class="nb">str</span><span class="p">(</span><span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">]),</span>
-                         <span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">)))</span>
-            <span class="c"># will return -1 if last gap removed</span>
-            <span class="n">gap_idx</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">ClearGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">])</span>
-        <span class="k">else</span><span class="p">:</span>
-            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed at loop insertion (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">))</span>
+        <span class="n">new_idx</span> <span class="o">=</span> <span class="n">_CloseLoop</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">,</span> <span class="n">actual_candidates</span><span class="p">,</span>
+                             <span class="n">actual_extended_gaps</span><span class="p">,</span> <span class="n">score_variant</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">new_idx</span> <span class="o">==</span> <span class="o">-</span><span class="mi">2</span><span class="p">:</span>
+            <span class="c"># try next one if we failed</span>
             <span class="n">gap_idx</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># all good: fix sidechains if we&#39;re in ring-punch-mode and continue</span>
+            <span class="k">if</span> <span class="n">ring_punch_detection</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="n">sidechain</span><span class="o">.</span><span class="n">Reconstruct</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">keep_sidechains</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">gap_idx</span> <span class="o">=</span> <span class="n">new_idx</span>
+
 </div>
 <div class="viewcode-block" id="FillLoopsByMonteCarlo"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.FillLoopsByMonteCarlo">[docs]</a><span class="k">def</span> <span class="nf">FillLoopsByMonteCarlo</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">,</span> <span class="n">max_loops_to_search</span><span class="o">=</span><span class="mi">6</span><span class="p">,</span>
-                          <span class="n">max_extension</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span> <span class="n">mc_num_loops</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">mc_steps</span><span class="o">=</span><span class="mi">5000</span><span class="p">):</span>
+                          <span class="n">max_extension</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span> <span class="n">mc_num_loops</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">mc_steps</span><span class="o">=</span><span class="mi">5000</span><span class="p">,</span>
+                          <span class="n">use_scoring_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">use_full_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                          <span class="n">score_variant</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">ring_punch_detection</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
+                          <span class="n">fragger_handles</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
     <span class="sd">&#39;&#39;&#39;Try to fill up loops with Monte Carlo sampling.</span>
 
 <span class="sd">    This is meant as a &quot;last-resort&quot; approach when it is not possible to fill</span>
 <span class="sd">    the loops from the database with :func:`FillLoopsByDatabase`.</span>
 <span class="sd">    This will extend the gaps (up to *max_extension* times) a bit to allow for </span>
 <span class="sd">    more loop candidates to be found.</span>
+<span class="sd">    </span>
+<span class="sd">    The loops are modelled by either sampling the dihedral angles or (if</span>
+<span class="sd">    *fragger_handles* is given) :class:`~promod3.loop.Fragger` lists. The latter</span>
+<span class="sd">    is only used if the gap length is &gt;= the length of fragments stored.</span>
+
 <span class="sd">    This function cannot fill gaps at C- or N-terminal.</span>
 
-<span class="sd">    .. doctest:: fillloopsbymc</span>
-
-<span class="sd">        from promod3 import modelling</span>
-<span class="sd">        from promod3 import loop</span>
-<span class="sd">  </span>
-<span class="sd">        tpl = io.LoadPDB(&#39;2dbs.pdb&#39;)</span>
-<span class="sd">        aln = ost.io.LoadAlignment(&#39;2dbs.fasta&#39;)</span>
-<span class="sd">        aln.AttachView(1, tpl.CreateFullView())</span>
-<span class="sd">  </span>
-<span class="sd">        mhandle = modelling.BuildRawModel(aln)</span>
-<span class="sd">        scorer = modelling.SetupBackboneScorer(mhandle)</span>
-<span class="sd">        modelling.FillLoopsByMonteCarlo(mhandle, scorer, </span>
-<span class="sd">                                        loop.LoadTorsionSamplerCoil())</span>
+<span class="sd">    .. literalinclude:: ../../../tests/doc/scripts/modelling_fill_loops_by_monte_carlo.py</span>
 <span class="sd">    </span>
 <span class="sd">    :param mhandle: Modelling handle on which to apply change.</span>
 <span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
@@ -651,8 +733,35 @@
 <span class="sd">    :param mc_steps: Number of MC steps to perform for each loop candidate</span>
 <span class="sd">                     (see :meth:`~promod3.loop.LoopCandidates.FillFromMonteCarloSampler`)</span>
 <span class="sd">    :type mc_steps:  :class:`int`</span>
+
+<span class="sd">    :param use_scoring_extender: True = use :class:`ScoringGapExtender` instead</span>
+<span class="sd">                                 of :class:`GapExtender`.</span>
+<span class="sd">                                 See :func:`CloseSmallDeletions`.</span>
+<span class="sd">    :type use_scoring_extender:  :class:`bool`</span>
+
+<span class="sd">    :param use_full_extender: True = use :class:`FullGapExtender` instead of</span>
+<span class="sd">                              :class:`GapExtender`.</span>
+<span class="sd">                              See :func:`CloseSmallDeletions`.</span>
+<span class="sd">    :type use_full_extender:  :class:`bool`</span>
+
+<span class="sd">    :param score_variant: How to score loop candidates.</span>
+<span class="sd">                          See :func:`FillLoopsByDatabase`.</span>
+<span class="sd">    :type score_variant:  :class:`int`</span>
+
+<span class="sd">    :param ring_punch_detection: How to deal with ring punchings.</span>
+<span class="sd">                                 See :func:`FillLoopsByDatabase`.</span>
+<span class="sd">    :type ring_punch_detection:  :class:`int`</span>
+
+<span class="sd">    :param fragger_handles: Either None (no fragger sampling used) or one</span>
+<span class="sd">                            fragger handle for each chain in *mhandle*.</span>
+<span class="sd">    :type fragger_handles:  :class:`list` of :class:`~promod3.loop.FraggerHandle`</span>
 <span class="sd">    &#39;&#39;&#39;</span>
 
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to fill </span><span class="si">%d</span><span class="s"> gap(s) by Monte Carlo.&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">return</span>
+
     <span class="c"># point to the current gap</span>
     <span class="n">gap_idx</span> <span class="o">=</span> <span class="mi">0</span>
 
@@ -663,9 +772,8 @@
 
         <span class="c"># keep copy of original gap</span>
         <span class="n">gap_orig</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">gap_idx</span><span class="p">]</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
-        <span class="c"># get chain for gap</span>
-        <span class="n">actual_chain_idx</span> <span class="o">=</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
-        <span class="n">actual_chain</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">score_variant</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">gap_ins</span> <span class="o">=</span> <span class="n">CountEnclosedInsertions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">)</span>
 
         <span class="c"># ignore terminal gaps</span>
         <span class="k">if</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">IsTerminal</span><span class="p">():</span>
@@ -675,9 +783,6 @@
         <span class="c">##################################</span>
         <span class="c"># find loop candidates</span>
         <span class="c">##################################</span>
-        <span class="c"># min/max stem res. numbers</span>
-        <span class="n">min_before_resnum</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">maxint</span>
-        <span class="n">max_after_resnum</span> <span class="o">=</span> <span class="o">-</span><span class="n">sys</span><span class="o">.</span><span class="n">maxint</span><span class="o">-</span><span class="mi">1</span>
         <span class="c"># list of LoopCandidates to fill gap</span>
         <span class="n">actual_candidates</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
         <span class="c"># list of StructuralGap corresponding to actual_candidates</span>
@@ -686,43 +791,67 @@
         <span class="n">found_loops</span> <span class="o">=</span> <span class="mi">0</span>
         <span class="c"># currently extended gap and gap-extender</span>
         <span class="n">actual_gap</span> <span class="o">=</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
-        <span class="n">actual_extender</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">GapExtender</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">)</span>
-
-        <span class="c"># make sure, that the loop seq has at least length 3</span>
-        <span class="k">while</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">seq</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">):</span>
-            <span class="k">if</span> <span class="ow">not</span> <span class="n">actual_extender</span><span class="o">.</span><span class="n">Extend</span><span class="p">():</span>
-                <span class="k">break</span>
-
+        <span class="n">actual_extender</span> <span class="o">=</span> <span class="n">_GetGapExtender</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">,</span>
+                                          <span class="n">use_scoring_extender</span><span class="p">,</span>
+                                          <span class="n">use_full_extender</span><span class="p">)</span>
+        <span class="n">actual_chain_idx</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
         <span class="c"># iteratively extend actual_gap</span>
-        <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">max_extension</span><span class="p">):</span>
-            <span class="c"># abort if we found enough loops</span>
-            <span class="k">if</span> <span class="n">found_loops</span> <span class="o">&gt;=</span> <span class="n">max_loops_to_search</span><span class="p">:</span>
-                <span class="k">break</span>
+        <span class="n">ext_step</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">while</span> <span class="n">found_loops</span> <span class="o">&lt;</span> <span class="n">max_loops_to_search</span> <span class="ow">and</span> <span class="n">ext_step</span> <span class="o">&lt;</span> <span class="n">max_extension</span><span class="p">:</span>
             <span class="c"># extend the gap</span>
             <span class="k">if</span> <span class="ow">not</span> <span class="n">actual_extender</span><span class="o">.</span><span class="n">Extend</span><span class="p">():</span>
                 <span class="k">break</span>
+            <span class="c"># make sure, that the loop seq has at least length 3</span>
+            <span class="k">if</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">):</span>
+                <span class="k">continue</span>
+            <span class="n">ext_step</span> <span class="o">+=</span> <span class="mi">1</span>
+            
             <span class="c"># ensure both stems are valid</span>
             <span class="k">if</span> <span class="ow">not</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">or</span> \
                <span class="ow">not</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
                 <span class="k">break</span>
+            <span class="c"># skip if we try to merge insertions with score_variant=0</span>
+            <span class="k">if</span> <span class="n">score_variant</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> \
+               <span class="n">CountEnclosedInsertions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">)</span> <span class="o">!=</span> <span class="n">gap_ins</span><span class="p">:</span>
+                <span class="k">continue</span>
 
             <span class="c"># setup sampler, closer, scorer and cooler for MC</span>
+            <span class="k">if</span> <span class="n">fragger_handles</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">fragger_handle</span> <span class="o">=</span> <span class="n">fragger_handles</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>
             <span class="k">try</span><span class="p">:</span>
-                <span class="n">mc_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">PhiPsiSampler</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">,</span> 
-                                                <span class="n">torsion_sampler</span><span class="p">)</span>
+                <span class="c"># choose sampler</span>
+                <span class="k">if</span> <span class="n">fragger_handles</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> \
+                   <span class="n">actual_gap</span><span class="o">.</span><span class="n">length</span> <span class="o">&lt;</span> <span class="n">fragger_handle</span><span class="o">.</span><span class="n">fragment_length</span><span class="p">:</span>
+                    <span class="n">mc_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">PhiPsiSampler</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">,</span>
+                                                    <span class="n">torsion_sampler</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">start_pos</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span>
+                    <span class="n">end_pos</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span>
+                    <span class="n">fragger_list</span> <span class="o">=</span> <span class="n">fragger_handle</span><span class="o">.</span><span class="n">GetList</span><span class="p">(</span><span class="n">start_pos</span><span class="p">,</span> <span class="n">end_pos</span><span class="p">)</span>
+                    <span class="n">mc_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">FragmentSampler</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">,</span>
+                                                      <span class="n">fragger_list</span><span class="p">,</span>
+                                                      <span class="n">init_fragments</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
 
                 <span class="n">mc_closer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">DirtyCCDCloser</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="p">,</span>
                                                 <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="p">)</span>
 
                 <span class="n">weights</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
-                <span class="n">weights</span><span class="p">[</span><span class="s">&quot;cbeta&quot;</span><span class="p">]</span><span class="o">=</span><span class="mf">5.0</span>
-                <span class="n">weights</span><span class="p">[</span><span class="s">&quot;cb_packing&quot;</span><span class="p">]</span><span class="o">=</span><span class="mf">1.0</span>
-                <span class="n">weights</span><span class="p">[</span><span class="s">&quot;clash&quot;</span><span class="p">]</span><span class="o">=</span><span class="mf">0.05</span>
+                <span class="n">weights</span><span class="p">[</span><span class="s">&quot;reduced&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">3.0</span>
+                <span class="n">weights</span><span class="p">[</span><span class="s">&quot;cb_packing&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">2.0</span>
+                <span class="n">weights</span><span class="p">[</span><span class="s">&quot;hbond&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
+                <span class="n">weights</span><span class="p">[</span><span class="s">&quot;clash&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.05</span>
                 <span class="n">mc_scorer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LinearScorer</span><span class="p">(</span>
                         <span class="n">scorer</span><span class="p">,</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">(),</span>
                         <span class="n">actual_chain_idx</span><span class="p">,</span> <span class="n">weights</span><span class="p">)</span>
 
-                <span class="n">mc_cooler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">ExponentialCooler</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mf">0.9</span><span class="p">)</span>
+                <span class="n">start_temperature</span> <span class="o">=</span> <span class="mi">100</span>
+                <span class="n">cooling_factor</span> <span class="o">=</span> <span class="mf">0.9</span>
+                <span class="c"># the number of 109 is roughly the number of times we have to apply</span>
+                <span class="c"># a factor of 0.9 to 100 until it reaches a value of 0.001</span>
+                <span class="n">cooling_interval</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="n">mc_steps</span><span class="o">/</span><span class="mf">109.0</span><span class="p">))</span>
+                <span class="n">mc_cooler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">ExponentialCooler</span><span class="p">(</span><span class="n">cooling_interval</span><span class="p">,</span>
+                                                   <span class="n">start_temperature</span><span class="p">,</span>
+                                                   <span class="n">cooling_factor</span><span class="p">)</span>
             <span class="k">except</span><span class="p">:</span>
                 <span class="c"># something went terribly wrong...</span>
                 <span class="n">ost</span><span class="o">.</span><span class="n">LogError</span><span class="p">(</span><span class="s">&#39;Failed to set up MC components&#39;</span><span class="p">)</span>
@@ -735,124 +864,379 @@
                     <span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">,</span> <span class="n">mc_num_loops</span><span class="p">,</span> <span class="n">mc_steps</span><span class="p">,</span> <span class="n">mc_sampler</span><span class="p">,</span>
                     <span class="n">mc_closer</span><span class="p">,</span> <span class="n">mc_scorer</span><span class="p">,</span> <span class="n">mc_cooler</span><span class="p">)</span>
             <span class="k">except</span> <span class="ne">RuntimeError</span><span class="p">:</span>
-                <span class="c"># monte carlo cannot be initialized when the stems are too far apart</span>
-                <span class="c"># =&gt; we need further loop extension</span>
+                <span class="c"># monte carlo cannot be initialized when the stems are too far</span>
+                <span class="c"># apart  =&gt; we need further loop extension</span>
                 <span class="n">ost</span><span class="o">.</span><span class="n">LogVerbose</span><span class="p">(</span><span class="s">&quot;Failed in setting up &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">)</span> <span class="o">+</span> 
                                <span class="s">&quot; stems might be too far away...&quot;</span><span class="p">)</span>
                 <span class="k">continue</span>
+            <span class="c"># check for ring punchings</span>
+            <span class="k">if</span> <span class="n">ring_punch_detection</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">FilterCandidates</span><span class="p">(</span><span class="n">candidates</span><span class="p">,</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">ring_punch_detection</span> <span class="o">==</span> <span class="mi">2</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">FilterCandidatesWithSC</span><span class="p">(</span><span class="n">candidates</span><span class="p">,</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">)</span>
             <span class="c"># skip if nothing found</span>
             <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                 <span class="k">continue</span>
 
             <span class="c"># update candidate lists</span>
-            <span class="n">min_before_resnum</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span>
-                                    <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">())</span>
-            <span class="n">max_after_resnum</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">max_after_resnum</span><span class="p">,</span>
-                                   <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">())</span>
             <span class="n">actual_candidates</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span>
             <span class="n">actual_extended_gaps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">Copy</span><span class="p">())</span>
             <span class="n">found_loops</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)</span>
 
-        <span class="c"># check result</span>
-        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">actual_candidates</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
-            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed at loop insertion (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">))</span>
-            <span class="n">gap_idx</span> <span class="o">+=</span> <span class="mi">1</span>
-            <span class="k">continue</span>   
-        
         <span class="c">##################################</span>
-        <span class="c"># all loop candidates will be scored along the full max. extension ever</span>
-        <span class="c"># reached in the search before, so we build an overall frame, where we</span>
-        <span class="c"># insert the loops (NOTE: identical to DB)</span>
+        <span class="c"># close loop</span>
         <span class="c">##################################</span>
-        <span class="n">frame_seq</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>\
-                    <span class="p">[</span><span class="n">min_before_resnum</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="n">max_after_resnum</span><span class="p">]</span>
-        <span class="n">frame_backbone_list</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)</span>
-        <span class="n">actual_res_num</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">mol</span><span class="o">.</span><span class="n">ResNum</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">)</span>
-        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)):</span>
-            <span class="n">actual_res</span> <span class="o">=</span> <span class="n">actual_chain</span><span class="o">.</span><span class="n">FindResidue</span><span class="p">(</span><span class="n">actual_res_num</span><span class="p">)</span>
-            <span class="k">if</span> <span class="n">actual_res</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
-                <span class="n">frame_backbone</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">Backbone</span><span class="p">(</span><span class="n">actual_res</span><span class="p">,</span> <span class="n">frame_seq</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
-                <span class="n">frame_backbone_list</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">frame_backbone</span>
-            <span class="n">actual_res_num</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">new_idx</span> <span class="o">=</span> <span class="n">_CloseLoop</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">gap_orig</span><span class="p">,</span> <span class="n">actual_candidates</span><span class="p">,</span>
+                             <span class="n">actual_extended_gaps</span><span class="p">,</span> <span class="n">score_variant</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">new_idx</span> <span class="o">==</span> <span class="o">-</span><span class="mi">2</span><span class="p">:</span>
+            <span class="c"># try next one if we failed</span>
+            <span class="n">gap_idx</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># all good: fix sidechains if we&#39;re in ring-punch-mode and continue</span>
+            <span class="k">if</span> <span class="n">ring_punch_detection</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="n">sidechain</span><span class="o">.</span><span class="n">Reconstruct</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">keep_sidechains</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">gap_idx</span> <span class="o">=</span> <span class="n">new_idx</span>
+
+</div>
+<div class="viewcode-block" id="ModelTermini"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.ModelTermini">[docs]</a><span class="k">def</span> <span class="nf">ModelTermini</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">,</span> <span class="n">fragger_handles</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">mc_num_loops</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span> <span class="n">mc_steps</span><span class="o">=</span><span class="mi">5000</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Try to model termini with Monte Carlo sampling.</span>
 
-        <span class="n">final_loop_candidates</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoopCandidates</span><span class="p">(</span><span class="n">frame_seq</span><span class="p">)</span>
+<span class="sd">    Use with care! This is an experimental feature which will increase coverage</span>
+<span class="sd">    but we do not assume that the resulting termini are of high quality!</span>
 
-        <span class="c">##################################</span>
-        <span class="c"># prepare loop candidates for scoring (NOTE: identical to DB)</span>
-        <span class="c">##################################</span>
-        <span class="n">back_mapper</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
-        <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">loop_candidates</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">actual_candidates</span><span class="p">):</span>
-            <span class="n">start_index</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>\
-                          <span class="o">-</span> <span class="n">min_before_resnum</span>
-            <span class="k">for</span> <span class="n">j</span><span class="p">,</span> <span class="n">loop_candidate</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">loop_candidates</span><span class="p">):</span>
-                <span class="n">actual_frame_backbone_list</span> <span class="o">=</span> <span class="n">frame_backbone_list</span>
-                <span class="n">actual_frame_backbone_list</span><span class="o">.</span><span class="n">ReplaceFragment</span><span class="p">(</span>
-                    <span class="n">loop_candidate</span><span class="o">.</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">start_index</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
-                <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">actual_frame_backbone_list</span><span class="p">)</span>
-                <span class="n">back_mapper</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">))</span>
-                
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">AttachScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateClashScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                   <span class="n">actual_chain_idx</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateCBetaScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                   <span class="n">actual_chain_idx</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateTorsionScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                     <span class="n">actual_chain_idx</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateCBPackingScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                       <span class="n">actual_chain_idx</span><span class="p">)</span>
-        <span class="n">final_loop_candidates</span><span class="o">.</span><span class="n">CalculateHBondScores</span><span class="p">(</span><span class="n">min_before_resnum</span><span class="p">,</span> 
-                                                   <span class="n">actual_chain_idx</span><span class="p">)</span>
+<span class="sd">    The termini are modelled by either sampling the dihedral angles or (if</span>
+<span class="sd">    *fragger_handles* is given) :class:`~promod3.loop.Fragger` lists. The latter</span>
+<span class="sd">    is only used if the gap length is &gt;= the length of fragments stored.</span>
 
-        <span class="c">##################################</span>
-        <span class="c"># compare scores (NOTE: can be made identical to DB)</span>
-        <span class="c">##################################</span>
+<span class="sd">    Terminal gaps of length 1 are ignored by this function!</span>
+
+<span class="sd">    .. literalinclude:: ../../../tests/doc/scripts/modelling_model_termini.py</span>
+
+<span class="sd">    :param mhandle: Modelling handle on which to apply change.</span>
+<span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
+
+<span class="sd">    :param scorer: A scorer dedicated to this model.</span>
+<span class="sd">                   If gaps are closed, the *scorer* is updated.</span>
+<span class="sd">    :type scorer: :class:`~promod3.loop.BackboneLoopScorer`</span>
+
+<span class="sd">    :param torsion_sampler: A sampler for torsion angles.</span>
+<span class="sd">    :type torsion_sampler: :class:`~promod3.loop.TorsionSampler`</span>
+
+<span class="sd">    :param fragger_handles: Either None (no fragger sampling used) or one</span>
+<span class="sd">                            fragger handle for each chain in *mhandle*.</span>
+<span class="sd">    :type fragger_handles:  :class:`list` of :class:`~promod3.loop.FraggerHandle`</span>
+
+<span class="sd">    :param mc_num_loops: Number of loop candidates to consider for each terminal gap</span>
+<span class="sd">                         (see :meth:`~promod3.loop.LoopCandidates.FillFromMonteCarloSampler`)</span>
+<span class="sd">    :type mc_num_loops:  :class:`int`</span>
+
+<span class="sd">    :param mc_steps: Number of MC steps to perform for each loop candidate</span>
+<span class="sd">                     (see :meth:`~promod3.loop.LoopCandidates.FillFromMonteCarloSampler`)</span>
+<span class="sd">    :type mc_steps:  :class:`int`</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+
+    <span class="c"># get terminal gaps (copies as we&#39;ll clear them as we go)</span>
+    <span class="n">terminal_gaps</span> <span class="o">=</span> <span class="p">[</span><span class="n">g</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span> <span class="k">if</span> <span class="n">g</span><span class="o">.</span><span class="n">IsTerminal</span><span class="p">()</span> <span class="ow">and</span> <span class="n">g</span><span class="o">.</span><span class="n">length</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">]</span>
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">terminal_gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to model </span><span class="si">%d</span><span class="s"> terminal gap(s).&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">terminal_gaps</span><span class="p">))</span>
+
+    <span class="c"># model them</span>
+    <span class="k">for</span> <span class="n">actual_gap</span> <span class="ow">in</span> <span class="n">terminal_gaps</span><span class="p">:</span>
+        
+        <span class="c"># extract info</span>
+        <span class="k">if</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">IsNTerminal</span><span class="p">():</span>
+            <span class="n">start_resnum</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">start_resnum</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+        <span class="n">actual_chain</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">GetChain</span><span class="p">()</span>
+        <span class="n">actual_chain_idx</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">fragger_handles</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">fragger_handle</span> <span class="o">=</span> <span class="n">fragger_handles</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>
+
+        <span class="c"># choose sampler</span>
+        <span class="k">if</span> <span class="n">fragger_handles</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> \
+           <span class="n">actual_gap</span><span class="o">.</span><span class="n">length</span> <span class="o">&lt;</span> <span class="n">fragger_handle</span><span class="o">.</span><span class="n">fragment_length</span><span class="p">:</span>
+            <span class="n">mc_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">PhiPsiSampler</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">,</span>
+                                            <span class="n">torsion_sampler</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">end_pos</span> <span class="o">=</span> <span class="n">start_resnum</span><span class="o">-</span><span class="mi">1</span> <span class="o">+</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">length</span>
+            <span class="n">fragger_list</span> <span class="o">=</span> <span class="n">fragger_handle</span><span class="o">.</span><span class="n">GetList</span><span class="p">(</span><span class="n">start_resnum</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">end_pos</span><span class="p">)</span>
+            <span class="n">mc_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">FragmentSampler</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">,</span> <span class="n">fragger_list</span><span class="p">,</span>
+                                              <span class="n">init_fragments</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+
+        <span class="c"># choose closer</span>
+        <span class="k">if</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">IsNTerminal</span><span class="p">():</span>
+            <span class="n">mc_closer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">NTerminalCloser</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">mc_closer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">CTerminalCloser</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span><span class="p">)</span>
+
+        <span class="c"># setup scorer</span>
+        <span class="n">scorer_weights</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
+        <span class="n">scorer_weights</span><span class="p">[</span><span class="s">&quot;reduced&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">3.0</span>
+        <span class="n">scorer_weights</span><span class="p">[</span><span class="s">&quot;cb_packing&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">2.0</span>
+        <span class="n">scorer_weights</span><span class="p">[</span><span class="s">&quot;hbond&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
+        <span class="n">scorer_weights</span><span class="p">[</span><span class="s">&quot;clash&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.05</span>
+        <span class="n">mc_scorer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LinearScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">,</span> <span class="n">start_resnum</span><span class="p">,</span>
+                                      <span class="n">actual_chain_idx</span><span class="p">,</span> <span class="n">scorer_weights</span><span class="p">)</span>
+
+        <span class="c"># setup cooler</span>
+        <span class="n">start_temperature</span> <span class="o">=</span> <span class="mi">100</span>
+        <span class="n">cooling_factor</span> <span class="o">=</span> <span class="mf">0.9</span>
+        <span class="c"># the number of 109 is roughly the number of times we have to apply</span>
+        <span class="c"># a factor of 0.9 to 100 until it reaches a value of 0.001</span>
+        <span class="n">cooling_interval</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="n">mc_steps</span><span class="o">/</span><span class="mf">109.0</span><span class="p">))</span>
+        <span class="n">mc_cooler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">ExponentialCooler</span><span class="p">(</span><span class="n">cooling_interval</span><span class="p">,</span>
+                                           <span class="n">start_temperature</span><span class="p">,</span>
+                                           <span class="n">cooling_factor</span><span class="p">)</span>
+
+        <span class="c"># try to get loop candidates</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogVerbose</span><span class="p">(</span><span class="s">&quot;Firing MC for &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">))</span>
+        <span class="n">candidates</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoopCandidates</span><span class="o">.</span><span class="n">FillFromMonteCarloSampler</span><span class="p">(</span>
+                <span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">,</span> <span class="n">mc_num_loops</span><span class="p">,</span> <span class="n">mc_steps</span><span class="p">,</span> <span class="n">mc_sampler</span><span class="p">,</span>
+                <span class="n">mc_closer</span><span class="p">,</span> <span class="n">mc_scorer</span><span class="p">,</span> <span class="n">mc_cooler</span><span class="p">)</span>
+
+        <span class="c"># score candidates</span>
+        <span class="n">candidates</span><span class="o">.</span><span class="n">AttachScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">)</span>
+        <span class="n">candidates</span><span class="o">.</span><span class="n">CalculateCombinedScores</span><span class="p">(</span><span class="n">_GetWeights</span><span class="p">(),</span> <span class="n">start_resnum</span><span class="p">,</span>
+                                           <span class="n">actual_chain_idx</span><span class="p">)</span>
+        <span class="c"># get best one</span>
         <span class="n">min_score</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">)</span>
-        <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
-        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">)):</span>
-            <span class="n">score</span> <span class="o">=</span> <span class="mf">0.0</span>
-            <span class="n">score</span> <span class="o">+=</span> <span class="mf">5.0</span><span class="o">*</span><span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">cbeta_score</span>
-            <span class="n">score</span> <span class="o">+=</span> <span class="mf">1.0</span><span class="o">*</span><span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">packing_score</span>
-            <span class="n">score</span> <span class="o">+=</span> <span class="mf">0.2</span><span class="o">*</span><span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">clash_score</span>
-            <span class="n">score</span> <span class="o">+=</span> <span class="mf">0.004</span><span class="o">*</span><span class="n">final_loop_candidates</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">hbond_score</span>
+        <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">for</span> <span class="n">candidate</span> <span class="ow">in</span> <span class="n">candidates</span><span class="p">:</span>
+            <span class="n">score</span> <span class="o">=</span> <span class="n">candidate</span><span class="o">.</span><span class="n">combined_score</span>
             <span class="k">if</span> <span class="n">score</span> <span class="o">&lt;</span> <span class="n">min_score</span><span class="p">:</span>
-                <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="n">i</span>
+                <span class="n">optimal_candidate</span> <span class="o">=</span> <span class="n">candidate</span>
                 <span class="n">min_score</span> <span class="o">=</span> <span class="n">score</span>
-        
+
         <span class="n">ost</span><span class="o">.</span><span class="n">LogVerbose</span><span class="p">(</span><span class="s">&quot;Gap </span><span class="si">%s</span><span class="s"> - </span><span class="si">%d</span><span class="s"> candidates, best (min) score </span><span class="si">%g</span><span class="s">&quot;</span> <span class="o">%</span>
-                       <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">),</span> <span class="n">min_score</span><span class="p">))</span>
+                       <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">),</span> <span class="n">min_score</span><span class="p">))</span>
 
-        <span class="c">##################################</span>
-        <span class="c"># finally resolve loop (NOTE: identical to DB)</span>
-        <span class="c">##################################</span>
-        <span class="k">if</span> <span class="n">optimal_candidate</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
-            <span class="n">idx_a</span> <span class="o">=</span> <span class="n">back_mapper</span><span class="p">[</span><span class="n">optimal_candidate</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
-            <span class="n">idx_b</span> <span class="o">=</span> <span class="n">back_mapper</span><span class="p">[</span><span class="n">optimal_candidate</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
+        <span class="c"># finally resolve loop</span>
+        <span class="k">if</span> <span class="n">optimal_candidate</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
             <span class="c"># update model</span>
-            <span class="n">start_resnum</span> <span class="o">=</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">]</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span>
-            <span class="n">bb_list</span> <span class="o">=</span> <span class="n">actual_candidates</span><span class="p">[</span><span class="n">idx_a</span><span class="p">][</span><span class="n">idx_b</span><span class="p">]</span><span class="o">.</span><span class="n">bb_list</span>
-            <span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">],</span>
-                               <span class="n">start_resnum</span><span class="p">,</span> <span class="n">actual_chain_idx</span><span class="p">)</span>
+            <span class="n">bb_list</span> <span class="o">=</span> <span class="n">optimal_candidate</span><span class="o">.</span><span class="n">bb_list</span>
+            <span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">actual_chain</span><span class="p">,</span> <span class="n">start_resnum</span><span class="p">)</span>
             <span class="c"># update scorer</span>
             <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">start_resnum</span><span class="p">,</span> <span class="n">actual_chain_idx</span><span class="p">)</span>
-            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Resolved </span><span class="si">%s</span><span class="s"> by filling </span><span class="si">%s</span><span class="s"> (</span><span class="si">%d</span><span class="s"> candidates)&quot;</span> <span class="o">%</span> \
-                        <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span>
-                         <span class="nb">str</span><span class="p">(</span><span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">]),</span>
-                         <span class="nb">len</span><span class="p">(</span><span class="n">final_loop_candidates</span><span class="p">)))</span>
-            <span class="c"># will return -1 if last gap removed</span>
-            <span class="n">gap_idx</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">ClearGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_extended_gaps</span><span class="p">[</span><span class="n">idx_a</span><span class="p">])</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Resolved terminal gap </span><span class="si">%s</span><span class="s"> (</span><span class="si">%d</span><span class="s"> candidates)&quot;</span> <span class="o">%</span> \
+                        <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">)))</span>
+            <span class="n">ClearGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">)</span>
         <span class="k">else</span><span class="p">:</span>
-            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed at loop insertion (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">))</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed to model terminal gap (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">))</span>
+            
+</div>
+<div class="viewcode-block" id="CloseLargeDeletions"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.CloseLargeDeletions">[docs]</a><span class="k">def</span> <span class="nf">CloseLargeDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">,</span> <span class="n">linker_length</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span>
+                        <span class="n">num_fragments</span><span class="o">=</span><span class="mi">500</span><span class="p">,</span> <span class="n">use_scoring_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                        <span class="n">use_full_extender</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+
+    <span class="sd">&#39;&#39;&#39;Try to close large deletions.</span>
+
+<span class="sd">    This is meant as a &quot;last-resort&quot; approach. In some cases you cannot </span>
+<span class="sd">    close very large deletions simply because the two parts separated</span>
+<span class="sd">    by a deletion are too far apart. The idea is to sample a linker region</span>
+<span class="sd">    and always move the whole chain towards the n-terminus. </span>
+<span class="sd">    </span>
+<span class="sd">    :param mhandle: Modelling handle on which to apply change.</span>
+<span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
+
+<span class="sd">    :param scorer: A scorer dedicated to this model.</span>
+<span class="sd">                   If gaps are closed, the *scorer* is updated.</span>
+<span class="sd">    :type scorer: :class:`~promod3.loop.BackboneLoopScorer`</span>
+
+<span class="sd">    :param structure_db: The database from which to extract fragments for</span>
+<span class="sd">                         the linker region.</span>
+<span class="sd">    :type structure_db: :class:`~promod3.loop.StructureDB`</span>
+
+<span class="sd">    :param linker_length: Desired length (in residues w/o stems) for the</span>
+<span class="sd">                          linker. This may be shorter if extender cannot</span>
+<span class="sd">                          extend further.</span>
+<span class="sd">    :type linker_length:  :class:`int`</span>
+
+<span class="sd">    :param num_fragments: Number of fragments to sample the linker.</span>
+<span class="sd">    :type num_fragments:  :class:`int`</span>
+
+<span class="sd">    :param use_scoring_extender: True = use :class:`ScoringGapExtender` instead</span>
+<span class="sd">                                 of :class:`GapExtender`.</span>
+<span class="sd">                                 See :func:`CloseSmallDeletions`.</span>
+<span class="sd">    :type use_scoring_extender:  :class:`bool`</span>
+
+<span class="sd">    :param use_full_extender: True = use :class:`FullGapExtender` instead of</span>
+<span class="sd">                              :class:`GapExtender`.</span>
+<span class="sd">                              See :func:`CloseSmallDeletions`.</span>
+<span class="sd">    :type use_full_extender:  :class:`bool`</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to resolve large deletions (</span><span class="si">%d</span><span class="s"> gap(s) left) by &quot;</span>
+                    <span class="s">&quot;sampling a linker region.&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">return</span>
+
+    <span class="c"># point to the current gap</span>
+    <span class="n">gap_idx</span> <span class="o">=</span> <span class="mi">0</span>
+
+    <span class="c"># Iterate all gaps. Since the number of gaps may change, always compare to</span>
+    <span class="c"># an updated list. gap_idx is only increased when necessary, e.g. current</span>
+    <span class="c"># gap could not be removed.</span>
+    <span class="k">while</span> <span class="n">gap_idx</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="ow">and</span> <span class="n">gap_idx</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
+
+        <span class="c"># keep copy of original gap</span>
+        <span class="n">gap_orig</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">gap_idx</span><span class="p">]</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
+        <span class="c"># get chain for gap</span>
+        <span class="n">actual_chain_idx</span> <span class="o">=</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
+        <span class="n">actual_chain</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">]</span>
+        
+        <span class="c"># terminal gaps are not deletions...</span>
+        <span class="k">if</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">IsTerminal</span><span class="p">():</span>
+            <span class="n">gap_idx</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="k">continue</span>
+
+        <span class="c"># check if too long</span>
+        <span class="k">if</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">length</span> <span class="o">&gt;</span> <span class="n">linker_length</span><span class="p">:</span>
             <span class="n">gap_idx</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="k">continue</span>
+
+        <span class="c"># the function only works, if there are no gaps (del. AND insert.)</span>
+        <span class="c"># towards the n-ter in the same chain, except terminal gaps.</span>
+        <span class="n">clean_nter</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">gap_idx</span><span class="p">):</span>
+            <span class="k">if</span> <span class="n">actual_chain_idx</span> <span class="o">==</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">():</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">IsTerminal</span><span class="p">():</span>
+                    <span class="n">clean_nter</span> <span class="o">=</span> <span class="bp">False</span>
+                    <span class="k">break</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">clean_nter</span><span class="p">:</span>
+            <span class="n">gap_idx</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="k">continue</span>
+
+        <span class="c"># extend gap to desired length</span>
+        <span class="n">actual_gap</span> <span class="o">=</span> <span class="n">gap_orig</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
+        <span class="n">actual_extender</span> <span class="o">=</span> <span class="n">_GetGapExtender</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">,</span>
+                                          <span class="n">use_scoring_extender</span><span class="p">,</span>
+                                          <span class="n">use_full_extender</span><span class="p">,</span>
+                                          <span class="n">linker_length</span><span class="p">)</span>
+        <span class="k">while</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">length</span> <span class="o">&lt;</span> <span class="n">linker_length</span><span class="p">:</span>
+            <span class="c"># extend the gap</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">actual_extender</span><span class="o">.</span><span class="n">Extend</span><span class="p">():</span>
+                <span class="k">break</span>
+
+        <span class="c"># FAIL (Fragger needs at least 3 residues)</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">:</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Failed in CloseLargeDeletions (</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">))</span>
+            <span class="n">gap_idx</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="k">continue</span>
+        
+        <span class="c"># extract gap info</span>
+        <span class="n">n_res</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">before</span>
+        <span class="n">c_res</span> <span class="o">=</span> <span class="n">actual_gap</span><span class="o">.</span><span class="n">after</span>
+        <span class="n">n_res_num</span> <span class="o">=</span> <span class="n">n_res</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+        <span class="n">c_res_num</span> <span class="o">=</span> <span class="n">c_res</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+
+        <span class="c"># let&#39;s find fragments!</span>
+        <span class="n">fragger</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">Fragger</span><span class="p">(</span><span class="n">actual_gap</span><span class="o">.</span><span class="n">full_seq</span><span class="p">)</span>
+        <span class="n">seqsim_matrix</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">seq</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">BLOSUM62</span>
+        <span class="n">fragger</span><span class="o">.</span><span class="n">AddSeqSimParameters</span><span class="p">(</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">seqsim_matrix</span><span class="p">)</span>
+        <span class="n">fragger</span><span class="o">.</span><span class="n">Fill</span><span class="p">(</span><span class="n">structure_db</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">,</span> <span class="n">num_fragments</span><span class="p">)</span>
+
+        <span class="c"># We generate two backbonelists based on residues beginning from the </span>
+        <span class="c"># n-terminus:</span>
+        <span class="c"># - bb_list: covers the full thing being sampled (incl. stuff in gap)</span>
+        <span class="c"># - initial_n_ter_bb_list: n-terminal residues before the fragment</span>
+        <span class="c">#                          insertion position</span>
+        <span class="c">#</span>
+        <span class="c"># After having found the ideal fragment, we cannot simply insert it into</span>
+        <span class="c"># the model, since all sidechain information would be lost.</span>
+        <span class="c"># We therefore need the initial_n_ter_bb_list to store the initial</span>
+        <span class="c"># positions. We can then calculate a transformation in the end and </span>
+        <span class="c"># apply it manually in the end for the according atom positions.</span>
+
+        <span class="c"># only put valid residues in bb_seq</span>
+        <span class="n">first_num</span> <span class="o">=</span> <span class="n">actual_chain</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+        <span class="n">bb_seq</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">[</span><span class="n">actual_chain_idx</span><span class="p">][</span><span class="n">first_num</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="n">c_res_num</span><span class="p">]</span>
+        <span class="n">bb_list</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">bb_seq</span><span class="p">)</span>
+        <span class="n">actual_res_num</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">mol</span><span class="o">.</span><span class="n">ResNum</span><span class="p">(</span><span class="n">first_num</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">bb_seq</span><span class="p">)):</span>
+            <span class="n">actual_res</span> <span class="o">=</span> <span class="n">actual_chain</span><span class="o">.</span><span class="n">FindResidue</span><span class="p">(</span><span class="n">actual_res_num</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">actual_res</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
+                <span class="n">bb_list</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">Backbone</span><span class="p">(</span><span class="n">actual_res</span><span class="p">,</span> <span class="n">bb_seq</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+            <span class="n">actual_res_num</span> <span class="o">+=</span> <span class="mi">1</span>
+
+        <span class="c"># define region in fragger and region before</span>
+        <span class="n">frag_start_idx</span> <span class="o">=</span> <span class="n">n_res_num</span> <span class="o">-</span> <span class="n">first_num</span>
+        <span class="n">initial_n_ter_bb_list</span> <span class="o">=</span> <span class="n">bb_list</span><span class="o">.</span><span class="n">Extract</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">frag_start_idx</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
+
+        <span class="c"># all fragments get now sampled and scored</span>
+        <span class="c"># the idea is to sample the fragments by moving the full part towards</span>
+        <span class="c"># the n-terminus</span>
+        <span class="n">best_score</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">)</span>
+        <span class="n">best_idx</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">fragger</span><span class="p">)):</span>
+
+            <span class="n">fragment</span> <span class="o">=</span> <span class="n">fragger</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
+
+            <span class="c"># let&#39;s move the fragment to the right position relative to</span>
+            <span class="c"># bb_list and insert it</span>
+            <span class="n">t</span> <span class="o">=</span> <span class="n">fragment</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetTransform</span><span class="p">(</span><span class="n">bb_list</span><span class="p">[</span><span class="n">frag_start_idx</span><span class="p">])</span>
+            <span class="n">fragment</span><span class="o">.</span><span class="n">ApplyTransform</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
+            <span class="n">bb_list</span><span class="o">.</span><span class="n">ReplaceFragment</span><span class="p">(</span><span class="n">fragger</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">frag_start_idx</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
+
+            <span class="c"># lets transform the overall bb_list to the right position</span>
+            <span class="c"># this represents the full stretch towards the n-terminus</span>
+            <span class="n">t</span> <span class="o">=</span> <span class="n">bb_list</span><span class="p">[</span><span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetTransform</span><span class="p">(</span><span class="n">c_res</span><span class="p">)</span>
+            <span class="n">bb_list</span><span class="o">.</span><span class="n">ApplyTransform</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
+
+            <span class="c"># a simple score gets calculated and best chosen</span>
+            <span class="n">score</span> <span class="o">=</span> <span class="n">scorer</span><span class="o">.</span><span class="n">CalculateReducedScore</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">first_num</span><span class="p">,</span>
+                                                 <span class="n">actual_chain_idx</span><span class="p">)</span>
+            <span class="n">score</span> <span class="o">+=</span> <span class="n">scorer</span><span class="o">.</span><span class="n">CalculateClashScore</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">first_num</span><span class="p">,</span>
+                                                <span class="n">actual_chain_idx</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">score</span> <span class="o">&lt;</span> <span class="n">best_score</span><span class="p">:</span>
+                <span class="n">best_score</span> <span class="o">=</span> <span class="n">score</span>
+                <span class="n">best_idx</span> <span class="o">=</span> <span class="n">i</span>
+
+        <span class="c"># set best fragment into bb_list (need to reapply transforms)</span>
+        <span class="n">fragment</span> <span class="o">=</span> <span class="n">fragger</span><span class="p">[</span><span class="n">best_idx</span><span class="p">]</span>
+        <span class="n">t</span> <span class="o">=</span> <span class="n">fragment</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetTransform</span><span class="p">(</span><span class="n">bb_list</span><span class="p">[</span><span class="n">frag_start_idx</span><span class="p">])</span>
+        <span class="n">fragment</span><span class="o">.</span><span class="n">ApplyTransform</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
+        <span class="n">bb_list</span><span class="o">.</span><span class="n">ReplaceFragment</span><span class="p">(</span><span class="n">fragment</span><span class="p">,</span> <span class="n">frag_start_idx</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
+        <span class="c"># lets transform the overall bb_list to the right position</span>
+        <span class="n">t</span> <span class="o">=</span> <span class="n">bb_list</span><span class="p">[</span><span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetTransform</span><span class="p">(</span><span class="n">c_res</span><span class="p">)</span>
+        <span class="n">bb_list</span><span class="o">.</span><span class="n">ApplyTransform</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
+
+        <span class="c"># We finally calculate the transformation from the initial positions</span>
+        <span class="c"># of all residues towards the n-terminus and apply it manually.</span>
+        <span class="c"># this is done to not loose all the sidechain information</span>
+        <span class="n">n_ter_bb_list</span> <span class="o">=</span> <span class="n">bb_list</span><span class="o">.</span><span class="n">Extract</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">frag_start_idx</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">t</span> <span class="o">=</span> <span class="n">initial_n_ter_bb_list</span><span class="o">.</span><span class="n">GetTransform</span><span class="p">(</span><span class="n">n_ter_bb_list</span><span class="p">)</span>
+        <span class="n">ed</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">EditXCS</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">actual_chain</span><span class="o">.</span><span class="n">residues</span><span class="p">[:</span><span class="n">frag_start_idx</span><span class="p">]:</span>
+            <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">r</span><span class="o">.</span><span class="n">atoms</span><span class="p">:</span>
+                <span class="n">new_pos</span> <span class="o">=</span> <span class="n">t</span> <span class="o">*</span> <span class="n">ost</span><span class="o">.</span><span class="n">geom</span><span class="o">.</span><span class="n">Vec4</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">GetPos</span><span class="p">())</span>
+                <span class="n">ed</span><span class="o">.</span><span class="n">SetAtomPos</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">ost</span><span class="o">.</span><span class="n">geom</span><span class="o">.</span><span class="n">Vec3</span><span class="p">(</span><span class="n">new_pos</span><span class="p">))</span>
+
+        <span class="c"># replace fragment part</span>
+        <span class="n">fragment</span> <span class="o">=</span> <span class="n">bb_list</span><span class="o">.</span><span class="n">Extract</span><span class="p">(</span><span class="n">frag_start_idx</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">))</span>
+        <span class="n">fragment</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">actual_chain</span><span class="p">,</span> <span class="n">n_res_num</span><span class="p">)</span>
+
+        <span class="c"># update scorer</span>
+        <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">first_num</span><span class="p">,</span> <span class="n">actual_chain_idx</span><span class="p">)</span>
+        <span class="c"># will return -1 if last gap removed</span>
+        <span class="n">gap_idx</span> <span class="o">=</span> <span class="n">ClearGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">actual_gap</span><span class="p">)</span>
+
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Resolved </span><span class="si">%s</span><span class="s"> by sampling </span><span class="si">%s</span><span class="s"> as linker&quot;</span> <span class="o">%</span> \
+                    <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">gap_orig</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">actual_gap</span><span class="p">)))</span>
+        
 
 <span class="c"># these methods will be exported into module</span></div>
 <span class="n">__all__</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;SetupBackboneScorer&#39;</span><span class="p">,</span> <span class="s">&#39;CloseSmallDeletions&#39;</span><span class="p">,</span> <span class="s">&#39;MergeGapsByDistance&#39;</span><span class="p">,</span>
-           <span class="s">&#39;FillLoopsByDatabase&#39;</span><span class="p">,</span> <span class="s">&#39;FillLoopsByMonteCarlo&#39;</span><span class="p">)</span>
+           <span class="s">&#39;FillLoopsByDatabase&#39;</span><span class="p">,</span> <span class="s">&#39;FillLoopsByMonteCarlo&#39;</span><span class="p">,</span> <span class="s">&#39;ModelTermini&#39;</span><span class="p">,</span>
+           <span class="s">&#39;CloseLargeDeletions&#39;</span><span class="p">)</span>
 
 <span class="c">#  LocalWords:  modeling stereochemically param idx init</span>
-<span class="c">#  LocalWords:  py ost pylint modelling promod CloseSmallDeletions testcode</span>
+<span class="c">#  LocalWords:  py ost pylint modelling promod CloseSmallDeletions</span>
 <span class="c">#  LocalWords:  fillloopsbydb tpl aln trg TLNGFTVPAGNTLV LNPDKGATVTMA mhandle</span>
 <span class="c">#  LocalWords:  NGGTLLIPNGTYHFLGIQMKSNVHIRVE AttachView CreateFullView len</span>
-<span class="c">#  LocalWords:  BuildRawModel SetupBackboneScorer FillLoopsByDatabase doctest</span>
+<span class="c">#  LocalWords:  BuildRawModel SetupBackboneScorer FillLoopsByDatabase</span>
 <span class="c">#  LocalWords:  LoadFragDB LoadStructureDB LoadTorsionSamplerCoil dbs fasta</span>
 <span class="c">#  LocalWords:  rtype</span>
 </pre></div>
@@ -890,7 +1274,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/_modules/promod3/modelling/_pipeline.html b/doc/html/_modules/promod3/modelling/_pipeline.html
index 863fb5582feaa041ef2f61e8b04f4a207949b48f..d77b0865372553a79445fe8476d929d33feb23d0 100644
--- a/doc/html/_modules/promod3/modelling/_pipeline.html
+++ b/doc/html/_modules/promod3/modelling/_pipeline.html
@@ -43,46 +43,105 @@
 <span class="sd">as argument.</span>
 <span class="sd">&#39;&#39;&#39;</span>
 
-<span class="kn">import</span> <span class="nn">ost</span>
-<span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">mol</span><span class="p">,</span><span class="n">conop</span>
-<span class="kn">from</span> <span class="nn">ost.mol</span> <span class="kn">import</span> <span class="n">mm</span>
+<span class="c"># internal</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">sidechain</span>
-<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">_modelling</span>
-<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">_closegaps</span>
+<span class="kn">from</span> <span class="nn">_modelling</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="kn">from</span> <span class="nn">_closegaps</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="kn">from</span> <span class="nn">_ring_punches</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="c"># external</span>
+<span class="kn">import</span> <span class="nn">ost</span>
+<span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">mol</span>
+<span class="kn">from</span> <span class="nn">ost.mol</span> <span class="kn">import</span> <span class="n">mm</span>
+<span class="kn">import</span> <span class="nn">os</span>
 
-<div class="viewcode-block" id="BuildSidechains"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.BuildSidechains">[docs]</a><span class="k">def</span> <span class="nf">BuildSidechains</span><span class="p">(</span><span class="n">mhandle</span><span class="p">):</span>
+<div class="viewcode-block" id="BuildSidechains"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.BuildSidechains">[docs]</a><span class="k">def</span> <span class="nf">BuildSidechains</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">merge_distance</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="n">scorer</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">fragment_db</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                    <span class="n">structure_db</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
     <span class="sd">&#39;&#39;&#39;Build sidechains for model.</span>
 
-<span class="sd">    This is esentially a wrapper for :func:`promod3.sidechain.Reconstruct`.</span>
+<span class="sd">    This is a wrapper for :func:`promod3.sidechain.Reconstruct`, followed</span>
+<span class="sd">    by a check for ring punches. If ring punches are found it introduces gaps</span>
+<span class="sd">    for the residues with punched rings and tries to fill them with </span>
+<span class="sd">    :func:`FillLoopsByDatabase` with *ring_punch_detection=2*.</span>
 
 <span class="sd">    :param mhandle: Modelling handle on which to apply change.</span>
 <span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
+
+<span class="sd">    :param merge_distance:  Used as parameter for :func:`MergeGapsByDistance`</span>
+<span class="sd">                            if ring punches are found.</span>
+<span class="sd">    :type merge_distance:   :class:`int`</span>
+<span class="sd">    :param scorer:          Used as parameter for :func:`FillLoopsByDatabase`</span>
+<span class="sd">                            if ring punches are found. A default one is created</span>
+<span class="sd">                            if None.</span>
+<span class="sd">    :type scorer:           :class:`~promod3.loop.BackboneLoopScorer`</span>
+<span class="sd">    :param fragment_db:     Used as parameter for :func:`FillLoopsByDatabase`</span>
+<span class="sd">                            if ring punches are found. A default one is loaded</span>
+<span class="sd">                            if None.</span>
+<span class="sd">    :type fragment_db:      :class:`~promod3.loop.FragDB`</span>
+<span class="sd">    :param structure_db:    Used as parameter for :func:`FillLoopsByDatabase`</span>
+<span class="sd">                            if ring punches are found. A default one is loaded</span>
+<span class="sd">                            if None.</span>
+<span class="sd">    :type structure_db:     :class:`~promod3.loop.StructureDB`</span>
+<span class="sd">    :param torsion_sampler: Used as parameter for :func:`FillLoopsByDatabase`</span>
+<span class="sd">                            if ring punches are found. A default one is loaded</span>
+<span class="sd">                            if None.</span>
+<span class="sd">    :type torsion_sampler:  :class:`~promod3.loop.TorsionSampler`</span>
 <span class="sd">    &#39;&#39;&#39;</span>
-    <span class="c"># assign torsion handles (TO BE REMOVED)</span>
-    <span class="n">proc</span> <span class="o">=</span> <span class="n">conop</span><span class="o">.</span><span class="n">HeuristicProcessor</span><span class="p">(</span><span class="bp">False</span><span class="p">,</span><span class="bp">True</span><span class="p">,</span><span class="bp">True</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span>
-    <span class="n">proc</span><span class="o">.</span><span class="n">Process</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
-    <span class="c"># reconstruct the sidechains</span>
+    <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Rebuilding sidechains.&quot;</span><span class="p">)</span>
     <span class="n">sidechain</span><span class="o">.</span><span class="n">Reconstruct</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">keep_sidechains</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
-    <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">CreateEntityFromView</span><span class="p">(</span>\
-                            <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;peptide=true and ele!=H&quot;</span><span class="p">),</span>
-                            <span class="bp">True</span><span class="p">)</span>
+    <span class="c"># check for ring punches</span>
+    <span class="n">rings</span> <span class="o">=</span> <span class="n">GetRings</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+    <span class="n">ring_punches</span> <span class="o">=</span> <span class="n">GetRingPunches</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+    <span class="c"># try to fix them</span>
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">ring_punches</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to fix </span><span class="si">%d</span><span class="s"> ring punch(es).&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">ring_punches</span><span class="p">))</span>
+        <span class="c"># backup old gaps</span>
+        <span class="n">old_gaps</span> <span class="o">=</span> <span class="p">[</span><span class="n">g</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">]</span>
+        <span class="c"># new gaps for mhandle</span>
+        <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span> <span class="o">=</span> <span class="n">StructuralGapList</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">res</span> <span class="ow">in</span> <span class="n">ring_punches</span><span class="p">:</span>
+            <span class="n">mygap</span> <span class="o">=</span> <span class="n">StructuralGap</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">prev</span><span class="p">,</span> <span class="n">res</span><span class="o">.</span><span class="n">next</span><span class="p">,</span> <span class="n">res</span><span class="o">.</span><span class="n">one_letter_code</span><span class="p">)</span>
+            <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mygap</span><span class="p">)</span>
+        <span class="c"># load stuff if needed</span>
+        <span class="k">if</span> <span class="n">scorer</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">scorer</span> <span class="o">=</span> <span class="n">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">fragment_db</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">fragment_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadFragDB</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">structure_db</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">structure_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadStructureDB</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">torsion_sampler</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">torsion_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSamplerCoil</span><span class="p">()</span>
+        <span class="c"># fix it</span>
+        <span class="n">MergeGapsByDistance</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">merge_distance</span><span class="p">)</span>
+        <span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">,</span>
+                            <span class="n">torsion_sampler</span><span class="p">,</span> <span class="n">ring_punch_detection</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
+        <span class="c"># re-build sidechains</span>
+        <span class="n">sidechain</span><span class="o">.</span><span class="n">Reconstruct</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">keep_sidechains</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c"># restore gaps</span>
+        <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span> <span class="o">=</span> <span class="n">StructuralGapList</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">old_gaps</span><span class="p">:</span>
+            <span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">g</span><span class="p">)</span>
+            
 </div>
-<div class="viewcode-block" id="MinimizeModelEnergy"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.MinimizeModelEnergy">[docs]</a><span class="k">def</span> <span class="nf">MinimizeModelEnergy</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">max_iterations</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">max_iter_sd</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span> 
-                        <span class="n">max_iter_lbfgs</span><span class="o">=</span><span class="mi">20</span><span class="p">):</span>
+<div class="viewcode-block" id="MinimizeModelEnergy"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.MinimizeModelEnergy">[docs]</a><span class="k">def</span> <span class="nf">MinimizeModelEnergy</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">max_iterations</span><span class="o">=</span><span class="mi">12</span><span class="p">,</span> <span class="n">max_iter_sd</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span>
+                        <span class="n">max_iter_lbfgs</span><span class="o">=</span><span class="mi">10</span><span class="p">):</span>
     <span class="sd">&#39;&#39;&#39;Minimize energy of final model using molecular mechanics.</span>
 
 <span class="sd">    Uses :mod:`ost.mol.mm` to perform energy minimization.</span>
 <span class="sd">    It will iteratively (at most *max_iterations* times):</span>
 <span class="sd">    </span>
-<span class="sd">    - run up to *max_iter_sd* minimization iterations of a steepest descend method</span>
-<span class="sd">    - run up to *max_iter_lbfgs* minimization iterations of a Limited-memory </span>
+<span class="sd">    - run up to *max_iter_sd* minimization iter. of a steepest descend method</span>
+<span class="sd">    - run up to *max_iter_lbfgs* minimization iter. of a Limited-memory </span>
 <span class="sd">      Broyden-Fletcher-Goldfarb-Shanno method</span>
 <span class="sd">    - abort if no stereochemical problems found</span>
 
 <span class="sd">    The idea is that we don&#39;t want to minimize &quot;too much&quot;. So, we iteratively</span>
 <span class="sd">    minimize until there are no stereochemical problems and not more.</span>
 
+<span class="sd">    To speed things up, this can run on multiple CPU threads by setting the</span>
+<span class="sd">    env. variable ``PM3_OPENMM_CPU_THREADS`` to the number of desired threads.</span>
+<span class="sd">    If the variable is not set, 1 thread will be used by default.</span>
+
 <span class="sd">    :param mhandle: Modelling handle on which to apply change.</span>
 <span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
 
@@ -95,15 +154,30 @@
 <span class="sd">    :param max_iter_lbfgs: Max. number of iterations within LBFGS method</span>
 <span class="sd">    :type max_iter_lbfgs:  :class:`int`</span>
 <span class="sd">    &#39;&#39;&#39;</span>
+    <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Minimize energy.&quot;</span><span class="p">)</span>
+    <span class="c"># ignore LogInfo in stereochemical problems if output up to info done</span>
+    <span class="n">ignore_stereo_log</span> <span class="o">=</span> <span class="p">(</span><span class="n">ost</span><span class="o">.</span><span class="n">GetVerbosityLevel</span><span class="p">()</span> <span class="o">==</span> <span class="mi">3</span><span class="p">)</span>
     <span class="c"># setup mm simulation</span>
     <span class="n">settings</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">Settings</span><span class="p">()</span>
     <span class="n">settings</span><span class="o">.</span><span class="n">integrator</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">LangevinIntegrator</span><span class="p">(</span><span class="mi">310</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">0.002</span><span class="p">)</span>
     <span class="n">settings</span><span class="o">.</span><span class="n">init_temperature</span> <span class="o">=</span> <span class="mi">0</span>
     <span class="n">settings</span><span class="o">.</span><span class="n">forcefield</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">LoadCHARMMForcefield</span><span class="p">()</span>
-    <span class="n">settings</span><span class="o">.</span><span class="n">platform</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">Platform</span><span class="o">.</span><span class="n">Reference</span>
     <span class="n">settings</span><span class="o">.</span><span class="n">nonbonded_method</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">NonbondedMethod</span><span class="o">.</span><span class="n">CutoffNonPeriodic</span>
     <span class="n">settings</span><span class="o">.</span><span class="n">keep_ff_specific_naming</span> <span class="o">=</span> <span class="bp">False</span>
-    <span class="n">sim</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">Simulation</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span><span class="n">settings</span><span class="p">)</span>
+    <span class="c"># use fast CPU platform by default</span>
+    <span class="n">settings</span><span class="o">.</span><span class="n">platform</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">Platform</span><span class="o">.</span><span class="n">CPU</span>
+    <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s">&#39;PM3_OPENMM_CPU_THREADS&#39;</span><span class="p">)</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">settings</span><span class="o">.</span><span class="n">cpu_properties</span><span class="p">[</span><span class="s">&quot;CpuThreads&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;1&quot;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="n">settings</span><span class="o">.</span><span class="n">cpu_properties</span><span class="p">[</span><span class="s">&quot;CpuThreads&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s">&#39;PM3_OPENMM_CPU_THREADS&#39;</span><span class="p">)</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">sim</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">Simulation</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">settings</span><span class="p">)</span>
+    <span class="k">except</span> <span class="ne">RuntimeError</span> <span class="k">as</span> <span class="n">ex</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogWarning</span><span class="p">(</span><span class="s">&quot;OpenMM failed to initialize with error: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">ex</span><span class="p">))</span>
+        <span class="c"># switch to &quot;mm.Platform.Reference&quot; as fallback</span>
+        <span class="n">settings</span><span class="o">.</span><span class="n">platform</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">Platform</span><span class="o">.</span><span class="n">Reference</span>
+        <span class="n">sim</span> <span class="o">=</span> <span class="n">mm</span><span class="o">.</span><span class="n">Simulation</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">settings</span><span class="p">)</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogWarning</span><span class="p">(</span><span class="s">&quot;Switched to slower reference platform of OpenMM!&quot;</span><span class="p">)</span>
     <span class="c"># settings to check for stereochemical problems</span>
     <span class="n">clashing_distances</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">DefaultClashingDistances</span><span class="p">()</span>
     <span class="n">bond_stereo_chemical_param</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">DefaultBondStereoChemicalParams</span><span class="p">()</span>
@@ -117,6 +191,8 @@
         <span class="n">sim</span><span class="o">.</span><span class="n">UpdatePositions</span><span class="p">()</span>
 
         <span class="c"># check for stereochemical problems</span>
+        <span class="k">if</span> <span class="n">ignore_stereo_log</span><span class="p">:</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">PushVerbosityLevel</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
         <span class="n">temp_ent</span> <span class="o">=</span> <span class="n">sim</span><span class="o">.</span><span class="n">GetEntity</span><span class="p">()</span>
         <span class="n">temp_ent</span> <span class="o">=</span> <span class="n">temp_ent</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;aname!=OXT&quot;</span><span class="p">)</span>
         <span class="n">temp_ent_clash_filtered</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">FilterClashes</span><span class="p">(</span>\
@@ -127,10 +203,15 @@
                                                 <span class="n">bond_stereo_chemical_param</span><span class="p">,</span>
                                                 <span class="n">angle_stereo_chemical_param</span><span class="p">,</span> 
                                                 <span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">ignore_stereo_log</span><span class="p">:</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">PopVerbosityLevel</span><span class="p">()</span>
         <span class="c"># checks above would remove bad atoms</span>
         <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">temp_ent_stereo_checked</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;ele!=H&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">atoms</span><span class="p">)</span> \
            <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">temp_ent</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;ele!=H&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">atoms</span><span class="p">):</span>
             <span class="k">break</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Stereo-chemical problems found, need more energy&quot;</span>
+                        <span class="o">+</span> <span class="s">&quot; minimization (iteration </span><span class="si">%d</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">))</span>
 
     <span class="c"># update model</span>
     <span class="n">simulation_ent</span> <span class="o">=</span> <span class="n">sim</span><span class="o">.</span><span class="n">GetEntity</span><span class="p">()</span>
@@ -138,49 +219,84 @@
                             <span class="n">simulation_ent</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;peptide=true and ele!=H&quot;</span><span class="p">),</span>
                             <span class="bp">True</span><span class="p">)</span>
 </div>
-<div class="viewcode-block" id="BuildFromRawModel"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.BuildFromRawModel">[docs]</a><span class="k">def</span> <span class="nf">BuildFromRawModel</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">fragment_db</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">structure_db</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
-                      <span class="n">torsion_sampler</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">merge_distance</span><span class="o">=</span><span class="mi">4</span><span class="p">):</span>
-    <span class="sd">&#39;&#39;&#39;Build a model starting with a raw model (see :func:`BuildRawModel`).</span>
+<div class="viewcode-block" id="CheckFinalModel"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.CheckFinalModel">[docs]</a><span class="k">def</span> <span class="nf">CheckFinalModel</span><span class="p">(</span><span class="n">mhandle</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Performs samity checks on final models and reports problems.</span>
 <span class="sd">    </span>
-<span class="sd">    This function will:</span>
-
-<span class="sd">    #. close small deletions and remove terminal gaps</span>
-<span class="sd">       (see :func:`CloseSmallDeletions` and :func:`RemoveTerminalGaps`)</span>
-<span class="sd">    #. iteratively: merge gaps of distance i and fill loops by database</span>
-<span class="sd">       (i from 0 to *merge_distance*-1)</span>
-<span class="sd">       (see :func:`MergeGapsByDistance` and :func:`FillLoopsByDatabase`)</span>
-<span class="sd">    #. close remaining gaps by Monte Carlo</span>
-<span class="sd">       (see :func:`FillLoopsByMonteCarlo`)</span>
-<span class="sd">    #. build sidechains</span>
-<span class="sd">       (see :func:`BuildSidechains`)</span>
-<span class="sd">    #. minimize energy for the final model, which is then returned</span>
-<span class="sd">       (see :func:`MinimizeModelEnergy`)</span>
-
-<span class="sd">    If function fails to close all gaps, it will produce a warning and return</span>
-<span class="sd">    an incomplete model.</span>
-
-<span class="sd">    :param mhandle: The prepared template coordinates loaded with the input</span>
-<span class="sd">                    alignment.</span>
-<span class="sd">    :type mhandle:  :class:`~promod3.modelling.ModellingHandle`</span>
-
-<span class="sd">    :param fragment_db: A fragment database coupled to the *structure_db*.</span>
-<span class="sd">                        Loads the default one shipped with |project| if omitted.</span>
-<span class="sd">    :type fragment_db: :class:`~promod3.loop.FragDB`</span>
+<span class="sd">    :param mhandle: Modelling handle for which to perform checks.</span>
+<span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="c"># report incomplete models</span>
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogWarning</span><span class="p">(</span><span class="s">&quot;Failed to close </span><span class="si">%d</span><span class="s"> gap(s). Returning incomplete model!&quot;</span> <span class="o">%</span> \
+                            <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="c"># check sequences</span>
+        <span class="k">for</span> <span class="n">chain</span><span class="p">,</span> <span class="n">seq</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">chains</span><span class="p">,</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">seqres</span><span class="p">):</span>
+            <span class="n">a</span> <span class="o">=</span> <span class="n">chain</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+            <span class="n">b</span> <span class="o">=</span> <span class="n">chain</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span><span class="o">.</span><span class="n">GetNum</span><span class="p">()</span>
+            <span class="n">expected_seq</span> <span class="o">=</span> <span class="n">seq</span><span class="p">[</span><span class="n">a</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="n">b</span><span class="p">]</span>
+            <span class="n">actual_seq</span> <span class="o">=</span> <span class="s">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">chain</span><span class="o">.</span><span class="n">residues</span><span class="p">])</span>
+            <span class="k">if</span> <span class="n">expected_seq</span> <span class="o">!=</span> <span class="n">actual_seq</span><span class="p">:</span>
+                <span class="n">ost</span><span class="o">.</span><span class="n">LogWarning</span><span class="p">(</span><span class="s">&quot;Sequence mismatch in chain </span><span class="si">%s</span><span class="s">!&quot;</span>\
+                               <span class="s">&quot; Expected &#39;</span><span class="si">%s</span><span class="s">&#39;. Got &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> \
+                               <span class="o">%</span> <span class="p">(</span><span class="n">chain</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">expected_seq</span><span class="p">,</span> <span class="n">actual_seq</span><span class="p">))</span>
+    
+    <span class="c"># report ring punchings</span>
+    <span class="n">rings</span> <span class="o">=</span> <span class="n">GetRings</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+    <span class="n">ring_punches</span> <span class="o">=</span> <span class="n">GetRingPunches</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">res</span> <span class="ow">in</span> <span class="n">ring_punches</span><span class="p">:</span>
+        <span class="n">ost</span><span class="o">.</span><span class="n">LogWarning</span><span class="p">(</span><span class="s">&quot;Ring of &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">res</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; has been punched!&quot;</span><span class="p">)</span>
+    
+    <span class="c"># report stereo-chemical problems</span>
+    <span class="n">ost</span><span class="o">.</span><span class="n">PushVerbosityLevel</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+    <span class="n">clashing_distances</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">DefaultClashingDistances</span><span class="p">()</span>
+    <span class="n">bond_stereo_chemical_param</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">DefaultBondStereoChemicalParams</span><span class="p">()</span>
+    <span class="n">angle_stereo_chemical_param</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">DefaultAngleStereoChemicalParams</span><span class="p">()</span>
+    <span class="c"># extract problems</span>
+    <span class="n">model_src</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;aname!=OXT&quot;</span><span class="p">)</span>
+    <span class="n">clash_info</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">FilterClashes</span><span class="p">(</span><span class="n">model_src</span><span class="p">,</span> <span class="n">clashing_distances</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
+    <span class="c"># note: 10,10 parameters below are hard coded bond-/angle-tolerances</span>
+    <span class="n">stereo_info</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">CheckStereoChemistry</span><span class="p">(</span><span class="n">model_src</span><span class="p">,</span>
+                                               <span class="n">bond_stereo_chemical_param</span><span class="p">,</span>
+                                               <span class="n">angle_stereo_chemical_param</span><span class="p">,</span>
+                                               <span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
+    <span class="n">ost</span><span class="o">.</span><span class="n">PopVerbosityLevel</span><span class="p">()</span>
+    <span class="c"># set bool props in model-residues</span>
+    <span class="n">atoms</span> <span class="o">=</span> <span class="p">[</span><span class="n">e</span><span class="o">.</span><span class="n">GetFirstAtom</span><span class="p">()</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">clash_info</span><span class="o">.</span><span class="n">GetClashList</span><span class="p">()]</span>\
+          <span class="o">+</span> <span class="p">[</span><span class="n">e</span><span class="o">.</span><span class="n">GetFirstAtom</span><span class="p">()</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">stereo_info</span><span class="o">.</span><span class="n">GetBondViolationList</span><span class="p">()]</span>\
+          <span class="o">+</span> <span class="p">[</span><span class="n">e</span><span class="o">.</span><span class="n">GetSecondAtom</span><span class="p">()</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">stereo_info</span><span class="o">.</span><span class="n">GetAngleViolationList</span><span class="p">()]</span>
+    <span class="k">for</span> <span class="n">atomui</span> <span class="ow">in</span> <span class="n">atoms</span><span class="p">:</span>
+        <span class="n">res</span> <span class="o">=</span> <span class="n">model_src</span><span class="o">.</span><span class="n">FindResidue</span><span class="p">(</span><span class="n">atomui</span><span class="o">.</span><span class="n">GetChainName</span><span class="p">(),</span> <span class="n">atomui</span><span class="o">.</span><span class="n">GetResNum</span><span class="p">())</span>
+        <span class="n">res</span><span class="o">.</span><span class="n">SetBoolProp</span><span class="p">(</span><span class="s">&quot;stereo_chemical_problem&quot;</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">atomui</span><span class="o">.</span><span class="n">GetAtomName</span><span class="p">()</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&quot;CA&quot;</span><span class="p">,</span> <span class="s">&quot;N&quot;</span><span class="p">,</span> <span class="s">&quot;O&quot;</span><span class="p">,</span> <span class="s">&quot;C&quot;</span><span class="p">]:</span>
+            <span class="n">res</span><span class="o">.</span><span class="n">SetBoolProp</span><span class="p">(</span><span class="s">&quot;stereo_chemical_problem_backbone&quot;</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
+    <span class="c"># report bad residues</span>
+    <span class="k">for</span> <span class="n">res</span> <span class="ow">in</span> <span class="n">model_src</span><span class="o">.</span><span class="n">residues</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">res</span><span class="o">.</span><span class="n">HasProp</span><span class="p">(</span><span class="s">&quot;stereo_chemical_problem_backbone&quot;</span><span class="p">)</span> <span class="ow">and</span>\
+           <span class="n">res</span><span class="o">.</span><span class="n">GetBoolProp</span><span class="p">(</span><span class="s">&quot;stereo_chemical_problem_backbone&quot;</span><span class="p">):</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Stereo-chemical problem in backbone &quot;</span> <span class="o">+</span> \
+                        <span class="s">&quot;of residue &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">res</span><span class="p">))</span>
+        <span class="k">elif</span> <span class="n">res</span><span class="o">.</span><span class="n">HasProp</span><span class="p">(</span><span class="s">&quot;stereo_chemical_problem&quot;</span><span class="p">)</span> <span class="ow">and</span>\
+             <span class="n">res</span><span class="o">.</span><span class="n">GetBoolProp</span><span class="p">(</span><span class="s">&quot;stereo_chemical_problem&quot;</span><span class="p">):</span>
+            <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Stereo-chemical problem in sidechain &quot;</span> <span class="o">+</span> \
+                        <span class="s">&quot;of residue &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">res</span><span class="p">))</span>
+</div>
+<div class="viewcode-block" id="BuildFromRawModel"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.BuildFromRawModel">[docs]</a><span class="k">def</span> <span class="nf">BuildFromRawModel</span><span class="p">(</span><span class="n">mhandle</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Build a model starting with a raw model (see :func:`BuildRawModel`).</span>
 
-<span class="sd">    :param structure_db: The structural database. Loads the default one shipped</span>
-<span class="sd">                         with |project| if omitted.</span>
-<span class="sd">    :type structure_db: :class:`~promod3.loop.StructureDB`</span>
+<span class="sd">    This function implements a recommended pipeline to generate complete models</span>
+<span class="sd">    from a raw model. The steps are shown in detail in the code example</span>
+<span class="sd">    :ref:`above &lt;modelling_steps_example&gt;`. If you wish to use your own</span>
+<span class="sd">    pipeline, you can use that code as a starting point for your own custom</span>
+<span class="sd">    modelling pipeline. For reproducibility, we recommend that you keep copies</span>
+<span class="sd">    of custom pipelines. </span>
 
-<span class="sd">    :param torsion_sampler: A sampler for torsion angles. Loads the default one</span>
-<span class="sd">                            shipped with |project| if omitted.</span>
-<span class="sd">    :type torsion_sampler: :class:`~promod3.loop.TorsionSampler`</span>
+<span class="sd">    If the function fails to close all gaps, it will produce a warning and</span>
+<span class="sd">    return an incomplete model.</span>
 
-<span class="sd">    :param merge_distance: Maximal distance up to which 2 gaps are merged. The</span>
-<span class="sd">                           gaps need to be immediate neighbours, distance is</span>
-<span class="sd">                           counted by residues, including stems. So **A-A-A**</span>
-<span class="sd">                           have a distance of 0 and therefore merging is only</span>
-<span class="sd">                           applied until *merge_distance* - 1.</span>
-<span class="sd">    :type merge_distance: :class:`int`</span>
+<span class="sd">    :param mhandle: The prepared template coordinates loaded with the input</span>
+<span class="sd">                    alignment.</span>
+<span class="sd">    :type mhandle:  :class:`ModellingHandle`</span>
 
 <span class="sd">    :return: Delivers the model as an |ost_s| entity.</span>
 <span class="sd">    :rtype: :class:`Entity &lt;ost.mol.EntityHandle&gt;`</span>
@@ -188,62 +304,48 @@
     <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Starting modelling based on a raw model.&quot;</span><span class="p">)</span>
 
     <span class="c"># a bit of setup</span>
-    <span class="k">if</span> <span class="n">fragment_db</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
-        <span class="n">fragment_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadFragDB</span><span class="p">()</span>
-    <span class="k">if</span> <span class="n">structure_db</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
-        <span class="n">structure_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadStructureDB</span><span class="p">()</span>
-    <span class="k">if</span> <span class="n">torsion_sampler</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
-        <span class="n">torsion_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSamplerCoil</span><span class="p">()</span>
-
-    <span class="n">scorer</span> <span class="o">=</span> <span class="n">_closegaps</span><span class="o">.</span><span class="n">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
-
-    <span class="c"># step 1a: close small deletions in the raw model</span>
-    <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to close small deletions (no. of gaps: </span><span class="si">%d</span><span class="s">).&quot;</span> <span class="o">%</span> \
-                   <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
-    <span class="n">_closegaps</span><span class="o">.</span><span class="n">CloseSmallDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">)</span>
-    
-    <span class="c"># step 1b: remove terminal gaps since we cannot deal with them below</span>
-    <span class="n">num_gaps_removed</span> <span class="o">=</span> <span class="n">_modelling</span><span class="o">.</span><span class="n">RemoveTerminalGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
-    <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Removed </span><span class="si">%d</span><span class="s"> terminal gaps.&quot;</span> <span class="o">%</span> <span class="n">num_gaps_removed</span><span class="p">)</span>
-
-    <span class="c"># step 2: simple handling of further gaps: merge, then fill from db</span>
-    <span class="k">for</span> <span class="n">distance</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">merge_distance</span><span class="p">):</span>
-        <span class="c"># step 2a: Combine gaps living close to each other</span>
-        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to merge </span><span class="si">%d</span><span class="s"> gap(s) with distance </span><span class="si">%d</span><span class="s">.&quot;</span> <span class="o">%</span> \
-                       <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">),</span> <span class="n">distance</span><span class="p">))</span>
-        <span class="n">_closegaps</span><span class="o">.</span><span class="n">MergeGapsByDistance</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">distance</span><span class="p">)</span>
-        <span class="c"># step 2b: fit loops into the model</span>
-        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to fill </span><span class="si">%d</span><span class="s"> gap(s) by database.&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
-        <span class="n">_closegaps</span><span class="o">.</span><span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span>
-                                       <span class="n">structure_db</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">)</span>
-        <span class="c"># check if we can abort</span>
-        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%d</span><span class="s"> gap(s) left after database search.&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
-        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
-            <span class="k">break</span>
+    <span class="n">fragment_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadFragDB</span><span class="p">()</span>
+    <span class="n">structure_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadStructureDB</span><span class="p">()</span>
+    <span class="n">torsion_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSamplerCoil</span><span class="p">()</span>
+    <span class="n">merge_distance</span> <span class="o">=</span> <span class="mi">4</span>
 
-    <span class="c"># step 3: close remaining gaps by Monte Carlo</span>
-    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
-        <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Trying to fill </span><span class="si">%d</span><span class="s"> gap(s) by Monte Carlo.&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
-        <span class="n">_closegaps</span><span class="o">.</span><span class="n">FillLoopsByMonteCarlo</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">)</span>
+    <span class="n">scorer</span> <span class="o">=</span> <span class="n">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
 
-    <span class="c"># check if we succeeded</span>
-    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
-        <span class="n">ost</span><span class="o">.</span><span class="n">LogWarning</span><span class="p">(</span><span class="s">&quot;Failed to close </span><span class="si">%d</span><span class="s"> gap(s). Returning incomplete model!&quot;</span> <span class="o">%</span> \
-                            <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">))</span>
+    <span class="c"># remove terminal gaps and close small deletions</span>
+    <span class="n">RemoveTerminalGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
+    <span class="n">CloseSmallDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">)</span>
 
-    <span class="c"># step 4: build sidechains</span>
-    <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Rebuilding sidechains.&quot;</span><span class="p">)</span>
-    <span class="n">BuildSidechains</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
-
-    <span class="c"># step 5: minimize energy of final model using molecular mechanics</span>
-    <span class="n">ost</span><span class="o">.</span><span class="n">LogInfo</span><span class="p">(</span><span class="s">&quot;Minimize energy.&quot;</span><span class="p">)</span>
+    <span class="c"># iteratively merge gaps of distance i and fill loops by database</span>
+    <span class="k">for</span> <span class="n">distance</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">merge_distance</span><span class="p">):</span>
+        <span class="n">MergeGapsByDistance</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">distance</span><span class="p">)</span>
+        <span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">,</span>
+                            <span class="n">torsion_sampler</span><span class="p">,</span> <span class="n">min_loops_required</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">max_res_extension</span><span class="o">=</span><span class="mi">6</span><span class="p">)</span>
+    <span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">,</span>
+                        <span class="n">torsion_sampler</span><span class="p">,</span> <span class="n">min_loops_required</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span>
+    <span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">,</span>
+                        <span class="n">torsion_sampler</span><span class="p">)</span>
+
+    <span class="c"># close remaining gaps by Monte Carlo</span>
+    <span class="n">FillLoopsByMonteCarlo</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">)</span>
+    <span class="n">CloseLargeDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">)</span>
+
+    <span class="c"># build sidechains</span>
+    <span class="n">BuildSidechains</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">merge_distance</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span>
+                    <span class="n">structure_db</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">)</span>
+
+    <span class="c"># minimize energy of final model using molecular mechanics</span>
     <span class="n">MinimizeModelEnergy</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
 
+    <span class="c"># sanity checks</span>
+    <span class="n">CheckFinalModel</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
+
     <span class="c"># done</span>
     <span class="k">return</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span>
 
 <span class="c"># these methods will be exported into module</span></div>
-<span class="n">__all__</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;BuildFromRawModel&#39;</span><span class="p">,</span> <span class="s">&#39;BuildSidechains&#39;</span><span class="p">,</span> <span class="s">&#39;MinimizeModelEnergy&#39;</span><span class="p">,)</span>
+<span class="n">__all__</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;BuildFromRawModel&#39;</span><span class="p">,</span> <span class="s">&#39;BuildSidechains&#39;</span><span class="p">,</span> <span class="s">&#39;MinimizeModelEnergy&#39;</span><span class="p">,</span>
+           <span class="s">&#39;CheckFinalModel&#39;</span><span class="p">)</span>
 </pre></div>
 
           </div>
@@ -279,7 +381,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/_modules/promod3/modelling/_ring_punches.html b/doc/html/_modules/promod3/modelling/_ring_punches.html
new file mode 100644
index 0000000000000000000000000000000000000000..40cc44f2410920947a35ed0e8e82087958a07f3f
--- /dev/null
+++ b/doc/html/_modules/promod3/modelling/_ring_punches.html
@@ -0,0 +1,305 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>promod3.modelling._ring_punches &mdash; ProMod3 0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../_static/alabaster.css" type="text/css" />
+    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../',
+        VERSION:     '0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../_static/doctools.js"></script>
+    <link rel="top" title="ProMod3 0 documentation" href="../../../index.html" />
+    <link rel="up" title="promod3" href="../../promod3.html" />
+   
+  
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
+
+  </head>
+  <body role="document">  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body" role="main">
+            
+  <h1>Source code for promod3.modelling._ring_punches</h1><div class="highlight"><pre>
+<span class="sd">&#39;&#39;&#39;Helper functions to deal with ring punchings.&#39;&#39;&#39;</span>
+<span class="kn">import</span> <span class="nn">ost</span>
+<span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">geom</span>
+<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">sidechain</span>
+<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">namedtuple</span>
+
+<span class="k">def</span> <span class="nf">_AddRing</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">res</span><span class="p">,</span> <span class="n">atom_names</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Try to add ring for given atoms in residue res to rings.&#39;&#39;&#39;</span>
+    <span class="c"># get exisiting atom positions</span>
+    <span class="n">N</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">atom_names</span><span class="p">)</span>
+    <span class="k">assert</span><span class="p">(</span><span class="n">N</span> <span class="o">&gt;=</span> <span class="mi">3</span><span class="p">)</span>
+    <span class="n">pos</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+    <span class="n">center</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">Vec3</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">atom_name</span> <span class="ow">in</span> <span class="n">atom_names</span><span class="p">:</span>
+        <span class="n">a</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="n">atom_name</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">a</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
+            <span class="n">pos</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">GetPos</span><span class="p">())</span>
+            <span class="n">center</span> <span class="o">+=</span> <span class="n">a</span><span class="o">.</span><span class="n">GetPos</span><span class="p">()</span>
+
+    <span class="c"># all good?</span>
+    <span class="n">allgood</span> <span class="o">=</span> <span class="bp">False</span>
+    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span> <span class="o">==</span> <span class="n">N</span><span class="p">:</span>
+        <span class="c"># all the ring there -&gt; good</span>
+        <span class="n">center</span> <span class="o">=</span> <span class="n">center</span><span class="o">/</span><span class="n">N</span>
+        <span class="n">plane</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">Plane</span><span class="p">(</span><span class="n">pos</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">center</span><span class="p">)</span>
+        <span class="n">allgood</span> <span class="o">=</span> <span class="bp">True</span>
+    <span class="k">elif</span> <span class="n">res</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="o">==</span> <span class="s">&#39;P&#39;</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
+        <span class="c"># incomplete proline: 3 BB-pos there</span>
+        <span class="c"># get ring-plane from 3 pos</span>
+        <span class="n">plane</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">Plane</span><span class="p">(</span><span class="n">pos</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">pos</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+        <span class="c"># fit circle in plane through 3 points:</span>
+        <span class="c"># - build 2 planes normal to ring-plane and vector connecting 2 points</span>
+        <span class="c"># - intersect 2 planes and resulting line with ring-plane  -&gt; DONE</span>
+        <span class="n">plane1</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">Plane</span><span class="p">((</span><span class="n">pos</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="n">pos</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">-</span> <span class="n">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="n">plane2</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">Plane</span><span class="p">((</span><span class="n">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="n">pos</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="n">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">-</span> <span class="n">pos</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+        <span class="n">i_line</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">IntersectionLine</span><span class="p">(</span><span class="n">plane1</span><span class="p">,</span> <span class="n">plane2</span><span class="p">)</span>
+        <span class="n">center</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">IntersectionPoint</span><span class="p">(</span><span class="n">i_line</span><span class="p">,</span> <span class="n">plane</span><span class="p">)</span>
+        <span class="n">allgood</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="c"># add ring</span>
+    <span class="k">if</span> <span class="n">allgood</span><span class="p">:</span>
+        <span class="c"># get ring radius</span>
+        <span class="n">radius</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pos</span><span class="p">:</span>
+            <span class="n">radius</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">geom</span><span class="o">.</span><span class="n">Length</span><span class="p">(</span><span class="n">p</span> <span class="o">-</span> <span class="n">center</span><span class="p">))</span>
+        <span class="c"># append to list</span>
+        <span class="n">Ring</span> <span class="o">=</span> <span class="n">namedtuple</span><span class="p">(</span><span class="s">&#39;Ring&#39;</span><span class="p">,</span> <span class="s">&#39;center plane radius residue&#39;</span><span class="p">)</span>
+        <span class="n">rings</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Ring</span><span class="p">(</span><span class="n">center</span><span class="p">,</span> <span class="n">plane</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span> <span class="n">res</span><span class="o">.</span><span class="n">handle</span><span class="p">))</span>
+
+<span class="k">def</span> <span class="nf">_IgnoreAtom</span><span class="p">(</span><span class="n">ring</span><span class="p">,</span> <span class="n">atom</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Return true if atom is part of ring-residue.&#39;&#39;&#39;</span>
+    <span class="k">return</span> <span class="n">ring</span><span class="o">.</span><span class="n">residue</span> <span class="o">==</span> <span class="n">atom</span><span class="o">.</span><span class="n">residue</span>
+
+<span class="k">def</span> <span class="nf">_CheckAtomVsRing</span><span class="p">(</span><span class="n">ring</span><span class="p">,</span> <span class="n">atom</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Check all bonds of atom for punches through ring.</span>
+<span class="sd">    Atom is ignored if it&#39;s in ring-residue or direct neighbors.</span>
+<span class="sd">    Return true if punch found.&#39;&#39;&#39;</span>
+    <span class="c"># check this atom (can be view or handle!)</span>
+    <span class="n">a1</span> <span class="o">=</span> <span class="n">atom</span><span class="o">.</span><span class="n">handle</span>
+    <span class="k">if</span> <span class="n">_IgnoreAtom</span><span class="p">(</span><span class="n">ring</span><span class="p">,</span> <span class="n">a1</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">False</span>
+    <span class="n">p1</span> <span class="o">=</span> <span class="n">a1</span><span class="o">.</span><span class="n">GetPos</span><span class="p">()</span>
+    <span class="n">d1</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">Dot</span><span class="p">(</span><span class="n">p1</span> <span class="o">-</span> <span class="n">ring</span><span class="o">.</span><span class="n">center</span><span class="p">,</span> <span class="n">ring</span><span class="o">.</span><span class="n">plane</span><span class="o">.</span><span class="n">normal</span><span class="p">)</span>
+    <span class="c"># check all bonded partners</span>
+    <span class="k">for</span> <span class="n">a_other</span> <span class="ow">in</span> <span class="n">atom</span><span class="o">.</span><span class="n">GetBondPartners</span><span class="p">():</span>
+        <span class="n">a2</span> <span class="o">=</span> <span class="n">a_other</span><span class="o">.</span><span class="n">handle</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">a_other</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">or</span> <span class="n">_IgnoreAtom</span><span class="p">(</span><span class="n">ring</span><span class="p">,</span> <span class="n">a2</span><span class="p">):</span>
+            <span class="k">continue</span>
+        <span class="c"># two bonded atoms on diff. sides of the plane?</span>
+        <span class="n">p2</span> <span class="o">=</span> <span class="n">a2</span><span class="o">.</span><span class="n">GetPos</span><span class="p">()</span>
+        <span class="n">d2</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">Dot</span><span class="p">(</span><span class="n">p2</span> <span class="o">-</span> <span class="n">ring</span><span class="o">.</span><span class="n">center</span><span class="p">,</span> <span class="n">ring</span><span class="o">.</span><span class="n">plane</span><span class="o">.</span><span class="n">normal</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">d1</span><span class="o">*</span><span class="n">d2</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="c"># get intersect</span>
+            <span class="n">line</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">Line3</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">)</span>
+            <span class="n">pi</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">IntersectionPoint</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">ring</span><span class="o">.</span><span class="n">plane</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">geom</span><span class="o">.</span><span class="n">Length</span><span class="p">(</span><span class="n">pi</span> <span class="o">-</span> <span class="n">ring</span><span class="o">.</span><span class="n">center</span><span class="p">)</span> <span class="o">&lt;</span> <span class="n">ring</span><span class="o">.</span><span class="n">radius</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">True</span>
+    <span class="k">return</span> <span class="bp">False</span>
+
+<div class="viewcode-block" id="GetRings"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.GetRings">[docs]</a><span class="k">def</span> <span class="nf">GetRings</span><span class="p">(</span><span class="n">ent</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Get rings for a protein structure.</span>
+<span class="sd">    A ring is only added if all ring-atoms exist or if it is a proline and</span>
+<span class="sd">    three of the atoms exist (center and radii are estimated then).</span>
+
+<span class="sd">    :param ent: Structure for which to detect rings.</span>
+<span class="sd">    :type ent:  :class:`~ost.mol.EntityHandle` or :class:`~ost.mol.EntityView`</span>
+
+<span class="sd">    :return: :class:`list` of rings to perform ring checks. Each ring is a named</span>
+<span class="sd">             tuple with:</span>
+<span class="sd">             center (:class:`~ost.geom.Vec3`),</span>
+<span class="sd">             plane (:class:`~ost.geom.Plane`),</span>
+<span class="sd">             radius (:class:`float`),</span>
+<span class="sd">             residue (:class:`~ost.mol.ResidueHandle`).</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="n">rings</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+    <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">ent</span><span class="o">.</span><span class="n">residues</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="ow">in</span> <span class="s">&#39;YF&#39;</span><span class="p">:</span>
+            <span class="n">_AddRing</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">r</span><span class="p">,</span> <span class="p">[</span><span class="s">&quot;CG&quot;</span><span class="p">,</span> <span class="s">&quot;CD1&quot;</span><span class="p">,</span> <span class="s">&quot;CD2&quot;</span><span class="p">,</span> <span class="s">&quot;CE1&quot;</span><span class="p">,</span> <span class="s">&quot;CE2&quot;</span><span class="p">,</span> <span class="s">&quot;CZ&quot;</span><span class="p">])</span>
+        <span class="k">elif</span> <span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="o">==</span> <span class="s">&#39;W&#39;</span><span class="p">:</span>
+            <span class="n">_AddRing</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">r</span><span class="p">,</span> <span class="p">[</span><span class="s">&quot;CG&quot;</span><span class="p">,</span> <span class="s">&quot;CD1&quot;</span><span class="p">,</span> <span class="s">&quot;NE1&quot;</span><span class="p">,</span> <span class="s">&quot;CD2&quot;</span><span class="p">,</span> <span class="s">&quot;CE2&quot;</span><span class="p">])</span>
+            <span class="n">_AddRing</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">r</span><span class="p">,</span> <span class="p">[</span><span class="s">&quot;CD2&quot;</span><span class="p">,</span> <span class="s">&quot;CE2&quot;</span><span class="p">,</span> <span class="s">&quot;CE3&quot;</span><span class="p">,</span> <span class="s">&quot;CZ2&quot;</span><span class="p">,</span> <span class="s">&quot;CZ3&quot;</span><span class="p">,</span> <span class="s">&quot;CH2&quot;</span><span class="p">])</span>
+        <span class="k">elif</span> <span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="o">==</span> <span class="s">&#39;H&#39;</span><span class="p">:</span>
+            <span class="n">_AddRing</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">r</span><span class="p">,</span> <span class="p">[</span><span class="s">&quot;CG&quot;</span><span class="p">,</span> <span class="s">&quot;CD2&quot;</span><span class="p">,</span> <span class="s">&quot;ND1&quot;</span><span class="p">,</span> <span class="s">&quot;CE1&quot;</span><span class="p">,</span> <span class="s">&quot;NE2&quot;</span><span class="p">])</span>
+        <span class="k">elif</span> <span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="o">==</span> <span class="s">&#39;P&#39;</span><span class="p">:</span>
+            <span class="n">_AddRing</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">r</span><span class="p">,</span> <span class="p">[</span><span class="s">&quot;N&quot;</span><span class="p">,</span> <span class="s">&quot;CA&quot;</span><span class="p">,</span> <span class="s">&quot;CB&quot;</span><span class="p">,</span> <span class="s">&quot;CD&quot;</span><span class="p">,</span> <span class="s">&quot;CG&quot;</span><span class="p">])</span>
+    <span class="k">return</span> <span class="n">rings</span>
+</div>
+<div class="viewcode-block" id="GetRingPunches"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.GetRingPunches">[docs]</a><span class="k">def</span> <span class="nf">GetRingPunches</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">ent</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Get list of residues with rings that are punched by the given structure.</span>
+
+<span class="sd">    :param rings: List of rings as provided by :func:`GetRings`.</span>
+<span class="sd">    :param ent: Structure for which to detect punches.</span>
+<span class="sd">    :type ent:  :class:`~ost.mol.EntityHandle` or :class:`~ost.mol.EntityView`</span>
+
+<span class="sd">    :return: :class:`list` of residues (:class:`~ost.mol.ResidueHandle`) which</span>
+<span class="sd">              have a punched ring.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="n">ring_punches</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+    <span class="k">for</span> <span class="n">ring</span> <span class="ow">in</span> <span class="n">rings</span><span class="p">:</span>
+        <span class="c"># we don&#39;t need to add residues multiple times</span>
+        <span class="k">if</span> <span class="n">ring</span><span class="o">.</span><span class="n">residue</span> <span class="ow">in</span> <span class="n">ring_punches</span><span class="p">:</span>
+            <span class="k">continue</span>
+        <span class="c"># check neighborhood (3A should be enough)</span>
+        <span class="k">for</span> <span class="n">atom</span> <span class="ow">in</span> <span class="n">ent</span><span class="o">.</span><span class="n">FindWithin</span><span class="p">(</span><span class="n">ring</span><span class="o">.</span><span class="n">center</span><span class="p">,</span> <span class="mi">3</span><span class="p">):</span>
+            <span class="k">if</span> <span class="n">_CheckAtomVsRing</span><span class="p">(</span><span class="n">ring</span><span class="p">,</span> <span class="n">atom</span><span class="p">):</span>
+                <span class="n">ring_punches</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ring</span><span class="o">.</span><span class="n">residue</span><span class="p">)</span>
+                <span class="k">break</span>
+    <span class="k">return</span> <span class="n">ring_punches</span>
+</div>
+<div class="viewcode-block" id="HasRingPunches"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.HasRingPunches">[docs]</a><span class="k">def</span> <span class="nf">HasRingPunches</span><span class="p">(</span><span class="n">rings</span><span class="p">,</span> <span class="n">ent</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Check if any ring is punched by the given structure.</span>
+<span class="sd">    This check is faster than using :func:`GetRingPunches`.</span>
+
+<span class="sd">    :param rings: List of rings as provided by :func:`GetRings`.</span>
+<span class="sd">    :param ent: Structure for which to detect punches.</span>
+<span class="sd">    :type ent:  :class:`~ost.mol.EntityHandle` or :class:`~ost.mol.EntityView`</span>
+
+<span class="sd">    :return: True, iff any ring is punched</span>
+<span class="sd">    :rtype:  :class:`bool`</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="k">for</span> <span class="n">ring</span> <span class="ow">in</span> <span class="n">rings</span><span class="p">:</span>
+        <span class="c"># check neighborhood (3A should be enough)</span>
+        <span class="k">for</span> <span class="n">atom</span> <span class="ow">in</span> <span class="n">ent</span><span class="o">.</span><span class="n">FindWithin</span><span class="p">(</span><span class="n">ring</span><span class="o">.</span><span class="n">center</span><span class="p">,</span> <span class="mi">3</span><span class="p">):</span>
+            <span class="k">if</span> <span class="n">_CheckAtomVsRing</span><span class="p">(</span><span class="n">ring</span><span class="p">,</span> <span class="n">atom</span><span class="p">):</span>
+                <span class="k">return</span> <span class="bp">True</span>
+    <span class="k">return</span> <span class="bp">False</span>
+</div>
+<div class="viewcode-block" id="FilterCandidates"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.FilterCandidates">[docs]</a><span class="k">def</span> <span class="nf">FilterCandidates</span><span class="p">(</span><span class="n">candidates</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span> <span class="n">gap</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Remove loop candidates if they cause ring punches.</span>
+
+<span class="sd">    :param candidates: Loop candidates meant to fill *gap* within *model*.</span>
+<span class="sd">                       Offending candidates are removed from this list.</span>
+<span class="sd">    :type candidates:  :class:`~promod3.loop.LoopCandidates`</span>
+<span class="sd">    :param model:      Model for which loop is to be filled.</span>
+<span class="sd">    :type model:       :class:`~ost.mol.EntityHandle`</span>
+<span class="sd">    :param gap:        Gap for which loop is to be filled.</span>
+<span class="sd">    :type gap:         :class:`StructuralGap`.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="n">start_resnum</span> <span class="o">=</span> <span class="n">gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span>
+    <span class="n">chain_idx</span> <span class="o">=</span> <span class="n">gap</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
+    <span class="c"># precompute rings and range of rings to replace</span>
+    <span class="n">chain_name</span> <span class="o">=</span> <span class="n">gap</span><span class="o">.</span><span class="n">GetChainName</span><span class="p">()</span>
+    <span class="n">end_resnum</span> <span class="o">=</span> <span class="n">gap</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span>
+    <span class="n">myqueryin</span> <span class="o">=</span> <span class="s">&quot;cname=&quot;</span> <span class="o">+</span> <span class="n">chain_name</span> <span class="o">+</span> <span class="s">&quot; and rnum=&quot;</span> <span class="o">+</span>\
+                <span class="nb">str</span><span class="p">(</span><span class="n">start_resnum</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;:&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">end_resnum</span><span class="p">)</span>
+    <span class="n">myqueryout</span> <span class="o">=</span> <span class="s">&quot;cname!=&quot;</span> <span class="o">+</span> <span class="n">chain_name</span> <span class="o">+</span> <span class="s">&quot; or rnum&lt;&quot;</span> <span class="o">+</span>\
+                 <span class="nb">str</span><span class="p">(</span><span class="n">start_resnum</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; or rnum&gt;&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">end_resnum</span><span class="p">)</span>
+    <span class="n">model_out</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">myqueryout</span><span class="p">)</span>
+    <span class="n">rings_out</span> <span class="o">=</span> <span class="n">GetRings</span><span class="p">(</span><span class="n">model_out</span><span class="p">)</span>
+    <span class="c"># filter loop candidates</span>
+    <span class="n">lc_idx</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="k">while</span> <span class="n">lc_idx</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">):</span>
+        <span class="c"># get loop-entity for checks</span>
+        <span class="n">new_loop</span> <span class="o">=</span> <span class="n">candidates</span><span class="p">[</span><span class="n">lc_idx</span><span class="p">]</span><span class="o">.</span><span class="n">bb_list</span><span class="o">.</span><span class="n">ToEntity</span><span class="p">()</span>
+        <span class="n">rings_new</span> <span class="o">=</span> <span class="n">GetRings</span><span class="p">(</span><span class="n">new_loop</span><span class="p">)</span>
+        <span class="n">check_punches</span> <span class="o">=</span> <span class="n">HasRingPunches</span><span class="p">(</span><span class="n">rings_out</span><span class="o">+</span><span class="n">rings_new</span><span class="p">,</span> <span class="n">new_loop</span><span class="p">)</span> <span class="ow">or</span>\
+                        <span class="n">HasRingPunches</span><span class="p">(</span><span class="n">rings_new</span><span class="p">,</span> <span class="n">model_out</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">check_punches</span><span class="p">:</span>
+            <span class="n">candidates</span><span class="o">.</span><span class="n">Remove</span><span class="p">(</span><span class="n">lc_idx</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">lc_idx</span> <span class="o">+=</span> <span class="mi">1</span>
+</div>
+<div class="viewcode-block" id="FilterCandidatesWithSC"><a class="viewcode-back" href="../../../modelling/index.html#promod3.modelling.FilterCandidatesWithSC">[docs]</a><span class="k">def</span> <span class="nf">FilterCandidatesWithSC</span><span class="p">(</span><span class="n">candidates</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span> <span class="n">gap</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Remove loop candidates if they (with sidechain) cause ring punches.</span>
+<span class="sd">    See :func:`FilterCandidates`.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="n">start_resnum</span> <span class="o">=</span> <span class="n">gap</span><span class="o">.</span><span class="n">before</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span>
+    <span class="n">chain_idx</span> <span class="o">=</span> <span class="n">gap</span><span class="o">.</span><span class="n">GetChainIndex</span><span class="p">()</span>
+    <span class="n">cur_model</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">Copy</span><span class="p">()</span>
+    <span class="c"># precompute rings and range of rings to replace</span>
+    <span class="n">chain_name</span> <span class="o">=</span> <span class="n">gap</span><span class="o">.</span><span class="n">GetChainName</span><span class="p">()</span>
+    <span class="n">end_resnum</span> <span class="o">=</span> <span class="n">gap</span><span class="o">.</span><span class="n">after</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">()</span>
+    <span class="n">myqueryin</span> <span class="o">=</span> <span class="s">&quot;cname=&quot;</span> <span class="o">+</span> <span class="n">chain_name</span> <span class="o">+</span> <span class="s">&quot; and rnum=&quot;</span> <span class="o">+</span>\
+                <span class="nb">str</span><span class="p">(</span><span class="n">start_resnum</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;:&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">end_resnum</span><span class="p">)</span>
+    <span class="n">myqueryout</span> <span class="o">=</span> <span class="s">&quot;cname!=&quot;</span> <span class="o">+</span> <span class="n">chain_name</span> <span class="o">+</span> <span class="s">&quot; or rnum&lt;&quot;</span> <span class="o">+</span>\
+                 <span class="nb">str</span><span class="p">(</span><span class="n">start_resnum</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; or rnum&gt;&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">end_resnum</span><span class="p">)</span>
+    <span class="n">rings_out</span> <span class="o">=</span> <span class="n">GetRings</span><span class="p">(</span><span class="n">cur_model</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">myqueryout</span><span class="p">))</span>
+    <span class="c"># filter loop candidates</span>
+    <span class="n">lc_idx</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="k">while</span> <span class="n">lc_idx</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">candidates</span><span class="p">):</span>
+        <span class="c"># insert loop into model-copy</span>
+        <span class="n">bb_list</span> <span class="o">=</span> <span class="n">candidates</span><span class="p">[</span><span class="n">lc_idx</span><span class="p">]</span><span class="o">.</span><span class="n">bb_list</span>
+        <span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">cur_model</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="n">chain_idx</span><span class="p">],</span> <span class="n">start_resnum</span><span class="p">)</span>
+        <span class="c"># add sidechains and check for clashes</span>
+        <span class="n">sidechain</span><span class="o">.</span><span class="n">Reconstruct</span><span class="p">(</span><span class="n">cur_model</span><span class="p">,</span> <span class="n">keep_sidechains</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">models_new</span> <span class="o">=</span> <span class="n">cur_model</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">myqueryin</span><span class="p">)</span>
+        <span class="n">rings_new</span> <span class="o">=</span> <span class="n">GetRings</span><span class="p">(</span><span class="n">models_new</span><span class="p">)</span>
+        <span class="n">check_punches</span> <span class="o">=</span> <span class="n">HasRingPunches</span><span class="p">(</span><span class="n">rings_out</span><span class="p">,</span> <span class="n">models_new</span><span class="p">)</span> <span class="ow">or</span>\
+                        <span class="n">HasRingPunches</span><span class="p">(</span><span class="n">rings_new</span><span class="p">,</span> <span class="n">cur_model</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">check_punches</span><span class="p">:</span>
+            <span class="n">candidates</span><span class="o">.</span><span class="n">Remove</span><span class="p">(</span><span class="n">lc_idx</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">lc_idx</span> <span class="o">+=</span> <span class="mi">1</span>
+
+<span class="c"># these methods will be exported into module</span></div>
+<span class="n">__all__</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;GetRings&#39;</span><span class="p">,</span> <span class="s">&#39;GetRingPunches&#39;</span><span class="p">,</span> <span class="s">&#39;HasRingPunches&#39;</span><span class="p">,</span> <span class="s">&#39;FilterCandidates&#39;</span><span class="p">,</span>
+           <span class="s">&#39;FilterCandidatesWithSC&#39;</span><span class="p">)</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
+        <div class="sphinxsidebarwrapper"><div class="relations">
+<h3>Related Topics</h3>
+<ul>
+  <li><a href="../../../index.html">Documentation overview</a><ul>
+  <li><a href="../../index.html">Module code</a><ul>
+  <li><a href="../../promod3.html">promod3</a><ul>
+  </ul></li>
+  </ul></li>
+  </ul></li>
+</ul>
+</div>
+<div id="searchbox" style="display: none" role="search">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="footer">
+      &copy;2016, Bienchen.
+      
+      |
+      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>
+      
+    </div>
+
+    
+
+    
+  </body>
+</html>
\ No newline at end of file
diff --git a/doc/html/_modules/promod3/sidechain/_reconstruct_sidechains.html b/doc/html/_modules/promod3/sidechain/_reconstruct_sidechains.html
index fb8baf6967a29d64da9ae1d6075cc9d3ba299e0a..39ed41fd0015c4d042e71941d06cca13cffe7512 100644
--- a/doc/html/_modules/promod3/sidechain/_reconstruct_sidechains.html
+++ b/doc/html/_modules/promod3/sidechain/_reconstruct_sidechains.html
@@ -40,35 +40,11 @@
   <h1>Source code for promod3.sidechain._reconstruct_sidechains</h1><div class="highlight"><pre>
 <span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">_sidechain</span> <span class="k">as</span> <span class="n">sidechain</span>
 <span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">geom</span>
+<span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">mol</span>
 
 <div class="viewcode-block" id="Reconstruct"><a class="viewcode-back" href="../../../sidechain/index.html#promod3.sidechain.Reconstruct">[docs]</a><span class="k">def</span> <span class="nf">Reconstruct</span><span class="p">(</span><span class="n">ent</span><span class="p">,</span> <span class="n">keep_sidechains</span> <span class="o">=</span> <span class="bp">False</span><span class="p">,</span> <span class="n">build_disulfids</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,</span> 
                 <span class="n">rotamer_model</span> <span class="o">=</span> <span class="s">&quot;frm&quot;</span><span class="p">,</span> <span class="n">consider_hbonds</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,</span>
-                <span class="n">rotamer_library</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span> <span class="n">add_polar_hydrogens</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
-
-    <span class="n">name_id_mapper</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;ARG&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ARG</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;ASN&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ASN</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;ASP&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ASP</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;GLN&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">GLN</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;GLU&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">GLU</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;LYS&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">LYS</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;SER&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">SER</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;CYS&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;MET&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">MET</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;TRP&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">TRP</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;TYR&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">TYR</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;THR&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">THR</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;VAL&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">VAL</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;ILE&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ILE</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;LEU&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">LEU</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;PRO&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">PRO</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;HSD&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">HSD</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;HSE&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">HSE</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;HIS&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">HIS</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;PHE&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">PHE</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;ALA&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;GLY&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">GLY</span>
-    <span class="n">name_id_mapper</span><span class="p">[</span><span class="s">&quot;MSE&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">MET</span>
+                <span class="n">rotamer_library</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>
 
     <span class="k">if</span> <span class="n">rotamer_model</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;frm&quot;</span><span class="p">:</span>
         <span class="n">use_frm</span> <span class="o">=</span> <span class="bp">True</span>
@@ -90,23 +66,53 @@
     <span class="n">prot</span> <span class="o">=</span> <span class="n">ent</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;peptide=true&quot;</span><span class="p">)</span>
     <span class="n">incomplete_sidechains</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
 
+    <span class="c">#extract rotamer ids</span>
+    <span class="n">rotamer_ids</span> <span class="o">=</span> <span class="p">[</span><span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
+        <span class="n">rot_id</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">TLCToRotID</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">())</span>
+        <span class="k">if</span> <span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">XXX</span><span class="p">:</span>
+            <span class="k">continue</span> <span class="c"># no idea what it is, so we stick with ALA </span>
+                     <span class="c"># =&gt; don&#39;t model sidechain</span>
+        <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">rot_id</span>
 
     <span class="c">#extract dihedral angles</span>
     <span class="n">phi_angles</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.0</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">)</span>
     <span class="n">psi_angles</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.0</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">)</span>
   
     <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
+
         <span class="n">phi</span> <span class="o">=</span> <span class="o">-</span><span class="mf">1.0472</span> 
         <span class="n">psi</span> <span class="o">=</span> <span class="o">-</span><span class="mf">0.7854</span>
   
         <span class="n">tor</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">GetPhiTorsion</span><span class="p">()</span>
         <span class="k">if</span> <span class="n">tor</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
             <span class="n">phi</span> <span class="o">=</span> <span class="n">tor</span><span class="o">.</span><span class="n">GetAngle</span><span class="p">()</span>
+        <span class="k">elif</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">r_prev</span> <span class="o">=</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">mol</span><span class="o">.</span><span class="n">InSequence</span><span class="p">(</span><span class="n">r_prev</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">):</span>
+                <span class="n">c_prev</span> <span class="o">=</span> <span class="n">r_prev</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;C&quot;</span><span class="p">)</span>
+                <span class="n">n</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;N&quot;</span><span class="p">)</span>
+                <span class="n">ca</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;CA&quot;</span><span class="p">)</span>
+                <span class="n">c</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;C&quot;</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">c_prev</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">n</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">ca</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">c</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
+                    <span class="n">phi</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">DihedralAngle</span><span class="p">(</span><span class="n">c_prev</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span><span class="n">n</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span>
+                                             <span class="n">ca</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span><span class="n">c</span><span class="o">.</span><span class="n">GetPos</span><span class="p">())</span>
       
         <span class="n">tor</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">GetPsiTorsion</span><span class="p">()</span>
         <span class="k">if</span> <span class="n">tor</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
             <span class="n">psi</span> <span class="o">=</span> <span class="n">tor</span><span class="o">.</span><span class="n">GetAngle</span><span class="p">()</span>
-  
+        <span class="k">elif</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">):</span>
+            <span class="n">r_next</span> <span class="o">=</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">mol</span><span class="o">.</span><span class="n">InSequence</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">r_next</span><span class="o">.</span><span class="n">handle</span><span class="p">):</span>
+                <span class="n">n</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;N&quot;</span><span class="p">)</span>
+                <span class="n">ca</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;CA&quot;</span><span class="p">)</span>
+                <span class="n">c</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;C&quot;</span><span class="p">)</span>
+                <span class="n">n_next</span> <span class="o">=</span> <span class="n">r_next</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;N&quot;</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">n</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">ca</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">c</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">n_next</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
+                    <span class="n">psi</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">DihedralAngle</span><span class="p">(</span><span class="n">n</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span> <span class="n">ca</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span>
+                                             <span class="n">c</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span> <span class="n">n_next</span><span class="o">.</span><span class="n">GetPos</span><span class="p">())</span>
+
+
         <span class="n">phi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">phi</span>
         <span class="n">psi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">psi</span>
 
@@ -123,11 +129,8 @@
     <span class="c">#build up backbone frame</span>
     <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
         <span class="k">try</span><span class="p">:</span>
-            <span class="n">rot_id</span> <span class="o">=</span> <span class="n">name_id_mapper</span><span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()]</span>
-        <span class="k">except</span><span class="p">:</span>
-            <span class="n">rot_id</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span>
-        <span class="k">try</span><span class="p">:</span>
-            <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructBackboneFrameResidue</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">rot_id</span><span class="p">,</span>
+            <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructBackboneFrameResidue</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                    <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                                                     <span class="n">i</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">,</span>
                                                                     <span class="n">phi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                                                     <span class="n">r</span><span class="o">.</span><span class="n">HasProp</span><span class="p">(</span><span class="s">&quot;n_ter&quot;</span><span class="p">),</span>
@@ -136,215 +139,221 @@
         <span class="k">except</span><span class="p">:</span>
             <span class="k">continue</span>
 
-    <span class="k">if</span> <span class="n">keep_sidechains</span><span class="p">:</span>
-        <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
-            <span class="k">try</span><span class="p">:</span>
-                <span class="n">rot_id</span> <span class="o">=</span> <span class="n">name_id_mapper</span><span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()]</span>
-            <span class="k">except</span><span class="p">:</span>
-                <span class="k">continue</span>
-            <span class="k">if</span> <span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span><span class="p">:</span>
-                <span class="k">continue</span> <span class="c">#cysteins will be handled seperately</span>
-            <span class="k">if</span> <span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span> <span class="ow">or</span> <span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">GLY</span><span class="p">:</span>
-                <span class="k">continue</span>
-            <span class="k">try</span><span class="p">:</span>
-                <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructSidechainFrameResidue</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">rot_id</span><span class="p">,</span>
-                                                                         <span class="n">i</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
-                <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">frame_residue</span><span class="p">)</span>
-            <span class="k">except</span><span class="p">:</span>
-                <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
-    <span class="k">else</span><span class="p">:</span>
-        <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
-            <span class="k">try</span><span class="p">:</span>
-                <span class="n">rot_id</span> <span class="o">=</span> <span class="n">name_id_mapper</span><span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()]</span>
-            <span class="k">except</span><span class="p">:</span>
-                <span class="k">continue</span>
-            <span class="k">if</span> <span class="n">rot_id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="n">sidechain</span><span class="o">.</span><span class="n">GLY</span><span class="p">,</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span><span class="p">]:</span>
-                <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
 
+    <span class="n">frame</span> <span class="o">=</span> <span class="bp">None</span>
 
-    <span class="c">#look for cysteins and evaluate potential disulfid bonds</span>
-    <span class="n">final_disulfid_indices</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
     <span class="k">if</span> <span class="n">build_disulfids</span><span class="p">:</span>
-        <span class="n">cystein_info</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
-        <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
-            <span class="k">try</span><span class="p">:</span>
-                <span class="n">rot_id</span> <span class="o">=</span> <span class="n">name_id_mapper</span><span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()]</span>
-            <span class="k">except</span><span class="p">:</span>
-                <span class="k">continue</span>
 
-            <span class="k">if</span> <span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span><span class="p">:</span>
-                <span class="n">ca</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;CA&quot;</span><span class="p">)</span>
-                <span class="n">cb</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;CB&quot;</span><span class="p">)</span>
-                <span class="k">if</span> <span class="n">ca</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">cb</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
-                    <span class="n">cystein_info</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">ca</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span><span class="n">cb</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span><span class="n">i</span><span class="p">))</span>
+        <span class="n">cystein_indices</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+
+        <span class="k">if</span> <span class="n">keep_sidechains</span><span class="p">:</span>
+            <span class="c">#let&#39;s add all complete sidechains except the cysteins to the frame</span>
+            <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
+
+                <span class="k">if</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span><span class="p">:</span>
+                    <span class="n">cystein_indices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
+                    <span class="k">continue</span>
+
+                <span class="k">if</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span> <span class="ow">or</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">GLY</span><span class="p">:</span>
+                    <span class="k">continue</span> <span class="c">#no sidechain to model</span>
+
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructSidechainFrameResidue</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                             <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
+                                                                             <span class="n">i</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
+                    <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">frame_residue</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c">#let&#39;s add everything except cysteins to the incomplete sidechains</span>
+            <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
+
+                <span class="k">if</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span><span class="p">:</span>
+                    <span class="n">cystein_indices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
+                    <span class="k">continue</span>
+
+                <span class="k">if</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span> <span class="ow">or</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">GLY</span><span class="p">:</span>
+                    <span class="k">continue</span> <span class="c">#no sidechain to model</span>
+
+                <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
 
+        <span class="c">#let&#39;s generate the frame without any cystein sidechains</span>
+        <span class="c">#this is required for the disulfid score evaluation</span>
         <span class="n">frame</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">Frame</span><span class="p">(</span><span class="n">frame_residues</span><span class="p">)</span>
 
-        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">cystein_info</span><span class="p">)):</span>
+        <span class="c">#some info we have to keep track of when evaluating disulfid bonds</span>
+        <span class="n">cystein_rotamers</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+        <span class="n">disulfid_indices</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+        <span class="n">cys_ca_positions</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+        <span class="n">cys_cb_positions</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">cystein_indices</span><span class="p">:</span>
+
+            <span class="n">rot_grop</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">r</span> <span class="o">=</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
+            <span class="n">ca</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;CA&quot;</span><span class="p">)</span>
+            <span class="n">cb</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;CB&quot;</span><span class="p">)</span>
 
-            <span class="k">if</span> <span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="ow">in</span> <span class="n">final_disulfid_indices</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="n">ca</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">cb</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()):</span>
                 <span class="k">continue</span>
 
-            <span class="n">complete_i</span> <span class="o">=</span> <span class="n">keep_sidechains</span> <span class="ow">and</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;SG&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span>
-            <span class="n">i_ca_pos</span> <span class="o">=</span> <span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
-            <span class="n">i_cb_pos</span> <span class="o">=</span> <span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
-            <span class="n">i_index</span> <span class="o">=</span> <span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span>
+            <span class="n">cys_ca_positions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ca</span><span class="o">.</span><span class="n">GetPos</span><span class="p">())</span>
+            <span class="n">cys_cb_positions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cb</span><span class="o">.</span><span class="n">GetPos</span><span class="p">())</span>
+
+            <span class="k">if</span> <span class="n">use_frm</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">bbdep</span><span class="p">:</span>
+                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                   <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
+                                                                   <span class="n">rotamer_library</span><span class="p">,</span>
+                                                                   <span class="n">rotamer_settings</span><span class="p">,</span>
+                                                                   <span class="n">phi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
+                                                                   <span class="n">psi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                   <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
+                                                                   <span class="n">rotamer_library</span><span class="p">,</span>
+                                                                   <span class="n">rotamer_settings</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">bbdep</span><span class="p">:</span>
+                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                   <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
+                                                                   <span class="n">rotamer_library</span><span class="p">,</span>
+                                                                   <span class="n">rotamer_settings</span><span class="p">,</span>
+                                                                   <span class="n">phi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
+                                                                   <span class="n">psi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                   <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
+                                                                   <span class="n">rotamer_library</span><span class="p">,</span>
+                                                                   <span class="n">rotamer_settings</span><span class="p">)</span>
+
+            <span class="n">frame</span><span class="o">.</span><span class="n">AddFrameEnergy</span><span class="p">(</span><span class="n">rot_group</span><span class="p">)</span>
+            <span class="n">cystein_rotamers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">rot_group</span><span class="p">)</span>
+
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">cystein_rotamers</span><span class="p">)):</span>
+            <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">cystein_rotamers</span><span class="p">)):</span>
+
+                <span class="k">if</span> <span class="n">geom</span><span class="o">.</span><span class="n">Distance</span><span class="p">(</span><span class="n">cys_ca_positions</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">cys_ca_positions</span><span class="p">[</span><span class="n">j</span><span class="p">])</span> <span class="o">&gt;</span> <span class="mf">8.0</span><span class="p">:</span>
+                    <span class="k">continue</span> <span class="c">#they&#39;re too far for a disulfid bond</span>
+
+                <span class="k">if</span> <span class="n">cystein_indices</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="ow">in</span> <span class="n">disulfid_indices</span> <span class="ow">or</span> <span class="n">cystein_indices</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="ow">in</span> <span class="n">disulfid_indices</span><span class="p">:</span>
+                    <span class="k">continue</span> <span class="c">#one of them already participates in a disulfid bond!</span>
+                             <span class="c">#that one might be bether but right now is first come</span>
+                             <span class="c">#first served principle</span>
+
+                <span class="n">min_score</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">)</span>
+                <span class="n">min_index_k</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
+                <span class="n">min_index_l</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
+
+                <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">cystein_rotamers</span><span class="p">[</span><span class="n">i</span><span class="p">])):</span>
+                    <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">cystein_rotamers</span><span class="p">[</span><span class="n">j</span><span class="p">])):</span>
+                        <span class="n">score</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">DisulfidScore</span><span class="p">(</span><span class="n">cystein_rotamers</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">k</span><span class="p">],</span> 
+                                                        <span class="n">cystein_rotamers</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="n">l</span><span class="p">],</span>
+                                                        <span class="n">cys_ca_positions</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> 
+                                                        <span class="n">cys_cb_positions</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
+                                                        <span class="n">cys_ca_positions</span><span class="p">[</span><span class="n">j</span><span class="p">],</span> 
+                                                        <span class="n">cys_cb_positions</span><span class="p">[</span><span class="n">j</span><span class="p">])</span>
+                        <span class="k">if</span> <span class="n">score</span> <span class="o">&lt;</span> <span class="n">min_score</span><span class="p">:</span>
+                            <span class="n">min_index_k</span> <span class="o">=</span> <span class="n">k</span>
+                            <span class="n">min_index_l</span> <span class="o">=</span> <span class="n">l</span>
+                            <span class="n">min_score</span> <span class="o">=</span> <span class="n">score</span>
+
+                <span class="k">if</span> <span class="n">min_score</span> <span class="o">&lt;</span> <span class="mf">45.0</span><span class="p">:</span>
+                    <span class="n">disulfid_indices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cystein_indices</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+                    <span class="n">disulfid_indices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cystein_indices</span><span class="p">[</span><span class="n">j</span><span class="p">])</span>
+                    <span class="n">particle_list</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+                    <span class="n">particle_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cystein_rotamers</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">min_index_k</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
+                    <span class="n">new_frame_residue_i</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">FrameResidue</span><span class="p">(</span><span class="n">particle_list</span><span class="p">,</span><span class="n">cystein_indices</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+                    <span class="n">particle_list</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+                    <span class="n">particle_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cystein_rotamers</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="n">min_index_l</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
+                    <span class="n">new_frame_residue_j</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">FrameResidue</span><span class="p">(</span><span class="n">particle_list</span><span class="p">,</span><span class="n">cystein_indices</span><span class="p">[</span><span class="n">j</span><span class="p">])</span>
+                    <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_frame_residue_i</span><span class="p">)</span>
+                    <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_frame_residue_j</span><span class="p">)</span>
+                    <span class="c">#set the position in the proteins residues</span>
+                    <span class="n">cystein_rotamers</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">min_index_k</span><span class="p">]</span><span class="o">.</span><span class="n">ApplyOnResidue</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_indices</span><span class="p">[</span><span class="n">i</span><span class="p">]]</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                    <span class="n">consider_hydrogens</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+                    <span class="n">cystein_rotamers</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="n">min_index_l</span><span class="p">]</span><span class="o">.</span><span class="n">ApplyOnResidue</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_indices</span><span class="p">[</span><span class="n">j</span><span class="p">]]</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                    <span class="n">consider_hydrogens</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span> 
+                    <span class="n">sidechain</span><span class="o">.</span><span class="n">ConnectSidechain</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_indices</span><span class="p">[</span><span class="n">i</span><span class="p">]]</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span><span class="p">)</span>
+                    <span class="n">sidechain</span><span class="o">.</span><span class="n">ConnectSidechain</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_indices</span><span class="p">[</span><span class="n">j</span><span class="p">]]</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span><span class="p">)</span>
+
+
+        <span class="c">#All cysteins participating in a disulfid bond have been applied to the</span>
+        <span class="c">#structure and added to the frame.</span>
+        <span class="c">#All remaining ones have to be handled according the given flags.</span>
+        <span class="k">for</span> <span class="n">idx</span> <span class="ow">in</span> <span class="n">cystein_indices</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">idx</span> <span class="ow">in</span> <span class="n">disulfid_indices</span><span class="p">:</span>
+                <span class="k">continue</span> <span class="c">#it&#39;s all fine</span>
+            <span class="k">if</span> <span class="n">keep_sidechains</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructSidechainFrameResidue</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">idx</span><span class="p">]</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                             <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">idx</span><span class="p">],</span>
+                                                                             <span class="n">idx</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
+                    <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">frame_residue</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span> 
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>  
+
+        <span class="c">#we finally have to rebuild the frame if any disulfid bonds have been built</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">disulfid_indices</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">Frame</span><span class="p">(</span><span class="n">frame_residues</span><span class="p">)</span>                 
 
-            <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">cystein_info</span><span class="p">)):</span>
 
-                <span class="k">if</span> <span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="ow">in</span> <span class="n">final_disulfid_indices</span><span class="p">:</span>
-                    <span class="k">continue</span>
-                 
-                <span class="n">complete_j</span> <span class="o">=</span> <span class="n">keep_sidechains</span> <span class="ow">and</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;SG&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span>
-
-                <span class="k">if</span> <span class="n">complete_i</span> <span class="ow">and</span> <span class="n">complete_j</span><span class="p">:</span>
-                    <span class="k">continue</span> <span class="c">#they&#39;re already there</span>
-
-                <span class="k">if</span> <span class="n">geom</span><span class="o">.</span><span class="n">Distance</span><span class="p">(</span><span class="n">i_ca_pos</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span> <span class="o">&lt;</span> <span class="mi">8</span><span class="p">:</span>
-                    <span class="n">j_ca_pos</span> <span class="o">=</span> <span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
-                    <span class="n">j_cb_pos</span> <span class="o">=</span> <span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
-                    <span class="n">j_index</span> <span class="o">=</span> <span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span>
-
-
-                    <span class="k">if</span> <span class="n">use_frm</span><span class="p">:</span>
-                        <span class="k">if</span> <span class="n">bbdep</span><span class="p">:</span>
-                            <span class="n">rot_group_one</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span>
-                                                                               <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
-                                                                               <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">,</span>
-                                                                               <span class="n">phi_angles</span><span class="p">[</span><span class="n">i_index</span><span class="p">],</span><span class="n">psi_angles</span><span class="p">[</span><span class="n">i_index</span><span class="p">])</span>
-
-                            <span class="n">rot_group_two</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span>
-                                                                               <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
-                                                                               <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">,</span>
-                                                                               <span class="n">phi_angles</span><span class="p">[</span><span class="n">j_index</span><span class="p">],</span><span class="n">psi_angles</span><span class="p">[</span><span class="n">j_index</span><span class="p">])</span>
-                        <span class="k">else</span><span class="p">:</span>
-                            <span class="n">rot_group_one</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span>
-                                                                               <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
-                                                                               <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
-
-                            <span class="n">rot_group_two</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span>
-                                                                               <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
-                                                                               <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
-
-
-                    <span class="k">else</span><span class="p">:</span>
-                        <span class="k">if</span> <span class="n">bbdep</span><span class="p">:</span>
-                            <span class="n">rot_group_one</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span>
-                                                                               <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
-                                                                               <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">,</span>
-                                                                               <span class="n">phi_angles</span><span class="p">[</span><span class="n">i_index</span><span class="p">],</span><span class="n">psi_angles</span><span class="p">[</span><span class="n">i_index</span><span class="p">])</span>
-
-                            <span class="n">rot_group_two</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span>
-                                                                               <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
-                                                                               <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">,</span>
-                                                                               <span class="n">phi_angles</span><span class="p">[</span><span class="n">j_index</span><span class="p">],</span><span class="n">psi_angles</span><span class="p">[</span><span class="n">j_index</span><span class="p">])</span>
-                        <span class="k">else</span><span class="p">:</span>
-                            <span class="n">rot_group_one</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span>
-                                                                               <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
-                                                                               <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
-
-                            <span class="n">rot_group_two</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span>
-                                                                               <span class="n">sidechain</span><span class="o">.</span><span class="n">CYD</span><span class="p">,</span><span class="n">cystein_info</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span>
-                                                                               <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
-
-
-                    <span class="n">frame</span><span class="o">.</span><span class="n">AddFrameEnergy</span><span class="p">(</span><span class="n">rot_group_one</span><span class="p">)</span>
-                    <span class="n">frame</span><span class="o">.</span><span class="n">AddFrameEnergy</span><span class="p">(</span><span class="n">rot_group_two</span><span class="p">)</span>
-                   
-                    <span class="n">min_index_k</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
-                    <span class="n">min_index_l</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
-                    <span class="n">min_score</span> <span class="o">=</span> <span class="mi">10000000</span>
-
-                    <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">rot_group_one</span><span class="p">)):</span>
-                        <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">rot_group_two</span><span class="p">)):</span>
-                            <span class="n">score</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">DisulfidScore</span><span class="p">(</span><span class="n">rot_group_one</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">rot_group_two</span><span class="p">[</span><span class="n">l</span><span class="p">],</span>
-                                                            <span class="n">i_ca_pos</span><span class="p">,</span><span class="n">i_cb_pos</span><span class="p">,</span><span class="n">j_ca_pos</span><span class="p">,</span><span class="n">j_cb_pos</span><span class="p">)</span>
-                            <span class="k">if</span> <span class="n">score</span> <span class="o">&lt;</span> <span class="n">min_score</span><span class="p">:</span>
-                                <span class="n">min_index_k</span> <span class="o">=</span> <span class="n">k</span>
-                                <span class="n">min_index_l</span> <span class="o">=</span> <span class="n">l</span>
-                                <span class="n">min_score</span> <span class="o">=</span> <span class="n">score</span>
-
-                    <span class="k">if</span> <span class="n">min_score</span> <span class="o">&lt;</span> <span class="mi">45</span><span class="p">:</span>
-                        <span class="n">final_disulfid_indices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i_index</span><span class="p">)</span>
-                        <span class="n">final_disulfid_indices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">j_index</span><span class="p">)</span>
-                        <span class="c">#create new frame residue...</span>
-                        <span class="n">particle_list</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
-                        <span class="n">particle_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">rot_group_one</span><span class="p">[</span><span class="n">min_index_k</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
-                        <span class="n">particle_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">rot_group_two</span><span class="p">[</span><span class="n">min_index_l</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
-                        <span class="n">new_frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">FrameResidue</span><span class="p">(</span><span class="n">particle_list</span><span class="p">,</span><span class="mi">100000</span><span class="p">)</span>
-                        <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_frame_residue</span><span class="p">)</span>
-                        <span class="c">#set the position in the proteins residues</span>
-                        <span class="n">rot_group_one</span><span class="p">[</span><span class="n">min_index_k</span><span class="p">]</span><span class="o">.</span><span class="n">ApplyOnResidue</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i_index</span><span class="p">]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">())</span>
-                        <span class="n">rot_group_two</span><span class="p">[</span><span class="n">min_index_l</span><span class="p">]</span><span class="o">.</span><span class="n">ApplyOnResidue</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">j_index</span><span class="p">]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">())</span>
-
-        <span class="c">#we still have to add the cysteins, that are complete, even though</span>
-        <span class="c">#they&#39;re not participating in a disulfid bond</span>
+    <span class="k">else</span><span class="p">:</span>
         <span class="k">if</span> <span class="n">keep_sidechains</span><span class="p">:</span>
             <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span> <span class="ow">or</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">GLY</span><span class="p">:</span>
+                    <span class="k">continue</span> <span class="c">#no sidechain to model</span>
                 <span class="k">try</span><span class="p">:</span>
-                    <span class="n">rot_id</span> <span class="o">=</span> <span class="n">name_id_mapper</span><span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()]</span>
-                <span class="k">except</span><span class="p">:</span>
-                    <span class="k">continue</span>
-                <span class="k">if</span> <span class="n">rot_id</span> <span class="o">!=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span><span class="p">:</span>
-                    <span class="k">continue</span> <span class="c">#all other sidechains are already handled</span>
-                <span class="k">if</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">final_disulfid_indices</span><span class="p">:</span>
-                    <span class="k">continue</span> <span class="c">#already added to the frame residues</span>
-                <span class="k">try</span><span class="p">:</span>
-                    <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructSidechainFrameResidue</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">rot_id</span><span class="p">,</span>
+                    <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructSidechainFrameResidue</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span>
+                                                                             <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                                                              <span class="n">i</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
                     <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">frame_residue</span><span class="p">)</span>
                 <span class="k">except</span><span class="p">:</span>
                     <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
         <span class="k">else</span><span class="p">:</span>
-            <span class="c">#The disulfid cysteins must be removed from incomplete sidechains</span>
-            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">final_disulfid_indices</span><span class="p">:</span>
-                <span class="k">try</span><span class="p">:</span>
-                    <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
-                <span class="k">except</span><span class="p">:</span>
-                    <span class="k">pass</span> <span class="c">#it&#39;s not there anyway, so we don&#39;t have to remove it</span>
-
-    <span class="k">elif</span> <span class="n">keep_sidechains</span><span class="p">:</span>
-        <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
-            <span class="k">try</span><span class="p">:</span>
-                <span class="n">rot_id</span> <span class="o">=</span> <span class="n">name_id_mapper</span><span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()]</span>
-            <span class="k">except</span><span class="p">:</span>
-                <span class="k">continue</span>
-            <span class="k">if</span> <span class="n">rot_id</span> <span class="o">!=</span> <span class="n">CYS</span><span class="p">:</span>
-                <span class="k">continue</span> <span class="c">#all other sidechains are already handled</span>
-            <span class="k">try</span><span class="p">:</span>
-                <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructSidechainFrameResidue</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">rot_id</span><span class="p">,</span>
-                                                                         <span class="n">i</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
-                <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">frame_residue</span><span class="p">)</span>
-            <span class="k">except</span><span class="p">:</span>
-                <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
-
+            <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="n">sidechain</span><span class="o">.</span><span class="n">GLY</span><span class="p">,</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span><span class="p">]:</span>
+                    <span class="n">incomplete_sidechains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
 
-    <span class="c">#finally build complete frame</span>
-    <span class="n">frame</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">Frame</span><span class="p">(</span><span class="n">frame_residues</span><span class="p">)</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">Frame</span><span class="p">(</span><span class="n">frame_residues</span><span class="p">)</span>
 
-    <span class="c">#build rotamers</span>
 
+    <span class="c">#build rotamers for incomplete sidechains</span>
     <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">incomplete_sidechains</span><span class="p">:</span>
 
         <span class="n">r</span> <span class="o">=</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
-
-        <span class="k">try</span><span class="p">:</span>
-            <span class="n">rot_id</span> <span class="o">=</span> <span class="n">name_id_mapper</span><span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()]</span>
-        <span class="k">except</span><span class="p">:</span>
-            <span class="k">continue</span>
+        <span class="n">rot_id</span> <span class="o">=</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
         
         <span class="k">if</span><span class="p">(</span><span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ALA</span> <span class="ow">or</span> <span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">GLY</span><span class="p">):</span>
             <span class="k">continue</span>
 
         <span class="k">if</span> <span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CYS</span><span class="p">:</span>
-            <span class="k">if</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">final_disulfid_indices</span><span class="p">:</span>
-                <span class="k">continue</span>
             <span class="n">rot_id</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CYH</span>
 
         <span class="k">if</span> <span class="n">rot_id</span> <span class="o">==</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">PRO</span><span class="p">:</span>
             <span class="n">tor</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">GetOmegaTorsion</span><span class="p">()</span>
+            <span class="n">omega</span> <span class="o">=</span> <span class="bp">None</span>
             <span class="k">if</span> <span class="n">tor</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
-                <span class="k">if</span> <span class="nb">abs</span><span class="p">(</span><span class="n">tor</span><span class="o">.</span><span class="n">GetAngle</span><span class="p">())</span> <span class="o">&lt;</span> <span class="mf">1.57</span><span class="p">:</span>
+                <span class="n">omega</span> <span class="o">=</span> <span class="n">tor</span><span class="o">.</span><span class="n">GetAngle</span><span class="p">()</span>
+            <span class="k">elif</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="c"># fallback computation of omega as in OST-code</span>
+                <span class="n">prev</span> <span class="o">=</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">if</span> <span class="n">prev</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">prev</span><span class="o">.</span><span class="n">IsPeptideLinking</span><span class="p">():</span>
+                    <span class="n">ca_prev</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;CA&quot;</span><span class="p">)</span>
+                    <span class="n">c_prev</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;C&quot;</span><span class="p">)</span>
+                    <span class="n">n</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;N&quot;</span><span class="p">)</span>
+                    <span class="n">ca</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">FindAtom</span><span class="p">(</span><span class="s">&quot;CA&quot;</span><span class="p">)</span>
+                    <span class="n">valid</span> <span class="o">=</span> <span class="n">ca_prev</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">c_prev</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> \
+                            <span class="ow">and</span> <span class="n">n</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span> <span class="ow">and</span> <span class="n">ca</span><span class="o">.</span><span class="n">IsValid</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">valid</span> <span class="ow">and</span> <span class="n">mol</span><span class="o">.</span><span class="n">BondExists</span><span class="p">(</span><span class="n">c_prev</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span> <span class="n">n</span><span class="o">.</span><span class="n">handle</span><span class="p">):</span>
+                        <span class="n">omega</span> <span class="o">=</span> <span class="n">geom</span><span class="o">.</span><span class="n">DihedralAngle</span><span class="p">(</span><span class="n">ca_prev</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span>
+                                                   <span class="n">c_prev</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span>
+                                                   <span class="n">n</span><span class="o">.</span><span class="n">GetPos</span><span class="p">(),</span> <span class="n">ca</span><span class="o">.</span><span class="n">GetPos</span><span class="p">())</span>
+            <span class="c"># omega not set if prev. res. missing</span>
+            <span class="k">if</span> <span class="n">omega</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="nb">abs</span><span class="p">(</span><span class="n">omega</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mf">1.57</span><span class="p">:</span>
                     <span class="n">rot_id</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">CPR</span>
                 <span class="k">else</span><span class="p">:</span>
                     <span class="n">rot_id</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">TPR</span>
@@ -352,19 +361,19 @@
         <span class="k">try</span><span class="p">:</span>
             <span class="k">if</span> <span class="n">use_frm</span><span class="p">:</span>
                 <span class="k">if</span> <span class="n">bbdep</span><span class="p">:</span>
-                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">rot_id</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
+                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">rot_id</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
                                                                    <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">,</span>
                                                                    <span class="n">phi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">],</span><span class="n">psi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
                 <span class="k">else</span><span class="p">:</span>
-                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">rot_id</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
+                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">rot_id</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
                                                                    <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
             <span class="k">else</span><span class="p">:</span>
                 <span class="k">if</span> <span class="n">bbdep</span><span class="p">:</span>
-                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">rot_id</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
+                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">rot_id</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
                                                                    <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">,</span>
                                                                    <span class="n">phi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">],</span><span class="n">psi_angles</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
                 <span class="k">else</span><span class="p">:</span>
-                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">rot_id</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
+                    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructRRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">rot_id</span><span class="p">,</span><span class="n">i</span><span class="p">,</span>
                                                                    <span class="n">rotamer_library</span><span class="p">,</span><span class="n">rotamer_settings</span><span class="p">)</span>
 
         <span class="k">except</span><span class="p">:</span>
@@ -387,18 +396,11 @@
 
     <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">rot_group</span><span class="p">,</span><span class="n">sol</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">residues_with_rotamer_group</span><span class="p">,</span><span class="n">rotamer_groups</span><span class="p">,</span><span class="n">solution</span><span class="p">):</span>
         <span class="k">try</span><span class="p">:</span>
-            <span class="n">rot_group</span><span class="p">[</span><span class="n">sol</span><span class="p">]</span><span class="o">.</span><span class="n">ApplyOnResidue</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">(),</span><span class="n">consider_hydrogens</span><span class="o">=</span><span class="n">add_polar_hydrogens</span><span class="p">)</span>
+            <span class="n">rot_group</span><span class="p">[</span><span class="n">sol</span><span class="p">]</span><span class="o">.</span><span class="n">ApplyOnResidue</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">consider_hydrogens</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+            <span class="n">sidechain</span><span class="o">.</span><span class="n">ConnectSidechain</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">handle</span><span class="p">,</span><span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
         <span class="k">except</span><span class="p">:</span>
             <span class="k">print</span> <span class="s">&quot;there is a backbone atom missing... &quot;</span><span class="p">,</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">GetQualifiedName</span><span class="p">()</span>
 
-    <span class="c">#if we want to add polar hydrogens, we also have to consider the backbone...</span>
-    <span class="k">if</span> <span class="n">add_polar_hydrogens</span><span class="p">:</span>
-        <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">frame_residues</span><span class="p">:</span>
-            <span class="n">i</span><span class="o">=</span><span class="n">r</span><span class="o">.</span><span class="n">GetResidueIndex</span><span class="p">()</span>
-            <span class="k">if</span> <span class="n">i</span><span class="o">==</span><span class="mi">100000</span><span class="p">:</span><span class="k">continue</span><span class="c">#These are cysteins that were already handled</span>
-            <span class="n">rh</span><span class="o">=</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">GetHandle</span><span class="p">()</span>
-            <span class="n">r</span><span class="o">.</span><span class="n">ApplyOnResidue</span><span class="p">(</span><span class="n">rh</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span>
-
 
 <span class="c"># these methods will be exported into module</span></div>
 <span class="n">__all__</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;Reconstruct&#39;</span><span class="p">,)</span>
@@ -437,7 +439,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/_modules/test_actions.html b/doc/html/_modules/test_actions.html
index 60893b7d893f94f8c176c3434fd52e6faf9acc0f..3bd5dec1cdf59f00fea0dfbc1374c3d68ae842bf 100644
--- a/doc/html/_modules/test_actions.html
+++ b/doc/html/_modules/test_actions.html
@@ -78,9 +78,8 @@
 <span class="sd">        Convenience stuff for action testing.</span>
 <span class="sd">        &quot;&quot;&quot;</span>
         <span class="c"># Determining the pm binary to be called. Going hard-coded is a bad</span>
-        <span class="c"># thing. But this is a unit test and we now where we are. Also be</span>
-        <span class="c"># putting it into the &#39;setUp&#39; function, we only need to change it once,</span>
-        <span class="c"># if so. The other idea would be to use a config file which</span>
+        <span class="c"># thing. But this is a unit test and we know where we are as all unit</span>
+        <span class="c"># tests are run in &quot;tests/MODULENAME&quot; within build-folder.</span>
         <span class="n">bld_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">())))</span>
         <span class="bp">self</span><span class="o">.</span><span class="n">pm_bin</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">bld_dir</span><span class="p">,</span> <span class="s">&#39;stage&#39;</span><span class="p">,</span> <span class="s">&#39;bin&#39;</span><span class="p">,</span> <span class="s">&#39;pm&#39;</span><span class="p">)</span>
         <span class="bp">self</span><span class="o">.</span><span class="n">pm_action</span> <span class="o">=</span> <span class="bp">None</span>
@@ -199,7 +198,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/_sources/actions/index_dev.txt b/doc/html/_sources/actions/index_dev.txt
index d88a707502036ca6c2bec6cac0fedc3c43997b3e..9373583b95f843220064846ba9d48fd6fee27e58 100644
--- a/doc/html/_sources/actions/index_dev.txt
+++ b/doc/html/_sources/actions/index_dev.txt
@@ -29,22 +29,11 @@ would clutter up the source repository, it would always show up as untracked
 file on ``git status``. To prevent this, tell |python| to stop producing
 bytecode right at the beginning of your test-script:
 
-.. testcode:: nobytecode
-  :hide:
-
-  import sys
-  sys.dont_write_bytecode = True
-
-.. code-block:: python
+.. literalinclude:: ../../../tests/doc/scripts/action_test.py
+  :lines: 1-5
   :emphasize-lines: 5
   :linenos:
 
-  import sys
-
-  # this is needed so there will be no test_actions.pyc created in the source
-  # directory
-  sys.dont_write_bytecode = True
-
 Line 5 does the trick. This needs to be set by you in every action unit test
 file since |python| only recognises it **before** the module is imported.
 Otherwise a module could disable bytecoding for all other modules loaded.
@@ -86,21 +75,10 @@ the underscore between ``do`` and ``awesome`` instead of a hyphen, that's
 
 As a starter, we disable bytecode compilation in the script:
 
-.. testsetup:: actiontest
-  :hide:
-
-  import sys
-  sys.dont_write_bytecode = True
-
-.. code-block:: python
+.. literalinclude:: ../../../tests/doc/scripts/action_test.py
+  :lines: 1-5
   :linenos:
 
-  import sys
-
-  # this is needed so there will be no test_actions.pyc created in the source
-  # directory
-  sys.dont_write_bytecode = True
-
 |cmake| Integration
 --------------------------------------------------------------------------------
 As always, when introducing new material to |project|, it has to be announced
@@ -134,36 +112,20 @@ tests. By spawning off from this you inherit a bunch of useful methods for your
 testing. To make it work, the childclass needs to be set up properly. But
 first, :file:`test_actions.py` has to be loaded as a module:
 
-.. testcode:: actiontest
-  :hide:
-
-  import test_actions
-
-.. code-block:: python
-  :linenos:
+.. literalinclude:: ../../../tests/doc/scripts/action_test.py
+  :lines: 7
   :lineno-start: 6
+  :linenos:
 
-  import test_actions
-
-Now create the childclass for your action. Go for :class:`<NAME>ActionTests` as
-a naming scheme:
-
-.. testcode:: actiontest
-  :hide:
-
-  class DoAwesomeActionTests(test_actions.ActionTestCase):
-      def __init__(self, *args, **kwargs):
-          test_actions.ActionTestCase.__init__(self, *args, **kwargs)
-          self.pm_action = 'do-awesome'
+To showcase, the test cases, we explain how one would (and does) test the
+``help`` action of ``pm``.
+First, we create the childclass for the action.
+Go for :class:`<NAME>ActionTests` as a naming scheme:
 
-.. code-block:: python
-  :linenos:
+.. literalinclude:: ../../../tests/doc/scripts/action_test.py
+  :lines: 9-12
   :lineno-start: 7
-
-  class DoAwesomeActionTests(test_actions.ActionTestCase):
-      def __init__(self, *args, **kwargs):
-          test_actions.ActionTestCase.__init__(self, *args, **kwargs)
-          self.pm_action = 'do-awesome'
+  :linenos:
 
 Pay attention that in your own class, you must set :attr:`pm_action` to make
 everything work. Also :meth:`__init__` needs certain parameters, as everything
@@ -176,23 +138,10 @@ states will be placed in the userlevel documentation. This topic is already
 covered in :class:`test_actions.ActionTestCase` by :meth:`~ActionTestCase.RunExitStatusTest`.
 As an example, testing for ``$?=0`` could work like this:
 
-.. testcode:: actiontest
-  :hide:
-
-  class DoAwesomeActionTests(test_actions.ActionTestCase):
-      def __init__(self, *args, **kwargs):
-          test_actions.ActionTestCase.__init__(self, *args, **kwargs)
-          self.pm_action = 'do-awesome'
-
-      def testExit0(self):
-          self.RunExitStatusTest(0, list())
-
-.. code-block:: python
-  :linenos:
+.. literalinclude:: ../../../tests/doc/scripts/action_test.py
+  :lines: 14-15
   :lineno-start: 11
-
-  def testExit0(self):
-      self.RunExitStatusTest(0, list())
+  :linenos:
 
 That will call the action stored in :attr:`pm_action` with the provided list of
 parameters and check that ``0`` is returned on the command line.
@@ -207,33 +156,10 @@ In |project|, unit tests are run via |ost_s|_'s :mod:`ost.testutils` and |python
 :class:`unittest.TestCase`. Those are called when the test module is executed
 as a script:
 
-.. testcode:: actiontest
-  :hide:
-
-  import unittest
-
-  class DoAwesomeActionTests(test_actions.ActionTestCase):
-      def __init__(self, *args, **kwargs):
-          test_actions.ActionTestCase.__init__(self, *args, **kwargs)
-          self.pm_bin = os.path.join(os.getcwd(), os.pardir, 'stage', 'bin',
-                                     'pm')
-          self.pm_action = 'help'
-
-      def testExit0(self):
-          self.RunExitStatusTest(0, list())
-
-  if __name__ == "__builtin__":
-      import os
-      suite = unittest.TestLoader().loadTestsFromTestCase(DoAwesomeActionTests)
-      unittest.TextTestRunner().run(suite)
-
-.. code-block:: python
-  :linenos:
+.. literalinclude:: ../../../tests/doc/scripts/action_test.py
+  :lines: 17-19
   :lineno-start: 13
-
-  if __name__ == "__main__":
-      from ost import testutils
-      testutils.RunTests()
+  :linenos:
 
 These three lines should be the same for all unit tests.
 
@@ -262,76 +188,17 @@ once done, disable it to keep output of unit tests low.
 
 To get the test for exit code ``0`` talking to you, just do
 
-.. testcode:: actiontest
-  :hide:
-
-  import unittest
-
-  class DoAwesomeActionTests(test_actions.ActionTestCase):
-      def __init__(self, *args, **kwargs):
-          test_actions.ActionTestCase.__init__(self, *args, **kwargs)
-          self.pm_bin = os.path.join(os.getcwd(), os.pardir, 'stage', 'bin',
-                                     'pm')
-          self.pm_action = 'help'
-
-      def testExit0(self):
-          self.RunExitStatusTest(0, list(), verbose=True)
-
-  if __name__ == "__builtin__":
-      import os
-      suite = unittest.TestLoader().loadTestsFromTestCase(DoAwesomeActionTests)
-      unittest.TextTestRunner().run(suite)
-
-.. testoutput:: actiontest
-  :hide:
-  :options: +NORMALIZE_WHITESPACE +ELLIPSIS
-
-  stdout of '.../doc/../stage/bin/pm help'
-   ------
-   Following actions are available:
-     build-rawmodel
-     help
-   Each action should respond to "--help".
-   ------
-   stderr of '.../doc/../stage/bin/pm help'
-   ------
-   ------
-
-.. code-block:: python
-  :linenos:
+.. literalinclude:: ../../../tests/doc/scripts/action_test_verbose.py
+  :lines: 14-15
   :lineno-start: 11
-
-  def testExit0(self):
-      self.RunExitStatusTest(0, list(), verbose=True)
+  :linenos:
 
 and
 
-.. testcode:: actiontest
-  :hide:
-
-  import unittest
-
-  class DoAwesomeActionTests(test_actions.ActionTestCase):
-      def __init__(self, *args, **kwargs):
-          test_actions.ActionTestCase.__init__(self, *args, **kwargs)
-          self.pm_bin = os.path.join(os.getcwd(), os.pardir, 'stage', 'bin',
-                                     'pm')
-          self.pm_action = 'help'
-
-      def testExit0(self):
-          self.RunExitStatusTest(0, list())
-
-  if __name__ == "__builtin__":
-      import os
-      suite = unittest.TestLoader().loadTestsFromTestCase(DoAwesomeActionTests)
-      unittest.TextTestRunner().run(suite)
-
-.. code-block:: python
-  :linenos:
+.. literalinclude:: ../../../tests/doc/scripts/action_test.py
+  :lines: 14-15
   :lineno-start: 11
-
-  def testExit0(self):
-      self.RunExitStatusTest(0, list())
+  :linenos:
 
 keeps it silent (:attr:`verbose` is set to ``False`` by default). If enabled,
 output will be separated into :file:`stdout` and :file:`stderr`:
@@ -340,7 +207,7 @@ output will be separated into :file:`stdout` and :file:`stderr`:
 
   $ make test_action_do_awesome.py_run
   <Lots of output from the build process>
-  [100%] running checks test_action_do_awesome.py
+  running checks test_action_do_awesome.py
   stdout of '<BUILD>/stage/bin/pm do-awesome'
   ------
   <Output to stdout>
@@ -349,6 +216,7 @@ output will be separated into :file:`stdout` and :file:`stderr`:
   ------
   <Output to stderr>
   ------
+  <More output from unit test runner>
 
 --------------------------------------------------------------------------------
 Unit Test Actions API
@@ -361,6 +229,6 @@ Unit Test Actions API
 ..  LocalWords:  linenos pyc dont promod unittest childclass lineno init args
 ..  LocalWords:  ActionTests DoAwesomeActionTests kwargs attr meth TestCase
 ..  LocalWords:  userlevel RunExitStatusTest testExit ost testutils RunTests
-..  LocalWords:  stdout stderr testcode nobytecode testsetup actiontest os
+..  LocalWords:  stdout stderr nobytecode testsetup actiontest os
 ..  LocalWords:  getcwd pardir builtin testoutput NORMALIZE WHITESPACE API
 ..  LocalWords:  autoclass
diff --git a/doc/html/_sources/buildsystem.txt b/doc/html/_sources/buildsystem.txt
index b90f9f10ba78b33ccbfe3f476c74c63e2fdba4c6..449bdfb0a75f3da81f758b2a9986898b5316ae2c 100644
--- a/doc/html/_sources/buildsystem.txt
+++ b/doc/html/_sources/buildsystem.txt
@@ -7,16 +7,16 @@ Building |project|
 Dependencies
 --------------------------------------------------------------------------------
 |project| is build on top of |ost_l|_ (|ost_s|), requiring at least version
-1.4. |ost_s| must be configured and compiled with ``ENABLE_MM=1`` to use |openmm|_.
+1.5. |ost_s| must be configured and compiled with ``ENABLE_MM=1`` to use |openmm|_.
 To create the build system, |cmake|_ is required in version
 2.8.7 or higher. |python|_ works well from version 2.7. For |ost_s| and the
 |C++| bit of |project|, |boost|_ is required in version 1.47.0 (the same as
 used for |ost_s|). Also |eigen3|_ and |lapack|_ are needed. To build
-documentation, |sphinx|_ 1.2b1 is used.
+documentation, |sphinx|_ 1.2b1 is required.
 
 The currently (Nov. 2015) preferred versions are:
 
-* |ost_s|_ 1.4
+* |ost_s|_ 1.5
 * |openmm|_ 6.1
 * |cmake|_ 2.8.12
 * |python|_ 2.7.5
@@ -105,8 +105,8 @@ Beside the usual ``make all`` and other default targets, there are a few
 special targets:
 
 * ``check`` :index:`make check` Runs unit tests and if |cmake| was invoked in
-  its standard configuration also |sphinx| with the ``doctest`` and
-  ``linkcheck`` builders
+  its standard configuration also documentation examples (``doctest``) and
+  links in the doc. (``linkcheck``) are checked
 * ``html`` :index:`make html` Creates documentation as web page using the
   |sphinx| ``html`` builder
 * ``man`` :index:`make man` Creates a manual page using the |sphinx| ``man``
diff --git a/doc/html/_sources/changelog.txt b/doc/html/_sources/changelog.txt
index b50334fa756a8c72a1005cf265e55e83c92f4ed9..e84d5d8477d5716928a9dc259de629d94fc6a199 100644
--- a/doc/html/_sources/changelog.txt
+++ b/doc/html/_sources/changelog.txt
@@ -5,20 +5,6 @@
 Changelog
 ================================================================================
 
-Changes in Release 0.1
+Release 1.0
 --------------------------------------------------------------------------------
- * initial setup of the CMake build system
- * first idea of the documentation system
- * meld included from SMNG as first module (to be modified/ renamed)
-
-Changes in Release 0.2
---------------------------------------------------------------------------------
- * added html documentation to repository
- * meld renamed to rawmodel
-
-Changes in Release 0.3 (to be released)
--------------------------------------------------------------------------------
- * merged argcheck into the helper module
- * rawmodel renamed to modelling and including high-level modelling functions
-
-..  LocalWords:  Changelog reStructuredText changelog txt
+ * initial release of ProMod3 for use in productive instances of SMNG
diff --git a/doc/html/_sources/cmake/index.txt b/doc/html/_sources/cmake/index.txt
index a104b61a5a6b2a871aa303263af13b93ed47f156..e3a5805c3882f3e43d1ad981b579fe33ce94148d 100644
--- a/doc/html/_sources/cmake/index.txt
+++ b/doc/html/_sources/cmake/index.txt
@@ -30,6 +30,131 @@ various :file:`CMakeLists.txt` files in the project's directory tree.
 Functions For Module/ Action Maintenance
 --------------------------------------------------------------------------------
 
+Module definition
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Default dependencies in a module ``NAME``:
+
+- ``_NAME`` depends on ``NAME_pymod`` and ``promod3_NAME`` (if that exists)
+- ``promod3_NAME`` depends on ``promod3_NAME_headers``
+
+.. cmake:command:: module
+
+  .. code-block:: cmake
+
+                  module(NAME name
+                         SOURCES source1 source2
+                         HEADERS header1 header2 [IN_DIR dir]
+                                 [header3 header4 [IN_DIR dir]]
+                         [DEPENDS_ON dep1 dep2]
+                         [HEADER_OUTPUT_DIR dir]
+                         [LINK link_cmds])
+
+  Define a |project| module from a set of |C++| files. This will define the
+  following make targets (where ``NAME`` is the provided module name):
+
+  - ``promod3_NAME``: builds library :file:`libpromod3_NAME`
+  - ``promod3_NAME_headers``: copies all header files
+
+  The parameters are:
+
+  ``NAME``
+    Specify the name of the module.
+
+  ``SOURCES``
+    Set of |C++| source files to be compiled.
+
+  ``HEADERS``
+    Set of |C++| header files to be copied. If the headers are located in
+    a different directory than the current one, you must group them by directory
+    and provide the directory name ``dir`` with ``IN_DIR dir`` after listing the
+    header files in said directory.
+
+  ``DEPENDS_ON``
+    Add dependencies on other targets (e.g. ``promod3_MOD`` for another
+    |project| module).
+
+  ``HEADER_OUTPUT_DIR``
+    Define alternative folder to which to copy header files. Default is
+    :file:`promod3/NAME`.
+
+  ``LINK``
+    Add dependencies to external libraries. You may use some predefines set of
+    libraries here, such as ``${OST_LIBRARIES}``, ``${BOOST_LIBRARIES}`` and
+    ``${LAPACK_LIBRARIES}``.
+
+
+.. cmake:command:: pymod
+
+  .. code-block:: cmake
+
+                  pymod(NAME name
+                        CPP source1 source2
+                        PY source source2 [IN_DIR dir] 
+                           [source3 source4 [IN_DIR dir]]
+                           [TRANSLATE dict END_TRANSLATE]
+                        [OUTPUT_DIR dir]
+                        [DEPENDS_ON dep1 dep2]
+                        [NEED_CONFIG_HEADER])
+
+  Define the |python| interface of a |project| ProMod3 module from a set of
+  |C++| wrappers and/or Python files. This will define the following make
+  targets (where ``NAME`` is the provided module name):
+
+  - ``_NAME``: builds library :file:`_NAME` for |python| wrapper around |C++|
+  - ``NAME_pymod``: copies (and/or translates) all |python| files
+
+  The parameters are:
+
+  ``NAME``
+    Specify the name of the module.
+
+  ``CPP``
+    Set of |C++| source files to be compiled.
+
+  ``PY``
+    Set of |python| source files to be copied. If the files are located in
+    a different directory than the current one, you must group them by directory
+    and provide the directory name ``dir`` with ``IN_DIR dir`` after listing the
+    header files in said directory.
+
+    If a |python| source file needs to be translated by |cmake|, provide the
+    dictionary after putting ``TRANSLATE``. This assumes a ``<FILE>.py.in`` for
+    ``<FILE>.py``. ``END_TRANSLATE`` marks the end of the translation
+    dictionary.
+
+  ``OUTPUT_DIR``
+    Define alternative folder (within Python tree) to place python files.
+    Default is :file:`promod3/NAME`.
+
+  ``DEPENDS_ON``
+    Add dependencies on other targets (e.g. ``promod3_MOD`` for another
+    |project| module). 
+
+  ``NEED_CONFIG_HEADER``
+    Makes the module depending on the config_header target, which provides the
+    headers in the :file:`config` directory.
+
+
+.. cmake:command:: convert_module_data
+
+  .. code-block:: cmake
+
+                  convert_module_data(MODULE name
+                                      FILE file
+                                      SCRIPT script
+                                      [ARGS args])
+
+  Use a Python script to convert a portable binary file to a non-portable one.
+  Calls ``python SCRIPT in_path out_path ARGS`` (with access to |ost_s| and 
+  |project|),
+  where ``in_path`` = :file:`portable_FILE`
+  (within path of current :file:`CMakeLists.txt`)
+  and ``out_path`` = :file:`share/promod3/MODULE_data/FILE`
+  (within the :file:`stage` directory).
+  If given, ``args`` can also be multiple arguments (must be put in "" then).
+
+
 Unit Tests
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 .. cmake:command:: promod3_unittest
@@ -40,7 +165,8 @@ Unit Tests
                                    SOURCES source1 [source2 ...]
                                    [LINK library1/ linker flag1 [library2/ linker flag2 ...]]
                                    [DATA data1 [data2 ...]]
-                                   [TARGET target])
+                                   [TARGET target]
+                                   [BASE_TARGET base_target])
 
   Add unit tests to |project|. Unit tests should go in module-wise so all
   source files containing test code go by a single call of
@@ -83,6 +209,11 @@ Unit Tests
     This defines an additional dependency for the unit test. That is, before
     running this unit test, this target will be built.
 
+  ``BASE_TARGET``
+    This defines an alternative base target to which to add this unit test.
+    By default all unit tests are registered to be executed with the 
+    ``codetest`` target. This can be overridden by using this argument.
+
 Documentation
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 .. cmake:command:: add_doc_source
@@ -114,8 +245,8 @@ Documentation
 
   .. code-block:: cmake
 
-                  add_doc_source(NAME name
-                                 DEP dependency1 [dependency2...])
+                  add_doc_dependency(NAME name
+                                     DEP dependency1 [dependency2...])
 
   Add a dependency to the doc build system. For an existing name, add some
   dependencies when it comes to building documentation. Mostly for internal use.
diff --git a/doc/html/_sources/contributing.txt b/doc/html/_sources/contributing.txt
index d47ca142290efe00b4d684007be96134e5c6c7ef..6b01d03e3ba02f1c5c5c41da13f53015428348db 100644
--- a/doc/html/_sources/contributing.txt
+++ b/doc/html/_sources/contributing.txt
@@ -227,6 +227,32 @@ usual Unix file system filled with the build products of |project|. The
 :file:`stage` directory tree can already be utilised. You may import Python
 modules from there, use the binaries from :file:`stage/bin`, etc..
 
+--------------------------------------------------------------------------------
+Quick testing of |project| features
+--------------------------------------------------------------------------------
+High-level features of |project|, can be tested directly in an interactive
+Python shell. First, you need to tell Python, where to find the modules by
+defining the ``PYTHONPATH`` env. variable in your shell to include the
+:file:`lib64/python2.7/site-packages` folders of the :file:`stage` folders of
+|project| and |ost_s|. For convenience, you can place the export-command in
+your :file:`.bashrc` (or so). Then, you can import modules from ``promod3``
+and ``ost`` as in the example codes shown in this documentation.
+
+To test low-level |C++| features, you can copy the :file:`extras/test_code`
+folder and adapt it for your purposes. First, you will have to fix the paths
+to |project| and |ost_s| in the :file:`Makefile` by changing the following
+lines:
+
+.. code-block:: make
+
+  # path to OST and ProMod3 stage
+  OST_ROOT = <DEFINEME>/ost/build/stage
+  PROMOD3_ROOT = <DEFINEME>/ProMod3/build/stage
+
+Afterwards, you should be able to compile and run small sample codes that use
+|project| and |ost_s| as in the :file:`test.cc` example. You can compile your
+code by executing ``make`` and run it with ``make run``.
+
 --------------------------------------------------------------------------------
 Unit Tests
 --------------------------------------------------------------------------------
@@ -244,14 +270,19 @@ the Internet. Nevertheless, here is a short list of most important advices:
 * No failing tests, that are considered 'this does not affect anything'
 
 To run the whole test suite, ``make check`` is enough. This will also trigger
-the ``doctest`` and ``linkcheck`` targets. To avoid this, e.g. when just
-testing a smallish change in code, ``codetest`` exists as a separate target,
-only running unit tests from all modules in |project|. Actually ``make check``
-does nothing more but invoking ``doctest``, ``linkcheck`` and ``codetest`` as
-dependencies. You could even go with running tests gathered in a single file:
-assuming you have :file:`your_module/tests/test_awesome_feature.py`, |cmake|
-will provide you with a target ``test_awesome_feature.py_run``. If your module
-has |C++| tests, those will be available by ``test_suite_your_module_run``.
+the ``doctest`` and ``linkcheck`` targets. Alternatively you can run:
+
+- ``make codetest`` to run only unit tests from all modules in |project|.
+  Note that ``make check`` does nothing more but invoking ``doctest``,
+  ``linkcheck`` and ``codetest`` as dependencies.
+- ``make check_xml`` to run tests without stopping after each failure.
+  Failures are shortly reported to the command line and the result of each test
+  is written in 'PYTEST-<TestCaseName>.xml' files in the 'tests' subfolders of
+  your 'build' folder.
+- Run single tests:
+  assuming you have :file:`your_module/tests/test_awesome_feature.py`, |cmake|
+  will provide you with a target ``test_awesome_feature.py_run``. If your module
+  has |C++| tests, those will be available by ``test_suite_your_module_run``.
 
 --------------------------------------------------------------------------------
 Writing Documentation
@@ -275,6 +306,40 @@ http://sphinx-doc.org/markup/inline.html
 If you write new functionality for |project|, or fix bugs, feel free to extend
 the Changelog. It will be automatically pulled into the documentation.
 
+It is highly recommended to add code examples with your documentation. For that
+purpose, you should write a fully runnable script, which is to be placed in the
+:file:`doc/tests/scripts` directory. The script is to be runnable from within
+the :file:`doc/tests` directory as ``pm SCRIPTPATH`` and may use data stored in
+the :file:`doc/tests/data` directory. The script and any data needed by it, must
+then be referenced in the :file:`doc/tests/CMakeLists.txt` file. Afterwards,
+they can be included in the documentation using the
+`literalinclude <http://www.sphinx-doc.org/en/stable/markup/code.html#includes>`_
+directive. For instance, if you add a new example code :file:`loop_main.py`,
+you would add it in your module documentation as follows:
+
+.. code-block:: rest
+
+  .. literalinclude:: ../../../tests/doc/scripts/loop_main.py
+
+If your example does not relate to a specific module and the documentation is
+in the top-level :file:`doc` directory, you need to drop one of the ``..`` as
+follows:
+
+.. code-block:: rest
+
+  .. literalinclude:: ../../tests/doc/scripts/hello_world.py
+
+To ensure that the code examples keep on working, a unit test has to be defined
+in :file:`doc/tests/test_doctests.py`. Each example code is run by a dedicated
+test function. Usually, the codes are run and the return code is checked.
+Command-line output or resulting files can also be checked (see existing test
+codes for examples). A few more guidelines for example codes:
+
+- If it generates files as output, please delete them after checking them.
+- If it requires external modules or binaries, check for their availablity. If
+  the external dependencies are not available, output a warning and skip the
+  test.
+
 .. _how-to-start-your-own-module:
 
 --------------------------------------------------------------------------------
@@ -296,12 +361,12 @@ tell you for which branch you went, a story of failure otherwise.
    $
 
 Sitting on top of the right code basis, you should just spawn your own branch
-from it. As an example, your feature will go by the name of 'sidechains'.
+from it. As an example, your feature will go by the name of 'sidechain'.
 
 .. code-block:: console
 
-   $ git checkout -b sidechains
-   Switched to a new branch 'sidechains'
+   $ git checkout -b sidechain
+   Switched to a new branch 'sidechain'
    $
 
 This time, |git| should tell you about going for **a new** branch.
@@ -322,9 +387,9 @@ list of directories which are likely to be used in every project.
 
 .. code-block:: console
 
-   $ mkdir -p sidechains/doc
-   $ mkdir -p sidechains/pymod
-   $ mkdir -p sidechains/tests
+   $ mkdir -p sidechain/doc
+   $ mkdir -p sidechain/pymod
+   $ mkdir -p sidechain/tests
    $
 
 If you run ``git status`` at this point, you will see basically nothing. That
@@ -333,9 +398,9 @@ version control, create a couple of files which are always needed.
 
 .. code-block:: console
 
-   $ touch sidechains/pymod/__init__.py
-   $ echo ":mod:\`~promod3.sidechains\` - ProMod3 side chain optimiser" >> sidechains/doc/index.rst
-   $ echo "================================================================================" >> sidechains/doc/index.rst
+   $ touch sidechain/pymod/__init__.py
+   $ echo ":mod:\`~promod3.sidechain\` - ProMod3 side chain optimiser" >> sidechain/doc/index.rst
+   $ echo "================================================================================" >> sidechain/doc/index.rst
    $
 
 Having an empty :file:`__init__.py` is perfectly fine for |python|, it just
@@ -349,13 +414,13 @@ extending some around the directory root.
 
 .. code-block:: console
 
-   $ touch sidechains/CMakeLists.txt
-   $ touch sidechains/pymod/CMakeLists.txt
-   $ touch sidechains/doc/CMakeLists.txt
+   $ touch sidechain/CMakeLists.txt
+   $ touch sidechain/pymod/CMakeLists.txt
+   $ touch sidechain/doc/CMakeLists.txt
    $
 
 Each of those files still needs a bit of content. The simplest one comes from
-the module's root, :file:`sidechains/CMakeLists.txt`:
+the module's root, :file:`sidechain/CMakeLists.txt`:
 
 .. code-block:: cmake
    :linenos:
@@ -371,11 +436,11 @@ configurations. The next level in :file:`CMakeLists.txt` magic comes for the
 .. code-block:: cmake
    :linenos:
 
-   set(SIDECHAINS_RST
+   set(SIDECHAIN_RST
    index.rst
    )
 
-   add_doc_source(NAME sidechains RST ${SIDECHAINS_RST})
+   add_doc_source(NAME sidechain RST ${SIDECHAIN_RST})
 
 ``add_doc_source`` is our custom |cmake| macro to register
 |restructuredtext_abrv| files for the documentation. On running
@@ -383,7 +448,7 @@ configurations. The next level in :file:`CMakeLists.txt` magic comes for the
 within the build directory. Each new submodule in your project should be
 covered by its own documentation entity, extending the list in ``RST``.
 Maintaining readability, its good practice to store this list in a separate
-variable, called ``SIDECHAINS_RST`` here.
+variable, called ``SIDECHAIN_RST`` here.
 
 For the actual code, you should keep in mind that a |python| module may be
 rather complex. There is for sure |python| code, there could be a bit of |C++|
@@ -396,16 +461,16 @@ a couple of examples around in this repository. Here is the most basic
 .. code-block:: cmake
   :linenos:
 
-  set(SIDECHAINS_PYMOD
+  set(SIDECHAIN_PYMOD
   __init__.py
   )
 
-  pymod(NAME sidechains PY ${SIDECHAINS_PYMOD})
+  pymod(NAME sidechain PY ${SIDECHAIN_PYMOD})
 
 Source files should be again listed in a dedicated variable. Later, you
 probably add some |C++| code and settings diverging from the defaults via the
 ``pymod`` macro. This is where things clutter up quite quickly. As set up here,
-your project would be added as a module ``sidechains`` in the |project|
+your project would be added as a module ``sidechain`` in the |project|
 |python| package tree.
 
 The final step towards |cmake| is to register your module's directory in the
@@ -413,131 +478,26 @@ top level :file:`CMakeLists.txt`:
 
 .. code-block:: cmake
   :linenos:
-  :emphasize-lines: 104
-
-  #-------------------------------------------------------------------------------
-  # Author: Bienchen
-  #-------------------------------------------------------------------------------
-  # Options to CMake:
-  #    DISABLE_DOCUMENTATION: Don't build documentation, don't search for Sphinx
-  #    DISABLE_DOCTEST: Don't run example code from documentation on 'make check'
-  #    DISABLE_LINKCHECK: Don't test links from documentation on 'make check'
-  # (if documentation is disabled, there is no doctest, linkcheck at all)
-  cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
-  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake_support)
-
-  project(ProMod3 CXX C)
-
-  include(PROMOD3)
-
-  set(PROMOD3_VERSION_MAJOR 0)
-  set(PROMOD3_VERSION_MINOR 1)
-  set(PROMOD3_VERSION_PATCH 0)
-  set(PROMOD3_VERSION_STRING ${PROMOD3_VERSION_MAJOR}.${PROMOD3_VERSION_MINOR}.${PROMOD3_VERSION_PATCH})
-
-  option(DISABLE_DOCUMENTATION "Do not build documentation" OFF)
-  option(DISABLE_DISABLE_DOCTEST "Do not check examples in documentation" OFF)
-  option(DISABLE_DISABLE_LINKCHECK "Do not check links in the documentation" OFF)
-
-  if (CMAKE_COMPILER_IS_GNUCXX)
-    exec_program(gcc ARGS --version OUTPUT_VARIABLE CMAKE_C_COMPILER_VERSION)
-    if(CMAKE_C_COMPILER_VERSION MATCHES ".*4\\.[5-9].*")
-      set(PROMOD_GCC_45 true)
-    else()
-      set(PROMOD_GCC_45 false)
-    endif()
-  endif()
-
-  if (OPTIMIZE)
-    set(CMAKE_BUILD_TYPE Release)
-    set(_OPT ON)
-  else()
-     set(CMAKE_BUILD_TYPE Debug)
-     set(_OPT OFF)
-  endif()
-
-  setup_stage()
-  file(MAKE_DIRECTORY ${STAGE_DIR}
-       ${EXECUTABLE_OUTPUT_PATH}
-       ${HEADER_STAGE_PATH}
-       ${LIB_STAGE_PATH}
-       ${LIBEXEC_STAGE_PATH})
-
-  setup_compiler_flags()
-  setup_boost()
-
-  find_package(Python 2.7 REQUIRED)
-  if(NOT DISABLE_DOCUMENTATION)
-    find_package(Sphinx ${PYTHON_VERSION} REQUIRED)
-    set(PYTHON_DOC_URL "https://docs.python.org/${PYTHON_VERSION}")
-    # set this to the URL corresponding to the version of OST you are using
-    set(OST_DOC_URL "http://www.openstructure.org/docs/1.3")
-  endif()
-  find_package(OPENSTRUCTURE 1.4 REQUIRED
-               COMPONENTS io mol seq seq_alg mol_alg conop)
-  find_package(QMEAN 1.0 REQUIRED)
-
-
-  #The KIC loop closing algorithm requires a solver for a generalised eigen
-  #problem. Eigen3 would provide such a solver, but only allows to extract
-  #the resulting eigenvalues and not the eigenvectors.
-  #As soon as there is an Eigen3 release with the required functionality,
-  #The Lapack dependency can be dropped.
-  find_package(LAPACK)
-
-  if (CMAKE_COMPILER_IS_GNUCXX)
-    # do not write back into cache, otherwise the compile command line gets
-    # expanded with multiple -fno-strict-aliasing flags, triggering a complete
-    # rebuild whenever cmake is run
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-strict-aliasing")
-    if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "4.6")
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
-    endif("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "4.6")
-  endif()
-
-  # additional packages/ headers/ etc.
-  #  Eigen3 is mandatory right now but may vanish once OST switches to the same
-  #  version.
-  find_package(Eigen3 3.2.1 REQUIRED)
-  if(NOT EIGEN3_FOUND)
-    message(FATAL_ERROR "Eigen3 is essential for building ${PROJECT_NAME}.")
-  endif()
-
-  # basic environment
-  include_directories(${Boost_INCLUDE_DIRS}
-                      ${OST_INCLUDE_DIR}
-                      ${QMEAN_INCLUDE_DIR}
-                      ${EIGEN3_INCLUDE_DIR})
-
-  set(FILES_TO_BE_REMOVED ${PROJECT_BINARY_DIR}/stage)
-  set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
-                               "${FILES_TO_BE_REMOVED}")
+  :emphasize-lines: 8
+
+  ## <lots of cmake commands...>
 
   ## sub dirs to be recognised by CMake
   ## e.g. add_subdirectory(src), subdirs have their own CMakeLists.txt
   add_subdirectory(config)
   add_subdirectory(core)
   add_subdirectory(modelling)
-  add_subdirectory(sidechains)
+  add_subdirectory(sidechain)
   add_subdirectory(loop)
   add_subdirectory(scripts)
   add_subdirectory(actions)
   add_subdirectory(extras)
-  if(NOT DISABLE_DOCUMENTATION)
-    add_changelog_to_doc(FILE "${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG")
-    add_subdirectory(doc)
-  endif()
-
-  ## report setup
-  message(STATUS "${PROJECT_NAME} will be built with the following options:\n"
-          "   OpenStructure (-DOST_ROOT) : ${OST_ROOT}\n"
-          "   QMEAN         (-DQMEAN_ROOT) : ${QMEAN_ROOT}\n"
-          "   Optimized     (-DOPTIMIZE) : ${_OPT}\n"
-          "   Python                     : ${PYTHON_BINARY}\n"
-          "   Eigen3                     : ${EIGEN3_INCLUDE_DIR}\n")
+  add_subdirectory(cmake_support)
+
+  ## <lots of cmake commands...>
 
 All that needs to be done for |cmake| to recognise your module is adding its
-directory as shown in line 104.
+directory as shown in line 8.
 
 This was the final step to set up the build system. Running |cmake| at this
 point would create the build environment in place. But building software in
@@ -578,52 +538,24 @@ good practice to develop new functionality along tests and that right from the
 beginning. At some point, new code needs testing anyway to see if it does what
 it should, so just do this by writing unit tests. Test sources are stored in
 files with a prefix :file:`test_` and usually come per submodule instead of
-sporting a single monolithic :file:`test_sidechains.py`.
-
-|python| code is evaluated using its own
-:py_docs:`unit testing framework <library/unittest.html>` with a little help
-from |ost_s|_ (|C++| uses the |boost| `Test Library <http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/index.html>`_).
-The basic scheme is to import your module, subclass :class:`unittest.TestCase`
-and make the whole file runnable as script using the most common |nameattr|_
-attribute. A file :file:`tests/test_something.py` could look like this,
-carrying a single test case:
-
-.. testcode:: promod3unittest
-  :hide:
-
-  import unittest
-
-  class something():
-      @staticmethod
-      def Else():
-          return 1
-
-  class SomethingTests(unittest.TestCase):
-      def testFileExistsFalse(self):
-          self.assertEquals(something.Else(), 1)
-
-  if __name__ == "__builtin__":
-      suite = unittest.TestLoader().loadTestsFromTestCase(SomethingTests)
-      unittest.TextTestRunner().run(suite)
-
-.. code-block:: python
+sporting a single monolithic :file:`test_sidechain.py`.
+
+|python| code is evaluated using its own :py_docs:`unit testing framework
+<library/unittest.html>` with a little help from |ost_s|_ (|C++| uses the
+|boost| `Test Library
+<http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/index.html>`_). The
+basic scheme is to import your module, subclass :class:`unittest.TestCase` and
+make the whole file runnable as script using the most common |nameattr|_
+attribute. As an example we test the :func:`promod3.sidechain.Reconstruct`
+function:
+
+.. literalinclude:: ../../tests/doc/scripts/unittest_sidechain.py
   :linenos:
 
-  import unittest
-  from promod3.sidechains import something
-
-  class SomethingTests(unittest.TestCase):
-      def testFileExistsFalse(self):
-          self.assertEquals(something.Else(), 1)
-
-  if __name__ == "__main__":
-      from ost import testutils
-      testutils.RunTests()
-
 To hook up your tests with ``make codetest`` (and to create a
-``test_something.py_run`` target), everything has to be introduced to |cmake|.
+``test_reconstruct.py_run`` target), everything has to be introduced to |cmake|.
 First, tell |cmake| to search :file:`tests` for a :file:`CMakeLists.txt` file
-by extending the list of sub-directories in :file:`sidechains/CMakeLists.txt`:
+by extending the list of sub-directories in :file:`sidechain/CMakeLists.txt`:
 
 .. code-block:: cmake
   :linenos:
@@ -632,21 +564,31 @@ by extending the list of sub-directories in :file:`sidechains/CMakeLists.txt`:
    add_subdirectory(doc)
    add_subdirectory(tests)
 
-Then fill :file:`sidechains/tests/CMakeLists.txt` with your new test script and
+Then fill :file:`sidechain/tests/CMakeLists.txt` with your new test script and
 ``make`` will recognise the changes next time it is run and fix the rest for
 you.
 
 .. code-block:: cmake
   :linenos:
 
-   set(SIDECHAINS_UNIT_TESTS
-   test_something.py
-   )
+  set(SIDECHAIN_UNIT_TESTS
+    test_reconstruct.py
+  )
+
+  set(SIDECHAIN_TEST_DATA
+    data/1eye.pdb
+    data/1eye_rec.pdb
+  )
+
+  promod3_unittest(MODULE sidechain
+                   SOURCES "${SIDECHAIN_UNIT_TESTS}"
+                   DATA "${SIDECHAIN_TEST_DATA}")
 
-   promod3_unittest(MODULE sidechains SOURCES "${SIDECHAINS_UNIT_TESTS}")
+Note how we listed the test data that we require in the unit test by defining
+``SIDECHAIN_TEST_DATA``.
 
 Now tests should be available by ``make check``, ``make codetest`` and
-``make test_something.py_run``.
+``make test_reconstruct.py_run``.
 
 --------------------------------------------------------------------------------
 How To Start Your Own Action
@@ -701,57 +643,7 @@ Just add your action with its full filename with a call to
 Before coding your action, lets set up unit tests for it. Usually when adding
 features, you will immediately try them, check that everything works as
 intended, etc.. |project| helps you automatising those tests so its rather easy
-to check later, if code changes break anything. Start with a file
-:file:`actions/tests/test_action_awesome.py`:
-
-.. testcode:: contribute_action
-  :hide:
-
-  import sys
-  sys.dont_write_bytecode = True
-
-  import test_actions
-  import unittest
-
-  class DoAwesomeActionTests(test_actions.ActionTestCase):
-      def __init__(self, *args, **kwargs):
-          test_actions.ActionTestCase.__init__(self, *args, **kwargs)
-          self.pm_bin = os.path.join(os.getcwd(), os.pardir, 'stage', 'bin',
-                                     'pm')
-          self.pm_action = 'help'
-
-      def testExit0(self):
-          self.RunExitStatusTest(0, list())
-
-  if __name__ == "__builtin__":
-      import os
-      suite = unittest.TestLoader().loadTestsFromTestCase(DoAwesomeActionTests)
-      unittest.TextTestRunner().run(suite)
-
-.. code-block:: python
-  :linenos:
-
-  import sys
-
-  # this is needed so there will be no test_actions.pyc created in the source
-  # directory
-  sys.dont_write_bytecode = True
-
-  import test_actions
-
-  class AwesomeActionTests(test_actions.ActionTestCase):
-      def __init__(self, *args, **kwargs):
-          test_actions.ActionTestCase.__init__(self, *args, **kwargs)
-          self.pm_action = 'awesome'
-
-      def testExit0(self):
-          self.RunExitStatusTest(0, list())
-
-  if __name__ == "__main__":
-      from ost import testutils
-      testutils.RunTests()
-
-Please note that for actions we are using
+to check later, if code changes break anything.  For actions, we are using
 :class:`test_actions.ActionTestCase <test_actions>` instead of
 :class:`unittest.TestCase`. Since testing has a lot in common for different
 actions, we decided to put up a little wrapper around this subject. See the
@@ -783,7 +675,7 @@ directory. There are only two really important points:
          <put together what your action should do here>
 
   start putting your action together.
-
+  
 --------------------------------------------------------------------------------
 Third Party Contributions (License Issues)
 --------------------------------------------------------------------------------
@@ -823,12 +715,12 @@ contributions to web pages using |project|.
 .. _pylint: http://www.pylint.org
 ..  LocalWords:  cmake hotfix doctest linkcheck rebase BRANCHNAME rebasing py
 ..  LocalWords:  CMakeLists txt rst pymod init submodule src restructuredtext
-..  LocalWords:  makefiles formatters Changelog codetest promod sidechains io
+..  LocalWords:  makefiles formatters Changelog codetest promod sidechain io
 ..  LocalWords:  mkdir linenos subdirectory abrv emphasize CXX GNUCXX gcc fno
 ..  LocalWords:  ARGS endif OPTIMIZE LIBEXEC Wno DIRS dirs subdirs config dbg
 ..  LocalWords:  changelog Optimized DOPTIMIZE gitignore cd conf subtree attr
-..  LocalWords:  unittest TestCase nameattr testcode staticmethod builtin cp
-..  LocalWords:  SomethingTests testFileExistsFalse testutils RunTests DQMEAN
+..  LocalWords:  unittest TestCase nameattr staticmethod builtin cp
+..  LocalWords:  testFileExistsFalse testutils RunTests DQMEAN
 ..  LocalWords:  pre API inline CMake hh ProMod Bienchen OST OPENSTRUCTURE os
 ..  LocalWords:  mol alg conop QMEAN KIC eigen eigenvectors Lapack 
 ..  LocalWords:  OpenStructure ost pylint chmod sys pyc dont bytecode args
diff --git a/doc/html/_sources/core/helper.txt b/doc/html/_sources/core/helper.txt
index fac343701e67c0d0c3a039866a507318ada49a82..03d2cef127c61cb16af4680f5580673c34dae2e7 100644
--- a/doc/html/_sources/core/helper.txt
+++ b/doc/html/_sources/core/helper.txt
@@ -16,75 +16,17 @@ rather empty modules left alone.
 Messages
 --------------------------------------------------------------------------------
 
-.. testcode:: helper
-  :hide:
-
-  from promod3.core import helper
-
-  try:
-     helper.MsgErrorAndExit("Something failed!", 1)
-  except SystemExit, e:
-     if e.code == 1:
-       pass
-     else:
-       raise
-
-.. testoutput:: helper
-  :hide:
-
-  Something failed!
-
-.. doctest:: helper
-
-  from promod3.core import helper
-
-  helper.MsgErrorAndExit("Something failed!", 1)
+.. literalinclude:: ../../../tests/doc/scripts/core_msg_error.py
 
 .. autofunction:: MsgErrorAndExit
 
 File Tests
 --------------------------------------------------------------------------------
 
-.. testcode:: helper
-  :hide:
-
-  import os
-  import tempfile
-  from promod3.core import helper
-  from promod3.core import pm3argparse
-
-  (fh, fn) = tempfile.mkstemp(suffix='.pdb')
-  os.close(fh)
-
-  p = pm3argparse.PM3ArgumentParser('Dummy')
-  p.add_argument('file', type=str)
-  opts = p.Parse([fn])
-
-  helper.FileExists('Test file', 1, opts.file)
-
-  opts.name, opts.ext, opts.gz = helper.FileExtension('Test file', 2,
-                                                        opts.file,
-                                                        ('pdb', 'mmcif'),
-                                                        gzip=True)
-
-  os.remove(fn)
-
-.. doctest:: helper
-
-  from promod3.core import helper
-  from promod3.core import pm3argparse
-
-  p = pm3argparse.PM3ArgumentParser(__doc__)
-  p.add_argument('file', type=str)
-  opts = p.Parse()
-
-  helper.FileExists('Test file', 1, opts.file)
-
-  opts.name, opts.ext, opts.gz = helper.FileExtension('Test file', 2,
-                                                        opts.file,
-                                                        ('pdb', 'mmcif'),
-                                                        gzip=True)
+The following example parses an argument (call as ``pm SCRIPTNAME FILENAME``) as
+a file name and checks whether it is a ``pdb`` or ``mmcif`` file.
 
+.. literalinclude:: ../../../tests/doc/scripts/core_file_checks.py
 
 .. autofunction:: FileExists
 
diff --git a/doc/html/_sources/core/pm3argparse.txt b/doc/html/_sources/core/pm3argparse.txt
index 1da913d23a33b67aac068eaa8d63d92e2940e98b..927faf547e89cc54e508fa38abfbf18b39fb217b 100644
--- a/doc/html/_sources/core/pm3argparse.txt
+++ b/doc/html/_sources/core/pm3argparse.txt
@@ -19,39 +19,12 @@ simplification. It provides a set of standard arguments you just need to
 activate for your action plus it comes with some verification functionality for
 input.
 
-.. testcode:: helper
-  :hide:
-
-  from promod3.core import pm3argparse
-
-  testparser = pm3argparse.PM3ArgumentParser('Dummy')
-  testparser.AddAlignment()
-  testparser.AssembleParser()
-
-  try:
-    opts = testparser.Parse(['-h'])
-  except SystemExit, sysex:
-    if sysex.code == 0:
-      pass
-
-.. doctest:: pm3argparse
-
-  '''
-  Place the description of your script right in the file and import
-  it via '__doc__' as description to the parser ('-h', '--help').
-  '''
-
-  from promod3.core import pm3argparse
-
-  # make sure we see output when passing '-h'
-  import ost
-  ost.PushVerbosityLevel(2) 
-
-  parser = pm3argparse.PM3ArgumentParser(__doc__)
-  parser.AddAlignment()
-  parser.AssembleParser()
-  opts = parser.Parse()
+.. literalinclude:: ../../../tests/doc/scripts/core_pm3argparse.py
 
+When the example above is run with ``pm`` and no additional arguments, the
+script exits with a code 2. If it is run with an additional argument ``-h`` or
+``--help``, it exits with a code 0 and displays the help message given as a
+docstring in your script.
 
 Argument Parser
 --------------------------------------------------------------------------------
diff --git a/doc/html/_sources/developers.txt b/doc/html/_sources/developers.txt
index 2c4a920b9f8005e7f84f5e8787e98b31b7c23002..b4da85fbf8cb77af13ccf64c73378f4be3b941dc 100644
--- a/doc/html/_sources/developers.txt
+++ b/doc/html/_sources/developers.txt
@@ -1,23 +1,16 @@
 Documentation For Developers
 ===============================================================================
-.. give an intro on what will be stored here
-.. topics: how to create a new module, how to do doc (rst_epillog),
-           little bit on doctest & linkcheck, unit tests, directory structure
+
+This section is for developers that wish to extending the functionality of
+|project|. It describes helper classes for development and how to contribute
+new features.
 
 Contents:
 
 .. toctree::
    :maxdepth: 2
 
-   gettingstarted
-   core/setcompoundschemlib
-   core/index
-   modelling/index
-   loop/index
-   sidechain/index
-   actions/index_dev
-   buildsystem
    contributing
+   actions/index_dev
    cmake/index
-
-.. todolist::
+   portableIO
diff --git a/doc/html/_sources/gettingstarted.txt b/doc/html/_sources/gettingstarted.txt
index 696d3827d343aadf28d13eae1f96e50d40994ceb..55c8ccfd47998d8d175e763f4044da79eeb6ec80 100644
--- a/doc/html/_sources/gettingstarted.txt
+++ b/doc/html/_sources/gettingstarted.txt
@@ -5,9 +5,8 @@ Get and Run |project|
 --------------------------------------------------------------------------------
 First steps to get |project| up and running:
 
-#. Get |ost_s|_.
-#. Get |project| from the ``git`` repository (see :ref:`here <git-branches>`).
-#. Compile |project| with ``cmake`` and ``make`` (see :ref:`here <building-promod>`).
+#. Obtain all dependencies and compile |project| with ``cmake`` and ``make``
+   (see :ref:`here <building-promod>`).
 #. Ensure that you have a ``stage/bin`` folder which includes a ``pm`` executable.
    For convenience, add the folder to your ``PATH`` env. variable.
 #. You can now execute |project| by running the following in your terminal:
@@ -21,15 +20,7 @@ First steps to get |project| up and running:
   - a predefined "action" (execute ``pm help`` for a list of possible actions)
   - the path to a python script, such as the following example:
 
-    .. code-block:: python
-
-      from ost import io
-      from promod3 import loop
-
-      # generate backbone with dihedrals of a helix and store it
-      sequence = "HELLYEAH"
-      bb_list = loop.BackboneList(sequence)
-      io.SavePDB(bb_list.ToEntity(), "test.pdb")
+    .. literalinclude:: ../../tests/doc/scripts/hello_world.py
 
     The execution of this script should generate a ``test.pdb`` file, which you
     can visualize with any pdb reader (e.g. ``dng`` from |ost_s|).
@@ -41,7 +32,8 @@ Modelling pipeline
 Commonly, your input is a template structure and an alignment of the template to 
 the desired target sequence. The modelling steps then are:
 
-- Build a raw model from the template (see :func:`~promod3.modelling.BuildRawModel` function)
+- Build a raw model from a template by copying the part of the template which
+  is conserved
 - Perform loop modelling to close all gaps (see :mod:`~promod3.loop` module)
 - Reconstruct sidechains (see :mod:`~promod3.sidechain` module)
 - Minimize energy of final model using molecular mechanics
diff --git a/doc/html/_sources/index.txt b/doc/html/_sources/index.txt
index 102c6f135af0d24c2a767c4bbb277e3f6cba9659..0699c60545cfc1014f4753e6f9a6b8647e822cc7 100644
--- a/doc/html/_sources/index.txt
+++ b/doc/html/_sources/index.txt
@@ -13,9 +13,12 @@ Contents:
 
    Users <users>
    Developers <developers>
-   changelog
 
-.. todolist::
+.. toctree::
+   :maxdepth: 1
+
+   changelog
+   
 
 Indices And Tables
 ==================
diff --git a/doc/html/_sources/loop/backbone.txt b/doc/html/_sources/loop/backbone.txt
index 14508e46ba1c01eb6e02497c8904d5a4f0c50cb9..1c4f6634e5861d714a7d04d472bff243916afa51 100644
--- a/doc/html/_sources/loop/backbone.txt
+++ b/doc/html/_sources/loop/backbone.txt
@@ -10,39 +10,7 @@ a residue. For simple structural manipulations they can be gathered to a
 :class:`BackboneList` that can be inserted into or converted to a 
 :class:`ost.mol.EntityHandle` at any time.
 
-.. code-block:: python
-
-  from ost import io
-  from promod3 import loop
-
-  sequence = "AAAAAAAA"
-
-  #The backbone gets initially constructed with backbone dihedrals
-  #typical for helices
-  bb_list = loop.BackboneList(sequence)
-
-  #let's have a look at the set dihedral angles
-  for i in range(len(bb_list)):
-    print "Looking at position ",i
-    if i > 0:
-      print "phi: ", bb_list.GetPhiTorsion(i)
-    if i < len(bb_list)-1:
-      print "psi: ", bb_list.GetPsiTorsion(i)
-
-
-  #we now use a TorsionSampler to set random dihedral angles
-  torsion_sampler = loop.LoadTorsionSampler()
-  idx = torsion_sampler.GetHistogramIndex("ALA","ALA","ALA")
-  for i in range(len(bb_list)):
-    dihedrals = torsion_sampler.Draw(idx)
-    if i > 0:
-      bb_list.SetPhiTorsion(i,dihedrals[0])
-    if i < len(bb_list)-1:
-      bb_list.SetPsiTorsion(i,dihedrals[1])
-
-  #let's save down the randomized fragment
-  io.SavePDB(bb_list.ToEntity(),"randomized_fragment.pdb")
-
+.. literalinclude:: ../../../tests/doc/scripts/loop_backbone.py
 
 
 The Basic Building Blocks
@@ -163,18 +131,20 @@ Editing Full Stretches Of Backbone Residues
     Creates a BackboneList from given **sequence** and **dihedral_angles**
 
     :param sequence:    Sequence of created BackboneList
-    :param dihedral_angles: List of :class:`tuple` objects defining the backbone dihedral
-                            angles of created BackboneList. Every :class:`tuple` must
-                            either have two or three elements. Two elements are considered
-                            to define the phi and psi angles, leading to an idealized omega
-                            angle of 180 degrees. In case of three elements, all angles
-                            are defined.
+    :param dihedral_angles: List of :class:`tuple` objects defining the backbone
+                            dihedral angles of created BackboneList. Every
+                            :class:`tuple` must either have two or three
+                            elements. Two elements are considered to define the
+                            phi and psi angles, leading to an idealized omega
+                            angle of 180 degrees. In case of three elements, all
+                            angles are defined.
+
 
     :type sequence:     :class:`str`
     :type dihedral_angles: :class:`list`
 
-    :raises:            :class:`RuntimeError` If **sequence** and **dihedral_angles**
-                        are inconsistent in size.   
+    :raises:            :exc:`~exceptions.RuntimeError` if **sequence** and 
+                        **dihedral_angles** are inconsistent in size.   
 
   .. method:: BackboneList(sequence, residues)
 
@@ -188,9 +158,9 @@ Editing Full Stretches Of Backbone Residues
     :type sequence:     :class:`str`
     :type residues:     :class:`list`
 
-    :raises:            :class:`RuntimeError` If **sequence** and **residues**
-                        are inconsistent in size or when there is a residue not
-                        providing all necessary positions. 
+    :raises:            :exc:`~exceptions.RuntimeError` if **sequence** and 
+                        **residues** are inconsistent in size or when there is
+                        a residue not providing all necessary positions. 
 
 
   .. method:: ToEntity()
@@ -204,7 +174,26 @@ Editing Full Stretches Of Backbone Residues
 
     :return:            The amino acid sequence
 
-  .. method:: InsertInto(chain,start_resnum,[remodel_cterminal_o = True])
+  .. method:: SetSequence(sequence)
+
+    Set amino acid sequence.
+
+  .. method:: Extract(from, to)
+
+    :returns: Items with indices *from*, ..., *to*-1 of this list.
+    :rtype:   :class:`BackboneList`
+
+  .. method:: MinCADistance(other)
+
+    Calculates the minimal pairwise CA-distance between this and the *other*
+    :class:`BackboneList`
+
+    :param other:       The other :class:`BackboneList`
+    :type other:        :class:`BackboneList`
+
+    :returns:           Minimal pairwise CA-distance
+
+  .. method:: InsertInto(chain, start_resnum, remodel_cterminal_o=True)
 
     Inserts the backbone list into the **chain**. If the residues corresponding
     to the :class:`BackboneList` are already present in the entity, they will
@@ -227,7 +216,7 @@ Editing Full Stretches Of Backbone Residues
     Does a simple reconstruction of all CBeta positions based on the actual
     n, ca, and c positions.
 
-  .. method:: ReconstructOxygenPositions([last_psi = -0.78540])
+  .. method:: ReconstructOxygenPositions(last_psi=-0.78540)
 
     Does a simple reconstruction of all oxygen positions based on the actual
     n, ca and c positions. The position of the last oxygen depends on the next
@@ -238,21 +227,14 @@ Editing Full Stretches Of Backbone Residues
 
     :type last_psi:     :class:`float`
 
-  .. method:: ApplyTransform(transformation_matrix)
-
-    Applies a transformation to the positions of the the :class:`BackboneList`.
-
-    :param transformation_matrix:       The transformation
-    :type transformation_matrix:        :class:`ost.geom.Mat4`
-
   .. method:: ApplyTransform(transform)
 
-    Applies a transformation to the positions of the the :class:`BackboneList`.
+    Applies a transformation to the positions of the :class:`BackboneList`.
 
-    :param transform:            The transformation
-    :type transform:        :class:`ost.geom.Transform`
+    :param transform:  The transformation
+    :type transform:   :class:`ost.geom.Transform` / :class:`ost.geom.Mat4`
 
-  .. method:: SetPhiTorsion(index,angle[,sequential=False])
+  .. method:: SetPhiTorsion(index, angle, sequential=False)
 
     Sets the *phi* torsion angle of the backbone at position **index** in the :class:`BackboneList`.
 
@@ -264,7 +246,7 @@ Editing Full Stretches Of Backbone Residues
     :type angle:             :class:`float`
     :type sequential:         :class:`bool`
 
-  .. method:: SetPsiTorsion(index,angle[,sequential=False])
+  .. method:: SetPsiTorsion(index, angle, sequential=False)
 
     Sets the *psi* torsion angle of the backbone at position **index** in the :class:`BackboneList`.
 
@@ -276,7 +258,7 @@ Editing Full Stretches Of Backbone Residues
     :type angle:             :class:`float`
     :type sequential:         :class:`bool`
 
-  .. method:: SetOmegaTorsion(index,angle[,sequential=False])
+  .. method:: SetOmegaTorsion(index, angle, sequential=False)
 
     Sets the *omega* torsion angle of the backbone at position **index** in the :class:`BackboneList`.
 
@@ -288,7 +270,7 @@ Editing Full Stretches Of Backbone Residues
     :type angle:             :class:`float`
     :type sequential:         :class:`bool`
 
-  .. method:: SetPhiPsiTorsion(index,phi, psi[,sequential=False])
+  .. method:: SetPhiPsiTorsion(index, phi, psi, sequential=False)
 
     Sets the *phi* and *psi* torsion angle of the backbone at position **index** in the :class:`BackboneList`.
 
@@ -302,7 +284,28 @@ Editing Full Stretches Of Backbone Residues
     :type psi:             :class:`float`
     :type sequential:         :class:`bool`
 
-  .. method:: RotateAroundPhiTorsion(index,angle[,sequential=False])
+  .. method:: GetPhiTorsion(index)
+
+    Get the *phi* torsion angle of the residue with **index** in the :class:`BackboneList`
+
+    :param index:           The index
+    :type index:            :class:`int`
+
+  .. method:: GetPsiTorsion(index)
+
+    Get the *psi* torsion angle of the residue with **index** in the :class:`BackboneList`
+
+    :param index:           The index
+    :type index:            :class:`int`
+
+  .. method:: GetOmegaTorsion(index)
+
+    Get the *omega* torsion angle of the residue with **index** in the :class:`BackboneList`
+
+    :param index:           The index
+    :type index:            :class:`int`
+
+  .. method:: RotateAroundPhiTorsion(index, angle, sequential=False)
 
     Rotates the *phi* torsion angle of the backbone at position **index** in the :class:`BackboneList` by **angle**.
 
@@ -314,7 +317,7 @@ Editing Full Stretches Of Backbone Residues
     :type angle:             :class:`float`
     :type sequential:         :class:`bool`
 
-  .. method:: RotateAroundPsiTorsion(index,angle[,sequential=False])
+  .. method:: RotateAroundPsiTorsion(index, angle, sequential=False)
 
     Rotates the *psi* torsion angle of the backbone at position **index** in the :class:`BackboneList` by **angle**.
 
@@ -326,7 +329,7 @@ Editing Full Stretches Of Backbone Residues
     :type angle:             :class:`float`
     :type sequential:         :class:`bool`
 
-  .. method:: RotateAroundOmegaTorsion(index,angle[,sequential=False])
+  .. method:: RotateAroundOmegaTorsion(index, angle, sequential=False)
 
     Rotates the *omega* torsion angle of the backbone at position **index** in the :class:`BackboneList` by **angle**.
 
@@ -338,7 +341,7 @@ Editing Full Stretches Of Backbone Residues
     :type angle:             :class:`float`
     :type sequential:         :class:`bool`
 
-  .. method:: RotateAroundPhiPsiTorsion(index,phi, psi[,sequential=False])
+  .. method:: RotateAroundPhiPsiTorsion(index, phi, psi, sequential=False)
 
     Rotates the *phi* and *psi* torsion angle of the backbone at position **index** in the :class:`BackboneList` by **phi** and **psi**.
 
@@ -352,30 +355,10 @@ Editing Full Stretches Of Backbone Residues
     :type psi:             :class:`float`
     :type sequential:         :class:`bool`
 
-  .. method:: GetPhiTorsion(index)
+  .. method:: ReplaceFragment(sub_fragment, index, superpose_stems)
 
-    Get the *phi* torsion angle of the residue with **index** in the :class:`BackboneList`
-
-    :param index:           The index
-    :type index:            :class:`int`
-
-  .. method:: GetPsiTorsion(index)
-
-    Get the *psi* torsion angle of the residue with **index** in the :class:`BackboneList`
-
-    :param index:           The index
-    :type index:            :class:`int`
-
-  .. method:: GetOmegaTorsion(index)
-
-    Get the *omega* torsion angle of the residue with **index** in the :class:`BackboneList`
-
-    :param index:           The index
-    :type index:            :class:`int`
-
-  .. method:: ReplaceFragment(sub_fragment,index,superpose_stems)
-
-    Replaces a fragment of the :class:`BackboneList` starting at position **index** by the **sub_fragment**.
+    Replaces a fragment of the :class:`BackboneList` starting at position
+    **index** by the **sub_fragment**.
 
     :param sub_fragment:          The fragment to be inserted
     :param index:                 The position at which the fragment 
@@ -390,11 +373,11 @@ Editing Full Stretches Of Backbone Residues
     :type index:                  :class:`int`
     :type superpose_stems:        :class:`bool`
 
-    :raises:                      :class:`RuntimeError` If **sub_fragment**
-                                  does not fully fit into actual fragment at
-                                  specified **index**
+    :raises:                      :exc:`~exceptions.RuntimeError` if
+                                  **sub_fragment** does not fully fit into
+                                  actual fragment at specified **index**
 
-  .. method:: CARMSD(other[,superposed_rmsd=False])
+  .. method:: CARMSD(other, superposed_rmsd=False)
 
     Calculates the C-alpha RMSD between this :class:`BackboneList` and an **other** backbone list.
     
@@ -404,7 +387,7 @@ Editing Full Stretches Of Backbone Residues
     :type other:              :class:`BackboneList`
     :type superposed_rmsd:    :class:`bool`
 
-  .. method:: RMSD(other[,superposed_rmsd=False])
+  .. method:: RMSD(other, superposed_rmsd=False)
 
     Calculates the RMSD between this :class:`BackboneList` and an **other** backbone list.
     
@@ -421,6 +404,16 @@ Editing Full Stretches Of Backbone Residues
     :param other:       The other backbone list
     :type other:        :class:`BackboneList`
 
+  .. method:: GetTransform(other)
+
+    Get transofrm to superpose this :class:`BackboneList` onto another one
+
+    :param other:     The other backbone list
+    :type other:      :class:`BackboneList`
+
+    :returns:         A 4x4 transformation matrix
+    :rtype:           :class:`ost.geom.Mat4`
+
   .. method:: append(bb)
 
     Appends the backbone **bb** at the end of the :class:`BackboneList`.
@@ -428,4 +421,15 @@ Editing Full Stretches Of Backbone Residues
     :param bb:            The backbone
     :type bb:             :class:`Backbone`
 
+  .. method:: __getitem__(index)
+              __setitem__(index)
+
+    Allow read/write access (with [*index*]) to backbone at given *index*.
+
+  .. method:: __iter__()
+
+    Makes list iterable.
+
+  .. method:: __len__()
 
+    :returns:  Number of backbones in the list.
diff --git a/doc/html/_sources/loop/backbone_loop_score.txt b/doc/html/_sources/loop/backbone_loop_score.txt
index 55acd78a2b2914f613c3534380a89550d911d3b7..0868068ef43d5c356f5a8e267aeaffb0c59f91ca 100644
--- a/doc/html/_sources/loop/backbone_loop_score.txt
+++ b/doc/html/_sources/loop/backbone_loop_score.txt
@@ -3,43 +3,225 @@ Loop Scoring
 
 .. currentmodule:: promod3.loop
 
-
-|project| provides several terms to assess a loop conformations plausibility.
-This is done using the :class:`BackboneLoopScorer`. To be used, the scorer 
-must be initialized with a seqres. After initialization the structural 
-environment can be set. This environment defines the particles a certain 
-loop interacts with and can be reset/extended at any time in the modelling
-process. All values of the different scores can be set manually. Once the
-scores are set, the scorer can be saved/loaded from/to disk. 
-Some of the available scores are statistical potential based.
-When setting up an empty scorer, the parametrization and the score values
-of these potentials have to be set manually. 
-
 The BackboneLoopScorer
 --------------------------------------------------------------------------------
 
+The :class:`BackboneLoopScorer` provides several terms to assess a 
+loop conformations plausibility. All values of the different scores 
+can be set manually. Once the scores are set, the scorer can be 
+saved/loaded from/to disk. Setting the scores can be avoided by 
+just loading the default scorer, which should satisfy most needs. 
+To be used, the scorer must be initialized with a seqres. 
+After initialization the structural environment can be set. 
+This environment defines the particles a certain loop interacts with 
+and can be reset/extended at any time in the modelling process.
+To score a certain loop you must define its exact location in the
+environment using a *chain_idx* and *start_resnum*:
+
+* *chain_idx*:
+    Index of chain as it occurs in the sequence list you initialized
+    the scorer with (0 in case of a single sequence)
+
+* *start_resnum*:
+    Residue number defining the position in the SEQRES of chain with
+    index *chain_idx*. **The numbering starts for every chain with
+    the value 1**.
+
+The following scores are available:
+
+* **ClashScore:** (see :func:`~BackboneLoopScorer.CalculateClashScore`)
+    Calculates a simple clash score of a loop itself and with the set
+    environment. There is no need to define any parameters if you start with an
+    empty scorer.
+
+* **CBetaScore:** (see :func:`~BackboneLoopScorer.CalculateCBetaScore`)
+    Evaluates a pairwise pseudo interaction energy between CB atoms. If you
+    start with an empty scorer you need to parametrize the energy function by
+    calling :func:`~BackboneLoopScorer.SetCBetaPotentialParameters`. You can
+    then set an energy value for every possible pair of residues given the
+    distance of their CB atoms (see :func:`~BackboneLoopScorer.SetCBetaEnergy`).
+    Every pairwise interaction within the loop and to the environment gets
+    evaluated according to the given parametrization, summed up and finally
+    normalized by the number of total interactions.
+
+* **ReducedScore:** (see :func:`~BackboneLoopScorer.CalculateReducedScore`)
+    Evaluates a pairwise pseudo  interaction energy between the reduced
+    representation of residues. Every residue gets represented by its CA
+    position p and a directional component ``v = norm(ca_pos-n_pos) + norm
+    (ca_pos-c_pos)``. Assuming an interaction between residues r1 and r2, we can
+    define a line l between p1 and p2. The potential then considers:
+
+    * dist => distance between p1 and p2
+    * alpha => angle between v1 and l
+    * beta => angle between v2 and l
+    * gamma => dihedral between (p1+v1,p1,p2,p2+v2)
+
+    If you start with an empty scorer you need to parametrize the energy
+    function by calling
+    :func:`~BackboneLoopScorer.SetReducedPotentialParameters`. You can then set
+    an energy value for every possible pair of residues given the distance of
+    their CA atoms and the according angles (see
+    :func:`~BackboneLoopScorer.SetReducedEnergy`). Every pairwise interaction
+    within the loop and to the environment gets evaluated according to the given
+    parametrization, summed up and finally normalized by the number of total
+    interactions.
+
+* **TorsionScore:** (see :func:`~BackboneLoopScorer.CalculateTorsionScore`)
+    Evaluates pseudo energies based on the identity of three consecutive
+    residues and the phi/psi dihedral angles of the central residue. The group
+    definitions are the same as they are used in the :class:`TorsionSampler`. If
+    you start with an empty scorer you need to parametrize the energy function
+    by calling :func:`~BackboneLoopScorer.SetTorsionPotentialParameters`. You
+    can then set an energy value for every possible torsion group and dihedral
+    angle pair (see :func:`~BackboneLoopScorer.SetTorsionEnergy`). Every residue
+    gets evaluated according to the set parametrization and the final score gets
+    normalized by the total number of summed pseudo energies. The first phi and
+    last psi angle get determined with the help of the environment if set.
+
+* **CBPackingScore:** (see :func:`~BackboneLoopScorer.CalculateCBPackingScore`)
+    Evaluates pseudo energies by counting the number of other CB positions
+    within a certain cutoff radius of the CB position of the residue to be
+    evaluated. If you start with an empty scorer you need to parametrize the
+    energy function by calling
+    :func:`~BackboneLoopScorer.SetCBPackingPotentialParameters`. You can then
+    set an energy value for every possible residue type and the corresponding
+    number of surrounding CB positions (see
+    :func:`~BackboneLoopScorer.SetCBPackingEnergy`). Every residue gets
+    evaluated according to the set parametrization and the final score gets
+    normalized by the number of residues in the loop.
+
+* **HBondScore:** (see :func:`~BackboneLoopScorer.CalculateHBondScore`)
+    Evaluates pairwise HBond pseudo energies similar to the one defined in the
+    Rosetta energy function. It considers the CA, C and O positions from
+    backbone hbond acceptors in interaction with the N and H positions from the
+    backbone hbond donors. 4 Parameters describe their relative orientation.
+
+    * dist => H-O distance
+    * alpha => O-H-N angle
+    * beta => C-N-H angle
+    * gamma => CA-C-O-H dihedral angle
+
+    A pseudo energy function for these parameters is evaluated for three
+    different states. State 1 for helical residues, state 2 for extended
+    residues and state 0 for other residues. If the state of two interacting
+    particles is the same, thats the one from which the energy is extracted. In
+    all other cases, the energy is extracted from the 0 state. If you start with
+    an empty scorer you need to parametrize the energy function by calling
+    :func:`~BackboneLoopScorer.SetHBondPotentialParameters`. You can then set an
+    energy value for every possible state and the according parameters (see
+    :func:`~BackboneLoopScorer.SetHBondEnergy`). Every pairwise interaction
+    within the loop and to the environment gets evaluated according to the given
+    parametrization, summed up and finally normalized by the number of total
+    interactions.
+
+* **SSAgreementScore:** (see :func:`~BackboneLoopScorer.CalculateSSAgreementScore`)
+    Evaluates an SSAgreement score. Despite no parameters being given,
+    :func:`~BackboneLoopScorer.SetSSAgreementParameters` has to be called before
+    you can set any SSAgreement scores (see
+    :func:`~BackboneLoopScorer.SetSSAgreementScore`) since the memory has to be
+    allocated internally. The SSAgreement score itself relates a score to a
+    certain combination of psipred prediction, its confidence and the actually
+    occurring secondary structure in the model. In every score evaluation, the
+    secondary structure of the loop is estimated by searching for hydrogen bonds
+    leading to a secondary structure as defined by dssp. The hbonds are searched
+    internally in the loop as well as in the environment. Before you can call
+    the scoring function, you have to set the psipred prediction in the scorer.
+    The final score gets summed up over all residues in the loop and normalized
+    by the number of residues.
+
+* **ContactScore:** (see :func:`~BackboneLoopScorer.CalculateContactScore`)
+    Evaluates contacts with the environment and within the loop itself. You can
+    set arbitrary contact functions. They are defined by a score that gets
+    added when the CB atoms of two specific residues are within a maximal
+    distance. When evaluating a loop, the results of all contact functions
+    towards the environment get added as well as the loop internal contacts. The
+    returned value gets then normalized by the number of residues in the loop.
+
+* **ConstraintScore:** (see :func:`~BackboneLoopScorer.CalculateConstraintScore`)
+    Evaluates constraints with the environment and within the loop itself. You
+    can set arbitrary constraint functions. They are defined by a min and max
+    distance and an arbitrary list of score values. If the distance between the
+    CB atoms of two specific residues is within the min and max distance, the
+    constraint function returns the value at the according position in the score
+    list assuming equidistant binning. When evaluating a loop, the results of
+    all constraint functions towards the environment get added as well as the
+    loop internal constraints. The returned value gets then normalized by the
+    number of residues in the loop.
+
+* **TransOmegaTorsion:** (see :func:`~BackboneLoopScorer.TransOmegaTorsions`)
+    Does not really return a score but rather a boolean value. It evaluates,
+    whether there are any unfavorable trans omega torsion angles in the loop. If
+    you wish you can decide, whether you want to allow pre-proline trans omega
+    torsions.
+
+
+
 .. class:: BackboneLoopScorer
 
+  .. method:: Load(filename)
+
+    Loads raw binary file generated with :meth:`Save` (optimized for fast
+    reading).
+
+    :param filename:    Name of file, the scorer will be loaded from.
+
+    :type filename:     :class:`str`
+
+    :returns:           A scorer
+    :rtype:             :class:`BackboneLoopScorer`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - file assumes different memory-layout than is available on this
+                machine. Use :meth:`LoadPortable` to convert your file.
+
   .. method:: Save(filename)
 
+    Saves raw binary representation (optimized for fast reading).This puts many
+    assumptions on the memory-layout of the target-machine and hence it is not
+    portable. A portable version is provided by :meth:`SavePortable`.
+    Preferably portable files are distributed and converted to a raw binary
+    before using them.
+
     :param filename:    Name of file, the scorer will be dumped into.
                         All model specific information is lost.
 
-
     :type filename:     :class:`str`
 
-  .. method:: Load(filename)
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: LoadPortable(filename)
+
+    Loads portable file generated with :meth:`SavePortable` (slow but less
+    machine-dependent).
 
     :param filename:    Name of file, the scorer will be loaded from.
 
     :type filename:     :class:`str`
 
-    :raises:            :class:`RuntimeError` if file doesn't exist
+    :returns:           A scorer
+    :rtype:             :class:`BackboneLoopScorer`
 
-  .. method:: SetCBetaPotentialParameters(cbeta_cutoff, cbeta_bins, cbeta_seq_sep)
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - machine-dependent fundamental types are smaller than required.
+
+  .. method:: SavePortable(filename)
 
-    Parametrizes a pairwise distance dependent statistical potential considering
-    pairwise distances between cbeta atoms.
+    Saves portable binary representation (slow but less machine-dependent).
+
+    :param filename:    Name of file, the scorer will be dumped into.
+                        All model specific information is lost.
+
+    :type filename:     :class:`str`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: SetCBetaPotentialParameters(cbeta_cutoff, cbeta_bins, cbeta_seq_sep)
 
     :param cbeta_cutoff: The maximum distance of two cbeta atoms to be 
                          considered
@@ -54,23 +236,12 @@ The BackboneLoopScorer
     :type cbeta_bins:   :class:`int`
     :type cbeta_seq_sep: :class:`int`
 
-    :raises:            :class:`RuntimeError` if *cbeta_cutoff* is negative or
-                        *cbeta_bins* is <= 0
+    :raises: :exc:`~exceptions.RuntimeError` if *cbeta_cutoff* is negative or
+             *cbeta_bins* is <= 0
 
 
   .. method:: SetReducedPotentialParameters(dist_cutoff, dist_bins, angle_bins, dihedral_bins, seq_sep)
 
-    Parametrizes a pairwise statistical potential considering the relative
-    orientation of two residues. Every residue gets represented by its CA
-    position p and a directional component v = norm(ca_pos-n_pos) + norm(ca_pos-c_pos).
-    Assuming an interaction between residues r1 and r2, we can define a line l
-    between p1 and p2. The potential then considers:
-
-    * dist => distance between p1 and p2
-    * alpha => angle between v1 and l
-    * beta => angle between v2 and l
-    * gamma => dihedral between (p1+v1,p1,p2,p2+v2)
-
     :param dist_cutoff: The maximum distance of two residues to be 
                         considered
 
@@ -92,16 +263,11 @@ The BackboneLoopScorer
     :type dihedral_bins: :class:`int`
     :type seq_sep:     :class:`int`
 
-    :raises:            :class:`RuntimeError` if *dist_cutoff* is negative or one
-                        of the bin parameters is <= 0
+    :raises:  :exc:`~exceptions.RuntimeError` if *dist_cutoff* is negative or
+              one of the bin parameters is <= 0
 
   .. method:: SetTorsionPotentialParameters(group_definitions, torsion_bins)
 
-    Parametrizes a torsion statistical potential, that assigns energies based
-    on the identity of three consecutive residues and the phi/psi dihedral
-    angles of the central residue. The group definitions are the same as they
-    are used in the :class:`TorsionSampler`.
-
     :param group_definitions: List of strings describing groups of residues
                                   for which separate phi/psi dependent energies
                                   can be set.
@@ -111,17 +277,12 @@ The BackboneLoopScorer
     :type group_definitions: :class:`list`
     :type torsion_bins: :class:`int`
 
-    :raises:            :class:`RuntimeError` if torsion_bins is <= 0 or 
-                        one possible combination of the 20 standard amino
-                        acids is not covered by any entry of *group_definitions* 
-
+    :raises: :exc:`~exceptions.RuntimeError` if torsion_bins is <= 0 or 
+             one possible combination of the 20 standard amino
+             acids is not covered by any entry of *group_definitions* 
 
   .. method:: SetCBPackingPotentialParameters(cb_packing_cutoff, cb_packing_max_count)
 
-    Parametrizes a cb packing statistical potential, that assigns energies
-    based on the number of other cbeta atoms in the environment within a certain
-    cutoff distance.
-
     :param cb_packing_cutoff: Radius in which other cbeta atoms are counted
     :param cb_packing_max_count: If number of other cbeta atoms exceeds
                                  *cb_packing_max_count*, it will be set to
@@ -130,23 +291,11 @@ The BackboneLoopScorer
     :type cb_packing_cutoff: :class:`float`
     :type cb_packing_max_count: :class:`int`
 
-    :raises:            :class:`RuntimeError` if *cb_packing_cutoff* is < 0 or
-                        *cb_packing_max_count* is <= 0
+    :raises:  :exc:`~exceptions.RuntimeError` if *cb_packing_cutoff* is < 0 or
+              *cb_packing_max_count* is <= 0
 
   .. method:: SetHBondPotentialParameters(hb_min_d, hb_max_d, hb_min_alpha, hb_max_alpha, hb_min_beta, hb_max_beta, hb_min_gamma, hb_max_gamma, hb_d_bins, hb_alpha_bins, hb_beta_bins, hb_gamma_bins)
 
-    Parametrizes an HBond potential similar to the one defined in the Rosetta
-    energy function. It considers the CA, C and O positions from the hbond 
-    acceptor as well as the N and H positions from the hbond donor.
-    4 Parameters describe their relative orientation.
-    d is the H-O distance, alpha is the angle O-H-N, beta is the angle  C-N-H
-    and gamma is the dihedral between CA-C-O-H. An energy function for these
-    parameters is built for three different states. State 1 for helical
-    residues, state 2 for extended residues and state 0 for other residues.
-    If the state of two interacting particles is the same, thats the one
-    from which the energy is extracted. In all other cases, the energy is
-    extracted from the 0 state.
-
     :param hb_min_d:    Minimal H-O distance, that interaction gets considered.
     :param hb_max_d:    Maximal H-O distance, that interaction gets considered.
     :param hb_min_alpha: Minimal O-H-N angle, that interaction gets considered.
@@ -179,20 +328,13 @@ The BackboneLoopScorer
     :type hb_beta_bins: :class:`int`
     :type hb_gamma_bins: :class:`int`
 
-    :raises:            :class:`RuntimeError` if one of the bin parameters is <= 0
-                        or a max parameter is smaller than its min counterpart.
+    :raises: :exc:`~exceptions.RuntimeError` if one of the bin parameters is
+             <= 0 or a max parameter is smaller than its min counterpart.
 
 
   .. method:: SetSSAgreementParameters()
 
-    Parametrizes the SSAgreement score. Despite no parameters being given, this
-    function has to be called before you can set any SSAgreement scores since the
-    memory has to be allocated internally. The SSAgreement score itself relates a 
-    score to a certain combination of psipred prediction, it's confidence and the 
-    actually occuring secondary structure in the model. In every score evaluation,
-    the secondary structure of the loop is estimated by searching for hydrogen bonds
-    leading to a secondary structure as defined by dssp. The hbonds are searched
-    internally in the loop as well as in the environment.
+    Required to set SSAgreement scores with :func:`SetSSAgreementScore`).
 
   .. method:: SetCBetaEnergy(a, b, bin, e)
 
@@ -208,8 +350,8 @@ The BackboneLoopScorer
     :type bin:          :class:`int`
     :type e:            :class:`float`
 
-    :raises:            :class:`RuntimeError` if invalid bin or amino acid is 
-                        given
+    :raises:  :exc:`~exceptions.RuntimeError` if invalid bin or amino acid is 
+              given
 
   .. method:: SetReducedEnergy(a, b, dist_bin, alpha_bin, beta_bin, gamma_bin, e)
 
@@ -233,8 +375,8 @@ The BackboneLoopScorer
     :type gamma_bin:    :class:`int`
     :type e:            :class:`float`
 
-    :raises:            :class:`RuntimeError` if invalid bin or amino acid is 
-                        given
+    :raises:  :exc:`~exceptions.RuntimeError` if invalid bin or amino acid is 
+              given
 
   .. method:: SetTorsionEnergy(group_id_idx, phi_bin, psi_bin, e)
 
@@ -251,8 +393,8 @@ The BackboneLoopScorer
     :type psi_bin:      :class:`int`
     :type e:            :class:`float`
 
-    :raises:            :class:`RuntimeError` if invalid angle bin or 
-                        group_id_idx is given.
+    :raises: :exc:`~exceptions.RuntimeError` if invalid angle bin or 
+             group_id_idx is given.
 
   .. method:: SetCBPackingEnergy(a, count, e)
 
@@ -264,8 +406,8 @@ The BackboneLoopScorer
     :type count:        :class:`int`
     :type e:            :class:`float`
 
-    :raises:            :class:`RuntimeError` if *a* is invalid or *count*
-                        exceeds previously defined *max_count*
+    :raises: :exc:`~exceptions.RuntimeError` if *a* is invalid or *count*
+             exceeds previously defined *max_count*
 
   .. method:: SetHBondEnergy(state, d_bin, alpha_bin, beta_bin, gamma_bin, e)
 
@@ -288,8 +430,8 @@ The BackboneLoopScorer
     :type gamma_bin:    :class:`int`
     :type e:            :class:`float`
 
-    :raises:            :class:`RuntimeError` if state is not in [0,1,2] or one
-                        of the bins is invalid.
+    :raises: :exc:`~exceptions.RuntimeError` if state is not in [0,1,2] or one
+             of the bins is invalid.
 
 
   .. method:: SetSSAgreementScore(psipred_state, int psipred_confidence,
@@ -311,22 +453,12 @@ The BackboneLoopScorer
 
     :param seqres:      Internal SEQRES to be set. Whenever setting structural
                         data, consistency with this SEQRES is encorced.
-    :type seqres:       :class:`str`
-
-    :raises:            :class:`RuntimeError` when *seqres* contains invalid 
-                        one letter code
-
-  .. method:: Initialize(seqres_list)
-
-    Set up internal scorer with given seqres_list
+    :type seqres:       :class:`str` / :class:`ost.seq.SequenceHandle` / 
+                        :class:`list` of :class:`str` / :class:`ost.seq.SequenceList`
 
-    :param seqres_list: Internal SEQRES to be set. Every entry in the list 
-                        represents one chain. Whenever setting structural
-                        data, consistency with these SEQRES is encorced.
-    :type seqres_list:       :class:`list`
+    :raises:  :exc:`~exceptions.RuntimeError` when *seqres* contains invalid
+              one letter code
 
-    :raises:            :class:`RuntimeError` when *seqres_list* contains
-                        element with invalid one letter code
 
   .. method:: SetPsipredPrediction(pred)
 
@@ -334,25 +466,13 @@ The BackboneLoopScorer
     SSAgreementScore.
 
     :param pred:        The prediction
-    :type pred:         :class:`PsipredPrediction`
+    :type pred:         :class:`PsipredPrediction` / :class:`list` of :class:`PsipredPrediction`
 
-    :raises:            :class:`RuntimeError` If the scorer is not yet initialized,
-                        the scorer is initialized for multiple chains or when the
-                        the size of the prediction is inconsistent with the internal
-                        seqres in the scorer.
+    :raises: :exc:`~exceptions.RuntimeError` if the scorer is not yet
+             initialized, the number of predictions is inconsistent with the
+             number of internal chains or when one of the predictions sizes is
+             inconsistent with the according internal seqres
 
-  .. method:: SetPsipredPrediction(pred)
-
-    Internally sets the psipred prediction, which is necessary to calculate the
-    SSAgreementScore.
-
-    :param pred:        The prediction
-    :type pred:         :class:`list` of :class:`PsipredPrediction`
-
-    :raises:            :class:`RuntimeError` If the scorer is not yet initialized,
-                        the number of predictions is inconsistent with the number of
-                        internal chains or when one of the predictions sizes is
-                        inconsistent with the according internal seqres
 
   .. method:: SetEnvironment(env)
 
@@ -365,10 +485,10 @@ The BackboneLoopScorer
                         provided SEQRES items.
     :type env:          :class:`ost.mol.EntityView`
 
-    :raises:            :class:`RuntimeError` if scorer has never been
-                        initialized with a SEQRES or when *env* is inconsistent
-                        with previously set SEQRES. This can be because of 
-                        corrupt residue numbers or sequence mismatches.
+    :raises:         :exc:`~exceptions.RuntimeError` if scorer has never been
+                     initialized with a SEQRES or when *env* is inconsistent
+                     with previously set SEQRES. This can be because of 
+                     corrupt residue numbers or sequence mismatches.
 
   .. method:: SetEnvironment(bb_list, start_resnum, [chain_index=0])
 
@@ -385,10 +505,10 @@ The BackboneLoopScorer
     :type start_resnum: :class:`int`
     :type chain_index:  :class:`int`
 
-    :raises:            :class:`RuntimeError` if sequence of *bb_list* is
-                        inconsistent with previously provided SEQRES or
-                        when either start_resnum or chain_index point to
-                        invalid positions in the SEQRES.
+    :raises:  :exc:`~exceptions.RuntimeError` if sequence of *bb_list* is
+              inconsistent with previously provided SEQRES or when either
+              start_resnum or chain_index point to invalid positions in the
+              SEQRES.
 
   .. method:: ClearEnvironment(start_resnum, num_residues, [chain_index=0])
 
@@ -403,8 +523,115 @@ The BackboneLoopScorer
     :type num_residues: :class:`int`
     :type chain_index:  :class:`int`
 
-    :raises:            :class:`RuntimeError` when either start_resnum or 
-                        chain_index point to invalid positions in the SEQRES.
+    :raises:  :exc:`~exceptions.RuntimeError` when either start_resnum or 
+              chain_index point to invalid positions in the SEQRES.
+
+  .. method:: AddContactFunction(max_dist, score)
+
+    Adds a contact definition and returns an index, so it can be used later
+    when you add specific contacts. While the specific contact definitions
+    get cleared when reinitializing the scorer, The contact functions stay
+    and their indices remain valid until the scorer object gets destroyed.
+    The definition simply returns *score* , if a certain CA-CA distance is below
+    *max_dist* and 0.0 otherwise.
+
+    :param max_dist:    Maximal distance between two CA atoms to be in contact
+    :param score:       Value that gets returned if two CA atoms are in contact
+
+    :type max_dist:     :class:`float`
+    :type score:        :class:`float`
+
+    :returns:           Index of added contact definition
+
+  .. method:: AddConstraintFunction(min_dist, max_dist, values)
+
+    Adds a constraint definition and returns an index, so it can be used later
+    when you add specific constraints. While the specific constraint definitions
+    get cleared when reinitializing the scorer, the constraint functions stay
+    and their indices remain valid until the scorer object gets destroyed.
+    The definition returns the value at pos i, where i gets determined given
+    a certain CA-CA distance by assuming an equidistant binning of *values* 
+    between *min_dist* and *max_dist* . If a certain CA-CA distance is outside 
+    the range defined by *min_dist* and *max_dist*, the definition returns 0.0.
+
+    :param min_dist:    Minimal distance between two CA atoms to be considered
+    :param max_dist:    Maximal distance between two CA atoms to be considered
+    :param values:      The possible values that get returned when two CA
+                        atoms have a distance between *min_dist* and *max_dist*
+
+    :type min_dist:     :class:`float`
+    :type max_dist:     :class:`float`
+    :type values:       :class:`list` of :class:`float`
+
+
+    :returns:           Index of added constraint definition
+
+    :raises: :exc:`~exceptions.RuntimeError` if *min_dist* >= *max_dist* or
+             when *values* contains no elements
+
+  .. method:: AddContact(chain_idx_one, resnum_one, chain_idx_two, resnum_two, max_dist, score)
+
+  .. method:: AddContact(chain_idx_one, resnum_one, chain_idx_two, resnum_two, f_idx)
+
+    Two versions to add a specific contact. In version one, the AddContactFunction
+    method gets called internally to generate a unique contact definition for
+    this pair of residues. In version two you can use a manually defined contact
+    definition.
+
+    :param chain_idx_one: Chain idx of residue one in the contact
+    :param resnum_one:    Resnum of residue one in the contact
+    :param chain_idx_two: Chain idx of residue two in the contact
+    :param resnum_two:    Resnum of residue two in the contact
+    :param max_dist:      Maximal distance between the two CA atoms to be in contact
+    :param score:         Value that gets returned if the two CA atoms are in contact
+    :param f_idx:         Index of manually set contact definition
+
+    :type chain_idx_one:  :class:`int`
+    :type resnum_one:     :class:`int`
+    :type chain_idx_two:  :class:`int`
+    :type resnum_two:     :class:`int`
+    :type max_dist:       :class:`float`
+    :type score:          :class:`float`
+    :type f_idx:          :class:`int`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if any of the chain indices or
+              resnums is invalid, the interaction partners are the same residue
+              or when *f_idx* is an invalid index.
+
+
+  .. method:: AddConstraint(chain_idx_one, resnum_one, chain_idx_two, \
+                            resnum_two, min_dist, max_dist, scores)
+              AddConstraint(chain_idx_one, resnum_one, chain_idx_two, \
+                            resnum_two, f_idx)
+
+    Two versions to add a specific constraint. In version one, the
+    AddConstraintFunction method gets called internally to generate a unique
+    constraint definition for this pair of residues. In version two you can use
+    a manually defined constraint definition.
+
+    :param chain_idx_one: Chain idx of residue one in the constraint
+    :param resnum_one:    Resnum of residue one in the constraint
+    :param chain_idx_two: Chain idx of residue two in the constraint
+    :param resnum_two:    Resnum of residue two in the constraint
+    :param min_dist:      Minimal distance between the two CA atoms to be considered
+    :param max_dist:      Maximal distance between the two CA atoms to be considered
+    :param scores:        Values that get returned if the two CA atoms are considered
+    :param f_idx:         Index of manually set constraint definition
+
+    :type chain_idx_one:  :class:`int`
+    :type resnum_one:     :class:`int`
+    :type chain_idx_two:  :class:`int`
+    :type resnum_two:     :class:`int`
+    :type min_dist:       :class:`float`
+    :type max_dist:       :class:`float`
+    :type scores:         :class:`list` of :class:`float`
+    :type f_idx:          :class:`int`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if any of the chain indices or
+              resnums is invalid, the interaction partners are the same residue,
+              *min_dist* >= *max_dist*, *scores* is empty or when *f_idx* is an
+              invalid index.
+
 
   .. method:: CalculateClashScore(bb_list, start_resnum, [chain_index=0])
 
@@ -419,10 +646,10 @@ The BackboneLoopScorer
 
     :returns: clash score
 
-    :raises:            :class:`RuntimeError` if size of *bb_list* is smaller
-                        than 3, the *chain_index*/*start_resnum* lead to
-                        invalid positions in the SEQRES or the scorer
-                        has never been initialized with a SEQRES.
+    :raises: :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+             than 3, the *chain_index*/*start_resnum* lead to invalid
+             positions in the SEQRES or the scorer has never been initialized
+             with a SEQRES.
 
   .. method:: CalculateCBetaScore(bb_list, start_resnum, [chain_index=0])
 
@@ -437,11 +664,10 @@ The BackboneLoopScorer
 
     :returns: cbeta score
 
-    :raises:            :class:`RuntimeError` if size of *bb_list* is smaller
-                        than 3, the *chain_index*/*start_resnum* lead to
-                        invalid positions in the SEQRES or when the 
-                        according potential or scorer have never been properly
-                        initialized.
+    :raises:  :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+              than 3, the *chain_index*/*start_resnum* lead to invalid positions
+              in the SEQRES or when the  according potential or scorer have
+              never been properly initialized.
 
   .. method:: CalculateReducedScore(bb_list, start_resnum, [chain_index=0])
 
@@ -456,11 +682,10 @@ The BackboneLoopScorer
 
     :returns: reduced score
 
-    :raises:            :class:`RuntimeError` if size of *bb_list* is smaller
-                        than 3, the *chain_index*/*start_resnum* lead to
-                        invalid positions in the SEQRES or when the 
-                        according potential or scorer have never been properly
-                        initialized.
+    :raises:  :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+              than 3, the *chain_index*/*start_resnum* lead to invalid positions
+              in the SEQRES or when the  according potential or scorer have
+              never been properly initialized.
 
   .. method:: CalculateTorsionScore(bb_list, start_resnum, [chain_index=0])
 
@@ -475,11 +700,10 @@ The BackboneLoopScorer
 
     :returns: torsion score
 
-    :raises:            :class:`RuntimeError` if size of *bb_list* is smaller
-                        than 3, the *chain_index*/*start_resnum* lead to
-                        invalid positions in the SEQRES or when the 
-                        according potential or scorer have never been properly
-                        initialized.
+    :raises:  :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+              than 3, the *chain_index*/*start_resnum* lead to invalid positions
+              in the SEQRES or when the  according potential or scorer have
+              never been properly initialized.
 
   .. method:: CalculateCBPackingScore(bb_list, start_resnum, [chain_index=0])
 
@@ -494,11 +718,10 @@ The BackboneLoopScorer
 
     :returns: packing score
 
-    :raises:            :class:`RuntimeError` if size of *bb_list* is smaller
-                        than 3, the *chain_index*/*start_resnum* lead to
-                        invalid positions in the SEQRES or when the 
-                        according potential or scorer have never been properly
-                        initialized.
+    :raises:  :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+              than 3, the *chain_index*/*start_resnum* lead to invalid positions
+              in the SEQRES or when the  according potential or scorer have
+              never been properly initialized.
 
   .. method:: CalculateHBondScore(bb_list, start_resnum, [chain_index=0])
 
@@ -513,11 +736,10 @@ The BackboneLoopScorer
 
     :returns: hbond score
 
-    :raises:            :class:`RuntimeError` if size of *bb_list* is smaller
-                        than 3, the *chain_index*/*start_resnum* lead to
-                        invalid positions in the SEQRES or when the 
-                        according potential or scorer have never been properly
-                        initialized.
+    :raises:  :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+              than 3, the *chain_index*/*start_resnum* lead to invalid positions
+              in the SEQRES or when the  according potential or scorer have
+              never been properly initialized.
 
 
   .. method:: CalculateSSAgreementScore(bb_list, start_resnum, [chain_index=0])
@@ -533,12 +755,45 @@ The BackboneLoopScorer
 
     :returns: SSAgreement score
 
-    :raises:            :class:`RuntimeError` if size of *bb_list* is smaller
-                        than 3, the *chain_index*/*start_resnum* lead to
-                        invalid positions in the SEQRES or, the 
-                        scorer have never been properly initialized,
-                        or when no :class:`PsipredPrediction` is set to 
-                        the scorer.
+    :raises:  :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+              than 3, the *chain_index*/*start_resnum* lead to invalid positions
+              in the SEQRES or the scorer have never been properly initialized
+              or when no :class:`PsipredPrediction` is set to the scorer.
+
+
+  .. method:: CalculateContactScore(bb_list, start_resnum, [chain_index=0])
+
+    :param bb_list:     Loop to calculate the contact score
+    :param start_resnum: ResNum defining the position in the SEQRES
+                         (first element starts with one!)
+    :param chain_index: Index of the chain the loop belongs to
+
+    :type bb_list:      :class:`BackboneList`
+    :type start_resnum: :class:`int`
+    :type chain_index:  :class:`int`
+
+    :returns: contact score
+
+    :raises:  :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+              than 3, the *chain_index*/*start_resnum* lead to invalid positions
+              in the SEQRES or the scorer have never been properly initialized
+
+  .. method:: CalculateConstraintScore(bb_list, start_resnum, [chain_index=0])
+
+    :param bb_list:     Loop to calculate the constraint score
+    :param start_resnum: ResNum defining the position in the SEQRES
+                         (first element starts with one!)
+    :param chain_index: Index of the chain the loop belongs to
+
+    :type bb_list:      :class:`BackboneList`
+    :type start_resnum: :class:`int`
+    :type chain_index:  :class:`int`
+
+    :returns: constraint score
+
+    :raises:  :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+              than 3, the *chain_index*/*start_resnum* lead to invalid positions
+              in the SEQRES or the scorer have never been properly initialized
 
   .. method:: TransOmegaTorsions(bb_list, [thresh = 20/180*pi, allow_prepro_cis=True])
 
@@ -556,7 +811,7 @@ The BackboneLoopScorer
     :returns:           :class:`bool` whether *bb_list* only contains
                         trans-omega torsions.
 
-    :raises:            :class:`RuntimeError` if size of *bb_list* is
-                        smaller than 3.
+    :raises: :exc:`~exceptions.RuntimeError` if size of *bb_list* is smaller
+             than 3.
 
 
diff --git a/doc/html/_sources/loop/helper_classes.txt b/doc/html/_sources/loop/helper_classes.txt
index 9c9e87fe2f18e79b12363274f74c5da1aeb46850..033902e4ffd970eedf165e226f0d847c2a3b3e60 100644
--- a/doc/html/_sources/loop/helper_classes.txt
+++ b/doc/html/_sources/loop/helper_classes.txt
@@ -30,9 +30,9 @@ Psipred
     :type prediction:   :class:`list`
     :type confidence:   :class:`list`
 
-    :raises:            :class:`RuntimeError` if size of **prediction** and 
-                        **confidence** are inconsistent or if they contain an
-                        invalid element
+    :raises:  :exc:`~exceptions.RuntimeError` if size of **prediction** and
+              **confidence** are inconsistent or if they contain an invalid
+              element
 
   .. method:: FromHHM(filename)
 
@@ -60,7 +60,7 @@ Psipred
     :type prediction:   :class:`str`
     :type confidence:   :class:`int`
 
-    :raises:            :class:`RuntimeError` if input contains invalid elements
+    :raises: :exc:`~exceptions.RuntimeError` if input contains invalid elements
 
   .. method:: Extract(from, to)
 
@@ -75,7 +75,7 @@ Psipred
 
     :returns:           :class:`PsipredPrediction` with the specified range
 
-    :raises:            :class:`RuntimeError` if **from** or **to** are invalid
+    :raises: :exc:`~exceptions.RuntimeError` if **from** or **to** are invalid
 
 
 
@@ -84,14 +84,14 @@ Psipred
     :param idx:         Index to get prediction from
     :type idx:          :class:`int`
     :returns:           Psipred prediction at pos **idx**
-    :raises:            :class:`RuntimeError` if **idx** is invalid
+    :raises:  :exc:`~exceptions.RuntimeError` if **idx** is invalid
 
   .. method:: GetConfidence(idx)
 
     :param idx:         Index to get confidence from
     :type idx:          :class:`int`
     :returns:           Psipred confidence at pos **idx**
-    :raises:            :class:`RuntimeError` if **idx** is invalid  
+    :raises: :exc:`~exceptions.RuntimeError` if **idx** is invalid  
 
   .. method:: GetPredictions()
 
@@ -120,7 +120,7 @@ Handling several loops at once
 
 .. class:: LoopCandidate(backbone_list)
   
-  Object representing a possible configuration of the backbone of a particular loop being modelled. Apart from the positions, stored in a :class:`BackboneList`, it also has attributes storing different scores associated with the candidate (will be set by calling the corresponding scoring function in :class:`LoopCandidates`) as well as some information on the original structure from which this particular loop configuration was taken (in the case when the configuration was taken from the structural database).
+  Object representing a possible configuration of the backbone of a particular loop being modelled. Apart from the positions, stored in a :class:`BackboneList`, it also has attributes storing different scores associated with the candidate (will be set by calling the corresponding scoring function in :class:`LoopCandidates`).
 
   :param backbone_list:  Positions of the backbone atoms
 
@@ -140,23 +140,7 @@ Handling several loops at once
     
     :param other:        Other loop
 
-    :type other:         :class:`LoopCandidate`  
-
-  .. method:: GetOriginalSequence()
-
-    Returns the sequence of the original loop from the structural database, i.e. the sequence of the piece of structure from which the loop was taken.
-
-    :returns:           A sequence
-
-    :rtype:             :class:`str`
-    
-  .. method:: GetOriginalDSSPState()
-
-    Returns the secondary structure of the original loop from the structural database, i.e. the secondary structure of the piece of structure from which the loop was taken.
-    
-    :returns:           The secondary structure code as given in DSSP
-
-    :rtype:             :class:`str` 
+    :type other:         :class:`LoopCandidate`   
 
   .. attribute:: bb_list
 
@@ -201,7 +185,7 @@ Handling several loops at once
     
     :type: :class:`float`
 
-  .. attribute:: ss_agreement
+  .. attribute:: ss_agreement_score
 
     The SSAgreement score of the loop candidate
 
@@ -256,9 +240,11 @@ Handling several loops at once
     :rtype:                :class:`LoopCandidates`
 
   .. staticmethod:: FillFromMonteCarloSampler(seq, num_loops, steps, \
-                                              sampler, closer, scorer, cooler)
+                                              sampler, closer, scorer, cooler, \
+                                              [random_seed = 0])
                     FillFromMonteCarloSampler(initial_bb, seq, num_loops, steps, \
-                                              sampler, closer, scorer, cooler)
+                                              sampler, closer, scorer, cooler, \
+                                              [random_seed = 0])
     
     Uses Monte Carlo simulated annealing to sample the loop to be modelled.
     If *initial_bb* is given, every Monte Carlo run starts from that configuration.
@@ -272,6 +258,10 @@ Handling several loops at once
     :param closer:     Used to close the loop after each MC step
     :param scorer:     Used to score the generated configurations at each MC step
     :param cooler:     Controls the temperature profile of the simulated annealing
+    :param random_seed: Seed to feed the random number generator for 
+                        accepting/rejecting proposed monte carlo steps.
+                        For every monte carlo run, the random number generator 
+                        gets refreshed and this seed gets increased by 1.
 
     :type initial_bb:  :class:`BackboneList`
     :type seq:         :class:`str`
@@ -281,6 +271,7 @@ Handling several loops at once
     :type closer:      :ref:`mc-closer-object`
     :type scorer:      :ref:`mc-scorer-object`
     :type cooler:      :ref:`mc-cooler-object`
+    :type random_seed: :class:`int`
 
     :returns:          The resulting candidates
     :rtype:            :class:`LoopCandidates`
@@ -325,10 +316,10 @@ Handling several loops at once
     of the closing to calculate the probability of the proposed move, which is
     then accepted or not depending on a metropolis criterium.
 
-    :param n_stem:               Residue defining the n-stem positions every
-                                 candidate should match
-    :param c_stem:               Residue defining the c-stem positions every
-                                 candidate should match
+    :param n_stem:      Residue defining the n-stem positions every candidate
+                        should match. See :meth:`~promod3.loop.CCD.CCD()`.
+    :param c_stem:      Residue defining the c-stem positions every candidate
+                        should match. See :meth:`~promod3.loop.CCD.CCD()`.
     :param torsion_sampler:      The torsion sampler
     :param torsion_samplers:     A list containing one torsion sampler for each
                                  residue in the loop
@@ -336,7 +327,7 @@ Handling several loops at once
     :param rmsd_cutoff:          Cutoff in stem residue RMSD used to determine
                                  convergence
     :param keep_non_converged:   Whether to keep loop candidates for which the
-                                 closing did not converged
+                                 closing did not converge
     :param random_seed:          seed for random number generator used to
                                  accept/reject moves in CCD algorithm
 
@@ -383,8 +374,8 @@ Handling several loops at once
     :param loop_candidate:                 The loop candidate
     :type loop_candidate:   :class:`LoopCandidate`
 
-    :raises:            :class:`RuntimeError` If sequence of *loop_candidate* is not consistent
-                        with internal sequence
+    :raises: :exc:`~exceptions.RuntimeError` If sequence of *loop_candidate*
+             is not consistent with internal sequence
 
   .. method:: Add(bb_list)
 
@@ -393,8 +384,8 @@ Handling several loops at once
     :param bb_list:                 The backbone list
     :type bb_list:                  :class:`BackboneList`
 
-    :raises:            :class:`RuntimeError` If sequence of *bb_list* is not consistent
-                        with internal sequence
+    :raises: :exc:`~exceptions.RuntimeError` If sequence of *bb_list* is not
+             consistent with internal sequence
  
   .. method:: Remove(index)
 
@@ -411,7 +402,7 @@ Handling several loops at once
     :type scorer:             :class:`BackboneLoopScorer`
 
 
-  .. method:: CalculateClasScores(start_resnum, [chain_index=0])
+  .. method:: CalculateClashScores(start_resnum, [chain_index=0])
 
     Calculates and assigns the clash score for each :class:`LoopCandidate`. 
 
diff --git a/doc/html/_sources/loop/index.txt b/doc/html/_sources/loop/index.txt
index b74674a2960992ed55bb408b85bcefcb8e242574..6ee05f6ba0cb005c0f8ccc495544a15a72598263 100644
--- a/doc/html/_sources/loop/index.txt
+++ b/doc/html/_sources/loop/index.txt
@@ -11,73 +11,7 @@ This module provides ways for representation and manipulation of peptides and
 finally connect them to larger structures. The following example should give 
 you a starting point to get an idea of what can be done.
 
-.. code-block:: python
-
-  from ost import io
-  from promod3 import loop
-  
-  #let's load a crambin structure from the pdb
-  crambin = io.LoadPDB("1crn",remote=True)
-  SEQRES = ''.join([r.one_letter_code for r in crambin.residues])
-  
-  #this is the sequence we want to remodel
-  loop_seq = SEQRES[23:31]
-  
-  #let's define the stem residues
-  n_stem = crambin.residues[23]
-  c_stem = crambin.residues[30]
-  
-  #we use the StructureDB as source for structural information
-  structure_db = loop.LoadStructureDB()
-  
-  #the FragDB allows to access the StructureDB based on geometric 
-  #features of the loop stem residue
-  frag_db = loop.LoadFragDB()
-  
-  #the LoopCandidates allow to handle several loops at once
-  #we directly want to find potential loop candidates from the
-  #previously loaded databases
-  loop_candidates = loop.LoopCandidates.FillFromDatabase(n_stem,
-                                                         c_stem,
-                                                         loop_seq,
-                                                         frag_db,
-                                                         structure_db)
-  
-  #The candidates usually don't match exactly the required stem coordinates
-  #CCD (Cyclic Coordinate Descent) is one way to enforce this match.
-  loop_candidates.ApplyCCD(n_stem, c_stem)
-  
-  #now it's time to select one candidate, we load a scorer object to do that
-  scorer = loop.LoadBackboneLoopScorer()
-  
-  #initialize scorer with the environment given by the crambin structure
-  scorer.Initialize(SEQRES)
-  scorer.SetEnvironment(crambin)
-  
-  #the scorer can then be attached to the LoopCandidates object
-  #to calculate several different scores, we go for a distance dependent
-  #statistical potential considering the CBeta positions of each residue
-  #and a clash score. To calculate the actual score we also have to pass
-  #the location of our loop candidates in the overall structure 
-  # => resnum = 24
-  loop_candidates.AttachScorer(scorer)
-  loop_candidates.CalculateCBetaScores(24)
-  loop_candidates.CalculateClashScores(24)
-  
-  #we simply sum up the previously calculated scores and search for the
-  #loop with minimal score
-  min_score = float("inf")
-  min_candidate = 0
-  for i,lc in enumerate(loop_candidates):
-    score = lc.cbeta_score + lc.clash_score
-    if score < min_score:
-      min_score = score
-      min_candidate = i
-    
-  #let's insert the found loop into our structure and save it down
-  bb_list = loop_candidates[min_candidate].bb_list
-  bb_list.InsertInto(crambin.chains[0],n_stem.GetNumber())
-  io.SavePDB(crambin,"modified_crambin.pdb")
+.. literalinclude:: ../../../tests/doc/scripts/loop_main.py
 
 Contents:
 
diff --git a/doc/html/_sources/loop/loop_closing.txt b/doc/html/_sources/loop/loop_closing.txt
index a43ec1fc9ad71cf642fc0b0237913ea1d984c735..2e39dd54a1e86001a898da7cf99b03cc6a25402b 100644
--- a/doc/html/_sources/loop/loop_closing.txt
+++ b/doc/html/_sources/loop/loop_closing.txt
@@ -54,8 +54,14 @@ this increases the probability of non-convergence.
     to avoid moving into unfavourable regions of the backbone dihedrals.
 
     :param sequence:    Sequence of the backbones to be closed
-    :param n_stem:      Residue defining the n_stem
-    :param c_stem:      Residue defining the c_stem
+    :param n_stem:      Residue defining the n_stem.
+                        If the residue before *n_stem* doesn't exist, the
+                        torsion sampler will use a default residue (ALA) and
+                        and phi angle (-1.0472) to evaluate the first angle.
+    :param c_stem:      Residue defining the c_stem.
+                        If the residue after *c_stem* doesn't exist, the
+                        torsion sampler will use a default residue (ALA) and
+                        psi angle (-0.7854) to evaluate the last angle.
     :param torsion_sampler: To extract probabilities for the analysis of the backbone 
                         dihedrals. You either pass a list with :class:`TorsionSampler`
                         objects for every residue of the loop to be closed or a single
@@ -75,11 +81,10 @@ this increases the probability of non-convergence.
     :type rmsd_cutoff:  :class:`float`
     :type seed:         :class:`int`
 
-    :raises:            :class:`RuntimeError` if a list of torsion samplers is given
-                        with inconsistent length regarding the sequence. Another 
-                        requirement is that the residue before **n_stem** and
-                        after **c_stem** must be valid and all backbone atoms 
-                        are present.
+    :raises:  :exc:`~exceptions.RuntimeError` if a list of torsion samplers is
+              given with inconsistent length regarding the sequence. Another
+              requirement is that all backbone atoms of the stems must be
+              present.
 
   .. method:: CCD(n_stem, c_stem, max_steps, rmsd_cutoff)
 
@@ -107,9 +112,9 @@ this increases the probability of non-convergence.
 
     :returns:           :class:`bool` Whether **rmsd_cutoff** has been reached  
 
-    :raises:            :class:`RuntimeError` if the CCD object has been initialized
-                        with :class:`TorsionSampler` support and the length of the
-                        **bb_list** is not consistent with the initial sequence.  
+    :raises:  :exc:`~exceptions.RuntimeError` if the CCD object has been
+              initialized with :class:`TorsionSampler` support and the length of
+              the **bb_list** is not consistent with the initial sequence.
 
 
 
@@ -152,7 +157,7 @@ at these pivot residues. Due to the internal mathematical formalism, up to
     :returns:             List of :class:`BackboneList` objects representing
                           the closed loops. There is a maximum of 16 entries.
 
-    :raises:              :class:`RuntimeError` in case of invalid pivot indices.
+    :raises: :exc:`~exceptions.RuntimeError` in case of invalid pivot indices.
 
 
 
@@ -183,7 +188,7 @@ can be relaxed by the relaxer.
   :type fix_nterm:      :class:`bool`
   :type fix_cterm:      :class:`bool`
 
-  :raises:              :class:`RuntimeError` if size of **bb_list** is below 2
+  :raises: :exc:`~exceptions.RuntimeError` if size of **bb_list** is below 2
 
 
   .. method:: Run(bb_list, [steps = 100, stop_criterion = 0.01])
@@ -202,8 +207,8 @@ can be relaxed by the relaxer.
 
     :returns:           Forcefield energy upon relaxation
 
-    :raises:            :class:`RuntimeError` if **bb_list** has not the same
-                        size or sequence as the initial one.
+    :raises:  :exc:`~exceptions.RuntimeError` if **bb_list** has not the same
+              size or sequence as the initial one.
 
 
 
diff --git a/doc/html/_sources/loop/monte_carlo.txt b/doc/html/_sources/loop/monte_carlo.txt
index 11dbd3e03fe5d76d3f9ad42c40732f626912e69a..224298a3c759cac2602e3547e0a762dbce2587d0 100644
--- a/doc/html/_sources/loop/monte_carlo.txt
+++ b/doc/html/_sources/loop/monte_carlo.txt
@@ -3,7 +3,7 @@ Monte Carlo Sampling
 
 .. currentmodule:: promod3.loop
 
-The monte carlo capabilities of |project| are mainly targeted at generating de
+The Monte Carlo capabilities of |project| are mainly targeted at generating de
 novo structure candidates for loops or N-/C-Termini. Every iteration of the
 sampling process consists basically of four steps.
 
@@ -13,35 +13,40 @@ sampling process consists basically of four steps.
 * Accept/Reject new conformation based on the score and a temperature controlled metropolis criterion
 
 These steps are performed by sampler, closer, scorer and cooler objects, that 
-can be arbitrarily combined to generate custom monte carlo sampling pipelines.
+can be arbitrarily combined to generate custom Monte Carlo sampling pipelines.
 This combination either happens manually or by using a convenient function
 provided by |project|.
 
 
+.. method:: SampleMonteCarlo(sampler, closer, scorer, cooler, steps,\
+                             bb_list, initialize=true, seed=0,\
+                             lowest_energy_conformation=true)
 
-.. method:: MonteCarloSampler(sampler,closer,scorer,cooler,steps,bb_list,initialize,seed)
-
-  A convenient function to perform monte carlo sampling using a simulated
+  A convenient function to perform Monte Carlo sampling using a simulated
   annealing scheme. In every iteration, a new loop conformation gets proposed by
   the provided **sampler** and closed by the **closer**. Upon scoring, this new
   conformation gets accepted/rejected using a metropolis criterion based on the
   temperature given by the **cooler** 
-  => acceptance probability: exp(-delta_score/T)
+  => acceptance probability: exp(-delta_score/T).
+  The result is stored in *bb_list* and is either the lowest energy conformation
+  ever encountered or the last accepted proposal.
 
   :param sampler:       Sampler object capable of initializing and altering
                         conformations.
   :param closer:        Closer object to adapt a new conformation to
-                        the environment
-  :param scorer:        Scorer object to score new loop conformations
+                        the environment.
+  :param scorer:        Scorer object to score new loop conformations.
   :param cooler:        Cooler object to control the temperature of the 
-                        monte carlo trajectory
-  :param steps:         Number of monte carlo iterations to be performed
-  :param bb_list:       The lowest scoring conformation of the trajectory
-                        gets stored in here
+                        Monte Carlo trajectory.
+  :param steps:         Number of Monte Carlo iterations to be performed.
+  :param bb_list:       The chosen conformation gets stored here.
   :param initialize:    Whether a new bb_list should be generated as starting
                         point, based on the samplers Initialize function.
                         The input **bb_list** gets used otherwise.
   :param seed:          Seed for internal random number generator.
+  :param lowest_energy_conformation:  If true, we choose the lowest scoring
+                                      conformation of the trajectory. Otherwise,
+                                      the last accepted proposal.
 
   :type sampler:        :ref:`mc-sampler-object`
   :type closer:         :ref:`mc-closer-object`
@@ -51,60 +56,12 @@ provided by |project|.
   :type bb_list:        :class:`BackboneList`
   :type initialize:     :class:`bool`
   :type seed:           :class:`int`
+  :type lowest_energy_conformation: :class:`bool`
 
+In this example, we apply Monte Carlo sampling to the N-terminal part of
+crambin:
 
-
-
-
-.. code-block:: python
-
-
-  #Example script, that applies monte-carlo sampling to the n-terminal
-  #part of crambin
-
-  from ost import io
-  from promod3 import loop
-  import numpy as np
-
-  prot = io.LoadPDB("1crn",remote=True)
-
-  chain_index = 0
-  start_resnum = 1
-  n_terminal_length = 8  
-
-  seqres = ''.join([r.one_letter_code for r in prot.residues])
-  terminal_sequence = seqres[:n_terminal_length]
-
-
-  #setup mc_sampler
-  torsion_sampler = loop.LoadTorsionSampler()
-  mc_sampler = loop.SoftSampler(terminal_sequence,torsion_sampler,10.0/180*np.pi)
-
-  #setup mc_closer
-  mc_closer = loop.NTerminalCloser(prot.residues[n_terminal_length-1])
-
-  #set up mc_scorer
-  scorer = loop.LoadBackboneLoopScorer()
-  scorer.Initialize(seqres)
-  scorer.SetEnvironment(prot)
-
-  weights = dict()
-  weights["cbeta"]=10.0
-  weights["clash"]=0.1
-  mc_scorer = loop.LinearScorer(scorer,start_resnum,chain_index,weights)
-
-  #setup mc_cooler
-  mc_cooler = loop.ExponentialCooler(100,100,0.9)
-
-  #create BackboneList from n-terminus
-  bb_list = loop.BackboneList(terminal_sequence,prot.residues[:n_terminal_length])
-
-  #shake it!
-  loop.MonteCarloLoopSampler(mc_sampler, mc_closer, mc_scorer, mc_cooler, 10000,bb_list,False,0)
-
-  #save down the result
-  io.SavePDB(bb_list.ToEntity(),"sampled_frag.pdb")
-
+.. literalinclude:: ../../../tests/doc/scripts/loop_monte_carlo.py
 
 
 .. _mc-sampler-object:
@@ -114,7 +71,7 @@ Sampler Object
 
 The sampler objects can be used to generate initial conformations and
 propose new conformations for a sequence of interest. They build the basis
-for any monte carlo sampling pipeline.
+for any Monte Carlo sampling pipeline.
 
 .. class:: PhiPsiSampler(sequence,torsion_sampler,[n_stem_phi=-1.0472,c_stem_psi=-0.78540,prev_aa='A',next_aa='A',seed=0])
 
@@ -175,10 +132,9 @@ for any monte carlo sampling pipeline.
     :type actual_positions: :class:`BackboneList`
     :type proposed_positions: :class:`BackboneList`
 
-    :raises:            :class:`RuntimeError` If size of **actual_positions**
-                        is not consistent with the internal sequence. Note,
-                        that the sequence itself doesn't get checked for
-                        efficiency reasons. 
+    :raises:  :exc:`~exceptions.RuntimeError` If size of **actual_positions**
+              is not consistent with the internal sequence. Note, that the
+              sequence itself doesn't get checked for efficiency reasons.
 
 
 
@@ -249,38 +205,47 @@ for any monte carlo sampling pipeline.
     :type actual_positions: :class:`BackboneList`
     :type proposed_positions: :class:`BackboneList`
 
-    :raises:            :class:`RuntimeError` If size of **actual_positions**
-                        is not consistent with the internal sequence. Note,
-                        that the sequence itself doesn't get checked for
-                        efficiency reasons. 
+    :raises:  :exc:`~exceptions.RuntimeError` If size of **actual_positions**
+              is not consistent with the internal sequence. Note, that the
+              sequence itself doesn't get checked for efficiency reasons.
 
 
-.. class:: FragmentSampler(sequence, fraggers, [init_fragments = 3, seed = 0])
+.. class:: FragmentSampler(sequence, fraggers, [init_bb_list = BackboneList(sequence), sampling_start_index = 0, init_fragments = 3, seed = 0])
 
   The FragmentSampler samples by replacing full fragments originating from a list
-  of :class:`Fragger` objects.
+  of :class:`Fragger` objects. The region, that actually gets sampled is
+  determined by **sampling_start_index** and number of :class:`Fragger` objects 
+  being available. All parts not covered by any fragger remain rigid.
 
-  :param sequence:      Sequence that should be sampled
+  :param sequence:      Overall sequence
   :param fraggers:      A list of :class:`Fragger` objects. The first fragger 
-                        covers the region starting at the first letter of the
-                        **sequence** and so on. All fraggers must contain fragments
-                        of equal size an exactly cover the full sequence to
-                        be sampled.
-  :param init_fragments: When calling the Initialize function, a completely helical
-                         conformation gets created. This is the number of fragments
-                         that gets randomly selected and inserted.
+                        covers the region starting at the letter 
+                        **sampling_start_index** of the **sequence** and so on. 
+                        All fraggers must contain fragments of equal size.
+  :param init_bb_list:  Initial conformation, that serves as a starting point for
+                        sampling. The default gets constructed using the default
+                        constructor of :class:`BackboneList` and results in
+                        a helix.
+  :param sampling_start_index: Defines the beginning of the region, that actually
+                               gets sampled.
+  :param init_fragments: When calling the Initialize function, the positions get set
+                         to the ones of **init_bb_list**. This is the number of 
+                         fragments that gets randomly selected and inserted.
   :param seed:          Seed for the internal random number generators
 
   :type sequence:       :class:`str`
   :type fraggers:       :class:`str`
+  :type init_bb_list:   :class:`BackboneList`
+  :type samplint_start_index: :class:`int`
   :type init_fragments: :class:`int`
   :type seed:           :class:`int`
 
 
   .. method:: Initialize(bb_list)
 
-    Sets up a new :class:`BackboneList` by creating a helix and replace n fragments
-    with n = **init_fragments** as given at the samplers initialization
+    Sets up a new :class:`BackboneList` by setting the setting 
+    bb_list = **init_bb_list** and randomly replace n fragments
+    with n = **init_fragments**
 
     :param bb_list:     The newly created conformation gets stored in here
     :type bb_list:      :class:`BackboneList`
@@ -318,10 +283,10 @@ or simple stem superposition in case of terminal sampling.
   avoid moving into unfavourable phi/psi ranges.
 
   :param n_stem:        Defining stem positions the closed conformation
-                        should adapt.
+                        should adapt. See :meth:`~promod3.loop.CCD.CCD()`.
 
   :param c_stem:        Defining stem positions the closed conformation
-                        should adapt.
+                        should adapt. See :meth:`~promod3.loop.CCD.CCD()`.
 
   :param sequence:      Sequence of the conformation to be closed.
   :param torsion_sampler: To enforce valid phi/psi ranges. Alternatively
@@ -336,12 +301,6 @@ or simple stem superposition in case of terminal sampling.
   :type torsion_sampler: :class:`TorsionSampler`
   :type seed:           :class:`int`
 
-  :raises:              :class:`RuntimeError` if the residues before **n_stem**
-                        and after c_stem cannot be accessed. This is necessary
-                        to extract the histogram indices for the torsion 
-                        sampler and to calculate the phi/psi angles of the
-                        stems.
-
   .. method:: Close(actual_positions,closed_positions)
     
     :param actual_positions: Conformation to be closed.
@@ -441,7 +400,7 @@ energy, the lower the better.
 
 .. class:: LinearScorer(scorer,start_resnum,chain_index,weights)
 
-  The LinearScorer allows to combine the scores availabler from
+  The LinearScorer allows to combine the scores available from
   :class:`BackboneLoopScorer` in a linear manner.
 
   :param scorer:        Scorer Object with set environment for the particular loop
@@ -451,7 +410,8 @@ energy, the lower the better.
   :param chain_index:   The chain the loop belongs to.
   :param weights:       Assigns every score, that should be combined a linear
                         weight. Key of dict is a score name and can be any of:
-                        ["cbeta", "clash", "torsion", "cb_packing", "hbond", "dssp_hbond"].
+                        ["cbeta", "clash", "torsion", "cb_packing", "hbond", "ss_agreement",
+                        "reduced", "contact", "constraint"].
                         An additional possible key is: "intercept".
 
   :type scorer:         :class:`BackboneLoopScorer`
@@ -459,7 +419,7 @@ energy, the lower the better.
   :type chain_index:    :class:`int`
   :type weights:        :class:`dict`
 
-  :raises:              :class:`RuntimeError` If there is an invalid weight name.
+  :raises: :exc:`~exceptions.RuntimeError` if there is an invalid weight name.
 
 
   .. method:: GetScore(bb_list)
@@ -476,7 +436,7 @@ energy, the lower the better.
 Cooler Object
 --------------------------------------------------------------------------------
 
-The cooler objects control the temperature of the monte carlo trajectory.
+The cooler objects control the temperature of the Monte Carlo trajectory.
 They're intended to deliver steadily decreasing temperatures with calls
 to their GetTemperature function.
 
diff --git a/doc/html/_sources/loop/structure_db.txt b/doc/html/_sources/loop/structure_db.txt
index 5841a3c225c1ef26472d2ff2567591ddd723cab1..ede886f71fdab6cd372b009885c8a9c3a5ee7632 100644
--- a/doc/html/_sources/loop/structure_db.txt
+++ b/doc/html/_sources/loop/structure_db.txt
@@ -16,11 +16,11 @@ Following features get stored on a per residue basis:
 * The secondary structure state as defined by dssp
 * The solvent accessibility in square Angstrom as calculated by dssp
 * The residue depth defined as the average distance from all atoms of a
-  residue to the closest surface vertex as calculated by msms [sanner1996]_ 
-  - This is a simplified version of
-  the residue depth as discussed in [chakravarty1999]_ and gets directly calculated
-  when structural information gets added to the StructureDB
-* The amino acid frequencies as given by an input HMM
+  residue to the closest surface vertex as calculated by msms [sanner1996]_.
+  This is a simplified version of the residue depth as discussed in
+  [chakravarty1999]_ and gets directly calculated when structural information
+  gets added to the StructureDB.
+* The amino acid frequencies as given by an input sequence profile
 * The amino acid frequency derived from structural alignments as described
   in [zhou2005]_ - Since the calculation of such a profile already requires a 
   StructureDB, we end up in a hen and egg problem here... When adding
@@ -79,93 +79,27 @@ Defining Chains and Fragments
 The Database
 --------------------------------------------------------------------------------
 
+The following code example demonstrates how to create a structural database
+and fill it with content.
 
-.. code-block:: python
-
-  #this code example demonstrates how to create a structural database and
-  #fill it with content
-
-  from promod3 import loop
-  import os
-
-  #we also need the external tools dssp and msms, you have to make sure
-  #that they are somewhere in your PATH
-  from ost.bindings import dssp
-  from ost.bindings import msms
-
-  structure_db = loop.StructureDB()
-
-  #lets fill in some structures. It gets assumed, that all required data lies
-  #in following directories
-  structure_dir = "foo"
-  hmm_dir = "bar" 
-
-  #the first 4 letters are suposed to be the pdb id, and the last one
-  #the corresponding chain name. The naming of the files in the
-  #directories is e.g. 1CRN.pdb for the structure and 1CRNA.hhm for the
-  #hmm. Please note, that the structure can contain several chains, whereas
-  #an hmm is considered unique for one particular sequence. 
-  ids = [1CRNA,1AKEA]
-
-  for i in ids:
-
-    pdb_id = i[:4]
-    chain_id = i[4]
-
-    #join together the data paths
-    structure_path = os.path.join(structure_dir,pdb_id+".pdb")
-    hmm_path = os.path.join(hmm_dir,pdb_id+chain_id+".hhm")    
-
-    #let's load the structure
-    structure = io.LoadPDB(structure_path).Select("cname="+chain_id+" and peptide=True")
-    #and the according HMM, that has to be in hhm format
-    hmm = ost.seq.HMM.Load(hmm_path)
- 
-    #we run dssp in a way, that the secondary structure, as well as
-    #the solvent accessibily gets assigned
-    dssp.AssignDSSP(structure,extract_burial_status=True)
-
-    #as a final step we need the surface as calculated by msms
-    surf = msms.CalculateSurface(structure)[0]
-
-    #let's add it
-    structure_db.AddCoordinates(pdb_id,chain_id,structure.chains[0],surf,hmm) 
-
-  #we Now have two structures in the database... Please note, that there
-  #is no profile derived from structures assigned yet. You might consider to use
-  #the default StructureDB to derive such profiles
-  default_db = loop.LoadStructureDB()
-
-  for i in range(structure_db.GetNumCoords()):
-    #get the CoordInfo for chain with index i 
-    coord_info = structure_db.GetCoordInfo(i)
-    #define a fragment, that covers the full length
-    fragment_info = loop.FragmentInfo(i,0,coord_info.size)
-    #extract the according BackboneList and the residue depths
-    bb_list = structure_db.GetBackboneList(bb_list,fragment_info)
-    depths = structure_db.GetResidueDepths(fragment_info)
-    #generate a profile based on the structural data in the default_db
-    hmm = default_db.GenerateStructureProfile(bb_list,depths)
-    #and add it to the previously created structure_db
-    structure_db.SetStructureProfile(i,hmm)
-
-  #That's it! Let's save it down...
-  structure_db.Save("my_db.dat")
-
-  #Calculating the structural profiles is highly expensive and heavily depends
-  #on the size of the database used as source...
-  #If you want to do this for a larger database, you might consider two things:
-  #
-  #  1. Use a database of limited size as structural source (something in
-  #     between 5000 and 10000 nonredundant chains is enough)
-  #  2. Use the ost.seq.HMMDB to gather hmms produced from jobs running 
-  #     in parallel
+.. literalinclude:: ../../../tests/doc/scripts/loop_structure_db.py
 
+Calculating the structural profiles is highly expensive and heavily depends on
+the size of the database used as source. If you want to do this for a larger
+database, you might want to consider two things:
+
+1. Use a database of limited size as structural source (something
+   in between 5000 and 10000 nonredundant chains is enough)
+2. Use the :class:`ost.seq.ProfileDB` to gather profiles produced from jobs
+   running in parallel
 
 .. class:: StructureDB()
 
   .. method:: Load(filename,[load_frequencies=False])
 
+    Loads raw binary file generated with :meth:`Save` (optimized for fast
+    reading).
+    
     :param filename:      path to the file from which to load the database.
     :param load_frequencies: If True, the full database including profile
                              information for every position gets loaded.
@@ -177,22 +111,68 @@ The Database
     :type filename:       :class:`str`
     :type load_frequencies: :class:`bool`
 
-    :returns:             The loaded StructureDB
+    :returns:             The loaded data base
+    :rtype:               :class:`StructureDB`
 
-    :raises:            :class:`RuntimeError` If **filename** does not exist.
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - file assumes different memory-layout than is available on this
+                machine. Use :meth:`LoadPortable` to convert your file.
 
   .. method:: Save(filename)
 
+    Saves raw binary representation (optimized for fast reading).This puts many
+    assumptions on the memory-layout of the target-machine and hence it is not
+    portable. A portable version is provided by :meth:`SavePortable`.
+    Preferably portable files are distributed and converted to a raw binary
+    before using them.
+
+    :param filename:      path to the file where the database will be saved
+
+    :type filename:       :class:`str`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - db has been loaded with load_frequencies=False. This enforces
+                only complete databases to be saved down.
+
+  .. method:: LoadPortable(filename)
+
+    Loads portable file generated with :meth:`SavePortable` (slow but less
+    machine-dependent).
+    
+    :param filename:      path to the file from which to load the database.
+
+    :type filename:       :class:`str`
+    :type load_frequencies: :class:`bool`
+
+    :returns:             The loaded data base
+    :rtype:               :class:`StructureDB`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - machine-dependent fundamental types are smaller than required.
+
+  .. method:: SavePortable(filename)
+
+    Saves portable binary representation (slow but less machine-dependent).
+
     :param filename:      path to the file where the database will be saved
 
     :type filename:       :class:`str`
 
-    :raises:            :class:`RuntimeError` If db has been loaded with 
-                        load_frequencies=False. This enforces only complete
-                        databases to be saved down.
+    :raises:  :exc:`~exceptions.RuntimeError` if:
 
+              - file cannot be opened.
+              - db has been loaded with load_frequencies=False. This enforces
+                only complete databases to be saved down.
 
-  .. method:: AddCoordinates(pdb_id, chain_name, chain, surf, hmm)
+  .. method:: AddCoordinates(pdb_id, chain_name, chain, surf, prof)
 
     This method takes a structural chain and searches the longest stretch of
     connected residues containing all necessary backbone atoms. This stretch
@@ -203,20 +183,20 @@ The Database
     :param chain_name:  Name of the chain consisting of one letter
     :param chain:       The actual chain 
     :param surf:        A surface describint the solvent accessible surface
-    :param hmm:         An HMM containing profile information.
+    :param prof:        Profile information for this structure.
 
     :type pdb_id:       :class:`str`
     :type chain_name:   :class:`str`
     :type chain:        :class:`ost.mol.ChainView`
     :type surf:         :class:`ost.mol.SurfaceHandle`
-    :type hmm:          :class:`ost.seq.HMM`
+    :type prof:         :class:`ost.seq.ProfileHandle`
 
     :returns:           DB Index of added chain.
 
-    :raises:            :class:`RuntimeError` If size of chain is too large, when
-                        db has been loaded with load_frequencies=False or when
-                        the ATOMSEQ form the **chain** can't be aligned with the
-                        SEQRES from the **hmm**.
+    :raises:  :exc:`~exceptions.RuntimeError` if size of chain is too large,
+              when db has been loaded with load_frequencies=False or when the
+              ATOMSEQ form the **chain** can't be aligned with the SEQRES from
+              the **prof**.
 
   .. method:: GetCoordIndex(pdb_id, chain_name)
 
@@ -246,9 +226,9 @@ The Database
 
     :returns:           :class:`BackboneList`
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
 
 
   .. method:: GetBackboneList(n_stem, c_stem, fragment)
@@ -266,9 +246,9 @@ The Database
 
     :returns:           :class:`BackboneList`
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
 
 
   .. method:: GetNumCoords()
@@ -288,9 +268,9 @@ The Database
 
     :returns:           The sequence of **fragment**
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
 
 
   .. method:: GetDSSPStates(fragment)
@@ -300,9 +280,9 @@ The Database
 
     :returns:           The dssp states of **fragment**
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
 
 
   .. method:: GetDihedralAngles(fragment)
@@ -313,9 +293,9 @@ The Database
     :returns:           A list of pairs containing the  phi and psi dihedral angles of every
                         residue of the **fragment**.
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
 
   .. method:: GetResidueDepths(fragment)
 
@@ -327,9 +307,9 @@ The Database
     :returns:           A :class:`list` of :class:`float` values describing
                         the per residue depth
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
 
   .. method:: GetSolventAccessibilitites(fragment)
 
@@ -342,9 +322,9 @@ The Database
                         the per residue solvent accessibilities in square A as
                         calculated by dssp
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
 
   .. method:: GetSequenceProfile(fragment)
 
@@ -353,13 +333,13 @@ The Database
 
     :type fragment:     :class:`FragmentInfo`
 
-    :returns:           The sequence profile for the residues defined by 
-                        **fragment**, represented as a :class:`ost.seq.HMM`
-                        with the BLOSUM62 probabilities as NULL model
+    :returns:   The sequence profile for the residues defined by 
+                **fragment**, represented as a :class:`ost.seq.ProfileHandle`
+                with the BLOSUM62 probabilities as NULL model
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
                         
   .. method:: GetStructureProfile(fragment)
 
@@ -368,13 +348,13 @@ The Database
 
     :type fragment:     :class:`FragmentInfo`
 
-    :returns:           The structure profile for the residues defined by 
-                        **fragment**, represented as a :class:`ost.seq.HMM`
-                        with the BLOSUM62 probabilities as NULL model
+    :returns:    The structure profile for the residues defined by 
+                 **fragment**, represented as a :class:`ost.seq.ProfileHandle`
+                 with the BLOSUM62 probabilities as NULL model
 
-    :raises:            :class:`RuntimeError` If fragment is invalid. This is
-                        the case when the fragment does not fully fit into one
-                        of the chains in the database.
+    :raises:  :exc:`~exceptions.RuntimeError` if fragment is invalid. This is
+              the case when the fragment does not fully fit into one of the
+              chains in the database.
 
   .. method:: GenerateStructureProfile(bb_list, residue_depths)
 
@@ -391,29 +371,26 @@ The Database
     :type residue_depths: :class:`list` of :class:`float` values 
 
     :returns:           The structure profile for the input, 
-                        represented as a :class:`ost.seq.HMM`
+                        represented as a :class:`ost.seq.ProfileHandle`
                         with the BLOSUM62 probabilities as NULL model
 
-    :raises:            :class:`RuntimeError` if **bb_list** and 
-                        **residue_depths** differ in size or when
-                        their size is 0
+    :raises:  :exc:`~exceptions.RuntimeError` if **bb_list** and 
+              **residue_depths** differ in size or when their size is 0
 
-  .. method:: SetStructureProfile(chain_idx, hmm)
+  .. method:: SetStructureProfile(chain_idx, prof)
 
-    Takes the **hmm** and sets the corresponding StructureProfile
+    Takes the **prof** and sets the corresponding StructureProfile
     frequencies in entry with **chain_idx**
 
-    :param hmm:         Source of profile frequencies
+    :param prof:        Source of profile frequencies
     :param chain_idx:   idx of entry for which to set the frequencies
 
-    :type hmm:          :class:`ost.seq.HMM`
+    :type prof:         :class:`ost.seq.ProfileHandle`
     :type chain_idx:    :class:`int`
 
-    :raises:            :class:`RuntimeError` If **chain_idx** does not match
-                        any entry in the db or when the size of the **hmm**
-                        does not exactly match the size of entry at 
-                        **chain_idx**
-
+    :raises: :exc:`~exceptions.RuntimeError` if **chain_idx** does not match
+             any entry in the db or when the size of the **prof** does not
+             exactly match the size of entry at **chain_idx**
 
 
 
@@ -421,50 +398,16 @@ Finding Fragments based on Geometric Features
 --------------------------------------------------------------------------------
 
 The fragment database allows to organize, search and access the information
-stored in a structural database (:class:`StructureDB`). 
-In its current form it groups fragments in bins according to their length
-and the geometry of their N-stem and C-stem (described by 4 angles and the
-distance between the N-stem C atom and the C-stem N atom). It can therefore
-be searched for fragments matching a certain geometry of N and C stems. 
-The bins are accessed through a hash table, making searching the database
-ultra fast.
-
- 
-.. code-block:: python
-
-  #This example should illustrate how to create a custom FragDB 
-  #based on a StructureDB
-
-  from promod3 import loop
-
-  #let's load the default structure_db 
-  structure_db = loop.LoadStructureDB()
-  
-  #and our beloved crambin...
-  structure = io.LoadPDB('1crn',remote=True)
-  
-  #we now want to connect the residue with index 17 and 21
-  n_stem = structure.residues[17]
-  c_stem = structure.residues[21]
-  
-  #A custom FragDB can be build to identify fragments
-  #fulfilling these particular geometric constraints
-  frag_db = loop.FragDB(1.0,20)
-  
-  #At this point we add all possible fragments of length 5 
-  #with an RMSD threshold of 0.5
-  frag_db.AddFragments(5,0.5,structure_db)
-  
-  #The FragDB can now be used to extract FragmentInfo objects to finally query
-  #the StructureDB
-  fragment_infos = frag_db.SearchDB(n_stem,c_stem,5)
-  
-  #let's get the fragments in form of BackboneList objects and save the down
-  for i,f_i in enumerate(fragment_infos):
-    bb_list = structure_db.GetBackboneList(n_stem,c_stem,f_i)
-    io.SavePDB(bb_list.ToEntity(),str(i)+".pdb")
+stored in a structural database (:class:`StructureDB`). In its current form it
+groups fragments in bins according to their length (incl. stems) and the
+geometry of their N-stem and C-stem (described by 4 angles and the distance
+between the N-stem C atom and the C-stem N atom). It can therefore be searched
+for fragments matching a certain geometry of N and C stems. The bins are
+accessed through a hash table, making searching the database ultra fast.
 
+This example illustrates how to create a custom FragDB based on a StructureDB:
 
+.. literalinclude:: ../../../tests/doc/scripts/loop_frag_db.py
 
 .. class:: FragDB(dist_bin_size, angle_bin_size)
 
@@ -475,22 +418,64 @@ ultra fast.
 
   .. method:: Load(filename)
 
+    Loads raw binary file generated with :meth:`Save` (optimized for fast
+    reading).
+
     :param filename:      path to the file from which to load the database.
 
     :type filename:       :class:`str`
 
     :returns:             The loaded database
-
     :rtype:               :class:`FragDB`
 
-    :raises:            :class:`RuntimeError` If **filename** does not exist.
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - file assumes different memory-layout than is available on this
+                machine. Use :meth:`LoadPortable` to convert your file.
 
   .. method:: Save(filename)
 
+    Saves raw binary representation (optimized for fast reading).This puts many
+    assumptions on the memory-layout of the target-machine and hence it is not
+    portable. A portable version is provided by :meth:`SavePortable`.
+    Preferably portable files are distributed and converted to a raw binary
+    before using them.
+
     :param filename:      path to the file where the database will be saved
 
     :type filename:       :class:`str`
 
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: LoadPortable(filename)
+
+    Loads portable file generated with :meth:`SavePortable` (slow but less
+    machine-dependent).
+
+    :param filename:      path to the file from which to load the database.
+
+    :type filename:       :class:`str`
+
+    :returns:             The loaded database
+    :rtype:               :class:`FragDB`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - machine-dependent fundamental types are smaller than required.
+
+  .. method:: SavePortable(filename)
+
+    Saves portable binary representation (slow but less machine-dependent).
+
+    :param filename:      path to the file where the database will be saved
+
+    :type filename:       :class:`str`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
 
   .. method:: GetAngularBinSize()
 
@@ -522,45 +507,49 @@ ultra fast.
   .. method:: PrintStatistics()
 
     Prints statistics about the fragment databse, notably:
-    1. the number of different stem groups (number of bins used to group the fragments according to the geometry of their stem residues)
+
+    1. the number of different stem groups (number of bins used to group the
+       fragments according to the geometry of their stem residues)
     2. The total number of fragments in the database
     3. The minimal and maximal number of fragments found in a stem group.
 
 
   .. method:: GetNumStemPairs()
-
-    Returns the number of stem groups (number of bins used to group the fragments according to the geometry of their stem residues).
-    
-    :returns:   The number of groups
-    :rtype:     :class:`int`
-    :param loop_length: The length of the fragments
-
-  .. method:: GetNumStemPairs(loop_length)
+              GetNumStemPairs(loop_length)
     
-    Returns the number of stem groups (number of bins used to group the fragments according to the geometry of their stem residues) for fragments of a given length.
+    Returns the number of stem groups (number of bins used to group the
+    fragments according to the geometry of their stem residues) for the whole db
+    or for fragments of a given length.
     
     :param loop_length:   The length of the fragments
     :type loop_length:    :class:`int`
 
     :returns:   The number of groups
     :rtype:     :class:`int`
-        
 
   .. method:: GetNumFragments()
+              GetNumFragments(loop_length)
 
-    Returns the number of fragments in the database.
+    Returns the number of fragments in the database in total or for fragments of
+    a given length.
+
+    :param loop_length:   The length of the fragments
+    :type loop_length:    :class:`int`
 
     :returns: Number of fragments
     :rtype:   :class:`int`
 
-  .. method:: GetNumFragments(loop_length)
-
-    Returns the number of fragments of length **loop_length** in the database.
+  .. method:: HasFragLength(loop_length)
 
     :param loop_length:   The length of the fragments
     :type loop_length:    :class:`int`
 
-    :returns: Number of fragments
+    :returns: True if fragments of given length exist. This function is quick.
+    :rtype:   :class:`bool`
+
+  .. method:: MaxFragLength()
+
+    :returns: Maximal fragment length contained in db. This function is quick.
     :rtype:   :class:`int`
 
   .. method:: SearchDB(n_stem, c_stem,frag_size,[extended_search=False])
@@ -622,58 +611,16 @@ arbitrary linear combination of following components:
   in between them. The scores are calculated as described for HHSearch [soding2005]_.
   In this case, the amino acid frequencies extracted from structural alignments are used.
 
+.. literalinclude:: ../../../tests/doc/scripts/loop_fragger.py
 
-.. code-block:: python
-
-  from promod3 import loop
-
-  #load an example structure
-  prot = io.LoadPDB("1crn",remote=True)
-
-  #extract some additional information
-  seq = ''.join([r.one_letter_code for r in prot.residues])
-  frag_pos = 35
-  frag_length = 9
-  frag_seq = seq[frag_pos:frag_pos+frag_length]
-  frag_residues = prot.residues[frag_pos:frag_pos+frag_length]
-  ref_backbone = loop.BackboneList(frag_seq,frag_residues)
-  
-  #let's load the StructureDB and a substitution matrix
-  db = loop.LoadStructureDB()
-  subst_matrix = ost.seq.alg.BLOSUM62
-  
-  #the fragger object needs to be initialized with its target sequence
-  fragger = loop.Fragger(frag_seq)
-
-  #we could now add an arbitrary number of parameters from different features
-  #for now we only go for the sequence similarity score
-  fragger.AddSeqSimParameters(1.0, subst_matrix)
+.. class:: Fragger(seq)
 
-  #the Fragger can finally be filled by providing a StructureDB
-  fragger.Fill(db,1.0,100)
-  
-  #let's see how good the fragments are...
-  below_three = 0
-  for i in range(len(fragger)):
-    ca_rmsd = fragger[i].CARMSD(ref_backbone,True)
-    print "Fragment ",i, " has CA RMSD of ",ca_rmsd
-    if ca_rmsd < 3.0:
-      below_three += 1
-  
-  print "Fraction of fragments below 3A: ", float(below_three)/len(fragger)
+  A Fragger object to search a :class:`StructureDB` for fragments with **seq**
+  as target sequence. You need to add some score components before you can
+  finally call the Fill function.
 
-
-.. class:: Fragger
-
-  .. method:: Fragger(seq)
-
-    Initialize a Fragger object to search a :class:`StructureDB` for fragments with
-    **seq** as target sequence. You need to add some score components before
-    you can finally call the Fill function.
-
-    :param seq:         Sequence of fragments to be searched
-
-    :type seq:          :class:`str`
+  :param seq:         Sequence of fragments to be searched
+  :type seq:          :class:`str`
 
   .. method:: Fill(db, rmsd_thresh, num_fragments)
 
@@ -717,25 +664,46 @@ arbitrary linear combination of following components:
     :type w:            :class:`str`
     :type psipred_prediction: :class:`PsipredPrediction`
 
-  .. method:: AddSequenceProfileParameters(w, hmm)
+
+  .. method:: AddTorsionProbabilityParameters(w, torsion_sampler, \
+                                              aa_before, aa_after)
+              AddTorsionProbabilityParameters(w, torsion_sampler_list, \
+                                              aa_before, aa_after)
+
+    Add TorsionProbability component of linear weight **w**
+
+    :param w:           linear weight
+    :type w:            :class:`float`
+    :param torsion_sampler: Torsion sampler to be used for all residues.
+    :type torsion_sampler:  :class:`TorsionSampler`
+    :param torsion_sampler_list: One torsion sampler for each residue.
+    :type torsion_sampler_list:  :class:`list` of :class:`TorsionSampler`
+    :param aa_before:   Name (3 letter code) of the residue before the sequence
+                        linked to this object.
+    :type aa_before:    :class:`str`
+    :param aa_after:    Name (3 letter code) of the residue after the sequence
+                        linked to this object.
+    :type aa_after:     :class:`str`
+
+  .. method:: AddSequenceProfileParameters(w, prof)
 
     Add SequenceProfile component of linear weight **w**
 
     :param w:           linear weight
-    :param hmm:         Profile for the fraggers target_sequence
+    :param prof:        Profile for the fraggers target_sequence
 
     :type w:            :class:`float`
-    :type hmm:          :class:`ost.seq.HMM`
+    :type prof:         :class:`ost.seq.ProfileHandle`
 
-  .. method:: AddStructureProfileParameters(w, hmm)
+  .. method:: AddStructureProfileParameters(w, prof)
 
     Add StructureProfile component of linear weight **w**
 
     :param w:           linear weight
-    :param hmm:         Profile for the fraggers target_sequence
+    :param prof:        Profile for the fraggers target_sequence
 
     :type w:            :class:`float`
-    :type hmm:          :class:`ost.seq.HMM`
+    :type prof:         :class:`ost.seq.ProfileHandle`
 
   .. method:: __len__()
 
@@ -746,6 +714,7 @@ arbitrary linear combination of following components:
     :param index:       Item to extract
 
     :returns:           Fragment at given position
+    :rtype:             :class:`BackboneList`
 
   .. method:: GetFragmentInfo(index)
 
@@ -771,12 +740,85 @@ arbitrary linear combination of following components:
     fragment defined by **index** with parameter indexing based on the order
     you added them to the :class:`Fragger`
 
-    :param parameter_index: Index of score
-    :param index:       Index of fragment
+    :param parameter_index: Index of score (0-indexed in order of score
+                            components that were added)
+    :param index:           Index of fragment
 
     :type parameter_index: :class:`int`
     :type index:           :class:`int`
 
+.. class:: FraggerMap
+
+  A simple storable map of Fragger objects. The idea is that one can use the map
+  to cache fragger lists that have already been generated.
+
+  You can use :meth:`Contains` to check if an item with a given key
+  (:class:`int`) already exists and access items with the [] operator (see
+  :meth:`__getitem__` and :meth:`__setitem__`).
+
+  Serialization is meant to be temporary and is not guaranteed to be portable.
+
+  .. method:: Load(filename, db)
+
+    Loads raw binary file generated with :meth:`Save`.
+    
+    :param filename: Path to the file.
+    :type filename:  :class:`str`
+    :param db:       Source of structural data used when filling the fragments.
+    :type db:        :class:`StructureDB`
+
+    :returns:        The loaded map.
+    :rtype:          :class:`FraggerMap`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: Save(filename)
+
+    Saves raw binary representation of this map. Only fragment infos and scores
+    are stored and not the parameters for scoring. The coordinates are to be
+    reread from a structure db.
+
+    :param filename: Path to the file.
+    :type filename:  :class:`str`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: LoadBB(filename)
+
+    Loads raw binary file generated with :meth:`SaveBB`.
+    
+    :param filename: Path to the file.
+    :type filename:  :class:`str`
+
+    :returns:        The loaded map.
+    :rtype:          :class:`FraggerMap`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: SaveBB(filename)
+
+    Saves raw binary representation of this map. Only fragments and scores
+    are stored and not the parameters for scoring. Here, we also store the 
+    coordinates. This file will hence be much larger than the one saved with
+    :meth:`Save`.
+
+    :param filename: Path to the file.
+    :type filename:  :class:`str`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: Contains(id)
+
+    :return: True, iff a fragger object for this id is already in the map.
+    :rtype:  :class:`bool`
+
+  .. method:: __getitem__(id)
+              __setitem__(id)
+
+    Allow read/write access (with [*id*]) to fragger object with given ID.
+
+.. autoclass:: FraggerHandle
+  :members:
 
 .. [soding2005] Söding J (2005). Protein homology detection by HMM-HMM comparison. Bioinformatics 21 (7): 951–960.
 .. [sanner1996] Sanner M, Olson AJ, Spehner JC (1996). Reduced Surface: an Efficient Way to Compute Molecular Surfaces. Biopolymers 38 (3): 305-320.
diff --git a/doc/html/_sources/loop/torsion_sampler.txt b/doc/html/_sources/loop/torsion_sampler.txt
index d297dddfc166a0c961ef9c60aa4f1a49ebbb520c..cd475da491565233ef332285f2a649827285b352 100644
--- a/doc/html/_sources/loop/torsion_sampler.txt
+++ b/doc/html/_sources/loop/torsion_sampler.txt
@@ -16,34 +16,10 @@ The distributions of the sampler are internally stored in a vector, so that
 most methods which need to access a specific distribution can either take 3 
 residue names or an index as input.
 
-.. code-block:: python
-
-  from promod3 import loop
-  import matplotlib.pyplot as plt
-  import numpy as np
-
-  #load a default sampler
-  t_sampler = loop.LoadTorsionSampler()
-
-  #dihedral angles will be stored in here
-  phi = list()
-  psi = list()
-  
-  #draw from a random distribution
-  for i in range(1000):
-    dihedral_pair = t_sampler.Draw("ALA","PRO","ALA")
-    phi.append(dihedral_pair[0])
-    psi.append(dihedral_pair[1])
-  
-  #and plot it
-  plt.xlim((-np.pi,np.pi))
-  plt.ylim((-np.pi,np.pi))
-  plt.plot(phi,psi,'.')
-  plt.xlabel("phi",fontsize='large')
-  plt.ylabel("psi",fontsize='large')
-  plt.title("ALA-PRO-ALA")
-  
-  plt.show()
+As a showcase example, we randomly sample from a given torsion sample and
+store the resulting samples as a scatter plot:
+
+.. literalinclude:: ../../../tests/doc/scripts/loop_torsion_sampler.py
 
 
 Defining Amino Acid triplets
@@ -94,22 +70,71 @@ The Torsion Sampler Class
     
     Recalculates the probability distributions from the histograms.
 
-  .. method:: Load(filename)
+  .. method:: Load(filename, seed)
+
+    Loads raw binary file generated with :meth:`Save` (optimized for fast
+    reading).
 
     :param filename:      path to the file from which to load the sampler.
+    :param seed:          seed for random number generator (not saved in file).
 
     :type filename:       :class:`str`
+    :type seed:           :class:`int`
 
     :returns:             A torsion sampler
-
     :rtype:               :class:`TorsionSampler`
 
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - file assumes different memory-layout than is available on this
+                machine. Use :meth:`LoadPortable` to convert your file.
+
   .. method:: Save(filename)
 
+    Saves raw binary representation (optimized for fast reading).This puts many
+    assumptions on the memory-layout of the target-machine and hence it is not
+    portable. A portable version is provided by :meth:`SavePortable`.
+    Preferably portable files are distributed and converted to a raw binary
+    before using them.
+
     :param filename:      path to the file where the sampler will be saved
 
     :type filename:       :class:`str`
 
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: LoadPortable(filename, seed)
+
+    Loads portable file generated with :meth:`SavePortable` (slow but less
+    machine-dependent).
+
+    :param filename:      path to the file from which to load the sampler.
+    :param seed:          seed for random number generator (not saved in file).
+
+    :type filename:       :class:`str`
+    :type seed:           :class:`int`
+
+    :returns:             A torsion sampler
+    :rtype:               :class:`TorsionSampler`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - machine-dependent fundamental types are smaller than required.
+
+  .. method:: SavePortable(filename)
+
+    Saves portable binary representation (slow but less machine-dependent).
+
+    :param filename:      path to the file where the sampler will be saved
+
+    :type filename:       :class:`str`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
   .. method:: GetHistogramIndex(before,central,after)
 
     :param before:        Name (3 letter code) of the residue before *central*
@@ -128,8 +153,8 @@ The Torsion Sampler Class
     :returns:             List of length n-2 containing histogram indices of
                           all consecutive amino acid triplets in **sequence**
 
-    :raises:              :class:`RuntimeError` if **sequence** contains non
-                          standard amino acid
+    :raises:  :exc:`~exceptions.RuntimeError` if **sequence** contains non
+              standard amino acid
 
 
   .. method:: Draw(before,central,after)
@@ -158,7 +183,7 @@ The Torsion Sampler Class
 
   .. method:: DrawPhiGivenPsi(before,central,after,psi)
     
-    Draws a *phi* angle for the *central* residue from the conditional distribution P(*phi*|*psi*) specific for such a triplet of residues.
+    Draws a *phi* angle for the *central* residue from the conditional distribution P( *phi* | *psi* ) specific for such a triplet of residues.
 
     :param before:        Name (3 letter code) of the residue before *central*
     :param central:       Name (3 letter code) of the residue for which the *phi* will be drawn
@@ -174,7 +199,7 @@ The Torsion Sampler Class
 
   .. method:: DrawPhiGivenPsi(index,psi)
 
-    Draws a *phi* angle from the conditional distribution P(*phi*|*psi*) specified by the *index*.
+    Draws a *phi* angle from the conditional distribution P( *phi* | *psi* ) specified by the *index*.
 
     :param index:         The index of the distribution from which a *phi* angle will be drawn.
     :param psi:           *psi* angle
@@ -186,7 +211,7 @@ The Torsion Sampler Class
 
   .. method:: DrawPsiGivenPhi(before,central,after,phi)
     
-    Draws a *phi* angle for the *central* residue from the conditional distribution P(*psi*|*phi*) specific for such a triplet of residues.
+    Draws a *phi* angle for the *central* residue from the conditional distribution P( *psi* | *phi* ) specific for such a triplet of residues.
 
     :param before:        Name (3 letter code) of the residue before *central*
     :param central:       Name (3 letter code) of the residue for which the *psi* angle will be drawn
@@ -202,7 +227,7 @@ The Torsion Sampler Class
 
   .. method:: DrawPsiGivenPhi(index,phi)
 
-    Draws a *phi* angle from the conditional distribution P(*psi*|*phi*) specified by the *index*.
+    Draws a *phi* angle from the conditional distribution P( *psi* | *phi* ) specified by the *index*.
 
     :param index:         The index of the distribution from which a psi angle will be drawn.
     :param phi:           *phi* angle
@@ -232,7 +257,7 @@ The Torsion Sampler Class
 
   .. method:: GetProbability(index,phi,psi)
     
-    Returns the probability of a specific pair of phi/psi angles calulated form the distribution specified by *index*.
+    Returns the probability of a specific pair of phi/psi angles calulated from the distribution specified by *index*.
 
     :param index:         The index of the distribution.
     :param phi:           phi angle
@@ -246,7 +271,7 @@ The Torsion Sampler Class
 
   .. method:: GetPhiProbabilityGivenPsi(before,central,after,phi,psi)
     
-    Returns P(*phi*|*psi*) for the central residue from the corresponding distribution.
+    Returns P( *phi* | *psi* ) for the central residue from the corresponding distribution.
 
     :param before:        Name (3 letter code) of the residue before *central*
     :param central:       Name (3 letter code) of the residue for which the probability is calculated.
@@ -264,7 +289,7 @@ The Torsion Sampler Class
 
   .. method:: GetPsiProbabilityGivenPhi(before,central,after,psi,phi)
     
-    Returns P(*psi*|*phi*) for the central residue from the corresponding distribution.
+    Returns P( *psi* | *phi* ) for the central residue from the corresponding distribution.
 
     :param before:        Name (3 letter code) of the residue before *central*
     :param central:       Name (3 letter code) of the residue for which the probability is calculated.
@@ -283,7 +308,7 @@ The Torsion Sampler Class
 
   .. method:: GetPhiProbabilityGivenPsi(index,phi,psi)
     
-    Returns P(*phi*|*psi*) for the central residue from the corresponding distribution.
+    Returns P( *phi* | *psi* ) for the central residue from the corresponding distribution.
 
     :param index:         The index of the distribution.
     :param psi:           phi angle
@@ -297,7 +322,7 @@ The Torsion Sampler Class
 
   .. method:: GetPsiProbabilityGivenPhi(index,psi,phi)
     
-    Returns P(*psi*|*phi*) for the central residue from the corresponding distribution.
+    Returns P( *psi* | *phi* ) for the central residue from the corresponding distribution.
 
     :param index:         The index of the distribution.
     :param psi:           phi angle
diff --git a/doc/html/_sources/modelling/index.txt b/doc/html/_sources/modelling/index.txt
index cc9b5ffa90638553702b4f1c4491c68d35e96baa..5d6a8aee8e982c14aa10365072775f09bc7926c8 100644
--- a/doc/html/_sources/modelling/index.txt
+++ b/doc/html/_sources/modelling/index.txt
@@ -12,7 +12,10 @@ the desired target sequence.
 A protein homology modelling pipeline then has the following main steps:
 
 - Build a raw model from the template (see :func:`BuildRawModel` function)
-- Perform loop modelling to close all gaps (see :func:`FillLoopsByDatabase` and :func:`FillLoopsByMonteCarlo` function)
+- Perform loop modelling to close (or remove) all gaps (see functions
+  :func:`CloseSmallDeletions`, :func:`RemoveTerminalGaps`,
+  :func:`MergeGapsByDistance`, :func:`FillLoopsByDatabase`,
+  :func:`FillLoopsByMonteCarlo`, :func:`CloseLargeDeletions`)
 - Build sidechains (see :func:`BuildSidechains` function)
 - Minimize energy of final model using molecular mechanics
   (see :func:`MinimizeModelEnergy` function)
@@ -21,67 +24,30 @@ The last steps to go from a raw model to a final model can easily be executed
 with the :func:`BuildFromRawModel` function. In its simplest form, one can run
 a full protein homology modelling pipeline as follows:
 
-.. code-block:: python
-
-  from ost import io
-  from promod3 import modelling
-
-  # get raw model
-  tpl = io.LoadPDB('data/1crn_cut.pdb')
-  aln = io.LoadAlignment('data/1crn.fasta')
-  aln.AttachView(1, tpl.CreateFullView())
-  mhandle = modelling.BuildRawModel(aln)
-
-  # build final model
-  final_model = modelling.BuildFromRawModel(mhandle)
-  io.SavePDB(final_model, 'model.pdb')
+.. literalinclude:: ../../../tests/doc/scripts/modelling_all.py
 
 If you want to run and tweak the internal steps, you can start with the 
 following code which is equivalent to the example above:
 
-.. code-block:: python
-
-  from ost import io
-  from promod3 import modelling
-
-  # setup
-  merge_distance = 4
-  fragment_db = loop.LoadFragDB()
-  structure_db = loop.LoadStructureDB()
-  torsion_sampler = loop.LoadTorsionSamplerCoil()
-
-  # get raw model
-  tpl = io.LoadPDB('data/1crn_cut.pdb')
-  aln = io.LoadAlignment('data/1crn.fasta')
-  aln.AttachView(1, tpl.CreateFullView())
-  mhandle = modelling.BuildRawModel(aln)
-
-  # perform loop modelling to close all gaps
-  scorer = modelling.SetupBackboneScorer(mhandle)
-  modelling.CloseSmallDeletions(mhandle, scorer)
-  modelling.RemoveTerminalGaps(mhandle)
-  for distance in range(merge_distance):
-      modelling.MergeGapsByDistance(mhandle, distance)
-      modelling.FillLoopsByDatabase(mhandle, scorer, fragment_db,
-                                    structure_db, torsion_sampler)
-  # if above fails on some gaps, use Monte Carlo
-  if len(mhandle.gaps) > 0:
-      modelling.FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler)
-  # build sidechains
-  modelling.BuildSidechains(mhandle)
-  # minimize energy of final model using molecular mechanics
-  modelling.MinimizeModelEnergy(mhandle)
-
-  # extract final model
-  final_model = mhandle.model
-  io.SavePDB(final_model, 'model.pdb')
+.. _modelling_steps_example:
+
+.. literalinclude:: ../../../tests/doc/scripts/modelling_steps.py
+
+In the default pipeline above, we call :func:`FillLoopsByDatabase` multiple
+times. First, we try to close "easy" gaps which require few extensions (we wish
+to limit the damage we do on the template) and for which we have plenty of loop
+candidates. If some gaps cannot be closed like this, we try less restrictive
+options. This approach is helpful if neighboring gaps are close together and the
+one closer to the C-terminus is easier to close. Several variants of the
+pipeline were evaluated on 1752 target-template-pairs and this one worked best.
 
 
 Modelling Pipeline
 --------------------------------------------------------------------------------
 
-.. function:: BuildRawModel(alignment)
-              BuildRawModel(alignments)
+.. function:: BuildRawModel(aln, include_ligands=False, chain_names=\
+              "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz",\
+              spdbv_style=False)
 
   Builds a raw (pseudo) model from the alignment. Can either take a single
   alignment handle or an alignment handle list. Every list item is treated as a
@@ -105,23 +71,41 @@ Modelling Pipeline
       phosphoserine are copied as a whole with the modifications stripped off.
 
   Residue numbers are set such that missing residue in gaps are honoured and
-  subsequent loop modelling can insert new residues without having to
-  renumber.
+  subsequent loop modelling can insert new residues without having to renumber.
+  **The numbering of residues starts for every chain with the value 1**.
   
   The returned :class:`ModellingHandle` stores the obtained raw model as well
   as information about insertions and deletions in the gaps list.
 
-  :param alignment: Single alignment handle for raw model.
-  :type alignment:  :class:`~ost.seq.AlignmentHandle`
+  Note, that this class is used in SWISS-MODEL and hence, legacy code must be
+  preserved.
+
+  :param aln: Single alignment handle for raw model with single chain or
+              list of alignment handles for raw model with multiple chains.
+  :type aln:  :class:`~ost.seq.AlignmentHandle` / :class:`~ost.seq.AlignmentList`
 
-  :param alignments: List of alignment handles for raw model with multiple chains.
-  :type alignments:  :class:`~ost.seq.AlignmentList`
+  :param include_ligands: True, if we wish to include ligands in the model.
+  :type include_ligands:  :class:`bool`
+
+  :param chain_names: Chains are named by a single chanacter taken from this.
+  :type chain_names:  :class:`str`
+
+  :param spdbv_style: True, if we need a model in the old SPDBV style.
+  :type spdbv_style:  :class:`bool`
 
   :return: Raw (pseudo) model from the alignment.
   :rtype:  :class:`ModellingHandle`
 
-  :raises: A :exc:`RuntimeError` when the second sequence does not have an
-           attached structure
+  :raises: A :exc:`RuntimeError` when: 
+           
+           - the alignments do not have two sequences
+           - the second sequence does not have an attached structure
+           - the residues of the template structure do not match with the
+             alignment sequence (note that you can set an "offset" (see
+             :meth:`~ost.seq.AlignmentHandle.SetSequenceOffset`) for the
+             template sequence (but not for the target))
+           - the target sequence has a non-zero offset (cannot be honored as
+             the resulting model will always start its residue numbering at 1)
 
 .. autofunction:: BuildFromRawModel
 
@@ -129,6 +113,8 @@ Modelling Pipeline
 
 .. autofunction:: MinimizeModelEnergy
 
+.. autofunction:: CheckFinalModel
+
 
 Closing Gaps
 --------------------------------------------------------------------------------
@@ -139,6 +125,10 @@ Closing Gaps
 
 .. function:: RemoveTerminalGaps(mhandle)
 
+  Removes terminal gaps without modelling them (just removes them from the list
+  of gaps). This is useful for pipelines which lack the possibility to properly
+  model loops at the termini.
+
   :param mhandle: Modelling handle on which to apply change.
   :type mhandle:  :class:`ModellingHandle`
 
@@ -151,9 +141,27 @@ Closing Gaps
 
 .. autofunction:: FillLoopsByMonteCarlo
 
+.. autofunction:: ModelTermini
+
+.. autofunction:: CloseLargeDeletions
+
+.. function:: CountEnclosedGaps(mhandle, gap)
+              CountEnclosedInsertions(mhandle, gap)
+
+  Counts all gaps from `mhandle` which are fully enclosed by given `gap`.
+  This is either all gaps or only insertions.
+
+  :param mhandle: Modelling handle on which to apply change.
+  :type mhandle:  :class:`ModellingHandle`
+  :param gap:     Gap defining range in which gaps are to be removed.
+  :type gap:      :class:`StructuralGap`
+
+  :return: Number of gaps.
+  :rtype:  :class:`int`
+
 .. function:: ClearGaps(mhandle, gap)
 
-  Removes all gaps from mhandle which are fully enclosed by given gap.
+  Removes all gaps from `mhandle` which are fully enclosed by given `gap`.
 
   :param mhandle: Modelling handle on which to apply change.
   :type mhandle:  :class:`ModellingHandle`
@@ -161,7 +169,7 @@ Closing Gaps
   :type gap:      :class:`StructuralGap`
 
   :return: Index of next gap in mhandle.gaps after removal.
-           Returns -1 if last gap was removed.
+           Returns -1 if last gap was removed or no gaps in *mhandle*.
   :rtype:  :class:`int`
 
   :raises: A :exc:`RuntimeError` if any gap in mhandle.gaps is only partially
@@ -169,7 +177,9 @@ Closing Gaps
 
 .. function:: MergeGaps(mhandle, index)
 
-  Merges two gaps mhandle.gaps[index] and mhandle.gaps[index+1].
+  Merges two gaps `mhandle.gaps[index]` and `mhandle.gaps[index+1]`.
+  The residues in between the gaps are removed from `mhandle.model` and added
+  to the new `mhandle.gaps[index]`.
 
   :param mhandle: Modelling handle on which to apply change.
   :type mhandle:  :class:`ModellingHandle`
@@ -177,7 +187,7 @@ Closing Gaps
   :type index:    :class:`int`
 
   :raises: A :exc:`RuntimeError` if indices out of range or if trying to merge
-           N-terminal gap with a C-terminal gap.
+           gaps of different chains or an N-terminal gap with a C-terminal gap.
 
 
 Modelling Handle class
@@ -211,7 +221,6 @@ Modelling Handle class
 
     :type: :class:`~ost.seq.SequenceList`
 
-
 Gap classes
 --------------------------------------------------------------------------------
 
@@ -337,7 +346,7 @@ The extender classes work on a given :class:`StructuralGap` and provide an
 Extend() function to propose new gaps for loop modelling. The function returns
 False if no new extension possible.
 
-.. class:: GapExtender(gap)
+.. class:: GapExtender(gap, seqres)
 
   The extender cycles through the following steps:
 
@@ -355,23 +364,57 @@ False if no new extension possible.
        ----
 
   :param gap: The gap which will be extended by :meth:`Extend`.
+  :param seqres: The full sequence of the chain, the gap is associated with.
+  :type gap:  :class:`StructuralGap`
+  :type seqres: :class:`str` / :class:`ost.seq.SequenceHandle`
+
+  :raises: An exception if a terminal gap is used to construct this.
+
+  .. method:: Extend()
+
+    Tries to extend *gap*.
+
+    :return: False, if the *gap* cannot be extended any further. This happens
+             if it reaches a terminal or another insertion gap.
+             Otherwise, the *gap* passed to the constructor is changed.
+             The gaps are extended with ascending length and will always have
+             valid termini.
+    :rtype:  :class:`bool`
+
+.. class:: FullGapExtender(gap, seqres, max_length=-1)
+
+  Cycles as GapExtender, but continues even if another gap was encountered.
+
+  :param gap: The gap which will be extended by :meth:`Extend`.
+  :param seqres: The full sequence of the chain, the gap is associated with.
+  :param max_length: - If -1, all possible non-terminal gaps are returned.
+                     - If >= 0, this restricts the max. gap-length
+                       (w/o termini) producable by :meth:`Extend`.
   :type gap:  :class:`StructuralGap`
+  :type seqres: :class:`str` / :class:`ost.seq.SequenceHandle`
+  :type max_length: :class:`int`
+
+  :raises: An exception if a terminal gap is used to construct this.
 
   .. method:: Extend()
 
-    Tries to extend `gap`.
+    Tries to extend *gap*.
 
-    :return: False, iff the gap cannot be extended any further.
+    :return: False, if the *gap* cannot be extended without exceeding *max_length*.
+             Otherwise, the *gap* passed to the constructor is changed.
+             The gaps are extended with ascending length and will always have
+             valid termini.
     :rtype:  :class:`bool`
 
-.. class:: ScoringGapExtender(gap, extension_penalty, penalties)
+.. class:: ScoringGapExtender(gap, extension_penalty, penalties, seqres,\
+                              max_length=-2)
 
   The extender scores possible gap extensions and returns them in order of
   their score when :meth:`Extend` is called.
   The score is penalized according to length and according to certain (well
-  conserved) regions in the structure.
-  score = length * `extension_penalty` + sum( `penalties` [i] )
-  (i = res.num. of residues in extension)
+  conserved) regions in the structure as defined by *penalties*.
+  score = num_gap_extensions * `extension_penalty` + sum( `penalties` [i] )
+  (i = resnum - 1 of residues in extension)
 
   :param gap: The gap which will be extended by :meth:`Extend`.
   :type gap:  :class:`StructuralGap`
@@ -379,16 +422,59 @@ False if no new extension possible.
   :type extension_penalty:  :class:`float`
   :param penalties: Penalty for each residue added to gap.
   :type penalties:  :class:`list` of :class:`float`
+  :param seqres: The full sequence of the chain, the gap is associated with.
+  :type seqres: :class:`str` / :class:`ost.seq.SequenceHandle`
+  :param max_length: 
+    - If -2, :class:`GapExtender` is used instead of :class:`FullGapExtender`
+      (i.e. it stops at gaps and termini).
+    - If -1, all possible non-terminal gaps are returned.
+    - If >= 0, this restricts the max. gap-length (w/o termini)
+      producable by :meth:`Extend`.
+  :type max_length: :class:`int`
+
+  :raises: An exception if a terminal gap is used to construct this.
 
   .. method:: Extend()
 
-    Tries to extend `gap`.
+    Tries to extend *gap*.
 
-    :return: False, iff the gap cannot be extended any further.
+    :return: False, if the gap cannot be extended any further.
+             Otherwise, *gap* is changed and returned in ascending score.
+             The updated *gap* will always have valid termini.
     :rtype:  :class:`bool`
 
+.. class:: ShiftExtension(n_num, c_num)
+
+  Implements the underlying extension scheme of the :class:`GapExtender`.
+  It is not associated to any structural data, it just spits out the
+  residue numbers according to the extension scheme described above.
+
+  :param n_num:         N residue number to start with
+  :param c_num:         C residue number to start with
+  :type n_num:          :class:`int`
+  :type c_num:          :class:`int`
+
+  .. method:: Extend()
+
+    :returns:           The next residue numbers for n_stem and c_stem
+    :rtype:             :class:`tuple`
+
+
+Detecting ring punches
+--------------------------------------------------------------------------------
+
+.. autofunction:: GetRings
+
+.. autofunction:: GetRingPunches
+
+.. autofunction:: HasRingPunches
+
+.. autofunction:: FilterCandidates
+
+.. autofunction:: FilterCandidatesWithSC
+
 ..  LocalWords:  currentmodule promod aln AttachView BuildRawModel pdb calpha
 ..  LocalWords:  ModellingHandle StructuralGapList modelling Modelling os ost
-..  LocalWords:  testcode tempfile io LoadAlignment LoadPDB fh fn doctest API
+..  LocalWords:  tempfile io LoadAlignment LoadPDB fh fn API
 ..  LocalWords:  modelling phosphoserine param exc RuntimeError automethod
 ..  LocalWords:  CloseSmallDeletions
diff --git a/doc/html/_sources/portableIO.txt b/doc/html/_sources/portableIO.txt
new file mode 100644
index 0000000000000000000000000000000000000000..38f288cb88d782edbed6fc7a8a976c77eb6f22ed
--- /dev/null
+++ b/doc/html/_sources/portableIO.txt
@@ -0,0 +1,382 @@
+.. _portableIO:
+
+Using binary files in |project|
+===============================================================================
+A few features in |project| (and potentially your next addition) require binary
+files to be loaded and stored. Here, we provide guidelines and describe helper
+tools to perform tasks related to loading and storing binary files.
+
+Generally, each binary file consists of a short header and binary data.
+The header ensures consistency between the storing and the loading of data,
+while the "binary data" is some binary representation of the data of interest.
+
+The main issue, we try to address is that in |C++|, the binary representation
+of objects can be machine- and compiler-dependent. The standard guarantees
+though that ``sizeof(char) = 1`` and that ``std::vector`` is contiguous in
+memory. Everything else (e.g. ``sizeof(int)``, endianness, padding of structs)
+can vary. Two approaches can be used:
+
+1. Raw binary data files which are very fast to load, but assume a certain
+   memory-layout for the internal representation of data
+2. Portable binary data files which are slow to load, but do not assume a given
+   memory-layout for the internal representation of data
+
+Portable I/O should always be provided for binary files. If this is too slow
+for your needs, you can provide functionality for raw binary files. In that
+case you should still distribute only the portable file and provide a
+converter which loads the portable file and stores a raw binary file for
+further use. Storing and loading of raw binary files on the same machine with
+the same compiler should never be an issue.
+
+The classes :class:`~promod3.loop.TorsionSampler`,
+:class:`~promod3.loop.FragDB`, :class:`~promod3.loop.StructureDB`,
+:class:`~promod3.loop.BackboneLoopScorer`,
+:class:`~promod3.sidechain.BBDepRotamerLib` and
+:class:`~promod3.sidechain.RotamerLib` use this approach and the conversion is
+automatically done in the ``make`` process. Code examples are given in the unit
+tests in :file:`test_check_io.cc` and :file:`test_portable_binary.cc` and in the
+|C++| code of the classes listed above (see methods Load, Save, LoadPortable and
+SavePortable).
+
+--------------------------------------------------------------------------------
+Header
+--------------------------------------------------------------------------------
+
+The header is written/read with functions provided in the header file
+:file:`promod3/core/check_io.hh`. The header is written/read before the data
+itself and is structured as follows:
+
+- a "magic number" (ensures that we can read ``uint32_t`` which is needed for
+  the following fields)
+- a version number (allows for backwards-compatibility)
+- sizes for all types which are treated as raw memory (i.e. casted to a byte
+  (``char``) array and written either to memory or to a stream)
+- example values for the used base-types (ensures we can e.g. read an ``int``)
+
+For portable I/O (see below), we only write/read fixed-width fundamental
+data-types (e.g. ``int32_t``, ``float``). Hence, we only check if we can
+read/write those types.
+When data is converted from a non-fixed fundamental type ``T`` (e.g. ``uint``,
+``short``, ``Real``), we furthermore ensure that the used fixed-width type
+(size written to file) is ``<= sizeof(T)``.
+
+All write functions (when saving a binary) should be mirrored by the
+corresponding check (or get) function in the exact same order when loading.
+
+All functions are templatized to work with any |ost_s|-like data sink or source
+and overloaded to work with ``std::ofstream`` and ``std::ifstream``.
+
+--------------------------------------------------------------------------------
+Portable binary data
+--------------------------------------------------------------------------------
+
+Portable files are written/read with functions and classes provided in the
+header file :file:`promod3/core/portable_binary_serializer.hh`.
+Generally, we store any data-structure value-by-value as fixed-width types!
+
+Writing and reading is performed by the following classes:
+
+- ``PortableBinaryDataSink`` to write files (opened as ``std::ofstream``)
+- ``PortableBinaryDataSource`` to read files (opened as ``std::ifstream``)
+
+Each serializable class must define a ``Serialize`` function that accepts sinks
+and sources, such as:
+
+.. code-block:: cpp
+
+  template <typename DS>
+  void Serialize(DS& ds) {
+    // serialize element-by-element
+  }
+
+Or if this is not possible for an object of type ``T``, we need to define
+global functions such as:
+
+.. code-block:: cpp
+
+  inline void Serialize(core::PortableBinaryDataSource& ds, T& t) { }
+  inline void Serialize(core::PortableBinaryDataSink& ds, T t) { }
+
+Given a sink or source object ``ds``, we read/write an object ``v`` as:
+
+- ``ds & v``, if ``v`` is an instance of a class, a ``bool`` or any
+  fixed-width type (e.g. ``char``, ``int_32_t``, ``float``)
+- ``core::ConvertBaseType<T>(ds, v)``, where ``T`` is a fixed-width type.
+  ``v`` will then be converted to/from ``T``. This is needed for any non-fixed
+  fundamental type (e.g. ``uint``, ``short``, ``Real``).
+
+Implementation notes:
+
+- the ``Serialize`` function for fundamental types takes care of endianness
+  (all written as little endian and converted from/to native endianness)
+- custom ``Serialize`` functions exist for ``String`` (= ``std::string``),
+  ``std::vector<T>`` and ``std::pair<T,T2>``. It will throw an error if the
+  used type ``T`` or ``T2`` is a fundamental type. In that case, you have to
+  serialize the values manually and convert each element appropriately.
+- you can use ``ds.IsSource()`` to distinguish sources and sinks.
+
+--------------------------------------------------------------------------------
+Code example
+--------------------------------------------------------------------------------
+
+Here is an example of a class which provides functionality for portable
+and non-portable I/O:
+
+.. code-block:: cpp
+
+  // includes for this class
+  #include <boost/shared_ptr.hpp>
+  #include <iostream>
+  #include <fstream>
+  #include <sstream>
+  #include <vector>
+
+  // includes for I/O
+  #include <promod3/core/message.hh>
+  #include <promod3/core/portable_binary_serializer.hh>
+  #include <promod3/core/check_io.hh>
+
+  using namespace promod3;
+
+  // define some data-structure
+  struct SomeData {
+    short s;
+    int i;
+    Real r;
+    
+    // portable serialization
+    // (cleanly element by element with fixed-width base-types)
+    template <typename DS>
+    void Serialize(DS& ds) {
+      core::ConvertBaseType<int16_t>(ds, s);
+      core::ConvertBaseType<int32_t>(ds, i);
+      core::ConvertBaseType<float>(ds, r);
+    }
+  };
+
+  // define pointer type
+  class MyClass;
+  typedef boost::shared_ptr<MyClass> MyClassPtr;
+
+  // define class
+  class MyClass {
+  public:
+    MyClass(const String& id): id_(id) { }
+
+    // raw binary save
+    void Save(const String& filename) {
+      // open file
+      std::ofstream out_stream(filename.c_str(), std::ios::binary);
+      if (!out_stream) {
+        std::stringstream ss;
+        ss << "The file '" << filename << "' cannot be opened.";
+        throw promod3::Error(ss.str());
+      }
+
+      // header for consistency checks
+      core::WriteMagicNumber(out_stream);
+      core::WriteVersionNumber(out_stream, 1);
+      // required base types: short, int, Real (for SomeData).
+      //                      uint (for sizes)
+      // required structs: SomeData
+      core::WriteTypeSize<uint>(out_stream);
+      core::WriteTypeSize<short>(out_stream);
+      core::WriteTypeSize<int>(out_stream);
+      core::WriteTypeSize<Real>(out_stream);
+      core::WriteTypeSize<SomeData>(out_stream);
+      // check values for base types
+      core::WriteBaseType<uint>(out_stream);
+      core::WriteBaseType<short>(out_stream);
+      core::WriteBaseType<int>(out_stream);
+      core::WriteBaseType<Real>(out_stream);
+
+      // write string
+      uint str_len = id_.length();
+      out_stream.write(reinterpret_cast<char*>(&str_len), sizeof(uint));
+      out_stream.write(id_.c_str(), str_len);
+      // write vector of SomeData
+      uint v_size = data_.size();
+      out_stream.write(reinterpret_cast<char*>(&v_size), sizeof(uint));
+      out_stream.write(reinterpret_cast<char*>(&data_[0]),
+                       sizeof(SomeData)*v_size);
+    }
+
+    // raw binary load
+    static MyClassPtr Load(const String& filename) {
+      // open file
+      std::ifstream in_stream(filename.c_str(), std::ios::binary);
+      if (!in_stream) {
+        std::stringstream ss;
+        ss << "The file '" << filename << "' does not exist.";
+        throw promod3::Error(ss.str());
+      }
+
+      // header for consistency checks
+      core::CheckMagicNumber(in_stream);
+      uint32_t version = core::GetVersionNumber(in_stream);
+      if (version > 1) {
+        std::stringstream ss;
+        ss << "Unsupported file version '" << version
+           << "' in '" << filename;
+        throw promod3::Error(ss.str());
+      }
+      // check for exact sizes as used in Save
+      core::CheckTypeSize<uint>(in_stream);
+      core::CheckTypeSize<short>(in_stream);
+      core::CheckTypeSize<int>(in_stream);
+      core::CheckTypeSize<Real>(in_stream);
+      core::CheckTypeSize<SomeData>(in_stream);
+      // check values for base types used in Save
+      core::CheckBaseType<uint>(in_stream);
+      core::CheckBaseType<short>(in_stream);
+      core::CheckBaseType<int>(in_stream);
+      core::CheckBaseType<Real>(in_stream);
+
+      // read string (needed for constructor)
+      uint str_len;
+      in_stream.read(reinterpret_cast<char*>(&str_len), sizeof(uint));
+      std::vector<char> tmp_buf(str_len);
+      in_stream.read(&tmp_buf[0], str_len);
+
+      // construct
+      MyClassPtr p(new MyClass(String(&tmp_buf[0], str_len)));
+
+      // read vector of SomeData
+      uint v_size;
+      in_stream.read(reinterpret_cast<char*>(&v_size), sizeof(uint));
+      p->data_.resize(v_size);
+      in_stream.read(reinterpret_cast<char*>(&p->data_[0]),
+                     sizeof(SomeData)*v_size);
+
+      return p;
+    }
+
+    // portable binary save
+    void SavePortable(const String& filename) {
+      // open file
+      std::ofstream out_stream_(filename.c_str(), std::ios::binary);
+      if (!out_stream_) {
+        std::stringstream ss;
+        ss << "The file '" << filename << "' cannot be opened.";
+        throw promod3::Error(ss.str());
+      }
+      core::PortableBinaryDataSink out_stream(out_stream_);
+
+      // header for consistency checks
+      core::WriteMagicNumber(out_stream);
+      core::WriteVersionNumber(out_stream, 1);
+      // required base types: short, int, Real
+      // -> converted to int16_t, int32_t, float
+      core::WriteTypeSize<int16_t>(out_stream);
+      core::WriteTypeSize<int32_t>(out_stream);
+      core::WriteTypeSize<float>(out_stream);
+      // check values for base types
+      core::WriteBaseType<int16_t>(out_stream);
+      core::WriteBaseType<int32_t>(out_stream);
+      core::WriteBaseType<float>(out_stream);
+
+      // write string (provided in portable_binary_serializer.hh)
+      out_stream & id_;
+      // write vector (provided in portable_binary_serializer.hh)
+      // -> only ok like this if vector of custom type
+      // -> will call Serialize-function for each element
+      out_stream & data_;
+    }
+
+    // portable binary load
+    static MyClassPtr LoadPortable(const String& filename) {
+      // open file
+      std::ifstream in_stream_(filename.c_str(), std::ios::binary);
+      if (!in_stream_) {
+        std::stringstream ss;
+        ss << "The file '" << filename << "' does not exist.";
+        throw promod3::Error(ss.str());
+      }
+      core::PortableBinaryDataSource in_stream(in_stream_);
+
+      // header for consistency checks
+      core::CheckMagicNumber(in_stream);
+      uint32_t version = core::GetVersionNumber(in_stream);
+      if (version > 1) {
+        std::stringstream ss;
+        ss << "Unsupported file version '" << version
+           << "' in '" << filename;
+        throw promod3::Error(ss.str());
+      }
+      // check for if required base types (see SavePortable)
+      // are big enough
+      core::CheckTypeSize<short>(in_stream, true);
+      core::CheckTypeSize<int>(in_stream, true);
+      core::CheckTypeSize<Real>(in_stream, true);
+      // check values for base types used in Save
+      core::CheckBaseType<int16_t>(in_stream);
+      core::CheckBaseType<int32_t>(in_stream);
+      core::CheckBaseType<float>(in_stream);
+
+      // read string (needed for constructor)
+      String s;
+      in_stream & s;
+      // construct
+      MyClassPtr p(new MyClass(s));
+      // read vector of SomeData
+      in_stream & p->data_;
+
+      return p;
+    }
+
+  private:
+    std::vector<SomeData> data_;
+    String id_;
+  };
+
+  int main() {
+    // generate raw file
+    MyClassPtr p(new MyClass("HELLO"));
+    p->Save("test.dat");
+    // load raw file
+    p = MyClass::Load("test.dat");
+
+    // generate portable file
+    p->SavePortable("test.dat");
+    // load portable file
+    p = MyClass::LoadPortable("test.dat");
+
+    return 0;
+  }
+
+--------------------------------------------------------------------------------
+Exisiting binary files
+--------------------------------------------------------------------------------
+
+The following binary files are currently in |project|:
+
+- module ``loop``:
+
+  - :file:`backbone_loop_scorer.dat`
+    (:class:`~promod3.loop.BackboneLoopScorer`)
+  - :file:`frag_db.dat`
+    (:class:`~promod3.loop.FragDB`)
+  - :file:`structure_db.dat`
+    (:class:`~promod3.loop.StructureDB`)
+  - :file:`torsion_sampler_coil.dat`
+    (:class:`~promod3.loop.TorsionSampler`)
+  - :file:`torsion_sampler.dat`
+    (:class:`~promod3.loop.TorsionSampler`)
+  - :file:`torsion_sampler_extended.dat`
+    (:class:`~promod3.loop.TorsionSampler`)
+  - :file:`torsion_sampler_helical.dat`
+    (:class:`~promod3.loop.TorsionSampler`)
+
+- module ``sidechain``:
+
+  - :file:`2010DunbrackLib.dat`
+    (:class:`~promod3.sidechain.BBDepRotamerLib`)
+  - :file:`PenultimateLib.dat`
+    (:class:`~promod3.sidechain.RotamerLib`)
+
+During the ``make`` process, portable versions of the files (stored in the
+:file:`<MODULE>/data` folder) are converted and corresponding raw binary files
+are stored in the :file:`stage/share/promod3/<MODULE>_data` folder.
+
+Code for the generation of the binary files and their portable versions are
+in the :file:`extras/data_generation` folder (provided as-is).
diff --git a/doc/html/_sources/sidechain/disulfid.txt b/doc/html/_sources/sidechain/disulfid.txt
index 9a63016ec1e15e38bd139d0b20fd3965b7183c99..fd2fb16dbd8a4deb4bfbca3523d292c480bb9d8d 100644
--- a/doc/html/_sources/sidechain/disulfid.txt
+++ b/doc/html/_sources/sidechain/disulfid.txt
@@ -8,13 +8,14 @@ a disulfid bond, one would get an unfavourable energy due to "clashes" between
 the sulfur atoms. It is possible to improve performance in sidechain
 reconstruction regarding cysteins when finding and separately handle
 disulfid bonds. PROMOD3 implements a simple geometrical description 
-[canutescu2003]_ .
+[canutescu2003b]_ .
 
 Two methods are implemented to evaluate this disulfid score on either rigid of 
 flexible rotamers. The above paper proposes two rotamers to be in a disulfid
 bonded state, if the resulting score is below 45.
 
-.. method:: DisulfidScore(rotamer_one,rotamer_two,ca_pos_one,cb_pos_one,ca_pos_two,cb_pos_two)
+.. method:: DisulfidScore(rotamer_one, rotamer_two, ca_pos_one, cb_pos_one, \
+                          ca_pos_two, cb_pos_two)
 
   :param rotamer_one:   First rotamer
   :param rotamer_two:   Second rotamer
@@ -30,12 +31,12 @@ bonded state, if the resulting score is below 45.
   :type ca_pos_two:     :class:`ost.geom.Vec3`
   :type cb_pos_two:     :class:`ost.geom.Vec3`
 
-  :raises:              :class:`RuntimeError` if given rotamers do not contain
-                        exactly one particle representing the gamma sulfur.
+  :raises:  :exc:`~exceptions.RuntimeError` if given rotamers do not contain
+            exactly one particle representing the gamma sulfur.
 
   :returns:             The disulfid score based on geometric features. In case
                         of :class:`FRMRotamer` as input, the minimal score
                         between all possible subrotamer combinations gets
                         returned.
 
-.. Already in other module .. [canutescu2003] Canutescu AA, Shelenkov AA, Dunbrack RL Jr. (2003). A graph-theory algorithm for rapid protein side-chain prediction. Protein Sci (2003).
+.. [canutescu2003b] Canutescu AA, Shelenkov AA, Dunbrack RL Jr. (2003). A graph-theory algorithm for rapid protein side-chain prediction. Protein Sci (2003).
diff --git a/doc/html/_sources/sidechain/frame.txt b/doc/html/_sources/sidechain/frame.txt
index 06af9c3adbed83e96a256eb4035e15beec22d10f..fcf4d6c0fb22b6efd3a2051f00f9e430d723a47d 100644
--- a/doc/html/_sources/sidechain/frame.txt
+++ b/doc/html/_sources/sidechain/frame.txt
@@ -41,7 +41,7 @@ The Frame Objects
 
     :returns:           :class:`Particle` at position **index**
 
-    :raises:            :class:`RuntimeError` if index is invalid
+    :raises:   :exc:`~exceptions.RuntimeError` if index is invalid
 
 
  
@@ -146,8 +146,8 @@ and sidechain frame residues.
   :type n_ter:          :class:`bool`
   :type c_ter:          :class:`bool`
 
-  :raises:              :class:`RuntimeError` when not all required backbone
-                        atoms are present in **residue**
+  :raises:  :exc:`~exceptions.RuntimeError` when not all required backbone
+            atoms are present in **residue**
 
   :returns:             :class:`FrameResidue`
 
@@ -164,8 +164,8 @@ and sidechain frame residues.
   :type residue_index:  :class:`int`
   :type settings:       :class:`RotamerSettings`
 
-  :raises:              :class:`RuntimeError` when not all required atoms
-                        atoms are present in **residue** 
+  :raises:  :exc:`~exceptions.RuntimeError` when not all required sidechain
+            atoms are present in **residue**
 
   :returns:             :class:`FrameResidue`
 
diff --git a/doc/html/_sources/sidechain/index.txt b/doc/html/_sources/sidechain/index.txt
index d063aa8beb54635e8775d6e07cc6a3ab6711e7f0..bfca8940ed6af8f0c1897b3274a679ea58eee138 100644
--- a/doc/html/_sources/sidechain/index.txt
+++ b/doc/html/_sources/sidechain/index.txt
@@ -15,25 +15,14 @@ implemented in PROMOD3 and can be applied in flexible ways.
 Reconstruct Function
 --------------------------------------------------------------------------------
 
-The simplest usage of the module is provided by the :func:`Reconstruct` function:
-
-.. code-block:: python
-
-  from ost import io,mol
-  from promod3 import sidechain
-  
-  #load a protein 
-  prot = io.LoadPDB('1eye',remote=True)
-  #get only amino acids
-  prot = mol.CreateEntityFromView(prot.Select("peptide=true"),True)
-  io.SavePDB(prot,"sidechain_test_orig.pdb")
-  #reconstruct sidechains
-  sidechain.Reconstruct(prot)
-  io.SavePDB(prot,"sidechain_test_rec.pdb")
+The simplest usage of the module is provided by the :func:`Reconstruct`
+function:
+
+.. literalinclude:: ../../../tests/doc/scripts/sidechain_reconstruct.py
 
 .. method:: Reconstruct(prot, keep_sidechains=False, build_disulfids, \
                         rotamer_model="frm", consider_hbonds=True, \
-                        rotamer_library=None, add_polar_hydrogens=False)
+                        rotamer_library=None)
 
   The function takes a structure and reconstructs its sidechains given the input 
   parameters.
@@ -61,10 +50,6 @@ The simplest usage of the module is provided by the :func:`Reconstruct` function
   :param rotamer_library: A rotamer library to extract the 
                           rotamers from.
 
-  :param add_polar_hydrogens:   All polar hydrogens will be constructed if  
-                            **consider_hbonds** is True.
-                            If this flag is activated, they'll be added to the
-                            structure.
 
   :type prot:           :class:`ost.mol.EntityHandle`
   :type keep_sidechains: :class:`bool`
@@ -72,7 +57,6 @@ The simplest usage of the module is provided by the :func:`Reconstruct` function
   :type rotamer_model:  :class:`str`
   :type consider_hbonds: :class:`bool`
   :type rotamer_library: :class:`BBDepRotamerLib` / :class:`RotamerLib`
-  :type add_polar_hydrogens: :class:`bool`
 
 
 Sidechain Module Functionality
@@ -85,90 +69,7 @@ at us. In this case, you should use the :func:`~promod3.sidechain.Reconstruct`
 function above. An overview of the full provided functionality can be found at 
 the bottom of this page.
 
-.. code-block:: python
-  
-  from ost import io,mol
-  from promod3 import sidechain
-
-  #load a protein, the rotamer library and the settings with default values
-  prot = io.LoadPDB('1eye',remote=True)
-  settings = sidechain.RotamerSettings()
-  library = sidechain.LoadDunbrackLib()
-
-  #let's create a new entity from the protein only containing the amino acids
-  prot = mol.CreateEntityFromView(prot.Select("peptide=true"),True)
-
-  #gather some data, the rotamer ids and backbone torsion angles
-  torsion_angles = list()
-  rotamer_ids = list()
-
-  for r in prot.residues:
-      rotamer_ids.append(sidechain.TLCToRotID(r.GetName()))
-      phi_handle = r.GetPhiTorsion()
-      psi_handle = r.GetPsiTorsion()
-
-      #set typical default values for an alpha helix...
-      phi = -1.0472 
-      psi = -0.7854
-      if phi_handle.IsValid():
-          phi = phi_handle.GetAngle()
-      if psi_handle.IsValid():
-          psi = psi_handle.GetAngle()
-
-      torsion_angles.append((phi,psi))
-
-  #lets first build a frame representing the rigid parts including the cystein
-  #sidechains
-  frame_residues = list()
-  for i,r in enumerate(prot.residues):
-      frame_residue = sidechain.ConstructBackboneFrameResidue(r,rotamer_ids[i],i,
-                                                              settings,
-                                                              torsion_angles[i][0],
-                                                              i == 1, 
-                                                              i == (len(rotamer_ids)-1))
-      frame_residues.append(frame_residue)
-
-  frame = sidechain.Frame(frame_residues)
-
-
-  #let's build up rotamer groups
-  rotamer_groups = list()
-  aa_with_rotamers = list()
-  for i,r in enumerate(prot.residues):
-
-      if r.GetName() == "ALA" or r.GetName() == "GLY":
-        continue
-
-      rot_group = sidechain.ConstructFRMRotamerGroup(r,rotamer_ids[i],i,
-                                                     library,settings,
-                                                     torsion_angles[i][0],
-                                                     torsion_angles[i][1])
-
-      #internal and frame energy have to be calculated directly
-      rot_group.CalculateInternalEnergies()
-      frame.SetFrameEnergy(rot_group)
-      #remove super unlikely rotamer in rotamer group 
-      #e.g. those who clash with the frame
-      rot_group.ApplySelfEnergyThresh()
-      #finally add it and keep track of the indices
-      rotamer_groups.append(rot_group)
-      aa_with_rotamers.append(i)
-
-
-  #buildup a graph given the rotamer groups
-  graph = sidechain.Graph.CreateFromFRMList(rotamer_groups)
-
-  #and get a solution out of it
-  solution = graph.Solve()
-
-  #let's finally apply the solution to the residues
-  for i,rot_group,sol in zip(aa_with_rotamers,rotamer_groups,solution):
-      rot_group[sol].ApplyOnResidue(prot.residues[i])
-
-  io.SavePDB(prot,"example_reconstruction.pdb")
-
-
-
+.. literalinclude:: ../../../tests/doc/scripts/sidechain_steps.py
 
 Contents:
 
@@ -182,5 +83,4 @@ Contents:
    Graph <graph>
    The Settings - Control Things... <sidechain_settings>
    Disulfid Bond Evaluation <disulfid>
-
-.. [krivov2009] Krivov GG, Shapovalov MV and Dunbrack RL Jr. (2009). Improved prediction of protein side-chain conformations with SCWRL4. Proteins. 
+   Loading Libraries <loading>
diff --git a/doc/html/_sources/sidechain/loading.txt b/doc/html/_sources/sidechain/loading.txt
new file mode 100644
index 0000000000000000000000000000000000000000..82ad5bf22e123e83b5aa50632aedcc2639bec6ef
--- /dev/null
+++ b/doc/html/_sources/sidechain/loading.txt
@@ -0,0 +1,59 @@
+Load Rotamer Libraries
+================================================================================
+
+.. currentmodule:: promod3.sidechain
+
+Since the PROMOD3 sidechain modelling algorithms are mainly designed after the 
+work of the Dunbrack lab [krivov2009]_ , their backbone dependent rotamer 
+library is probably the way to go. There exists a binary version of their 
+2010 libary [shapovalov2011]_ , that can
+directly be loaded. As an alternative, there is also a binary file containing
+the backbone independent Penultimate library [lovell2000]_ .
+
+.. method:: LoadDunbrackLib()
+
+  Loads the 2010 backbone dependent rotamer library from the dunbrack lab.
+  The library has been generated using the ReadDunbrackFile function
+  using the file with smoothing factor 5 and nonrotameric dihedrals
+  sampled in 20 degree steps.
+
+  :returns:             The requested library
+  :rtype:               :class:`BBDepRotamerLib`
+
+
+.. method:: LoadPenultimateLib()
+
+  Loads the backbone independent Penultimate library. The values for the dihedral
+  angles are directly extracted from the publication without considering the
+  probabilities specifically for helices/sheets. Due to no assigned standard
+  deviations, the flexible rotamer model won't work.
+
+  :returns:             The requested library
+  :rtype:               :class:`RotamerLib`
+
+
+.. method:: ReadDunbrackFile(filename)
+
+  Reads a file as it is provided when you get a licence for the 2010 library of
+  the Dunbrack lab. It can only read the classic version, where all rotamers
+  are in a single file. Specific distributions of nonrotameric sidechains also
+  cannot be read.
+
+  :param filename:      Name of the file
+  :type param:          :class:`str`
+
+  :throws:  :exc:`~exceptions.RuntimeError` if file does not exist, the format
+            is not valid or when the library is incomplete leading to problems
+            to make the library static. Most likely your input file is
+            incomplete if the last problem gets triggered.
+
+  :returns: The read library
+  :rtype:   :class:`BBDepRotamerLib`
+
+
+.. [krivov2009] Krivov GG, Shapovalov MV and Dunbrack RL Jr. (2009). Improved prediction of protein side-chain conformations with SCWRL4. Proteins.
+
+.. [shapovalov2011] Shapovalov MV and Dunbrack RL Jr. (2011). A smoothed backbone-dependent rotamer library for proteins derived from adaptive kernel density estimates and regressions. Structure.
+
+.. [lovell2000] Lovell SC, Word JM, Richardson JS, Richardson DC (2000). The penultimate rotamer library. Proteins.
+
diff --git a/doc/html/_sources/sidechain/rotamer.txt b/doc/html/_sources/sidechain/rotamer.txt
index ff201e334d0dd03bbf324f7d5b11d9821158f4c6..9a420d3260c218e7769a53fc2210586c406c49bb 100644
--- a/doc/html/_sources/sidechain/rotamer.txt
+++ b/doc/html/_sources/sidechain/rotamer.txt
@@ -130,7 +130,7 @@ Rotamers
 
     :returns:           :class:`Particle` at specified index
 
-    :raises:            :class:`RuntimeError` if index is invalid
+    :raises:  :exc:`~exceptions.RuntimeError` if index is invalid
 
 
   .. method:: __len__()
@@ -152,8 +152,8 @@ Rotamers
     :type consider_hydrogens: :class:`bool`
     :type new_res_name: :class:`str`
 
-    :raises:            :class:`RuntimeError` if not all required backbone atoms
-                        are present in **res**
+    :raises: :exc:`~exceptions.RuntimeError` if not all required backbone atoms
+             are present in **res**
 
 
   .. method:: GetTransformedCopy(transform)
@@ -255,7 +255,7 @@ Rotamers
 
     :returns:           :class:`Particle` at specified index
 
-    :raises:            :class:`RuntimeError` if index is invalid
+    :raises:  :exc:`~exceptions.RuntimeError` if index is invalid
 
 
   .. method:: __len__()
@@ -277,7 +277,7 @@ Rotamers
     :returns:           :class:`list` of particle indices belonging to this
                         particular subrotamer
 
-    :raises:            :class:`RuntimeError` if index is invalid
+    :raises:  :exc:`~exceptions.RuntimeError` if index is invalid
 
 
   .. method:: GetSubrotamerAssociations(index)
@@ -289,7 +289,7 @@ Rotamers
     :returns:           :class:`list` of subrotamer indices this particle is 
                         associated with
 
-    :raises:            :class:`RuntimeError` if index is invalid
+    :raises:  :exc:`~exceptions.RuntimeError` if index is invalid
 
 
   .. method:: ApplyOnResidue(res,[consider_hydrogens=False,new_res_name=""])
@@ -307,8 +307,8 @@ Rotamers
     :type consider_hydrogens: :class:`bool`
     :type new_res_name: :class:`str`
 
-    :raises:            :class:`RuntimeError` if not all required backbone atoms
-                        are present in **res**
+    :raises: :exc:`~exceptions.RuntimeError` if not all required backbone atoms
+             are present in **res**
 
 
   .. method:: GetTransformedCopy(transform)
@@ -362,7 +362,7 @@ Rotamers
 
     :returns: Frame energy if calculated, 0.0 otherwise 
 
-    :raises:            :class:`RuntimeError` if index is invalid
+    :raises:  :exc:`~exceptions.RuntimeError` if index is invalid
 
 
   .. method:: GetSelfEnergy()
@@ -438,7 +438,7 @@ Rotamer Groups
 
   :type rotamers:       :class:`list`
 
-  :raises:              :class:`RuntimeError` if provided **rotamers** is empty
+  :raises:  :exc:`~exceptions.RuntimeError` if provided **rotamers** is empty
 
 
   .. method:: __len__()
@@ -450,7 +450,7 @@ Rotamer Groups
 
     :returns:           :class:`RRMRotamer` at given **index**
 
-    :raises:            :class:`RuntimeError` if **index** is invalid
+    :raises:  :exc:`~exceptions.RuntimeError` if **index** is invalid
 
 
   .. method:: ApplyOneResidue(index,res,[consider_hydrogens=False,new_res_name=""])
@@ -469,8 +469,8 @@ Rotamer Groups
     :type consider_hydrogens: :class:`bool`
     :type new_res_name: :class:`str`
 
-    :raises:            :class:`RuntimeError` if not all required backbone atoms
-                        are present in **res** or when **index** is invalid
+    :raises: :exc:`~exceptions.RuntimeError` if not all required backbone atoms
+             are present in **res** or when **index** is invalid
 
 
   .. method:: Merge(other)
@@ -502,7 +502,7 @@ Rotamer Groups
 
   :type rotamers:       :class:`list`
 
-  :raises:              :class:`RuntimeError` if provided **rotamers** is empty
+  :raises:  :exc:`~exceptions.RuntimeError` if provided **rotamers** is empty
 
 
   .. method:: __len__()
@@ -514,7 +514,7 @@ Rotamer Groups
 
     :returns:           :class:`FRMRotamer` at given **index**
 
-    :raises:            :class:`RuntimeError` if **index** is invalid
+    :raises:  :exc:`~exceptions.RuntimeError` if **index** is invalid
 
 
   .. method:: ApplyOneResidue(index,res,[consider_hydrogens=False,new_res_name=""])
@@ -533,8 +533,8 @@ Rotamer Groups
     :type consider_hydrogens: :class:`bool`
     :type new_res_name: :class:`str`
 
-    :raises:            :class:`RuntimeError` if not all required backbone atoms
-                        are present in **res** or when **index** is invalid
+    :raises: :exc:`~exceptions.RuntimeError` if not all required backbone atoms
+             are present in **res** or when **index** is invalid
 
 
   .. method:: Merge(other)
@@ -594,8 +594,8 @@ rotamer groups.
   :type chi3:           :class:`float`
   :type chi4:           :class:`float`
 
-  :raises:              :class:`RuntimeError` if not all required chi angles
-                        for this particular **id** are given.
+  :raises:  :exc:`~exceptions.RuntimeError` if not all required chi angles
+            for this particular **id** are given.
 
 
 .. method:: ConstructRRMRotamer(residue,rotamer_id,settings,probability,[chi1=NaN,chi2=NaN,chi3=NaN,chi4=NaN])
@@ -620,10 +620,9 @@ rotamer groups.
   :type chi3:           :class:`float`
   :type chi4:           :class:`float`
 
-  :raises:              :class:`RuntimeError` if not all required chi angles
-                        for this particular **id** are given or when not
-                        all required anchor atoms are present in
-                        **residue**.
+  :raises:  :exc:`~exceptions.RuntimeError` if not all required chi angles
+            for this particular **id** are given or when not all required
+            anchor atoms are present in **residue**.
 
 
 .. method:: ConstructFRMRotamer(n_pos,ca_pos,cb_pos,rotamer_id,settings,probability,[chi1=NaN,sig1=NaN,chi2=NaN,sig2=NaN,chi3=NaN,sig3=NaN,chi4=NaN,sig4=NaN])
@@ -660,8 +659,8 @@ rotamer groups.
   :type chi4:           :class:`float`
   :type sig4:           :class:`float`
 
-  :raises:              :class:`RuntimeError` if not all required chi angles
-                        for this particular **id** are given.
+  :raises:  :exc:`~exceptions.RuntimeError` if not all required chi angles
+            for this particular **id** are given.
 
 
 .. method:: ConstructFRMRotamer(residue,rotamer_id,settings,probability,[chi1=NaN,sig1=NaN,chi2=NaN,sig2=NaN,chi3=NaN,sig3=NaN,chi4=NaN,sig4=NaN])
@@ -694,10 +693,9 @@ rotamer groups.
   :type chi4:           :class:`float`
   :type sig4:           :class:`float`
 
-  :raises:              :class:`RuntimeError` if not all required chi angles
-                        or standard deviations for this particular **id** 
-                        are given or when not all required anchor atoms are present in
-                        **residue**.
+  :raises:  :exc:`~exceptions.RuntimeError` if not all required chi angles
+            or standard deviations for this particular **id** are given or when
+            not all required anchor atoms are present in **residue**.
 
 
 Convenient functions for constructing rotamer groups
@@ -786,11 +784,11 @@ several rotamers might be constructed and added to the group per library instanc
   :type phi:            :class:`float`
   :type psi:            :class:`float`
 
-  :raises:              :class:`RuntimeError` if not all required anchor atoms 
-                        are present in **residue**.
+  :raises:  :exc:`~exceptions.RuntimeError` if not all required anchor atoms 
+            are present in **residue**.
 
 
-.. method:: ConstructFRMRotamerGroup(n_pos,ca_pos,cb_pos,rotamer_id,residue_index,rot_lib,settings,[phi=-1.0472,psi=-0.7854])
+.. method:: ConstructFRMRotamerGroup(n_pos, ca_pos, cb_pos, rotamer_id, residue_index, rot_lib, settings, [phi=-1.0472, psi=-0.7854])
 
   Constructs a full group of :class:`FRMRotamer` objects. It extracts rotamers
   from *rot_lib* and adds them to the group until the summed probability
@@ -860,8 +858,8 @@ several rotamers might be constructed and added to the group per library instanc
   :type phi:            :class:`float`
   :type psi:            :class:`float`
 
-  :raises:              :class:`RuntimeError` if not all required anchor atoms 
-                        are present in **residue**.
+  :raises:  :exc:`~exceptions.RuntimeError` if not all required anchor atoms 
+            are present in **residue**.
 
 
 
@@ -920,8 +918,8 @@ several rotamers might be constructed and added to the group per library instanc
   :type rot_lib:        :class:`RotamerLib`
   :type settings:       :class:`RotamerSettings`
 
-  :raises:              :class:`RuntimeError` if not all required anchor atoms 
-                        are present in **residue**.
+  :raises:  :exc:`~exceptions.RuntimeError` if not all required anchor atoms 
+            are present in **residue**.
 
 
 .. method:: ConstructFRMRotamerGroup(n_pos,ca_pos,cb_pos,rotamer_id,residue_index,rot_lib,settings)
@@ -978,8 +976,5 @@ several rotamers might be constructed and added to the group per library instanc
   :type rot_lib:        :class:`BBDepRotamerLib`
   :type settings:       :class:`RotamerSettings`
 
-  :raises:              :class:`RuntimeError` if not all required anchor atoms 
-                        are present in **residue**.
-
-
-    
\ No newline at end of file
+  :raises:  :exc:`~exceptions.RuntimeError` if not all required anchor atoms 
+            are present in **residue**.
diff --git a/doc/html/_sources/sidechain/rotamer_lib.txt b/doc/html/_sources/sidechain/rotamer_lib.txt
index 2e716e2240c38a6eefcbc8e947441718ae1cf880..9b3f429e4a109d5d36127c442b5afd9b149642df 100644
--- a/doc/html/_sources/sidechain/rotamer_lib.txt
+++ b/doc/html/_sources/sidechain/rotamer_lib.txt
@@ -28,19 +28,66 @@ The Non Backbone Dependent Rotamer Library
   
   Non backbone dependent rotamer library
 
+  .. method:: Load(filename)
+
+    Loads raw binary file generated with :meth:`Save` (optimized for fast
+    reading).
+
+    :param filename:    Name of file, the library will be loaded from
+
+    :type filename:     :class:`str`
+
+    :returns:           A rotamer library
+    :rtype:             :class:`RotamerLib`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - file assumes different memory-layout than is available on this
+                machine. Use :meth:`LoadPortable` to convert your file.
+
   .. method:: Save(filename)
 
+    Saves raw binary representation (optimized for fast reading).This puts many
+    assumptions on the memory-layout of the target-machine and hence it is not
+    portable. A portable version is provided by :meth:`SavePortable`.
+    Preferably portable files are distributed and converted to a raw binary
+    before using them.
+
     :param filename:    Name of file, the library will be dumped into
 
     :type filename:     :class:`str`
 
-  .. method:: Load(filename)
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: LoadPortable(filename)
+
+    Loads portable file generated with :meth:`SavePortable` (slow but less
+    machine-dependent).
 
     :param filename:    Name of file, the library will be loaded from
 
     :type filename:     :class:`str`
 
-    :raises:            :class:`RuntimeError` if file doesn't exist
+    :returns:           A rotamer library
+    :rtype:             :class:`RotamerLib`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - machine-dependent fundamental types are smaller than required.
+
+  .. method:: SavePortable(filename)
+
+    Saves portable binary representation (slow but less machine-dependent).
+
+    :param filename:    Name of file, the library will be dumped into
+
+    :type filename:     :class:`str`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
 
   .. method:: AddRotamer(id, rotamer)
 
@@ -50,7 +97,7 @@ The Non Backbone Dependent Rotamer Library
     :type id:           :class:`RotamerID`
     :type rotamer:      :class:`RotamerLibEntry`
 
-    :raises:            :class:`RuntimeError` if the library is already static
+    :raises:  :exc:`~exceptions.RuntimeError` if the library is already static
 
   .. method:: QueryLib(id)
 
@@ -76,8 +123,8 @@ The Non Backbone Dependent Rotamer Library
     :returns:           :class:`list` of :class:`RotamerLibEntry` of nonzero
                         probability sorted by their probability
 
-    :raises:            :class:`RuntimeError` if no entries for *id* can be 
-                        found
+    :raises:  :exc:`~exceptions.RuntimeError` if no entries for *id* can be 
+              found
 
   .. method:: MakeStatic()
     
@@ -99,19 +146,66 @@ The Backbone Dependent Rotamer Library
   :type phi_bins:       :class:`int`
   :type psi_bins:       :class:`int`
 
+  .. method:: Load(filename)
+
+    Loads raw binary file generated with :meth:`Save` (optimized for fast
+    reading).
+
+    :param filename:    Name of file, the library will be loaded from
+
+    :type filename:     :class:`str`
+
+    :returns:           A rotamer library
+    :rtype:             :class:`BBDepRotamerLib`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - file assumes different memory-layout than is available on this
+                machine. Use :meth:`LoadPortable` to convert your file.
+
   .. method:: Save(filename)
 
+    Saves raw binary representation (optimized for fast reading).This puts many
+    assumptions on the memory-layout of the target-machine and hence it is not
+    portable. A portable version is provided by :meth:`SavePortable`.
+    Preferably portable files are distributed and converted to a raw binary
+    before using them.
+
     :param filename:    Name of file, the library will be dumped into
 
     :type filename:     :class:`str`
 
-  .. method:: Load(filename)
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
+
+  .. method:: LoadPortable(filename)
+
+    Loads portable file generated with :meth:`SavePortable` (slow but less
+    machine-dependent).
 
     :param filename:    Name of file, the library will be loaded from
 
     :type filename:     :class:`str`
 
-    :raises:            :class:`RuntimeError` if file doesn't exist
+    :returns:           A rotamer library
+    :rtype:             :class:`BBDepRotamerLib`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if:
+
+              - file cannot be opened.
+              - version number stored in file is not supported.
+              - machine-dependent fundamental types are smaller than required.
+
+  .. method:: SavePortable(filename)
+
+    Saves portable binary representation (slow but less machine-dependent).
+
+    :param filename:    Name of file, the library will be dumped into
+
+    :type filename:     :class:`str`
+
+    :raises:  :exc:`~exceptions.RuntimeError` if file cannot be opened.
 
   .. method:: AddRotamer(id, r1, r2, r3, r4, phi_bin, psi_bin, rotamer)
 
@@ -133,8 +227,8 @@ The Backbone Dependent Rotamer Library
     :type psi_bin:      :class:`int`
     :type rotamer:      :class:`RotamerLibEntry`
 
-    :raises:            :class:`RuntimeError` if an invalid backbone angle bin
-                        is given or when the library is already static.
+    :raises:  :exc:`~exceptions.RuntimeError` if an invalid backbone angle bin
+              is given or when the library is already static.
 
   .. method:: QueryLib(id, phi, psi)
 
@@ -172,8 +266,8 @@ The Backbone Dependent Rotamer Library
     :returns:           :class:`list` of :class:`RotamerLibEntry` of nonzero
                         probability for given phi/psi pair sorted by their probability
 
-    :raises:            :class:`RuntimeError` if no entries for *id* can be 
-                        found
+    :raises:  :exc:`~exceptions.RuntimeError` if no entries for *id* can be
+              found
 
   .. method:: MakeStatic()
     
@@ -189,8 +283,8 @@ The Backbone Dependent Rotamer Library
     * The configuration combinations of a particular :class:`RotamerID` must
       be consistent across all phi/psi bins
 
-    :raises:              :class:`RuntimeError` if one of the points above is
-                          not fulfilled
+    :raises:  :exc:`~exceptions.RuntimeError` if one of the points above is
+              not fulfilled
 
   .. method:: SetInterpolate(interpolate)
 
@@ -286,9 +380,9 @@ functionalities.
 
     :returns:           :class:`RotamerLibEntry`
 
-    :raises:            :class:`RuntimeError` if residue name cannot be
-                        translated to :class:`RotamerID` or when not all 
-                        required atoms are present in *res*.
+    :raises:  :exc:`~exceptions.RuntimeError` if residue name cannot be
+              translated to :class:`RotamerID` or when not all  required atoms
+              are present in *res*.
 
   .. staticmethod:: FromResidue(res, id)
 
@@ -305,8 +399,8 @@ functionalities.
 
     :returns:           :class:`RotamerLibEntry`
 
-    :raises:            :class:`RuntimeError` if not all 
-                        required atoms are present in *res*.
+    :raises:  :exc:`~exceptions.RuntimeError` if not all required atoms are
+              present in *res*.
 
   .. method:: IsSimilar(other, thresh)
 
diff --git a/doc/html/_sources/users.txt b/doc/html/_sources/users.txt
index cf364d753b239e63b75aaa433a481e00868f69ed..d1d77fcf7f625e25e1a4880c8a28762fbf8c9522 100644
--- a/doc/html/_sources/users.txt
+++ b/doc/html/_sources/users.txt
@@ -1,3 +1,18 @@
 Documentation For Users
 =======================
-.. intro, primer on concept of actions, holistic ProMod and hint towards modules
+
+This section is for users of |project|. It describes how to compile and run
+scripts using the functionality of this library.
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   gettingstarted
+   buildsystem
+   modelling/index
+   loop/index
+   sidechain/index
+   core/index
+   core/setcompoundschemlib
diff --git a/doc/html/actions/index_dev.html b/doc/html/actions/index_dev.html
index 7e4e66b186999f41c3048dbf14c3b032bf718d64..7bb65002031ad8ab3186c6349845badcd29e6709 100644
--- a/doc/html/actions/index_dev.html
+++ b/doc/html/actions/index_dev.html
@@ -25,8 +25,8 @@
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
     <link rel="up" title="Documentation For Developers" href="../developers.html" />
-    <link rel="next" title="Building ProMod3" href="../buildsystem.html" />
-    <link rel="prev" title="Disulfid Bond Evaluation" href="../sidechain/disulfid.html" />
+    <link rel="next" title="ProMod3‘s Share Of CMake" href="../cmake/index.html" />
+    <link rel="prev" title="Contributing" href="../contributing.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -155,15 +155,17 @@ first, <code class="file docutils literal"><span class="pre">test_actions.py</sp
 <div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>6</pre></div></td><td class="code"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">test_actions</span>
 </pre></div>
 </td></tr></table></div>
-<p>Now create the childclass for your action. Go for <code class="xref py py-class docutils literal"><span class="pre">&lt;NAME&gt;ActionTests</span></code> as
-a naming scheme:</p>
+<p>To showcase, the test cases, we explain how one would (and does) test the
+<code class="docutils literal"><span class="pre">help</span></code> action of <code class="docutils literal"><span class="pre">pm</span></code>.
+First, we create the childclass for the action.
+Go for <code class="xref py py-class docutils literal"><span class="pre">&lt;NAME&gt;ActionTests</span></code> as a naming scheme:</p>
 <div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 7
  8
  9
-10</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">class</span> <span class="nc">DoAwesomeActionTests</span><span class="p">(</span><span class="n">test_actions</span><span class="o">.</span><span class="n">ActionTestCase</span><span class="p">):</span>
+10</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">class</span> <span class="nc">HelpActionTests</span><span class="p">(</span><span class="n">test_actions</span><span class="o">.</span><span class="n">ActionTestCase</span><span class="p">):</span>
     <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
         <span class="n">test_actions</span><span class="o">.</span><span class="n">ActionTestCase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
-        <span class="bp">self</span><span class="o">.</span><span class="n">pm_action</span> <span class="o">=</span> <span class="s">&#39;do-awesome&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pm_action</span> <span class="o">=</span> <span class="s">&#39;help&#39;</span>
 </pre></div>
 </td></tr></table></div>
 <p>Pay attention that in your own class, you must set <code class="xref py py-attr docutils literal"><span class="pre">pm_action</span></code> to make
@@ -177,8 +179,8 @@ states will be placed in the userlevel documentation. This topic is already
 covered in <a class="reference internal" href="#test_actions.ActionTestCase" title="test_actions.ActionTestCase"><code class="xref py py-class docutils literal"><span class="pre">test_actions.ActionTestCase</span></code></a> by <a class="reference internal" href="#test_actions.ActionTestCase.RunExitStatusTest" title="test_actions.ActionTestCase.RunExitStatusTest"><code class="xref py py-meth docutils literal"><span class="pre">RunExitStatusTest()</span></code></a>.
 As an example, testing for <code class="docutils literal"><span class="pre">$?=0</span></code> could work like this:</p>
 <div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>11
-12</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">def</span> <span class="nf">testExit0</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-    <span class="bp">self</span><span class="o">.</span><span class="n">RunExitStatusTest</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">list</span><span class="p">())</span>
+12</pre></div></td><td class="code"><div class="highlight"><pre>    <span class="k">def</span> <span class="nf">testExit0</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">RunExitStatusTest</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">list</span><span class="p">())</span>
 </pre></div>
 </td></tr></table></div>
 <p>That will call the action stored in <code class="xref py py-attr docutils literal"><span class="pre">pm_action</span></code> with the provided list of
@@ -224,21 +226,21 @@ output onto the command line. The idea is to turn it on for development, but
 once done, disable it to keep output of unit tests low.</p>
 <p>To get the test for exit code <code class="docutils literal"><span class="pre">0</span></code> talking to you, just do</p>
 <div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>11
-12</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">def</span> <span class="nf">testExit0</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-    <span class="bp">self</span><span class="o">.</span><span class="n">RunExitStatusTest</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">list</span><span class="p">(),</span> <span class="n">verbose</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+12</pre></div></td><td class="code"><div class="highlight"><pre>    <span class="k">def</span> <span class="nf">testExit0</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">RunExitStatusTest</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">list</span><span class="p">(),</span> <span class="n">verbose</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
 </pre></div>
 </td></tr></table></div>
 <p>and</p>
 <div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>11
-12</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">def</span> <span class="nf">testExit0</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-    <span class="bp">self</span><span class="o">.</span><span class="n">RunExitStatusTest</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">list</span><span class="p">())</span>
+12</pre></div></td><td class="code"><div class="highlight"><pre>    <span class="k">def</span> <span class="nf">testExit0</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">RunExitStatusTest</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">list</span><span class="p">())</span>
 </pre></div>
 </td></tr></table></div>
 <p>keeps it silent (<code class="xref py py-attr docutils literal"><span class="pre">verbose</span></code> is set to <code class="docutils literal"><span class="pre">False</span></code> by default). If enabled,
 output will be separated into <code class="file docutils literal"><span class="pre">stdout</span></code> and <code class="file docutils literal"><span class="pre">stderr</span></code>:</p>
 <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> make test_action_do_awesome.py_run
 <span class="go">&lt;Lots of output from the build process&gt;</span>
-<span class="go">[100%] running checks test_action_do_awesome.py</span>
+<span class="go">running checks test_action_do_awesome.py</span>
 <span class="go">stdout of &#39;&lt;BUILD&gt;/stage/bin/pm do-awesome&#39;</span>
 <span class="go">------</span>
 <span class="go">&lt;Output to stdout&gt;</span>
@@ -247,6 +249,7 @@ output will be separated into <code class="file docutils literal"><span class="p
 <span class="go">------</span>
 <span class="go">&lt;Output to stderr&gt;</span>
 <span class="go">------</span>
+<span class="go">&lt;More output from unit test runner&gt;</span>
 </pre></div>
 </div>
 </div>
@@ -377,8 +380,8 @@ file (also complains if a directory is found instead).</p>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
   <li><a href="../developers.html">Documentation For Developers</a><ul>
-      <li>Previous: <a href="../sidechain/disulfid.html" title="previous chapter">Disulfid Bond Evaluation</a></li>
-      <li>Next: <a href="../buildsystem.html" title="next chapter">Building ProMod3</a></li>
+      <li>Previous: <a href="../contributing.html" title="previous chapter">Contributing</a></li>
+      <li>Next: <a href="../cmake/index.html" title="next chapter">ProMod3&#8216;s Share Of CMake</a></li>
   </ul></li>
   </ul></li>
 </ul>
@@ -408,7 +411,7 @@ file (also complains if a directory is found instead).</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/buildsystem.html b/doc/html/buildsystem.html
index b75a8b1d38289d4a17a0e19dbdff65ca71063856..38a22bdbfc512090570bcf39468c6367dc749ec8 100644
--- a/doc/html/buildsystem.html
+++ b/doc/html/buildsystem.html
@@ -24,9 +24,9 @@
     <script type="text/javascript" src="_static/underscore.js"></script>
     <script type="text/javascript" src="_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="index.html" />
-    <link rel="up" title="Documentation For Developers" href="developers.html" />
-    <link rel="next" title="Contributing" href="contributing.html" />
-    <link rel="prev" title="test_actions - Testing Actions" href="actions/index_dev.html" />
+    <link rel="up" title="Documentation For Users" href="users.html" />
+    <link rel="next" title="modelling - Protein Modelling" href="modelling/index.html" />
+    <link rel="prev" title="Getting Started" href="gettingstarted.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -44,15 +44,15 @@
 <div class="section" id="dependencies">
 <h2>Dependencies<a class="headerlink" href="#dependencies" title="Permalink to this headline">¶</a></h2>
 <p>ProMod3 is build on top of <a class="reference external" href="http://www.OpenStructure.org">OpenStructure</a> (OST), requiring at least version
-1.4. OST must be configured and compiled with <code class="docutils literal"><span class="pre">ENABLE_MM=1</span></code> to use <a class="reference external" href="https://simtk.org/home/openmm">OpenMM</a>.
+1.5. OST must be configured and compiled with <code class="docutils literal"><span class="pre">ENABLE_MM=1</span></code> to use <a class="reference external" href="https://simtk.org/home/openmm">OpenMM</a>.
 To create the build system, <a class="reference external" href="https://cmake.org/">CMake</a> is required in version
 2.8.7 or higher. <a class="reference external" href="https://www.python.org/">Python</a> works well from version 2.7. For OST and the
 C++ bit of ProMod3, <a class="reference external" href="http://www.boost.org/">Boost</a> is required in version 1.47.0 (the same as
 used for OST). Also <a class="reference external" href="http://eigen.tuxfamily.org/index.php?title=Main_Page">Eigen 3</a> and <a class="reference external" href="http://www.netlib.org/lapack/">LAPACK</a> are needed. To build
-documentation, <a class="reference external" href="http://sphinx-doc.org/">Sphinx</a> 1.2b1 is used.</p>
+documentation, <a class="reference external" href="http://sphinx-doc.org/">Sphinx</a> 1.2b1 is required.</p>
 <p>The currently (Nov. 2015) preferred versions are:</p>
 <ul class="simple">
-<li><a class="reference external" href="http://www.OpenStructure.org">OST</a> 1.4</li>
+<li><a class="reference external" href="http://www.OpenStructure.org">OST</a> 1.5</li>
 <li><a class="reference external" href="https://simtk.org/home/openmm">OpenMM</a> 6.1</li>
 <li><a class="reference external" href="https://cmake.org/">CMake</a> 2.8.12</li>
 <li><a class="reference external" href="https://www.python.org/">Python</a> 2.7.5</li>
@@ -121,8 +121,8 @@ latest code.</p>
 special targets:</p>
 <ul class="simple">
 <li><code class="docutils literal"><span class="pre">check</span></code> <span class="target" id="index-1"></span>make check Runs unit tests and if CMake was invoked in
-its standard configuration also Sphinx with the <code class="docutils literal"><span class="pre">doctest</span></code> and
-<code class="docutils literal"><span class="pre">linkcheck</span></code> builders</li>
+its standard configuration also documentation examples (<code class="docutils literal"><span class="pre">doctest</span></code>) and
+links in the doc. (<code class="docutils literal"><span class="pre">linkcheck</span></code>) are checked</li>
 <li><code class="docutils literal"><span class="pre">html</span></code> <span class="target" id="index-2"></span>make html Creates documentation as web page using the
 Sphinx <code class="docutils literal"><span class="pre">html</span></code> builder</li>
 <li><code class="docutils literal"><span class="pre">man</span></code> <span class="target" id="index-3"></span>make man Creates a manual page using the Sphinx <code class="docutils literal"><span class="pre">man</span></code>
@@ -156,9 +156,9 @@ builder</li>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="index.html">Documentation overview</a><ul>
-  <li><a href="developers.html">Documentation For Developers</a><ul>
-      <li>Previous: <a href="actions/index_dev.html" title="previous chapter"><code class="docutils literal"><span class="pre">test_actions</span></code> - Testing Actions</a></li>
-      <li>Next: <a href="contributing.html" title="next chapter">Contributing</a></li>
+  <li><a href="users.html">Documentation For Users</a><ul>
+      <li>Previous: <a href="gettingstarted.html" title="previous chapter">Getting Started</a></li>
+      <li>Next: <a href="modelling/index.html" title="next chapter"><code class="docutils literal"><span class="pre">modelling</span></code> - Protein Modelling</a></li>
   </ul></li>
   </ul></li>
 </ul>
@@ -188,7 +188,7 @@ builder</li>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/changelog.html b/doc/html/changelog.html
index af462e81b4a86a8a687b15f65ec5e1d21d536219..b9f5c280a6693fbc94056993753d7d7a16c86b1d 100644
--- a/doc/html/changelog.html
+++ b/doc/html/changelog.html
@@ -24,7 +24,7 @@
     <script type="text/javascript" src="_static/underscore.js"></script>
     <script type="text/javascript" src="_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="index.html" />
-    <link rel="prev" title="ProMod3‘s Share Of CMake" href="cmake/index.html" />
+    <link rel="prev" title="Using binary files in ProMod3" href="portableIO.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -39,31 +39,11 @@
             
   <div class="section" id="changelog">
 <h1>Changelog<a class="headerlink" href="#changelog" title="Permalink to this headline">¶</a></h1>
-<div class="section" id="changes-in-release-0-1">
-<h2>Changes in Release 0.1<a class="headerlink" href="#changes-in-release-0-1" title="Permalink to this headline">¶</a></h2>
+<div class="section" id="release-1-0">
+<h2>Release 1.0<a class="headerlink" href="#release-1-0" title="Permalink to this headline">¶</a></h2>
 <blockquote>
 <div><ul class="simple">
-<li>initial setup of the CMake build system</li>
-<li>first idea of the documentation system</li>
-<li>meld included from SMNG as first module (to be modified/ renamed)</li>
-</ul>
-</div></blockquote>
-</div>
-<div class="section" id="changes-in-release-0-2">
-<h2>Changes in Release 0.2<a class="headerlink" href="#changes-in-release-0-2" title="Permalink to this headline">¶</a></h2>
-<blockquote>
-<div><ul class="simple">
-<li>added html documentation to repository</li>
-<li>meld renamed to rawmodel</li>
-</ul>
-</div></blockquote>
-</div>
-<div class="section" id="changes-in-release-0-3-to-be-released">
-<h2>Changes in Release 0.3 (to be released)<a class="headerlink" href="#changes-in-release-0-3-to-be-released" title="Permalink to this headline">¶</a></h2>
-<blockquote>
-<div><ul class="simple">
-<li>merged argcheck into the helper module</li>
-<li>rawmodel renamed to modelling and including high-level modelling functions</li>
+<li>initial release of ProMod3 for use in productive instances of SMNG</li>
 </ul>
 </div></blockquote>
 </div>
@@ -78,9 +58,7 @@
   <h3><a href="index.html">Table Of Contents</a></h3>
   <ul>
 <li><a class="reference internal" href="#">Changelog</a><ul>
-<li><a class="reference internal" href="#changes-in-release-0-1">Changes in Release 0.1</a></li>
-<li><a class="reference internal" href="#changes-in-release-0-2">Changes in Release 0.2</a></li>
-<li><a class="reference internal" href="#changes-in-release-0-3-to-be-released">Changes in Release 0.3 (to be released)</a></li>
+<li><a class="reference internal" href="#release-1-0">Release 1.0</a></li>
 </ul>
 </li>
 </ul>
@@ -88,7 +66,7 @@
 <h3>Related Topics</h3>
 <ul>
   <li><a href="index.html">Documentation overview</a><ul>
-      <li>Previous: <a href="cmake/index.html" title="previous chapter">ProMod3&#8216;s Share Of CMake</a></li>
+      <li>Previous: <a href="portableIO.html" title="previous chapter">Using binary files in ProMod3</a></li>
   </ul></li>
 </ul>
 </div>
@@ -117,7 +95,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/cmake/index.html b/doc/html/cmake/index.html
index 54039a58990d77ebdbc6a72c17d9b11bf7712117..ee00728cbdfc8f34a8b48f04c1fbd41d06750576 100644
--- a/doc/html/cmake/index.html
+++ b/doc/html/cmake/index.html
@@ -25,8 +25,8 @@
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
     <link rel="up" title="Documentation For Developers" href="../developers.html" />
-    <link rel="next" title="Changelog" href="../changelog.html" />
-    <link rel="prev" title="Contributing" href="../contributing.html" />
+    <link rel="next" title="Using binary files in ProMod3" href="../portableIO.html" />
+    <link rel="prev" title="test_actions - Testing Actions" href="../actions/index_dev.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -63,6 +63,123 @@ various <code class="file docutils literal"><span class="pre">CMakeLists.txt</sp
 </div>
 <div class="section" id="functions-for-module-action-maintenance">
 <h2>Functions For Module/ Action Maintenance<a class="headerlink" href="#functions-for-module-action-maintenance" title="Permalink to this headline">¶</a></h2>
+<div class="section" id="module-definition">
+<h3>Module definition<a class="headerlink" href="#module-definition" title="Permalink to this headline">¶</a></h3>
+<p>Default dependencies in a module <code class="docutils literal"><span class="pre">NAME</span></code>:</p>
+<ul class="simple">
+<li><code class="docutils literal"><span class="pre">_NAME</span></code> depends on <code class="docutils literal"><span class="pre">NAME_pymod</span></code> and <code class="docutils literal"><span class="pre">promod3_NAME</span></code> (if that exists)</li>
+<li><code class="docutils literal"><span class="pre">promod3_NAME</span></code> depends on <code class="docutils literal"><span class="pre">promod3_NAME_headers</span></code></li>
+</ul>
+<dl class="command">
+<dt id="command:module">
+<code class="descname">module</code><a class="headerlink" href="#command:module" title="Permalink to this definition">¶</a></dt>
+<dd><div class="highlight-cmake"><div class="highlight"><pre><span class="nb">module</span><span class="p">(</span><span class="s">NAME</span> <span class="s">name</span>
+       <span class="s">SOURCES</span> <span class="s">source1</span> <span class="s">source2</span>
+       <span class="s">HEADERS</span> <span class="s">header1</span> <span class="s">header2</span> <span class="s">[IN_DIR</span> <span class="s">dir]</span>
+               <span class="s">[header3</span> <span class="s">header4</span> <span class="s">[IN_DIR</span> <span class="s">dir]]</span>
+       <span class="s">[DEPENDS_ON</span> <span class="s">dep1</span> <span class="s">dep2]</span>
+       <span class="s">[HEADER_OUTPUT_DIR</span> <span class="s">dir]</span>
+       <span class="s">[LINK</span> <span class="s">link_cmds]</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Define a ProMod3 module from a set of C++ files. This will define the
+following make targets (where <code class="docutils literal"><span class="pre">NAME</span></code> is the provided module name):</p>
+<ul class="simple">
+<li><code class="docutils literal"><span class="pre">promod3_NAME</span></code>: builds library <code class="file docutils literal"><span class="pre">libpromod3_NAME</span></code></li>
+<li><code class="docutils literal"><span class="pre">promod3_NAME_headers</span></code>: copies all header files</li>
+</ul>
+<p>The parameters are:</p>
+<dl class="docutils">
+<dt><code class="docutils literal"><span class="pre">NAME</span></code></dt>
+<dd>Specify the name of the module.</dd>
+<dt><code class="docutils literal"><span class="pre">SOURCES</span></code></dt>
+<dd>Set of C++ source files to be compiled.</dd>
+<dt><code class="docutils literal"><span class="pre">HEADERS</span></code></dt>
+<dd>Set of C++ header files to be copied. If the headers are located in
+a different directory than the current one, you must group them by directory
+and provide the directory name <code class="docutils literal"><span class="pre">dir</span></code> with <code class="docutils literal"><span class="pre">IN_DIR</span> <span class="pre">dir</span></code> after listing the
+header files in said directory.</dd>
+<dt><code class="docutils literal"><span class="pre">DEPENDS_ON</span></code></dt>
+<dd>Add dependencies on other targets (e.g. <code class="docutils literal"><span class="pre">promod3_MOD</span></code> for another
+ProMod3 module).</dd>
+<dt><code class="docutils literal"><span class="pre">HEADER_OUTPUT_DIR</span></code></dt>
+<dd>Define alternative folder to which to copy header files. Default is
+<code class="file docutils literal"><span class="pre">promod3/NAME</span></code>.</dd>
+<dt><code class="docutils literal"><span class="pre">LINK</span></code></dt>
+<dd>Add dependencies to external libraries. You may use some predefines set of
+libraries here, such as <code class="docutils literal"><span class="pre">${OST_LIBRARIES}</span></code>, <code class="docutils literal"><span class="pre">${BOOST_LIBRARIES}</span></code> and
+<code class="docutils literal"><span class="pre">${LAPACK_LIBRARIES}</span></code>.</dd>
+</dl>
+</dd></dl>
+
+<dl class="command">
+<dt id="command:pymod">
+<code class="descname">pymod</code><a class="headerlink" href="#command:pymod" title="Permalink to this definition">¶</a></dt>
+<dd><div class="highlight-cmake"><div class="highlight"><pre><span class="nb">pymod</span><span class="p">(</span><span class="s">NAME</span> <span class="s">name</span>
+      <span class="s">CPP</span> <span class="s">source1</span> <span class="s">source2</span>
+      <span class="s">PY</span> <span class="s">source</span> <span class="s">source2</span> <span class="s">[IN_DIR</span> <span class="s">dir]</span>
+         <span class="s">[source3</span> <span class="s">source4</span> <span class="s">[IN_DIR</span> <span class="s">dir]]</span>
+         <span class="s">[TRANSLATE</span> <span class="s">dict</span> <span class="s">END_TRANSLATE]</span>
+      <span class="s">[OUTPUT_DIR</span> <span class="s">dir]</span>
+      <span class="s">[DEPENDS_ON</span> <span class="s">dep1</span> <span class="s">dep2]</span>
+      <span class="s">[NEED_CONFIG_HEADER]</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Define the Python interface of a ProMod3 ProMod3 module from a set of
+C++ wrappers and/or Python files. This will define the following make
+targets (where <code class="docutils literal"><span class="pre">NAME</span></code> is the provided module name):</p>
+<ul class="simple">
+<li><code class="docutils literal"><span class="pre">_NAME</span></code>: builds library <code class="file docutils literal"><span class="pre">_NAME</span></code> for Python wrapper around C++</li>
+<li><code class="docutils literal"><span class="pre">NAME_pymod</span></code>: copies (and/or translates) all Python files</li>
+</ul>
+<p>The parameters are:</p>
+<dl class="docutils">
+<dt><code class="docutils literal"><span class="pre">NAME</span></code></dt>
+<dd>Specify the name of the module.</dd>
+<dt><code class="docutils literal"><span class="pre">CPP</span></code></dt>
+<dd>Set of C++ source files to be compiled.</dd>
+<dt><code class="docutils literal"><span class="pre">PY</span></code></dt>
+<dd><p class="first">Set of Python source files to be copied. If the files are located in
+a different directory than the current one, you must group them by directory
+and provide the directory name <code class="docutils literal"><span class="pre">dir</span></code> with <code class="docutils literal"><span class="pre">IN_DIR</span> <span class="pre">dir</span></code> after listing the
+header files in said directory.</p>
+<p class="last">If a Python source file needs to be translated by CMake, provide the
+dictionary after putting <code class="docutils literal"><span class="pre">TRANSLATE</span></code>. This assumes a <code class="docutils literal"><span class="pre">&lt;FILE&gt;.py.in</span></code> for
+<code class="docutils literal"><span class="pre">&lt;FILE&gt;.py</span></code>. <code class="docutils literal"><span class="pre">END_TRANSLATE</span></code> marks the end of the translation
+dictionary.</p>
+</dd>
+<dt><code class="docutils literal"><span class="pre">OUTPUT_DIR</span></code></dt>
+<dd>Define alternative folder (within Python tree) to place python files.
+Default is <code class="file docutils literal"><span class="pre">promod3/NAME</span></code>.</dd>
+<dt><code class="docutils literal"><span class="pre">DEPENDS_ON</span></code></dt>
+<dd>Add dependencies on other targets (e.g. <code class="docutils literal"><span class="pre">promod3_MOD</span></code> for another
+ProMod3 module).</dd>
+<dt><code class="docutils literal"><span class="pre">NEED_CONFIG_HEADER</span></code></dt>
+<dd>Makes the module depending on the config_header target, which provides the
+headers in the <code class="file docutils literal"><span class="pre">config</span></code> directory.</dd>
+</dl>
+</dd></dl>
+
+<dl class="command">
+<dt id="command:convert_module_data">
+<code class="descname">convert_module_data</code><a class="headerlink" href="#command:convert_module_data" title="Permalink to this definition">¶</a></dt>
+<dd><div class="highlight-cmake"><div class="highlight"><pre><span class="nb">convert_module_data</span><span class="p">(</span><span class="s">MODULE</span> <span class="s">name</span>
+                    <span class="s">FILE</span> <span class="s">file</span>
+                    <span class="s">SCRIPT</span> <span class="s">script</span>
+                    <span class="s">[ARGS</span> <span class="s">args]</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Use a Python script to convert a portable binary file to a non-portable one.
+Calls <code class="docutils literal"><span class="pre">python</span> <span class="pre">SCRIPT</span> <span class="pre">in_path</span> <span class="pre">out_path</span> <span class="pre">ARGS</span></code> (with access to OST and
+ProMod3),
+where <code class="docutils literal"><span class="pre">in_path</span></code> = <code class="file docutils literal"><span class="pre">portable_FILE</span></code>
+(within path of current <code class="file docutils literal"><span class="pre">CMakeLists.txt</span></code>)
+and <code class="docutils literal"><span class="pre">out_path</span></code> = <code class="file docutils literal"><span class="pre">share/promod3/MODULE_data/FILE</span></code>
+(within the <code class="file docutils literal"><span class="pre">stage</span></code> directory).
+If given, <code class="docutils literal"><span class="pre">args</span></code> can also be multiple arguments (must be put in &#8220;&#8221; then).</p>
+</dd></dl>
+
+</div>
 <div class="section" id="unit-tests">
 <h3>Unit Tests<a class="headerlink" href="#unit-tests" title="Permalink to this headline">¶</a></h3>
 <dl class="command">
@@ -72,7 +189,8 @@ various <code class="file docutils literal"><span class="pre">CMakeLists.txt</sp
                  <span class="s">SOURCES</span> <span class="s">source1</span> <span class="s">[source2</span> <span class="s">...]</span>
                  <span class="s">[LINK</span> <span class="s">library1/</span> <span class="s">linker</span> <span class="s">flag1</span> <span class="s">[library2/</span> <span class="s">linker</span> <span class="s">flag2</span> <span class="s">...]]</span>
                  <span class="s">[DATA</span> <span class="s">data1</span> <span class="s">[data2</span> <span class="s">...]]</span>
-                 <span class="s">[TARGET</span> <span class="s">target]</span><span class="p">)</span>
+                 <span class="s">[TARGET</span> <span class="s">target]</span>
+                 <span class="s">[BASE_TARGET</span> <span class="s">base_target]</span><span class="p">)</span>
 </pre></div>
 </div>
 <p>Add unit tests to ProMod3. Unit tests should go in module-wise so all
@@ -110,6 +228,10 @@ build directory.</dd>
 <dt><code class="docutils literal"><span class="pre">TARGET</span></code></dt>
 <dd>This defines an additional dependency for the unit test. That is, before
 running this unit test, this target will be built.</dd>
+<dt><code class="docutils literal"><span class="pre">BASE_TARGET</span></code></dt>
+<dd>This defines an alternative base target to which to add this unit test.
+By default all unit tests are registered to be executed with the
+<code class="docutils literal"><span class="pre">codetest</span></code> target. This can be overridden by using this argument.</dd>
 </dl>
 </dd></dl>
 
@@ -144,8 +266,8 @@ name or a CMake list.</dd>
 <dl class="command">
 <dt id="command:add_doc_dependency">
 <code class="descname">add_doc_dependency</code><a class="headerlink" href="#command:add_doc_dependency" title="Permalink to this definition">¶</a></dt>
-<dd><div class="highlight-cmake"><div class="highlight"><pre><span class="nb">add_doc_source</span><span class="p">(</span><span class="s">NAME</span> <span class="s">name</span>
-               <span class="s">DEP</span> <span class="s">dependency1</span> <span class="s">[dependency2...]</span><span class="p">)</span>
+<dd><div class="highlight-cmake"><div class="highlight"><pre><span class="nb">add_doc_dependency</span><span class="p">(</span><span class="s">NAME</span> <span class="s">name</span>
+                   <span class="s">DEP</span> <span class="s">dependency1</span> <span class="s">[dependency2...]</span><span class="p">)</span>
 </pre></div>
 </div>
 <p>Add a dependency to the doc build system. For an existing name, add some
@@ -207,6 +329,7 @@ target has to be created <strong>before</strong> any action may be attached to i
 <li><a class="reference internal" href="#">ProMod3&#8216;s Share Of CMake</a><ul>
 <li><a class="reference internal" href="#introduction">Introduction</a></li>
 <li><a class="reference internal" href="#functions-for-module-action-maintenance">Functions For Module/ Action Maintenance</a><ul>
+<li><a class="reference internal" href="#module-definition">Module definition</a></li>
 <li><a class="reference internal" href="#unit-tests">Unit Tests</a></li>
 <li><a class="reference internal" href="#documentation">Documentation</a></li>
 <li><a class="reference internal" href="#actions">Actions</a></li>
@@ -220,8 +343,8 @@ target has to be created <strong>before</strong> any action may be attached to i
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
   <li><a href="../developers.html">Documentation For Developers</a><ul>
-      <li>Previous: <a href="../contributing.html" title="previous chapter">Contributing</a></li>
-      <li>Next: <a href="../changelog.html" title="next chapter">Changelog</a></li>
+      <li>Previous: <a href="../actions/index_dev.html" title="previous chapter"><code class="docutils literal"><span class="pre">test_actions</span></code> - Testing Actions</a></li>
+      <li>Next: <a href="../portableIO.html" title="next chapter">Using binary files in ProMod3</a></li>
   </ul></li>
   </ul></li>
 </ul>
@@ -251,7 +374,7 @@ target has to be created <strong>before</strong> any action may be attached to i
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/contributing.html b/doc/html/contributing.html
index 8198e48aa37cd5caa0b500065086692da998dd2a..62890bd4f5f6b3b947fa12c05879582fff6a8f65 100644
--- a/doc/html/contributing.html
+++ b/doc/html/contributing.html
@@ -25,8 +25,8 @@
     <script type="text/javascript" src="_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="index.html" />
     <link rel="up" title="Documentation For Developers" href="developers.html" />
-    <link rel="next" title="ProMod3‘s Share Of CMake" href="cmake/index.html" />
-    <link rel="prev" title="Building ProMod3" href="buildsystem.html" />
+    <link rel="next" title="test_actions - Testing Actions" href="actions/index_dev.html" />
+    <link rel="prev" title="Documentation For Developers" href="developers.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -232,6 +232,28 @@ usual Unix file system filled with the build products of ProMod3. The
 <code class="file docutils literal"><span class="pre">stage</span></code> directory tree can already be utilised. You may import Python
 modules from there, use the binaries from <code class="file docutils literal"><span class="pre">stage/bin</span></code>, etc..</p>
 </div>
+<div class="section" id="quick-testing-of-project-features">
+<h2>Quick testing of ProMod3 features<a class="headerlink" href="#quick-testing-of-project-features" title="Permalink to this headline">¶</a></h2>
+<p>High-level features of ProMod3, can be tested directly in an interactive
+Python shell. First, you need to tell Python, where to find the modules by
+defining the <code class="docutils literal"><span class="pre">PYTHONPATH</span></code> env. variable in your shell to include the
+<code class="file docutils literal"><span class="pre">lib64/python2.7/site-packages</span></code> folders of the <code class="file docutils literal"><span class="pre">stage</span></code> folders of
+ProMod3 and OST. For convenience, you can place the export-command in
+your <code class="file docutils literal"><span class="pre">.bashrc</span></code> (or so). Then, you can import modules from <code class="docutils literal"><span class="pre">promod3</span></code>
+and <code class="docutils literal"><span class="pre">ost</span></code> as in the example codes shown in this documentation.</p>
+<p>To test low-level C++ features, you can copy the <code class="file docutils literal"><span class="pre">extras/test_code</span></code>
+folder and adapt it for your purposes. First, you will have to fix the paths
+to ProMod3 and OST in the <code class="file docutils literal"><span class="pre">Makefile</span></code> by changing the following
+lines:</p>
+<div class="highlight-make"><div class="highlight"><pre><span class="c"># path to OST and ProMod3 stage</span>
+<span class="nv">OST_ROOT</span> <span class="o">=</span> &lt;DEFINEME&gt;/ost/build/stage
+<span class="nv">PROMOD3_ROOT</span> <span class="o">=</span> &lt;DEFINEME&gt;/ProMod3/build/stage
+</pre></div>
+</div>
+<p>Afterwards, you should be able to compile and run small sample codes that use
+ProMod3 and OST as in the <code class="file docutils literal"><span class="pre">test.cc</span></code> example. You can compile your
+code by executing <code class="docutils literal"><span class="pre">make</span></code> and run it with <code class="docutils literal"><span class="pre">make</span> <span class="pre">run</span></code>.</p>
+</div>
 <div class="section" id="unit-tests">
 <h2>Unit Tests<a class="headerlink" href="#unit-tests" title="Permalink to this headline">¶</a></h2>
 <p>Of course your code should contain tests. But we cannot give an elaborate
@@ -248,14 +270,20 @@ possibility that the module is not available</li>
 <li>No failing tests, that are considered &#8216;this does not affect anything&#8217;</li>
 </ul>
 <p>To run the whole test suite, <code class="docutils literal"><span class="pre">make</span> <span class="pre">check</span></code> is enough. This will also trigger
-the <code class="docutils literal"><span class="pre">doctest</span></code> and <code class="docutils literal"><span class="pre">linkcheck</span></code> targets. To avoid this, e.g. when just
-testing a smallish change in code, <code class="docutils literal"><span class="pre">codetest</span></code> exists as a separate target,
-only running unit tests from all modules in ProMod3. Actually <code class="docutils literal"><span class="pre">make</span> <span class="pre">check</span></code>
-does nothing more but invoking <code class="docutils literal"><span class="pre">doctest</span></code>, <code class="docutils literal"><span class="pre">linkcheck</span></code> and <code class="docutils literal"><span class="pre">codetest</span></code> as
-dependencies. You could even go with running tests gathered in a single file:
+the <code class="docutils literal"><span class="pre">doctest</span></code> and <code class="docutils literal"><span class="pre">linkcheck</span></code> targets. Alternatively you can run:</p>
+<ul class="simple">
+<li><code class="docutils literal"><span class="pre">make</span> <span class="pre">codetest</span></code> to run only unit tests from all modules in ProMod3.
+Note that <code class="docutils literal"><span class="pre">make</span> <span class="pre">check</span></code> does nothing more but invoking <code class="docutils literal"><span class="pre">doctest</span></code>,
+<code class="docutils literal"><span class="pre">linkcheck</span></code> and <code class="docutils literal"><span class="pre">codetest</span></code> as dependencies.</li>
+<li><code class="docutils literal"><span class="pre">make</span> <span class="pre">check_xml</span></code> to run tests without stopping after each failure.
+Failures are shortly reported to the command line and the result of each test
+is written in &#8216;PYTEST-&lt;TestCaseName&gt;.xml&#8217; files in the &#8216;tests&#8217; subfolders of
+your &#8216;build&#8217; folder.</li>
+<li>Run single tests:
 assuming you have <code class="file docutils literal"><span class="pre">your_module/tests/test_awesome_feature.py</span></code>, CMake
 will provide you with a target <code class="docutils literal"><span class="pre">test_awesome_feature.py_run</span></code>. If your module
-has C++ tests, those will be available by <code class="docutils literal"><span class="pre">test_suite_your_module_run</span></code>.</p>
+has C++ tests, those will be available by <code class="docutils literal"><span class="pre">test_suite_your_module_run</span></code>.</li>
+</ul>
 </div>
 <div class="section" id="writing-documentation">
 <h2>Writing Documentation<a class="headerlink" href="#writing-documentation" title="Permalink to this headline">¶</a></h2>
@@ -274,6 +302,36 @@ documentation, here is a helpful list of standard formatters:
 <a class="reference external" href="http://sphinx-doc.org/markup/inline.html">http://sphinx-doc.org/markup/inline.html</a></p>
 <p>If you write new functionality for ProMod3, or fix bugs, feel free to extend
 the Changelog. It will be automatically pulled into the documentation.</p>
+<p>It is highly recommended to add code examples with your documentation. For that
+purpose, you should write a fully runnable script, which is to be placed in the
+<code class="file docutils literal"><span class="pre">doc/tests/scripts</span></code> directory. The script is to be runnable from within
+the <code class="file docutils literal"><span class="pre">doc/tests</span></code> directory as <code class="docutils literal"><span class="pre">pm</span> <span class="pre">SCRIPTPATH</span></code> and may use data stored in
+the <code class="file docutils literal"><span class="pre">doc/tests/data</span></code> directory. The script and any data needed by it, must
+then be referenced in the <code class="file docutils literal"><span class="pre">doc/tests/CMakeLists.txt</span></code> file. Afterwards,
+they can be included in the documentation using the
+<a class="reference external" href="http://www.sphinx-doc.org/en/stable/markup/code.html#includes">literalinclude</a>
+directive. For instance, if you add a new example code <code class="file docutils literal"><span class="pre">loop_main.py</span></code>,
+you would add it in your module documentation as follows:</p>
+<div class="highlight-rest"><div class="highlight"><pre><span class="p">..</span> <span class="ow">literalinclude</span><span class="p">::</span> ../../../tests/doc/scripts/loop_main.py
+</pre></div>
+</div>
+<p>If your example does not relate to a specific module and the documentation is
+in the top-level <code class="file docutils literal"><span class="pre">doc</span></code> directory, you need to drop one of the <code class="docutils literal"><span class="pre">..</span></code> as
+follows:</p>
+<div class="highlight-rest"><div class="highlight"><pre><span class="p">..</span> <span class="ow">literalinclude</span><span class="p">::</span> ../../tests/doc/scripts/hello_world.py
+</pre></div>
+</div>
+<p>To ensure that the code examples keep on working, a unit test has to be defined
+in <code class="file docutils literal"><span class="pre">doc/tests/test_doctests.py</span></code>. Each example code is run by a dedicated
+test function. Usually, the codes are run and the return code is checked.
+Command-line output or resulting files can also be checked (see existing test
+codes for examples). A few more guidelines for example codes:</p>
+<ul class="simple">
+<li>If it generates files as output, please delete them after checking them.</li>
+<li>If it requires external modules or binaries, check for their availablity. If
+the external dependencies are not available, output a warning and skip the
+test.</li>
+</ul>
 </div>
 <div class="section" id="how-to-start-your-own-module">
 <span id="id2"></span><h2>How To Start Your Own Module<a class="headerlink" href="#how-to-start-your-own-module" title="Permalink to this headline">¶</a></h2>
@@ -290,9 +348,9 @@ tell you for which branch you went, a story of failure otherwise.</p>
 </pre></div>
 </div>
 <p>Sitting on top of the right code basis, you should just spawn your own branch
-from it. As an example, your feature will go by the name of &#8216;sidechains&#8217;.</p>
-<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> git checkout -b sidechains
-<span class="go">Switched to a new branch &#39;sidechains&#39;</span>
+from it. As an example, your feature will go by the name of &#8216;sidechain&#8217;.</p>
+<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> git checkout -b sidechain
+<span class="go">Switched to a new branch &#39;sidechain&#39;</span>
 <span class="gp">$</span>
 </pre></div>
 </div>
@@ -307,18 +365,18 @@ install our very own Git hook to check some coding rules on commit.</p>
 commit.</p>
 <p>Now create the directory structure where your project will live. Here is the
 list of directories which are likely to be used in every project.</p>
-<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> mkdir -p sidechains/doc
-<span class="gp">$</span> mkdir -p sidechains/pymod
-<span class="gp">$</span> mkdir -p sidechains/tests
+<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> mkdir -p sidechain/doc
+<span class="gp">$</span> mkdir -p sidechain/pymod
+<span class="gp">$</span> mkdir -p sidechain/tests
 <span class="gp">$</span>
 </pre></div>
 </div>
 <p>If you run <code class="docutils literal"><span class="pre">git</span> <span class="pre">status</span></code> at this point, you will see basically nothing. That
 is, Git does not admire empty directories. Before you bring your module under
 version control, create a couple of files which are always needed.</p>
-<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> touch sidechains/pymod/__init__.py
-<span class="gp">$</span> <span class="nb">echo</span> <span class="s2">&quot;:mod:\`~promod3.sidechains\` - ProMod3 side chain optimiser&quot;</span> &gt;&gt; sidechains/doc/index.rst
-<span class="gp">$</span> <span class="nb">echo</span> <span class="s2">&quot;================================================================================&quot;</span> &gt;&gt; sidechains/doc/index.rst
+<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> touch sidechain/pymod/__init__.py
+<span class="gp">$</span> <span class="nb">echo</span> <span class="s2">&quot;:mod:\`~promod3.sidechain\` - ProMod3 side chain optimiser&quot;</span> &gt;&gt; sidechain/doc/index.rst
+<span class="gp">$</span> <span class="nb">echo</span> <span class="s2">&quot;================================================================================&quot;</span> &gt;&gt; sidechain/doc/index.rst
 <span class="gp">$</span>
 </pre></div>
 </div>
@@ -329,14 +387,14 @@ your documentation.</p>
 <p>For integration with <strong class="command">make</strong>, the build system needs to now about the
 new module and its members. This goes for setting up new CMake files and
 extending some around the directory root.</p>
-<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> touch sidechains/CMakeLists.txt
-<span class="gp">$</span> touch sidechains/pymod/CMakeLists.txt
-<span class="gp">$</span> touch sidechains/doc/CMakeLists.txt
+<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> touch sidechain/CMakeLists.txt
+<span class="gp">$</span> touch sidechain/pymod/CMakeLists.txt
+<span class="gp">$</span> touch sidechain/doc/CMakeLists.txt
 <span class="gp">$</span>
 </pre></div>
 </div>
 <p>Each of those files still needs a bit of content. The simplest one comes from
-the module&#8217;s root, <code class="file docutils literal"><span class="pre">sidechains/CMakeLists.txt</span></code>:</p>
+the module&#8217;s root, <code class="file docutils literal"><span class="pre">sidechain/CMakeLists.txt</span></code>:</p>
 <div class="highlight-cmake"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
 2</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">pymod</span><span class="p">)</span>
 <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">doc</span><span class="p">)</span>
@@ -350,11 +408,11 @@ configurations. The next level in <code class="file docutils literal"><span clas
 2
 3
 4
-5</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">set</span><span class="p">(</span><span class="s">SIDECHAINS_RST</span>
+5</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">set</span><span class="p">(</span><span class="s">SIDECHAIN_RST</span>
 <span class="s">index.rst</span>
 <span class="p">)</span>
 
-<span class="nb">add_doc_source</span><span class="p">(</span><span class="s">NAME</span> <span class="s">sidechains</span> <span class="s">RST</span> <span class="o">${</span><span class="nv">SIDECHAINS_RST</span><span class="o">}</span><span class="p">)</span>
+<span class="nb">add_doc_source</span><span class="p">(</span><span class="s">NAME</span> <span class="s">sidechain</span> <span class="s">RST</span> <span class="o">${</span><span class="nv">SIDECHAIN_RST</span><span class="o">}</span><span class="p">)</span>
 </pre></div>
 </td></tr></table></div>
 <p><code class="docutils literal"><span class="pre">add_doc_source</span></code> is our custom CMake macro to register
@@ -363,7 +421,7 @@ reST files for the documentation. On running
 within the build directory. Each new submodule in your project should be
 covered by its own documentation entity, extending the list in <code class="docutils literal"><span class="pre">RST</span></code>.
 Maintaining readability, its good practice to store this list in a separate
-variable, called <code class="docutils literal"><span class="pre">SIDECHAINS_RST</span></code> here.</p>
+variable, called <code class="docutils literal"><span class="pre">SIDECHAIN_RST</span></code> here.</p>
 <p>For the actual code, you should keep in mind that a Python module may be
 rather complex. There is for sure Python code, there could be a bit of C++
 and conditional compilation. In rare cases you also want to modify the
@@ -375,263 +433,53 @@ a couple of examples around in this repository. Here is the most basic
 2
 3
 4
-5</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">set</span><span class="p">(</span><span class="s">SIDECHAINS_PYMOD</span>
+5</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">set</span><span class="p">(</span><span class="s">SIDECHAIN_PYMOD</span>
 <span class="s">__init__.py</span>
 <span class="p">)</span>
 
-<span class="nb">pymod</span><span class="p">(</span><span class="s">NAME</span> <span class="s">sidechains</span> <span class="s">PY</span> <span class="o">${</span><span class="nv">SIDECHAINS_PYMOD</span><span class="o">}</span><span class="p">)</span>
+<span class="nb">pymod</span><span class="p">(</span><span class="s">NAME</span> <span class="s">sidechain</span> <span class="s">PY</span> <span class="o">${</span><span class="nv">SIDECHAIN_PYMOD</span><span class="o">}</span><span class="p">)</span>
 </pre></div>
 </td></tr></table></div>
 <p>Source files should be again listed in a dedicated variable. Later, you
 probably add some C++ code and settings diverging from the defaults via the
 <code class="docutils literal"><span class="pre">pymod</span></code> macro. This is where things clutter up quite quickly. As set up here,
-your project would be added as a module <code class="docutils literal"><span class="pre">sidechains</span></code> in the ProMod3
+your project would be added as a module <code class="docutils literal"><span class="pre">sidechain</span></code> in the ProMod3
 Python package tree.</p>
 <p>The final step towards CMake is to register your module&#8217;s directory in the
 top level <code class="file docutils literal"><span class="pre">CMakeLists.txt</span></code>:</p>
-<div class="highlight-cmake"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>  1
-  2
-  3
-  4
-  5
-  6
-  7
-  8
-  9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120</pre></div></td><td class="code"><div class="highlight"><pre><span class="c">#-------------------------------------------------------------------------------</span>
-<span class="c"># Author: Bienchen</span>
-<span class="c">#-------------------------------------------------------------------------------</span>
-<span class="c"># Options to CMake:</span>
-<span class="c">#    DISABLE_DOCUMENTATION: Don&#39;t build documentation, don&#39;t search for Sphinx</span>
-<span class="c">#    DISABLE_DOCTEST: Don&#39;t run example code from documentation on &#39;make check&#39;</span>
-<span class="c">#    DISABLE_LINKCHECK: Don&#39;t test links from documentation on &#39;make check&#39;</span>
-<span class="c"># (if documentation is disabled, there is no doctest, linkcheck at all)</span>
-<span class="nb">cmake_minimum_required</span><span class="p">(</span><span class="s">VERSION</span> <span class="s">2.6.4</span> <span class="s">FATAL_ERROR</span><span class="p">)</span>
-<span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_MODULE_PATH</span> <span class="o">${</span><span class="nv">CMAKE_MODULE_PATH</span><span class="o">}</span> <span class="o">${</span><span class="nv">CMAKE_SOURCE_DIR</span><span class="o">}</span><span class="s">/cmake_support</span><span class="p">)</span>
-
-<span class="nb">project</span><span class="p">(</span><span class="s">ProMod3</span> <span class="s">CXX</span> <span class="s">C</span><span class="p">)</span>
-
-<span class="nb">include</span><span class="p">(</span><span class="s">PROMOD3</span><span class="p">)</span>
-
-<span class="nb">set</span><span class="p">(</span><span class="s">PROMOD3_VERSION_MAJOR</span> <span class="s">0</span><span class="p">)</span>
-<span class="nb">set</span><span class="p">(</span><span class="s">PROMOD3_VERSION_MINOR</span> <span class="s">1</span><span class="p">)</span>
-<span class="nb">set</span><span class="p">(</span><span class="s">PROMOD3_VERSION_PATCH</span> <span class="s">0</span><span class="p">)</span>
-<span class="nb">set</span><span class="p">(</span><span class="s">PROMOD3_VERSION_STRING</span> <span class="o">${</span><span class="nv">PROMOD3_VERSION_MAJOR</span><span class="o">}</span><span class="s">.</span><span class="o">${</span><span class="nv">PROMOD3_VERSION_MINOR</span><span class="o">}</span><span class="s">.</span><span class="o">${</span><span class="nv">PROMOD3_VERSION_PATCH</span><span class="o">}</span><span class="p">)</span>
-
-<span class="nb">option</span><span class="p">(</span><span class="s">DISABLE_DOCUMENTATION</span> <span class="s2">&quot;Do not build documentation&quot;</span> <span class="s">OFF</span><span class="p">)</span>
-<span class="nb">option</span><span class="p">(</span><span class="s">DISABLE_DISABLE_DOCTEST</span> <span class="s2">&quot;Do not check examples in documentation&quot;</span> <span class="s">OFF</span><span class="p">)</span>
-<span class="nb">option</span><span class="p">(</span><span class="s">DISABLE_DISABLE_LINKCHECK</span> <span class="s2">&quot;Do not check links in the documentation&quot;</span> <span class="s">OFF</span><span class="p">)</span>
-
-<span class="nb">if</span> <span class="p">(</span><span class="s">CMAKE_COMPILER_IS_GNUCXX</span><span class="p">)</span>
-  <span class="nb">exec_program</span><span class="p">(</span><span class="s">gcc</span> <span class="s">ARGS</span> <span class="s">--version</span> <span class="s">OUTPUT_VARIABLE</span> <span class="s">CMAKE_C_COMPILER_VERSION</span><span class="p">)</span>
-  <span class="nb">if</span><span class="p">(</span><span class="s">CMAKE_C_COMPILER_VERSION</span> <span class="s">MATCHES</span> <span class="s2">&quot;.*4\\.[5-9].*&quot;</span><span class="p">)</span>
-    <span class="nb">set</span><span class="p">(</span><span class="s">PROMOD_GCC_45</span> <span class="s">true</span><span class="p">)</span>
-  <span class="nb">else</span><span class="p">()</span>
-    <span class="nb">set</span><span class="p">(</span><span class="s">PROMOD_GCC_45</span> <span class="s">false</span><span class="p">)</span>
-  <span class="nb">endif</span><span class="p">()</span>
-<span class="nb">endif</span><span class="p">()</span>
-
-<span class="nb">if</span> <span class="p">(</span><span class="s">OPTIMIZE</span><span class="p">)</span>
-  <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_BUILD_TYPE</span> <span class="s">Release</span><span class="p">)</span>
-  <span class="nb">set</span><span class="p">(</span><span class="s">_OPT</span> <span class="s">ON</span><span class="p">)</span>
-<span class="nb">else</span><span class="p">()</span>
-   <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_BUILD_TYPE</span> <span class="s">Debug</span><span class="p">)</span>
-   <span class="nb">set</span><span class="p">(</span><span class="s">_OPT</span> <span class="s">OFF</span><span class="p">)</span>
-<span class="nb">endif</span><span class="p">()</span>
-
-<span class="nb">setup_stage</span><span class="p">()</span>
-<span class="nb">file</span><span class="p">(</span><span class="s">MAKE_DIRECTORY</span> <span class="o">${</span><span class="nv">STAGE_DIR</span><span class="o">}</span>
-     <span class="o">${</span><span class="nv">EXECUTABLE_OUTPUT_PATH</span><span class="o">}</span>
-     <span class="o">${</span><span class="nv">HEADER_STAGE_PATH</span><span class="o">}</span>
-     <span class="o">${</span><span class="nv">LIB_STAGE_PATH</span><span class="o">}</span>
-     <span class="o">${</span><span class="nv">LIBEXEC_STAGE_PATH</span><span class="o">}</span><span class="p">)</span>
-
-<span class="nb">setup_compiler_flags</span><span class="p">()</span>
-<span class="nb">setup_boost</span><span class="p">()</span>
-
-<span class="nb">find_package</span><span class="p">(</span><span class="s">Python</span> <span class="s">2.7</span> <span class="s">REQUIRED</span><span class="p">)</span>
-<span class="nb">if</span><span class="p">(</span><span class="s">NOT</span> <span class="s">DISABLE_DOCUMENTATION</span><span class="p">)</span>
-  <span class="nb">find_package</span><span class="p">(</span><span class="s">Sphinx</span> <span class="o">${</span><span class="nv">PYTHON_VERSION</span><span class="o">}</span> <span class="s">REQUIRED</span><span class="p">)</span>
-  <span class="nb">set</span><span class="p">(</span><span class="s">PYTHON_DOC_URL</span> <span class="s2">&quot;https://docs.python.org/${PYTHON_VERSION}&quot;</span><span class="p">)</span>
-  <span class="c"># set this to the URL corresponding to the version of OST you are using</span>
-  <span class="nb">set</span><span class="p">(</span><span class="s">OST_DOC_URL</span> <span class="s2">&quot;http://www.openstructure.org/docs/1.3&quot;</span><span class="p">)</span>
-<span class="nb">endif</span><span class="p">()</span>
-<span class="nb">find_package</span><span class="p">(</span><span class="s">OPENSTRUCTURE</span> <span class="s">1.4</span> <span class="s">REQUIRED</span>
-             <span class="s">COMPONENTS</span> <span class="s">io</span> <span class="s">mol</span> <span class="s">seq</span> <span class="s">seq_alg</span> <span class="s">mol_alg</span> <span class="s">conop</span><span class="p">)</span>
-<span class="nb">find_package</span><span class="p">(</span><span class="s">QMEAN</span> <span class="s">1.0</span> <span class="s">REQUIRED</span><span class="p">)</span>
-
-
-<span class="c">#The KIC loop closing algorithm requires a solver for a generalised eigen</span>
-<span class="c">#problem. Eigen3 would provide such a solver, but only allows to extract</span>
-<span class="c">#the resulting eigenvalues and not the eigenvectors.</span>
-<span class="c">#As soon as there is an Eigen3 release with the required functionality,</span>
-<span class="c">#The Lapack dependency can be dropped.</span>
-<span class="nb">find_package</span><span class="p">(</span><span class="s">LAPACK</span><span class="p">)</span>
-
-<span class="nb">if</span> <span class="p">(</span><span class="s">CMAKE_COMPILER_IS_GNUCXX</span><span class="p">)</span>
-  <span class="c"># do not write back into cache, otherwise the compile command line gets</span>
-  <span class="c"># expanded with multiple -fno-strict-aliasing flags, triggering a complete</span>
-  <span class="c"># rebuild whenever cmake is run</span>
-  <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_CXX_FLAGS_RELEASE</span> <span class="s2">&quot;${CMAKE_CXX_FLAGS_RELEASE} -fno-strict-aliasing&quot;</span><span class="p">)</span>
-  <span class="nb">if</span><span class="p">(</span><span class="s2">&quot;${CMAKE_CXX_COMPILER_VERSION}&quot;</span> <span class="s">VERSION_GREATER</span> <span class="s2">&quot;4.6&quot;</span><span class="p">)</span>
-    <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_CXX_FLAGS</span> <span class="s2">&quot;${CMAKE_CXX_FLAGS} -Wno-attributes&quot;</span><span class="p">)</span>
-  <span class="nb">endif</span><span class="p">(</span><span class="s2">&quot;${CMAKE_CXX_COMPILER_VERSION}&quot;</span> <span class="s">VERSION_GREATER</span> <span class="s2">&quot;4.6&quot;</span><span class="p">)</span>
-<span class="nb">endif</span><span class="p">()</span>
-
-<span class="c"># additional packages/ headers/ etc.</span>
-<span class="c">#  Eigen3 is mandatory right now but may vanish once OST switches to the same</span>
-<span class="c">#  version.</span>
-<span class="nb">find_package</span><span class="p">(</span><span class="s">Eigen3</span> <span class="s">3.2.1</span> <span class="s">REQUIRED</span><span class="p">)</span>
-<span class="nb">if</span><span class="p">(</span><span class="s">NOT</span> <span class="s">EIGEN3_FOUND</span><span class="p">)</span>
-  <span class="nb">message</span><span class="p">(</span><span class="s">FATAL_ERROR</span> <span class="s2">&quot;Eigen3 is essential for building ${PROJECT_NAME}.&quot;</span><span class="p">)</span>
-<span class="nb">endif</span><span class="p">()</span>
-
-<span class="c"># basic environment</span>
-<span class="nb">include_directories</span><span class="p">(</span><span class="o">${</span><span class="nv">Boost_INCLUDE_DIRS</span><span class="o">}</span>
-                    <span class="o">${</span><span class="nv">OST_INCLUDE_DIR</span><span class="o">}</span>
-                    <span class="o">${</span><span class="nv">QMEAN_INCLUDE_DIR</span><span class="o">}</span>
-                    <span class="o">${</span><span class="nv">EIGEN3_INCLUDE_DIR</span><span class="o">}</span><span class="p">)</span>
-
-<span class="nb">set</span><span class="p">(</span><span class="s">FILES_TO_BE_REMOVED</span> <span class="o">${</span><span class="nv">PROJECT_BINARY_DIR</span><span class="o">}</span><span class="s">/stage</span><span class="p">)</span>
-<span class="nb">set_directory_properties</span><span class="p">(</span><span class="s">PROPERTIES</span> <span class="s">ADDITIONAL_MAKE_CLEAN_FILES</span>
-                             <span class="s2">&quot;${FILES_TO_BE_REMOVED}&quot;</span><span class="p">)</span>
+<div class="highlight-cmake"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15</pre></div></td><td class="code"><div class="highlight"><pre><span class="c">## &lt;lots of cmake commands...&gt;</span>
 
 <span class="c">## sub dirs to be recognised by CMake</span>
 <span class="c">## e.g. add_subdirectory(src), subdirs have their own CMakeLists.txt</span>
 <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">config</span><span class="p">)</span>
 <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">core</span><span class="p">)</span>
 <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">modelling</span><span class="p">)</span>
-<span class="hll"><span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">sidechains</span><span class="p">)</span>
+<span class="hll"><span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">sidechain</span><span class="p">)</span>
 </span><span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">loop</span><span class="p">)</span>
 <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">scripts</span><span class="p">)</span>
 <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">actions</span><span class="p">)</span>
 <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">extras</span><span class="p">)</span>
-<span class="nb">if</span><span class="p">(</span><span class="s">NOT</span> <span class="s">DISABLE_DOCUMENTATION</span><span class="p">)</span>
-  <span class="nb">add_changelog_to_doc</span><span class="p">(</span><span class="s">FILE</span> <span class="s2">&quot;${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG&quot;</span><span class="p">)</span>
-  <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">doc</span><span class="p">)</span>
-<span class="nb">endif</span><span class="p">()</span>
+<span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">cmake_support</span><span class="p">)</span>
 
-<span class="c">## report setup</span>
-<span class="nb">message</span><span class="p">(</span><span class="s">STATUS</span> <span class="s2">&quot;${PROJECT_NAME} will be built with the following options:\n&quot;</span>
-        <span class="s2">&quot;   OpenStructure (-DOST_ROOT) : ${OST_ROOT}\n&quot;</span>
-        <span class="s2">&quot;   QMEAN         (-DQMEAN_ROOT) : ${QMEAN_ROOT}\n&quot;</span>
-        <span class="s2">&quot;   Optimized     (-DOPTIMIZE) : ${_OPT}\n&quot;</span>
-        <span class="s2">&quot;   Python                     : ${PYTHON_BINARY}\n&quot;</span>
-        <span class="s2">&quot;   Eigen3                     : ${EIGEN3_INCLUDE_DIR}\n&quot;</span><span class="p">)</span>
+<span class="c">## &lt;lots of cmake commands...&gt;</span>
 </pre></div>
 </td></tr></table></div>
 <p>All that needs to be done for CMake to recognise your module is adding its
-directory as shown in line 104.</p>
+directory as shown in line 8.</p>
 <p>This was the final step to set up the build system. Running CMake at this
 point would create the build environment in place. But building software in
 your code repository has several drawbacks. First of all, it puts all kind of
@@ -666,14 +514,13 @@ good practice to develop new functionality along tests and that right from the
 beginning. At some point, new code needs testing anyway to see if it does what
 it should, so just do this by writing unit tests. Test sources are stored in
 files with a prefix <code class="file docutils literal"><span class="pre">test_</span></code> and usually come per submodule instead of
-sporting a single monolithic <code class="file docutils literal"><span class="pre">test_sidechains.py</span></code>.</p>
-<p>Python code is evaluated using its own
-<a class="reference external" href="https://docs.python.org/2.7/library/unittest.html">unit testing framework</a> with a little help
-from <a class="reference external" href="http://www.OpenStructure.org">OST</a> (C++ uses the Boost <a class="reference external" href="http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/index.html">Test Library</a>).
-The basic scheme is to import your module, subclass <a class="reference external" href="https://docs.python.org/2.7/library/unittest.html#unittest.TestCase" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">unittest.TestCase</span></code></a>
-and make the whole file runnable as script using the most common <a class="reference external" href="https://docs.python.org/2.7/library/__main__.html"><code class="xref py py-attr docutils literal"><span class="pre">__name__</span></code></a>
-attribute. A file <code class="file docutils literal"><span class="pre">tests/test_something.py</span></code> could look like this,
-carrying a single test case:</p>
+sporting a single monolithic <code class="file docutils literal"><span class="pre">test_sidechain.py</span></code>.</p>
+<p>Python code is evaluated using its own <a class="reference external" href="https://docs.python.org/2.7/library/unittest.html">unit testing framework</a> with a little help from <a class="reference external" href="http://www.OpenStructure.org">OST</a> (C++ uses the
+Boost <a class="reference external" href="http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/index.html">Test Library</a>). The
+basic scheme is to import your module, subclass <a class="reference external" href="https://docs.python.org/2.7/library/unittest.html#unittest.TestCase" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">unittest.TestCase</span></code></a> and
+make the whole file runnable as script using the most common <a class="reference external" href="https://docs.python.org/2.7/library/__main__.html"><code class="xref py py-attr docutils literal"><span class="pre">__name__</span></code></a>
+attribute. As an example we test the <a class="reference internal" href="sidechain/index.html#promod3.sidechain.Reconstruct" title="promod3.sidechain.Reconstruct"><code class="xref py py-func docutils literal"><span class="pre">promod3.sidechain.Reconstruct()</span></code></a>
+function:</p>
 <div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
  2
  3
@@ -683,12 +530,30 @@ carrying a single test case:</p>
  7
  8
  9
-10</pre></div></td><td class="code"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">unittest</span>
-<span class="kn">from</span> <span class="nn">promod3.sidechains</span> <span class="kn">import</span> <span class="n">something</span>
-
-<span class="k">class</span> <span class="nc">SomethingTests</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
-    <span class="k">def</span> <span class="nf">testFileExistsFalse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-        <span class="bp">self</span><span class="o">.</span><span class="n">assertEquals</span><span class="p">(</span><span class="n">something</span><span class="o">.</span><span class="n">Else</span><span class="p">(),</span> <span class="mi">1</span><span class="p">)</span>
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19</pre></div></td><td class="code"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">unittest</span>
+<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">sidechain</span>
+<span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span><span class="n">mol</span>
+<span class="kn">import</span> <span class="nn">os</span>
+
+<span class="k">class</span> <span class="nc">ReconstructTests</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
+    <span class="k">def</span> <span class="nf">testReconstruct</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+    	<span class="n">in_file</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;data&#39;</span><span class="p">,</span> <span class="s">&#39;1eye.pdb&#39;</span><span class="p">)</span>
+    	<span class="n">ref_file</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;data&#39;</span><span class="p">,</span> <span class="s">&#39;1eye_rec.pdb&#39;</span><span class="p">)</span>
+    	<span class="c"># get and reconstruct 1eye</span>
+    	<span class="n">prot</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="n">in_file</span><span class="p">)</span>
+    	<span class="n">sidechain</span><span class="o">.</span><span class="n">Reconstruct</span><span class="p">(</span><span class="n">prot</span><span class="p">,</span> <span class="n">keep_sidechains</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+    	<span class="c"># compare with reference solution</span>
+    	<span class="n">prot_rec</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="n">ref_file</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">GetAtomCount</span><span class="p">(),</span> <span class="n">prot_rec</span><span class="o">.</span><span class="n">GetAtomCount</span><span class="p">())</span>
 
 <span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
     <span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">testutils</span>
@@ -696,9 +561,9 @@ carrying a single test case:</p>
 </pre></div>
 </td></tr></table></div>
 <p>To hook up your tests with <code class="docutils literal"><span class="pre">make</span> <span class="pre">codetest</span></code> (and to create a
-<code class="docutils literal"><span class="pre">test_something.py_run</span></code> target), everything has to be introduced to CMake.
+<code class="docutils literal"><span class="pre">test_reconstruct.py_run</span></code> target), everything has to be introduced to CMake.
 First, tell CMake to search <code class="file docutils literal"><span class="pre">tests</span></code> for a <code class="file docutils literal"><span class="pre">CMakeLists.txt</span></code> file
-by extending the list of sub-directories in <code class="file docutils literal"><span class="pre">sidechains/CMakeLists.txt</span></code>:</p>
+by extending the list of sub-directories in <code class="file docutils literal"><span class="pre">sidechain/CMakeLists.txt</span></code>:</p>
 <div class="highlight-cmake"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
 2
 3</pre></div></td><td class="code"><div class="highlight"><pre> <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">pymod</span><span class="p">)</span>
@@ -706,22 +571,38 @@ by extending the list of sub-directories in <code class="file docutils literal">
  <span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">tests</span><span class="p">)</span>
 </pre></div>
 </td></tr></table></div>
-<p>Then fill <code class="file docutils literal"><span class="pre">sidechains/tests/CMakeLists.txt</span></code> with your new test script and
+<p>Then fill <code class="file docutils literal"><span class="pre">sidechain/tests/CMakeLists.txt</span></code> with your new test script and
 <code class="docutils literal"><span class="pre">make</span></code> will recognise the changes next time it is run and fix the rest for
 you.</p>
-<div class="highlight-cmake"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2
-3
-4
-5</pre></div></td><td class="code"><div class="highlight"><pre> <span class="nb">set</span><span class="p">(</span><span class="s">SIDECHAINS_UNIT_TESTS</span>
- <span class="s">test_something.py</span>
- <span class="p">)</span>
+<div class="highlight-cmake"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">set</span><span class="p">(</span><span class="s">SIDECHAIN_UNIT_TESTS</span>
+  <span class="s">test_reconstruct.py</span>
+<span class="p">)</span>
+
+<span class="nb">set</span><span class="p">(</span><span class="s">SIDECHAIN_TEST_DATA</span>
+  <span class="s">data/1eye.pdb</span>
+  <span class="s">data/1eye_rec.pdb</span>
+<span class="p">)</span>
 
- <span class="nb">promod3_unittest</span><span class="p">(</span><span class="s">MODULE</span> <span class="s">sidechains</span> <span class="s">SOURCES</span> <span class="s2">&quot;${SIDECHAINS_UNIT_TESTS}&quot;</span><span class="p">)</span>
+<span class="nb">promod3_unittest</span><span class="p">(</span><span class="s">MODULE</span> <span class="s">sidechain</span>
+                 <span class="s">SOURCES</span> <span class="s2">&quot;${SIDECHAIN_UNIT_TESTS}&quot;</span>
+                 <span class="s">DATA</span> <span class="s2">&quot;${SIDECHAIN_TEST_DATA}&quot;</span><span class="p">)</span>
 </pre></div>
 </td></tr></table></div>
+<p>Note how we listed the test data that we require in the unit test by defining
+<code class="docutils literal"><span class="pre">SIDECHAIN_TEST_DATA</span></code>.</p>
 <p>Now tests should be available by <code class="docutils literal"><span class="pre">make</span> <span class="pre">check</span></code>, <code class="docutils literal"><span class="pre">make</span> <span class="pre">codetest</span></code> and
-<code class="docutils literal"><span class="pre">make</span> <span class="pre">test_something.py_run</span></code>.</p>
+<code class="docutils literal"><span class="pre">make</span> <span class="pre">test_reconstruct.py_run</span></code>.</p>
 </div>
 <div class="section" id="how-to-start-your-own-action">
 <h2>How To Start Your Own Action<a class="headerlink" href="#how-to-start-your-own-action" title="Permalink to this headline">¶</a></h2>
@@ -771,48 +652,7 @@ executable, which does not propagate if you do it <strong>after</strong> the fir
 <p>Before coding your action, lets set up unit tests for it. Usually when adding
 features, you will immediately try them, check that everything works as
 intended, etc.. ProMod3 helps you automatising those tests so its rather easy
-to check later, if code changes break anything. Start with a file
-<code class="file docutils literal"><span class="pre">actions/tests/test_action_awesome.py</span></code>:</p>
-<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19</pre></div></td><td class="code"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span>
-
-<span class="c"># this is needed so there will be no test_actions.pyc created in the source</span>
-<span class="c"># directory</span>
-<span class="n">sys</span><span class="o">.</span><span class="n">dont_write_bytecode</span> <span class="o">=</span> <span class="bp">True</span>
-
-<span class="kn">import</span> <span class="nn">test_actions</span>
-
-<span class="k">class</span> <span class="nc">AwesomeActionTests</span><span class="p">(</span><span class="n">test_actions</span><span class="o">.</span><span class="n">ActionTestCase</span><span class="p">):</span>
-    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
-        <span class="n">test_actions</span><span class="o">.</span><span class="n">ActionTestCase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
-        <span class="bp">self</span><span class="o">.</span><span class="n">pm_action</span> <span class="o">=</span> <span class="s">&#39;awesome&#39;</span>
-
-    <span class="k">def</span> <span class="nf">testExit0</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-        <span class="bp">self</span><span class="o">.</span><span class="n">RunExitStatusTest</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">list</span><span class="p">())</span>
-
-<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
-    <span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">testutils</span>
-    <span class="n">testutils</span><span class="o">.</span><span class="n">RunTests</span><span class="p">()</span>
-</pre></div>
-</td></tr></table></div>
-<p>Please note that for actions we are using
+to check later, if code changes break anything.  For actions, we are using
 <a class="reference internal" href="actions/index_dev.html#module-test_actions" title="test_actions: Testing Actions"><code class="xref py py-class docutils literal"><span class="pre">test_actions.ActionTestCase</span></code></a> instead of
 <a class="reference external" href="https://docs.python.org/2.7/library/unittest.html#unittest.TestCase" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">unittest.TestCase</span></code></a>. Since testing has a lot in common for different
 actions, we decided to put up a little wrapper around this subject. See the
@@ -889,6 +729,7 @@ contributions to web pages using ProMod3.</p>
 <li><a class="reference internal" href="#directory-structure">Directory Structure</a></li>
 <li><a class="reference internal" href="#cmake">CMake</a></li>
 <li><a class="reference internal" href="#the-stage-directory">The <code class="file docutils literal"><span class="pre">stage</span></code> Directory</a></li>
+<li><a class="reference internal" href="#quick-testing-of-project-features">Quick testing of ProMod3 features</a></li>
 <li><a class="reference internal" href="#unit-tests">Unit Tests</a></li>
 <li><a class="reference internal" href="#writing-documentation">Writing Documentation</a></li>
 <li><a class="reference internal" href="#how-to-start-your-own-module">How To Start Your Own Module</a></li>
@@ -902,8 +743,8 @@ contributions to web pages using ProMod3.</p>
 <ul>
   <li><a href="index.html">Documentation overview</a><ul>
   <li><a href="developers.html">Documentation For Developers</a><ul>
-      <li>Previous: <a href="buildsystem.html" title="previous chapter">Building ProMod3</a></li>
-      <li>Next: <a href="cmake/index.html" title="next chapter">ProMod3&#8216;s Share Of CMake</a></li>
+      <li>Previous: <a href="developers.html" title="previous chapter">Documentation For Developers</a></li>
+      <li>Next: <a href="actions/index_dev.html" title="next chapter"><code class="docutils literal"><span class="pre">test_actions</span></code> - Testing Actions</a></li>
   </ul></li>
   </ul></li>
 </ul>
@@ -933,7 +774,7 @@ contributions to web pages using ProMod3.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/core/helper.html b/doc/html/core/helper.html
index dd2e46e88b7b85f27e0d727c30948e7ad4a13a2d..880e2c6c33e1957ae0cba1ed54ec946a83e7ef5f 100644
--- a/doc/html/core/helper.html
+++ b/doc/html/core/helper.html
@@ -25,7 +25,7 @@
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
     <link rel="up" title="core - ProMod3 Core Functionality" href="index.html" />
-    <link rel="next" title="modelling - Protein Modelling" href="../modelling/index.html" />
+    <link rel="next" title="SetCompoundsChemlib()" href="setcompoundschemlib.html" />
     <link rel="prev" title="pm3argparse - Parsing Command Lines" href="pm3argparse.html" />
    
   
@@ -79,7 +79,10 @@ traditionally reserved to successful commands.</li>
 </div>
 <div class="section" id="file-tests">
 <h2>File Tests<a class="headerlink" href="#file-tests" title="Permalink to this headline">¶</a></h2>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">promod3.core</span> <span class="kn">import</span> <span class="n">helper</span>
+<p>The following example parses an argument (call as <code class="docutils literal"><span class="pre">pm</span> <span class="pre">SCRIPTNAME</span> <span class="pre">FILENAME</span></code>) as
+a file name and checks whether it is a <code class="docutils literal"><span class="pre">pdb</span></code> or <code class="docutils literal"><span class="pre">mmcif</span></code> file.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot;Test for file reading.&quot;&quot;&quot;</span>
+<span class="kn">from</span> <span class="nn">promod3.core</span> <span class="kn">import</span> <span class="n">helper</span>
 <span class="kn">from</span> <span class="nn">promod3.core</span> <span class="kn">import</span> <span class="n">pm3argparse</span>
 
 <span class="n">p</span> <span class="o">=</span> <span class="n">pm3argparse</span><span class="o">.</span><span class="n">PM3ArgumentParser</span><span class="p">(</span><span class="n">__doc__</span><span class="p">)</span>
@@ -89,9 +92,9 @@ traditionally reserved to successful commands.</li>
 <span class="n">helper</span><span class="o">.</span><span class="n">FileExists</span><span class="p">(</span><span class="s">&#39;Test file&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">file</span><span class="p">)</span>
 
 <span class="n">opts</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">ext</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">gz</span> <span class="o">=</span> <span class="n">helper</span><span class="o">.</span><span class="n">FileExtension</span><span class="p">(</span><span class="s">&#39;Test file&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span>
-                                                      <span class="n">opts</span><span class="o">.</span><span class="n">file</span><span class="p">,</span>
-                                                      <span class="p">(</span><span class="s">&#39;pdb&#39;</span><span class="p">,</span> <span class="s">&#39;mmcif&#39;</span><span class="p">),</span>
-                                                      <span class="n">gzip</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+                                                    <span class="n">opts</span><span class="o">.</span><span class="n">file</span><span class="p">,</span>
+                                                    <span class="p">(</span><span class="s">&#39;pdb&#39;</span><span class="p">,</span> <span class="s">&#39;mmcif&#39;</span><span class="p">),</span>
+                                                    <span class="n">gzip</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
 </pre></div>
 </div>
 <dl class="function">
@@ -210,10 +213,10 @@ script will terminate if a gzip file is found.</li>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a><ul>
       <li>Previous: <a href="pm3argparse.html" title="previous chapter"><code class="docutils literal"><span class="pre">pm3argparse</span></code> - Parsing Command Lines</a></li>
-      <li>Next: <a href="../modelling/index.html" title="next chapter"><code class="docutils literal"><span class="pre">modelling</span></code> - Protein Modelling</a></li>
+      <li>Next: <a href="setcompoundschemlib.html" title="next chapter"><code class="docutils literal"><span class="pre">SetCompoundsChemlib()</span></code></a></li>
   </ul></li>
   </ul></li>
   </ul></li>
@@ -244,7 +247,7 @@ script will terminate if a gzip file is found.</li>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/core/index.html b/doc/html/core/index.html
index e559518c243945e994ed6ff0b4527c6127a79964..f12371ac5222503db2ddb6a58d864864edbd30d1 100644
--- a/doc/html/core/index.html
+++ b/doc/html/core/index.html
@@ -24,9 +24,9 @@
     <script type="text/javascript" src="../_static/underscore.js"></script>
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
-    <link rel="up" title="Documentation For Developers" href="../developers.html" />
+    <link rel="up" title="Documentation For Users" href="../users.html" />
     <link rel="next" title="pm3argparse - Parsing Command Lines" href="pm3argparse.html" />
-    <link rel="prev" title="SetCompoundsChemlib()" href="setcompoundschemlib.html" />
+    <link rel="prev" title="Load Rotamer Libraries" href="../sidechain/loading.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -69,8 +69,8 @@ modeling per se but cover standard programming issues.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
-      <li>Previous: <a href="setcompoundschemlib.html" title="previous chapter"><code class="docutils literal"><span class="pre">SetCompoundsChemlib()</span></code></a></li>
+  <li><a href="../users.html">Documentation For Users</a><ul>
+      <li>Previous: <a href="../sidechain/loading.html" title="previous chapter">Load Rotamer Libraries</a></li>
       <li>Next: <a href="pm3argparse.html" title="next chapter"><code class="docutils literal"><span class="pre">pm3argparse</span></code> - Parsing Command Lines</a></li>
   </ul></li>
   </ul></li>
@@ -101,7 +101,7 @@ modeling per se but cover standard programming issues.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/core/pm3argparse.html b/doc/html/core/pm3argparse.html
index e62a5ad098153ad5ff41cea96daf5d86540f831e..67748aea9c9628c87940de8db63fb7489784f2ea 100644
--- a/doc/html/core/pm3argparse.html
+++ b/doc/html/core/pm3argparse.html
@@ -52,16 +52,16 @@ There <a class="reference internal" href="#promod3.core.pm3argparse.PM3ArgumentP
 simplification. It provides a set of standard arguments you just need to
 activate for your action plus it comes with some verification functionality for
 input.</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="sd">&#39;&#39;&#39;</span>
+<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot;</span>
 <span class="sd">Place the description of your script right in the file and import</span>
 <span class="sd">it via &#39;__doc__&#39; as description to the parser (&#39;-h&#39;, &#39;--help&#39;).</span>
-<span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">&quot;&quot;&quot;</span>
 
 <span class="kn">from</span> <span class="nn">promod3.core</span> <span class="kn">import</span> <span class="n">pm3argparse</span>
 
 <span class="c"># make sure we see output when passing &#39;-h&#39;</span>
 <span class="kn">import</span> <span class="nn">ost</span>
-<span class="n">ost</span><span class="o">.</span><span class="n">PushVerbosityLevel</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
+<span class="n">ost</span><span class="o">.</span><span class="n">PushVerbosityLevel</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> 
 
 <span class="n">parser</span> <span class="o">=</span> <span class="n">pm3argparse</span><span class="o">.</span><span class="n">PM3ArgumentParser</span><span class="p">(</span><span class="n">__doc__</span><span class="p">)</span>
 <span class="n">parser</span><span class="o">.</span><span class="n">AddAlignment</span><span class="p">()</span>
@@ -69,6 +69,10 @@ input.</p>
 <span class="n">opts</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parse</span><span class="p">()</span>
 </pre></div>
 </div>
+<p>When the example above is run with <code class="docutils literal"><span class="pre">pm</span></code> and no additional arguments, the
+script exits with a code 2. If it is run with an additional argument <code class="docutils literal"><span class="pre">-h</span></code> or
+<code class="docutils literal"><span class="pre">--help</span></code>, it exits with a code 0 and displays the help message given as a
+docstring in your script.</p>
 </div>
 <div class="section" id="argument-parser">
 <h2>Argument Parser<a class="headerlink" href="#argument-parser" title="Permalink to this headline">¶</a></h2>
@@ -280,7 +284,7 @@ and with the right constraints.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a><ul>
       <li>Previous: <a href="index.html" title="previous chapter"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a></li>
       <li>Next: <a href="helper.html" title="next chapter"><code class="docutils literal"><span class="pre">helper</span></code> - Shared Functionality For the Everything</a></li>
@@ -314,7 +318,7 @@ and with the right constraints.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/core/setcompoundschemlib.html b/doc/html/core/setcompoundschemlib.html
index 9ddbda7e05713d244b46931766b0e961ce5e902c..17ead7afdb947c03b198db6ff4d35808d47594fe 100644
--- a/doc/html/core/setcompoundschemlib.html
+++ b/doc/html/core/setcompoundschemlib.html
@@ -24,9 +24,9 @@
     <script type="text/javascript" src="../_static/underscore.js"></script>
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
-    <link rel="up" title="Documentation For Developers" href="../developers.html" />
-    <link rel="next" title="core - ProMod3 Core Functionality" href="index.html" />
-    <link rel="prev" title="Getting Started" href="../gettingstarted.html" />
+    <link rel="up" title="Documentation For Users" href="../users.html" />
+    <link rel="next" title="Documentation For Developers" href="../developers.html" />
+    <link rel="prev" title="helper - Shared Functionality For the Everything" href="helper.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -74,9 +74,9 @@ enabled globally.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
-      <li>Previous: <a href="../gettingstarted.html" title="previous chapter">Getting Started</a></li>
-      <li>Next: <a href="index.html" title="next chapter"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a></li>
+  <li><a href="../users.html">Documentation For Users</a><ul>
+      <li>Previous: <a href="helper.html" title="previous chapter"><code class="docutils literal"><span class="pre">helper</span></code> - Shared Functionality For the Everything</a></li>
+      <li>Next: <a href="../developers.html" title="next chapter">Documentation For Developers</a></li>
   </ul></li>
   </ul></li>
 </ul>
@@ -106,7 +106,7 @@ enabled globally.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/developers.html b/doc/html/developers.html
index 9e7b87f44140e4edff017d3b3c3a005044a50512..c22855e1374b4f477f9a88f50701439717e9686f 100644
--- a/doc/html/developers.html
+++ b/doc/html/developers.html
@@ -24,8 +24,8 @@
     <script type="text/javascript" src="_static/underscore.js"></script>
     <script type="text/javascript" src="_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="index.html" />
-    <link rel="next" title="Getting Started" href="gettingstarted.html" />
-    <link rel="prev" title="Documentation For Users" href="users.html" />
+    <link rel="next" title="Contributing" href="contributing.html" />
+    <link rel="prev" title="SetCompoundsChemlib()" href="core/setcompoundschemlib.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -40,60 +40,19 @@
             
   <div class="section" id="documentation-for-developers">
 <h1>Documentation For Developers<a class="headerlink" href="#documentation-for-developers" title="Permalink to this headline">¶</a></h1>
+<p>This section is for developers that wish to extending the functionality of
+ProMod3. It describes helper classes for development and how to contribute
+new features.</p>
 <p>Contents:</p>
 <div class="toctree-wrapper compound">
 <ul>
-<li class="toctree-l1"><a class="reference internal" href="gettingstarted.html">Getting Started</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#get-and-run-project">Get and Run ProMod3</a></li>
-<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#modelling-pipeline">Modelling pipeline</a></li>
-</ul>
-</li>
-<li class="toctree-l1"><a class="reference internal" href="core/setcompoundschemlib.html"><code class="docutils literal"><span class="pre">SetCompoundsChemlib()</span></code></a></li>
-<li class="toctree-l1"><a class="reference internal" href="core/index.html"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="core/pm3argparse.html"><code class="docutils literal"><span class="pre">pm3argparse</span></code> - Parsing Command Lines</a></li>
-<li class="toctree-l2"><a class="reference internal" href="core/helper.html"><code class="docutils literal"><span class="pre">helper</span></code> - Shared Functionality For the Everything</a></li>
-</ul>
-</li>
-<li class="toctree-l1"><a class="reference internal" href="modelling/index.html"><code class="docutils literal"><span class="pre">modelling</span></code> - Protein Modelling</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#modelling-pipeline">Modelling Pipeline</a></li>
-<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#closing-gaps">Closing Gaps</a></li>
-<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#modelling-handle-class">Modelling Handle class</a></li>
-<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#gap-classes">Gap classes</a></li>
-<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#gap-extender-classes">Gap Extender classes</a></li>
-</ul>
-</li>
-<li class="toctree-l1"><a class="reference internal" href="loop/index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="loop/backbone.html">Representing Loops</a></li>
-<li class="toctree-l2"><a class="reference internal" href="loop/torsion_sampler.html">Have a closer look at backbone dihedral angles</a></li>
-<li class="toctree-l2"><a class="reference internal" href="loop/structure_db.html">A dump for structural data</a></li>
-<li class="toctree-l2"><a class="reference internal" href="loop/loop_closing.html">Closing Loops - adapt them to the environment</a></li>
-<li class="toctree-l2"><a class="reference internal" href="loop/backbone_loop_score.html">Loop Scoring</a></li>
-<li class="toctree-l2"><a class="reference internal" href="loop/monte_carlo.html">Generating Loops DeNovo</a></li>
-<li class="toctree-l2"><a class="reference internal" href="loop/load_loop_objects.html">Loading Precomputed Loop Objects</a></li>
-<li class="toctree-l2"><a class="reference internal" href="loop/helper_classes.html">Helper Classes</a></li>
-</ul>
-</li>
-<li class="toctree-l1"><a class="reference internal" href="sidechain/index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="sidechain/index.html#reconstruct-function">Reconstruct Function</a></li>
-<li class="toctree-l2"><a class="reference internal" href="sidechain/index.html#sidechain-module-functionality">Sidechain Module Functionality</a></li>
-</ul>
-</li>
-<li class="toctree-l1"><a class="reference internal" href="actions/index_dev.html"><code class="docutils literal"><span class="pre">test_actions</span></code> - Testing Actions</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="actions/index_dev.html#creating-an-action-unit-test-script">Creating an Action Unit Test Script</a></li>
-<li class="toctree-l2"><a class="reference internal" href="actions/index_dev.html#unit-test-actions-api">Unit Test Actions API</a></li>
-</ul>
-</li>
-<li class="toctree-l1"><a class="reference internal" href="buildsystem.html">Building ProMod3</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="buildsystem.html#dependencies">Dependencies</a></li>
-<li class="toctree-l2"><a class="reference internal" href="buildsystem.html#using-cmake">Using CMake</a></li>
-</ul>
-</li>
 <li class="toctree-l1"><a class="reference internal" href="contributing.html">Contributing</a><ul>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#git-branches">Git Branches</a></li>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#git-hooks">Git Hooks</a></li>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#directory-structure">Directory Structure</a></li>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#cmake">CMake</a></li>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#the-stage-directory">The <code class="file docutils literal"><span class="pre">stage</span></code> Directory</a></li>
+<li class="toctree-l2"><a class="reference internal" href="contributing.html#quick-testing-of-project-features">Quick testing of ProMod3 features</a></li>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#unit-tests">Unit Tests</a></li>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#writing-documentation">Writing Documentation</a></li>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#how-to-start-your-own-module">How To Start Your Own Module</a></li>
@@ -101,11 +60,23 @@
 <li class="toctree-l2"><a class="reference internal" href="contributing.html#third-party-contributions-license-issues">Third Party Contributions (License Issues)</a></li>
 </ul>
 </li>
+<li class="toctree-l1"><a class="reference internal" href="actions/index_dev.html"><code class="docutils literal"><span class="pre">test_actions</span></code> - Testing Actions</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="actions/index_dev.html#creating-an-action-unit-test-script">Creating an Action Unit Test Script</a></li>
+<li class="toctree-l2"><a class="reference internal" href="actions/index_dev.html#unit-test-actions-api">Unit Test Actions API</a></li>
+</ul>
+</li>
 <li class="toctree-l1"><a class="reference internal" href="cmake/index.html">ProMod3&#8216;s Share Of CMake</a><ul>
 <li class="toctree-l2"><a class="reference internal" href="cmake/index.html#introduction">Introduction</a></li>
 <li class="toctree-l2"><a class="reference internal" href="cmake/index.html#functions-for-module-action-maintenance">Functions For Module/ Action Maintenance</a></li>
 </ul>
 </li>
+<li class="toctree-l1"><a class="reference internal" href="portableIO.html">Using binary files in ProMod3</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="portableIO.html#header">Header</a></li>
+<li class="toctree-l2"><a class="reference internal" href="portableIO.html#portable-binary-data">Portable binary data</a></li>
+<li class="toctree-l2"><a class="reference internal" href="portableIO.html#code-example">Code example</a></li>
+<li class="toctree-l2"><a class="reference internal" href="portableIO.html#exisiting-binary-files">Exisiting binary files</a></li>
+</ul>
+</li>
 </ul>
 </div>
 </div>
@@ -119,8 +90,8 @@
 <h3>Related Topics</h3>
 <ul>
   <li><a href="index.html">Documentation overview</a><ul>
-      <li>Previous: <a href="users.html" title="previous chapter">Documentation For Users</a></li>
-      <li>Next: <a href="gettingstarted.html" title="next chapter">Getting Started</a></li>
+      <li>Previous: <a href="core/setcompoundschemlib.html" title="previous chapter"><code class="docutils literal"><span class="pre">SetCompoundsChemlib()</span></code></a></li>
+      <li>Next: <a href="contributing.html" title="next chapter">Contributing</a></li>
   </ul></li>
 </ul>
 </div>
@@ -149,7 +120,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/genindex.html b/doc/html/genindex.html
index ebe2eb9a36a6434146d3bb12d915e95eb48fd1a8..f5d62dd58fe9332e3f40f980343bf517566b3280 100644
--- a/doc/html/genindex.html
+++ b/doc/html/genindex.html
@@ -68,11 +68,19 @@
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%" valign="top"><dl>
       
-  <dt><a href="loop/structure_db.html#promod3.loop.Fragger.__getitem__">__getitem__() (promod3.loop.Fragger method)</a>
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.__getitem__">__getitem__() (promod3.loop.BackboneList method)</a>
   </dt>
 
       <dd><dl>
         
+  <dt><a href="loop/structure_db.html#promod3.loop.Fragger.__getitem__">(promod3.loop.Fragger method)</a>
+  </dt>
+
+        
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerMap.__getitem__">(promod3.loop.FraggerMap method)</a>
+  </dt>
+
+        
   <dt><a href="sidechain/rotamer.html#promod3.sidechain.FRMRotamer.__getitem__">(promod3.sidechain.FRMRotamer method)</a>
   </dt>
 
@@ -97,14 +105,22 @@
   <dt><a href="core/pm3argparse.html#promod3.core.pm3argparse.PM3ArgumentParser.__init__">__init__() (promod3.core.pm3argparse.PM3ArgumentParser method)</a>
   </dt>
 
+      
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.__iter__">__iter__() (promod3.loop.BackboneList method)</a>
+  </dt>
+
   </dl></td>
   <td style="width: 33%" valign="top"><dl>
       
-  <dt><a href="loop/structure_db.html#promod3.loop.Fragger.__len__">__len__() (promod3.loop.Fragger method)</a>
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.__len__">__len__() (promod3.loop.BackboneList method)</a>
   </dt>
 
       <dd><dl>
         
+  <dt><a href="loop/structure_db.html#promod3.loop.Fragger.__len__">(promod3.loop.Fragger method)</a>
+  </dt>
+
+        
   <dt><a href="loop/helper_classes.html#promod3.loop.PsipredPrediction.__len__">(promod3.loop.PsipredPrediction method)</a>
   </dt>
 
@@ -126,6 +142,16 @@
 
         
   <dt><a href="sidechain/rotamer.html#promod3.sidechain.RRMRotamerGroup.__len__">(promod3.sidechain.RRMRotamerGroup method)</a>
+  </dt>
+
+      </dl></dd>
+      
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.__setitem__">__setitem__() (promod3.loop.BackboneList method)</a>
+  </dt>
+
+      <dd><dl>
+        
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerMap.__setitem__">(promod3.loop.FraggerMap method)</a>
   </dt>
 
       </dl></dd>
@@ -188,6 +214,22 @@
   </dt>
 
       
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.AddConstraint">AddConstraint() (promod3.loop.BackboneLoopScorer method)</a>
+  </dt>
+
+      
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.AddConstraintFunction">AddConstraintFunction() (promod3.loop.BackboneLoopScorer method)</a>
+  </dt>
+
+      
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.AddContact">AddContact() (promod3.loop.BackboneLoopScorer method)</a>, <a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.AddContact">[1]</a>
+  </dt>
+
+      
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.AddContactFunction">AddContactFunction() (promod3.loop.BackboneLoopScorer method)</a>
+  </dt>
+
+      
   <dt><a href="loop/structure_db.html#promod3.loop.StructureDB.AddCoordinates">AddCoordinates() (promod3.loop.StructureDB method)</a>
   </dt>
 
@@ -213,12 +255,12 @@
   </dt>
 
       </dl></dd>
+  </dl></td>
+  <td style="width: 33%" valign="top"><dl>
       
   <dt><a href="loop/structure_db.html#promod3.loop.Fragger.AddSeqIDParameters">AddSeqIDParameters() (promod3.loop.Fragger method)</a>
   </dt>
 
-  </dl></td>
-  <td style="width: 33%" valign="top"><dl>
       
   <dt><a href="loop/structure_db.html#promod3.loop.Fragger.AddSeqSimParameters">AddSeqSimParameters() (promod3.loop.Fragger method)</a>
   </dt>
@@ -236,6 +278,10 @@
   </dt>
 
       
+  <dt><a href="loop/structure_db.html#promod3.loop.Fragger.AddTorsionProbabilityParameters">AddTorsionProbabilityParameters() (promod3.loop.Fragger method)</a>
+  </dt>
+
+      
   <dt><a href="modelling/index.html#promod3.modelling.StructuralGap.after">after (promod3.modelling.StructuralGap attribute)</a>
   </dt>
 
@@ -287,7 +333,7 @@
 
       <dd><dl>
         
-  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.ApplyTransform">(promod3.loop.BackboneList method)</a>, <a href="loop/backbone.html#promod3.loop.BackboneList.ApplyTransform">[1]</a>
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.ApplyTransform">(promod3.loop.BackboneList method)</a>
   </dt>
 
       </dl></dd>
@@ -386,7 +432,7 @@
   </dt>
 
       
-  <dt><a href="loop/helper_classes.html#promod3.loop.LoopCandidates.CalculateClasScores">CalculateClasScores() (promod3.loop.LoopCandidates method)</a>
+  <dt><a href="loop/helper_classes.html#promod3.loop.LoopCandidates.CalculateClashScores">CalculateClashScores() (promod3.loop.LoopCandidates method)</a>
   </dt>
 
       
@@ -394,6 +440,14 @@
   </dt>
 
       
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.CalculateConstraintScore">CalculateConstraintScore() (promod3.loop.BackboneLoopScorer method)</a>
+  </dt>
+
+      
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.CalculateContactScore">CalculateContactScore() (promod3.loop.BackboneLoopScorer method)</a>
+  </dt>
+
+      
   <dt><a href="loop/helper_classes.html#promod3.loop.LoopCandidates.CalculateHBondcores">CalculateHBondcores() (promod3.loop.LoopCandidates method)</a>
   </dt>
 
@@ -479,13 +533,17 @@
   <dt><a href="loop/monte_carlo.html#promod3.loop.CCDCloser">CCDCloser (class in promod3.loop)</a>
   </dt>
 
-  </dl></td>
-  <td style="width: 33%" valign="top"><dl>
       
   <dt><a href="loop/structure_db.html#promod3.loop.FragmentInfo.chain_index">chain_index (promod3.loop.FragmentInfo attribute)</a>
   </dt>
 
       
+  <dt><a href="modelling/index.html#promod3.modelling.CheckFinalModel">CheckFinalModel() (in module promod3.modelling)</a>
+  </dt>
+
+  </dl></td>
+  <td style="width: 33%" valign="top"><dl>
+      
   <dt><a href="sidechain/rotamer_lib.html#promod3.sidechain.RotamerLibEntry.chi1">chi1 (promod3.sidechain.RotamerLibEntry attribute)</a>
   </dt>
 
@@ -536,6 +594,10 @@
 
       </dl></dd>
       
+  <dt><a href="modelling/index.html#promod3.modelling.CloseLargeDeletions">CloseLargeDeletions() (in module promod3.modelling)</a>
+  </dt>
+
+      
   <dt><a href="modelling/index.html#promod3.modelling.CloseSmallDeletions">CloseSmallDeletions() (in module promod3.modelling)</a>
   </dt>
 
@@ -562,6 +624,14 @@
   </dt>
 
         
+  <dt><a href="cmake/index.html#command:convert_module_data"><strong>convert_module_data</strong></a>
+  </dt>
+
+        
+  <dt><a href="cmake/index.html#command:module"><strong>module</strong></a>
+  </dt>
+
+        
   <dt><a href="contributing.html#index-0-command:pm_action">pm_action</a>, <a href="cmake/index.html#command:pm_action"><strong>[1]</strong></a>
   </dt>
 
@@ -569,6 +639,10 @@
   <dt><a href="cmake/index.html#index-0-command:promod3_unittest">promod3_unittest</a>, <a href="cmake/index.html#index-1-command:promod3_unittest">[1]</a>, <a href="cmake/index.html#command:promod3_unittest"><strong>[2]</strong></a>
   </dt>
 
+        
+  <dt><a href="cmake/index.html#command:pymod"><strong>pymod</strong></a>
+  </dt>
+
       </dl></dd>
       
   <dt><a href="sidechain/frame.html#promod3.sidechain.ConstructBackboneFrameResidue">ConstructBackboneFrameResidue() (in module promod3.sidechain)</a>, <a href="sidechain/frame.html#promod3.sidechain.ConstructBackboneFrameResidue">[1]</a>
@@ -599,6 +673,21 @@
   </dt>
 
       
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerMap.Contains">Contains() (promod3.loop.FraggerMap method)</a>
+  </dt>
+
+      
+  <dt>
+    convert_module_data
+  </dt>
+
+      <dd><dl>
+        
+  <dt><a href="cmake/index.html#command:convert_module_data"><strong>command</strong></a>
+  </dt>
+
+      </dl></dd>
+      
   <dt><a href="loop/structure_db.html#promod3.loop.CoordInfo">CoordInfo (class in promod3.loop)</a>
   </dt>
 
@@ -607,6 +696,14 @@
   </dt>
 
       
+  <dt><a href="modelling/index.html#promod3.modelling.CountEnclosedGaps">CountEnclosedGaps() (in module promod3.modelling)</a>
+  </dt>
+
+      
+  <dt><a href="modelling/index.html#promod3.modelling.CountEnclosedInsertions">CountEnclosedInsertions() (in module promod3.modelling)</a>
+  </dt>
+
+      
   <dt><a href="sidechain/graph.html#promod3.sidechain.Graph.CreateFromFRMList">CreateFromFRMList() (promod3.sidechain.Graph static method)</a>
   </dt>
 
@@ -657,14 +754,22 @@
   </dt>
 
       
-  <dt><a href="modelling/index.html#promod3.modelling.GapExtender.Extend">Extend() (promod3.modelling.GapExtender method)</a>
+  <dt><a href="modelling/index.html#promod3.modelling.FullGapExtender.Extend">Extend() (promod3.modelling.FullGapExtender method)</a>
   </dt>
 
       <dd><dl>
         
+  <dt><a href="modelling/index.html#promod3.modelling.GapExtender.Extend">(promod3.modelling.GapExtender method)</a>
+  </dt>
+
+        
   <dt><a href="modelling/index.html#promod3.modelling.ScoringGapExtender.Extend">(promod3.modelling.ScoringGapExtender method)</a>
   </dt>
 
+        
+  <dt><a href="modelling/index.html#promod3.modelling.ShiftExtension.Extend">(promod3.modelling.ShiftExtension method)</a>
+  </dt>
+
       </dl></dd>
       
   <dt><a href="modelling/index.html#promod3.modelling.StructuralGap.ExtendAtCTerm">ExtendAtCTerm() (promod3.modelling.StructuralGap method)</a>
@@ -677,9 +782,15 @@
   </dt>
 
       
-  <dt><a href="loop/helper_classes.html#promod3.loop.PsipredPrediction.Extract">Extract() (promod3.loop.PsipredPrediction method)</a>
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.Extract">Extract() (promod3.loop.BackboneList method)</a>
+  </dt>
+
+      <dd><dl>
+        
+  <dt><a href="loop/helper_classes.html#promod3.loop.PsipredPrediction.Extract">(promod3.loop.PsipredPrediction method)</a>
   </dt>
 
+      </dl></dd>
       
   <dt><a href="loop/torsion_sampler.html#promod3.loop.TorsionSampler.ExtractStatistics">ExtractStatistics() (promod3.loop.TorsionSampler method)</a>
   </dt>
@@ -723,6 +834,14 @@
   </dt>
 
       
+  <dt><a href="modelling/index.html#promod3.modelling.FilterCandidates">FilterCandidates() (in module promod3.modelling)</a>
+  </dt>
+
+      
+  <dt><a href="modelling/index.html#promod3.modelling.FilterCandidatesWithSC">FilterCandidatesWithSC() (in module promod3.modelling)</a>
+  </dt>
+
+      
   <dt><a href="loop/structure_db.html#promod3.loop.FragDB">FragDB (class in promod3.loop)</a>
   </dt>
 
@@ -731,12 +850,16 @@
   </dt>
 
       
-  <dt><a href="loop/structure_db.html#promod3.loop.Fragger.Fragger">Fragger() (promod3.loop.Fragger method)</a>
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerHandle">FraggerHandle (class in promod3.loop)</a>
   </dt>
 
   </dl></td>
   <td style="width: 33%" valign="top"><dl>
       
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerMap">FraggerMap (class in promod3.loop)</a>
+  </dt>
+
+      
   <dt><a href="loop/structure_db.html#promod3.loop.FragmentInfo">FragmentInfo (class in promod3.loop)</a>
   </dt>
 
@@ -776,6 +899,10 @@
   <dt><a href="modelling/index.html#promod3.modelling.StructuralGap.full_seq">full_seq (promod3.modelling.StructuralGap attribute)</a>
   </dt>
 
+      
+  <dt><a href="modelling/index.html#promod3.modelling.FullGapExtender">FullGapExtender (class in promod3.modelling)</a>
+  </dt>
+
   </dl></td>
 </tr></table>
 
@@ -795,6 +922,10 @@
   </dt>
 
       
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerHandle.Get">Get() (promod3.loop.FraggerHandle method)</a>
+  </dt>
+
+      
   <dt><a href="loop/structure_db.html#promod3.loop.FragDB.GetAngularBinSize">GetAngularBinSize() (promod3.loop.FragDB method)</a>
   </dt>
 
@@ -933,12 +1064,16 @@
   </dt>
 
       
-  <dt><a href="sidechain/rotamer.html#promod3.sidechain.Particle.GetName">GetName() (promod3.sidechain.Particle method)</a>
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerHandle.GetList">GetList() (promod3.loop.FraggerHandle method)</a>
   </dt>
 
   </dl></td>
   <td style="width: 33%" valign="top"><dl>
       
+  <dt><a href="sidechain/rotamer.html#promod3.sidechain.Particle.GetName">GetName() (promod3.sidechain.Particle method)</a>
+  </dt>
+
+      
   <dt><a href="sidechain/graph.html#promod3.sidechain.Graph.GetNumActiveEdges">GetNumActiveEdges() (promod3.sidechain.Graph method)</a>
   </dt>
 
@@ -955,7 +1090,7 @@
   </dt>
 
       
-  <dt><a href="loop/structure_db.html#promod3.loop.FragDB.GetNumFragments">GetNumFragments() (promod3.loop.FragDB method)</a>, <a href="loop/structure_db.html#promod3.loop.FragDB.GetNumFragments">[1]</a>
+  <dt><a href="loop/structure_db.html#promod3.loop.FragDB.GetNumFragments">GetNumFragments() (promod3.loop.FragDB method)</a>
   </dt>
 
       
@@ -963,7 +1098,7 @@
   </dt>
 
       
-  <dt><a href="loop/structure_db.html#promod3.loop.FragDB.GetNumStemPairs">GetNumStemPairs() (promod3.loop.FragDB method)</a>, <a href="loop/structure_db.html#promod3.loop.FragDB.GetNumStemPairs">[1]</a>
+  <dt><a href="loop/structure_db.html#promod3.loop.FragDB.GetNumStemPairs">GetNumStemPairs() (promod3.loop.FragDB method)</a>
   </dt>
 
       
@@ -975,14 +1110,6 @@
   </dt>
 
       
-  <dt><a href="loop/helper_classes.html#promod3.loop.LoopCandidate.GetOriginalDSSPState">GetOriginalDSSPState() (promod3.loop.LoopCandidate method)</a>
-  </dt>
-
-      
-  <dt><a href="loop/helper_classes.html#promod3.loop.LoopCandidate.GetOriginalSequence">GetOriginalSequence() (promod3.loop.LoopCandidate method)</a>
-  </dt>
-
-      
   <dt><a href="sidechain/rotamer.html#promod3.sidechain.Particle.GetParticleType">GetParticleType() (promod3.sidechain.Particle method)</a>
   </dt>
 
@@ -1033,6 +1160,14 @@
   </dt>
 
       
+  <dt><a href="modelling/index.html#promod3.modelling.GetRingPunches">GetRingPunches() (in module promod3.modelling)</a>
+  </dt>
+
+      
+  <dt><a href="modelling/index.html#promod3.modelling.GetRings">GetRings() (in module promod3.modelling)</a>
+  </dt>
+
+      
   <dt><a href="loop/structure_db.html#promod3.loop.Fragger.GetScore">GetScore() (promod3.loop.Fragger method)</a>, <a href="loop/structure_db.html#promod3.loop.Fragger.GetScore">[1]</a>
   </dt>
 
@@ -1096,6 +1231,12 @@
   <dt><a href="loop/backbone.html#promod3.loop.Backbone.GetTransform">GetTransform() (promod3.loop.Backbone method)</a>
   </dt>
 
+      <dd><dl>
+        
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.GetTransform">(promod3.loop.BackboneList method)</a>
+  </dt>
+
+      </dl></dd>
       
   <dt><a href="sidechain/rotamer.html#promod3.sidechain.FRMRotamer.GetTransformedCopy">GetTransformedCopy() (promod3.sidechain.FRMRotamer method)</a>
   </dt>
@@ -1117,6 +1258,16 @@
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%" valign="top"><dl>
       
+  <dt><a href="loop/structure_db.html#promod3.loop.FragDB.HasFragLength">HasFragLength() (promod3.loop.FragDB method)</a>
+  </dt>
+
+      
+  <dt><a href="modelling/index.html#promod3.modelling.HasRingPunches">HasRingPunches() (in module promod3.modelling)</a>
+  </dt>
+
+  </dl></td>
+  <td style="width: 33%" valign="top"><dl>
+      
   <dt><a href="loop/helper_classes.html#promod3.loop.LoopCandidate.hbond_score">hbond_score (promod3.loop.LoopCandidate attribute)</a>
   </dt>
 
@@ -1127,7 +1278,7 @@
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%" valign="top"><dl>
       
-  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.Initialize">Initialize() (promod3.loop.BackboneLoopScorer method)</a>, <a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.Initialize">[1]</a>
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.Initialize">Initialize() (promod3.loop.BackboneLoopScorer method)</a>
   </dt>
 
       <dd><dl>
@@ -1224,6 +1375,10 @@
   </dt>
 
         
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerMap.Load">(promod3.loop.FraggerMap method)</a>
+  </dt>
+
+        
   <dt><a href="loop/structure_db.html#promod3.loop.StructureDB.Load">(promod3.loop.StructureDB method)</a>
   </dt>
 
@@ -1245,16 +1400,58 @@
   </dt>
 
       
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerMap.LoadBB">LoadBB() (promod3.loop.FraggerMap method)</a>
+  </dt>
+
+      
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerHandle.LoadCached">LoadCached() (promod3.loop.FraggerHandle method)</a>
+  </dt>
+
+      
+  <dt><a href="sidechain/loading.html#promod3.sidechain.LoadDunbrackLib">LoadDunbrackLib() (in module promod3.sidechain)</a>
+  </dt>
+
+      
   <dt><a href="loop/load_loop_objects.html#promod3.loop.LoadFragDB">LoadFragDB() (in module promod3.loop)</a>
   </dt>
 
       
-  <dt><a href="loop/load_loop_objects.html#promod3.loop.LoadStructureDB">LoadStructureDB() (in module promod3.loop)</a>
+  <dt><a href="sidechain/loading.html#promod3.sidechain.LoadPenultimateLib">LoadPenultimateLib() (in module promod3.sidechain)</a>
   </dt>
 
   </dl></td>
   <td style="width: 33%" valign="top"><dl>
       
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.LoadPortable">LoadPortable() (promod3.loop.BackboneLoopScorer method)</a>
+  </dt>
+
+      <dd><dl>
+        
+  <dt><a href="loop/structure_db.html#promod3.loop.FragDB.LoadPortable">(promod3.loop.FragDB method)</a>
+  </dt>
+
+        
+  <dt><a href="loop/structure_db.html#promod3.loop.StructureDB.LoadPortable">(promod3.loop.StructureDB method)</a>
+  </dt>
+
+        
+  <dt><a href="loop/torsion_sampler.html#promod3.loop.TorsionSampler.LoadPortable">(promod3.loop.TorsionSampler method)</a>
+  </dt>
+
+        
+  <dt><a href="sidechain/rotamer_lib.html#promod3.sidechain.BBDepRotamerLib.LoadPortable">(promod3.sidechain.BBDepRotamerLib method)</a>
+  </dt>
+
+        
+  <dt><a href="sidechain/rotamer_lib.html#promod3.sidechain.RotamerLib.LoadPortable">(promod3.sidechain.RotamerLib method)</a>
+  </dt>
+
+      </dl></dd>
+      
+  <dt><a href="loop/load_loop_objects.html#promod3.loop.LoadStructureDB">LoadStructureDB() (in module promod3.loop)</a>
+  </dt>
+
+      
   <dt><a href="loop/load_loop_objects.html#promod3.loop.LoadTorsionSampler">LoadTorsionSampler() (in module promod3.loop)</a>
   </dt>
 
@@ -1319,6 +1516,10 @@
 
       </dl></dd>
       
+  <dt><a href="loop/structure_db.html#promod3.loop.FragDB.MaxFragLength">MaxFragLength() (promod3.loop.FragDB method)</a>
+  </dt>
+
+      
   <dt><a href="sidechain/rotamer.html#promod3.sidechain.FRMRotamerGroup.Merge">Merge() (promod3.sidechain.FRMRotamerGroup method)</a>
   </dt>
 
@@ -1339,6 +1540,10 @@
   </dt>
 
       
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.MinCADistance">MinCADistance() (promod3.loop.BackboneList method)</a>
+  </dt>
+
+      
   <dt><a href="modelling/index.html#promod3.modelling.MinimizeModelEnergy">MinimizeModelEnergy() (in module promod3.modelling)</a>
   </dt>
 
@@ -1351,9 +1556,20 @@
   </dt>
 
       
-  <dt><a href="loop/monte_carlo.html#promod3.loop.MonteCarloSampler">MonteCarloSampler() (in module promod3.loop)</a>
+  <dt><a href="modelling/index.html#promod3.modelling.ModelTermini">ModelTermini() (in module promod3.modelling)</a>
+  </dt>
+
+      
+  <dt>
+    module
+  </dt>
+
+      <dd><dl>
+        
+  <dt><a href="cmake/index.html#command:module"><strong>command</strong></a>
   </dt>
 
+      </dl></dd>
       
   <dt><a href="core/helper.html#promod3.core.helper.MsgErrorAndExit">MsgErrorAndExit() (in module promod3.core.helper)</a>
   </dt>
@@ -1530,6 +1746,17 @@
   <dt><a href="loop/helper_classes.html#promod3.loop.PsipredPrediction.PsipredPrediction">PsipredPrediction() (promod3.loop.PsipredPrediction method)</a>, <a href="loop/helper_classes.html#promod3.loop.PsipredPrediction.PsipredPrediction">[1]</a>
   </dt>
 
+      
+  <dt>
+    pymod
+  </dt>
+
+      <dd><dl>
+        
+  <dt><a href="cmake/index.html#command:pymod"><strong>command</strong></a>
+  </dt>
+
+      </dl></dd>
   </dl></td>
 </tr></table>
 
@@ -1553,6 +1780,10 @@
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%" valign="top"><dl>
       
+  <dt><a href="sidechain/loading.html#promod3.sidechain.ReadDunbrackFile">ReadDunbrackFile() (in module promod3.sidechain)</a>
+  </dt>
+
+      
   <dt><a href="sidechain/index.html#promod3.sidechain.Reconstruct">Reconstruct() (in module promod3.sidechain)</a>
   </dt>
 
@@ -1655,6 +1886,10 @@
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%" valign="top"><dl>
       
+  <dt><a href="loop/monte_carlo.html#promod3.loop.SampleMonteCarlo">SampleMonteCarlo() (in module promod3.loop)</a>
+  </dt>
+
+      
   <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.Save">Save() (promod3.loop.BackboneLoopScorer method)</a>
   </dt>
 
@@ -1664,6 +1899,10 @@
   </dt>
 
         
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerMap.Save">(promod3.loop.FraggerMap method)</a>
+  </dt>
+
+        
   <dt><a href="loop/structure_db.html#promod3.loop.StructureDB.Save">(promod3.loop.StructureDB method)</a>
   </dt>
 
@@ -1681,6 +1920,40 @@
 
       </dl></dd>
       
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerMap.SaveBB">SaveBB() (promod3.loop.FraggerMap method)</a>
+  </dt>
+
+      
+  <dt><a href="loop/structure_db.html#promod3.loop.FraggerHandle.SaveCached">SaveCached() (promod3.loop.FraggerHandle method)</a>
+  </dt>
+
+      
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.SavePortable">SavePortable() (promod3.loop.BackboneLoopScorer method)</a>
+  </dt>
+
+      <dd><dl>
+        
+  <dt><a href="loop/structure_db.html#promod3.loop.FragDB.SavePortable">(promod3.loop.FragDB method)</a>
+  </dt>
+
+        
+  <dt><a href="loop/structure_db.html#promod3.loop.StructureDB.SavePortable">(promod3.loop.StructureDB method)</a>
+  </dt>
+
+        
+  <dt><a href="loop/torsion_sampler.html#promod3.loop.TorsionSampler.SavePortable">(promod3.loop.TorsionSampler method)</a>
+  </dt>
+
+        
+  <dt><a href="sidechain/rotamer_lib.html#promod3.sidechain.BBDepRotamerLib.SavePortable">(promod3.sidechain.BBDepRotamerLib method)</a>
+  </dt>
+
+        
+  <dt><a href="sidechain/rotamer_lib.html#promod3.sidechain.RotamerLib.SavePortable">(promod3.sidechain.RotamerLib method)</a>
+  </dt>
+
+      </dl></dd>
+      
   <dt><a href="modelling/index.html#promod3.modelling.ScoringGapExtender">ScoringGapExtender (class in promod3.modelling)</a>
   </dt>
 
@@ -1793,15 +2066,15 @@
 
       </dl></dd>
       
-  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.SetPsipredPrediction">SetPsipredPrediction() (promod3.loop.BackboneLoopScorer method)</a>, <a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.SetPsipredPrediction">[1]</a>
+  <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.SetPsipredPrediction">SetPsipredPrediction() (promod3.loop.BackboneLoopScorer method)</a>
   </dt>
 
+  </dl></td>
+  <td style="width: 33%" valign="top"><dl>
       
   <dt><a href="loop/backbone.html#promod3.loop.BackboneList.SetPsiTorsion">SetPsiTorsion() (promod3.loop.BackboneList method)</a>
   </dt>
 
-  </dl></td>
-  <td style="width: 33%" valign="top"><dl>
       
   <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.SetReducedEnergy">SetReducedEnergy() (promod3.loop.BackboneLoopScorer method)</a>
   </dt>
@@ -1811,6 +2084,10 @@
   </dt>
 
       
+  <dt><a href="loop/backbone.html#promod3.loop.BackboneList.SetSequence">SetSequence() (promod3.loop.BackboneList method)</a>
+  </dt>
+
+      
   <dt><a href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer.SetSSAgreementParameters">SetSSAgreementParameters() (promod3.loop.BackboneLoopScorer method)</a>
   </dt>
 
@@ -1839,6 +2116,10 @@
   </dt>
 
       
+  <dt><a href="modelling/index.html#promod3.modelling.ShiftExtension">ShiftExtension (class in promod3.modelling)</a>
+  </dt>
+
+      
   <dt><a href="sidechain/rotamer.html#promod3.sidechain.SidechainParticle">SidechainParticle (class in promod3.sidechain)</a>
   </dt>
 
@@ -1875,7 +2156,7 @@
   </dt>
 
       
-  <dt><a href="loop/helper_classes.html#promod3.loop.LoopCandidate.ss_agreement">ss_agreement (promod3.loop.LoopCandidate attribute)</a>
+  <dt><a href="loop/helper_classes.html#promod3.loop.LoopCandidate.ss_agreement_score">ss_agreement_score (promod3.loop.LoopCandidate attribute)</a>
   </dt>
 
       
@@ -1977,7 +2258,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/gettingstarted.html b/doc/html/gettingstarted.html
index 65497cd39bef2ee2e4de5ad512438b76076960b8..3bb34410de394d731a94509e9920fb71d6aa1168 100644
--- a/doc/html/gettingstarted.html
+++ b/doc/html/gettingstarted.html
@@ -24,9 +24,9 @@
     <script type="text/javascript" src="_static/underscore.js"></script>
     <script type="text/javascript" src="_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="index.html" />
-    <link rel="up" title="Documentation For Developers" href="developers.html" />
-    <link rel="next" title="SetCompoundsChemlib()" href="core/setcompoundschemlib.html" />
-    <link rel="prev" title="Documentation For Developers" href="developers.html" />
+    <link rel="up" title="Documentation For Users" href="users.html" />
+    <link rel="next" title="Building ProMod3" href="buildsystem.html" />
+    <link rel="prev" title="Documentation For Users" href="users.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -45,9 +45,8 @@
 <h2>Get and Run ProMod3<a class="headerlink" href="#get-and-run-project" title="Permalink to this headline">¶</a></h2>
 <p>First steps to get ProMod3 up and running:</p>
 <ol class="arabic simple">
-<li>Get <a class="reference external" href="http://www.OpenStructure.org">OST</a>.</li>
-<li>Get ProMod3 from the <code class="docutils literal"><span class="pre">git</span></code> repository (see <a class="reference internal" href="contributing.html#git-branches"><span>here</span></a>).</li>
-<li>Compile ProMod3 with <code class="docutils literal"><span class="pre">cmake</span></code> and <code class="docutils literal"><span class="pre">make</span></code> (see <a class="reference internal" href="buildsystem.html#building-promod"><span>here</span></a>).</li>
+<li>Obtain all dependencies and compile ProMod3 with <code class="docutils literal"><span class="pre">cmake</span></code> and <code class="docutils literal"><span class="pre">make</span></code>
+(see <a class="reference internal" href="buildsystem.html#building-promod"><span>here</span></a>).</li>
 <li>Ensure that you have a <code class="docutils literal"><span class="pre">stage/bin</span></code> folder which includes a <code class="docutils literal"><span class="pre">pm</span></code> executable.
 For convenience, add the folder to your <code class="docutils literal"><span class="pre">PATH</span></code> env. variable.</li>
 <li>You can now execute ProMod3 by running the following in your terminal:</li>
@@ -82,7 +81,8 @@ can visualize with any pdb reader (e.g. <code class="docutils literal"><span cla
 Commonly, your input is a template structure and an alignment of the template to
 the desired target sequence. The modelling steps then are:</p>
 <ul class="simple">
-<li>Build a raw model from the template (see <a class="reference internal" href="modelling/index.html#promod3.modelling.BuildRawModel" title="promod3.modelling.BuildRawModel"><code class="xref py py-func docutils literal"><span class="pre">BuildRawModel()</span></code></a> function)</li>
+<li>Build a raw model from a template by copying the part of the template which
+is conserved</li>
 <li>Perform loop modelling to close all gaps (see <a class="reference internal" href="loop/index.html#module-promod3.loop" title="promod3.loop: Loop Modelling"><code class="xref py py-mod docutils literal"><span class="pre">loop</span></code></a> module)</li>
 <li>Reconstruct sidechains (see <a class="reference internal" href="sidechain/index.html#module-promod3.sidechain" title="promod3.sidechain: Sidechain Modelling"><code class="xref py py-mod docutils literal"><span class="pre">sidechain</span></code></a> module)</li>
 <li>Minimize energy of final model using molecular mechanics
@@ -109,9 +109,9 @@ the desired target sequence. The modelling steps then are:</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="index.html">Documentation overview</a><ul>
-  <li><a href="developers.html">Documentation For Developers</a><ul>
-      <li>Previous: <a href="developers.html" title="previous chapter">Documentation For Developers</a></li>
-      <li>Next: <a href="core/setcompoundschemlib.html" title="next chapter"><code class="docutils literal"><span class="pre">SetCompoundsChemlib()</span></code></a></li>
+  <li><a href="users.html">Documentation For Users</a><ul>
+      <li>Previous: <a href="users.html" title="previous chapter">Documentation For Users</a></li>
+      <li>Next: <a href="buildsystem.html" title="next chapter">Building ProMod3</a></li>
   </ul></li>
   </ul></li>
 </ul>
@@ -141,7 +141,7 @@ the desired target sequence. The modelling steps then are:</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/index.html b/doc/html/index.html
index 28bd056a97e9eb73296384240823e7d6c253ce81..7859807e00750da56b0f92576a9b33b2f160b172 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -42,26 +42,28 @@
 <p>Contents:</p>
 <div class="toctree-wrapper compound">
 <ul>
-<li class="toctree-l1"><a class="reference internal" href="users.html">Users</a></li>
-<li class="toctree-l1"><a class="reference internal" href="developers.html">Developers</a><ul>
+<li class="toctree-l1"><a class="reference internal" href="users.html">Users</a><ul>
 <li class="toctree-l2"><a class="reference internal" href="gettingstarted.html">Getting Started</a></li>
-<li class="toctree-l2"><a class="reference internal" href="core/setcompoundschemlib.html"><code class="docutils literal"><span class="pre">SetCompoundsChemlib()</span></code></a></li>
-<li class="toctree-l2"><a class="reference internal" href="core/index.html"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a></li>
+<li class="toctree-l2"><a class="reference internal" href="buildsystem.html">Building ProMod3</a></li>
 <li class="toctree-l2"><a class="reference internal" href="modelling/index.html"><code class="docutils literal"><span class="pre">modelling</span></code> - Protein Modelling</a></li>
 <li class="toctree-l2"><a class="reference internal" href="loop/index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a></li>
 <li class="toctree-l2"><a class="reference internal" href="sidechain/index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a></li>
-<li class="toctree-l2"><a class="reference internal" href="actions/index_dev.html"><code class="docutils literal"><span class="pre">test_actions</span></code> - Testing Actions</a></li>
-<li class="toctree-l2"><a class="reference internal" href="buildsystem.html">Building ProMod3</a></li>
+<li class="toctree-l2"><a class="reference internal" href="core/index.html"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a></li>
+<li class="toctree-l2"><a class="reference internal" href="core/setcompoundschemlib.html"><code class="docutils literal"><span class="pre">SetCompoundsChemlib()</span></code></a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="developers.html">Developers</a><ul>
 <li class="toctree-l2"><a class="reference internal" href="contributing.html">Contributing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="actions/index_dev.html"><code class="docutils literal"><span class="pre">test_actions</span></code> - Testing Actions</a></li>
 <li class="toctree-l2"><a class="reference internal" href="cmake/index.html">ProMod3&#8216;s Share Of CMake</a></li>
+<li class="toctree-l2"><a class="reference internal" href="portableIO.html">Using binary files in ProMod3</a></li>
 </ul>
 </li>
-<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="changelog.html#changes-in-release-0-1">Changes in Release 0.1</a></li>
-<li class="toctree-l2"><a class="reference internal" href="changelog.html#changes-in-release-0-2">Changes in Release 0.2</a></li>
-<li class="toctree-l2"><a class="reference internal" href="changelog.html#changes-in-release-0-3-to-be-released">Changes in Release 0.3 (to be released)</a></li>
 </ul>
-</li>
+</div>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
 </ul>
 </div>
 </div>
@@ -82,7 +84,9 @@
         <div class="sphinxsidebarwrapper">
   <h3><a href="#">Table Of Contents</a></h3>
   <ul>
-<li><a class="reference internal" href="#">Welcome To ProMod3&#8217;s Documentation!</a></li>
+<li><a class="reference internal" href="#">Welcome To ProMod3&#8217;s Documentation!</a><ul>
+</ul>
+</li>
 <li><a class="reference internal" href="#indices-and-tables">Indices And Tables</a></li>
 </ul>
 <div class="relations">
@@ -118,7 +122,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/backbone.html b/doc/html/loop/backbone.html
index 19ff85cd5815f86c83721950e103babc79b6224e..79febf095aa4e520c9e2410f704704953bbd796e 100644
--- a/doc/html/loop/backbone.html
+++ b/doc/html/loop/backbone.html
@@ -51,31 +51,31 @@ a residue. For simple structural manipulations they can be gathered to a
 
 <span class="n">sequence</span> <span class="o">=</span> <span class="s">&quot;AAAAAAAA&quot;</span>
 
-<span class="c">#The backbone gets initially constructed with backbone dihedrals</span>
-<span class="c">#typical for helices</span>
+<span class="c"># the backbone gets initially constructed with backbone dihedrals</span>
+<span class="c"># typical for helices</span>
 <span class="n">bb_list</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span>
 
-<span class="c">#let&#39;s have a look at the set dihedral angles</span>
+<span class="c"># let&#39;s have a look at the set dihedral angles</span>
 <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">)):</span>
-  <span class="k">print</span> <span class="s">&quot;Looking at position &quot;</span><span class="p">,</span><span class="n">i</span>
-  <span class="k">if</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
-    <span class="k">print</span> <span class="s">&quot;phi: &quot;</span><span class="p">,</span> <span class="n">bb_list</span><span class="o">.</span><span class="n">GetPhiTorsion</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
-  <span class="k">if</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
-    <span class="k">print</span> <span class="s">&quot;psi: &quot;</span><span class="p">,</span> <span class="n">bb_list</span><span class="o">.</span><span class="n">GetPsiTorsion</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;Looking at position </span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">i</span>
+    <span class="k">if</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;phi: </span><span class="si">%.4f</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">bb_list</span><span class="o">.</span><span class="n">GetPhiTorsion</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
+    <span class="k">if</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;psi: </span><span class="si">%.4f</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">bb_list</span><span class="o">.</span><span class="n">GetPsiTorsion</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
 
 
-<span class="c">#we now use a TorsionSampler to set random dihedral angles</span>
+<span class="c"># we now use a TorsionSampler to set random dihedral angles</span>
 <span class="n">torsion_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSampler</span><span class="p">()</span>
-<span class="n">idx</span> <span class="o">=</span> <span class="n">torsion_sampler</span><span class="o">.</span><span class="n">GetHistogramIndex</span><span class="p">(</span><span class="s">&quot;ALA&quot;</span><span class="p">,</span><span class="s">&quot;ALA&quot;</span><span class="p">,</span><span class="s">&quot;ALA&quot;</span><span class="p">)</span>
+<span class="n">idx</span> <span class="o">=</span> <span class="n">torsion_sampler</span><span class="o">.</span><span class="n">GetHistogramIndex</span><span class="p">(</span><span class="s">&quot;ALA&quot;</span><span class="p">,</span> <span class="s">&quot;ALA&quot;</span><span class="p">,</span> <span class="s">&quot;ALA&quot;</span><span class="p">)</span>
 <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">)):</span>
-  <span class="n">dihedrals</span> <span class="o">=</span> <span class="n">torsion_sampler</span><span class="o">.</span><span class="n">Draw</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
-  <span class="k">if</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
-    <span class="n">bb_list</span><span class="o">.</span><span class="n">SetPhiTorsion</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">dihedrals</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
-  <span class="k">if</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
-    <span class="n">bb_list</span><span class="o">.</span><span class="n">SetPsiTorsion</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">dihedrals</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
-
-<span class="c">#let&#39;s save down the randomized fragment</span>
-<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">bb_list</span><span class="o">.</span><span class="n">ToEntity</span><span class="p">(),</span><span class="s">&quot;randomized_fragment.pdb&quot;</span><span class="p">)</span>
+    <span class="n">dihedrals</span> <span class="o">=</span> <span class="n">torsion_sampler</span><span class="o">.</span><span class="n">Draw</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
+    <span class="k">if</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">bb_list</span><span class="o">.</span><span class="n">SetPhiTorsion</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">dihedrals</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+    <span class="k">if</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">bb_list</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+        <span class="n">bb_list</span><span class="o">.</span><span class="n">SetPsiTorsion</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">dihedrals</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+
+<span class="c"># let&#39;s save down the randomized fragment</span>
+<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">bb_list</span><span class="o">.</span><span class="n">ToEntity</span><span class="p">(),</span> <span class="s">&quot;randomized_fragment.pdb&quot;</span><span class="p">)</span>
 </pre></div>
 </div>
 <div class="section" id="the-basic-building-blocks">
@@ -260,17 +260,18 @@ torsion angles.</p>
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
 <li><strong>sequence</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Sequence of created BackboneList</li>
-<li><strong>dihedral_angles</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>) &#8211; List of <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code> objects defining the backbone dihedral
-angles of created BackboneList. Every <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code> must
-either have two or three elements. Two elements are considered
-to define the phi and psi angles, leading to an idealized omega
-angle of 180 degrees. In case of three elements, all angles
-are defined.</li>
+<li><strong>dihedral_angles</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>) &#8211; List of <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code> objects defining the backbone
+dihedral angles of created BackboneList. Every
+<code class="xref py py-class docutils literal"><span class="pre">tuple</span></code> must either have two or three
+elements. Two elements are considered to define the
+phi and psi angles, leading to an idealized omega
+angle of 180 degrees. In case of three elements, all
+angles are defined.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If <strong>sequence</strong> and <strong>dihedral_angles</strong>
-are inconsistent in size.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>sequence</strong> and
+<strong>dihedral_angles</strong> are inconsistent in size.</p>
 </td>
 </tr>
 </tbody>
@@ -293,9 +294,9 @@ backbone positions are extracted.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If <strong>sequence</strong> and <strong>residues</strong>
-are inconsistent in size or when there is a residue not
-providing all necessary positions.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>sequence</strong> and
+<strong>residues</strong> are inconsistent in size or when there is
+a residue not providing all necessary positions.</p>
 </td>
 </tr>
 </tbody>
@@ -331,9 +332,47 @@ providing all necessary positions.</p>
 </table>
 </dd></dl>
 
+<dl class="method">
+<dt id="promod3.loop.BackboneList.SetSequence">
+<code class="descname">SetSequence</code><span class="sig-paren">(</span><em>sequence</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetSequence" title="Permalink to this definition">¶</a></dt>
+<dd><p>Set amino acid sequence.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneList.Extract">
+<code class="descname">Extract</code><span class="sig-paren">(</span><em>from</em>, <em>to</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.Extract" title="Permalink to this definition">¶</a></dt>
+<dd><table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Items with indices <em>from</em>, ..., <em>to</em>-1 of this list.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneList.MinCADistance">
+<code class="descname">MinCADistance</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.MinCADistance" title="Permalink to this definition">¶</a></dt>
+<dd><p>Calculates the minimal pairwise CA-distance between this and the <em>other</em>
+<a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>other</strong> (<a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>) &#8211; The other <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Minimal pairwise CA-distance</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
 <dl class="method">
 <dt id="promod3.loop.BackboneList.InsertInto">
-<code class="descname">InsertInto</code><span class="sig-paren">(</span><em>chain</em>, <em>start_resnum</em><span class="optional">[</span>, <em>remodel_cterminal_o = True</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.InsertInto" title="Permalink to this definition">¶</a></dt>
+<code class="descname">InsertInto</code><span class="sig-paren">(</span><em>chain</em>, <em>start_resnum</em>, <em>remodel_cterminal_o=True</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.InsertInto" title="Permalink to this definition">¶</a></dt>
 <dd><p>Inserts the backbone list into the <strong>chain</strong>. If the residues corresponding
 to the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> are already present in the entity, they will
 be replaced, otherwise they will be added to the entity.</p>
@@ -366,7 +405,7 @@ n, ca, and c positions.</p>
 
 <dl class="method">
 <dt id="promod3.loop.BackboneList.ReconstructOxygenPositions">
-<code class="descname">ReconstructOxygenPositions</code><span class="sig-paren">(</span><span class="optional">[</span><em>last_psi = -0.78540</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.ReconstructOxygenPositions" title="Permalink to this definition">¶</a></dt>
+<code class="descname">ReconstructOxygenPositions</code><span class="sig-paren">(</span><em>last_psi=-0.78540</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.ReconstructOxygenPositions" title="Permalink to this definition">¶</a></dt>
 <dd><p>Does a simple reconstruction of all oxygen positions based on the actual
 n, ca and c positions. The position of the last oxygen depends on the next
 residue, an additional parameter is therefore required.</p>
@@ -383,27 +422,13 @@ the default value corresponds to a typical alpha-helix</td>
 
 <dl class="method">
 <dt id="promod3.loop.BackboneList.ApplyTransform">
-<code class="descname">ApplyTransform</code><span class="sig-paren">(</span><em>transformation_matrix</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.ApplyTransform" title="Permalink to this definition">¶</a></dt>
-<dd><p>Applies a transformation to the positions of the the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>.</p>
-<table class="docutils field-list" frame="void" rules="none">
-<col class="field-name" />
-<col class="field-body" />
-<tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>transformation_matrix</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/geom/mat/#ost.geom.Mat4" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.geom.Mat4</span></code></a>) &#8211; The transformation</td>
-</tr>
-</tbody>
-</table>
-</dd></dl>
-
-<dl class="method">
-<dt>
-<code class="descname">ApplyTransform</code><span class="sig-paren">(</span><em>transform</em><span class="sig-paren">)</span></dt>
-<dd><p>Applies a transformation to the positions of the the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>.</p>
+<code class="descname">ApplyTransform</code><span class="sig-paren">(</span><em>transform</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.ApplyTransform" title="Permalink to this definition">¶</a></dt>
+<dd><p>Applies a transformation to the positions of the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>transform</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.geom.Transform</span></code>) &#8211; The transformation</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>transform</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.geom.Transform</span></code> / <a class="reference external" href="http://www.openstructure.org/docs/1.3/geom/mat/#ost.geom.Mat4" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.geom.Mat4</span></code></a>) &#8211; The transformation</td>
 </tr>
 </tbody>
 </table>
@@ -411,7 +436,7 @@ the default value corresponds to a typical alpha-helix</td>
 
 <dl class="method">
 <dt id="promod3.loop.BackboneList.SetPhiTorsion">
-<code class="descname">SetPhiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em><span class="optional">[</span>, <em>sequential=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetPhiTorsion" title="Permalink to this definition">¶</a></dt>
+<code class="descname">SetPhiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em>, <em>sequential=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetPhiTorsion" title="Permalink to this definition">¶</a></dt>
 <dd><p>Sets the <em>phi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -430,7 +455,7 @@ the default value corresponds to a typical alpha-helix</td>
 
 <dl class="method">
 <dt id="promod3.loop.BackboneList.SetPsiTorsion">
-<code class="descname">SetPsiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em><span class="optional">[</span>, <em>sequential=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetPsiTorsion" title="Permalink to this definition">¶</a></dt>
+<code class="descname">SetPsiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em>, <em>sequential=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetPsiTorsion" title="Permalink to this definition">¶</a></dt>
 <dd><p>Sets the <em>psi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -449,7 +474,7 @@ the default value corresponds to a typical alpha-helix</td>
 
 <dl class="method">
 <dt id="promod3.loop.BackboneList.SetOmegaTorsion">
-<code class="descname">SetOmegaTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em><span class="optional">[</span>, <em>sequential=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetOmegaTorsion" title="Permalink to this definition">¶</a></dt>
+<code class="descname">SetOmegaTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em>, <em>sequential=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetOmegaTorsion" title="Permalink to this definition">¶</a></dt>
 <dd><p>Sets the <em>omega</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -468,7 +493,7 @@ the default value corresponds to a typical alpha-helix</td>
 
 <dl class="method">
 <dt id="promod3.loop.BackboneList.SetPhiPsiTorsion">
-<code class="descname">SetPhiPsiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>phi</em>, <em>psi</em><span class="optional">[</span>, <em>sequential=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetPhiPsiTorsion" title="Permalink to this definition">¶</a></dt>
+<code class="descname">SetPhiPsiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>phi</em>, <em>psi</em>, <em>sequential=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.SetPhiPsiTorsion" title="Permalink to this definition">¶</a></dt>
 <dd><p>Sets the <em>phi</em> and <em>psi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -487,74 +512,58 @@ the default value corresponds to a typical alpha-helix</td>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.BackboneList.RotateAroundPhiTorsion">
-<code class="descname">RotateAroundPhiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em><span class="optional">[</span>, <em>sequential=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RotateAroundPhiTorsion" title="Permalink to this definition">¶</a></dt>
-<dd><p>Rotates the <em>phi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by <strong>angle</strong>.</p>
+<dt id="promod3.loop.BackboneList.GetPhiTorsion">
+<code class="descname">GetPhiTorsion</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.GetPhiTorsion" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get the <em>phi</em> torsion angle of the residue with <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
-<li><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index of the residue in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> for which the angle should be set.</li>
-<li><strong>angle</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The angle</li>
-<li><strong>sequential</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; If <em>True</em>, the rotation will be propagated to all residues after the one with <strong>index</strong>. Otherwise it will be propagated in the direction where it will affect the least number of residues.</li>
-</ul>
-</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index</td>
 </tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.BackboneList.RotateAroundPsiTorsion">
-<code class="descname">RotateAroundPsiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em><span class="optional">[</span>, <em>sequential=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RotateAroundPsiTorsion" title="Permalink to this definition">¶</a></dt>
-<dd><p>Rotates the <em>psi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by <strong>angle</strong>.</p>
+<dt id="promod3.loop.BackboneList.GetPsiTorsion">
+<code class="descname">GetPsiTorsion</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.GetPsiTorsion" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get the <em>psi</em> torsion angle of the residue with <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
-<li><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index of the residue in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> for which the angle should be set.</li>
-<li><strong>angle</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The angle</li>
-<li><strong>sequential</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; If <em>True</em>, the rotation will be propagated to all residues after the one with <strong>index</strong>. Otherwise it will be propagated in the direction where it will affect the least number of residues.</li>
-</ul>
-</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index</td>
 </tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.BackboneList.RotateAroundOmegaTorsion">
-<code class="descname">RotateAroundOmegaTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em><span class="optional">[</span>, <em>sequential=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RotateAroundOmegaTorsion" title="Permalink to this definition">¶</a></dt>
-<dd><p>Rotates the <em>omega</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by <strong>angle</strong>.</p>
+<dt id="promod3.loop.BackboneList.GetOmegaTorsion">
+<code class="descname">GetOmegaTorsion</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.GetOmegaTorsion" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get the <em>omega</em> torsion angle of the residue with <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
-<li><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index of the residue in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> for which the angle should be set.</li>
-<li><strong>angle</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The angle</li>
-<li><strong>sequential</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; If <em>True</em>, the rotation will be propagated to all residues after the one with <strong>index</strong>. Otherwise it will be propagated in the direction where it will affect the least number of residues.</li>
-</ul>
-</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index</td>
 </tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.BackboneList.RotateAroundPhiPsiTorsion">
-<code class="descname">RotateAroundPhiPsiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>phi</em>, <em>psi</em><span class="optional">[</span>, <em>sequential=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RotateAroundPhiPsiTorsion" title="Permalink to this definition">¶</a></dt>
-<dd><p>Rotates the <em>phi</em> and <em>psi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by <strong>phi</strong> and <strong>psi</strong>.</p>
+<dt id="promod3.loop.BackboneList.RotateAroundPhiTorsion">
+<code class="descname">RotateAroundPhiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em>, <em>sequential=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RotateAroundPhiTorsion" title="Permalink to this definition">¶</a></dt>
+<dd><p>Rotates the <em>phi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by <strong>angle</strong>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
 <li><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index of the residue in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> for which the angle should be set.</li>
-<li><strong>phi</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The phi angle</li>
-<li><strong>psi</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The psi angle</li>
+<li><strong>angle</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The angle</li>
 <li><strong>sequential</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; If <em>True</em>, the rotation will be propagated to all residues after the one with <strong>index</strong>. Otherwise it will be propagated in the direction where it will affect the least number of residues.</li>
 </ul>
 </td>
@@ -564,42 +573,58 @@ the default value corresponds to a typical alpha-helix</td>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.BackboneList.GetPhiTorsion">
-<code class="descname">GetPhiTorsion</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.GetPhiTorsion" title="Permalink to this definition">¶</a></dt>
-<dd><p>Get the <em>phi</em> torsion angle of the residue with <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></p>
+<dt id="promod3.loop.BackboneList.RotateAroundPsiTorsion">
+<code class="descname">RotateAroundPsiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em>, <em>sequential=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RotateAroundPsiTorsion" title="Permalink to this definition">¶</a></dt>
+<dd><p>Rotates the <em>psi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by <strong>angle</strong>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index of the residue in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> for which the angle should be set.</li>
+<li><strong>angle</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The angle</li>
+<li><strong>sequential</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; If <em>True</em>, the rotation will be propagated to all residues after the one with <strong>index</strong>. Otherwise it will be propagated in the direction where it will affect the least number of residues.</li>
+</ul>
+</td>
 </tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.BackboneList.GetPsiTorsion">
-<code class="descname">GetPsiTorsion</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.GetPsiTorsion" title="Permalink to this definition">¶</a></dt>
-<dd><p>Get the <em>psi</em> torsion angle of the residue with <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></p>
+<dt id="promod3.loop.BackboneList.RotateAroundOmegaTorsion">
+<code class="descname">RotateAroundOmegaTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>angle</em>, <em>sequential=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RotateAroundOmegaTorsion" title="Permalink to this definition">¶</a></dt>
+<dd><p>Rotates the <em>omega</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by <strong>angle</strong>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index of the residue in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> for which the angle should be set.</li>
+<li><strong>angle</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The angle</li>
+<li><strong>sequential</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; If <em>True</em>, the rotation will be propagated to all residues after the one with <strong>index</strong>. Otherwise it will be propagated in the direction where it will affect the least number of residues.</li>
+</ul>
+</td>
 </tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.BackboneList.GetOmegaTorsion">
-<code class="descname">GetOmegaTorsion</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.GetOmegaTorsion" title="Permalink to this definition">¶</a></dt>
-<dd><p>Get the <em>omega</em> torsion angle of the residue with <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></p>
+<dt id="promod3.loop.BackboneList.RotateAroundPhiPsiTorsion">
+<code class="descname">RotateAroundPhiPsiTorsion</code><span class="sig-paren">(</span><em>index</em>, <em>phi</em>, <em>psi</em>, <em>sequential=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RotateAroundPhiPsiTorsion" title="Permalink to this definition">¶</a></dt>
+<dd><p>Rotates the <em>phi</em> and <em>psi</em> torsion angle of the backbone at position <strong>index</strong> in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by <strong>phi</strong> and <strong>psi</strong>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The index of the residue in the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> for which the angle should be set.</li>
+<li><strong>phi</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The phi angle</li>
+<li><strong>psi</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The psi angle</li>
+<li><strong>sequential</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; If <em>True</em>, the rotation will be propagated to all residues after the one with <strong>index</strong>. Otherwise it will be propagated in the direction where it will affect the least number of residues.</li>
+</ul>
+</td>
 </tr>
 </tbody>
 </table>
@@ -608,7 +633,8 @@ the default value corresponds to a typical alpha-helix</td>
 <dl class="method">
 <dt id="promod3.loop.BackboneList.ReplaceFragment">
 <code class="descname">ReplaceFragment</code><span class="sig-paren">(</span><em>sub_fragment</em>, <em>index</em>, <em>superpose_stems</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.ReplaceFragment" title="Permalink to this definition">¶</a></dt>
-<dd><p>Replaces a fragment of the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> starting at position <strong>index</strong> by the <strong>sub_fragment</strong>.</p>
+<dd><p>Replaces a fragment of the <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> starting at position
+<strong>index</strong> by the <strong>sub_fragment</strong>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -626,9 +652,9 @@ stems using the positions at <strong>index</strong> and
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If <strong>sub_fragment</strong>
-does not fully fit into actual fragment at
-specified <strong>index</strong></p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if
+<strong>sub_fragment</strong> does not fully fit into
+actual fragment at specified <strong>index</strong></p>
 </td>
 </tr>
 </tbody>
@@ -637,7 +663,7 @@ specified <strong>index</strong></p>
 
 <dl class="method">
 <dt id="promod3.loop.BackboneList.CARMSD">
-<code class="descname">CARMSD</code><span class="sig-paren">(</span><em>other</em><span class="optional">[</span>, <em>superposed_rmsd=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.CARMSD" title="Permalink to this definition">¶</a></dt>
+<code class="descname">CARMSD</code><span class="sig-paren">(</span><em>other</em>, <em>superposed_rmsd=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.CARMSD" title="Permalink to this definition">¶</a></dt>
 <dd><p>Calculates the C-alpha RMSD between this <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> and an <strong>other</strong> backbone list.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -655,7 +681,7 @@ specified <strong>index</strong></p>
 
 <dl class="method">
 <dt id="promod3.loop.BackboneList.RMSD">
-<code class="descname">RMSD</code><span class="sig-paren">(</span><em>other</em><span class="optional">[</span>, <em>superposed_rmsd=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RMSD" title="Permalink to this definition">¶</a></dt>
+<code class="descname">RMSD</code><span class="sig-paren">(</span><em>other</em>, <em>superposed_rmsd=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.RMSD" title="Permalink to this definition">¶</a></dt>
 <dd><p>Calculates the RMSD between this <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> and an <strong>other</strong> backbone list.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -685,6 +711,24 @@ specified <strong>index</strong></p>
 </table>
 </dd></dl>
 
+<dl class="method">
+<dt id="promod3.loop.BackboneList.GetTransform">
+<code class="descname">GetTransform</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.GetTransform" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get transofrm to superpose this <a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> onto another one</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>other</strong> (<a class="reference internal" href="#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>) &#8211; The other backbone list</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A 4x4 transformation matrix</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="http://www.openstructure.org/docs/1.3/geom/mat/#ost.geom.Mat4" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.geom.Mat4</span></code></a></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
 <dl class="method">
 <dt id="promod3.loop.BackboneList.append">
 <code class="descname">append</code><span class="sig-paren">(</span><em>bb</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.append" title="Permalink to this definition">¶</a></dt>
@@ -699,6 +743,33 @@ specified <strong>index</strong></p>
 </table>
 </dd></dl>
 
+<dl class="method">
+<dt id="promod3.loop.BackboneList.__getitem__">
+<code class="descname">__getitem__</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.__getitem__" title="Permalink to this definition">¶</a></dt>
+<dt id="promod3.loop.BackboneList.__setitem__">
+<code class="descname">__setitem__</code><span class="sig-paren">(</span><em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.__setitem__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Allow read/write access (with [<em>index</em>]) to backbone at given <em>index</em>.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneList.__iter__">
+<code class="descname">__iter__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.__iter__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Makes list iterable.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneList.__len__">
+<code class="descname">__len__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneList.__len__" title="Permalink to this definition">¶</a></dt>
+<dd><table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Number of backbones in the list.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
 </dd></dl>
 
 </div>
@@ -722,7 +793,7 @@ specified <strong>index</strong></p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
       <li>Previous: <a href="index.html" title="previous chapter"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a></li>
       <li>Next: <a href="torsion_sampler.html" title="next chapter">Torsion Sampler</a></li>
@@ -756,7 +827,7 @@ specified <strong>index</strong></p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/backbone_loop_score.html b/doc/html/loop/backbone_loop_score.html
index d5c2310d906ad640c29ec18bc72736a171d2b464..8587dd806d60059f379c417c57013314d13a13f2 100644
--- a/doc/html/loop/backbone_loop_score.html
+++ b/doc/html/loop/backbone_loop_score.html
@@ -41,45 +41,291 @@
             
   <div class="section" id="loop-scoring">
 <h1>Loop Scoring<a class="headerlink" href="#loop-scoring" title="Permalink to this headline">¶</a></h1>
-<p>ProMod3 provides several terms to assess a loop conformations plausibility.
-This is done using the <a class="reference internal" href="#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a>. To be used, the scorer
-must be initialized with a seqres. After initialization the structural
-environment can be set. This environment defines the particles a certain
-loop interacts with and can be reset/extended at any time in the modelling
-process. All values of the different scores can be set manually. Once the
-scores are set, the scorer can be saved/loaded from/to disk.
-Some of the available scores are statistical potential based.
-When setting up an empty scorer, the parametrization and the score values
-of these potentials have to be set manually.</p>
 <div class="section" id="the-backboneloopscorer">
 <h2>The BackboneLoopScorer<a class="headerlink" href="#the-backboneloopscorer" title="Permalink to this headline">¶</a></h2>
+<p>The <a class="reference internal" href="#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a> provides several terms to assess a
+loop conformations plausibility. All values of the different scores
+can be set manually. Once the scores are set, the scorer can be
+saved/loaded from/to disk. Setting the scores can be avoided by
+just loading the default scorer, which should satisfy most needs.
+To be used, the scorer must be initialized with a seqres.
+After initialization the structural environment can be set.
+This environment defines the particles a certain loop interacts with
+and can be reset/extended at any time in the modelling process.
+To score a certain loop you must define its exact location in the
+environment using a <em>chain_idx</em> and <em>start_resnum</em>:</p>
+<ul>
+<li><dl class="first docutils">
+<dt><em>chain_idx</em>:</dt>
+<dd><p class="first last">Index of chain as it occurs in the sequence list you initialized
+the scorer with (0 in case of a single sequence)</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><em>start_resnum</em>:</dt>
+<dd><p class="first last">Residue number defining the position in the SEQRES of chain with
+index <em>chain_idx</em>. <strong>The numbering starts for every chain with
+the value 1</strong>.</p>
+</dd>
+</dl>
+</li>
+</ul>
+<p>The following scores are available:</p>
+<ul>
+<li><dl class="first docutils">
+<dt><strong>ClashScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateClashScore" title="promod3.loop.BackboneLoopScorer.CalculateClashScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateClashScore()</span></code></a>)</dt>
+<dd><p class="first last">Calculates a simple clash score of a loop itself and with the set
+environment. There is no need to define any parameters if you start with an
+empty scorer.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>CBetaScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateCBetaScore" title="promod3.loop.BackboneLoopScorer.CalculateCBetaScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateCBetaScore()</span></code></a>)</dt>
+<dd><p class="first last">Evaluates a pairwise pseudo interaction energy between CB atoms. If you
+start with an empty scorer you need to parametrize the energy function by
+calling <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetCBetaPotentialParameters" title="promod3.loop.BackboneLoopScorer.SetCBetaPotentialParameters"><code class="xref py py-func docutils literal"><span class="pre">SetCBetaPotentialParameters()</span></code></a>. You can
+then set an energy value for every possible pair of residues given the
+distance of their CB atoms (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetCBetaEnergy" title="promod3.loop.BackboneLoopScorer.SetCBetaEnergy"><code class="xref py py-func docutils literal"><span class="pre">SetCBetaEnergy()</span></code></a>).
+Every pairwise interaction within the loop and to the environment gets
+evaluated according to the given parametrization, summed up and finally
+normalized by the number of total interactions.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>ReducedScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateReducedScore" title="promod3.loop.BackboneLoopScorer.CalculateReducedScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateReducedScore()</span></code></a>)</dt>
+<dd><p class="first">Evaluates a pairwise pseudo  interaction energy between the reduced
+representation of residues. Every residue gets represented by its CA
+position p and a directional component <code class="docutils literal"><span class="pre">v</span> <span class="pre">=</span> <span class="pre">norm(ca_pos-n_pos)</span> <span class="pre">+</span> <span class="pre">norm</span>
+<span class="pre">(ca_pos-c_pos)</span></code>. Assuming an interaction between residues r1 and r2, we can
+define a line l between p1 and p2. The potential then considers:</p>
+<ul class="simple">
+<li>dist =&gt; distance between p1 and p2</li>
+<li>alpha =&gt; angle between v1 and l</li>
+<li>beta =&gt; angle between v2 and l</li>
+<li>gamma =&gt; dihedral between (p1+v1,p1,p2,p2+v2)</li>
+</ul>
+<p class="last">If you start with an empty scorer you need to parametrize the energy
+function by calling
+<a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetReducedPotentialParameters" title="promod3.loop.BackboneLoopScorer.SetReducedPotentialParameters"><code class="xref py py-func docutils literal"><span class="pre">SetReducedPotentialParameters()</span></code></a>. You can then set
+an energy value for every possible pair of residues given the distance of
+their CA atoms and the according angles (see
+<a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetReducedEnergy" title="promod3.loop.BackboneLoopScorer.SetReducedEnergy"><code class="xref py py-func docutils literal"><span class="pre">SetReducedEnergy()</span></code></a>). Every pairwise interaction
+within the loop and to the environment gets evaluated according to the given
+parametrization, summed up and finally normalized by the number of total
+interactions.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>TorsionScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateTorsionScore" title="promod3.loop.BackboneLoopScorer.CalculateTorsionScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateTorsionScore()</span></code></a>)</dt>
+<dd><p class="first last">Evaluates pseudo energies based on the identity of three consecutive
+residues and the phi/psi dihedral angles of the central residue. The group
+definitions are the same as they are used in the <a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>. If
+you start with an empty scorer you need to parametrize the energy function
+by calling <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetTorsionPotentialParameters" title="promod3.loop.BackboneLoopScorer.SetTorsionPotentialParameters"><code class="xref py py-func docutils literal"><span class="pre">SetTorsionPotentialParameters()</span></code></a>. You
+can then set an energy value for every possible torsion group and dihedral
+angle pair (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetTorsionEnergy" title="promod3.loop.BackboneLoopScorer.SetTorsionEnergy"><code class="xref py py-func docutils literal"><span class="pre">SetTorsionEnergy()</span></code></a>). Every residue
+gets evaluated according to the set parametrization and the final score gets
+normalized by the total number of summed pseudo energies. The first phi and
+last psi angle get determined with the help of the environment if set.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>CBPackingScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateCBPackingScore" title="promod3.loop.BackboneLoopScorer.CalculateCBPackingScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateCBPackingScore()</span></code></a>)</dt>
+<dd><p class="first last">Evaluates pseudo energies by counting the number of other CB positions
+within a certain cutoff radius of the CB position of the residue to be
+evaluated. If you start with an empty scorer you need to parametrize the
+energy function by calling
+<a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetCBPackingPotentialParameters" title="promod3.loop.BackboneLoopScorer.SetCBPackingPotentialParameters"><code class="xref py py-func docutils literal"><span class="pre">SetCBPackingPotentialParameters()</span></code></a>. You can then
+set an energy value for every possible residue type and the corresponding
+number of surrounding CB positions (see
+<a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetCBPackingEnergy" title="promod3.loop.BackboneLoopScorer.SetCBPackingEnergy"><code class="xref py py-func docutils literal"><span class="pre">SetCBPackingEnergy()</span></code></a>). Every residue gets
+evaluated according to the set parametrization and the final score gets
+normalized by the number of residues in the loop.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>HBondScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateHBondScore" title="promod3.loop.BackboneLoopScorer.CalculateHBondScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateHBondScore()</span></code></a>)</dt>
+<dd><p class="first">Evaluates pairwise HBond pseudo energies similar to the one defined in the
+Rosetta energy function. It considers the CA, C and O positions from
+backbone hbond acceptors in interaction with the N and H positions from the
+backbone hbond donors. 4 Parameters describe their relative orientation.</p>
+<ul class="simple">
+<li>dist =&gt; H-O distance</li>
+<li>alpha =&gt; O-H-N angle</li>
+<li>beta =&gt; C-N-H angle</li>
+<li>gamma =&gt; CA-C-O-H dihedral angle</li>
+</ul>
+<p class="last">A pseudo energy function for these parameters is evaluated for three
+different states. State 1 for helical residues, state 2 for extended
+residues and state 0 for other residues. If the state of two interacting
+particles is the same, thats the one from which the energy is extracted. In
+all other cases, the energy is extracted from the 0 state. If you start with
+an empty scorer you need to parametrize the energy function by calling
+<a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetHBondPotentialParameters" title="promod3.loop.BackboneLoopScorer.SetHBondPotentialParameters"><code class="xref py py-func docutils literal"><span class="pre">SetHBondPotentialParameters()</span></code></a>. You can then set an
+energy value for every possible state and the according parameters (see
+<a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetHBondEnergy" title="promod3.loop.BackboneLoopScorer.SetHBondEnergy"><code class="xref py py-func docutils literal"><span class="pre">SetHBondEnergy()</span></code></a>). Every pairwise interaction
+within the loop and to the environment gets evaluated according to the given
+parametrization, summed up and finally normalized by the number of total
+interactions.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>SSAgreementScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateSSAgreementScore" title="promod3.loop.BackboneLoopScorer.CalculateSSAgreementScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateSSAgreementScore()</span></code></a>)</dt>
+<dd><p class="first last">Evaluates an SSAgreement score. Despite no parameters being given,
+<a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SetSSAgreementParameters" title="promod3.loop.BackboneLoopScorer.SetSSAgreementParameters"><code class="xref py py-func docutils literal"><span class="pre">SetSSAgreementParameters()</span></code></a> has to be called before
+you can set any SSAgreement scores (see
+<code class="xref py py-func docutils literal"><span class="pre">SetSSAgreementScore()</span></code>) since the memory has to be
+allocated internally. The SSAgreement score itself relates a score to a
+certain combination of psipred prediction, its confidence and the actually
+occurring secondary structure in the model. In every score evaluation, the
+secondary structure of the loop is estimated by searching for hydrogen bonds
+leading to a secondary structure as defined by dssp. The hbonds are searched
+internally in the loop as well as in the environment. Before you can call
+the scoring function, you have to set the psipred prediction in the scorer.
+The final score gets summed up over all residues in the loop and normalized
+by the number of residues.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>ContactScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateContactScore" title="promod3.loop.BackboneLoopScorer.CalculateContactScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateContactScore()</span></code></a>)</dt>
+<dd><p class="first last">Evaluates contacts with the environment and within the loop itself. You can
+set arbitrary contact functions. They are defined by a score that gets
+added when the CB atoms of two specific residues are within a maximal
+distance. When evaluating a loop, the results of all contact functions
+towards the environment get added as well as the loop internal contacts. The
+returned value gets then normalized by the number of residues in the loop.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>ConstraintScore:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.CalculateConstraintScore" title="promod3.loop.BackboneLoopScorer.CalculateConstraintScore"><code class="xref py py-func docutils literal"><span class="pre">CalculateConstraintScore()</span></code></a>)</dt>
+<dd><p class="first last">Evaluates constraints with the environment and within the loop itself. You
+can set arbitrary constraint functions. They are defined by a min and max
+distance and an arbitrary list of score values. If the distance between the
+CB atoms of two specific residues is within the min and max distance, the
+constraint function returns the value at the according position in the score
+list assuming equidistant binning. When evaluating a loop, the results of
+all constraint functions towards the environment get added as well as the
+loop internal constraints. The returned value gets then normalized by the
+number of residues in the loop.</p>
+</dd>
+</dl>
+</li>
+<li><dl class="first docutils">
+<dt><strong>TransOmegaTorsion:</strong> (see <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.TransOmegaTorsions" title="promod3.loop.BackboneLoopScorer.TransOmegaTorsions"><code class="xref py py-func docutils literal"><span class="pre">TransOmegaTorsions()</span></code></a>)</dt>
+<dd><p class="first last">Does not really return a score but rather a boolean value. It evaluates,
+whether there are any unfavorable trans omega torsion angles in the loop. If
+you wish you can decide, whether you want to allow pre-proline trans omega
+torsions.</p>
+</dd>
+</dl>
+</li>
+</ul>
 <dl class="class">
 <dt id="promod3.loop.BackboneLoopScorer">
 <em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">BackboneLoopScorer</code><a class="headerlink" href="#promod3.loop.BackboneLoopScorer" title="Permalink to this definition">¶</a></dt>
 <dd><dl class="method">
+<dt id="promod3.loop.BackboneLoopScorer.Load">
+<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.Load" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads raw binary file generated with <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.Save" title="promod3.loop.BackboneLoopScorer.Save"><code class="xref py py-meth docutils literal"><span class="pre">Save()</span></code></a> (optimized for fast
+reading).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the scorer will be loaded from.</p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A scorer</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>file assumes different memory-layout than is available on this
+machine. Use <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.LoadPortable" title="promod3.loop.BackboneLoopScorer.LoadPortable"><code class="xref py py-meth docutils literal"><span class="pre">LoadPortable()</span></code></a> to convert your file.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.Save">
 <code class="descname">Save</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.Save" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Saves raw binary representation (optimized for fast reading).This puts many
+assumptions on the memory-layout of the target-machine and hence it is not
+portable. A portable version is provided by <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SavePortable" title="promod3.loop.BackboneLoopScorer.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a>.
+Preferably portable files are distributed and converted to a raw binary
+before using them.</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the scorer will be dumped into.
 All model specific information is lost.</td>
 </tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.BackboneLoopScorer.Load">
-<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.Load" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dt id="promod3.loop.BackboneLoopScorer.LoadPortable">
+<code class="descname">LoadPortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.LoadPortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads portable file generated with <a class="reference internal" href="#promod3.loop.BackboneLoopScorer.SavePortable" title="promod3.loop.BackboneLoopScorer.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a> (slow but less
+machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the scorer will be loaded from.</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the scorer will be loaded from.</p>
+</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if file doesn&#8217;t exist</td>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A scorer</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>machine-dependent fundamental types are smaller than required.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneLoopScorer.SavePortable">
+<code class="descname">SavePortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.SavePortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves portable binary representation (slow but less machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the scorer will be dumped into.
+All model specific information is lost.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
 </tr>
 </tbody>
 </table>
@@ -88,9 +334,7 @@ All model specific information is lost.</td>
 <dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.SetCBetaPotentialParameters">
 <code class="descname">SetCBetaPotentialParameters</code><span class="sig-paren">(</span><em>cbeta_cutoff</em>, <em>cbeta_bins</em>, <em>cbeta_seq_sep</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.SetCBetaPotentialParameters" title="Permalink to this definition">¶</a></dt>
-<dd><p>Parametrizes a pairwise distance dependent statistical potential considering
-pairwise distances between cbeta atoms.</p>
-<table class="docutils field-list" frame="void" rules="none">
+<dd><table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
@@ -104,7 +348,7 @@ have to be considered</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <em>cbeta_cutoff</em> is negative or
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <em>cbeta_cutoff</em> is negative or
 <em>cbeta_bins</em> is &lt;= 0</p>
 </td>
 </tr>
@@ -115,18 +359,7 @@ have to be considered</li>
 <dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.SetReducedPotentialParameters">
 <code class="descname">SetReducedPotentialParameters</code><span class="sig-paren">(</span><em>dist_cutoff</em>, <em>dist_bins</em>, <em>angle_bins</em>, <em>dihedral_bins</em>, <em>seq_sep</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.SetReducedPotentialParameters" title="Permalink to this definition">¶</a></dt>
-<dd><p>Parametrizes a pairwise statistical potential considering the relative
-orientation of two residues. Every residue gets represented by its CA
-position p and a directional component v = norm(ca_pos-n_pos) + norm(ca_pos-c_pos).
-Assuming an interaction between residues r1 and r2, we can define a line l
-between p1 and p2. The potential then considers:</p>
-<ul class="simple">
-<li>dist =&gt; distance between p1 and p2</li>
-<li>alpha =&gt; angle between v1 and l</li>
-<li>beta =&gt; angle between v2 and l</li>
-<li>gamma =&gt; dihedral between (p1+v1,p1,p2,p2+v2)</li>
-</ul>
-<table class="docutils field-list" frame="void" rules="none">
+<dd><table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
@@ -144,8 +377,8 @@ have to be considered</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <em>dist_cutoff</em> is negative or one
-of the bin parameters is &lt;= 0</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <em>dist_cutoff</em> is negative or
+one of the bin parameters is &lt;= 0</p>
 </td>
 </tr>
 </tbody>
@@ -155,11 +388,7 @@ of the bin parameters is &lt;= 0</p>
 <dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.SetTorsionPotentialParameters">
 <code class="descname">SetTorsionPotentialParameters</code><span class="sig-paren">(</span><em>group_definitions</em>, <em>torsion_bins</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.SetTorsionPotentialParameters" title="Permalink to this definition">¶</a></dt>
-<dd><p>Parametrizes a torsion statistical potential, that assigns energies based
-on the identity of three consecutive residues and the phi/psi dihedral
-angles of the central residue. The group definitions are the same as they
-are used in the <a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>.</p>
-<table class="docutils field-list" frame="void" rules="none">
+<dd><table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
@@ -172,7 +401,7 @@ torsion angles in a discrete manner.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if torsion_bins is &lt;= 0 or
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if torsion_bins is &lt;= 0 or
 one possible combination of the 20 standard amino
 acids is not covered by any entry of <em>group_definitions</em></p>
 </td>
@@ -184,10 +413,7 @@ acids is not covered by any entry of <em>group_definitions</em></p>
 <dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.SetCBPackingPotentialParameters">
 <code class="descname">SetCBPackingPotentialParameters</code><span class="sig-paren">(</span><em>cb_packing_cutoff</em>, <em>cb_packing_max_count</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.SetCBPackingPotentialParameters" title="Permalink to this definition">¶</a></dt>
-<dd><p>Parametrizes a cb packing statistical potential, that assigns energies
-based on the number of other cbeta atoms in the environment within a certain
-cutoff distance.</p>
-<table class="docutils field-list" frame="void" rules="none">
+<dd><table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
@@ -199,7 +425,7 @@ this number.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <em>cb_packing_cutoff</em> is &lt; 0 or
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <em>cb_packing_cutoff</em> is &lt; 0 or
 <em>cb_packing_max_count</em> is &lt;= 0</p>
 </td>
 </tr>
@@ -210,18 +436,7 @@ this number.</li>
 <dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.SetHBondPotentialParameters">
 <code class="descname">SetHBondPotentialParameters</code><span class="sig-paren">(</span><em>hb_min_d</em>, <em>hb_max_d</em>, <em>hb_min_alpha</em>, <em>hb_max_alpha</em>, <em>hb_min_beta</em>, <em>hb_max_beta</em>, <em>hb_min_gamma</em>, <em>hb_max_gamma</em>, <em>hb_d_bins</em>, <em>hb_alpha_bins</em>, <em>hb_beta_bins</em>, <em>hb_gamma_bins</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.SetHBondPotentialParameters" title="Permalink to this definition">¶</a></dt>
-<dd><p>Parametrizes an HBond potential similar to the one defined in the Rosetta
-energy function. It considers the CA, C and O positions from the hbond
-acceptor as well as the N and H positions from the hbond donor.
-4 Parameters describe their relative orientation.
-d is the H-O distance, alpha is the angle O-H-N, beta is the angle  C-N-H
-and gamma is the dihedral between CA-C-O-H. An energy function for these
-parameters is built for three different states. State 1 for helical
-residues, state 2 for extended residues and state 0 for other residues.
-If the state of two interacting particles is the same, thats the one
-from which the energy is extracted. In all other cases, the energy is
-extracted from the 0 state.</p>
-<table class="docutils field-list" frame="void" rules="none">
+<dd><table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
@@ -247,8 +462,8 @@ dihedral in a discrete angle.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if one of the bin parameters is &lt;= 0
-or a max parameter is smaller than its min counterpart.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if one of the bin parameters is
+&lt;= 0 or a max parameter is smaller than its min counterpart.</p>
 </td>
 </tr>
 </tbody>
@@ -258,14 +473,7 @@ or a max parameter is smaller than its min counterpart.</p>
 <dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.SetSSAgreementParameters">
 <code class="descname">SetSSAgreementParameters</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.SetSSAgreementParameters" title="Permalink to this definition">¶</a></dt>
-<dd><p>Parametrizes the SSAgreement score. Despite no parameters being given, this
-function has to be called before you can set any SSAgreement scores since the
-memory has to be allocated internally. The SSAgreement score itself relates a
-score to a certain combination of psipred prediction, it&#8217;s confidence and the
-actually occuring secondary structure in the model. In every score evaluation,
-the secondary structure of the loop is estimated by searching for hydrogen bonds
-leading to a secondary structure as defined by dssp. The hbonds are searched
-internally in the loop as well as in the environment.</p>
+<dd><p>Required to set SSAgreement scores with <code class="xref py py-func docutils literal"><span class="pre">SetSSAgreementScore()</span></code>).</p>
 </dd></dl>
 
 <dl class="method">
@@ -285,7 +493,7 @@ on the previously defined <em>cbeta_cutoff</em> and
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if invalid bin or amino acid is
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if invalid bin or amino acid is
 given</p>
 </td>
 </tr>
@@ -315,7 +523,7 @@ on the previously defined <em>dihedral_bins</em>.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if invalid bin or amino acid is
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if invalid bin or amino acid is
 given</p>
 </td>
 </tr>
@@ -341,7 +549,7 @@ the previously defined <em>torsion_bins</em></li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if invalid angle bin or
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if invalid angle bin or
 group_id_idx is given.</p>
 </td>
 </tr>
@@ -363,7 +571,7 @@ group_id_idx is given.</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <em>a</em> is invalid or <em>count</em>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <em>a</em> is invalid or <em>count</em>
 exceeds previously defined <em>max_count</em></p>
 </td>
 </tr>
@@ -393,7 +601,7 @@ the previously set parametrization.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if state is not in [0,1,2] or one
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if state is not in [0,1,2] or one
 of the bins is invalid.</p>
 </td>
 </tr>
@@ -430,35 +638,17 @@ of the bins is invalid.</p>
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>seqres</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Internal SEQRES to be set. Whenever setting structural
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>seqres</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> / <a class="reference external" href="http://www.openstructure.org/docs/1.3/seq/base/seq/#ost.seq.SequenceHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.seq.SequenceHandle</span></code></a> /
+<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> / <a class="reference external" href="http://www.openstructure.org/docs/1.3/seq/base/seq/#ost.seq.SequenceList" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.seq.SequenceList</span></code></a>) &#8211; Internal SEQRES to be set. Whenever setting structural
 data, consistency with this SEQRES is encorced.</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> when <em>seqres</em> contains invalid
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> when <em>seqres</em> contains invalid
 one letter code</td>
 </tr>
 </tbody>
 </table>
 </dd></dl>
 
-<dl class="method">
-<dt>
-<code class="descname">Initialize</code><span class="sig-paren">(</span><em>seqres_list</em><span class="sig-paren">)</span></dt>
-<dd><p>Set up internal scorer with given seqres_list</p>
-<table class="docutils field-list" frame="void" rules="none">
-<col class="field-name" />
-<col class="field-body" />
-<tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>seqres_list</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>) &#8211; Internal SEQRES to be set. Every entry in the list
-represents one chain. Whenever setting structural
-data, consistency with these SEQRES is encorced.</td>
-</tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> when <em>seqres_list</em> contains
-element with invalid one letter code</td>
-</tr>
-</tbody>
-</table>
-</dd></dl>
-
 <dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.SetPsipredPrediction">
 <code class="descname">SetPsipredPrediction</code><span class="sig-paren">(</span><em>pred</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.SetPsipredPrediction" title="Permalink to this definition">¶</a></dt>
@@ -468,31 +658,11 @@ SSAgreementScore.</p>
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pred</strong> (<a class="reference internal" href="helper_classes.html#PsipredPrediction" title="PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a>) &#8211; The prediction</td>
-</tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If the scorer is not yet initialized,
-the scorer is initialized for multiple chains or when the
-the size of the prediction is inconsistent with the internal
-seqres in the scorer.</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pred</strong> (<a class="reference internal" href="helper_classes.html#promod3.loop.PsipredPrediction" title="promod3.loop.PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a> / <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference internal" href="helper_classes.html#promod3.loop.PsipredPrediction" title="promod3.loop.PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a>) &#8211; The prediction</td>
 </tr>
-</tbody>
-</table>
-</dd></dl>
-
-<dl class="method">
-<dt>
-<code class="descname">SetPsipredPrediction</code><span class="sig-paren">(</span><em>pred</em><span class="sig-paren">)</span></dt>
-<dd><p>Internally sets the psipred prediction, which is necessary to calculate the
-SSAgreementScore.</p>
-<table class="docutils field-list" frame="void" rules="none">
-<col class="field-name" />
-<col class="field-body" />
-<tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pred</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference internal" href="helper_classes.html#PsipredPrediction" title="PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a>) &#8211; The prediction</td>
-</tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If the scorer is not yet initialized,
-the number of predictions is inconsistent with the number of
-internal chains or when one of the predictions sizes is
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if the scorer is not yet
+initialized, the number of predictions is inconsistent with the
+number of internal chains or when one of the predictions sizes is
 inconsistent with the according internal seqres</td>
 </tr>
 </tbody>
@@ -513,7 +683,7 @@ data gets resetted for these positions.</p>
 in <em>env</em> are expected to be in the same order as the
 provided SEQRES items.</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if scorer has never been
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if scorer has never been
 initialized with a SEQRES or when <em>env</em> is inconsistent
 with previously set SEQRES. This can be because of
 corrupt residue numbers or sequence mismatches.</td>
@@ -540,10 +710,10 @@ data gets resetted for these positions.</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if sequence of <em>bb_list</em> is
-inconsistent with previously provided SEQRES or
-when either start_resnum or chain_index point to
-invalid positions in the SEQRES.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if sequence of <em>bb_list</em> is
+inconsistent with previously provided SEQRES or when either
+start_resnum or chain_index point to invalid positions in the
+SEQRES.</p>
 </td>
 </tr>
 </tbody>
@@ -566,7 +736,7 @@ with idx <em>chain_index</em> starting from residue number <em>start_resnum</em>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> when either start_resnum or
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> when either start_resnum or
 chain_index point to invalid positions in the SEQRES.</p>
 </td>
 </tr>
@@ -574,6 +744,137 @@ chain_index point to invalid positions in the SEQRES.</p>
 </table>
 </dd></dl>
 
+<dl class="method">
+<dt id="promod3.loop.BackboneLoopScorer.AddContactFunction">
+<code class="descname">AddContactFunction</code><span class="sig-paren">(</span><em>max_dist</em>, <em>score</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.AddContactFunction" title="Permalink to this definition">¶</a></dt>
+<dd><p>Adds a contact definition and returns an index, so it can be used later
+when you add specific contacts. While the specific contact definitions
+get cleared when reinitializing the scorer, The contact functions stay
+and their indices remain valid until the scorer object gets destroyed.
+The definition simply returns <em>score</em> , if a certain CA-CA distance is below
+<em>max_dist</em> and 0.0 otherwise.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>max_dist</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Maximal distance between two CA atoms to be in contact</li>
+<li><strong>score</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Value that gets returned if two CA atoms are in contact</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Index of added contact definition</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneLoopScorer.AddConstraintFunction">
+<code class="descname">AddConstraintFunction</code><span class="sig-paren">(</span><em>min_dist</em>, <em>max_dist</em>, <em>values</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.AddConstraintFunction" title="Permalink to this definition">¶</a></dt>
+<dd><p>Adds a constraint definition and returns an index, so it can be used later
+when you add specific constraints. While the specific constraint definitions
+get cleared when reinitializing the scorer, the constraint functions stay
+and their indices remain valid until the scorer object gets destroyed.
+The definition returns the value at pos i, where i gets determined given
+a certain CA-CA distance by assuming an equidistant binning of <em>values</em>
+between <em>min_dist</em> and <em>max_dist</em> . If a certain CA-CA distance is outside
+the range defined by <em>min_dist</em> and <em>max_dist</em>, the definition returns 0.0.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>min_dist</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Minimal distance between two CA atoms to be considered</li>
+<li><strong>max_dist</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Maximal distance between two CA atoms to be considered</li>
+<li><strong>values</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; The possible values that get returned when two CA
+atoms have a distance between <em>min_dist</em> and <em>max_dist</em></li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Index of added constraint definition</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <em>min_dist</em> &gt;= <em>max_dist</em> or
+when <em>values</em> contains no elements</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneLoopScorer.AddContact">
+<code class="descname">AddContact</code><span class="sig-paren">(</span><em>chain_idx_one</em>, <em>resnum_one</em>, <em>chain_idx_two</em>, <em>resnum_two</em>, <em>max_dist</em>, <em>score</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.AddContact" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt>
+<code class="descname">AddContact</code><span class="sig-paren">(</span><em>chain_idx_one</em>, <em>resnum_one</em>, <em>chain_idx_two</em>, <em>resnum_two</em>, <em>f_idx</em><span class="sig-paren">)</span></dt>
+<dd><p>Two versions to add a specific contact. In version one, the AddContactFunction
+method gets called internally to generate a unique contact definition for
+this pair of residues. In version two you can use a manually defined contact
+definition.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>chain_idx_one</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Chain idx of residue one in the contact</li>
+<li><strong>resnum_one</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Resnum of residue one in the contact</li>
+<li><strong>chain_idx_two</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Chain idx of residue two in the contact</li>
+<li><strong>resnum_two</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Resnum of residue two in the contact</li>
+<li><strong>max_dist</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Maximal distance between the two CA atoms to be in contact</li>
+<li><strong>score</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Value that gets returned if the two CA atoms are in contact</li>
+<li><strong>f_idx</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Index of manually set contact definition</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if any of the chain indices or
+resnums is invalid, the interaction partners are the same residue
+or when <em>f_idx</em> is an invalid index.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneLoopScorer.AddConstraint">
+<code class="descname">AddConstraint</code><span class="sig-paren">(</span><em>chain_idx_one</em>, <em>resnum_one</em>, <em>chain_idx_two</em>, <em>resnum_two</em>, <em>min_dist</em>, <em>max_dist</em>, <em>scores</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.AddConstraint" title="Permalink to this definition">¶</a></dt>
+<dt>
+<code class="descname">AddConstraint</code><span class="sig-paren">(</span><em>chain_idx_one</em>, <em>resnum_one</em>, <em>chain_idx_two</em>, <em>resnum_two</em>, <em>f_idx</em><span class="sig-paren">)</span></dt>
+<dd><p>Two versions to add a specific constraint. In version one, the
+AddConstraintFunction method gets called internally to generate a unique
+constraint definition for this pair of residues. In version two you can use
+a manually defined constraint definition.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>chain_idx_one</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Chain idx of residue one in the constraint</li>
+<li><strong>resnum_one</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Resnum of residue one in the constraint</li>
+<li><strong>chain_idx_two</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Chain idx of residue two in the constraint</li>
+<li><strong>resnum_two</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Resnum of residue two in the constraint</li>
+<li><strong>min_dist</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Minimal distance between the two CA atoms to be considered</li>
+<li><strong>max_dist</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Maximal distance between the two CA atoms to be considered</li>
+<li><strong>scores</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Values that get returned if the two CA atoms are considered</li>
+<li><strong>f_idx</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Index of manually set constraint definition</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if any of the chain indices or
+resnums is invalid, the interaction partners are the same residue,
+<em>min_dist</em> &gt;= <em>max_dist</em>, <em>scores</em> is empty or when <em>f_idx</em> is an
+invalid index.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
 <dl class="method">
 <dt id="promod3.loop.BackboneLoopScorer.CalculateClashScore">
 <code class="descname">CalculateClashScore</code><span class="sig-paren">(</span><em>bb_list</em>, <em>start_resnum</em><span class="optional">[</span>, <em>chain_index=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.CalculateClashScore" title="Permalink to this definition">¶</a></dt>
@@ -592,10 +893,10 @@ chain_index point to invalid positions in the SEQRES.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">clash score</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <em>bb_list</em> is smaller
-than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to
-invalid positions in the SEQRES or the scorer
-has never been initialized with a SEQRES.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid
+positions in the SEQRES or the scorer has never been initialized
+with a SEQRES.</p>
 </td>
 </tr>
 </tbody>
@@ -620,11 +921,10 @@ has never been initialized with a SEQRES.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">cbeta score</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <em>bb_list</em> is smaller
-than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to
-invalid positions in the SEQRES or when the
-according potential or scorer have never been properly
-initialized.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid positions
+in the SEQRES or when the  according potential or scorer have
+never been properly initialized.</p>
 </td>
 </tr>
 </tbody>
@@ -649,11 +949,10 @@ initialized.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">reduced score</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <em>bb_list</em> is smaller
-than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to
-invalid positions in the SEQRES or when the
-according potential or scorer have never been properly
-initialized.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid positions
+in the SEQRES or when the  according potential or scorer have
+never been properly initialized.</p>
 </td>
 </tr>
 </tbody>
@@ -678,11 +977,10 @@ initialized.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">torsion score</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <em>bb_list</em> is smaller
-than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to
-invalid positions in the SEQRES or when the
-according potential or scorer have never been properly
-initialized.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid positions
+in the SEQRES or when the  according potential or scorer have
+never been properly initialized.</p>
 </td>
 </tr>
 </tbody>
@@ -707,11 +1005,10 @@ initialized.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">packing score</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <em>bb_list</em> is smaller
-than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to
-invalid positions in the SEQRES or when the
-according potential or scorer have never been properly
-initialized.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid positions
+in the SEQRES or when the  according potential or scorer have
+never been properly initialized.</p>
 </td>
 </tr>
 </tbody>
@@ -736,11 +1033,10 @@ initialized.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">hbond score</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <em>bb_list</em> is smaller
-than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to
-invalid positions in the SEQRES or when the
-according potential or scorer have never been properly
-initialized.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid positions
+in the SEQRES or when the  according potential or scorer have
+never been properly initialized.</p>
 </td>
 </tr>
 </tbody>
@@ -765,12 +1061,64 @@ initialized.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">SSAgreement score</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <em>bb_list</em> is smaller
-than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to
-invalid positions in the SEQRES or, the
-scorer have never been properly initialized,
-or when no <a class="reference internal" href="helper_classes.html#PsipredPrediction" title="PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a> is set to
-the scorer.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid positions
+in the SEQRES or the scorer have never been properly initialized
+or when no <a class="reference internal" href="helper_classes.html#promod3.loop.PsipredPrediction" title="promod3.loop.PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a> is set to the scorer.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneLoopScorer.CalculateContactScore">
+<code class="descname">CalculateContactScore</code><span class="sig-paren">(</span><em>bb_list</em>, <em>start_resnum</em><span class="optional">[</span>, <em>chain_index=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.CalculateContactScore" title="Permalink to this definition">¶</a></dt>
+<dd><table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>bb_list</strong> (<a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>) &#8211; Loop to calculate the contact score</li>
+<li><strong>start_resnum</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; ResNum defining the position in the SEQRES
+(first element starts with one!)</li>
+<li><strong>chain_index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Index of the chain the loop belongs to</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">contact score</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid positions
+in the SEQRES or the scorer have never been properly initialized</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.BackboneLoopScorer.CalculateConstraintScore">
+<code class="descname">CalculateConstraintScore</code><span class="sig-paren">(</span><em>bb_list</em>, <em>start_resnum</em><span class="optional">[</span>, <em>chain_index=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.BackboneLoopScorer.CalculateConstraintScore" title="Permalink to this definition">¶</a></dt>
+<dd><table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>bb_list</strong> (<a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>) &#8211; Loop to calculate the constraint score</li>
+<li><strong>start_resnum</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; ResNum defining the position in the SEQRES
+(first element starts with one!)</li>
+<li><strong>chain_index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Index of the chain the loop belongs to</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">constraint score</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3, the <em>chain_index</em>/<em>start_resnum</em> lead to invalid positions
+in the SEQRES or the scorer have never been properly initialized</p>
 </td>
 </tr>
 </tbody>
@@ -797,8 +1145,8 @@ allowed in case of a subsequent proline.</li>
 trans-omega torsions.</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <em>bb_list</em> is
-smaller than 3.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <em>bb_list</em> is smaller
+than 3.</p>
 </td>
 </tr>
 </tbody>
@@ -827,7 +1175,7 @@ smaller than 3.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
       <li>Previous: <a href="loop_closing.html" title="previous chapter">Loop Closing</a></li>
       <li>Next: <a href="monte_carlo.html" title="next chapter">Monte Carlo Sampling</a></li>
@@ -861,7 +1209,7 @@ smaller than 3.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/helper_classes.html b/doc/html/loop/helper_classes.html
index 8af6dcbcf88a0e1aeea22b1e9e06442633ea3a18..29bdec5bb06baea52e3eb7076cd883ce78b14dc4 100644
--- a/doc/html/loop/helper_classes.html
+++ b/doc/html/loop/helper_classes.html
@@ -69,9 +69,9 @@ functionality in the loop module.</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <strong>prediction</strong> and
-<strong>confidence</strong> are inconsistent or if they contain an
-invalid element</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <strong>prediction</strong> and
+<strong>confidence</strong> are inconsistent or if they contain an invalid
+element</p>
 </td>
 </tr>
 </tbody>
@@ -122,7 +122,7 @@ as they are produced by the psipred executable</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if input contains invalid elements</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if input contains invalid elements</p>
 </td>
 </tr>
 </tbody>
@@ -147,7 +147,7 @@ to <strong>to</strong>, not including <strong>to</strong> itself</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.PsipredPrediction" title="promod3.loop.PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a> with the specified range</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <strong>from</strong> or <strong>to</strong> are invalid</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>from</strong> or <strong>to</strong> are invalid</p>
 </td>
 </tr>
 </tbody>
@@ -165,7 +165,7 @@ to <strong>to</strong>, not including <strong>to</strong> itself</p>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Psipred prediction at pos <strong>idx</strong></td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <strong>idx</strong> is invalid</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>idx</strong> is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -182,7 +182,7 @@ to <strong>to</strong>, not including <strong>to</strong> itself</p>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Psipred confidence at pos <strong>idx</strong></td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <strong>idx</strong> is invalid</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>idx</strong> is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -237,7 +237,7 @@ to <strong>to</strong>, not including <strong>to</strong> itself</p>
 <dl class="class">
 <dt id="promod3.loop.LoopCandidate">
 <em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">LoopCandidate</code><span class="sig-paren">(</span><em>backbone_list</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.LoopCandidate" title="Permalink to this definition">¶</a></dt>
-<dd><p>Object representing a possible configuration of the backbone of a particular loop being modelled. Apart from the positions, stored in a <a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>, it also has attributes storing different scores associated with the candidate (will be set by calling the corresponding scoring function in <a class="reference internal" href="#promod3.loop.LoopCandidates" title="promod3.loop.LoopCandidates"><code class="xref py py-class docutils literal"><span class="pre">LoopCandidates</span></code></a>) as well as some information on the original structure from which this particular loop configuration was taken (in the case when the configuration was taken from the structural database).</p>
+<dd><p>Object representing a possible configuration of the backbone of a particular loop being modelled. Apart from the positions, stored in a <a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>, it also has attributes storing different scores associated with the candidate (will be set by calling the corresponding scoring function in <a class="reference internal" href="#promod3.loop.LoopCandidates" title="promod3.loop.LoopCandidates"><code class="xref py py-class docutils literal"><span class="pre">LoopCandidates</span></code></a>).</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -274,38 +274,6 @@ to <strong>to</strong>, not including <strong>to</strong> itself</p>
 </table>
 </dd></dl>
 
-<dl class="method">
-<dt id="promod3.loop.LoopCandidate.GetOriginalSequence">
-<code class="descname">GetOriginalSequence</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.LoopCandidate.GetOriginalSequence" title="Permalink to this definition">¶</a></dt>
-<dd><p>Returns the sequence of the original loop from the structural database, i.e. the sequence of the piece of structure from which the loop was taken.</p>
-<table class="docutils field-list" frame="void" rules="none">
-<col class="field-name" />
-<col class="field-body" />
-<tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A sequence</td>
-</tr>
-<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a></td>
-</tr>
-</tbody>
-</table>
-</dd></dl>
-
-<dl class="method">
-<dt id="promod3.loop.LoopCandidate.GetOriginalDSSPState">
-<code class="descname">GetOriginalDSSPState</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.LoopCandidate.GetOriginalDSSPState" title="Permalink to this definition">¶</a></dt>
-<dd><p>Returns the secondary structure of the original loop from the structural database, i.e. the secondary structure of the piece of structure from which the loop was taken.</p>
-<table class="docutils field-list" frame="void" rules="none">
-<col class="field-name" />
-<col class="field-body" />
-<tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The secondary structure code as given in DSSP</td>
-</tr>
-<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a></td>
-</tr>
-</tbody>
-</table>
-</dd></dl>
-
 <dl class="attribute">
 <dt id="promod3.loop.LoopCandidate.bb_list">
 <code class="descname">bb_list</code><a class="headerlink" href="#promod3.loop.LoopCandidate.bb_list" title="Permalink to this definition">¶</a></dt>
@@ -405,8 +373,8 @@ to <strong>to</strong>, not including <strong>to</strong> itself</p>
 </dd></dl>
 
 <dl class="attribute">
-<dt id="promod3.loop.LoopCandidate.ss_agreement">
-<code class="descname">ss_agreement</code><a class="headerlink" href="#promod3.loop.LoopCandidate.ss_agreement" title="Permalink to this definition">¶</a></dt>
+<dt id="promod3.loop.LoopCandidate.ss_agreement_score">
+<code class="descname">ss_agreement_score</code><a class="headerlink" href="#promod3.loop.LoopCandidate.ss_agreement_score" title="Permalink to this definition">¶</a></dt>
 <dd><p>The SSAgreement score of the loop candidate</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -486,9 +454,9 @@ a bit less precisely.</li>
 
 <dl class="staticmethod">
 <dt id="promod3.loop.LoopCandidates.FillFromMonteCarloSampler">
-<em class="property">static </em><code class="descname">FillFromMonteCarloSampler</code><span class="sig-paren">(</span><em>seq</em>, <em>num_loops</em>, <em>steps</em>, <em>sampler</em>, <em>closer</em>, <em>scorer</em>, <em>cooler</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.LoopCandidates.FillFromMonteCarloSampler" title="Permalink to this definition">¶</a></dt>
+<em class="property">static </em><code class="descname">FillFromMonteCarloSampler</code><span class="sig-paren">(</span><em>seq</em>, <em>num_loops</em>, <em>steps</em>, <em>sampler</em>, <em>closer</em>, <em>scorer</em>, <em>cooler</em><span class="optional">[</span>, <em>random_seed = 0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.LoopCandidates.FillFromMonteCarloSampler" title="Permalink to this definition">¶</a></dt>
 <dt>
-<em class="property">static </em><code class="descname">FillFromMonteCarloSampler</code><span class="sig-paren">(</span><em>initial_bb</em>, <em>seq</em>, <em>num_loops</em>, <em>steps</em>, <em>sampler</em>, <em>closer</em>, <em>scorer</em>, <em>cooler</em><span class="sig-paren">)</span></dt>
+<em class="property">static </em><code class="descname">FillFromMonteCarloSampler</code><span class="sig-paren">(</span><em>initial_bb</em>, <em>seq</em>, <em>num_loops</em>, <em>steps</em>, <em>sampler</em>, <em>closer</em>, <em>scorer</em>, <em>cooler</em><span class="optional">[</span>, <em>random_seed = 0</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
 <dd><p>Uses Monte Carlo simulated annealing to sample the loop to be modelled.
 If <em>initial_bb</em> is given, every Monte Carlo run starts from that configuration.</p>
 <table class="docutils field-list" frame="void" rules="none">
@@ -505,6 +473,10 @@ generated</li>
 <li><strong>closer</strong> (<a class="reference internal" href="monte_carlo.html#mc-closer-object"><span>Closer Object</span></a>) &#8211; Used to close the loop after each MC step</li>
 <li><strong>scorer</strong> (<a class="reference internal" href="monte_carlo.html#mc-scorer-object"><span>Scorer Object</span></a>) &#8211; Used to score the generated configurations at each MC step</li>
 <li><strong>cooler</strong> (<a class="reference internal" href="monte_carlo.html#mc-cooler-object"><span>Cooler Object</span></a>) &#8211; Controls the temperature profile of the simulated annealing</li>
+<li><strong>random_seed</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Seed to feed the random number generator for
+accepting/rejecting proposed monte carlo steps.
+For every monte carlo run, the random number generator
+gets refreshed and this seed gets increased by 1.</li>
 </ul>
 </td>
 </tr>
@@ -572,10 +544,10 @@ then accepted or not depending on a metropolis criterium.</p>
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
-<li><strong>n_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Residue defining the n-stem positions every
-candidate should match</li>
-<li><strong>c_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Residue defining the c-stem positions every
-candidate should match</li>
+<li><strong>n_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Residue defining the n-stem positions every candidate
+should match. See <a class="reference internal" href="loop_closing.html#promod3.loop.CCD.CCD" title="promod3.loop.CCD.CCD"><code class="xref py py-meth docutils literal"><span class="pre">CCD()</span></code></a>.</li>
+<li><strong>c_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Residue defining the c-stem positions every candidate
+should match. See <a class="reference internal" href="loop_closing.html#promod3.loop.CCD.CCD" title="promod3.loop.CCD.CCD"><code class="xref py py-meth docutils literal"><span class="pre">CCD()</span></code></a>.</li>
 <li><strong>torsion_sampler</strong> (<a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; The torsion sampler</li>
 <li><strong>torsion_samplers</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; A list containing one torsion sampler for each
 residue in the loop</li>
@@ -583,7 +555,7 @@ residue in the loop</li>
 <li><strong>rmsd_cutoff</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Cutoff in stem residue RMSD used to determine
 convergence</li>
 <li><strong>keep_non_converged</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; Whether to keep loop candidates for which the
-closing did not converged</li>
+closing did not converge</li>
 <li><strong>random_seed</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; seed for random number generator used to
 accept/reject moves in CCD algorithm</li>
 </ul>
@@ -633,8 +605,8 @@ should match</li>
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>loop_candidate</strong> (<a class="reference internal" href="#promod3.loop.LoopCandidate" title="promod3.loop.LoopCandidate"><code class="xref py py-class docutils literal"><span class="pre">LoopCandidate</span></code></a>) &#8211; The loop candidate</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If sequence of <em>loop_candidate</em> is not consistent
-with internal sequence</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> If sequence of <em>loop_candidate</em>
+is not consistent with internal sequence</td>
 </tr>
 </tbody>
 </table>
@@ -650,8 +622,8 @@ with internal sequence</td>
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>bb_list</strong> (<a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>) &#8211; The backbone list</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If sequence of <em>bb_list</em> is not consistent
-with internal sequence</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> If sequence of <em>bb_list</em> is not
+consistent with internal sequence</td>
 </tr>
 </tbody>
 </table>
@@ -686,8 +658,8 @@ with internal sequence</td>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.LoopCandidates.CalculateClasScores">
-<code class="descname">CalculateClasScores</code><span class="sig-paren">(</span><em>start_resnum</em><span class="optional">[</span>, <em>chain_index=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.LoopCandidates.CalculateClasScores" title="Permalink to this definition">¶</a></dt>
+<dt id="promod3.loop.LoopCandidates.CalculateClashScores">
+<code class="descname">CalculateClashScores</code><span class="sig-paren">(</span><em>start_resnum</em><span class="optional">[</span>, <em>chain_index=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.LoopCandidates.CalculateClashScores" title="Permalink to this definition">¶</a></dt>
 <dd><p>Calculates and assigns the clash score for each <a class="reference internal" href="#promod3.loop.LoopCandidate" title="promod3.loop.LoopCandidate"><code class="xref py py-class docutils literal"><span class="pre">LoopCandidate</span></code></a>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -986,7 +958,7 @@ the according value also gets added to the final score.</li>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
       <li>Previous: <a href="load_loop_objects.html" title="previous chapter">Load Loop Objects</a></li>
       <li>Next: <a href="../sidechain/index.html" title="next chapter"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a></li>
@@ -1020,7 +992,7 @@ the according value also gets added to the final score.</li>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/index.html b/doc/html/loop/index.html
index 5021f37e70da6534b112c7cc4cb96b35c4172763..728d8a878865245bc106420b96b17ba4037dd374 100644
--- a/doc/html/loop/index.html
+++ b/doc/html/loop/index.html
@@ -24,7 +24,7 @@
     <script type="text/javascript" src="../_static/underscore.js"></script>
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
-    <link rel="up" title="Documentation For Developers" href="../developers.html" />
+    <link rel="up" title="Documentation For Users" href="../users.html" />
     <link rel="next" title="Backbone" href="backbone.html" />
     <link rel="prev" title="modelling - Protein Modelling" href="../modelling/index.html" />
    
@@ -48,56 +48,56 @@ you a starting point to get an idea of what can be done.</p>
 <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
 
-<span class="c">#let&#39;s load a crambin structure from the pdb</span>
-<span class="n">crambin</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&quot;1crn&quot;</span><span class="p">,</span><span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="c"># let&#39;s load a crambin structure from the pdb</span>
+<span class="n">crambin</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&quot;1crn&quot;</span><span class="p">,</span> <span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
 <span class="n">SEQRES</span> <span class="o">=</span> <span class="s">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">crambin</span><span class="o">.</span><span class="n">residues</span><span class="p">])</span>
 
-<span class="c">#this is the sequence we want to remodel</span>
+<span class="c"># this is the sequence we want to remodel</span>
 <span class="n">loop_seq</span> <span class="o">=</span> <span class="n">SEQRES</span><span class="p">[</span><span class="mi">23</span><span class="p">:</span><span class="mi">31</span><span class="p">]</span>
 
-<span class="c">#let&#39;s define the stem residues</span>
+<span class="c"># let&#39;s define the stem residues</span>
 <span class="n">n_stem</span> <span class="o">=</span> <span class="n">crambin</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="mi">23</span><span class="p">]</span>
 <span class="n">c_stem</span> <span class="o">=</span> <span class="n">crambin</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="mi">30</span><span class="p">]</span>
 
-<span class="c">#we use the StructureDB as source for structural information</span>
+<span class="c"># we use the StructureDB as source for structural information</span>
 <span class="n">structure_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadStructureDB</span><span class="p">()</span>
 
-<span class="c">#the FragDB allows to access the StructureDB based on geometric</span>
-<span class="c">#features of the loop stem residue</span>
+<span class="c"># the FragDB allows to access the StructureDB based on geometric </span>
+<span class="c"># features of the loop stem residue</span>
 <span class="n">frag_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadFragDB</span><span class="p">()</span>
 
-<span class="c">#the LoopCandidates allow to handle several loops at once</span>
-<span class="c">#we directly want to find potential loop candidates from the</span>
-<span class="c">#previously loaded databases</span>
+<span class="c"># the LoopCandidates allow to handle several loops at once</span>
+<span class="c"># we directly want to find potential loop candidates from the</span>
+<span class="c"># previously loaded databases</span>
 <span class="n">loop_candidates</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoopCandidates</span><span class="o">.</span><span class="n">FillFromDatabase</span><span class="p">(</span><span class="n">n_stem</span><span class="p">,</span>
                                                        <span class="n">c_stem</span><span class="p">,</span>
                                                        <span class="n">loop_seq</span><span class="p">,</span>
                                                        <span class="n">frag_db</span><span class="p">,</span>
                                                        <span class="n">structure_db</span><span class="p">)</span>
 
-<span class="c">#The candidates usually don&#39;t match exactly the required stem coordinates</span>
-<span class="c">#CCD (Cyclic Coordinate Descent) is one way to enforce this match.</span>
+<span class="c"># candidates usually don&#39;t match exactly the required stem coords.</span>
+<span class="c"># CCD (Cyclic Coordinate Descent) is one way to enforce this match.</span>
 <span class="n">loop_candidates</span><span class="o">.</span><span class="n">ApplyCCD</span><span class="p">(</span><span class="n">n_stem</span><span class="p">,</span> <span class="n">c_stem</span><span class="p">)</span>
 
-<span class="c">#now it&#39;s time to select one candidate, we load a scorer object to do that</span>
+<span class="c"># load a scorer object to compare candidates</span>
 <span class="n">scorer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadBackboneLoopScorer</span><span class="p">()</span>
 
-<span class="c">#initialize scorer with the environment given by the crambin structure</span>
+<span class="c"># initialize scorer with the environment given by crambin structure</span>
 <span class="n">scorer</span><span class="o">.</span><span class="n">Initialize</span><span class="p">(</span><span class="n">SEQRES</span><span class="p">)</span>
 <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">crambin</span><span class="p">)</span>
 
-<span class="c">#the scorer can then be attached to the LoopCandidates object</span>
-<span class="c">#to calculate several different scores, we go for a distance dependent</span>
-<span class="c">#statistical potential considering the CBeta positions of each residue</span>
-<span class="c">#and a clash score. To calculate the actual score we also have to pass</span>
-<span class="c">#the location of our loop candidates in the overall structure</span>
-<span class="c"># =&gt; resnum = 24</span>
+<span class="c"># the scorer can then be attached to the LoopCandidates object</span>
+<span class="c"># to calculate several different scores, we use a distance dependent</span>
+<span class="c"># statistical potential considering CBeta positions of each residue</span>
+<span class="c"># and a clash score. To calculate the actual score we pass the</span>
+<span class="c"># location of our loop candidates in the overall structure </span>
+<span class="c">#  =&gt; resnum = 24</span>
 <span class="n">loop_candidates</span><span class="o">.</span><span class="n">AttachScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">)</span>
 <span class="n">loop_candidates</span><span class="o">.</span><span class="n">CalculateCBetaScores</span><span class="p">(</span><span class="mi">24</span><span class="p">)</span>
 <span class="n">loop_candidates</span><span class="o">.</span><span class="n">CalculateClashScores</span><span class="p">(</span><span class="mi">24</span><span class="p">)</span>
 
-<span class="c">#we simply sum up the previously calculated scores and search for the</span>
-<span class="c">#loop with minimal score</span>
+<span class="c"># we simply sum up the previously calculated scores and search for</span>
+<span class="c"># the loop with minimal score</span>
 <span class="n">min_score</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="s">&quot;inf&quot;</span><span class="p">)</span>
 <span class="n">min_candidate</span> <span class="o">=</span> <span class="mi">0</span>
 <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">lc</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">loop_candidates</span><span class="p">):</span>
@@ -105,11 +105,11 @@ you a starting point to get an idea of what can be done.</p>
   <span class="k">if</span> <span class="n">score</span> <span class="o">&lt;</span> <span class="n">min_score</span><span class="p">:</span>
     <span class="n">min_score</span> <span class="o">=</span> <span class="n">score</span>
     <span class="n">min_candidate</span> <span class="o">=</span> <span class="n">i</span>
-
-<span class="c">#let&#39;s insert the found loop into our structure and save it down</span>
+  
+<span class="c"># let&#39;s insert the found loop into our structure and save it down</span>
 <span class="n">bb_list</span> <span class="o">=</span> <span class="n">loop_candidates</span><span class="p">[</span><span class="n">min_candidate</span><span class="p">]</span><span class="o">.</span><span class="n">bb_list</span>
-<span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">crambin</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">n_stem</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">())</span>
-<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">crambin</span><span class="p">,</span><span class="s">&quot;modified_crambin.pdb&quot;</span><span class="p">)</span>
+<span class="n">bb_list</span><span class="o">.</span><span class="n">InsertInto</span><span class="p">(</span><span class="n">crambin</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">n_stem</span><span class="o">.</span><span class="n">GetNumber</span><span class="p">())</span>
+<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">crambin</span><span class="p">,</span> <span class="s">&quot;modified_crambin.pdb&quot;</span><span class="p">)</span>
 </pre></div>
 </div>
 <p>Contents:</p>
@@ -168,7 +168,7 @@ you a starting point to get an idea of what can be done.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
       <li>Previous: <a href="../modelling/index.html" title="previous chapter"><code class="docutils literal"><span class="pre">modelling</span></code> - Protein Modelling</a></li>
       <li>Next: <a href="backbone.html" title="next chapter">Backbone</a></li>
   </ul></li>
@@ -200,7 +200,7 @@ you a starting point to get an idea of what can be done.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/load_loop_objects.html b/doc/html/loop/load_loop_objects.html
index aab6712fb74c60bf46d3cf0c81cebea1f999c258..77ab79d88dacba15ec3409393b121769051478e1 100644
--- a/doc/html/loop/load_loop_objects.html
+++ b/doc/html/loop/load_loop_objects.html
@@ -197,7 +197,7 @@ Proteins, 62(4):892–908, Mar 2006.</dd>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
       <li>Previous: <a href="monte_carlo.html" title="previous chapter">Monte Carlo Sampling</a></li>
       <li>Next: <a href="helper_classes.html" title="next chapter">Helper Classes</a></li>
@@ -231,7 +231,7 @@ Proteins, 62(4):892–908, Mar 2006.</dd>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/loop_closing.html b/doc/html/loop/loop_closing.html
index 90f5e900276ce229005f916b963d899657ed9e51..49af751d2b9c6079da1db369061016183f4e026c 100644
--- a/doc/html/loop/loop_closing.html
+++ b/doc/html/loop/loop_closing.html
@@ -87,8 +87,14 @@ to avoid moving into unfavourable regions of the backbone dihedrals.</p>
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
 <li><strong>sequence</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Sequence of the backbones to be closed</li>
-<li><strong>n_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Residue defining the n_stem</li>
-<li><strong>c_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Residue defining the c_stem</li>
+<li><strong>n_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Residue defining the n_stem.
+If the residue before <em>n_stem</em> doesn&#8217;t exist, the
+torsion sampler will use a default residue (ALA) and
+and phi angle (-1.0472) to evaluate the first angle.</li>
+<li><strong>c_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Residue defining the c_stem.
+If the residue after <em>c_stem</em> doesn&#8217;t exist, the
+torsion sampler will use a default residue (ALA) and
+psi angle (-0.7854) to evaluate the last angle.</li>
 <li><strong>torsion_sampler</strong> (<a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a> / <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>) &#8211; To extract probabilities for the analysis of the backbone
 dihedrals. You either pass a list with <a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>
 objects for every residue of the loop to be closed or a single
@@ -101,11 +107,10 @@ should be accepted.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if a list of torsion samplers is given
-with inconsistent length regarding the sequence. Another
-requirement is that the residue before <strong>n_stem</strong> and
-after <strong>c_stem</strong> must be valid and all backbone atoms
-are present.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if a list of torsion samplers is
+given with inconsistent length regarding the sequence. Another
+requirement is that all backbone atoms of the stems must be
+present.</p>
 </td>
 </tr>
 </tbody>
@@ -146,9 +151,9 @@ closed has RMSD below the <strong>c_stem</strong></li>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a> Whether <strong>rmsd_cutoff</strong> has been reached</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if the CCD object has been initialized
-with <a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a> support and the length of the
-<strong>bb_list</strong> is not consistent with the initial sequence.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if the CCD object has been
+initialized with <a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a> support and the length of
+the <strong>bb_list</strong> is not consistent with the initial sequence.</td>
 </tr>
 </tbody>
 </table>
@@ -208,7 +213,7 @@ stem residues.</p>
 the closed loops. There is a maximum of 16 entries.</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> in case of invalid pivot indices.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> in case of invalid pivot indices.</p>
 </td>
 </tr>
 </tbody>
@@ -245,7 +250,7 @@ rigid during relaxation.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if size of <strong>bb_list</strong> is below 2</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of <strong>bb_list</strong> is below 2</p>
 </td>
 </tr>
 </tbody>
@@ -270,7 +275,7 @@ relaxation aborts.</li>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Forcefield energy upon relaxation</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <strong>bb_list</strong> has not the same
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>bb_list</strong> has not the same
 size or sequence as the initial one.</p>
 </td>
 </tr>
@@ -314,7 +319,7 @@ size or sequence as the initial one.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
       <li>Previous: <a href="structure_db.html" title="previous chapter">Structural Database</a></li>
       <li>Next: <a href="backbone_loop_score.html" title="next chapter">Loop Scoring</a></li>
@@ -348,7 +353,7 @@ size or sequence as the initial one.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/monte_carlo.html b/doc/html/loop/monte_carlo.html
index 8874a342c0388d797b093db7b3c5ad2c876df113..55fcf9cc97a62ce10969cf75609888b3cd58af7d 100644
--- a/doc/html/loop/monte_carlo.html
+++ b/doc/html/loop/monte_carlo.html
@@ -41,7 +41,7 @@
             
   <div class="section" id="monte-carlo-sampling">
 <h1>Monte Carlo Sampling<a class="headerlink" href="#monte-carlo-sampling" title="Permalink to this headline">¶</a></h1>
-<p>The monte carlo capabilities of ProMod3 are mainly targeted at generating de
+<p>The Monte Carlo capabilities of ProMod3 are mainly targeted at generating de
 novo structure candidates for loops or N-/C-Termini. Every iteration of the
 sampling process consists basically of four steps.</p>
 <ul class="simple">
@@ -51,18 +51,20 @@ sampling process consists basically of four steps.</p>
 <li>Accept/Reject new conformation based on the score and a temperature controlled metropolis criterion</li>
 </ul>
 <p>These steps are performed by sampler, closer, scorer and cooler objects, that
-can be arbitrarily combined to generate custom monte carlo sampling pipelines.
+can be arbitrarily combined to generate custom Monte Carlo sampling pipelines.
 This combination either happens manually or by using a convenient function
 provided by ProMod3.</p>
 <dl class="method">
-<dt id="promod3.loop.MonteCarloSampler">
-<code class="descclassname">promod3.loop.</code><code class="descname">MonteCarloSampler</code><span class="sig-paren">(</span><em>sampler</em>, <em>closer</em>, <em>scorer</em>, <em>cooler</em>, <em>steps</em>, <em>bb_list</em>, <em>initialize</em>, <em>seed</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.MonteCarloSampler" title="Permalink to this definition">¶</a></dt>
-<dd><p>A convenient function to perform monte carlo sampling using a simulated
+<dt id="promod3.loop.SampleMonteCarlo">
+<code class="descclassname">promod3.loop.</code><code class="descname">SampleMonteCarlo</code><span class="sig-paren">(</span><em>sampler</em>, <em>closer</em>, <em>scorer</em>, <em>cooler</em>, <em>steps</em>, <em>bb_list</em>, <em>initialize=true</em>, <em>seed=0</em>, <em>lowest_energy_conformation=true</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.SampleMonteCarlo" title="Permalink to this definition">¶</a></dt>
+<dd><p>A convenient function to perform Monte Carlo sampling using a simulated
 annealing scheme. In every iteration, a new loop conformation gets proposed by
 the provided <strong>sampler</strong> and closed by the <strong>closer</strong>. Upon scoring, this new
 conformation gets accepted/rejected using a metropolis criterion based on the
 temperature given by the <strong>cooler</strong>
-=&gt; acceptance probability: exp(-delta_score/T)</p>
+=&gt; acceptance probability: exp(-delta_score/T).
+The result is stored in <em>bb_list</em> and is either the lowest energy conformation
+ever encountered or the last accepted proposal.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -71,17 +73,19 @@ temperature given by the <strong>cooler</strong>
 <li><strong>sampler</strong> (<a class="reference internal" href="#mc-sampler-object"><span>Sampler Object</span></a>) &#8211; Sampler object capable of initializing and altering
 conformations.</li>
 <li><strong>closer</strong> (<a class="reference internal" href="#mc-closer-object"><span>Closer Object</span></a>) &#8211; Closer object to adapt a new conformation to
-the environment</li>
-<li><strong>scorer</strong> (<a class="reference internal" href="#mc-scorer-object"><span>Scorer Object</span></a>) &#8211; Scorer object to score new loop conformations</li>
+the environment.</li>
+<li><strong>scorer</strong> (<a class="reference internal" href="#mc-scorer-object"><span>Scorer Object</span></a>) &#8211; Scorer object to score new loop conformations.</li>
 <li><strong>cooler</strong> (<a class="reference internal" href="#mc-cooler-object"><span>Cooler Object</span></a>) &#8211; Cooler object to control the temperature of the
-monte carlo trajectory</li>
-<li><strong>steps</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Number of monte carlo iterations to be performed</li>
-<li><strong>bb_list</strong> (<a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>) &#8211; The lowest scoring conformation of the trajectory
-gets stored in here</li>
+Monte Carlo trajectory.</li>
+<li><strong>steps</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Number of Monte Carlo iterations to be performed.</li>
+<li><strong>bb_list</strong> (<a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>) &#8211; The chosen conformation gets stored here.</li>
 <li><strong>initialize</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; Whether a new bb_list should be generated as starting
 point, based on the samplers Initialize function.
 The input <strong>bb_list</strong> gets used otherwise.</li>
 <li><strong>seed</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Seed for internal random number generator.</li>
+<li><strong>lowest_energy_conformation</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; If true, we choose the lowest scoring
+conformation of the trajectory. Otherwise,
+the last accepted proposal.</li>
 </ul>
 </td>
 </tr>
@@ -89,58 +93,61 @@ The input <strong>bb_list</strong> gets used otherwise.</li>
 </table>
 </dd></dl>
 
-<div class="highlight-python"><div class="highlight"><pre><span class="c">#Example script, that applies monte-carlo sampling to the n-terminal</span>
-<span class="c">#part of crambin</span>
-
-<span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span>
+<p>In this example, we apply Monte Carlo sampling to the N-terminal part of
+crambin:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
 <span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
 
-<span class="n">prot</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&quot;1crn&quot;</span><span class="p">,</span><span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="c"># setup protein</span>
+<span class="n">prot</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&quot;1crn&quot;</span><span class="p">,</span> <span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
 
 <span class="n">chain_index</span> <span class="o">=</span> <span class="mi">0</span>
 <span class="n">start_resnum</span> <span class="o">=</span> <span class="mi">1</span>
-<span class="n">n_terminal_length</span> <span class="o">=</span> <span class="mi">8</span>
+<span class="n">n_terminal_length</span> <span class="o">=</span> <span class="mi">8</span>  
 
 <span class="n">seqres</span> <span class="o">=</span> <span class="s">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">])</span>
 <span class="n">terminal_sequence</span> <span class="o">=</span> <span class="n">seqres</span><span class="p">[:</span><span class="n">n_terminal_length</span><span class="p">]</span>
 
-
-<span class="c">#setup mc_sampler</span>
+<span class="c"># setup mc_sampler</span>
 <span class="n">torsion_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSampler</span><span class="p">()</span>
-<span class="n">mc_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">SoftSampler</span><span class="p">(</span><span class="n">terminal_sequence</span><span class="p">,</span><span class="n">torsion_sampler</span><span class="p">,</span><span class="mf">10.0</span><span class="o">/</span><span class="mi">180</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">)</span>
+<span class="n">mc_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">SoftSampler</span><span class="p">(</span><span class="n">terminal_sequence</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">,</span>
+                              <span class="mf">10.0</span> <span class="o">/</span> <span class="mi">180</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">)</span>
 
-<span class="c">#setup mc_closer</span>
+<span class="c"># setup mc_closer</span>
 <span class="n">mc_closer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">NTerminalCloser</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">n_terminal_length</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
 
-<span class="c">#set up mc_scorer</span>
+<span class="c"># set up mc_scorer</span>
 <span class="n">scorer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadBackboneLoopScorer</span><span class="p">()</span>
 <span class="n">scorer</span><span class="o">.</span><span class="n">Initialize</span><span class="p">(</span><span class="n">seqres</span><span class="p">)</span>
 <span class="n">scorer</span><span class="o">.</span><span class="n">SetEnvironment</span><span class="p">(</span><span class="n">prot</span><span class="p">)</span>
 
 <span class="n">weights</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
-<span class="n">weights</span><span class="p">[</span><span class="s">&quot;cbeta&quot;</span><span class="p">]</span><span class="o">=</span><span class="mf">10.0</span>
-<span class="n">weights</span><span class="p">[</span><span class="s">&quot;clash&quot;</span><span class="p">]</span><span class="o">=</span><span class="mf">0.1</span>
-<span class="n">mc_scorer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LinearScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">,</span><span class="n">start_resnum</span><span class="p">,</span><span class="n">chain_index</span><span class="p">,</span><span class="n">weights</span><span class="p">)</span>
+<span class="n">weights</span><span class="p">[</span><span class="s">&quot;cbeta&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">10.0</span>
+<span class="n">weights</span><span class="p">[</span><span class="s">&quot;clash&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.1</span>
+<span class="n">mc_scorer</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LinearScorer</span><span class="p">(</span><span class="n">scorer</span><span class="p">,</span> <span class="n">start_resnum</span><span class="p">,</span> <span class="n">chain_index</span><span class="p">,</span>
+                              <span class="n">weights</span><span class="p">)</span>
 
-<span class="c">#setup mc_cooler</span>
-<span class="n">mc_cooler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">ExponentialCooler</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mf">0.9</span><span class="p">)</span>
+<span class="c"># setup mc_cooler</span>
+<span class="n">mc_cooler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">ExponentialCooler</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">)</span>
 
-<span class="c">#create BackboneList from n-terminus</span>
-<span class="n">bb_list</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">terminal_sequence</span><span class="p">,</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[:</span><span class="n">n_terminal_length</span><span class="p">])</span>
+<span class="c"># create BackboneList from n-terminus</span>
+<span class="n">bb_list</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">terminal_sequence</span><span class="p">,</span>
+                            <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[:</span><span class="n">n_terminal_length</span><span class="p">])</span>
 
-<span class="c">#shake it!</span>
-<span class="n">loop</span><span class="o">.</span><span class="n">MonteCarloLoopSampler</span><span class="p">(</span><span class="n">mc_sampler</span><span class="p">,</span> <span class="n">mc_closer</span><span class="p">,</span> <span class="n">mc_scorer</span><span class="p">,</span> <span class="n">mc_cooler</span><span class="p">,</span> <span class="mi">10000</span><span class="p">,</span><span class="n">bb_list</span><span class="p">,</span><span class="bp">False</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
+<span class="c"># shake it!</span>
+<span class="n">loop</span><span class="o">.</span><span class="n">SampleMonteCarlo</span><span class="p">(</span><span class="n">mc_sampler</span><span class="p">,</span> <span class="n">mc_closer</span><span class="p">,</span> <span class="n">mc_scorer</span><span class="p">,</span> <span class="n">mc_cooler</span><span class="p">,</span>
+	                  <span class="mi">10000</span><span class="p">,</span> <span class="n">bb_list</span><span class="p">,</span> <span class="bp">False</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
 
-<span class="c">#save down the result</span>
-<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">bb_list</span><span class="o">.</span><span class="n">ToEntity</span><span class="p">(),</span><span class="s">&quot;sampled_frag.pdb&quot;</span><span class="p">)</span>
+<span class="c"># save down the result</span>
+<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">bb_list</span><span class="o">.</span><span class="n">ToEntity</span><span class="p">(),</span> <span class="s">&quot;sampled_frag.pdb&quot;</span><span class="p">)</span>
 </pre></div>
 </div>
 <div class="section" id="sampler-object">
 <span id="mc-sampler-object"></span><h2>Sampler Object<a class="headerlink" href="#sampler-object" title="Permalink to this headline">¶</a></h2>
 <p>The sampler objects can be used to generate initial conformations and
 propose new conformations for a sequence of interest. They build the basis
-for any monte carlo sampling pipeline.</p>
+for any Monte Carlo sampling pipeline.</p>
 <dl class="class">
 <dt id="promod3.loop.PhiPsiSampler">
 <em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">PhiPsiSampler</code><span class="sig-paren">(</span><em>sequence</em>, <em>torsion_sampler</em><span class="optional">[</span>, <em>n_stem_phi=-1.0472</em>, <em>c_stem_psi=-0.78540</em>, <em>prev_aa='A'</em>, <em>next_aa='A'</em>, <em>seed=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.PhiPsiSampler" title="Permalink to this definition">¶</a></dt>
@@ -210,10 +217,9 @@ principle also applies for the last residue.</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If size of <strong>actual_positions</strong>
-is not consistent with the internal sequence. Note,
-that the sequence itself doesn&#8217;t get checked for
-efficiency reasons.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> If size of <strong>actual_positions</strong>
+is not consistent with the internal sequence. Note, that the
+sequence itself doesn&#8217;t get checked for efficiency reasons.</p>
 </td>
 </tr>
 </tbody>
@@ -299,10 +305,9 @@ when a new step should be proposed</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If size of <strong>actual_positions</strong>
-is not consistent with the internal sequence. Note,
-that the sequence itself doesn&#8217;t get checked for
-efficiency reasons.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> If size of <strong>actual_positions</strong>
+is not consistent with the internal sequence. Note, that the
+sequence itself doesn&#8217;t get checked for efficiency reasons.</p>
 </td>
 </tr>
 </tbody>
@@ -313,23 +318,30 @@ efficiency reasons.</p>
 
 <dl class="class">
 <dt id="promod3.loop.FragmentSampler">
-<em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">FragmentSampler</code><span class="sig-paren">(</span><em>sequence</em>, <em>fraggers</em><span class="optional">[</span>, <em>init_fragments = 3</em>, <em>seed = 0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragmentSampler" title="Permalink to this definition">¶</a></dt>
+<em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">FragmentSampler</code><span class="sig-paren">(</span><em>sequence</em>, <em>fraggers</em><span class="optional">[</span>, <em>init_bb_list = BackboneList(sequence)</em>, <em>sampling_start_index = 0</em>, <em>init_fragments = 3</em>, <em>seed = 0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragmentSampler" title="Permalink to this definition">¶</a></dt>
 <dd><p>The FragmentSampler samples by replacing full fragments originating from a list
-of <a class="reference internal" href="structure_db.html#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> objects.</p>
+of <a class="reference internal" href="structure_db.html#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> objects. The region, that actually gets sampled is
+determined by <strong>sampling_start_index</strong> and number of <a class="reference internal" href="structure_db.html#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> objects
+being available. All parts not covered by any fragger remain rigid.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
-<li><strong>sequence</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Sequence that should be sampled</li>
+<li><strong>sequence</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Overall sequence</li>
 <li><strong>fraggers</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; A list of <a class="reference internal" href="structure_db.html#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> objects. The first fragger
-covers the region starting at the first letter of the
-<strong>sequence</strong> and so on. All fraggers must contain fragments
-of equal size an exactly cover the full sequence to
-be sampled.</li>
-<li><strong>init_fragments</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; When calling the Initialize function, a completely helical
-conformation gets created. This is the number of fragments
-that gets randomly selected and inserted.</li>
+covers the region starting at the letter
+<strong>sampling_start_index</strong> of the <strong>sequence</strong> and so on.
+All fraggers must contain fragments of equal size.</li>
+<li><strong>init_bb_list</strong> (<a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a>) &#8211; Initial conformation, that serves as a starting point for
+sampling. The default gets constructed using the default
+constructor of <a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> and results in
+a helix.</li>
+<li><strong>sampling_start_index</strong> &#8211; Defines the beginning of the region, that actually
+gets sampled.</li>
+<li><strong>init_fragments</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; When calling the Initialize function, the positions get set
+to the ones of <strong>init_bb_list</strong>. This is the number of
+fragments that gets randomly selected and inserted.</li>
 <li><strong>seed</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Seed for the internal random number generators</li>
 </ul>
 </td>
@@ -339,8 +351,9 @@ that gets randomly selected and inserted.</li>
 <dl class="method">
 <dt id="promod3.loop.FragmentSampler.Initialize">
 <code class="descname">Initialize</code><span class="sig-paren">(</span><em>bb_list</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragmentSampler.Initialize" title="Permalink to this definition">¶</a></dt>
-<dd><p>Sets up a new <a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by creating a helix and replace n fragments
-with n = <strong>init_fragments</strong> as given at the samplers initialization</p>
+<dd><p>Sets up a new <a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a> by setting the setting
+bb_list = <strong>init_bb_list</strong> and randomly replace n fragments
+with n = <strong>init_fragments</strong></p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -391,11 +404,11 @@ avoid moving into unfavourable phi/psi ranges.</p>
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
 <li><strong>n_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Defining stem positions the closed conformation
-should adapt.</li>
+should adapt. See <a class="reference internal" href="loop_closing.html#promod3.loop.CCD.CCD" title="promod3.loop.CCD.CCD"><code class="xref py py-meth docutils literal"><span class="pre">CCD()</span></code></a>.</li>
 <li><strong>c_stem</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ResidueHandle</span></code></a>) &#8211; Defining stem positions the closed conformation
-should adapt.</li>
+should adapt. See <a class="reference internal" href="loop_closing.html#promod3.loop.CCD.CCD" title="promod3.loop.CCD.CCD"><code class="xref py py-meth docutils literal"><span class="pre">CCD()</span></code></a>.</li>
 <li><strong>sequence</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Sequence of the conformation to be closed.</li>
 <li><strong>torsion_sampler</strong> (<a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; To enforce valid phi/psi ranges. Alternatively
 you can also pass a list of <a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>
@@ -405,13 +418,6 @@ every residue of the conformation to be closed.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if the residues before <strong>n_stem</strong>
-and after c_stem cannot be accessed. This is necessary
-to extract the histogram indices for the torsion
-sampler and to calculate the phi/psi angles of the
-stems.</p>
-</td>
-</tr>
 </tbody>
 </table>
 <dl class="method">
@@ -565,7 +571,7 @@ energy, the lower the better.</p>
 <dl class="class">
 <dt id="promod3.loop.LinearScorer">
 <em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">LinearScorer</code><span class="sig-paren">(</span><em>scorer</em>, <em>start_resnum</em>, <em>chain_index</em>, <em>weights</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.LinearScorer" title="Permalink to this definition">¶</a></dt>
-<dd><p>The LinearScorer allows to combine the scores availabler from
+<dd><p>The LinearScorer allows to combine the scores available from
 <a class="reference internal" href="backbone_loop_score.html#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a> in a linear manner.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -579,12 +585,13 @@ residue numbers start from one.</li>
 <li><strong>chain_index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The chain the loop belongs to.</li>
 <li><strong>weights</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/stdtypes.html#dict" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a>) &#8211; Assigns every score, that should be combined a linear
 weight. Key of dict is a score name and can be any of:
-[&#8220;cbeta&#8221;, &#8220;clash&#8221;, &#8220;torsion&#8221;, &#8220;cb_packing&#8221;, &#8220;hbond&#8221;, &#8220;dssp_hbond&#8221;].
+[&#8220;cbeta&#8221;, &#8220;clash&#8221;, &#8220;torsion&#8221;, &#8220;cb_packing&#8221;, &#8220;hbond&#8221;, &#8220;ss_agreement&#8221;,
+&#8220;reduced&#8221;, &#8220;contact&#8221;, &#8220;constraint&#8221;].
 An additional possible key is: &#8220;intercept&#8221;.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If there is an invalid weight name.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if there is an invalid weight name.</p>
 </td>
 </tr>
 </tbody>
@@ -609,7 +616,7 @@ An additional possible key is: &#8220;intercept&#8221;.</li>
 </div>
 <div class="section" id="cooler-object">
 <span id="mc-cooler-object"></span><h2>Cooler Object<a class="headerlink" href="#cooler-object" title="Permalink to this headline">¶</a></h2>
-<p>The cooler objects control the temperature of the monte carlo trajectory.
+<p>The cooler objects control the temperature of the Monte Carlo trajectory.
 They&#8217;re intended to deliver steadily decreasing temperatures with calls
 to their GetTemperature function.</p>
 <dl class="class">
@@ -675,7 +682,7 @@ the returned temperature gets multiplied by the <strong>cooling_factor</strong>.
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
       <li>Previous: <a href="backbone_loop_score.html" title="previous chapter">Loop Scoring</a></li>
       <li>Next: <a href="load_loop_objects.html" title="next chapter">Load Loop Objects</a></li>
@@ -709,7 +716,7 @@ the returned temperature gets multiplied by the <strong>cooling_factor</strong>.
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/structure_db.html b/doc/html/loop/structure_db.html
index 29ffdc9b3ac4ed770661e0e87e0a021eb4b1b7c0..d0c9e0f0db21fe2612920ebf6607e297a8f318ef 100644
--- a/doc/html/loop/structure_db.html
+++ b/doc/html/loop/structure_db.html
@@ -54,11 +54,11 @@ Following features get stored on a per residue basis:</p>
 <li>The secondary structure state as defined by dssp</li>
 <li>The solvent accessibility in square Angstrom as calculated by dssp</li>
 <li>The residue depth defined as the average distance from all atoms of a
-residue to the closest surface vertex as calculated by msms <a class="reference internal" href="#sanner1996" id="id3">[sanner1996]</a>
-- This is a simplified version of
-the residue depth as discussed in <a class="reference internal" href="#chakravarty1999" id="id4">[chakravarty1999]</a> and gets directly calculated
-when structural information gets added to the StructureDB</li>
-<li>The amino acid frequencies as given by an input HMM</li>
+residue to the closest surface vertex as calculated by msms <a class="reference internal" href="#sanner1996" id="id3">[sanner1996]</a>.
+This is a simplified version of the residue depth as discussed in
+<a class="reference internal" href="#chakravarty1999" id="id4">[chakravarty1999]</a> and gets directly calculated when structural information
+gets added to the StructureDB.</li>
+<li>The amino acid frequencies as given by an input sequence profile</li>
 <li>The amino acid frequency derived from structural alignments as described
 in <a class="reference internal" href="#zhou2005" id="id5">[zhou2005]</a> - Since the calculation of such a profile already requires a
 StructureDB, we end up in a hen and egg problem here... When adding
@@ -137,93 +137,101 @@ The offset parameter tells us where it exactly starts. (<a class="reference exte
 </div>
 <div class="section" id="the-database">
 <h2>The Database<a class="headerlink" href="#the-database" title="Permalink to this headline">¶</a></h2>
-<div class="highlight-python"><div class="highlight"><pre><span class="c">#this code example demonstrates how to create a structural database and</span>
-<span class="c">#fill it with content</span>
-
-<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
+<p>The following code example demonstrates how to create a structural database
+and fill it with content.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
+<span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span>
 <span class="kn">import</span> <span class="nn">os</span>
 
-<span class="c">#we also need the external tools dssp and msms, you have to make sure</span>
-<span class="c">#that they are somewhere in your PATH</span>
+<span class="c"># we also need the external tools dssp and msms, you have to make</span>
+<span class="c"># sure that they are somewhere in your PATH</span>
 <span class="kn">from</span> <span class="nn">ost.bindings</span> <span class="kn">import</span> <span class="n">dssp</span>
 <span class="kn">from</span> <span class="nn">ost.bindings</span> <span class="kn">import</span> <span class="n">msms</span>
 
 <span class="n">structure_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">StructureDB</span><span class="p">()</span>
 
-<span class="c">#lets fill in some structures. It gets assumed, that all required data lies</span>
-<span class="c">#in following directories</span>
-<span class="n">structure_dir</span> <span class="o">=</span> <span class="s">&quot;foo&quot;</span>
-<span class="n">hmm_dir</span> <span class="o">=</span> <span class="s">&quot;bar&quot;</span>
+<span class="c"># lets fill in some structures. It gets assumed, that all required</span>
+<span class="c"># data lies in the following directories</span>
+<span class="n">structure_dir</span> <span class="o">=</span> <span class="s">&quot;data&quot;</span>
+<span class="n">prof_dir</span> <span class="o">=</span> <span class="s">&quot;data&quot;</span>
 
-<span class="c">#the first 4 letters are suposed to be the pdb id, and the last one</span>
-<span class="c">#the corresponding chain name. The naming of the files in the</span>
-<span class="c">#directories is e.g. 1CRN.pdb for the structure and 1CRNA.hhm for the</span>
-<span class="c">#hmm. Please note, that the structure can contain several chains, whereas</span>
-<span class="c">#an hmm is considered unique for one particular sequence.</span>
-<span class="n">ids</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="n">CRNA</span><span class="p">,</span><span class="mi">1</span><span class="n">AKEA</span><span class="p">]</span>
+<span class="c"># the first 4 letters are suposed to be the pdb id, and the last one</span>
+<span class="c"># the corresponding chain name. The naming of the files in the</span>
+<span class="c"># directories is e.g. 1CRN.pdb for the structure and 1CRNA.hhm for</span>
+<span class="c"># the profile. Please note, that the structure can contain several</span>
+<span class="c"># chains, whereas the hhm file is only for that specific chain.</span>
+<span class="n">ids</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;1CRNA&quot;</span><span class="p">,</span> <span class="s">&quot;1AKIA&quot;</span><span class="p">]</span>
 
 <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">ids</span><span class="p">:</span>
 
-  <span class="n">pdb_id</span> <span class="o">=</span> <span class="n">i</span><span class="p">[:</span><span class="mi">4</span><span class="p">]</span>
-  <span class="n">chain_id</span> <span class="o">=</span> <span class="n">i</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span>
+    <span class="n">pdb_id</span> <span class="o">=</span> <span class="n">i</span><span class="p">[:</span><span class="mi">4</span><span class="p">]</span>
+    <span class="n">chain_id</span> <span class="o">=</span> <span class="n">i</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span>
 
-  <span class="c">#join together the data paths</span>
-  <span class="n">structure_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">structure_dir</span><span class="p">,</span><span class="n">pdb_id</span><span class="o">+</span><span class="s">&quot;.pdb&quot;</span><span class="p">)</span>
-  <span class="n">hmm_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">hmm_dir</span><span class="p">,</span><span class="n">pdb_id</span><span class="o">+</span><span class="n">chain_id</span><span class="o">+</span><span class="s">&quot;.hhm&quot;</span><span class="p">)</span>
+    <span class="c"># join together the data paths</span>
+    <span class="n">structure_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">structure_dir</span><span class="p">,</span> <span class="n">pdb_id</span> <span class="o">+</span> <span class="s">&quot;.pdb&quot;</span><span class="p">)</span>
+    <span class="n">prof_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">prof_dir</span><span class="p">,</span> <span class="n">pdb_id</span> <span class="o">+</span> <span class="n">chain_id</span> <span class="o">+</span> <span class="s">&quot;.hhm&quot;</span><span class="p">)</span>
 
-  <span class="c">#let&#39;s load the structure</span>
-  <span class="n">structure</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="n">structure_path</span><span class="p">)</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;cname=&quot;</span><span class="o">+</span><span class="n">chain_id</span><span class="o">+</span><span class="s">&quot; and peptide=True&quot;</span><span class="p">)</span>
-  <span class="c">#and the according HMM, that has to be in hhm format</span>
-  <span class="n">hmm</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">seq</span><span class="o">.</span><span class="n">HMM</span><span class="o">.</span><span class="n">Load</span><span class="p">(</span><span class="n">hmm_path</span><span class="p">)</span>
+    <span class="c"># let&#39;s load the structure</span>
+    <span class="n">structure</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="n">structure_path</span><span class="p">)</span>\
+                  <span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;cname=&quot;</span> <span class="o">+</span> <span class="n">chain_id</span> <span class="o">+</span> <span class="s">&quot; and peptide=True&quot;</span><span class="p">)</span>
+    <span class="c"># and the according profile in hhm format</span>
+    <span class="n">prof</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadSequenceProfile</span><span class="p">(</span><span class="n">prof_path</span><span class="p">)</span>
 
-  <span class="c">#we run dssp in a way, that the secondary structure, as well as</span>
-  <span class="c">#the solvent accessibily gets assigned</span>
-  <span class="n">dssp</span><span class="o">.</span><span class="n">AssignDSSP</span><span class="p">(</span><span class="n">structure</span><span class="p">,</span><span class="n">extract_burial_status</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+    <span class="c"># we run dssp in a way, that the secondary structure, as well as</span>
+    <span class="c"># the solvent accessibily gets assigned</span>
+    <span class="n">dssp</span><span class="o">.</span><span class="n">AssignDSSP</span><span class="p">(</span><span class="n">structure</span><span class="p">,</span> <span class="n">extract_burial_status</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
 
-  <span class="c">#as a final step we need the surface as calculated by msms</span>
-  <span class="n">surf</span> <span class="o">=</span> <span class="n">msms</span><span class="o">.</span><span class="n">CalculateSurface</span><span class="p">(</span><span class="n">structure</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+    <span class="c"># as a final step we need the surface as calculated by msms</span>
+    <span class="n">surf</span> <span class="o">=</span> <span class="n">msms</span><span class="o">.</span><span class="n">CalculateSurface</span><span class="p">(</span><span class="n">structure</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
 
-  <span class="c">#let&#39;s add it</span>
-  <span class="n">structure_db</span><span class="o">.</span><span class="n">AddCoordinates</span><span class="p">(</span><span class="n">pdb_id</span><span class="p">,</span><span class="n">chain_id</span><span class="p">,</span><span class="n">structure</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">surf</span><span class="p">,</span><span class="n">hmm</span><span class="p">)</span>
+    <span class="c"># let&#39;s add it</span>
+    <span class="n">structure_db</span><span class="o">.</span><span class="n">AddCoordinates</span><span class="p">(</span><span class="n">pdb_id</span><span class="p">,</span> <span class="n">chain_id</span><span class="p">,</span>
+                                <span class="n">structure</span><span class="o">.</span><span class="n">chains</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">surf</span><span class="p">,</span> <span class="n">prof</span><span class="p">)</span>
 
-<span class="c">#we Now have two structures in the database... Please note, that there</span>
-<span class="c">#is no profile derived from structures assigned yet. You might consider to use</span>
-<span class="c">#the default StructureDB to derive such profiles</span>
-<span class="n">default_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadStructureDB</span><span class="p">()</span>
+<span class="c"># we now have two structures in the database...</span>
+
+<span class="c"># Please note, that there is no profile derived from structures</span>
+<span class="c"># assigned yet. To demonstrate, we use our small db to derive</span>
+<span class="c"># profiles.</span>
+<span class="n">src_db</span> <span class="o">=</span> <span class="n">structure_db</span>
+<span class="c"># In practice you might want to use the default StructureDB instead:</span>
+<span class="c"># src_db = loop.LoadStructureDB()</span>
 
 <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">structure_db</span><span class="o">.</span><span class="n">GetNumCoords</span><span class="p">()):</span>
-  <span class="c">#get the CoordInfo for chain with index i</span>
-  <span class="n">coord_info</span> <span class="o">=</span> <span class="n">structure_db</span><span class="o">.</span><span class="n">GetCoordInfo</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
-  <span class="c">#define a fragment, that covers the full length</span>
-  <span class="n">fragment_info</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">FragmentInfo</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">coord_info</span><span class="o">.</span><span class="n">size</span><span class="p">)</span>
-  <span class="c">#extract the according BackboneList and the residue depths</span>
-  <span class="n">bb_list</span> <span class="o">=</span> <span class="n">structure_db</span><span class="o">.</span><span class="n">GetBackboneList</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span><span class="n">fragment_info</span><span class="p">)</span>
-  <span class="n">depths</span> <span class="o">=</span> <span class="n">structure_db</span><span class="o">.</span><span class="n">GetResidueDepths</span><span class="p">(</span><span class="n">fragment_info</span><span class="p">)</span>
-  <span class="c">#generate a profile based on the structural data in the default_db</span>
-  <span class="n">hmm</span> <span class="o">=</span> <span class="n">default_db</span><span class="o">.</span><span class="n">GenerateStructureProfile</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span><span class="n">depths</span><span class="p">)</span>
-  <span class="c">#and add it to the previously created structure_db</span>
-  <span class="n">structure_db</span><span class="o">.</span><span class="n">SetStructureProfile</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">hmm</span><span class="p">)</span>
-
-<span class="c">#That&#39;s it! Let&#39;s save it down...</span>
+    <span class="c"># get the CoordInfo for chain with index i </span>
+    <span class="n">coord_info</span> <span class="o">=</span> <span class="n">structure_db</span><span class="o">.</span><span class="n">GetCoordInfo</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
+    <span class="c"># define a fragment, that covers the full length</span>
+    <span class="n">fragment_info</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">FragmentInfo</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">coord_info</span><span class="o">.</span><span class="n">size</span><span class="p">)</span>
+    <span class="c"># extract the according BackboneList and the residue depths</span>
+    <span class="n">bb_list</span> <span class="o">=</span> <span class="n">structure_db</span><span class="o">.</span><span class="n">GetBackboneList</span><span class="p">(</span><span class="n">fragment_info</span><span class="p">)</span>
+    <span class="n">depths</span> <span class="o">=</span> <span class="n">structure_db</span><span class="o">.</span><span class="n">GetResidueDepths</span><span class="p">(</span><span class="n">fragment_info</span><span class="p">)</span>
+    <span class="c"># generate a profile based on the structural data in the src_db</span>
+    <span class="n">prof</span> <span class="o">=</span> <span class="n">src_db</span><span class="o">.</span><span class="n">GenerateStructureProfile</span><span class="p">(</span><span class="n">bb_list</span><span class="p">,</span> <span class="n">depths</span><span class="p">)</span>
+    <span class="c"># and add it to the previously created structure_db</span>
+    <span class="n">structure_db</span><span class="o">.</span><span class="n">SetStructureProfile</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">prof</span><span class="p">)</span>
+
+<span class="c"># That&#39;s it! Let&#39;s save it down...</span>
 <span class="n">structure_db</span><span class="o">.</span><span class="n">Save</span><span class="p">(</span><span class="s">&quot;my_db.dat&quot;</span><span class="p">)</span>
-
-<span class="c">#Calculating the structural profiles is highly expensive and heavily depends</span>
-<span class="c">#on the size of the database used as source...</span>
-<span class="c">#If you want to do this for a larger database, you might consider two things:</span>
-<span class="c">#</span>
-<span class="c">#  1. Use a database of limited size as structural source (something in</span>
-<span class="c">#     between 5000 and 10000 nonredundant chains is enough)</span>
-<span class="c">#  2. Use the ost.seq.HMMDB to gather hmms produced from jobs running</span>
-<span class="c">#     in parallel</span>
 </pre></div>
 </div>
+<p>Calculating the structural profiles is highly expensive and heavily depends on
+the size of the database used as source. If you want to do this for a larger
+database, you might want to consider two things:</p>
+<ol class="arabic simple">
+<li>Use a database of limited size as structural source (something
+in between 5000 and 10000 nonredundant chains is enough)</li>
+<li>Use the <code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileDB</span></code> to gather profiles produced from jobs
+running in parallel</li>
+</ol>
 <dl class="class">
 <dt id="promod3.loop.StructureDB">
 <em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">StructureDB</code><a class="headerlink" href="#promod3.loop.StructureDB" title="Permalink to this definition">¶</a></dt>
 <dd><dl class="method">
 <dt id="promod3.loop.StructureDB.Load">
 <code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="optional">[</span>, <em>load_frequencies=False</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.StructureDB.Load" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Loads raw binary file generated with <a class="reference internal" href="#promod3.loop.StructureDB.Save" title="promod3.loop.StructureDB.Save"><code class="xref py py-meth docutils literal"><span class="pre">Save()</span></code></a> (optimized for fast
+reading).</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
@@ -238,10 +246,19 @@ profile dependent functions.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The loaded StructureDB</p>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The loaded data base</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If <strong>filename</strong> does not exist.</p>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>file assumes different memory-layout than is available on this
+machine. Use <a class="reference internal" href="#promod3.loop.StructureDB.LoadPortable" title="promod3.loop.StructureDB.LoadPortable"><code class="xref py py-meth docutils literal"><span class="pre">LoadPortable()</span></code></a> to convert your file.</li>
+</ul>
 </td>
 </tr>
 </tbody>
@@ -251,15 +268,78 @@ profile dependent functions.</li>
 <dl class="method">
 <dt id="promod3.loop.StructureDB.Save">
 <code class="descname">Save</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.StructureDB.Save" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Saves raw binary representation (optimized for fast reading).This puts many
+assumptions on the memory-layout of the target-machine and hence it is not
+portable. A portable version is provided by <a class="reference internal" href="#promod3.loop.StructureDB.SavePortable" title="promod3.loop.StructureDB.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a>.
+Preferably portable files are distributed and converted to a raw binary
+before using them.</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file where the database will be saved</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file where the database will be saved</p>
+</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If db has been loaded with
-load_frequencies=False. This enforces only complete
-databases to be saved down.</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>db has been loaded with load_frequencies=False. This enforces
+only complete databases to be saved down.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.StructureDB.LoadPortable">
+<code class="descname">LoadPortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.StructureDB.LoadPortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads portable file generated with <a class="reference internal" href="#promod3.loop.StructureDB.SavePortable" title="promod3.loop.StructureDB.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a> (slow but less
+machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file from which to load the database.</p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The loaded data base</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>machine-dependent fundamental types are smaller than required.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.StructureDB.SavePortable">
+<code class="descname">SavePortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.StructureDB.SavePortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves portable binary representation (slow but less machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file where the database will be saved</p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>db has been loaded with load_frequencies=False. This enforces
+only complete databases to be saved down.</li>
+</ul>
+</td>
 </tr>
 </tbody>
 </table>
@@ -267,7 +347,7 @@ databases to be saved down.</td>
 
 <dl class="method">
 <dt id="promod3.loop.StructureDB.AddCoordinates">
-<code class="descname">AddCoordinates</code><span class="sig-paren">(</span><em>pdb_id</em>, <em>chain_name</em>, <em>chain</em>, <em>surf</em>, <em>hmm</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.StructureDB.AddCoordinates" title="Permalink to this definition">¶</a></dt>
+<code class="descname">AddCoordinates</code><span class="sig-paren">(</span><em>pdb_id</em>, <em>chain_name</em>, <em>chain</em>, <em>surf</em>, <em>prof</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.StructureDB.AddCoordinates" title="Permalink to this definition">¶</a></dt>
 <dd><p>This method takes a structural chain and searches the longest stretch of
 connected residues containing all necessary backbone atoms. This stretch
 gets then added to the database. Due to technical reasons, The maximal
@@ -281,17 +361,17 @@ extent along one of the base axis cannot exceed 650 A.</p>
 <li><strong>chain_name</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of the chain consisting of one letter</li>
 <li><strong>chain</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ChainView" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.ChainView</span></code></a>) &#8211; The actual chain</li>
 <li><strong>surf</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/surface/#ost.mol.SurfaceHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.mol.SurfaceHandle</span></code></a>) &#8211; A surface describint the solvent accessible surface</li>
-<li><strong>hmm</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.HMM</span></code>) &#8211; An HMM containing profile information.</li>
+<li><strong>prof</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileHandle</span></code>) &#8211; Profile information for this structure.</li>
 </ul>
 </td>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">DB Index of added chain.</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If size of chain is too large, when
-db has been loaded with load_frequencies=False or when
-the ATOMSEQ form the <strong>chain</strong> can&#8217;t be aligned with the
-SEQRES from the <strong>hmm</strong>.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if size of chain is too large,
+when db has been loaded with load_frequencies=False or when the
+ATOMSEQ form the <strong>chain</strong> can&#8217;t be aligned with the SEQRES from
+the <strong>prof</strong>.</p>
 </td>
 </tr>
 </tbody>
@@ -347,9 +427,9 @@ index <strong>idx</strong>.</td>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</td>
 </tr>
 </tbody>
 </table>
@@ -375,9 +455,9 @@ superposed onto.</li>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</p>
 </td>
 </tr>
 </tbody>
@@ -414,9 +494,9 @@ of the chains in the database.</p>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The sequence of <strong>fragment</strong></td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</td>
 </tr>
 </tbody>
 </table>
@@ -433,9 +513,9 @@ of the chains in the database.</td>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The dssp states of <strong>fragment</strong></td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</td>
 </tr>
 </tbody>
 </table>
@@ -453,9 +533,9 @@ of the chains in the database.</td>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A list of pairs containing the  phi and psi dihedral angles of every
 residue of the <strong>fragment</strong>.</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</td>
 </tr>
 </tbody>
 </table>
@@ -474,9 +554,9 @@ depths</td>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a> values describing
 the per residue depth</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</td>
 </tr>
 </tbody>
 </table>
@@ -496,9 +576,9 @@ accessibilities</td>
 the per residue solvent accessibilities in square A as
 calculated by dssp</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</td>
 </tr>
 </tbody>
 </table>
@@ -515,12 +595,12 @@ of the chains in the database.</td>
 profile</td>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The sequence profile for the residues defined by
-<strong>fragment</strong>, represented as a <code class="xref py py-class docutils literal"><span class="pre">ost.seq.HMM</span></code>
+<strong>fragment</strong>, represented as a <code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileHandle</span></code>
 with the BLOSUM62 probabilities as NULL model</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</td>
 </tr>
 </tbody>
 </table>
@@ -537,12 +617,12 @@ of the chains in the database.</td>
 profile</td>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The structure profile for the residues defined by
-<strong>fragment</strong>, represented as a <code class="xref py py-class docutils literal"><span class="pre">ost.seq.HMM</span></code>
+<strong>fragment</strong>, represented as a <code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileHandle</span></code>
 with the BLOSUM62 probabilities as NULL model</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If fragment is invalid. This is
-the case when the fragment does not fully fit into one
-of the chains in the database.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if fragment is invalid. This is
+the case when the fragment does not fully fit into one of the
+chains in the database.</td>
 </tr>
 </tbody>
 </table>
@@ -566,13 +646,12 @@ profile</li>
 </td>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The structure profile for the input,
-represented as a <code class="xref py py-class docutils literal"><span class="pre">ost.seq.HMM</span></code>
+represented as a <code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileHandle</span></code>
 with the BLOSUM62 probabilities as NULL model</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <strong>bb_list</strong> and
-<strong>residue_depths</strong> differ in size or when
-their size is 0</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>bb_list</strong> and
+<strong>residue_depths</strong> differ in size or when their size is 0</p>
 </td>
 </tr>
 </tbody>
@@ -581,23 +660,22 @@ their size is 0</p>
 
 <dl class="method">
 <dt id="promod3.loop.StructureDB.SetStructureProfile">
-<code class="descname">SetStructureProfile</code><span class="sig-paren">(</span><em>chain_idx</em>, <em>hmm</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.StructureDB.SetStructureProfile" title="Permalink to this definition">¶</a></dt>
-<dd><p>Takes the <strong>hmm</strong> and sets the corresponding StructureProfile
+<code class="descname">SetStructureProfile</code><span class="sig-paren">(</span><em>chain_idx</em>, <em>prof</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.StructureDB.SetStructureProfile" title="Permalink to this definition">¶</a></dt>
+<dd><p>Takes the <strong>prof</strong> and sets the corresponding StructureProfile
 frequencies in entry with <strong>chain_idx</strong></p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
-<li><strong>hmm</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.HMM</span></code>) &#8211; Source of profile frequencies</li>
+<li><strong>prof</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileHandle</span></code>) &#8211; Source of profile frequencies</li>
 <li><strong>chain_idx</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; idx of entry for which to set the frequencies</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If <strong>chain_idx</strong> does not match
-any entry in the db or when the size of the <strong>hmm</strong>
-does not exactly match the size of entry at
-<strong>chain_idx</strong></p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>chain_idx</strong> does not match
+any entry in the db or when the size of the <strong>prof</strong> does not
+exactly match the size of entry at <strong>chain_idx</strong></p>
 </td>
 </tr>
 </tbody>
@@ -610,44 +688,44 @@ does not exactly match the size of entry at
 <div class="section" id="finding-fragments-based-on-geometric-features">
 <h2>Finding Fragments based on Geometric Features<a class="headerlink" href="#finding-fragments-based-on-geometric-features" title="Permalink to this headline">¶</a></h2>
 <p>The fragment database allows to organize, search and access the information
-stored in a structural database (<a class="reference internal" href="#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>).
-In its current form it groups fragments in bins according to their length
-and the geometry of their N-stem and C-stem (described by 4 angles and the
-distance between the N-stem C atom and the C-stem N atom). It can therefore
-be searched for fragments matching a certain geometry of N and C stems.
-The bins are accessed through a hash table, making searching the database
-ultra fast.</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="c">#This example should illustrate how to create a custom FragDB</span>
-<span class="c">#based on a StructureDB</span>
-
+stored in a structural database (<a class="reference internal" href="#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>). In its current form it
+groups fragments in bins according to their length (incl. stems) and the
+geometry of their N-stem and C-stem (described by 4 angles and the distance
+between the N-stem C atom and the C-stem N atom). It can therefore be searched
+for fragments matching a certain geometry of N and C stems. The bins are
+accessed through a hash table, making searching the database ultra fast.</p>
+<p>This example illustrates how to create a custom FragDB based on a StructureDB:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
 
-<span class="c">#let&#39;s load the default structure_db</span>
-<span class="n">structure_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadStructureDB</span><span class="p">()</span>
+<span class="c"># let&#39;s load the default structure_db </span>
+<span class="n">structure_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">StructureDB</span><span class="o">.</span><span class="n">LoadPortable</span><span class="p">(</span><span class="s">&quot;data/port_str_db.dat&quot;</span><span class="p">)</span>
+<span class="c"># in practice you might want to use the default StructureDB instead:</span>
+<span class="c"># structure_db = loop.LoadStructureDB()</span>
 
-<span class="c">#and our beloved crambin...</span>
-<span class="n">structure</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;1crn&#39;</span><span class="p">,</span><span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="c"># and our beloved crambin...</span>
+<span class="n">structure</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&quot;1crn&quot;</span><span class="p">,</span> <span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
 
-<span class="c">#we now want to connect the residue with index 17 and 21</span>
+<span class="c"># we now want to connect the residue with index 17 and 21</span>
 <span class="n">n_stem</span> <span class="o">=</span> <span class="n">structure</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="mi">17</span><span class="p">]</span>
 <span class="n">c_stem</span> <span class="o">=</span> <span class="n">structure</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="mi">21</span><span class="p">]</span>
 
-<span class="c">#A custom FragDB can be build to identify fragments</span>
-<span class="c">#fulfilling these particular geometric constraints</span>
-<span class="n">frag_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">FragDB</span><span class="p">(</span><span class="mf">1.0</span><span class="p">,</span><span class="mi">20</span><span class="p">)</span>
+<span class="c"># a custom FragDB can be built to identify fragments</span>
+<span class="c"># fulfilling these particular geometric constraints</span>
+<span class="n">frag_db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">FragDB</span><span class="p">(</span><span class="mf">1.0</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
 
-<span class="c">#At this point we add all possible fragments of length 5</span>
-<span class="c">#with an RMSD threshold of 0.5</span>
-<span class="n">frag_db</span><span class="o">.</span><span class="n">AddFragments</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mf">0.5</span><span class="p">,</span><span class="n">structure_db</span><span class="p">)</span>
+<span class="c"># at this point we add all possible fragments of length 5 </span>
+<span class="c"># with an RMSD threshold of 0.5</span>
+<span class="n">frag_db</span><span class="o">.</span><span class="n">AddFragments</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">)</span>
 
-<span class="c">#The FragDB can now be used to extract FragmentInfo objects to finally query</span>
-<span class="c">#the StructureDB</span>
-<span class="n">fragment_infos</span> <span class="o">=</span> <span class="n">frag_db</span><span class="o">.</span><span class="n">SearchDB</span><span class="p">(</span><span class="n">n_stem</span><span class="p">,</span><span class="n">c_stem</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
+<span class="c"># the FragDB can now be used to extract FragmentInfo objects to</span>
+<span class="c"># finally query the StructureDB</span>
+<span class="n">fragment_infos</span> <span class="o">=</span> <span class="n">frag_db</span><span class="o">.</span><span class="n">SearchDB</span><span class="p">(</span><span class="n">n_stem</span><span class="p">,</span> <span class="n">c_stem</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
 
-<span class="c">#let&#39;s get the fragments in form of BackboneList objects and save the down</span>
+<span class="c"># get the fragments in form of BackboneList objects and store them</span>
 <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">f_i</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">fragment_infos</span><span class="p">):</span>
-  <span class="n">bb_list</span> <span class="o">=</span> <span class="n">structure_db</span><span class="o">.</span><span class="n">GetBackboneList</span><span class="p">(</span><span class="n">n_stem</span><span class="p">,</span><span class="n">c_stem</span><span class="p">,</span><span class="n">f_i</span><span class="p">)</span>
-  <span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">bb_list</span><span class="o">.</span><span class="n">ToEntity</span><span class="p">(),</span><span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">+</span><span class="s">&quot;.pdb&quot;</span><span class="p">)</span>
+    <span class="n">bb_list</span> <span class="o">=</span> <span class="n">structure_db</span><span class="o">.</span><span class="n">GetBackboneList</span><span class="p">(</span><span class="n">n_stem</span><span class="p">,</span> <span class="n">c_stem</span><span class="p">,</span> <span class="n">f_i</span><span class="p">)</span>
+    <span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">bb_list</span><span class="o">.</span><span class="n">ToEntity</span><span class="p">(),</span> <span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;.pdb&quot;</span><span class="p">)</span>
 </pre></div>
 </div>
 <dl class="class">
@@ -668,17 +746,29 @@ ultra fast.</p>
 <dl class="method">
 <dt id="promod3.loop.FragDB.Load">
 <code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.Load" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Loads raw binary file generated with <a class="reference internal" href="#promod3.loop.FragDB.Save" title="promod3.loop.FragDB.Save"><code class="xref py py-meth docutils literal"><span class="pre">Save()</span></code></a> (optimized for fast
+reading).</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file from which to load the database.</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file from which to load the database.</p>
+</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The loaded database</td>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The loaded database</p>
+</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#promod3.loop.FragDB" title="promod3.loop.FragDB"><code class="xref py py-class docutils literal"><span class="pre">FragDB</span></code></a></td>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.FragDB" title="promod3.loop.FragDB"><code class="xref py py-class docutils literal"><span class="pre">FragDB</span></code></a></p>
+</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> If <strong>filename</strong> does not exist.</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>file assumes different memory-layout than is available on this
+machine. Use <a class="reference internal" href="#promod3.loop.FragDB.LoadPortable" title="promod3.loop.FragDB.LoadPortable"><code class="xref py py-meth docutils literal"><span class="pre">LoadPortable()</span></code></a> to convert your file.</li>
+</ul>
+</td>
 </tr>
 </tbody>
 </table>
@@ -687,12 +777,65 @@ ultra fast.</p>
 <dl class="method">
 <dt id="promod3.loop.FragDB.Save">
 <code class="descname">Save</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.Save" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Saves raw binary representation (optimized for fast reading).This puts many
+assumptions on the memory-layout of the target-machine and hence it is not
+portable. A portable version is provided by <a class="reference internal" href="#promod3.loop.FragDB.SavePortable" title="promod3.loop.FragDB.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a>.
+Preferably portable files are distributed and converted to a raw binary
+before using them.</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file where the database will be saved</td>
 </tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FragDB.LoadPortable">
+<code class="descname">LoadPortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.LoadPortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads portable file generated with <a class="reference internal" href="#promod3.loop.FragDB.SavePortable" title="promod3.loop.FragDB.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a> (slow but less
+machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file from which to load the database.</p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The loaded database</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.FragDB" title="promod3.loop.FragDB"><code class="xref py py-class docutils literal"><span class="pre">FragDB</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>machine-dependent fundamental types are smaller than required.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FragDB.SavePortable">
+<code class="descname">SavePortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.SavePortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves portable binary representation (slow but less machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file where the database will be saved</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
 </tbody>
 </table>
 </dd></dl>
@@ -752,41 +895,51 @@ As the fragments are added they are organized in bins described by their length
 <dl class="method">
 <dt id="promod3.loop.FragDB.PrintStatistics">
 <code class="descname">PrintStatistics</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.PrintStatistics" title="Permalink to this definition">¶</a></dt>
-<dd><p>Prints statistics about the fragment databse, notably:
-1. the number of different stem groups (number of bins used to group the fragments according to the geometry of their stem residues)
-2. The total number of fragments in the database
-3. The minimal and maximal number of fragments found in a stem group.</p>
+<dd><p>Prints statistics about the fragment databse, notably:</p>
+<ol class="arabic simple">
+<li>the number of different stem groups (number of bins used to group the
+fragments according to the geometry of their stem residues)</li>
+<li>The total number of fragments in the database</li>
+<li>The minimal and maximal number of fragments found in a stem group.</li>
+</ol>
 </dd></dl>
 
 <dl class="method">
 <dt id="promod3.loop.FragDB.GetNumStemPairs">
 <code class="descname">GetNumStemPairs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.GetNumStemPairs" title="Permalink to this definition">¶</a></dt>
-<dd><p>Returns the number of stem groups (number of bins used to group the fragments according to the geometry of their stem residues).</p>
+<dt>
+<code class="descname">GetNumStemPairs</code><span class="sig-paren">(</span><em>loop_length</em><span class="sig-paren">)</span></dt>
+<dd><p>Returns the number of stem groups (number of bins used to group the
+fragments according to the geometry of their stem residues) for the whole db
+or for fragments of a given length.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The number of groups</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>loop_length</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The length of the fragments</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a></td>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The number of groups</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>loop_length</strong> &#8211; The length of the fragments</td>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a></td>
 </tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
+<dt id="promod3.loop.FragDB.GetNumFragments">
+<code class="descname">GetNumFragments</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.GetNumFragments" title="Permalink to this definition">¶</a></dt>
 <dt>
-<code class="descname">GetNumStemPairs</code><span class="sig-paren">(</span><em>loop_length</em><span class="sig-paren">)</span></dt>
-<dd><p>Returns the number of stem groups (number of bins used to group the fragments according to the geometry of their stem residues) for fragments of a given length.</p>
+<code class="descname">GetNumFragments</code><span class="sig-paren">(</span><em>loop_length</em><span class="sig-paren">)</span></dt>
+<dd><p>Returns the number of fragments in the database in total or for fragments of
+a given length.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>loop_length</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The length of the fragments</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The number of groups</td>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Number of fragments</td>
 </tr>
 <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a></td>
 </tr>
@@ -795,34 +948,32 @@ As the fragments are added they are organized in bins described by their length
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.loop.FragDB.GetNumFragments">
-<code class="descname">GetNumFragments</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.GetNumFragments" title="Permalink to this definition">¶</a></dt>
-<dd><p>Returns the number of fragments in the database.</p>
-<table class="docutils field-list" frame="void" rules="none">
+<dt id="promod3.loop.FragDB.HasFragLength">
+<code class="descname">HasFragLength</code><span class="sig-paren">(</span><em>loop_length</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.HasFragLength" title="Permalink to this definition">¶</a></dt>
+<dd><table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Number of fragments</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>loop_length</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The length of the fragments</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a></td>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True if fragments of given length exist. This function is quick.</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a></td>
 </tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt>
-<code class="descname">GetNumFragments</code><span class="sig-paren">(</span><em>loop_length</em><span class="sig-paren">)</span></dt>
-<dd><p>Returns the number of fragments of length <strong>loop_length</strong> in the database.</p>
-<table class="docutils field-list" frame="void" rules="none">
+<dt id="promod3.loop.FragDB.MaxFragLength">
+<code class="descname">MaxFragLength</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FragDB.MaxFragLength" title="Permalink to this definition">¶</a></dt>
+<dd><table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>loop_length</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; The length of the fragments</td>
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Maximal fragment length contained in db. This function is quick.</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Number of fragments</td>
-</tr>
-<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a></td>
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a></td>
 </tr>
 </tbody>
 </table>
@@ -889,53 +1040,59 @@ fragment from the <a class="reference internal" href="#promod3.loop.StructureDB"
 in between them. The scores are calculated as described for HHSearch <a class="reference internal" href="#soding2005" id="id10">[soding2005]</a>.
 In this case, the amino acid frequencies extracted from structural alignments are used.</li>
 </ul>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span> <span class="n">seq</span>
+<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
 
-<span class="c">#load an example structure</span>
-<span class="n">prot</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&quot;1crn&quot;</span><span class="p">,</span><span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="c"># load an example structure</span>
+<span class="n">prot</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&quot;1crn&quot;</span><span class="p">,</span> <span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
 
-<span class="c">#extract some additional information</span>
-<span class="n">seq</span> <span class="o">=</span> <span class="s">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">])</span>
+<span class="c"># extract some additional information</span>
+<span class="n">seqres</span> <span class="o">=</span> <span class="s">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">r</span><span class="o">.</span><span class="n">one_letter_code</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">])</span>
 <span class="n">frag_pos</span> <span class="o">=</span> <span class="mi">35</span>
 <span class="n">frag_length</span> <span class="o">=</span> <span class="mi">9</span>
-<span class="n">frag_seq</span> <span class="o">=</span> <span class="n">seq</span><span class="p">[</span><span class="n">frag_pos</span><span class="p">:</span><span class="n">frag_pos</span><span class="o">+</span><span class="n">frag_length</span><span class="p">]</span>
+<span class="n">frag_seq</span> <span class="o">=</span> <span class="n">seqres</span><span class="p">[</span><span class="n">frag_pos</span><span class="p">:</span><span class="n">frag_pos</span><span class="o">+</span><span class="n">frag_length</span><span class="p">]</span>
 <span class="n">frag_residues</span> <span class="o">=</span> <span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">frag_pos</span><span class="p">:</span><span class="n">frag_pos</span><span class="o">+</span><span class="n">frag_length</span><span class="p">]</span>
-<span class="n">ref_backbone</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">frag_seq</span><span class="p">,</span><span class="n">frag_residues</span><span class="p">)</span>
+<span class="n">ref_backbone</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">BackboneList</span><span class="p">(</span><span class="n">frag_seq</span><span class="p">,</span> <span class="n">frag_residues</span><span class="p">)</span>
 
-<span class="c">#let&#39;s load the StructureDB and a substitution matrix</span>
+<span class="c"># let&#39;s load the StructureDB and a substitution matrix</span>
 <span class="n">db</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadStructureDB</span><span class="p">()</span>
-<span class="n">subst_matrix</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">seq</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">BLOSUM62</span>
+<span class="n">subst_matrix</span> <span class="o">=</span> <span class="n">seq</span><span class="o">.</span><span class="n">alg</span><span class="o">.</span><span class="n">BLOSUM62</span>
 
-<span class="c">#the fragger object needs to be initialized with its target sequence</span>
+<span class="c"># the fragger object needs to be initialized with its target sequence</span>
 <span class="n">fragger</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">Fragger</span><span class="p">(</span><span class="n">frag_seq</span><span class="p">)</span>
 
-<span class="c">#we could now add an arbitrary number of parameters from different features</span>
-<span class="c">#for now we only go for the sequence similarity score</span>
+<span class="c"># we could now add an arbitrary number of parameters from different</span>
+<span class="c"># features for now we only go for the sequence similarity score</span>
 <span class="n">fragger</span><span class="o">.</span><span class="n">AddSeqSimParameters</span><span class="p">(</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">subst_matrix</span><span class="p">)</span>
 
-<span class="c">#the Fragger can finally be filled by providing a StructureDB</span>
-<span class="n">fragger</span><span class="o">.</span><span class="n">Fill</span><span class="p">(</span><span class="n">db</span><span class="p">,</span><span class="mf">1.0</span><span class="p">,</span><span class="mi">100</span><span class="p">)</span>
+<span class="c"># the Fragger can finally be filled by providing a StructureDB</span>
+<span class="n">fragger</span><span class="o">.</span><span class="n">Fill</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
 
-<span class="c">#let&#39;s see how good the fragments are...</span>
+<span class="c"># let&#39;s see how good the fragments are...</span>
 <span class="n">below_three</span> <span class="o">=</span> <span class="mi">0</span>
 <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">fragger</span><span class="p">)):</span>
-  <span class="n">ca_rmsd</span> <span class="o">=</span> <span class="n">fragger</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">CARMSD</span><span class="p">(</span><span class="n">ref_backbone</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span>
-  <span class="k">print</span> <span class="s">&quot;Fragment &quot;</span><span class="p">,</span><span class="n">i</span><span class="p">,</span> <span class="s">&quot; has CA RMSD of &quot;</span><span class="p">,</span><span class="n">ca_rmsd</span>
-  <span class="k">if</span> <span class="n">ca_rmsd</span> <span class="o">&lt;</span> <span class="mf">3.0</span><span class="p">:</span>
-    <span class="n">below_three</span> <span class="o">+=</span> <span class="mi">1</span>
-
-<span class="k">print</span> <span class="s">&quot;Fraction of fragments below 3A: &quot;</span><span class="p">,</span> <span class="nb">float</span><span class="p">(</span><span class="n">below_three</span><span class="p">)</span><span class="o">/</span><span class="nb">len</span><span class="p">(</span><span class="n">fragger</span><span class="p">)</span>
+    <span class="n">ca_rmsd</span> <span class="o">=</span> <span class="n">fragger</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">CARMSD</span><span class="p">(</span><span class="n">ref_backbone</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;Fragment </span><span class="si">%d</span><span class="s"> has CA RMSD of </span><span class="si">%.3f</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">ca_rmsd</span><span class="p">)</span>
+    <span class="k">if</span> <span class="n">ca_rmsd</span> <span class="o">&lt;</span> <span class="mf">3.0</span><span class="p">:</span>
+        <span class="n">below_three</span> <span class="o">+=</span> <span class="mi">1</span>
+
+<span class="n">fraction</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">below_three</span><span class="p">)</span><span class="o">/</span><span class="nb">len</span><span class="p">(</span><span class="n">fragger</span><span class="p">)</span>
+<span class="k">print</span> <span class="s">&quot;Fraction of fragments below 3A: </span><span class="si">%.2f</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">fraction</span>
+
+<span class="c"># add into a cached map with ID based on frag_pos</span>
+<span class="n">fragger_map</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">FraggerMap</span><span class="p">()</span>
+<span class="k">if</span> <span class="ow">not</span> <span class="n">fragger_map</span><span class="o">.</span><span class="n">Contains</span><span class="p">(</span><span class="n">frag_pos</span><span class="p">):</span>
+	<span class="n">fragger_map</span><span class="p">[</span><span class="n">frag_pos</span><span class="p">]</span> <span class="o">=</span> <span class="n">fragger</span>
+<span class="c"># store it for future use</span>
+<span class="n">fragger_map</span><span class="o">.</span><span class="n">SaveBB</span><span class="p">(</span><span class="s">&quot;frag_map.dat&quot;</span><span class="p">)</span>
 </pre></div>
 </div>
 <dl class="class">
 <dt id="promod3.loop.Fragger">
-<em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">Fragger</code><a class="headerlink" href="#promod3.loop.Fragger" title="Permalink to this definition">¶</a></dt>
-<dd><dl class="method">
-<dt id="promod3.loop.Fragger.Fragger">
-<code class="descname">Fragger</code><span class="sig-paren">(</span><em>seq</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.Fragger.Fragger" title="Permalink to this definition">¶</a></dt>
-<dd><p>Initialize a Fragger object to search a <a class="reference internal" href="#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a> for fragments with
-<strong>seq</strong> as target sequence. You need to add some score components before
-you can finally call the Fill function.</p>
+<em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">Fragger</code><span class="sig-paren">(</span><em>seq</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.Fragger" title="Permalink to this definition">¶</a></dt>
+<dd><p>A Fragger object to search a <a class="reference internal" href="#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a> for fragments with <strong>seq</strong>
+as target sequence. You need to add some score components before you can
+finally call the Fill function.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -944,8 +1101,6 @@ you can finally call the Fill function.</p>
 </tr>
 </tbody>
 </table>
-</dd></dl>
-
 <dl class="method">
 <dt id="promod3.loop.Fragger.Fill">
 <code class="descname">Fill</code><span class="sig-paren">(</span><em>db</em>, <em>rmsd_thresh</em>, <em>num_fragments</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.Fragger.Fill" title="Permalink to this definition">¶</a></dt>
@@ -1009,7 +1164,32 @@ There will be no pair of fragments with RMSD below <strong>rmsd_thresh</strong>.
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
 <li><strong>w</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; linear weight</li>
-<li><strong>psipred_prediction</strong> (<a class="reference internal" href="helper_classes.html#PsipredPrediction" title="PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a>) &#8211; Psipred prediction for fraggers target_sequence</li>
+<li><strong>psipred_prediction</strong> (<a class="reference internal" href="helper_classes.html#promod3.loop.PsipredPrediction" title="promod3.loop.PsipredPrediction"><code class="xref py py-class docutils literal"><span class="pre">PsipredPrediction</span></code></a>) &#8211; Psipred prediction for fraggers target_sequence</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.Fragger.AddTorsionProbabilityParameters">
+<code class="descname">AddTorsionProbabilityParameters</code><span class="sig-paren">(</span><em>w</em>, <em>torsion_sampler</em>, <em>aa_before</em>, <em>aa_after</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.Fragger.AddTorsionProbabilityParameters" title="Permalink to this definition">¶</a></dt>
+<dt>
+<code class="descname">AddTorsionProbabilityParameters</code><span class="sig-paren">(</span><em>w</em>, <em>torsion_sampler_list</em>, <em>aa_before</em>, <em>aa_after</em><span class="sig-paren">)</span></dt>
+<dd><p>Add TorsionProbability component of linear weight <strong>w</strong></p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>w</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; linear weight</li>
+<li><strong>torsion_sampler</strong> (<a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; Torsion sampler to be used for all residues.</li>
+<li><strong>torsion_sampler_list</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; One torsion sampler for each residue.</li>
+<li><strong>aa_before</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name (3 letter code) of the residue before the sequence
+linked to this object.</li>
+<li><strong>aa_after</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name (3 letter code) of the residue after the sequence
+linked to this object.</li>
 </ul>
 </td>
 </tr>
@@ -1019,7 +1199,7 @@ There will be no pair of fragments with RMSD below <strong>rmsd_thresh</strong>.
 
 <dl class="method">
 <dt id="promod3.loop.Fragger.AddSequenceProfileParameters">
-<code class="descname">AddSequenceProfileParameters</code><span class="sig-paren">(</span><em>w</em>, <em>hmm</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.Fragger.AddSequenceProfileParameters" title="Permalink to this definition">¶</a></dt>
+<code class="descname">AddSequenceProfileParameters</code><span class="sig-paren">(</span><em>w</em>, <em>prof</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.Fragger.AddSequenceProfileParameters" title="Permalink to this definition">¶</a></dt>
 <dd><p>Add SequenceProfile component of linear weight <strong>w</strong></p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -1027,7 +1207,7 @@ There will be no pair of fragments with RMSD below <strong>rmsd_thresh</strong>.
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
 <li><strong>w</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; linear weight</li>
-<li><strong>hmm</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.HMM</span></code>) &#8211; Profile for the fraggers target_sequence</li>
+<li><strong>prof</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileHandle</span></code>) &#8211; Profile for the fraggers target_sequence</li>
 </ul>
 </td>
 </tr>
@@ -1037,7 +1217,7 @@ There will be no pair of fragments with RMSD below <strong>rmsd_thresh</strong>.
 
 <dl class="method">
 <dt id="promod3.loop.Fragger.AddStructureProfileParameters">
-<code class="descname">AddStructureProfileParameters</code><span class="sig-paren">(</span><em>w</em>, <em>hmm</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.Fragger.AddStructureProfileParameters" title="Permalink to this definition">¶</a></dt>
+<code class="descname">AddStructureProfileParameters</code><span class="sig-paren">(</span><em>w</em>, <em>prof</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.Fragger.AddStructureProfileParameters" title="Permalink to this definition">¶</a></dt>
 <dd><p>Add StructureProfile component of linear weight <strong>w</strong></p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -1045,7 +1225,7 @@ There will be no pair of fragments with RMSD below <strong>rmsd_thresh</strong>.
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
 <li><strong>w</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; linear weight</li>
-<li><strong>hmm</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.HMM</span></code>) &#8211; Profile for the fraggers target_sequence</li>
+<li><strong>prof</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileHandle</span></code>) &#8211; Profile for the fraggers target_sequence</li>
 </ul>
 </td>
 </tr>
@@ -1077,6 +1257,8 @@ There will be no pair of fragments with RMSD below <strong>rmsd_thresh</strong>.
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Fragment at given position</td>
 </tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="backbone.html#promod3.loop.BackboneList" title="promod3.loop.BackboneList"><code class="xref py py-class docutils literal"><span class="pre">BackboneList</span></code></a></td>
+</tr>
 </tbody>
 </table>
 </dd></dl>
@@ -1123,7 +1305,8 @@ you added them to the <a class="reference internal" href="#promod3.loop.Fragger"
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
-<li><strong>parameter_index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Index of score</li>
+<li><strong>parameter_index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Index of score (0-indexed in order of score
+components that were added)</li>
 <li><strong>index</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Index of fragment</li>
 </ul>
 </td>
@@ -1134,6 +1317,214 @@ you added them to the <a class="reference internal" href="#promod3.loop.Fragger"
 
 </dd></dl>
 
+<dl class="class">
+<dt id="promod3.loop.FraggerMap">
+<em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">FraggerMap</code><a class="headerlink" href="#promod3.loop.FraggerMap" title="Permalink to this definition">¶</a></dt>
+<dd><p>A simple storable map of Fragger objects. The idea is that one can use the map
+to cache fragger lists that have already been generated.</p>
+<p>You can use <a class="reference internal" href="#promod3.loop.FraggerMap.Contains" title="promod3.loop.FraggerMap.Contains"><code class="xref py py-meth docutils literal"><span class="pre">Contains()</span></code></a> to check if an item with a given key
+(<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) already exists and access items with the [] operator (see
+<a class="reference internal" href="#promod3.loop.FraggerMap.__getitem__" title="promod3.loop.FraggerMap.__getitem__"><code class="xref py py-meth docutils literal"><span class="pre">__getitem__()</span></code></a> and <a class="reference internal" href="#promod3.loop.FraggerMap.__setitem__" title="promod3.loop.FraggerMap.__setitem__"><code class="xref py py-meth docutils literal"><span class="pre">__setitem__()</span></code></a>).</p>
+<p>Serialization is meant to be temporary and is not guaranteed to be portable.</p>
+<dl class="method">
+<dt id="promod3.loop.FraggerMap.Load">
+<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em>, <em>db</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FraggerMap.Load" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads raw binary file generated with <a class="reference internal" href="#promod3.loop.FraggerMap.Save" title="promod3.loop.FraggerMap.Save"><code class="xref py py-meth docutils literal"><span class="pre">Save()</span></code></a>.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Path to the file.</li>
+<li><strong>db</strong> (<a class="reference internal" href="#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>) &#8211; Source of structural data used when filling the fragments.</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The loaded map.</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.FraggerMap" title="promod3.loop.FraggerMap"><code class="xref py py-class docutils literal"><span class="pre">FraggerMap</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FraggerMap.Save">
+<code class="descname">Save</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FraggerMap.Save" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves raw binary representation of this map. Only fragment infos and scores
+are stored and not the parameters for scoring. The coordinates are to be
+reread from a structure db.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Path to the file.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FraggerMap.LoadBB">
+<code class="descname">LoadBB</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FraggerMap.LoadBB" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads raw binary file generated with <a class="reference internal" href="#promod3.loop.FraggerMap.SaveBB" title="promod3.loop.FraggerMap.SaveBB"><code class="xref py py-meth docutils literal"><span class="pre">SaveBB()</span></code></a>.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Path to the file.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The loaded map.</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#promod3.loop.FraggerMap" title="promod3.loop.FraggerMap"><code class="xref py py-class docutils literal"><span class="pre">FraggerMap</span></code></a></td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FraggerMap.SaveBB">
+<code class="descname">SaveBB</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FraggerMap.SaveBB" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves raw binary representation of this map. Only fragments and scores
+are stored and not the parameters for scoring. Here, we also store the
+coordinates. This file will hence be much larger than the one saved with
+<a class="reference internal" href="#promod3.loop.FraggerMap.Save" title="promod3.loop.FraggerMap.Save"><code class="xref py py-meth docutils literal"><span class="pre">Save()</span></code></a>.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Path to the file.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FraggerMap.Contains">
+<code class="descname">Contains</code><span class="sig-paren">(</span><em>id</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FraggerMap.Contains" title="Permalink to this definition">¶</a></dt>
+<dd><table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True, iff a fragger object for this id is already in the map.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FraggerMap.__getitem__">
+<code class="descname">__getitem__</code><span class="sig-paren">(</span><em>id</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FraggerMap.__getitem__" title="Permalink to this definition">¶</a></dt>
+<dt id="promod3.loop.FraggerMap.__setitem__">
+<code class="descname">__setitem__</code><span class="sig-paren">(</span><em>id</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.FraggerMap.__setitem__" title="Permalink to this definition">¶</a></dt>
+<dd><p>Allow read/write access (with [<em>id</em>]) to fragger object with given ID.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="promod3.loop.FraggerHandle">
+<em class="property">class </em><code class="descclassname">promod3.loop.</code><code class="descname">FraggerHandle</code><span class="sig-paren">(</span><em>prof</em>, <em>psipred_pred</em>, <em>fragment_length=9</em>, <em>fragments_per_position=100</em>, <em>rmsd_thresh=0.0</em>, <em>ss_agreement_weight=1.0</em>, <em>sequence_profile_weight=0.8</em>, <em>structure_profile_weight=2.0</em>, <em>torsion_weight=13.0</em>, <em>structure_db=None</em>, <em>torsion_sampler_coil=None</em>, <em>torsion_sampler_helix=None</em>, <em>torsion_sampler_extended=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/loop/_fragger.html#FraggerHandle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.loop.FraggerHandle" title="Permalink to this definition">¶</a></dt>
+<dd><p>Handler for Fragger objects linked to a specific chain.</p>
+<p>Fragments are chosen by a combined score of SSAgree, TorsionProbability,
+SequenceProfile and StructureProfile (see <a class="reference internal" href="#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> for details).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>prof</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.ProfileHandle</span></code>) &#8211; Sequence profile for this chain.</li>
+<li><strong>psipred_pred</strong> (<code class="xref py py-class docutils literal"><span class="pre">ost.seq.PsipredPrediction</span></code>) &#8211; Psipred prediction for this chain.</li>
+<li><strong>fragment_length</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Length (num. residues) of fragments to be extracted.</li>
+<li><strong>fragments_per_position</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Number of fragments to be extracted at each
+position.</li>
+<li><strong>rmsd_thresh</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; To guarantee structural diversity, no pair of fragments
+at a given position will have RMSD below <cite>rmsd_thresh</cite>.</li>
+<li><strong>ss_agreement_weight</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Linear weight for SSAgree score.</li>
+<li><strong>sequence_profile_weight</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Linear weight for SequenceProfile score.</li>
+<li><strong>structure_profile_weight</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Linear weight for StructureProfile score.</li>
+<li><strong>torsion_weight</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Linear weight for TorsionProbability score.</li>
+<li><strong>structure_db</strong> (<a class="reference internal" href="#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>) &#8211; Source of structural data</li>
+<li><strong>torsion_sampler_coil</strong> (<a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; Torsion sampler for coil residues.</li>
+<li><strong>torsion_sampler_helix</strong> (<a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; Torsion sampler for helical residues.</li>
+<li><strong>torsion_sampler_extended</strong> (<a class="reference internal" href="torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; Torsion sampler for extended residues.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<dl class="method">
+<dt id="promod3.loop.FraggerHandle.Get">
+<code class="descname">Get</code><span class="sig-paren">(</span><em>frag_pos</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/loop/_fragger.html#FraggerHandle.Get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.loop.FraggerHandle.Get" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get fragger for sequence at index frag_pos..frag_pos+frag_length-1.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>frag_pos</strong> (<em>:class`int`</em>) &#8211; Start-index (note that sequence-indexing starts at 0)</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A <a class="reference internal" href="#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> object.</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.ValueError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code></a> if index out-of-bounds.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FraggerHandle.GetList">
+<code class="descname">GetList</code><span class="sig-paren">(</span><em>pos_start=0</em>, <em>pos_end=-1</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/loop/_fragger.html#FraggerHandle.GetList"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.loop.FraggerHandle.GetList" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get List of fragments covering sequence indices pos_start..pos_end.</p>
+<p>This will return an empty list if range is smaller than fragment_length.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>pos_start</strong> (<em>:class`int`</em>) &#8211; Start-index (note that sequence-indexing starts at 0)</li>
+<li><strong>pos_end</strong> (<em>:class`int`</em>) &#8211; End-index or -1 if it should go to the sequence-end.</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference internal" href="#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> objects.</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.ValueError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code></a> if indices out-of-bounds.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FraggerHandle.LoadCached">
+<code class="descname">LoadCached</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/loop/_fragger.html#FraggerHandle.LoadCached"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.loop.FraggerHandle.LoadCached" title="Permalink to this definition">¶</a></dt>
+<dd><p>Load fragger objects stored with <a class="reference internal" href="#promod3.loop.FraggerHandle.SaveCached" title="promod3.loop.FraggerHandle.SaveCached"><code class="xref py py-meth docutils literal"><span class="pre">SaveCached()</span></code></a>.
+Note that here we require that the same structure db is set as was
+used when <cite>filename</cite> was saved.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.FraggerHandle.SaveCached">
+<code class="descname">SaveCached</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/loop/_fragger.html#FraggerHandle.SaveCached"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.loop.FraggerHandle.SaveCached" title="Permalink to this definition">¶</a></dt>
+<dd><p>Save cached fraggers.</p>
+</dd></dl>
+
+</dd></dl>
+
 <table class="docutils citation" frame="void" id="soding2005" rules="none">
 <colgroup><col class="label" /><col /></colgroup>
 <tbody valign="top">
@@ -1193,7 +1584,7 @@ you added them to the <a class="reference internal" href="#promod3.loop.Fragger"
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
       <li>Previous: <a href="torsion_sampler.html" title="previous chapter">Torsion Sampler</a></li>
       <li>Next: <a href="loop_closing.html" title="next chapter">Loop Closing</a></li>
@@ -1227,7 +1618,7 @@ you added them to the <a class="reference internal" href="#promod3.loop.Fragger"
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/loop/torsion_sampler.html b/doc/html/loop/torsion_sampler.html
index 64ce4355b71fc0cb20e9ae406e566d7c23b5d953..511bc81ab99b602ad85c45550fd747e56c185120 100644
--- a/doc/html/loop/torsion_sampler.html
+++ b/doc/html/loop/torsion_sampler.html
@@ -52,32 +52,39 @@ in question.
 The distributions of the sampler are internally stored in a vector, so that
 most methods which need to access a specific distribution can either take 3
 residue names or an index as input.</p>
+<p>As a showcase example, we randomly sample from a given torsion sample and
+store the resulting samples as a scatter plot:</p>
 <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
+<span class="c"># this requires matplotlib and numpy</span>
+<span class="kn">import</span> <span class="nn">matplotlib</span>
+<span class="c"># change next line, if you wish to use a GUI-based plot-output</span>
+<span class="n">matplotlib</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="s">&quot;Agg&quot;</span><span class="p">)</span>
 <span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>
 <span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
 
-<span class="c">#load a default sampler</span>
+<span class="c"># load a default sampler</span>
 <span class="n">t_sampler</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSampler</span><span class="p">()</span>
 
-<span class="c">#dihedral angles will be stored in here</span>
+<span class="c"># dihedral angles will be stored in here</span>
 <span class="n">phi</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
 <span class="n">psi</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
 
-<span class="c">#draw from a random distribution</span>
+<span class="c"># draw from a random distribution</span>
 <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1000</span><span class="p">):</span>
-  <span class="n">dihedral_pair</span> <span class="o">=</span> <span class="n">t_sampler</span><span class="o">.</span><span class="n">Draw</span><span class="p">(</span><span class="s">&quot;ALA&quot;</span><span class="p">,</span><span class="s">&quot;PRO&quot;</span><span class="p">,</span><span class="s">&quot;ALA&quot;</span><span class="p">)</span>
-  <span class="n">phi</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dihedral_pair</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
-  <span class="n">psi</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dihedral_pair</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
-
-<span class="c">#and plot it</span>
-<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">((</span><span class="o">-</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">,</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">))</span>
-<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">((</span><span class="o">-</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">,</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">))</span>
-<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">phi</span><span class="p">,</span><span class="n">psi</span><span class="p">,</span><span class="s">&#39;.&#39;</span><span class="p">)</span>
-<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">&quot;phi&quot;</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="s">&#39;large&#39;</span><span class="p">)</span>
-<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">&quot;psi&quot;</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="s">&#39;large&#39;</span><span class="p">)</span>
+    <span class="n">dihedral_pair</span> <span class="o">=</span> <span class="n">t_sampler</span><span class="o">.</span><span class="n">Draw</span><span class="p">(</span><span class="s">&quot;ALA&quot;</span><span class="p">,</span> <span class="s">&quot;PRO&quot;</span><span class="p">,</span> <span class="s">&quot;ALA&quot;</span><span class="p">)</span>
+    <span class="n">phi</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dihedral_pair</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+    <span class="n">psi</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dihedral_pair</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+
+<span class="c"># and plot it</span>
+<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="o">-</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">)</span>
+<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="o">-</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">)</span>
+<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">phi</span><span class="p">,</span> <span class="n">psi</span><span class="p">,</span> <span class="s">&#39;.&#39;</span><span class="p">)</span>
+<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">&quot;phi&quot;</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s">&#39;large&#39;</span><span class="p">)</span>
+<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">&quot;psi&quot;</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s">&#39;large&#39;</span><span class="p">)</span>
 <span class="n">plt</span><span class="o">.</span><span class="n">title</span><span class="p">(</span><span class="s">&quot;ALA-PRO-ALA&quot;</span><span class="p">)</span>
 
-<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
+<span class="c"># store plot as png file</span>
+<span class="n">plt</span><span class="o">.</span><span class="n">savefig</span><span class="p">(</span><span class="s">&quot;torsion_plot.png&quot;</span><span class="p">)</span>
 </pre></div>
 </div>
 <div class="section" id="defining-amino-acid-triplets">
@@ -140,16 +147,33 @@ acids not matching any of the group definitions.</p>
 
 <dl class="method">
 <dt id="promod3.loop.TorsionSampler.Load">
-<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.Load" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em>, <em>seed</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.Load" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads raw binary file generated with <a class="reference internal" href="#promod3.loop.TorsionSampler.Save" title="promod3.loop.TorsionSampler.Save"><code class="xref py py-meth docutils literal"><span class="pre">Save()</span></code></a> (optimized for fast
+reading).</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file from which to load the sampler.</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file from which to load the sampler.</li>
+<li><strong>seed</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; seed for random number generator (not saved in file).</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A torsion sampler</p>
+</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A torsion sampler</td>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a></p>
+</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a></td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>file assumes different memory-layout than is available on this
+machine. Use <a class="reference internal" href="#promod3.loop.TorsionSampler.LoadPortable" title="promod3.loop.TorsionSampler.LoadPortable"><code class="xref py py-meth docutils literal"><span class="pre">LoadPortable()</span></code></a> to convert your file.</li>
+</ul>
+</td>
 </tr>
 </tbody>
 </table>
@@ -158,12 +182,68 @@ acids not matching any of the group definitions.</p>
 <dl class="method">
 <dt id="promod3.loop.TorsionSampler.Save">
 <code class="descname">Save</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.Save" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Saves raw binary representation (optimized for fast reading).This puts many
+assumptions on the memory-layout of the target-machine and hence it is not
+portable. A portable version is provided by <a class="reference internal" href="#promod3.loop.TorsionSampler.SavePortable" title="promod3.loop.TorsionSampler.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a>.
+Preferably portable files are distributed and converted to a raw binary
+before using them.</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file where the sampler will be saved</td>
 </tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.TorsionSampler.LoadPortable">
+<code class="descname">LoadPortable</code><span class="sig-paren">(</span><em>filename</em>, <em>seed</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.LoadPortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads portable file generated with <a class="reference internal" href="#promod3.loop.TorsionSampler.SavePortable" title="promod3.loop.TorsionSampler.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a> (slow but less
+machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file from which to load the sampler.</li>
+<li><strong>seed</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; seed for random number generator (not saved in file).</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A torsion sampler</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>machine-dependent fundamental types are smaller than required.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.loop.TorsionSampler.SavePortable">
+<code class="descname">SavePortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.SavePortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves portable binary representation (slow but less machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; path to the file where the sampler will be saved</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
 </tbody>
 </table>
 </dd></dl>
@@ -202,7 +282,7 @@ should created.</td>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">List of length n-2 containing histogram indices of
 all consecutive amino acid triplets in <strong>sequence</strong></td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <strong>sequence</strong> contains non
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>sequence</strong> contains non
 standard amino acid</td>
 </tr>
 </tbody>
@@ -250,7 +330,7 @@ standard amino acid</td>
 <dl class="method">
 <dt id="promod3.loop.TorsionSampler.DrawPhiGivenPsi">
 <code class="descname">DrawPhiGivenPsi</code><span class="sig-paren">(</span><em>before</em>, <em>central</em>, <em>after</em>, <em>psi</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.DrawPhiGivenPsi" title="Permalink to this definition">¶</a></dt>
-<dd><p>Draws a <em>phi</em> angle for the <em>central</em> residue from the conditional distribution P(<em>phi*|*psi</em>) specific for such a triplet of residues.</p>
+<dd><p>Draws a <em>phi</em> angle for the <em>central</em> residue from the conditional distribution P( <em>phi</em> | <em>psi</em> ) specific for such a triplet of residues.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -273,7 +353,7 @@ standard amino acid</td>
 <dl class="method">
 <dt>
 <code class="descname">DrawPhiGivenPsi</code><span class="sig-paren">(</span><em>index</em>, <em>psi</em><span class="sig-paren">)</span></dt>
-<dd><p>Draws a <em>phi</em> angle from the conditional distribution P(<em>phi*|*psi</em>) specified by the <em>index</em>.</p>
+<dd><p>Draws a <em>phi</em> angle from the conditional distribution P( <em>phi</em> | <em>psi</em> ) specified by the <em>index</em>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -294,7 +374,7 @@ standard amino acid</td>
 <dl class="method">
 <dt id="promod3.loop.TorsionSampler.DrawPsiGivenPhi">
 <code class="descname">DrawPsiGivenPhi</code><span class="sig-paren">(</span><em>before</em>, <em>central</em>, <em>after</em>, <em>phi</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.DrawPsiGivenPhi" title="Permalink to this definition">¶</a></dt>
-<dd><p>Draws a <em>phi</em> angle for the <em>central</em> residue from the conditional distribution P(<em>psi*|*phi</em>) specific for such a triplet of residues.</p>
+<dd><p>Draws a <em>phi</em> angle for the <em>central</em> residue from the conditional distribution P( <em>psi</em> | <em>phi</em> ) specific for such a triplet of residues.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -317,7 +397,7 @@ standard amino acid</td>
 <dl class="method">
 <dt>
 <code class="descname">DrawPsiGivenPhi</code><span class="sig-paren">(</span><em>index</em>, <em>phi</em><span class="sig-paren">)</span></dt>
-<dd><p>Draws a <em>phi</em> angle from the conditional distribution P(<em>psi*|*phi</em>) specified by the <em>index</em>.</p>
+<dd><p>Draws a <em>phi</em> angle from the conditional distribution P( <em>psi</em> | <em>phi</em> ) specified by the <em>index</em>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -362,7 +442,7 @@ standard amino acid</td>
 <dl class="method">
 <dt>
 <code class="descname">GetProbability</code><span class="sig-paren">(</span><em>index</em>, <em>phi</em>, <em>psi</em><span class="sig-paren">)</span></dt>
-<dd><p>Returns the probability of a specific pair of phi/psi angles calulated form the distribution specified by <em>index</em>.</p>
+<dd><p>Returns the probability of a specific pair of phi/psi angles calulated from the distribution specified by <em>index</em>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -384,7 +464,7 @@ standard amino acid</td>
 <dl class="method">
 <dt id="promod3.loop.TorsionSampler.GetPhiProbabilityGivenPsi">
 <code class="descname">GetPhiProbabilityGivenPsi</code><span class="sig-paren">(</span><em>before</em>, <em>central</em>, <em>after</em>, <em>phi</em>, <em>psi</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.GetPhiProbabilityGivenPsi" title="Permalink to this definition">¶</a></dt>
-<dd><p>Returns P(<em>phi*|*psi</em>) for the central residue from the corresponding distribution.</p>
+<dd><p>Returns P( <em>phi</em> | <em>psi</em> ) for the central residue from the corresponding distribution.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -408,7 +488,7 @@ standard amino acid</td>
 <dl class="method">
 <dt id="promod3.loop.TorsionSampler.GetPsiProbabilityGivenPhi">
 <code class="descname">GetPsiProbabilityGivenPhi</code><span class="sig-paren">(</span><em>before</em>, <em>central</em>, <em>after</em>, <em>psi</em>, <em>phi</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.loop.TorsionSampler.GetPsiProbabilityGivenPhi" title="Permalink to this definition">¶</a></dt>
-<dd><p>Returns P(<em>psi*|*phi</em>) for the central residue from the corresponding distribution.</p>
+<dd><p>Returns P( <em>psi</em> | <em>phi</em> ) for the central residue from the corresponding distribution.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -432,7 +512,7 @@ standard amino acid</td>
 <dl class="method">
 <dt>
 <code class="descname">GetPhiProbabilityGivenPsi</code><span class="sig-paren">(</span><em>index</em>, <em>phi</em>, <em>psi</em><span class="sig-paren">)</span></dt>
-<dd><p>Returns P(<em>phi*|*psi</em>) for the central residue from the corresponding distribution.</p>
+<dd><p>Returns P( <em>phi</em> | <em>psi</em> ) for the central residue from the corresponding distribution.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -454,7 +534,7 @@ standard amino acid</td>
 <dl class="method">
 <dt>
 <code class="descname">GetPsiProbabilityGivenPhi</code><span class="sig-paren">(</span><em>index</em>, <em>psi</em>, <em>phi</em><span class="sig-paren">)</span></dt>
-<dd><p>Returns P(<em>psi*|*phi</em>) for the central residue from the corresponding distribution.</p>
+<dd><p>Returns P( <em>psi</em> | <em>phi</em> ) for the central residue from the corresponding distribution.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -524,7 +604,7 @@ standard amino acid</td>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
       <li>Previous: <a href="backbone.html" title="previous chapter">Backbone</a></li>
       <li>Next: <a href="structure_db.html" title="next chapter">Structural Database</a></li>
@@ -558,7 +638,7 @@ standard amino acid</td>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/modelling/index.html b/doc/html/modelling/index.html
index 51d7ec7567b8349e443604e573216adcc31f3822..7541f9ffe218eca4a0f9505e87ac2acdb69f19b2 100644
--- a/doc/html/modelling/index.html
+++ b/doc/html/modelling/index.html
@@ -24,9 +24,9 @@
     <script type="text/javascript" src="../_static/underscore.js"></script>
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
-    <link rel="up" title="Documentation For Developers" href="../developers.html" />
+    <link rel="up" title="Documentation For Users" href="../users.html" />
     <link rel="next" title="loop - Loop Modelling" href="../loop/index.html" />
-    <link rel="prev" title="helper - Shared Functionality For the Everything" href="../core/helper.html" />
+    <link rel="prev" title="Building ProMod3" href="../buildsystem.html" />
    
   
   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
@@ -47,7 +47,10 @@ the desired target sequence.
 A protein homology modelling pipeline then has the following main steps:</p>
 <ul class="simple">
 <li>Build a raw model from the template (see <a class="reference internal" href="#promod3.modelling.BuildRawModel" title="promod3.modelling.BuildRawModel"><code class="xref py py-func docutils literal"><span class="pre">BuildRawModel()</span></code></a> function)</li>
-<li>Perform loop modelling to close all gaps (see <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a> and <a class="reference internal" href="#promod3.modelling.FillLoopsByMonteCarlo" title="promod3.modelling.FillLoopsByMonteCarlo"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByMonteCarlo()</span></code></a> function)</li>
+<li>Perform loop modelling to close (or remove) all gaps (see functions
+<a class="reference internal" href="#promod3.modelling.CloseSmallDeletions" title="promod3.modelling.CloseSmallDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseSmallDeletions()</span></code></a>, <a class="reference internal" href="#promod3.modelling.RemoveTerminalGaps" title="promod3.modelling.RemoveTerminalGaps"><code class="xref py py-func docutils literal"><span class="pre">RemoveTerminalGaps()</span></code></a>,
+<a class="reference internal" href="#promod3.modelling.MergeGapsByDistance" title="promod3.modelling.MergeGapsByDistance"><code class="xref py py-func docutils literal"><span class="pre">MergeGapsByDistance()</span></code></a>, <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>,
+<a class="reference internal" href="#promod3.modelling.FillLoopsByMonteCarlo" title="promod3.modelling.FillLoopsByMonteCarlo"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByMonteCarlo()</span></code></a>, <a class="reference internal" href="#promod3.modelling.CloseLargeDeletions" title="promod3.modelling.CloseLargeDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseLargeDeletions()</span></code></a>)</li>
 <li>Build sidechains (see <a class="reference internal" href="#promod3.modelling.BuildSidechains" title="promod3.modelling.BuildSidechains"><code class="xref py py-func docutils literal"><span class="pre">BuildSidechains()</span></code></a> function)</li>
 <li>Minimize energy of final model using molecular mechanics
 (see <a class="reference internal" href="#promod3.modelling.MinimizeModelEnergy" title="promod3.modelling.MinimizeModelEnergy"><code class="xref py py-func docutils literal"><span class="pre">MinimizeModelEnergy()</span></code></a> function)</li>
@@ -71,8 +74,8 @@ a full protein homology modelling pipeline as follows:</p>
 </div>
 <p>If you want to run and tweak the internal steps, you can start with the
 following code which is equivalent to the example above:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span>
-<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span>
+<div class="highlight-python" id="modelling-steps-example"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span>
+<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span><span class="p">,</span> <span class="n">loop</span>
 
 <span class="c"># setup</span>
 <span class="n">merge_distance</span> <span class="o">=</span> <span class="mi">4</span>
@@ -88,32 +91,50 @@ following code which is equivalent to the example above:</p>
 
 <span class="c"># perform loop modelling to close all gaps</span>
 <span class="n">scorer</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
-<span class="n">modelling</span><span class="o">.</span><span class="n">CloseSmallDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">)</span>
 <span class="n">modelling</span><span class="o">.</span><span class="n">RemoveTerminalGaps</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">CloseSmallDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">)</span>
 <span class="k">for</span> <span class="n">distance</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">merge_distance</span><span class="p">):</span>
     <span class="n">modelling</span><span class="o">.</span><span class="n">MergeGapsByDistance</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">distance</span><span class="p">)</span>
     <span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span>
-                                  <span class="n">structure_db</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">)</span>
+                                  <span class="n">structure_db</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">,</span>
+                                  <span class="n">min_loops_required</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span>
+                                  <span class="n">max_res_extension</span><span class="o">=</span><span class="mi">6</span><span class="p">)</span>
+<span class="c"># if above fails, try DB-fill with less restrictions</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span>
+                              <span class="n">structure_db</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">,</span>
+                              <span class="n">min_loops_required</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">fragment_db</span><span class="p">,</span>
+                              <span class="n">structure_db</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">)</span>
 <span class="c"># if above fails on some gaps, use Monte Carlo</span>
-<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
-    <span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByMonteCarlo</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">)</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByMonteCarlo</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">torsion_sampler</span><span class="p">)</span>
+<span class="c"># as a last resort, try to close large deletions</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">CloseLargeDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">)</span>
 <span class="c"># build sidechains</span>
-<span class="n">modelling</span><span class="o">.</span><span class="n">BuildSidechains</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">BuildSidechains</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">merge_distance</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span>
+                          <span class="n">fragment_db</span><span class="p">,</span> <span class="n">structure_db</span><span class="p">,</span>
+                          <span class="n">torsion_sampler</span><span class="p">)</span>
 <span class="c"># minimize energy of final model using molecular mechanics</span>
 <span class="n">modelling</span><span class="o">.</span><span class="n">MinimizeModelEnergy</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
+<span class="c"># check final model and report issues</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">CheckFinalModel</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
 
 <span class="c"># extract final model</span>
 <span class="n">final_model</span> <span class="o">=</span> <span class="n">mhandle</span><span class="o">.</span><span class="n">model</span>
 <span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">final_model</span><span class="p">,</span> <span class="s">&#39;model.pdb&#39;</span><span class="p">)</span>
 </pre></div>
 </div>
+<p>In the default pipeline above, we call <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a> multiple
+times. First, we try to close &#8220;easy&#8221; gaps which require few extensions (we wish
+to limit the damage we do on the template) and for which we have plenty of loop
+candidates. If some gaps cannot be closed like this, we try less restrictive
+options. This approach is helpful if neighboring gaps are close together and the
+one closer to the C-terminus is easier to close. Several variants of the
+pipeline were evaluated on 1752 target-template-pairs and this one worked best.</p>
 <div class="section" id="modelling-pipeline">
 <h2>Modelling Pipeline<a class="headerlink" href="#modelling-pipeline" title="Permalink to this headline">¶</a></h2>
 <dl class="function">
 <dt id="promod3.modelling.BuildRawModel">
-<code class="descclassname">promod3.modelling.</code><code class="descname">BuildRawModel</code><span class="sig-paren">(</span><em>alignment</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.BuildRawModel" title="Permalink to this definition">¶</a></dt>
-<dt>
-<code class="descclassname">promod3.modelling.</code><code class="descname">BuildRawModel</code><span class="sig-paren">(</span><em>alignments</em><span class="sig-paren">)</span></dt>
+<code class="descclassname">promod3.modelling.</code><code class="descname">BuildRawModel</code><span class="sig-paren">(</span><em>aln</em>, <em>include_ligands=False</em>, <em>chain_names=            &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz&quot;</em>, <em>spdbv_style=False</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.BuildRawModel" title="Permalink to this definition">¶</a></dt>
 <dd><p>Builds a raw (pseudo) model from the alignment. Can either take a single
 alignment handle or an alignment handle list. Every list item is treated as a
 single chain in the final raw model.</p>
@@ -134,17 +155,22 @@ phosphoserine are copied as a whole with the modifications stripped off.</li>
 </ul>
 </div></blockquote>
 <p>Residue numbers are set such that missing residue in gaps are honoured and
-subsequent loop modelling can insert new residues without having to
-renumber.</p>
+subsequent loop modelling can insert new residues without having to renumber.
+<strong>The numbering of residues starts for every chain with the value 1</strong>.</p>
 <p>The returned <a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a> stores the obtained raw model as well
 as information about insertions and deletions in the gaps list.</p>
+<p>Note, that this class is used in SWISS-MODEL and hence, legacy code must be
+preserved.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
-<li><strong>alignment</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/seq/base/seq/#ost.seq.AlignmentHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">AlignmentHandle</span></code></a>) &#8211; Single alignment handle for raw model.</li>
-<li><strong>alignments</strong> (<code class="xref py py-class docutils literal"><span class="pre">AlignmentList</span></code>) &#8211; List of alignment handles for raw model with multiple chains.</li>
+<li><strong>aln</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/seq/base/seq/#ost.seq.AlignmentHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">AlignmentHandle</span></code></a> / <code class="xref py py-class docutils literal"><span class="pre">AlignmentList</span></code>) &#8211; Single alignment handle for raw model with single chain or
+list of alignment handles for raw model with multiple chains.</li>
+<li><strong>include_ligands</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True, if we wish to include ligands in the model.</li>
+<li><strong>chain_names</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Chains are named by a single chanacter taken from this.</li>
+<li><strong>spdbv_style</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True, if we need a model in the old SPDBV style.</li>
 </ul>
 </td>
 </tr>
@@ -154,8 +180,17 @@ as information about insertions and deletions in the gaps list.</p>
 <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a></p>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last">A <code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code> when the second sequence does not have an
-attached structure</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first">A <code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code> when:</p>
+<ul class="last simple">
+<li>the alignments do not have two sequences</li>
+<li>the second sequence does not have an attached structure</li>
+<li>the residues of the template structure do not match with the
+alignment sequence (note that you can set an &#8220;offset&#8221; (see
+<a class="reference external" href="http://www.openstructure.org/docs/1.3/seq/base/seq/#ost.seq.AlignmentHandle.SetSequenceOffset" title="(in OpenStructure v1.3.3)"><code class="xref py py-meth docutils literal"><span class="pre">SetSequenceOffset()</span></code></a>) for the
+template sequence (but not for the target))</li>
+<li>the target sequence has a non-zero offset (cannot be honored as
+the resulting model will always start its residue numbering at 1)</li>
+</ul>
 </td>
 </tr>
 </tbody>
@@ -164,50 +199,26 @@ attached structure</p>
 
 <dl class="function">
 <dt id="promod3.modelling.BuildFromRawModel">
-<code class="descclassname">promod3.modelling.</code><code class="descname">BuildFromRawModel</code><span class="sig-paren">(</span><em>mhandle</em>, <em>fragment_db=None</em>, <em>structure_db=None</em>, <em>torsion_sampler=None</em>, <em>merge_distance=4</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_pipeline.html#BuildFromRawModel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.BuildFromRawModel" title="Permalink to this definition">¶</a></dt>
+<code class="descclassname">promod3.modelling.</code><code class="descname">BuildFromRawModel</code><span class="sig-paren">(</span><em>mhandle</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_pipeline.html#BuildFromRawModel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.BuildFromRawModel" title="Permalink to this definition">¶</a></dt>
 <dd><p>Build a model starting with a raw model (see <a class="reference internal" href="#promod3.modelling.BuildRawModel" title="promod3.modelling.BuildRawModel"><code class="xref py py-func docutils literal"><span class="pre">BuildRawModel()</span></code></a>).</p>
-<p>This function will:</p>
-<ol class="arabic simple">
-<li>close small deletions and remove terminal gaps
-(see <a class="reference internal" href="#promod3.modelling.CloseSmallDeletions" title="promod3.modelling.CloseSmallDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseSmallDeletions()</span></code></a> and <a class="reference internal" href="#promod3.modelling.RemoveTerminalGaps" title="promod3.modelling.RemoveTerminalGaps"><code class="xref py py-func docutils literal"><span class="pre">RemoveTerminalGaps()</span></code></a>)</li>
-<li>iteratively: merge gaps of distance i and fill loops by database
-(i from 0 to <em>merge_distance</em>-1)
-(see <a class="reference internal" href="#promod3.modelling.MergeGapsByDistance" title="promod3.modelling.MergeGapsByDistance"><code class="xref py py-func docutils literal"><span class="pre">MergeGapsByDistance()</span></code></a> and <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>)</li>
-<li>close remaining gaps by Monte Carlo
-(see <a class="reference internal" href="#promod3.modelling.FillLoopsByMonteCarlo" title="promod3.modelling.FillLoopsByMonteCarlo"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByMonteCarlo()</span></code></a>)</li>
-<li>build sidechains
-(see <a class="reference internal" href="#promod3.modelling.BuildSidechains" title="promod3.modelling.BuildSidechains"><code class="xref py py-func docutils literal"><span class="pre">BuildSidechains()</span></code></a>)</li>
-<li>minimize energy for the final model, which is then returned
-(see <a class="reference internal" href="#promod3.modelling.MinimizeModelEnergy" title="promod3.modelling.MinimizeModelEnergy"><code class="xref py py-func docutils literal"><span class="pre">MinimizeModelEnergy()</span></code></a>)</li>
-</ol>
-<p>If function fails to close all gaps, it will produce a warning and return
-an incomplete model.</p>
+<p>This function implements a recommended pipeline to generate complete models
+from a raw model. The steps are shown in detail in the code example
+<a class="reference internal" href="#modelling-steps-example"><span>above</span></a>. If you wish to use your own
+pipeline, you can use that code as a starting point for your own custom
+modelling pipeline. For reproducibility, we recommend that you keep copies
+of custom pipelines.</p>
+<p>If the function fails to close all gaps, it will produce a warning and
+return an incomplete model.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
-<li><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; The prepared template coordinates loaded with the input
-alignment.</li>
-<li><strong>fragment_db</strong> (<a class="reference internal" href="../loop/structure_db.html#promod3.loop.FragDB" title="promod3.loop.FragDB"><code class="xref py py-class docutils literal"><span class="pre">FragDB</span></code></a>) &#8211; A fragment database coupled to the <em>structure_db</em>.
-Loads the default one shipped with ProMod3 if omitted.</li>
-<li><strong>structure_db</strong> (<a class="reference internal" href="../loop/structure_db.html#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>) &#8211; The structural database. Loads the default one shipped
-with ProMod3 if omitted.</li>
-<li><strong>torsion_sampler</strong> (<a class="reference internal" href="../loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; A sampler for torsion angles. Loads the default one
-shipped with ProMod3 if omitted.</li>
-<li><strong>merge_distance</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Maximal distance up to which 2 gaps are merged. The
-gaps need to be immediate neighbours, distance is
-counted by residues, including stems. So <strong>A-A-A</strong>
-have a distance of 0 and therefore merging is only
-applied until <em>merge_distance</em> - 1.</li>
-</ul>
-</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; The prepared template coordinates loaded with the input
+alignment.</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Delivers the model as an OST entity.</p>
-</td>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Delivers the model as an OST entity.</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">Entity</span></code></a></p>
-</td>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">Entity</span></code></a></td>
 </tr>
 </tbody>
 </table>
@@ -215,14 +226,34 @@ applied until <em>merge_distance</em> - 1.</li>
 
 <dl class="function">
 <dt id="promod3.modelling.BuildSidechains">
-<code class="descclassname">promod3.modelling.</code><code class="descname">BuildSidechains</code><span class="sig-paren">(</span><em>mhandle</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_pipeline.html#BuildSidechains"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.BuildSidechains" title="Permalink to this definition">¶</a></dt>
+<code class="descclassname">promod3.modelling.</code><code class="descname">BuildSidechains</code><span class="sig-paren">(</span><em>mhandle</em>, <em>merge_distance=4</em>, <em>scorer=None</em>, <em>fragment_db=None</em>, <em>structure_db=None</em>, <em>torsion_sampler=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_pipeline.html#BuildSidechains"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.BuildSidechains" title="Permalink to this definition">¶</a></dt>
 <dd><p>Build sidechains for model.</p>
-<p>This is esentially a wrapper for <a class="reference internal" href="../sidechain/index.html#promod3.sidechain.Reconstruct" title="promod3.sidechain.Reconstruct"><code class="xref py py-func docutils literal"><span class="pre">promod3.sidechain.Reconstruct()</span></code></a>.</p>
+<p>This is a wrapper for <a class="reference internal" href="../sidechain/index.html#promod3.sidechain.Reconstruct" title="promod3.sidechain.Reconstruct"><code class="xref py py-func docutils literal"><span class="pre">promod3.sidechain.Reconstruct()</span></code></a>, followed
+by a check for ring punches. If ring punches are found it introduces gaps
+for the residues with punched rings and tries to fill them with 
+<a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a> with <em>ring_punch_detection=2</em>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; Modelling handle on which to apply change.</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; Modelling handle on which to apply change.</li>
+<li><strong>merge_distance</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Used as parameter for <a class="reference internal" href="#promod3.modelling.MergeGapsByDistance" title="promod3.modelling.MergeGapsByDistance"><code class="xref py py-func docutils literal"><span class="pre">MergeGapsByDistance()</span></code></a>
+if ring punches are found.</li>
+<li><strong>scorer</strong> (<a class="reference internal" href="../loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a>) &#8211; Used as parameter for <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>
+if ring punches are found. A default one is created
+if None.</li>
+<li><strong>fragment_db</strong> (<a class="reference internal" href="../loop/structure_db.html#promod3.loop.FragDB" title="promod3.loop.FragDB"><code class="xref py py-class docutils literal"><span class="pre">FragDB</span></code></a>) &#8211; Used as parameter for <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>
+if ring punches are found. A default one is loaded
+if None.</li>
+<li><strong>structure_db</strong> (<a class="reference internal" href="../loop/structure_db.html#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>) &#8211; Used as parameter for <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>
+if ring punches are found. A default one is loaded
+if None.</li>
+<li><strong>torsion_sampler</strong> (<a class="reference internal" href="../loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; Used as parameter for <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>
+if ring punches are found. A default one is loaded
+if None.</li>
+</ul>
+</td>
 </tr>
 </tbody>
 </table>
@@ -230,18 +261,21 @@ applied until <em>merge_distance</em> - 1.</li>
 
 <dl class="function">
 <dt id="promod3.modelling.MinimizeModelEnergy">
-<code class="descclassname">promod3.modelling.</code><code class="descname">MinimizeModelEnergy</code><span class="sig-paren">(</span><em>mhandle</em>, <em>max_iterations=3</em>, <em>max_iter_sd=30</em>, <em>max_iter_lbfgs=20</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_pipeline.html#MinimizeModelEnergy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.MinimizeModelEnergy" title="Permalink to this definition">¶</a></dt>
+<code class="descclassname">promod3.modelling.</code><code class="descname">MinimizeModelEnergy</code><span class="sig-paren">(</span><em>mhandle</em>, <em>max_iterations=12</em>, <em>max_iter_sd=20</em>, <em>max_iter_lbfgs=10</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_pipeline.html#MinimizeModelEnergy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.MinimizeModelEnergy" title="Permalink to this definition">¶</a></dt>
 <dd><p>Minimize energy of final model using molecular mechanics.</p>
 <p>Uses <code class="xref py py-mod docutils literal"><span class="pre">ost.mol.mm</span></code> to perform energy minimization.
 It will iteratively (at most <em>max_iterations</em> times):</p>
 <ul class="simple">
-<li>run up to <em>max_iter_sd</em> minimization iterations of a steepest descend method</li>
-<li>run up to <em>max_iter_lbfgs</em> minimization iterations of a Limited-memory 
+<li>run up to <em>max_iter_sd</em> minimization iter. of a steepest descend method</li>
+<li>run up to <em>max_iter_lbfgs</em> minimization iter. of a Limited-memory 
 Broyden-Fletcher-Goldfarb-Shanno method</li>
 <li>abort if no stereochemical problems found</li>
 </ul>
 <p>The idea is that we don&#8217;t want to minimize &#8220;too much&#8221;. So, we iteratively
 minimize until there are no stereochemical problems and not more.</p>
+<p>To speed things up, this can run on multiple CPU threads by setting the
+env. variable <code class="docutils literal"><span class="pre">PM3_OPENMM_CPU_THREADS</span></code> to the number of desired threads.
+If the variable is not set, 1 thread will be used by default.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -258,6 +292,20 @@ minimize until there are no stereochemical problems and not more.</p>
 </table>
 </dd></dl>
 
+<dl class="function">
+<dt id="promod3.modelling.CheckFinalModel">
+<code class="descclassname">promod3.modelling.</code><code class="descname">CheckFinalModel</code><span class="sig-paren">(</span><em>mhandle</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_pipeline.html#CheckFinalModel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.CheckFinalModel" title="Permalink to this definition">¶</a></dt>
+<dd><p>Performs samity checks on final models and reports problems.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; Modelling handle for which to perform checks.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
 </div>
 <div class="section" id="closing-gaps">
 <h2>Closing Gaps<a class="headerlink" href="#closing-gaps" title="Permalink to this headline">¶</a></h2>
@@ -282,7 +330,7 @@ minimize until there are no stereochemical problems and not more.</p>
 
 <dl class="function">
 <dt id="promod3.modelling.CloseSmallDeletions">
-<code class="descclassname">promod3.modelling.</code><code class="descname">CloseSmallDeletions</code><span class="sig-paren">(</span><em>mhandle</em>, <em>scorer</em>, <em>extension_steps=9</em>, <em>clash_thresh=1.0</em>, <em>e_thresh=200</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_closegaps.html#CloseSmallDeletions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.CloseSmallDeletions" title="Permalink to this definition">¶</a></dt>
+<code class="descclassname">promod3.modelling.</code><code class="descname">CloseSmallDeletions</code><span class="sig-paren">(</span><em>mhandle</em>, <em>scorer</em>, <em>max_extension=9</em>, <em>clash_thresh=1.0</em>, <em>e_thresh=200</em>, <em>use_scoring_extender=True</em>, <em>use_full_extender=True</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_closegaps.html#CloseSmallDeletions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.CloseSmallDeletions" title="Permalink to this definition">¶</a></dt>
 <dd><p>Close small deletions by relaxing neighbouring residues.</p>
 <p>Small deletions in the template from the target-template alignment have a
 good chance to be bridged just by relaxing neighbours around a tiny gap.
@@ -290,16 +338,20 @@ Before diving into the more demanding tasks in modeling, those may be closed
 already in the raw-model. After closure some checks are done to see if the
 solution is stereochemically sensible.</p>
 <p>Closed gaps are removed from <code class="xref py py-attr docutils literal"><span class="pre">mhandle.gaps</span></code>.</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">ost</span>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span> <span class="n">seq</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span>
-<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
 
-<span class="n">tpl</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;gly.pdb&#39;</span><span class="p">)</span>
-<span class="n">aln</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">LoadAlignment</span><span class="p">(</span><span class="s">&#39;seq.fasta&#39;</span><span class="p">)</span>
+<span class="c"># setup</span>
+<span class="n">tpl</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;data/gly.pdb&#39;</span><span class="p">)</span>
+<span class="n">aln</span> <span class="o">=</span> <span class="n">seq</span><span class="o">.</span><span class="n">CreateAlignment</span><span class="p">(</span><span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;trg&#39;</span><span class="p">,</span> <span class="s">&#39;GGG-GGG&#39;</span><span class="p">),</span>
+                          <span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;tpl&#39;</span><span class="p">,</span> <span class="s">&#39;GGGAGGG&#39;</span><span class="p">))</span>
 <span class="n">aln</span><span class="o">.</span><span class="n">AttachView</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">tpl</span><span class="o">.</span><span class="n">CreateFullView</span><span class="p">())</span>
 <span class="n">mhandle</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">BuildRawModel</span><span class="p">(</span><span class="n">aln</span><span class="p">)</span>
+<span class="c"># close small deletion</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps before: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
 <span class="n">scorer</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
 <span class="n">modelling</span><span class="o">.</span><span class="n">CloseSmallDeletions</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">)</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps after: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
 </pre></div>
 </div>
 <table class="docutils field-list" frame="void" rules="none">
@@ -310,14 +362,24 @@ solution is stereochemically sensible.</p>
 <li><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; Modelling handle on which to apply change.</li>
 <li><strong>scorer</strong> (<a class="reference internal" href="../loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a>) &#8211; A scorer dedicated to this model.
 If gaps are closed, the <em>scorer</em> is updated.</li>
-<li><strong>extension_steps</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Iterations allowed for gap extension. This does not
-directly mean &#8216;extended size of gap&#8217; but no. of
-attempts to extend. Extension works like trying to
-increase left, then right, then try more on the
-left side again...</li>
+<li><strong>max_extension</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Maximal number of gap extension steps to perform
+(see <a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>)</li>
 <li><strong>clash_thresh</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Threshold for the clash score, acceptance means being
 lower than this.</li>
 <li><strong>e_thresh</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Potential energy should be lower than this.</li>
+<li><strong>use_scoring_extender</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = use <a class="reference internal" href="#promod3.modelling.ScoringGapExtender" title="promod3.modelling.ScoringGapExtender"><code class="xref py py-class docutils literal"><span class="pre">ScoringGapExtender</span></code></a> instead
+of <a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>.
+The gap is penalized according as
+0.8*length + sum(helices) + sum(sheets).
+For the scondary-structure-penalty to work,
+the model-template must have the appropriate
+information before <a class="reference internal" href="#promod3.modelling.BuildRawModel" title="promod3.modelling.BuildRawModel"><code class="xref py py-func docutils literal"><span class="pre">BuildRawModel()</span></code></a> is
+called (e.g. with <a class="reference external" href="http://www.openstructure.org/docs/1.3/bindings/dssp/#module-ost.bindings.dssp" title="(in OpenStructure v1.3.3)"><code class="xref py py-mod docutils literal"><span class="pre">ost.bindings.dssp</span></code></a>).</li>
+<li><strong>use_full_extender</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = use <a class="reference internal" href="#promod3.modelling.FullGapExtender" title="promod3.modelling.FullGapExtender"><code class="xref py py-class docutils literal"><span class="pre">FullGapExtender</span></code></a> instead of
+of <a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>. Also works in combination
+with <cite>use_scoring_extender</cite>. This allows the gap
+extender to skip neighboring gaps and to correctly
+handle gaps close to termini.</li>
 </ul>
 </td>
 </tr>
@@ -328,7 +390,10 @@ lower than this.</li>
 <dl class="function">
 <dt id="promod3.modelling.RemoveTerminalGaps">
 <code class="descclassname">promod3.modelling.</code><code class="descname">RemoveTerminalGaps</code><span class="sig-paren">(</span><em>mhandle</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.RemoveTerminalGaps" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Removes terminal gaps without modelling them (just removes them from the list
+of gaps). This is useful for pipelines which lack the possibility to properly
+model loops at the termini.</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
@@ -350,14 +415,23 @@ lower than this.</li>
 each other. Then delete the residues and store a new gap spanning the whole
 stretch of original gaps and the deleted region. Original gaps will be
 removed. Stem residues count to the gap, so <strong>A-A-A</strong> has a distance of 0.</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">ost</span>
+<p>IMPORTANT: we assume here that <em>mhandle</em> stores gaps sequentially.
+Non-sequential gaps are ignored!</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span> <span class="n">seq</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span>
 
-<span class="n">tpl</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;1mcg.pdb&#39;</span><span class="p">)</span>
-<span class="n">aln</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">LoadAlignment</span><span class="p">(</span><span class="s">&#39;1mcg_aln.fasta&#39;</span><span class="p">)</span>
+<span class="c"># setup</span>
+<span class="n">tpl</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;data/1crn_cut.pdb&#39;</span><span class="p">)</span>
+<span class="n">seq_trg</span> <span class="o">=</span> <span class="s">&#39;TTCCPSIVARSNFNVCRLPGTPEAICATGYTCIIIPGATCPGDYAN&#39;</span>
+<span class="n">seq_tpl</span> <span class="o">=</span> <span class="s">&#39;TTCCPSIVARSNFNVCRLPGTPEA----G--CIIIPGATCPGDYAN&#39;</span>
+<span class="n">aln</span> <span class="o">=</span> <span class="n">seq</span><span class="o">.</span><span class="n">CreateAlignment</span><span class="p">(</span><span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;trg&#39;</span><span class="p">,</span> <span class="n">seq_trg</span><span class="p">),</span>
+                          <span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;tpl&#39;</span><span class="p">,</span> <span class="n">seq_tpl</span><span class="p">))</span>
 <span class="n">aln</span><span class="o">.</span><span class="n">AttachView</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">tpl</span><span class="o">.</span><span class="n">CreateFullView</span><span class="p">())</span>
 <span class="n">mhandle</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">BuildRawModel</span><span class="p">(</span><span class="n">aln</span><span class="p">)</span>
+<span class="c"># merge gaps</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps before: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
 <span class="n">modelling</span><span class="o">.</span><span class="n">MergeGapsByDistance</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps after: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
 </pre></div>
 </div>
 <table class="docutils field-list" frame="void" rules="none">
@@ -377,25 +451,30 @@ merge happens.</li>
 
 <dl class="function">
 <dt id="promod3.modelling.FillLoopsByDatabase">
-<code class="descclassname">promod3.modelling.</code><code class="descname">FillLoopsByDatabase</code><span class="sig-paren">(</span><em>mhandle</em>, <em>scorer</em>, <em>fragment_db</em>, <em>structure_db</em>, <em>torsion_sampler</em>, <em>max_loops_to_search=40</em>, <em>extended_search=True</em>, <em>use_scoring_extender=True</em>, <em>max_db_loop_len=12</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_closegaps.html#FillLoopsByDatabase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.FillLoopsByDatabase" title="Permalink to this definition">¶</a></dt>
+<code class="descclassname">promod3.modelling.</code><code class="descname">FillLoopsByDatabase</code><span class="sig-paren">(</span><em>mhandle</em>, <em>scorer</em>, <em>fragment_db</em>, <em>structure_db</em>, <em>torsion_sampler</em>, <em>max_loops_to_search=40</em>, <em>min_loops_required=4</em>, <em>max_res_extension=-1</em>, <em>extended_search=True</em>, <em>use_scoring_extender=True</em>, <em>use_full_extender=True</em>, <em>score_variant=0</em>, <em>ring_punch_detection=1</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_closegaps.html#FillLoopsByDatabase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.FillLoopsByDatabase" title="Permalink to this definition">¶</a></dt>
 <dd><p>Try to fill up loops from a structural database.</p>
 <p>Usually this will extend the gaps a bit to match candidates from the
 database. Do not expect a gap being filled in between its actual stem
 residues.
 This function cannot fill gaps at C- or N-terminal.</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span>
-<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span> <span class="n">seq</span>
+<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span><span class="p">,</span> <span class="n">loop</span>
 
-<span class="n">tpl</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;2dbs.pdb&#39;</span><span class="p">)</span>
-<span class="n">aln</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">LoadAlignment</span><span class="p">(</span><span class="s">&#39;2dbs.fasta&#39;</span><span class="p">)</span>
+<span class="c"># setup</span>
+<span class="n">tpl</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;data/1crn_cut.pdb&#39;</span><span class="p">)</span>
+<span class="n">seq_trg</span> <span class="o">=</span> <span class="s">&#39;TTCCPSIVARSNFNVCRLPGTPEAICATYTGCIIIPGATCPGDYAN&#39;</span>
+<span class="n">seq_tpl</span> <span class="o">=</span> <span class="s">&#39;TTCCPSIVARSNFNVCRLPGTPEA------GCIIIPGATCPGDYAN&#39;</span>
+<span class="n">aln</span> <span class="o">=</span> <span class="n">seq</span><span class="o">.</span><span class="n">CreateAlignment</span><span class="p">(</span><span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;trg&#39;</span><span class="p">,</span> <span class="n">seq_trg</span><span class="p">),</span>
+                          <span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;tpl&#39;</span><span class="p">,</span> <span class="n">seq_tpl</span><span class="p">))</span>
 <span class="n">aln</span><span class="o">.</span><span class="n">AttachView</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">tpl</span><span class="o">.</span><span class="n">CreateFullView</span><span class="p">())</span>
-
 <span class="n">mhandle</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">BuildRawModel</span><span class="p">(</span><span class="n">aln</span><span class="p">)</span>
+<span class="c"># merge gaps</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps before: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
 <span class="n">scorer</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
-<span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> 
-                              <span class="n">loop</span><span class="o">.</span><span class="n">LoadFragDB</span><span class="p">(),</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByDatabase</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> <span class="n">loop</span><span class="o">.</span><span class="n">LoadFragDB</span><span class="p">(),</span>
                               <span class="n">loop</span><span class="o">.</span><span class="n">LoadStructureDB</span><span class="p">(),</span>
                               <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSamplerCoil</span><span class="p">())</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps after: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
 </pre></div>
 </div>
 <table class="docutils field-list" frame="void" rules="none">
@@ -410,7 +489,19 @@ If gaps are closed, the <em>scorer</em> is updated.</li>
 <li><strong>structure_db</strong> (<a class="reference internal" href="../loop/structure_db.html#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>) &#8211; Backbone/ profile data.</li>
 <li><strong>torsion_sampler</strong> (<a class="reference internal" href="../loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; A sampler for torsion angles.</li>
 <li><strong>max_loops_to_search</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Define how many candidates are &#8216;enough&#8217; to be
-evaluated per loop.</li>
+evaluated per loop. The actual found candidates
+may be more (if we found &#8216;enough&#8217;) or less (if
+not enough candidates exist) of this number.</li>
+<li><strong>min_loops_required</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Define how many candidates we require to close
+the loop. If we did not find at least this number
+of candidates for a gap, we skip it without
+closing. Can be set to <code class="docutils literal"><span class="pre">max_loops_to_search</span></code>
+(or equivalently to -1) to enforce that we only
+close gaps for which we found enough candidates.</li>
+<li><strong>max_res_extension</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Only allow this number of residues to be added to
+the gaps when extending. If set to <strong>-1</strong>, any
+number of residues can be added (as long as the
+<cite>fragment_db</cite> allows it).</li>
 <li><strong>extended_search</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = more loop candidates are considered.
 The candidate search is done less precisely (see
 <a class="reference internal" href="../loop/helper_classes.html#promod3.loop.LoopCandidates.FillFromDatabase" title="promod3.loop.LoopCandidates.FillFromDatabase"><code class="xref py py-meth docutils literal"><span class="pre">FillFromDatabase()</span></code></a>).
@@ -418,15 +509,26 @@ The candidates are still scored and evaluated the
 same though (only more of them considered).</li>
 <li><strong>use_scoring_extender</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = use <a class="reference internal" href="#promod3.modelling.ScoringGapExtender" title="promod3.modelling.ScoringGapExtender"><code class="xref py py-class docutils literal"><span class="pre">ScoringGapExtender</span></code></a> instead
 of <a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>.
-The gap is penalized according as
-0.8*length + sum(helices) + sum(sheets).
-For the scondary-structure-penalty to work,
-the model-template must have the appropriate
-information before <a class="reference internal" href="#promod3.modelling.BuildRawModel" title="promod3.modelling.BuildRawModel"><code class="xref py py-func docutils literal"><span class="pre">BuildRawModel()</span></code></a> is
-called (e.g. with <a class="reference external" href="http://www.openstructure.org/docs/1.3/bindings/dssp/#module-ost.bindings.dssp" title="(in OpenStructure v1.3.3)"><code class="xref py py-mod docutils literal"><span class="pre">ost.bindings.dssp</span></code></a>).</li>
-<li><strong>max_db_loop_len</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Max. len of loops for which a database search makes
-sense. Should correspond to the biggest loop stored
-in the database.</li>
+See <a class="reference internal" href="#promod3.modelling.CloseSmallDeletions" title="promod3.modelling.CloseSmallDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseSmallDeletions()</span></code></a>.</li>
+<li><strong>use_full_extender</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = use <a class="reference internal" href="#promod3.modelling.FullGapExtender" title="promod3.modelling.FullGapExtender"><code class="xref py py-class docutils literal"><span class="pre">FullGapExtender</span></code></a> instead of
+<a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>.
+See <a class="reference internal" href="#promod3.modelling.CloseSmallDeletions" title="promod3.modelling.CloseSmallDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseSmallDeletions()</span></code></a>.</li>
+<li><strong>score_variant</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; <p>How to score loop candidates. Options:</p>
+<ul>
+<li><strong>0</strong>: put frame of backbone residues enclosing all
+candidates and score frame. This will also &#8220;score&#8221;
+non-modelled residues!</li>
+<li><strong>1</strong>: score candidates directly</li>
+<li><strong>2</strong>: like <strong>1</strong> but penalize length of candidate</li>
+</ul>
+</li>
+<li><strong>ring_punch_detection</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; <p>How to deal with ring punchings. Options:</p>
+<ul>
+<li><strong>0</strong>: not at all (fastest)</li>
+<li><strong>1</strong>: check for punchings with existing rings</li>
+<li><strong>2</strong>: check incl. sidechain for loop cand.</li>
+</ul>
+</li>
 </ul>
 </td>
 </tr>
@@ -436,24 +538,33 @@ in the database.</li>
 
 <dl class="function">
 <dt id="promod3.modelling.FillLoopsByMonteCarlo">
-<code class="descclassname">promod3.modelling.</code><code class="descname">FillLoopsByMonteCarlo</code><span class="sig-paren">(</span><em>mhandle</em>, <em>scorer</em>, <em>torsion_sampler</em>, <em>max_loops_to_search=6</em>, <em>max_extension=30</em>, <em>mc_num_loops=2</em>, <em>mc_steps=5000</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_closegaps.html#FillLoopsByMonteCarlo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.FillLoopsByMonteCarlo" title="Permalink to this definition">¶</a></dt>
+<code class="descclassname">promod3.modelling.</code><code class="descname">FillLoopsByMonteCarlo</code><span class="sig-paren">(</span><em>mhandle</em>, <em>scorer</em>, <em>torsion_sampler</em>, <em>max_loops_to_search=6</em>, <em>max_extension=30</em>, <em>mc_num_loops=2</em>, <em>mc_steps=5000</em>, <em>use_scoring_extender=True</em>, <em>use_full_extender=True</em>, <em>score_variant=0</em>, <em>ring_punch_detection=1</em>, <em>fragger_handles=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_closegaps.html#FillLoopsByMonteCarlo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.FillLoopsByMonteCarlo" title="Permalink to this definition">¶</a></dt>
 <dd><p>Try to fill up loops with Monte Carlo sampling.</p>
 <p>This is meant as a &#8220;last-resort&#8221; approach when it is not possible to fill
 the loops from the database with <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>.
 This will extend the gaps (up to <em>max_extension</em> times) a bit to allow for 
-more loop candidates to be found.
-This function cannot fill gaps at C- or N-terminal.</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span>
-<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">loop</span>
+more loop candidates to be found.</p>
+<p>The loops are modelled by either sampling the dihedral angles or (if
+<em>fragger_handles</em> is given) <a class="reference internal" href="../loop/structure_db.html#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> lists. The latter
+is only used if the gap length is &gt;= the length of fragments stored.</p>
+<p>This function cannot fill gaps at C- or N-terminal.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span> <span class="n">seq</span>
+<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span><span class="p">,</span> <span class="n">loop</span>
 
-<span class="n">tpl</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;2dbs.pdb&#39;</span><span class="p">)</span>
-<span class="n">aln</span> <span class="o">=</span> <span class="n">ost</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">LoadAlignment</span><span class="p">(</span><span class="s">&#39;2dbs.fasta&#39;</span><span class="p">)</span>
+<span class="c"># setup</span>
+<span class="n">tpl</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;data/1crn_cut.pdb&#39;</span><span class="p">)</span>
+<span class="n">seq_trg</span> <span class="o">=</span> <span class="s">&#39;TTCCPSIVARSNFNVCRLPGTPEAICATYTGCIIIPGATCPGDYAN&#39;</span>
+<span class="n">seq_tpl</span> <span class="o">=</span> <span class="s">&#39;TTCCPSIVARSNFNVCRLPGTPEA------GCIIIPGATCPGDYAN&#39;</span>
+<span class="n">aln</span> <span class="o">=</span> <span class="n">seq</span><span class="o">.</span><span class="n">CreateAlignment</span><span class="p">(</span><span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;trg&#39;</span><span class="p">,</span> <span class="n">seq_trg</span><span class="p">),</span>
+                          <span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;tpl&#39;</span><span class="p">,</span> <span class="n">seq_tpl</span><span class="p">))</span>
 <span class="n">aln</span><span class="o">.</span><span class="n">AttachView</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">tpl</span><span class="o">.</span><span class="n">CreateFullView</span><span class="p">())</span>
-
 <span class="n">mhandle</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">BuildRawModel</span><span class="p">(</span><span class="n">aln</span><span class="p">)</span>
+<span class="c"># merge gaps</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps before: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
 <span class="n">scorer</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
-<span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByMonteCarlo</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span> 
-                                <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSamplerCoil</span><span class="p">())</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">FillLoopsByMonteCarlo</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span>
+                              	<span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSamplerCoil</span><span class="p">())</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps after: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
 </pre></div>
 </div>
 <table class="docutils field-list" frame="void" rules="none">
@@ -473,6 +584,69 @@ evaluated per loop.</li>
 (see <a class="reference internal" href="../loop/helper_classes.html#promod3.loop.LoopCandidates.FillFromMonteCarloSampler" title="promod3.loop.LoopCandidates.FillFromMonteCarloSampler"><code class="xref py py-meth docutils literal"><span class="pre">FillFromMonteCarloSampler()</span></code></a>)</li>
 <li><strong>mc_steps</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Number of MC steps to perform for each loop candidate
 (see <a class="reference internal" href="../loop/helper_classes.html#promod3.loop.LoopCandidates.FillFromMonteCarloSampler" title="promod3.loop.LoopCandidates.FillFromMonteCarloSampler"><code class="xref py py-meth docutils literal"><span class="pre">FillFromMonteCarloSampler()</span></code></a>)</li>
+<li><strong>use_scoring_extender</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = use <a class="reference internal" href="#promod3.modelling.ScoringGapExtender" title="promod3.modelling.ScoringGapExtender"><code class="xref py py-class docutils literal"><span class="pre">ScoringGapExtender</span></code></a> instead
+of <a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>.
+See <a class="reference internal" href="#promod3.modelling.CloseSmallDeletions" title="promod3.modelling.CloseSmallDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseSmallDeletions()</span></code></a>.</li>
+<li><strong>use_full_extender</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = use <a class="reference internal" href="#promod3.modelling.FullGapExtender" title="promod3.modelling.FullGapExtender"><code class="xref py py-class docutils literal"><span class="pre">FullGapExtender</span></code></a> instead of
+<a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>.
+See <a class="reference internal" href="#promod3.modelling.CloseSmallDeletions" title="promod3.modelling.CloseSmallDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseSmallDeletions()</span></code></a>.</li>
+<li><strong>score_variant</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; How to score loop candidates.
+See <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>.</li>
+<li><strong>ring_punch_detection</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; How to deal with ring punchings.
+See <a class="reference internal" href="#promod3.modelling.FillLoopsByDatabase" title="promod3.modelling.FillLoopsByDatabase"><code class="xref py py-func docutils literal"><span class="pre">FillLoopsByDatabase()</span></code></a>.</li>
+<li><strong>fragger_handles</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference internal" href="../loop/structure_db.html#promod3.loop.FraggerHandle" title="promod3.loop.FraggerHandle"><code class="xref py py-class docutils literal"><span class="pre">FraggerHandle</span></code></a>) &#8211; Either None (no fragger sampling used) or one
+fragger handle for each chain in <em>mhandle</em>.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="promod3.modelling.ModelTermini">
+<code class="descclassname">promod3.modelling.</code><code class="descname">ModelTermini</code><span class="sig-paren">(</span><em>mhandle</em>, <em>scorer</em>, <em>torsion_sampler</em>, <em>fragger_handles=None</em>, <em>mc_num_loops=20</em>, <em>mc_steps=5000</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_closegaps.html#ModelTermini"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.ModelTermini" title="Permalink to this definition">¶</a></dt>
+<dd><p>Try to model termini with Monte Carlo sampling.</p>
+<p>Use with care! This is an experimental feature which will increase coverage
+but we do not assume that the resulting termini are of high quality!</p>
+<p>The termini are modelled by either sampling the dihedral angles or (if
+<em>fragger_handles</em> is given) <a class="reference internal" href="../loop/structure_db.html#promod3.loop.Fragger" title="promod3.loop.Fragger"><code class="xref py py-class docutils literal"><span class="pre">Fragger</span></code></a> lists. The latter
+is only used if the gap length is &gt;= the length of fragments stored.</p>
+<p>Terminal gaps of length 1 are ignored by this function!</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span> <span class="n">seq</span>
+<span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">modelling</span><span class="p">,</span> <span class="n">loop</span>
+
+<span class="c"># setup</span>
+<span class="n">tpl</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;data/gly.pdb&#39;</span><span class="p">)</span>
+<span class="n">seq_trg</span> <span class="o">=</span> <span class="s">&#39;AAAAGGGGGGGGGGGGGGGGGGGGAAAAAA&#39;</span>
+<span class="n">seq_tpl</span> <span class="o">=</span> <span class="s">&#39;----GGGGGGGGGGGGGGGGGGGG------&#39;</span>
+<span class="n">aln</span> <span class="o">=</span> <span class="n">seq</span><span class="o">.</span><span class="n">CreateAlignment</span><span class="p">(</span><span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;trg&#39;</span><span class="p">,</span> <span class="n">seq_trg</span><span class="p">),</span>
+                          <span class="n">seq</span><span class="o">.</span><span class="n">CreateSequence</span><span class="p">(</span><span class="s">&#39;tpl&#39;</span><span class="p">,</span> <span class="n">seq_tpl</span><span class="p">))</span>
+<span class="n">aln</span><span class="o">.</span><span class="n">AttachView</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">tpl</span><span class="o">.</span><span class="n">CreateFullView</span><span class="p">())</span>
+<span class="n">mhandle</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">BuildRawModel</span><span class="p">(</span><span class="n">aln</span><span class="p">)</span>
+<span class="c"># merge gaps</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps before: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
+<span class="n">scorer</span> <span class="o">=</span> <span class="n">modelling</span><span class="o">.</span><span class="n">SetupBackboneScorer</span><span class="p">(</span><span class="n">mhandle</span><span class="p">)</span>
+<span class="n">modelling</span><span class="o">.</span><span class="n">ModelTermini</span><span class="p">(</span><span class="n">mhandle</span><span class="p">,</span> <span class="n">scorer</span><span class="p">,</span>
+                       <span class="n">loop</span><span class="o">.</span><span class="n">LoadTorsionSamplerCoil</span><span class="p">())</span>
+<span class="k">print</span> <span class="s">&#39;Number of gaps after: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">mhandle</span><span class="o">.</span><span class="n">gaps</span><span class="p">)</span>
+</pre></div>
+</div>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; Modelling handle on which to apply change.</li>
+<li><strong>scorer</strong> (<a class="reference internal" href="../loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a>) &#8211; A scorer dedicated to this model.
+If gaps are closed, the <em>scorer</em> is updated.</li>
+<li><strong>torsion_sampler</strong> (<a class="reference internal" href="../loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>) &#8211; A sampler for torsion angles.</li>
+<li><strong>fragger_handles</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference internal" href="../loop/structure_db.html#promod3.loop.FraggerHandle" title="promod3.loop.FraggerHandle"><code class="xref py py-class docutils literal"><span class="pre">FraggerHandle</span></code></a>) &#8211; Either None (no fragger sampling used) or one
+fragger handle for each chain in <em>mhandle</em>.</li>
+<li><strong>mc_num_loops</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Number of loop candidates to consider for each terminal gap
+(see <a class="reference internal" href="../loop/helper_classes.html#promod3.loop.LoopCandidates.FillFromMonteCarloSampler" title="promod3.loop.LoopCandidates.FillFromMonteCarloSampler"><code class="xref py py-meth docutils literal"><span class="pre">FillFromMonteCarloSampler()</span></code></a>)</li>
+<li><strong>mc_steps</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Number of MC steps to perform for each loop candidate
+(see <a class="reference internal" href="../loop/helper_classes.html#promod3.loop.LoopCandidates.FillFromMonteCarloSampler" title="promod3.loop.LoopCandidates.FillFromMonteCarloSampler"><code class="xref py py-meth docutils literal"><span class="pre">FillFromMonteCarloSampler()</span></code></a>)</li>
 </ul>
 </td>
 </tr>
@@ -480,10 +654,72 @@ evaluated per loop.</li>
 </table>
 </dd></dl>
 
+<dl class="function">
+<dt id="promod3.modelling.CloseLargeDeletions">
+<code class="descclassname">promod3.modelling.</code><code class="descname">CloseLargeDeletions</code><span class="sig-paren">(</span><em>mhandle</em>, <em>scorer</em>, <em>structure_db</em>, <em>linker_length=8</em>, <em>num_fragments=500</em>, <em>use_scoring_extender=True</em>, <em>use_full_extender=True</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_closegaps.html#CloseLargeDeletions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.CloseLargeDeletions" title="Permalink to this definition">¶</a></dt>
+<dd><p>Try to close large deletions.</p>
+<p>This is meant as a &#8220;last-resort&#8221; approach. In some cases you cannot 
+close very large deletions simply because the two parts separated
+by a deletion are too far apart. The idea is to sample a linker region
+and always move the whole chain towards the n-terminus.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; Modelling handle on which to apply change.</li>
+<li><strong>scorer</strong> (<a class="reference internal" href="../loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a>) &#8211; A scorer dedicated to this model.
+If gaps are closed, the <em>scorer</em> is updated.</li>
+<li><strong>structure_db</strong> (<a class="reference internal" href="../loop/structure_db.html#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>) &#8211; The database from which to extract fragments for
+the linker region.</li>
+<li><strong>linker_length</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Desired length (in residues w/o stems) for the
+linker. This may be shorter if extender cannot
+extend further.</li>
+<li><strong>num_fragments</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; Number of fragments to sample the linker.</li>
+<li><strong>use_scoring_extender</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = use <a class="reference internal" href="#promod3.modelling.ScoringGapExtender" title="promod3.modelling.ScoringGapExtender"><code class="xref py py-class docutils literal"><span class="pre">ScoringGapExtender</span></code></a> instead
+of <a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>.
+See <a class="reference internal" href="#promod3.modelling.CloseSmallDeletions" title="promod3.modelling.CloseSmallDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseSmallDeletions()</span></code></a>.</li>
+<li><strong>use_full_extender</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; True = use <a class="reference internal" href="#promod3.modelling.FullGapExtender" title="promod3.modelling.FullGapExtender"><code class="xref py py-class docutils literal"><span class="pre">FullGapExtender</span></code></a> instead of
+<a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>.
+See <a class="reference internal" href="#promod3.modelling.CloseSmallDeletions" title="promod3.modelling.CloseSmallDeletions"><code class="xref py py-func docutils literal"><span class="pre">CloseSmallDeletions()</span></code></a>.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="promod3.modelling.CountEnclosedGaps">
+<code class="descclassname">promod3.modelling.</code><code class="descname">CountEnclosedGaps</code><span class="sig-paren">(</span><em>mhandle</em>, <em>gap</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.CountEnclosedGaps" title="Permalink to this definition">¶</a></dt>
+<dt id="promod3.modelling.CountEnclosedInsertions">
+<code class="descclassname">promod3.modelling.</code><code class="descname">CountEnclosedInsertions</code><span class="sig-paren">(</span><em>mhandle</em>, <em>gap</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.CountEnclosedInsertions" title="Permalink to this definition">¶</a></dt>
+<dd><p>Counts all gaps from <cite>mhandle</cite> which are fully enclosed by given <cite>gap</cite>.
+This is either all gaps or only insertions.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>mhandle</strong> (<a class="reference internal" href="#promod3.modelling.ModellingHandle" title="promod3.modelling.ModellingHandle"><code class="xref py py-class docutils literal"><span class="pre">ModellingHandle</span></code></a>) &#8211; Modelling handle on which to apply change.</li>
+<li><strong>gap</strong> (<a class="reference internal" href="#promod3.modelling.StructuralGap" title="promod3.modelling.StructuralGap"><code class="xref py py-class docutils literal"><span class="pre">StructuralGap</span></code></a>) &#8211; Gap defining range in which gaps are to be removed.</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Number of gaps.</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a></p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
 <dl class="function">
 <dt id="promod3.modelling.ClearGaps">
 <code class="descclassname">promod3.modelling.</code><code class="descname">ClearGaps</code><span class="sig-paren">(</span><em>mhandle</em>, <em>gap</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.ClearGaps" title="Permalink to this definition">¶</a></dt>
-<dd><p>Removes all gaps from mhandle which are fully enclosed by given gap.</p>
+<dd><p>Removes all gaps from <cite>mhandle</cite> which are fully enclosed by given <cite>gap</cite>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -495,7 +731,7 @@ evaluated per loop.</li>
 </td>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Index of next gap in mhandle.gaps after removal.
-Returns -1 if last gap was removed.</p>
+Returns -1 if last gap was removed or no gaps in <em>mhandle</em>.</p>
 </td>
 </tr>
 <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a></p>
@@ -512,7 +748,9 @@ enclosed by given gap.</p>
 <dl class="function">
 <dt id="promod3.modelling.MergeGaps">
 <code class="descclassname">promod3.modelling.</code><code class="descname">MergeGaps</code><span class="sig-paren">(</span><em>mhandle</em>, <em>index</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.MergeGaps" title="Permalink to this definition">¶</a></dt>
-<dd><p>Merges two gaps mhandle.gaps[index] and mhandle.gaps[index+1].</p>
+<dd><p>Merges two gaps <cite>mhandle.gaps[index]</cite> and <cite>mhandle.gaps[index+1]</cite>.
+The residues in between the gaps are removed from <cite>mhandle.model</cite> and added
+to the new <cite>mhandle.gaps[index]</cite>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
@@ -524,7 +762,7 @@ enclosed by given gap.</p>
 </td>
 </tr>
 <tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last">A <code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code> if indices out of range or if trying to merge
-N-terminal gap with a C-terminal gap.</p>
+gaps of different chains or an N-terminal gap with a C-terminal gap.</p>
 </td>
 </tr>
 </tbody>
@@ -842,7 +1080,7 @@ Extend() function to propose new gaps for loop modelling. The function returns
 False if no new extension possible.</p>
 <dl class="class">
 <dt id="promod3.modelling.GapExtender">
-<em class="property">class </em><code class="descclassname">promod3.modelling.</code><code class="descname">GapExtender</code><span class="sig-paren">(</span><em>gap</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.GapExtender" title="Permalink to this definition">¶</a></dt>
+<em class="property">class </em><code class="descclassname">promod3.modelling.</code><code class="descname">GapExtender</code><span class="sig-paren">(</span><em>gap</em>, <em>seqres</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.GapExtender" title="Permalink to this definition">¶</a></dt>
 <dd><p>The extender cycles through the following steps:</p>
 <div class="highlight-none"><div class="highlight"><pre>   -
   --
@@ -860,19 +1098,76 @@ False if no new extension possible.</p>
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>gap</strong> (<a class="reference internal" href="#promod3.modelling.StructuralGap" title="promod3.modelling.StructuralGap"><code class="xref py py-class docutils literal"><span class="pre">StructuralGap</span></code></a>) &#8211; The gap which will be extended by <a class="reference internal" href="#promod3.modelling.GapExtender.Extend" title="promod3.modelling.GapExtender.Extend"><code class="xref py py-meth docutils literal"><span class="pre">Extend()</span></code></a>.</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>gap</strong> (<a class="reference internal" href="#promod3.modelling.StructuralGap" title="promod3.modelling.StructuralGap"><code class="xref py py-class docutils literal"><span class="pre">StructuralGap</span></code></a>) &#8211; The gap which will be extended by <a class="reference internal" href="#promod3.modelling.GapExtender.Extend" title="promod3.modelling.GapExtender.Extend"><code class="xref py py-meth docutils literal"><span class="pre">Extend()</span></code></a>.</li>
+<li><strong>seqres</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> / <a class="reference external" href="http://www.openstructure.org/docs/1.3/seq/base/seq/#ost.seq.SequenceHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.seq.SequenceHandle</span></code></a>) &#8211; The full sequence of the chain, the gap is associated with.</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last">An exception if a terminal gap is used to construct this.</p>
+</td>
 </tr>
 </tbody>
 </table>
 <dl class="method">
 <dt id="promod3.modelling.GapExtender.Extend">
 <code class="descname">Extend</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.GapExtender.Extend" title="Permalink to this definition">¶</a></dt>
-<dd><p>Tries to extend <cite>gap</cite>.</p>
+<dd><p>Tries to extend <em>gap</em>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">False, iff the gap cannot be extended any further.</td>
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">False, if the <em>gap</em> cannot be extended any further. This happens
+if it reaches a terminal or another insertion gap.
+Otherwise, the <em>gap</em> passed to the constructor is changed.
+The gaps are extended with ascending length and will always have
+valid termini.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="promod3.modelling.FullGapExtender">
+<em class="property">class </em><code class="descclassname">promod3.modelling.</code><code class="descname">FullGapExtender</code><span class="sig-paren">(</span><em>gap</em>, <em>seqres</em>, <em>max_length=-1</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.FullGapExtender" title="Permalink to this definition">¶</a></dt>
+<dd><p>Cycles as GapExtender, but continues even if another gap was encountered.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>gap</strong> (<a class="reference internal" href="#promod3.modelling.StructuralGap" title="promod3.modelling.StructuralGap"><code class="xref py py-class docutils literal"><span class="pre">StructuralGap</span></code></a>) &#8211; The gap which will be extended by <a class="reference internal" href="#promod3.modelling.FullGapExtender.Extend" title="promod3.modelling.FullGapExtender.Extend"><code class="xref py py-meth docutils literal"><span class="pre">Extend()</span></code></a>.</li>
+<li><strong>seqres</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> / <a class="reference external" href="http://www.openstructure.org/docs/1.3/seq/base/seq/#ost.seq.SequenceHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.seq.SequenceHandle</span></code></a>) &#8211; The full sequence of the chain, the gap is associated with.</li>
+<li><strong>max_length</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; <ul>
+<li>If -1, all possible non-terminal gaps are returned.</li>
+<li>If &gt;= 0, this restricts the max. gap-length
+(w/o termini) producable by <a class="reference internal" href="#promod3.modelling.FullGapExtender.Extend" title="promod3.modelling.FullGapExtender.Extend"><code class="xref py py-meth docutils literal"><span class="pre">Extend()</span></code></a>.</li>
+</ul>
+</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last">An exception if a terminal gap is used to construct this.</p>
+</td>
+</tr>
+</tbody>
+</table>
+<dl class="method">
+<dt id="promod3.modelling.FullGapExtender.Extend">
+<code class="descname">Extend</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.FullGapExtender.Extend" title="Permalink to this definition">¶</a></dt>
+<dd><p>Tries to extend <em>gap</em>.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">False, if the <em>gap</em> cannot be extended without exceeding <em>max_length</em>.
+Otherwise, the <em>gap</em> passed to the constructor is changed.
+The gaps are extended with ascending length and will always have
+valid termini.</td>
 </tr>
 <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a></td>
 </tr>
@@ -884,35 +1179,49 @@ False if no new extension possible.</p>
 
 <dl class="class">
 <dt id="promod3.modelling.ScoringGapExtender">
-<em class="property">class </em><code class="descclassname">promod3.modelling.</code><code class="descname">ScoringGapExtender</code><span class="sig-paren">(</span><em>gap</em>, <em>extension_penalty</em>, <em>penalties</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.ScoringGapExtender" title="Permalink to this definition">¶</a></dt>
+<em class="property">class </em><code class="descclassname">promod3.modelling.</code><code class="descname">ScoringGapExtender</code><span class="sig-paren">(</span><em>gap</em>, <em>extension_penalty</em>, <em>penalties</em>, <em>seqres</em>, <em>max_length=-2</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.ScoringGapExtender" title="Permalink to this definition">¶</a></dt>
 <dd><p>The extender scores possible gap extensions and returns them in order of
 their score when <a class="reference internal" href="#promod3.modelling.ScoringGapExtender.Extend" title="promod3.modelling.ScoringGapExtender.Extend"><code class="xref py py-meth docutils literal"><span class="pre">Extend()</span></code></a> is called.
 The score is penalized according to length and according to certain (well
-conserved) regions in the structure.
-score = length * <cite>extension_penalty</cite> + sum( <cite>penalties</cite> [i] )
-(i = res.num. of residues in extension)</p>
+conserved) regions in the structure as defined by <em>penalties</em>.
+score = num_gap_extensions * <cite>extension_penalty</cite> + sum( <cite>penalties</cite> [i] )
+(i = resnum - 1 of residues in extension)</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
 <li><strong>gap</strong> (<a class="reference internal" href="#promod3.modelling.StructuralGap" title="promod3.modelling.StructuralGap"><code class="xref py py-class docutils literal"><span class="pre">StructuralGap</span></code></a>) &#8211; The gap which will be extended by <a class="reference internal" href="#promod3.modelling.ScoringGapExtender.Extend" title="promod3.modelling.ScoringGapExtender.Extend"><code class="xref py py-meth docutils literal"><span class="pre">Extend()</span></code></a>.</li>
 <li><strong>extension_penalty</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Penalty for length of gap.</li>
 <li><strong>penalties</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>) &#8211; Penalty for each residue added to gap.</li>
+<li><strong>seqres</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> / <a class="reference external" href="http://www.openstructure.org/docs/1.3/seq/base/seq/#ost.seq.SequenceHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ost.seq.SequenceHandle</span></code></a>) &#8211; The full sequence of the chain, the gap is associated with.</li>
+<li><strong>max_length</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; <ul>
+<li>If -2, <a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a> is used instead of <a class="reference internal" href="#promod3.modelling.FullGapExtender" title="promod3.modelling.FullGapExtender"><code class="xref py py-class docutils literal"><span class="pre">FullGapExtender</span></code></a>
+(i.e. it stops at gaps and termini).</li>
+<li>If -1, all possible non-terminal gaps are returned.</li>
+<li>If &gt;= 0, this restricts the max. gap-length (w/o termini)
+producable by <a class="reference internal" href="#promod3.modelling.ScoringGapExtender.Extend" title="promod3.modelling.ScoringGapExtender.Extend"><code class="xref py py-meth docutils literal"><span class="pre">Extend()</span></code></a>.</li>
+</ul>
+</li>
 </ul>
 </td>
 </tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last">An exception if a terminal gap is used to construct this.</p>
+</td>
+</tr>
 </tbody>
 </table>
 <dl class="method">
 <dt id="promod3.modelling.ScoringGapExtender.Extend">
 <code class="descname">Extend</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.ScoringGapExtender.Extend" title="Permalink to this definition">¶</a></dt>
-<dd><p>Tries to extend <cite>gap</cite>.</p>
+<dd><p>Tries to extend <em>gap</em>.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">False, iff the gap cannot be extended any further.</td>
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">False, if the gap cannot be extended any further.
+Otherwise, <em>gap</em> is changed and returned in ascending score.
+The updated <em>gap</em> will always have valid termini.</td>
 </tr>
 <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a></td>
 </tr>
@@ -922,6 +1231,141 @@ score = length * <cite>extension_penalty</cite> + sum( <cite>penalties</cite> [i
 
 </dd></dl>
 
+<dl class="class">
+<dt id="promod3.modelling.ShiftExtension">
+<em class="property">class </em><code class="descclassname">promod3.modelling.</code><code class="descname">ShiftExtension</code><span class="sig-paren">(</span><em>n_num</em>, <em>c_num</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.ShiftExtension" title="Permalink to this definition">¶</a></dt>
+<dd><p>Implements the underlying extension scheme of the <a class="reference internal" href="#promod3.modelling.GapExtender" title="promod3.modelling.GapExtender"><code class="xref py py-class docutils literal"><span class="pre">GapExtender</span></code></a>.
+It is not associated to any structural data, it just spits out the
+residue numbers according to the extension scheme described above.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>n_num</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; N residue number to start with</li>
+<li><strong>c_num</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>) &#8211; C residue number to start with</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<dl class="method">
+<dt id="promod3.modelling.ShiftExtension.Extend">
+<code class="descname">Extend</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.modelling.ShiftExtension.Extend" title="Permalink to this definition">¶</a></dt>
+<dd><table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The next residue numbers for n_stem and c_stem</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">tuple</span></code></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="detecting-ring-punches">
+<h2>Detecting ring punches<a class="headerlink" href="#detecting-ring-punches" title="Permalink to this headline">¶</a></h2>
+<dl class="function">
+<dt id="promod3.modelling.GetRings">
+<code class="descclassname">promod3.modelling.</code><code class="descname">GetRings</code><span class="sig-paren">(</span><em>ent</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_ring_punches.html#GetRings"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.GetRings" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get rings for a protein structure.
+A ring is only added if all ring-atoms exist or if it is a proline and
+three of the atoms exist (center and radii are estimated then).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>ent</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">EntityHandle</span></code></a> or <a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityView" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">EntityView</span></code></a>) &#8211; Structure for which to detect rings.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of rings to perform ring checks. Each ring is a named
+tuple with:
+center (<a class="reference external" href="http://www.openstructure.org/docs/1.3/geom/vec/#ost.geom.Vec3" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">Vec3</span></code></a>),
+plane (<a class="reference external" href="http://www.openstructure.org/docs/1.3/geom/composite/#ost.geom.Plane" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">Plane</span></code></a>),
+radius (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#float" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>),
+residue (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ResidueHandle</span></code></a>).</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="promod3.modelling.GetRingPunches">
+<code class="descclassname">promod3.modelling.</code><code class="descname">GetRingPunches</code><span class="sig-paren">(</span><em>rings</em>, <em>ent</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_ring_punches.html#GetRingPunches"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.GetRingPunches" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get list of residues with rings that are punched by the given structure.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>rings</strong> &#8211; List of rings as provided by <a class="reference internal" href="#promod3.modelling.GetRings" title="promod3.modelling.GetRings"><code class="xref py py-func docutils literal"><span class="pre">GetRings()</span></code></a>.</li>
+<li><strong>ent</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">EntityHandle</span></code></a> or <a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityView" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">EntityView</span></code></a>) &#8211; Structure for which to detect punches.</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of residues (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.ResidueHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">ResidueHandle</span></code></a>) which
+have a punched ring.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="promod3.modelling.HasRingPunches">
+<code class="descclassname">promod3.modelling.</code><code class="descname">HasRingPunches</code><span class="sig-paren">(</span><em>rings</em>, <em>ent</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_ring_punches.html#HasRingPunches"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.HasRingPunches" title="Permalink to this definition">¶</a></dt>
+<dd><p>Check if any ring is punched by the given structure.
+This check is faster than using <a class="reference internal" href="#promod3.modelling.GetRingPunches" title="promod3.modelling.GetRingPunches"><code class="xref py py-func docutils literal"><span class="pre">GetRingPunches()</span></code></a>.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>rings</strong> &#8211; List of rings as provided by <a class="reference internal" href="#promod3.modelling.GetRings" title="promod3.modelling.GetRings"><code class="xref py py-func docutils literal"><span class="pre">GetRings()</span></code></a>.</li>
+<li><strong>ent</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">EntityHandle</span></code></a> or <a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityView" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">EntityView</span></code></a>) &#8211; Structure for which to detect punches.</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True, iff any ring is punched</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a></p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="promod3.modelling.FilterCandidates">
+<code class="descclassname">promod3.modelling.</code><code class="descname">FilterCandidates</code><span class="sig-paren">(</span><em>candidates</em>, <em>model</em>, <em>gap</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_ring_punches.html#FilterCandidates"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.FilterCandidates" title="Permalink to this definition">¶</a></dt>
+<dd><p>Remove loop candidates if they cause ring punches.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>candidates</strong> (<a class="reference internal" href="../loop/helper_classes.html#promod3.loop.LoopCandidates" title="promod3.loop.LoopCandidates"><code class="xref py py-class docutils literal"><span class="pre">LoopCandidates</span></code></a>) &#8211; Loop candidates meant to fill <em>gap</em> within <em>model</em>.
+Offending candidates are removed from this list.</li>
+<li><strong>model</strong> (<a class="reference external" href="http://www.openstructure.org/docs/1.3/mol/base/entity/#ost.mol.EntityHandle" title="(in OpenStructure v1.3.3)"><code class="xref py py-class docutils literal"><span class="pre">EntityHandle</span></code></a>) &#8211; Model for which loop is to be filled.</li>
+<li><strong>gap</strong> (<a class="reference internal" href="#promod3.modelling.StructuralGap" title="promod3.modelling.StructuralGap"><code class="xref py py-class docutils literal"><span class="pre">StructuralGap</span></code></a>.) &#8211; Gap for which loop is to be filled.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="promod3.modelling.FilterCandidatesWithSC">
+<code class="descclassname">promod3.modelling.</code><code class="descname">FilterCandidatesWithSC</code><span class="sig-paren">(</span><em>candidates</em>, <em>model</em>, <em>gap</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/modelling/_ring_punches.html#FilterCandidatesWithSC"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.modelling.FilterCandidatesWithSC" title="Permalink to this definition">¶</a></dt>
+<dd><p>Remove loop candidates if they (with sidechain) cause ring punches.
+See <a class="reference internal" href="#promod3.modelling.FilterCandidates" title="promod3.modelling.FilterCandidates"><code class="xref py py-func docutils literal"><span class="pre">FilterCandidates()</span></code></a>.</p>
+</dd></dl>
+
 </div>
 </div>
 
@@ -939,6 +1383,7 @@ score = length * <cite>extension_penalty</cite> + sum( <cite>penalties</cite> [i
 <li><a class="reference internal" href="#modelling-handle-class">Modelling Handle class</a></li>
 <li><a class="reference internal" href="#gap-classes">Gap classes</a></li>
 <li><a class="reference internal" href="#gap-extender-classes">Gap Extender classes</a></li>
+<li><a class="reference internal" href="#detecting-ring-punches">Detecting ring punches</a></li>
 </ul>
 </li>
 </ul>
@@ -946,8 +1391,8 @@ score = length * <cite>extension_penalty</cite> + sum( <cite>penalties</cite> [i
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
-      <li>Previous: <a href="../core/helper.html" title="previous chapter"><code class="docutils literal"><span class="pre">helper</span></code> - Shared Functionality For the Everything</a></li>
+  <li><a href="../users.html">Documentation For Users</a><ul>
+      <li>Previous: <a href="../buildsystem.html" title="previous chapter">Building ProMod3</a></li>
       <li>Next: <a href="../loop/index.html" title="next chapter"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a></li>
   </ul></li>
   </ul></li>
@@ -978,7 +1423,7 @@ score = length * <cite>extension_penalty</cite> + sum( <cite>penalties</cite> [i
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/objects.inv b/doc/html/objects.inv
index 0237ecd59ee07c2fe5b7847fa27accba2a234f88..569c2d76daf9465ec245857590e3a184eb0830b9 100644
Binary files a/doc/html/objects.inv and b/doc/html/objects.inv differ
diff --git a/doc/html/portableIO.html b/doc/html/portableIO.html
new file mode 100644
index 0000000000000000000000000000000000000000..d76786e29b9ca0991e3560f1c8efa685779105c0
--- /dev/null
+++ b/doc/html/portableIO.html
@@ -0,0 +1,473 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>Using binary files in ProMod3 &mdash; ProMod3 0 documentation</title>
+    
+    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    './',
+        VERSION:     '0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/underscore.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="top" title="ProMod3 0 documentation" href="index.html" />
+    <link rel="up" title="Documentation For Developers" href="developers.html" />
+    <link rel="next" title="Changelog" href="changelog.html" />
+    <link rel="prev" title="ProMod3‘s Share Of CMake" href="cmake/index.html" />
+   
+  
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
+
+  </head>
+  <body role="document">  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body" role="main">
+            
+  <div class="section" id="using-binary-files-in-project">
+<span id="portableio"></span><h1>Using binary files in ProMod3<a class="headerlink" href="#using-binary-files-in-project" title="Permalink to this headline">¶</a></h1>
+<p>A few features in ProMod3 (and potentially your next addition) require binary
+files to be loaded and stored. Here, we provide guidelines and describe helper
+tools to perform tasks related to loading and storing binary files.</p>
+<p>Generally, each binary file consists of a short header and binary data.
+The header ensures consistency between the storing and the loading of data,
+while the &#8220;binary data&#8221; is some binary representation of the data of interest.</p>
+<p>The main issue, we try to address is that in C++, the binary representation
+of objects can be machine- and compiler-dependent. The standard guarantees
+though that <code class="docutils literal"><span class="pre">sizeof(char)</span> <span class="pre">=</span> <span class="pre">1</span></code> and that <code class="docutils literal"><span class="pre">std::vector</span></code> is contiguous in
+memory. Everything else (e.g. <code class="docutils literal"><span class="pre">sizeof(int)</span></code>, endianness, padding of structs)
+can vary. Two approaches can be used:</p>
+<ol class="arabic simple">
+<li>Raw binary data files which are very fast to load, but assume a certain
+memory-layout for the internal representation of data</li>
+<li>Portable binary data files which are slow to load, but do not assume a given
+memory-layout for the internal representation of data</li>
+</ol>
+<p>Portable I/O should always be provided for binary files. If this is too slow
+for your needs, you can provide functionality for raw binary files. In that
+case you should still distribute only the portable file and provide a
+converter which loads the portable file and stores a raw binary file for
+further use. Storing and loading of raw binary files on the same machine with
+the same compiler should never be an issue.</p>
+<p>The classes <a class="reference internal" href="loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>,
+<a class="reference internal" href="loop/structure_db.html#promod3.loop.FragDB" title="promod3.loop.FragDB"><code class="xref py py-class docutils literal"><span class="pre">FragDB</span></code></a>, <a class="reference internal" href="loop/structure_db.html#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>,
+<a class="reference internal" href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a>,
+<a class="reference internal" href="sidechain/rotamer_lib.html#promod3.sidechain.BBDepRotamerLib" title="promod3.sidechain.BBDepRotamerLib"><code class="xref py py-class docutils literal"><span class="pre">BBDepRotamerLib</span></code></a> and
+<a class="reference internal" href="sidechain/rotamer_lib.html#promod3.sidechain.RotamerLib" title="promod3.sidechain.RotamerLib"><code class="xref py py-class docutils literal"><span class="pre">RotamerLib</span></code></a> use this approach and the conversion is
+automatically done in the <code class="docutils literal"><span class="pre">make</span></code> process. Code examples are given in the unit
+tests in <code class="file docutils literal"><span class="pre">test_check_io.cc</span></code> and <code class="file docutils literal"><span class="pre">test_portable_binary.cc</span></code> and in the
+C++ code of the classes listed above (see methods Load, Save, LoadPortable and
+SavePortable).</p>
+<div class="section" id="header">
+<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
+<p>The header is written/read with functions provided in the header file
+<code class="file docutils literal"><span class="pre">promod3/core/check_io.hh</span></code>. The header is written/read before the data
+itself and is structured as follows:</p>
+<ul class="simple">
+<li>a &#8220;magic number&#8221; (ensures that we can read <code class="docutils literal"><span class="pre">uint32_t</span></code> which is needed for
+the following fields)</li>
+<li>a version number (allows for backwards-compatibility)</li>
+<li>sizes for all types which are treated as raw memory (i.e. casted to a byte
+(<code class="docutils literal"><span class="pre">char</span></code>) array and written either to memory or to a stream)</li>
+<li>example values for the used base-types (ensures we can e.g. read an <code class="docutils literal"><span class="pre">int</span></code>)</li>
+</ul>
+<p>For portable I/O (see below), we only write/read fixed-width fundamental
+data-types (e.g. <code class="docutils literal"><span class="pre">int32_t</span></code>, <code class="docutils literal"><span class="pre">float</span></code>). Hence, we only check if we can
+read/write those types.
+When data is converted from a non-fixed fundamental type <code class="docutils literal"><span class="pre">T</span></code> (e.g. <code class="docutils literal"><span class="pre">uint</span></code>,
+<code class="docutils literal"><span class="pre">short</span></code>, <code class="docutils literal"><span class="pre">Real</span></code>), we furthermore ensure that the used fixed-width type
+(size written to file) is <code class="docutils literal"><span class="pre">&lt;=</span> <span class="pre">sizeof(T)</span></code>.</p>
+<p>All write functions (when saving a binary) should be mirrored by the
+corresponding check (or get) function in the exact same order when loading.</p>
+<p>All functions are templatized to work with any OST-like data sink or source
+and overloaded to work with <code class="docutils literal"><span class="pre">std::ofstream</span></code> and <code class="docutils literal"><span class="pre">std::ifstream</span></code>.</p>
+</div>
+<div class="section" id="portable-binary-data">
+<h2>Portable binary data<a class="headerlink" href="#portable-binary-data" title="Permalink to this headline">¶</a></h2>
+<p>Portable files are written/read with functions and classes provided in the
+header file <code class="file docutils literal"><span class="pre">promod3/core/portable_binary_serializer.hh</span></code>.
+Generally, we store any data-structure value-by-value as fixed-width types!</p>
+<p>Writing and reading is performed by the following classes:</p>
+<ul class="simple">
+<li><code class="docutils literal"><span class="pre">PortableBinaryDataSink</span></code> to write files (opened as <code class="docutils literal"><span class="pre">std::ofstream</span></code>)</li>
+<li><code class="docutils literal"><span class="pre">PortableBinaryDataSource</span></code> to read files (opened as <code class="docutils literal"><span class="pre">std::ifstream</span></code>)</li>
+</ul>
+<p>Each serializable class must define a <code class="docutils literal"><span class="pre">Serialize</span></code> function that accepts sinks
+and sources, such as:</p>
+<div class="highlight-cpp"><div class="highlight"><pre><span class="k">template</span> <span class="o">&lt;</span><span class="k">typename</span> <span class="n">DS</span><span class="o">&gt;</span>
+<span class="kt">void</span> <span class="n">Serialize</span><span class="p">(</span><span class="n">DS</span><span class="o">&amp;</span> <span class="n">ds</span><span class="p">)</span> <span class="p">{</span>
+  <span class="c1">// serialize element-by-element</span>
+<span class="p">}</span>
+</pre></div>
+</div>
+<p>Or if this is not possible for an object of type <code class="docutils literal"><span class="pre">T</span></code>, we need to define
+global functions such as:</p>
+<div class="highlight-cpp"><div class="highlight"><pre><span class="kr">inline</span> <span class="kt">void</span> <span class="nf">Serialize</span><span class="p">(</span><span class="n">core</span><span class="o">::</span><span class="n">PortableBinaryDataSource</span><span class="o">&amp;</span> <span class="n">ds</span><span class="p">,</span> <span class="n">T</span><span class="o">&amp;</span> <span class="n">t</span><span class="p">)</span> <span class="p">{</span> <span class="p">}</span>
+<span class="kr">inline</span> <span class="kt">void</span> <span class="nf">Serialize</span><span class="p">(</span><span class="n">core</span><span class="o">::</span><span class="n">PortableBinaryDataSink</span><span class="o">&amp;</span> <span class="n">ds</span><span class="p">,</span> <span class="n">T</span> <span class="n">t</span><span class="p">)</span> <span class="p">{</span> <span class="p">}</span>
+</pre></div>
+</div>
+<p>Given a sink or source object <code class="docutils literal"><span class="pre">ds</span></code>, we read/write an object <code class="docutils literal"><span class="pre">v</span></code> as:</p>
+<ul class="simple">
+<li><code class="docutils literal"><span class="pre">ds</span> <span class="pre">&amp;</span> <span class="pre">v</span></code>, if <code class="docutils literal"><span class="pre">v</span></code> is an instance of a class, a <code class="docutils literal"><span class="pre">bool</span></code> or any
+fixed-width type (e.g. <code class="docutils literal"><span class="pre">char</span></code>, <code class="docutils literal"><span class="pre">int_32_t</span></code>, <code class="docutils literal"><span class="pre">float</span></code>)</li>
+<li><code class="docutils literal"><span class="pre">core::ConvertBaseType&lt;T&gt;(ds,</span> <span class="pre">v)</span></code>, where <code class="docutils literal"><span class="pre">T</span></code> is a fixed-width type.
+<code class="docutils literal"><span class="pre">v</span></code> will then be converted to/from <code class="docutils literal"><span class="pre">T</span></code>. This is needed for any non-fixed
+fundamental type (e.g. <code class="docutils literal"><span class="pre">uint</span></code>, <code class="docutils literal"><span class="pre">short</span></code>, <code class="docutils literal"><span class="pre">Real</span></code>).</li>
+</ul>
+<p>Implementation notes:</p>
+<ul class="simple">
+<li>the <code class="docutils literal"><span class="pre">Serialize</span></code> function for fundamental types takes care of endianness
+(all written as little endian and converted from/to native endianness)</li>
+<li>custom <code class="docutils literal"><span class="pre">Serialize</span></code> functions exist for <code class="docutils literal"><span class="pre">String</span></code> (= <code class="docutils literal"><span class="pre">std::string</span></code>),
+<code class="docutils literal"><span class="pre">std::vector&lt;T&gt;</span></code> and <code class="docutils literal"><span class="pre">std::pair&lt;T,T2&gt;</span></code>. It will throw an error if the
+used type <code class="docutils literal"><span class="pre">T</span></code> or <code class="docutils literal"><span class="pre">T2</span></code> is a fundamental type. In that case, you have to
+serialize the values manually and convert each element appropriately.</li>
+<li>you can use <code class="docutils literal"><span class="pre">ds.IsSource()</span></code> to distinguish sources and sinks.</li>
+</ul>
+</div>
+<div class="section" id="code-example">
+<h2>Code example<a class="headerlink" href="#code-example" title="Permalink to this headline">¶</a></h2>
+<p>Here is an example of a class which provides functionality for portable
+and non-portable I/O:</p>
+<div class="highlight-cpp"><div class="highlight"><pre><span class="c1">// includes for this class</span>
+<span class="cp">#include &lt;boost/shared_ptr.hpp&gt;</span>
+<span class="cp">#include &lt;iostream&gt;</span>
+<span class="cp">#include &lt;fstream&gt;</span>
+<span class="cp">#include &lt;sstream&gt;</span>
+<span class="cp">#include &lt;vector&gt;</span>
+
+<span class="c1">// includes for I/O</span>
+<span class="cp">#include &lt;promod3/core/message.hh&gt;</span>
+<span class="cp">#include &lt;promod3/core/portable_binary_serializer.hh&gt;</span>
+<span class="cp">#include &lt;promod3/core/check_io.hh&gt;</span>
+
+<span class="k">using</span> <span class="k">namespace</span> <span class="n">promod3</span><span class="p">;</span>
+
+<span class="c1">// define some data-structure</span>
+<span class="k">struct</span> <span class="n">SomeData</span> <span class="p">{</span>
+  <span class="kt">short</span> <span class="n">s</span><span class="p">;</span>
+  <span class="kt">int</span> <span class="n">i</span><span class="p">;</span>
+  <span class="n">Real</span> <span class="n">r</span><span class="p">;</span>
+
+  <span class="c1">// portable serialization</span>
+  <span class="c1">// (cleanly element by element with fixed-width base-types)</span>
+  <span class="k">template</span> <span class="o">&lt;</span><span class="k">typename</span> <span class="n">DS</span><span class="o">&gt;</span>
+  <span class="kt">void</span> <span class="n">Serialize</span><span class="p">(</span><span class="n">DS</span><span class="o">&amp;</span> <span class="n">ds</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">ConvertBaseType</span><span class="o">&lt;</span><span class="kt">int16_t</span><span class="o">&gt;</span><span class="p">(</span><span class="n">ds</span><span class="p">,</span> <span class="n">s</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">ConvertBaseType</span><span class="o">&lt;</span><span class="kt">int32_t</span><span class="o">&gt;</span><span class="p">(</span><span class="n">ds</span><span class="p">,</span> <span class="n">i</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">ConvertBaseType</span><span class="o">&lt;</span><span class="kt">float</span><span class="o">&gt;</span><span class="p">(</span><span class="n">ds</span><span class="p">,</span> <span class="n">r</span><span class="p">);</span>
+  <span class="p">}</span>
+<span class="p">};</span>
+
+<span class="c1">// define pointer type</span>
+<span class="k">class</span> <span class="nc">MyClass</span><span class="p">;</span>
+<span class="k">typedef</span> <span class="n">boost</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">MyClass</span><span class="o">&gt;</span> <span class="n">MyClassPtr</span><span class="p">;</span>
+
+<span class="c1">// define class</span>
+<span class="k">class</span> <span class="nc">MyClass</span> <span class="p">{</span>
+<span class="k">public</span><span class="o">:</span>
+  <span class="n">MyClass</span><span class="p">(</span><span class="k">const</span> <span class="n">String</span><span class="o">&amp;</span> <span class="n">id</span><span class="p">)</span><span class="o">:</span> <span class="n">id_</span><span class="p">(</span><span class="n">id</span><span class="p">)</span> <span class="p">{</span> <span class="p">}</span>
+
+  <span class="c1">// raw binary save</span>
+  <span class="kt">void</span> <span class="n">Save</span><span class="p">(</span><span class="k">const</span> <span class="n">String</span><span class="o">&amp;</span> <span class="n">filename</span><span class="p">)</span> <span class="p">{</span>
+    <span class="c1">// open file</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">ofstream</span> <span class="n">out_stream</span><span class="p">(</span><span class="n">filename</span><span class="p">.</span><span class="n">c_str</span><span class="p">(),</span> <span class="n">std</span><span class="o">::</span><span class="n">ios</span><span class="o">::</span><span class="n">binary</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">out_stream</span><span class="p">)</span> <span class="p">{</span>
+      <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span> <span class="n">ss</span><span class="p">;</span>
+      <span class="n">ss</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;The file &#39;&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">filename</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;&#39; cannot be opened.&quot;</span><span class="p">;</span>
+      <span class="k">throw</span> <span class="n">promod3</span><span class="o">::</span><span class="n">Error</span><span class="p">(</span><span class="n">ss</span><span class="p">.</span><span class="n">str</span><span class="p">());</span>
+    <span class="p">}</span>
+
+    <span class="c1">// header for consistency checks</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteMagicNumber</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteVersionNumber</span><span class="p">(</span><span class="n">out_stream</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
+    <span class="c1">// required base types: short, int, Real (for SomeData).</span>
+    <span class="c1">//                      uint (for sizes)</span>
+    <span class="c1">// required structs: SomeData</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteTypeSize</span><span class="o">&lt;</span><span class="n">uint</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteTypeSize</span><span class="o">&lt;</span><span class="kt">short</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteTypeSize</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteTypeSize</span><span class="o">&lt;</span><span class="n">Real</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteTypeSize</span><span class="o">&lt;</span><span class="n">SomeData</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="c1">// check values for base types</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteBaseType</span><span class="o">&lt;</span><span class="n">uint</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteBaseType</span><span class="o">&lt;</span><span class="kt">short</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteBaseType</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteBaseType</span><span class="o">&lt;</span><span class="n">Real</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+
+    <span class="c1">// write string</span>
+    <span class="n">uint</span> <span class="n">str_len</span> <span class="o">=</span> <span class="n">id_</span><span class="p">.</span><span class="n">length</span><span class="p">();</span>
+    <span class="n">out_stream</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="k">reinterpret_cast</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">*&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="n">str_len</span><span class="p">),</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">uint</span><span class="p">));</span>
+    <span class="n">out_stream</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">id_</span><span class="p">.</span><span class="n">c_str</span><span class="p">(),</span> <span class="n">str_len</span><span class="p">);</span>
+    <span class="c1">// write vector of SomeData</span>
+    <span class="n">uint</span> <span class="n">v_size</span> <span class="o">=</span> <span class="n">data_</span><span class="p">.</span><span class="n">size</span><span class="p">();</span>
+    <span class="n">out_stream</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="k">reinterpret_cast</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">*&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="n">v_size</span><span class="p">),</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">uint</span><span class="p">));</span>
+    <span class="n">out_stream</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="k">reinterpret_cast</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">*&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="n">data_</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span>
+                     <span class="k">sizeof</span><span class="p">(</span><span class="n">SomeData</span><span class="p">)</span><span class="o">*</span><span class="n">v_size</span><span class="p">);</span>
+  <span class="p">}</span>
+
+  <span class="c1">// raw binary load</span>
+  <span class="k">static</span> <span class="n">MyClassPtr</span> <span class="n">Load</span><span class="p">(</span><span class="k">const</span> <span class="n">String</span><span class="o">&amp;</span> <span class="n">filename</span><span class="p">)</span> <span class="p">{</span>
+    <span class="c1">// open file</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">ifstream</span> <span class="n">in_stream</span><span class="p">(</span><span class="n">filename</span><span class="p">.</span><span class="n">c_str</span><span class="p">(),</span> <span class="n">std</span><span class="o">::</span><span class="n">ios</span><span class="o">::</span><span class="n">binary</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">in_stream</span><span class="p">)</span> <span class="p">{</span>
+      <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span> <span class="n">ss</span><span class="p">;</span>
+      <span class="n">ss</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;The file &#39;&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">filename</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;&#39; does not exist.&quot;</span><span class="p">;</span>
+      <span class="k">throw</span> <span class="n">promod3</span><span class="o">::</span><span class="n">Error</span><span class="p">(</span><span class="n">ss</span><span class="p">.</span><span class="n">str</span><span class="p">());</span>
+    <span class="p">}</span>
+
+    <span class="c1">// header for consistency checks</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckMagicNumber</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="kt">uint32_t</span> <span class="n">version</span> <span class="o">=</span> <span class="n">core</span><span class="o">::</span><span class="n">GetVersionNumber</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">version</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
+      <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span> <span class="n">ss</span><span class="p">;</span>
+      <span class="n">ss</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Unsupported file version &#39;&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">version</span>
+         <span class="o">&lt;&lt;</span> <span class="s">&quot;&#39; in &#39;&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">filename</span><span class="p">;</span>
+      <span class="k">throw</span> <span class="n">promod3</span><span class="o">::</span><span class="n">Error</span><span class="p">(</span><span class="n">ss</span><span class="p">.</span><span class="n">str</span><span class="p">());</span>
+    <span class="p">}</span>
+    <span class="c1">// check for exact sizes as used in Save</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckTypeSize</span><span class="o">&lt;</span><span class="n">uint</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckTypeSize</span><span class="o">&lt;</span><span class="kt">short</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckTypeSize</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckTypeSize</span><span class="o">&lt;</span><span class="n">Real</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckTypeSize</span><span class="o">&lt;</span><span class="n">SomeData</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="c1">// check values for base types used in Save</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckBaseType</span><span class="o">&lt;</span><span class="n">uint</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckBaseType</span><span class="o">&lt;</span><span class="kt">short</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckBaseType</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckBaseType</span><span class="o">&lt;</span><span class="n">Real</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+
+    <span class="c1">// read string (needed for constructor)</span>
+    <span class="n">uint</span> <span class="n">str_len</span><span class="p">;</span>
+    <span class="n">in_stream</span><span class="p">.</span><span class="n">read</span><span class="p">(</span><span class="k">reinterpret_cast</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">*&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="n">str_len</span><span class="p">),</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">uint</span><span class="p">));</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;</span> <span class="n">tmp_buf</span><span class="p">(</span><span class="n">str_len</span><span class="p">);</span>
+    <span class="n">in_stream</span><span class="p">.</span><span class="n">read</span><span class="p">(</span><span class="o">&amp;</span><span class="n">tmp_buf</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">str_len</span><span class="p">);</span>
+
+    <span class="c1">// construct</span>
+    <span class="n">MyClassPtr</span> <span class="nf">p</span><span class="p">(</span><span class="k">new</span> <span class="n">MyClass</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="o">&amp;</span><span class="n">tmp_buf</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">str_len</span><span class="p">)));</span>
+
+    <span class="c1">// read vector of SomeData</span>
+    <span class="n">uint</span> <span class="n">v_size</span><span class="p">;</span>
+    <span class="n">in_stream</span><span class="p">.</span><span class="n">read</span><span class="p">(</span><span class="k">reinterpret_cast</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">*&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="n">v_size</span><span class="p">),</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">uint</span><span class="p">));</span>
+    <span class="n">p</span><span class="o">-&gt;</span><span class="n">data_</span><span class="p">.</span><span class="n">resize</span><span class="p">(</span><span class="n">v_size</span><span class="p">);</span>
+    <span class="n">in_stream</span><span class="p">.</span><span class="n">read</span><span class="p">(</span><span class="k">reinterpret_cast</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">*&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="n">p</span><span class="o">-&gt;</span><span class="n">data_</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span>
+                   <span class="k">sizeof</span><span class="p">(</span><span class="n">SomeData</span><span class="p">)</span><span class="o">*</span><span class="n">v_size</span><span class="p">);</span>
+
+    <span class="k">return</span> <span class="n">p</span><span class="p">;</span>
+  <span class="p">}</span>
+
+  <span class="c1">// portable binary save</span>
+  <span class="kt">void</span> <span class="n">SavePortable</span><span class="p">(</span><span class="k">const</span> <span class="n">String</span><span class="o">&amp;</span> <span class="n">filename</span><span class="p">)</span> <span class="p">{</span>
+    <span class="c1">// open file</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">ofstream</span> <span class="n">out_stream_</span><span class="p">(</span><span class="n">filename</span><span class="p">.</span><span class="n">c_str</span><span class="p">(),</span> <span class="n">std</span><span class="o">::</span><span class="n">ios</span><span class="o">::</span><span class="n">binary</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">out_stream_</span><span class="p">)</span> <span class="p">{</span>
+      <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span> <span class="n">ss</span><span class="p">;</span>
+      <span class="n">ss</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;The file &#39;&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">filename</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;&#39; cannot be opened.&quot;</span><span class="p">;</span>
+      <span class="k">throw</span> <span class="n">promod3</span><span class="o">::</span><span class="n">Error</span><span class="p">(</span><span class="n">ss</span><span class="p">.</span><span class="n">str</span><span class="p">());</span>
+    <span class="p">}</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">PortableBinaryDataSink</span> <span class="n">out_stream</span><span class="p">(</span><span class="n">out_stream_</span><span class="p">);</span>
+
+    <span class="c1">// header for consistency checks</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteMagicNumber</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteVersionNumber</span><span class="p">(</span><span class="n">out_stream</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
+    <span class="c1">// required base types: short, int, Real</span>
+    <span class="c1">// -&gt; converted to int16_t, int32_t, float</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteTypeSize</span><span class="o">&lt;</span><span class="kt">int16_t</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteTypeSize</span><span class="o">&lt;</span><span class="kt">int32_t</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteTypeSize</span><span class="o">&lt;</span><span class="kt">float</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="c1">// check values for base types</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteBaseType</span><span class="o">&lt;</span><span class="kt">int16_t</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteBaseType</span><span class="o">&lt;</span><span class="kt">int32_t</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">WriteBaseType</span><span class="o">&lt;</span><span class="kt">float</span><span class="o">&gt;</span><span class="p">(</span><span class="n">out_stream</span><span class="p">);</span>
+
+    <span class="c1">// write string (provided in portable_binary_serializer.hh)</span>
+    <span class="n">out_stream</span> <span class="o">&amp;</span> <span class="n">id_</span><span class="p">;</span>
+    <span class="c1">// write vector (provided in portable_binary_serializer.hh)</span>
+    <span class="c1">// -&gt; only ok like this if vector of custom type</span>
+    <span class="c1">// -&gt; will call Serialize-function for each element</span>
+    <span class="n">out_stream</span> <span class="o">&amp;</span> <span class="n">data_</span><span class="p">;</span>
+  <span class="p">}</span>
+
+  <span class="c1">// portable binary load</span>
+  <span class="k">static</span> <span class="n">MyClassPtr</span> <span class="n">LoadPortable</span><span class="p">(</span><span class="k">const</span> <span class="n">String</span><span class="o">&amp;</span> <span class="n">filename</span><span class="p">)</span> <span class="p">{</span>
+    <span class="c1">// open file</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">ifstream</span> <span class="n">in_stream_</span><span class="p">(</span><span class="n">filename</span><span class="p">.</span><span class="n">c_str</span><span class="p">(),</span> <span class="n">std</span><span class="o">::</span><span class="n">ios</span><span class="o">::</span><span class="n">binary</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">in_stream_</span><span class="p">)</span> <span class="p">{</span>
+      <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span> <span class="n">ss</span><span class="p">;</span>
+      <span class="n">ss</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;The file &#39;&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">filename</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;&#39; does not exist.&quot;</span><span class="p">;</span>
+      <span class="k">throw</span> <span class="n">promod3</span><span class="o">::</span><span class="n">Error</span><span class="p">(</span><span class="n">ss</span><span class="p">.</span><span class="n">str</span><span class="p">());</span>
+    <span class="p">}</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">PortableBinaryDataSource</span> <span class="n">in_stream</span><span class="p">(</span><span class="n">in_stream_</span><span class="p">);</span>
+
+    <span class="c1">// header for consistency checks</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckMagicNumber</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="kt">uint32_t</span> <span class="n">version</span> <span class="o">=</span> <span class="n">core</span><span class="o">::</span><span class="n">GetVersionNumber</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">version</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
+      <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span> <span class="n">ss</span><span class="p">;</span>
+      <span class="n">ss</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Unsupported file version &#39;&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">version</span>
+         <span class="o">&lt;&lt;</span> <span class="s">&quot;&#39; in &#39;&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">filename</span><span class="p">;</span>
+      <span class="k">throw</span> <span class="n">promod3</span><span class="o">::</span><span class="n">Error</span><span class="p">(</span><span class="n">ss</span><span class="p">.</span><span class="n">str</span><span class="p">());</span>
+    <span class="p">}</span>
+    <span class="c1">// check for if required base types (see SavePortable)</span>
+    <span class="c1">// are big enough</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckTypeSize</span><span class="o">&lt;</span><span class="kt">short</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckTypeSize</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckTypeSize</span><span class="o">&lt;</span><span class="n">Real</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
+    <span class="c1">// check values for base types used in Save</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckBaseType</span><span class="o">&lt;</span><span class="kt">int16_t</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckBaseType</span><span class="o">&lt;</span><span class="kt">int32_t</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+    <span class="n">core</span><span class="o">::</span><span class="n">CheckBaseType</span><span class="o">&lt;</span><span class="kt">float</span><span class="o">&gt;</span><span class="p">(</span><span class="n">in_stream</span><span class="p">);</span>
+
+    <span class="c1">// read string (needed for constructor)</span>
+    <span class="n">String</span> <span class="n">s</span><span class="p">;</span>
+    <span class="n">in_stream</span> <span class="o">&amp;</span> <span class="n">s</span><span class="p">;</span>
+    <span class="c1">// construct</span>
+    <span class="n">MyClassPtr</span> <span class="nf">p</span><span class="p">(</span><span class="k">new</span> <span class="n">MyClass</span><span class="p">(</span><span class="n">s</span><span class="p">));</span>
+    <span class="c1">// read vector of SomeData</span>
+    <span class="n">in_stream</span> <span class="o">&amp;</span> <span class="n">p</span><span class="o">-&gt;</span><span class="n">data_</span><span class="p">;</span>
+
+    <span class="k">return</span> <span class="n">p</span><span class="p">;</span>
+  <span class="p">}</span>
+
+<span class="k">private</span><span class="o">:</span>
+  <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">SomeData</span><span class="o">&gt;</span> <span class="n">data_</span><span class="p">;</span>
+  <span class="n">String</span> <span class="n">id_</span><span class="p">;</span>
+<span class="p">};</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+  <span class="c1">// generate raw file</span>
+  <span class="n">MyClassPtr</span> <span class="n">p</span><span class="p">(</span><span class="k">new</span> <span class="n">MyClass</span><span class="p">(</span><span class="s">&quot;HELLO&quot;</span><span class="p">));</span>
+  <span class="n">p</span><span class="o">-&gt;</span><span class="n">Save</span><span class="p">(</span><span class="s">&quot;test.dat&quot;</span><span class="p">);</span>
+  <span class="c1">// load raw file</span>
+  <span class="n">p</span> <span class="o">=</span> <span class="n">MyClass</span><span class="o">::</span><span class="n">Load</span><span class="p">(</span><span class="s">&quot;test.dat&quot;</span><span class="p">);</span>
+
+  <span class="c1">// generate portable file</span>
+  <span class="n">p</span><span class="o">-&gt;</span><span class="n">SavePortable</span><span class="p">(</span><span class="s">&quot;test.dat&quot;</span><span class="p">);</span>
+  <span class="c1">// load portable file</span>
+  <span class="n">p</span> <span class="o">=</span> <span class="n">MyClass</span><span class="o">::</span><span class="n">LoadPortable</span><span class="p">(</span><span class="s">&quot;test.dat&quot;</span><span class="p">);</span>
+
+  <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="exisiting-binary-files">
+<h2>Exisiting binary files<a class="headerlink" href="#exisiting-binary-files" title="Permalink to this headline">¶</a></h2>
+<p>The following binary files are currently in ProMod3:</p>
+<ul class="simple">
+<li>module <code class="docutils literal"><span class="pre">loop</span></code>:<ul>
+<li><code class="file docutils literal"><span class="pre">backbone_loop_scorer.dat</span></code>
+(<a class="reference internal" href="loop/backbone_loop_score.html#promod3.loop.BackboneLoopScorer" title="promod3.loop.BackboneLoopScorer"><code class="xref py py-class docutils literal"><span class="pre">BackboneLoopScorer</span></code></a>)</li>
+<li><code class="file docutils literal"><span class="pre">frag_db.dat</span></code>
+(<a class="reference internal" href="loop/structure_db.html#promod3.loop.FragDB" title="promod3.loop.FragDB"><code class="xref py py-class docutils literal"><span class="pre">FragDB</span></code></a>)</li>
+<li><code class="file docutils literal"><span class="pre">structure_db.dat</span></code>
+(<a class="reference internal" href="loop/structure_db.html#promod3.loop.StructureDB" title="promod3.loop.StructureDB"><code class="xref py py-class docutils literal"><span class="pre">StructureDB</span></code></a>)</li>
+<li><code class="file docutils literal"><span class="pre">torsion_sampler_coil.dat</span></code>
+(<a class="reference internal" href="loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>)</li>
+<li><code class="file docutils literal"><span class="pre">torsion_sampler.dat</span></code>
+(<a class="reference internal" href="loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>)</li>
+<li><code class="file docutils literal"><span class="pre">torsion_sampler_extended.dat</span></code>
+(<a class="reference internal" href="loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>)</li>
+<li><code class="file docutils literal"><span class="pre">torsion_sampler_helical.dat</span></code>
+(<a class="reference internal" href="loop/torsion_sampler.html#promod3.loop.TorsionSampler" title="promod3.loop.TorsionSampler"><code class="xref py py-class docutils literal"><span class="pre">TorsionSampler</span></code></a>)</li>
+</ul>
+</li>
+<li>module <code class="docutils literal"><span class="pre">sidechain</span></code>:<ul>
+<li><code class="file docutils literal"><span class="pre">2010DunbrackLib.dat</span></code>
+(<a class="reference internal" href="sidechain/rotamer_lib.html#promod3.sidechain.BBDepRotamerLib" title="promod3.sidechain.BBDepRotamerLib"><code class="xref py py-class docutils literal"><span class="pre">BBDepRotamerLib</span></code></a>)</li>
+<li><code class="file docutils literal"><span class="pre">PenultimateLib.dat</span></code>
+(<a class="reference internal" href="sidechain/rotamer_lib.html#promod3.sidechain.RotamerLib" title="promod3.sidechain.RotamerLib"><code class="xref py py-class docutils literal"><span class="pre">RotamerLib</span></code></a>)</li>
+</ul>
+</li>
+</ul>
+<p>During the <code class="docutils literal"><span class="pre">make</span></code> process, portable versions of the files (stored in the
+<code class="file docutils literal"><span class="pre">&lt;MODULE&gt;/data</span></code> folder) are converted and corresponding raw binary files
+are stored in the <code class="file docutils literal"><span class="pre">stage/share/promod3/&lt;MODULE&gt;_data</span></code> folder.</p>
+<p>Code for the generation of the binary files and their portable versions are
+in the <code class="file docutils literal"><span class="pre">extras/data_generation</span></code> folder (provided as-is).</p>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
+        <div class="sphinxsidebarwrapper">
+  <h3><a href="index.html">Table Of Contents</a></h3>
+  <ul>
+<li><a class="reference internal" href="#">Using binary files in ProMod3</a><ul>
+<li><a class="reference internal" href="#header">Header</a></li>
+<li><a class="reference internal" href="#portable-binary-data">Portable binary data</a></li>
+<li><a class="reference internal" href="#code-example">Code example</a></li>
+<li><a class="reference internal" href="#exisiting-binary-files">Exisiting binary files</a></li>
+</ul>
+</li>
+</ul>
+<div class="relations">
+<h3>Related Topics</h3>
+<ul>
+  <li><a href="index.html">Documentation overview</a><ul>
+  <li><a href="developers.html">Documentation For Developers</a><ul>
+      <li>Previous: <a href="cmake/index.html" title="previous chapter">ProMod3&#8216;s Share Of CMake</a></li>
+      <li>Next: <a href="changelog.html" title="next chapter">Changelog</a></li>
+  </ul></li>
+  </ul></li>
+</ul>
+</div>
+  <div role="note" aria-label="source link">
+    <h3>This Page</h3>
+    <ul class="this-page-menu">
+      <li><a href="_sources/portableIO.txt"
+            rel="nofollow">Show Source</a></li>
+    </ul>
+   </div>
+<div id="searchbox" style="display: none" role="search">
+  <h3>Quick search</h3>
+    <form class="search" action="search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="footer">
+      &copy;2016, Bienchen.
+      
+      |
+      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>
+      
+      |
+      <a href="_sources/portableIO.txt"
+          rel="nofollow">Page source</a>
+    </div>
+
+    
+
+    
+  </body>
+</html>
\ No newline at end of file
diff --git a/doc/html/py-modindex.html b/doc/html/py-modindex.html
index 7582a247e7a9000bf489dedf9f67f749a4ec6422..fbb333e4f09e5c92caefff4905f1ccb49bfa613e 100644
--- a/doc/html/py-modindex.html
+++ b/doc/html/py-modindex.html
@@ -127,7 +127,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/search.html b/doc/html/search.html
index cd760235a39d67b03d322ae53cdd7c7a8d6a7586..d10b8fb25fd42e1caaec0b25e62dc92cce78a1e8 100644
--- a/doc/html/search.html
+++ b/doc/html/search.html
@@ -84,7 +84,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/searchindex.js b/doc/html/searchindex.js
index 31365f72b3f46675135ef420d0782ece5069a0a4..cd9cc0a46d7a84bb90a7dde3f49650f2244c30a5 100644
--- a/doc/html/searchindex.js
+++ b/doc/html/searchindex.js
@@ -1 +1 @@
-Search.setIndex({envversion:46,filenames:["actions/index_dev","buildsystem","changelog","cmake/index","contributing","core/helper","core/index","core/pm3argparse","core/setcompoundschemlib","developers","gettingstarted","index","loop/backbone","loop/backbone_loop_score","loop/helper_classes","loop/index","loop/load_loop_objects","loop/loop_closing","loop/monte_carlo","loop/structure_db","loop/torsion_sampler","modelling/index","sidechain/disulfid","sidechain/frame","sidechain/graph","sidechain/index","sidechain/rotamer","sidechain/rotamer_id","sidechain/rotamer_lib","sidechain/sidechain_settings","users"],objects:{"":{"command:add_doc_dependency":[3,0,1,""],"command:add_doc_source":[3,0,1,""],"command:pm_action":[3,0,1,""],"command:promod3_unittest":[3,0,1,""],test_actions:[0,1,0,"-"]},"promod3.core":{helper:[5,1,0,"-"],pm3argparse:[7,1,0,"-"]},"promod3.core.helper":{FileExists:[5,5,1,""],FileExtension:[5,5,1,""],FileGzip:[5,5,1,""],MsgErrorAndExit:[5,5,1,""]},"promod3.core.pm3argparse":{PM3ArgumentParser:[7,3,1,""]},"promod3.core.pm3argparse.PM3ArgumentParser":{"__init__":[7,2,1,""],AddAlignment:[7,2,1,""],AssembleParser:[7,2,1,""],Parse:[7,2,1,""],action:[7,4,1,""]},"promod3.loop":{Backbone:[12,3,1,""],BackboneList:[12,3,1,""],BackboneLoopScorer:[13,3,1,""],BackboneRelaxer:[17,3,1,""],CCD:[17,3,1,""],CCDCloser:[18,3,1,""],CTerminalCloser:[18,3,1,""],CoordInfo:[19,3,1,""],DirtyCCDCloser:[18,3,1,""],ExponentialCooler:[18,3,1,""],FragDB:[19,3,1,""],Fragger:[19,3,1,""],FragmentInfo:[19,3,1,""],FragmentSampler:[18,3,1,""],KIC:[17,3,1,""],KICCloser:[18,3,1,""],LinearScorer:[18,3,1,""],LoadBackboneLoopScorer:[16,2,1,""],LoadFragDB:[16,2,1,""],LoadStructureDB:[16,2,1,""],LoadTorsionSampler:[16,2,1,""],LoadTorsionSamplerCoil:[16,2,1,""],LoadTorsionSamplerExtended:[16,2,1,""],LoadTorsionSamplerHelical:[16,2,1,""],LoopCandidate:[14,3,1,""],LoopCandidates:[14,3,1,""],MonteCarloSampler:[18,2,1,""],NTerminalCloser:[18,3,1,""],PhiPsiSampler:[18,3,1,""],PsipredPrediction:[14,3,1,""],SoftSampler:[18,3,1,""],StructureDB:[19,3,1,""],TorsionSampler:[20,3,1,""]},"promod3.loop.Backbone":{ApplyTransform:[12,2,1,""],Backbone:[12,2,1,""],GetTransform:[12,2,1,""],aa:[12,4,1,""],c_coord:[12,4,1,""],ca_coord:[12,4,1,""],cb_coord:[12,4,1,""],n_coord:[12,4,1,""],o_coord:[12,4,1,""],one_letter_code:[12,4,1,""]},"promod3.loop.BackboneList":{ApplyTransform:[12,2,1,""],BackboneList:[12,2,1,""],CARMSD:[12,2,1,""],GetOmegaTorsion:[12,2,1,""],GetPhiTorsion:[12,2,1,""],GetPsiTorsion:[12,2,1,""],GetSequence:[12,2,1,""],InsertInto:[12,2,1,""],RMSD:[12,2,1,""],ReconstructCBetaPositions:[12,2,1,""],ReconstructOxygenPositions:[12,2,1,""],ReplaceFragment:[12,2,1,""],RotateAroundOmegaTorsion:[12,2,1,""],RotateAroundPhiPsiTorsion:[12,2,1,""],RotateAroundPhiTorsion:[12,2,1,""],RotateAroundPsiTorsion:[12,2,1,""],SetOmegaTorsion:[12,2,1,""],SetPhiPsiTorsion:[12,2,1,""],SetPhiTorsion:[12,2,1,""],SetPsiTorsion:[12,2,1,""],SuperposeOnto:[12,2,1,""],ToEntity:[12,2,1,""],append:[12,2,1,""]},"promod3.loop.BackboneLoopScorer":{CalculateCBPackingScore:[13,2,1,""],CalculateCBetaScore:[13,2,1,""],CalculateClashScore:[13,2,1,""],CalculateHBondScore:[13,2,1,""],CalculateReducedScore:[13,2,1,""],CalculateSSAgreementScore:[13,2,1,""],CalculateTorsionScore:[13,2,1,""],ClearEnvironment:[13,2,1,""],Initialize:[13,2,1,""],Load:[13,2,1,""],Save:[13,2,1,""],SetCBPackingEnergy:[13,2,1,""],SetCBPackingPotentialParameters:[13,2,1,""],SetCBetaEnergy:[13,2,1,""],SetCBetaPotentialParameters:[13,2,1,""],SetEnvironment:[13,2,1,""],SetHBondEnergy:[13,2,1,""],SetHBondPotentialParameters:[13,2,1,""],SetPsipredPrediction:[13,2,1,""],SetReducedEnergy:[13,2,1,""],SetReducedPotentialParameters:[13,2,1,""],SetSSAgreementParameters:[13,2,1,""],SetTorsionEnergy:[13,2,1,""],SetTorsionPotentialParameters:[13,2,1,""],TransOmegaTorsions:[13,2,1,""]},"promod3.loop.BackboneRelaxer":{Run:[17,2,1,""]},"promod3.loop.CCD":{CCD:[17,2,1,""],Close:[17,2,1,""]},"promod3.loop.CCDCloser":{Close:[18,2,1,""]},"promod3.loop.CoordInfo":{offset:[19,4,1,""],pdb_id:[19,4,1,""],size:[19,4,1,""]},"promod3.loop.DirtyCCDCloser":{Close:[18,2,1,""]},"promod3.loop.ExponentialCooler":{GetTemperature:[18,2,1,""],Reset:[18,2,1,""]},"promod3.loop.FragDB":{AddFragments:[19,2,1,""],GetAngularBinSize:[19,2,1,""],GetDistBinSize:[19,2,1,""],GetNumFragments:[19,2,1,""],GetNumStemPairs:[19,2,1,""],Load:[19,2,1,""],PrintStatistics:[19,2,1,""],Save:[19,2,1,""],SearchDB:[19,2,1,""]},"promod3.loop.Fragger":{"__getitem__":[19,2,1,""],"__len__":[19,2,1,""],AddSSAgreeParameters:[19,2,1,""],AddSeqIDParameters:[19,2,1,""],AddSeqSimParameters:[19,2,1,""],AddSequenceProfileParameters:[19,2,1,""],AddStructureProfileParameters:[19,2,1,""],Fill:[19,2,1,""],Fragger:[19,2,1,""],GetFragmentInfo:[19,2,1,""],GetScore:[19,2,1,""]},"promod3.loop.FragmentInfo":{chain_index:[19,4,1,""],length:[19,4,1,""],offset:[19,4,1,""]},"promod3.loop.FragmentSampler":{Initialize:[18,2,1,""],ProposeStep:[18,2,1,""]},"promod3.loop.KIC":{Close:[17,2,1,""],KIC:[17,2,1,""]},"promod3.loop.KICCloser":{Close:[18,2,1,""]},"promod3.loop.LinearScorer":{GetScore:[18,2,1,""]},"promod3.loop.LoopCandidate":{CARMSD:[14,2,1,""],GetOriginalDSSPState:[14,2,1,""],GetOriginalSequence:[14,2,1,""],RMSD:[14,2,1,""],bb_list:[14,4,1,""],cbeta_score:[14,4,1,""],clash_score:[14,4,1,""],combined_score:[14,4,1,""],hbond_score:[14,4,1,""],packing_score:[14,4,1,""],reduced_score:[14,4,1,""],ss_agreement:[14,4,1,""],torsion_score:[14,4,1,""]},"promod3.loop.LoopCandidates":{Add:[14,2,1,""],ApplyCCD:[14,2,1,""],ApplyKIC:[14,2,1,""],AttachScorer:[14,2,1,""],CalculateBetaScores:[14,2,1,""],CalculateClasScores:[14,2,1,""],CalculateCombinedScores:[14,2,1,""],CalculateHBondcores:[14,2,1,""],CalculatePackingScores:[14,2,1,""],CalculateReducedScores:[14,2,1,""],CalculateSSAgreementScores:[14,2,1,""],CalculateTorsionScores:[14,2,1,""],ClusterCandidates:[14,2,1,""],FillFromDatabase:[14,6,1,""],FillFromMonteCarloSampler:[14,6,1,""],GetAVGCBetaScore:[14,2,1,""],GetAVGClashScore:[14,2,1,""],GetAVGCombinedScore:[14,2,1,""],GetAVGHBondscore:[14,2,1,""],GetAVGPackingScore:[14,2,1,""],GetAVGReducedScore:[14,2,1,""],GetAVGSSAgreementscore:[14,2,1,""],GetAVGTorsionScore:[14,2,1,""],Remove:[14,2,1,""]},"promod3.loop.PhiPsiSampler":{Initialize:[18,2,1,""],ProposeStep:[18,2,1,""]},"promod3.loop.PsipredPrediction":{"__len__":[14,2,1,""],Add:[14,2,1,""],Extract:[14,2,1,""],FromHHM:[14,2,1,""],FromHoriz:[14,2,1,""],GetConfidence:[14,2,1,""],GetConfidences:[14,2,1,""],GetPrediction:[14,2,1,""],GetPredictions:[14,2,1,""],PsipredPrediction:[14,2,1,""]},"promod3.loop.SoftSampler":{Initialize:[18,2,1,""],ProposeStep:[18,2,1,""]},"promod3.loop.StructureDB":{AddCoordinates:[19,2,1,""],GenerateStructureProfile:[19,2,1,""],GetBackboneList:[19,2,1,""],GetCoordIndex:[19,2,1,""],GetCoordInfo:[19,2,1,""],GetDSSPStates:[19,2,1,""],GetDihedralAngles:[19,2,1,""],GetNumCoords:[19,2,1,""],GetResidueDepths:[19,2,1,""],GetSequence:[19,2,1,""],GetSequenceProfile:[19,2,1,""],GetSolventAccessibilitites:[19,2,1,""],GetStructureProfile:[19,2,1,""],Load:[19,2,1,""],PrintStatistics:[19,2,1,""],Save:[19,2,1,""],SetStructureProfile:[19,2,1,""]},"promod3.loop.TorsionSampler":{Draw:[20,2,1,""],DrawPhiGivenPsi:[20,2,1,""],DrawPsiGivenPhi:[20,2,1,""],ExtractStatistics:[20,2,1,""],GetBinSize:[20,2,1,""],GetBinsPerDimension:[20,2,1,""],GetHistogramIndex:[20,2,1,""],GetHistogramIndices:[20,2,1,""],GetPhiProbabilityGivenPsi:[20,2,1,""],GetProbability:[20,2,1,""],GetPsiProbabilityGivenPhi:[20,2,1,""],Load:[20,2,1,""],Save:[20,2,1,""],UpdateDistributions:[20,2,1,""]},"promod3.modelling":{BuildFromRawModel:[21,5,1,""],BuildRawModel:[21,5,1,""],BuildSidechains:[21,5,1,""],ClearGaps:[21,5,1,""],CloseSmallDeletions:[21,5,1,""],FillLoopsByDatabase:[21,5,1,""],FillLoopsByMonteCarlo:[21,5,1,""],GapExtender:[21,3,1,""],MergeGaps:[21,5,1,""],MergeGapsByDistance:[21,5,1,""],MinimizeModelEnergy:[21,5,1,""],ModellingHandle:[21,3,1,""],RemoveTerminalGaps:[21,5,1,""],ScoringGapExtender:[21,3,1,""],SetupBackboneScorer:[21,5,1,""],StructuralGap:[21,3,1,""],StructuralGapList:[21,3,1,""]},"promod3.modelling.GapExtender":{Extend:[21,2,1,""]},"promod3.modelling.ModellingHandle":{gaps:[21,4,1,""],model:[21,4,1,""],seqres:[21,4,1,""]},"promod3.modelling.ScoringGapExtender":{Extend:[21,2,1,""]},"promod3.modelling.StructuralGap":{Copy:[21,2,1,""],ExtendAtCTerm:[21,2,1,""],ExtendAtNTerm:[21,2,1,""],GetChain:[21,2,1,""],GetChainIndex:[21,2,1,""],GetChainName:[21,2,1,""],GetLength:[21,2,1,""],IsCTerminal:[21,2,1,""],IsNTerminal:[21,2,1,""],IsTerminal:[21,2,1,""],ShiftCTerminal:[21,2,1,""],after:[21,4,1,""],before:[21,4,1,""],full_seq:[21,4,1,""],length:[21,4,1,""],seq:[21,4,1,""]},"promod3.sidechain":{AAToRotID:[27,2,1,""],BBDepRotamerLib:[28,3,1,""],ConstructBackboneFrameResidue:[23,2,1,""],ConstructFRMRotamer:[26,2,1,""],ConstructFRMRotamerGroup:[26,2,1,""],ConstructFrameResidue:[23,2,1,""],ConstructRRMRotamer:[26,2,1,""],ConstructRRMRotamerGroup:[26,2,1,""],ConstructSidechainFrameResidue:[23,2,1,""],DisulfidScore:[22,2,1,""],FRMRotamer:[26,3,1,""],FRMRotamerGroup:[26,3,1,""],Frame:[23,3,1,""],FrameResidue:[23,3,1,""],Graph:[24,3,1,""],Particle:[26,3,1,""],RRMRotamer:[26,3,1,""],RRMRotamerGroup:[26,3,1,""],Reconstruct:[25,2,1,""],RotamerID:[27,3,1,""],RotamerLib:[28,3,1,""],RotamerLibEntry:[28,3,1,""],RotamerSettings:[29,3,1,""],SidechainParticle:[26,3,1,""],TLCToRotID:[27,2,1,""]},"promod3.sidechain.BBDepRotamerLib":{AddRotamer:[28,2,1,""],Load:[28,2,1,""],MakeStatic:[28,2,1,""],QueryLib:[28,2,1,""],Save:[28,2,1,""],SetInterpolate:[28,2,1,""]},"promod3.sidechain.FRMRotamer":{"__getitem__":[26,2,1,""],"__len__":[26,2,1,""],ApplyOnResidue:[26,2,1,""],CalculateInternalEnergy:[26,2,1,""],GetFrameEnergy:[26,2,1,""],GetInternalEnergy:[26,2,1,""],GetInternalEnergyPrefactor:[26,2,1,""],GetNumSubrotamers:[26,2,1,""],GetProbability:[26,2,1,""],GetSelfEnergy:[26,2,1,""],GetSubrotamerAssociations:[26,2,1,""],GetSubrotamerDefinition:[26,2,1,""],GetTemperature:[26,2,1,""],GetTransformedCopy:[26,2,1,""],SetFrameEnergy:[26,2,1,""],SetInternalEnergy:[26,2,1,""],SetInternalEnergyPrefactor:[26,2,1,""],SetProbability:[26,2,1,""],SetTemperature:[26,2,1,""]},"promod3.sidechain.FRMRotamerGroup":{"__getitem__":[26,2,1,""],"__len__":[26,2,1,""],ApplyOneResidue:[26,2,1,""],ApplySelfEnergyThres:[26,2,1,""],CalculateInternalEnergies:[26,2,1,""],Merge:[26,2,1,""]},"promod3.sidechain.Frame":{AddFrameEnergy:[23,2,1,""],SetFrameEnergy:[23,2,1,""]},"promod3.sidechain.FrameResidue":{"__getitem__":[23,2,1,""],"__len__":[23,2,1,""]},"promod3.sidechain.Graph":{CreateFromFRMList:[24,6,1,""],CreateFromRRMList:[24,6,1,""],GetNumActiveEdges:[24,2,1,""],GetNumActiveNodes:[24,2,1,""],GetNumEdges:[24,2,1,""],GetNumNodes:[24,2,1,""],Prune:[24,2,1,""],Solve:[24,2,1,""]},"promod3.sidechain.Particle":{AddLonePair:[26,2,1,""],GetCharge:[26,2,1,""],GetName:[26,2,1,""],GetParticleType:[26,2,1,""],GetPos:[26,2,1,""],IsHBondAcceptor:[26,2,1,""],IsHBondDonor:[26,2,1,""],PairwiseEnergy:[26,2,1,""],SetPolarDirection:[26,2,1,""]},"promod3.sidechain.RRMRotamer":{"__getitem__":[26,2,1,""],"__len__":[26,2,1,""],ApplyOnResidue:[26,2,1,""],CalculateInternalEnergy:[26,2,1,""],GetFrameEnergy:[26,2,1,""],GetInternalEnergy:[26,2,1,""],GetInternalEnergyPrefactor:[26,2,1,""],GetProbability:[26,2,1,""],GetSelfEnergy:[26,2,1,""],GetTransformedCopy:[26,2,1,""],SetFrameEnergy:[26,2,1,""],SetInternalEnergy:[26,2,1,""],SetInternalEnergyPrefactor:[26,2,1,""],SetProbability:[26,2,1,""]},"promod3.sidechain.RRMRotamerGroup":{"__getitem__":[26,2,1,""],"__len__":[26,2,1,""],ApplyOneResidue:[26,2,1,""],ApplySelfEnergyThres:[26,2,1,""],CalculateInternalEnergies:[26,2,1,""],Merge:[26,2,1,""]},"promod3.sidechain.RotamerLib":{AddRotamer:[28,2,1,""],Load:[28,2,1,""],MakeStatic:[28,2,1,""],QueryLib:[28,2,1,""],Save:[28,2,1,""]},"promod3.sidechain.RotamerLibEntry":{FromResidue:[28,6,1,""],IsSimilar:[28,2,1,""],SimilarDihedral:[28,2,1,""],chi1:[28,4,1,""],chi2:[28,4,1,""],chi3:[28,4,1,""],chi4:[28,4,1,""],probability:[28,4,1,""],sig1:[28,4,1,""],sig2:[28,4,1,""],sig3:[28,4,1,""],sig4:[28,4,1,""]},"test_actions.ActionTestCase":{RunAction:[0,2,1,""],RunExitStatusTest:[0,2,1,""],pm_action:[0,4,1,""],pm_bin:[0,4,1,""],testPMExists:[0,2,1,""]},promod3:{SetCompoundsChemlib:[8,5,1,""],core:[6,1,0,"-"],loop:[15,1,0,"-"],modelling:[21,1,0,"-"],sidechain:[25,1,0,"-"]},test_actions:{ActionTestCase:[0,3,1,""]}},objnames:{"0":["cmake","command","CMake command"],"1":["py","module","Python module"],"2":["py","method","Python method"],"3":["py","class","Python class"],"4":["py","attribute","Python attribute"],"5":["py","function","Python function"],"6":["py","staticmethod","Python static method"]},objtypes:{"0":"cmake:command","1":"py:module","2":"py:method","3":"py:class","4":"py:attribute","5":"py:function","6":"py:staticmethod"},terms:{"1akea":19,"1crn":[15,18,19,21],"1crn_cut":21,"1crna":19,"1ey":25,"1mcg":21,"1mcg_aln":21,"2b1":1,"2db":21,"4x4":12,"__doc__":[5,7],"__getitem__":[19,23,26],"__init__":[0,4,7],"__len__":[14,19,23,26],"__main__":[0,4],"__name__":[0,4],"_opt":4,"_run":[0,3],"_xml":3,"boolean":5,"break":[3,4],"case":[4,12,13,14,17,18,19,20,21,22,25,26,28],"char":12,"class":[0,4,6,7,12,13],"default":[0,1,4,7,8,12,19,20,21,25,26,29],"enum":27,"export":[24,26],"final":[4,10,14,15,19,21,24,25],"float":[12,13,14,15,17,18,19,20,21,23,24,26,28],"function":[0,2],"import":[0,4,5,7,10,12,15,18,19,20,21,25],"int":[0,5,12,13,14,16,17,18,19,20,21,23,24,26,28],"new":[0,4,7,14,16,17,18,19,21,25,26],"null":19,"public":4,"return":[0,5,7,8,12,13,14,16,17,18,19,20,21,22,23,24,26,27,28],"s\u00f6ding":19,"short":4,"static":[4,14,24,28],"super":25,"switch":4,"throw":[0,25],"true":[0,4,5,7,12,13,14,15,16,17,18,19,21,25,26,29],"try":[0,4,21,28],"while":[0,3,4],aa_with_rotam:25,aaaaaaaa:12,aatorotid:27,abil:4,abort:[4,17,21],about:[0,3,4,14,19,21],abov:[0,4,21,22,25,27,28],absolut:3,academ:4,accept:[14,17,18,21],acceptor:13,access:[15,18,19,20,26,27],accessibili:19,accord:[4,12,13,14,18,19,20,21,23,25,26,28],accuraci:17,achiev:4,acid:[12,13,16,19],acknowledg:4,across:[0,28],act:17,action_unit_test:0,actiontest:0,activ:[4,7,25],actual:[4,7,12,13,15,19,21,26,28],actual_posit:18,actual_step:18,adapt:[9,15,17,18],add:[0,3,4,7,10,14,16,19,20,23,25,26],add_argu:5,add_changelog_to_doc:4,add_custom_target:4,add_doc_depend:3,add_doc_sourc:[3,4],add_polar_hydrogen:25,add_subdirectori:4,addalign:7,addcoordin:19,addfrag:19,addframeenergi:23,addit:[3,4,5,12,18,19],addition:[0,3],additional_make_clean_fil:4,addlonepair:26,addrotam:28,addseqidparamet:19,addseqsimparamet:19,addsequenceprofileparamet:19,addssagreeparamet:19,addstructureprofileparamet:19,admir:4,advic:4,advis:4,affect:[4,12,27],after:[0,1,4,7,12,13,14,17,18,20,21,24,28],again:[1,4,21],ago:0,agreement:19,ala:[12,20,25,27],alanin:27,alg:19,algorithm:[4,14,15,17,18,21,25,27,29],alia:21,alias:4,align:[7,10,19,21],alignmenthandl:21,alignmentlist:[7,21],all:[0,1,3,4,7,10,12,13,14,17,18,19,20,21,22,23,24,25,26,28],alloc:[13,19],allow:[4,5,12,13,14,15,18,19,20,21,23],allow_prepro_ci:13,almost:3,aln:21,aln_sourc:7,alon:5,along:[0,4,19],alot:4,alpha:[12,13,14,23,25,26],alpha_bin:13,alreadi:[0,3,4,12,13,16,19,21,23,24,28],also:[0,1,3,4,5,14,15,17,18,19,20,21,23,24,28,29],alter:18,altern:18,alwai:[0,4,18],ambig:28,ambigu:28,amino:[12,13,16,19],aminoacid:[12,13,27,28],among:14,amount:28,analysi:[17,19],analyt:[14,28],anchor:26,ancient:8,angl:[9,12,13,14,15,17,18,19,20,21,23,25,26,28],angle_bin:13,angle_bin_s:19,angstrom:[17,19],ani:[0,3,4,8,10,12,13,14,18,19,20,21,23,25],anneal:[14,18],announc:[0,4],anoth:[12,17,21],anymor:24,anyth:[1,4,7,8],anywai:4,apart:[0,14,21],append:[12,14,20,21,25],appli:[4,5,8,12,14,17,18,21,24,25,26],applic:[0,17],applyccd:[14,15],applyk:14,applyoneresidu:26,applyonresidu:[25,26],applyselfenergythr:26,applyselfenergythresh:25,applytransform:12,approach:[1,4,19,21],appropri:[20,21],approxim:[24,26],arbitrari:[7,14,19],arbitrarili:18,arg:[0,4,7,27],argcheck:2,arginin:27,argpars:7,argument:[0,1,6],argumentpars:7,argv:7,around:[0,4,21],ask:4,asn:27,asp:[26,27,28],asparagin:27,aspart:[27,28],ass:18,assemblepars:7,assertequ:4,assess:13,assign:[13,14,18,19,29],assigndssp:19,associ:[14,23,26],assum:[0,4,13,19,24],atom:[12,13,14,17,19,21,22,23,25,26,28,29],atomhandl:26,atomseq:19,attach:[3,14,15,21],attachscor:[14,15],attachview:21,attempt:21,attent:[0,4],attribut:[4,7,14,28],author:4,autom:3,automat:[0,4,5,19,28],automatis:4,avail:[0,1,4,8,13,14],availabl:18,averag:[14,19],avg:19,avoid:[4,5,8,17,18],awai:4,awar:4,awesom:[0,4],awesomeactiontest:4,axi:19,back:[0,4,18,24],backbon:10,backbone_list:14,backbonelist:[10,12,13,14,17,18,19],backbonerelax:17,background:1,bar:19,base:[5,12,13,17,18],basi:[3,4,17,18,19,26],basic:[0,1,4,5],bb_list:[10,12,13,14,15,17,18,19],bbdeprotamerlib:[25,26,28],bbdeprotamerlibrari:26,becaus:[4,13],becom:28,been:[4,13,16,17,19,24,28],befor:[0,3,4,7,12,13,14,17,18,19,20,21],begin:[0,4,12],behav:0,behaviour:[7,28],behind:4,bell:4,belong:[3,4,13,14,18,19,21,23,26],belov:19,below:[4,17,19,22,24],below_thre:19,besid:[1,3,7],best:3,beta:[12,13,14,23,26],beta_bin:13,better:18,between:[0,12,13,14,17,18,19,21,22,23,24,26,28,29],beyond:7,bienchen:4,biggest:21,bilinearli:28,bin:[0,4,10,13,19,20,28],bin_siz:[20,28],binari:[0,4],bind:[19,21],bioinformat:19,biol:19,biopolym:19,bit:[0,1,4,14,21],bla:1,blank:4,blas_blas_librari:1,blosum62:19,bond:[13,17,19],bool:[0,5,7,12,13,14,16,17,18,19,21,23,25,26,28],boost:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],boost_include_dir:4,boost_root:1,both:[21,25,26,28],bottom:25,bound:26,branch:3,branchnam:4,brew:3,bridg:[16,21],briefli:4,bring:4,broken:0,broyden:21,bug:4,build:0,build_disulfid:25,builder:1,buildfromrawmodel:21,buildrawmodel:[10,21],buildsidechain:21,buildup:[25,29],built:[3,4,13,19,23,25,26],bunch:[0,4,7],bytecod:0,c_coord:12,c_po:[13,23],c_stem:[12,14,15,17,18,19],c_stem_psi:18,c_ter:[17,23],c_terminu:19,ca_coord:12,ca_po:[13,23,26],ca_pos_on:22,ca_pos_two:22,ca_rmsd:19,cach:[1,4],calcul:[12,13,14,15,17,18,19,20,22,23,24,25,26],calculatebetascor:14,calculatecbetascor:[13,15],calculatecbpackingscor:13,calculateclashscor:[13,15],calculateclasscor:14,calculatecombinedscor:14,calculatehbondcor:14,calculatehbondscor:13,calculateinternalenergi:[25,26],calculatepackingscor:14,calculatereducedscor:[13,14],calculatessagreementscor:[13,14],calculatesurfac:19,calculatetorsionscor:[13,14],call:[0,1,3,4,7,8,13,14,16,18,19,20,21,26,28],calul:20,came:4,can:[0,1,4,5,7,8,10,12,13,17,18,19,20,23,24,25,26],candid:[14,15,18,21],cannot:[4,18,19,21,27,28],canutescu2003:[17,22],canutescu:17,capabl:[16,18],captur:0,carbon:[12,23,26],carbonyl:26,carlo:[],carmsd:[12,14,19],carri:[4,5],categori:3,caus:4,cb_coord:12,cb_pack:[14,18],cb_packing_cutoff:13,cb_packing_max_count:13,cb_po:[23,26],cb_pos_on:22,cb_pos_two:22,cbeta:[12,13,14,15,18],cbeta_bin:13,cbeta_cutoff:13,cbeta_scor:[14,15],cbeta_seq_sep:13,ccd:[],ccdcloser:18,central:[13,20],certain:[0,1,3,4,13,19,20,21],certainli:0,ch1particl:26,ch2particl:26,ch3particl:26,chain:[4,12,13,16,18],chain_id:19,chain_idx:19,chain_index:[13,14,18,19],chain_nam:19,chainhandl:[12,21],chainview:19,chakravarti:19,chakravarty1999:19,chanc:[4,21,24],chang:0,change_frequ:18,chapter:[4,14],charact:[7,19],charg:[4,26],charmm27:17,check:[0,1,4,5,7,13,18,21,28],checkout:4,chemic:8,chi1:[26,28],chi2:[26,28],chi3:[26,28],chi4:[26,28],chi:[26,28],child:7,childclass:0,chmod:4,clash:[13,14,15,17,18,21,22,25],clash_scor:[14,15],clash_thresh:21,clean:[1,4],clear:13,clearenviron:13,cleargap:21,clip:7,clone:4,close:[4,10],closed_posit:18,closer:[],closesmalldelet:21,closest:19,closur:[17,21],cluster:14,clustercandid:14,clutter:[0,4],cmake_build_typ:4,cmake_c_compiler_vers:4,cmake_compiler_is_gnucxx:4,cmake_current_source_dir:4,cmake_cxx_compiler_vers:4,cmake_cxx_flag:4,cmake_cxx_flags_releas:4,cmake_minimum_requir:4,cmake_module_path:4,cmake_source_dir:4,cmake_support:[3,4],cmakecach:1,cmakelist:[0,1,3,4],cname:19,coars:4,code:[0,1,3,4,5,7,8,12,13,14,19,20,21,25,27],codetest:[3,4],coil:16,collect:5,collid:29,collis:29,combin:[13,14,18,19,20,22,28],combined_scor:14,come:[0,3,4,5,7],command:[0,4,5,6],commandlin:7,comment:4,commerci:4,commit:4,common:[4,7],commonli:[10,21],compar:[19,28],comparison:[19,28],compat:4,compil:[0,1,4,10],complain:0,complaint:4,complet:[4,18,19,21,25,28],complex:[4,26],compon:[4,8,13,19],compound:8,compress:5,comput:19,concept:4,condit:[4,20],conf:[1,4],confid:[13,14],config:4,configur:[1,4,14,28],conflict:4,conform:[13,17,18,19,24,25,28],connect:[3,4,15,19,24],conop:[4,12,13,27],conquer:4,consecut:[13,20],consequ:25,conserv:21,consid:[3,4,12,13,15,17,18,19,20,21,23,28],consider_all_nod:24,consider_hbond:[25,29],consider_hydrogen:26,consist:[4,13,14,17,18,19,26,28],constraint:[7,17,19],construct:12,constructbackboneframeresidu:[23,25],constructframeresidu:23,constructfrmrotam:26,constructfrmrotamergroup:[25,26],constructor:[24,26],constructrrmrotam:26,constructrrmrotamergroup:26,constructsidechainframeresidu:23,contain:[0,1,3,4,5,7,12,13,14,16,18,19,20,21,22,25,26,28],content:[4,9,11,14,15,19,25],continu:[0,17,25],contrast:23,contribut:3,control:[4,14,18,23,25,26,28,29],conveni:[0,10,18],convent:[0,27],converg:[14,17,18],convert:[12,21],cooler:[],cooling_factor:18,coord_info:19,coordin:[12,14,15,16,17,19,21,25],coordinfo:19,cope:4,copi:[3,4,21],core:[4,5],correspond:[4,12,14,19,20,21,28],corrupt:13,could:[0,3,4,7,19,21],count:[13,18,21],counterpart:13,coupl:[0,4,21],cours:4,coutsia:17,cover:[0,4,6,13,18,19],cparticl:26,cpr:[27,28],crambin:[15,18,19],crash:25,createentityfromview:25,createfromfrmlist:[24,25],createfromrrmlist:24,createfullview:21,creation:17,criterion:18,criterium:14,croak:4,crucial:4,ctermin:12,cterminalclos:18,cterminu:12,current:[1,4,18,19,26],custom:[4,18,19,27],cutoff:[13,14,16,26],cxx:4,cycl:21,cyclic:[14,15,17],cyd:[27,28],cyh:[27,28],cystein:[22,25,27],d_bin:13,dai:5,dare:3,dat:19,data1:3,data2:3,data:[0,3,4,9,13,15,16,19,21,25,26],databas:16,databs:19,date:4,dbg:4,deactiv:29,dead:24,debug:4,decent:8,decid:[4,17],decis:20,declar:[3,4],decod:7,decompos:24,decomposit:24,decreas:18,dedic:[3,4,21],def:[0,4],default_db:19,defin:[0,3,8,12,13,16,17,18],definit:[4,13,14,19,20,26,27],degre:[12,19,20],delet:[21,26],deliv:[0,18,19,21],delta:29,delta_scor:18,demand:21,demonstr:19,denovo:[9,15],dep:3,dependency1:3,dependency2:3,depth:19,deriv:[0,19],descend:21,descent:[14,15,17],describ:[3,5,7,13,14,17,19,21,25,28],describint:19,descript:[4,7,19,22,28],design:0,desir:[10,18,21],despit:13,detail:4,detect:[5,19,29],determin:[5,14],deuterium:21,develop:[0,4],deviat:[13,18,26,28],devot:6,dict:[14,18],dictionari:[7,8,19],did:[4,14],differ:[0,1,3,4,7,8,13,14,15,19,21,25,27,28,29],dihedr:[9,10,12,13,15,17,18,19,20,26,28],dihedral_angl:12,dihedral_bin:13,dihedral_idx:28,dihedral_pair:20,dimens:20,dir:4,direct:[4,12,13,16,26],directli:[15,17,19,21,25,26,27,28],directori:[0,1,3],dirti:0,dirtyccdclos:18,disabl:[0,4],disable_disable_doctest:4,disable_disable_linkcheck:4,disable_doctest:[1,4],disable_document:[1,4],disable_linkcheck:[1,4],discret:13,discuss:19,disk:[13,28],displai:5,dist:13,dist_bin:13,dist_bin_s:19,dist_cutoff:13,distanc:[13,14,15,19,21,29],distinguish:23,distribut:[0,4,18,20],disulfidscor:22,dive:[4,21],diverg:4,divers:19,dng:10,doawesomeactiontest:0,doc:[1,3,4],doctest:[1,4],document:[0,1,2],doe:[0,3,4,5,7,8,12,19,21,24],doesn:[13,18,21,28],don:[1,4,15,21],done:[0,4,5,7,13,15,17,20,21],donor:13,dont_write_bytecod:[0,4],doptim:4,dost_root:[1,4],doubl:24,doubt:7,down:[7,12,15,18,19],dqmean_root:4,draw:[12,18,20],drawback:4,drawn:[18,20],drawphigivenpsi:20,drawpsigivenphi:20,driven:4,drop:4,dssp:[13,14,19,21],dssp_hbond:18,dssp_state:13,due:[14,17,19,21,22,23],dump:[9,13,15,28],dunbrack:[17,25],dure:[0,17,23,28],dynam:28,e_thresh:21,each:[4,14,15,21],earlier:1,easi:4,easier:[0,4],easili:[3,4,21],ebb_list:19,echo:4,edg:24,editor:0,educ:4,effect:[3,4],effici:[18,19],egg:19,eigen3:4,eigen3_found:4,eigen3_include_dir:[1,4],eigen:[1,4],eigenvalu:4,eigenvector:4,either:[4,7,12,13,14,17,18,20,21,22,23,25,26,27,28],elabor:4,element:[0,12,13,14],elimin:24,els:4,emerg:0,emploi:4,empti:[4,5,7,12,13,14,26],enabl:[0,5,8,26],enable_mm:1,enclos:21,encorc:13,end:[0,1,3,4,5,12,14,19,21,24],endif:4,energi:[10,13,17,18,21,22,23,24,25,26,29],enforc:[14,15,18,19,24],enough:[4,19,21],ensur:10,enter:23,entiti:[4,12,14,21,25],entityhandl:[12,21,25],entityview:[13,20,21],entri:[4,13,17,19,25],enumer:[4,15,19,24,25,26,27],env:[4,10,13],environ:[0,4,9,13,14,15,18],epsilon:24,equal:[13,18],equidist:28,equival:21,error:5,esenti:21,essenti:4,estim:[13,18],etc:[0,4],evalu:[3,4,13,20],even:[1,4,24],eventu:7,ever:4,everi:[0,4,12,13,14,16,17,18,19,20,21,24,28],everybodi:4,everyth:[0,4],evolut:19,exactli:[1,15,18,19,21,22,27],exampl:[0,1,4,7,10,15,18,19,20,21,25,27],example_reconstruct:25,exce:[13,19],except:4,exclud:4,exclus:[0,4],exec_program:4,executable_output_path:4,exist:[0,1,3,4,5,7,13,19,21,23,26,27,28],exit:[0,5,7],exit_cod:0,exit_statu:5,exot:4,exp:18,expand:4,expect:[0,13,19,21,26],expens:19,explain:4,explan:4,exponenti:18,exponentialcool:18,ext:5,extend:[0,3,4,13,16,19],extendatcterm:21,extendatnterm:21,extended_search:[14,19,21],extens:[5,7,21],extension_penalti:21,extension_step:21,extent:19,extern:[3,4,19],extra:4,extract:[4,12,13,14,17,18,19,20,21,23,25,26],extract_burial_statu:19,extractstatist:20,f_i:19,factor:[18,26,29],fail:[0,4,5,14,21],failur:[4,5,28],fall:[17,24],fallback:28,fals:[0,4,5,7,12,14,16,18,19,21,23,24,25,26],far:14,fast:[19,28],fasta:[7,21],faster:[16,17,19],fatal_error:4,favourit:0,featur:4,fed:[3,4],fedora:4,feed:3,feel:4,fellow:4,fetch:4,few:[1,4],field:28,figur:4,file:[0,1,3,4],filecheck:4,fileexist:5,fileextens:5,filegzip:5,filenam:[4,5,7,13,14,19,20,28],files_to_be_remov:4,fill:[3,4,7,14,19,21],fillfromdatabas:[14,15,21],fillfrommontecarlosampl:[14,21],fillloopsbydatabas:21,fillloopsbymontecarlo:21,final_model:21,find:[3,4],find_packag:4,fine:4,fire:0,first:[0,2,4,7,10,13,14,17,18,19,20,21,22,25,26,28],fit:[12,17,18,19],fix:[4,5,25],fix_cterm:17,fix_nterm:17,flag1:3,flag2:3,flag:[3,4,5,7,12,13,23,24,25,26],fletcher:21,flexibl:[22,25,26,29],flip:28,flush:[0,4],fno:4,fold:19,folder:[1,4,10],follow:[0,4,7,10,15,19,21,24,25,26,27,28],fontsiz:20,foo:19,forbidden:4,forc:17,forcefield:17,forg:4,forget:[0,4],form:[14,16,19,20,21,24,26,28],formal:[14,17,28],format:[4,7,19],formatt:4,forward:4,found:[0,3,4,5,7,14,15,17,18,19,21,24,25,28],foundat:0,four:18,fourth:26,fraction:[17,18,19],frag_db:[14,15,19],frag_length:19,frag_po:19,frag_residu:19,frag_seq:19,frag_siz:19,fragdb:[14,15,16,19,21],fragger:[18,19],fragment:[12,16,17,18],fragment_db:21,fragment_info:19,fragment_length:19,fragmentinfo:19,fragmentsampl:18,frame:4,frame_residu:[23,25],frameresidu:23,framework:4,free:[4,27,28],frequenc:[18,19],frm:25,frm_delta1_arg:29,frm_delta1_asn:29,frm_delta1_asp:29,frm_delta1_ci:29,frm_delta1_gln:29,frm_delta1_glu:29,frm_delta1_hi:29,frm_delta1_il:29,frm_delta1_leu:29,frm_delta1_li:29,frm_delta1_met:29,frm_delta1_ph:29,frm_delta1_pro:29,frm_delta1_s:29,frm_delta1_thr:29,frm_delta1_trp:29,frm_delta1_tyr:29,frm_delta1_v:29,frm_delta2_arg:29,frm_delta2_asn:29,frm_delta2_asp:29,frm_delta2_gln:29,frm_delta2_glu:29,frm_delta2_hi:29,frm_delta2_il:29,frm_delta2_leu:29,frm_delta2_li:29,frm_delta2_met:29,frm_delta2_ph:29,frm_delta2_pro:29,frm_delta2_s:29,frm_delta2_thr:29,frm_delta2_trp:29,frm_delta2_tyr:29,frm_delta3_arg:29,frm_delta3_gln:29,frm_delta3_glu:29,frm_delta3_li:29,frm_delta3_met:29,frm_delta3_tyr:29,frm_delta4_arg:29,frm_delta4_li:29,frm_t_arg:29,frm_t_asn:29,frm_t_asp:29,frm_t_cy:29,frm_t_gln:29,frm_t_glu:29,frm_t_hi:29,frm_t_ile:29,frm_t_leu:29,frm_t_ly:29,frm_t_met:29,frm_t_phe:29,frm_t_pro:29,frm_t_ser:29,frm_t_thr:29,frm_t_trp:29,frm_t_tyr:29,frm_t_val:29,frmrotam:[22,26],frmrotamergroup:[23,24,26],from:[0,1,2,3,4,5,7,10,12,13,14,15,18,19,20,21,23,24,25,26,27,28],fromhhm:14,fromhoriz:14,fromresidu:28,front:[0,4,5],fulfil:[19,28],full:[0,4],full_seq:21,fulli:[4,12,19,21],functions_specific_to_your_act:4,funni:[1,4],further:[21,29],gamma:[13,22],gamma_bin:13,gap:[10,16,17],gapextend:21,gapfre:19,gather:[3,4,6,12,19,25,26,28],gcc:4,gener:[0,1,4,9,10,14,15,16,17,18,19,20,27,28],generalis:4,generatestructureprofil:19,geom:[12,22,23,26],geometr:[],geometri:[14,19],get:[0,1,4],getangl:25,getangularbins:19,getavgcbetascor:14,getavgclashscor:14,getavgcombinedscor:14,getavghbondscor:14,getavgpackingscor:14,getavgreducedscor:14,getavgssagreementscor:14,getavgtorsionscor:14,getbackbonelist:19,getbins:20,getbinsperdimens:20,getchain:21,getchainindex:21,getchainnam:21,getcharg:26,getconfid:14,getcoordindex:19,getcoordinfo:19,getdihedralangl:19,getdistbins:19,getdsspstat:19,getfragmentinfo:19,getframeenergi:26,gethistogramindex:[12,20],gethistogramindic:20,getinternalenergi:26,getinternalenergyprefactor:26,getlength:21,getnam:[25,26],getnumactiveedg:24,getnumactivenod:24,getnumb:15,getnumcoord:19,getnumedg:24,getnumfrag:19,getnumnod:24,getnumstempair:19,getnumsubrotam:26,getomegators:12,getoriginaldsspst:14,getoriginalsequ:14,getparticletyp:26,getphiprobabilitygivenpsi:20,getphitors:[12,25],getpo:26,getpredict:14,getprob:[20,26],getpsiprobabilitygivenphi:20,getpsitors:[12,25],getresiduedepth:19,getscor:[18,19],getselfenergi:26,getsequ:[12,19],getsequenceprofil:19,getsolventaccessibilitit:19,getstructureprofil:19,getsubrotamerassoci:26,getsubrotamerdefinit:26,gettemperatur:[18,26],gettransform:12,gettransformedcopi:26,git:[0,1,2,3],gitignor:4,give:[3,4,15,18,26],given:[0,3,5,7,12,13,14,15,17,18,19,21,22,24,25,26,28],gln:27,global:8,glu:[26,27,28],glutam:27,glutamin:27,gly:[21,25,27],glycin:27,goal:0,gobbl:7,goe:[1,4,28],goldfarb:21,good:[3,4,19,21],got:1,grain:4,greedi:14,grep:1,group:[13,16,19,20,23,24,25],group_definit:[13,20],group_id_idx:13,guarante:19,gui:4,guid:17,gzip:[5,7],hand:[1,3,7],handl:[],happen:[0,4,18,21,26],hash:19,hb_alpha_bin:13,hb_beta_bin:13,hb_d_bin:13,hb_gamma_bin:13,hb_max_alpha:13,hb_max_beta:13,hb_max_d:13,hb_max_gamma:13,hb_min_alpha:13,hb_min_beta:13,hb_min_d:13,hb_min_gamma:13,hbond:[13,14,18,23,25,26,27,29],hbond_scor:14,headach:4,header:[1,4],header_stage_path:4,headlin:4,heavili:[19,25,26],helic:[12,13,16,18,21,26],helix:[10,12,18,25],hellyeah:10,help:[0,1,3,4,7,10],helper:[2,3],hen:19,henc:4,here:[0,1,3,4,5,7,10,18,19,20,29],hhm:[14,19],hhsearch:[14,19],hhsuit:19,hide:4,hierarch:14,hierarchi:8,high:[2,21],higher:1,highest:8,highli:[1,19],hint:7,histidin:27,histogram:[18,20],histori:4,hit:[0,4,17,20],hmm:19,hmm_dir:19,hmm_path:19,hmmdb:19,home:3,homolog:[6,10,19,21],honour:21,horiz:14,host:[3,4],hotfix:4,hous:4,hparticl:26,hsd:[26,27,28],hse:[26,27,28],html:[1,2,4],http:4,hydrogen:[13,19,21,23,25,26,29],hyphen:0,idea:[0,2,4,15,21],ideal:[12,13,17],ident:[13,19,20,28],identifi:[7,13,19,28],idx:[12,13,14,19],iff:21,ignor:21,illustr:19,imagin:4,imaginari:0,immedi:[0,4,8,21],implement:[4,17,22,24,25,27],implicit:1,improv:[16,22,25],includ:[1,2,4,5,10,14,16,19,21,25,26,29],include_directori:4,incomplet:21,inconsist:[12,13,14,17,21],inconveni:4,increas:[14,17,21],index:[4,11,12,13,14,17,18,19,20,21,23,26,28],indic:[5,7],inf:[15,24],influenc:[7,29],info:19,inform:[4,7,12,13,14,15,16,19,21],inherit:0,init:4,init_frag:18,initi:[2,12,13,14,15,17,18,19,21,24,26,28],initial_bb:14,initial_epsilon:24,initialis:0,inlin:4,input:[0,7,10,14,17,18,19,20,21,22,25,26],insert:[12,15,18,21],insertinto:[12,15],insid:[0,3,7],insight:4,inspir:17,instal:[1,4],instanc:[7,16,21,26],instead:[0,1,3,4,5,18,21,26],intend:[0,4,14,18,26],interact:[13,22,23],intercept:[14,18],interest:[0,18,19,26,28],interfac:4,intermedi:4,intern:[0,3,4,13,14,16,17,18,19,20,21,24,25,26,29],internal_e_prefactor_arg:29,internal_e_prefactor_asn:29,internal_e_prefactor_asp:29,internal_e_prefactor_ci:29,internal_e_prefactor_gln:29,internal_e_prefactor_glu:29,internal_e_prefactor_hi:29,internal_e_prefactor_il:29,internal_e_prefactor_leu:29,internal_e_prefactor_li:29,internal_e_prefactor_met:29,internal_e_prefactor_ph:29,internal_e_prefactor_pro:29,internal_e_prefactor_s:29,internal_e_prefactor_thr:29,internal_e_prefactor_trp:29,internal_e_prefactor_tyr:29,internal_e_prefactor_v:29,internet:4,interpol:28,interpret:[4,5],intervent:4,introduc:[0,3,4,17],invalid:[13,14,17,18,19,21,23,26,27,28],invok:[1,3,4,8],involv:4,isctermin:21,ishbondacceptor:26,ishbonddonor:26,isntermin:21,isoleucin:27,issimilar:28,istermin:21,isvalid:25,item:[0,4,13,19,21],iter:[14,17,18,19,20,21,24],itself:[3,4,13,14,18,25],job:[4,19,21],join:[15,18,19],jone:[19,26,29],jones1999:19,json:7,just:[0,1,4,7,8,14,19,21],kabsch1983:19,kabsch:19,keep:[0,3,4,7,14,25],keep_non_converg:14,keep_sidechain:25,kei:[7,14,18],kept:[17,23,25],keyword:20,kic:4,kicclos:18,kick:7,kind:[0,4],kinemat:17,know:[1,28],known:[3,5],kortemm:17,krivov2009:25,krivov:25,kwarg:[0,4],l_e:26,label:4,languag:3,lapack:[1,4],lapack_lapack_librari:1,larg:[19,20],larger:[15,19],last:[0,3,12,18,19,21,29],last_psi:12,later:[0,4],latest:1,latter:4,launcher:[3,4],layout:[19,26],lbfg:21,lead:[4,5,12,13,14,17],least:[1,3,4,12,24],leav:0,left:[5,21],legal:4,len:[12,19,21,25],length:[7,13,14,16,17,19,20,21],lennard:[26,29],less:[4,14,16,19,21,29],let:[0,4,12,15,19,25],letter:[12,13,18,19,20,27],leu:27,leucin:27,level:[1,2,4,8,21],lib:29,lib_stage_path:4,libexec:[3,4],libexec_stage_path:4,librari:[1,3,4,8,25,26],library1:3,library2:3,life:4,ligand:23,like:[0,3,4,7,21,26],limit:[7,17,19,21],line:[0,4,6],linear:[14,18,19],linear_weight:14,linearscor:18,link:[1,3,4],linkcheck:[1,4],linker:3,list:[0,1,3,4,5,7,10,12,13,14,17,18,19,20,21,23,24,25,26,28],littl:[3,4],live:[3,4],load:[0,7,8,13],load_frequ:[16,19],loadalign:21,loadbackboneloopscor:[15,16,18],loaddunbracklib:25,loadfragdb:[15,16,21],loadpdb:[15,18,19,21,25],loadstructuredb:[15,16,19,21],loadtorsionsampl:[12,16,18,20],loadtorsionsamplercoil:[16,21],loadtorsionsamplerextend:16,loadtorsionsamplerhel:16,locat:[1,3,12,15,21],log:[4,5,26],lone:26,lone_pair:26,longest:19,look:[4,5,9,12,15],loop:[4,10,12],loop_candid:[14,15],loop_length:19,loop_seq:15,loopcandid:[14,15],loss:4,lost:[0,4,13],lot:[0,4,7],low:0,lower:[18,21],lowest:[18,26],lysin:27,macro:[3,4],made:[3,28],magic:4,mai:[0,1,3,4,5,7,21],main:[21,28],mainli:[18,26],maintain:4,major:4,make_directori:4,makefil:[1,4],makestat:28,malici:4,man:[1,4],manag:[3,4],mandatori:[4,14],mandel:17,mandell2009:17,mani:[5,7,17,21],manipul:[12,15],manner:[4,13,18,24],manual:[0,1,4,13,14,18,19],mar:16,mark:[7,23],markup:4,master:4,mat4:12,match:[3,4,14,15,17,18,19,20,21],materi:[0,4],mathemat:[14,17],matplotlib:20,matric:19,matrix:[12,19],matter:[3,26],max:[13,21,24,28,29],max_complec:24,max_complex:24,max_count:13,max_db_loop_len:21,max_dev:18,max_dist:14,max_extens:21,max_iter:[14,21],max_iter_lbfg:21,max_iter_sd:21,max_loops_to_search:21,max_step:17,maxim:[13,14,16,17,18,19,21],maximum:[13,14,17,18],mc_closer:18,mc_cooler:18,mc_num_loop:21,mc_sampler:18,mc_scorer:18,mc_step:21,mean:[3,4,7,21],meaning:19,meant:[10,21,24],mechan:[10,17,21],medl:21,meld:2,member:[4,7,14],memori:[13,16,19,21],mention:[0,1],merg:[2,4,14,21,26],merge_dist:21,mergegap:21,mergegapsbydist:21,mess:4,messag:4,messi:4,met:27,methionin:[21,27],method:[0,7,17,19,20,21,22,24],metropoli:[14,18],mhandl:21,middl:4,might:[17,19,26],min:13,min_candid:15,min_scor:15,mind:[0,4],minim:[10,13,14,15,17,19,21,22,24],minimizemodelenergi:21,minimum:12,mismatch:13,miss:[5,21],mix:3,mkdir:[1,4],mmcif:5,mod:4,mode:[0,28],model:[0,2,4,6],modellinghandl:21,modif:21,modifi:[2,4,12,14,21],modified_crambin:15,modul:[0,2],mol:[4,10,12,13,14,17,18,19,20,21,23,25,26,28],mol_alg:4,molecular:[10,17,19,21],moment:4,monitor:0,monolith:4,mont:[],montecarloloopsampl:18,montecarlosampl:18,mood:4,more:[0,1,3,4,7,21,24,26,29],most:[3,4,12,17,20,21,23,29],mostli:[3,4],move:[4,14,17,18],msg:5,msgerrorandexit:5,msm:19,much:[4,21],multipl:[1,4,7,13,21],multipli:18,my_db:19,n_coord:12,n_po:[13,23,26],n_stem:[14,15,17,18,19],n_stem_phi:18,n_ter:[17,23],n_terminal_length:18,name:[0,3,4,5,7,13,14,18,19,20,21,26,27,28],namespac:7,nan:[26,28],nat:17,necessari:[12,13,18,19],need:[0,1,3,4,5,7,8,17,19,20,21],neg:[0,13],neglect:[23,26],neglect_size_on:14,neighbour:[21,28],never:[4,7,13],nevertheless:4,new_res_nam:26,newli:18,next:[0,4,12,17,21],next_aa:18,nice:4,nitrogen:[12,23,26],nobodi:0,node:24,non:[4,16,17,20,25],none:[7,21,25],nonredund:19,nonzero:[24,28],norm:13,normal:26,normalization_factor:26,notabl:19,note:[4,7,14,17,18,19,23,25,27],noth:[3,4,18,26],notic:[0,3,4],nov:1,novel:19,novo:18,now:[0,4,10,12,15,19],nparticl:26,nterminalclos:18,num:21,num_frag:19,num_loop:14,num_residu:13,number:[0,12,13,14,16,17,18,19,20,21,23,24,26,28],numpi:[18,20],o_coord:12,o_po:23,object:[7,12],observ:[17,19,24],obtain:21,obviou:4,occupi:23,occur:[13,26],ocparticl:26,off:[0,4,21],offer:[16,23,26],offset:19,often:[4,5,7,17],olc:12,olson:19,omega:[12,13],omit:21,onc:[0,4,13],one_letter_cod:[12,15,18,19],onli:[0,3,4,5,7,8,13,14,18,19,21,23,24,25],onto:[0,12,19],oparticl:26,openmm:1,openstructur:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],oper:[4,10,24],opt:[4,5,7],optim:[1,4,28],optimis:4,option:[1,4,7,17,28],order:[7,13,19,21],org:4,organ:[19,28],orient:[13,17],origin:[4,7,14,18,21],ost:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],ost_doc_url:4,ost_double_precis:1,ost_include_dir:4,ost_root:[1,4],other:[0,1,4,7,12,13,14,21,26,28,29],otherwis:[0,3,4,12,18,26],our:[3,4,15,19],out:[0,1,3,4,19,20,21,25,28],output_vari:4,outsid:4,over:[1,3,4,7,19],overal:[15,24],overlap:18,overli:4,overview:[4,25],own:[0,3],oxygen:[12,23,26],pack:[13,14],packag:[3,4],packing_scor:14,page:[1,4,11,25],pai:0,pair:[14,17,18,19,20,26,28],pairwis:[13,14,22,24,26],pairwiseenergi:26,paper:[22,25],paragraph:[0,4],parallel:19,paramet:[0,3,5,7,8,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29],parameter_index:19,parametr:[13,23,26],parent:21,pars:[5,6],parse_arg:7,parser:6,part:[0,4,18,23,24,25],partial:21,particip:25,particl:[13,17,19,22,23,25],particular:[4,14,17,18,19,26,28],partner:[13,26],pass:[4,7,15,17,18,21],past:[4,21],path:[0,1,3,4,5,10,19,20],path_to_chemlib:8,pattern:19,pdb:[5,10,12,15,16,18,19,21,25],pdb_id:19,penal:21,penalti:21,peopl:4,pep:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],peptid:[15,19,25],per:[3,4,6,18,19,20,21,26,29],perfect:4,perfectli:4,perform:[4,10,12,14,17,18,19,21,22,24],permiss:4,permut:24,phe:[27,28],phenylalanin:27,phi:[12,13,17,18,19,20,23,25,26,28],phi_bin:[13,28],phi_handl:25,phipsisampl:18,phosphoserin:21,phrase:4,pick:18,pictur:4,piec:[4,14],pipelin:[],pivot:[14,17,18],pivot_on:[14,17],pivot_thre:[14,17],pivot_two:[14,17],place:[0,4,5,7],placehold:14,plausibl:13,pleas:[4,17,19],plot:20,plt:20,plu:[4,7,8,26],pm3_csc:4,pm3argpars:[5,6],pm3argumentpars:[5,7],pm3optionsnamespac:7,pm_action:[0,3,4],pm_action_init:4,pm_bin:0,point:[1,4,7,8,13,15,18,19,28],pointer:1,polar:[25,26,29],polar_direct:26,pop:4,popul:[1,4],posit:[12,13,14,15,16,17,18,19,20,21,22,23,24,26],possibl:[4,7,10,13,14,16,17,18,19,20,21,22,23,24,25,26,27,29],post:7,potenti:[13,15,16,19,21],practic:[3,4],pre:4,pre_commit:4,precis:[14,21],precomput:[9,15,16],pred:13,predefin:10,predict:[13,14,19,25],prefactor:[26,29],prefer:[1,3,28],prefix:[0,3,4,5,7],prepar:[4,21],present:[12,17,23,26,28],prev_aa:18,prevent:[0,4],previous:[13,15,19,26],principl:18,print:[0,1,12,19],printstatist:19,privat:0,pro:[20,27,28],probabilist:19,probability_cutoff:29,probabl:[3,4,14,17,18,19,20,26,28,29],problem:[4,7,17,18,19,21,24],process:[0,4,7,13,17,18,23,28],produc:[0,1,3,4,14,19,21],product:[0,4],profil:[14,16,19,21],prog:7,program:[3,4,6],project:[3,4],project_binary_dir:4,project_nam:4,prolin:[13,27],promod3:0,promod3_unittest:[0,3,4],promod3_version_major:4,promod3_version_minor:4,promod3_version_patch:4,promod3_version_str:4,promod_gcc_45:4,promot:4,propag:[4,12],proper:4,properli:[0,13,24],properti:[4,28],propos:[14,17,18,21,22],proposed_posit:18,proposestep:18,prot:[18,19,25],protein:[10,16,17,19],proton:[26,27,28],provid:[0,1,3,4,7,12,13,14,15,17,18,19,21,23,25,26,28],prune:24,pseudo:[18,21,29],psi:[12,13,17,18,19,20,25,26,28],psi_bin:[13,28],psi_handl:25,psipr:13,psipred_confid:13,psipred_predict:19,psipred_st:13,psipredpredict:[13,14,19],pull:4,punch:0,purpos:[4,28],push:4,pushverbositylevel:7,put:[0,3,4,5,7],py_run:[0,3,4],pyc:[0,4],pylint:4,pylintrc:4,pymod:4,pyplot:20,python:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],python_binari:4,python_doc_url:4,python_root:1,python_vers:4,qmean:[1,4],qmean_include_dir:4,qmean_root:4,queri:[19,26,28],querylib:28,question:20,quickli:[4,17],quit:[4,7],rachovski:16,rackovski:16,radian:20,radii:29,radiu:[13,29],rais:[7,12,13,14,17,18,19,20,21,22,23,26,28],random:[12,14,16,17,18,20],random_se:14,randomized_frag:12,randomli:[17,18],rang:[12,13,14,17,18,19,20,21,28],rare:4,rather:[4,5,7,28],raw:[10,21],rawmodel:[2,4],reach:[17,26],read:[4,21,28],readabl:[4,28],reader:[4,10],readi:[1,28],real:[4,7],realli:[0,1,4,5],reappear:4,reason:[4,18,19,23],rebas:4,rebuild:[1,4],recalcul:[12,20],recent:4,recoginz:27,recognis:[0,4],recognit:19,recommend:1,reconstruct:[10,12,17,22],reconstructcbetaposit:12,reconstructoxygenposit:12,record:0,reduc:[13,14,19],reduced_scor:14,redund:16,ref_backbon:19,refer:[0,3],regard:[17,22],region:[17,18,21,23],regist:[3,4],reject:[14,17,18],rel:[3,13,14,17],relat:[3,4,7,13,14,19,29],relax:[],relev:[1,3],remain:21,rememb:[0,18],remodel:15,remodel_cterminal_o:12,remot:[15,18,19,25],remov:[1,14,21,24,25],removeterminalgap:21,renam:2,renumb:21,replac:[12,18],replacefrag:12,report:[0,4],repositori:[0,2,3,4,10],repres:[9,13,14,15,17,19,20,21,22,23,24,25,26],represent:[12,15,26],request:28,requir:[1,4,12,15,16,17,19,23,25,26,27,28],resembl:4,reserv:5,reset:[13,18],residehandl:26,residue_depth:19,residue_index:[23,26],residuehandl:[12,14,17,18,19,21,23,26,28],resnum:[12,13,15],resolv:[4,17],resort:21,respons:4,rest:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],restrict:4,restructuredtext:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],result:[1,4,14,18,21,22,24,28,29],reus:21,review:4,reviv:4,rewrit:0,right:[0,1,4,7,21],rigid:[17,22,23,24,25,26,28],rmsd:[12,14,17,19],rmsd_cutoff:[14,17,19],rmsd_thresh:19,rmsd_threshold:19,robot:17,role:7,root:[1,3,4],rosetta:13,rot_group:25,rot_lib:26,rotam:[22,23,24,25],rotamer_group:[23,24,25],rotamer_id:[25,26],rotamer_librari:25,rotamer_model:25,rotamer_on:22,rotamer_two:22,rotamergroup:26,rotamerid:[23,25,26],rotamerlib:[25,26,28],rotamerlibentri:28,rotamerset:[23,25,26,29],rotat:12,rotatearoundomegators:12,rotatearoundphipsitors:12,rotatearoundphitors:12,rotatearoundpsitors:12,roughli:16,routin:0,rrm:25,rrmrotam:[22,26],rrmrotamergroup:[23,24,26],rst1:3,rst2:3,rst:[3,4],rule:4,runact:0,runexitstatustest:[0,4],runnabl:4,runtest:[0,4],runtimeerror:[12,13,14,17,18,19,20,21,22,23,26,28],runtimeexcept:20,same:[0,1,3,4,7,13,17,18,19,21,23,26,28],sampl:17,sample_polar_hydrogen:[26,29],sampled_frag:18,sampler:[16,17],sander:19,sanner1996:19,sanner:19,satisfi:27,save:[4,12,13,15,18,19,20,28],savepdb:[10,12,15,18,19,21,25],scheme:[0,4,7,18],sci:17,scondari:21,score:[],scorer:[13,16],scoringgapextend:21,scratch:26,scwrl4:[25,26],seamlessli:4,search:[1,4,11,13,14,15,19,21,25,26],searchdb:19,second:[13,14,17,21,22,26],secondari:[13,14,19],secondli:4,section:[0,3],see:[0,4,5,7,10,14,19,21,29],seed:[14,16,17,18,20],seem:4,segment:12,select:[15,17,18,19,25],selenium:21,self:[0,4,24,26],self_energi:26,send:5,sens:21,sensibl:21,separ:[0,4,13,20,22],seq:[4,14,19,21],seq_alg:4,seq_sep:13,seqid:19,seqr:[13,15,18,19,21],seqres_list:13,seqsim:19,sequenc:[7,10,12,13,17,18],sequencehandl:21,sequencelist:21,sequenceprofil:19,sequenti:12,ser:[26,27,29],serin:27,serv:[0,7,19],servic:4,set:[0,1,3,4,5,7,8,12,13,16,17,18,19,23,24,25,26,28],set_directory_properti:4,setcbetaenergi:13,setcbetapotentialparamet:13,setcbpackingenergi:13,setcbpackingpotentialparamet:13,setenviron:[13,15,18],setframeenergi:[23,25,26],sethbondenergi:13,sethbondpotentialparamet:13,setinternalenergi:26,setinternalenergyprefactor:26,setinterpol:28,setomegators:12,setphipsitors:12,setphitors:12,setpolardirect:26,setprob:26,setpsipredpredict:13,setpsitors:12,setreducedenergi:13,setreducedpotentialparamet:13,setssagreementparamet:13,setssagreementscor:13,setstructureprofil:19,settemperatur:26,settorsionenergi:13,settorsionpotentialparamet:13,setup:[2,4,17,18,21],setup_boost:4,setup_compiler_flag:4,setup_stag:4,setupbackbonescor:21,sever:[1,4,7,13],shake:18,shanno:21,shapovalov:25,shebang:4,sheet:21,shell:[0,1,4,5],shift:21,shiftctermin:21,ship:21,shortest:14,should:[0,3,4,5,7,10,12,13,14,15,17,18,19,20,21,23,24,25,26],show:[0,4,20,25],shown:4,side:[4,21,25],sidechain:[4,10,22,23,24],sidechain_test_orig:25,sidechain_test_rec:25,sidechainparticl:26,sidechains_pymod:4,sidechains_rst:4,sidechains_unit_test:4,sig1:[26,28],sig2:[26,28],sig3:[26,28],sig4:[26,28],silent:0,similar:[0,1,4,13,19,28],similardihedr:28,similarli:1,simpl:[12,18,22,23,28],simplest:[4,21,25],simpli:[12,15,18,27,28],simplif:7,simplifi:19,simul:[14,18],sinc:[0,1,3,4,5,13,19,20,27],singl:[3,4,14,17,18,19,21,23,24,26],sit:4,size:[12,13,14,17,18,19,20,21],skip:[0,4,19],small:[17,21],smaller:[13,17,19,29],smallest:25,smallish:[1,4],smart:4,smng:2,soding2005:19,softsampl:18,softwar:4,sol:25,sole:[0,4],soli:16,solut:[4,17,18],solv:[4,24,25],solvent:19,solver:4,some:[0,1,3,4,7,13,14,18,19,21,23,25,26,28],somehow:14,someth:[0,4,5,19],somethingtest:4,sometim:4,somewher:[3,19],soon:[4,17,25,28],sort:[0,3,28],sound:4,sourc:[0,1,3,4,5,7,8,15,19,21,25,28],source1:[3,4],source2:[3,4],span:21,sparticl:26,spawn:[0,4],special:[0,1,3,4,27,28],specif:[0,13,18,19,20,28],specifi:[1,3,12,14,20,26,28],specimen:5,spehner:19,spend:4,sphinx:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],sport:4,squar:19,src:4,ss_agreement:14,ssagre:19,ssagreement:[13,14],ssagreementscor:13,stabil:19,stabl:4,stack:4,stage:[0,1],stage_dir:4,stai:[0,4],standard:[1,4,6,7,13,20,23,26,28],start:[0,1,3],start_resnum:[12,13,14,18],start_temperatur:18,starter:0,stash:4,state:[0,1,4,13,19,22,26,27,28],statist:[13,15,16,19],statu:[0,4],stderr:0,stdout:0,steadili:18,steepest:[17,21],stem:[12,14,15,17,18,19,21],step:[4,10,14,17,18,19,21],stereochem:21,steric:28,still:[4,21],stop:[0,17],stop_criterion:17,store:[0,4,10,12,14,18,19,20,21],stori:4,str:[0,5,7,8,12,13,14,17,18,19,20,21,25,26,27,28],straight:4,strategi:28,strict:4,string:[5,7,13,19,20,21],strip:[21,26],structral:13,structural_db:14,structuralgap:21,structuralgaplist:21,structure_db:[15,19,21],structure_dir:19,structure_path:19,structuredb:[14,15,16,19,21],structureprofil:19,sub:[4,14,17],sub_frag:12,subdir:4,subject:4,submodul:4,submodule1:4,subrotam:[22,26,29],subsequ:[13,21],subst:19,subst_matrix:19,substitut:19,substweightmatrix:19,subtre:[3,4],succeed:21,success:[5,18,24],suffix:5,suggest:4,suit:[0,4,14],sulfur:[22,26],sum:[15,21,26,29],superpos:[12,17,18,19],superpose_stem:12,superposed_rmsd:12,superposeonto:12,superposit:[14,18],supervis:0,supos:19,support:[0,4,5,17],suppos:4,sure:[1,4,7,19],surf:19,surfac:19,surfacehandl:19,surround:[13,19],symmetr:28,system:[0,1,2,3,4],t_sampler:20,tail:12,tailor:21,take:[4,18,19,20,21,24,25],taken:[14,23,26],talk:0,target:[0,1,3,4,7,10,12,17,18,19,21],target_sequ:19,task:[4,17,21],technic:[19,23,29],tell:[0,4,5,7,19],temperatur:[14,18,26,29],templat:[0,7,10,21],temporarili:4,term:[4,13,19,26,27,28,29],termin:[0,5,10,12,14,17,18,21,23],terminal_sequ:18,termini:18,terminu:[18,19],test_:4,test_action_:0,test_action_awesom:4,test_action_do_awesom:0,test_action_help:0,test_awesome_featur:4,test_foo:3,test_sidechain:4,test_someth:4,test_submodule1:4,test_suite_:3,test_suite_your_module_run:4,test_your_modul:4,testcas:[0,4],testexit0:[0,4],testfileexistsfals:4,testpmexist:0,testutil:[0,4],text:[0,7],than:[4,7,13,17,19,21,29],thei:[1,4,12,13,14,18,19,20,25,26,27,28],them:[3,4,9,14,15,19,20,21,23,26,29],theoret:18,therefor:[4,12,16,17,18,19,21,28],thi:[0,1,3,4,5,6,7,8,10,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28],thing:[0,1,4,7,17,19,25,28,29],think:4,thoroughli:4,those:[0,1,3,4,7,14,21,24,25],though:21,thr:[26,27,29],thread:16,three:[0,3,4,12,13,14,18,20,26,27,29],threonin:27,thresh:[13,26,28],threshold:[17,19,21,24,28],through:[0,4,19,21],throughout:[4,7,16],thu:5,tidi:4,tightli:4,time:[0,4,12,13,15,21],tini:[4,21],titl:20,tlc:27,tlctorotid:[25,27],toentiti:[10,12,18,19],togeth:[4,19],too:[4,14,19,21],tool:[3,15,19,25],toolbox:4,top:[1,4,8],topic:[0,4],topolog:17,torsion:[12,13,16,17,18],torsion_angl:25,torsion_bin:13,torsion_sampl:[12,14,17,18,21],torsion_scor:14,torsionprob:19,torsionsampl:[12,13,14,16,17,18,19,20,21],total:19,touch:[0,4],toward:[4,17,21],tpl:21,tpr:[27,28],track:[5,25],tradit:7,tradition:5,train:16,trajectori:18,tran:[13,27,28],transform:[12,26,28],transformation_matrix:12,translat:[27,28],transomegators:13,treat:[4,21,28],tree:[0,3,4,24],trg:7,tri:[21,28],trick:[0,4],trigger:[0,3,4],tripeptid:20,tripl:5,triplet:18,trp:27,trustworthi:4,tryptophan:27,tupl:[5,12],turn:[0,4,5,21],tutori:4,tweak:21,two:[0,4,12,13,14,17,19,21,22,25,26,27,28,29],txt:[0,1,3,4],type:[0,5,7,12,16,19,20,23,25,26],typic:[12,18,25,26],tyr:[26,27,28,29],tyrosin:27,ultra:19,uncertain:4,under:[3,4],undergo:[17,18],underli:14,underscor:0,understand:4,unexpect:1,unfavour:[17,18,22],unfortun:4,uniqu:[14,18,19,28],unittest:[0,4],unix:4,unlik:[25,29],unrecognis:[5,7],until:[4,17,21,24,26],untrack:0,unus:4,updat:[4,17,21],updatedistribut:20,upon:[17,18],url:4,usabl:4,usag:[16,19,23,25],use_scoring_extend:21,user:0,userlevel:0,usr:4,usual:[0,1,3,4,7,15,21],utilis:4,val:[20,27],valid:[4,17,18,21],valin:27,valu:[1,5,7,12,13,14,18,19,23,24,25,26,27,28],vanish:4,varadarajan:19,vari:3,variabl:[0,1,4,10,29],variant:7,variou:[0,1,3,4],vec3:[12,22,23,26],vector:20,verbos:0,veri:[0,4,5,29],verif:7,verifi:[0,4,5],version:[1,4,19,27],version_great:4,vertex:19,via:[0,4,7,8],view:[4,20],virtual:4,visual:10,wai:[0,1,3,4,7,12,15,19,23,25,27],wait:4,walk:[0,4],want:[0,1,4,8,15,17,19,21,26,28],warn:[4,21],watch:4,web:[1,4],weight:[14,18,19],weird:[17,25],well:[1,3,4,13,14,19,20,21,25,26,28],went:4,were:[4,21],wether:24,what:[0,4,5,7,15],when:[0,3,4,7,12,13,14,18,19,20,21,22,23,25,26,28,29],whenev:[4,13],where:[0,4,5,12,19,20,28],wherea:19,whether:[5,12,13,14,17,18,19,23,25,26,28],which:[0,4,5,6,7,10,12,13,14,18,19,20,21,23,26],whistl:4,who:[24,25],whole:[0,4,21],why:[0,4],wild:3,wise:3,within:[1,4,13,21,28],without:[0,3,4,5,16,17,19,21],wno:4,won:[23,25],word:3,work:[0,1,3,4,7,21],worst:4,would:[0,1,4,5,20,22,26],wrapper:[0,4,8,21],wrong:[1,7],www:4,xlabel:20,xlim:20,xxx:27,year:0,yet:[13,19],ylabel:20,ylim:20,you:[0,1,3,4,5,7,8,10,13,14,15,17,18,19,21,23,25,26,28],your:[0,3],your_modul:4,yourself:[1,4],zero:[19,28],zhou2005:19,zhou:19,zip:25},titles:["<code class=\"docutils literal\"><span class=\"pre\">test_actions</span></code> - Testing Actions","Building ProMod3","Changelog","ProMod3&#8216;s Share Of CMake","Contributing","<code class=\"docutils literal\"><span class=\"pre\">helper</span></code> - Shared Functionality For the Everything","<code class=\"docutils literal\"><span class=\"pre\">core</span></code> - ProMod3 Core Functionality","<code class=\"docutils literal\"><span class=\"pre\">pm3argparse</span></code> - Parsing Command Lines","<code class=\"docutils literal\"><span class=\"pre\">SetCompoundsChemlib()</span></code>","Documentation For Developers","Getting Started","Welcome To ProMod3&#8217;s Documentation!","Backbone","Loop Scoring","Helper Classes","<code class=\"docutils literal\"><span class=\"pre\">loop</span></code> - Loop Modelling","Load Loop Objects","Loop Closing","Monte Carlo Sampling","Structural Database","Torsion Sampler","<code class=\"docutils literal\"><span class=\"pre\">modelling</span></code> - Protein Modelling","Disulfid Bond Evaluation","Frame","Coming to a solution","<code class=\"docutils literal\"><span class=\"pre\">sidechain</span></code> - Sidechain Modelling","Rotamers","RotamerID","Rotamer Library","Rotamer Settings","Documentation For Users"],titleterms:{"class":[14,20,21],"function":[3,5,6,23,25,26],acid:20,action:[0,3,4],actiontestcas:0,amino:20,api:0,argument:7,backbon:[12,17,28],backboneloopscor:13,base:19,basic:12,block:[12,26],bond:22,branch:4,build:[1,12,26],can:27,carlo:18,ccd:17,chain:19,chang:2,changelog:2,close:[17,21],closer:18,cmake:[0,1,3,4],come:24,command:7,construct:[23,26],contribut:4,conveni:[23,26],cooler:18,core:6,creat:0,databas:19,defin:[19,20],depend:[1,28],develop:9,directori:4,disulfid:22,document:[3,4,9,11,30],edit:12,entri:28,evalu:22,everyth:5,execut:0,extend:21,featur:19,file:5,find:19,fragment:19,frame:23,full:12,gap:21,geometr:19,get:[10,27],git:4,graph:24,group:26,handl:[14,21],have:0,helper:[5,14],hook:4,how:[4,27],indic:11,integr:0,interact:24,introduct:[3,5,7],issu:4,kic:17,librari:28,licens:4,line:7,load:16,loop:[13,14,15,16,17],mainten:3,make:[0,1],messag:5,model:[10,15,21,25],modul:[3,4,25],mont:18,must:0,non:28,object:[16,18,23],onc:14,output:0,own:4,pars:7,parser:7,parti:4,particl:26,pipelin:[10,21],pm3argpars:7,promod3:[1,3,6,10,11],protein:21,psipr:14,reconstruct:25,relax:17,releas:2,residu:[12,23],rotam:[26,28,29],rotamerid:27,run:[0,1,10],sampl:18,sampler:[18,20],score:13,scorer:18,script:0,sequenc:19,set:29,setcompoundschemlib:8,sever:14,share:[3,5],sidechain:25,smallest:26,solut:24,stage:4,start:[4,10],stretch:12,structur:[4,19],subclass:0,tabl:11,test:[0,3,4,5],test_act:0,third:4,torsion:20,triplet:20,type:28,unit:[0,3,4],user:30,welcom:11,write:4,your:4}})
\ No newline at end of file
+Search.setIndex({envversion:46,filenames:["actions/index_dev","buildsystem","changelog","cmake/index","contributing","core/helper","core/index","core/pm3argparse","core/setcompoundschemlib","developers","gettingstarted","index","loop/backbone","loop/backbone_loop_score","loop/helper_classes","loop/index","loop/load_loop_objects","loop/loop_closing","loop/monte_carlo","loop/structure_db","loop/torsion_sampler","modelling/index","portableIO","sidechain/disulfid","sidechain/frame","sidechain/graph","sidechain/index","sidechain/loading","sidechain/rotamer","sidechain/rotamer_id","sidechain/rotamer_lib","sidechain/sidechain_settings","users"],objects:{"":{"command:add_doc_dependency":[3,0,1,""],"command:add_doc_source":[3,0,1,""],"command:convert_module_data":[3,0,1,""],"command:module":[3,0,1,""],"command:pm_action":[3,0,1,""],"command:promod3_unittest":[3,0,1,""],"command:pymod":[3,0,1,""],test_actions:[0,1,0,"-"]},"promod3.core":{helper:[5,1,0,"-"],pm3argparse:[7,1,0,"-"]},"promod3.core.helper":{FileExists:[5,5,1,""],FileExtension:[5,5,1,""],FileGzip:[5,5,1,""],MsgErrorAndExit:[5,5,1,""]},"promod3.core.pm3argparse":{PM3ArgumentParser:[7,3,1,""]},"promod3.core.pm3argparse.PM3ArgumentParser":{"__init__":[7,2,1,""],AddAlignment:[7,2,1,""],AssembleParser:[7,2,1,""],Parse:[7,2,1,""],action:[7,4,1,""]},"promod3.loop":{Backbone:[12,3,1,""],BackboneList:[12,3,1,""],BackboneLoopScorer:[13,3,1,""],BackboneRelaxer:[17,3,1,""],CCD:[17,3,1,""],CCDCloser:[18,3,1,""],CTerminalCloser:[18,3,1,""],CoordInfo:[19,3,1,""],DirtyCCDCloser:[18,3,1,""],ExponentialCooler:[18,3,1,""],FragDB:[19,3,1,""],Fragger:[19,3,1,""],FraggerHandle:[19,3,1,""],FraggerMap:[19,3,1,""],FragmentInfo:[19,3,1,""],FragmentSampler:[18,3,1,""],KIC:[17,3,1,""],KICCloser:[18,3,1,""],LinearScorer:[18,3,1,""],LoadBackboneLoopScorer:[16,2,1,""],LoadFragDB:[16,2,1,""],LoadStructureDB:[16,2,1,""],LoadTorsionSampler:[16,2,1,""],LoadTorsionSamplerCoil:[16,2,1,""],LoadTorsionSamplerExtended:[16,2,1,""],LoadTorsionSamplerHelical:[16,2,1,""],LoopCandidate:[14,3,1,""],LoopCandidates:[14,3,1,""],NTerminalCloser:[18,3,1,""],PhiPsiSampler:[18,3,1,""],PsipredPrediction:[14,3,1,""],SampleMonteCarlo:[18,2,1,""],SoftSampler:[18,3,1,""],StructureDB:[19,3,1,""],TorsionSampler:[20,3,1,""]},"promod3.loop.Backbone":{ApplyTransform:[12,2,1,""],Backbone:[12,2,1,""],GetTransform:[12,2,1,""],aa:[12,4,1,""],c_coord:[12,4,1,""],ca_coord:[12,4,1,""],cb_coord:[12,4,1,""],n_coord:[12,4,1,""],o_coord:[12,4,1,""],one_letter_code:[12,4,1,""]},"promod3.loop.BackboneList":{"__getitem__":[12,2,1,""],"__iter__":[12,2,1,""],"__len__":[12,2,1,""],"__setitem__":[12,2,1,""],ApplyTransform:[12,2,1,""],BackboneList:[12,2,1,""],CARMSD:[12,2,1,""],Extract:[12,2,1,""],GetOmegaTorsion:[12,2,1,""],GetPhiTorsion:[12,2,1,""],GetPsiTorsion:[12,2,1,""],GetSequence:[12,2,1,""],GetTransform:[12,2,1,""],InsertInto:[12,2,1,""],MinCADistance:[12,2,1,""],RMSD:[12,2,1,""],ReconstructCBetaPositions:[12,2,1,""],ReconstructOxygenPositions:[12,2,1,""],ReplaceFragment:[12,2,1,""],RotateAroundOmegaTorsion:[12,2,1,""],RotateAroundPhiPsiTorsion:[12,2,1,""],RotateAroundPhiTorsion:[12,2,1,""],RotateAroundPsiTorsion:[12,2,1,""],SetOmegaTorsion:[12,2,1,""],SetPhiPsiTorsion:[12,2,1,""],SetPhiTorsion:[12,2,1,""],SetPsiTorsion:[12,2,1,""],SetSequence:[12,2,1,""],SuperposeOnto:[12,2,1,""],ToEntity:[12,2,1,""],append:[12,2,1,""]},"promod3.loop.BackboneLoopScorer":{AddConstraint:[13,2,1,""],AddConstraintFunction:[13,2,1,""],AddContact:[13,2,1,""],AddContactFunction:[13,2,1,""],CalculateCBPackingScore:[13,2,1,""],CalculateCBetaScore:[13,2,1,""],CalculateClashScore:[13,2,1,""],CalculateConstraintScore:[13,2,1,""],CalculateContactScore:[13,2,1,""],CalculateHBondScore:[13,2,1,""],CalculateReducedScore:[13,2,1,""],CalculateSSAgreementScore:[13,2,1,""],CalculateTorsionScore:[13,2,1,""],ClearEnvironment:[13,2,1,""],Initialize:[13,2,1,""],Load:[13,2,1,""],LoadPortable:[13,2,1,""],Save:[13,2,1,""],SavePortable:[13,2,1,""],SetCBPackingEnergy:[13,2,1,""],SetCBPackingPotentialParameters:[13,2,1,""],SetCBetaEnergy:[13,2,1,""],SetCBetaPotentialParameters:[13,2,1,""],SetEnvironment:[13,2,1,""],SetHBondEnergy:[13,2,1,""],SetHBondPotentialParameters:[13,2,1,""],SetPsipredPrediction:[13,2,1,""],SetReducedEnergy:[13,2,1,""],SetReducedPotentialParameters:[13,2,1,""],SetSSAgreementParameters:[13,2,1,""],SetTorsionEnergy:[13,2,1,""],SetTorsionPotentialParameters:[13,2,1,""],TransOmegaTorsions:[13,2,1,""]},"promod3.loop.BackboneRelaxer":{Run:[17,2,1,""]},"promod3.loop.CCD":{CCD:[17,2,1,""],Close:[17,2,1,""]},"promod3.loop.CCDCloser":{Close:[18,2,1,""]},"promod3.loop.CoordInfo":{offset:[19,4,1,""],pdb_id:[19,4,1,""],size:[19,4,1,""]},"promod3.loop.DirtyCCDCloser":{Close:[18,2,1,""]},"promod3.loop.ExponentialCooler":{GetTemperature:[18,2,1,""],Reset:[18,2,1,""]},"promod3.loop.FragDB":{AddFragments:[19,2,1,""],GetAngularBinSize:[19,2,1,""],GetDistBinSize:[19,2,1,""],GetNumFragments:[19,2,1,""],GetNumStemPairs:[19,2,1,""],HasFragLength:[19,2,1,""],Load:[19,2,1,""],LoadPortable:[19,2,1,""],MaxFragLength:[19,2,1,""],PrintStatistics:[19,2,1,""],Save:[19,2,1,""],SavePortable:[19,2,1,""],SearchDB:[19,2,1,""]},"promod3.loop.Fragger":{"__getitem__":[19,2,1,""],"__len__":[19,2,1,""],AddSSAgreeParameters:[19,2,1,""],AddSeqIDParameters:[19,2,1,""],AddSeqSimParameters:[19,2,1,""],AddSequenceProfileParameters:[19,2,1,""],AddStructureProfileParameters:[19,2,1,""],AddTorsionProbabilityParameters:[19,2,1,""],Fill:[19,2,1,""],GetFragmentInfo:[19,2,1,""],GetScore:[19,2,1,""]},"promod3.loop.FraggerHandle":{Get:[19,2,1,""],GetList:[19,2,1,""],LoadCached:[19,2,1,""],SaveCached:[19,2,1,""]},"promod3.loop.FraggerMap":{"__getitem__":[19,2,1,""],"__setitem__":[19,2,1,""],Contains:[19,2,1,""],Load:[19,2,1,""],LoadBB:[19,2,1,""],Save:[19,2,1,""],SaveBB:[19,2,1,""]},"promod3.loop.FragmentInfo":{chain_index:[19,4,1,""],length:[19,4,1,""],offset:[19,4,1,""]},"promod3.loop.FragmentSampler":{Initialize:[18,2,1,""],ProposeStep:[18,2,1,""]},"promod3.loop.KIC":{Close:[17,2,1,""],KIC:[17,2,1,""]},"promod3.loop.KICCloser":{Close:[18,2,1,""]},"promod3.loop.LinearScorer":{GetScore:[18,2,1,""]},"promod3.loop.LoopCandidate":{CARMSD:[14,2,1,""],RMSD:[14,2,1,""],bb_list:[14,4,1,""],cbeta_score:[14,4,1,""],clash_score:[14,4,1,""],combined_score:[14,4,1,""],hbond_score:[14,4,1,""],packing_score:[14,4,1,""],reduced_score:[14,4,1,""],ss_agreement_score:[14,4,1,""],torsion_score:[14,4,1,""]},"promod3.loop.LoopCandidates":{Add:[14,2,1,""],ApplyCCD:[14,2,1,""],ApplyKIC:[14,2,1,""],AttachScorer:[14,2,1,""],CalculateBetaScores:[14,2,1,""],CalculateClashScores:[14,2,1,""],CalculateCombinedScores:[14,2,1,""],CalculateHBondcores:[14,2,1,""],CalculatePackingScores:[14,2,1,""],CalculateReducedScores:[14,2,1,""],CalculateSSAgreementScores:[14,2,1,""],CalculateTorsionScores:[14,2,1,""],ClusterCandidates:[14,2,1,""],FillFromDatabase:[14,6,1,""],FillFromMonteCarloSampler:[14,6,1,""],GetAVGCBetaScore:[14,2,1,""],GetAVGClashScore:[14,2,1,""],GetAVGCombinedScore:[14,2,1,""],GetAVGHBondscore:[14,2,1,""],GetAVGPackingScore:[14,2,1,""],GetAVGReducedScore:[14,2,1,""],GetAVGSSAgreementscore:[14,2,1,""],GetAVGTorsionScore:[14,2,1,""],Remove:[14,2,1,""]},"promod3.loop.PhiPsiSampler":{Initialize:[18,2,1,""],ProposeStep:[18,2,1,""]},"promod3.loop.PsipredPrediction":{"__len__":[14,2,1,""],Add:[14,2,1,""],Extract:[14,2,1,""],FromHHM:[14,2,1,""],FromHoriz:[14,2,1,""],GetConfidence:[14,2,1,""],GetConfidences:[14,2,1,""],GetPrediction:[14,2,1,""],GetPredictions:[14,2,1,""],PsipredPrediction:[14,2,1,""]},"promod3.loop.SoftSampler":{Initialize:[18,2,1,""],ProposeStep:[18,2,1,""]},"promod3.loop.StructureDB":{AddCoordinates:[19,2,1,""],GenerateStructureProfile:[19,2,1,""],GetBackboneList:[19,2,1,""],GetCoordIndex:[19,2,1,""],GetCoordInfo:[19,2,1,""],GetDSSPStates:[19,2,1,""],GetDihedralAngles:[19,2,1,""],GetNumCoords:[19,2,1,""],GetResidueDepths:[19,2,1,""],GetSequence:[19,2,1,""],GetSequenceProfile:[19,2,1,""],GetSolventAccessibilitites:[19,2,1,""],GetStructureProfile:[19,2,1,""],Load:[19,2,1,""],LoadPortable:[19,2,1,""],PrintStatistics:[19,2,1,""],Save:[19,2,1,""],SavePortable:[19,2,1,""],SetStructureProfile:[19,2,1,""]},"promod3.loop.TorsionSampler":{Draw:[20,2,1,""],DrawPhiGivenPsi:[20,2,1,""],DrawPsiGivenPhi:[20,2,1,""],ExtractStatistics:[20,2,1,""],GetBinSize:[20,2,1,""],GetBinsPerDimension:[20,2,1,""],GetHistogramIndex:[20,2,1,""],GetHistogramIndices:[20,2,1,""],GetPhiProbabilityGivenPsi:[20,2,1,""],GetProbability:[20,2,1,""],GetPsiProbabilityGivenPhi:[20,2,1,""],Load:[20,2,1,""],LoadPortable:[20,2,1,""],Save:[20,2,1,""],SavePortable:[20,2,1,""],UpdateDistributions:[20,2,1,""]},"promod3.modelling":{BuildFromRawModel:[21,5,1,""],BuildRawModel:[21,5,1,""],BuildSidechains:[21,5,1,""],CheckFinalModel:[21,5,1,""],ClearGaps:[21,5,1,""],CloseLargeDeletions:[21,5,1,""],CloseSmallDeletions:[21,5,1,""],CountEnclosedGaps:[21,5,1,""],CountEnclosedInsertions:[21,5,1,""],FillLoopsByDatabase:[21,5,1,""],FillLoopsByMonteCarlo:[21,5,1,""],FilterCandidates:[21,5,1,""],FilterCandidatesWithSC:[21,5,1,""],FullGapExtender:[21,3,1,""],GapExtender:[21,3,1,""],GetRingPunches:[21,5,1,""],GetRings:[21,5,1,""],HasRingPunches:[21,5,1,""],MergeGaps:[21,5,1,""],MergeGapsByDistance:[21,5,1,""],MinimizeModelEnergy:[21,5,1,""],ModelTermini:[21,5,1,""],ModellingHandle:[21,3,1,""],RemoveTerminalGaps:[21,5,1,""],ScoringGapExtender:[21,3,1,""],SetupBackboneScorer:[21,5,1,""],ShiftExtension:[21,3,1,""],StructuralGap:[21,3,1,""],StructuralGapList:[21,3,1,""]},"promod3.modelling.FullGapExtender":{Extend:[21,2,1,""]},"promod3.modelling.GapExtender":{Extend:[21,2,1,""]},"promod3.modelling.ModellingHandle":{gaps:[21,4,1,""],model:[21,4,1,""],seqres:[21,4,1,""]},"promod3.modelling.ScoringGapExtender":{Extend:[21,2,1,""]},"promod3.modelling.ShiftExtension":{Extend:[21,2,1,""]},"promod3.modelling.StructuralGap":{Copy:[21,2,1,""],ExtendAtCTerm:[21,2,1,""],ExtendAtNTerm:[21,2,1,""],GetChain:[21,2,1,""],GetChainIndex:[21,2,1,""],GetChainName:[21,2,1,""],GetLength:[21,2,1,""],IsCTerminal:[21,2,1,""],IsNTerminal:[21,2,1,""],IsTerminal:[21,2,1,""],ShiftCTerminal:[21,2,1,""],after:[21,4,1,""],before:[21,4,1,""],full_seq:[21,4,1,""],length:[21,4,1,""],seq:[21,4,1,""]},"promod3.sidechain":{AAToRotID:[29,2,1,""],BBDepRotamerLib:[30,3,1,""],ConstructBackboneFrameResidue:[24,2,1,""],ConstructFRMRotamer:[28,2,1,""],ConstructFRMRotamerGroup:[28,2,1,""],ConstructFrameResidue:[24,2,1,""],ConstructRRMRotamer:[28,2,1,""],ConstructRRMRotamerGroup:[28,2,1,""],ConstructSidechainFrameResidue:[24,2,1,""],DisulfidScore:[23,2,1,""],FRMRotamer:[28,3,1,""],FRMRotamerGroup:[28,3,1,""],Frame:[24,3,1,""],FrameResidue:[24,3,1,""],Graph:[25,3,1,""],LoadDunbrackLib:[27,2,1,""],LoadPenultimateLib:[27,2,1,""],Particle:[28,3,1,""],RRMRotamer:[28,3,1,""],RRMRotamerGroup:[28,3,1,""],ReadDunbrackFile:[27,2,1,""],Reconstruct:[26,2,1,""],RotamerID:[29,3,1,""],RotamerLib:[30,3,1,""],RotamerLibEntry:[30,3,1,""],RotamerSettings:[31,3,1,""],SidechainParticle:[28,3,1,""],TLCToRotID:[29,2,1,""]},"promod3.sidechain.BBDepRotamerLib":{AddRotamer:[30,2,1,""],Load:[30,2,1,""],LoadPortable:[30,2,1,""],MakeStatic:[30,2,1,""],QueryLib:[30,2,1,""],Save:[30,2,1,""],SavePortable:[30,2,1,""],SetInterpolate:[30,2,1,""]},"promod3.sidechain.FRMRotamer":{"__getitem__":[28,2,1,""],"__len__":[28,2,1,""],ApplyOnResidue:[28,2,1,""],CalculateInternalEnergy:[28,2,1,""],GetFrameEnergy:[28,2,1,""],GetInternalEnergy:[28,2,1,""],GetInternalEnergyPrefactor:[28,2,1,""],GetNumSubrotamers:[28,2,1,""],GetProbability:[28,2,1,""],GetSelfEnergy:[28,2,1,""],GetSubrotamerAssociations:[28,2,1,""],GetSubrotamerDefinition:[28,2,1,""],GetTemperature:[28,2,1,""],GetTransformedCopy:[28,2,1,""],SetFrameEnergy:[28,2,1,""],SetInternalEnergy:[28,2,1,""],SetInternalEnergyPrefactor:[28,2,1,""],SetProbability:[28,2,1,""],SetTemperature:[28,2,1,""]},"promod3.sidechain.FRMRotamerGroup":{"__getitem__":[28,2,1,""],"__len__":[28,2,1,""],ApplyOneResidue:[28,2,1,""],ApplySelfEnergyThres:[28,2,1,""],CalculateInternalEnergies:[28,2,1,""],Merge:[28,2,1,""]},"promod3.sidechain.Frame":{AddFrameEnergy:[24,2,1,""],SetFrameEnergy:[24,2,1,""]},"promod3.sidechain.FrameResidue":{"__getitem__":[24,2,1,""],"__len__":[24,2,1,""]},"promod3.sidechain.Graph":{CreateFromFRMList:[25,6,1,""],CreateFromRRMList:[25,6,1,""],GetNumActiveEdges:[25,2,1,""],GetNumActiveNodes:[25,2,1,""],GetNumEdges:[25,2,1,""],GetNumNodes:[25,2,1,""],Prune:[25,2,1,""],Solve:[25,2,1,""]},"promod3.sidechain.Particle":{AddLonePair:[28,2,1,""],GetCharge:[28,2,1,""],GetName:[28,2,1,""],GetParticleType:[28,2,1,""],GetPos:[28,2,1,""],IsHBondAcceptor:[28,2,1,""],IsHBondDonor:[28,2,1,""],PairwiseEnergy:[28,2,1,""],SetPolarDirection:[28,2,1,""]},"promod3.sidechain.RRMRotamer":{"__getitem__":[28,2,1,""],"__len__":[28,2,1,""],ApplyOnResidue:[28,2,1,""],CalculateInternalEnergy:[28,2,1,""],GetFrameEnergy:[28,2,1,""],GetInternalEnergy:[28,2,1,""],GetInternalEnergyPrefactor:[28,2,1,""],GetProbability:[28,2,1,""],GetSelfEnergy:[28,2,1,""],GetTransformedCopy:[28,2,1,""],SetFrameEnergy:[28,2,1,""],SetInternalEnergy:[28,2,1,""],SetInternalEnergyPrefactor:[28,2,1,""],SetProbability:[28,2,1,""]},"promod3.sidechain.RRMRotamerGroup":{"__getitem__":[28,2,1,""],"__len__":[28,2,1,""],ApplyOneResidue:[28,2,1,""],ApplySelfEnergyThres:[28,2,1,""],CalculateInternalEnergies:[28,2,1,""],Merge:[28,2,1,""]},"promod3.sidechain.RotamerLib":{AddRotamer:[30,2,1,""],Load:[30,2,1,""],LoadPortable:[30,2,1,""],MakeStatic:[30,2,1,""],QueryLib:[30,2,1,""],Save:[30,2,1,""],SavePortable:[30,2,1,""]},"promod3.sidechain.RotamerLibEntry":{FromResidue:[30,6,1,""],IsSimilar:[30,2,1,""],SimilarDihedral:[30,2,1,""],chi1:[30,4,1,""],chi2:[30,4,1,""],chi3:[30,4,1,""],chi4:[30,4,1,""],probability:[30,4,1,""],sig1:[30,4,1,""],sig2:[30,4,1,""],sig3:[30,4,1,""],sig4:[30,4,1,""]},"test_actions.ActionTestCase":{RunAction:[0,2,1,""],RunExitStatusTest:[0,2,1,""],pm_action:[0,4,1,""],pm_bin:[0,4,1,""],testPMExists:[0,2,1,""]},promod3:{SetCompoundsChemlib:[8,5,1,""],core:[6,1,0,"-"],loop:[15,1,0,"-"],modelling:[21,1,0,"-"],sidechain:[26,1,0,"-"]},test_actions:{ActionTestCase:[0,3,1,""]}},objnames:{"0":["cmake","command","CMake command"],"1":["py","module","Python module"],"2":["py","method","Python method"],"3":["py","class","Python class"],"4":["py","attribute","Python attribute"],"5":["py","function","Python function"],"6":["py","staticmethod","Python static method"]},objtypes:{"0":"cmake:command","1":"py:module","2":"py:method","3":"py:class","4":"py:attribute","5":"py:function","6":"py:staticmethod"},terms:{"1akia":19,"1crn":[15,18,19,21],"1crn_cut":21,"1crna":19,"1ey":[4,26],"1eye_rec":4,"2010dunbracklib":22,"2b1":1,"4x4":12,"__doc__":[5,7],"__getitem__":[12,19,24,28],"__init__":[0,4,7],"__iter__":12,"__len__":[12,14,19,24,28],"__main__":[0,4],"__name__":[0,4],"__setitem__":[12,19],"_data":22,"_name":3,"_run":[0,3],"_xml":3,"boolean":[5,13],"break":[3,4],"byte":22,"case":[0,4,12,13,17,18,19,20,21,22,23,26,28,30],"char":[12,22],"class":[4,6,7],"const":22,"default":[0,1,3,4,7,8,12,13,17,18,19,20,21,26,28,31],"enum":29,"export":[4,25,28],"final":[4,10,13,14,15,19,21,25,26],"float":[12,13,14,15,17,18,19,20,21,22,24,25,28,30],"function":[],"import":[0,4,5,7,10,12,15,18,19,20,21,26],"int":[0,5,12,13,14,16,17,18,19,20,21,22,24,25,28,30],"long":21,"new":[0,4,7,9,14,16,17,18,19,21,22,26,28],"null":19,"public":[4,22,27],"return":[0,4,5,7,8,12,13,14,16,17,18,19,20,21,22,23,24,25,27,28,29,30],"s\u00f6ding":19,"short":[4,22],"static":[4,14,22,25,27,30],"super":26,"switch":4,"throw":[0,22,26,27],"true":[0,5,7,12,13,14,15,16,17,18,19,21,22,26,28,31],"try":[0,4,21,22,30],"void":22,"while":[0,3,4,13,22],aa_aft:19,aa_befor:19,aa_with_rotam:26,aaaaaaaa:12,aaaaggggggggggggggggggggaaaaaa:21,aatorotid:29,abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz:21,abil:4,abl:4,abort:[4,17,21],about:[0,3,4,14,19,21],abov:[0,4,7,21,22,23,26,29,30],absolut:3,academ:4,accept:[14,17,18,21,22],acceptor:13,access:[3,12,15,19,20,28,29],accessibili:19,accord:[4,12,13,14,18,19,20,21,24,26,28,30],accuraci:17,achiev:4,acid:[],acknowledg:4,across:[0,30],act:17,action_unit_test:0,actiontest:0,activ:[4,7],actual:[4,7,12,13,15,18,19,21,28,30],actual_posit:18,actual_step:18,adapt:[4,15,17,18,27,32],add:[0,3,4,7,10,13,14,16,19,20,24,26,28],add_argu:5,add_custom_target:4,add_doc_depend:3,add_doc_sourc:[3,4],add_polar_hydrogen:26,add_subdirectori:4,addalign:7,addconstraint:13,addconstraintfunct:13,addcontact:13,addcontactfunct:13,addcoordin:19,addfrag:19,addframeenergi:24,addit:[3,4,5,7,12,18,19,22],addition:[0,3],addlonepair:28,address:22,addrotam:30,addseqidparamet:19,addseqsimparamet:19,addsequenceprofileparamet:19,addssagreeparamet:19,addstructureprofileparamet:19,addtorsionprobabilityparamet:19,admir:4,advic:4,advis:4,affect:[4,12,29],after:[0,1,3,4,7,12,13,14,17,18,19,20,21,25,27,30],afterward:4,again:[1,4],agg:20,ago:0,agreement:19,ala:[12,17,20,26,29],alanin:29,alg:19,algorithm:[14,15,17,18,21,23,26,27,29,31],alia:21,align:[7,10,19,21],alignmenthandl:21,alignmentlist:[7,21],all:[0,1,3,4,7,10,12,13,14,17,18,19,20,21,22,23,24,25,26,27,28,30],alloc:[13,19],allow:[4,5,12,13,14,15,18,19,20,21,22,24],allow_prepro_ci:13,almost:3,aln:21,aln_sourc:7,alon:5,along:[0,4,19],alot:4,alpha:[12,13,14,24,26,28],alpha_bin:13,alreadi:[0,3,4,12,13,16,19,21,24,25,30],also:[0,1,3,4,5,14,17,18,19,20,21,24,25,27,30,31],alter:18,altern:[3,4,18,27],alwai:[0,4,18,21,22],ambig:30,ambigu:30,amino:[],aminoacid:[12,13,29,30],among:14,amount:30,analysi:[17,19],analyt:[14,30],anchor:28,ancient:8,angl:[12,13,14,15,17,18,19,20,21,24,26,27,28,30,32],angle_bin:13,angle_bin_s:19,angstrom:[17,19],ani:[0,3,4,8,10,12,13,14,18,19,20,21,22,24,26],anneal:[14,18],announc:[0,4],anoth:[3,12,17,21],anymor:25,anyth:[1,4,7,8],anywai:4,apart:[0,14,21],append:[12,14,20,21,26],appli:[4,5,8,12,14,17,18,21,25,26,28],applic:[0,17],applyccd:[14,15],applyk:14,applyoneresidu:28,applyonresidu:[26,28],applyselfenergythr:28,applyselfenergythresh:26,applytransform:12,approach:[1,4,19,21,22],appropri:[20,21,22],approxim:[25,28],arbitrari:[7,13,14,19],arbitrarili:18,arg:[0,3,7,29],arginin:29,argpars:7,argument:[1,3,5,6],argumentpars:7,argv:7,around:[0,3,4,21],arrai:22,ascend:21,ask:4,asn:29,asp:[28,29,30],asparagin:29,aspart:[29,30],ass:18,assemblepars:7,assertequ:4,assess:13,assign:[14,18,19,27,31],assigndssp:19,associ:[14,21,24,28],assum:[0,3,4,13,19,20,21,22,25,30],assumpt:[13,19,20,30],atom:[12,13,14,17,19,21,23,24,26,28,30,31],atomhandl:28,atomseq:19,attach:[3,14,15,21],attachscor:[14,15],attachview:21,attent:[0,4],attribut:[4,7,14,30],autom:3,automat:[0,4,5,19,22,30],automatis:4,avail:[0,1,4,8,13,14,18,19,20,30],availabl:4,averag:[14,19],avg:19,avoid:[5,8,13,17,18],awai:4,awar:4,awesom:[0,4],axi:19,back:[0,4,18,25],backbon:10,backbone_list:14,backbone_loop_scor:22,backbonelist:[10,12,13,14,17,18,19],backbonerelax:17,background:1,backward:22,base:[3,5],base_target:3,bashrc:4,basi:[3,4,17,18,19,28],basic:[1,4,5],bb_list:[10,12,13,14,15,17,18,19],bbdeprotamerlib:[22,26,27,28,30],bbdeprotamerlibrari:28,becaus:[4,13,21],becom:30,been:[4,13,16,17,19,25,27,30],befor:[0,3,4,7,12,13,14,17,18,19,20,21,22,30],begin:[0,4,12,18],behav:0,behaviour:[7,30],behind:4,bell:4,belong:[3,4,13,14,18,19,21,24,28],belov:19,below:[4,13,17,19,22,23,25],below_thre:19,besid:[1,3,7],best:[3,21],beta:[12,13,14,24,28],beta_bin:13,better:18,between:[0,12,13,14,17,18,19,21,22,23,24,25,28,30,31],beyond:7,big:22,biggest:[],bilinearli:30,bin:[0,4,10,13,19,20,30],bin_siz:[20,30],binari:[3,4],bind:[19,21],bioinformat:19,biol:19,biopolym:19,bit:[0,1,4,14,21],bla:1,blank:4,blas_blas_librari:1,blosum62:19,bond:[],bool:[0,5,7,12,13,14,16,17,18,19,21,22,24,26,28,30],boost:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],boost_librari:3,boost_root:1,both:[21,26,28,30],bottom:26,bound:[19,28],branch:3,branchnam:4,brew:3,bridg:[16,21],briefli:4,bring:4,broken:0,broyden:21,bug:4,build:[],build_disulfid:26,builder:1,buildfromrawmodel:21,buildrawmodel:21,buildsidechain:21,buildup:[26,31],built:[3,19,24,26,28],bunch:[0,4,7],bytecod:0,c_coord:12,c_num:21,c_po:[13,24],c_stem:[12,14,15,17,18,19,21],c_stem_psi:18,c_str:22,c_ter:[17,24],c_terminu:19,ca_coord:12,ca_po:[13,24,28],ca_pos_on:23,ca_pos_two:23,ca_rmsd:19,cach:[1,19],calcul:[12,13,14,15,17,18,19,20,23,24,25,26,28],calculatebetascor:14,calculatecbetascor:[13,15],calculatecbpackingscor:13,calculateclashscor:[13,14,15],calculateclasscor:[],calculatecombinedscor:14,calculateconstraintscor:13,calculatecontactscor:13,calculatehbondcor:14,calculatehbondscor:13,calculateinternalenergi:[26,28],calculatepackingscor:14,calculatereducedscor:[13,14],calculatessagreementscor:[13,14],calculatesurfac:19,calculatetorsionscor:[13,14],call:[0,1,3,4,5,7,8,13,14,16,18,19,20,21,22,28,30],calul:20,came:4,can:[1,3,4,5,7,10,22],cand:21,candid:[14,15,18,21],cannot:[4,13,19,20,21,22,27,29,30],canutescu2003:17,canutescu2003b:23,canutescu:[17,23],capabl:[16,18],captur:0,carbon:[12,24,28],carbonyl:28,care:[21,22],carlo:[],carmsd:[12,14,19],carri:[4,5],cast:22,categori:3,caus:[4,21],cb_coord:12,cb_pack:[14,18],cb_packing_cutoff:13,cb_packing_max_count:13,cb_po:[24,28],cb_pos_on:23,cb_pos_two:23,cbeta:[12,13,14,15,18],cbeta_bin:13,cbeta_cutoff:13,cbeta_scor:[14,15],cbeta_seq_sep:13,cbetascor:13,cbpackingscor:13,ccd:[],ccdcloser:18,center:21,central:[13,20],certain:[0,1,3,4,13,19,20,21,22],certainli:0,ch1particl:28,ch2particl:28,ch3particl:28,chain:4,chain_id:19,chain_idx:[13,19],chain_idx_on:13,chain_idx_two:13,chain_index:[13,14,18,19],chain_nam:[19,21],chainhandl:[12,21],chainview:19,chakravarti:19,chakravarty1999:19,chanact:21,chanc:[4,21,25],chang:[0,3,4,12,17,18,20,21,25],change_frequ:18,chapter:[4,14],charact:[7,19],charg:[4,28],charmm27:17,check:[0,1,4,5,7,13,18,19,21,22,30],check_io:22,check_xml:4,checkbasetyp:22,checkfinalmodel:21,checkmagicnumb:22,checkout:4,checktypes:22,chemic:8,chi1:[28,30],chi2:[28,30],chi3:[28,30],chi4:[28,30],chi:[28,30],child:7,childclass:0,chmod:4,choos:18,chosen:[18,19],ciiipgatcpgdyan:21,clash:[13,14,15,17,18,21,23,26],clash_scor:[14,15],clash_thresh:21,clashscor:13,classic:27,clean:[1,4],cleanli:22,clear:13,clearenviron:13,cleargap:21,clip:7,clone:4,close:[4,10],closed_posit:18,closelargedelet:21,closer:[],closesmalldelet:21,closest:19,closur:[17,21],cluster:14,clustercandid:14,clutter:[0,4],cmake_support:[3,4],cmakecach:1,cmakelist:[0,1,3,4],cname:19,coars:4,code:[1,3,4,5,7],codetest:[3,4],coil:[16,19],collect:5,collid:31,collis:31,combin:[13,14,18,19,20,21,23,30],combined_scor:14,come:[3,4,5,7],command:[4,5,6],commandlin:7,comment:4,commerci:4,commit:4,common:[4,7],commonli:[10,21],compar:[4,15,19,30],comparison:[19,30],compat:[4,22],compil:[0,1,3,4,10,22,32],complain:0,complaint:4,complet:[4,18,19,21,26,30],complex:[4,28],compon:[8,13,19],compound:8,compress:5,comput:19,concept:4,condit:[4,20],conf:[1,4],confid:[13,14],config:[3,4],config_head:3,configur:[1,4,14,30],conflict:4,conform:[13,17,18,19,25,27,30],connect:[3,4,15,19,25],conop:[12,13,29],conquer:4,consecut:[13,20],consequ:26,conserv:[10,21],consid:[3,4,12,13,15,17,18,19,20,21,24,27,30],consider_all_nod:25,consider_hbond:[26,31],consider_hydrogen:28,consist:[4,13,14,17,18,19,22,28,30],constraint:[7,13,17,18,19],constraintscor:13,construct:22,constructbackboneframeresidu:[24,26],constructframeresidu:24,constructfrmrotam:28,constructfrmrotamergroup:[26,28],constructor:[18,21,22,25,28],constructrrmrotam:28,constructrrmrotamergroup:28,constructsidechainframeresidu:24,contact:[13,18],contactscor:13,contain:[0,1,3,4,5,7,12,13,14,16,18,19,20,21,23,26,27,28,30],content:[4,9,11,14,15,19,26,32],contigu:22,continu:[0,17,21,26],contrast:24,contribut:3,control:[4,14,18,24,26,28,30,31],conveni:[4,10],convent:[0,29],converg:[14,17,18],convers:22,convert:[3,12,13,19,20,21,22,30],convert_module_data:3,convertbasetyp:22,cooler:[],cooling_factor:18,coord:15,coord_info:19,coordin:[12,14,15,16,17,19,21,26],coordinfo:19,cope:4,copi:[3,4,10,21],core:[4,5],correctli:21,correspond:[4,12,13,14,19,20,22,30],corrupt:13,could:[0,3,4,7,19,21],count:[13,18,21],countenclosedgap:21,countenclosedinsert:21,counterpart:13,coupl:[0,4,21],cours:4,coutsia:17,cover:[0,4,6,13,18,19],coverag:21,cparticl:28,cpp:3,cpr:[29,30],cpu:21,crambin:[15,18,19],crash:26,createalign:21,createentityfromview:26,createfromfrmlist:[25,26],createfromrrmlist:25,createfullview:21,createsequ:21,creation:17,criterion:18,criterium:14,croak:4,crucial:4,ctermin:12,cterminalclos:18,cterminu:12,current:[1,3,4,18,19,22,28],custom:[4,18,19,21,22,29],cutoff:[13,14,16,28],cycl:21,cyclic:[14,15,17],cyd:[29,30],cyh:[29,30],cystein:[23,26,29],d_bin:13,dai:5,damag:21,dare:3,dat:[19,22],data1:3,data2:3,data:[3,4],data_:22,data_gener:22,databas:[],databs:19,date:4,dbg:4,deactiv:31,dead:25,deal:21,debug:4,decent:8,decid:[4,13,17],decis:20,declar:[3,4],decod:7,decompos:25,decomposit:25,decreas:18,dedic:[3,4,21],def:[0,4],defin:[3,4],definem:4,degre:[12,19,20,27],delet:[4,21,28],deliv:[0,18,19,21],delta:31,delta_scor:18,demand:21,demonstr:19,denovo:[15,32],densiti:27,dep1:3,dep2:3,dep:3,dependency1:3,dependency2:3,depends_on:3,depth:19,deriv:[0,19,27],descend:21,descent:[14,15,17],describ:[3,5,7,9,13,14,17,19,21,22,26,30,32],describint:19,descript:[4,7,19,23,30],design:[0,27],desir:[10,18,21],despit:13,destroi:13,detail:[4,19,21],detect:5,determin:[5,13,14,18],deuterium:21,develop:4,deviat:[13,18,27,28,30],devot:6,dict:[3,14,18],dictionari:[3,7,8,19],did:[4,14,21],differ:[0,1,3,4,7,8,13,14,15,19,20,21,26,29,30,31],dihedr:[10,12,13,15,17,18,19,20,21,27,28,30,32],dihedral_angl:12,dihedral_bin:13,dihedral_idx:30,dihedral_pair:20,dimens:20,dir:[3,4],direct:[4,12,13,16,28],directli:[4,15,17,19,21,26,27,28,29,30],directori:[1,3],dirti:0,dirtyccdclos:18,disabl:[0,4],disable_doctest:1,disable_document:1,disable_linkcheck:1,discret:13,discuss:19,disk:[13,30],displai:[5,7],dist:13,dist_bin:13,dist_bin_s:19,dist_cutoff:13,distanc:[12,13,14,15,19,21,31],distinguish:[22,24],distribut:[0,4,13,18,19,20,22,27,30],disulfidscor:23,dive:[4,21],diverg:4,divers:19,dng:10,doc:[1,3,4],docstr:7,doctest:[1,4],document:1,doe:[0,3,4,5,7,8,12,13,19,21,22,25,27],doesn:[17,18,21,30],don:[1,15,21],done:[0,4,5,7,15,17,20,21,22],donor:13,dont_write_bytecod:0,dost_root:1,doubl:25,doubt:7,down:[7,12,15,18,19],draw:[12,18,20],drawback:4,drawn:[18,20],drawphigivenpsi:20,drawpsigivenphi:20,driven:4,drop:4,dssp:[13,19,21],dssp_state:13,due:[14,17,19,21,23,24,27],dump:[13,15,30,32],dunbrack:[17,23,27],dure:[0,17,22,24,30],dynam:30,e_thresh:21,each:[4,14,15,19,21,22],earlier:1,easi:[4,21],easier:[0,4,21],easili:[3,4,21],ebb_list:19,echo:4,edg:25,editor:0,educ:4,effect:[3,4],effici:[18,19],egg:19,eigen3_include_dir:1,eigen:1,either:[4,7,12,13,14,17,18,20,21,22,23,24,26,28,29,30],elabor:4,element:[0,12,13,14,22],elimin:25,els:[4,22],emerg:0,emploi:4,empti:[4,5,7,12,13,14,19,28],enabl:[0,5,8,28],enable_mm:1,enclos:21,encorc:13,encount:[18,21],end:[0,1,3,4,5,12,14,19,21,25],end_transl:3,endian:22,energi:[10,13,17,18,21,23,24,25,26,28,31],enforc:[14,15,18,19,21,25],enough:[4,19,21,22],ensur:[4,10,22],ent:21,enter:24,entiti:[4,12,14,21,26],entityhandl:[12,21,26],entityview:[13,20,21],entri:4,enumer:[4,15,19,25,26,28,29],env:[4,10,13,21],environ:[0,4,13,14,15,18,32],epsilon:25,equal:[13,18],equidist:[13,30],equival:21,error:[5,22],esenti:[],estim:[13,18,21,27],etc:[0,4],evalu:[3,4],even:[1,4,21,25],eventu:7,ever:[4,18],everi:[0,4,12,13,14,16,17,18,19,20,21,25,30],everybodi:4,everyth:4,evolut:19,exact:[13,22],exactli:[1,15,19,21,23,29],exampl:[1,4,5,7,10],example_reconstruct:26,exce:[13,19],exceed:21,except:[4,21],exclud:4,exclus:[0,4],exisit:[],exist:[0,1,3,4,5,7,17,19,21,22,24,27,28,29,30],exit:[0,5,7],exit_cod:0,exit_statu:5,exot:4,exp:18,expect:[0,13,19,21,28],expens:19,experiment:21,explain:[0,4],explan:4,exponenti:18,exponentialcool:18,ext:5,extend:[3,4],extendatcterm:21,extendatnterm:21,extended_search:[14,19,21],extens:[5,7,21],extension_penalti:21,extent:19,extern:[3,4,19],extra:[4,22],extract:[12,13,14,17,18,19,20,21,24,26,27,28],extract_burial_statu:19,extractstatist:20,f_i:19,f_idx:13,factor:[18,27,28,31],fail:[0,4,5,14,21],failur:[4,5,30],fall:[17,25],fallback:30,fals:[0,4,5,7,12,14,16,18,19,21,24,25,26,28],far:[14,21],fast:[13,19,20,22,30],fasta:[7,21],faster:[16,17,19,21],fastest:21,favourit:0,fed:[3,4],fedora:4,feed:[3,14],feel:4,fellow:4,fetch:4,few:[1,4,21,22],field:[22,30],figur:4,file:[1,3,4],filecheck:4,fileexist:5,fileextens:5,filegzip:5,filenam:[4,5,7,13,14,19,20,22,27,30],fill:[3,4,7,14,19,21],fillfromdatabas:[14,15,21],fillfrommontecarlosampl:[14,21],fillloopsbydatabas:21,fillloopsbymontecarlo:21,filter:[],filtercandid:21,filtercandidateswithsc:21,final_model:21,find:[3,4],fine:4,fire:0,first:[0,4,7,10,13,14,17,18,19,20,21,23,26,28,30],fit:[12,17,18,19],fix:[4,5,22,26],fix_cterm:17,fix_nterm:17,flag1:3,flag2:3,flag:[3,4,5,7,12,13,24,25,26,28],fletcher:21,flexibl:[23,26,27,28,31],flip:30,flush:[0,4],fold:19,folder:[1,3,4,10,22],follow:[0,3,4,5,7,10,13,15,19,21,22,25,26,28,29,30],fontsiz:20,forbidden:4,forc:17,forcefield:17,forg:4,forget:[0,4],form:[14,16,19,21,25,28,30],formal:[14,17,30],format:[4,7,19,27],formatt:4,forward:4,found:[0,3,4,5,7,14,15,17,18,19,21,25,26,30],foundat:0,four:18,fourth:28,fraction:[17,18,19],frag_db:[14,15,19,22],frag_length:19,frag_map:19,frag_po:19,frag_residu:19,frag_seq:19,frag_siz:19,fragdb:[14,15,16,19,21,22],fragger:[18,19,21],fragger_handl:21,fragger_map:19,fraggerhandl:[19,21],fraggermap:19,fragment:[],fragment_db:21,fragment_info:19,fragment_length:19,fragmentinfo:19,fragments_per_posit:19,fragmentsampl:18,frame:4,frame_residu:[24,26],frameresidu:24,framework:4,free:[4,29,30],frequenc:[18,19],frm:26,frm_delta1_arg:31,frm_delta1_asn:31,frm_delta1_asp:31,frm_delta1_ci:31,frm_delta1_gln:31,frm_delta1_glu:31,frm_delta1_hi:31,frm_delta1_il:31,frm_delta1_leu:31,frm_delta1_li:31,frm_delta1_met:31,frm_delta1_ph:31,frm_delta1_pro:31,frm_delta1_s:31,frm_delta1_thr:31,frm_delta1_trp:31,frm_delta1_tyr:31,frm_delta1_v:31,frm_delta2_arg:31,frm_delta2_asn:31,frm_delta2_asp:31,frm_delta2_gln:31,frm_delta2_glu:31,frm_delta2_hi:31,frm_delta2_il:31,frm_delta2_leu:31,frm_delta2_li:31,frm_delta2_met:31,frm_delta2_ph:31,frm_delta2_pro:31,frm_delta2_s:31,frm_delta2_thr:31,frm_delta2_trp:31,frm_delta2_tyr:31,frm_delta3_arg:31,frm_delta3_gln:31,frm_delta3_glu:31,frm_delta3_li:31,frm_delta3_met:31,frm_delta3_tyr:31,frm_delta4_arg:31,frm_delta4_li:31,frm_t_arg:31,frm_t_asn:31,frm_t_asp:31,frm_t_cy:31,frm_t_gln:31,frm_t_glu:31,frm_t_hi:31,frm_t_ile:31,frm_t_leu:31,frm_t_ly:31,frm_t_met:31,frm_t_phe:31,frm_t_pro:31,frm_t_ser:31,frm_t_thr:31,frm_t_trp:31,frm_t_tyr:31,frm_t_val:31,frmrotam:[23,28],frmrotamergroup:[24,25,28],from:[0,1,3,4,5,7,10,12,13,14,15,18,19,20,21,22,24,25,26,27,28,29,30],fromhhm:14,fromhoriz:14,fromresidu:30,front:[0,4,5],fstream:22,fulfil:[19,30],full:4,full_seq:21,fullgapextend:21,fulli:[4,12,19,21],functions_specific_to_your_act:4,fundament:[13,19,20,22,30],funni:[1,4],further:[21,22,31],furthermor:22,futur:19,gamma:[13,23],gamma_bin:13,gap:10,gapextend:21,gapfre:19,gather:[3,4,6,12,19,26,28,30],gciiipgatcpgdyan:21,gener:[0,1,4,10,13,14,15,16,17,18,19,20,21,22,27,29,30,32],generatestructureprofil:19,geom:[12,23,24,28],geometr:[],geometri:[14,19],get:[1,4],getangl:26,getangularbins:19,getatomcount:4,getavgcbetascor:14,getavgclashscor:14,getavgcombinedscor:14,getavghbondscor:14,getavgpackingscor:14,getavgreducedscor:14,getavgssagreementscor:14,getavgtorsionscor:14,getbackbonelist:19,getbins:20,getbinsperdimens:20,getchain:21,getchainindex:21,getchainnam:21,getcharg:28,getconfid:14,getcoordindex:19,getcoordinfo:19,getdihedralangl:19,getdistbins:19,getdsspstat:19,getfragmentinfo:19,getframeenergi:28,gethistogramindex:[12,20],gethistogramindic:20,getinternalenergi:28,getinternalenergyprefactor:28,getlength:21,getlist:19,getnam:[26,28],getnumactiveedg:25,getnumactivenod:25,getnumb:15,getnumcoord:19,getnumedg:25,getnumfrag:19,getnumnod:25,getnumstempair:19,getnumsubrotam:28,getomegators:12,getparticletyp:28,getphiprobabilitygivenpsi:20,getphitors:[12,26],getpo:28,getpredict:14,getprob:[20,28],getpsiprobabilitygivenphi:20,getpsitors:[12,26],getr:21,getresiduedepth:19,getringpunch:21,getscor:[18,19],getselfenergi:28,getsequ:[12,19],getsequenceprofil:19,getsolventaccessibilitit:19,getstructureprofil:19,getsubrotamerassoci:28,getsubrotamerdefinit:28,gettemperatur:[18,28],gettransform:12,gettransformedcopi:28,getversionnumb:22,ggg:21,gggaggg:21,gggggggggggggggggggg:21,git:[1,3],gitignor:4,give:[3,4,15,18,28],given:[0,3,5,7,12,13,14,15,17,18,19,20,21,22,23,25,26,28,30],gln:29,global:[8,22],glu:[28,29,30],glutam:29,glutamin:29,gly:[21,26,29],glycin:29,goal:0,gobbl:7,goe:[1,4,30],goldfarb:21,good:[3,4,19,21],got:1,grain:4,graph:[],greedi:14,grep:1,group:3,group_definit:[13,20],group_id_idx:13,guarante:[19,22],gui:[4,20],guid:17,guidelin:[4,22],gzip:[5,7],hand:[1,3,7],handler:19,happen:[0,4,18,21,28],hasfraglength:19,hash:19,hasringpunch:21,hb_alpha_bin:13,hb_beta_bin:13,hb_d_bin:13,hb_gamma_bin:13,hb_max_alpha:13,hb_max_beta:13,hb_max_d:13,hb_max_gamma:13,hb_min_alpha:13,hb_min_beta:13,hb_min_d:13,hb_min_gamma:13,hbond:[13,14,18,24,26,28,29,31],hbond_scor:14,hbondscor:13,headach:4,header1:3,header2:3,header3:3,header4:3,header:[1,3,4],header_output_dir:3,headlin:4,heavili:[19,26,28],helic:[12,13,16,19,21,27,28],helix:[10,12,18,26],hello:22,hello_world:4,hellyeah:10,help:[0,1,3,4,7,10,13,21],helpactiontest:0,helper:3,hen:19,henc:[4,13,19,20,21,22,30],here:[0,1,3,4,5,7,10,18,19,20,21,22,31],hhm:[14,19],hhsearch:[14,19],hhsuit:19,hide:4,hierarch:14,hierarchi:8,high:[4,21],higher:1,highest:8,highli:[1,4,19],hint:7,histidin:29,histogram:[18,20],histori:4,hit:[0,4,17,20],hmm:19,home:3,homolog:[6,10,19,21],honor:21,honour:21,horiz:14,host:[3,4],hotfix:4,hous:4,how:[],hparticl:28,hpp:22,hsd:[28,29,30],hse:[28,29,30],html:[1,4],http:4,hydrogen:[13,19,21,24,26,28,31],hyphen:0,id_:22,idea:[0,4,15,19,21],ideal:[12,13,17],ident:[13,19,20,30],identifi:[7,13,19,30],idx:[12,13,14,19],iff:[19,21],ifstream:22,ignor:21,illustr:19,imagin:4,imaginari:0,immedi:[0,4,8],implement:[4,17,21,22,23,25,26,29],implicit:1,improv:[16,23,27],in_dir:3,in_fil:4,in_path:3,in_stream:22,in_stream_:22,incl:[19,21],includ:[1,4,5,10,14,16,19,21,22,26,28,31],include_ligand:21,incomplet:[21,27],inconsist:[12,13,14,17,21],inconveni:4,increas:[14,17,21],independ:27,index:[4,11,12,13,14,17,18,19,20,21,24,28,30],indic:[5,7],inf:[15,25],influenc:[7,31],info:19,inform:[4,7,12,13,14,15,16,19,21],inherit:0,init:4,init_bb_list:18,init_frag:18,initi:[2,12,13,14,15,17,18,19,21,25,28,30],initial_bb:14,initial_epsilon:25,initialis:0,inlin:[4,22],input:[0,7,10,14,17,18,19,20,21,23,26,27,28],insert:[12,15,18,21],insertinto:[12,15],insid:[0,3,7],insight:4,inspir:17,instal:[1,4],instanc:[2,4,7,16,21,22,28],instead:[0,1,3,4,5,18,19,21,28],int16_t:22,int32_t:22,int_32_t:22,intend:[0,4,14,18,28],interact:4,intercept:[14,18],interest:[0,18,19,22,28,30],interfac:[3,4],intermedi:4,intern:[0,3,4,13,14,16,17,18,19,20,21,22,25,26,28,31],internal_e_prefactor_arg:31,internal_e_prefactor_asn:31,internal_e_prefactor_asp:31,internal_e_prefactor_ci:31,internal_e_prefactor_gln:31,internal_e_prefactor_glu:31,internal_e_prefactor_hi:31,internal_e_prefactor_il:31,internal_e_prefactor_leu:31,internal_e_prefactor_li:31,internal_e_prefactor_met:31,internal_e_prefactor_ph:31,internal_e_prefactor_pro:31,internal_e_prefactor_s:31,internal_e_prefactor_thr:31,internal_e_prefactor_trp:31,internal_e_prefactor_tyr:31,internal_e_prefactor_v:31,internet:4,interpol:30,interpret:[4,5],intervent:4,introduc:[0,3,4,17,21],invalid:[13,14,17,18,19,21,24,28,29,30],invok:[1,3,4,8],involv:4,iostream:22,isctermin:21,ishbondacceptor:28,ishbonddonor:28,isntermin:21,isoleucin:29,issimilar:30,issourc:22,istermin:21,isvalid:26,item:[0,4,12,13,19,21],iter:[12,14,17,18,19,20,21,25],itself:[3,4,13,14,18,22,26],job:[4,19,21],join:[4,15,18,19],jone:[19,28,31],jones1999:19,json:7,just:[0,1,4,7,8,13,14,19,21],kabsch1983:19,kabsch:19,keep:[0,3,4,7,14,21,26],keep_non_converg:14,keep_sidechain:[4,26],kei:[7,14,18,19],kept:[17,24,26],kernel:27,keyword:20,kic:[],kicclos:18,kick:7,kind:[0,4],kinemat:17,know:[1,30],known:[3,5],kortemm:17,krivov2009:[26,27],krivov:27,kwarg:0,l_e:28,lab:27,label:4,lack:21,languag:3,lapack:1,lapack_lapack_librari:1,lapack_librari:3,larg:[19,20,21],larger:[15,19],last:[0,3,12,13,17,18,19,21,27,31],last_psi:12,later:[0,4,13],latest:1,latter:[4,21],launcher:[3,4],layout:[13,19,20,22,28,30],lbfg:21,lead:[4,5,12,13,14,17,27],least:[1,3,4,12,21,25],leav:0,left:5,legaci:21,legal:4,len:[12,19,21,26],length:[7,13,14,16,17,19,20,21,22],lennard:[28,31],less:[4,13,14,16,19,20,21,30,31],let:[0,4,12,15,19,26],letter:[12,13,18,19,20,29],leu:29,leucin:29,level:[1,4,8,21],lib64:4,lib:31,libari:27,libexec:[3,4],libpromod3_nam:3,librari:[1,3,4],library1:3,library2:3,licenc:27,life:4,ligand:[21,24],like:[0,3,4,7,21,22,27,28],limit:[7,17,19,21],line:[4,6],linear:[14,18,19],linear_weight:14,linearscor:18,link:[1,3,4,19],link_cmd:3,linkcheck:[1,4],linker:[3,21],linker_length:21,list:[0,1,3,4,5,7,10,12,13,14,17,18,19,20,21,22,24,25,26,28,30],literalinclud:4,littl:[3,4,22],live:[3,4],load:7,load_frequ:[16,19],loadalign:21,loadbackboneloopscor:[15,16,18],loadbb:19,loadcach:19,loaddunbracklib:[26,27],loadfragdb:[15,16,21],loadpdb:[4,15,18,19,21,26],loadpenultimatelib:27,loadport:[13,19,20,22,30],loadsequenceprofil:19,loadstructuredb:[15,16,19,21],loadtorsionsampl:[12,16,18,20],loadtorsionsamplercoil:[16,21],loadtorsionsamplerextend:16,loadtorsionsamplerhel:16,locat:[1,3,12,13,15,21],log:[4,5,28],lone:28,lone_pair:28,longest:19,look:[4,5,12,15,32],loop:[4,10],loop_candid:[14,15],loop_length:19,loop_main:4,loop_seq:15,loopcandid:[14,15,21],loss:4,lost:[0,4,13],lot:[0,4,7],lovel:27,lovell2000:27,low:[0,4],lower:[18,21],lowest:[18,28],lowest_energy_conform:18,lysin:29,machin:[13,19,20,22,30],macro:[3,4],made:[3,30],magic:[4,22],mai:[0,1,3,4,5,7,21],main:[21,22,30],mainli:[18,27,28],maintain:4,major:4,makefil:[1,4],makestat:30,malici:4,man:[1,4],manag:[3,4],mandatori:14,mandel:17,mandell2009:17,mani:[5,7,13,17,19,20,21,30],manipul:[12,15],manner:[4,13,18,25],manual:[0,1,4,13,14,18,19,22],map:19,mar:16,mark:[3,7,24],markup:4,master:4,mat4:12,match:[3,14,15,17,18,19,20,21],materi:[0,4],mathemat:[14,17],matplotlib:20,matric:19,matrix:[12,19],matter:[3,28],max:[13,21,25,30,31],max_complec:25,max_complex:25,max_count:13,max_db_loop_len:[],max_dev:18,max_dist:[13,14],max_extens:21,max_iter:[14,21],max_iter_lbfg:21,max_iter_sd:21,max_length:21,max_loops_to_search:21,max_res_extens:21,max_step:17,maxfraglength:19,maxim:[13,14,16,17,18,19,21],maximum:[13,14,17,18],mc_closer:18,mc_cooler:18,mc_num_loop:21,mc_sampler:18,mc_scorer:18,mc_step:21,mean:[3,4,7,21],meaning:19,meant:[10,19,21,25],mechan:[10,17,21],medl:21,member:[4,7,14],memori:[13,16,19,20,21,22,30],mention:[0,1],merg:[4,14,21,28],merge_dist:21,mergegap:21,mergegapsbydist:21,mess:4,messi:4,met:29,methionin:[21,29],method:[0,7,13,17,19,20,21,22,23,25],metropoli:[14,18],mhandl:21,middl:4,might:[17,19,28],min:13,min_candid:15,min_dist:13,min_loops_requir:21,min_scor:15,mincadist:12,mind:[0,4],minim:[10,12,13,14,15,17,19,21,23,25],minimizemodelenergi:21,minimum:12,mirror:22,mismatch:13,miss:[5,21],mix:3,mkdir:[1,4],mmcif:5,mod:4,mode:[0,30],model:[4,6],modellinghandl:21,modeltermini:21,modif:21,modifi:[4,12,14,21],modified_crambin:15,modul:[],module_data:3,mol:[4,10,12,13,14,17,18,19,20,21,24,26,28,30],molecular:[10,17,19,21],moment:4,monitor:0,monolith:4,mont:[],montecarloloopsampl:[],mood:4,more:[0,1,3,4,7,21,25,28,31],most:[3,4,12,13,17,20,21,24,27,31],mostli:[3,4],move:[4,14,17,18,21],msg:5,msgerrorandexit:5,msm:19,much:[4,19,21],multipl:[1,3,7,21],multipli:18,my_db:19,myclass:22,myclassptr:22,n_coord:12,n_num:21,n_po:[13,24,28],n_stem:[14,15,17,18,19,21],n_stem_phi:18,n_ter:[17,24],n_terminal_length:18,name:[0,3,4,5,7,13,14,18,19,20,21,27,28,29,30],name_pymod:3,namespac:[7,22],nan:[28,30],nat:17,nativ:22,necessari:[12,13,18,19],need:[0,1,3,4,5,7,8,13,17,19,20,21,22],need_config_head:3,neg:[0,13],neglect:[24,28],neglect_size_on:14,neighbor:21,neighbour:[21,30],never:[4,7,13,22],nevertheless:4,new_res_nam:28,newli:18,next:[0,4,12,17,20,21,22],next_aa:18,nice:4,nitrogen:[12,24,28],nobodi:0,node:25,non:[3,4,22],none:[7,19,21,26],nonredund:19,nonrotamer:27,nonzero:[25,30],norm:13,normal:[13,28],normalization_factor:28,notabl:19,note:[4,7,14,17,18,19,21,22,24,26,29],noth:[3,4,18,28],notic:[0,3,4],nov:1,novel:19,novo:18,now:[4,10,12,19],nparticl:28,nterminalclos:18,num:19,num_frag:[19,21],num_gap_extens:21,num_loop:14,num_residu:13,number:[0,12,13,14,16,17,18,19,20,21,22,24,25,28,30],numpi:[18,20],o_coord:12,o_po:24,object:7,observ:[17,19,25],obtain:[10,21],obviou:4,occupi:24,occur:[13,28],ocparticl:28,off:[0,4,21],offend:21,offer:[16,24,28],offset:[19,21],ofstream:22,often:[4,5,7,17],olc:12,old:21,olson:19,omega:[12,13],onc:4,one_letter_cod:[12,15,18,19],onli:[0,3,4,5,7,8,13,14,18,19,21,22,24,25,26,27],onto:[0,12,19],oparticl:28,open:[13,19,20,22,30],openmm:1,openstructur:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],oper:[4,10,19,25],opt:[4,5,7],optim:[1,13,19,20,30],optimis:4,option:[1,7,17,21,30],order:[7,13,19,21,22],org:4,organ:[19,30],orient:[13,17],origin:[4,7,18,21],ost:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],ost_double_precis:1,ost_librari:3,ost_root:[1,4],other:[0,1,3,4,7,12,13,14,21,28,30,31],otherwis:[0,3,4,12,13,18,21,28],our:[3,4,15,19],out:[0,1,3,4,19,20,21,26,30],out_path:3,out_stream:22,out_stream_:22,output_dir:3,outsid:[4,13],over:[1,3,4,7,13,19],overal:[15,18,25],overlap:18,overli:4,overload:22,overridden:3,overview:[4,26],own:3,oxygen:[12,24,28],pack:[13,14],packag:[3,4],packing_scor:14,pad:22,page:[1,4,11,26],pai:0,pair:[13,14,17,18,19,20,21,22,28,30],pairwis:[12,13,14,23,25,28],pairwiseenergi:28,paper:[23,26],paragraph:[0,4],parallel:19,param:[],paramet:[0,3,5,7,8,12,13,14,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31],parameter_index:19,parametr:[13,24,28],parent:21,pars:[5,6],parse_arg:7,parser:6,part:[0,4,10,18,21,24,25,26],partial:21,particip:26,particl:[],particular:[4,14,17,18,19,28,30],partner:[13,28],pass:[4,7,15,17,18,21],past:[4,21],path:[0,1,3,4,5,10,19,20],path_to_chemlib:8,pattern:19,pdb:[4,5,10,12,15,16,18,19,21,26],pdb_id:19,penal:21,penalti:21,penultim:27,penultimatelib:22,peopl:4,pep:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],peptid:[15,19,26],per:[3,4,6,18,19,20,21,28,31],perfect:4,perfectli:4,perform:[4,10,12,14,17,18,19,21,22,23,25],permiss:4,permut:25,phe:[29,30],phenylalanin:29,phi:[12,13,17,18,19,20,24,26,28,30],phi_bin:[13,30],phi_handl:26,phipsisampl:18,phosphoserin:21,phrase:4,pick:18,pictur:4,piec:4,pivot:[14,17,18],pivot_on:[14,17],pivot_thre:[14,17],pivot_two:[14,17],place:[0,3,4,5,7],placehold:14,plane:21,plausibl:13,pleas:[4,17,19],plenti:21,plot:20,plt:20,plu:[4,7,8,28],pm3_csc:4,pm3_openmm_cpu_thread:21,pm3argpars:[5,6],pm3argumentpars:[5,7],pm3optionsnamespac:7,pm_action:[0,3,4],pm_action_init:4,pm_bin:0,png:20,point:[1,4,7,8,13,15,18,19,21,30],pointer:[1,22],polar:[28,31],polar_direct:28,pop:4,popul:[1,4],port_str_db:19,portabl:3,portable_binary_seri:22,portable_fil:3,portablebinarydatasink:22,portablebinarydatasourc:22,pos_end:19,pos_start:19,posit:[12,13,14,15,16,17,18,19,20,21,23,24,25,28],possibl:[4,7,10,13,14,16,17,18,19,20,21,22,23,24,25,26,28,29,31],post:7,potenti:[13,15,16,19,21,22],practic:[3,4,19],pre:[4,13],pre_commit:4,precis:[14,21],precomput:[15,16,32],pred:13,predefin:[3,10],predict:[13,14,19,23,27],prefactor:[28,31],prefer:[1,3,13,19,20,30],prefix:[0,3,4,5,7],prepar:[4,21],present:[12,17,24,28,30],preserv:21,prev_aa:18,prevent:[0,4],previous:[13,15,19,28],principl:18,print:[0,1,12,19,21],printstatist:19,privat:[0,22],pro:[20,29,30],probabilist:19,probability_cutoff:31,probabl:[3,4,14,17,18,19,20,27,28,30,31],problem:[4,7,17,18,19,21,25,27],process:[0,4,7,13,17,18,22,24,30],produc:[0,1,3,4,14,19,21],product:[0,2,4],prof:19,prof_dir:19,prof_path:19,profil:[14,16,19,21],profiledb:19,profilehandl:19,prog:7,program:[3,4,6],project:[3,4],prolin:[13,21,29],promod3:[],promod3_mod:3,promod3_nam:3,promod3_name_head:3,promod3_root:4,promod3_unittest:[0,3,4],promot:4,propag:[4,12],proper:4,properli:[0,13,21,25],properti:30,propos:[14,17,18,21,23],proposed_posit:18,proposestep:18,prot:[4,18,19,26],prot_rec:4,protein:10,proton:[28,29,30],provid:[0,1,3,4,7,12,13,14,15,17,18,19,20,21,22,24,26,27,28,30],prune:25,pseudo:[13,18,21,31],psi:[12,13,17,18,19,20,26,28,30],psi_bin:[13,30],psi_handl:26,psipr:[],psipred_confid:13,psipred_pr:19,psipred_predict:19,psipred_st:13,psipredpredict:[13,14,19],pull:4,punch:0,purpos:[4,30],push:4,pushverbositylevel:7,put:[0,3,4,5,7,13,19,20,21,30],py_run:[0,3,4],pyc:0,pylint:4,pylintrc:4,pymod:[3,4],pyplot:20,pytest:4,python2:4,python:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],python_root:1,pythonpath:4,qmean:1,qualiti:21,queri:[19,28,30],querylib:30,question:20,quickli:[4,17],quit:[4,7],rachovski:16,rackovski:16,radian:20,radii:[21,31],radiu:[13,21,31],rais:[7,12,13,14,17,18,19,20,21,23,24,28,30],random:[12,14,16,17,18,20],random_se:14,randomized_frag:12,randomli:[17,18,20],rang:[12,13,14,17,18,19,20,21,30],rapid:23,rare:4,rather:[4,5,7,13,30],raw:[10,13,19,20,21,22,30],rawmodel:4,reach:[17,21,28],read:[4,5,12,13,19,20,21,22,27,30],readabl:[4,30],readdunbrackfil:27,reader:[4,10],readi:[1,30],real:[4,7,22],realli:[0,1,4,5,13],reappear:4,reason:[4,18,19,24],rebas:4,rebuild:[1,4],recalcul:[12,20],recent:4,recoginz:29,recognis:[0,4],recognit:19,recommend:[1,4,21],reconstruct:[4,10],reconstructcbetaposit:12,reconstructoxygenposit:12,reconstructtest:4,record:0,reduc:[13,14,18,19],reduced_scor:14,reducedscor:13,redund:16,ref_backbon:19,ref_fil:4,refer:[0,3,4],referenc:4,refresh:14,regard:[17,23],region:[17,18,21,24],regist:[3,4],regress:27,reiniti:13,reinterpret_cast:22,reject:[14,17,18],rel:[3,13,14,17],relat:[3,4,7,13,14,19,22,31],relax:[],relev:[1,3],remain:[13,18],rememb:[0,18],remodel:15,remodel_cterminal_o:12,remot:[15,18,19,26],remov:[1,14,21,25,26],removeterminalgap:21,renumb:21,replac:[12,18],replacefrag:12,report:[0,4,21],repositori:[0,3,4],repres:[13,14,15,17,19,20,21,23,24,25,26,28,32],represent:[12,13,15,19,20,22,28,30],reproduc:21,request:[27,30],requir:[1,4,12,13,15,16,17,19,20,21,22,24,26,28,29,30],reread:19,resembl:4,reserv:5,reset:[13,18],residehandl:28,residue_depth:19,residue_index:[24,28],residuehandl:[12,14,17,18,19,21,24,28,30],resiz:22,resnum:[12,13,15,21],resnum_on:13,resnum_two:13,resolv:[4,17],resort:21,respons:4,rest:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],restrict:[4,21],restructuredtext:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],result:[1,4,13,14,18,20,21,23,25,30,31],reus:21,review:4,reviv:4,rewrit:0,richardson:27,right:[0,1,4,7],rigid:[17,18,23,24,25,26,28,30],ring_punch_detect:21,rmsd:[12,14,17,19],rmsd_cutoff:[14,17,19],rmsd_thresh:19,rmsd_threshold:19,robot:17,role:7,root:[1,3,4],rosetta:13,rot_group:26,rot_lib:28,rotam:[],rotamer_group:[24,25,26],rotamer_id:[26,28],rotamer_librari:26,rotamer_model:26,rotamer_on:23,rotamer_two:23,rotamergroup:28,rotamerid:[],rotamerlib:[22,26,27,28,30],rotamerlibentri:30,rotamerset:[24,26,28,31],rotat:12,rotatearoundomegators:12,rotatearoundphipsitors:12,rotatearoundphitors:12,rotatearoundpsitors:12,roughli:16,routin:0,rrm:26,rrmrotam:[23,28],rrmrotamergroup:[24,25,28],rst1:3,rst2:3,rst:[3,4],rule:4,runact:0,runexitstatustest:0,runnabl:4,runner:0,runtest:[0,4],runtimeerror:[12,13,14,17,18,19,20,21,23,24,27,28,30],runtimeexcept:20,said:3,same:[0,1,3,7,13,17,18,19,21,22,24,28,30],samiti:21,sampl:4,sample_polar_hydrogen:[28,31],sampled_frag:18,samplemontecarlo:18,sampler:[],sampling_start_index:18,sander:19,sanner1996:19,sanner:19,satisfi:[13,29],save:[4,12,13,15,18,19,20,22,30],savebb:19,savecach:19,savefig:20,savepdb:[10,12,15,18,19,21,26],saveport:[13,19,20,22,30],scatter:20,scheme:[0,4,7,18,21],sci:[17,23],scondari:21,score_vari:21,scorer:[],scoringgapextend:21,scratch:28,scriptnam:5,scriptpath:4,scwrl4:[26,27,28],seamlessli:4,search:[1,4,11,13,14,15,19,21,26,28],searchdb:19,second:[13,14,17,21,23,28],secondari:[13,14,19],secondli:4,section:[0,3,9,32],see:[0,4,5,7,10,13,14,18,19,21,22,31],seed:[14,16,17,18,20],seem:4,segment:12,select:[17,18,19,26],selenium:21,self:[0,4,25,28],self_energi:28,send:5,sens:[],sensibl:21,separ:[0,4,13,20,21,23],seq:[13,14,19,21],seq_sep:13,seq_tpl:21,seq_trg:21,seqid:19,seqr:[13,15,18,19,21],seqsim:19,sequenc:[7,10],sequence_profile_weight:19,sequencehandl:[13,21],sequencelist:[13,21],sequenceprofil:19,sequenti:[12,21],ser:[28,29,31],serial:[19,22],serializ:22,serin:29,serv:[0,7,18,19],servic:4,set:[1,3,4,5,7],setcbetaenergi:13,setcbetapotentialparamet:13,setcbpackingenergi:13,setcbpackingpotentialparamet:13,setenviron:[13,15,18],setframeenergi:[24,26,28],sethbondenergi:13,sethbondpotentialparamet:13,setinternalenergi:28,setinternalenergyprefactor:28,setinterpol:30,setomegators:12,setphipsitors:12,setphitors:12,setpolardirect:28,setprob:28,setpsipredpredict:13,setpsitors:12,setreducedenergi:13,setreducedpotentialparamet:13,setsequ:12,setsequenceoffset:21,setssagreementparamet:13,setssagreementscor:13,setstructureprofil:19,settemperatur:28,settorsionenergi:13,settorsionpotentialparamet:13,setup:[4,17,18,21],setupbackbonescor:21,sever:[1,4,7],shake:18,shanno:21,shapovalov2011:27,shapovalov:27,shared_ptr:22,shebang:4,sheet:[21,27],shelenkov:23,shell:[0,1,4,5],shift:21,shiftctermin:21,shiftextens:21,shorter:21,shortest:14,shortli:4,should:[0,3,4,5,7,10,12,13,14,15,17,18,19,20,21,22,24,25,26,28],show:[0,4,26],showcas:[0,20],shown:[4,21],side:[4,21,23,27],sidechain:[4,10,22],sidechain_pymod:4,sidechain_rst:4,sidechain_test_data:4,sidechain_test_orig:26,sidechain_test_rec:26,sidechain_unit_test:4,sidechainparticl:28,sig1:[28,30],sig2:[28,30],sig3:[28,30],sig4:[28,30],silent:0,similar:[0,1,4,13,19,30],similardihedr:30,similarli:1,simpl:[12,13,18,19,23,24,30],simplest:[4,21,26],simpli:[12,13,15,18,21,29,30],simplif:7,simplifi:19,simul:[14,18],sinc:[0,1,3,4,5,13,19,20,27,29],singl:[3,4,13,14,17,18,19,21,24,25,27,28],sink:22,sit:4,site:4,size:[12,13,14,17,18,19,20,22],sizeof:22,skip:[0,4,19,21],slow:[13,19,20,22,30],small:[4,17,19,21],smaller:[13,17,19,20,30,31],smallest:[],smallish:[1,4],smart:4,smng:2,smooth:27,soding2005:19,softsampl:18,softwar:4,sol:26,sole:[0,4],soli:16,solut:4,solv:[4,25,26],solvent:19,some:[0,1,3,4,7,18,19,21,22,24,26,28,30],somedata:22,somehow:14,someth:[0,4,5,19],sometim:4,somewher:[3,19],soon:[17,26,30],sort:[0,3,30],sound:4,sourc:[0,1,3,4,5,7,8,15,19,21,22,26,30],source1:[3,4],source2:[3,4],source3:3,source4:3,span:21,sparticl:28,spawn:[0,4],spdbv:21,spdbv_style:21,special:[0,1,3,4,29,30],specif:[0,4,13,18,19,20,27,30],specifi:[1,3,12,14,20,28,30],specimen:5,speed:21,spehner:19,spend:4,sphinx:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],spit:21,sport:4,squar:19,src:4,src_db:19,ss_agreement:[14,18],ss_agreement_scor:14,ss_agreement_weight:19,ssagre:19,ssagreement:[13,14],ssagreementscor:13,sstream:22,stabil:19,stabl:4,stack:4,stage:[1,3],stai:[0,4,13],standard:[1,4,6,7,13,20,22,24,27,28,30],start:[1,3],start_resnum:[12,13,14,18],start_temperatur:18,starter:0,stash:4,state:[0,1,4,13,19,23,28,29,30],statist:[15,16,19],statu:[0,4],std:22,stderr:0,stdout:0,steadili:18,steepest:[17,21],stem:[12,14,15,17,18,19,21],step:[4,10,14,17,18,19,21,27],stereochem:21,steric:30,still:[4,21,22],stop:[0,4,17,21],stop_criterion:17,storabl:19,store:[0,4,10,12,13,14,18,19,20,21,22,30],stori:4,str:[0,5,7,8,12,13,14,17,18,19,20,21,22,26,28,29,30],str_len:22,straight:4,strategi:30,stream:22,strict:4,string:[5,7,13,19,20,21,22],stringstream:22,strip:[21,28],struct:22,structral:13,structural_db:14,structuralgap:21,structuralgaplist:21,structure_db:[15,19,21,22],structure_dir:19,structure_path:19,structure_profile_weight:19,structuredb:[14,15,16,19,21,22],structureprofil:19,style:21,sub:[4,14,17],sub_frag:12,subdir:4,subfold:4,subject:4,submodul:4,submodule1:4,subrotam:[23,28,31],subsequ:[13,21],subst:19,subst_matrix:19,substitut:19,substweightmatrix:19,subtre:[3,4],succeed:21,success:[5,18,25],suffix:5,suggest:4,suit:[0,4,14],sulfur:[23,28],sum:[13,15,21,28,31],superpos:[12,17,18,19],superpose_stem:12,superposed_rmsd:12,superposeonto:12,superposit:[14,18],supervis:0,supos:19,support:[0,4,5,13,17,19,20,30],suppos:4,sure:[1,4,7,19],surf:19,surfac:19,surfacehandl:19,surround:[13,19],swiss:21,symmetr:30,system:[0,1,3,4],t_sampler:20,tail:12,tailor:21,take:[4,18,19,20,21,22,25,26],taken:[21,24,28],talk:0,target:[0,1,3,4,7,10,12,13,17,18,19,20,21,30],target_sequ:19,task:[4,17,21,22],technic:[19,24,31],tell:[0,4,5,7,19],temperatur:[14,18,28,31],templat:[0,7,10,21,22],temporari:19,temporarili:4,term:[4,13,19,28,29,30,31],termin:[0,5,10,12,14,17,18,21,24],terminal_sequ:18,termini:[18,21],terminu:[18,19,21],test_:4,test_action_:0,test_action_do_awesom:0,test_action_help:0,test_awesome_featur:4,test_check_io:22,test_cod:4,test_doctest:4,test_foo:3,test_portable_binari:22,test_reconstruct:4,test_sidechain:4,test_submodule1:4,test_suite_:3,test_suite_your_module_run:4,test_your_modul:4,testcas:[0,4],testcasenam:4,testexit0:0,testpmexist:0,testreconstruct:4,testutil:[0,4],text:[0,7],than:[3,4,7,13,17,19,20,21,30,31],thei:[1,4,12,13,14,18,19,20,21,28,29,30],them:[3,4,13,14,15,19,20,21,24,28,30,31,32],theoret:18,theori:23,therefor:[4,12,16,17,18,19,30],thi:[0,1,3,4,5,6,7,8,9,10,12,13,14,15,17,18,19,20,21,22,23,24,25,26,28,29,30,32],thing:[0,1,4,7,17,19,21,26,30,31],think:4,thoroughli:4,those:[0,1,3,4,7,14,21,22,25,26],though:[21,22],thr:[28,29,31],thread:[16,21],three:[0,3,4,12,13,14,18,20,21,28,29,31],threonin:29,thresh:[13,28,30],threshold:[17,19,21,25,30],through:[0,4,19,21],throughout:[4,7,16],thu:5,tidi:4,tightli:4,time:[0,4,12,13,21],tini:[4,21],titl:20,tlc:29,tlctorotid:[26,29],tmp_buf:22,toentiti:[10,12,18,19],togeth:[4,19,21],too:[4,14,19,21,22],tool:[3,15,19,22,26],toolbox:4,top:[1,4,8],topic:[0,4],topolog:17,torsion:[],torsion_angl:26,torsion_bin:13,torsion_plot:20,torsion_sampl:[12,14,17,18,19,21,22],torsion_sampler_coil:[19,22],torsion_sampler_extend:[19,22],torsion_sampler_hel:22,torsion_sampler_helix:19,torsion_sampler_list:19,torsion_scor:14,torsion_weight:19,torsionprob:19,torsionsampl:[12,13,14,16,17,18,19,20,21,22],torsionscor:13,total:[13,19],touch:[0,4],toward:[4,13,17,21],tpl:21,tpr:[29,30],track:[5,26],tradit:7,tradition:5,train:16,trajectori:18,tran:[13,29,30],transform:[12,28,30],transformation_matrix:12,translat:[3,29,30],transofrm:12,transomegators:13,treat:[4,21,22,30],tree:[0,3,4,25],trg:[7,21],tri:[21,30],trick:[0,4],trigger:[0,3,4,27],tripeptid:20,tripl:5,triplet:[],trp:29,trustworthi:4,tryptophan:29,ttccpsivarsnfnvcrlpgtpea:21,ttccpsivarsnfnvcrlpgtpeaicatgytciiipgatcpgdyan:21,ttccpsivarsnfnvcrlpgtpeaicatytgciiipgatcpgdyan:21,tupl:[5,12,21],turn:[0,4,5,21],tutori:4,tweak:21,two:[0,4,12,13,14,17,19,21,22,23,26,28,29,30,31],txt:[0,1,3,4],type:[5,7,22],typedef:22,typenam:22,typic:[12,18,26,28],tyr:[28,29,30,31],tyrosin:29,uint32_t:22,uint:22,ultra:19,uncertain:4,under:[3,4],undergo:[17,18],underli:[14,21],underscor:0,understand:4,unexpect:1,unfavor:13,unfavour:[17,18,23],unfortun:4,uniqu:[13,14,18,30],unittest:[0,4],unix:4,unlik:[26,31],unrecognis:[5,7],unsupport:22,until:[4,13,17,21,25,28],untrack:0,unus:4,updat:[4,17,21],updatedistribut:20,upon:[17,18],usabl:4,usag:[16,19,24,26],use_full_extend:21,use_scoring_extend:21,user:[],userlevel:0,usr:4,usual:[0,1,3,4,7,15,21],utilis:4,v_size:22,val:[20,29],valid:[4,13,18,21,27],valin:29,valu:[1,5,7,12,13,14,18,19,21,22,24,25,26,27,28,29,30],valueerror:19,varadarajan:19,vari:[3,22],variabl:[0,1,4,10,21,31],variant:[7,21],variou:[0,1,3,4],vec3:[12,21,23,24,28],vector:[20,22],verbos:0,veri:[0,4,5,21,22,31],verif:7,verifi:[0,4,5],version:[1,4,13,19,20,22,27,29,30],vertex:19,via:[0,4,7,8],view:[4,20],virtual:4,visual:10,wai:[0,1,3,4,7,12,15,19,24,26,27,29],wait:4,walk:[0,4],want:[0,1,4,8,13,15,17,19,21,28,30],warn:[4,21],watch:4,web:[1,4],weight:[14,18,19],weird:[17,26],well:[1,3,4,13,19,20,21,26,28,30],went:4,were:[4,19,21],wether:25,what:[0,4,5,7,15],when:[0,3,4,7,12,13,18,19,20,21,22,23,24,26,27,28,30,31],whenev:13,where:[0,3,4,5,12,13,19,20,22,27,30],wherea:19,whether:[5,12,13,14,17,18,19,24,26,28,30],which:[0,3,4,5,6,7,10,12,13,14,18,19,20,21,22,24,28],whistl:4,who:[25,26],whole:[0,4,19,21],why:[0,4],width:22,wild:3,wise:3,wish:[9,13,20,21],within:[1,3,4,13,21,30],without:[0,3,4,5,16,17,19,21,27],won:[24,26,27],word:[3,27],work:[0,1,3,4,7,21,22,27],worst:4,would:[0,1,4,5,20,23,28],wrapper:[0,3,4,8,21],writebasetyp:22,writemagicnumb:22,writetypes:22,writeversionnumb:22,written:[4,22],wrong:[1,7],xlabel:20,xlim:20,xml:4,xxx:29,year:0,yet:[13,19],ylabel:20,ylim:20,you:[0,1,3,4,5,7,8,10,13,14,15,17,18,19,20,21,22,24,26,27,28,30],your:3,your_modul:4,yourself:[1,4],zero:[19,21,30],zhou2005:19,zhou:19,zip:26},titles:["<code class=\"docutils literal\"><span class=\"pre\">test_actions</span></code> - Testing Actions","Building ProMod3","Changelog","ProMod3&#8216;s Share Of CMake","Contributing","<code class=\"docutils literal\"><span class=\"pre\">helper</span></code> - Shared Functionality For the Everything","<code class=\"docutils literal\"><span class=\"pre\">core</span></code> - ProMod3 Core Functionality","<code class=\"docutils literal\"><span class=\"pre\">pm3argparse</span></code> - Parsing Command Lines","<code class=\"docutils literal\"><span class=\"pre\">SetCompoundsChemlib()</span></code>","Documentation For Developers","Getting Started","Welcome To ProMod3&#8217;s Documentation!","Backbone","Loop Scoring","Helper Classes","<code class=\"docutils literal\"><span class=\"pre\">loop</span></code> - Loop Modelling","Load Loop Objects","Loop Closing","Monte Carlo Sampling","Structural Database","Torsion Sampler","<code class=\"docutils literal\"><span class=\"pre\">modelling</span></code> - Protein Modelling","Using binary files in ProMod3","Disulfid Bond Evaluation","Frame","Coming to a solution","<code class=\"docutils literal\"><span class=\"pre\">sidechain</span></code> - Sidechain Modelling","Load Rotamer Libraries","Rotamers","RotamerID","Rotamer Library","Rotamer Settings","Documentation For Users"],titleterms:{"class":[14,20,21],"function":[3,5,6,24,26,28],acid:20,action:[0,3,4],actiontestcas:0,amino:20,api:0,argument:7,backbon:[12,17,30],backboneloopscor:13,base:19,basic:12,binari:22,block:[12,28],bond:23,branch:4,build:[1,12,28],can:29,carlo:18,ccd:17,chain:19,changelog:2,close:[17,21],closer:18,cmake:[0,1,3,4],code:22,come:25,command:7,construct:[24,28],contribut:4,conveni:[24,28],cooler:18,core:6,creat:0,data:22,databas:19,defin:[19,20],definit:3,depend:[1,30],detect:21,develop:9,directori:4,disulfid:23,document:[3,4,9,11,32],edit:12,entri:30,evalu:23,everyth:5,exampl:22,execut:0,exisit:22,extend:21,featur:[4,19],file:[5,22],find:19,fragment:19,frame:24,full:12,gap:21,geometr:19,get:[10,29],git:4,graph:25,group:28,handl:[14,21],have:0,header:22,helper:[5,14],hook:4,how:[4,29],indic:11,integr:0,interact:25,introduct:[3,5,7],issu:4,kic:17,librari:[27,30],licens:4,line:7,load:[16,27],loop:[13,14,15,16,17],mainten:3,make:[0,1],messag:5,model:[10,15,21,26],modul:[3,4,26],mont:18,must:0,non:30,object:[16,18,24],onc:14,output:0,own:4,pars:7,parser:7,parti:4,particl:28,pipelin:[10,21],pm3argpars:7,portabl:22,promod3:[1,3,4,6,10,11,22],protein:21,psipr:14,punch:21,quick:4,reconstruct:26,relax:17,releas:2,residu:[12,24],ring:21,rotam:[27,28,30,31],rotamerid:29,run:[0,1,10],sampl:18,sampler:[18,20],score:13,scorer:18,script:0,sequenc:19,set:31,setcompoundschemlib:8,sever:14,share:[3,5],sidechain:26,smallest:28,solut:25,stage:4,start:[4,10],stretch:12,structur:[4,19],subclass:0,tabl:11,test:[0,3,4,5],test_act:0,third:4,torsion:20,triplet:20,type:30,unit:[0,3,4],user:32,welcom:11,write:4,your:4}})
\ No newline at end of file
diff --git a/doc/html/sidechain/disulfid.html b/doc/html/sidechain/disulfid.html
index c3e1ba39131c02724232ccb705fa6beed2e1c1f1..2ba78a148db3c80f8959af7011144e7f4d3728bc 100644
--- a/doc/html/sidechain/disulfid.html
+++ b/doc/html/sidechain/disulfid.html
@@ -25,7 +25,7 @@
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
     <link rel="up" title="sidechain - Sidechain Modelling" href="index.html" />
-    <link rel="next" title="test_actions - Testing Actions" href="../actions/index_dev.html" />
+    <link rel="next" title="Load Rotamer Libraries" href="loading.html" />
     <link rel="prev" title="Rotamer Settings" href="sidechain_settings.html" />
    
   
@@ -46,7 +46,7 @@ a disulfid bond, one would get an unfavourable energy due to &#8220;clashes&#822
 the sulfur atoms. It is possible to improve performance in sidechain
 reconstruction regarding cysteins when finding and separately handle
 disulfid bonds. PROMOD3 implements a simple geometrical description
-<a class="reference internal" href="../loop/loop_closing.html#canutescu2003" id="id1">[canutescu2003]</a> .</p>
+<a class="reference internal" href="#canutescu2003b" id="id1">[canutescu2003b]</a> .</p>
 <p>Two methods are implemented to evaluate this disulfid score on either rigid of
 flexible rotamers. The above paper proposes two rotamers to be in a disulfid
 bonded state, if the resulting score is below 45.</p>
@@ -67,7 +67,7 @@ bonded state, if the resulting score is below 45.</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if given rotamers do not contain
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if given rotamers do not contain
 exactly one particle representing the gamma sulfur.</p>
 </td>
 </tr>
@@ -81,6 +81,12 @@ returned.</p>
 </table>
 </dd></dl>
 
+<table class="docutils citation" frame="void" id="canutescu2003b" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id1">[canutescu2003b]</a></td><td>Canutescu AA, Shelenkov AA, Dunbrack RL Jr. (2003). A graph-theory algorithm for rapid protein side-chain prediction. Protein Sci (2003).</td></tr>
+</tbody>
+</table>
 </div>
 
 
@@ -92,10 +98,10 @@ returned.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
       <li>Previous: <a href="sidechain_settings.html" title="previous chapter">Rotamer Settings</a></li>
-      <li>Next: <a href="../actions/index_dev.html" title="next chapter"><code class="docutils literal"><span class="pre">test_actions</span></code> - Testing Actions</a></li>
+      <li>Next: <a href="loading.html" title="next chapter">Load Rotamer Libraries</a></li>
   </ul></li>
   </ul></li>
   </ul></li>
@@ -126,7 +132,7 @@ returned.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/sidechain/frame.html b/doc/html/sidechain/frame.html
index 3e6636bb0e44040eb781af73fbba3e64c688818c..6a64329c83a5027ce2971be12c5d45bab58b33d9 100644
--- a/doc/html/sidechain/frame.html
+++ b/doc/html/sidechain/frame.html
@@ -94,7 +94,7 @@ residue index are neglected</li>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="rotamer.html#promod3.sidechain.Particle" title="promod3.sidechain.Particle"><code class="xref py py-class docutils literal"><span class="pre">Particle</span></code></a> at position <strong>index</strong></td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if index is invalid</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if index is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -217,7 +217,7 @@ hbonds get considered.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> when not all required backbone
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> when not all required backbone
 atoms are present in <strong>residue</strong></p>
 </td>
 </tr>
@@ -244,7 +244,7 @@ particles.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> when not all required atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> when not all required sidechain
 atoms are present in <strong>residue</strong></p>
 </td>
 </tr>
@@ -301,7 +301,7 @@ construct a <a class="reference internal" href="#promod3.sidechain.FrameResidue"
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
       <li>Previous: <a href="rotamer.html" title="previous chapter">Rotamers</a></li>
       <li>Next: <a href="rotamer_lib.html" title="next chapter">Rotamer Library</a></li>
@@ -335,7 +335,7 @@ construct a <a class="reference internal" href="#promod3.sidechain.FrameResidue"
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/sidechain/graph.html b/doc/html/sidechain/graph.html
index 15dd3020f395965158601365ce7fa57066cfc06d..5f19e22d674f4d3bcc90ce2b797c53cba244a954 100644
--- a/doc/html/sidechain/graph.html
+++ b/doc/html/sidechain/graph.html
@@ -220,7 +220,7 @@ even after performing pruning operations</td>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
       <li>Previous: <a href="rotamer_lib.html" title="previous chapter">Rotamer Library</a></li>
       <li>Next: <a href="sidechain_settings.html" title="next chapter">Rotamer Settings</a></li>
@@ -254,7 +254,7 @@ even after performing pruning operations</td>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/sidechain/index.html b/doc/html/sidechain/index.html
index fd11038d6986ad4508c9642869ece9a752956ef2..7459be0720bd9155a23ffc178bc9088f8be062d2 100644
--- a/doc/html/sidechain/index.html
+++ b/doc/html/sidechain/index.html
@@ -24,7 +24,7 @@
     <script type="text/javascript" src="../_static/underscore.js"></script>
     <script type="text/javascript" src="../_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
-    <link rel="up" title="Documentation For Developers" href="../developers.html" />
+    <link rel="up" title="Documentation For Users" href="../users.html" />
     <link rel="next" title="RotamerID" href="rotamer_id.html" />
     <link rel="prev" title="Helper Classes" href="../loop/helper_classes.html" />
    
@@ -42,29 +42,30 @@
   <div class="section" id="module-promod3.sidechain">
 <span id="sidechain-sidechain-modelling"></span><h1><a class="reference internal" href="#module-promod3.sidechain" title="promod3.sidechain: Sidechain Modelling"><code class="xref py py-mod docutils literal"><span class="pre">sidechain</span></code></a> - Sidechain Modelling<a class="headerlink" href="#module-promod3.sidechain" title="Permalink to this headline">¶</a></h1>
 <p>Tools and algorithms to model sidechains given backbone coordinates.
-The full module is heavily based on SCWRL4 <a class="reference internal" href="#krivov2009" id="id1">[krivov2009]</a> .
+The full module is heavily based on SCWRL4 <a class="reference internal" href="loading.html#krivov2009" id="id1">[krivov2009]</a> .
 The according paper describes the modelling of sidechains using two different
 rotamer models. A rigid model, as well as a flexible model. Both models are
 implemented in PROMOD3 and can be applied in flexible ways.</p>
 <div class="section" id="reconstruct-function">
 <h2>Reconstruct Function<a class="headerlink" href="#reconstruct-function" title="Permalink to this headline">¶</a></h2>
-<p>The simplest usage of the module is provided by the <a class="reference internal" href="#promod3.sidechain.Reconstruct" title="promod3.sidechain.Reconstruct"><code class="xref py py-func docutils literal"><span class="pre">Reconstruct()</span></code></a> function:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span><span class="n">mol</span>
+<p>The simplest usage of the module is provided by the <a class="reference internal" href="#promod3.sidechain.Reconstruct" title="promod3.sidechain.Reconstruct"><code class="xref py py-func docutils literal"><span class="pre">Reconstruct()</span></code></a>
+function:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span> <span class="n">mol</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">sidechain</span>
 
-<span class="c">#load a protein</span>
+<span class="c"># load a protein </span>
 <span class="n">prot</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;1eye&#39;</span><span class="p">,</span><span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
-<span class="c">#get only amino acids</span>
-<span class="n">prot</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">CreateEntityFromView</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;peptide=true&quot;</span><span class="p">),</span><span class="bp">True</span><span class="p">)</span>
-<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">prot</span><span class="p">,</span><span class="s">&quot;sidechain_test_orig.pdb&quot;</span><span class="p">)</span>
-<span class="c">#reconstruct sidechains</span>
+<span class="c"># get only amino acids</span>
+<span class="n">prot</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">CreateEntityFromView</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;peptide=true&quot;</span><span class="p">),</span> <span class="bp">True</span><span class="p">)</span>
+<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">prot</span><span class="p">,</span> <span class="s">&#39;sidechain_test_orig.pdb&#39;</span><span class="p">)</span>
+<span class="c"># reconstruct sidechains</span>
 <span class="n">sidechain</span><span class="o">.</span><span class="n">Reconstruct</span><span class="p">(</span><span class="n">prot</span><span class="p">)</span>
-<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">prot</span><span class="p">,</span><span class="s">&quot;sidechain_test_rec.pdb&quot;</span><span class="p">)</span>
+<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">prot</span><span class="p">,</span> <span class="s">&#39;sidechain_test_rec.pdb&#39;</span><span class="p">)</span>
 </pre></div>
 </div>
 <dl class="method">
 <dt id="promod3.sidechain.Reconstruct">
-<code class="descclassname">promod3.sidechain.</code><code class="descname">Reconstruct</code><span class="sig-paren">(</span><em>prot</em>, <em>keep_sidechains=False</em>, <em>build_disulfids</em>, <em>rotamer_model=&quot;frm&quot;</em>, <em>consider_hbonds=True</em>, <em>rotamer_library=None</em>, <em>add_polar_hydrogens=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/sidechain/_reconstruct_sidechains.html#Reconstruct"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.sidechain.Reconstruct" title="Permalink to this definition">¶</a></dt>
+<code class="descclassname">promod3.sidechain.</code><code class="descname">Reconstruct</code><span class="sig-paren">(</span><em>prot</em>, <em>keep_sidechains=False</em>, <em>build_disulfids</em>, <em>rotamer_model=&quot;frm&quot;</em>, <em>consider_hbonds=True</em>, <em>rotamer_library=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/promod3/sidechain/_reconstruct_sidechains.html#Reconstruct"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#promod3.sidechain.Reconstruct" title="Permalink to this definition">¶</a></dt>
 <dd><p>The function takes a structure and reconstructs its sidechains given the input
 parameters.</p>
 <table class="docutils field-list" frame="void" rules="none">
@@ -89,10 +90,6 @@ when building rotamers and frame and the <strong>add_polar_hydrogens</strong>
 flag won&#8217;t have any consequences.</li>
 <li><strong>rotamer_library</strong> (<a class="reference internal" href="rotamer_lib.html#promod3.sidechain.BBDepRotamerLib" title="promod3.sidechain.BBDepRotamerLib"><code class="xref py py-class docutils literal"><span class="pre">BBDepRotamerLib</span></code></a> / <a class="reference internal" href="rotamer_lib.html#promod3.sidechain.RotamerLib" title="promod3.sidechain.RotamerLib"><code class="xref py py-class docutils literal"><span class="pre">RotamerLib</span></code></a>) &#8211; A rotamer library to extract the
 rotamers from.</li>
-<li><strong>add_polar_hydrogens</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>) &#8211; All polar hydrogens will be constructed if
-<strong>consider_hbonds</strong> is True.
-If this flag is activated, they&#8217;ll be added to the
-structure.</li>
 </ul>
 </td>
 </tr>
@@ -112,15 +109,16 @@ the bottom of this page.</p>
 <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">ost</span> <span class="kn">import</span> <span class="n">io</span><span class="p">,</span><span class="n">mol</span>
 <span class="kn">from</span> <span class="nn">promod3</span> <span class="kn">import</span> <span class="n">sidechain</span>
 
-<span class="c">#load a protein, the rotamer library and the settings with default values</span>
-<span class="n">prot</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;1eye&#39;</span><span class="p">,</span><span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="c"># load a protein</span>
+<span class="n">prot</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">LoadPDB</span><span class="p">(</span><span class="s">&#39;1eye&#39;</span><span class="p">,</span> <span class="n">remote</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="c"># load rotamer library and settings with default values</span>
 <span class="n">settings</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">RotamerSettings</span><span class="p">()</span>
 <span class="n">library</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">LoadDunbrackLib</span><span class="p">()</span>
 
-<span class="c">#let&#39;s create a new entity from the protein only containing the amino acids</span>
-<span class="n">prot</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">CreateEntityFromView</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;peptide=true&quot;</span><span class="p">),</span><span class="bp">True</span><span class="p">)</span>
+<span class="c"># create new entity from protein only containing the amino acids</span>
+<span class="n">prot</span> <span class="o">=</span> <span class="n">mol</span><span class="o">.</span><span class="n">CreateEntityFromView</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="s">&quot;peptide=true&quot;</span><span class="p">),</span> <span class="bp">True</span><span class="p">)</span>
 
-<span class="c">#gather some data, the rotamer ids and backbone torsion angles</span>
+<span class="c"># gather some data, the rotamer ids and backbone torsion angles</span>
 <span class="n">torsion_angles</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
 <span class="n">rotamer_ids</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
 
@@ -129,8 +127,8 @@ the bottom of this page.</p>
     <span class="n">phi_handle</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">GetPhiTorsion</span><span class="p">()</span>
     <span class="n">psi_handle</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">GetPsiTorsion</span><span class="p">()</span>
 
-    <span class="c">#set typical default values for an alpha helix...</span>
-    <span class="n">phi</span> <span class="o">=</span> <span class="o">-</span><span class="mf">1.0472</span>
+    <span class="c"># set typical default values for an alpha helix...</span>
+    <span class="n">phi</span> <span class="o">=</span> <span class="o">-</span><span class="mf">1.0472</span> 
     <span class="n">psi</span> <span class="o">=</span> <span class="o">-</span><span class="mf">0.7854</span>
     <span class="k">if</span> <span class="n">phi_handle</span><span class="o">.</span><span class="n">IsValid</span><span class="p">():</span>
         <span class="n">phi</span> <span class="o">=</span> <span class="n">phi_handle</span><span class="o">.</span><span class="n">GetAngle</span><span class="p">()</span>
@@ -139,21 +137,20 @@ the bottom of this page.</p>
 
     <span class="n">torsion_angles</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">phi</span><span class="p">,</span><span class="n">psi</span><span class="p">))</span>
 
-<span class="c">#lets first build a frame representing the rigid parts including the cystein</span>
-<span class="c">#sidechains</span>
+<span class="c"># first build a frame representing the rigid parts including</span>
+<span class="c"># cystein sidechains</span>
 <span class="n">frame_residues</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
 <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
-    <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructBackboneFrameResidue</span><span class="p">(</span><span class="n">r</span><span class="p">,</span><span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">],</span><span class="n">i</span><span class="p">,</span>
-                                                            <span class="n">settings</span><span class="p">,</span>
-                                                            <span class="n">torsion_angles</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span>
-                                                            <span class="n">i</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span>
-                                                            <span class="n">i</span> <span class="o">==</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">rotamer_ids</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+    <span class="n">frame_residue</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructBackboneFrameResidue</span><span class="p">(</span>
+                        <span class="n">r</span><span class="p">,</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">i</span><span class="p">,</span> <span class="n">settings</span><span class="p">,</span>
+                        <span class="n">torsion_angles</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span>
+                        <span class="n">i</span> <span class="o">==</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">rotamer_ids</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
     <span class="n">frame_residues</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">frame_residue</span><span class="p">)</span>
 
 <span class="n">frame</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">Frame</span><span class="p">(</span><span class="n">frame_residues</span><span class="p">)</span>
 
 
-<span class="c">#let&#39;s build up rotamer groups</span>
+<span class="c"># let&#39;s build up rotamer groups</span>
 <span class="n">rotamer_groups</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
 <span class="n">aa_with_rotamers</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
 <span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">r</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">):</span>
@@ -161,33 +158,34 @@ the bottom of this page.</p>
     <span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;ALA&quot;</span> <span class="ow">or</span> <span class="n">r</span><span class="o">.</span><span class="n">GetName</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;GLY&quot;</span><span class="p">:</span>
       <span class="k">continue</span>
 
-    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span><span class="n">r</span><span class="p">,</span><span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">],</span><span class="n">i</span><span class="p">,</span>
-                                                   <span class="n">library</span><span class="p">,</span><span class="n">settings</span><span class="p">,</span>
-                                                   <span class="n">torsion_angles</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span>
-                                                   <span class="n">torsion_angles</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
+    <span class="n">rot_group</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">ConstructFRMRotamerGroup</span><span class="p">(</span>
+                    <span class="n">r</span><span class="p">,</span> <span class="n">rotamer_ids</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">i</span><span class="p">,</span> <span class="n">library</span><span class="p">,</span> <span class="n">settings</span><span class="p">,</span>
+                    <span class="n">torsion_angles</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">torsion_angles</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
 
-    <span class="c">#internal and frame energy have to be calculated directly</span>
+    <span class="c"># internal and frame energy have to be calculated directly</span>
     <span class="n">rot_group</span><span class="o">.</span><span class="n">CalculateInternalEnergies</span><span class="p">()</span>
     <span class="n">frame</span><span class="o">.</span><span class="n">SetFrameEnergy</span><span class="p">(</span><span class="n">rot_group</span><span class="p">)</span>
-    <span class="c">#remove super unlikely rotamer in rotamer group</span>
-    <span class="c">#e.g. those who clash with the frame</span>
+    <span class="c"># remove super unlikely rotamer in rotamer group </span>
+    <span class="c"># e.g. those who clash with the frame</span>
     <span class="n">rot_group</span><span class="o">.</span><span class="n">ApplySelfEnergyThresh</span><span class="p">()</span>
-    <span class="c">#finally add it and keep track of the indices</span>
+    <span class="c"># finally add it and keep track of the indices</span>
     <span class="n">rotamer_groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">rot_group</span><span class="p">)</span>
     <span class="n">aa_with_rotamers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
 
 
-<span class="c">#buildup a graph given the rotamer groups</span>
+<span class="c"># buildup a graph given the rotamer groups</span>
 <span class="n">graph</span> <span class="o">=</span> <span class="n">sidechain</span><span class="o">.</span><span class="n">Graph</span><span class="o">.</span><span class="n">CreateFromFRMList</span><span class="p">(</span><span class="n">rotamer_groups</span><span class="p">)</span>
 
-<span class="c">#and get a solution out of it</span>
+<span class="c"># and get a solution out of it</span>
 <span class="n">solution</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">Solve</span><span class="p">()</span>
 
-<span class="c">#let&#39;s finally apply the solution to the residues</span>
-<span class="k">for</span> <span class="n">i</span><span class="p">,</span><span class="n">rot_group</span><span class="p">,</span><span class="n">sol</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">aa_with_rotamers</span><span class="p">,</span><span class="n">rotamer_groups</span><span class="p">,</span><span class="n">solution</span><span class="p">):</span>
+<span class="c"># let&#39;s finally apply the solution to the residues</span>
+<span class="k">for</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">rot_group</span><span class="p">,</span> <span class="n">sol</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">aa_with_rotamers</span><span class="p">,</span>
+                               <span class="n">rotamer_groups</span><span class="p">,</span>
+                               <span class="n">solution</span><span class="p">):</span>
     <span class="n">rot_group</span><span class="p">[</span><span class="n">sol</span><span class="p">]</span><span class="o">.</span><span class="n">ApplyOnResidue</span><span class="p">(</span><span class="n">prot</span><span class="o">.</span><span class="n">residues</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
 
-<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">prot</span><span class="p">,</span><span class="s">&quot;example_reconstruction.pdb&quot;</span><span class="p">)</span>
+<span class="n">io</span><span class="o">.</span><span class="n">SavePDB</span><span class="p">(</span><span class="n">prot</span><span class="p">,</span> <span class="s">&quot;example_reconstruction.pdb&quot;</span><span class="p">)</span>
 </pre></div>
 </div>
 <p>Contents:</p>
@@ -223,14 +221,9 @@ the bottom of this page.</p>
 </li>
 <li class="toctree-l1"><a class="reference internal" href="sidechain_settings.html">The Settings - Control Things...</a></li>
 <li class="toctree-l1"><a class="reference internal" href="disulfid.html">Disulfid Bond Evaluation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="loading.html">Loading Libraries</a></li>
 </ul>
 </div>
-<table class="docutils citation" frame="void" id="krivov2009" rules="none">
-<colgroup><col class="label" /><col /></colgroup>
-<tbody valign="top">
-<tr><td class="label"><a class="fn-backref" href="#id1">[krivov2009]</a></td><td>Krivov GG, Shapovalov MV and Dunbrack RL Jr. (2009). Improved prediction of protein side-chain conformations with SCWRL4. Proteins.</td></tr>
-</tbody>
-</table>
 </div>
 </div>
 
@@ -252,7 +245,7 @@ the bottom of this page.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
       <li>Previous: <a href="../loop/helper_classes.html" title="previous chapter">Helper Classes</a></li>
       <li>Next: <a href="rotamer_id.html" title="next chapter">RotamerID</a></li>
   </ul></li>
@@ -284,7 +277,7 @@ the bottom of this page.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/sidechain/loading.html b/doc/html/sidechain/loading.html
new file mode 100644
index 0000000000000000000000000000000000000000..90e0776888338f9a0fcb2d3e866479f8071e5b6f
--- /dev/null
+++ b/doc/html/sidechain/loading.html
@@ -0,0 +1,192 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>Load Rotamer Libraries &mdash; ProMod3 0 documentation</title>
+    
+    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
+    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../',
+        VERSION:     '0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../_static/jquery.js"></script>
+    <script type="text/javascript" src="../_static/underscore.js"></script>
+    <script type="text/javascript" src="../_static/doctools.js"></script>
+    <link rel="top" title="ProMod3 0 documentation" href="../index.html" />
+    <link rel="up" title="sidechain - Sidechain Modelling" href="index.html" />
+    <link rel="next" title="core - ProMod3 Core Functionality" href="../core/index.html" />
+    <link rel="prev" title="Disulfid Bond Evaluation" href="disulfid.html" />
+   
+  
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
+
+  </head>
+  <body role="document">  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body" role="main">
+            
+  <div class="section" id="load-rotamer-libraries">
+<h1>Load Rotamer Libraries<a class="headerlink" href="#load-rotamer-libraries" title="Permalink to this headline">¶</a></h1>
+<p>Since the PROMOD3 sidechain modelling algorithms are mainly designed after the
+work of the Dunbrack lab <a class="reference internal" href="#krivov2009" id="id1">[krivov2009]</a> , their backbone dependent rotamer
+library is probably the way to go. There exists a binary version of their
+2010 libary <a class="reference internal" href="#shapovalov2011" id="id2">[shapovalov2011]</a> , that can
+directly be loaded. As an alternative, there is also a binary file containing
+the backbone independent Penultimate library <a class="reference internal" href="#lovell2000" id="id3">[lovell2000]</a> .</p>
+<dl class="method">
+<dt id="promod3.sidechain.LoadDunbrackLib">
+<code class="descclassname">promod3.sidechain.</code><code class="descname">LoadDunbrackLib</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.LoadDunbrackLib" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads the 2010 backbone dependent rotamer library from the dunbrack lab.
+The library has been generated using the ReadDunbrackFile function
+using the file with smoothing factor 5 and nonrotameric dihedrals
+sampled in 20 degree steps.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The requested library</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="rotamer_lib.html#promod3.sidechain.BBDepRotamerLib" title="promod3.sidechain.BBDepRotamerLib"><code class="xref py py-class docutils literal"><span class="pre">BBDepRotamerLib</span></code></a></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.sidechain.LoadPenultimateLib">
+<code class="descclassname">promod3.sidechain.</code><code class="descname">LoadPenultimateLib</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.LoadPenultimateLib" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads the backbone independent Penultimate library. The values for the dihedral
+angles are directly extracted from the publication without considering the
+probabilities specifically for helices/sheets. Due to no assigned standard
+deviations, the flexible rotamer model won&#8217;t work.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The requested library</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="rotamer_lib.html#promod3.sidechain.RotamerLib" title="promod3.sidechain.RotamerLib"><code class="xref py py-class docutils literal"><span class="pre">RotamerLib</span></code></a></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.sidechain.ReadDunbrackFile">
+<code class="descclassname">promod3.sidechain.</code><code class="descname">ReadDunbrackFile</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.ReadDunbrackFile" title="Permalink to this definition">¶</a></dt>
+<dd><p>Reads a file as it is provided when you get a licence for the 2010 library of
+the Dunbrack lab. It can only read the classic version, where all rotamers
+are in a single file. Specific distributions of nonrotameric sidechains also
+cannot be read.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> &#8211; Name of the file</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Throws:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file does not exist, the format
+is not valid or when the library is incomplete leading to problems
+to make the library static. Most likely your input file is
+incomplete if the last problem gets triggered.</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The read library</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="rotamer_lib.html#promod3.sidechain.BBDepRotamerLib" title="promod3.sidechain.BBDepRotamerLib"><code class="xref py py-class docutils literal"><span class="pre">BBDepRotamerLib</span></code></a></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<table class="docutils citation" frame="void" id="krivov2009" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id1">[krivov2009]</a></td><td>Krivov GG, Shapovalov MV and Dunbrack RL Jr. (2009). Improved prediction of protein side-chain conformations with SCWRL4. Proteins.</td></tr>
+</tbody>
+</table>
+<table class="docutils citation" frame="void" id="shapovalov2011" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id2">[shapovalov2011]</a></td><td>Shapovalov MV and Dunbrack RL Jr. (2011). A smoothed backbone-dependent rotamer library for proteins derived from adaptive kernel density estimates and regressions. Structure.</td></tr>
+</tbody>
+</table>
+<table class="docutils citation" frame="void" id="lovell2000" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id3">[lovell2000]</a></td><td>Lovell SC, Word JM, Richardson JS, Richardson DC (2000). The penultimate rotamer library. Proteins.</td></tr>
+</tbody>
+</table>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
+        <div class="sphinxsidebarwrapper"><div class="relations">
+<h3>Related Topics</h3>
+<ul>
+  <li><a href="../index.html">Documentation overview</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
+  <li><a href="index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
+      <li>Previous: <a href="disulfid.html" title="previous chapter">Disulfid Bond Evaluation</a></li>
+      <li>Next: <a href="../core/index.html" title="next chapter"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a></li>
+  </ul></li>
+  </ul></li>
+  </ul></li>
+</ul>
+</div>
+  <div role="note" aria-label="source link">
+    <h3>This Page</h3>
+    <ul class="this-page-menu">
+      <li><a href="../_sources/sidechain/loading.txt"
+            rel="nofollow">Show Source</a></li>
+    </ul>
+   </div>
+<div id="searchbox" style="display: none" role="search">
+  <h3>Quick search</h3>
+    <form class="search" action="../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="footer">
+      &copy;2016, Bienchen.
+      
+      |
+      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>
+      
+      |
+      <a href="../_sources/sidechain/loading.txt"
+          rel="nofollow">Page source</a>
+    </div>
+
+    
+
+    
+  </body>
+</html>
\ No newline at end of file
diff --git a/doc/html/sidechain/rotamer.html b/doc/html/sidechain/rotamer.html
index e5358184905bbf807601896556a77b8d1f891b59..d2c084911121862846167a7b85a25584500f5ab4 100644
--- a/doc/html/sidechain/rotamer.html
+++ b/doc/html/sidechain/rotamer.html
@@ -239,7 +239,7 @@ be constructed with the convenient functions provided by PROMOD3.</p>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#promod3.sidechain.Particle" title="promod3.sidechain.Particle"><code class="xref py py-class docutils literal"><span class="pre">Particle</span></code></a> at specified index</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if index is invalid</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if index is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -276,7 +276,7 @@ default value (&#8220;&#8221;)</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required backbone atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required backbone atoms
 are present in <strong>res</strong></p>
 </td>
 </tr>
@@ -458,7 +458,7 @@ of particle indices.</p>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#promod3.sidechain.Particle" title="promod3.sidechain.Particle"><code class="xref py py-class docutils literal"><span class="pre">Particle</span></code></a> at specified index</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if index is invalid</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if index is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -502,7 +502,7 @@ of particle indices.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of particle indices belonging to this
 particular subrotamer</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if index is invalid</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if index is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -520,7 +520,7 @@ particular subrotamer</td>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of subrotamer indices this particle is
 associated with</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if index is invalid</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if index is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -544,7 +544,7 @@ default value (&#8220;&#8221;)</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required backbone atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required backbone atoms
 are present in <strong>res</strong></p>
 </td>
 </tr>
@@ -638,7 +638,7 @@ energy has to be calculated using a <a class="reference internal" href="frame.ht
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Frame energy if calculated, 0.0 otherwise</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if index is invalid</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if index is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -782,7 +782,7 @@ residue position. It can either be constructed by providing a list of
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>rotamers</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>) &#8211; A list of <a class="reference internal" href="#promod3.sidechain.RRMRotamer" title="promod3.sidechain.RRMRotamer"><code class="xref py py-class docutils literal"><span class="pre">RRMRotamer</span></code></a> objects</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if provided <strong>rotamers</strong> is empty</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if provided <strong>rotamers</strong> is empty</td>
 </tr>
 </tbody>
 </table>
@@ -808,7 +808,7 @@ residue position. It can either be constructed by providing a list of
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#promod3.sidechain.RRMRotamer" title="promod3.sidechain.RRMRotamer"><code class="xref py py-class docutils literal"><span class="pre">RRMRotamer</span></code></a> at given <strong>index</strong></td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <strong>index</strong> is invalid</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>index</strong> is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -832,7 +832,7 @@ default value (&#8220;&#8221;)</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required backbone atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required backbone atoms
 are present in <strong>res</strong> or when <strong>index</strong> is invalid</p>
 </td>
 </tr>
@@ -881,7 +881,7 @@ residue position. It can either be constructed by providing a list of
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>rotamers</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>) &#8211; A list of <a class="reference internal" href="#promod3.sidechain.FRMRotamer" title="promod3.sidechain.FRMRotamer"><code class="xref py py-class docutils literal"><span class="pre">FRMRotamer</span></code></a> objects</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if provided <strong>rotamers</strong> is empty</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if provided <strong>rotamers</strong> is empty</td>
 </tr>
 </tbody>
 </table>
@@ -907,7 +907,7 @@ residue position. It can either be constructed by providing a list of
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#promod3.sidechain.FRMRotamer" title="promod3.sidechain.FRMRotamer"><code class="xref py py-class docutils literal"><span class="pre">FRMRotamer</span></code></a> at given <strong>index</strong></td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if <strong>index</strong> is invalid</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <strong>index</strong> is invalid</td>
 </tr>
 </tbody>
 </table>
@@ -931,7 +931,7 @@ default value (&#8220;&#8221;)</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required backbone atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required backbone atoms
 are present in <strong>res</strong> or when <strong>index</strong> is invalid</p>
 </td>
 </tr>
@@ -996,7 +996,7 @@ particles.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required chi angles
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required chi angles
 for this particular <strong>id</strong> are given.</p>
 </td>
 </tr>
@@ -1025,10 +1025,9 @@ particles.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required chi angles
-for this particular <strong>id</strong> are given or when not
-all required anchor atoms are present in
-<strong>residue</strong>.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required chi angles
+for this particular <strong>id</strong> are given or when not all required
+anchor atoms are present in <strong>residue</strong>.</p>
 </td>
 </tr>
 </tbody>
@@ -1061,7 +1060,7 @@ particles.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required chi angles
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required chi angles
 for this particular <strong>id</strong> are given.</p>
 </td>
 </tr>
@@ -1094,10 +1093,9 @@ particles.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required chi angles
-or standard deviations for this particular <strong>id</strong>
-are given or when not all required anchor atoms are present in
-<strong>residue</strong>.</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required chi angles
+or standard deviations for this particular <strong>id</strong> are given or when
+not all required anchor atoms are present in <strong>residue</strong>.</p>
 </td>
 </tr>
 </tbody>
@@ -1184,7 +1182,7 @@ alpha helical value.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required anchor atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required anchor atoms
 are present in <strong>residue</strong>.</p>
 </td>
 </tr>
@@ -1259,7 +1257,7 @@ alpha helical value.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required anchor atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required anchor atoms
 are present in <strong>residue</strong>.</p>
 </td>
 </tr>
@@ -1322,7 +1320,7 @@ particles.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required anchor atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required anchor atoms
 are present in <strong>residue</strong>.</p>
 </td>
 </tr>
@@ -1385,7 +1383,7 @@ particles.</li>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all required anchor atoms
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required anchor atoms
 are present in <strong>residue</strong>.</p>
 </td>
 </tr>
@@ -1417,7 +1415,7 @@ are present in <strong>residue</strong>.</p>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
       <li>Previous: <a href="rotamer_id.html" title="previous chapter">RotamerID</a></li>
       <li>Next: <a href="frame.html" title="next chapter">Frame</a></li>
@@ -1451,7 +1449,7 @@ are present in <strong>residue</strong>.</p>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/sidechain/rotamer_id.html b/doc/html/sidechain/rotamer_id.html
index 2dc41f6882fdf3c5cda4a3284cb3746881fbc1e6..31d85c80581242ea04c55aca8e999dc7a31e9474 100644
--- a/doc/html/sidechain/rotamer_id.html
+++ b/doc/html/sidechain/rotamer_id.html
@@ -147,7 +147,7 @@ defined in <code class="xref py py-class docutils literal"><span class="pre">ost
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
       <li>Previous: <a href="index.html" title="previous chapter"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a></li>
       <li>Next: <a href="rotamer.html" title="next chapter">Rotamers</a></li>
@@ -181,7 +181,7 @@ defined in <code class="xref py py-class docutils literal"><span class="pre">ost
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/sidechain/rotamer_lib.html b/doc/html/sidechain/rotamer_lib.html
index 0591f5856340798567ae11b341946025293c6863..cff5394d4cfeebd2d028389a74b1987366f5630a 100644
--- a/doc/html/sidechain/rotamer_lib.html
+++ b/doc/html/sidechain/rotamer_lib.html
@@ -61,29 +61,98 @@ mode you can get the rotamers out of it or dump it to disk.</p>
 <dt id="promod3.sidechain.RotamerLib">
 <em class="property">class </em><code class="descclassname">promod3.sidechain.</code><code class="descname">RotamerLib</code><a class="headerlink" href="#promod3.sidechain.RotamerLib" title="Permalink to this definition">¶</a></dt>
 <dd><p>Non backbone dependent rotamer library</p>
+<dl class="method">
+<dt id="promod3.sidechain.RotamerLib.Load">
+<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.RotamerLib.Load" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads raw binary file generated with <a class="reference internal" href="#promod3.sidechain.RotamerLib.Save" title="promod3.sidechain.RotamerLib.Save"><code class="xref py py-meth docutils literal"><span class="pre">Save()</span></code></a> (optimized for fast
+reading).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be loaded from</p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A rotamer library</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.sidechain.RotamerLib" title="promod3.sidechain.RotamerLib"><code class="xref py py-class docutils literal"><span class="pre">RotamerLib</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>file assumes different memory-layout than is available on this
+machine. Use <a class="reference internal" href="#promod3.sidechain.RotamerLib.LoadPortable" title="promod3.sidechain.RotamerLib.LoadPortable"><code class="xref py py-meth docutils literal"><span class="pre">LoadPortable()</span></code></a> to convert your file.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
 <dl class="method">
 <dt id="promod3.sidechain.RotamerLib.Save">
 <code class="descname">Save</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.RotamerLib.Save" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Saves raw binary representation (optimized for fast reading).This puts many
+assumptions on the memory-layout of the target-machine and hence it is not
+portable. A portable version is provided by <a class="reference internal" href="#promod3.sidechain.RotamerLib.SavePortable" title="promod3.sidechain.RotamerLib.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a>.
+Preferably portable files are distributed and converted to a raw binary
+before using them.</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be dumped into</td>
 </tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.sidechain.RotamerLib.Load">
-<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.RotamerLib.Load" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dt id="promod3.sidechain.RotamerLib.LoadPortable">
+<code class="descname">LoadPortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.RotamerLib.LoadPortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads portable file generated with <a class="reference internal" href="#promod3.sidechain.RotamerLib.SavePortable" title="promod3.sidechain.RotamerLib.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a> (slow but less
+machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be loaded from</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be loaded from</p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A rotamer library</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.sidechain.RotamerLib" title="promod3.sidechain.RotamerLib"><code class="xref py py-class docutils literal"><span class="pre">RotamerLib</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>machine-dependent fundamental types are smaller than required.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.sidechain.RotamerLib.SavePortable">
+<code class="descname">SavePortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.RotamerLib.SavePortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves portable binary representation (slow but less machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be dumped into</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if file doesn&#8217;t exist</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
 </tr>
 </tbody>
 </table>
@@ -102,7 +171,7 @@ mode you can get the rotamers out of it or dump it to disk.</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if the library is already static</p>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if the library is already static</p>
 </td>
 </tr>
 </tbody>
@@ -131,7 +200,7 @@ special <em>id</em> requests.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> of <a class="reference internal" href="#promod3.sidechain.RotamerLibEntry" title="promod3.sidechain.RotamerLibEntry"><code class="xref py py-class docutils literal"><span class="pre">RotamerLibEntry</span></code></a> of nonzero
 probability sorted by their probability</td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if no entries for <em>id</em> can be
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if no entries for <em>id</em> can be
 found</td>
 </tr>
 </tbody>
@@ -166,29 +235,98 @@ and ready for io.</p>
 </tr>
 </tbody>
 </table>
+<dl class="method">
+<dt id="promod3.sidechain.BBDepRotamerLib.Load">
+<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.BBDepRotamerLib.Load" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads raw binary file generated with <a class="reference internal" href="#promod3.sidechain.BBDepRotamerLib.Save" title="promod3.sidechain.BBDepRotamerLib.Save"><code class="xref py py-meth docutils literal"><span class="pre">Save()</span></code></a> (optimized for fast
+reading).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be loaded from</p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A rotamer library</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.sidechain.BBDepRotamerLib" title="promod3.sidechain.BBDepRotamerLib"><code class="xref py py-class docutils literal"><span class="pre">BBDepRotamerLib</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>file assumes different memory-layout than is available on this
+machine. Use <a class="reference internal" href="#promod3.sidechain.BBDepRotamerLib.LoadPortable" title="promod3.sidechain.BBDepRotamerLib.LoadPortable"><code class="xref py py-meth docutils literal"><span class="pre">LoadPortable()</span></code></a> to convert your file.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
 <dl class="method">
 <dt id="promod3.sidechain.BBDepRotamerLib.Save">
 <code class="descname">Save</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.BBDepRotamerLib.Save" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dd><p>Saves raw binary representation (optimized for fast reading).This puts many
+assumptions on the memory-layout of the target-machine and hence it is not
+portable. A portable version is provided by <a class="reference internal" href="#promod3.sidechain.BBDepRotamerLib.SavePortable" title="promod3.sidechain.BBDepRotamerLib.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a>.
+Preferably portable files are distributed and converted to a raw binary
+before using them.</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be dumped into</td>
 </tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
+</tr>
 </tbody>
 </table>
 </dd></dl>
 
 <dl class="method">
-<dt id="promod3.sidechain.BBDepRotamerLib.Load">
-<code class="descname">Load</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.BBDepRotamerLib.Load" title="Permalink to this definition">¶</a></dt>
-<dd><table class="docutils field-list" frame="void" rules="none">
+<dt id="promod3.sidechain.BBDepRotamerLib.LoadPortable">
+<code class="descname">LoadPortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.BBDepRotamerLib.LoadPortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads portable file generated with <a class="reference internal" href="#promod3.sidechain.BBDepRotamerLib.SavePortable" title="promod3.sidechain.BBDepRotamerLib.SavePortable"><code class="xref py py-meth docutils literal"><span class="pre">SavePortable()</span></code></a> (slow but less
+machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be loaded from</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be loaded from</p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A rotamer library</p>
+</td>
+</tr>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.sidechain.BBDepRotamerLib" title="promod3.sidechain.BBDepRotamerLib"><code class="xref py py-class docutils literal"><span class="pre">BBDepRotamerLib</span></code></a></p>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if:</p>
+<ul class="last simple">
+<li>file cannot be opened.</li>
+<li>version number stored in file is not supported.</li>
+<li>machine-dependent fundamental types are smaller than required.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="promod3.sidechain.BBDepRotamerLib.SavePortable">
+<code class="descname">SavePortable</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#promod3.sidechain.BBDepRotamerLib.SavePortable" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves portable binary representation (slow but less machine-dependent).</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>) &#8211; Name of file, the library will be dumped into</td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if file doesn&#8217;t exist</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if file cannot be opened.</td>
 </tr>
 </tbody>
 </table>
@@ -213,7 +351,7 @@ and ready for io.</p>
 </ul>
 </td>
 </tr>
-<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if an invalid backbone angle bin
+<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if an invalid backbone angle bin
 is given or when the library is already static.</p>
 </td>
 </tr>
@@ -257,7 +395,7 @@ special <em>id</em> requests.</p>
 probability for given phi/psi pair sorted by their probability</p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if no entries for <em>id</em> can be
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if no entries for <em>id</em> can be
 found</p>
 </td>
 </tr>
@@ -282,7 +420,7 @@ be consistent across all phi/psi bins</li>
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if one of the points above is
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if one of the points above is
 not fulfilled</td>
 </tr>
 </tbody>
@@ -410,9 +548,9 @@ standard deviations are NaN.</p>
 </tr>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#promod3.sidechain.RotamerLibEntry" title="promod3.sidechain.RotamerLibEntry"><code class="xref py py-class docutils literal"><span class="pre">RotamerLibEntry</span></code></a></td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if residue name cannot be
-translated to <a class="reference internal" href="rotamer_id.html#promod3.sidechain.RotamerID" title="promod3.sidechain.RotamerID"><code class="xref py py-class docutils literal"><span class="pre">RotamerID</span></code></a> or when not all
-required atoms are present in <em>res</em>.</td>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if residue name cannot be
+translated to <a class="reference internal" href="rotamer_id.html#promod3.sidechain.RotamerID" title="promod3.sidechain.RotamerID"><code class="xref py py-class docutils literal"><span class="pre">RotamerID</span></code></a> or when not all  required atoms
+are present in <em>res</em>.</td>
 </tr>
 </tbody>
 </table>
@@ -438,8 +576,8 @@ are NaN.</p>
 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><a class="reference internal" href="#promod3.sidechain.RotamerLibEntry" title="promod3.sidechain.RotamerLibEntry"><code class="xref py py-class docutils literal"><span class="pre">RotamerLibEntry</span></code></a></p>
 </td>
 </tr>
-<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">RuntimeError</span></code> if not all
-required atoms are present in <em>res</em>.</p>
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/2.7/library/exceptions.html#exceptions.RuntimeError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if not all required atoms are
+present in <em>res</em>.</p>
 </td>
 </tr>
 </tbody>
@@ -584,7 +722,7 @@ considered similar</li>
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
       <li>Previous: <a href="frame.html" title="previous chapter">Frame</a></li>
       <li>Next: <a href="graph.html" title="next chapter">Coming to a solution</a></li>
@@ -618,7 +756,7 @@ considered similar</li>
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/sidechain/sidechain_settings.html b/doc/html/sidechain/sidechain_settings.html
index d2515df664ebfdf45dfb4dc6a16ac7c7bd631b95..04d4956386a303f843671075d9f87917299c2474 100644
--- a/doc/html/sidechain/sidechain_settings.html
+++ b/doc/html/sidechain/sidechain_settings.html
@@ -481,7 +481,7 @@ rotamer group (see <a class="reference internal" href="rotamer.html#rotamer-grou
 <h3>Related Topics</h3>
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
-  <li><a href="../developers.html">Documentation For Developers</a><ul>
+  <li><a href="../users.html">Documentation For Users</a><ul>
   <li><a href="index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
       <li>Previous: <a href="graph.html" title="previous chapter">Coming to a solution</a></li>
       <li>Next: <a href="disulfid.html" title="next chapter">Disulfid Bond Evaluation</a></li>
@@ -515,7 +515,7 @@ rotamer group (see <a class="reference internal" href="rotamer.html#rotamer-grou
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
diff --git a/doc/html/users.html b/doc/html/users.html
index ea7682353f899fa8dfa3665a2aea5853850efebc..f9372cfe7aef7c8b66691e034ca9668922ac36ed 100644
--- a/doc/html/users.html
+++ b/doc/html/users.html
@@ -24,7 +24,7 @@
     <script type="text/javascript" src="_static/underscore.js"></script>
     <script type="text/javascript" src="_static/doctools.js"></script>
     <link rel="top" title="ProMod3 0 documentation" href="index.html" />
-    <link rel="next" title="Documentation For Developers" href="developers.html" />
+    <link rel="next" title="Getting Started" href="gettingstarted.html" />
     <link rel="prev" title="Welcome To ProMod3’s Documentation!" href="index.html" />
    
   
@@ -40,6 +40,54 @@
             
   <div class="section" id="documentation-for-users">
 <h1>Documentation For Users<a class="headerlink" href="#documentation-for-users" title="Permalink to this headline">¶</a></h1>
+<p>This section is for users of ProMod3. It describes how to compile and run
+scripts using the functionality of this library.</p>
+<p>Contents:</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="gettingstarted.html">Getting Started</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#get-and-run-project">Get and Run ProMod3</a></li>
+<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#modelling-pipeline">Modelling pipeline</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="buildsystem.html">Building ProMod3</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="buildsystem.html#dependencies">Dependencies</a></li>
+<li class="toctree-l2"><a class="reference internal" href="buildsystem.html#using-cmake">Using CMake</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="modelling/index.html"><code class="docutils literal"><span class="pre">modelling</span></code> - Protein Modelling</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#modelling-pipeline">Modelling Pipeline</a></li>
+<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#closing-gaps">Closing Gaps</a></li>
+<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#modelling-handle-class">Modelling Handle class</a></li>
+<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#gap-classes">Gap classes</a></li>
+<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#gap-extender-classes">Gap Extender classes</a></li>
+<li class="toctree-l2"><a class="reference internal" href="modelling/index.html#detecting-ring-punches">Detecting ring punches</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="loop/index.html"><code class="docutils literal"><span class="pre">loop</span></code> - Loop Modelling</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="loop/backbone.html">Representing Loops</a></li>
+<li class="toctree-l2"><a class="reference internal" href="loop/torsion_sampler.html">Have a closer look at backbone dihedral angles</a></li>
+<li class="toctree-l2"><a class="reference internal" href="loop/structure_db.html">A dump for structural data</a></li>
+<li class="toctree-l2"><a class="reference internal" href="loop/loop_closing.html">Closing Loops - adapt them to the environment</a></li>
+<li class="toctree-l2"><a class="reference internal" href="loop/backbone_loop_score.html">Loop Scoring</a></li>
+<li class="toctree-l2"><a class="reference internal" href="loop/monte_carlo.html">Generating Loops DeNovo</a></li>
+<li class="toctree-l2"><a class="reference internal" href="loop/load_loop_objects.html">Loading Precomputed Loop Objects</a></li>
+<li class="toctree-l2"><a class="reference internal" href="loop/helper_classes.html">Helper Classes</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="sidechain/index.html"><code class="docutils literal"><span class="pre">sidechain</span></code> - Sidechain Modelling</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="sidechain/index.html#reconstruct-function">Reconstruct Function</a></li>
+<li class="toctree-l2"><a class="reference internal" href="sidechain/index.html#sidechain-module-functionality">Sidechain Module Functionality</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="core/index.html"><code class="docutils literal"><span class="pre">core</span></code> - ProMod3 Core Functionality</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="core/pm3argparse.html"><code class="docutils literal"><span class="pre">pm3argparse</span></code> - Parsing Command Lines</a></li>
+<li class="toctree-l2"><a class="reference internal" href="core/helper.html"><code class="docutils literal"><span class="pre">helper</span></code> - Shared Functionality For the Everything</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="core/setcompoundschemlib.html"><code class="docutils literal"><span class="pre">SetCompoundsChemlib()</span></code></a></li>
+</ul>
+</div>
 </div>
 
 
@@ -52,7 +100,7 @@
 <ul>
   <li><a href="index.html">Documentation overview</a><ul>
       <li>Previous: <a href="index.html" title="previous chapter">Welcome To ProMod3&#8217;s Documentation!</a></li>
-      <li>Next: <a href="developers.html" title="next chapter">Documentation For Developers</a></li>
+      <li>Next: <a href="gettingstarted.html" title="next chapter">Getting Started</a></li>
   </ul></li>
 </ul>
 </div>
@@ -81,7 +129,7 @@
       <div class="clearer"></div>
     </div>
     <div class="footer">
-      &copy;2015, Bienchen.
+      &copy;2016, Bienchen.
       
       |
       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>