diff --git a/loop/data/backbone_loop_scorer.dat b/loop/data/backbone_loop_scorer.dat
index 8e7f6b7f85c15c48c4fd35417397b0703ff28a80..2d787a1dd00166fcac6b78c1fbcbbc4a95cd7bc4 100644
Binary files a/loop/data/backbone_loop_scorer.dat and b/loop/data/backbone_loop_scorer.dat differ
diff --git a/loop/doc/CMakeLists.txt b/loop/doc/CMakeLists.txt
index aad8160d272b8cb04a9838fd8231222db6761eec..ddd0b2da74420f56ef39b8b55c65c8d5104be4f6 100644
--- a/loop/doc/CMakeLists.txt
+++ b/loop/doc/CMakeLists.txt
@@ -1,14 +1,13 @@
 set(LOOP_RST
 index.rst
 torsion_sampler.rst
-loop_candidate.rst
 loop_closing.rst
 backbone.rst
 backbone_loop_score.rst
 monte_carlo.rst
 structure_db.rst
 load_loop_objects.rst
-
+helper_classes.rst
 )
 
 add_doc_source(NAME loop RST ${LOOP_RST})
diff --git a/loop/doc/backbone.rst b/loop/doc/backbone.rst
index 13befcdcbfc4bb2f97cde23c802cd302f872aec1..14508e46ba1c01eb6e02497c8904d5a4f0c50cb9 100644
--- a/loop/doc/backbone.rst
+++ b/loop/doc/backbone.rst
@@ -120,11 +120,18 @@ The Basic Building Blocks
     Applies a transformation to the coordinates of the backbone
 
     :param transformation_matrix:       The transformation
-    :type transformation_matrix:        :class:`ost.geom.Mat4`
+    :type transformation_matrix:        :class:`ost.geom.Mat4` / :class:`ost.geom.Transform`
+
+  .. method:: GetTransform(target)
+
+     Get transformation performing a minimum RMSD transformation onto
+     *target* considering the positions of the N, CA and C atoms.
+
+    :param target:    The target positions
 
-  .. method:: GetTransform()
+    :type target:     :class:`Backbone` / :class:`ost.mol.ResidueHandle`          
 
-    :returns:         The transformation currently applied on the backbone
+    :returns:         A 4x4 transformation matrix
     :rtype:           :class:`ost.geom.Mat4`
 
 
@@ -197,24 +204,23 @@ Editing Full Stretches Of Backbone Residues
 
     :return:            The amino acid sequence
 
-  .. method:: InsertInto(chain,n_stem,c_stem,[remodel_cterminal_o = True])
+  .. 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
     be replaced, otherwise they will be added to the entity.
 
     :param chain:                 The chain
-    :param n_stem:                The residue number of the n_stem
-    :param c_stem:                The residue number of the c_stem
+    :param start_resnum:          Residue number defining the start location of
+                                  insertion
     :param remodel_cterminal_o:   The position of the cterminal o is dependent
                                   on the residue after the c_stem. If this flag
                                   is set and the residue after the cterminus is 
                                   present in **chain**, the according oxygen
                                   position gets recalculated.
-    :type entity:     :class:`ost.mol.ChainHandle`
-    :type n_stem:     :class:`int`
-    :type c_stem:     :class:`int`
-    :type remodel_cterminal_o: :class:`bool`
+    :type chain:                 :class:`ost.mol.ChainHandle`
+    :type start_resnum:          :class:`int` / :class:`ost.mol.ResNum`
+    :type remodel_cterminal_o:   :class:`bool`
 
   .. method:: ReconstructCBetaPositions()
 
diff --git a/loop/doc/backbone_loop_score.rst b/loop/doc/backbone_loop_score.rst
index 201939e2f0d73b1eda9162fbf101e3a21ef3124d..55acd78a2b2914f613c3534380a89550d911d3b7 100644
--- a/loop/doc/backbone_loop_score.rst
+++ b/loop/doc/backbone_loop_score.rst
@@ -15,7 +15,6 @@ 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
 --------------------------------------------------------------------------------
 
@@ -58,6 +57,44 @@ The BackboneLoopScorer
     :raises:            :class:`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
+
+    :param dist_bins:   Number of equally sized bins to describe the
+                        distances in a discrete manner
+
+    :param angle_bins:  Number of equally sized bins to describe the angle
+                        parameters in a discrete manner (range of [0, pi])
+
+    :param dihedral_bins: Number of equally sized bins to describe the dihedral
+                          parameter in a discrete manner (range of [-pi,pi])
+
+    :param seq_sep:     Minimal separation in sequence two residues must
+                        have to be considered
+
+    :type dist_cutoff: :class:`float`
+    :type dist_bins:   :class:`int`
+    :type angle_bins:  :class:`int`
+    :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
+
   .. method:: SetTorsionPotentialParameters(group_definitions, torsion_bins)
 
     Parametrizes a torsion statistical potential, that assigns energies based
@@ -82,7 +119,8 @@ The BackboneLoopScorer
   .. 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.
+    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
@@ -145,6 +183,17 @@ The BackboneLoopScorer
                         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.
+
   .. method:: SetCBetaEnergy(a, b, bin, e)
 
     :param a:           Identity of first interaction partner.          
@@ -162,6 +211,31 @@ The BackboneLoopScorer
     :raises:            :class:`RuntimeError` if invalid bin or amino acid is 
                         given
 
+  .. method:: SetReducedEnergy(a, b, dist_bin, alpha_bin, beta_bin, gamma_bin, e)
+
+    :param a:           Identity of first interaction partner.          
+    :param b:           Identity of second interaction partner. 
+    :param dist_bin:    Discrete bin describing the interaction distance based
+                        on the previously defined *dist_cutoff* and *dist_bins*.
+    :param alpha_bin:   Discrete bin describing the alpha angle based
+                        on the previously defined *angle_bins*.
+    :param beta_bin:    Discrete bin describing the beta angle based
+                        on the previously defined *angle_bins*.
+    :param gamma_bin:   Discrete bin describing the gamma dihedral based
+                        on the previously defined *dihedral_bins*.
+    :param e:           Energy to be set         
+
+    :type a:            :class:`ost.conop.AminoAcid`                 
+    :type b:            :class:`ost.conop.AminoAcid`
+    :type dist_bin:     :class:`int`
+    :type alpha_bin:    :class:`int`
+    :type beta_bin:     :class:`int`
+    :type gamma_bin:    :class:`int`
+    :type e:            :class:`float`
+
+    :raises:            :class:`RuntimeError` if invalid bin or amino acid is 
+                        given
+
   .. method:: SetTorsionEnergy(group_id_idx, phi_bin, psi_bin, e)
 
     :param group_id_idx: Index of group identifier given at setting up the 
@@ -217,6 +291,20 @@ The BackboneLoopScorer
     :raises:            :class:`RuntimeError` if state is not in [0,1,2] or one
                         of the bins is invalid.
 
+
+  .. method:: SetSSAgreementScore(psipred_state, int psipred_confidence,
+                                  dssp_state, score)
+
+    :param psipred_state: must be one of ['H','E','C']
+    :param psipred_confidence: must be in [0,9]
+    :param dssp_state:  must be one of ['H','E','C','G','B','S','T','I']
+    :param score:       score to be set
+
+    :type psipred_state: :class:`str`
+    :type psipred_confidence: :class:`int`
+    :type dssp_state:   :class:`str`
+    :type score:        :class:`float`    
+
   .. method:: Initialize(seqres)
 
     Set up internal scorer with given seqres
@@ -240,6 +328,32 @@ The BackboneLoopScorer
     :raises:            :class:`RuntimeError` when *seqres_list* contains
                         element with invalid one letter code
 
+  .. method:: SetPsipredPrediction(pred)
+
+    Internally sets the psipred prediction, which is necessary to calculate the
+    SSAgreementScore.
+
+    :param pred:        The prediction
+    :type pred:         :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.
+
+  .. 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)
 
     Sets structural environment with which loops to be scored interact.
@@ -276,6 +390,22 @@ The BackboneLoopScorer
                         when either start_resnum or chain_index point to
                         invalid positions in the SEQRES.
 
+  .. method:: ClearEnvironment(start_resnum, num_residues, [chain_index=0])
+
+    Clears a stretch of length *num_residues* in the environment in chain 
+    with idx *chain_index* starting from residue number *start_resnum*
+
+    :param start_resnum: Start of stretch to clear
+    :param num_residues: Length of stretch to clear
+    :param chain_index: Chain the stretch belongs to
+
+    :type start_resnum: :class:`int`
+    :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.
+
   .. method:: CalculateClashScore(bb_list, start_resnum, [chain_index=0])
 
     :param bb_list:     Loop to calculate the clash score
@@ -313,6 +443,25 @@ The BackboneLoopScorer
                         according potential or scorer have never been properly
                         initialized.
 
+  .. method:: CalculateReducedScore(bb_list, start_resnum, [chain_index=0])
+
+    :param bb_list:     Loop to calculate the reduced 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: 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.
+
   .. method:: CalculateTorsionScore(bb_list, start_resnum, [chain_index=0])
 
     :param bb_list:     Loop to calculate the torsion score
@@ -370,12 +519,10 @@ The BackboneLoopScorer
                         according potential or scorer have never been properly
                         initialized.
 
-  .. method:: CalculateDSSPHBondScore(bb_list, start_resnum, [chain_index=0])
 
-    Instead of calculate an hbond score based on a statistical potential,
-    an the DSSP hbond energy function gets evaluated in this function.
+  .. method:: CalculateSSAgreementScore(bb_list, start_resnum, [chain_index=0])
 
-    :param bb_list:     Loop to calculate the hbond score
+    :param bb_list:     Loop to calculate the SSAgreement 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
@@ -384,12 +531,14 @@ The BackboneLoopScorer
     :type start_resnum: :class:`int`
     :type chain_index:  :class:`int`
 
-    :returns: hbond score
+    :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 when the 
-                        scorer has never been properly initialized.
+                        invalid positions in the SEQRES or, the 
+                        scorer have never been properly initialized,
+                        or when no :class:`PsipredPrediction` is set to 
+                        the scorer.
 
   .. method:: TransOmegaTorsions(bb_list, [thresh = 20/180*pi, allow_prepro_cis=True])
 
diff --git a/loop/doc/helper_classes.rst b/loop/doc/helper_classes.rst
new file mode 100644
index 0000000000000000000000000000000000000000..9c9e87fe2f18e79b12363274f74c5da1aeb46850
--- /dev/null
+++ b/loop/doc/helper_classes.rst
@@ -0,0 +1,552 @@
+Helper Classes
+================================================================================
+
+.. currentmodule:: promod3.loop
+
+This chapter describes helper classes, that are somehow related to the 
+functionality in the loop module.
+
+Psipred
+--------------------------------------------------------------------------------
+
+  
+
+
+.. class:: PsipredPrediction
+
+  A container for the secondary structure prediction by Psipred.
+
+  .. method:: PsipredPrediction()
+    
+    Constructs empty container
+
+  .. method:: PsipredPrediction(prediction, confidence)
+
+    Constructs container with given content
+
+    :param prediction:  Secondary structure prediction as element in ['H','E','C']
+    :param confidence:  Confidence of prediction as element in [0,9]
+
+    :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
+
+  .. method:: FromHHM(filename)
+
+    Static function to Load a :class:`PsipredPrediction` object from hhm file, 
+    as they are provided by the hhsearch suite
+
+    :param filename:    Name of file
+    :type filename:     :class:`str`
+
+  .. method:: FromHoriz(filename)
+
+    Static function to Load a :class:`PsipredPrediction` object from horiz file, 
+    as they are produced by the psipred executable
+
+    :param filename:    Name of file
+    :type filename:     :class:`str` 
+
+  .. method:: Add(prediction, confidence)
+
+    Adds and appends a single residue psipred prediction at the end
+
+    :param prediction:  Prediction, must be one in ['H','E','C']
+    :param confidence:  Confidence of prediction, must be in [0,9]
+
+    :type prediction:   :class:`str`
+    :type confidence:   :class:`int`
+
+    :raises:            :class:`RuntimeError` if input contains invalid elements
+
+  .. method:: Extract(from, to)
+
+    Extracts content and returns a sub-:class:`PsipredPrediction` with range **from**
+    to **to**, not including **to** itself
+
+    :param from:        Idx to start
+    :param to:          Idx to end
+
+    :type from:         :class:`int`
+    :type to:           :class:`int`
+
+    :returns:           :class:`PsipredPrediction` with the specified range
+
+    :raises:            :class:`RuntimeError` if **from** or **to** are invalid
+
+
+
+  .. method:: GetPrediction(idx)
+
+    :param idx:         Index to get prediction from
+    :type idx:          :class:`int`
+    :returns:           Psipred prediction at pos **idx**
+    :raises:            :class:`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  
+
+  .. method:: GetPredictions()
+
+    Get all the predictions in the container
+
+    :returns:           :class:`list` containing all the predictions in the container
+
+
+  .. method:: GetConfidences()
+
+    Get all the confidences in the container
+
+    :returns:           :class:`list` containing all the confidences in the container
+
+
+  .. method:: __len__()
+
+    :returns:           Number of elements in container
+
+
+
+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).
+
+  :param backbone_list:  Positions of the backbone atoms
+
+  :type backbone_list:   :class:`BackboneList`
+
+  .. method:: CARMSD(other)
+
+    Calculates the C-alpha RMSD between this loop candidate and an *other* loop candidate, after superposition.
+    
+    :param other:        Other loop
+
+    :type other:         :class:`LoopCandidate`
+
+  .. method:: RMSD(other)
+
+    Calculates the RMSD between this loop candidate and an *other* loop candidate, after superposition.
+    
+    :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` 
+
+  .. attribute:: bb_list
+
+    The backbone list containing the positions of the backbone atoms
+
+    :type: :class:`BackboneList`
+
+
+  .. attribute:: clash_score
+
+    The clash score of the loop candidate
+
+    :type: :class:`float`
+
+  .. attribute:: cbeta_score
+
+    The C-beta score of the loop candidate
+
+    :type: :class:`float`
+
+  .. attribute:: reduced_score
+
+    The reduced score of the loop candidate
+
+    :type: :class:`float`
+
+  .. attribute:: torsion_score
+
+    The torsion score of the loop candidate
+
+    :type: :class:`float`
+
+  .. attribute:: packing_score
+
+    The packing score of the loop candidate
+
+    :type: :class:`float`
+
+  .. attribute:: hbond_score
+
+    The HBond score of the loop candidate
+    
+    :type: :class:`float`
+
+  .. attribute:: ss_agreement
+
+    The SSAgreement score of the loop candidate
+
+    :type: :class:`float`
+
+  .. attribute:: combined_score
+
+    Score value intended to be a placeholder for an arbitrary combination
+    of the other scores
+
+    :type: :class:`float`
+
+
+.. class:: LoopCandidates(seq)
+
+  The *LoopCandidates* is a helper class used as a container for 
+  :class:`LoopCandidate` objects enforcing consistent length
+  and sequence among them. It can either be filled manually or
+  generated using static filling functions using the functionality
+  from the :class:`FragDB` or Monte Carlo algorithms. Once it contains
+  candidates you can apply closing, scoring or clustering algorithms on the content.
+  Note, that you have to attach a scorer object before any scoring action.
+
+  :param seq:            The sequence being enforced for all candidates
+
+  :type sequence:        :class:`str`
+
+
+  .. staticmethod:: FillFromDatabase(n_stem, c_stem, seq, frag_db, \
+                                     structural_db, extended_search=False)
+    
+    Searches for loop candidates matching the length (number of residues in *seq*) and geometry (of *n_stem* and *c_stem*) of the loop to be modelled in a fragment database.
+
+    :param n_stem:         The residue at the N-terminal end of the loop 
+    :param c_stem:         The residue at the C-terminal end of the loop 
+    :param seq:            The sequence of residues to be added including the
+                           *n_stem* and *c_stem*
+    :param frag_db:        The fragment database
+    :param structural_db:  The according structural database
+    :param extended_search: Whether search should be extended to fragments
+                            matching the geometry of the *n_stem* and *c_stem*
+                            a bit less precisely.
+
+    :type n_stem:          :class:`ost.mol.ResidueHandle`
+    :type c_stem:          :class:`ost.mol.ResidueHandle`
+    :type seq:             :class:`str`
+    :type frag_db:         :class:`FragDB`
+    :type structural_db:   :class:`StructureDB`
+    :type extended_search: :class:`bool`
+
+    :returns:              A list of loop candidates
+    :rtype:                :class:`LoopCandidates`
+
+  .. staticmethod:: FillFromMonteCarloSampler(seq, num_loops, steps, \
+                                              sampler, closer, scorer, cooler)
+                    FillFromMonteCarloSampler(initial_bb, seq, num_loops, steps, \
+                                              sampler, closer, scorer, cooler)
+    
+    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.
+ 
+    :param initial_bb: Initial configuration used for the sampling
+    :param seq:        The sequence of residues to be sampled
+    :param num_loops:  Number of loop candidates to return
+    :param steps:      Number of MC steps to perform for each loop candidate
+                       generated
+    :param sampler:    Used to generate a new configuration at each MC step
+    :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
+
+    :type initial_bb:  :class:`BackboneList`
+    :type seq:         :class:`str`
+    :type num_loops:   :class:`int`
+    :type steps:       :class:`int`
+    :type sampler:     :ref:`mc-sampler-object`
+    :type closer:      :ref:`mc-closer-object`
+    :type scorer:      :ref:`mc-scorer-object`
+    :type cooler:      :ref:`mc-cooler-object`
+
+    :returns:          The resulting candidates
+    :rtype:            :class:`LoopCandidates`
+
+    :raises: A :exc:`RuntimeError`, if *initial_bb* is not given and the Monte
+             Carlo sampler failed to initialize (i.e. stems are too far apart)
+    :raises: A :exc:`RuntimeError`, if *initial_bb* is given and it is
+             inconsistent with *seq*
+
+  .. method:: ClusterCandidates(max_dist, neglect_size_one = true)
+
+    Clusters the loop candidates according to their pairwise CARMSD using a greedy
+    hierarchical clustering algorithm. Every candidate gets assigned a unique cluster.
+    At every clustering step, the two clusters with shortest distance get merged, with
+    the distance definition being the maximal CARMSD between any of the members
+    of the two clusters.
+
+    :param max_dist:    Maximal distance two clusters can have to be merged
+    :param neglect_size_one: Whether clusters should be added to the return
+                             list if they only contain one :class:`LoopCandidate`
+
+    :type max_dist:     :class:`float`
+    :type neglect_size_one: :class:`bool`
+
+
+    :returns:   A list of :class:`LoopCandidates`. Each element in the list
+                corresponds to the candidates in one cluster.
+
+  .. method:: ApplyCCD(n_stem, c_stem, max_iterations=1000, \
+                       rmsd_cutoff=0.1, keep_non_converged=false, random_seed=0)
+              ApplyCCD(n_stem, c_stem, torsion_sampler, max_iterations=1000, \
+                       rmsd_cutoff=0.1, keep_non_converged=false, random_seed=0)
+              ApplyCCD(n_stem, c_stem, torsion_samplers, max_iterations=1000, \
+                       rmsd_cutoff=0.1, keep_non_converged=false, random_seed=0)
+
+    Closes all :class:`LoopCandidate` in :class:`LoopCandidates` using the CCD
+    algorithm (i.e. modifies the :class:`LoopCandidate` so that its stem residues 
+    match those of *n_stem* and *c_stem*). CCD (cyclic coordinate descent, see
+    :class:`~promod3.loop.CCD`) is an iterative minimization algorithm.
+
+    If *torsion_sampler* or *torsion_samplers* is given, it is used at each step
+    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 torsion_sampler:      The torsion sampler
+    :param torsion_samplers:     A list containing one torsion sampler for each
+                                 residue in the loop
+    :param max_iterations:       Maximum number of iteration
+    :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
+    :param random_seed:          seed for random number generator used to
+                                 accept/reject moves in CCD algorithm
+
+    :type n_stem:               :class:`ost.mol.ResidueHandle`
+    :type c_stem:               :class:`ost.mol.ResidueHandle`
+    :type torsion_sampler:      :class:`TorsionSampler`
+    :type torsion_samplers:     :class:`list` of :class:`TorsionSampler`
+    :type max_iterations:       :class:`int`
+    :type rmsd_cutoff:          :class:`float`
+    :type keep_non_converged:   :class:`bool`
+    :type random_seed:          :class:`int`
+
+
+  .. method:: ApplyKIC(n_stem, c_stem, pivot_one, pivot_two, pivot_three)
+
+    Closes all :class:`LoopCandidate` in :class:`LoopCandidates` (i.e. modifies
+    the :class:`LoopCandidate` so that its stem residues match those of
+    *n_stem* and *c_stem*, which are the stem residues of the loop being
+    modelled), using the KIC algorithm. This algorithm finds analytical
+    solutions for closing the loop by modifying the torsion angles of just
+    three pivot residues. Due to the underlying mathematical formalism in KIC,
+    up to 16 solutions can be found for every candidate. This leads to an
+    increase in number of loops. 
+
+    :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 pivot_one:   First pivot residue
+    :param pivot_two:   Second pivot residue 
+    :param pivot_three: Third pivot residue 
+
+    :type n_stem:       :class:`ost.mol.ResidueHandle`
+    :type c_stem:       :class:`ost.mol.ResidueHandle`
+    :type pivot_one:    :class:`int`
+    :type pivot_two:    :class:`int`
+    :type pivot_three:  :class:`int`
+
+
+  .. method:: Add(loop_candidate)
+
+    Add a loop candidate to the list of candidates
+
+    :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
+
+  .. method:: Add(bb_list)
+
+    Add a loop candidate to the list of candidates from a list of backbone positions
+
+    :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
+ 
+  .. method:: Remove(index)
+
+    Remove a loop candidate from the list of candidates.
+
+    :param index:         The index of the candidate that will be removed
+    :type index:          :class:`int`
+
+  .. method:: AttachScorer(scorer)
+
+    Attaches a scorer to the :class:`LoopCandidates`. The scorer contains the information about the environment of the loop candidates and is mandatory to calculate the different scores for the loop candidates.
+
+    :param scorer:            The scorer
+    :type scorer:             :class:`BackboneLoopScorer`
+
+
+  .. method:: CalculateClasScores(start_resnum, [chain_index=0])
+
+    Calculates and assigns the clash score for each :class:`LoopCandidate`. 
+
+    :param start_resnum:    Residue number of the starting residue of the candidates being scored
+                            (residue numbers start with one!)
+    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneLoopScorer`)
+
+    :type start_resnum:     :class:`int`
+    :type chain_index:      :class:`int`       
+
+
+  .. method:: CalculateBetaScores(start_resnum, [chain_index=0])
+
+    Calculates and assigns the cbeta score for each :class:`LoopCandidate`.
+
+    :param start_resnum:    Residue number of the starting residue of the candidates being scored
+                            (residue numbers start with one!)
+    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneLoopScorer`)
+    
+    :type start_resnum:     :class:`int`
+    :type chain_index:      :class:`int`
+
+  .. method:: CalculateReducedScores(start_resnum, [chain_index=0])
+
+    Calculates and assigns the reduced score for each :class:`LoopCandidate`.
+
+    :param start_resnum:    Residue number of the starting residue of the candidates being scored
+                            (residue numbers start with one!)
+    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneLoopScorer`)
+    
+    :type start_resnum:     :class:`int`
+    :type chain_index:      :class:`int`
+
+
+  .. method:: CalculateTorsionScores(start_resnum, [chain_index=0])
+
+    Calculates and assigns the torsion score for each :class:`LoopCandidate`.
+
+    :param start_resnum:    Residue number of the starting residue of the candidates being scored
+                            (residue numbers start with one!)
+    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneLoopScorer`)
+    
+    :type start_resnum:     :class:`int`
+    :type chain_index:      :class:`int`
+  .. method:: CalculatePackingScores(start_resnum, [chain_index=0])
+
+    Calculates and assigns the packing score for each :class:`LoopCandidate`.
+
+    :param start_resnum:    Residue number of the starting residue of the candidates being scored
+                            (residue numbers start with one!)
+    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneLoopScorer`)
+    
+    :type start_resnum:     :class:`int`
+    :type chain_index:      :class:`int`
+
+  .. method:: CalculateHBondcores(start_resnum, [chain_index=0])
+
+    Calculates and assigns the HBond score for each :class:`LoopCandidate`. 
+
+    :param start_resnum:    Residue number of the starting residue of the candidates being scored
+                            (residue numbers start with one!)
+    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneLoopScorer`)
+    
+    :type start_resnum:     :class:`int`
+    :type chain_index:      :class:`int`
+
+  .. method:: CalculateSSAgreementScores(start_resnum, [chain_index=0])
+
+    Calculates and assigns the SSAgreement score for each :class:`LoopCandidate`. 
+
+    :param start_resnum:    Residue number of the starting residue of the candidates being scored
+                            (residue numbers start with one!)
+    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneLoopScorer`)
+    
+    :type start_resnum:     :class:`int`
+    :type chain_index:      :class:`int`
+
+
+  .. method:: CalculateCombinedScores(linear_weights, start_resnum, [chain_index=0])
+
+    Calculates and assigns an arbitrary linear combination of all the available scores for each :class:`LoopCandidate`. 
+
+     
+    :param linear_weights:  Defining the linear weights of the scores as key value pairs. Allowed
+                            keys are: ["cbeta","clash","torsion","cb_packing","hbond","ss_agreement", "reduced", "intercept"]
+                            For every key, the according function in the attached 
+                            :class:`BackboneLoopScorer` gets called and the returned score added to
+                            the final score with the according weight. If there is an intercept given,
+                            the according value also gets added to the final score.
+    :param start_resnum:    Residue number of the starting residue of the candidates being scored
+                            (residue numbers start with one!)
+    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneLoopScorer`)
+    
+    :type linear_weights:   :class:`dict`
+    :type start_resnum:     :class:`int`
+    :type chain_index:      :class:`int`
+
+ 
+
+  .. method:: GetAVGClashScore()
+
+    :return:      The average of the clash scores of all :class:`LoopCandidate`.
+    :rtype:       float
+
+  .. method:: GetAVGCBetaScore()
+
+    :return:      The average of the cbeta scores of all :class:`LoopCandidate`.
+    :rtype:       float
+
+  .. method:: GetAVGReducedScore()
+
+    :return:      The average of the reduced scores of all :class:`LoopCandidate`.
+    :rtype:       float
+
+  .. method:: GetAVGTorsionScore()
+
+    :return:      The average of the torsion scores of all :class:`LoopCandidate`.
+    :rtype:       float
+
+  .. method:: GetAVGPackingScore()
+
+    :return:      The average of the packing scores of all :class:`LoopCandidate`.
+    :rtype:       float
+
+  .. method:: GetAVGHBondscore()
+
+    :return:      The average of the HBond scores of all :class:`LoopCandidate`.
+    :rtype:       float
+
+  .. method:: GetAVGSSAgreementscore()
+
+    :return:      The average of the SSAgreement scores of all :class:`LoopCandidate`.
+    :rtype:       float
+
+  .. method:: GetAVGCombinedScore()
+
+    :return:      The average of the combined scores of all :class:`LoopCandidate`.
+    :rtype:       float
\ No newline at end of file
diff --git a/loop/doc/index.rst b/loop/doc/index.rst
index 4d7e4abf1979161b2b1bba9e59590f11892f5d1c..b74674a2960992ed55bb408b85bcefcb8e242574 100644
--- a/loop/doc/index.rst
+++ b/loop/doc/index.rst
@@ -45,7 +45,7 @@ you a starting point to get an idea of what can be done.
   
   #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()
+  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()
@@ -57,10 +57,12 @@ you a starting point to get an idea of what can be done.
   #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
+  #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()
-  loop_candidates.CalculateClashScores()
+  loop_candidates.CalculateCBetaScores(24)
+  loop_candidates.CalculateClashScores(24)
   
   #we simply sum up the previously calculated scores and search for the
   #loop with minimal score
@@ -72,10 +74,10 @@ you a starting point to get an idea of what can be done.
       min_score = score
       min_candidate = i
     
-  #let's insert that loop and save the structure down to disk
-  loop_candidates.InsertInto(crambin,min_candidate)
-  io.SavePDB(crambin,"remodeled_crambin.pdb")
-
+  #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")
 
 Contents:
 
@@ -88,5 +90,5 @@ Contents:
    Closing Loops - adapt them to the environment <loop_closing>
    Loop Scoring <backbone_loop_score>
    Generating Loops DeNovo <monte_carlo>
-   Handle several loop candidates at once <loop_candidate>
    Loading Precomputed Loop Objects <load_loop_objects>
+   Helper Classes <helper_classes>
diff --git a/loop/doc/load_loop_objects.rst b/loop/doc/load_loop_objects.rst
index 0a5d8bb7e51f973ca739c3a91f849ee934a79051..f14289b9b7a92c14936a626f943ae26b20f01f68 100644
--- a/loop/doc/load_loop_objects.rst
+++ b/loop/doc/load_loop_objects.rst
@@ -65,7 +65,8 @@ Several data objects are used throughout the loop module.
 
 .. method:: LoadFragDB()
 
-  Loads and returns a FragDB with the default StructureDB attached.
+  Loads and returns a FragDB containing fragments up to the length of 14,
+  therefore capable of bridging gaps up to the length of 12.
 
   :returns:             The Fragment database
   :rtype:               :class:`FragDB`
diff --git a/loop/doc/loop_candidate.rst b/loop/doc/loop_candidate.rst
deleted file mode 100644
index d5cdd9b6c52b5524a6e7ca3488bc4d1d79a64cc6..0000000000000000000000000000000000000000
--- a/loop/doc/loop_candidate.rst
+++ /dev/null
@@ -1,388 +0,0 @@
-Loop Candidates
-================================================================================
-
-.. currentmodule:: promod3.loop
-
-.. 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).
-
-  :param backbone_list:  Positions of the backbone atoms
-
-  :type backbone_list:   :class:`BackboneList`
-
-  .. method:: CARMSD(other)
-
-    Calculates the C-alpha RMSD between this loop candidate and an *other* loop candidate, after superposition.
-    
-    :param other:        Other loop
-
-    :type other:         :class:`LoopCandidate`
-
-  .. method:: RMSD(other)
-
-    Calculates the RMSD between this loop candidate and an *other* loop candidate, after superposition.
-    
-    :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` 
-
-  .. attribute:: bb_list
-
-    The backbone list containing the positions of the backbone atoms
-
-    :type: :class:`BackboneList`
-
-  .. attribute:: stem_rmsd
-
-    The backbone RMSD of the two stem residues of the loop candidate relative to the stem residues for which the loop is being modelled. This is a measure of how well the loop candidate fits in the structure where it is being added.
-
-    :type: :class:`float`
-
-  .. attribute:: clash_score
-
-    The clash score of the loop candidate
-
-    :type: :class:`float`
-
-  .. attribute:: cbeta_score
-
-    The C-beta score of the loop candidate
-
-    :type: :class:`float`
-
-  .. attribute:: torsion_score
-
-    The torsion score of the loop candidate
-
-    :type: :class:`float`
-
-  .. attribute:: packing_score
-
-    The packing score of the loop candidate
-
-    :type: :class:`float`
-
-  .. attribute:: hbond_score
-
-    The H-bond score of the loop candidate
-    
-    :type: :class:`float`
-
-  .. attribute:: dssp_hbond_score
-
-    The DSSP H-bond of the loop candidate
-
-    :type: :class:`float`
-
-
-.. class:: LoopCandidates(n_stem,c_stem,seq)
-
-  The *LoopCandidates* is the basic object used for loop modelling.
-  It contains the positions of the two anchor residues, the *n_stem* and *c_stem*
-  residues, and the sequence of the residues to be modelled in between these 
-  anchor residues.
-  It also contains a list of :class:`LoopCandidate`, which are possible
-  conformations of the backbone between the stem residues.
-
-
-  :param n_stem:         The residue at the N-terminal end of the loop 
-  :param c_stem:         The residue at the C-terminal end of the loop 
-  :param seq:            The sequence of residues to be added between the
-                         *n_stem* and *c_stem*
-
-  :type n_stem:          :class:`ost.mol.ResidueHandle`
-  :type c_stem:          :class:`ost.mol.ResidueHandle`
-  :type sequence:        :class:`str`
-
-
-  .. staticmethod:: FillFromDatabase(n_stem, c_stem, seq, frag_db, \
-                                     structural_db, extended_search=False)
-    
-    Searches for loop candidates matching the length (number of residues in *seq*) and geometry (of *n_stem* and *c_stem*) of the loop to be modelled in a fragment database.
-
-    :param n_stem:         The residue at the N-terminal end of the loop 
-    :param c_stem:         The residue at the C-terminal end of the loop 
-    :param seq:            The sequence of residues to be added between the
-                           *n_stem* and *c_stem*
-    :param frag_db:        The fragment database
-    :param structural_db:  The according structural database
-    :param extended_search: Whether search should be extended to fragments
-                            matching the geometry of the *n_stem* and *c_stem*
-                            a bit less precisely.
-
-    :type n_stem:          :class:`ost.mol.ResidueHandle`
-    :type c_stem:          :class:`ost.mol.ResidueHandle`
-    :type seq:             :class:`str`
-    :type frag_db:         :class:`FragDB`
-    :type structural_db:   :class:`StructureDB`
-    :type extended_search: :class:`bool`
-
-    :returns:              A list of loop candidates
-    :rtype:                :class:`LoopCandidates`
-
-  .. staticmethod:: 
-      FillFromMonteCarloSampler(n_stem, c_stem, seq, num_loops, \
-                                steps, sampler, closer, scorer, cooler)
-      FillFromMonteCarloSampler(n_stem, c_stem, initial_bb, seq, num_loops, \
-                                steps, sampler, closer, scorer, cooler)
-    
-    Uses Monte Carlo simulated annealing to sample the loop to be modelled.
-
-    :param n_stem:     The residue at the N-terminal end of the loop 
-    :param c_stem:     The residue at the C-terminal end of the loop 
-    :param initial_bb: Initial configuration used for the sampling (optional)
-    :param seq:        The sequence of residues to be added between the
-                       *n_stem* and *c_stem*
-    :param num_loops:  Number of loop candidates to return
-    :param steps:      Number of MC steps to perform for each loop candidate
-                       generated
-    :param sampler:    Used to generate a new configuration at each MC step
-    :param closer:     Used to close the loop (make it match the *n_stem* 
-                       and *c_stem* geometry) 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
-
-    :type n_stem:      :class:`ost.mol.ResidueHandle`
-    :type c_stem:      :class:`ost.mol.ResidueHandle`
-    :type initial_bb:  :class:`BackboneList`
-    :type seq:         :class:`str`
-    :type num_loops:   :class:`int`
-    :type steps:       :class:`int`
-    :type sampler:     :ref:`mc-sampler-object`
-    :type closer:      :ref:`mc-closer-object`
-    :type scorer:      :ref:`mc-scorer-object`
-    :type cooler:      :ref:`mc-cooler-object`
-
-    :returns:          A list of loop candidates
-    :rtype:            :class:`LoopCandidates`
-
-    :raises: A :exc:`RuntimeError`, if *initial_bb* is not given and the Monte
-             Carlo sampler failed to initialize (i.e. stems are too far apart)
-    :raises: A :exc:`RuntimeError`, if *initial_bb* is given and it is
-             inconsistent with *seq*
-
-  .. method:: ClusterCandidates()
-
-    Clusters the loop candidates according to their pairwise CA-RMSD using a 
-    FLAME (fuzzy clustering by local approximation fo memberships) clustering 
-    algorithm.
-
-    :returns:  A list of :class:`LoopCandidates`. Each element in the list 
-               corresponds to the candidates in one cluster.
-
-  .. method:: ApplyCCD(max_iterations=1000, rmsd_cutoff=0.1, \
-                       keep_non_converged=false, random_seed=0, step_size=1.0)
-              ApplyCCD(torsion_sampler, max_iterations=1000, rmsd_cutoff=0.1, \
-                       keep_non_converged=false, random_seed=0, step_size=1.0)
-              ApplyCCD(torsion_samplers, max_iterations=1000, rmsd_cutoff=0.1, \
-                       keep_non_converged=false, random_seed=0, step_size=1.0)
-
-    Closes all :class:`LoopCandidate` in :class:`LoopCandidates` using the CCD
-    algorithm (i.e. modifies the :class:`LoopCandidate` so that its stem residues
-    match those of the :class:`LoopCandidates`, which are the stem residues of the
-    loop being modelled). 
-    CCD (cyclic coordinate descent, see :class:`~promod3.loop.CCD`) is an 
-    iterative minimization algorithm.
-
-    If *torsion_sampler* or *torsion_samplers* is given, it is used at each step
-    of the closing to calculate the probability of the proposed move, which is 
-    then accepted (or not) depending on a metropolis criterium.
-
-    :param torsion_sampler:      the torsion sampler
-    :param torsion_samplers:     a list containing one torsion sampler for each
-                                 residue in the loop.
-    :param max_iterations:       maximum number of iteration
-    :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 converge. If this is False, it
-                                 erases loop candidates which didn't converge!
-    :param random_seed:          seed for random number generator
-    :param step_size:            size of the steps taken during loop closing.
-
-    :type torsion_sampler:      :class:`TorsionSampler`
-    :type torsion_samplers:     :class:`list` of :class:`TorsionSampler`
-    :type max_iterations:       :class:`int`
-    :type rmsd_cutoff:          :class:`float`
-    :type keep_non_converged:   :class:`bool`
-    :type random_seed:          :class:`int`
-    :type step_size:            :class:`float`
-
-  .. method:: ApplyKIC(pivot_one,pivot_two,pivot_three)
-
-    Closes all :class:`LoopCandidate` in :class:`LoopCandidates` (i.e. modifies the :class:`LoopCandidate` so that its stem residues match those of the :class:`LoopCandidates`, which are the stem residues of the loop being modelled), using the KIC algorithm. This algorithm finds analytical solutions for closing the loop by modifying the torsion angles of just three pivot residues. Due to the underlying mathematical formalism in KIC, up to 16 solutions can be found for every candidate. This leads to an increase in number of loops. 
-
-    :param pivot_one:     Maximum number of iteration
-    :param pivot_two:     Cutoff in stem residue RMSD used 
-    :param pivot_three:   Wether to keep loop candidates for 
-
-    :type max_iterations:       :class:`int`
-    :type rmsd_cutoff:          :class:`float`
-    :type keep_non_converged:   :class:`bool`
-    :type random_seed:          :class:`int`
-    :type step_size:            :class:`float`
-
-  .. method:: ToEntity(index)
-
-    Transforms the loop candidate with index *index* in the list of candidates into an :class:`ost.mol.EntityHandle`.
-
-    :param index:             The index of the :class:`LoopCandidate` that will be transformed into an class:`ost.mol.EntityHandle`
-    :type index:      :class:`int`
-
-    :returns:         An class:`ost.mol.EntityHandle`
-
-  .. method:: InsertInto(entity,index)
-
-    Inserts the loop candidate with index *index* in the list of candidates into the *entity*.
-
-    :param index:             The index of the :class:`LoopCandidate`
-    :param entity:            The entity
-
-    :type index:      :class:`int`
-    :type entity:     class:`ost.mol.EntityHandle`
-
-  .. method:: CalculateClasScores([chain_index=0])
-
-    Calculates and assigns the clash score for each :class:`LoopCandidate`. Scores include interactions within the loop and between the loop and the environment (set in the scorer).
-
-    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneScorer`)
-    :type chain_index:      :class:`int`       
-
-
-  .. method:: CalculateBetaScores([chain_index=0])
-
-    Calculates and assigns the C-beta score for each :class:`LoopCandidate`. Scores include interactions within the loop and between the loop and the environment (set in the scorer).
-    This score is a pairwise statistical potential based only on C-beta positions.
-
-    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneScorer`)
-    :type chain_index:      :class:`int`  
-
-  .. method:: CalculateTorsionScores([chain_index=0])
-
-    Calculates and assigns the torsion score for each :class:`LoopCandidate`. This score only includes contributions from the torsion angles of the :class:`LoopCandidate`.
-
-    This score is a statistical potential based only on backbone dihedral angles specific for triplet of residues (torsion potential depends on the identity of the residue and its two neighbors).
-
-    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneScorer`)
-    :type chain_index:      :class:`int`  
-
-  .. method:: CalculatePackingScores([chain_index=0])
-
-    Calculates and assigns the packing score for each :class:`LoopCandidate`. Scores include interactions within the loop and between the loop and the environment (set in the scorer).
-    This score is a statistical potential measuring and scoring the solvent exposure of the residues.
-
-    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneScorer`)
-    :type chain_index:      :class:`int`  
-
-  .. method:: CalculateHBondcores([chain_index=0])
-
-    Calculates and assigns the HBond score for each :class:`LoopCandidate`. Scores include interactions within the loop and between the loop and the environment (set in the scorer).
-    This score measures the energy of H-bonds.
-
-    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneScorer`)
-    :type chain_index:      :class:`int`  
-
-  .. method:: CalculateDSSPHBondScores([chain_index=0])
-
-    Calculates and assigns the C-beta score for each :class:`LoopCandidate`. Scores include interactions within the loop and between the loop and the environment (set in the scorer).
-    This score measures the energy of H-bonds as defined by DSSP.
-
-    :param chain_index:     The index of the chain to which the loop belongs (index relative to the entity forming the environment in the :class:`BackboneScorer`)
-    :type chain_index:      :class:`int`  
-
-  .. method:: CalculateStemRMSD()
-
-    Calculates and assigns the stem RMSD (i.e. the RMSD between the stem residues of the loop candidate and the stem residues of the loop being modelled) for each :class:`LoopCandidate`.
-
-  .. method:: GetAVGClasScore()
-
-    :return:      The average of the clash scores of all :class:`LoopCandidate`.
-    :rtype:       float
-
-  .. method:: GetAVGCBetaScore()
-
-    :return:      The average of the C-beta scores of all :class:`LoopCandidate`.
-    :rtype:       float
-
-  .. method:: GetAVGTorsionScore()
-
-    :return:      The average of the torsion scores of all :class:`LoopCandidate`.
-    :rtype:       float
-
-  .. method:: GetAVGPackingScore()
-
-    :return:      The average of the packing scores of all :class:`LoopCandidate`.
-    :rtype:       float
-
-  .. method:: GetAVGHBondcore()
-
-    :return:      The average of the H-bond scores of all :class:`LoopCandidate`.
-    :rtype:       float
-
-  .. method:: GetAVGDSSPHBondScore()
-
-    :return:      The average of the DSSP H-bond scores of all :class:`LoopCandidate`.
-    :rtype:       float
-
-  .. method:: GetAVGStemRMSD()
-
-    :return:      The average of the stem RMSDs of all :class:`LoopCandidate`.
-    :rtype:       float
-
-  .. method:: GetNStem()
-
-    :return:      The N-stem of loop being modelled
-    :rtype:       :class:`ost.mol.EntityHandle`
-
-  .. method:: GetCStem()
-
-    :return:      The C-stem of loop being modelled
-    :rtype:       :class:`ost.mol.EntityHandle`
-
-  .. method:: Add(loop_candidate)
-
-    Add a loop candidate to the list of candidates
-
-    :param loop_candidate:                 The loop candidate
-    :type loop_candidate:   :class:`LoopCandidate`
-
-  .. method:: Add(bb_list)
-
-    Add a loop candidate to the list of candidates from a list of backbone positions
-
-    :param bb_list:                 The backbone list
-    :type bb_list:                  :class:`BackboneList`
- 
-  .. method:: Remove(index)
-
-    Remove a loop candidate from the list of candidates.
-
-    :param index:         The index of the candidate that will be removed
-    :type index:          :class:`int`
-
-  .. method:: AttachScorer(scorer)
-
-    Attaches a scorer to the :class:`LoopCandidates`. The scorer contains the information about the environment of the loop candidates and is mandatory to calculate the different scores for the loop candidates.
-
-    :param scorer:            The scorer
-    :type scorer:             :class:`BackboneLoopScorer`
-
-
diff --git a/loop/doc/structure_db.rst b/loop/doc/structure_db.rst
index 0f792588a93a6c6198fa4b9a22d4faad8a08c8d2..5841a3c225c1ef26472d2ff2567591ddd723cab1 100644
--- a/loop/doc/structure_db.rst
+++ b/loop/doc/structure_db.rst
@@ -572,8 +572,8 @@ ultra fast.
     :param frag_size: The length of the fragment
     :param extended_search: Whether an extended search should be performed, which will include fragments from bins surrounding the bin describing the  **n_stem** and **c_stem** geometry.
 
-    :type n_stem:              :class:`ost.mol.ResidueHandle`
-    :type c_stem:              :class:`ost.mol.ResidueHandle`
+    :type n_stem:              :class:`ost.mol.ResidueHandle` / :class:`Backbone`
+    :type c_stem:              :class:`ost.mol.ResidueHandle` / :class:`Backbone`
     :type frag_size:           :class:`float`
     :type extended_search:     :class:`bool`
 
@@ -707,19 +707,15 @@ arbitrary linear combination of following components:
     :type w:            :class:`float`
     :type subst:        :class:`ost.seq.SubstWeightMatrix`
 
-  .. method:: AddSSAgreeParameters(w, psipred_prediction, psipred_confidence)
+  .. method:: AddSSAgreeParameters(w, psipred_prediction)
 
     Add SSAgree score component with linear weight **w**
 
     :param w:           linear weight
-    :param psipred_prediction:  Secondary structure state ('H','E','C') as predicted 
-                                by PSIPRED for every item in the Fraggers target sequence
-    :param psipred_confidence:  Confidence for secondary structure state ([0,9]) as predicted
-                                by PSIPRED for every item in the Fraggers target sequence
+    :param psipred_prediction:  Psipred prediction for fraggers target_sequence
 
     :type w:            :class:`str`
-    :type psipred_prediction: :class:`list`
-    :type psipred_confidence: :class:`list`
+    :type psipred_prediction: :class:`PsipredPrediction`
 
   .. method:: AddSequenceProfileParameters(w, hmm)
 
diff --git a/loop/pymod/CMakeLists.txt b/loop/pymod/CMakeLists.txt
index 3e10528de5ddc0fa7197710759a18c56f8905789..aa24d300115eb879c8fc6cc0b9043ca4661c6e63 100644
--- a/loop/pymod/CMakeLists.txt
+++ b/loop/pymod/CMakeLists.txt
@@ -9,6 +9,7 @@ export_loop_object_loader.cc
 export_loop_score.cc
 export_loop_closure.cc
 export_fragger.cc
+export_psipred_prediction.cc
 wrap_loop.cc
 )
 
diff --git a/loop/pymod/__init__.py b/loop/pymod/__init__.py
index 13572b1bc16d5462fc17a512e64b986d71dfc1e4..9725f9223db22a93595dc31fa64ef9055911ba70 100644
--- a/loop/pymod/__init__.py
+++ b/loop/pymod/__init__.py
@@ -1,3 +1,169 @@
 '''__init__.py of the loop module
 '''
 from _loop import *
+
+# TODO: extract this into some _....py file and import here (like in modelling)
+from ost.conop import OneLetterCodeToResidueName
+
+def _AssembleTorsionSamplers(psipred_pred,
+                             torsion_sampler_coil,
+                             torsion_sampler_helix,
+                             torsion_sampler_extended):
+
+    samplers = [torsion_sampler_coil]*len(psipred_pred)
+    for i in range(len(psipred_pred)):
+        if psipred_pred.GetPrediction(i) == 'H' and psipred_pred.GetConfidence(i) >= 6:
+            samplers[i] = torsion_sampler_helix  
+        if psipred_pred.GetPrediction(i) == 'E' and psipred_pred.GetConfidence(i) >= 6:
+            samplers[i] = torsion_sampler_extended
+    return samplers
+
+def _GenerateFragger(hmm,psipred_pred,
+                     num_fragments,
+                     rmsd_thresh,
+                     ss_agreement_weight,
+                     sequence_profile_weight,
+                     structure_profile_weight,
+                     torsion_weight,
+                     aa_before,
+                     aa_after,
+                     structure_db,
+                     torsion_sampler_coil,
+                     torsion_sampler_helix,
+                     torsion_sampler_extended):
+    
+    torsion_samplers = _AssembleTorsionSamplers(psipred_pred,
+                                                torsion_sampler_coil,
+                                                torsion_sampler_helix,
+                                                torsion_sampler_extended)
+
+    fragger = Fragger(hmm.sequence)
+    fragger.AddSSAgreeParameters(ss_agreement_weight,psipred_pred)
+    fragger.AddSequenceProfileParameters(sequence_profile_weight,hmm)
+    fragger.AddStructureProfileParameters(structure_profile_weight,hmm)
+    fragger.AddTorsionProbabilityParameters(torsion_weight,torsion_samplers,
+                                            aa_before,aa_after)
+
+    fragger.Fill(structure_db,rmsd_thresh,num_fragments)
+
+    return fragger
+
+
+def GenerateFragger(hmm, psipred_pred, 
+                    num_fragments = 100,
+                    rmsd_thresh = 0.0, 
+                    ss_agreement_weight = 1.0, 
+                    sequence_profile_weight = 0.8, 
+                    structure_profile_weight = 2.0,
+                    torsion_weight = 13.0,
+                    aa_before = "ALA",
+                    aa_after = "ALA",
+                    structure_db = None,
+                    torsion_sampler_coil = None,
+                    torsion_sampler_helix = None,
+                    torsion_sampler_extended = None):
+
+    if len(hmm) != len(psipred_pred):
+        raise ValueError("Length of HMM must be consistent with Psipred!")
+
+    if structure_db == None:
+        structure_db = LoadStructureDB()
+
+    if torsion_sampler_coil == None:
+        torsion_sampler_coil = LoadTorsionSamplerCoil()
+
+    if torsion_sampler_helix == None:
+        torsion_sampler_helix = LoadTorsionSamplerHelical()
+
+    if torsion_sampler_extended == None:
+        torsion_sampler_extended = LoadTorsionSamplerExtended()
+
+    if len(aa_before) == 1:
+        #seems to be a one_letter_code, let's try our best
+        aa_before = OneLetterCodeToResidueName(aa_before)
+
+    if len(aa_after) == 1:
+        #seems to be a one_letter_code, let's try our best
+        aa_after = OneLetterCodeToResidueName(aa_after)
+
+    return _GenerateFragger(hmm, psipred_pred, 
+                            num_fragments,
+                            rmsd_thresh, 
+                            ss_agreement_weight, 
+                            sequence_profile_weight, 
+                            structure_profile_weight,
+                            torsion_weight,
+                            aa_before,
+                            aa_after,
+                            structure_db,
+                            torsion_sampler_coil,
+                            torsion_sampler_helix,
+                            torsion_sampler_extended)
+
+
+def GenerateFraggerList(hmm, psipred_pred,
+                        fragment_length = 9,
+                        fragments_per_position = 100,
+                        rmsd_thresh = 0.0, 
+                        ss_agreement_weight = 1.0, 
+                        sequence_profile_weight = 0.8, 
+                        structure_profile_weight = 2.0,
+                        torsion_weight = 13.0,
+                        structure_db = None,
+                        torsion_sampler_coil = None,
+                        torsion_sampler_helix = None,
+                        torsion_sampler_extended = None):
+
+
+    if len(hmm) != len(psipred_pred):
+        raise ValueError("Length of HMM must be consistent with Psipred!")
+
+    if structure_db == None:
+        structure_db = LoadStructureDB()
+
+    if torsion_sampler_coil == None:
+        torsion_sampler_coil = LoadTorsionSamplerCoil()
+
+    if torsion_sampler_helix == None:
+        torsion_sampler_helix = LoadTorsionSamplerHelical()
+
+    if torsion_sampler_extended == None:
+        torsion_sampler_extended = LoadTorsionSamplerExtended()
+
+    sequence = hmm.sequence
+    num_positions = len(sequence) - fragment_length + 1
+
+    fragger_list = list()
+
+    for i in range(num_positions):
+
+        aa_before = "ALA"
+        aa_after = "ALA"
+
+        if i > 0:
+            aa_before = OneLetterCodeToResidueName(sequence[i-1])
+
+        if i + fragment_length < len(sequence):
+            aa_after = OneLetterCodeToResidueName(sequence[i+fragment_length])
+
+        sub_hmm = hmm.Extract(i,i+fragment_length)
+        sub_psipred_pred = psipred_pred.Extract(i,i+fragment_length)
+
+        fragger = _GenerateFragger(sub_hmm, sub_psipred_pred, 
+                                   fragments_per_position,
+                                   rmsd_thresh, 
+                                   ss_agreement_weight, 
+                                   sequence_profile_weight, 
+                                   structure_profile_weight,
+                                   torsion_weight,
+                                   aa_before,
+                                   aa_before,
+                                   structure_db,
+                                   torsion_sampler_coil,
+                                   torsion_sampler_helix,
+                                   torsion_sampler_extended)
+
+        fragger_list.append(fragger)
+
+    return fragger_list
+
diff --git a/loop/pymod/export_backbone.cc b/loop/pymod/export_backbone.cc
index b4d36455d30f9c402bde7e6ce38200c33461b485..6b4edb7e3bf5ec6fe47641d844de3e9affc2e673 100644
--- a/loop/pymod/export_backbone.cc
+++ b/loop/pymod/export_backbone.cc
@@ -86,6 +86,22 @@ void ApplyTransformMat4(BackboneListPtr p, const geom::Mat4& t){ p->ApplyTransfo
 void ApplyTransformTransform(BackboneListPtr p, const geom::Transform& t) { p->ApplyTransform(t); }
 
 void ApplyTransformSingle(BackbonePtr p, const geom::Mat4& t){ p->ApplyTransform(t); }
+
+void InsertInto_int(BackboneListPtr p, ost::mol::ChainHandle& chain, uint start_resnum,
+                    bool remodel_cterminal_o){
+  p->InsertInto(chain,start_resnum,remodel_cterminal_o);
+}
+
+void InsertInto_resnum(BackboneListPtr p, ost::mol::ChainHandle& chain, 
+                       const ost::mol::ResNum start_resnum,
+                       bool remodel_cterminal_o){
+  p->InsertInto(chain,start_resnum,remodel_cterminal_o);
+}
+
+
+
+
+
 }//ns
 
 void export_Backbone(){
@@ -118,7 +134,8 @@ void export_Backbone(){
     .def("__init__", make_constructor(&FullInitWrapperRHList))
     .def("ToEntity",&BackboneList::ToEntity)
     .def("GetSequence",&BackboneList::GetSequence)
-    .def("InsertInto",&BackboneList::InsertInto,(arg("chain"),arg("n_stem"),arg("c_stem"),arg("remodel_cterminal_o")=true))
+    .def("InsertInto",&InsertInto_int,(arg("chain"),arg("start_resnum"),arg("remodel_cterminal_o")=true))
+    .def("InsertInto",&InsertInto_resnum,(arg("chain"),arg("start_resnum"),arg("remodel_cterminal_o")=true))
     .def("ReconstructCBetaPositions",&BackboneList::ReconstructCBetaPositions)
     .def("ReconstructOxygenPositions",&BackboneList::ReconstructOxygenPositions,(arg("last_psi")=-0.78540))
     .def("ApplyTransform",&ApplyTransformMat4,(arg("transformation_matrix")))
diff --git a/loop/pymod/export_frag_db.cc b/loop/pymod/export_frag_db.cc
index 789b7fe4f561325104a8a3d4d8119696c3e4d418..2ed493fc131cde2f88e6fe226478303f0746c0a0 100644
--- a/loop/pymod/export_frag_db.cc
+++ b/loop/pymod/export_frag_db.cc
@@ -13,11 +13,30 @@ namespace{
     return FragDBPtr(new FragDB(dist_bin_s,ang_bin_s,false));
   }
 
-  boost::python::list WrapSearchDB(FragDBPtr p,
-                                   const ost::mol::ResidueHandle& n_stem, 
-                                   const ost::mol::ResidueHandle& c_stem,
-                                   uint frag_size,
-                                   bool extended_search){
+  boost::python::list WrapSearchDBResidueHandle(FragDBPtr p,
+                                                const ost::mol::ResidueHandle& n_stem, 
+                                                const ost::mol::ResidueHandle& c_stem,
+                                                uint frag_size,
+                                                bool extended_search){
+    std::vector<FragmentInfo> fragments;
+
+    p->SearchDB(n_stem,c_stem,frag_size,fragments,extended_search);
+
+    boost::python::list return_list;
+
+    for(std::vector<FragmentInfo>::iterator i = fragments.begin();
+        i != fragments.end(); ++i){
+      return_list.append(*i);
+    }
+
+    return return_list;
+  }
+
+  boost::python::list WrapSearchDBBackbone(FragDBPtr p,
+                                           const Backbone& n_stem, 
+                                           const Backbone& c_stem,
+                                           uint frag_size,
+                                           bool extended_search){
     std::vector<FragmentInfo> fragments;
 
     p->SearchDB(n_stem,c_stem,frag_size,fragments,extended_search);
@@ -37,8 +56,6 @@ namespace{
 
   int GetNumFragments(FragDBPtr p){ return p->GetNumFragments(); }
   int GetNumFragmentsGivenLength(FragDBPtr p, uint length) {return p->GetNumFragments(length); }
-
-
 }
 
 void export_FragDB(){
@@ -55,7 +72,8 @@ void export_FragDB(){
     .def("GetNumStemPairs",&GetNumStemPairsGivenLength,(arg("loop_length")))
     .def("GetNumFragments",&GetNumFragments)
     .def("GetNumFragments",&GetNumFragmentsGivenLength,(arg("loop_length")))
-    .def("SearchDB",&WrapSearchDB,(arg("n_stem"),arg("c_stem"),arg("frag_size"),arg("extended_search")=false))
+    .def("SearchDB",&WrapSearchDBResidueHandle,(arg("n_stem"),arg("c_stem"),arg("frag_size"),arg("extended_search")=false))
+    .def("SearchDB",&WrapSearchDBBackbone,(arg("n_stem"),arg("c_stem"),arg("frag_size"),arg("extended_search")=false))
   ;
 
   register_ptr_to_python<FragDBPtr>(); 
diff --git a/loop/pymod/export_fragger.cc b/loop/pymod/export_fragger.cc
index 928c6cfd03d43ffd3691815717e6d0349c94dbb0..835f54e3d143b3bf25f16a1c34a677ee4f3d44fc 100644
--- a/loop/pymod/export_fragger.cc
+++ b/loop/pymod/export_fragger.cc
@@ -43,23 +43,6 @@ namespace{
     return fragger.GetScore(parameter_index,index);
   }
 
-  void WrapSSAgreeParameters(Fragger& fragger, Real w,
-                             const boost::python::list& p_p,
-                             const boost::python::list& p_c){
-    std::vector<char> v_p_p;
-    std::vector<int> v_p_c;
-
-    for(uint i = 0; i < boost::python::len(p_p); ++i){
-      v_p_p.push_back(boost::python::extract<char>(p_p[i]));
-    }
-
-    for(uint i = 0; i < boost::python::len(p_c); ++i){
-      v_p_c.push_back(boost::python::extract<int>(p_c[i]));
-    }
-
-    fragger.AddSSAgreeParameters(w,v_p_p,v_p_c);
-  }
-
   void WrapTorsionSingle(Fragger& fragger, Real w,
                          TorsionSamplerPtr t_s, const String& before,
                          const String& after){
@@ -83,7 +66,7 @@ void export_Fragger(){
   class_<Fragger> ("Fragger", init<String>())
     .def("AddSeqIDParameters",&Fragger::AddSeqIDParameters,(arg("weight")))
     .def("AddSeqSimParameters",&Fragger::AddSeqSimParameters,(arg("weight"),arg("subst_matrix")))
-    .def("AddSSAgreeParameters",&WrapSSAgreeParameters,(arg("weight"),arg("psipred_prediction"),arg("psipred_confidence")))
+    .def("AddSSAgreeParameters",&Fragger::AddSSAgreeParameters,(arg("weight"),arg("psipred_prediction")))
     .def("AddTorsionProbabilityParameters",&WrapTorsionSingle,(arg("weight"),arg("torsion_sampler"),arg("aa_before")="ALA",arg("aa_after")="ALA"))
     .def("AddTorsionProbabilityParameters",&WrapTorsionList,(arg("weight"),arg("torsion_sampler_list"),arg("aa_before")="ALA",arg("aa_after")="ALA"))
     .def("AddSequenceProfileParameters",&Fragger::AddSequenceProfileParameters,(arg("weight"),arg("hmm")))
diff --git a/loop/pymod/export_loop_candidate.cc b/loop/pymod/export_loop_candidate.cc
index 86983412eb3994c7b7ff538c8f46751609608409..77b954a3cb048b09cf5ea48fbcc0e2b9ba7ce582 100644
--- a/loop/pymod/export_loop_candidate.cc
+++ b/loop/pymod/export_loop_candidate.cc
@@ -18,20 +18,35 @@ namespace{
     return (*lcs)[i];
   }
 
-  void ApplyCCDWithAllSamplers(LoopCandidatesPtr p, boost::python::list l, int max_iterations, Real rmsd_cutoff, bool keep_non_converged, int random_seed){
+  void ApplyCCDWithAllSamplers(LoopCandidatesPtr p,
+                               const ost::mol::ResidueHandle& n_stem,
+                               const ost::mol::ResidueHandle& c_stem,
+                               boost::python::list l, 
+                               int max_iterations, Real rmsd_cutoff, 
+                               bool keep_non_converged, int random_seed){
     std::vector<TorsionSamplerPtr> v;
     for(uint i = 0; i < boost::python::len(l); ++i){
       v.push_back(boost::python::extract<TorsionSamplerPtr>(l[i]));
     }
-    p->ApplyCCD(v,max_iterations,rmsd_cutoff,keep_non_converged,random_seed);
+    p->ApplyCCD(n_stem,c_stem,v,max_iterations,rmsd_cutoff,keep_non_converged,random_seed);
   }
 
-  void ApplyCCDWithSampler(LoopCandidatesPtr p, TorsionSamplerPtr torsion_sampler, int max_iterations, Real rmsd_cutoff, bool keep_non_converged, int random_seed){
-    p->ApplyCCD(torsion_sampler, max_iterations,rmsd_cutoff, keep_non_converged, random_seed); 
+  void ApplyCCDWithSampler(LoopCandidatesPtr p, 
+                           const ost::mol::ResidueHandle& n_stem,
+                           const ost::mol::ResidueHandle& c_stem,
+                           TorsionSamplerPtr torsion_sampler, 
+                           int max_iterations, Real rmsd_cutoff, 
+                           bool keep_non_converged, int random_seed){
+    p->ApplyCCD(n_stem,c_stem,torsion_sampler, 
+                max_iterations,rmsd_cutoff, keep_non_converged, random_seed); 
   }
 
-  void ApplyCCDWithoutSampler(LoopCandidatesPtr p, int max_iterations, Real rmsd_cutoff, bool keep_non_converged, int random_seed){
-    p->ApplyCCD(max_iterations, rmsd_cutoff, keep_non_converged, random_seed); 
+  void ApplyCCDWithoutSampler(LoopCandidatesPtr p, 
+                              const ost::mol::ResidueHandle& n_stem,
+                              const ost::mol::ResidueHandle& c_stem,
+                              int max_iterations, 
+                              Real rmsd_cutoff, bool keep_non_converged){
+    p->ApplyCCD(n_stem,c_stem,max_iterations, rmsd_cutoff, keep_non_converged); 
   }
 
   void AddLoopCandidate(LoopCandidatesPtr p, LoopCandidate& candidate){
@@ -42,31 +57,46 @@ namespace{
     p->Add(bb);
   }
 
-  LoopCandidatesPtr FillFromMC(const ost::mol::ResidueHandle& n_stem,
-                               const ost::mol::ResidueHandle& c_stem,
-                               const String& seq, 
+  LoopCandidatesPtr FillFromMC(const String& seq, 
                                uint num_loops, uint steps, 
                                MonteCarloSamplerPtr sampler,
                                MonteCarloCloserPtr closer,
                                MonteCarloScorerPtr scorer,
                                MonteCarloCoolerPtr cooler){
-    return LoopCandidates::FillFromMonteCarloSampler(n_stem,c_stem,seq,num_loops,steps,
+    return LoopCandidates::FillFromMonteCarloSampler(seq,num_loops,steps,
                                                      sampler,closer,scorer,cooler);
   }
 
-  LoopCandidatesPtr FillFromMCInit(const ost::mol::ResidueHandle& n_stem,
-                                   const ost::mol::ResidueHandle& c_stem,
-                                   const BackboneList& initial_bb,
+  LoopCandidatesPtr FillFromMCInit(const BackboneList& initial_bb,
                                    const String& seq, 
                                    uint num_loops, uint steps, 
                                    MonteCarloSamplerPtr sampler,
                                    MonteCarloCloserPtr closer,
                                    MonteCarloScorerPtr scorer,
                                    MonteCarloCoolerPtr cooler){
-    return LoopCandidates::FillFromMonteCarloSampler(n_stem,c_stem,initial_bb,seq,num_loops,steps,
+    return LoopCandidates::FillFromMonteCarloSampler(initial_bb,seq,num_loops,steps,
                                                      sampler,closer,scorer,cooler);
   }
-}
+
+  void WrapCombinedScores(LoopCandidatesPtr p,
+                          const boost::python::dict& weights,
+                          uint start_resnum, uint chain_index){
+
+    String key;
+    Real value;
+    std::map<String,Real> m_weights;
+    boost::python::list keys = weights.keys();
+    
+    for(int i = 0; i < boost::python::len(keys); ++i){
+      key = boost::python::extract<String>(keys[i]);
+      value = boost::python::extract<Real>(weights[keys[i]]);
+      m_weights[key] = value;
+    }  
+
+    p->CalculateCombinedScores(m_weights, start_resnum, chain_index);
+  }
+
+} //ns
 
 
 void export_loop_candidate()
@@ -83,41 +113,40 @@ void export_loop_candidate()
     .def("GetOriginalDSSPState",&LoopCandidate::GetOriginalDSSPState)
     .def_readwrite("clash_score", &LoopCandidate::clash_score)
     .def_readwrite("cbeta_score", &LoopCandidate::cbeta_score)
+    .def_readwrite("reduced_score", &LoopCandidate::reduced_score)
     .def_readwrite("torsion_score", &LoopCandidate::torsion_score)
     .def_readwrite("packing_score", &LoopCandidate::packing_score)
     .def_readwrite("hbond_score", &LoopCandidate::hbond_score)
-    .def_readwrite("dssp_hbond_score", &LoopCandidate::dssp_hbond_score)
-    .def_readwrite("stem_rmsd", &LoopCandidate::stem_rmsd)
+    .def_readwrite("ss_agreement_score", &LoopCandidate::ss_agreement_score)
+    .def_readwrite("combined_score", &LoopCandidate::combined_score)
     .def_readwrite("bb_list", &LoopCandidate::bb_list)
   ;
 
-  class_<LoopCandidates, LoopCandidatesPtr, boost::noncopyable>("LoopCandidates", init<const ost::mol::ResidueHandle&, const ost::mol::ResidueHandle&, const String&>())
+  class_<LoopCandidates, LoopCandidatesPtr, boost::noncopyable>("LoopCandidates", init<const String&>())
     .def("FillFromDatabase",&LoopCandidates::FillFromDatabase,(arg("n_stem"),arg("c_stem"),arg("seq"),arg("frag_db"),arg("structure_db"),arg("extended_search")=false)).staticmethod("FillFromDatabase")
-    .def("FillFromMonteCarloSampler",&FillFromMCInit,(arg("n_stem"),arg("c_stem"),arg("initial_bb"),arg("seq"),arg("num_loops"),arg("steps"),arg("sampler"),arg("closer"),arg("scorer"),arg("cooler")))
-    .def("FillFromMonteCarloSampler",&FillFromMC,(arg("n_stem"),arg("c_stem"),arg("seq"),arg("num_loops"),arg("steps"),arg("sampler"),arg("closer"),arg("scorer"),arg("cooler"))).staticmethod("FillFromMonteCarloSampler")
-    .def("ClusterCandidates",&LoopCandidates::ClusterCandidates)
-    .def("ApplyCCD",&ApplyCCDWithSampler,(arg("torsion_sampler"),arg("max_iterations")=1000,arg("rmsd_cutoff")=0.1,arg("keep_non_converged")=false,arg("random_seed")=0))
-    .def("ApplyCCD",&ApplyCCDWithoutSampler,(arg("max_iterations")=1000,arg("rmsd_cutoff")=0.1,arg("keep_non_converged")=false,arg("random_seed")=0))
-    .def("ApplyCCD",&ApplyCCDWithAllSamplers,(arg("torsion_samplers"),arg("max_iterations")=1000,arg("rmsd_cutoff")=0.1,arg("keep_non_converged")=false,arg("random_seed")=0))
+    .def("FillFromMonteCarloSampler",&FillFromMCInit,(arg("initial_bb"),arg("seq"),arg("num_loops"),arg("steps"),arg("sampler"),arg("closer"),arg("scorer"),arg("cooler")))
+    .def("FillFromMonteCarloSampler",&FillFromMC,(arg("seq"),arg("num_loops"),arg("steps"),arg("sampler"),arg("closer"),arg("scorer"),arg("cooler"))).staticmethod("FillFromMonteCarloSampler")
+    .def("ClusterCandidates",&LoopCandidates::ClusterCandidates,(arg("max_rmsd"),arg("neglect_size_one")=true))
+    .def("ApplyCCD",&ApplyCCDWithSampler,(arg("n_stem"),arg("c_stem"),arg("torsion_sampler"),arg("max_iterations")=1000,arg("rmsd_cutoff")=0.1,arg("keep_non_converged")=false,arg("random_seed")=0))
+    .def("ApplyCCD",&ApplyCCDWithAllSamplers,(arg("n_stem"),arg("c_stem"),arg("torsion_samplers"),arg("max_iterations")=1000,arg("rmsd_cutoff")=0.1,arg("keep_non_converged")=false,arg("random_seed")=0))
+    .def("ApplyCCD",&ApplyCCDWithoutSampler,(arg("n_stem"),arg("c_stem"),arg("max_iterations")=1000,arg("rmsd_cutoff")=0.1,arg("keep_non_converged")=false))
     .def("ApplyKIC",&LoopCandidates::ApplyKIC,(arg("pivot_one"),arg("pivot_two"),arg("pivot_three")))
-    .def("ToEntity", &LoopCandidates::ToEntity,(arg("index")))
-    .def("InsertInto", &LoopCandidates::InsertInto,(arg("entity"),arg("index")))
     .def("GetAVGClashScore",&LoopCandidates::GetAVGClashScore)
     .def("GetAVGCBetaScore",&LoopCandidates::GetAVGCBetaScore)
+    .def("GetAVGReducedScore",&LoopCandidates::GetAVGReducedScore)
     .def("GetAVGTorsionScore",&LoopCandidates::GetAVGTorsionScore)
     .def("GetAVGPackingScore",&LoopCandidates::GetAVGPackingScore)
     .def("GetAVGHBondScore",&LoopCandidates::GetAVGHBondScore)
-    .def("GetAVGDSSPHBondScore",&LoopCandidates::GetAVGDSSPHBondScore)
-    .def("GetAVGStemRMSD",&LoopCandidates::GetAVGStemRMSD)
-    .def("CalculateClashScores",&LoopCandidates::CalculateClashScores,(arg("chain_index")=0))
-    .def("CalculateCBetaScores",&LoopCandidates::CalculateCBetaScores,(arg("chain_index")=0))
-    .def("CalculateTorsionScores",&LoopCandidates::CalculateTorsionScores,(arg("chain_index")=0))
-    .def("CalculateCBPackingScores",&LoopCandidates::CalculateCBPackingScores,(arg("chain_index")=0))
-    .def("CalculateHBondScores",&LoopCandidates::CalculateHBondScores,(arg("chain_index")=0))
-    .def("CalculateDSSPHBondScores",&LoopCandidates::CalculateDSSPHBondScores,(arg("chain_index")=0))
-    .def("CalculateStemRMSD",&LoopCandidates::CalculateStemRMSD)
-    .def("GetNStem",&LoopCandidates::GetNStem)
-    .def("GetCStem",&LoopCandidates::GetCStem)
+    .def("GetAVGSSAgreementScore",&LoopCandidates::GetAVGSSAgreementScore)
+    .def("GetAVGCombinedScore",&LoopCandidates::GetAVGCombinedScore)
+    .def("CalculateClashScores",&LoopCandidates::CalculateClashScores,(arg("start_resnum"),arg("chain_index")=0))
+    .def("CalculateCBetaScores",&LoopCandidates::CalculateCBetaScores,(arg("start_resnum"),arg("chain_index")=0))
+    .def("CalculateReducedScores",&LoopCandidates::CalculateReducedScores,(arg("start_resnum"),arg("chain_index")))
+    .def("CalculateTorsionScores",&LoopCandidates::CalculateTorsionScores,(arg("start_resnum"),arg("chain_index")=0))
+    .def("CalculateCBPackingScores",&LoopCandidates::CalculateCBPackingScores,(arg("start_resnum"),arg("chain_index")=0))
+    .def("CalculateHBondScores",&LoopCandidates::CalculateHBondScores,(arg("start_resnum"),arg("chain_index")=0))
+    .def("CalculateSSAgreementScores",&LoopCandidates::CalculateSSAgreementScores,(arg("start_resnum"),arg("chain_index")=0))
+    .def("CalculateCombinedScores",&WrapCombinedScores,(arg("linear_weights"),arg("start_resnum"),arg("chain_index")=0))
     .def("__iter__", iterator<LoopCandidates>())
     .def("__len__", &LoopCandidates::size)
     .def("__getitem__", lc_getitem, 
diff --git a/loop/pymod/export_loop_score.cc b/loop/pymod/export_loop_score.cc
index 12b4ed32c50fea12ee5e55bc925106cea9784a1b..874516a5b2b6e92b09e58f61a2aecf75ea4be942 100644
--- a/loop/pymod/export_loop_score.cc
+++ b/loop/pymod/export_loop_score.cc
@@ -23,6 +23,19 @@ namespace{
     p->Initialize(v); 
   }
 
+  void WrapSetPsipredPredictionSingle(BackboneLoopScorerPtr p, PsipredPredictionPtr pp){
+    p->SetPsipredPrediction(pp);
+  }
+
+  void WrapSetPsipredPredictionMulti(BackboneLoopScorerPtr p, 
+                                     boost::python::list& pp){
+    std::vector<PsipredPredictionPtr> v_pp;
+    for(uint i = 0; i < boost::python::len(pp); ++i){
+      v_pp.push_back(boost::python::extract<PsipredPredictionPtr>(pp[i]));
+    }
+    p->SetPsipredPrediction(v_pp);
+  }
+
   void SetEnvironment_env(BackboneLoopScorerPtr p, const ost::mol::EntityHandle& env){
     p->SetEnvironment(env);
   }
@@ -32,6 +45,12 @@ namespace{
     p->SetEnvironment(bb_list,start_resnum,chain_index);
   }
 
+  void SetEnvironment_bblist_resnum(BackboneLoopScorerPtr p, const promod3::loop::BackboneList& bb_list,
+                                    const ost::mol::ResNum& start_resnum, uint chain_index){
+    uint num = start_resnum.GetNum();
+    p->SetEnvironment(bb_list,num,chain_index);
+  }
+
   void wrap_set_torsion_param(BackboneLoopScorerPtr p, const boost::python::list& l, uint bins){
     std::vector<String> v;
     for(uint i = 0; i < boost::python::len(l); ++i){
@@ -48,22 +67,30 @@ void export_loop_score()
     .def("Save",&BackboneLoopScorer::Save,(arg("filename")))
     .def("Initialize",&Initialize_string,(arg("seqres")))
     .def("Initialize",&Initialize_string_list,(arg("seqres")))
+    .def("SetPsipredPrediction",&WrapSetPsipredPredictionSingle,(arg("psipred_prediction")))
+    .def("SetPsipredPrediction",&WrapSetPsipredPredictionMulti,(arg("psipred_predictions")))    
     .def("SetEnvironment",&SetEnvironment_env,(arg("env")))
     .def("SetEnvironment",&SetEnvironment_bblist,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
+    .def("SetEnvironment",&SetEnvironment_bblist_resnum,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
     .def("SetCBetaPotentialParameters",&BackboneLoopScorer::SetCBetaPotentialParameters,(arg("cbeta_cutoff"),arg("cbeta_bins"),arg("cbeta_seq_sep")))
+    .def("SetReducedPotentialParameters",&BackboneLoopScorer::SetReducedPotentialParameters,(arg("dist_cutoff"),arg("dist_bins"),arg("angle_bins"),arg("dihedral_bins"),arg("reduced_seq_sep")))
     .def("SetTorsionPotentialParameters",&wrap_set_torsion_param,(arg("group_definitions"),arg("torsion_bins")))
     .def("SetCBPackingPotentialParameters",&BackboneLoopScorer::SetCBPackingPotentialParameters,(arg("cb_packing_cutoff"),arg("cb_packing_max_count")))
     .def("SetHBondPotentialParameters",&BackboneLoopScorer::SetHBondPotentialParameters,(arg("min_d"),arg("max_d"),arg("min_alpha"),arg("max_alpha"),arg("min_beta"),arg("max_beta"),arg("min_gamma"),arg("max_gamma"),arg("d_bins"),arg("alpha_bins"),arg("beta_bins"),arg("gamma_bins")))
+    .def("SetSSAgreementParameters",&BackboneLoopScorer::SetSSAgreementParameters)
     .def("SetCBetaEnergy",&BackboneLoopScorer::SetCBetaEnergy,(arg("aa_one"),arg("aa_two"),arg("bin"),arg("energy")))
+    .def("SetReducedEnergy",&BackboneLoopScorer::SetReducedEnergy,(arg("aa_one"),arg("aa_two"),arg("dist_bin"),arg("alpha_bin"),arg("beta_bin"),arg("gamma_bin"),arg("energy")))
     .def("SetTorsionEnergy",&BackboneLoopScorer::SetTorsionEnergy,(arg("group_identifier_idx"),arg("phi_bin"),arg("psi_bin"),arg("energy")))
     .def("SetCBPackingEnergy",&BackboneLoopScorer::SetCBPackingEnergy,(arg("aa"),arg("count"),arg("energy")))
     .def("SetHBondEnergy",&BackboneLoopScorer::SetHBondEnergy,(arg("state"),arg("d_bin"),arg("alpha_bin"),arg("beta_bin"),arg("gamma_bin")))
+    .def("SetSSAgreementScore",&BackboneLoopScorer::SetSSAgreementScore,(arg("psipred_state"),arg("psipred_confidence"),arg("dssp_state"),arg("score")))
     .def("CalculateClashScore",&BackboneLoopScorer::CalculateClashScore,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
     .def("CalculateCBetaScore",&BackboneLoopScorer::CalculateCBetaScore,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
+    .def("CalculateReducedScore",&BackboneLoopScorer::CalculateReducedScore,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
     .def("CalculateTorsionScore",&BackboneLoopScorer::CalculateTorsionScore,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
     .def("CalculateCBPackingScore",&BackboneLoopScorer::CalculateCBPackingScore,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
     .def("CalculateHBondScore",&BackboneLoopScorer::CalculateHBondScore,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
-    .def("CalculateDSSPHBondScore",&BackboneLoopScorer::CalculateDSSPHBondScore,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
+    .def("CalculateSSAgreementScore",&BackboneLoopScorer::CalculateSSAgreementScore,(arg("bb_list"),arg("start_resnum"),arg("chain_index")=0))
     .def("TransOmegaTorsions",&BackboneLoopScorer::TransOmegaTorsions,(arg("bb_list"),arg("thresh")=20.0/180*M_PI,arg("allow_prepro_cis")=true))
   ;
 
diff --git a/loop/pymod/export_psipred_prediction.cc b/loop/pymod/export_psipred_prediction.cc
new file mode 100644
index 0000000000000000000000000000000000000000..55544e39bc6fa0a8f3882f0227cecd30579ba0b8
--- /dev/null
+++ b/loop/pymod/export_psipred_prediction.cc
@@ -0,0 +1,76 @@
+#include <boost/python.hpp>
+#include <boost/python/register_ptr_to_python.hpp>
+#include <boost/python/make_constructor.hpp>
+
+#include <promod3/loop/psipred_prediction.hh>
+
+using namespace promod3;
+using namespace promod3::loop;
+using namespace boost::python;
+
+
+namespace{
+
+  PsipredPredictionPtr WrapEmtpyConstructor(){
+    PsipredPredictionPtr p(new PsipredPrediction);
+    return p;
+  }
+
+  PsipredPredictionPtr WrapListConstructor(const boost::python::list& prediction, 
+                                           const boost::python::list& confidence){
+    
+    std::vector<char> v_prediction;
+    std::vector<int> v_confidence;
+
+    for(uint i = 0; i < boost::python::len(prediction); ++i){
+      v_prediction.push_back(boost::python::extract<char>(prediction[i]));
+    }
+
+    for(uint i = 0; i < boost::python::len(confidence); ++i){
+      v_confidence.push_back(boost::python::extract<int>(confidence[i]));
+    }
+
+    PsipredPredictionPtr p(new PsipredPrediction(v_prediction,v_confidence));
+    return p;
+  }
+
+  boost::python::list WrapGetPredictions(const PsipredPrediction& p){
+    std::vector<char> v_predictions = p.GetPredictions();
+    boost::python::list predictions;
+    for(std::vector<char>::iterator i = v_predictions.begin();
+        i != v_predictions.end(); ++i){
+      predictions.append(*i);
+    }
+    return predictions;
+  }
+
+  boost::python::list WrapGetConfidences(const PsipredPrediction& p){
+    std::vector<int> v_confidences = p.GetConfidences();
+    boost::python::list confidences;
+    for(std::vector<int>::iterator i = v_confidences.begin();
+        i != v_confidences.end(); ++i){
+      confidences.append(*i);
+    }
+    return confidences;
+  }
+}
+
+
+void export_PsipredPrediction(){
+
+  class_<PsipredPrediction> ("PsipredPrediction", no_init)
+    .def("__init__",make_constructor(&WrapEmtpyConstructor))
+    .def("__init__",make_constructor(&WrapListConstructor))
+    .def("FromHHM",&PsipredPrediction::FromHHM,(arg("filename"))).staticmethod("FromHHM")
+    .def("FromHoriz",&PsipredPrediction::FromHoriz,(arg("filename"))).staticmethod("FromHoriz")
+    .def("Extract",&PsipredPrediction::Extract,(arg("from"),arg("to")))
+    .def("Add",&PsipredPrediction::Add,(arg("prediction"),arg("confidence")))
+    .def("GetPrediction",&PsipredPrediction::GetPrediction,(arg("idx")))
+    .def("GetConfidence",&PsipredPrediction::GetConfidence,(arg("idx")))
+    .def("GetPredictions",&WrapGetPredictions)
+    .def("GetConfidences",&WrapGetConfidences)
+    .def("__len__",&PsipredPrediction::size)
+  ;
+
+  register_ptr_to_python<PsipredPredictionPtr>(); 
+}
diff --git a/loop/pymod/wrap_loop.cc b/loop/pymod/wrap_loop.cc
index daa0d4776a69a18b2f58e870fd3c121b600e87a6..23c98e48b00e2e8cc3c28eccbff803b346ce1bc4 100644
--- a/loop/pymod/wrap_loop.cc
+++ b/loop/pymod/wrap_loop.cc
@@ -11,6 +11,7 @@ void export_LoopObjectLoader();
 void export_loop_score();
 void export_LoopClosure();
 void export_Fragger();
+void export_PsipredPrediction();
 
 using namespace boost::python;
 
@@ -26,5 +27,6 @@ BOOST_PYTHON_MODULE(_loop)
   export_loop_score();
   export_LoopClosure();
   export_Fragger();
+  export_PsipredPrediction();
 }
 
diff --git a/loop/src/CMakeLists.txt b/loop/src/CMakeLists.txt
index 61b42a167bcebb074521cb193555d451f6ccb302..6550194a39f1556025ee67c693191692d072a8e9 100644
--- a/loop/src/CMakeLists.txt
+++ b/loop/src/CMakeLists.txt
@@ -19,11 +19,14 @@ ccd.hh
 monte_carlo_cooler.hh
 monte_carlo_scorer.hh
 monte_carlo_closer.hh
-flame.hh
 kic.hh
 loop_object_loader.hh
 backbone_relaxer.hh
 dynamic_spatial_organizer.hh
+sec_struct.hh
+psipred_prediction.hh
+cluster.hh
+sidechain.hh
 )
 
 set(LOOP_SOURCES
@@ -40,10 +43,13 @@ ccd.cc
 monte_carlo_scorer.cc
 monte_carlo_cooler.cc
 monte_carlo_closer.cc
-flame.cc
 kic.cc
 loop_object_loader.cc
 backbone_relaxer.cc
+sec_struct.cc
+psipred_prediction.cc
+cluster.cc
+sidechain.cc
 )
 
 module(NAME loop HEADERS ${LOOP_HEADERS} SOURCES ${LOOP_SOURCES} DEPENDS_ON
diff --git a/loop/src/backbone.cc b/loop/src/backbone.cc
index 4461a286cf1d7da6037e22617c47051a34b80b60..b660a35dc3b887e7d78bbac60f3e17e65da5e8f7 100644
--- a/loop/src/backbone.cc
+++ b/loop/src/backbone.cc
@@ -409,16 +409,15 @@ ost::mol::EntityHandle BackboneList::ToEntity() const{
 }
 
 void BackboneList::InsertInto(ost::mol::ChainHandle& chain,
-                              uint n, uint c, bool remodel_cterminal_o) const{
+                              uint start_resnum, bool remodel_cterminal_o) const{
 
-  ost::mol::XCSEditor edi=chain.GetEntity().EditXCS(ost::mol::BUFFERED_EDIT);
+  ost::mol::ResNum num(start_resnum);
+  this->InsertInto(chain, num, remodel_cterminal_o);
+}
 
-  if(n + this->size()-1 != c){
-    std::stringstream ss;
-    ss << "The provided residue numbers do not match with the length ";
-    ss << "of the backbone to be inserted!";
-    throw promod3::Error(ss.str());
-  }  
+void BackboneList::InsertInto(ost::mol::ChainHandle& chain,
+                              const ost::mol::ResNum& start_resnum, 
+                              bool remodel_cterminal_o) const{
 
   if(!chain.IsValid()){
     std::stringstream ss;
@@ -426,8 +425,10 @@ void BackboneList::InsertInto(ost::mol::ChainHandle& chain,
     throw promod3::Error(ss.str());
   }
 
-  ost::mol::ResNum n_num(n);
-  ost::mol::ResNum c_num(c);
+  ost::mol::XCSEditor edi=chain.GetEntity().EditXCS(ost::mol::BUFFERED_EDIT);  
+
+  ost::mol::ResNum n_num = start_resnum;
+  ost::mol::ResNum c_num = start_resnum + this->size() -1;
 
   ost::mol::ResidueHandle before = chain.FindResidue(n_num);
   ost::mol::ResidueHandle after = chain.FindResidue(c_num);
@@ -643,13 +644,6 @@ void BackboneList::InsertInto(ost::mol::ChainHandle& chain,
   edi.ReorderResidues(chain);
 }
 
-String BackboneList::GetSequence() const{
-  String return_string(this->size(),'X');
-  for(uint i = 0; i < this->size(); ++i){
-    return_string[i] = bb_list_[i].one_letter_code;
-  }
-  return return_string;
-}
 
 void BackboneList::SetSequence(const String& seq){
   if(seq.size() != this->size()){
@@ -672,6 +666,14 @@ void BackboneList::SetSequence(const String& seq){
   }
 }
 
+String BackboneList::GetSequence() const{
+  String return_string(this->size(),'X');
+  for(uint i = 0; i < this->size(); ++i){
+    return_string[i] = bb_list_[i].one_letter_code;
+  }
+  return return_string;
+}
+
 void BackboneList::ReconstructCBetaPositions(){
   for(BackboneList::iterator i = this->begin(); i != this->end(); ++i){
     promod3::core::ConstructCBetaPos(i->n_coord, i->ca_coord, i->c_coord,
diff --git a/loop/src/backbone.hh b/loop/src/backbone.hh
index de1ee76ae76686028f83baa91b01c7f011f41005..c88eccf4cd736984e1f2d4282979a3e00395ab7f 100644
--- a/loop/src/backbone.hh
+++ b/loop/src/backbone.hh
@@ -72,7 +72,11 @@ public:
   ost::mol::EntityHandle ToEntity() const;
 
   void InsertInto(ost::mol::ChainHandle& chain,
-                  uint n, uint c, bool remodel_cterminal_o = true) const;
+                  uint start_resnum, bool remodel_cterminal_o = true) const;
+
+  void InsertInto(ost::mol::ChainHandle& chain,
+                  const ost::mol::ResNum& start_resnum, 
+                  bool remodel_cterminal_o = true) const;
 
   String GetSequence() const;
 
diff --git a/loop/src/backbone_loop_score.cc b/loop/src/backbone_loop_score.cc
index c10fa4d27b66ccbd17375f00e596c529e31a0253..682e3f4779f885cf0f02d472bcfbcc0e9ef6db2f 100644
--- a/loop/src/backbone_loop_score.cc
+++ b/loop/src/backbone_loop_score.cc
@@ -17,15 +17,6 @@ inline Real StericEnergy(Real d, Real rr){
   return 57.273*(1.0-d/rr);
 }
 
-inline Real DSSPHBondEnergy(const geom::Vec3& h_pos, const geom::Vec3& n_pos,
-                        const geom::Vec3& c_pos, const geom::Vec3& o_pos){
-  Real on = 1.0/geom::Distance(o_pos,n_pos);
-  Real ch = 1.0/geom::Distance(c_pos,h_pos);
-  Real oh = 1.0/geom::Distance(o_pos,h_pos);
-  Real cn = 1.0/geom::Distance(c_pos,n_pos);
-  return 27.888 * (on+ch-oh-cn);
-}
-
 inline int GetHBondState(Real phi, Real psi){
 
   //check whether phi/psi pair is typical for
@@ -42,6 +33,29 @@ inline int GetHBondState(Real phi, Real psi){
   return 0;
 }
 
+inline int GetDSSPIdx(char dssp_state){
+  switch(dssp_state){
+    case 'H': return 0;
+    case 'E': return 1;
+    case 'C': return 2;
+    case 'G': return 3;
+    case 'B': return 4;
+    case 'S': return 5;
+    case 'T': return 6;
+    case 'I': return 7;
+    default: throw promod3::Error("Invalid dssp state observed!");
+  }
+}
+
+inline int GetPsipredIdx(char psipred_state){
+  switch(psipred_state){
+    case 'H': return 0;
+    case 'E': return 1;
+    case 'C': return 2;
+    default: throw promod3::Error("Invalid psipred state observed!");
+  }
+}
+
 //calculates internal clash score, neglecting interactions from neighbouring residues
 Real CalculateInternalClashScore(const promod3::loop::BackboneList& bb_list){
 
@@ -130,7 +144,9 @@ namespace promod3 { namespace loop {
 
 
 BackboneLoopScorer::BackboneLoopScorer(): initialized_(false),
-                                          cb_env_(10.0), 
+                                          psipred_set_(false),
+                                          cb_env_(10.0),
+                                          reduced_env_(10.0), 
                                           clash_env_(6.0),
                                           hbond_env_(10.0),
                                           cbeta_seq_sep_(0),
@@ -138,6 +154,15 @@ BackboneLoopScorer::BackboneLoopScorer(): initialized_(false),
                                           cbeta_cutoff_(0.0),
                                           squared_cbeta_cutoff_(0.0),
                                           cbeta_bin_size_(0.0),
+                                          reduced_seq_sep_(0),
+                                          reduced_dist_bins_(0),
+                                          reduced_angle_bins_(0),
+                                          reduced_dihedral_bins_(0),
+                                          reduced_distance_cutoff_(0.0),
+                                          reduced_squared_distance_cutoff_(0.0),
+                                          reduced_dist_bin_size_(0.0),
+                                          reduced_angle_bin_size_(0.0),
+                                          reduced_dihedral_bin_size_(0.0),
                                           cb_packing_cutoff_(0.0),
                                           squared_cb_packing_cutoff_(0.0),
                                           cb_packing_max_count_(0.0),
@@ -162,19 +187,24 @@ BackboneLoopScorer::BackboneLoopScorer(): initialized_(false),
                                           hb_beta_bins_(0),
                                           hb_gamma_bins_(0),
                                           cbeta_energies_(NULL),
+                                          reduced_energies_(NULL),
                                           torsion_energies_(NULL),
                                           cb_packing_energies_(NULL),
-                                          hbond_energies_(NULL){ }
+                                          hbond_energies_(NULL),
+                                          ss_agreement_scores_(NULL){ }
 
 BackboneLoopScorer::~BackboneLoopScorer(){
   this->DeallocateCBeta();
+  this->DeallocateReduced();
   this->DeallocateTorsion();
   this->DeallocateCBPacking();
   this->DeallocateHBond();
+  this->DeallocateSSAgreement();
    
   if(initialized_){
     for(uint i = 0; i < seqres_.size(); ++i){
       delete [] cb_env_data_[i];
+      delete [] reduced_env_data_[i];
       delete [] hbond_env_data_[i];
       delete [] env_set_[i];
       for(uint j = 0; j < seqres_[i].size(); ++j){
@@ -183,10 +213,12 @@ BackboneLoopScorer::~BackboneLoopScorer(){
       delete [] clash_env_data_[i];
     }
     delete [] cb_env_data_;
+    delete [] reduced_env_data_;
     delete [] clash_env_data_;
     delete [] hbond_env_data_;
     delete [] env_set_;
     cb_env_.Clear();
+    reduced_env_.Clear();
     clash_env_.Clear();
     hbond_env_.Clear();
   }
@@ -209,6 +241,16 @@ BackboneLoopScorerPtr BackboneLoopScorer::Load(const String& filename){
   in_stream.read(reinterpret_cast<char*>(&p->squared_cbeta_cutoff_), sizeof(Real));
   in_stream.read(reinterpret_cast<char*>(&p->cbeta_bin_size_), sizeof(Real));
 
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_seq_sep_), sizeof(uint));
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_dist_bins_), sizeof(uint));
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_angle_bins_), sizeof(uint));
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_dihedral_bins_), sizeof(uint));
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_distance_cutoff_), sizeof(Real));
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_squared_distance_cutoff_), sizeof(Real));
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_dist_bin_size_), sizeof(Real));
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_angle_bin_size_), sizeof(Real));
+  in_stream.read(reinterpret_cast<char*>(&p->reduced_dihedral_bin_size_), sizeof(Real));
+
   in_stream.read(reinterpret_cast<char*>(&p->cb_packing_cutoff_), sizeof(Real));
   in_stream.read(reinterpret_cast<char*>(&p->squared_cb_packing_cutoff_), sizeof(Real));
   in_stream.read(reinterpret_cast<char*>(&p->cb_packing_max_count_), sizeof(Real));
@@ -261,6 +303,26 @@ BackboneLoopScorerPtr BackboneLoopScorer::Load(const String& filename){
         }
       }
     }
+    
+  }
+
+  if(p->reduced_dist_bins_ != 0){
+    p->AllocateReduced();
+    Real value;
+    for(int i = 0; i < ost::conop::XXX; ++i){
+      for(int j = 0; j < ost::conop::XXX; ++j){
+        for(uint k = 0; k < p->reduced_dist_bins_; ++k){
+          for(uint l = 0; l < p->reduced_angle_bins_; ++l){
+            for(uint m = 0; m < p->reduced_angle_bins_; ++m){
+              for(uint n = 0; n < p->reduced_dihedral_bins_; ++n){
+                in_stream.read(reinterpret_cast<char*>(&value),sizeof(Real));
+                p->reduced_energies_[i][j][k][l][m][n] = value;
+              }
+            }
+          }
+        }
+      }
+    }
   }
 
   if(p->num_torsion_bins_ != 0){
@@ -304,6 +366,21 @@ BackboneLoopScorerPtr BackboneLoopScorer::Load(const String& filename){
     }
   }
   
+  uint ss_agreement_present;
+  in_stream.read(reinterpret_cast<char*>(&ss_agreement_present),sizeof(uint));
+  if(ss_agreement_present == 1){
+    p->AllocateSSAgreement();
+    Real value;
+    for(uint i = 0; i < 8; ++i){
+      for(uint j = 0; j < 3; ++j){
+        for(uint k = 0; k < 10; ++k){
+          in_stream.read(reinterpret_cast<char*>(&value),sizeof(Real));
+          p->ss_agreement_scores_[i][j][k] = value;
+        }
+      }
+    }
+  }
+
   in_stream.close();
   return p;
 }
@@ -317,6 +394,16 @@ void BackboneLoopScorer::Save(const String& filename){
   out_stream.write(reinterpret_cast<char*>(&squared_cbeta_cutoff_), sizeof(Real));
   out_stream.write(reinterpret_cast<char*>(&cbeta_bin_size_), sizeof(Real));
 
+  out_stream.write(reinterpret_cast<char*>(&reduced_seq_sep_), sizeof(uint));
+  out_stream.write(reinterpret_cast<char*>(&reduced_dist_bins_), sizeof(uint));
+  out_stream.write(reinterpret_cast<char*>(&reduced_angle_bins_), sizeof(uint));
+  out_stream.write(reinterpret_cast<char*>(&reduced_dihedral_bins_), sizeof(uint));
+  out_stream.write(reinterpret_cast<char*>(&reduced_distance_cutoff_), sizeof(Real));
+  out_stream.write(reinterpret_cast<char*>(&reduced_squared_distance_cutoff_), sizeof(Real));
+  out_stream.write(reinterpret_cast<char*>(&reduced_dist_bin_size_), sizeof(Real));
+  out_stream.write(reinterpret_cast<char*>(&reduced_angle_bin_size_), sizeof(Real));
+  out_stream.write(reinterpret_cast<char*>(&reduced_dihedral_bin_size_), sizeof(Real));
+
   out_stream.write(reinterpret_cast<char*>(&cb_packing_cutoff_), sizeof(Real));
   out_stream.write(reinterpret_cast<char*>(&squared_cb_packing_cutoff_), sizeof(Real));
   out_stream.write(reinterpret_cast<char*>(&cb_packing_max_count_), sizeof(Real));
@@ -362,6 +449,22 @@ void BackboneLoopScorer::Save(const String& filename){
     }
   }
 
+  if(reduced_energies_ != NULL){
+    for(int i = 0; i < ost::conop::XXX; ++i){
+      for(int j = 0; j < ost::conop::XXX; ++j){
+        for(uint k = 0; k < reduced_dist_bins_; ++k){
+          for(uint l = 0; l < reduced_angle_bins_; ++l){
+            for(uint m = 0; m < reduced_angle_bins_; ++m){
+              for(uint n = 0; n < reduced_dihedral_bins_; ++n){
+                out_stream.write(reinterpret_cast<char*>(&reduced_energies_[i][j][k][l][m][n]),sizeof(Real));
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
   if(torsion_energies_ != NULL){
     for(uint i = 0; i < num_torsion_groups_; ++i){
       for(uint j = 0; j < num_torsion_bins_; ++j){
@@ -393,6 +496,23 @@ void BackboneLoopScorer::Save(const String& filename){
       }
     }
   }
+
+  if(ss_agreement_scores_ != NULL){
+    uint ss_agreement_present = 1;
+    out_stream.write(reinterpret_cast<char*>(&ss_agreement_present),sizeof(uint));
+    for(uint i = 0; i < 8; ++i){
+      for(uint j = 0; j < 3; ++j){
+        for(uint k = 0; k < 10; ++k){
+          out_stream.write(reinterpret_cast<char*>(&ss_agreement_scores_[i][j][k]),sizeof(Real));
+        }
+      }
+    }
+  }
+  else{
+    uint ss_agreement_present = 0;
+    out_stream.write(reinterpret_cast<char*>(&ss_agreement_present),sizeof(uint));
+  }
+
   out_stream.close();
 }
 
@@ -410,6 +530,10 @@ void BackboneLoopScorer::SetCBetaPotentialParameters(Real cbeta_cutoff, uint cbe
     throw promod3::Error("Number of bins must be nonzero!");
   }
 
+  if(cbeta_seq_sep < 1){
+    throw promod3::Error("CBeta sequence separation must be at least 1!");
+  }
+
   cbeta_seq_sep_ = cbeta_seq_sep;
   cbeta_bins_ = cbeta_bins;
   cbeta_cutoff_ = cbeta_cutoff;
@@ -420,6 +544,47 @@ void BackboneLoopScorer::SetCBetaPotentialParameters(Real cbeta_cutoff, uint cbe
   this->AllocateCBeta();  
 }
 
+void BackboneLoopScorer::SetReducedPotentialParameters(Real dist_cutoff, uint dist_bins, uint angle_bins, 
+                                                       uint dihedral_bins, uint seq_sep){
+
+  //deallocate (nothing happens when reduced_energies_ is NULL)
+  this->DeallocateReduced();
+
+  if(dist_cutoff < 0.0){
+    throw promod3::Error("Reduced dist cutoff must not be negative!");
+  }
+
+  if(dist_bins == 0){
+    throw promod3::Error("Reduced dist bins must be nonzero!");
+  }
+
+  if(angle_bins == 0){
+    throw promod3::Error("Reduced angle bins must be nonzero!");
+  }
+
+  if(dihedral_bins == 0){
+    throw promod3::Error("Reduced dihedral bins must be nonzero!");
+  }
+
+  if(seq_sep == 0){
+    throw promod3::Error("Reduced seq_sep must be at least 1!");
+  }
+
+  reduced_seq_sep_ = seq_sep;
+  reduced_dist_bins_ = dist_bins;
+  reduced_angle_bins_ = angle_bins;
+  reduced_dihedral_bins_ = dihedral_bins;
+  reduced_distance_cutoff_ = dist_cutoff;
+  reduced_squared_distance_cutoff_ = reduced_distance_cutoff_ * reduced_distance_cutoff_;
+  reduced_dist_bin_size_ = reduced_distance_cutoff_ / reduced_dist_bins_;
+  reduced_angle_bin_size_ = M_PI / reduced_angle_bins_;
+  reduced_dihedral_bin_size_ = 2 * M_PI / reduced_dihedral_bins_;
+
+  //allocate reduced_energies_ according to previously extracted parameters
+  this->AllocateReduced();
+
+}
+
 void BackboneLoopScorer::SetTorsionPotentialParameters(const std::vector<String>& group_definitions, 
                                                        uint torsion_bins){
 
@@ -542,7 +707,7 @@ void BackboneLoopScorer::SetHBondPotentialParameters(Real hb_min_d, Real hb_max_
     throw promod3::Error("hb_max_d must be larger than hb_min_d");
   }
 
-  if(hb_max_alpha_ <= hb_min_alpha){
+  if(hb_max_alpha <= hb_min_alpha){
     throw promod3::Error("hb_max_alpha must be larger than hb_min_alpha");
   }
 
@@ -575,9 +740,20 @@ void BackboneLoopScorer::SetHBondPotentialParameters(Real hb_min_d, Real hb_max_
   this->AllocateHBond();
 }
 
+void BackboneLoopScorer::SetSSAgreementParameters(){
+  //deallocate (nothing happens when hbond_energies_ is NULL)
+  this->DeallocateSSAgreement();
+  //allocate ss_agreement stuff with fixed parametrization
+  this->AllocateSSAgreement();
+}
+
 void BackboneLoopScorer::SetCBetaEnergy(ost::conop::AminoAcid a, 
-                                         ost::conop::AminoAcid b, 
-                                         uint bin, Real e){
+                                        ost::conop::AminoAcid b, 
+                                        uint bin, Real e){
+
+  if(cbeta_energies_ == NULL){
+    throw promod3::Error("You need to parametrize the cbeta potential before setting energies!");
+  }
 
   if(a == ost::conop::XXX || b == ost::conop::XXX){
     throw promod3::Error("Cannot set energy for invalid amino acid");
@@ -590,10 +766,49 @@ void BackboneLoopScorer::SetCBetaEnergy(ost::conop::AminoAcid a,
   cbeta_energies_[a][b][bin] = e;
 }
 
+void BackboneLoopScorer::SetReducedEnergy(ost::conop::AminoAcid a, 
+                                          ost::conop::AminoAcid b, 
+                                          uint dist_bin, 
+                                          uint alpha_bin,
+                                          uint beta_bin,
+                                          uint gamma_bin,
+                                          Real e){
+
+  if(reduced_energies_ == NULL){
+    throw promod3::Error("You need to parametrize the reduced potential before setting energies!");
+  }
+
+  if(a == ost::conop::XXX || b == ost::conop::XXX){
+    throw promod3::Error("Cannot set energy for invalid amino acid");
+  }
+
+  if(dist_bin >= reduced_dist_bins_){
+    throw promod3::Error("Cannot set reduced energy for invalid dist bin");
+  }
+
+  if(alpha_bin >= reduced_angle_bins_){
+    throw promod3::Error("Cannot set reduced energy for invalid alpha bin");
+  }
+
+  if(beta_bin >= reduced_angle_bins_){
+    throw promod3::Error("Cannot set reduced energy for invalid beta bin");
+  }
+
+  if(gamma_bin >= reduced_dihedral_bins_){
+    throw promod3::Error("Cannot set reduced energy for invalid gamma bin");
+  }
+
+  reduced_energies_[a][b][dist_bin][alpha_bin][beta_bin][gamma_bin] = e;
+}
+
 void BackboneLoopScorer::SetTorsionEnergy(uint group_id_idx,
                                           uint phi_bin, uint psi_bin,
                                           Real e){
 
+  if(torsion_energies_ == NULL){
+    throw promod3::Error("You need to parametrize the torsion potential before setting energies!");
+  }
+
   if(group_id_idx >= num_torsion_groups_){
     throw promod3::Error("Invalid torsion group identifier index!");
   }
@@ -612,6 +827,10 @@ void BackboneLoopScorer::SetTorsionEnergy(uint group_id_idx,
 void BackboneLoopScorer::SetCBPackingEnergy(ost::conop::AminoAcid aa, 
                                             uint count, Real e){
 
+  if(cb_packing_energies_ == NULL){
+    throw promod3::Error("You need to parametrize the packing potential before setting energies!");
+  }
+
   if(aa == ost::conop::XXX){
     throw promod3::Error("Cannot set energy for invalid amino acid!");
   }
@@ -626,6 +845,10 @@ void BackboneLoopScorer::SetCBPackingEnergy(ost::conop::AminoAcid aa,
 void BackboneLoopScorer::SetHBondEnergy(uint state, uint d_bin, uint alpha_bin, 
                                         uint beta_bin, uint gamma_bin, Real e){
 
+  if(hbond_energies_ == NULL){
+    throw promod3::Error("You need to parametrize the hbond potential before setting energies!");
+  }
+
   if(state >= 3){
     throw promod3::Error("Invalid state when setting energy for hbond potential!");
   }
@@ -650,6 +873,21 @@ void BackboneLoopScorer::SetHBondEnergy(uint state, uint d_bin, uint alpha_bin,
 
 }
 
+void BackboneLoopScorer::SetSSAgreementScore(char psipred_state, int psipred_confidence,
+                                             char dssp_state, Real score){
+
+  if(ss_agreement_scores_ == NULL){
+    throw promod3::Error("You need to parametrize the ss agreement term before setting scores!");
+  }
+
+  int psipred_idx = GetPsipredIdx(psipred_state);
+  int dssp_idx = GetDSSPIdx(dssp_state);
+  if(psipred_confidence < 0 || psipred_confidence > 9){
+    throw promod3::Error("Invalid psipred confidence observed!");
+  }
+  ss_agreement_scores_[dssp_idx][psipred_idx][psipred_confidence] = score;
+}
+
 void BackboneLoopScorer::Initialize(const String& seqres){
   std::vector<String> seqres_vec;
   seqres_vec.push_back(seqres);
@@ -701,6 +939,7 @@ void BackboneLoopScorer::Initialize(const std::vector<String>& seqres){
   if(initialized_){
     for(uint i = 0; i < seqres_.size(); ++i){
       delete [] cb_env_data_[i];
+      delete [] reduced_env_data_[i];
       delete [] env_set_[i];
       delete [] hbond_env_data_[i];
       for(uint j = 0; j < seqres_[i].size(); ++j){
@@ -709,10 +948,12 @@ void BackboneLoopScorer::Initialize(const std::vector<String>& seqres){
       delete [] clash_env_data_[i];
     }
     delete [] cb_env_data_;
+    delete [] reduced_env_data_;
     delete [] clash_env_data_;
     delete [] hbond_env_data_;
     delete [] env_set_;
     cb_env_.Clear();
+    reduced_env_.Clear();
     clash_env_.Clear();
     hbond_env_.Clear();
   }
@@ -724,12 +965,14 @@ void BackboneLoopScorer::Initialize(const std::vector<String>& seqres){
 
   //initialize the environment data
   cb_env_data_ = new CBSpatialOrganizerItem*[seqres_.size()];
+  reduced_env_data_ = new ReducedSpatialOrganizerItem*[seqres_.size()];
   clash_env_data_ = new ClashSpatialOrganizerItem**[seqres_.size()];
   hbond_env_data_ = new HBondSpatialOrganizerItem*[seqres_.size()];
   env_set_ = new bool*[seqres_.size()];
 
   for(uint i = 0; i < seqres_.size(); ++i){
     cb_env_data_[i] = new CBSpatialOrganizerItem[seqres_[i].size()];
+    reduced_env_data_[i] = new ReducedSpatialOrganizerItem[seqres_[i].size()];
     clash_env_data_[i] = new ClashSpatialOrganizerItem*[seqres_[i].size()];
     hbond_env_data_[i] = new HBondSpatialOrganizerItem[seqres_[i].size()];
     env_set_[i] = new bool[seqres_[i].size()];
@@ -744,48 +987,133 @@ void BackboneLoopScorer::Initialize(const std::vector<String>& seqres){
   }
 
   //fill all data we already can into cb_env_data_
+  int actual_index = 0;
   for(uint i = 0; i < seqres_.size(); ++i){
     for(uint j = 0; j < seqres_[i].size(); ++j){
       cb_env_data_[i][j].aa = seqres_[i][j];
-      cb_env_data_[i][j].number = j+1;
-      cb_env_data_[i][j].chain_index = i;  
+      cb_env_data_[i][j].idx = actual_index;
+      ++actual_index;  
+    }
+  }
+
+  //fill all data we already can into reduced_env_data_
+  actual_index = 0;
+  for(uint i = 0; i < seqres_.size(); ++i){
+    for(uint j = 0; j < seqres_[i].size(); ++j){
+      reduced_env_data_[i][j].aa = seqres_[i][j];
+      reduced_env_data_[i][j].idx = actual_index;
+      ++actual_index;  
     }
   }
 
   //fill all data we already can into clash_env_data_
+  actual_index = 0;
   for(uint i = 0; i < seqres_.size(); ++i){
     for(uint j = 0; j < seqres_[i].size(); ++j){
       //N
       clash_env_data_[i][j][0].radius = 1.3;
-      clash_env_data_[i][j][0].number = j+1;
-      clash_env_data_[i][j][0].chain_index = i;
+      clash_env_data_[i][j][0].idx = actual_index;
       //CA
       clash_env_data_[i][j][1].radius = 1.6;
-      clash_env_data_[i][j][1].number = j+1;
-      clash_env_data_[i][j][1].chain_index = i;
+      clash_env_data_[i][j][1].idx = actual_index;
       //C
       clash_env_data_[i][j][2].radius = 1.6;
-      clash_env_data_[i][j][2].number = j+1;
-      clash_env_data_[i][j][2].chain_index = i;
+      clash_env_data_[i][j][2].idx = actual_index;
       //O
       clash_env_data_[i][j][3].radius = 1.3;
-      clash_env_data_[i][j][3].number = j+1;
-      clash_env_data_[i][j][3].chain_index = i;
+      clash_env_data_[i][j][3].idx = actual_index;
       //CB
       clash_env_data_[i][j][4].radius = 1.6;
-      clash_env_data_[i][j][4].number = j+1;
-      clash_env_data_[i][j][4].chain_index = i;
+      clash_env_data_[i][j][4].idx = actual_index;
+      ++actual_index;
     }
   }
 
   //fill all data we already can into hbond_env_data_
+  actual_index = 0;
   for(uint i = 0; i < seqres_.size(); ++i){
     for(uint j = 0; j < seqres_[i].size(); ++j){
-      hbond_env_data_[i][j].number = j+1;
-      hbond_env_data_[i][j].chain_index = i;
+      hbond_env_data_[i][j].idx = actual_index;
+      hbond_env_data_[i][j].is_proline = seqres_[i][j] == 'P';
+      ++actual_index;
     }
   }  
+
+  //let's finally set the residue indices
+  residue_indices_.clear();
+  actual_index = 0;
+  for(uint i = 0; i < seqres_.size(); ++i){
+    residue_indices_.push_back(std::vector<int>());
+    for(uint j = 0; j < seqres_[i].size(); ++j){
+      residue_indices_[i].push_back(actual_index);
+      ++actual_index;
+    }
+  }
+
   initialized_ = true;
+
+  psipred_pred_.clear();
+  psipred_conf_.clear();
+  psipred_set_ = false;
+}
+
+void BackboneLoopScorer::SetPsipredPrediction(PsipredPredictionPtr pp){
+  if(!initialized_){
+    throw promod3::Error("Cannot set psipred prediction if scorer is not initialized!");
+  }
+  if(seqres_.size() != 1){
+    String err = "Cannot set single psipred prediction for scorer being initialized ";
+    err += "with multiple chains!";
+    throw promod3::Error(err);
+  }
+  if(pp->size() != seqres_[0].size()){
+    String err = "Size of psipred prediction must be consistent with ";
+    err += "seqres you used to initialize the scorer!";
+    throw promod3::Error(err);
+  }
+  psipred_pred_.clear();
+  psipred_conf_.clear();
+
+  std::vector<int> pred;
+  for(uint i = 0; i < pp->size(); ++i){
+    pred.push_back(GetPsipredIdx(pp->GetPrediction(i)));
+  }
+  psipred_pred_.push_back(pred);
+  psipred_conf_.push_back(pp->GetConfidences());
+  psipred_set_ = true;
+}
+
+void BackboneLoopScorer::SetPsipredPrediction(std::vector<PsipredPredictionPtr>& pp){
+
+  if(!initialized_){
+    throw promod3::Error("Cannot set psipred prediction if scorer is not initialized!");
+  }
+  if(seqres_.size() != pp.size()){
+    String err = "Size of psipred predictions must be consistent with number ";
+    err += "of chains in scorer!";
+    throw promod3::Error(err);
+  }
+
+  for(uint i = 0; i < pp.size(); ++i){
+    if(seqres_[i].size() != pp[i]->size()){
+      String err = "Size of psipred predictions must be consistent with size ";
+      err += "seqres sequences in scorer!";
+      throw promod3::Error(err);
+    }
+  }
+
+  psipred_pred_.clear();
+  psipred_conf_.clear();
+
+  for(uint i = 0; i < pp.size(); ++i){
+    std::vector<int> pred;
+    for(uint j = 0; j < pp[i]->size(); ++j){
+      pred.push_back(GetPsipredIdx(pp[i]->GetPrediction(j)));
+    }
+    psipred_pred_.push_back(pred);
+    psipred_conf_.push_back(pp[i]->GetConfidences());    
+  }
+  psipred_set_ = true;
 }
 
 void BackboneLoopScorer::SetEnvironment(const ost::mol::EntityHandle& env){
@@ -893,6 +1221,13 @@ void BackboneLoopScorer::SetEnvironment(const ost::mol::EntityHandle& env){
         cb_env_data_[i][index].pos = cb_pos;
         cb_env_.Reset(&cb_env_data_[i][index],old_pos,cb_pos);
 
+        //do reduced_env_
+        old_pos = reduced_env_data_[i][index].pos;
+        reduced_env_data_[i][index].pos = ca_pos;
+        reduced_env_data_[i][index].axis = geom::Normalize(ca_pos-n_pos) +
+                                           geom::Normalize(ca_pos-c_pos);
+        reduced_env_.Reset(&reduced_env_data_[i][index],old_pos,ca_pos);
+
         //do clash_env_
 
         //do N
@@ -935,6 +1270,12 @@ void BackboneLoopScorer::SetEnvironment(const ost::mol::EntityHandle& env){
         cb_env_data_[i][index].pos = cb_pos;
         cb_env_.Add(&cb_env_data_[i][index],cb_pos);
 
+        //do reduced_env_
+        reduced_env_data_[i][index].pos = ca_pos;
+        reduced_env_data_[i][index].axis = geom::Normalize(ca_pos-n_pos) +
+                                           geom::Normalize(ca_pos-c_pos);
+        reduced_env_.Add(&reduced_env_data_[i][index],ca_pos);
+
         //do clash_env_
 
         //do N
@@ -1000,7 +1341,7 @@ void BackboneLoopScorer::SetEnvironment(const ost::mol::EntityHandle& env){
             states[i][j] = GetHBondState(phi,psi);
           }
         }
-        //note, that last hydrogen is calculated with a wrong phi...
+        //note, that first hydrogen is calculated with a wrong phi...
         //I just don't care at this point...
         promod3::core::ConstructAtomPos(current_item->c_pos,
                                         current_item->pos,
@@ -1099,6 +1440,13 @@ void BackboneLoopScorer::SetEnvironment(const promod3::loop::BackboneList& bb_li
       cb_env_data_[chain_index][index].pos = cb_pos;
       cb_env_.Reset(&cb_env_data_[chain_index][index],old_pos,cb_pos);
 
+      //do reduced_env_
+      old_pos = reduced_env_data_[chain_index][index].pos;
+      reduced_env_data_[chain_index][index].pos = ca_pos;
+      reduced_env_data_[chain_index][index].axis = geom::Normalize(ca_pos-n_pos) +
+                                                   geom::Normalize(ca_pos-c_pos);
+      reduced_env_.Reset(&reduced_env_data_[chain_index][index],old_pos,ca_pos);      
+
       //do clash_env_
       
       //do N
@@ -1140,6 +1488,12 @@ void BackboneLoopScorer::SetEnvironment(const promod3::loop::BackboneList& bb_li
       cb_env_data_[chain_index][index].pos = cb_pos;
       cb_env_.Add(&cb_env_data_[chain_index][index],cb_pos);
 
+      //do reduced_env_
+      reduced_env_data_[chain_index][index].pos = ca_pos;
+      reduced_env_data_[chain_index][index].axis = geom::Normalize(ca_pos-n_pos) +
+                                                   geom::Normalize(ca_pos-c_pos);
+      reduced_env_.Add(&reduced_env_data_[chain_index][index],ca_pos); 
+
       //do clash_env_
 
       //do N
@@ -1256,10 +1610,58 @@ void BackboneLoopScorer::SetEnvironment(const promod3::loop::BackboneList& bb_li
   }   
 }
 
+void BackboneLoopScorer::ClearEnvironment(uint start_resnum, uint num_residues, 
+                                        uint chain_index){
+
+  if(chain_index >= seqres_.size()){
+    throw promod3::Error("Invalid chain index encountered when clearing environment!");
+  }  
+
+  if(num_residues == 0){
+    throw promod3::Error("Num of residues to clear must be larger 0!");
+  }
+
+  uint end_resnum = start_resnum + num_residues - 1;
+  //in case of overflows(e.g. when user input is negative) start_resnum could be bigger end_resnum
+  if(start_resnum < 1 || end_resnum > seqres_[chain_index].size()){
+    throw promod3::Error("Invalid start residue number encountered when clearing environment!");
+  }
+
+  uint idx = start_resnum - 1;
+  uint num_clash_items;
+
+  for(uint i = 0; i < num_residues; ++i, ++idx){
+
+    env_set_[chain_index][idx] = false;
+
+    //remove cb env item in env
+    geom::Vec3 pos = cb_env_data_[chain_index][idx].pos;
+    cb_env_.Remove(&cb_env_data_[chain_index][idx],pos);
+
+    //remove hbond env item in env
+    pos = hbond_env_data_[chain_index][idx].pos;
+    hbond_env_.Remove(&hbond_env_data_[chain_index][idx],pos);
+
+    //remove reduced env item in env
+    pos = reduced_env_data_[chain_index][idx].pos;
+    reduced_env_.Remove(&reduced_env_data_[chain_index][idx],pos);
+
+    if(seqres_[chain_index][idx] == 'G') num_clash_items = 4;
+    else num_clash_items = 5;
+
+    for(uint j = 0; j < num_clash_items; ++j){
+      pos = clash_env_data_[chain_index][idx][j].pos;
+      clash_env_.Remove(&clash_env_data_[chain_index][idx][j],pos);  
+    }
+  }
+}
+
 Real BackboneLoopScorer::CalculateClashScore(const BackboneList& bb_list, uint start_resnum, 
                                              uint chain_index) const{
 
-  if(bb_list.size() < 3){
+  int size = bb_list.size();
+
+  if(size < 3){
     throw promod3::Error("Size of Backbone list must be at least 3!");
   }
 
@@ -1271,7 +1673,7 @@ Real BackboneLoopScorer::CalculateClashScore(const BackboneList& bb_list, uint s
     throw promod3::Error("Invalid chain index encountered when calculating backbone clash score!");
   }
 
-  uint end_resnum = start_resnum + bb_list.size() - 1;
+  uint end_resnum = start_resnum + size - 1;
   //in case of overflows(e.g. when user input is negative) start_resnum could be bigger end_resnum
   if(start_resnum < 1 || end_resnum > seqres_[chain_index].size()){
     throw promod3::Error("Invalid start residue number encountered when calculating backbone clash score!");
@@ -1282,67 +1684,68 @@ Real BackboneLoopScorer::CalculateClashScore(const BackboneList& bb_list, uint s
 
   Real clash_score = 0.0;
 
-  //start resnum has at least value one... in this case we get the actual invalid
-  //residue number 0... this has no effect on the result in the end...
-  //also for neglect_end we could potentially get an invalid residue number.
-  uint neglect_start = start_resnum-1;
-  uint neglect_end = end_resnum+1;
+  //variables to figure out what interactions to the environment should be neglected later on...
+  int loop_start_idx = residue_indices_[chain_index][start_resnum-1];
+  int loop_end_idx = residue_indices_[chain_index][end_resnum-1];
+  int neglect_start = std::max(residue_indices_[chain_index][0],loop_start_idx-1);
+  int neglect_end = std::min(residue_indices_[chain_index].back(),loop_end_idx+1);
+
+  for(int i = 0; i < size; ++i){
 
-  for(uint i = 0; i < bb_list.size(); ++i){
     within_result = clash_env_.FindWithin(bb_list[i].n_coord, 2.9);
     a = within_result.first;
     for(uint j = 0; j < within_result.second; ++j) {
-      if (neglect_start <= a[j].first->number && a[j].first->number <= neglect_end){
-        if(a[j].first->chain_index == chain_index) continue;
+      if (a[j].first->idx < neglect_start || a[j].first->idx > neglect_end){
+        clash_score += StericEnergy(a[j].second,1.3+a[j].first->radius);
       }
-      clash_score += StericEnergy(a[j].second,1.3+a[j].first->radius);
     }
+
     within_result = clash_env_.FindWithin(bb_list[i].ca_coord, 3.2);
     a = within_result.first;
     for(uint j = 0; j < within_result.second; ++j) {
-      if (neglect_start <= a[j].first->number && a[j].first->number <= neglect_end){
-        if(a[j].first->chain_index == chain_index) continue;
+      if (a[j].first->idx < neglect_start || a[j].first->idx > neglect_end){
+        clash_score += StericEnergy(a[j].second,1.6+a[j].first->radius);
       }
-      clash_score += StericEnergy(a[j].second,1.6+a[j].first->radius);
     }
+
     within_result = clash_env_.FindWithin(bb_list[i].c_coord, 3.2);
     a = within_result.first;
     for(uint j = 0; j < within_result.second; ++j) {
-      if (neglect_start <= a[j].first->number && a[j].first->number <= neglect_end){
-        if(a[j].first->chain_index == chain_index) continue;
+      if (a[j].first->idx < neglect_start || a[j].first->idx > neglect_end){
+        clash_score += StericEnergy(a[j].second,1.6+a[j].first->radius);
       }
-      clash_score += StericEnergy(a[j].second,1.6+a[j].first->radius);
     }
+
     within_result = clash_env_.FindWithin(bb_list[i].o_coord, 2.9);
     a = within_result.first;
     for(uint j = 0; j < within_result.second; ++j) {
-      if (neglect_start <= a[j].first->number && a[j].first->number <= neglect_end){
-        if(a[j].first->chain_index == chain_index) continue;
-      }
-      clash_score += StericEnergy(a[j].second,1.3+a[j].first->radius);
+      if (a[j].first->idx < neglect_start || a[j].first->idx > neglect_end){
+        clash_score += StericEnergy(a[j].second,1.3+a[j].first->radius);
+      } 
     }
     
     if(bb_list[i].aa != ost::conop::GLY){
       within_result = clash_env_.FindWithin(bb_list[i].cb_coord, 3.2);
       a = within_result.first;
       for(uint j = 0; j < within_result.second; ++j) {
-        if (neglect_start <= a[j].first->number && a[j].first->number <= neglect_end){
-          if(a[j].first->chain_index == chain_index) continue;
+        if (a[j].first->idx < neglect_start || a[j].first->idx > neglect_end){
+          clash_score += StericEnergy(a[j].second,1.6+a[j].first->radius);
         }
-        clash_score += StericEnergy(a[j].second,1.6+a[j].first->radius);
       }
     }
   }
   clash_score += CalculateInternalClashScore(bb_list);
 
-  clash_score /= bb_list.size();
+  clash_score /= size;
   return clash_score;
 }
 
 Real BackboneLoopScorer::CalculateCBetaScore(const BackboneList& bb_list, uint start_resnum, 
                                              uint chain_index) const{
 
-  if(bb_list.size() < 3){
+  int size = bb_list.size();
+
+  if(size < 3){
     throw promod3::Error("Size of Backbone list must be at least 3!");
   }
 
@@ -1354,7 +1757,7 @@ Real BackboneLoopScorer::CalculateCBetaScore(const BackboneList& bb_list, uint s
     throw promod3::Error("Invalid chain index encountered when calculating cbeta score!");
   }
 
-  uint end_resnum = start_resnum + bb_list.size()-1;
+  uint end_resnum = start_resnum +size-1;
   //in case of overflows(e.g. when user input is negative) start_resnum could be bigger end_resnum
   if(start_resnum < 1 || end_resnum > seqres_[chain_index].size()){
     throw promod3::Error("Invalid start residue number encountered when calculating cbeta score!");
@@ -1372,27 +1775,40 @@ Real BackboneLoopScorer::CalculateCBetaScore(const BackboneList& bb_list, uint s
   Real cbeta_score = 0.0;
   int counter = 0;
   int max_bin = cbeta_bins_-1;
+
+  //let's precalculate the idx ranges we have to neglect
+  int loop_start_idx = residue_indices_[chain_index][start_resnum-1];
+  int loop_end_idx = residue_indices_[chain_index][end_resnum-1];
+  int min_idx_chain = residue_indices_[chain_index][0];
+  int max_idx_chain = residue_indices_[chain_index].back();
+  int seq_sep = static_cast<int>(cbeta_seq_sep_);
+  std::vector<int> start_neglect(size,loop_start_idx);
+  std::vector<int> end_neglect(size,loop_end_idx);
+  int neglect_range = seq_sep - 1;
+
+  for(int i = 0; i < neglect_range; ++i){
+    start_neglect[i] = std::max(min_idx_chain,start_neglect[i]-(neglect_range+i));
+    end_neglect[size-1-i] = std::min(max_idx_chain,end_neglect[i]+(neglect_range-i));
+  }
+
   //let's go over every loop residue
-  for(uint i = 0; i < bb_list.size(); ++i){
+  for(int i = 0; i < size; ++i){
     within_result = cb_env_.FindWithin(bb_list[i].cb_coord, cbeta_cutoff_);
     a = within_result.first;
     for(uint j = 0; j < within_result.second; ++j){
-      if(std::abs(static_cast<int>(a[j].first->number)-static_cast<int>(start_resnum+i)) < static_cast<int>(cbeta_seq_sep_) ||
-         (a[j].first->number >= start_resnum && a[j].first->number <= end_resnum)){ //not considering any loop residues
-        if(chain_index == a[j].first->chain_index){
-          continue;
-        }
+      if(a[j].first->idx < start_neglect[i] || a[j].first->idx > end_neglect[i]){
+        bin = std::min(static_cast<int>(a[j].second/cbeta_bin_size_),max_bin);
+        cbeta_score += cbeta_energies_[bb_list[i].aa][a[j].first->aa][bin];
+        ++counter;
       }
-      bin = std::min(static_cast<int>(a[j].second/cbeta_bin_size_),max_bin);
-      cbeta_score += cbeta_energies_[bb_list[i].aa][a[j].first->aa][bin];
-      ++counter;
     }
   }
+
   //we do not have the loop internal interactions yet
   //let's do first the interactions towards c_ter
-  if(bb_list.size()>=cbeta_seq_sep_){
-    for(uint i = 0; i < bb_list.size()-cbeta_seq_sep_; ++i){
-      for(uint j = i+cbeta_seq_sep_; j < bb_list.size(); ++j){
+  if(size>=seq_sep){
+    for(int i = 0; i < size-seq_sep; ++i){
+      for(int j = i+seq_sep; j < size; ++j){
         dist = geom::Length2(bb_list[i].cb_coord-bb_list[j].cb_coord);
         if(dist >= squared_cbeta_cutoff_) continue;
         dist = std::sqrt(dist);
@@ -1402,8 +1818,8 @@ Real BackboneLoopScorer::CalculateCBetaScore(const BackboneList& bb_list, uint s
       }
     }
     //let's finally do the ones towards n_ter
-    for(uint i = cbeta_seq_sep_; i < bb_list.size(); ++i){
-      for(uint j = 0; j <= i-cbeta_seq_sep_; ++j){
+    for(int i = seq_sep; i < size; ++i){
+      for(int j = 0; j <= i-seq_sep; ++j){
         dist = geom::Length2(bb_list[i].cb_coord-bb_list[j].cb_coord);
         if(dist >= squared_cbeta_cutoff_) continue;
         dist = std::sqrt(dist);
@@ -1417,14 +1833,154 @@ Real BackboneLoopScorer::CalculateCBetaScore(const BackboneList& bb_list, uint s
   return cbeta_score;
 }
 
+Real BackboneLoopScorer::CalculateReducedScore(const BackboneList& bb_list, uint start_resnum,
+                                               uint chain_index) const{
+
+  int size = bb_list.size();
+
+  if(size < 3){
+    throw promod3::Error("Size of Backbone list must be at least 3!");
+  }
+
+  if(!initialized_){
+    throw promod3::Error("Require Loop Scorer to be properly initialized before use!");
+  }
+
+  if(chain_index >= seqres_.size()){
+    throw promod3::Error("Invalid chain index encountered when calculating reduced score!");
+  }
+
+  uint end_resnum = start_resnum +size-1;
+  //in case of overflows(e.g. when user input is negative) start_resnum could be bigger end_resnum
+  if(start_resnum < 1 || end_resnum > seqres_[chain_index].size()){
+    throw promod3::Error("Invalid start residue number encountered when calculating reduced score!");
+  }
+
+  if(reduced_energies_ == NULL){
+    throw promod3::Error("Reduced potential needs to be attached to scorer to calculate according score!");
+  }
+
+  promod3::loop::DynamicSpatialOrganizer<ReducedSpatialOrganizerItem,geom::Vec3>::WithinResult within_result;
+  std::pair<ReducedSpatialOrganizerItem*,Real>* a;
+
+  Real reduced_score = 0.0;
+  Real dist;
+  Real alpha;
+  Real beta;
+  Real gamma;
+  int dist_bin;
+  int alpha_bin;
+  int beta_bin;
+  int gamma_bin;
+  int counter = 0;
+  int max_dist_bin = reduced_dist_bins_-1;
+  int max_angle_bin = reduced_angle_bins_-1;
+  int max_dihedral_bin = reduced_dihedral_bins_-1;
+
+  //let's precalculate the idx ranges we have to neglect
+  int loop_start_idx = residue_indices_[chain_index][start_resnum-1];
+  int loop_end_idx = residue_indices_[chain_index][end_resnum-1];
+  int min_idx_chain = residue_indices_[chain_index][0];
+  int max_idx_chain = residue_indices_[chain_index].back();
+  int seq_sep = static_cast<int>(reduced_seq_sep_);
+  std::vector<int> start_neglect(size,loop_start_idx);
+  std::vector<int> end_neglect(size,loop_end_idx);
+  int neglect_range = seq_sep - 1;
+
+  for(int i = 0; i < neglect_range; ++i){
+    start_neglect[i] = std::max(min_idx_chain,start_neglect[i]-(neglect_range+i));
+    end_neglect[size-1-i] = std::min(max_idx_chain,end_neglect[i]+(neglect_range-i));
+  }
+
+  geom::Vec3 bb_list_axis[size];
+  geom::Vec3 bb_list_ca_pos[size];
+  for(int i = 0; i < size; ++i){
+    bb_list_ca_pos[i] = bb_list[i].ca_coord;
+    bb_list_axis[i] = geom::Normalize(bb_list_ca_pos[i]-bb_list[i].n_coord) +
+                      geom::Normalize(bb_list_ca_pos[i]-bb_list[i].c_coord);
+  }
+
+  //let's go over every loop residue
+  for(int i = 0; i < size; ++i){
+    within_result = reduced_env_.FindWithin(bb_list_ca_pos[i], reduced_distance_cutoff_);
+    a = within_result.first;
+    for(uint j = 0; j < within_result.second; ++j){
+      if(a[j].first->idx < start_neglect[i] || a[j].first->idx > end_neglect[i]){
+        dist_bin = std::min(static_cast<int>(a[j].second/reduced_dist_bin_size_),max_dist_bin);
+        alpha = geom::Angle(bb_list_axis[i],a[j].first->pos-bb_list_ca_pos[i]);
+        beta = geom::Angle(a[j].first->axis,bb_list_ca_pos[i]-a[j].first->pos);
+        gamma = geom::DihedralAngle(bb_list_ca_pos[i]+bb_list_axis[i], bb_list_ca_pos[i], 
+                                    a[j].first->pos, a[j].first->pos+a[j].first->axis);
+        alpha_bin = std::min(static_cast<int>(alpha/reduced_angle_bin_size_), max_angle_bin);
+        beta_bin = std::min(static_cast<int>(beta/reduced_angle_bin_size_), max_angle_bin);
+        gamma_bin = std::min(static_cast<int>((gamma+M_PI)/reduced_dihedral_bin_size_), max_dihedral_bin);
+        reduced_score += reduced_energies_[bb_list[i].aa][a[j].first->aa][dist_bin][alpha_bin][beta_bin][gamma_bin];
+        ++counter;
+      }
+    }
+  }
+
+  //we do not have the loop internal interactions yet
+  //let's do first the interactions towards c_ter
+  if(size>=seq_sep){
+    for(int i = 0; i < size-seq_sep; ++i){
+      for(int j = i+seq_sep; j < size; ++j){
+        dist = geom::Length2(bb_list_ca_pos[i]-bb_list_ca_pos[j]);
+        if(dist >= reduced_squared_distance_cutoff_) continue;
+        dist = std::sqrt(dist);
+        alpha = geom::Angle(bb_list_axis[i],bb_list_ca_pos[j]-bb_list_ca_pos[i]);
+        beta = geom::Angle(bb_list_axis[j],bb_list_ca_pos[i]-bb_list_ca_pos[j]);
+        gamma = geom::DihedralAngle(bb_list_ca_pos[i] + bb_list_axis[i],
+                                    bb_list_ca_pos[i],
+                                    bb_list_ca_pos[j],
+                                    bb_list_ca_pos[j] + bb_list_axis[j]);
+        dist_bin = std::min(static_cast<int>(dist/reduced_dist_bin_size_),max_dist_bin);
+        alpha_bin = std::min(static_cast<int>(alpha/reduced_angle_bin_size_), max_angle_bin);
+        beta_bin = std::min(static_cast<int>(beta/reduced_angle_bin_size_), max_angle_bin);
+        gamma_bin = std::min(static_cast<int>((gamma+M_PI)/reduced_dihedral_bin_size_), max_dihedral_bin);
+        reduced_score += reduced_energies_[bb_list[i].aa][bb_list[j].aa][dist_bin][alpha_bin][beta_bin][gamma_bin];
+        ++counter;
+      }
+    }
+
+    //let's finally do the ones towards n_ter
+    for(int i = seq_sep; i < size; ++i){
+      for(int j = 0; j <= i-seq_sep; ++j){
+        dist = geom::Length2(bb_list_ca_pos[i]-bb_list_ca_pos[j]);
+        if(dist >= reduced_squared_distance_cutoff_) continue;
+        dist = std::sqrt(dist);
+        alpha = geom::Angle(bb_list_axis[i],bb_list_ca_pos[j]-bb_list_ca_pos[i]);
+        beta = geom::Angle(bb_list_axis[j],bb_list_ca_pos[i]-bb_list_ca_pos[j]);
+        gamma = geom::DihedralAngle(bb_list_ca_pos[i] + bb_list_axis[i],
+                                    bb_list_ca_pos[i],
+                                    bb_list_ca_pos[j],
+                                    bb_list_ca_pos[j] + bb_list_axis[j]);
+        dist_bin = std::min(static_cast<int>(dist/reduced_dist_bin_size_),max_dist_bin);
+        alpha_bin = std::min(static_cast<int>(alpha/reduced_angle_bin_size_), max_angle_bin);
+        beta_bin = std::min(static_cast<int>(beta/reduced_angle_bin_size_), max_angle_bin);
+        gamma_bin = std::min(static_cast<int>((gamma+M_PI)/reduced_dihedral_bin_size_), max_dihedral_bin);
+        reduced_score += reduced_energies_[bb_list[i].aa][bb_list[j].aa][dist_bin][alpha_bin][beta_bin][gamma_bin];
+        ++counter;
+      }
+    }
+  }
+
+  if(counter>0) reduced_score /= counter;
+  return reduced_score;
+
+  return 0.0;
+}
+
 Real BackboneLoopScorer::CalculateTorsionScore(const BackboneList& bb_list, uint start_resnum, 
                                                uint chain_index) const{
 
-  if(bb_list.size() < 3){
+  int size = bb_list.size();
+
+  if(size < 3){
     throw promod3::Error("Size of Backbone list must be at least 3!");
   }
 
-  uint end_resnum = start_resnum + bb_list.size()-1;
+  uint end_resnum = start_resnum +size-1;
   if(!initialized_){
     throw promod3::Error("Require Loop Scorer to be properly initialized before use!");
   }
@@ -1446,7 +2002,7 @@ Real BackboneLoopScorer::CalculateTorsionScore(const BackboneList& bb_list, uint
   Real angle1, angle2;
   uint bin1, bin2;
   int torsion_group_index;
-  for(uint i = 1; i < bb_list.size()-1; ++i){
+  for(int i = 1; i < size-1; ++i){
     torsion_group_index = torsion_group_indices_[chain_index][start_resnum-1+i];
     if(torsion_group_index == -1) continue;
     angle1 = geom::DihedralAngle(bb_list[i-1].c_coord,bb_list[i].n_coord,
@@ -1484,7 +2040,7 @@ Real BackboneLoopScorer::CalculateTorsionScore(const BackboneList& bb_list, uint
         torsion_group_index = torsion_group_indices_[chain_index][end_resnum-1];
         if(torsion_group_index != -1){
           //the data for the residues before and after get extracted from the hbond env data
-          angle1 = bb_list.GetPhiTorsion(bb_list.size()-1);
+          angle1 = bb_list.GetPhiTorsion(size-1);
           angle2 = geom::DihedralAngle(bb_list.back().n_coord,
                                        bb_list.back().ca_coord,
                                        bb_list.back().c_coord, 
@@ -1505,7 +2061,9 @@ Real BackboneLoopScorer::CalculateTorsionScore(const BackboneList& bb_list, uint
 Real BackboneLoopScorer::CalculateCBPackingScore(const BackboneList& bb_list, uint start_resnum,
                                                  uint chain_index) const{
 
-  if(bb_list.size() < 3){
+  int size = bb_list.size();
+
+  if(size < 3){
     throw promod3::Error("Size of Backbone list must be at least 3!");
   }
 
@@ -1516,7 +2074,7 @@ Real BackboneLoopScorer::CalculateCBPackingScore(const BackboneList& bb_list, ui
   if(chain_index >= seqres_.size()){
     throw promod3::Error("Invalid chain index encountered when calculating cb packing score!");
   }
-  uint end_resnum = start_resnum + bb_list.size()-1;
+  uint end_resnum = start_resnum + size-1;
   //in case of overflows(e.g. when user input is negative) start_resnum could be bigger end_resnum
   if(start_resnum < 1 || end_resnum > seqres_[chain_index].size()){
     throw promod3::Error("Invalid start residue number encountered when calculating cb packing score!");
@@ -1531,37 +2089,36 @@ Real BackboneLoopScorer::CalculateCBPackingScore(const BackboneList& bb_list, ui
 
   uint counter;
   Real packing_score = 0.0;
-  //let's go over every loop residue (not including before and after)
-  for(uint i = 0; i < bb_list.size(); ++i){
+  int loop_start_idx = residue_indices_[chain_index][start_resnum-1];
+  int loop_end_idx = residue_indices_[chain_index][end_resnum-1];
+  //let's go over every loop residue
+  for(int i = 0; i < size; ++i){
     counter = 0;
     //lets first search for other cb positions in the spatial organizer,
     //neglecting all residue numbers from the loop
     within_result = cb_env_.FindWithin(bb_list[i].cb_coord,cb_packing_cutoff_);
     a = within_result.first;
     for(uint j = 0; j < within_result.second; ++j){
-      if(a[j].first->number >= start_resnum && a[j].first->number <= end_resnum){
-        if(chain_index==a[j].first->chain_index){
-          continue;
-        }
-      }
-      ++counter;
+      if(a[j].first->idx < loop_start_idx || a[j].first->idx > loop_end_idx) ++counter;
     }
     //let's finally look for other residues within the cutoff in the loop
-    for(uint j = 0; j < bb_list.size(); ++j){
+    for(int j = 0; j < size; ++j){
       if(j == i) continue;
       if(geom::Length2(bb_list[i].cb_coord-bb_list[j].cb_coord) < squared_cb_packing_cutoff_) ++counter;
     }
     packing_score += cb_packing_energies_[bb_list[i].aa][std::min(counter,cb_packing_max_count_)];
   }
 
-  packing_score /= bb_list.size();
+  packing_score /= size;
   return packing_score;
 }
 
 Real BackboneLoopScorer::CalculateHBondScore(const BackboneList& bb_list, uint start_resnum, 
                                              uint chain_index) const{
 
-  if(bb_list.size() < 3){
+  int size = bb_list.size();
+
+  if(size < 3){
     throw promod3::Error("Size of Backbone list must be at least 3!");
   }
 
@@ -1573,7 +2130,7 @@ Real BackboneLoopScorer::CalculateHBondScore(const BackboneList& bb_list, uint s
     throw promod3::Error("Invalid chain index encountered when calculating hbond score!");
   }
 
-  uint end_resnum = start_resnum + bb_list.size()-1;
+  uint end_resnum = start_resnum + size-1;
   //in case of overflows(e.g. when user input is negative) start_resnum could be bigger end_resnum
   if(start_resnum < 1 || end_resnum > seqres_[chain_index].size()){
     throw promod3::Error("Invalid start residue number encountered when calculating hbond score!");
@@ -1590,14 +2147,14 @@ Real BackboneLoopScorer::CalculateHBondScore(const BackboneList& bb_list, uint s
   Real hbond_score = 0.0;
 
   //note, that the n-terminal backbone hydrogen will be constructed below
-  std::vector<geom::Vec3>  h_positions(bb_list.size());
-  for(uint i = 1; i < bb_list.size(); ++i){
+  std::vector<geom::Vec3>  h_positions(size);
+  for(int i = 1; i < size; ++i){
     Real phi = bb_list.GetPhiTorsion(i);
     promod3::core::ConstructAtomPos(bb_list[i].c_coord,bb_list[i].ca_coord,
                                     bb_list[i].n_coord,0.9970,2.0420,phi+M_PI,h_positions[i]);    
   }
 
-  uint states[bb_list.size()];
+  uint states[size];
   Real n_phi = -1.0472;
   Real c_psi = -0.78540;
   if(start_resnum > 1){
@@ -1623,9 +2180,9 @@ Real BackboneLoopScorer::CalculateHBondScore(const BackboneList& bb_list, uint s
                                   bb_list[0].n_coord,0.9970,2.0420,n_phi+M_PI,h_positions[0]);
 
   states[0] = GetHBondState(n_phi,bb_list.GetPsiTorsion(0));
-  states[bb_list.size()-1] = GetHBondState(bb_list.GetPhiTorsion(bb_list.size()-1),c_psi);
+  states[size-1] = GetHBondState(bb_list.GetPhiTorsion(size-1),c_psi);
 
-  for(uint i = 1; i < bb_list.size()-1; ++i){
+  for(int i = 1; i <size-1; ++i){
     states[i] = GetHBondState(bb_list.GetPhiTorsion(i),
                               bb_list.GetPsiTorsion(i));
   }
@@ -1649,13 +2206,23 @@ Real BackboneLoopScorer::CalculateHBondScore(const BackboneList& bb_list, uint s
       states[0] = 0;
     }
   }
-  if(states[bb_list.size()-1] == 2){
-    if(next_state != 2 && states[bb_list.size()-2] != 2){
-      states[bb_list.size()-1] = 0;
+  if(states[0] == 2){
+    if(prev_state != 2 && states[1] != 2){
+      states[0] = 0;
+    }
+  }
+  if(states[size-1] == 1){
+    if(next_state != 1 && states[size-2] != 1){
+      states[size-1] = 0;
+    }
+  }
+  if(states[size-1] == 2){
+    if(next_state != 2 && states[size-2] != 2){
+      states[size-1] = 0;
     }
   }
 
-  for(uint i = 1; i < bb_list.size()-1; ++i){
+  for(int i = 1; i < size-1; ++i){
     if(states[i] == 1){
       if(states[i-1] == 1 || states[i+1] == 1) continue;
     }
@@ -1667,69 +2234,82 @@ Real BackboneLoopScorer::CalculateHBondScore(const BackboneList& bb_list, uint s
 
   //let's go over every loop residue
   int state;
-  for(uint i = 0; i < bb_list.size(); ++i){
-    within_result = hbond_env_.FindWithin(bb_list[i].ca_coord, 8.0);
+  int loop_start_idx = residue_indices_[chain_index][start_resnum-1];
+  int loop_end_idx = residue_indices_[chain_index][end_resnum-1];
+  for(int i = 0; i < size; ++i){
+    within_result = hbond_env_.FindWithin(bb_list[i].ca_coord, 9.0);
     a = within_result.first;
     for(uint j = 0; j < within_result.second; ++j){
-      if(a[j].first->number >= start_resnum && a[j].first->number <= end_resnum){ //not considering any loop residues
-        if(chain_index == a[j].first->chain_index){
-          continue;
-        }
-      }
-      if(states[i] == a[j].first->state) state = states[i];
-      else state = 0;
 
-      //case of being donor for current bb item
-      hbond_score += this->EvalHBondPotential(state,bb_list[i].n_coord,
-                                              h_positions[i],
-                                              a[j].first->pos,
-                                              a[j].first->c_pos,
-                                              a[j].first->o_pos);
+      if(a[j].first->idx < loop_start_idx || a[j].first->idx > loop_end_idx){
 
+        if(states[i] == a[j].first->state) state = states[i];
+        else state = 0;
 
-      //case of being acceptor for current bb item
-      hbond_score += this->EvalHBondPotential(state, a[j].first->n_pos, 
-                                              a[j].first->h_pos,
-                                              bb_list[i].ca_coord, 
-                                              bb_list[i].c_coord,
-                                              bb_list[i].o_coord);
+        //case of being donor for current bb item
+        if(bb_list[i].one_letter_code != 'P'){
+          hbond_score += this->EvalHBondPotential(state,bb_list[i].n_coord,
+                                                  h_positions[i],
+                                                  a[j].first->pos,
+                                                  a[j].first->c_pos,
+                                                  a[j].first->o_pos);
+        }
+
+        //case of being acceptor for current bb item
+        if(!a[j].first->is_proline){
+          hbond_score += this->EvalHBondPotential(state, a[j].first->n_pos, 
+                                                  a[j].first->h_pos,
+                                                  bb_list[i].ca_coord, 
+                                                  bb_list[i].c_coord,
+                                                  bb_list[i].o_coord);
+        }
+      }
     }
   }
 
   //we do not have the loop internal interactions yet...
-  for(uint i = 1; i < bb_list.size(); ++i){
-    for(uint j = 0; j < i; ++j){
+  for(int i = 0; i < size; ++i){
+    for(int j = 0; j < size; ++j){
+
+      if(i == j) continue;
+
+      if(geom::Length2(bb_list[i].ca_coord-bb_list[j].ca_coord) > 81.0) continue;
 
       if(states[i] == states[j]) state = states[i];
       else state = 0;
 
       //case of i being donor
-      hbond_score += this->EvalHBondPotential(state,
-                                              bb_list[i].n_coord,
-                                              h_positions[i],
-                                              bb_list[j].ca_coord, 
-                                              bb_list[j].c_coord, 
-                                              bb_list[j].o_coord);
+      if(bb_list[i].one_letter_code != 'P'){
+        hbond_score += this->EvalHBondPotential(state,
+                                                bb_list[i].n_coord,
+                                                h_positions[i],
+                                                bb_list[j].ca_coord, 
+                                                bb_list[j].c_coord, 
+                                                bb_list[j].o_coord);
+      }
 
       //case of i being acceptor
-      hbond_score += this->EvalHBondPotential(state,
-                                              bb_list[j].n_coord,
-                                              h_positions[j],
-                                              bb_list[i].ca_coord,
-                                              bb_list[i].c_coord, 
-                                              bb_list[i].o_coord);
+      if(bb_list[j].one_letter_code != 'P'){
+        hbond_score += this->EvalHBondPotential(state,
+                                                bb_list[j].n_coord,
+                                                h_positions[j],
+                                                bb_list[i].ca_coord,
+                                                bb_list[i].c_coord, 
+                                                bb_list[i].o_coord);
+      }
     }
   }
 
-  hbond_score /= bb_list.size();
+  hbond_score /= size;
   return hbond_score;
 }
 
+Real BackboneLoopScorer::CalculateSSAgreementScore(const BackboneList& bb_list, uint start_resnum, 
+                                                   uint chain_index) const{
 
-Real BackboneLoopScorer::CalculateDSSPHBondScore(const BackboneList& bb_list, uint start_resnum, 
-                                             uint chain_index) const{
+  int size = bb_list.size();
 
-  if(bb_list.size() < 3){
+  if(size < 3){
     throw promod3::Error("Size of Backbone list must be at least 3!");
   }
 
@@ -1741,90 +2321,294 @@ Real BackboneLoopScorer::CalculateDSSPHBondScore(const BackboneList& bb_list, ui
     throw promod3::Error("Invalid chain index encountered when calculating hbond score!");
   }
 
-  uint end_resnum = start_resnum + bb_list.size()-1;
+  if(ss_agreement_scores_ == NULL){
+    throw promod3::Error("SSAgreement scores must be attached to scorer to calculate according score!");
+  }
+
+  if(!psipred_set_){
+    throw promod3::Error("Psipred prediction must be set in scorer to calculate SSAgrement score!");
+  }
+
+  uint end_resnum = start_resnum + size-1;
   //in case of overflows(e.g. when user input is negative) start_resnum could be bigger end_resnum
   if(start_resnum < 1 || end_resnum > seqres_[chain_index].size()){
-    throw promod3::Error("Invalid start residue number encountered when calculating hbond score!");
+    throw promod3::Error("Invalid start residue number encountered when calculating ss_agreement score!");
   }
 
-  promod3::loop::DynamicSpatialOrganizer<HBondSpatialOrganizerItem,geom::Vec3>::WithinResult within_result;
-  std::pair<HBondSpatialOrganizerItem*,Real>* a;
+  //to assign the secondary structure as correct as possible we need to
+  //define margins to the left and right if the environment is correctly set there...
+  int start_idx = start_resnum-1;
+  int end_idx = end_resnum-1;
+  int max_left_margin = std::min(6,start_idx);
+  int max_right_margin = std::min(6,static_cast<int>(residue_indices_[chain_index].size())-1-end_idx);
+  int left_margin = 0;
+  int right_margin = 0;
 
-  Real score;
-  Real hbond_score = 0.0;
+  for(int i = 0; i < max_left_margin; ++i){
+    if(!env_set_[chain_index][start_idx-1-i]) break;
+    ++left_margin;
+  }
 
-  std::vector<geom::Vec3>  h_positions(bb_list.size());
-  for(uint i = 1; i < bb_list.size(); ++i){
-    Real phi = bb_list.GetPhiTorsion(i);
-    promod3::core::ConstructAtomPos(bb_list[i].c_coord,bb_list[i].ca_coord,
-                                    bb_list[i].n_coord,0.9970,2.0420,phi+M_PI,h_positions[i]);    
+  for(int i = 0; i < max_right_margin; ++i){
+    if(!env_set_[chain_index][end_idx+1+i]) break;
+    ++right_margin;
   }
 
-  Real n_phi = -1.0472;
-  if(start_resnum > 1){
-    if(env_set_[chain_index][start_resnum-2]){
-      n_phi = geom::DihedralAngle(hbond_env_data_[chain_index][start_resnum-2].c_pos,
-                                  bb_list[0].n_coord, 
-                                  bb_list[0].ca_coord, 
-                                  bb_list[0].c_coord);
-    }
+  int total_size = size + left_margin + right_margin;
+  
+  std::vector<geom::Vec3> ca_positions(total_size, geom::Vec3(0,0,0));
+  std::vector<geom::Vec3> c_positions(total_size, geom::Vec3(0,0,0));
+  std::vector<geom::Vec3> o_positions(total_size, geom::Vec3(0,0,0)); 
+  std::vector<geom::Vec3> n_positions(total_size, geom::Vec3(0,0,0));
+  std::vector<geom::Vec3> h_positions(total_size, geom::Vec3(0,0,0));
+
+  //lets first fill everything from the left margin using hbond env
+  for(int i = 0; i < left_margin; ++i){
+    const HBondSpatialOrganizerItem& env_item = hbond_env_data_[chain_index][start_idx-left_margin+i];
+    ca_positions[i] = env_item.pos;
+    c_positions[i] = env_item.c_pos;
+    o_positions[i] = env_item.o_pos;
+    n_positions[i] = env_item.n_pos;
+    h_positions[i] = env_item.h_pos;
+  }
+  //lets fill everything from the right margin
+  for(int i = 0; i < right_margin; ++i){
+    const HBondSpatialOrganizerItem& env_item = hbond_env_data_[chain_index][end_idx+1+i]; 
+    ca_positions[left_margin+size+i] = env_item.pos;
+    c_positions[left_margin+size+i] = env_item.c_pos;
+    o_positions[left_margin+size+i] = env_item.o_pos;
+    n_positions[left_margin+size+i] = env_item.n_pos;
+    h_positions[left_margin+size+i] = env_item.h_pos;   
+  }
+
+  //let's fill all positions from the bb_list except the hydrogen ones...
+  for(int i = 0; i < size; ++i){
+    const Backbone& bb_item = bb_list[i];
+    ca_positions[left_margin+i] = bb_item.ca_coord;
+    c_positions[left_margin+i] = bb_item.c_coord;
+    o_positions[left_margin+i] = bb_item.o_coord;
+    n_positions[left_margin+i] = bb_item.n_coord;   
+  }
+
+  //we can finally calculate the h-positions, we do this the dirty dssp way 
+  //(negative c-o vector of previous residue)
+  int first_h;
+  if(left_margin == 0) first_h = 1;
+  else first_h = 0;
+  for(int i = first_h; i < size; ++i){
+    geom::Vec3 dir = geom::Normalize(c_positions[left_margin+i-1]-
+                                     o_positions[left_margin+i-1]);
+    h_positions[left_margin+i] = n_positions[left_margin+i] + dir;
+  }
+
+  //if the first hbond is one, we have to construct a "dummy" h,
+  //note that there is no previous res in the env in this case...
+  if(first_h == 1){
+    promod3::core::ConstructAtomPos(c_positions[0],ca_positions[0],
+                                    n_positions[0],0.9970,2.0420,2.0944,h_positions[0]);
+
   }
-  promod3::core::ConstructAtomPos(bb_list[0].c_coord,bb_list[0].ca_coord,
-                                  bb_list[0].n_coord,0.9970,2.0420,n_phi+M_PI,h_positions[0]);
+  
+  std::vector<int> donor_for_one(total_size,-1);
+  std::vector<int> donor_for_two(total_size,-1);
+  std::vector<int> acceptor_for_one(total_size,-1);
+  std::vector<int> acceptor_for_two(total_size,-1);
+  std::vector<Real> donor_one_energies(total_size,std::numeric_limits<Real>::max());
+  std::vector<Real> donor_two_energies(total_size,std::numeric_limits<Real>::max());
+  std::vector<Real> acceptor_one_energies(total_size,std::numeric_limits<Real>::max());
+  std::vector<Real> acceptor_two_energies(total_size,std::numeric_limits<Real>::max());
+  
+  int loop_start_idx = residue_indices_[chain_index][start_idx];
+  int loop_end_idx = residue_indices_[chain_index][end_idx];
+  int positions_start_idx = loop_start_idx-left_margin;
+  int positions_end_idx = loop_end_idx+right_margin;
+  int min_idx_chain = residue_indices_[chain_index][0];
+  int max_idx_chain = residue_indices_[chain_index].back();
+  //let's precalculate the idx ranges we have to neglect
+  std::vector<int> start_neglect(total_size,positions_start_idx);
+  std::vector<int> end_neglect(total_size,positions_end_idx);
 
+  for(int i = 0; i < 2; ++i){
+    start_neglect[i] = std::max(min_idx_chain,start_neglect[i]-(2+i));
+    end_neglect[total_size-1-i] = std::min(max_idx_chain,end_neglect[i]+(2-i));
+  }
 
-  //let's go over every loop residue
-  for(uint i = 0; i < bb_list.size(); ++i){
-    within_result = hbond_env_.FindWithin(bb_list[i].ca_coord, 8.0);
+  //we have to know where the prolines are
+  bool prolines[total_size];
+  for(int i = 0; i < total_size; ++i){
+    prolines[i] = seqres_[chain_index][start_idx-left_margin+i] == ost::conop::PRO;
+  }
+
+  promod3::loop::DynamicSpatialOrganizer<HBondSpatialOrganizerItem,geom::Vec3>::WithinResult within_result;
+  std::pair<HBondSpatialOrganizerItem*,Real>* a;
+  Real e;
+  //let's start to fill the stuff from the env
+  for(int i = 0; i < total_size; ++i){
+    within_result = hbond_env_.FindWithin(ca_positions[i], 9.0); 
     a = within_result.first;
     for(uint j = 0; j < within_result.second; ++j){
-      if(a[j].first->number >= start_resnum && a[j].first->number <= end_resnum){ //not considering any loop residues
-        if(chain_index == a[j].first->chain_index){
-          continue;
+      if(a[j].first->idx < start_neglect[i] || a[j].first->idx > end_neglect[i]){ 
+
+        //i as acceptor
+        if(!a[j].first->is_proline && positions_start_idx + i < max_idx_chain && !(a[j].first->idx == min_idx_chain)){
+          e = DSSPHBondEnergy(a[j].first->h_pos, a[j].first->n_pos,
+                              c_positions[i], o_positions[i]);
+
+          if(e < -0.5){
+            //it is an hbond... let's see, whether it is the best for i as acceptor
+            if(e < acceptor_two_energies[i]){
+              if(e < acceptor_one_energies[i]){
+                acceptor_two_energies[i] = acceptor_one_energies[i];
+                acceptor_for_two[i] = acceptor_for_one[i];
+                acceptor_one_energies[i] = e;
+                acceptor_for_one[i] = a[j].first->idx;
+              }
+              else{
+                acceptor_two_energies[i] = e;
+                acceptor_for_two[i] = a[j].first->idx;
+              }
+            }             
+          }
+        }
+
+        //i as donor
+        if(!prolines[i] && positions_start_idx + i > min_idx_chain && a[j].first->idx < max_idx_chain){
+
+          e = DSSPHBondEnergy(h_positions[i],n_positions[i],
+                              a[j].first->c_pos,a[j].first->o_pos);
+
+          if(e < -0.5){
+            //it is an hbond... let's see, whether it is the best for i as donor
+            if(e < donor_two_energies[i]){
+              if(e < donor_one_energies[i]){
+                donor_two_energies[i] = donor_one_energies[i];
+                donor_for_two[i] = donor_for_one[i];
+                donor_one_energies[i] = e;
+                donor_for_one[i] = a[j].first->idx;
+              }
+              else{
+                donor_two_energies[i] = e;
+                donor_for_two[i] = a[j].first->idx;
+              }
+            }  
+          } 
+        }
+      }
+    } 
+  }
+
+  //let's get the internal hbonds right...
+  for(int i = 0; i < total_size-3; ++i){
+    for(int j = i+3; j < total_size; ++j){
+      if(geom::Length2(ca_positions[i]-ca_positions[j]) < 81.0){
+        //i as acceptor ; j as donor
+        if(!prolines[j]){
+          e = DSSPHBondEnergy(h_positions[j],n_positions[j],
+                              c_positions[i],o_positions[i]);
+
+          if(e < -0.5){
+            //it is an hbond... let's see, whether it is the best for i as acceptor
+            if(e < acceptor_two_energies[i]){
+              if(e < acceptor_one_energies[i]){
+                acceptor_two_energies[i] = acceptor_one_energies[i];
+                acceptor_for_two[i] = acceptor_for_one[i];
+                acceptor_one_energies[i] = e;
+                acceptor_for_one[i] = positions_start_idx + j;
+              }
+              else{
+                acceptor_two_energies[i] = e;
+                acceptor_for_two[i] = positions_start_idx + j;
+              }
+            }
+
+            //let's see, whether it is the best for j as donor
+            if(e < donor_two_energies[j]){
+              if(e < donor_one_energies[j]){
+                donor_two_energies[j] = donor_one_energies[j];
+                donor_for_two[j] = donor_for_one[j];
+                donor_one_energies[j] = e;
+                donor_for_one[j] = positions_start_idx + i;
+              }
+              else{
+                donor_two_energies[j] = e;
+                donor_for_two[j] = positions_start_idx + i;
+              }              
+            }             
+          }
+        }
+
+        //i as donor, j as acceptor
+        if(!prolines[i] && positions_start_idx + i > min_idx_chain && positions_start_idx + j < max_idx_chain){
+
+          e = DSSPHBondEnergy(h_positions[i],n_positions[i],
+                              c_positions[j],o_positions[j]);
+
+          if(e < -0.5){
+            //it is an hbond... let's see, whether it is the best for i as donor
+            if(e < donor_two_energies[i]){
+              if(e < donor_one_energies[i]){
+                donor_two_energies[i] = donor_one_energies[i];
+                donor_for_two[i] = donor_for_one[i];
+                donor_one_energies[i] = e;
+                donor_for_one[i] = positions_start_idx + j;
+              }
+              else{
+                donor_two_energies[i] = e;
+                donor_for_two[i] = positions_start_idx + j;
+              }
+            }
+
+            //let's see, whether it is the best for j as acceptor
+            if(e < acceptor_two_energies[j]){
+              if(e < acceptor_one_energies[j]){
+                acceptor_two_energies[j] = acceptor_one_energies[j];
+                acceptor_for_two[j] = acceptor_for_one[j];
+                acceptor_one_energies[j] = e;
+                acceptor_for_one[j] = positions_start_idx + i;
+              }
+              else{
+                acceptor_two_energies[j] = e;
+                acceptor_for_two[j] = positions_start_idx + i;
+              }              
+            }             
+          }
         }
       }
-      //case of being donor for current bb item
-      score = DSSPHBondEnergy(h_positions[i],bb_list[i].n_coord,
-                          a[j].first->c_pos,a[j].first->o_pos);
-      if(score < 0.0) hbond_score += score;
-      
-      //case of being acceptor for current bb item
-      score = DSSPHBondEnergy(a[j].first->h_pos, a[j].first->n_pos,
-                          bb_list[i].c_coord, bb_list[i].o_coord);
-      if(score < 0.0) hbond_score += score;
     }
   }
 
-  //we do not have the loop internal interactions yet...
-  for(uint i = 1; i < bb_list.size(); ++i){
-    for(uint j = 0; j < i; ++j){
-      //case of i being donor
-      score = DSSPHBondEnergy(h_positions[i],bb_list[i].n_coord,
-                          bb_list[j].c_coord, bb_list[j].o_coord);
-      if(score < 0.0) hbond_score += score;
-      
-      //case of i being acceptor
-      score = DSSPHBondEnergy(h_positions[j],bb_list[j].n_coord,
-                          bb_list[i].c_coord, bb_list[i].o_coord);
-      if(score < 0.0) hbond_score += score;
-      
-    }
+
+  String ss;
+  RawEstimateSS(ca_positions, positions_start_idx, donor_for_one, donor_for_two, 
+                acceptor_for_one, acceptor_for_two, ss);
+
+  int dssp_idx;
+  int psipred_idx;
+  int psipred_conf;
+  Real score = 0.0;
+  for(int i = 0; i < size; ++i){
+    dssp_idx = GetDSSPIdx(ss[left_margin+i]);
+    psipred_idx = psipred_pred_[chain_index][start_idx+i];
+    psipred_conf = psipred_conf_[chain_index][start_idx+i];
+    score += ss_agreement_scores_[dssp_idx][psipred_idx][psipred_conf];
   }
 
-  hbond_score /= bb_list.size();
-  return hbond_score;
+  score /= size;
+  return score;
 }
 
 bool BackboneLoopScorer::TransOmegaTorsions(const BackboneList& bb_list, 
                                             Real thresh,
                                             bool allow_prepro_cis) const{
 
-  if(bb_list.size() < 3){
+  int size = bb_list.size();
+
+  if(size < 3){
     throw promod3::Error("Size of Backbone list must be at least 3!");
   }
 
   Real angle;
-  for(uint i = 0; i < bb_list.size()-1; ++i){
+  for(int i = 0; i < size-1; ++i){
     angle = bb_list.GetOmegaTorsion(i);
     if(std::abs(angle) < M_PI-thresh){
       if(allow_prepro_cis && bb_list[i+1].aa == ost::conop::PRO){
@@ -1864,13 +2648,38 @@ void BackboneLoopScorer::AllocateCBeta(){
     throw promod3::Error("Tried to allocate memory for cbeta term, but the memory is already allocated!");
   }
   cbeta_energies_ = new Real**[ost::conop::XXX];
-  for (uint i = 0; i < ost::conop::XXX; ++i) {
+  for (uint i = 0; i < ost::conop::XXX; ++i){
     cbeta_energies_[i] = new Real*[ost::conop::XXX];
     for (uint j = 0; j < ost::conop::XXX; ++j){
       cbeta_energies_[i][j] = new Real[cbeta_bins_];
       memset(&cbeta_energies_[i][j][0],0,cbeta_bins_*sizeof(Real));
     }
   }
+  
+}
+
+void BackboneLoopScorer::AllocateReduced(){
+  if(reduced_energies_ != NULL){
+    throw promod3::Error("Tried to allocate memory for reduced term, but the memory is already allocated!");
+  }
+  reduced_energies_ = new Real*****[ost::conop::XXX];
+  for (uint i = 0; i < ost::conop::XXX; ++i){
+    reduced_energies_[i] = new Real****[ost::conop::XXX];
+    for (uint j = 0; j < ost::conop::XXX; ++j){
+      reduced_energies_[i][j] = new Real***[reduced_dist_bins_];
+      for (uint k = 0; k < reduced_dist_bins_; ++k){
+        reduced_energies_[i][j][k] = new Real**[reduced_angle_bins_];
+        for(uint l = 0; l < reduced_angle_bins_; ++l){
+          reduced_energies_[i][j][k][l] = new Real*[reduced_angle_bins_];
+          for(uint m = 0; m < reduced_angle_bins_; ++m){
+            reduced_energies_[i][j][k][l][m] = new Real[reduced_dihedral_bins_];
+            memset(&reduced_energies_[i][j][k][l][m][0],0,reduced_dihedral_bins_*sizeof(Real));
+          }
+        }
+      }
+    }
+  }
+  
 }
 
 void BackboneLoopScorer::AllocateCBPacking(){
@@ -1919,6 +2728,20 @@ void BackboneLoopScorer::AllocateHBond(){
   }
 }
 
+void BackboneLoopScorer::AllocateSSAgreement(){
+  if(ss_agreement_scores_ != NULL){
+    throw promod3::Error("Tried to allocate memory for ss agreement term, but the memory is already allocated!");
+  }
+  ss_agreement_scores_ = new Real**[8];
+  for (uint i = 0; i < 8; ++i) {
+    ss_agreement_scores_[i] = new Real*[3];
+    for (uint j = 0; j < 3; ++j){
+      ss_agreement_scores_[i][j] = new Real[10];
+      memset(&ss_agreement_scores_[i][j][0],0,10*sizeof(Real));
+    }
+  }
+}
+
 void BackboneLoopScorer::DeallocateCBeta(){
   if(cbeta_energies_ != NULL){
     for (int i = 0; i < ost::conop::XXX; ++i) {
@@ -1932,6 +2755,28 @@ void BackboneLoopScorer::DeallocateCBeta(){
   }
 }
 
+void BackboneLoopScorer::DeallocateReduced(){
+  if(reduced_energies_ != NULL){
+    for (int i = 0; i < ost::conop::XXX; ++i) {
+      for (int j = 0; j < ost::conop::XXX; ++j){
+        for (uint k = 0; k < reduced_dist_bins_; ++k){
+          for (uint l = 0; l < reduced_angle_bins_; ++l){
+            for (uint m = 0; m < reduced_angle_bins_; ++m){
+              delete [] reduced_energies_[i][j][k][l][m];
+            }
+            delete [] reduced_energies_[i][j][k][l];
+          }
+          delete [] reduced_energies_[i][j][k];
+        } 
+        delete [] reduced_energies_[i][j];
+      }
+      delete [] reduced_energies_[i];
+    }
+    delete [] reduced_energies_;
+    reduced_energies_ = NULL;
+  }
+}
+
 void BackboneLoopScorer::DeallocateTorsion(){
   if(torsion_energies_!=NULL){
     for (uint i = 0; i < num_torsion_groups_; ++i) {
@@ -1974,4 +2819,19 @@ void BackboneLoopScorer::DeallocateHBond(){
   }
 }
 
+void BackboneLoopScorer::DeallocateSSAgreement(){
+  if(ss_agreement_scores_ != NULL){
+    for (int i = 0; i < 8; ++i) {
+      for (int j = 0; j < 3; ++j){ 
+        delete [] ss_agreement_scores_[i][j];
+      }
+      delete [] ss_agreement_scores_[i];
+    }
+    delete [] ss_agreement_scores_;
+    ss_agreement_scores_ = NULL;
+  }
+}
+
+
+
 }}//ns
diff --git a/loop/src/backbone_loop_score.hh b/loop/src/backbone_loop_score.hh
index a6becc82f0f8ef2c78833aafcf36fe977bad7e93..d413b8e663b654be8364b448347920639e83f352 100644
--- a/loop/src/backbone_loop_score.hh
+++ b/loop/src/backbone_loop_score.hh
@@ -7,6 +7,8 @@
 #include <ost/mol/view_op.hh>
 #include <promod3/loop/backbone.hh>
 #include <promod3/loop/dynamic_spatial_organizer.hh>
+#include <promod3/loop/sec_struct.hh>
+#include <promod3/loop/psipred_prediction.hh>
 
 #include <boost/shared_ptr.hpp>
 
@@ -23,26 +25,34 @@ struct CBSpatialOrganizerItem{
   CBSpatialOrganizerItem() { }
 
   CBSpatialOrganizerItem(ost::conop::AminoAcid a, 
-                         geom::Vec3& p, uint n, 
-                         uint c_i): aa(a), pos(p), number(n), 
-                                             chain_index(c_i) { }
+                         geom::Vec3& p, uint i): aa(a), pos(p), idx(i) { }
   ost::conop::AminoAcid aa;
   geom::Vec3 pos;  
-  uint number;
-  uint chain_index;
+  int idx;
+};
+
+struct ReducedSpatialOrganizerItem{
+  ReducedSpatialOrganizerItem() { }
+
+  ReducedSpatialOrganizerItem(ost::conop::AminoAcid a, 
+                              geom::Vec3& p, geom::Vec3& ax,
+                              uint i): aa(a), pos(p), axis(ax), idx(i) { }
+  ost::conop::AminoAcid aa;
+  geom::Vec3 pos;
+  geom::Vec3 axis;  
+  int idx;
 };
 
 struct ClashSpatialOrganizerItem{
   ClashSpatialOrganizerItem() { }
 
   ClashSpatialOrganizerItem(Real r, const geom::Vec3& p,
-                            uint n, uint c_i): radius(r), pos(p),
-                                                     number(n), chain_index(c_i) { }
+                            uint i): radius(r), pos(p),
+                                     idx(i) { }
 
   Real radius;
   geom::Vec3 pos;
-  uint number;
-  uint chain_index;
+  int idx;
 };
 
 struct HBondSpatialOrganizerItem{
@@ -50,11 +60,10 @@ struct HBondSpatialOrganizerItem{
 
   HBondSpatialOrganizerItem(const geom::Vec3& p, const geom::Vec3& n,
                             const geom::Vec3& h, const geom::Vec3& c,
-                            const geom::Vec3& o, uint state, uint num, 
+                            const geom::Vec3& o, uint state, uint i, 
                             uint c_i): pos(p), n_pos(n),
                                        h_pos(h), c_pos(c),
-                                       o_pos(o), number(num),
-                                       chain_index(c_i) { }
+                                       o_pos(o), idx(i) { }
 
   geom::Vec3 pos; //CA position of residue
   geom::Vec3 n_pos; //donor N
@@ -62,21 +71,10 @@ struct HBondSpatialOrganizerItem{
   geom::Vec3 c_pos; //acceptor C
   geom::Vec3 o_pos; //acceptor O
   uint state;
-  uint number;
-  uint chain_index;
+  int idx;
+  bool is_proline;
 };
 
-struct HBondAcceptorSpatialOrganizerItem{
-  HBondAcceptorSpatialOrganizerItem() { }
-
-  HBondAcceptorSpatialOrganizerItem(const geom::Vec3& p, const geom::Vec3& c): pos(p),
-                                                                               c_pos(c) { }
-
-  geom::Vec3 pos; //acceptor oxygen
-  geom::Vec3 c_pos; //carbon
-};
-
-
 class BackboneLoopScorer{
 public:
 
@@ -90,6 +88,9 @@ public:
 
   void SetCBetaPotentialParameters(Real cbeta_cutoff, uint cbeta_bins, uint cbeta_seq_sep);
 
+  void SetReducedPotentialParameters(Real dist_cutoff, uint dist_bins, uint angle_bins, 
+                                     uint dihedral_bins, uint seq_sep);
+
   void SetTorsionPotentialParameters(const std::vector<String>& group_definitions, 
                                      uint torsion_bins);
 
@@ -102,8 +103,13 @@ public:
                                    uint hb_d_bins, uint hb_alpha_bins,
                                    uint hb_beta_bins, uint hb_gamma_bins);
 
+  void SetSSAgreementParameters();
+
   void SetCBetaEnergy(ost::conop::AminoAcid a, ost::conop::AminoAcid b, uint bin, Real e);
 
+  void SetReducedEnergy(ost::conop::AminoAcid a, ost::conop::AminoAcid b,
+                        uint dist_bin, uint alpha_bin, uint beta_bin, uint gamma_bin, Real e);
+
   void SetTorsionEnergy(uint group_id_idx, uint phi_bin, uint psi_bin, Real e);
 
   void SetCBPackingEnergy(ost::conop::AminoAcid aa, uint count, Real e);
@@ -111,32 +117,46 @@ public:
   void SetHBondEnergy(uint state, uint d_bin, uint alpha_bin, 
                       uint beta_bin, uint gamma_bin, Real e);
 
+  void SetSSAgreementScore(char psipred_state, int psipred_confidence,
+                           char dssp_state, Real score);
+
   void Initialize(const String& seqres);
 
   void Initialize(const std::vector<String>& seqres);
 
+  void SetPsipredPrediction(PsipredPredictionPtr pp);
+
+  void SetPsipredPrediction(std::vector<PsipredPredictionPtr>& pp);
+
   void SetEnvironment(const ost::mol::EntityHandle& env);
 
   void SetEnvironment(const promod3::loop::BackboneList& bb_list, uint start_resnum,
                       uint chain_index = 0);
 
+  void ClearEnvironment(uint start_resnum, uint num_residues, 
+                        uint chain_index = 0);
+
   Real CalculateClashScore(const BackboneList& bb_list, uint start_resnum, 
-                           uint chain_index=0) const;
+                           uint chain_index = 0) const;
 
   Real CalculateCBetaScore(const BackboneList& bb_list, uint start_resnum, 
-                           uint chain_index=0) const;
+                           uint chain_index = 0) const;
+
+  Real CalculateReducedScore(const BackboneList& bb_list, uint start_resnum,
+                             uint chain_index = 0) const;
 
   Real CalculateTorsionScore(const BackboneList& bb_list, uint start_resnum, 
-                             uint chain_index=0) const;
+                             uint chain_index = 0) const;
 
   Real CalculateCBPackingScore(const BackboneList& bb_list, uint start_resnum, 
-                               uint chain_index=0) const;
+                               uint chain_index = 0) const;
 
-  Real CalculateHBondScore(const BackboneList& bb_list, uint start_resnum,
+  Real CalculateHBondScore(const BackboneList& 
+    bb_list, uint start_resnum,
                            uint chain_index = 0) const;
 
-  Real CalculateDSSPHBondScore(const BackboneList& bb_list, uint start_resnum, 
-                               uint chain_index=0) const;
+  Real CalculateSSAgreementScore(const BackboneList& bb_list, uint start_resnum,
+                                 uint chain_index = 0) const;
 
   bool TransOmegaTorsions(const BackboneList& bb_list, 
                           Real thresh = 20.0/180*M_PI, 
@@ -150,32 +170,46 @@ private:
 
   void AllocateCBeta();
 
+  void AllocateReduced();
+
   void AllocateCBPacking();
 
   void AllocateTorsion();
 
   void AllocateHBond();
 
+  void AllocateSSAgreement();
+
   void DeallocateCBeta();
 
+  void DeallocateReduced();
+
   void DeallocateCBPacking();
 
   void DeallocateTorsion();
 
   void DeallocateHBond();
 
+  void DeallocateSSAgreement();
+
   //environment dependent data
   bool initialized_;
   std::vector<std::vector<ost::conop::AminoAcid> > seqres_;
+  std::vector<std::vector<int> > residue_indices_;
   bool** env_set_;
   CBSpatialOrganizerItem** cb_env_data_;
+  ReducedSpatialOrganizerItem** reduced_env_data_;
   ClashSpatialOrganizerItem*** clash_env_data_;
   HBondSpatialOrganizerItem** hbond_env_data_;
   std::vector<std::vector<int> > torsion_group_indices_;
+  bool psipred_set_;
+  std::vector<std::vector<int> > psipred_pred_;
+  std::vector<std::vector<int> > psipred_conf_;
  
   //the dynamic spatial organizer data objects, that directly depend on 
-  //cb_env_data_, clash_env_data_ and hbond_env_data_
+  //cb_env_data_, reduced_env_data_, clash_env_data_ and hbond_env_data_
   promod3::loop::DynamicSpatialOrganizer<CBSpatialOrganizerItem,geom::Vec3> cb_env_;
+  promod3::loop::DynamicSpatialOrganizer<ReducedSpatialOrganizerItem,geom::Vec3> reduced_env_;
   promod3::loop::DynamicSpatialOrganizer<ClashSpatialOrganizerItem,geom::Vec3> clash_env_;
   promod3::loop::DynamicSpatialOrganizer<HBondSpatialOrganizerItem,geom::Vec3> hbond_env_;
 
@@ -186,6 +220,16 @@ private:
   Real squared_cbeta_cutoff_;
   Real cbeta_bin_size_;
 
+  uint reduced_seq_sep_;
+  uint reduced_dist_bins_;
+  uint reduced_angle_bins_;
+  uint reduced_dihedral_bins_;
+  Real reduced_distance_cutoff_;
+  Real reduced_squared_distance_cutoff_;
+  Real reduced_dist_bin_size_;
+  Real reduced_angle_bin_size_;
+  Real reduced_dihedral_bin_size_;
+
   Real cb_packing_cutoff_;
   Real squared_cb_packing_cutoff_;
   uint cb_packing_max_count_;
@@ -212,10 +256,13 @@ private:
   uint hb_beta_bins_;
   uint hb_gamma_bins_;
 
+  //the scores
   Real*** cbeta_energies_;
+  Real****** reduced_energies_;
   Real*** torsion_energies_;
   Real** cb_packing_energies_;
   Real***** hbond_energies_;
+  Real*** ss_agreement_scores_;
 };
 
 }}//ns
diff --git a/loop/src/cluster.cc b/loop/src/cluster.cc
new file mode 100644
index 0000000000000000000000000000000000000000..66997a6b93b47dc49c303a410a0be3810aae7f58
--- /dev/null
+++ b/loop/src/cluster.cc
@@ -0,0 +1,83 @@
+#include <promod3/loop/cluster.hh>
+
+namespace promod3{ namespace loop{
+
+void Cluster::Merge(const Cluster& other){
+  for(std::vector<int>::const_iterator i = other.members.begin(); 
+      i != other.members.end(); ++i){
+    members.push_back(*i);
+  }
+}
+
+float Cluster::PairwiseDistanceAVG(const Cluster& other, float** dist_matrix){
+  float sum  = 0.0;
+  for(std::vector<int>::const_iterator i = members.begin();
+      i != members.end(); ++i){
+    for(std::vector<int>::const_iterator j = other.members.begin();
+        j != other.members.end(); ++j){
+      sum += dist_matrix[*i][*j];
+    }
+  }
+  return sum / (members.size() * other.members.size());
+}
+
+float Cluster::PairwiseDistanceMAX(const Cluster& other, float** dist_matrix){
+  float max_dist = 0.0;
+  float current_dist;
+  for(std::vector<int>::const_iterator i = members.begin();
+      i != members.end(); ++i){
+    for(std::vector<int>::const_iterator j = other.members.begin();
+        j != other.members.end(); ++j){
+      current_dist = dist_matrix[*i][*j];
+      if(current_dist > max_dist) max_dist = current_dist;
+    }
+  }
+  return max_dist;
+}
+
+void DoClustering(float** dist_matrix, int num, float max_dist, 
+                  std::vector<std::vector<int> >& output){
+
+  //initialize every point as single cluster
+  std::vector<Cluster> clusters(num);
+  for(int i = 0; i < num; ++i){
+    clusters[i].members.push_back(i);
+  }
+
+  //always search for the closest distances and merge the according clusters
+  bool something_happened = true;
+  int num_clusters = num;
+  std::pair<int,int> pair_to_merge;
+  float min_distance;
+  float distance;
+
+  while(something_happened){
+    something_happened = false;
+    min_distance = std::numeric_limits<float>::max();
+
+    for(int i = 0; i < num_clusters; ++i){
+      for(int j = i + 1; j < num_clusters; ++j){
+        distance = clusters[i].PairwiseDistanceMAX(clusters[j], dist_matrix);
+        if(distance < min_distance){
+          pair_to_merge = std::make_pair(i,j);
+          min_distance = distance;
+        }
+      }
+    }
+
+    if(min_distance < max_dist){
+      clusters[pair_to_merge.first].Merge(clusters[pair_to_merge.second]);
+      clusters.erase(clusters.begin() + pair_to_merge.second);
+      something_happened = true;
+      --num_clusters;
+    }
+  }
+
+  //fill the output
+  output.clear();
+  for(unsigned int i = 0; i < clusters.size(); ++i){
+    output.push_back(clusters[i].members);
+  }
+}
+
+}} //ns
diff --git a/loop/src/cluster.hh b/loop/src/cluster.hh
new file mode 100644
index 0000000000000000000000000000000000000000..ae46de44f3a71aab5b6d9edb4d10c72764005eeb
--- /dev/null
+++ b/loop/src/cluster.hh
@@ -0,0 +1,29 @@
+#ifndef PROMOD_LOOP_CLUSTER_HH
+#define PROMOD_LOOP_CLUSTER_HH
+
+#include <vector>
+#include <limits>
+
+namespace promod3 { namespace loop {
+  
+struct Cluster{
+
+  Cluster() { }
+
+  void Merge(const Cluster& other);
+
+  float PairwiseDistanceAVG(const Cluster& other, float** dist_matrix);
+
+  float PairwiseDistanceMAX(const Cluster& other, float** dist_matrix);
+
+  std::vector<int> members;
+
+};
+
+
+void DoClustering(float** dist_matrix, int num, float max_dist, 
+                  std::vector<std::vector<int> >& output);
+
+}} //ns
+
+#endif
diff --git a/loop/src/dynamic_spatial_organizer.hh b/loop/src/dynamic_spatial_organizer.hh
index ff02680610ca13ae5223e0daae139fef1a302f51..3b44311aec584b357fe621f4276b84bf3fabbb2f 100644
--- a/loop/src/dynamic_spatial_organizer.hh
+++ b/loop/src/dynamic_spatial_organizer.hh
@@ -94,9 +94,9 @@ public:
     Index indx=gen_index(pos);
     typename ItemMap::iterator i = map_.find(indx);
     if(i != map_.end()){
-      typename EntryMap::iterator j = i->find(reinterpret_cast<uintptr_t>(item));
-      if(j != i->end()){
-        i->erase(j);
+      typename EntryMap::iterator j = i->second.find(reinterpret_cast<uintptr_t>(item));
+      if(j != i->second.end()){
+        i->second.erase(j);
       }
     }
   }
diff --git a/loop/src/flame.cc b/loop/src/flame.cc
deleted file mode 100644
index 181ffb146fc2306a480db3423243ab440b73aecb..0000000000000000000000000000000000000000
--- a/loop/src/flame.cc
+++ /dev/null
@@ -1,537 +0,0 @@
-/*===================================================================
-  The standard implementation of FLAME data clustering algorithm.
-
-  FLAME (Fuzzy clustering by Local Approximation of MEmberships)
-  was first described in:
-  "FLAME, a novel fuzzy clustering method for the analysis of DNA
-  microarray data", BMC Bioinformatics, 2007, 8:3.
-  Available from: http://www.biomedcentral.com/1471-2105/8/3
-  
-  Copyright(C) 2007, Fu Limin (phoolimin@gmail.com).
-  All rights reserved.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. Redistributions of source code must retain the above copyright
-     notice, this list of conditions and the following disclaimer.
-  2. The origin of this software must not be misrepresented; you must 
-     not claim that you wrote the original software. If you use this 
-     software in a product, an acknowledgment in the product 
-     documentation would be appreciated but is not required.
-  3. Altered source versions must be plainly marked as such, and must
-     not be misrepresented as being the original software.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-===================================================================*/
-
-#include"stdio.h"
-#include"stdlib.h"
-#include"string.h"
-#include"math.h"
-
-#include"flame.hh"
-
-namespace promod3{ namespace loop{ namespace flame{
-
-/* Quick Sort.
- * Adam Drozdek: Data Structures and Algorithms in C++, 2nd Edition.
- */
-void PartialQuickSort( IndexFloat *data, int first, int last, int part )
-{
-	int lower=first+1, upper=last;
-	float pivot;
-	IndexFloat val;
-	if( first >= last ) return;
-	val = data[first];
-	data[first] = data[ (first+last)/2 ];
-	data[ (first+last)/2 ] = val;
-	pivot = data[ first ].value;
-
-	while( lower <= upper ){
-		while( lower <= last && data[lower].value < pivot ) lower ++;
-		while( pivot < data[upper].value ) upper --;
-		if( lower < upper ){
-			val = data[lower];
-			data[lower] = data[upper];
-			data[upper] = val;
-			upper --;
-		}
-		lower ++;
-	}
-	val = data[first];
-	data[first] = data[upper];
-	data[upper] = val;
-	if( first < upper-1 ) PartialQuickSort( data, first, upper-1, part );
-	if( upper >= part ) return;
-	if( upper+1 < last ) PartialQuickSort( data, upper+1, last, part );
-}
-
-const DistFunction basicDistFunctions[] =
-{
-	Flame_Euclidean ,
-	Flame_CosineDist ,
-	Flame_PearsonDist ,
-	Flame_UCPearsonDist ,
-	Flame_SQPearsonDist ,
-	Flame_DotProductDist ,
-	Flame_CovarianceDist ,
-	Flame_Manhattan 
-};
-
-float Flame_Euclidean( float *x, float *y, int m )
-{
-	float d = 0;
-	int i;
-	for(i=0; i<m; i++ ) d += ( x[i] - y[i] ) * ( x[i] - y[i] );
-	return sqrt( d );
-}
-float Flame_Cosine( float *x, float *y, int m )
-{
-	float r =0, x2 =0, y2 =0;
-	int i;
-	for(i=0; i<m; i++ ){
-		r += x[i] * y[i];
-		x2 += x[i] * x[i];
-		y2 += y[i] * y[i];
-	}
-	return r / ( sqrt( x2 * y2 ) + EPSILON );
-}
-float Flame_Pearson( float *x, float *y, int m )
-{
-	int i;
-	float r, x2, y2, xavg, yavg;
-	if( m ==0 ) return 0;
-	xavg = yavg = 0;
-	r = x2 = y2 = 0;
-	for( i=0; i<m; i++ ){
-		xavg += x[i];
-		yavg += y[i];
-	}
-	xavg = xavg/m;
-	yavg = yavg/m;
-	for( i=0; i<m; i++ ){
-		r  += ( x[i] - xavg ) * ( y[i] - yavg );
-		x2 += ( x[i] - xavg ) * ( x[i] - xavg );
-		y2 += ( y[i] - yavg ) * ( y[i] - yavg );
-	}
-	return r / ( sqrt( x2 * y2 ) + EPSILON );
-}
-float Flame_UCPearson( float *x, float *y, int m )
-{
-	int i;
-	float r, x2, y2, xavg, yavg;
-	if( m ==0 ) return 0;
-	xavg = yavg = 0;
-	r = x2 = y2 = 0;
-	for( i=0; i<m; i++ ){
-		xavg += x[i];
-		yavg += y[i];
-	}
-	xavg = xavg/m;
-	yavg = yavg/m;
-	for( i=0; i<m; i++ ){
-		r  += x[i] * y[i];
-		x2 += ( x[i] - xavg ) * ( x[i] - xavg );
-		y2 += ( y[i] - yavg ) * ( y[i] - yavg );
-	}
-	return r / ( sqrt( x2 * y2 ) + EPSILON );
-}
-float Flame_SQPearson( float *x, float *y, int m )
-{
-	int i;
-	float r, x2, y2, xavg, yavg;
-	if( m ==0 ) return 0;
-	xavg = yavg = 0;
-	r = x2 = y2 = 0;
-	for( i=0; i<m; i++ ){
-		xavg += x[i];
-		yavg += y[i];
-	}
-	xavg = xavg/m;
-	yavg = yavg/m;
-	for( i=0; i<m; i++ ){
-		r  += ( x[i] - xavg ) * ( y[i] - yavg );
-		x2 += ( x[i] - xavg ) * ( x[i] - xavg );
-		y2 += ( y[i] - yavg ) * ( y[i] - yavg );
-	}
-	return r*r / ( x2 * y2 + EPSILON );
-}
-float Flame_DotProduct( float *x, float *y, int m )
-{
-	int i;
-	float r = 0;
-	for(i=0; i<m; i++ ) r += x[i] * y[i];
-	if( m == 0 ) return 0;
-	return r / m;
-}
-float Flame_Covariance( float *x, float *y, int m )
-{
-	int i;
-	float r, x2, y2, xavg, yavg;
-	if( m ==0 ) return 0;
-	xavg = yavg = 0;
-	r = x2 = y2 = 0;
-	for( i=0; i<m; i++ ){
-		xavg += x[i];
-		yavg += y[i];
-	}
-	xavg = xavg/m;
-	yavg = yavg/m;
-	for( i=0; i<m; i++ ) r += ( x[i] - xavg ) * ( y[i] - yavg );
-	if( m <= 1 ) return 0;
-	return r / (m-1);
-}
-float Flame_Manhattan( float *x, float *y, int m )
-{
-	float d = 0;
-	int i;
-	for(i=0; i<m; i++ ) d += fabs( x[i] - y[i] );
-	return d;
-}
-float Flame_CosineDist( float *x, float *y, int m )
-{
-	return 1-Flame_Cosine( x, y, m );
-}
-float Flame_PearsonDist( float *x, float *y, int m )
-{
-	return 1-Flame_Pearson( x, y, m );
-}
-float Flame_UCPearsonDist( float *x, float *y, int m )
-{
-	return 1-Flame_UCPearson( x, y, m );
-}
-float Flame_SQPearsonDist( float *x, float *y, int m )
-{
-	return 1-Flame_SQPearson( x, y, m );
-}
-float Flame_DotProductDist( float *x, float *y, int m )
-{
-	return 1-Flame_DotProduct( x, y, m );
-}
-float Flame_CovarianceDist( float *x, float *y, int m )
-{
-	return 1-Flame_Covariance( x, y, m );
-}
-
-Flame* Flame_New()
-{
-	Flame *self = (Flame*) malloc( sizeof(Flame) );
-	memset( self, 0, sizeof(Flame) );
-	return self;
-}
-void Flame_Clear( Flame *self )
-{
-	int i;
-	for(i=0; i<self->N; i++){
-		free( self->graph[i] );
-		free( self->dists[i] );
-		free( self->weights[i] );
-		free( self->fuzzyships[i] );
-	}
-	if( self->clusters ){
-		for(i=0; i<=self->cso_count; i++){
-			if( self->clusters[i].array ) free( self->clusters[i].array );
-		}
-		free( self->clusters );
-		self->clusters = NULL;
-	}
-	if( self->graph ) free( self->graph );
-	if( self->dists ) free( self->dists );
-	if( self->nncounts ) free( self->nncounts );
-	if( self->weights ) free( self->weights );
-	if( self->fuzzyships ) free( self->fuzzyships );
-	if( self->obtypes ) free( self->obtypes );
-	self->graph = NULL;
-	self->dists = NULL;
-	self->nncounts = NULL;
-	self->weights = NULL;
-	self->obtypes = NULL;
-	self->fuzzyships = NULL;
-	self->N = self->K = self->KMAX = self->cso_count = 0;
-}
-
-/* If m==0, data is distance matrix. */
-void Flame_SetMatrix( Flame *self, float *data[], int n, int m )
-{
-	int i, j, k;
-	int MAX = sqrt( n ) + 10;
-	IndexFloat *vals = (IndexFloat*) calloc( n, sizeof(IndexFloat) );
-	if( MAX >= n ) MAX = n - 1;
-		
-	Flame_Clear( self );
-	self->N = n;
-	self->KMAX = MAX;
-	
-	self->graph = (int**) calloc( n, sizeof(int*) );
-	self->dists = (float**) calloc( n, sizeof(float*) );
-	self->weights = (float**) calloc( n, sizeof(float*) );
-	self->nncounts = (int*) calloc( n, sizeof(int) );
-	self->obtypes = (char*) calloc( n, sizeof(char) );
-	self->fuzzyships = (float**) calloc( n, sizeof(float*) );
-
-	for(i=0; i<n; i++){
-		self->graph[i] = (int*) calloc( MAX, sizeof(int) );
-		self->dists[i] = (float*) calloc( MAX, sizeof(float) );
-		self->weights[i] = (float*) calloc( MAX, sizeof(float) );
-		if( m ==0 ){
-			/* data is distance matrix. */
-			for(j=0; j<n; j++){
-				vals[j].index = j;
-				vals[j].value = data[i][j];
-			}
-		}else{
-			/* data is raw data matrix. */
-			for(j=0; j<n; j++){
-				vals[j].index = j;
-				vals[j].value = self->distfunc( data[i], data[j], m );
-			}
-		}
-		PartialQuickSort( vals, 0, n-1, MAX+1 );
-		/* Store MAX number of nearest neighbors. */
-		for(j=0; j<MAX; j++){
-			self->graph[i][j] = vals[j+1].index;
-			self->dists[i][j] = vals[j+1].value;
-		}
-	}
-	free( vals );
-}
-void Flame_SetDataMatrix( Flame *self, float *data[], int n, int m, int dt )
-{
-	self->simtype = dt;
-	if( dt >0 && dt < DST_NULL ) self->distfunc = basicDistFunctions[ dt-1 ];
-	if( self->distfunc == NULL ) self->distfunc = basicDistFunctions[0];
-	Flame_SetMatrix( self, data, n, m );
-}
-void Flame_SetDistMatrix( Flame *self, float *data[], int n )
-{
-	Flame_SetMatrix( self, data, n, DST_USER );
-}
-void Flame_DefineSupports( Flame *self, int knn, float thd )
-{
-	int i, j, k;
-	int n = self->N;
-	int kmax = self->KMAX;
-	float **dists = self->dists;
-	float *density = (float*) calloc( n, sizeof(float) );
-	float d, sum, sum2, fmin, fmax = 0.0;
-	
-	if( knn > kmax ) knn = kmax;
-	self->K = knn;
-	for(i=0; i<n; i++){
-		/* To include all the neighbors that have distances equal to the
-		 * distance of the most distant one of the K-Nearest Neighbors */
-		k = knn;
-		d = dists[i][knn-1];
-		for(j=knn; j<kmax; j++) if( dists[i][j] == d ) k ++; else break;
-		self->nncounts[i] = k;
-
-		/* The definition of weights in this implementation is 
-		 * different from the previous implementations where distances 
-		 * or similarities often have to be transformed in some way.
-		 *
-		 * But in this definition, the weights are only dependent on 
-		 * the ranking of distances of the neighbors, so it is more 
-		 * robust against distance transformations. */
-		sum = 0.5*k*(k+1.0);
-		for(j=0; j<k; j++) self->weights[i][j] = (k-j) / sum;
-		
-		sum = 0.0;
-		for(j=0; j<k; j++) sum += dists[i][j];
-		density[i] = 1.0 / (sum + EPSILON);
-	}
-	sum = 0.0;
-	sum2 = 0.0;
-	for(i=0; i<n; i++){
-		sum += density[i];
-		sum2 += density[i] * density[i];
-	}
-	sum = sum / n;
-	/* Density threshold for possible outliers. */
-	thd = sum + thd * sqrt( sum2 / n - sum * sum );
-
-	memset( self->obtypes, 0, n*sizeof(char) );
-	self->cso_count = 0;
-	for(i=0; i<n; i++){
-		k = self->nncounts[i];
-		fmax = 0.0;
-		fmin = density[i] / density[ self->graph[i][0] ];
-		for(j=1; j<k; j++){
-			d = density[i] / density[ self->graph[i][j] ];
-			if( d > fmax ) fmax = d;
-			if( d < fmin ) fmin = d;
-			/* To avoid defining neighboring objects or objects close 
-			 * to an outlier as CSOs.  */
-			if( self->obtypes[ self->graph[i][j] ] ) fmin = 0.0;
-		}
-		if( fmin >= 1.0 ){
-			self->cso_count ++;
-			self->obtypes[i] = OBT_SUPPORT;
-		}else if( fmax <= 1.0 && density[i] < thd ){
-			self->obtypes[i] = OBT_OUTLIER;
-		}
-	}
-	free( density );
-}
-void Flame_LocalApproximation( Flame *self, int steps, float epsilon )
-{
-	int i, j, k, t, n = self->N, m = self->cso_count;
-	float **fuzzyships = self->fuzzyships;
-	float **fuzzyships2 = (float**)calloc( n, sizeof(float*) );
-	char *obtypes = self->obtypes;
-	char even = 0;
-	double dev;
-
-	k = 0;
-	for(i=0; i<n; i++){
-		fuzzyships[i] = (float*) realloc( fuzzyships[i], (m+1)*sizeof(float) );
-		fuzzyships2[i] = (float*) calloc( m+1, sizeof(float) );
-		memset( fuzzyships[i], 0, (m+1)*sizeof(float) );
-		if( obtypes[i] == OBT_SUPPORT ){
-			/* Full membership to the cluster represented by itself. */
-			fuzzyships[i][k] = 1.0;
-			fuzzyships2[i][k] = 1.0;
-			k ++;
-		}else if( obtypes[i] == OBT_OUTLIER ){
-			/* Full membership to the outlier group. */
-			fuzzyships[i][m] = 1.0;
-			fuzzyships2[i][m] = 1.0;
-		}else{
-			/* Equal memberships to all clusters and the outlier group.
-			 * Random initialization does not change the results. */
-			for(j=0; j<=m; j++)
-				fuzzyships[i][j] = fuzzyships2[i][j] = 1.0/(m+1);
-		}
-	}
-	for(t=0; t<steps; t++){
-		dev = 0;
-		for(i=0; i<n; i++){
-			int knn = self->nncounts[i];
-			int *ids = self->graph[i];
-			float *wt = self->weights[i];
-			float *fuzzy = fuzzyships[i];
-			float **fuzzy2 = fuzzyships2;
-			double sum = 0.0;
-			if( self->obtypes[i] != OBT_NORMAL ) continue;
-			if( even ){
-				fuzzy = fuzzyships2[i];
-				fuzzy2 = fuzzyships;
-			}
-			/* Update membership of an object by a linear combination of 
-			 * the memberships of its nearest neighbors. */
-			for(j=0; j<=m; j++){
-				fuzzy[j] = 0.0;
-				for(k=0; k<knn; k++) fuzzy[j] += wt[k] * fuzzy2[ ids[k] ][j];
-				dev += (fuzzy[j] - fuzzy2[i][j]) * (fuzzy[j] - fuzzy2[i][j]);
-				sum += fuzzy[j];
-			}
-			for(j=0; j<=m; j++) fuzzy[j] = fuzzy[j] / sum;
-		}
-		even = ! even;
-		if( dev < epsilon ) break;
-	}
-	/* update the membership of all objects to remove clusters 
-	 * that contains only the CSO. */
-	for(i=0; i<n; i++){
-		int knn = self->nncounts[i];
-		int *ids = self->graph[i];
-		float *wt = self->weights[i];
-		float *fuzzy = fuzzyships[i];
-		float **fuzzy2 = fuzzyships2;
-		for(j=0; j<=m; j++){
-			fuzzy[j] = 0.0;
-			for(k=0; k<knn; k++) fuzzy[j] += wt[k] * fuzzy2[ ids[k] ][j];
-			dev += (fuzzy[j] - fuzzy2[i][j]) * (fuzzy[j] - fuzzy2[i][j]);
-		}
-	}
-	for(i=0; i<n; i++) free( fuzzyships2[i] );
-	free( fuzzyships2 );
-}
-
-void IntArray_Push( IntArray *self, int value )
-{
-	if( self->size >= self->bufsize ){
-		self->bufsize += self->bufsize /10 + 10;
-		self->array = (int*)realloc( self->array, self->bufsize*sizeof(int));
-	}
-	self->array[ self->size ] = value;
-	self->size ++;
-}
-void Flame_MakeClusters( Flame *self, float thd )
-{
-	int i, j, imax;
-	int N = self->N;
-	int C = self->cso_count+1;
-	float fmax;
-	float **fuzzyships = self->fuzzyships;
-	IntArray *clust;
-	IndexFloat *vals = (IndexFloat*) calloc( N, sizeof(IndexFloat) );
-	
-	/* Sort objects based on the "entropy" of fuzzy memberships. */
-	for(i=0; i<N; i++){
-		vals[i].index = i;
-		vals[i].value = 0.0;
-		for(j=0; j<C; j++){
-			float fs = fuzzyships[i][j];
-			if( fs > EPSILON ) vals[i].value -= fs * log( fs );
-		}
-	}
-	PartialQuickSort( vals, 0, N-1, N );
-
-	if( self->clusters ){
-		for(i=0; i<C; i++)
-			if( self->clusters[i].array ) free( self->clusters[i].array );
-		free( self->clusters );
-	}
-	self->clusters = (IntArray*) calloc( C, sizeof(IntArray) );
-	if( thd <0 || thd > 1.0 ){
-		/* Assign each object to the cluster 
-		 * in which it has the highest membership. */
-		for(i=0; i<N; i++){
-			int id = vals[i].index;
-			fmax = 0;
-			imax = -1;
-			for(j=0; j<C; j++){
-				if( fuzzyships[id][j] > fmax ){
-					imax = j;
-					fmax = fuzzyships[id][j];
-				}
-			}
-			IntArray_Push( self->clusters + imax, id );
-		}
-	}else{
-		/* Assign each object to all the clusters
-		 * in which it has membership higher than thd,
-		 * otherwise, assign it to the outlier group.*/
-		for(i=0; i<N; i++){
-			int id = vals[i].index;
-			imax = -1;
-			for(j=0; j<C; j++){
-				if( fuzzyships[id][j] > thd || ( j == C-1 && imax <0 ) ){
-					imax = j;
-					clust = self->clusters + j;
-					IntArray_Push( self->clusters + j, id );
-				}
-			}
-		}
-	}
-	/* removing empty clusters */
-	C = 0;
-	for(i=0; i<self->cso_count; i++){
-		if( self->clusters[i].size >0 ){
-			self->clusters[C] = self->clusters[i];
-			C ++;
-		}
-	}
-	/* keep the outlier group, even if its empty */
-	self->clusters[C] = self->clusters[self->cso_count];
-	C ++;
-	for(i=C; i<self->cso_count+1; i++) memset( self->clusters+i, 0, sizeof(IntArray) );
-	self->count = C;
-	free( vals );
-}
-
-}}}//ns
diff --git a/loop/src/flame.hh b/loop/src/flame.hh
deleted file mode 100644
index f68b74c2e6e99b4a70d026c4f30f23ddc654f15b..0000000000000000000000000000000000000000
--- a/loop/src/flame.hh
+++ /dev/null
@@ -1,190 +0,0 @@
-/*===================================================================
-  The standard implementation of FLAME data clustering algorithm.
-
-  FLAME (Fuzzy clustering by Local Approximation of MEmberships)
-  was first described in:
-  "FLAME, a novel fuzzy clustering method for the analysis of DNA
-  microarray data", BMC Bioinformatics, 2007, 8:3.
-  Available from: http://www.biomedcentral.com/1471-2105/8/3
-  
-  Copyright(C) 2007, Fu Limin (phoolimin@gmail.com).
-  All rights reserved.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. Redistributions of source code must retain the above copyright
-     notice, this list of conditions and the following disclaimer.
-  2. The origin of this software must not be misrepresented; you must 
-     not claim that you wrote the original software. If you use this 
-     software in a product, an acknowledgment in the product 
-     documentation would be appreciated but is not required.
-  3. Altered source versions must be plainly marked as such, and must
-     not be misrepresented as being the original software.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-===================================================================*/
-
-#ifndef __FLAME_H
-#define __FLAME_H
-
-/* Since data for clustering are usually noisy,
- * so it is not very necessary to have EPSILON extremely small.
- */
-
-namespace promod3{ namespace loop{ namespace flame{
-
-#define EPSILON 1E-9
-
-typedef struct IndexFloat IndexFloat;
-typedef struct Flame Flame;
-typedef struct IntArray IntArray;
-
-struct IntArray
-{
-	int *array;
-	int  size;
-	int  bufsize;
-};
-
-/* For sorting and storing the orignal indices. */
-struct IndexFloat
-{
-	int   index;
-	float value;
-};
-
-/* Sort until the smallest "part" items are sorted. */
-void PartialQuickSort( IndexFloat *data, int first, int last, int part );
-
-float Flame_Euclidean( float *x, float *y, int m );
-float Flame_Cosine( float *x, float *y, int m );
-float Flame_Pearson( float *x, float *y, int m );
-float Flame_UCPearson( float *x, float *y, int m );
-float Flame_SQPearson( float *x, float *y, int m );
-float Flame_DotProduct( float *x, float *y, int m );
-float Flame_Covariance( float *x, float *y, int m );
-float Flame_Manhattan( float *x, float *y, int m );
-float Flame_CosineDist( float *x, float *y, int m );
-float Flame_PearsonDist( float *x, float *y, int m );
-float Flame_UCPearsonDist( float *x, float *y, int m );
-float Flame_SQPearsonDist( float *x, float *y, int m );
-float Flame_DotProductDist( float *x, float *y, int m );
-float Flame_CovarianceDist( float *x, float *y, int m );
-
-enum DistSimTypes
-{
-	DST_USER = 0,
-	DST_EUCLID ,
-	DST_COSINE ,
-	DST_PEARSON ,
-	DST_UC_PEARSON ,
-	DST_SQ_PEARSON ,
-	DST_DOT_PROD ,
-	DST_COVARIANCE ,
-	DST_MANHATTAN ,
-	DST_NULL
-};
-typedef float (*DistFunction)( float *x, float *y, int m );
-
-extern const DistFunction basicDistFunctions[];
-
-enum FlameObjectTypes
-{
-	OBT_NORMAL ,
-	OBT_SUPPORT ,
-	OBT_OUTLIER
-};
-
-struct Flame
-{
-	int simtype;
-
-	/* Number of objects */
-	int N;
-
-	/* Number of K-Nearest Neighbors */
-	int K;
-
-	/* Upper bound for K defined as: sqrt(N)+10 */
-	int KMAX;
-
-	/* Stores the KMAX nearest neighbors instead of K nearest neighbors
-	 * for each objects, so that when K is changed, weights and CSOs can be
-	 * re-computed without referring to the original data.
-	 */
-	int   **graph;
-	/* Distances to the KMAX nearest neighbors. */
-	float **dists;
-
-	/* Nearest neighbor count.
-	 * it can be different from K if an object has nearest neighbors with
-	 * equal distance. */
-	int    *nncounts;
-	float **weights;
-
-	/* Number of identified Cluster Supporting Objects */
-	int cso_count;
-	char *obtypes;
-
-	float **fuzzyships;
-	
-	/* Number of clusters including the outlier group */
-	int count;
-	/* The last one is the outlier group. */
-	IntArray *clusters;
-	
-	DistFunction distfunc;
-};
-
-/* Create a structure for FLAME clustering, and set all fields to zero. */
-Flame* Flame_New();
-
-/* Free allocated memory, and set all fields to zero. */
-void Flame_Clear( Flame *self );
-
-/* Set a NxM data matrix, and compute distances of type T.
- * 
- * If T==DST_USER or T>=DST_NULL, and Flame::distfunc member is set,
- * then Flame::distfunc is used to compute the distances;
- * Otherwise, Flame_Euclidean() is used. */
-void Flame_SetDataMatrix( Flame *self, float *data[], int N, int M, int T );
-
-/* Set a pre-computed NxN distance matrix. */
-void Flame_SetDistMatrix( Flame *self, float *data[], int N );
-
-/* Define knn-nearest neighbors for each object 
- * and the Cluster Supporting Objects (CSO). 
- * 
- * The actual number of nearest neighbors could be large than knn,
- * if an object has neighbors of the same distances.
- *
- * Based on the distances of the neighbors, a density can be computed
- * for each object. Objects with local maximum density are defined as
- * CSOs. The initial outliers are defined as objects with local minimum
- * density which is less than mean( density ) + thd * stdev( density );
- */
-void Flame_DefineSupports( Flame *self, int knn, float thd );
-
-/* Local Approximation of fuzzy memberships.
- * Stopped after the maximum steps of iterations;
- * Or stopped when the overall membership difference between
- * two iterations become less than epsilon. */
-void Flame_LocalApproximation( Flame *self, int steps, float epsilon );
-
-/* Construct clusters.
- * If 0<thd<1:
- *   each object is assigned to all clusters in which
- *   it has membership higher than thd; if it can not be assigned
- *   to any clusters, it is then assigned to the outlier group.
- * Else:
- *   each object is assigned to the group (clusters/outlier group)
- *   in which it has the highest membership. */
-void Flame_MakeClusters( Flame *self, float thd );
-
-}}}//ns
-
-#endif
diff --git a/loop/src/frag_db.cc b/loop/src/frag_db.cc
index 18f6f016db5a20b8f73e3168410b3274bd85b29c..bc446e8c1a34cd98834fdaad4781af78b7358fb1 100644
--- a/loop/src/frag_db.cc
+++ b/loop/src/frag_db.cc
@@ -109,8 +109,21 @@ void FragDB::SearchDB(const ost::mol::ResidueHandle& n_stem, const ost::mol::Res
                       uint frag_size, std::vector<FragmentInfo>& fragments,
                       bool extended_search){
 
-
   std::pair<StemCoords,StemCoords> stems = this->StemCoordsFromResidues(n_stem, c_stem);
+  this->SearchDB(stems, frag_size, fragments, extended_search);
+}
+
+void FragDB::SearchDB(const Backbone& n_stem, const Backbone& c_stem,
+                      uint frag_size, std::vector<FragmentInfo>& fragments,
+                      bool extended_search){
+
+  std::pair<StemCoords,StemCoords> stems = this->StemCoordsFromBackbone(n_stem, c_stem);
+  this->SearchDB(stems, frag_size, fragments, extended_search);
+}
+
+void FragDB::SearchDB(const std::pair<StemCoords,StemCoords>& stems, uint frag_size, 
+                      std::vector<FragmentInfo>& fragments,
+                      bool extended_search){
 
   std::vector<StemPairGeom> stem_pairs = this->MakeStemPairGeom(stems.first, stems.second, 
                                                                 frag_size, extended_search);
@@ -196,6 +209,23 @@ std::pair<FragDB::StemCoords,FragDB::StemCoords> FragDB::StemCoordsFromResidues(
   return std::make_pair(n_stem,c_stem);
 }
 
+std::pair<FragDB::StemCoords,FragDB::StemCoords> FragDB::StemCoordsFromBackbone(const Backbone& n_bb,
+                                                                                const Backbone& c_bb){
+
+  FragDB::StemCoords n_stem;
+  FragDB::StemCoords c_stem;
+
+  n_stem.n_coord = n_bb.n_coord;
+  n_stem.ca_coord = n_bb.ca_coord;
+  n_stem.c_coord  = n_bb.c_coord;
+
+  c_stem.n_coord = c_bb.n_coord;
+  c_stem.ca_coord = c_bb.ca_coord;
+  c_stem.c_coord  = c_bb.c_coord;
+
+  return std::make_pair(n_stem,c_stem);
+}
+
 std::pair<FragDB::StemCoords,FragDB::StemCoords> FragDB::StemCoordsFromPeptides(const Peptide& n_pep,
                                                                                 const Peptide& c_pep){
 
diff --git a/loop/src/frag_db.hh b/loop/src/frag_db.hh
index 5e38f5d77c194b0b5c70c8fa909b9ac867eb32e9..7d5156c67117a6651176da40259af225049520b8 100644
--- a/loop/src/frag_db.hh
+++ b/loop/src/frag_db.hh
@@ -61,6 +61,10 @@ public:
                 uint frag_size, std::vector<FragmentInfo>& fragments, 
                 bool extended_search = false);
 
+  void SearchDB(const Backbone& n_stem, const Backbone& c_stem,
+                uint frag_size, std::vector<FragmentInfo>& fragments,
+                bool extended_search = false);
+
   uint GetAngularBinSize() const { return angular_bin_size_; }
 
   Real GetDistBinSize() const { return dist_bin_size_; }
@@ -81,13 +85,20 @@ public:
 
 private:
 
+  void SearchDB(const std::pair<StemCoords,StemCoords>& stems, uint frag_size, 
+                std::vector<FragmentInfo>& fragments,
+                bool extended_search);
+
   FragDB(const FragDB& other) { };
 
   std::pair<StemCoords,StemCoords> StemCoordsFromResidues(const ost::mol::ResidueHandle& n_res,
-                                                            const ost::mol::ResidueHandle& c_res);
+                                                          const ost::mol::ResidueHandle& c_res);
+
+  std::pair<StemCoords,StemCoords> StemCoordsFromBackbone(const Backbone& n_bb,
+                                                          const Backbone& c_bb);
 
   std::pair<StemCoords,StemCoords> StemCoordsFromPeptides(const Peptide& n_pep,
-                                                            const Peptide& c_pep);
+                                                          const Peptide& c_pep);
 
   std::vector<StemPairGeom> MakeStemPairGeom(const FragDB::StemCoords& n_stem,
                                              const FragDB::StemCoords& c_stem,
diff --git a/loop/src/fragger.cc b/loop/src/fragger.cc
index eac14b6298f83f15b75b678ff6f536a09bcdbd8e..02c0b94e47dc5c7494a3fe8c79bcb83fb075497c 100644
--- a/loop/src/fragger.cc
+++ b/loop/src/fragger.cc
@@ -152,7 +152,7 @@ void Fragger::AddSeqIDParameters(Real w){
   score_types_.push_back(SeqID);
   weights_.push_back(w);
   subst_matrix_.push_back(ost::seq::alg::SubstWeightMatrix());
-  psipred_prediction_.push_back(std::vector<char>());
+  psipred_prediction_.push_back(std::vector<int>());
   psipred_confidence_.push_back(std::vector<int>());
   t_sampler_.push_back(std::vector<TorsionSamplerPtr>());
   t_sampler_indices_.push_back(std::vector<int>());
@@ -163,36 +163,25 @@ void Fragger::AddSeqSimParameters(Real w, ost::seq::alg::SubstWeightMatrix& subs
   score_types_.push_back(SeqSim);
   weights_.push_back(w);
   subst_matrix_.push_back(subst_matrix);
-  psipred_prediction_.push_back(std::vector<char>());
+  psipred_prediction_.push_back(std::vector<int>());
   psipred_confidence_.push_back(std::vector<int>());
   t_sampler_.push_back(std::vector<TorsionSamplerPtr>());
   t_sampler_indices_.push_back(std::vector<int>());
   profiles_.push_back(NULL);
 }
 
-void Fragger::AddSSAgreeParameters(Real w, const std::vector<char>& p_p,
-                                   const std::vector<int>& p_c){
+void Fragger::AddSSAgreeParameters(Real w, const PsipredPrediction& pp){
 
-  if(p_p.size() != frag_sequence_.size()){
-    throw promod3::Error("Length of psipred prediction must be consistent with fragment sequence!");
+  if(pp.size() != frag_sequence_.size()){
+    throw promod3::Error("Size of psipred prediction must be consistent with fragment sequence!");
   }
 
-  if(p_c.size() != frag_sequence_.size()){
-    throw promod3::Error("Length of psipred confidence must be consistent with fragment sequence!");
-  }
-
-  for(std::vector<char>::const_iterator i = p_p.begin(),
-      e = p_p.end(); i!=e; ++i){
-    if(*i != 'H' && *i != 'E' && *i!='C'){
-      throw promod3::Error("Every element in psipred prediction must be in ['H','E','C']!");
-    }
-  }
+  std::vector<int> p_p;
+  std::vector<int> p_c;
 
-  for(std::vector<int>::const_iterator i = p_c.begin(),
-      e = p_c.end(); i!=e; ++i){
-    if(*i < 0 || *i > 9){
-      throw promod3::Error("Every element in psipred confidence must be in range [0,9]!");
-    }
+  for(uint i = 0; i < pp.size(); ++i){
+    p_p.push_back(GetPsipredIdx(pp.GetPrediction(i)));
+    p_c.push_back(pp.GetConfidence(i));
   }
 
   score_types_.push_back(SSAgree);
@@ -224,7 +213,7 @@ void Fragger::AddTorsionProbabilityParameters(Real w, const TorsionSamplerPtr t_
   score_types_.push_back(TorsionProb);
   weights_.push_back(w);
   subst_matrix_.push_back(ost::seq::alg::SubstWeightMatrix());
-  psipred_prediction_.push_back(std::vector<char>());
+  psipred_prediction_.push_back(std::vector<int>());
   psipred_confidence_.push_back(std::vector<int>());
   t_sampler_.push_back(v_t_s);
   t_sampler_indices_.push_back(indices);
@@ -257,7 +246,7 @@ void Fragger::AddTorsionProbabilityParameters(Real w, const std::vector<TorsionS
   score_types_.push_back(TorsionProb);
   weights_.push_back(w);
   subst_matrix_.push_back(ost::seq::alg::SubstWeightMatrix());
-  psipred_prediction_.push_back(std::vector<char>());
+  psipred_prediction_.push_back(std::vector<int>());
   psipred_confidence_.push_back(std::vector<int>());
   t_sampler_.push_back(t_s);
   t_sampler_indices_.push_back(indices);
@@ -271,7 +260,7 @@ void Fragger::AddSequenceProfileParameters(Real w, ost::seq::HMMPtr hmm){
   score_types_.push_back(SequenceProfile);
   weights_.push_back(w);
   subst_matrix_.push_back(ost::seq::alg::SubstWeightMatrix());
-  psipred_prediction_.push_back(std::vector<char>());
+  psipred_prediction_.push_back(std::vector<int>());
   psipred_confidence_.push_back(std::vector<int>());
   t_sampler_.push_back(std::vector<TorsionSamplerPtr>());
   t_sampler_indices_.push_back(std::vector<int>());
@@ -306,7 +295,7 @@ void Fragger::AddStructureProfileParameters(Real w, ost::seq::HMMPtr hmm){
   score_types_.push_back(StructureProfile);
   weights_.push_back(w);
   subst_matrix_.push_back(ost::seq::alg::SubstWeightMatrix());
-  psipred_prediction_.push_back(std::vector<char>());
+  psipred_prediction_.push_back(std::vector<int>());
   psipred_confidence_.push_back(std::vector<int>());
   t_sampler_.push_back(std::vector<TorsionSamplerPtr>());
   t_sampler_indices_.push_back(std::vector<int>());
@@ -586,7 +575,7 @@ void Fragger::GenerateSeqIDProfile(StructureDBPtr db, std::vector<Real>& profile
 }
 
 void Fragger::GenerateSSAgreementProfile(StructureDBPtr db, std::vector<Real>& profile, uint index,
-                                         const std::vector<char>& predicted_ss, 
+                                         const std::vector<int>& predicted_ss, 
                                          const std::vector<int>& confidence) const{
 
   const std::vector<CoordInfo>& coord_toc = db->GetCoordToc();
@@ -600,25 +589,20 @@ void Fragger::GenerateSSAgreementProfile(StructureDBPtr db, std::vector<Real>& p
 
   //let's precalculate as much as we can
   std::vector<int> chain_dssp_states(chain_size);
-  std::vector<int> seq_psipred_predictions(seq_size);
-
+  
   uint coord_index = coord_toc[index].offset;
   for(uint i = 0; i < chain_size; ++i){
     chain_dssp_states[i] = GetDSSPIdx(coords[coord_index].dssp_state);
     ++coord_index;
   }
 
-  for(uint i = 0; i < seq_size; ++i){
-    seq_psipred_predictions[i] = GetPsipredIdx(predicted_ss[i]);
-  }
-
   Real score = 0.0;
   Real factor = 1.0 / seq_size;
 
   for(uint i = 0; i <= chain_size - seq_size; ++i){
     score = 0.0;
     for(uint j = 0; j < seq_size; ++j){
-      score += ss_agreements[chain_dssp_states[i+j]][seq_psipred_predictions[j]][confidence[j]];
+      score += ss_agreements[chain_dssp_states[i+j]][predicted_ss[j]][confidence[j]];
     }
     profile.push_back(score*factor);
   }    
@@ -667,7 +651,6 @@ void Fragger::GenerateProfileProfile(StructureDBPtr db, std::vector<Real>& profi
                                      Real** hmm) const{
 
   const std::vector<CoordInfo>& coord_toc = db->GetCoordToc();
-  const PagedArray<Peptide,4096>& coords = db->GetCoords();
 
   profile.clear();
 
diff --git a/loop/src/fragger.hh b/loop/src/fragger.hh
index 63b75d7f39111ceffda65111a9e8ea09fdaa0dfe..cafc474499c183b5a0fd217a5ec0a316ea9e6f00 100644
--- a/loop/src/fragger.hh
+++ b/loop/src/fragger.hh
@@ -4,6 +4,7 @@
 #include <promod3/loop/structure_db.hh>
 #include <promod3/loop/backbone.hh>
 #include <promod3/loop/torsion_sampler.hh>
+#include <promod3/loop/psipred_prediction.hh>
 #include <ost/seq/hmm.hh>
 #include <ost/conop/amino_acids.hh>
 
@@ -39,8 +40,7 @@ public:
 
   void AddSeqSimParameters(Real w, ost::seq::alg::SubstWeightMatrix& subst_matrix);
 
-  void AddSSAgreeParameters(Real w, const std::vector<char>& p_p,
-                            const std::vector<int>& p_c);
+  void AddSSAgreeParameters(Real w, const PsipredPrediction& pp);
 
   void AddTorsionProbabilityParameters(Real w, TorsionSamplerPtr t_s, 
                                        const String& before, const String& after);
@@ -93,7 +93,7 @@ private:
                             uint index) const;
 
   void GenerateSSAgreementProfile(StructureDBPtr db, std::vector<Real>& profile, uint index,
-                                  const std::vector<char>& predicted_ss, 
+                                  const std::vector<int>& predicted_ss, 
                                   const std::vector<int>& confidence) const;
 
   void GenerateTorsionProbabilityProfile(StructureDBPtr db, std::vector<Real>& profile, uint index,
@@ -106,7 +106,7 @@ private:
 
   //members holding stuff to calculate scores
   std::vector<ost::seq::alg::SubstWeightMatrix> subst_matrix_;
-  std::vector<std::vector<char> > psipred_prediction_;
+  std::vector<std::vector<int> > psipred_prediction_;
   std::vector<std::vector<int> > psipred_confidence_;
   std::vector<std::vector<TorsionSamplerPtr> > t_sampler_;
   std::vector<std::vector<int> > t_sampler_indices_;
diff --git a/loop/src/loop_candidate.cc b/loop/src/loop_candidate.cc
index d107f4a57e3bb272304e5d3f0725dcc1344b3264..abf4b80277c82c00f865ec10e5f56759e26f6807 100644
--- a/loop/src/loop_candidate.cc
+++ b/loop/src/loop_candidate.cc
@@ -10,80 +10,7 @@ Real LoopCandidate::RMSD(const LoopCandidate& other){
   return bb_list.RMSD(other.bb_list);
 }
 
-LoopCandidates::LoopCandidates(const ost::mol::ResidueHandle& n_stem, 
-                               const ost::mol::ResidueHandle& c_stem, 
-                               const String& seq):
-                               n_stem_(n_stem), 
-                               c_stem_(c_stem), 
-                               sequence_(seq) { 
-
-  if(n_stem.GetOneLetterCode() != seq[0] || 
-     c_stem.GetOneLetterCode() != seq[seq.size()-1]){
-    throw promod3::Error("Amino acid identities from stem residues do not match with the provided sequence!");
-  }
-
-  int n_stem_num = n_stem.GetNumber().GetNum();
-  int c_stem_num = c_stem.GetNumber().GetNum();
-
-  if(c_stem_num - n_stem_num + 1 != static_cast<int>(seq.size())){
-    throw promod3::Error("Difference in the stem residues numbers is inconsisten with the size of the provided sequence!");
-  }
-}
-
-void LoopCandidates::InsertInto(ost::mol::EntityHandle& ent, uint index) const{
-
-  if(index >= this->size()){
-    throw promod3::Error("Index is out of bounds!");
-  }
-
-  if(!n_stem_.IsValid() && !c_stem_.IsValid()){
-    std::stringstream ss;
-    ss << "At least one of the stem residues must be valid when ";
-    ss << "Inserting a loop candidate into an entity!";
-    throw promod3::Error(ss.str());
-  }
-
-  ost::mol::ResNum n_num;
-  ost::mol::ResNum c_num;
-  ost::mol::ChainHandle chain;
-  String chain_name;
-
-  if(n_stem_.IsValid() && c_stem_.IsValid()){
-    n_num = n_stem_.GetNumber();
-    c_num = c_stem_.GetNumber();
-    chain_name = n_stem_.GetChain().GetName();
-    chain = ent.FindChain(chain_name);
-  }
-  else if(n_stem_.IsValid()){
-    n_num = n_stem_.GetNumber();
-    c_num = n_num + candidates_[index].size() - 1;
-    chain_name = n_stem_.GetChain().GetName();
-    chain = ent.FindChain(chain_name);
-  }
-  else{
-    c_num = c_stem_.GetNumber();
-    n_num = c_num - candidates_[index].size() + 1;
-    chain_name = c_stem_.GetChain().GetName();
-    chain = ent.FindChain(chain_name);
-  }
-
-  if(!chain.IsValid()){
-    std::stringstream ss;
-    ss << "Could not find required chain of name \"" <<chain_name;
-    ss << "\" in ent to insert loop candidate!";
-    throw promod3::Error(ss.str());
-  }
-
-  candidates_[index].bb_list.InsertInto(chain,n_num.GetNum(),c_num.GetNum());
-}
-
-
-ost::mol::EntityHandle LoopCandidates::ToEntity(uint index) const {
-  if(index >= this->size()){
-    throw promod3::Error("Index is out of bounds!");
-  }
-  return candidates_[index].bb_list.ToEntity();
-}
+LoopCandidates::LoopCandidates(const String& seq): sequence_(seq) { }
 
 void LoopCandidates::Add(const LoopCandidate& candidate){
   //we check, whether the length and the sequence are consistent
@@ -130,7 +57,7 @@ LoopCandidatesPtr LoopCandidates::FillFromDatabase(const ost::mol::ResidueHandle
                                                    StructureDBPtr structure_db,
                                                    bool extended_search){
 
-  LoopCandidatesPtr candidates(new LoopCandidates(n_stem, c_stem, seq));
+  LoopCandidatesPtr candidates(new LoopCandidates(seq));
   std::vector<FragmentInfo> fragments;
   frag_db->SearchDB(n_stem,c_stem,seq.size(),fragments,extended_search);
 
@@ -159,16 +86,14 @@ LoopCandidatesPtr LoopCandidates::FillFromDatabase(const ost::mol::ResidueHandle
   return candidates;
 }
 
-LoopCandidatesPtr LoopCandidates::FillFromMonteCarloSampler(const ost::mol::ResidueHandle& n_stem,
-                                                            const ost::mol::ResidueHandle& c_stem,
-                                                            const String& seq, 
+LoopCandidatesPtr LoopCandidates::FillFromMonteCarloSampler(const String& seq, 
                                                             uint num_loops, uint steps, 
                                                             MonteCarloSamplerPtr sampler,
                                                             MonteCarloCloserPtr closer,
                                                             MonteCarloScorerPtr scorer,
                                                             MonteCarloCoolerPtr cooler){
 
-  LoopCandidatesPtr candidates(new LoopCandidates(n_stem,c_stem,seq));
+  LoopCandidatesPtr candidates(new LoopCandidates(seq));
 
   for(uint i = 0; i < num_loops; ++i){
     BackboneList new_backbone;
@@ -180,9 +105,7 @@ LoopCandidatesPtr LoopCandidates::FillFromMonteCarloSampler(const ost::mol::Resi
   return candidates;
 }
 
-LoopCandidatesPtr LoopCandidates::FillFromMonteCarloSampler(const ost::mol::ResidueHandle& n_stem,
-                                                            const ost::mol::ResidueHandle& c_stem,
-                                                            const BackboneList& initial_bb,
+LoopCandidatesPtr LoopCandidates::FillFromMonteCarloSampler(const BackboneList& initial_bb,
                                                             const String& seq, 
                                                             uint num_loops, uint steps, 
                                                             MonteCarloSamplerPtr sampler,
@@ -201,7 +124,7 @@ LoopCandidatesPtr LoopCandidates::FillFromMonteCarloSampler(const ost::mol::Resi
     }
   }
 
-  LoopCandidatesPtr candidates(new LoopCandidates(n_stem,c_stem,seq));
+  LoopCandidatesPtr candidates(new LoopCandidates(seq));
 
   for(uint i = 0; i < num_loops; ++i){
     BackboneList new_backbone = initial_bb;
@@ -213,8 +136,12 @@ LoopCandidatesPtr LoopCandidates::FillFromMonteCarloSampler(const ost::mol::Resi
   return candidates;
 }
 
-void LoopCandidates::ApplyCCD(std::vector<TorsionSamplerPtr> torsion_sampler, int max_iterations, Real rmsd_cutoff, bool keep_non_converged, int random_seed){
-  CCD closer(sequence_,n_stem_,c_stem_,torsion_sampler,max_iterations,rmsd_cutoff,random_seed);
+void LoopCandidates::ApplyCCD(const ost::mol::ResidueHandle& n_stem,
+                              const ost::mol::ResidueHandle& c_stem,
+                              std::vector<TorsionSamplerPtr> torsion_sampler, 
+                              int max_iterations, Real rmsd_cutoff, 
+                              bool keep_non_converged, int random_seed){
+  CCD closer(sequence_,n_stem,c_stem,torsion_sampler,max_iterations,rmsd_cutoff,random_seed);
   for(LoopCandidateList::iterator i = this->begin(); i != this->end(); ){
     if(!closer.Close(i->bb_list) && !keep_non_converged){
       i = candidates_.erase(i);
@@ -224,8 +151,12 @@ void LoopCandidates::ApplyCCD(std::vector<TorsionSamplerPtr> torsion_sampler, in
   }
 }
 
-void LoopCandidates::ApplyCCD(TorsionSamplerPtr torsion_sampler, int max_iterations, Real rmsd_cutoff, bool keep_non_converged, int random_seed){
-  CCD closer(sequence_,n_stem_,c_stem_,torsion_sampler,max_iterations,rmsd_cutoff,random_seed);
+void LoopCandidates::ApplyCCD(const ost::mol::ResidueHandle& n_stem,
+                              const ost::mol::ResidueHandle& c_stem,
+                              TorsionSamplerPtr torsion_sampler, 
+                              int max_iterations, Real rmsd_cutoff, 
+                              bool keep_non_converged, int random_seed){
+  CCD closer(sequence_,n_stem,c_stem,torsion_sampler,max_iterations,rmsd_cutoff,random_seed);
   for(LoopCandidateList::iterator i = this->begin(); i != this->end(); ){
     if(!closer.Close(i->bb_list) && !keep_non_converged){
       i = candidates_.erase(i);
@@ -235,8 +166,11 @@ void LoopCandidates::ApplyCCD(TorsionSamplerPtr torsion_sampler, int max_iterati
   }
 }
 
-void LoopCandidates::ApplyCCD(int max_iterations, Real rmsd_cutoff, bool keep_non_converged, int random_seed){
-  CCD closer(n_stem_,c_stem_,max_iterations,rmsd_cutoff);
+void LoopCandidates::ApplyCCD(const ost::mol::ResidueHandle& n_stem,
+                              const ost::mol::ResidueHandle& c_stem,
+                              int max_iterations, Real rmsd_cutoff, 
+                              bool keep_non_converged){
+  CCD closer(n_stem,c_stem,max_iterations,rmsd_cutoff);
   for(LoopCandidateList::iterator i = this->begin(); i != this->end(); ){
     if(!closer.Close(i->bb_list) && !keep_non_converged){
       i = candidates_.erase(i);
@@ -246,10 +180,12 @@ void LoopCandidates::ApplyCCD(int max_iterations, Real rmsd_cutoff, bool keep_no
   }
 }
 
-void LoopCandidates::ApplyKIC(uint pivot_one, uint pivot_two, uint pivot_three){
+void LoopCandidates::ApplyKIC(const ost::mol::ResidueHandle& n_stem,
+                              const ost::mol::ResidueHandle& c_stem,
+                              uint pivot_one, uint pivot_two, uint pivot_three){
 
   LoopCandidateList new_candidates;
-  KIC closer(n_stem_, c_stem_);
+  KIC closer(n_stem, c_stem);
 
   for(LoopCandidateList::iterator i = this->begin(); i != this->end(); ++i){
 
@@ -268,62 +204,63 @@ void LoopCandidates::ApplyKIC(uint pivot_one, uint pivot_two, uint pivot_three){
   candidates_ = new_candidates;
 }
 
-LoopCandidatesList LoopCandidates::ClusterCandidates(){
+LoopCandidatesList LoopCandidates::ClusterCandidates(Real max_dist, 
+                                                     bool neglect_size_one){
 
   LoopCandidatesList return_list;
-  uint num_loops = candidates_.size();
+  int num_loops = candidates_.size();
 
   if(num_loops <= 1){
     return_list.push_back(*this);
     return return_list;
   }
 
-  Real** rmsd_matrix = NULL;
+  float** rmsd_matrix = NULL;
 
-  rmsd_matrix = (Real**)malloc(num_loops*sizeof(Real*));
-  for(uint i = 0; i < num_loops; ++i){
-    rmsd_matrix[i] = (Real*)malloc(num_loops*sizeof(Real));
-    memset(rmsd_matrix[i],0,num_loops*sizeof(Real));
+  rmsd_matrix = new float*[num_loops];
+  for(int i= 0; i < num_loops; ++i){
+    rmsd_matrix[i] = new float[num_loops];
+  }
+
+  //set diagonal elements to zero
+  for(int i = 0; i < num_loops; ++i){
+    rmsd_matrix[i][i] = 0.0;
   }
 
   Real rmsd;
-  for(uint i = 0; i < num_loops; ++i){
-    for(uint j = i+1; j < num_loops; ++j){
+  for(int i = 0; i < num_loops; ++i){
+    for(int j = i+1; j < num_loops; ++j){
       rmsd = candidates_[i].CARMSD(candidates_[j]);
       rmsd_matrix[i][j] = rmsd;
       rmsd_matrix[j][i] = rmsd;
     }
   }
 
-  flame::Flame* flame = flame::Flame_New();
-  flame::Flame_SetDistMatrix(flame, rmsd_matrix, num_loops);
-  flame::Flame_DefineSupports(flame,int(std::sqrt(candidates_.size())),-2.0);
-  flame::Flame_LocalApproximation(flame, 500, 1e-6);
-  flame::Flame_MakeClusters(flame,-1.0);
+  std::vector<std::vector<int> > clusters;
+  DoClustering(rmsd_matrix, num_loops, max_dist, clusters);
 
-  for(int i = 0; i <= flame->cso_count; ++i){
-    LoopCandidates new_candidates(n_stem_,c_stem_,sequence_);
+  for(uint i = 0; i < clusters.size(); ++i){
+    if(clusters[i].size() <= 1 && neglect_size_one) continue;
+    LoopCandidates new_candidates(sequence_);
     return_list.push_back(new_candidates);
-    for(int j = 0; j < flame->clusters[i].size; ++j){
-      return_list.back().Add(candidates_[flame->clusters[i].array[j]]);
-    }
+    for(uint j = 0; j < clusters[i].size(); ++j){
+      return_list.back().Add(candidates_[clusters[i][j]]);
+    }    
   }
 
-  for(uint i = 0; i < num_loops; ++i){
-    free(rmsd_matrix[i]);
+  for(int i = 0; i < num_loops; ++i){
+    delete [] rmsd_matrix[i];
   }
-  free(rmsd_matrix);
-  flame::Flame_Clear(flame);
+  delete [] rmsd_matrix;
   
   return return_list;
 }
 
-void LoopCandidates::CalculateClashScores(int chain_index){
+void LoopCandidates::CalculateClashScores(uint start_resnum, uint chain_index){
   if(!scorer_){
     throw promod3::Error("Require a loop scorer to be attached to LoopCandidatesObject!");
   }
   Real clash_score;
-  int start_resnum = n_stem_.GetNumber().GetNum();
 
   for(LoopCandidateList::iterator i = this->begin(); 
       i != this->end(); ++i){
@@ -332,12 +269,11 @@ void LoopCandidates::CalculateClashScores(int chain_index){
   }
 }
 
-void LoopCandidates::CalculateCBetaScores(int chain_index){
+void LoopCandidates::CalculateCBetaScores(uint start_resnum, uint chain_index){
   if(!scorer_){
     throw promod3::Error("Require a loop scorer to be attached to LoopCandidatesObject!");
   }
   Real cbeta_score;
-  int start_resnum = n_stem_.GetNumber().GetNum();
 
   for(LoopCandidateList::iterator i = this->begin(); 
       i != this->end(); ++i){
@@ -346,12 +282,24 @@ void LoopCandidates::CalculateCBetaScores(int chain_index){
   }  
 }
 
-void LoopCandidates::CalculateTorsionScores(int chain_index){
+void LoopCandidates::CalculateReducedScores(uint start_resnum, uint chain_index){
+  if(!scorer_){
+    throw promod3::Error("Require a loop scorer to be attached to LoopCandidatesObject!");
+  }
+  Real reduced_score;
+
+  for(LoopCandidateList::iterator i = this->begin(); 
+      i != this->end(); ++i){
+    reduced_score = scorer_->CalculateReducedScore(i->bb_list,start_resnum, chain_index);
+    i->reduced_score = reduced_score;
+  }  
+}
+
+void LoopCandidates::CalculateTorsionScores(uint start_resnum, uint chain_index){
   if(!scorer_){
     throw promod3::Error("Require a loop scorer to be attached to LoopCandidatesObject!");
   }
   Real torsion_score;
-  int start_resnum = n_stem_.GetNumber().GetNum();  
 
   for(LoopCandidateList::iterator i = this->begin(); 
       i != this->end(); ++i){
@@ -360,12 +308,11 @@ void LoopCandidates::CalculateTorsionScores(int chain_index){
   }  
 }
 
-void LoopCandidates::CalculateCBPackingScores(int chain_index){
+void LoopCandidates::CalculateCBPackingScores(uint start_resnum, uint chain_index){
   if(!scorer_){
     throw promod3::Error("Require a loop scorer to be attached to LoopCandidatesObject!");
   }
   Real packing_score;
-  int start_resnum = n_stem_.GetNumber().GetNum();
 
   for(LoopCandidateList::iterator i = this->begin(); 
       i != this->end(); ++i){
@@ -374,12 +321,11 @@ void LoopCandidates::CalculateCBPackingScores(int chain_index){
   }
 }
 
-void LoopCandidates::CalculateHBondScores(int chain_index){
+void LoopCandidates::CalculateHBondScores(uint start_resnum, uint chain_index){
   if(!scorer_){
     throw promod3::Error("Require a loop scorer to be attached to LoopCandidatesObject!");
   }
   Real hbond_score;
-  int start_resnum = n_stem_.GetNumber().GetNum();
 
   for(LoopCandidateList::iterator i = this->begin(); 
       i != this->end(); ++i){
@@ -388,45 +334,73 @@ void LoopCandidates::CalculateHBondScores(int chain_index){
   }
 }
 
-void LoopCandidates::CalculateDSSPHBondScores(int chain_index){
+void LoopCandidates::CalculateSSAgreementScores(uint start_resnum, uint chain_index){
   if(!scorer_){
     throw promod3::Error("Require a loop scorer to be attached to LoopCandidatesObject!");
   }
-  Real dssp_hbond_score;
-  int start_resnum = n_stem_.GetNumber().GetNum();
+  Real ss_agreement_score;
 
   for(LoopCandidateList::iterator i = this->begin(); 
       i != this->end(); ++i){
-    dssp_hbond_score = scorer_->CalculateDSSPHBondScore(i->bb_list,start_resnum, chain_index);
-    i->dssp_hbond_score = dssp_hbond_score;
+    ss_agreement_score = scorer_->CalculateSSAgreementScore(i->bb_list,start_resnum, chain_index);
+    i->ss_agreement_score = ss_agreement_score;
   }
 }
 
-void LoopCandidates::CalculateStemRMSD(){
+void LoopCandidates::CalculateCombinedScores(const std::map<String,Real>& linear_weights,
+                                             uint start_resnum, uint chain_index){
 
-  geom::Vec3 before_n_pos = n_stem_.FindAtom("N").GetPos();
-  geom::Vec3 before_ca_pos = n_stem_.FindAtom("CA").GetPos();
-  geom::Vec3 before_c_pos = n_stem_.FindAtom("C").GetPos();
-  geom::Vec3 before_o_pos = n_stem_.FindAtom("O").GetPos();
-  geom::Vec3 after_n_pos = c_stem_.FindAtom("N").GetPos();
-  geom::Vec3 after_ca_pos = c_stem_.FindAtom("CA").GetPos();
-  geom::Vec3 after_c_pos = c_stem_.FindAtom("C").GetPos();
-  geom::Vec3 after_o_pos = c_stem_.FindAtom("O").GetPos();
 
-  Real rmsd;
+  typedef Real (BackboneLoopScorer::*score_f_ptr)(const BackboneList&, uint, uint) const;
+  std::vector<std::pair<score_f_ptr, Real> > weights;
+  Real intercept = 0.0;
 
-  for(LoopCandidateList::iterator i = candidates_.begin(); 
-      i != candidates_.end(); ++i){
-    rmsd = 0.0;
-    rmsd += geom::Length2(before_n_pos-i->bb_list[0].n_coord);
-    rmsd += geom::Length2(before_ca_pos-i->bb_list[0].ca_coord);
-    rmsd += geom::Length2(before_c_pos-i->bb_list[0].c_coord);
-    rmsd += geom::Length2(before_o_pos-i->bb_list[0].o_coord);    
-    rmsd += geom::Length2(after_n_pos-i->bb_list.back().n_coord);
-    rmsd += geom::Length2(after_ca_pos-i->bb_list.back().ca_coord);
-    rmsd += geom::Length2(after_c_pos-i->bb_list.back().c_coord); 
-    rmsd += geom::Length2(after_o_pos-i->bb_list.back().o_coord); 
-    i->stem_rmsd = std::sqrt(rmsd/8);
+  for(std::map<String, Real>::const_iterator i =linear_weights.begin();
+      i != linear_weights.end(); ++i){
+
+    if(i->first == "cbeta"){
+      weights.push_back(std::make_pair(&BackboneLoopScorer::CalculateCBetaScore,i->second));
+    }
+    else if(i->first == "clash"){
+      weights.push_back(std::make_pair(&BackboneLoopScorer::CalculateClashScore,i->second));     
+    }
+    else if(i->first == "torsion"){
+      weights.push_back(std::make_pair(&BackboneLoopScorer::CalculateTorsionScore,i->second));     
+    }
+    else if(i->first == "cb_packing"){
+      weights.push_back(std::make_pair(&BackboneLoopScorer::CalculateCBPackingScore,i->second));     
+    }
+    else if(i->first == "hbond"){
+      weights.push_back(std::make_pair(&BackboneLoopScorer::CalculateHBondScore,i->second));     
+    }
+    else if(i->first == "ss_agreement"){
+      weights.push_back(std::make_pair(&BackboneLoopScorer::CalculateSSAgreementScore,i->second));
+    }
+    else if(i->first == "reduced"){
+      weights.push_back(std::make_pair(&BackboneLoopScorer::CalculateReducedScore,i->second));
+    }
+    else if(i->first == "intercept"){
+      intercept = i->second;
+    }
+    else{
+      std::stringstream ss;
+      ss << "Invalid keyword in weight dictionary observed when Calculating combined score! ";
+      ss << "Valid keywords are: cbeta, clash, torsion, cb_packing, hbond, ss_agreement, reduced ";
+      ss << "and intercept.";
+      throw promod3::Error(ss.str());
+    }
+  }  
+
+  Real score;
+  for(LoopCandidateList::iterator i = this->begin(); 
+      i != this->end(); ++i){
+    score = 0.0;
+    for(std::vector<std::pair<score_f_ptr, Real> >::iterator j = weights.begin();
+        j != weights.end(); ++j){
+      score += j->second * ((*scorer_).*(j->first))(i->bb_list,start_resnum,chain_index);
+    }
+    score += intercept;    
+    i->combined_score = score;
   }
 }
 
@@ -446,6 +420,14 @@ Real LoopCandidates::GetAVGCBetaScore(){
   return score/this->size();
 }
 
+Real LoopCandidates::GetAVGReducedScore(){
+  Real score = 0.0;
+  for(LoopCandidateList::iterator i = this->begin(); i != this->end(); ++i){
+    score += i->reduced_score;
+  }
+  return score/this->size();
+}
+
 Real LoopCandidates::GetAVGTorsionScore(){
   Real score = 0.0;
   for(LoopCandidateList::iterator i = this->begin(); i != this->end(); ++i){
@@ -470,20 +452,21 @@ Real LoopCandidates::GetAVGHBondScore(){
   return score/this->size();
 }
 
-Real LoopCandidates::GetAVGDSSPHBondScore(){
+Real LoopCandidates::GetAVGSSAgreementScore(){
   Real score = 0.0;
   for(LoopCandidateList::iterator i = this->begin(); i != this->end(); ++i){
-    score += i->dssp_hbond_score;
+    score += i->ss_agreement_score;
   }
   return score/this->size();
 }
 
-Real LoopCandidates::GetAVGStemRMSD(){
+Real LoopCandidates::GetAVGCombinedScore(){
   Real score = 0.0;
   for(LoopCandidateList::iterator i = this->begin(); i != this->end(); ++i){
-    score += i->stem_rmsd;
+    score += i->combined_score;
   }
   return score/this->size();
 }
 
+
 }}
diff --git a/loop/src/loop_candidate.hh b/loop/src/loop_candidate.hh
index c0a127269c3297bd6382f8ff034b494f459b6b36..9e0bf4300c892367742ae06118d7fe9c7727b26a 100644
--- a/loop/src/loop_candidate.hh
+++ b/loop/src/loop_candidate.hh
@@ -4,7 +4,7 @@
 #include <promod3/loop/backbone.hh>
 #include <promod3/loop/frag_db.hh>
 #include <promod3/loop/monte_carlo.hh>
-#include <promod3/loop/flame.hh>
+#include <promod3/loop/cluster.hh>
 #include <promod3/loop/backbone_loop_score.hh>
 #include <promod3/loop/ccd.hh>
 #include <promod3/loop/kic.hh>
@@ -16,18 +16,15 @@ namespace promod3 { namespace loop {
 struct LoopCandidate {
 public:
   LoopCandidate(const BackboneList& bb_list):
-    clash_score(0.0), cbeta_score(0.0),
+    clash_score(0.0), cbeta_score(0.0), reduced_score(0.0),
     torsion_score(0.0), packing_score(0.0), hbond_score(0.0),
-    dssp_hbond_score(0.0), stem_rmsd(0.0), original_sequence(""), 
-    bb_list(bb_list)
-  { }
+    ss_agreement_score(0.0),original_sequence(""), bb_list(bb_list) { }
   LoopCandidate(const BackboneList& bb_list, const String& original_sequence,
                 const String& original_dssp_states):
     clash_score(0.0), cbeta_score(0.0),
     torsion_score(0.0), packing_score(0.0), hbond_score(0.0),
-    dssp_hbond_score(0.0), stem_rmsd(0.0), original_sequence(original_sequence), 
-    original_dssp_states(original_dssp_states), bb_list(bb_list)
-  { }
+    original_sequence(original_sequence), 
+    original_dssp_states(original_dssp_states), bb_list(bb_list) { }
 
   Real CARMSD(const LoopCandidate& other);
 
@@ -41,11 +38,12 @@ public:
 
   Real clash_score;
   Real cbeta_score;
+  Real reduced_score;
   Real torsion_score;
   Real packing_score;
   Real hbond_score;
-  Real dssp_hbond_score;
-  Real stem_rmsd;
+  Real ss_agreement_score;
+  Real combined_score;
   String original_sequence;
   String original_dssp_states;
   BackboneList   bb_list;
@@ -58,9 +56,7 @@ typedef std::vector<LoopCandidates> LoopCandidatesList;
 
 class LoopCandidates {
 public:
-  LoopCandidates(const ost::mol::ResidueHandle& n_stem, 
-                 const ost::mol::ResidueHandle& c_stem, 
-                 const String& seq);
+  LoopCandidates( const String& seq);
   
   static LoopCandidatesPtr FillFromDatabase(const ost::mol::ResidueHandle& n_stem, 
                                             const ost::mol::ResidueHandle& c_stem,
@@ -69,9 +65,7 @@ public:
                                             StructureDBPtr structure_db,
                                             bool extended_search);
 
-  static LoopCandidatesPtr FillFromMonteCarloSampler(const ost::mol::ResidueHandle& n_stem, 
-                                                     const ost::mol::ResidueHandle& c_stem, 
-                                                     const String& seq, 
+  static LoopCandidatesPtr FillFromMonteCarloSampler(const String& seq, 
                                                      uint num_loops, 
                                                      uint steps,
                                                      MonteCarloSamplerPtr sampler,
@@ -79,9 +73,7 @@ public:
                                                      MonteCarloScorerPtr scorer,
                                                      MonteCarloCoolerPtr cooler);
 
-  static LoopCandidatesPtr FillFromMonteCarloSampler(const ost::mol::ResidueHandle& n_stem, 
-                                                     const ost::mol::ResidueHandle& c_stem,
-                                                     const BackboneList& initial_bb, 
+  static LoopCandidatesPtr FillFromMonteCarloSampler(const BackboneList& initial_bb, 
                                                      const String& seq, 
                                                      uint num_loops, 
                                                      uint steps,
@@ -91,22 +83,28 @@ public:
                                                      MonteCarloCoolerPtr cooler);
 
 
-  void ApplyCCD(std::vector<TorsionSamplerPtr> torsion_sampler,
+  void ApplyCCD(const ost::mol::ResidueHandle& n_stem,
+                const ost::mol::ResidueHandle& c_stem,
+                std::vector<TorsionSamplerPtr> torsion_sampler,
                 int max_iterations = 1000, Real rmsd_cutoff = 0.1,
                 bool keep_non_converged = false, int random_seed=0);
 
-  void ApplyCCD(TorsionSamplerPtr torsion_sampler, int max_iterations = 1000, Real rmsd_cutoff = 0.1, 
-                bool keep_non_converged = false, int random_seed=0);
-
-  void ApplyCCD(int max_iterations = 1000, Real rmsd_cutoff = 0.1, bool keep_non_converged = false, int random_seed=0);
-
-  void ApplyKIC(uint pivot_one, uint pivot_two, uint pivot_three);
+  void ApplyCCD(const ost::mol::ResidueHandle& n_stem,
+                const ost::mol::ResidueHandle& c_stem,
+                TorsionSamplerPtr torsion_sampler, int max_iterations = 1000, 
+                Real rmsd_cutoff = 0.1,  bool keep_non_converged = false, 
+                int random_seed=0);
 
-  LoopCandidatesList ClusterCandidates();
+  void ApplyCCD(const ost::mol::ResidueHandle& n_stem,
+                const ost::mol::ResidueHandle& c_stem,
+                int max_iterations = 1000, Real rmsd_cutoff = 0.1, 
+                bool keep_non_converged = false);
 
-  ost::mol::EntityHandle ToEntity(uint index) const;
+  void ApplyKIC(const ost::mol::ResidueHandle& n_stem,
+                const ost::mol::ResidueHandle& c_stem,
+                uint pivot_one, uint pivot_two, uint pivot_three);
 
-  void InsertInto(ost::mol::EntityHandle& ent, uint index) const;
+  LoopCandidatesList ClusterCandidates(Real max_dist, bool neglect_size_one = true);
 
   void Add(const LoopCandidate& candidate);
 
@@ -116,37 +114,38 @@ public:
 
   void AttachScorer(BackboneLoopScorerPtr scorer) { scorer_ = scorer; }
 
-  void CalculateClashScores(int chain_index = 0);
+  void CalculateClashScores(uint start_resnum, uint chain_index = 0);
 
-  void CalculateCBetaScores(int chain_index = 0);
+  void CalculateCBetaScores(uint start_resnum, uint chain_index = 0);
 
-  void CalculateTorsionScores(int chain_index = 0);
+  void CalculateReducedScores(uint start_resnum, uint chain_index = 0);
 
-  void CalculateCBPackingScores(int chain_index = 0);
+  void CalculateTorsionScores(uint start_resnum, uint chain_index = 0);
 
-  void CalculateHBondScores(int chain_index = 0);
+  void CalculateCBPackingScores(uint start_resnum, uint chain_index = 0);
 
-  void CalculateDSSPHBondScores(int chain_index = 0);
+  void CalculateHBondScores(uint start_resnum, uint chain_index = 0);
 
-  void CalculateStemRMSD();
+  void CalculateSSAgreementScores(uint start_resnum, uint chain_index = 0);
+
+  void CalculateCombinedScores(const std::map<String, Real>& linear_weights,
+                               uint start_resnum, uint chain_index = 0);
 
   Real GetAVGClashScore();
 
   Real GetAVGCBetaScore();
 
+  Real GetAVGReducedScore();
+
   Real GetAVGTorsionScore();
 
   Real GetAVGPackingScore();
 
   Real GetAVGHBondScore();
 
-  Real GetAVGDSSPHBondScore();
-
-  Real GetAVGStemRMSD();
-
-  ost::mol::ResidueHandle GetNStem() { return n_stem_; }
+  Real GetAVGSSAgreementScore();
 
-  ost::mol::ResidueHandle GetCStem() { return c_stem_; }
+  Real GetAVGCombinedScore();
 
   size_t size() const { return candidates_.size(); }
   
@@ -182,8 +181,7 @@ public:
 
   
 private:
-  LoopCandidateList candidates_;
-  ost::mol::ResidueHandle n_stem_, c_stem_;
+  LoopCandidateList candidates_;;
   String sequence_;
   BackboneLoopScorerPtr scorer_;
 };
diff --git a/loop/src/monte_carlo_scorer.cc b/loop/src/monte_carlo_scorer.cc
index bf216b09ec6e7b702cbc7593df1e5576d49eda95..18e86101c40bf72a4ee08c3ba8e7a66522a634cf 100644
--- a/loop/src/monte_carlo_scorer.cc
+++ b/loop/src/monte_carlo_scorer.cc
@@ -28,16 +28,19 @@ LinearScorer::LinearScorer(BackboneLoopScorerPtr scorer, uint start_resnum, uint
     else if(i->first == "hbond"){
   	  weights_.push_back(std::make_pair(&BackboneLoopScorer::CalculateHBondScore,i->second));  	  
   	}
-    else if(i->first == "dssp_hbond"){
-  	  weights_.push_back(std::make_pair(&BackboneLoopScorer::CalculateDSSPHBondScore,i->second));  	  
-  	}
+    else if(i->first == "ss_agreement"){
+      weights_.push_back(std::make_pair(&BackboneLoopScorer::CalculateSSAgreementScore,i->second));
+    }
+    else if(i->first == "reduced"){
+      weights_.push_back(std::make_pair(&BackboneLoopScorer::CalculateReducedScore,i->second));
+    }
   	else if(i->first == "intercept"){
       intercept_ = i->second;
   	}
   	else{
       std::stringstream ss;
       ss << "Invalid keyword in weight dictionary observed when setting up Linear Scorer! ";
-      ss << "Valid keywords are: cbeta, clash, torsion, cb_packing, hbond, dssp_hbond ";
+      ss << "Valid keywords are: cbeta, clash, torsion, cb_packing, hbond, ss_agreement, reduced ";
       ss << "and intercept.";
   	  throw promod3::Error(ss.str());
   	}
diff --git a/loop/src/psipred_prediction.cc b/loop/src/psipred_prediction.cc
new file mode 100644
index 0000000000000000000000000000000000000000..00b3f460be3e9564c5d7eda160cbc9b31440ccb3
--- /dev/null
+++ b/loop/src/psipred_prediction.cc
@@ -0,0 +1,187 @@
+#include <promod3/loop/psipred_prediction.hh>
+
+namespace promod3{ namespace loop{
+
+PsipredPrediction::PsipredPrediction(const std::vector<char>& prediction,
+	                                   const std::vector<int>& confidence){
+
+  //check input for validity
+  if(prediction.size() != confidence.size()){
+  	throw promod3::Error("Size of psipred prediction and confidence is inconsistent!");
+  }
+
+  for(std::vector<char>::const_iterator i = prediction.begin(); 
+  	  i != prediction.end(); ++i){
+    if(!(*i == 'H' || *i == 'C' || *i == 'E')){
+      throw promod3::Error("Psipred prediction must be element of ['H','E','C']!");
+    }
+  }
+
+  for(std::vector<int>::const_iterator i = confidence.begin(); 
+  	  i != confidence.end(); ++i){
+  	if((*i)<0 || (*i)>9){
+      throw promod3::Error("Psipred confidence must be in range [0,9]!");
+  	}
+  }
+
+  prediction_ = prediction;
+  confidence_ = confidence; 
+}
+
+PsipredPredictionPtr PsipredPrediction::Extract(uint from, uint to) const{
+
+  if(to <= from){
+  	throw promod3::Error("'from' parameter must be smaller than 'to' parameter!");
+  }
+
+  if(to > this->size()){
+  	throw promod3::Error("Try to access invalid range in PsipredPrediction!");
+  }
+
+  std::vector<char> pred;
+  std::vector<int> conf;
+
+  for(uint i = from; i < to; ++i){
+  	pred.push_back(prediction_[i]);
+  	conf.push_back(confidence_[i]);
+  }
+
+  PsipredPredictionPtr p(new PsipredPrediction(pred,conf));
+  return p;
+}
+
+void PsipredPrediction::Add(char prediction, int confidence){
+  if(!(prediction == 'H' || prediction == 'E' || prediction == 'C')){
+  	throw promod3::Error("Psipred prediction must be in ['H','E','C']!");
+  }
+  if(confidence < 0 || confidence > 9){
+    throw promod3::Error("Psipred confidence must be in [0,9]!");
+  }
+  prediction_.push_back(prediction);
+  confidence_.push_back(confidence);
+}
+
+char PsipredPrediction::GetPrediction(uint idx) const{
+  if(idx >= this->size()){
+    throw promod3::Error("Invalid idx for getting psipred prediction!");
+  }
+
+  return prediction_[idx];
+}
+
+int PsipredPrediction::GetConfidence(uint idx) const{
+  if(idx >= this->size()){
+    throw promod3::Error("Invalid idx for getting psipred confidence!");
+  }
+  return confidence_[idx];
+}
+
+PsipredPredictionPtr PsipredPrediction::FromHHM(const String& filename){
+
+  std::vector<char> prediction;
+  std::vector<int> confidence;
+
+  boost::iostreams::filtering_stream<boost::iostreams::input> in;
+  std::ifstream stream(filename.c_str()); 
+  if(!stream){
+    throw std::runtime_error("Could not open file!");
+  }
+  if (filename.rfind(".gz") == filename.size()-3) {
+    in.push(boost::iostreams::gzip_decompressor());
+  }
+
+  bool in_sspred = false;
+  bool in_ssconf = false;
+
+  in.push(stream);
+  std::string line;
+  ost::StringRef sline;
+  while (std::getline(in, line)) {
+    sline=ost::StringRef(line.c_str(), line.length());
+    sline = sline.trim();
+    if (sline.empty()) continue;
+    if (sline == ost::StringRef("//", 2)) break;
+
+    if(sline.length() > 0 &&
+       sline[0] == '>'){
+      in_sspred = false;
+      in_ssconf = false;
+    }
+
+    if (sline.length() > 8 && 
+        sline.substr(0, 9)==ost::StringRef(">ss_pred ", 9)) {
+      in_sspred = true;
+      continue;
+    }
+
+    if (sline.length() > 8 && 
+        sline.substr(0, 9)==ost::StringRef(">ss_conf ", 9)) {
+      in_ssconf = true;
+      continue;
+    }
+
+    if(in_sspred){
+      for(uint i = 0; i < sline.size(); ++i){
+        prediction.push_back(sline[i]);
+      }
+    }
+
+    if(in_ssconf){
+      for(uint i = 0; i < sline.size(); ++i){
+        confidence.push_back(int(sline[i])-48); //note, that the number zero
+                                                //has number 48 in ascii...
+      }
+    }
+  }
+
+  PsipredPredictionPtr p(new PsipredPrediction(prediction,confidence));
+  return p;
+}
+
+PsipredPredictionPtr PsipredPrediction::FromHoriz(const String& filename){
+
+  std::vector<char> prediction;
+  std::vector<int> confidence;
+
+  boost::iostreams::filtering_stream<boost::iostreams::input> in;
+  std::ifstream stream(filename.c_str()); 
+  if(!stream){
+    throw std::runtime_error("Could not open file!");
+  }
+  if (filename.rfind(".gz") == filename.size()-3) {
+    in.push(boost::iostreams::gzip_decompressor());
+  }
+
+  in.push(stream);
+  std::string line;
+  ost::StringRef sline;
+  std::vector<ost::StringRef> split_sline;
+
+  while (std::getline(in, line)) {
+    sline=ost::StringRef(line.c_str(), line.length());
+    sline = sline.trim();
+    if (sline.empty()) continue;
+
+    split_sline = sline.split();
+
+    if(split_sline[0].str() == "Pred:" && split_sline.size() == 2){
+      String data = split_sline[1].str();
+      for(uint i = 0; i < data.size(); ++i){
+        prediction.push_back(data[i]);
+      }
+    }
+
+    if(split_sline[0].str() == "Conf:" && split_sline.size() == 2){
+      String data = split_sline[1].str();
+      for(uint i = 0; i < data.size(); ++i){
+        confidence.push_back(int(data[i])-48); //note, that the number zero
+                                               //has number 48 in ascii...
+      }
+    }
+  }
+
+  PsipredPredictionPtr p(new PsipredPrediction(prediction,confidence));
+  return p;
+}
+
+}} //ns
diff --git a/loop/src/psipred_prediction.hh b/loop/src/psipred_prediction.hh
new file mode 100644
index 0000000000000000000000000000000000000000..b7786813907d8d25c6c1534c066853fa221698d9
--- /dev/null
+++ b/loop/src/psipred_prediction.hh
@@ -0,0 +1,51 @@
+#ifndef PROMOD_LOOP_PSIPRED_PREDICTION_HH
+#define PROMOD_LOOP_PSIPRED_PREDICTION_HH
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <ost/string_ref.hh>
+#include <promod3/core/message.hh>
+#include <fstream>
+#include <boost/iostreams/filter/gzip.hpp>
+#include <boost/iostreams/filtering_stream.hpp>
+
+namespace promod3 { namespace loop {
+
+class PsipredPrediction;
+typedef boost::shared_ptr<PsipredPrediction> PsipredPredictionPtr;
+
+class PsipredPrediction{
+
+public:
+
+  PsipredPrediction() {}
+
+  PsipredPrediction(const std::vector<char>& prediction, 
+                    const std::vector<int>& confidence);
+
+  static PsipredPredictionPtr FromHHM(const String& filename);
+
+  static PsipredPredictionPtr FromHoriz(const String& filename);
+
+  PsipredPredictionPtr Extract(uint from, uint to) const;
+
+  void Add(char prediction, int confidence);
+
+  char GetPrediction(uint idx) const;
+
+  int GetConfidence(uint idx) const;
+
+  std::vector<char> GetPredictions() const { return prediction_; }
+
+  std::vector<int> GetConfidences() const { return confidence_; }
+
+  size_t size() const { return prediction_.size(); }
+
+private:
+  std::vector<char> prediction_;
+  std::vector<int> confidence_;
+};
+
+}} //ns
+
+#endif
diff --git a/loop/src/sec_struct.cc b/loop/src/sec_struct.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1bd43d87bd5db09b477e3a5b5183ef179d608534
--- /dev/null
+++ b/loop/src/sec_struct.cc
@@ -0,0 +1,405 @@
+#include <promod3/loop/sec_struct.hh>
+
+namespace promod3{ namespace loop{
+
+void RawEstimateSS(const std::vector<geom::Vec3>& ca_positions, 
+	                 int start_idx,
+                   const std::vector<int>& donor_for_one,
+                   const std::vector<int>& donor_for_two, 
+                   const std::vector<int>& acceptor_for_one,
+                   const std::vector<int>& acceptor_for_two,
+                   String& ss_assignment){
+  
+  int size = ca_positions.size();
+
+  if(size != static_cast<int>(donor_for_one.size())){
+    throw promod3::Error("Position and donor data are inconsistent for dssp calculation!");
+  }
+
+  if(size != static_cast<int>(donor_for_two.size())){
+    throw promod3::Error("Position and donor data are inconsistent for dssp calculation!");
+  }
+
+  if(size != static_cast<int>(acceptor_for_one.size())){
+    throw promod3::Error("Position and acceptor data are inconsistent for dssp calculation!");
+  }
+
+  if(size != static_cast<int>(acceptor_for_two.size())){
+    throw promod3::Error("Position and acceptor data are inconsistent for dssp calculation!");
+  }
+
+  if(size < 3){
+    throw promod3::Error("Size of input positions are too small!");
+  }
+
+  ss_assignment.assign(size,'C');
+
+  int bends[size];
+  int turn_3[size];
+  int turn_4[size];
+  int turn_5[size];
+  int para_bridge[size];
+  int antipara_bridge[size];
+  
+  memset(bends,0,size*sizeof(int));
+  memset(turn_3,0,size*sizeof(int));
+  memset(turn_4,0,size*sizeof(int));
+  memset(turn_5,0,size*sizeof(int));
+  memset(para_bridge,0,size*sizeof(int));
+  memset(antipara_bridge,0,size*sizeof(int));
+  
+  //let's first search for the bends, i.e. pieces with high curvature
+  Real angle;
+  for(int i = 2; i < size-2; ++i){
+    angle = geom::Angle(ca_positions[i]-ca_positions[i-2],
+                        ca_positions[i+2]-ca_positions[i]);
+    if(angle > 1.2217) bends[i] = 1;   
+  }
+  
+  //let's search for turns
+  int three = start_idx + 3;
+  int four = start_idx + 4;
+  int five = start_idx + 5;
+  for(int i = 0; i < size; ++i, ++three, ++four, ++five){
+    if(acceptor_for_one[i] == four) turn_4[i] = 1;
+    if(acceptor_for_one[i] == three) turn_3[i] = 1;
+    if(acceptor_for_one[i] == five) turn_5[i] = 1;
+    if(acceptor_for_two[i] == four) turn_4[i] = 1;
+    if(acceptor_for_two[i] == three) turn_3[i] = 1;
+    if(acceptor_for_two[i] == five) turn_5[i] = 1;
+  }
+
+  //let's search for antiparallel beta bridges
+  for(int i = 0; i < size; ++i){
+    if(acceptor_for_one[i] != -1){
+      if(acceptor_for_one[i] == donor_for_one[i]) antipara_bridge[i] = 1;
+      if(acceptor_for_one[i] == donor_for_two[i]) antipara_bridge[i] = 1;
+    }
+    if(acceptor_for_two[i] != -1){
+      if(acceptor_for_two[i] == donor_for_one[i]) antipara_bridge[i] = 1;
+      if(acceptor_for_two[i] == donor_for_two[i]) antipara_bridge[i] = 1;
+    }
+  }
+
+  for(int i = 1; i < size-1; ++i){
+    if(donor_for_one[i+1] != -1){
+      if(donor_for_one[i+1] + 2 == acceptor_for_one[i-1]) antipara_bridge[i] = 1;
+      if(donor_for_one[i+1] + 2 == acceptor_for_two[i-1]) antipara_bridge[i] = 1;
+    }
+
+    if(donor_for_two[i+1] != -1){
+      if(donor_for_two[i+1] + 2 == acceptor_for_one[i-1]) antipara_bridge[i] = 1;
+      if(donor_for_two[i+1] + 2 == acceptor_for_two[i-1]) antipara_bridge[i] = 1;
+    }
+  }
+
+  //let's search for parallel beta bridges
+  for(int i = 1; i < size-1; ++i){
+    if(acceptor_for_one[i-1] != -1){
+      if(acceptor_for_one[i-1] == donor_for_one[i+1]) para_bridge[i] = 1;
+      if(acceptor_for_one[i-1] == donor_for_two[i+1]) para_bridge[i] = 1;
+    }
+    if(acceptor_for_two[i-1] != -1){
+      if(acceptor_for_two[i-1] == donor_for_one[i+1]) para_bridge[i] = 1; 
+      if(acceptor_for_two[i-1] == donor_for_two[i+1]) para_bridge[i] = 1;      
+    } 
+  }
+
+  for(int i = 0; i < size; ++i){
+    if(donor_for_one[i] != -1){
+      if(donor_for_one[i] + 2 == acceptor_for_one[i]) para_bridge[i] = 1;
+      if(donor_for_one[i] + 2 == acceptor_for_two[i]) para_bridge[i] = 1;
+    }
+
+    if(donor_for_two[i] != -1){
+      if(donor_for_two[i] + 2 == acceptor_for_one[i]) para_bridge[i] = 1;
+      if(donor_for_two[i] + 2 == acceptor_for_two[i]) para_bridge[i] = 1;        
+    }
+  }
+
+  //priority according to the dssp paper is: H,B,E,G,I,T,S
+  //we therefore start to assign from lowest to highest priority,
+  //potentially overwriting low priority elements
+  
+  //do S
+  for(int i = 0; i < size; ++i){
+    if(bends[i]) ss_assignment[i] = 'S';
+  }
+
+  //do T
+  for(int i = 0; i < size - 2; ++i){
+    if(turn_3[i]){
+      ss_assignment[i+1] = 'T';
+      ss_assignment[i+2] = 'T';
+    }
+  }
+
+  for(int i = 0; i < size - 3; ++i){
+    if(turn_4[i]){
+      ss_assignment[i+1] = 'T';
+      ss_assignment[i+2] = 'T';
+      ss_assignment[i+3] = 'T';
+    }
+  }
+
+  for(int i = 0; i < size - 4; ++i){
+    if(turn_5[i]){
+      ss_assignment[i+1] = 'T';
+      ss_assignment[i+2] = 'T';
+      ss_assignment[i+3] = 'T';
+      ss_assignment[i+4] = 'T';
+    }
+  }
+
+  //let's do the helices... we use the bend arrays to fill helices
+  //and start with H, we then fill in G if there is no space occupied by H
+  //and finally I if there is nothing in that range occupied.
+  memset(bends,0,size*sizeof(int));
+  for(int i = 1; i < size-4; ++i){
+    if(turn_4[i-1] && turn_4[i]){
+      bends[i] = 1;
+      bends[i+1] = 1;
+      bends[i+2] = 1;
+      bends[i+3] = 1;
+    }  
+  }
+
+  int start;
+  int end;
+  for(int i = 1; i < size-3; ++i){
+    if(turn_3[i-1] && turn_3[i]){
+      start = i;
+      end = i+3;
+      //let's search how long it continues...
+      while(true && end < size){
+        if(turn_3[end-3] && turn_3[end-2]){
+          ++end;
+        }
+        else break;
+      }
+      //check, whether there already is something in this range
+      bool empty = true;
+      for(int j = start; j < end; ++j){
+        if(bends[j]){
+          empty = false;
+          break;
+        }
+      }
+      if(empty){
+        //let's fill!
+        for(int j = start; j < end; ++j){
+          bends[j] = 2;
+        }
+      }
+    }
+  }
+
+  for(int i = 1; i < size-5; ++i){
+    if(turn_5[i-1] && turn_5[i]){
+      start = i;
+      end = i+5;
+      //let's search how long it continues...
+      while(true && end < size){
+        if(turn_5[end-5] && turn_5[end-4]){
+          ++end;
+        }
+        else break;
+      }
+      //check, whether there already is something in this range
+      bool empty = true;
+      for(int j = start; j < end; ++j){
+        if(bends[j]){
+          empty = false;
+          break;
+        }
+      }
+      if(empty){
+        //let's fill!
+        for(int j = start; j < end; ++j){
+          bends[j] = 3;
+        }
+      }
+    }
+  }
+
+  //do I
+  for(int i = 0; i < size; ++i){
+    if(bends[i] == 3) ss_assignment[i] = 'I';
+  }
+
+  //do G
+  for(int i = 0; i < size; ++i){
+    if(bends[i] == 2) ss_assignment[i] = 'G';
+  }
+
+  //do E
+  if(para_bridge[0]){
+    if(para_bridge[1]) ss_assignment[0] = 'E';
+  }
+  if(antipara_bridge[0]){
+    if(antipara_bridge[1]) ss_assignment[0] = 'E';
+  }
+
+  for(int i = 1; i < size - 1; ++i){
+    if(para_bridge[i]){
+      if(para_bridge[i-1] || para_bridge[i+1]) ss_assignment[i] = 'E';
+    }
+    if(antipara_bridge[i]){
+      if(antipara_bridge[i-1] || antipara_bridge[i+1]) ss_assignment[i] = 'E';
+    }
+  }
+
+  if(para_bridge[size-1]){
+    if(para_bridge[size-2]) ss_assignment[size-1] = 'E';
+  }
+  if(antipara_bridge[size-1]){
+    if(antipara_bridge[size-2]) ss_assignment[size-1] = 'E';
+  }
+
+  //do B
+  if(para_bridge[0]){
+    if(!para_bridge[1]) ss_assignment[0] = 'B';
+  }
+  if(antipara_bridge[0]){
+    if(!antipara_bridge[1]) ss_assignment[0] = 'B';
+  }
+
+  for(int i = 1; i < size-1; ++i){
+    if(para_bridge[i]){
+      if(!(para_bridge[i-1] || para_bridge[i+1])) ss_assignment[i] = 'B';
+    }
+    if(antipara_bridge[i]){
+      if(!(antipara_bridge[i-1] ||antipara_bridge[i+1])) ss_assignment[i] = 'B';
+    }
+  }
+
+  if(para_bridge[size-1]){
+    if(!para_bridge[size-2]) ss_assignment[size-1] = 'B';
+  }
+  if(antipara_bridge[size-1]){
+    if(!antipara_bridge[size-2]) ss_assignment[size-1] = 'B';
+  }
+
+  //do H
+  for(int i = 0; i < size; ++i){
+    if(bends[i] == 1) ss_assignment[i] = 'H';
+  }
+}
+
+void EstimateSS(const BackboneList& bb_list, String& ss_assignment){
+
+  int size = bb_list.size();
+
+  if(size == 0){
+    throw promod3::Error("Cannot estimate SS with empty BackboneList!");
+  }
+
+  std::vector<int> donor_for_one(size,-1);
+  std::vector<int> donor_for_two(size,-1);
+  std::vector<int> acceptor_for_one(size,-1);
+  std::vector<int> acceptor_for_two(size,-1);
+  std::vector<Real> donor_one_energies(size,std::numeric_limits<Real>::max());
+  std::vector<Real> donor_two_energies(size,std::numeric_limits<Real>::max());
+  std::vector<Real> acceptor_one_energies(size,std::numeric_limits<Real>::max());
+  std::vector<Real> acceptor_two_energies(size,std::numeric_limits<Real>::max());
+  std::vector<geom::Vec3> ca_positions(size,geom::Vec3(0,0,0));
+  std::vector<geom::Vec3> h_positions(size,geom::Vec3(0,0,0));
+
+  //first residue is expected not to be an hbond donor,
+  //we don't do anything for the first h_position...
+  ca_positions[0] = bb_list[0].ca_coord;
+
+  geom::Vec3 co_vec;
+  for(int i = 1; i < size; ++i){
+  	ca_positions[i] = bb_list[i].ca_coord;
+    co_vec = geom::Normalize(bb_list[i-1].o_coord - bb_list[i-1].c_coord);
+    h_positions[i] = bb_list[i].n_coord - co_vec; 
+  }
+
+  Real e;
+  for(int i = 0; i < size-3; ++i){
+    for(int j = i+3; j < size; ++j){
+      if(geom::Length2(ca_positions[i]-ca_positions[j]) < 81.0){
+        //i as acceptor ; j as donor
+        if(bb_list[j].one_letter_code != 'P'){
+          e = DSSPHBondEnergy(h_positions[j],bb_list[j].n_coord,
+                              bb_list[i].c_coord,bb_list[i].o_coord);
+
+          if(e < -0.5){
+            //it is an hbond... let's see, whether it is the best for i as acceptor
+            if(e < acceptor_two_energies[i]){
+              if(e < acceptor_one_energies[i]){
+                acceptor_two_energies[i] = acceptor_one_energies[i];
+                acceptor_for_two[i] = acceptor_for_one[i];
+                acceptor_one_energies[i] = e;
+                acceptor_for_one[i] = j;
+              }
+              else{
+                acceptor_two_energies[i] = e;
+                acceptor_for_two[i] = j;
+              }
+            }
+
+            //let's see, whether it is the best for j as donor
+            if(e < donor_two_energies[j]){
+              if(e < donor_one_energies[j]){
+                donor_two_energies[j] = donor_one_energies[j];
+                donor_for_two[j] = donor_for_one[j];
+                donor_one_energies[j] = e;
+                donor_for_one[j] = i;
+              }
+              else{
+                donor_two_energies[j] = e;
+                donor_for_two[j] = i;
+              }              
+            }             
+          }
+        }
+
+        //i as donor, j as acceptor
+        // note, that the first residue is not considered for donor
+        // and last element not as acceptor
+        if(bb_list[i].one_letter_code != 'P' && i > 0 && j < size-1){
+
+          e = DSSPHBondEnergy(h_positions[i],bb_list[i].n_coord,
+                              bb_list[j].c_coord,bb_list[j].o_coord);
+
+          if(e < -0.5){
+            //it is an hbond... let's see, whether it is the best for i as donor
+            if(e < donor_two_energies[i]){
+              if(e < donor_one_energies[i]){
+                donor_two_energies[i] = donor_one_energies[i];
+                donor_for_two[i] = donor_for_one[i];
+                donor_one_energies[i] = e;
+                donor_for_one[i] = j;
+              }
+              else{
+                donor_two_energies[i] = e;
+                donor_for_two[i] = j;
+              }
+            }
+
+            //let's see, whether it is the best for j as acceptor
+            if(e < acceptor_two_energies[j]){
+              if(e < acceptor_one_energies[j]){
+                acceptor_two_energies[j] = acceptor_one_energies[j];
+                acceptor_for_two[j] = acceptor_for_one[j];
+                acceptor_one_energies[j] = e;
+                acceptor_for_one[j] = i;
+              }
+              else{
+                acceptor_two_energies[j] = e;
+                acceptor_for_two[j] = i;
+              }              
+            }             
+          }
+        }
+      }
+    }
+  }
+
+  RawEstimateSS(ca_positions, 0, donor_for_one, donor_for_two, 
+                acceptor_for_one, acceptor_for_two, ss_assignment);
+}
+
+}} //ns 
diff --git a/loop/src/sec_struct.hh b/loop/src/sec_struct.hh
new file mode 100644
index 0000000000000000000000000000000000000000..b808265bfe6869c5c0dbaa8ec8d88499512f2448
--- /dev/null
+++ b/loop/src/sec_struct.hh
@@ -0,0 +1,63 @@
+#ifndef PROMOD_LOOP_SEC_STRUCT_HH
+#define PROMOD_LOOP_SEC_STRUCT_HH
+
+#include <promod3/loop/backbone.hh>
+#include <algorithm>
+#include <limits>
+#include <math.h>
+
+namespace promod3 { namespace loop {
+
+inline Real DSSPHBondEnergy(const geom::Vec3& h_pos, const geom::Vec3& n_pos,
+                            const geom::Vec3& c_pos, const geom::Vec3& o_pos){
+  Real on = 1.0/geom::Distance(o_pos,n_pos);
+  Real ch = 1.0/geom::Distance(c_pos,h_pos);
+  Real oh = 1.0/geom::Distance(o_pos,h_pos);
+  Real cn = 1.0/geom::Distance(c_pos,n_pos);
+  return 27.888 * (on+ch-oh-cn);
+}
+
+//Raw estimation of secondary structure
+//
+// This function is not intended for Python export, since the
+// input has to be prepared carefully. It basically estimates
+// the secondary structure based on the hydrogen pattern as
+// described for the dssp tool. Some simplifications lead to
+// same estimation for roughly 98-99 % of the residues.
+// Please note, that there is absolutely no handling of chain
+// breaks!
+//
+// The idea is, that secondary structure estimation can be performed
+// for a small stretch in the environment of a full structure.
+// ca_positions contains the CA-positions of this stretch.
+// Every residue is considered to serve as donor/acceptor 
+// for two other residues (note, that Proline cannot be a donor,
+// you have to consider that in the input data!!). 
+// This acceptor/donor information is
+// given in the other four vectors. donor_for_one[i] means,
+// that residue i of the stretch is donor for the corresponding
+// entry, where a value of -1 means that i is NOT a donor at all.
+// The entry indices are based on the residue index in
+// the full structure. For the proper positioning of the stretch 
+// in the full structure, the parameter start_idx is used.
+//
+//
+// Some points to consider when preparing the input data:
+// Only check for hbonds of residue i beginning at i+3
+// => at least 3 residue apart... Only consider HBonds 
+// with DSSPHBondEnergy < -0.5
+
+
+void RawEstimateSS(const std::vector<geom::Vec3>& ca_positions, 
+	                 int start_idx,
+	                 const std::vector<int>& donor_for_one,
+                   const std::vector<int>& donor_for_two, 
+	                 const std::vector<int>& acceptor_for_one,
+                   const std::vector<int>& acceptor_for_two,
+  	               String& ss_assignment);
+
+void EstimateSS(const BackboneList& bb_list, String& ss_assignment);
+
+}} //ns
+
+#endif
diff --git a/loop/src/sidechain.cc b/loop/src/sidechain.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fc7982bc5a51acda0af9ebcd3119bc1e752100bb
--- /dev/null
+++ b/loop/src/sidechain.cc
@@ -0,0 +1,16 @@
+#include <promod3/loop/sidechain.hh>
+
+namespace promod3 { namespace loop {
+
+
+Sidechain::Sidechain(uint num_heavy_atoms, uint num_hydrogens){
+  heavy_atom_positions_ = new geom::Vec3[num_heavy_atoms];
+  hydrogen_positions_ = new geom::Vec3[num_hydrogens];
+}
+
+Sidechain::~Sidechain(){
+  delete [] heavy_atom_positions_;
+  delete [] hydrogen_positions_;
+}
+
+}} //ns
diff --git a/loop/src/sidechain.hh b/loop/src/sidechain.hh
new file mode 100644
index 0000000000000000000000000000000000000000..7a63b37196210d02f2b4b4f24667e19cf2075b7b
--- /dev/null
+++ b/loop/src/sidechain.hh
@@ -0,0 +1,44 @@
+#ifndef PROMOD_LOOP_SIDECHAIN_HH
+#define PROMOD_LOOP_SIDECHAIN_HH
+
+#include <boost/shared_ptr.hpp>
+
+#include <promod3/sidechain/rotamer.hh>
+#include <promod3/sidechain/frame.hh>
+#include <promod3/loop/backbone.hh>
+
+
+
+namespace promod3 { namespace loop {
+
+class Sidechain;
+typedef boost::shared_ptr<Sidechain> SidechainPtr;
+
+class Sidechain{
+
+public:
+
+  Sidechain(uint num_heavy_atoms, uint num_hydrogens);
+
+  virtual ~Sidechain();
+
+  virtual void FillPositions(const promod3::sidechain::RRMRotamer& rot) = 0;
+
+  virtual void FillPositions(const promod3::sidechain::FRMRotamer& rot) = 0;
+
+  virtual void FillPositions(const promod3::sidechain::FrameResidue& frame_res) = 0;
+
+  virtual void FillPositions(const ost::mol::ResidueHandle& res) = 0;
+
+  virtual void ConstructHydrogens(const Backbone& bb) = 0;
+
+  virtual void SetResiduePositions(const ost::mol::ResidueHandle& res) = 0;
+
+protected:
+  geom::Vec3* heavy_atom_positions_;
+  geom::Vec3* hydrogen_positions_;
+};
+
+}} //ns
+
+#endif
diff --git a/loop/src/structure_db.cc b/loop/src/structure_db.cc
index 8a63ffd5dd2423415ec077a159754d7f0ecc7246..a136e90e1dfbdbb1efbdc563986fa5ba8b3f5e43 100644
--- a/loop/src/structure_db.cc
+++ b/loop/src/structure_db.cc
@@ -808,9 +808,7 @@ ost::seq::HMMPtr StructureDB::GenerateStructureProfile(const BackboneList& bb_li
   Real frequencies[20];
   for(uint i = 0; i < bb_list_size; ++i){
     //sum up a value of one for every position
-    //std::cerr<<"look at new column "<<i<<std::endl;
     memset(frequencies,0,sizeof(Real)*20);
-    //std::cerr<<"number of letters: "<<close_sequences[i].size()<<std::endl;
     for(uint j = 0; j < close_sequences[i].size(); ++j){
       int idx = ost::seq::HMMColumn::GetIndex(close_sequences[i][j]);
       if(idx != -1) frequencies[idx] += 1.0;
@@ -827,9 +825,7 @@ ost::seq::HMMPtr StructureDB::GenerateStructureProfile(const BackboneList& bb_li
     ost::seq::HMMColumn actual_col;
     actual_col.SetOneLetterCode(bb_list[i].one_letter_code);
     Real* hmm_col_data = actual_col.freqs_begin();
-    //std::cerr<<"final frequencies: "<<std::endl;
     for(uint j = 0; j < 20; ++j){
-      //std::cerr<<j<<" "<<frequencies[j]<<std::endl;
       hmm_col_data[j] = frequencies[j];
     }
     return_hmm->push_back(actual_col);
diff --git a/loop/tests/CMakeLists.txt b/loop/tests/CMakeLists.txt
index 846838f7fa9152dab8ef6b36ef9bc5ae0265b996..7b2d6138caabe9acb69af2ae3e6dd3ef2b989aaf 100644
--- a/loop/tests/CMakeLists.txt
+++ b/loop/tests/CMakeLists.txt
@@ -3,12 +3,16 @@ set(LOOP_UNIT_TESTS
   test_torsion_sampler.cc
   test_loop_closing.cc
   test_loop_score.cc
+  test_psipred_prediction.cc
+  test_ss_assignment.cc
   tests.cc
 )
 
 set(LOOP_TEST_DATA
   data/4nyk.pdb
   data/3DEFA.pdb
+  data/1akyA.horiz
+  data/1A88A.hhm
 )
 
 promod3_unittest(MODULE loop
diff --git a/loop/tests/data/1A88A.hhm b/loop/tests/data/1A88A.hhm
new file mode 100644
index 0000000000000000000000000000000000000000..eb3dc68c20708835ecc19322b6cf46e9bb1066e3
--- /dev/null
+++ b/loop/tests/data/1A88A.hhm
@@ -0,0 +1,869 @@
+HHsearch 1.5
+NAME  9ec8ef8344f0798f4d5e69635f049d78
+FAM   
+FILE  9ec8ef8344f0798f4d5e69635f049d78
+COM   /import/bc2/soft/app/hhsuite/2.0.16/Linux/bin/hhmake -i <118 characters> -o <118 characters> 
+DATE  Fri Sep  6 18:12:11 2013
+LENG  275 match states, 275 columns in multiple alignment
+FILT  141 out of 1335 sequences passed filter (-id 90 -cov 0 -qid 0 -qsc -20.00 -diff 100)
+NEFF  11.1
+SEQ
+>ss_pred PSIPRED predicted secondary structure
+CEEEECCCCEEEEEEECCCCCCEEEEECCCCCCHHHHHHHHHHHHHCCCEEEEECCCCCCCCCCCCCCCCHHHHHHHHHHHHHHCCCCCEEEEEECHHHH
+HHHHHHHHCCHHHCCEEEEECCCCCCCCCCCCCCCCCCHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCCCCCCHHHHHHHHHHHHHHHHHHHHHHHHHHH
+HHHCCCHHHHHHHCCCCEEEEEECCCCCCCHHHHHHHHHHHCCCCEEEEECCCCCCHHHHCHHHHHHHHHHHHHC
+>ss_conf PSIPRED confidence values
+9599149928999981588998699989999977799999999986898899966899899999988899999999999999981999869999888899
+9999998638011138999878761000133354323278999999998764899998631211110134310102789999999863110688999999
+751012677885389998999958998669899999999848998899989998644552999999999999849
+>Consensus
+xxxxxxxgxxlxxxxxgxxxxxxivllHGxxxxxxxxxxxxxxlxxxxxxvxxxDxxGxGxSxxxxxxxxxxxxxxdlxxxlxxlxxxxxxlvGhSxGgx
+xxxxxxaxxxxxxixxlvlxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxlxxixxPxlxixgxxDxxxxxxxxxxxxxxxxxxxxxxxxxxxgHxxxxxxxxxxxxxixxflxx
+>9ec8ef8344f0798f4d5e69635f049d78
+GTVTTSDGTNIFYKDWGPRDGLPVVFHHGWPLSADDWDNQMLFFLSHGYRVIAHDRRGHGRSDQPSTGHDMDTYAADVAALTEALDLRGAVHIGHSTGGG
+EVARYVARAEPGRVAKAVLVSAVPPVMVKSDTNPDGLPLEVFDEFRAALAANRAQFYIDVPSGPFYGFNREGATVSQGLIDHWWLQGMMGAANAHYECIA
+AFSETDFTDDLKRIDVPVLVAHGTDDQVVPYADAAPKSAELLANATLKSYEGLPHGMLSTHPEVLNPDLLAFVKS
+>gi|68171462|ref|ZP_00544849.1| Alpha/beta hydrolase fold [Ehrlichia chaffeensis str. Sapulpa]gi|88658364|ref|YP_507044.1| putative hydrolase [Ehrlichia chaffeensis str. Arkansas]gi|67999123|gb|EAM85786.1| Alpha/beta hydrolase fold [Ehrlichia chaffeensis str. Sapulpa]gi|88599821|gb|ABD45290.1| putative hydrolase [Ehrlichia chaffeensis str. Arkansas]
+-LNISHLQeKFIMHYNYTnSPSSNYLICVHGITRNSRDFDYLANILS-SDYKIICPDIVGRGKSSWLEDySlYNYLTYCKSIIYLLKHLKIDKVDFLGTS
+MGGIIGMYLAAYFP-NLINKLIINDIG----------PA-IKVSALEKISKHINinpifNTIteaEIYIKKLLC-NF-S-IDQEDHWQHIIKHSIIQNPN
+-KTYSLAVDPkigiafNKEINCIKdtdawtIWDIWEKIQSRILVIRGSLSNILTKTTL-NKMLLSKQYIDFIEYPNIGHAPALMSNNQIQD-IRNWLL-
+>gi|254240840|ref|ZP_04934162.1| hypothetical protein PA2G_01514 [Pseudomonas aeruginosa 2192]gi|126194218|gb|EAZ58281.1| hypothetical protein PA2G_01514 [Pseudomonas aeruginosa 2192]
+--------------------------------------------LPAWLAVRPVELPGRGARMAEPLQTDLASLAQQLARELHDEVrQGPYAMLGHSLGA
+LlacEVLYALRELGCPTPLGFFACGTAAP-SRRAEY-DRG-FAEP---------KSDAELIADLR--------DLQGTPEEVLGNRELMSLTLPILRADF
+LLCGSYRHQ----RRPPLACPIRTLGGRED-KASEEQLLAWAEETRSGFGLELFDGG-HFFIHQREAEVLAVVE-----
+>gi|302776726|ref|XP_002971512.1| hypothetical protein SELMODRAFT_172238 [Selaginella moellendorffii]gi|300160644|gb|EFJ27261.1| hypothetical protein SELMODRAFT_172238 [Selaginella moellendorffii]
+-------------------------------------KYLVSRVRNIGWHTVVFNSRGCSdspvTSPKFYSASFTEDLRQVVRFVAYRFPESRIYAVGWS
+LGANILVRYLGQ--EGEnciLSGAVSLCNPFDLVVADEDFRKGFNNiydkSLATSLRTIFRKHA--ALFEEIGG---EYNIPLAANAKTVRqfDEGLTRV
+SFGYRSVD----EYYADASSSKSIEHVKVPLFCIQAANDPIAP---------------------------------------------
+#
+NULL   3706	5728	4211	4064	4839	3729	4763	4308	4069	3323	5509	4640	4464	4937	4285	4423	3815	3783	6325	4665	
+HMM    A	C	D	E	F	G	H	I	K	L	M	N	P	Q	R	S	T	V	W	Y	
+       M->M	M->I	M->D	I->M	I->I	D->M	D->D	Neff	Neff_I	Neff_D
+       0	*	*	0	*	0	*	*	*	*	
+G 1    *	*	*	*	*	996	*	*	*	*	1972	*	*	*	*	2037	*	*	*	*	1
+       0	*	*	*	*	*	*	2838	0	0	
+
+T 2    *	*	*	4056	2327	*	3938	4866	4909	4125	*	*	5124	5031	4063	3499	3185	*	*	2102	2
+       0	*	*	*	*	*	*	8843	0	0	
+
+V 3    4516	*	*	*	2079	*	4638	2746	5558	2395	*	*	*	5598	4583	5711	5415	3414	4653	3634	3
+       31	5572	*	0	*	*	*	9738	1000	0	
+
+T 4    4266	5829	4140	3808	4129	*	4958	4342	3207	3808	4854	5787	4700	5006	4810	3598	3075	3246	*	5689	4
+       0	*	*	*	*	*	*	9990	0	0	
+
+T 5    4422	*	4539	3793	5000	5201	5971	4250	4012	3393	5911	4082	5927	*	*	2983	2021	4411	*	4567	5
+       88	5975	4521	1000	1000	*	*	10168	1001	0	
+
+S 6    3445	5077	5977	4405	4547	4332	4952	*	4124	4192	6128	3516	3157	6066	4448	2532	5050	4017	6285	5235	6
+       66	5049	6080	1575	590	602	1552	10235	1197	1351	
+
+D 7    3610	*	1385	5187	6206	3282	*	*	5130	*	*	3046	4664	3438	4669	4757	5547	*	*	6324	7
+       39	6171	6274	0	*	969	1032	10301	1023	1190	
+
+G 8    5073	*	4335	4295	*	865	5280	*	4941	5475	6222	4347	5459	6494	5279	3672	5248	6271	*	*	8
+       104	4046	6755	1700	530	1022	979	10424	1672	1176	
+
+T 9    4066	4947	4822	4456	4942	4082	4392	4837	4777	2700	4800	6361	6500	4834	3924	5323	4201	2707	6593	4073	9
+       108	5395	4373	1224	806	1096	910	10560	1187	1160	
+
+N 10   6685	*	3739	3811	6229	5536	6484	5478	2895	3902	6497	3684	4800	4763	2764	3491	3273	3972	*	6738	10
+       74	4605	6774	2429	296	810	1219	10607	1710	1721	
+
+I 11   *	*	*	*	4611	*	5003	2159	*	1346	4480	*	6531	5624	*	5596	4253	2918	6620	5708	11
+       44	5662	6559	1613	571	1433	667	10709	1170	1386	
+
+F 12   3223	6690	5669	5641	3443	4945	2361	6623	4694	6638	*	5366	6299	6637	3245	3348	3785	5006	6437	3325	12
+       52	4807	*	384	2098	1541	608	10737	1449	1363	
+
+Y 13   4015	5630	5477	*	3374	4169	5607	5215	*	4239	6410	5702	*	6319	*	5442	6665	3159	3755	1393	13
+       82	4877	5548	1239	795	*	0	10778	1404	1176	
+
+K 14   4273	*	5579	3099	5065	5218	4255	4220	4159	4993	5347	5490	5414	3706	2911	4928	3679	3965	5006	3746	14
+       47	6446	5607	0	*	941	1062	10728	1025	1561	
+
+D 15   6707	5460	3273	2263	6849	5535	5679	3558	4921	4199	*	5635	4978	5677	3394	4643	3496	3239	5539	6482	15
+       142	4264	4593	1675	542	417	1995	10737	2053	1552	
+
+W 16   3919	6487	6448	4975	3382	3961	4230	3215	4644	3732	*	5606	5503	5661	4926	3974	5497	6629	2579	3562	16
+       129	4530	4555	2450	292	311	2368	10768	1574	1743	
+
+G 17   3576	*	4635	4904	6773	880	6634	4903	4173	*	*	5536	4567	6623	4673	4866	5621	6410	6421	*	17
+       759	3608	1611	587	1582	740	1317	10782	2202	1725	
+
+P 18   4574	*	2895	4574	*	5301	*	5013	3745	5069	*	4140	1672	6136	4723	3516	3590	5166	*	*	18
+       302	3105	3787	711	1362	5145	41	10306	2283	5728	
+
+R 19   2721	*	3384	3508	*	3974	*	*	3072	5140	*	4467	2420	5099	4548	3092	6047	5844	*	*	19
+       289	3023	4101	1845	471	71	4371	10259	2256	6140	
+
+D 20   3679	*	4182	3090	*	4035	4767	*	3257	5881	6647	2804	3922	4464	4109	2718	6852	4663	7034	*	20
+       149	3636	5823	1615	570	635	1490	10974	2393	1854	
+
+G 21   3804	6680	3259	5876	7002	1881	5654	*	3450	4395	*	5202	3695	4731	3954	3352	5985	4688	*	*	21
+       181	3189	6890	807	1222	495	1784	11056	2927	1534	
+
+L 22   3910	6765	4866	3638	5903	4767	6987	4505	3209	5469	6905	5279	1832	4238	3216	5435	4902	4897	6980	*	22
+       166	3306	7013	1008	992	910	1096	11157	3113	1210	
+
+P 23   3549	*	5936	*	7008	3534	5942	6781	4186	4011	5419	5061	1812	*	*	4635	2928	3071	6884	5337	23
+       132	3513	*	797	1236	0	*	11261	2733	1168	
+
+V 24   4471	6879	6823	*	6890	*	7047	1819	*	1919	4416	7409	*	*	6946	*	6899	1715	*	*	24
+       20	6216	*	612	1533	*	*	11297	1203	0	
+
+V 25   5443	7029	*	*	4795	*	*	2298	*	1673	4710	*	*	6810	*	*	*	1464	*	7161	25
+       0	*	*	*	*	*	0	11287	0	1019	
+
+F 26   6911	4636	*	*	2015	*	6807	3524	*	1414	3645	*	*	*	*	*	*	3319	7019	4477	26
+       0	*	*	*	*	0	*	11287	0	1019	
+
+H 27   4299	5421	*	*	4779	5554	6110	2286	*	1595	4509	6947	7159	6812	*	4940	5260	2515	6862	7054	27
+       10	*	7130	*	*	*	*	11297	0	0	
+
+H 28   6844	*	*	*	*	5108	446	6812	*	*	6951	5113	3201	7311	*	4741	5954	6154	*	*	28
+       10	*	7224	*	*	0	*	11291	0	1000	
+
+G 29   4022	*	4802	6063	*	346	6895	*	*	6848	*	6892	5414	*	7257	4749	6905	*	*	*	29
+       47	7272	5278	1000	1000	*	0	11289	1000	1000	
+
+W 30   3552	*	7020	6845	2622	3195	6843	4722	*	2356	6762	4648	6863	6824	6980	5844	4243	5159	3085	3408	30
+       55	7020	5087	0	*	1425	672	11246	1155	1766	
+
+P 31   4181	6739	5776	5928	6079	1903	6065	*	*	3433	4106	5416	2298	5753	6064	4212	3894	*	4170	5968	31
+       74	5925	4905	542	1676	784	1255	11215	1202	2151	
+
+L 32   4393	5366	3487	3871	6783	2196	4933	*	*	3649	5020	5296	5877	4762	6111	2956	3963	3951	5442	5292	32
+       12	6873	*	1000	1000	2815	221	11210	1000	2136	
+
+S 33   4704	5904	2735	5938	6964	3378	3521	5844	*	6794	6826	3224	4970	4991	5406	2480	3031	6148	6929	4872	33
+       11	7089	*	0	*	1504	627	11220	1000	1958	
+
+A 34   2649	5953	5316	7120	4866	3031	5957	4175	4199	5447	5388	5079	4150	4754	4501	2248	4194	*	5410	7154	34
+       44	6083	6015	769	1275	391	2074	11254	1395	1567	
+
+D 35   3428	6979	3339	3578	5393	3985	4294	5438	5006	5102	*	3864	5913	4959	3245	3677	4470	5918	3520	4462	35
+       31	5997	7402	627	1504	*	0	11285	1175	1343	
+
+D 36   3732	4740	3587	3907	4639	5558	4365	4477	6034	4028	3332	5003	6204	5353	4085	2897	4415	4171	7003	4870	36
+       94	4170	6999	890	1119	990	1010	11277	2259	1516	
+
+W 37   6002	*	6815	7035	2290	7082	7191	6089	*	4054	5077	5394	*	6004	6018	5814	*	5454	1414	2522	37
+       44	6084	6006	1318	740	965	1036	11269	1186	1529	
+
+D 38   3866	*	3137	3437	5345	5440	4947	*	3843	4086	5394	3889	6881	3925	2887	3790	3741	5541	6049	4952	38
+       45	5913	6142	576	1602	999	1001	11275	1200	1512	
+
+N 39   3254	*	3962	4018	4418	4769	4055	5933	3824	4421	7129	3575	2337	4681	4270	4892	4895	7138	*	4723	39
+       95	6022	4371	2138	372	416	1997	11281	1349	1529	
+
+Q 40   4074	5381	*	6024	4345	*	5117	3542	5311	2433	4741	4596	4610	3170	6042	5837	4160	2742	6901	4330	40
+       45	5030	*	1637	559	482	1817	11241	1553	2071	
+
+M 41   1908	6155	*	5874	3692	4742	6902	2953	*	3265	4027	*	5028	5419	6091	6073	5407	2743	5614	6964	41
+       47	6823	5419	2585	263	0	*	11296	1045	1183	
+
+L 42   4124	*	3627	2872	5479	6733	6718	4882	3774	3542	*	5015	2929	3889	3718	3743	5343	4475	5980	5319	42
+       22	6040	*	2431	296	553	1652	11280	1178	1370	
+
+F 43   3833	7136	4307	4228	3898	5097	4960	5905	4626	3262	5091	4291	4356	5996	3459	3978	4468	4564	6019	2980	43
+       58	4942	7188	612	1531	*	0	11304	1572	1000	
+
+F 44   4346	*	*	5476	2659	5941	6103	3404	6839	955	7036	7240	5846	6954	7196	7333	6045	4755	*	6026	44
+       109	5103	4515	1147	867	1044	958	11300	1512	1159	
+
+L 45   1964	6780	4652	4778	6159	4381	4687	6027	3895	2620	*	4660	*	5626	4416	3054	4763	5184	6107	7279	45
+       128	5580	3966	2180	360	223	2804	11357	1352	2017	
+
+S 46   2954	*	3646	3037	*	4432	*	6969	2571	5361	7199	4386	5033	3003	3268	4265	5252	5957	*	6139	46
+       119	4810	4529	1426	671	137	3463	11290	1816	2550	
+
+H 47   3468	6866	4074	3521	5864	5056	3752	6813	3216	4729	5529	3885	5458	3317	2624	5157	5368	6054	7393	5011	47
+       239	5659	2910	1249	788	0	*	11344	1572	1990	
+
+G 48   5764	*	3254	4215	7005	1264	4410	5316	3456	5202	6946	3854	5794	*	3885	5980	5548	*	*	6936	48
+       84	4942	5392	1456	654	0	*	11263	1618	3653	
+
+Y 49   7059	5438	*	*	2201	6011	3517	2984	*	5436	6915	6103	6994	6838	4898	4796	5182	5232	4370	1795	49
+       21	6136	*	561	1634	0	*	11370	1179	1362	
+
+R 50   4166	7294	3640	3937	*	6962	3077	5161	3631	*	7232	3669	3956	5673	2156	4359	4557	4333	7059	6037	50
+       18	6347	*	1764	503	*	*	11384	1185	0	
+
+V 51   3957	3185	*	*	4792	7226	6191	3095	6909	3419	7040	*	7035	*	7172	6017	4170	1171	*	6255	51
+       10	*	7131	*	*	*	*	11384	0	0	
+
+I 52   4727	*	7215	6243	3240	*	5957	2025	*	2690	7130	*	*	7396	7249	6891	5464	2271	6188	2755	52
+       26	6512	7233	1320	738	0	*	11382	1149	1014	
+
+A 53   1807	4064	*	*	5052	3915	7245	4224	*	3263	5132	7138	6264	5995	4270	3684	4093	3024	*	5788	53
+       0	*	*	*	*	*	0	11376	0	1008	
+
+H 54   5459	7095	7613	*	2795	5945	4800	2858	*	3003	6151	*	2225	*	*	*	7152	2877	4835	3325	54
+       19	7397	7087	0	*	*	0	11376	1007	1008	
+
+D 55   5613	7151	731	3489	6919	7387	6976	*	7164	7386	*	3533	6001	5626	7143	3919	5219	6898	7123	6945	55
+       41	5471	7477	2740	234	1041	960	11362	1423	1192	
+
+R 56   4799	5889	7477	5484	4090	6867	3711	4626	7143	1611	3938	4714	5542	4477	3705	5593	*	6264	4538	3692	56
+       0	*	*	*	*	*	0	11368	0	1186	
+
+R 57   4044	6920	7119	5609	5580	7181	6979	4420	5921	3773	7163	6904	1644	*	1676	4608	6139	7171	*	5575	57
+       56	5801	5616	770	1274	1065	937	11368	1532	1186	
+
+G 58   5245	7109	5550	6230	6120	434	5536	7085	6032	6010	*	4611	6210	6971	7011	4952	*	*	*	6065	58
+       30	6100	7441	973	1027	*	0	11360	1205	1515	
+
+H 59   4888	3894	6839	5222	2351	7120	1830	6038	7054	5159	5520	5985	*	4937	4339	6894	5137	5415	6856	2839	59
+       0	*	*	*	*	*	0	11356	0	1686	
+
+G 60   5171	7127	5280	5437	6839	388	5515	*	7184	6185	*	*	6990	7143	6004	4725	6323	7252	*	6198	60
+       75	5091	5553	1140	872	*	0	11356	1640	1686	
+
+R 61   4726	*	3787	3604	5090	3304	4698	5922	2986	3453	6857	3933	6007	4255	2989	4797	4411	*	7197	4425	61
+       78	4729	6089	1695	533	1531	613	11311	2144	2423	
+
+S 62   5532	4765	4439	5966	*	*	*	*	5198	5623	*	4932	4675	6743	4560	739	3449	6817	*	6836	62
+       98	5071	4803	1010	990	2053	398	11326	1559	2236	
+
+D 63   3868	7076	2406	3456	7151	4231	*	5029	4003	4325	5490	5917	3752	5082	3858	2706	4517	5315	*	7035	63
+       88	4280	7022	1582	586	2011	412	11255	2061	2926	
+
+Q 64   4659	*	4074	4216	7062	3112	4129	6798	3010	3949	5308	4697	3710	4556	3198	4381	4387	4084	7183	5994	64
+       177	3686	4721	1519	619	2514	278	11292	2835	2588	
+
+P 65   3692	6905	3558	3874	6970	4916	5899	4694	6042	4391	6071	4731	1940	4241	4591	3934	4048	4574	5890	6699	65
+       173	3465	5462	1796	490	1396	690	11229	2798	3067	
+
+S 66   3834	5929	3879	4535	4971	5856	5386	5866	3580	3399	6030	3933	3527	5072	3572	3190	5001	4458	5138	4729	66
+       192	3404	5041	1562	596	747	1307	11270	2943	2737	
+
+T 67   3793	7028	4081	3511	5353	3590	5147	4704	4704	4080	5897	4011	3305	4100	3306	3894	4787	4505	*	6070	67
+       225	2790	*	886	1124	2163	365	11254	4038	2358	
+
+G 68   3434	5134	3385	3858	5525	2330	4508	5540	4460	6089	*	4835	4257	4398	4704	3383	4433	5065	*	5445	68
+       145	3500	7093	1237	797	1053	949	11264	2928	2344	
+
+H 69   4919	5096	4553	4534	4480	4029	3731	4724	4277	3602	5364	3994	5447	4763	4431	4140	4578	5036	5992	2636	69
+       84	4148	*	1988	419	2380	308	11298	2296	1798	
+
+D 70   5341	6013	2863	4377	6775	4345	4225	6141	5039	4542	7069	3301	4944	4989	4331	2478	2795	6968	7130	6184	70
+       62	5073	6328	1319	739	2212	351	11309	1587	1615	
+
+M 71   4057	6910	6075	6193	2878	7233	5386	2691	6949	2408	3732	7011	3787	6102	5440	7060	4032	3811	5473	5070	71
+       30	7023	6280	0	*	1268	774	11308	1219	1784	
+
+D 72   3361	6903	2432	3116	*	4556	5964	6029	4106	4099	6136	4785	4100	5438	4269	3374	4054	5390	4991	7006	72
+       23	6000	*	563	1630	1383	698	11322	1182	1756	
+
+T 73   3693	6273	2387	3336	4781	3979	4125	5117	5471	4294	5602	5473	6752	4803	3714	4189	3568	5258	6980	5474	73
+       47	5883	6064	584	1587	553	1651	11335	1224	1403	
+
+Y 74   4525	5503	*	5071	4116	*	3944	3814	*	2810	3284	*	6068	4131	5131	5286	5515	3518	3469	2834	74
+       20	6187	*	2209	352	*	0	11341	1166	1441	
+
+A 75   1579	5428	5651	4824	7202	6099	6066	3402	7083	4493	5069	5427	4856	6943	5949	4240	4548	2514	6103	7171	75
+       9	7309	*	0	*	0	*	11341	1000	1441	
+
+A 76   3085	*	2707	2438	*	6072	5164	*	3858	5508	6944	4547	7071	3531	3322	3211	4810	5484	*	*	76
+       40	5190	*	287	2469	0	*	11381	1570	1000	
+
+D 77   3145	5506	1176	3655	5301	*	7352	5696	5657	4716	*	5552	5921	3843	7401	4786	*	4180	7185	5465	77
+       30	7209	6192	2000	415	*	*	11384	1001	0	
+
+V 78   3811	*	*	*	6277	*	*	1883	*	1607	6885	*	*	7088	*	6194	4338	2315	6028	5561	78
+       0	*	*	*	*	*	0	11356	0	1164	
+
+A 79   2719	5552	3981	3589	6060	5287	4184	3495	3519	3519	7482	4763	*	4406	3700	3993	5892	4488	6933	5462	79
+       9	7352	*	0	*	*	0	11356	1000	1164	
+
+A 80   2263	6023	3589	2606	4833	4740	6090	5998	4579	5215	7035	4209	*	3874	4321	4213	3910	4358	*	6941	80
+       8	*	7456	*	*	0	*	11356	0	1164	
+
+L 81   2728	*	7180	7067	2710	4682	*	2885	7307	1815	4867	6867	*	6886	6955	7150	6200	3321	6051	5519	81
+       0	*	*	0	*	0	*	11381	1000	1000	
+
+T 82   4153	5515	7241	*	5632	*	*	2175	6061	1701	3437	6220	*	*	4611	7016	5723	2677	*	5542	82
+       55	5007	7311	313	2357	*	*	11384	1583	0	
+
+E 83   3756	*	2401	2744	*	6088	*	6893	3341	5135	7132	3837	7157	3281	3246	4564	3474	*	*	6337	83
+       9	7283	*	0	*	895	1113	11355	1145	1181	
+
+A 84   2758	7232	4612	3641	4137	5460	3513	4800	3810	4800	*	7304	*	3658	3935	4278	3766	4284	5588	3919	84
+       87	4734	5586	2003	414	*	0	11381	1778	1000	
+
+L 85   3932	6969	*	5637	4343	6854	5414	3323	7175	1312	5047	6809	*	4465	5600	5479	4613	3384	7499	4453	85
+       151	3443	7062	1965	427	912	1094	11339	3263	1540	
+
+D 86   4158	7044	2963	3932	*	1881	5454	5966	3631	4745	6194	3634	7151	4496	3811	4151	5787	5435	*	*	86
+       98	4450	5656	1039	962	971	1030	11354	2060	1826	
+
+L 87   3393	6850	4478	3860	7137	4687	4979	2831	4428	2400	*	4259	4098	6174	5534	4312	5938	4085	5350	4960	87
+       118	3960	6107	1752	508	817	1210	11339	2551	2026	
+
+R 88   4798	7193	3040	2997	6098	3392	5514	5372	2879	7178	6951	4451	4453	3423	4324	4148	3759	5419	7138	6898	88
+       281	2633	6005	1877	459	0	*	11339	4401	1911	
+
+G 89   4825	*	3926	3742	*	7534	7301	5913	2286	6369	*	3619	2208	3663	3081	4137	5559	7476	*	*	89
+       146	3596	6186	985	1015	0	*	11341	2802	1206	
+
+A 90   3182	5611	7010	7035	2959	6236	5529	2515	*	3913	*	*	3888	7112	*	7219	5081	1871	6218	4282	90
+       41	6241	6110	1397	689	1009	991	11357	1205	1159	
+
+V 91   3600	6957	5038	*	4021	3961	2957	2938	*	4519	7431	4111	*	*	*	3800	3375	2605	*	4208	91
+       8	7424	*	0	*	1058	944	11339	1147	1538	
+
+H 92   4518	*	*	7277	4107	*	7539	2210	*	1435	5432	*	7079	*	*	*	6357	2117	5603	7229	92
+       9	*	7277	*	*	1048	953	11345	0	1194	
+
+I 93   3615	5092	*	*	3753	5092	6886	2141	*	2516	5098	6869	*	*	*	6858	7184	1842	6952	4828	93
+       0	*	*	*	*	867	1146	11356	0	1248	
+
+G 94   2543	7032	*	*	*	420	*	*	7286	*	*	6997	*	*	*	4741	6044	7185	*	*	94
+       0	*	*	*	*	*	0	11372	0	1010	
+
+H 95   5178	5854	6956	7342	3439	6144	1175	5073	*	4849	6033	4815	7278	4319	*	4379	4832	4504	4773	4156	95
+       0	*	*	*	*	*	0	11372	0	1010	
+
+S 96   6959	5156	3126	*	*	3744	*	*	*	6210	*	*	*	*	*	394	*	*	*	*	96
+       0	*	*	*	*	*	0	11372	0	1010	
+
+T 97   5483	*	7038	7487	3963	4902	*	4727	*	2035	2089	7569	*	5287	5529	5047	4389	4199	3777	3439	97
+       9	*	7289	*	*	*	0	11372	0	1010	
+
+G 98   5238	*	6905	*	7163	219	7290	*	*	7144	7122	7452	*	7274	*	4280	6086	*	*	*	98
+       31	7131	6146	1585	585	1144	869	11352	1002	1173	
+
+G 99   1734	7167	7068	*	*	728	*	*	*	6869	6142	7017	*	*	*	4551	6925	*	*	*	99
+       284	*	2483	*	*	652	1460	11346	0	1352	
+
+G 100  2762	6829	6021	6990	4437	3697	5282	3707	6082	3177	3832	5229	4524	5302	4748	4115	3666	4041	5257	4526	100
+       196	5333	3291	1585	585	62	4568	11141	1385	4713	
+
+E 101  4454	5288	6117	5055	5359	5903	*	2800	5970	2803	4035	*	7147	5020	4963	5347	3780	1987	5512	4723	101
+       38	6743	5912	1969	426	103	3862	11281	1243	2987	
+
+V 102  1748	*	*	*	4977	4707	6895	2512	*	3497	5434	*	*	*	7204	4829	3653	2216	*	*	102
+       40	*	5203	*	*	508	1751	11358	0	1356	
+
+A 103  1845	6092	*	7002	6131	3325	6970	4444	*	2411	4161	7273	6010	4276	6823	4098	3716	4586	5550	7090	103
+       42	*	5130	*	*	2479	285	11300	0	1808	
+
+R 104  3607	*	5452	4768	7403	7157	3653	3564	3811	3205	4019	4651	7080	3802	3364	4006	4725	4646	5953	3880	104
+       44	7143	5448	0	*	*	0	11249	1000	2384	
+
+Y 105  3039	6185	*	4250	3186	6039	6251	4425	4654	2931	4005	6817	*	5704	4416	*	4210	4420	6138	2291	105
+       12	6975	*	1000	1000	2602	260	11244	1032	2883	
+
+V 106  1359	7165	*	6982	5178	6056	*	3213	*	1966	4176	7227	*	6155	*	5587	5365	4465	*	5484	106
+       55	5518	5991	1668	545	*	0	11248	1352	2570	
+
+A 107  1348	4921	5016	4619	*	3547	4991	5176	6950	3906	5483	6066	*	4435	5469	3320	4723	4986	7042	*	107
+       57	5340	6183	422	1980	775	1267	11192	1413	3056	
+
+R 108  3925	*	3786	2906	5940	5451	4688	5033	3244	3029	6226	5023	6972	4460	3232	3928	3733	5340	*	5496	108
+       166	4204	4206	1379	700	3348	149	11283	2116	2322	
+
+A 109  4620	*	4600	4149	3998	5305	3108	4350	3388	3208	*	4418	6831	4610	3202	5980	4427	6996	*	2946	109
+       307	4540	2752	1169	849	1687	536	11203	1781	3551	
+
+E 110  3965	5672	3606	5341	4229	3867	3612	5670	4466	4222	5732	5753	2372	4868	4404	3873	*	4882	6586	3992	110
+       628	4206	1744	551	1656	472	1842	11060	1960	5276	
+
+P 111  3474	*	4559	3397	*	3931	5020	6695	3709	5068	*	6577	1598	4951	5017	3548	6497	4641	6699	6633	111
+       119	5061	4346	406	2028	338	2258	11080	1388	6724	
+
+G 112  4209	6076	2433	2351	*	3713	5089	5973	3841	4525	6296	3946	4626	4078	5355	3877	5993	5520	*	7003	112
+       61	6187	5160	0	*	716	1354	11239	1179	3191	
+
+R 113  4374	6023	4264	5071	6080	4976	4379	*	2903	3260	5101	4719	4538	3568	2478	3979	5516	5491	6992	4937	113
+       55	4734	*	855	1161	945	1058	11281	1793	2461	
+
+V 114  4573	5088	*	*	4316	6988	*	1922	5581	2590	5407	6153	4106	*	*	7117	6072	1837	*	5509	114
+       27	6378	7213	0	*	*	0	11307	1161	1636	
+
+A 115  2643	6242	3577	3420	*	4498	7099	5030	2616	5094	*	5160	7121	4869	3127	3383	4553	4537	*	6732	115
+       0	*	*	*	*	2816	221	11299	0	1960	
+
+K 116  2768	5428	7159	5097	5271	2166	5188	5045	3123	6064	6902	4911	*	5983	3202	2830	4802	7297	*	6863	116
+       0	*	*	*	*	*	0	11303	0	1804	
+
+A 117  3773	6085	*	*	4479	4139	7125	3075	6996	1494	4431	*	*	*	7107	5618	6872	2422	6901	4494	117
+       9	7275	*	1000	1000	*	0	11303	1000	1804	
+
+V 118  3795	4755	*	*	4469	5497	5921	2023	6999	3739	4558	*	6872	*	*	4446	4725	1613	*	5907	118
+       36	*	5341	*	*	590	1575	11303	0	1804	
+
+L 119  3571	5589	6037	7140	3940	4763	6114	3378	*	1278	4493	7118	7217	*	*	4742	4789	3809	*	4487	119
+       0	*	*	*	*	2084	388	11327	0	1714	
+
+V 120  5048	4244	5580	5417	4485	*	7206	2078	*	2413	4539	5226	7115	7123	7334	3831	5454	2714	5360	4776	120
+       112	5811	4130	988	1012	2074	391	11349	1239	1508	
+
+S 121  2485	5034	2871	4119	6966	2335	*	6881	*	6162	*	3230	7086	*	6741	2230	5980	7078	6905	*	121
+       285	5896	2622	1323	736	1480	640	11297	1403	2708	
+
+A 122  2263	5795	5927	*	*	2829	5904	4865	*	5258	5908	5964	2724	5761	5137	2382	3362	5695	*	*	122
+       243	3691	3691	1456	654	2763	230	11162	2373	5100	
+
+V 123  2430	5092	5065	5136	3418	3717	6791	3317	*	3581	5124	*	3812	4661	5171	4357	3859	4219	5894	6812	123
+       195	4179	3811	1897	451	1215	813	11097	2086	5633	
+
+P 124  3383	6885	5862	6824	*	3866	4443	4729	5881	3800	6730	4884	1564	6723	5737	5112	3667	4375	5152	4841	124
+       241	4322	3268	1831	476	1451	657	11153	1859	5002	
+
+P 125  3820	5744	4172	5842	4160	3965	6800	5743	4757	4420	6850	4179	1669	5696	4908	4715	3453	5118	*	5865	125
+       175	4811	3672	1900	450	3265	158	11156	1529	5198	
+
+V 126  3699	5726	4271	4387	3320	4722	*	3411	5157	2925	4608	5893	4094	5665	4360	4300	5159	3625	4118	6567	126
+       316	3255	3440	2467	288	2195	355	11050	2942	6020	
+
+M 127  5629	6600	4298	5082	3478	4679	3707	3904	4718	3114	3952	6752	*	6620	3668	3749	3669	3679	5037	4673	127
+       221	4668	3282	790	1247	4327	74	11032	1569	6250	
+
+V 128  3535	*	5466	3220	4493	4634	*	4901	4874	2458	4497	4928	4239	4928	4223	4954	4015	3782	5521	4489	128
+       170	4464	3926	2018	409	2814	221	10909	1749	7048	
+
+K 129  3436	*	4447	3451	6355	4082	4890	6401	2508	4919	*	4977	3513	4244	3482	3969	4211	5535	4825	6907	129
+       227	4206	3453	2231	345	3154	172	10921	1784	6999	
+
+S 130  3329	*	4096	4182	4418	3692	5496	5504	4477	3327	6357	3871	4240	4229	4189	4541	3724	3629	6500	5512	130
+       292	3859	3125	2600	260	2010	412	10891	1889	7297	
+
+D 131  3070	6712	4090	3769	4059	3900	*	3886	3968	3904	6606	5475	3957	3871	4266	3932	3445	6783	6553	5680	131
+       246	3385	4041	1728	518	2315	324	10847	2350	7136	
+
+T 132  2785	*	4577	3825	4608	4548	5707	5027	6553	3757	*	4999	4065	3597	5706	3513	4073	3299	4677	4514	132
+       176	3961	4304	1788	493	2241	343	10844	1934	6818	
+
+N 133  3724	*	4064	3701	5736	3583	5642	4339	4763	4364	5025	4092	4348	5510	4087	3193	3361	5162	4414	5066	133
+       188	4525	3672	2221	348	2734	235	10919	1610	6389	
+
+P 134  4097	5783	4664	3669	4797	6466	6582	4578	5598	3775	5184	4629	1889	4334	*	3406	4322	4024	*	5745	134
+       240	4059	3423	1261	779	2870	212	10970	2116	6585	
+
+D 135  2834	*	3880	3310	4599	3827	4483	5460	*	3414	6356	4546	4240	4305	4647	4034	3709	4295	6521	5630	135
+       243	4231	3299	1587	584	1581	587	10935	1745	6939	
+
+G 136  3484	6710	5612	5613	*	1929	5095	4721	5010	4291	*	4183	3679	4436	3434	3750	4628	4646	6610	6440	136
+       133	4651	4368	2640	252	2114	379	11037	1522	6616	
+
+L 137  5768	*	6684	5126	3102	5207	*	3488	4280	1935	4742	5080	4437	4974	4125	4705	4316	4599	4732	5163	137
+       139	4924	4082	748	1306	3718	114	10964	1447	6247	
+
+P 138  3583	*	4345	5632	3770	3492	*	4389	3811	4341	6740	5749	2721	5811	3399	3202	3950	4998	*	5661	138
+       225	4056	3571	2274	334	1898	451	10916	1874	6508	
+
+L 139  3549	*	3680	4701	4060	5748	*	3190	5567	2800	4303	5008	4050	4717	4084	4382	3967	4396	5140	5766	139
+       178	4026	4198	2287	331	1956	430	10990	1905	6287	
+
+E 140  3388	*	3413	3491	4745	4743	*	6759	3713	3867	*	4174	4097	3856	3027	3601	4425	5032	5853	6566	140
+       242	3342	4163	1230	802	2523	276	11008	2782	5890	
+
+V 141  4002	5633	4786	4219	3741	4749	4637	3499	4420	2950	5085	5092	6570	5425	5199	4445	3915	3288	5736	4118	141
+       158	4109	4446	1955	430	2502	280	11111	2242	5868	
+
+F 142  3089	*	5222	6898	2714	4772	5237	4170	5200	2351	5186	5577	5084	5006	4763	4686	5815	3947	5117	4138	142
+       118	3905	6441	1230	802	2096	384	11149	2231	5752	
+
+D 143  3135	*	3490	2993	5699	4031	4475	5639	3511	4845	5915	5738	5249	4422	3511	3301	4985	4397	*	5205	143
+       36	5820	7128	1000	1000	2425	297	11098	1180	4979	
+
+E 144  3179	5976	4031	3010	5755	3889	5879	5853	3636	4331	4567	5278	4846	3833	3301	3887	4418	6105	5918	5776	144
+       186	3784	4378	1910	446	2032	404	11173	2354	4473	
+
+F 145  4099	*	*	4658	2543	5232	6795	3664	5889	2004	3501	6821	*	5950	4279	6751	5346	3592	4502	5377	145
+       67	5194	5798	2559	268	2291	330	11237	1538	4664	
+
+R 146  3421	*	5303	3884	5880	4309	5836	3367	3360	3433	*	5156	4562	3921	2503	3883	6716	5732	5911	5945	146
+       100	4532	5392	2248	341	2153	367	11158	1744	4275	
+
+A 147  3042	*	3582	3389	5373	5236	5910	5399	3026	4062	5931	4933	4390	4383	3607	3796	3699	5274	*	5359	147
+       182	4537	3725	3127	175	1962	428	11193	1780	3997	
+
+A 148  3706	*	4944	4996	4964	3771	5272	3724	4084	2528	6902	4167	4370	4874	4316	4160	4928	4231	5054	4280	148
+       211	3655	4149	2320	322	4678	57	11073	2502	4645	
+
+L 149  3407	6653	6645	4791	4788	4686	5740	3122	4857	2297	4831	5660	5920	5915	4597	4086	4500	3538	5075	4187	149
+       160	4909	3799	1460	652	2574	265	11013	1503	5379	
+
+A 150  3127	6476	3342	4148	4832	4847	*	3914	3936	3065	6983	5759	4788	4132	3594	3988	3955	5649	6631	4703	150
+       92	4834	5241	1991	418	2437	295	11065	1491	5673	
+
+A 151  2694	*	5880	3460	4794	4884	5830	5818	3006	4430	5813	4719	4428	3922	3629	3664	3495	7044	6682	5178	151
+       175	3530	5186	1845	471	2448	292	11003	2512	5313	
+
+N 152  3635	6618	3960	4292	5957	4223	6774	5324	3169	3660	6488	3738	4553	4006	4085	3867	3197	4842	6761	5135	152
+       127	5330	4074	1658	550	2544	271	11051	1716	5131	
+
+R 153  3605	6934	4140	5266	4484	4374	4805	5742	3781	3661	5113	5148	3840	4018	2630	5085	4426	5370	4515	4896	153
+       194	3642	4446	1285	762	1495	632	11049	2363	5360	
+
+A 154  3826	*	3822	2985	5893	4525	4920	3625	2975	3654	6970	4930	4287	4798	4232	3930	4300	6941	5828	5147	154
+       103	4032	6950	1525	616	1935	437	11070	2062	4814	
+
+Q 155  4089	6733	4542	3025	6812	3604	6002	*	3156	4320	5905	3892	4368	3389	3491	4185	3903	5314	6689	5407	155
+       163	3950	4577	2169	363	4308	75	11155	2226	4060	
+
+F 156  4322	6900	*	4510	2590	4850	5293	4583	5890	2394	4233	4877	*	5837	3667	4584	4241	4535	4621	4036	156
+       57	5428	6016	1833	475	2700	241	11086	1300	4679	
+
+Y 157  3426	5346	5376	4909	2534	5742	6805	3818	4970	3720	4651	5333	5471	5937	5423	5820	4831	3827	4568	2701	157
+       72	5352	5382	1780	496	2256	339	11085	1361	4439	
+
+I 158  2956	6868	3746	3933	5759	4247	7017	4036	3418	3610	5315	3835	4636	3675	4911	4368	5858	4067	5258	6827	158
+       102	5317	4526	2012	411	4323	74	11118	1378	4191	
+
+D 159  3983	6688	2448	3740	5251	6888	4440	4838	3216	5217	6556	5714	5279	4212	3678	3168	4562	5214	5961	4854	159
+       176	4285	3979	2321	322	2037	403	11055	1886	4843	
+
+V 160  4375	*	5442	5167	3024	3983	6903	3236	4810	2631	3822	5169	4894	5346	5851	6704	4565	3514	5703	3824	160
+       191	4487	3656	1564	595	2273	335	11080	1720	4942	
+
+P 161  2811	6676	4423	4163	*	5290	5740	4410	4846	3165	4766	6667	2891	5813	4764	3918	4740	3377	5809	4210	161
+       165	5152	3644	1568	593	2836	218	11079	1366	5319	
+
+S 162  2924	6621	5088	3706	5520	4885	5742	4189	3844	3705	*	4326	3264	4273	4411	3485	4638	4126	5110	6918	162
+       734	3729	1628	1882	457	4098	87	11048	2254	5854	
+
+G 163  3364	*	3014	3382	6190	3377	6128	6381	4575	4224	6387	3906	6012	6107	3464	2952	6261	3558	6056	6643	163
+       593	3836	1906	1672	543	1662	548	10461	1683	8547	
+
+P 164  4580	6514	5120	5112	6236	4207	6248	*	4694	6218	*	3416	1776	4702	3898	3258	3889	4534	6120	4790	164
+       141	3883	5315	2239	343	1318	739	10522	1727	8373	
+
+F 165  3180	6524	6682	*	2549	4609	5476	3849	4963	2646	*	4742	5513	6480	5505	4362	5098	3769	4318	3649	165
+       133	6662	3682	2807	222	3390	145	10883	1000	6483	
+
+Y 166  5504	6410	5575	3721	2511	5011	3965	4152	6646	2969	4601	6346	6427	4572	5542	4250	*	5658	4308	2704	166
+       144	5531	3763	1342	724	2173	362	10853	1198	6844	
+
+G 167  3447	6606	4230	4783	4665	2045	6665	4553	4291	5015	4674	4265	6671	4226	4071	3948	4459	5628	*	4386	167
+       192	4380	3705	837	1184	1970	425	10895	1670	6593	
+
+F 168  4564	6537	5624	4395	2754	4674	5102	3847	4300	2706	6716	5904	4045	6511	4256	4354	4658	4043	5810	3797	168
+       253	3466	3835	2232	345	2557	269	10919	2381	6410	
+
+N 169  5074	5099	3275	4570	5133	3479	5163	5687	4348	3519	6489	2876	5620	4576	5214	3410	5164	3581	6584	4598	169
+       167	5046	3659	2835	218	2362	312	10921	1376	6408	
+
+R 170  3776	6676	3565	4106	6709	4944	4268	4158	3544	4650	6743	3567	3835	4283	2768	4399	4334	5560	*	5716	170
+       363	5700	2300	1339	725	1865	463	10912	1173	6429	
+
+E 171  3963	*	4494	3343	6436	3591	4984	4955	4093	4541	5357	4573	2446	3935	4903	4091	4215	4765	6393	5434	171
+       205	4554	3471	2222	348	2108	381	10832	1528	7257	
+
+G 172  4677	*	3227	5583	5481	3099	6626	4927	4282	4305	4964	4295	2883	5480	5003	3063	3626	4264	*	5364	172
+       165	5442	3554	2466	288	1747	510	10748	1185	6931	
+
+A 173  3030	6498	3479	4353	6446	4150	*	4572	3682	4267	6588	4273	2830	3796	5736	3924	4066	4911	5246	6710	173
+       154	4279	4326	1105	902	2649	250	10907	1690	6400	
+
+T 174  3294	6455	4365	3762	5157	5056	6667	4464	2597	3387	6458	4626	4338	4278	5142	3771	4197	4884	5640	5191	174
+       120	6741	3830	1331	731	2107	381	10944	1190	6253	
+
+V 175  4692	6786	4042	3889	3919	4752	5477	3781	5743	3107	3542	6983	4141	3768	4338	4653	4626	3487	5600	5180	175
+       128	6695	3737	3585	126	2290	330	10945	1000	6086	
+
+S 176  4108	6658	3490	4685	5235	5512	5105	5139	3401	3431	5111	4327	4134	4772	4633	2834	2931	6762	6809	6829	176
+       118	5023	4396	2319	323	3268	158	10942	1408	6131	
+
+Q 177  3538	*	3604	2657	5819	5027	4294	6475	3579	4027	5047	4022	4045	4518	4736	3745	5088	4305	6776	5629	177
+       89	4553	5858	268	2561	2472	287	10912	1617	6236	
+
+G 178  3371	*	3612	2511	4421	3162	5648	3703	4666	3906	5251	5193	4730	6691	3798	4178	4378	*	*	6849	178
+       144	5797	3696	1819	481	2309	325	11003	1172	5706	
+
+L 179  4377	6715	4468	3435	3212	5617	5044	4676	5027	1811	4466	5573	5765	5200	6889	6546	4704	3707	6844	4765	179
+       45	5629	6602	1068	935	3233	162	10945	1195	5849	
+
+I 180  3588	6529	5679	3972	3715	5932	4890	3138	4264	2855	6568	4377	5778	5844	4775	4059	4226	3628	5712	4367	180
+       55	5828	5635	1310	745	2410	301	10947	1176	5561	
+
+D 181  4477	*	2848	3209	6594	5349	5201	6662	3858	4799	5809	4468	4391	3624	2886	3859	5304	3928	6906	4799	181
+       69	5187	5682	2864	213	3703	115	11036	1351	5097	
+
+H 182  2803	*	3595	3931	6035	6681	4504	*	4827	3807	5833	4230	4117	4256	3855	3208	3875	3837	*	4779	182
+       126	4456	4711	3284	156	2380	308	11043	1763	5107	
+
+W 183  4891	5760	5738	4788	2900	5859	6672	4322	6693	2797	5142	5648	5786	*	3852	3923	4837	4996	3001	2883	183
+       120	4496	4816	1734	516	3125	176	11060	1722	4954	
+
+W 184  3435	5869	4495	5737	4044	5871	4230	3444	4953	2891	5363	5878	5731	5988	4225	5245	6785	3546	3117	3802	184
+       98	4124	6861	2239	343	2269	335	11055	1955	5066	
+
+L 185  3075	*	3711	3700	5938	5354	4699	5351	3463	4721	6653	3844	4812	4030	2650	4163	4776	4903	6978	5248	185
+       113	5142	4413	2760	230	4510	65	11070	1414	4470	
+
+Q 186  3655	5744	4034	3772	7183	4742	6589	4847	4792	3501	4203	3315	4265	3745	3373	4056	4021	4787	5800	*	186
+       137	5147	4001	1761	505	3056	185	11020	1388	5104	
+
+G 187  2928	6647	4794	5129	4839	3436	6765	4844	4690	2982	5807	4369	3948	4389	4618	3452	3747	5743	*	4231	187
+       110	4459	5152	1787	494	2682	244	10956	1726	5575	
+
+M 188  3853	6835	5859	6882	3944	5717	5810	3253	5243	2045	3467	6598	6756	5189	4091	4215	4040	4231	*	4137	188
+       117	4560	4828	1542	607	3422	141	10979	1705	5457	
+
+M 189  4065	*	4497	3648	4114	4857	5967	4435	4359	2597	3875	4359	5669	4121	3304	4393	5702	4797	6864	4606	189
+       270	3282	3877	1407	683	2948	200	10967	2689	5658	
+
+G 190  2885	*	4386	3689	6470	2670	5161	5724	4603	4698	6598	3680	3338	4939	4021	3566	4110	*	6707	6503	190
+       102	4700	5065	1700	531	3208	165	10925	1532	5970	
+
+A 191  3203	5122	4498	5516	5762	2342	5099	4411	4700	3722	5101	5837	4762	6937	4801	2650	5065	5826	5817	4702	191
+       124	4489	4729	1290	758	2791	225	10911	1870	5923	
+
+A 192  3566	6663	5563	4875	4098	4400	5161	3452	3461	3158	4690	5753	3158	5078	4464	3408	6552	5207	5236	5655	192
+       85	5158	5085	2178	360	1758	505	10915	1537	5826	
+
+N 193  3149	*	4135	3476	6648	4232	4254	5143	3692	4800	5796	4069	4124	5266	3092	3630	4732	4279	5742	5914	193
+       178	3909	4329	1442	662	3194	167	11029	2120	5023	
+
+A 194  2828	*	3594	4024	6978	3470	6786	4705	5152	4171	4867	3592	4730	4865	5295	3082	3491	4545	*	5563	194
+       69	5208	5677	314	2355	2672	246	11024	1530	5364	
+
+H 195  3367	6729	3377	4795	4391	4213	7231	4022	3777	3259	4024	4672	5738	5155	4277	4332	4377	4272	6863	4134	195
+       185	3949	4172	1575	590	2705	240	11030	2048	5048	
+
+Y 196  3157	6666	5230	4768	3081	6526	4831	4049	5767	3013	7020	5651	4511	5277	4436	5632	5371	4525	5229	2396	196
+       127	4438	4724	2508	279	2502	280	11014	1712	5272	
+
+E 197  3347	4819	3275	2658	5801	5664	4401	4619	4015	3854	5844	4427	6753	4875	2956	3763	5767	*	6718	6620	197
+       136	4029	5136	1927	440	1806	486	11033	2046	5148	
+
+C 198  2715	4637	4575	4605	4014	4157	5038	4538	4847	3137	6885	4683	4318	4108	4841	3895	4298	5301	6856	4564	198
+       137	4167	4846	1473	644	2495	282	11053	2184	4554	
+
+I 199  3866	6022	5913	5997	4556	5242	5181	3032	5228	2475	3684	5189	5196	*	4993	4591	4470	3058	4912	4194	199
+       111	5421	4303	0	*	1501	629	11046	1344	4533	
+
+A 200  4010	7351	4268	3678	4484	4823	5266	6716	2907	4132	4865	3763	5354	3758	2846	3881	5005	4968	6798	6554	200
+       73	5372	5322	1707	528	2401	303	11058	1365	4402	
+
+A 201  2799	5906	4848	4283	4926	4958	4529	4940	4223	3319	5195	4019	4360	3839	4606	3913	4426	4386	6002	4882	201
+       100	4933	4862	1289	759	2048	399	11100	1824	4212	
+
+F 202  3841	5780	4813	4976	2486	4971	5863	3827	5338	2996	4911	6031	4851	5924	4972	5865	5339	3336	4949	3444	202
+       100	6819	4100	3249	160	4119	86	11111	1181	4081	
+
+S 203  3272	5104	4022	7023	6798	3769	5257	4887	4447	3535	4718	3869	4288	4002	3874	3241	3995	4637	*	5217	203
+       110	4153	5853	1954	431	2135	373	11054	2175	4835	
+
+E 204  4273	*	2963	3792	5863	5288	4531	5359	4284	4138	6769	4136	4959	4177	3558	3554	3200	5245	*	3825	204
+       176	3906	4374	1041	960	2853	215	11125	2282	4340	
+
+T 205  3659	5805	4592	2986	4293	4925	4906	3624	4876	3527	4898	*	4257	4310	3597	4747	3763	5922	5780	4274	205
+       116	4845	4559	1180	840	2684	244	11065	1563	4707	
+
+D 206  3974	6638	1756	4108	6921	4542	4987	6639	5339	4439	6570	3474	4810	4463	3199	3771	6957	5258	6526	*	206
+       163	3638	5236	1351	718	2281	332	11049	2391	4828	
+
+F 207  3537	6680	4264	5239	4068	4612	5759	3267	*	2547	4840	*	4049	3956	4854	4318	5127	4082	4592	4106	207
+       116	3696	*	1271	772	1028	973	11087	2347	4548	
+
+T 208  4197	7089	3685	5013	6106	5487	6005	4337	4362	2716	5272	*	3598	3808	3051	3764	3832	4590	5347	5943	208
+       43	5503	7152	2467	288	2488	283	11251	1415	2902	
+
+D 209  3015	*	3090	2578	5383	5483	4672	5141	3203	5917	*	4691	3532	5066	3978	3421	5397	6926	*	6877	209
+       39	5221	*	967	1033	1402	686	11255	1428	2722	
+
+D 210  3470	7097	3290	3478	4990	4398	6004	4113	3447	3564	6177	4063	5047	4235	4032	4053	4506	4257	*	7095	210
+       78	4954	5638	2924	204	1735	515	11312	1572	2040	
+
+L 211  3405	6995	6120	*	4287	*	5299	3287	5397	1385	4238	*	5519	7020	5379	7013	4636	4496	4318	4355	211
+       56	4703	*	242	2696	1984	420	11312	1913	2178	
+
+K 212  3284	*	3745	3713	6982	4556	4214	6095	2846	4636	7057	5461	3107	5491	3308	3660	4656	5417	7154	5079	212
+       101	4960	4814	1696	532	595	1564	11325	1539	1849	
+
+R 213  3624	*	3908	3962	*	4792	5883	5043	2754	4592	*	2958	5066	3239	3137	3749	5093	6717	6852	6051	213
+       78	4452	7230	1016	984	1521	618	11264	1922	2298	
+
+I 214  4460	6842	5031	*	4521	5935	6900	1664	6928	2288	5975	5956	6810	*	7120	6004	3230	2976	7080	6198	214
+       80	4208	*	1735	515	768	1276	11288	2088	2147	
+
+D 215  3694	*	3258	5041	7029	5141	5458	6932	2839	6323	6982	3692	4286	3882	3900	3215	2785	4489	*	*	215
+       45	5864	6231	3040	187	0	*	11344	1577	1382	
+
+V 216  3026	3272	7139	*	5633	4167	5580	3039	4842	3395	5414	7146	6217	4065	5404	6105	3956	2294	*	6948	216
+       22	6047	*	1832	476	0	*	11329	1192	1403	
+
+P 217  6962	*	6872	4563	*	*	7193	*	4300	*	*	4293	473	6234	4905	4460	6210	7293	*	*	217
+       20	6214	*	0	*	*	*	11373	1198	0	
+
+V 218  3814	5093	*	*	4832	7062	*	2526	4331	3319	5125	*	6830	*	6957	4621	2151	2170	*	*	218
+       0	*	*	*	*	*	*	11373	0	0	
+
+L 219  5160	5929	6089	7307	4305	5972	4771	3986	6227	1098	3954	*	*	4873	7101	6219	4279	3855	5646	5163	219
+       0	*	*	*	*	*	*	11373	0	0	
+
+V 220  4158	7166	*	*	3038	6996	7247	2060	*	2562	4490	*	*	5484	7179	5444	5058	2444	7082	3757	220
+       8	*	7490	*	*	*	*	11373	0	0	
+
+A 221  5210	6375	*	6130	3501	5221	5934	1892	*	1957	4592	*	*	7250	*	6882	4825	2573	6151	6141	221
+       0	*	*	0	*	0	*	11365	1000	1000	
+
+H 222  3529	5568	7101	5002	5043	4591	2804	4822	5355	5549	*	4313	7251	3464	4390	3406	5086	4507	3217	3518	222
+       10	7159	*	1585	585	*	*	11373	1000	0	
+
+G 223  2368	5176	5451	*	6904	743	7097	*	*	7010	7190	6095	*	6203	6869	3867	5462	*	*	*	223
+       13	6805	*	0	*	*	*	11373	1024	0	
+
+T 224  3884	7111	2739	2562	*	3412	6957	*	3676	5022	5207	4938	5941	4863	3471	3686	3305	6012	*	*	224
+       34	6077	6894	3083	181	*	*	11373	1191	0	
+
+D 225  3445	*	3181	3650	4516	4233	4541	7064	2747	5088	7080	3257	6098	3407	3996	4122	5403	*	7119	5590	225
+       27	7468	6292	0	*	0	*	11351	1000	1022	
+
+D 226  6059	*	470	5207	5938	4288	*	*	5966	*	*	5417	6976	*	5858	3954	4669	*	*	*	226
+       67	6024	5061	0	*	1665	546	11347	1189	1376	
+
+Q 227  3960	7021	3788	3802	5448	4022	4722	5470	3464	4470	*	4381	2704	5133	3516	4487	5974	3529	5973	5448	227
+       56	7118	5014	0	*	613	1530	11317	1000	1942	
+
+V 228  3835	6849	5969	5542	3432	5495	5114	3254	4674	2920	4322	5456	5048	4527	6908	5086	4284	2590	5085	4921	228
+       32	7100	6074	3170	170	977	1023	11297	1000	1930	
+
+V 229  4438	5060	6068	4339	3839	5016	5459	2597	6032	3421	5511	*	5452	5909	5409	4762	3599	2092	*	5433	229
+       21	*	6082	*	*	1348	720	11337	0	1711	
+
+P 230  4048	6269	3487	4515	5062	4674	4681	6194	5089	5973	6861	4713	1745	4749	4758	2758	4751	7015	*	6082	230
+       43	7081	5521	0	*	782	1257	11344	1000	1710	
+
+Y 231  3260	5866	5135	4947	3726	7065	6962	3856	4403	3344	5546	5479	2978	6046	4963	4500	4986	3158	4984	3748	231
+       106	5811	4245	1805	486	1299	753	11318	1229	1714	
+
+A 232  3313	*	3369	2400	5356	4918	3944	5786	3402	5989	5225	4682	5895	3570	4318	3324	5416	6045	*	7186	232
+       45	7034	5452	0	*	757	1293	11273	1000	2559	
+
+D 233  3236	5380	4259	3430	6340	4263	4186	4666	4238	3719	4098	4953	4674	5498	4203	3781	3605	3720	*	*	233
+       349	*	2219	*	*	522	1719	11318	0	2037	
+
+A 234  2435	5810	4643	6734	6880	3393	4709	3347	6709	4511	5139	4860	6569	3958	5834	2814	4679	3508	*	5066	234
+       113	6711	3924	0	*	157	3282	11095	1020	5254	
+
+A 235  2904	7089	3997	3680	6746	4023	6266	4646	4107	3690	5072	5937	5181	3930	3515	3710	5390	3953	5985	4271	235
+       56	6737	5107	1000	1000	326	2306	11235	1204	2603	
+
+P 236  3362	7094	3815	2511	6038	6171	5381	4464	2695	5993	6891	5927	5563	3335	3003	4917	5489	5912	*	4691	236
+       104	*	3842	*	*	605	1546	11302	0	1905	
+
+K 237  3233	*	5291	3119	4404	4982	*	4250	5059	2446	5496	5017	6830	4181	3392	4593	5963	7145	4157	3734	237
+       128	6694	3733	0	*	464	1862	11277	1030	2695	
+
+S 238  3425	6857	6739	4564	3921	5895	4976	2908	4568	2404	3332	4576	*	5307	5012	5091	5484	4507	5194	4407	238
+       72	7010	4607	2905	207	119	3658	11292	1380	2932	
+
+A 239  2310	*	3818	3157	4924	4741	3769	4952	4055	4881	7195	4782	*	4705	3725	4243	5469	3894	5975	5077	239
+       22	*	6064	*	*	246	2672	11290	0	1936	
+
+E 240  3266	6078	3555	3174	*	3751	5123	6763	3685	4710	*	3760	7113	3066	3457	3649	4671	6896	*	4705	240
+       73	5970	4915	461	1871	606	1544	11326	1374	1346	
+
+L 241  3272	7159	5119	5867	4580	4997	3802	3585	4433	2101	5394	4131	6880	5879	3808	5484	4079	4479	5419	6869	241
+       139	4372	4522	1101	906	309	2375	11302	1952	1746	
+
+L 242  5562	6830	*	5482	3461	5477	7125	2579	4423	2488	5928	3950	7181	6040	4388	3468	4718	3917	5008	4097	242
+       210	3791	3987	1490	635	0	*	11278	2406	2256	
+
+A 243  3435	5382	5965	4107	5987	4424	6148	*	2953	5996	*	4116	1885	4376	3812	3440	4593	*	7150	*	243
+       55	5011	7322	1327	734	222	2812	11245	1544	2268	
+
+N 244  4496	5570	2828	5309	*	3035	3971	5522	3621	4966	*	3076	4736	4048	3652	4186	4828	5536	7003	4962	244
+       86	4108	*	1143	870	2088	387	11298	2251	1562	
+
+A 245  2740	3700	*	6184	4685	4003	5886	4387	3746	3471	5401	5590	5444	7031	6962	2437	4187	3345	*	7004	245
+       67	4457	*	1248	789	0	*	11302	2141	1390	
+
+T 246  6018	6910	3733	2172	6857	6037	7308	6179	3499	6951	6801	5271	5438	3282	2675	3763	3250	5232	*	5972	246
+       12	*	6870	*	*	*	*	11322	0	0	
+
+L 247  4214	6760	*	7035	2642	7211	4357	3118	5460	2061	5954	7067	*	5391	5107	5028	4216	3340	6031	4038	247
+       24	6780	7019	0	*	0	*	11293	1046	1019	
+
+K 248  5007	5944	7103	4010	4723	*	3844	2951	3502	3565	6115	6087	7071	4146	4154	5251	4405	2135	7135	5946	248
+       0	*	*	*	*	0	*	11264	0	1021	
+
+S 249  4651	7043	4838	2982	4975	6061	4949	2606	6062	3620	5111	*	5561	5521	7145	4088	3705	2277	5438	7051	249
+       35	5886	7083	1000	1000	*	*	11279	1202	0	
+
+Y 250  6924	5853	7098	*	2452	*	5394	2007	*	2425	5084	6015	*	*	6829	*	5334	2761	6870	3458	250
+       33	7083	6039	1000	1000	*	0	11274	1010	1000	
+
+E 251  5468	*	2585	2327	6810	4978	6054	*	3531	6911	6897	4667	2091	4233	4714	4767	4312	*	*	*	251
+       132	6818	3666	0	*	599	1557	11257	1000	1357	
+
+G 252  4290	*	3011	4163	6962	1533	4498	*	3386	6910	6770	2700	6733	4795	5739	4978	6934	*	*	*	252
+       40	6778	5802	0	*	131	3522	11129	1008	2786	
+
+L 253  1835	3827	4877	6015	6824	2988	6992	5041	*	4479	6271	6791	*	4946	6989	2812	3337	4036	5862	*	253
+       72	6791	4651	0	*	0	*	11215	1018	1372	
+
+P 254  3828	*	3865	5203	5329	1222	5456	5954	3708	*	*	5569	4987	7068	4259	3397	4972	6857	6910	6805	254
+       0	*	*	*	*	394	2066	11183	0	1767	
+
+H 255  *	7022	6939	7271	*	6898	236	*	*	5901	6878	6073	*	5749	*	6783	5497	*	*	5038	255
+       11	6998	*	0	*	*	0	11240	1007	1046	
+
+G 256  3522	4594	4889	4864	3087	4462	4352	5538	7072	3070	4162	3925	5503	6098	5252	3527	5035	4951	4059	4342	256
+       22	*	6021	*	*	*	0	11205	0	1046	
+
+M 257  3613	5387	7077	*	3376	5425	5855	2718	*	2453	4428	*	2517	*	5823	3828	5928	3932	*	5359	257
+       26	5820	*	613	1531	*	0	11161	1203	1465	
+
+L 258  5385	4963	*	*	3094	6997	2903	3975	5837	3143	3701	4886	3197	3623	*	4633	4389	4274	5731	4982	258
+       98	4560	5432	746	1308	630	1498	11161	1924	1465	
+
+S 259  4615	*	4567	3489	3872	6038	4606	4383	*	2540	4579	4253	5807	3880	4194	5929	5367	3570	3726	4369	259
+       158	3656	5345	159	3264	0	*	11170	2498	1585	
+
+T 260  4514	6036	2569	1493	6827	5156	5911	5821	5275	6841	6944	5360	5287	6069	4870	3318	3687	6997	6738	6747	260
+       70	4393	*	1288	760	0	*	11129	1921	1398	
+
+H 261  3452	5314	3045	3644	6647	4640	4476	5421	3471	7108	5946	2937	5297	3348	3784	4317	5307	6851	*	4664	261
+       36	6728	6014	1585	585	*	*	11193	1025	0	
+
+P 262  3925	*	5920	5902	5999	3941	6925	*	4012	6009	5370	5358	1217	6672	3651	3645	4876	5946	5799	5776	262
+       13	6808	*	0	*	885	1125	11123	1000	1177	
+
+E 263  3753	*	2587	1814	*	6704	4526	6939	3430	5385	*	5013	5260	3198	4308	4571	5460	5969	*	*	263
+       44	5908	6202	2400	303	*	0	11134	1213	1000	
+
+V 264  2987	*	4360	2556	5373	4814	6876	3851	3312	3689	*	4611	5329	3343	4328	5119	4668	4986	6899	5858	264
+       11	7012	*	0	*	587	1580	11134	1166	1344	
+
+L 265  5895	5938	*	*	2231	6837	6803	3675	*	2699	7259	*	6866	6892	5697	6787	3866	1915	6604	3210	265
+       22	*	6037	1000	1000	0	*	11092	1000	1000	
+
+N 266  2247	*	5992	5894	4812	4600	6816	4305	6690	4387	5068	2914	*	4774	4270	4077	3648	3530	*	3529	266
+       23	7013	6995	3700	115	0	*	11041	1000	1152	
+
+P 267  3024	*	3044	2691	*	5845	5700	5179	3404	*	6844	3966	4559	2831	3513	4300	5346	5400	*	*	267
+       23	6738	7218	1585	585	0	*	11028	1019	1000	
+
+D 268  2600	5791	3739	3661	5744	4737	4477	3526	5210	3128	6922	5809	6844	3972	3993	4884	4723	4183	5238	5709	268
+       13	6762	*	2807	222	*	0	11025	1000	1000	
+
+L 269  4181	6481	*	*	3988	*	6708	1665	*	1887	4755	*	*	*	*	*	5623	2390	*	5192	269
+       26	5810	*	1357	714	*	0	10939	1180	1000	
+
+L 270  4146	*	3826	3591	5757	4446	6764	3312	3445	2254	6633	4416	*	4881	3214	5715	4385	5790	6536	5651	270
+       0	*	*	*	*	*	0	10939	0	1000	
+
+A 271  3523	*	2805	2564	*	5299	*	6639	3727	4903	6533	3562	6634	3894	3248	3141	4715	5838	*	6733	271
+       14	*	6699	*	*	*	0	10890	0	1000	
+
+F 272  3917	5018	6827	*	938	*	6529	4662	*	4367	*	*	*	*	*	*	4968	5594	2439	4789	272
+       0	*	*	2322	322	0	*	10808	1000	1163	
+
+V 273  4599	5452	6385	*	3697	*	*	1990	*	1137	4956	6476	*	6372	6514	6534	4867	5114	*	*	273
+       36	5349	*	2411	300	*	*	10640	1192	0	
+
+K 274  3763	6333	3453	3017	6339	3835	5302	6307	3384	4725	6189	3835	5389	3163	3534	3676	4346	6371	*	*	274
+       112	3747	*	2000	415	*	*	10532	1024	0	
+
+S 275  2375	*	3914	*	*	4008	*	*	2405	*	*	*	*	3017	4171	3063	2387	*	*	*	275
+       0	*	*	0	*	*	*	6498	0	0	
+
+//
diff --git a/loop/tests/data/1akyA.horiz b/loop/tests/data/1akyA.horiz
new file mode 100644
index 0000000000000000000000000000000000000000..1564e9eccda74130990c1eee14010c1a554f3edc
--- /dev/null
+++ b/loop/tests/data/1akyA.horiz
@@ -0,0 +1,25 @@
+# PSIPRED HFORMAT (PSIPRED V3.2)
+
+Conf: 960499976999993515779998829960155289999998299434999999763999
+Pred: CCCEEEEECCCCCCCCCHHHHHHHHHCCCCCCHHHHHHHHHHCCCHHHHHHHHHHHCCCC
+  AA: ESIRMVLIGPPGAGKGTQAPNLQERFHAAHLATGDMLRSQIAKGTQLGLEAKKIMDQGGL
+              10        20        30        40        50        60
+
+
+Conf: 628999999999741499987770111899998989999999997299976799984396
+Pred: CHHHHHHHHHHHHHHCCCCCCCCEEECCCCCCHHHHHHHHHHHHHCCCCCCEEEEEECCH
+  AA: VSDDIMVNMIKDELTNNPACKNGFILDGFPRTIPQAEKLDQMLKEQGTPLEKAIELKVDD
+              70        80        90       100       110       120
+
+
+Conf: 899999754532379996232012799878877787976321589999999999999995
+Pred: HHHHHHHHCCCCCCCCCCEEECCCCCCCCCCCCCCCCCCCCCCCCCCHHHHHHHHHHHHH
+  AA: ELLVARITGRLIHPASGRSYHKIFNPPKEDMKDDVTGEALVQRSDDNADALKKRLAAYHA
+             130       140       150       160       170       180
+
+
+Conf: 05046999966197788307999578999999973459
+Pred: CCCHHHHHHHHCCCEEEECCCCCHHHHHHHHHHHHCCC
+  AA: QTEPIVDFYKKTGIWAGVDASQPPATVWADILNKLGKN
+             190       200       210      
+
diff --git a/loop/tests/test_loop_score.cc b/loop/tests/test_loop_score.cc
index 3d2c46eb96d60aca901dcaaf62132ff2909a4aa3..88cab4c4631badbe111fcd553b328de402d1ba4c 100644
--- a/loop/tests/test_loop_score.cc
+++ b/loop/tests/test_loop_score.cc
@@ -14,8 +14,6 @@ BOOST_AUTO_TEST_SUITE( loop );
 
 using namespace promod3::loop;
 
-
-
 BOOST_AUTO_TEST_CASE(test_loop_score_set_env){
 
   //load an entity to test...
@@ -87,10 +85,13 @@ BOOST_AUTO_TEST_CASE(test_loop_score_potential_terms){
     bb_list.push_back(new_bb);
   }
 
-  //check whether error gets thrown when no potentials are set
+  //check whether error gets thrown when no scores are set
   BOOST_CHECK_THROW(scorer.CalculateCBetaScore(bb_list,214,0),promod3::Error);
   BOOST_CHECK_THROW(scorer.CalculateCBPackingScore(bb_list,214,0),promod3::Error);
   BOOST_CHECK_THROW(scorer.CalculateTorsionScore(bb_list,214,0),promod3::Error);
+  BOOST_CHECK_THROW(scorer.CalculateReducedScore(bb_list,214,0),promod3::Error);
+  BOOST_CHECK_THROW(scorer.CalculateHBondScore(bb_list,214,0),promod3::Error);
+  BOOST_CHECK_THROW(scorer.CalculateSSAgreementScore(bb_list,214,0),promod3::Error);
 
   //load scorer with properly set potentials
   promod3::loop::BackboneLoopScorerPtr standard_scorer = LoadBackboneLoopScorer();
@@ -101,17 +102,45 @@ BOOST_AUTO_TEST_CASE(test_loop_score_potential_terms){
   BOOST_CHECK_THROW(standard_scorer->CalculateCBetaScore(bb_list,214,1),promod3::Error);
   BOOST_CHECK_THROW(standard_scorer->CalculateCBPackingScore(bb_list,214,1),promod3::Error);
   BOOST_CHECK_THROW(standard_scorer->CalculateTorsionScore(bb_list,214,1),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateReducedScore(bb_list,214,1),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateClashScore(bb_list,214,1),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateHBondScore(bb_list,214,1),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateSSAgreementScore(bb_list,214,1),promod3::Error);
+
   BOOST_CHECK_THROW(standard_scorer->CalculateCBetaScore(bb_list,214,-1),promod3::Error);
   BOOST_CHECK_THROW(standard_scorer->CalculateCBPackingScore(bb_list,214,-1),promod3::Error);
   BOOST_CHECK_THROW(standard_scorer->CalculateTorsionScore(bb_list,214,-1),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateReducedScore(bb_list,214,-1),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateClashScore(bb_list,214,-1),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateHBondScore(bb_list,214,-1),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateSSAgreementScore(bb_list,214,-1),promod3::Error);
+
 
   //invalid residues
   BOOST_CHECK_THROW(standard_scorer->CalculateCBetaScore(bb_list,1000,0),promod3::Error);
   BOOST_CHECK_THROW(standard_scorer->CalculateCBPackingScore(bb_list,1000,0),promod3::Error);
   BOOST_CHECK_THROW(standard_scorer->CalculateTorsionScore(bb_list,1000,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateReducedScore(bb_list,1000,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateClashScore(bb_list,1000,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateHBondScore(bb_list,1000,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateSSAgreementScore(bb_list,1000,0),promod3::Error);
+
+  BOOST_CHECK_THROW(standard_scorer->CalculateCBetaScore(bb_list,0,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateCBPackingScore(bb_list,0,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateTorsionScore(bb_list,0,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateReducedScore(bb_list,0,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateClashScore(bb_list,0,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateHBondScore(bb_list,0,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateSSAgreementScore(bb_list,0,0),promod3::Error);
+
   BOOST_CHECK_THROW(standard_scorer->CalculateCBetaScore(bb_list,-1,0),promod3::Error);
   BOOST_CHECK_THROW(standard_scorer->CalculateCBPackingScore(bb_list,-1,0),promod3::Error);
   BOOST_CHECK_THROW(standard_scorer->CalculateTorsionScore(bb_list,-1,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateReducedScore(bb_list,-1,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateClashScore(bb_list,-1,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateHBondScore(bb_list,-1,0),promod3::Error);
+  BOOST_CHECK_THROW(standard_scorer->CalculateSSAgreementScore(bb_list,-1,0),promod3::Error);
+
 
   //we check the energy calculation after saving/loading, so this is tested as well...
   standard_scorer->Save("test_loop_scorer.dat");
@@ -120,14 +149,56 @@ BOOST_AUTO_TEST_CASE(test_loop_score_potential_terms){
   loaded_scorer->Initialize(seqres);
   loaded_scorer->SetEnvironment(test_ent);
 
+  //generate a psipred object and attach it to the scorer to calculate the
+  //ss_agreement score
+  String psipred_ss = "CCCCHHHHHHHHHHHHHHHHHHHHHHHHHHHCCCCCCEEEEECCCCCCHHHHHHH";
+  psipred_ss += "HHCCCCCCCCCCCCEEEEEEEEEEECCCEEEEEEECCCCCCCCCHHHHHHHHHHHHHCCCC";
+  psipred_ss += "CCEEEEEEECCCCCCCHHHHHHHHHHHHHHCCCCCCCEEEEEECCCCCCCCCCCHHHHHHH";
+  psipred_ss += "HHHHHHHHHHHHCCCCCCCCCCCCCCEEEEECCCCEEECCCCCEECCCCHHHHHHHHHHHH";
+  psipred_ss += "HHHHHCCCCCCCCHHHHHHCCCCC";
+
+  int psipred_conf[] = {9,6,4,0,3,4,1,3,1,1,4,6,7,7,8,9,9,9,9,9,9,9,9,9,9,9,9,9,
+                        8,8,6,1,5,8,8,7,2,8,9,9,9,8,8,9,9,9,9,8,8,9,9,9,9,9,9,9,
+                        6,7,8,7,6,5,3,3,5,6,6,7,5,4,6,8,8,8,9,9,9,9,8,4,1,8,6,6,
+                        8,9,9,9,9,7,9,9,8,4,0,1,2,2,0,3,7,9,9,9,9,9,9,9,9,8,6,3,
+                        3,4,7,9,9,8,8,9,9,9,9,8,4,7,8,6,6,5,5,4,7,7,9,9,9,9,9,9,
+                        9,9,9,9,8,3,4,2,4,5,7,8,5,8,9,9,9,9,8,6,0,0,1,7,7,4,4,4,
+                        6,8,9,9,9,9,9,9,8,7,9,9,9,9,9,9,9,9,9,7,3,3,0,0,0,1,1,2,
+                        2,1,1,3,5,8,6,5,8,9,8,6,2,4,5,2,3,5,5,6,8,8,6,3,0,0,7,7,
+                        7,2,5,8,9,9,9,9,9,9,9,9,9,9,9,9,9,8,2,7,9,9,6,3,3,1,7,7,
+                        7,7,7,5,3,0,2,4,7,9};
+
+  std::vector<char> v_psipred_ss;
+  std::vector<int> v_psipred_conf;
+
+  for(int i = 0; i < 262; ++i){
+    v_psipred_ss.push_back(psipred_ss[i]);
+    v_psipred_conf.push_back(psipred_conf[i]);
+  }
+
+  PsipredPredictionPtr psipred_prediction(new PsipredPrediction(v_psipred_ss,v_psipred_conf));
+  loaded_scorer->SetPsipredPrediction(psipred_prediction);
 
+  //let's calculate the scores
   Real cb_score = loaded_scorer->CalculateCBetaScore(bb_list,214,0);
   Real cb_packing_score = loaded_scorer->CalculateCBPackingScore(bb_list,214,0);
   Real torsion_score = loaded_scorer->CalculateTorsionScore(bb_list,214,0);
-
-  BOOST_CHECK_CLOSE(cb_score,0.00311393,Real(1e-3));
-  BOOST_CHECK_CLOSE(cb_packing_score,-0.657945,Real(1e-3));
-  BOOST_CHECK_CLOSE(torsion_score,-0.143922,Real(1e-3));
+  Real hbond_score = loaded_scorer->CalculateHBondScore(bb_list,214,0);
+  Real ss_agreement_score = loaded_scorer->CalculateSSAgreementScore(bb_list,214,0);
+  Real reduced_score = loaded_scorer->CalculateReducedScore(bb_list,214,0);
+  Real clash_score = loaded_scorer->CalculateClashScore(bb_list,214,0);
+
+
+  //the following target values have been calculated externally from promod
+  //with qmean and should be the reference, since the qmean potentials are quiet
+  //well tested
+  BOOST_CHECK_CLOSE(cb_score,-0.00178876915015,Real(1e-3));
+  BOOST_CHECK_CLOSE(cb_packing_score,-0.657944619656,Real(1e-3));
+  BOOST_CHECK_CLOSE(torsion_score,-0.143922114538,Real(1e-3));
+  BOOST_CHECK_CLOSE(hbond_score,-0.79220325417,Real(1e-3));
+  BOOST_CHECK_CLOSE(ss_agreement_score,0.566874,Real(1e-3));
+  BOOST_CHECK_CLOSE(reduced_score,-0.0734949707985,Real(1e-3));
+  BOOST_CHECK_CLOSE(clash_score,0.0,Real(1e-3));
 }
 
 
diff --git a/loop/tests/test_psipred_prediction.cc b/loop/tests/test_psipred_prediction.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7053e5a1dc6eaf2f60ab062fca6765b0d13e632e
--- /dev/null
+++ b/loop/tests/test_psipred_prediction.cc
@@ -0,0 +1,158 @@
+#include <promod3/loop/psipred_prediction.hh>
+#include <promod3/core/message.hh>
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+
+BOOST_AUTO_TEST_SUITE( loop );
+using namespace promod3::loop;
+
+BOOST_AUTO_TEST_CASE(test_loading_from_hhm){
+
+  PsipredPredictionPtr p = PsipredPrediction::FromHHM("data/1A88A.hhm");
+
+  String expected_prediction = "CEEEECCCCEEEEEEECCCCCCEEEEECCCCCCHHHHHHHHHHHHH";
+  expected_prediction += "CCCEEEEECCCCCCCCCCCCCCCCHHHHHHHHHHHHHHCCCCCEEEEEECHH";
+  expected_prediction += "HHHHHHHHHHCCHHHCCEEEEECCCCCCCCCCCCCCCCCCHHHHHHHHHHHH";
+  expected_prediction += "HHHHHHHHHHHHHHHHCCCCCCCHHHHHHHHHHHHHHHHHHHHHHHHHHHHH";
+  expected_prediction += "HCCCHHHHHHHCCCCEEEEEECCCCCCCHHHHHHHHHHHCCCCEEEEECCCC";
+  expected_prediction += "CCHHHHCHHHHHHHHHHHHHC";
+
+  int expected_confidence[] = {9,5,9,9,1,4,9,9,2,8,9,9,9,9,8,1,5,8,8,9,9,8,6,9,
+  	                           9,9,8,9,9,9,9,9,7,7,7,9,9,9,9,9,9,9,9,9,8,6,8,9,
+  	                           8,8,9,9,9,6,6,8,9,9,8,9,9,9,9,9,9,8,8,8,9,9,9,9,
+  	                           9,9,9,9,9,9,9,9,9,9,9,8,1,9,9,9,8,6,9,9,9,9,8,8,
+  	                           8,8,9,9,9,9,9,9,9,9,8,6,3,8,0,1,1,1,3,8,9,9,9,8,
+  	                           7,8,7,6,1,0,0,0,1,3,3,3,5,4,3,2,3,2,7,8,9,9,9,9,
+  	                           9,9,9,9,8,7,6,4,8,9,9,9,9,8,6,3,1,2,1,1,1,1,0,1,
+  	                           3,4,3,1,0,1,0,2,7,8,9,9,9,9,9,9,9,8,6,3,1,1,0,6,
+  	                           8,8,9,9,9,9,9,9,7,5,1,0,1,2,6,7,7,8,8,5,3,8,9,9,
+  	                           9,8,9,9,9,9,5,8,9,9,8,6,6,9,8,9,9,9,9,9,9,9,9,8,
+  	                           4,8,9,9,8,8,9,9,9,8,9,9,9,8,6,4,4,5,5,2,9,9,9,9,
+  	                           9,9,9,9,9,9,9,9,8,4,9};
+
+  BOOST_CHECK(p->size() == expected_prediction.size());
+
+  for(uint i = 0; i < expected_prediction.size(); ++i){
+  	BOOST_CHECK(expected_prediction[i] == p->GetPrediction(i));
+  	BOOST_CHECK(expected_confidence[i] == p->GetConfidence(i));
+  }
+}
+
+BOOST_AUTO_TEST_CASE(test_loading_from_horiz){
+
+  PsipredPredictionPtr p = PsipredPrediction::FromHoriz("data/1akyA.horiz");
+
+  String expected_prediction = "CCCEEEEECCCCCCCCCHHHHHHHHHCCCCCCHHHHHHHHHHCCCH";
+  expected_prediction += "HHHHHHHHHHCCCCCHHHHHHHHHHHHHHCCCCCCCCEEECCCCCCHHHHHH";
+  expected_prediction += "HHHHHHHCCCCCCEEEEEECCHHHHHHHHHCCCCCCCCCCEEECCCCCCCCC";
+  expected_prediction += "CCCCCCCCCCCCCCCCCHHHHHHHHHHHHHCCCHHHHHHHHCCCEEEECCCC";
+  expected_prediction += "CHHHHHHHHHHHHCCC";
+
+  int expected_confidence[] = {9,6,0,4,9,9,9,7,6,9,9,9,9,9,3,5,1,5,7,7,9,9,9,8,
+  	                           8,2,9,9,6,0,1,5,5,2,8,9,9,9,9,9,9,8,2,9,9,4,3,4,
+  	                           9,9,9,9,9,9,7,6,3,9,9,9,6,2,8,9,9,9,9,9,9,9,9,9,
+  	                           7,4,1,4,9,9,9,8,7,7,7,0,1,1,1,8,9,9,9,9,8,9,8,9,
+  	                           9,9,9,9,9,9,9,9,7,2,9,9,9,7,6,7,9,9,9,8,4,3,9,6,
+  	                           8,9,9,9,9,9,7,5,4,5,3,2,3,7,9,9,9,6,2,3,2,0,1,2,
+  	                           7,9,9,8,7,8,8,7,7,7,8,7,9,7,6,3,2,1,5,8,9,9,9,9,
+  	                           9,9,9,9,9,9,9,9,9,9,9,5,0,5,0,4,6,9,9,9,9,6,6,1,
+  	                           9,7,7,8,8,3,0,7,9,9,9,5,7,8,9,9,9,9,9,9,9,7,3,4,
+  	                           5,9};
+
+  BOOST_CHECK(p->size() == expected_prediction.size());
+
+  for(uint i = 0; i < expected_prediction.size(); ++i){
+  	BOOST_CHECK(expected_prediction[i] == p->GetPrediction(i));
+  	BOOST_CHECK(expected_confidence[i] == p->GetConfidence(i));
+  }
+}
+
+BOOST_AUTO_TEST_CASE(test_init){
+
+
+  std::vector<char> invalid_pred;
+  std::vector<int> invalid_conf_one;
+  std::vector<int> invalid_conf_two;
+  std::vector<char> valid_pred;
+  std::vector<int> valid_conf;
+  std::vector<char> long_pred;
+
+  invalid_pred.push_back('H');
+  invalid_pred.push_back('X');
+  invalid_conf_one.push_back(4);
+  invalid_conf_one.push_back(-1);
+  invalid_conf_two.push_back(4);
+  invalid_conf_two.push_back(10);
+  valid_pred.push_back('C');
+  valid_pred.push_back('E');
+  valid_conf.push_back(1);
+  valid_conf.push_back(2);
+  long_pred.push_back('E');
+  long_pred.push_back('C');
+  long_pred.push_back('H');
+
+  BOOST_CHECK_THROW(PsipredPrediction(invalid_pred,valid_conf),promod3::Error);
+  BOOST_CHECK_THROW(PsipredPrediction(valid_pred,invalid_conf_one),promod3::Error);
+  BOOST_CHECK_THROW(PsipredPrediction(valid_pred,invalid_conf_two),promod3::Error);
+  BOOST_CHECK_THROW(PsipredPrediction(long_pred,valid_conf),promod3::Error);
+  BOOST_CHECK_NO_THROW(PsipredPrediction(valid_pred,valid_conf));
+}
+
+BOOST_AUTO_TEST_CASE(test_remaining_stuff){
+
+  std::vector<char> pred;
+  std::vector<int> conf;
+
+  pred.push_back('H');
+  pred.push_back('E');
+  pred.push_back('C');
+  pred.push_back('E');
+
+  conf.push_back(9);
+  conf.push_back(2);
+  conf.push_back(3);
+  conf.push_back(5);
+
+  PsipredPrediction p(pred,conf);
+
+  //check, whether the add functionality throws the expected exceptions
+  BOOST_CHECK(p.size() == 4);
+  BOOST_CHECK_THROW(p.Add('X',4),promod3::Error);
+  BOOST_CHECK_THROW(p.Add('H',-1),promod3::Error);
+  BOOST_CHECK_THROW(p.Add('H',10),promod3::Error);
+  BOOST_CHECK_NO_THROW(p.Add('H',5));
+  
+  //Check, wether the Getter functions properly check the indices
+  BOOST_CHECK_THROW(p.GetPrediction(-1),promod3::Error);
+  BOOST_CHECK_THROW(p.GetPrediction(10),promod3::Error);
+
+  BOOST_CHECK_THROW(p.GetConfidence(-1),promod3::Error);
+  BOOST_CHECK_THROW(p.GetConfidence(10),promod3::Error);
+
+  //check the size function
+  BOOST_CHECK(p.size() == 5);
+
+  //lets see whether the expected stuff is filled in...
+  String expected_pred = "HECEH";
+  int expected_conf[] = {9,2,3,5,5};
+
+  for(int i = 0; i < 5; ++i){
+  	BOOST_CHECK(expected_pred[i] == p.GetPrediction(i));
+  	BOOST_CHECK(expected_conf[i] == p.GetConfidence(i));
+  }
+
+  //Check, whether the extract function does the right thing
+  BOOST_CHECK_THROW(p.Extract(1,1),promod3::Error);
+  BOOST_CHECK_THROW(p.Extract(1,10),promod3::Error);
+  BOOST_CHECK_THROW(p.Extract(3,1),promod3::Error);
+
+  PsipredPredictionPtr p_two = p.Extract(1,3);
+  BOOST_CHECK(p_two->size() == 2);
+  BOOST_CHECK(p_two->GetPrediction(0) == 'E');
+  BOOST_CHECK(p_two->GetPrediction(1) == 'C');
+  BOOST_CHECK(p_two->GetConfidence(0) == 2);
+  BOOST_CHECK(p_two->GetConfidence(1) == 3);
+}
+
+BOOST_AUTO_TEST_SUITE_END();
diff --git a/loop/tests/test_ss_assignment.cc b/loop/tests/test_ss_assignment.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3a922811e06e00d5342c43759646cfdc1c717d1c
--- /dev/null
+++ b/loop/tests/test_ss_assignment.cc
@@ -0,0 +1,50 @@
+#include <promod3/loop/sec_struct.hh>
+#include <promod3/core/message.hh>
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+
+#include <ost/io/mol/pdb_reader.hh>
+#include <ost/conop/heuristic.hh>
+#include <ost/mol/builder.hh>
+
+BOOST_AUTO_TEST_SUITE( loop );
+
+using namespace promod3::loop;
+
+BOOST_AUTO_TEST_CASE(test_ss_assignment){
+
+  //load an entity to test...
+  String pdb_name = "data/3DEFA.pdb";
+
+  ost::io::PDBReader reader(pdb_name, ost::io::IOProfile());
+  ost::mol::EntityHandle test_ent = ost::mol::CreateEntity();
+  reader.Import(test_ent);
+
+  ost::conop::ProcessorPtr processor(new ost::conop::HeuristicProcessor(false,true,true,true,ost::conop::CONOP_SILENT));
+  processor->Process(test_ent);
+
+  ost::mol::ResidueHandleList res_list = test_ent.GetResidueList();
+
+  String sequence(res_list.size(),'X');
+
+  for(uint i = 0; i < res_list.size(); ++i){
+    sequence[i] = res_list[i].GetOneLetterCode();
+  }
+
+  BackboneList bb_list(sequence,res_list);
+
+  String ss_estimate;
+  EstimateSS(bb_list,ss_estimate);
+
+  String expected_output = "CBCHHHHTSCHHHHHHHHHHHHHHHHTTCCEEEEEEEECTTSSHHHHHHH";
+  expected_output += "HHTSCCSCCCSSCCSCCCEEEEEBETTEEEEEEECCCSEETTEECHHHHHHHHHHT";
+  expected_output += "TTCEECEEEEEEESSCSCCCHHHHHHHHHHHHHHCGGGGGGEEEEEECTTCCCSTT";
+  expected_output += "CCHHHHHHHHHHHHHHHHHHHHTCCHHHHHHHCCEEEECCCCTTCCBCTTSCEECT";
+  expected_output += "TSCBHHHHHHHHHHHHHTSCSCCEEC";
+
+  BOOST_CHECK(ss_estimate == expected_output);
+}
+
+
+BOOST_AUTO_TEST_SUITE_END();
diff --git a/modelling/pymod/_closegaps.py b/modelling/pymod/_closegaps.py
index 2a13fc64d96874d22f603078e5489716742c1261..65ff9bf5390736187c7a5090e914ae46e77a5f56 100644
--- a/modelling/pymod/_closegaps.py
+++ b/modelling/pymod/_closegaps.py
@@ -121,16 +121,17 @@ def CloseSmallDeletions(mhandle, scorer, extension_steps=9, clash_thresh=1.0,
                 # gather residues for backbone relaxation, check that we get a
                 # bunch of actual residues, otherwise jump to next extension
                 res_list = list()
-                current_resnum = current_gap.before.GetNumber()
-                after_resnum = current_gap.after.GetNumber()
+                n_stem_resnum = current_gap.before.GetNumber()
+                c_stem_resnum = current_gap.after.GetNumber()
+                idx = 0
                 found_residues = True
-                while current_resnum <= after_resnum:
-                    res = current_chain.FindResidue(current_resnum)
+                while n_stem_resnum + idx <= c_stem_resnum:
+                    res = current_chain.FindResidue(n_stem_resnum+idx)
                     if not res.IsValid():
                         found_residues = False
                         break
                     res_list.append(res)
-                    current_resnum += 1
+                    idx += 1
                 if not found_residues:
                     continue
                 # backbone relaxation, for now we allow 300 steps or stop at
@@ -141,7 +142,7 @@ def CloseSmallDeletions(mhandle, scorer, extension_steps=9, clash_thresh=1.0,
                 # check for clashes
                 score = scorer.CalculateClashScore(\
                                         bb_list,
-                                        current_gap.before.GetNumber().GetNum(),
+                                        n_stem_resnum.GetNum(),
                                         current_chain_index)
                 # if there is no clash and potential energy is low enough we
                 # just solved a gap, delete it and update the scorer for the
@@ -152,11 +153,10 @@ def CloseSmallDeletions(mhandle, scorer, extension_steps=9, clash_thresh=1.0,
                     ost.LogInfo("Closed: %s by relaxing %s" % \
                                    (mhandle.gaps[current_gap_index], current_gap))
                     chain = current_gap.before.GetChain()
-                    bb_list.InsertInto(chain, current_gap.before.GetNumber().GetNum(),
-                                       current_gap.after.GetNumber().GetNum())
-                    scorer.SetEnvironment(\
-                                        bb_list,
-                                        current_gap.before.GetNumber().GetNum())
+                    bb_list.InsertInto(chain, n_stem_resnum,
+                                       current_chain_index)
+                    scorer.SetEnvironment(bb_list, n_stem_resnum,
+                                          current_chain_index)
                     modelling.ClearGaps(mhandle, current_gap)
                     success = True
                     break
@@ -452,7 +452,8 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
             # try to close loops
             try:
                 #pylint: disable=broad-except
-                candidates.ApplyCCD(torsion_sampler)
+                candidates.ApplyCCD(actual_gap.before, actual_gap.after,
+                                    torsion_sampler)
             except Exception:
                 # ccd requires the residues before and after the stems
                 # to be valid, it could be that we extend too much...
@@ -490,20 +491,14 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
                 frame_backbone_list[i] = frame_backbone
             actual_res_num += 1
 
-        overall_before_residue = actual_chain.FindResidue(
-            ost.mol.ResNum(min_before_resnum))
-        overall_after_residue = actual_chain.FindResidue(
-            ost.mol.ResNum(max_after_resnum))
-        final_loop_candidates = loop.LoopCandidates(overall_before_residue,
-                                                    overall_after_residue,
-                                                    frame_seq)
+        final_loop_candidates = loop.LoopCandidates(frame_seq)
 
         ##################################
         # prepare loop candidates for scoring
         ##################################
         back_mapper = list()
         for i, loop_candidates in enumerate(actual_candidates):
-            start_index = loop_candidates.GetNStem().GetNumber().GetNum()\
+            start_index = actual_extended_gaps[i].before.GetNumber().GetNum()\
                           - min_before_resnum
             for j, loop_candidate in enumerate(loop_candidates):
                 actual_frame_backbone_list = frame_backbone_list
@@ -513,11 +508,16 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
                 back_mapper.append((i, j))
 
         final_loop_candidates.AttachScorer(scorer)
-        final_loop_candidates.CalculateClashScores(actual_chain_idx)
-        final_loop_candidates.CalculateCBetaScores(actual_chain_idx)
-        final_loop_candidates.CalculateTorsionScores(actual_chain_idx)
-        final_loop_candidates.CalculateCBPackingScores(actual_chain_idx)
-        final_loop_candidates.CalculateHBondScores(actual_chain_idx)
+        final_loop_candidates.CalculateClashScores(min_before_resnum, 
+                                                   actual_chain_idx)
+        final_loop_candidates.CalculateCBetaScores(min_before_resnum, 
+                                                   actual_chain_idx)
+        final_loop_candidates.CalculateTorsionScores(min_before_resnum, 
+                                                     actual_chain_idx)
+        final_loop_candidates.CalculateCBPackingScores(min_before_resnum, 
+                                                       actual_chain_idx)
+        final_loop_candidates.CalculateHBondScores(min_before_resnum, 
+                                                   actual_chain_idx)
 
         ##################################
         # compare scores
@@ -546,13 +546,12 @@ def FillLoopsByDatabase(mhandle, scorer, fragment_db, structure_db,
             idx_a = back_mapper[optimal_candidate][0]
             idx_b = back_mapper[optimal_candidate][1]
             # update model
-            actual_candidates[idx_a].InsertInto(mhandle.model, idx_b)
-            # update scorer
+            start_resnum = actual_extended_gaps[idx_a].before.GetNumber()
             bb_list = actual_candidates[idx_a][idx_b].bb_list
-            scorer.SetEnvironment(\
-                       bb_list,
-                       actual_candidates[idx_a].GetNStem().GetNumber().GetNum(),
-                       actual_chain_idx)
+            bb_list.InsertInto(mhandle.model.chains[actual_chain_idx],
+                               start_resnum, actual_chain_idx)
+            # update scorer
+            scorer.SetEnvironment(bb_list, start_resnum, actual_chain_idx)
             ost.LogInfo("Resolved %s by filling %s (%d candidates)" % \
                         (str(gap_orig),
                          str(actual_extended_gaps[idx_a]),
@@ -679,8 +678,9 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
                 weights["cbeta"]=5.0
                 weights["cb_packing"]=1.0
                 weights["clash"]=0.05
-                mc_scorer = loop.LinearScorer(scorer, actual_gap.before.GetNumber().GetNum(),
-                                              actual_chain_idx, weights)
+                mc_scorer = loop.LinearScorer(
+                        scorer, actual_gap.before.GetNumber().GetNum(),
+                        actual_chain_idx, weights)
 
                 mc_cooler = loop.ExponentialCooler(200,100,0.9)
             except:
@@ -692,9 +692,8 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
             try:
                 ost.LogVerbose("Firing MC for " + str(actual_gap))
                 candidates = loop.LoopCandidates.FillFromMonteCarloSampler(
-                    actual_gap.before, actual_gap.after, actual_gap.full_seq,
-                    mc_num_loops, mc_steps, mc_sampler, mc_closer,
-                    mc_scorer, mc_cooler)
+                    actual_gap.full_seq, mc_num_loops, mc_steps, mc_sampler,
+                    mc_closer, mc_scorer, mc_cooler)
             except RuntimeError:
                 # monte carlo cannot be initialized when the stems are too far apart
                 # => we need further loop extension
@@ -736,20 +735,14 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
                 frame_backbone_list[i] = frame_backbone
             actual_res_num += 1
 
-        overall_before_residue = actual_chain.FindResidue(
-            ost.mol.ResNum(min_before_resnum))
-        overall_after_residue = actual_chain.FindResidue(
-            ost.mol.ResNum(max_after_resnum))
-        final_loop_candidates = loop.LoopCandidates(overall_before_residue,
-                                                    overall_after_residue,
-                                                    frame_seq)
+        final_loop_candidates = loop.LoopCandidates(frame_seq)
 
         ##################################
         # prepare loop candidates for scoring (NOTE: identical to DB)
         ##################################
         back_mapper = list()
         for i, loop_candidates in enumerate(actual_candidates):
-            start_index = loop_candidates.GetNStem().GetNumber().GetNum()\
+            start_index = actual_extended_gaps[i].before.GetNumber().GetNum()\
                           - min_before_resnum
             for j, loop_candidate in enumerate(loop_candidates):
                 actual_frame_backbone_list = frame_backbone_list
@@ -759,11 +752,16 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
                 back_mapper.append((i,j))
                 
         final_loop_candidates.AttachScorer(scorer)
-        final_loop_candidates.CalculateClashScores(actual_chain_idx)
-        final_loop_candidates.CalculateCBetaScores(actual_chain_idx)
-        final_loop_candidates.CalculateTorsionScores(actual_chain_idx)
-        final_loop_candidates.CalculateCBPackingScores(actual_chain_idx)
-        final_loop_candidates.CalculateHBondScores(actual_chain_idx)
+        final_loop_candidates.CalculateClashScores(min_before_resnum, 
+                                                   actual_chain_idx)
+        final_loop_candidates.CalculateCBetaScores(min_before_resnum, 
+                                                   actual_chain_idx)
+        final_loop_candidates.CalculateTorsionScores(min_before_resnum, 
+                                                     actual_chain_idx)
+        final_loop_candidates.CalculateCBPackingScores(min_before_resnum, 
+                                                       actual_chain_idx)
+        final_loop_candidates.CalculateHBondScores(min_before_resnum, 
+                                                   actual_chain_idx)
 
         ##################################
         # compare scores (NOTE: can be made identical to DB)
@@ -790,13 +788,12 @@ def FillLoopsByMonteCarlo(mhandle, scorer, torsion_sampler, max_loops_to_search=
             idx_a = back_mapper[optimal_candidate][0]
             idx_b = back_mapper[optimal_candidate][1]
             # update model
-            actual_candidates[idx_a].InsertInto(mhandle.model, idx_b)
-            # update scorer
+            start_resnum = actual_extended_gaps[idx_a].before.GetNumber()
             bb_list = actual_candidates[idx_a][idx_b].bb_list
-            scorer.SetEnvironment(\
-                       bb_list,
-                       actual_candidates[idx_a].GetNStem().GetNumber().GetNum(),
-                       actual_chain_idx)
+            bb_list.InsertInto(mhandle.model.chains[actual_chain_idx],
+                               start_resnum, actual_chain_idx)
+            # update scorer
+            scorer.SetEnvironment(bb_list, start_resnum, actual_chain_idx)
             ost.LogInfo("Resolved %s by filling %s (%d candidates)" % \
                         (str(gap_orig),
                          str(actual_extended_gaps[idx_a]),
diff --git a/modelling/tests/data/1crn_build.pdb b/modelling/tests/data/1crn_build.pdb
index d6442a5c2894ec0706359d4fa291e898dfda9372..bb62cfddebfbc5c7a47e00c6ffb148db65269993 100644
--- a/modelling/tests/data/1crn_build.pdb
+++ b/modelling/tests/data/1crn_build.pdb
@@ -1,329 +1,329 @@
-ATOM      1  N   THR A   1      17.055  14.170   3.573  1.00 13.79           N  
-ATOM      2  CA  THR A   1      16.959  12.877   4.362  1.00 10.80           C  
-ATOM      3  C   THR A   1      15.697  12.787   5.169  1.00  9.19           C  
-ATOM      4  O   THR A   1      15.243  13.804   5.681  1.00  9.85           O  
-ATOM      5  CB  THR A   1      18.166  12.761   5.287  1.00 13.02           C  
-ATOM      6  OG1 THR A   1      19.334  12.714   4.477  1.00 15.06           O  
-ATOM      7  CG2 THR A   1      18.168  11.511   6.185  1.00 14.23           C  
-ATOM      8  N   THR A   2      15.087  11.587   5.299  1.00  7.81           N  
-ATOM      9  CA  THR A   2      13.820  11.412   6.003  1.00  8.31           C  
-ATOM     10  C   THR A   2      14.029  10.685   7.315  1.00  5.80           C  
-ATOM     11  O   THR A   2      14.692   9.651   7.385  1.00  6.94           O  
-ATOM     12  CB  THR A   2      12.739  10.686   5.199  1.00 10.32           C  
-ATOM     13  OG1 THR A   2      13.137   9.383   4.796  1.00 12.81           O  
-ATOM     14  CG2 THR A   2      12.465  11.458   3.905  1.00 11.90           C  
-ATOM     15  N   CYS A   3      13.474  11.234   8.407  1.00  5.24           N  
-ATOM     16  CA  CYS A   3      13.656  10.729   9.760  1.00  5.39           C  
-ATOM     17  C   CYS A   3      12.287  10.480  10.370  1.00  4.45           C  
-ATOM     18  O   CYS A   3      11.412  11.336  10.260  1.00  6.54           O  
-ATOM     19  CB  CYS A   3      14.388  11.771  10.640  1.00  5.99           C  
-ATOM     20  SG  CYS A   3      15.945  12.381   9.926  1.00  7.01           S  
-ATOM     21  N   CYS A   4      12.030   9.320  11.002  1.00  3.90           N  
-ATOM     22  CA  CYS A   4      10.699   8.968  11.472  1.00  4.24           C  
-ATOM     23  C   CYS A   4      10.678   8.737  12.981  1.00  3.72           C  
-ATOM     24  O   CYS A   4      11.673   8.282  13.542  1.00  5.30           O  
-ATOM     25  CB  CYS A   4      10.172   7.709  10.747  1.00  4.41           C  
-ATOM     26  SG  CYS A   4       9.837   8.008   8.982  1.00  0.00           S  
-ATOM     27  N   PRO A   5       9.596   9.037  13.704  1.00  3.96           N  
-ATOM     28  CA  PRO A   5       9.577   8.975  15.169  1.00  4.25           C  
-ATOM     29  C   PRO A   5       9.323   7.570  15.685  1.00  4.96           C  
-ATOM     30  O   PRO A   5       9.411   7.342  16.888  1.00  7.44           O  
-ATOM     31  CB  PRO A   5       8.381   9.880  15.518  1.00  5.11           C  
-ATOM     32  CG  PRO A   5       7.412   9.673  14.352  1.00  5.24           C  
-ATOM     33  CD  PRO A   5       8.369   9.637  13.167  1.00  5.20           C  
-ATOM     34  N   SER A   6       8.941   6.616  14.820  1.00  4.83           N  
-ATOM     35  CA  SER A   6       8.656   5.263  15.240  1.00  4.45           C  
-ATOM     36  C   SER A   6       8.756   4.363  14.030  1.00  4.99           C  
-ATOM     37  O   SER A   6       8.707   4.809  12.883  1.00  4.61           O  
-ATOM     38  CB  SER A   6       7.276   5.075  15.952  1.00  5.05           C  
-ATOM     39  OG  SER A   6       6.156   5.097  15.056  1.00  6.39           O  
-ATOM     40  N   ILE A   7       8.881   3.045  14.263  1.00  4.94           N  
-ATOM     41  CA  ILE A   7       8.882   2.013  13.237  1.00  6.33           C  
-ATOM     42  C   ILE A   7       7.579   1.986  12.435  1.00  5.32           C  
-ATOM     43  O   ILE A   7       7.585   1.876  11.212  1.00  6.85           O  
-ATOM     44  CB  ILE A   7       9.219   0.673  13.893  1.00  8.43           C  
-ATOM     45  CG1 ILE A   7      10.712   0.677  14.316  1.00  9.78           C  
-ATOM     46  CG2 ILE A   7       8.907  -0.511  12.951  1.00 11.70           C  
-ATOM     47  CD1 ILE A   7      11.132  -0.542  15.147  1.00  9.92           C  
-ATOM     48  N   VAL A   8       6.416   2.161  13.101  1.00  5.02           N  
-ATOM     49  CA  VAL A   8       5.109   2.266  12.452  1.00  6.93           C  
-ATOM     50  C   VAL A   8       5.037   3.440  11.486  1.00  5.39           C  
-ATOM     51  O   VAL A   8       4.580   3.314  10.350  1.00  6.30           O  
-ATOM     52  CB  VAL A   8       4.003   2.393  13.502  1.00  9.64           C  
-ATOM     53  CG1 VAL A   8       2.648   2.815  12.893  1.00 13.85           C  
-ATOM     54  CG2 VAL A   8       3.839   1.037  14.211  1.00 11.97           C  
-ATOM     55  N   ALA A   9       5.555   4.610  11.905  1.00  3.73           N  
-ATOM     56  CA  ALA A   9       5.647   5.795  11.081  1.00  3.56           C  
-ATOM     57  C   ALA A   9       6.500   5.603   9.826  1.00  4.13           C  
-ATOM     58  O   ALA A   9       6.095   5.955   8.718  1.00  4.36           O  
-ATOM     59  CB  ALA A   9       6.210   6.922  11.958  1.00  4.80           C  
-ATOM     60  N   ARG A  10       7.678   4.958   9.958  1.00  3.73           N  
-ATOM     61  CA  ARG A  10       8.513   4.576   8.830  1.00  3.38           C  
-ATOM     62  C   ARG A  10       7.866   3.588   7.867  1.00  3.47           C  
-ATOM     63  O   ARG A  10       7.937   3.750   6.648  1.00  4.67           O  
-ATOM     64  CB  ARG A  10       9.853   3.989   9.334  1.00  3.95           C  
-ATOM     65  CG  ARG A  10      10.844   3.550   8.228  1.00  4.55           C  
-ATOM     66  CD  ARG A  10      11.291   4.651   7.257  1.00  5.89           C  
-ATOM     67  NE  ARG A  10      12.180   5.560   8.027  1.00  6.20           N  
-ATOM     68  CZ  ARG A  10      12.841   6.605   7.523  1.00  7.52           C  
-ATOM     69  NH1 ARG A  10      12.702   6.977   6.257  1.00 10.68           N  
-ATOM     70  NH2 ARG A  10      13.639   7.298   8.322  1.00  9.48           N  
-ATOM     71  N   SER A  11       7.188   2.544   8.378  1.00  5.19           N  
-ATOM     72  CA  SER A  11       6.460   1.589   7.548  1.00  4.60           C  
-ATOM     73  C   SER A  11       5.335   2.226   6.751  1.00  4.84           C  
-ATOM     74  O   SER A  11       5.209   2.007   5.547  1.00  5.84           O  
-ATOM     75  CB  SER A  11       5.874   0.431   8.385  1.00  5.91           C  
-ATOM     76  OG  SER A  11       6.941  -0.341   8.934  1.00  8.38           O  
-ATOM     77  N   ASN A  12       4.535   3.105   7.393  1.00  3.54           N  
-ATOM     78  CA  ASN A  12       3.522   3.916   6.733  1.00  4.57           C  
-ATOM     79  C   ASN A  12       4.112   4.876   5.697  1.00  4.14           C  
-ATOM     80  O   ASN A  12       3.562   5.043   4.610  1.00  5.52           O  
-ATOM     81  CB  ASN A  12       2.696   4.717   7.773  1.00  6.42           C  
-ATOM     82  CG  ASN A  12       1.866   3.763   8.625  1.00  8.25           C  
-ATOM     83  OD1 ASN A  12       1.605   2.614   8.272  1.00 12.72           O  
-ATOM     84  ND2 ASN A  12       1.395   4.260   9.791  1.00  9.92           N  
-ATOM     85  N   PHE A  13       5.277   5.504   5.985  1.00  3.43           N  
-ATOM     86  CA  PHE A  13       6.007   6.342   5.039  1.00  3.49           C  
-ATOM     87  C   PHE A  13       6.391   5.602   3.763  1.00  3.40           C  
-ATOM     88  O   PHE A  13       6.166   6.085   2.656  1.00  4.07           O  
-ATOM     89  CB  PHE A  13       7.297   6.904   5.711  1.00  5.48           C  
-ATOM     90  CG  PHE A  13       8.035   7.860   4.818  1.00  5.57           C  
-ATOM     91  CD1 PHE A  13       9.142   7.418   4.074  1.00  6.99           C  
-ATOM     92  CD2 PHE A  13       7.583   9.177   4.662  1.00  6.52           C  
-ATOM     93  CE1 PHE A  13       9.772   8.277   3.167  1.00  8.20           C  
-ATOM     94  CE2 PHE A  13       8.223  10.049   3.773  1.00  6.34           C  
-ATOM     95  CZ  PHE A  13       9.307   9.591   3.017  1.00  6.84           C  
-ATOM     96  N   ASN A  14       6.947   4.387   3.894  1.00  3.64           N  
-ATOM     97  CA  ASN A  14       7.350   3.575   2.763  1.00  4.31           C  
-ATOM     98  C   ASN A  14       6.172   3.168   1.873  1.00  3.98           C  
-ATOM     99  O   ASN A  14       6.250   3.277   0.652  1.00  6.22           O  
-ATOM    100  CB  ASN A  14       8.155   2.347   3.258  1.00  5.81           C  
-ATOM    101  CG  ASN A  14       9.490   2.800   3.853  1.00  6.82           C  
-ATOM    102  OD1 ASN A  14       9.983   3.911   3.657  1.00  9.43           O  
-ATOM    103  ND2 ASN A  14      10.141   1.885   4.607  1.00  8.21           N  
-ATOM    104  N   VAL A  15       5.021   2.765   2.459  1.00  3.76           N  
-ATOM    105  CA  VAL A  15       3.782   2.519   1.715  1.00  3.98           C  
-ATOM    106  C   VAL A  15       3.248   3.762   1.014  1.00  3.80           C  
-ATOM    107  O   VAL A  15       2.864   3.722  -0.154  1.00  4.85           O  
-ATOM    108  CB  VAL A  15       2.697   1.918   2.606  1.00  4.71           C  
-ATOM    109  CG1 VAL A  15       1.356   1.767   1.854  1.00  6.67           C  
-ATOM    110  CG2 VAL A  15       3.174   0.534   3.079  1.00  6.26           C  
-ATOM    111  N   CYS A  16       3.271   4.926   1.690  1.00  3.79           N  
-ATOM    112  CA  CYS A  16       2.892   6.211   1.123  1.00  3.54           C  
-ATOM    113  C   CYS A  16       3.722   6.595  -0.101  1.00  3.48           C  
-ATOM    114  O   CYS A  16       3.213   7.158  -1.070  1.00  4.63           O  
-ATOM    115  CB  CYS A  16       2.985   7.298   2.227  1.00  4.58           C  
-ATOM    116  SG  CYS A  16       2.400   8.945   1.711  1.00  0.00           S  
-ATOM    117  N   ARG A  17       5.029   6.278  -0.088  1.00  3.99           N  
-ATOM    118  CA  ARG A  17       5.940   6.527  -1.186  1.00  3.83           C  
-ATOM    119  C   ARG A  17       5.816   5.581  -2.379  1.00  3.79           C  
-ATOM    120  O   ARG A  17       6.274   5.931  -3.465  1.00  5.39           O  
-ATOM    121  CB  ARG A  17       7.399   6.499  -0.659  1.00  4.11           C  
-ATOM    122  CG  ARG A  17       7.757   7.715   0.220  1.00  4.69           C  
-ATOM    123  CD  ARG A  17       7.914   9.031  -0.550  1.00  5.10           C  
-ATOM    124  NE  ARG A  17       9.204   8.932  -1.303  1.00  4.71           N  
-ATOM    125  CZ  ARG A  17       9.509   9.606  -2.418  1.00  5.28           C  
-ATOM    126  NH1 ARG A  17       8.619  10.341  -3.078  1.00  6.67           N  
-ATOM    127  NH2 ARG A  17      10.763   9.546  -2.865  1.00  6.41           N  
-ATOM    128  N   LEU A  18       5.163   4.403  -2.251  1.00  4.70           N  
-ATOM    129  CA  LEU A  18       4.982   3.452  -3.352  1.00  5.46           C  
-ATOM    130  C   LEU A  18       4.297   4.004  -4.615  1.00  5.13           C  
-ATOM    131  O   LEU A  18       4.811   3.721  -5.696  1.00  5.55           O  
-ATOM    132  CB  LEU A  18       4.206   2.176  -2.907  1.00  6.47           C  
-ATOM    133  CG  LEU A  18       4.966   1.173  -2.018  1.00  7.43           C  
-ATOM    134  CD1 LEU A  18       3.997   0.071  -1.562  1.00  8.70           C  
-ATOM    135  CD2 LEU A  18       6.158   0.530  -2.741  1.00  9.39           C  
-ATOM    136  N   PRO A  19       3.212   4.786  -4.630  1.00  4.28           N  
-ATOM    137  CA  PRO A  19       2.696   5.374  -5.865  1.00  5.38           C  
-ATOM    138  C   PRO A  19       3.519   6.551  -6.369  1.00  6.30           C  
-ATOM    139  O   PRO A  19       3.170   7.112  -7.404  1.00  9.62           O  
-ATOM    140  CB  PRO A  19       1.245   5.770  -5.544  1.00  5.87           C  
-ATOM    141  CG  PRO A  19       1.129   5.806  -4.016  1.00  6.47           C  
-ATOM    142  CD  PRO A  19       2.286   4.946  -3.506  1.00  6.45           C  
-ATOM    143  N   GLY A  20       4.588   6.976  -5.663  1.00  4.94           N  
-ATOM    144  CA  GLY A  20       5.419   8.095  -6.096  1.00  5.39           C  
-ATOM    145  C   GLY A  20       5.077   9.407  -5.451  1.00  5.03           C  
-ATOM    146  O   GLY A  20       5.637  10.440  -5.811  1.00  7.34           O  
-ATOM    147  N   THR A  21       4.166   9.407  -4.456  1.00  4.10           N  
-ATOM    148  CA  THR A  21       3.758  10.568  -3.659  1.00  3.94           C  
-ATOM    149  C   THR A  21       4.943  11.387  -3.140  1.00  3.96           C  
-ATOM    150  O   THR A  21       5.888  10.785  -2.614  1.00  5.82           O  
-ATOM    151  CB  THR A  21       2.919  10.159  -2.456  1.00  4.13           C  
-ATOM    152  OG1 THR A  21       1.883   9.279  -2.862  1.00  5.45           O  
-ATOM    153  CG2 THR A  21       2.253  11.354  -1.745  1.00  5.41           C  
-ATOM    154  N   PRO A  22       5.013  12.720  -3.270  1.00  5.04           N  
-ATOM    155  CA  PRO A  22       6.092  13.539  -2.719  1.00  4.69           C  
-ATOM    156  C   PRO A  22       6.439  13.279  -1.266  1.00  4.19           C  
-ATOM    157  O   PRO A  22       5.540  13.036  -0.460  1.00  4.47           O  
-ATOM    158  CB  PRO A  22       5.635  14.989  -2.938  1.00  7.12           C  
-ATOM    159  CG  PRO A  22       4.668  14.910  -4.121  1.00  7.03           C  
-ATOM    160  CD  PRO A  22       4.006  13.544  -3.946  1.00  4.90           C  
-ATOM    161  N   GLU A  23       7.732  13.369  -0.889  1.00  5.16           N  
-ATOM    162  CA  GLU A  23       8.161  13.178   0.485  1.00  5.31           C  
-ATOM    163  C   GLU A  23       7.497  14.128   1.464  1.00  4.11           C  
-ATOM    164  O   GLU A  23       7.125  13.714   2.551  1.00  5.11           O  
-ATOM    165  CB  GLU A  23       9.699  13.264   0.646  1.00  6.16           C  
-ATOM    166  CG  GLU A  23      10.443  12.076  -0.005  1.00  7.48           C  
-ATOM    167  CD  GLU A  23      11.918  11.974   0.381  1.00  9.40           C  
-ATOM    168  OE1 GLU A  23      12.483  12.943   0.944  1.00 10.40           O  
-ATOM    169  OE2 GLU A  23      12.466  10.870   0.122  1.00 13.32           O  
-ATOM    170  N   ALA A  24       7.285  15.410   1.109  1.00  4.56           N  
-ATOM    171  CA  ALA A  24       6.612  16.370   1.966  1.00  4.49           C  
-ATOM    172  C   ALA A  24       5.173  16.007   2.340  1.00  4.10           C  
-ATOM    173  O   ALA A  24       4.771  16.101   3.497  1.00  5.64           O  
-ATOM    174  CB  ALA A  24       6.626  17.725   1.239  1.00  5.80           C  
-ATOM    175  N   ILE A  25       4.372  15.542   1.357  1.00  0.00           N  
-ATOM    176  CA  ILE A  25       3.023  15.032   1.584  1.00  0.00           C  
-ATOM    177  C   ILE A  25       3.033  13.748   2.391  1.00  0.00           C  
-ATOM    178  O   ILE A  25       2.258  13.574   3.324  1.00  0.00           O  
-ATOM    179  CB  ILE A  25       2.274  14.810   0.267  1.00  0.00           C  
-ATOM    180  CG1 ILE A  25       2.068  16.167  -0.444  1.00  0.00           C  
-ATOM    181  CG2 ILE A  25       0.909  14.114   0.507  1.00  0.00           C  
-ATOM    182  CD1 ILE A  25       1.532  16.038  -1.873  1.00  0.00           C  
-ATOM    183  N   CYS A  26       3.924  12.791   2.080  1.00  0.00           N  
-ATOM    184  CA  CYS A  26       4.003  11.593   2.894  1.00  0.00           C  
-ATOM    185  C   CYS A  26       4.520  11.796   4.297  1.00  0.00           C  
-ATOM    186  O   CYS A  26       3.931  11.284   5.242  1.00  0.00           O  
-ATOM    187  CB  CYS A  26       4.881  10.517   2.224  1.00  0.00           C  
-ATOM    188  SG  CYS A  26       4.020   9.793   0.824  1.00  0.00           S  
-ATOM    189  N   ALA A  27       5.629  12.536   4.475  1.00  0.00           N  
-ATOM    190  CA  ALA A  27       6.383  12.536   5.709  1.00  0.00           C  
-ATOM    191  C   ALA A  27       5.594  13.018   6.901  1.00  0.00           C  
-ATOM    192  O   ALA A  27       5.400  12.278   7.856  1.00  0.00           O  
-ATOM    193  CB  ALA A  27       7.661  13.392   5.556  1.00  0.00           C  
-ATOM    194  N   THR A  28       5.017  14.227   6.827  1.00  0.00           N  
-ATOM    195  CA  THR A  28       4.317  14.839   7.956  1.00  0.00           C  
-ATOM    196  C   THR A  28       3.119  14.027   8.418  1.00  0.00           C  
-ATOM    197  O   THR A  28       2.887  13.839   9.611  1.00  0.00           O  
-ATOM    198  CB  THR A  28       3.883  16.267   7.635  1.00  0.00           C  
-ATOM    199  OG1 THR A  28       5.028  17.056   7.339  1.00  0.00           O  
-ATOM    200  CG2 THR A  28       3.178  16.921   8.833  1.00  0.00           C  
-ATOM    201  N   TYR A  29       2.334  13.469   7.481  1.00  0.00           N  
-ATOM    202  CA  TYR A  29       1.128  12.728   7.803  1.00  0.00           C  
-ATOM    203  C   TYR A  29       1.396  11.298   8.263  1.00  0.00           C  
-ATOM    204  O   TYR A  29       0.546  10.659   8.879  1.00  0.00           O  
-ATOM    205  CB  TYR A  29       0.188  12.706   6.576  1.00  0.00           C  
-ATOM    206  CG  TYR A  29      -0.392  14.075   6.319  1.00  0.00           C  
-ATOM    207  CD1 TYR A  29       0.240  14.973   5.445  1.00  0.00           C  
-ATOM    208  CD2 TYR A  29      -1.608  14.457   6.912  1.00  0.00           C  
-ATOM    209  CE1 TYR A  29      -0.346  16.203   5.125  1.00  0.00           C  
-ATOM    210  CE2 TYR A  29      -2.201  15.691   6.599  1.00  0.00           C  
-ATOM    211  CZ  TYR A  29      -1.573  16.556   5.693  1.00  0.00           C  
-ATOM    212  OH  TYR A  29      -2.177  17.775   5.332  1.00  0.00           O  
-ATOM    213  N   THR A  30       2.605  10.761   8.031  1.00  0.00           N  
-ATOM    214  CA  THR A  30       2.999   9.466   8.583  1.00  0.00           C  
-ATOM    215  C   THR A  30       3.781   9.652   9.871  1.00  0.00           C  
-ATOM    216  O   THR A  30       4.102   8.687  10.554  1.00  0.00           O  
-ATOM    217  CB  THR A  30       3.818   8.634   7.597  1.00  0.00           C  
-ATOM    218  OG1 THR A  30       5.010   9.290   7.198  1.00  0.00           O  
-ATOM    219  CG2 THR A  30       2.989   8.381   6.319  1.00  0.00           C  
-ATOM    220  N   GLY A  31       4.046  10.915  10.269  1.00  0.00           N  
-ATOM    221  CA  GLY A  31       4.737  11.308  11.504  1.00  0.00           C  
-ATOM    222  C   GLY A  31       6.147  11.792  11.263  1.00  0.00           C  
-ATOM    223  O   GLY A  31       6.792  12.401  12.124  1.00  0.00           O  
-ATOM    224  N   CYS A  32       6.707  11.440  10.107  1.00  4.30           N  
-ATOM    225  CA  CYS A  32       8.077  11.673   9.715  1.00  4.89           C  
-ATOM    226  C   CYS A  32       8.445  13.103   9.303  1.00  5.50           C  
-ATOM    227  O   CYS A  32       7.607  13.949   9.003  1.00  5.82           O  
-ATOM    228  CB  CYS A  32       8.476  10.711   8.578  1.00  4.66           C  
-ATOM    229  SG  CYS A  32       8.059   8.978   8.956  1.00  0.00           S  
-ATOM    230  N   ILE A  33       9.759  13.413   9.269  1.00  6.02           N  
-ATOM    231  CA  ILE A  33      10.249  14.736   8.900  1.00  5.24           C  
-ATOM    232  C   ILE A  33      11.293  14.632   7.807  1.00  5.16           C  
-ATOM    233  O   ILE A  33      11.911  13.586   7.600  1.00  7.19           O  
-ATOM    234  CB  ILE A  33      10.816  15.522  10.086  1.00  5.49           C  
-ATOM    235  CG1 ILE A  33      12.043  14.825  10.721  1.00  6.85           C  
-ATOM    236  CG2 ILE A  33       9.671  15.720  11.104  1.00  6.45           C  
-ATOM    237  CD1 ILE A  33      12.736  15.658  11.806  1.00  8.94           C  
-ATOM    238  N   ILE A  34      11.519  15.741   7.076  1.00  5.52           N  
-ATOM    239  CA  ILE A  34      12.549  15.860   6.054  1.00  6.82           C  
-ATOM    240  C   ILE A  34      13.561  16.856   6.572  1.00  6.92           C  
-ATOM    241  O   ILE A  34      13.213  17.966   6.969  1.00  9.22           O  
-ATOM    242  CB  ILE A  34      12.026  16.370   4.709  1.00  8.11           C  
-ATOM    243  CG1 ILE A  34      10.932  15.434   4.158  1.00  9.59           C  
-ATOM    244  CG2 ILE A  34      13.182  16.504   3.683  1.00  9.73           C  
-ATOM    245  CD1 ILE A  34      10.162  16.057   2.995  1.00 13.41           C  
-ATOM    246  N   ILE A  35      14.852  16.480   6.588  1.00  7.06           N  
-ATOM    247  CA  ILE A  35      15.928  17.368   6.993  1.00  7.52           C  
-ATOM    248  C   ILE A  35      16.911  17.541   5.835  1.00  6.63           C  
-ATOM    249  O   ILE A  35      17.043  16.627   5.007  1.00  7.90           O  
-ATOM    250  CB  ILE A  35      16.647  16.907   8.262  1.00  8.07           C  
-ATOM    251  CG1 ILE A  35      17.337  15.534   8.098  1.00  9.41           C  
-ATOM    252  CG2 ILE A  35      15.625  16.905   9.421  1.00  9.46           C  
-ATOM    253  CD1 ILE A  35      18.260  15.190   9.270  1.00  9.85           C  
-ATOM    254  N   PRO A  36      17.610  18.681   5.706  1.00  8.07           N  
-ATOM    255  CA  PRO A  36      18.634  18.864   4.679  1.00  8.78           C  
-ATOM    256  C   PRO A  36      19.873  18.018   4.929  1.00  8.31           C  
-ATOM    257  O   PRO A  36      20.505  17.583   3.971  1.00  9.09           O  
-ATOM    258  CB  PRO A  36      18.955  20.374   4.681  1.00  9.67           C  
-ATOM    259  CG  PRO A  36      18.263  20.995   5.906  1.00 10.15           C  
-ATOM    260  CD  PRO A  36      17.371  19.898   6.494  1.00  9.53           C  
-ATOM    261  N   GLY A  37      20.255  17.799   6.205  1.00  8.48           N  
-ATOM    262  CA  GLY A  37      21.404  16.976   6.583  1.00  9.20           C  
-ATOM    263  C   GLY A  37      21.174  15.485   6.488  1.00 10.41           C  
-ATOM    264  O   GLY A  37      20.158  15.010   5.994  1.00 12.06           O  
-ATOM    265  N   ALA A  38      22.131  14.681   6.985  1.00  9.24           N  
-ATOM    266  CA  ALA A  38      22.041  13.229   6.948  1.00  9.24           C  
-ATOM    267  C   ALA A  38      21.922  12.593   8.325  1.00  9.60           C  
-ATOM    268  O   ALA A  38      21.787  11.379   8.452  1.00 13.65           O  
-ATOM    269  CB  ALA A  38      23.292  12.681   6.238  1.00 10.43           C  
-ATOM    270  N   THR A  39      21.924  13.409   9.391  1.00  8.70           N  
-ATOM    271  CA  THR A  39      22.001  12.917  10.762  1.00  9.46           C  
-ATOM    272  C   THR A  39      20.681  13.188  11.430  1.00  8.32           C  
-ATOM    273  O   THR A  39      20.370  14.321  11.790  1.00  9.89           O  
-ATOM    274  CB  THR A  39      23.102  13.595  11.579  1.00 10.72           C  
-ATOM    275  OG1 THR A  39      24.336  13.513  10.879  1.00 11.66           O  
-ATOM    276  CG2 THR A  39      23.307  12.895  12.931  1.00 11.81           C  
-ATOM    277  N   CYS A  40      19.840  12.151  11.593  1.00  7.64           N  
-ATOM    278  CA  CYS A  40      18.561  12.278  12.269  1.00  8.05           C  
-ATOM    279  C   CYS A  40      18.703  12.511  13.781  1.00  7.63           C  
-ATOM    280  O   CYS A  40      19.602  11.926  14.390  1.00  9.64           O  
-ATOM    281  CB  CYS A  40      17.675  11.038  12.000  1.00  7.80           C  
-ATOM    282  SG  CYS A  40      17.232  10.850  10.242  1.00  7.30           S  
-ATOM    283  N   PRO A  41      17.894  13.344  14.445  1.00  8.00           N  
-ATOM    284  CA  PRO A  41      17.918  13.482  15.902  1.00  8.96           C  
-ATOM    285  C   PRO A  41      17.362  12.258  16.624  1.00  9.06           C  
-ATOM    286  O   PRO A  41      16.726  11.403  16.012  1.00  8.82           O  
-ATOM    287  CB  PRO A  41      17.061  14.731  16.151  1.00 10.39           C  
-ATOM    288  CG  PRO A  41      16.047  14.729  15.005  1.00 10.99           C  
-ATOM    289  CD  PRO A  41      16.846  14.167  13.830  1.00 10.49           C  
-ATOM    290  N   GLY A  42      17.599  12.144  17.951  1.00  7.55           N  
-ATOM    291  CA  GLY A  42      17.294  10.935  18.721  1.00  8.00           C  
-ATOM    292  C   GLY A  42      15.838  10.634  18.980  1.00  7.22           C  
-ATOM    293  O   GLY A  42      15.493   9.521  19.364  1.00  8.41           O  
-ATOM    294  N   ASP A  43      14.945  11.604  18.754  1.00  5.54           N  
-ATOM    295  CA  ASP A  43      13.508  11.479  18.868  1.00  5.85           C  
-ATOM    296  C   ASP A  43      12.858  11.199  17.510  1.00  5.87           C  
-ATOM    297  O   ASP A  43      11.667  10.909  17.403  1.00  7.29           O  
-ATOM    298  CB  ASP A  43      12.945  12.766  19.537  1.00  6.72           C  
-ATOM    299  CG  ASP A  43      13.339  14.080  18.863  1.00  8.59           C  
-ATOM    300  OD1 ASP A  43      14.399  14.135  18.183  1.00  9.59           O  
-ATOM    301  OD2 ASP A  43      12.584  15.063  19.060  1.00 11.45           O  
-ATOM    302  N   TYR A  44      13.675  11.175  16.441  1.00  5.22           N  
-ATOM    303  CA  TYR A  44      13.270  10.780  15.106  1.00  5.56           C  
-ATOM    304  C   TYR A  44      14.262   9.745  14.605  1.00  4.61           C  
-ATOM    305  O   TYR A  44      14.914   9.899  13.575  1.00  6.04           O  
-ATOM    306  CB  TYR A  44      13.186  11.958  14.104  1.00  5.41           C  
-ATOM    307  CG  TYR A  44      12.012  12.845  14.406  1.00  5.34           C  
-ATOM    308  CD1 TYR A  44      12.103  13.885  15.345  1.00  6.59           C  
-ATOM    309  CD2 TYR A  44      10.793  12.640  13.737  1.00  5.94           C  
-ATOM    310  CE1 TYR A  44      10.994  14.698  15.620  1.00  5.97           C  
-ATOM    311  CE2 TYR A  44       9.683  13.451  14.008  1.00  5.17           C  
-ATOM    312  CZ  TYR A  44       9.785  14.478  14.952  1.00  5.96           C  
-ATOM    313  OH  TYR A  44       8.659  15.282  15.216  1.00  8.60           O  
-ATOM    314  N   ALA A  45      14.395   8.643  15.360  1.00  4.76           N  
-ATOM    315  CA  ALA A  45      15.467   7.680  15.218  1.00  5.89           C  
-ATOM    316  C   ALA A  45      15.167   6.501  14.296  1.00  6.67           C  
-ATOM    317  O   ALA A  45      15.962   5.565  14.193  1.00  7.56           O  
-ATOM    318  CB  ALA A  45      15.739   7.116  16.627  1.00  6.82           C  
-ATOM    319  N   ASN A  46      14.014   6.506  13.612  1.00  5.80           N  
-ATOM    320  CA  ASN A  46      13.586   5.407  12.777  1.00  6.15           C  
-ATOM    321  C   ASN A  46      13.305   5.864  11.329  1.00  6.61           C  
-ATOM    322  O   ASN A  46      13.555   7.041  10.956  1.00  7.18           O  
-ATOM    323  CB  ASN A  46      12.283   4.789  13.338  1.00  7.27           C  
-ATOM    324  CG  ASN A  46      12.481   4.240  14.742  1.00  7.98           C  
-ATOM    325  OD1 ASN A  46      11.771   4.587  15.685  1.00 11.00           O  
-ATOM    326  ND2 ASN A  46      13.439   3.301  14.905  1.00 10.32           N  
-ATOM    327  OXT ASN A  46      12.803   5.019  10.541  1.00  0.00           O  
+ATOM      1  N   THR A   1      17.052  14.174   3.574  1.00 13.79           N  
+ATOM      2  CA  THR A   1      16.951  12.881   4.364  1.00 10.80           C  
+ATOM      3  C   THR A   1      15.689  12.789   5.177  1.00  9.19           C  
+ATOM      4  O   THR A   1      15.237  13.807   5.689  1.00  9.85           O  
+ATOM      5  CB  THR A   1      18.164  12.766   5.283  1.00 13.02           C  
+ATOM      6  OG1 THR A   1      19.334  12.715   4.478  1.00 15.06           O  
+ATOM      7  CG2 THR A   1      18.170  11.509   6.175  1.00 14.23           C  
+ATOM      8  N   THR A   2      15.080  11.588   5.312  1.00  7.81           N  
+ATOM      9  CA  THR A   2      13.810  11.412   6.010  1.00  8.31           C  
+ATOM     10  C   THR A   2      14.012  10.684   7.323  1.00  5.80           C  
+ATOM     11  O   THR A   2      14.661   9.642   7.391  1.00  6.94           O  
+ATOM     12  CB  THR A   2      12.734  10.690   5.193  1.00 10.32           C  
+ATOM     13  OG1 THR A   2      13.124   9.387   4.781  1.00 12.81           O  
+ATOM     14  CG2 THR A   2      12.464  11.473   3.904  1.00 11.90           C  
+ATOM     15  N   CYS A   3      13.467  11.238   8.419  1.00  5.24           N  
+ATOM     16  CA  CYS A   3      13.653  10.742   9.776  1.00  5.39           C  
+ATOM     17  C   CYS A   3      12.289  10.504  10.403  1.00  4.45           C  
+ATOM     18  O   CYS A   3      11.428  11.381  10.332  1.00  6.54           O  
+ATOM     19  CB  CYS A   3      14.409  11.786  10.637  1.00  5.99           C  
+ATOM     20  SG  CYS A   3      15.971  12.359   9.904  1.00  7.01           S  
+ATOM     21  N   CYS A   4      12.020   9.328  11.007  1.00  3.90           N  
+ATOM     22  CA  CYS A   4      10.692   8.963  11.473  1.00  4.24           C  
+ATOM     23  C   CYS A   4      10.653   8.765  12.990  1.00  3.72           C  
+ATOM     24  O   CYS A   4      11.636   8.317  13.571  1.00  5.30           O  
+ATOM     25  CB  CYS A   4      10.210   7.673  10.770  1.00  4.41           C  
+ATOM     26  SG  CYS A   4       9.834   7.941   9.013  1.00  0.00           S  
+ATOM     27  N   PRO A   5       9.559   9.092  13.691  1.00  3.96           N  
+ATOM     28  CA  PRO A   5       9.500   9.032  15.155  1.00  4.25           C  
+ATOM     29  C   PRO A   5       9.250   7.623  15.665  1.00  4.96           C  
+ATOM     30  O   PRO A   5       9.301   7.394  16.870  1.00  7.44           O  
+ATOM     31  CB  PRO A   5       8.291   9.932  15.476  1.00  5.11           C  
+ATOM     32  CG  PRO A   5       7.360   9.737  14.279  1.00  5.24           C  
+ATOM     33  CD  PRO A   5       8.351   9.701  13.123  1.00  5.20           C  
+ATOM     34  N   SER A   6       8.912   6.667  14.785  1.00  4.83           N  
+ATOM     35  CA  SER A   6       8.658   5.302  15.196  1.00  4.45           C  
+ATOM     36  C   SER A   6       8.772   4.377  14.002  1.00  4.99           C  
+ATOM     37  O   SER A   6       8.750   4.798  12.846  1.00  4.61           O  
+ATOM     38  CB  SER A   6       7.291   5.092  15.927  1.00  5.05           C  
+ATOM     39  OG  SER A   6       6.156   5.079  15.051  1.00  6.39           O  
+ATOM     40  N   ILE A   7       8.884   3.059  14.258  1.00  4.94           N  
+ATOM     41  CA  ILE A   7       8.878   2.011  13.244  1.00  6.33           C  
+ATOM     42  C   ILE A   7       7.570   1.972  12.448  1.00  5.32           C  
+ATOM     43  O   ILE A   7       7.573   1.843  11.226  1.00  6.85           O  
+ATOM     44  CB  ILE A   7       9.220   0.670  13.899  1.00  8.43           C  
+ATOM     45  CG1 ILE A   7      10.714   0.675  14.322  1.00  9.78           C  
+ATOM     46  CG2 ILE A   7       8.917  -0.516  12.953  1.00 11.70           C  
+ATOM     47  CD1 ILE A   7      11.132  -0.546  15.153  1.00  9.92           C  
+ATOM     48  N   VAL A   8       6.406   2.155  13.111  1.00  5.02           N  
+ATOM     49  CA  VAL A   8       5.098   2.256  12.461  1.00  6.93           C  
+ATOM     50  C   VAL A   8       5.032   3.426  11.490  1.00  5.39           C  
+ATOM     51  O   VAL A   8       4.574   3.298  10.354  1.00  6.30           O  
+ATOM     52  CB  VAL A   8       3.993   2.383  13.513  1.00  9.64           C  
+ATOM     53  CG1 VAL A   8       2.634   2.799  12.905  1.00 13.85           C  
+ATOM     54  CG2 VAL A   8       3.839   1.027  14.226  1.00 11.97           C  
+ATOM     55  N   ALA A   9       5.562   4.592  11.902  1.00  3.73           N  
+ATOM     56  CA  ALA A   9       5.693   5.765  11.068  1.00  3.56           C  
+ATOM     57  C   ALA A   9       6.563   5.549   9.824  1.00  4.13           C  
+ATOM     58  O   ALA A   9       6.189   5.912   8.708  1.00  4.36           O  
+ATOM     59  CB  ALA A   9       6.276   6.887  11.942  1.00  4.80           C  
+ATOM     60  N   ARG A  10       7.730   4.889   9.970  1.00  3.73           N  
+ATOM     61  CA  ARG A  10       8.560   4.481   8.846  1.00  3.38           C  
+ATOM     62  C   ARG A  10       7.914   3.476   7.895  1.00  3.47           C  
+ATOM     63  O   ARG A  10       8.009   3.612   6.676  1.00  4.67           O  
+ATOM     64  CB  ARG A  10       9.915   3.924   9.344  1.00  3.95           C  
+ATOM     65  CG  ARG A  10      10.909   3.510   8.229  1.00  4.55           C  
+ATOM     66  CD  ARG A  10      11.322   4.627   7.257  1.00  5.89           C  
+ATOM     67  NE  ARG A  10      12.192   5.554   8.026  1.00  6.20           N  
+ATOM     68  CZ  ARG A  10      12.848   6.604   7.529  1.00  7.52           C  
+ATOM     69  NH1 ARG A  10      12.715   6.986   6.265  1.00 10.68           N  
+ATOM     70  NH2 ARG A  10      13.641   7.295   8.333  1.00  9.48           N  
+ATOM     71  N   SER A  11       7.210   2.449   8.409  1.00  5.19           N  
+ATOM     72  CA  SER A  11       6.484   1.490   7.580  1.00  4.60           C  
+ATOM     73  C   SER A  11       5.381   2.126   6.757  1.00  4.84           C  
+ATOM     74  O   SER A  11       5.272   1.887   5.553  1.00  5.84           O  
+ATOM     75  CB  SER A  11       5.875   0.348   8.422  1.00  5.91           C  
+ATOM     76  OG  SER A  11       6.933  -0.431   8.979  1.00  8.38           O  
+ATOM     77  N   ASN A  12       4.587   3.029   7.368  1.00  3.54           N  
+ATOM     78  CA  ASN A  12       3.603   3.847   6.680  1.00  4.57           C  
+ATOM     79  C   ASN A  12       4.236   4.770   5.629  1.00  4.14           C  
+ATOM     80  O   ASN A  12       3.663   4.982   4.564  1.00  5.52           O  
+ATOM     81  CB  ASN A  12       2.766   4.672   7.696  1.00  6.42           C  
+ATOM     82  CG  ASN A  12       1.918   3.747   8.562  1.00  8.25           C  
+ATOM     83  OD1 ASN A  12       1.637   2.598   8.228  1.00 12.72           O  
+ATOM     84  ND2 ASN A  12       1.446   4.272   9.716  1.00  9.92           N  
+ATOM     85  N   PHE A  13       5.454   5.316   5.882  1.00  3.43           N  
+ATOM     86  CA  PHE A  13       6.199   6.127   4.919  1.00  3.49           C  
+ATOM     87  C   PHE A  13       6.521   5.390   3.631  1.00  3.40           C  
+ATOM     88  O   PHE A  13       6.267   5.889   2.535  1.00  4.07           O  
+ATOM     89  CB  PHE A  13       7.524   6.648   5.555  1.00  5.48           C  
+ATOM     90  CG  PHE A  13       8.244   7.611   4.660  1.00  5.57           C  
+ATOM     91  CD1 PHE A  13       9.417   7.205   4.019  1.00  6.99           C  
+ATOM     92  CD2 PHE A  13       7.716   8.882   4.387  1.00  6.52           C  
+ATOM     93  CE1 PHE A  13      10.037   8.031   3.082  1.00  8.20           C  
+ATOM     94  CE2 PHE A  13       8.364   9.746   3.491  1.00  6.34           C  
+ATOM     95  CZ  PHE A  13       9.511   9.302   2.823  1.00  6.84           C  
+ATOM     96  N   ASN A  14       7.048   4.161   3.748  1.00  3.64           N  
+ATOM     97  CA  ASN A  14       7.433   3.329   2.627  1.00  4.31           C  
+ATOM     98  C   ASN A  14       6.227   2.958   1.758  1.00  3.98           C  
+ATOM     99  O   ASN A  14       6.291   3.071   0.538  1.00  6.22           O  
+ATOM    100  CB  ASN A  14       8.248   2.110   3.146  1.00  5.81           C  
+ATOM    101  CG  ASN A  14       9.555   2.608   3.774  1.00  6.82           C  
+ATOM    102  OD1 ASN A  14      10.043   3.709   3.526  1.00  9.43           O  
+ATOM    103  ND2 ASN A  14      10.187   1.768   4.629  1.00  8.21           N  
+ATOM    104  N   VAL A  15       5.070   2.602   2.368  1.00  3.76           N  
+ATOM    105  CA  VAL A  15       3.798   2.407   1.665  1.00  3.98           C  
+ATOM    106  C   VAL A  15       3.271   3.662   0.978  1.00  3.80           C  
+ATOM    107  O   VAL A  15       2.864   3.630  -0.182  1.00  4.85           O  
+ATOM    108  CB  VAL A  15       2.715   1.865   2.600  1.00  4.71           C  
+ATOM    109  CG1 VAL A  15       1.353   1.732   1.878  1.00  6.67           C  
+ATOM    110  CG2 VAL A  15       3.167   0.485   3.108  1.00  6.26           C  
+ATOM    111  N   CYS A  16       3.303   4.825   1.659  1.00  3.79           N  
+ATOM    112  CA  CYS A  16       2.897   6.114   1.110  1.00  3.54           C  
+ATOM    113  C   CYS A  16       3.721   6.536  -0.103  1.00  3.48           C  
+ATOM    114  O   CYS A  16       3.207   7.106  -1.065  1.00  4.63           O  
+ATOM    115  CB  CYS A  16       2.961   7.184   2.233  1.00  4.58           C  
+ATOM    116  SG  CYS A  16       2.261   8.815   1.808  1.00  0.00           S  
+ATOM    117  N   ARG A  17       5.033   6.245  -0.087  1.00  3.99           N  
+ATOM    118  CA  ARG A  17       5.939   6.511  -1.185  1.00  3.83           C  
+ATOM    119  C   ARG A  17       5.817   5.572  -2.386  1.00  3.79           C  
+ATOM    120  O   ARG A  17       6.266   5.939  -3.470  1.00  5.39           O  
+ATOM    121  CB  ARG A  17       7.398   6.495  -0.662  1.00  4.11           C  
+ATOM    122  CG  ARG A  17       7.751   7.718   0.212  1.00  4.69           C  
+ATOM    123  CD  ARG A  17       7.902   9.037  -0.554  1.00  5.10           C  
+ATOM    124  NE  ARG A  17       9.194   8.943  -1.308  1.00  4.71           N  
+ATOM    125  CZ  ARG A  17       9.499   9.612  -2.424  1.00  5.28           C  
+ATOM    126  NH1 ARG A  17       8.607  10.335  -3.096  1.00  6.67           N  
+ATOM    127  NH2 ARG A  17      10.761   9.564  -2.858  1.00  6.41           N  
+ATOM    128  N   LEU A  18       5.175   4.383  -2.270  1.00  4.70           N  
+ATOM    129  CA  LEU A  18       4.986   3.439  -3.376  1.00  5.46           C  
+ATOM    130  C   LEU A  18       4.291   3.996  -4.635  1.00  5.13           C  
+ATOM    131  O   LEU A  18       4.803   3.719  -5.717  1.00  5.55           O  
+ATOM    132  CB  LEU A  18       4.207   2.162  -2.930  1.00  6.47           C  
+ATOM    133  CG  LEU A  18       4.965   1.160  -2.035  1.00  7.43           C  
+ATOM    134  CD1 LEU A  18       4.002   0.060  -1.562  1.00  8.70           C  
+ATOM    135  CD2 LEU A  18       6.164   0.515  -2.745  1.00  9.39           C  
+ATOM    136  N   PRO A  19       3.199   4.773  -4.650  1.00  4.28           N  
+ATOM    137  CA  PRO A  19       2.686   5.374  -5.882  1.00  5.38           C  
+ATOM    138  C   PRO A  19       3.516   6.549  -6.386  1.00  6.30           C  
+ATOM    139  O   PRO A  19       3.156   7.125  -7.409  1.00  9.62           O  
+ATOM    140  CB  PRO A  19       1.232   5.768  -5.558  1.00  5.87           C  
+ATOM    141  CG  PRO A  19       1.126   5.808  -4.029  1.00  6.47           C  
+ATOM    142  CD  PRO A  19       2.266   4.916  -3.531  1.00  6.45           C  
+ATOM    143  N   GLY A  20       4.600   6.960  -5.696  1.00  4.94           N  
+ATOM    144  CA  GLY A  20       5.447   8.064  -6.138  1.00  5.39           C  
+ATOM    145  C   GLY A  20       5.108   9.397  -5.530  1.00  5.03           C  
+ATOM    146  O   GLY A  20       5.706  10.412  -5.879  1.00  7.34           O  
+ATOM    147  N   THR A  21       4.154   9.430  -4.579  1.00  4.10           N  
+ATOM    148  CA  THR A  21       3.748  10.589  -3.779  1.00  3.94           C  
+ATOM    149  C   THR A  21       4.926  11.404  -3.230  1.00  3.96           C  
+ATOM    150  O   THR A  21       5.864  10.792  -2.702  1.00  5.82           O  
+ATOM    151  CB  THR A  21       2.874  10.168  -2.604  1.00  4.13           C  
+ATOM    152  OG1 THR A  21       1.821   9.334  -3.052  1.00  5.45           O  
+ATOM    153  CG2 THR A  21       2.220  11.361  -1.879  1.00  5.41           C  
+ATOM    154  N   PRO A  22       4.999  12.742  -3.327  1.00  5.04           N  
+ATOM    155  CA  PRO A  22       6.089  13.542  -2.768  1.00  4.69           C  
+ATOM    156  C   PRO A  22       6.446  13.263  -1.317  1.00  4.19           C  
+ATOM    157  O   PRO A  22       5.553  12.987  -0.514  1.00  4.47           O  
+ATOM    158  CB  PRO A  22       5.638  14.999  -2.961  1.00  7.12           C  
+ATOM    159  CG  PRO A  22       4.681  14.943  -4.153  1.00  7.03           C  
+ATOM    160  CD  PRO A  22       3.993  13.590  -3.976  1.00  4.90           C  
+ATOM    161  N   GLU A  23       7.739  13.376  -0.935  1.00  5.16           N  
+ATOM    162  CA  GLU A  23       8.169  13.194   0.441  1.00  5.31           C  
+ATOM    163  C   GLU A  23       7.496  14.148   1.410  1.00  4.11           C  
+ATOM    164  O   GLU A  23       7.078  13.729   2.474  1.00  5.11           O  
+ATOM    165  CB  GLU A  23       9.707  13.273   0.616  1.00  6.16           C  
+ATOM    166  CG  GLU A  23      10.449  12.081  -0.029  1.00  7.48           C  
+ATOM    167  CD  GLU A  23      11.913  11.943   0.386  1.00  9.40           C  
+ATOM    168  OE1 GLU A  23      12.492  12.886   0.971  1.00 10.40           O  
+ATOM    169  OE2 GLU A  23      12.439  10.827   0.117  1.00 13.32           O  
+ATOM    170  N   ALA A  24       7.308  15.438   1.067  1.00  4.56           N  
+ATOM    171  CA  ALA A  24       6.621  16.397   1.921  1.00  4.49           C  
+ATOM    172  C   ALA A  24       5.180  16.031   2.297  1.00  4.10           C  
+ATOM    173  O   ALA A  24       4.756  16.198   3.440  1.00  5.64           O  
+ATOM    174  CB  ALA A  24       6.636  17.764   1.211  1.00  5.80           C  
+ATOM    175  N   ILE A  25       4.394  15.501   1.339  1.00  0.00           N  
+ATOM    176  CA  ILE A  25       3.048  15.002   1.590  1.00  0.00           C  
+ATOM    177  C   ILE A  25       3.061  13.730   2.432  1.00  0.00           C  
+ATOM    178  O   ILE A  25       2.372  13.615   3.444  1.00  0.00           O  
+ATOM    179  CB  ILE A  25       2.313  14.812   0.255  1.00  0.00           C  
+ATOM    180  CG1 ILE A  25       2.102  16.205  -0.397  1.00  0.00           C  
+ATOM    181  CG2 ILE A  25       0.963  14.078   0.443  1.00  0.00           C  
+ATOM    182  CD1 ILE A  25       1.586  16.177  -1.843  1.00  0.00           C  
+ATOM    183  N   CYS A  26       3.904  12.748   2.059  1.00  0.00           N  
+ATOM    184  CA  CYS A  26       4.028  11.492   2.777  1.00  0.00           C  
+ATOM    185  C   CYS A  26       4.679  11.528   4.128  1.00  0.00           C  
+ATOM    186  O   CYS A  26       4.192  10.866   5.031  1.00  0.00           O  
+ATOM    187  CB  CYS A  26       4.785  10.458   1.933  1.00  0.00           C  
+ATOM    188  SG  CYS A  26       3.688   9.746   0.705  1.00  0.00           S  
+ATOM    189  N   ALA A  27       5.778  12.279   4.333  1.00  0.00           N  
+ATOM    190  CA  ALA A  27       6.493  12.310   5.592  1.00  0.00           C  
+ATOM    191  C   ALA A  27       5.591  12.834   6.695  1.00  0.00           C  
+ATOM    192  O   ALA A  27       5.400  12.218   7.736  1.00  0.00           O  
+ATOM    193  CB  ALA A  27       7.764  13.180   5.435  1.00  0.00           C  
+ATOM    194  N   THR A  28       4.893  13.937   6.394  1.00  0.00           N  
+ATOM    195  CA  THR A  28       3.923  14.572   7.274  1.00  0.00           C  
+ATOM    196  C   THR A  28       2.741  13.674   7.621  1.00  0.00           C  
+ATOM    197  O   THR A  28       2.339  13.603   8.779  1.00  0.00           O  
+ATOM    198  CB  THR A  28       3.412  15.893   6.700  1.00  0.00           C  
+ATOM    199  OG1 THR A  28       4.497  16.775   6.442  1.00  0.00           O  
+ATOM    200  CG2 THR A  28       2.489  16.602   7.704  1.00  0.00           C  
+ATOM    201  N   TYR A  29       2.175  12.909   6.654  1.00  0.00           N  
+ATOM    202  CA  TYR A  29       1.080  11.970   6.896  1.00  0.00           C  
+ATOM    203  C   TYR A  29       1.428  10.870   7.911  1.00  0.00           C  
+ATOM    204  O   TYR A  29       0.593  10.382   8.666  1.00  0.00           O  
+ATOM    205  CB  TYR A  29       0.624  11.324   5.544  1.00  0.00           C  
+ATOM    206  CG  TYR A  29      -0.635  10.499   5.709  1.00  0.00           C  
+ATOM    207  CD1 TYR A  29      -1.850  11.143   5.992  1.00  0.00           C  
+ATOM    208  CD2 TYR A  29      -0.606   9.091   5.669  1.00  0.00           C  
+ATOM    209  CE1 TYR A  29      -3.007  10.401   6.264  1.00  0.00           C  
+ATOM    210  CE2 TYR A  29      -1.766   8.345   5.940  1.00  0.00           C  
+ATOM    211  CZ  TYR A  29      -2.964   9.005   6.243  1.00  0.00           C  
+ATOM    212  OH  TYR A  29      -4.135   8.277   6.531  1.00  0.00           O  
+ATOM    213  N   THR A  30       2.697  10.436   7.917  1.00  0.00           N  
+ATOM    214  CA  THR A  30       3.176   9.274   8.649  1.00  0.00           C  
+ATOM    215  C   THR A  30       3.831   9.697   9.960  1.00  0.00           C  
+ATOM    216  O   THR A  30       4.153   8.869  10.809  1.00  0.00           O  
+ATOM    217  CB  THR A  30       4.159   8.500   7.763  1.00  0.00           C  
+ATOM    218  OG1 THR A  30       5.287   9.281   7.382  1.00  0.00           O  
+ATOM    219  CG2 THR A  30       3.434   8.105   6.459  1.00  0.00           C  
+ATOM    220  N   GLY A  31       4.004  11.024  10.173  1.00  0.00           N  
+ATOM    221  CA  GLY A  31       4.606  11.660  11.347  1.00  0.00           C  
+ATOM    222  C   GLY A  31       6.090  11.917  11.212  1.00  0.00           C  
+ATOM    223  O   GLY A  31       6.743  12.404  12.129  1.00  0.00           O  
+ATOM    224  N   CYS A  32       6.681  11.555  10.065  1.00  4.30           N  
+ATOM    225  CA  CYS A  32       8.085  11.715   9.748  1.00  4.89           C  
+ATOM    226  C   CYS A  32       8.454  13.116   9.288  1.00  5.50           C  
+ATOM    227  O   CYS A  32       7.612  13.924   8.912  1.00  5.82           O  
+ATOM    228  CB  CYS A  32       8.560  10.707   8.666  1.00  4.66           C  
+ATOM    229  SG  CYS A  32       8.095   8.986   9.047  1.00  0.00           S  
+ATOM    230  N   ILE A  33       9.760  13.441   9.302  1.00  6.02           N  
+ATOM    231  CA  ILE A  33      10.248  14.755   8.913  1.00  5.24           C  
+ATOM    232  C   ILE A  33      11.287  14.639   7.813  1.00  5.16           C  
+ATOM    233  O   ILE A  33      11.891  13.587   7.601  1.00  7.19           O  
+ATOM    234  CB  ILE A  33      10.819  15.544  10.091  1.00  5.49           C  
+ATOM    235  CG1 ILE A  33      12.042  14.839  10.724  1.00  6.85           C  
+ATOM    236  CG2 ILE A  33       9.676  15.751  11.111  1.00  6.45           C  
+ATOM    237  CD1 ILE A  33      12.741  15.661  11.811  1.00  8.94           C  
+ATOM    238  N   ILE A  34      11.519  15.747   7.079  1.00  5.52           N  
+ATOM    239  CA  ILE A  34      12.549  15.859   6.058  1.00  6.82           C  
+ATOM    240  C   ILE A  34      13.565  16.851   6.576  1.00  6.92           C  
+ATOM    241  O   ILE A  34      13.220  17.961   6.972  1.00  9.22           O  
+ATOM    242  CB  ILE A  34      12.028  16.369   4.711  1.00  8.11           C  
+ATOM    243  CG1 ILE A  34      10.930  15.435   4.162  1.00  9.59           C  
+ATOM    244  CG2 ILE A  34      13.185  16.501   3.685  1.00  9.73           C  
+ATOM    245  CD1 ILE A  34      10.156  16.056   3.000  1.00 13.41           C  
+ATOM    246  N   ILE A  35      14.855  16.472   6.592  1.00  7.06           N  
+ATOM    247  CA  ILE A  35      15.930  17.361   6.996  1.00  7.52           C  
+ATOM    248  C   ILE A  35      16.911  17.537   5.836  1.00  6.63           C  
+ATOM    249  O   ILE A  35      17.044  16.619   5.015  1.00  7.90           O  
+ATOM    250  CB  ILE A  35      16.652  16.899   8.263  1.00  8.07           C  
+ATOM    251  CG1 ILE A  35      17.337  15.523   8.103  1.00  9.41           C  
+ATOM    252  CG2 ILE A  35      15.631  16.897   9.423  1.00  9.46           C  
+ATOM    253  CD1 ILE A  35      18.260  15.183   9.277  1.00  9.85           C  
+ATOM    254  N   PRO A  36      17.607  18.682   5.698  1.00  8.07           N  
+ATOM    255  CA  PRO A  36      18.634  18.863   4.674  1.00  8.78           C  
+ATOM    256  C   PRO A  36      19.871  18.014   4.931  1.00  8.31           C  
+ATOM    257  O   PRO A  36      20.493  17.561   3.975  1.00  9.09           O  
+ATOM    258  CB  PRO A  36      18.953  20.375   4.670  1.00  9.67           C  
+ATOM    259  CG  PRO A  36      18.270  20.996   5.902  1.00 10.15           C  
+ATOM    260  CD  PRO A  36      17.370  19.900   6.484  1.00  9.53           C  
+ATOM    261  N   GLY A  37      20.258  17.805   6.207  1.00  8.48           N  
+ATOM    262  CA  GLY A  37      21.401  16.977   6.592  1.00  9.20           C  
+ATOM    263  C   GLY A  37      21.174  15.486   6.493  1.00 10.41           C  
+ATOM    264  O   GLY A  37      20.154  15.010   6.007  1.00 12.06           O  
+ATOM    265  N   ALA A  38      22.138  14.679   6.975  1.00  9.24           N  
+ATOM    266  CA  ALA A  38      22.048  13.226   6.937  1.00  9.24           C  
+ATOM    267  C   ALA A  38      21.924  12.592   8.317  1.00  9.60           C  
+ATOM    268  O   ALA A  38      21.779  11.380   8.448  1.00 13.65           O  
+ATOM    269  CB  ALA A  38      23.301  12.675   6.231  1.00 10.43           C  
+ATOM    270  N   THR A  39      21.936  13.409   9.384  1.00  8.70           N  
+ATOM    271  CA  THR A  39      22.006  12.918  10.757  1.00  9.46           C  
+ATOM    272  C   THR A  39      20.684  13.190  11.422  1.00  8.32           C  
+ATOM    273  O   THR A  39      20.371  14.325  11.774  1.00  9.89           O  
+ATOM    274  CB  THR A  39      23.098  13.598  11.584  1.00 10.72           C  
+ATOM    275  OG1 THR A  39      24.337  13.528  10.894  1.00 11.66           O  
+ATOM    276  CG2 THR A  39      23.300  12.891  12.934  1.00 11.81           C  
+ATOM    277  N   CYS A  40      19.843  12.153  11.591  1.00  7.64           N  
+ATOM    278  CA  CYS A  40      18.566  12.277  12.270  1.00  8.05           C  
+ATOM    279  C   CYS A  40      18.707  12.523  13.782  1.00  7.63           C  
+ATOM    280  O   CYS A  40      19.612  11.951  14.392  1.00  9.64           O  
+ATOM    281  CB  CYS A  40      17.691  11.026  12.008  1.00  7.80           C  
+ATOM    282  SG  CYS A  40      17.247  10.823  10.250  1.00  7.30           S  
+ATOM    283  N   PRO A  41      17.893  13.350  14.448  1.00  8.00           N  
+ATOM    284  CA  PRO A  41      17.916  13.489  15.905  1.00  8.96           C  
+ATOM    285  C   PRO A  41      17.356  12.265  16.627  1.00  9.06           C  
+ATOM    286  O   PRO A  41      16.729  11.408  16.008  1.00  8.82           O  
+ATOM    287  CB  PRO A  41      17.059  14.740  16.150  1.00 10.39           C  
+ATOM    288  CG  PRO A  41      16.041  14.730  15.007  1.00 10.99           C  
+ATOM    289  CD  PRO A  41      16.842  14.169  13.833  1.00 10.49           C  
+ATOM    290  N   GLY A  42      17.582  12.149  17.957  1.00  7.55           N  
+ATOM    291  CA  GLY A  42      17.287  10.932  18.720  1.00  8.00           C  
+ATOM    292  C   GLY A  42      15.834  10.626  18.991  1.00  7.22           C  
+ATOM    293  O   GLY A  42      15.500   9.515  19.390  1.00  8.41           O  
+ATOM    294  N   ASP A  43      14.934  11.587  18.754  1.00  5.54           N  
+ATOM    295  CA  ASP A  43      13.499  11.469  18.872  1.00  5.85           C  
+ATOM    296  C   ASP A  43      12.848  11.189  17.514  1.00  5.87           C  
+ATOM    297  O   ASP A  43      11.658  10.897  17.409  1.00  7.29           O  
+ATOM    298  CB  ASP A  43      12.948  12.770  19.528  1.00  6.72           C  
+ATOM    299  CG  ASP A  43      13.364  14.078  18.851  1.00  8.59           C  
+ATOM    300  OD1 ASP A  43      14.431  14.115  18.179  1.00  9.59           O  
+ATOM    301  OD2 ASP A  43      12.624  15.073  19.035  1.00 11.45           O  
+ATOM    302  N   TYR A  44      13.664  11.169  16.443  1.00  5.22           N  
+ATOM    303  CA  TYR A  44      13.258  10.777  15.107  1.00  5.56           C  
+ATOM    304  C   TYR A  44      14.250   9.745  14.602  1.00  4.61           C  
+ATOM    305  O   TYR A  44      14.893   9.899  13.567  1.00  6.04           O  
+ATOM    306  CB  TYR A  44      13.179  11.959  14.108  1.00  5.41           C  
+ATOM    307  CG  TYR A  44      12.005  12.848  14.406  1.00  5.34           C  
+ATOM    308  CD1 TYR A  44      12.093  13.887  15.346  1.00  6.59           C  
+ATOM    309  CD2 TYR A  44      10.790  12.643  13.731  1.00  5.94           C  
+ATOM    310  CE1 TYR A  44      10.982  14.701  15.615  1.00  5.97           C  
+ATOM    311  CE2 TYR A  44       9.679  13.453  13.999  1.00  5.17           C  
+ATOM    312  CZ  TYR A  44       9.775  14.480  14.942  1.00  5.96           C  
+ATOM    313  OH  TYR A  44       8.649  15.285  15.201  1.00  8.60           O  
+ATOM    314  N   ALA A  45      14.393   8.645  15.361  1.00  4.76           N  
+ATOM    315  CA  ALA A  45      15.464   7.683  15.215  1.00  5.89           C  
+ATOM    316  C   ALA A  45      15.162   6.500  14.300  1.00  6.67           C  
+ATOM    317  O   ALA A  45      15.948   5.556  14.215  1.00  7.56           O  
+ATOM    318  CB  ALA A  45      15.746   7.121  16.623  1.00  6.82           C  
+ATOM    319  N   ASN A  46      14.016   6.508  13.604  1.00  5.80           N  
+ATOM    320  CA  ASN A  46      13.591   5.409  12.769  1.00  6.15           C  
+ATOM    321  C   ASN A  46      13.325   5.866  11.320  1.00  6.61           C  
+ATOM    322  O   ASN A  46      13.563   7.051  10.958  1.00  7.18           O  
+ATOM    323  CB  ASN A  46      12.283   4.791  13.320  1.00  7.27           C  
+ATOM    324  CG  ASN A  46      12.469   4.228  14.720  1.00  7.98           C  
+ATOM    325  OD1 ASN A  46      11.740   4.544  15.659  1.00 11.00           O  
+ATOM    326  ND2 ASN A  46      13.441   3.305  14.887  1.00 10.32           N  
+ATOM    327  OXT ASN A  46      12.841   5.020  10.525  1.00  0.00           O  
 TER     328      ASN A  46                                                      
 END   
diff --git a/modelling/tests/data/1crn_final.pdb b/modelling/tests/data/1crn_final.pdb
index a07e6e5353cb9bcb7841f63f7345ae85fbce4852..34120cd7a69d5e787eb42d88db930733ce51cd15 100644
--- a/modelling/tests/data/1crn_final.pdb
+++ b/modelling/tests/data/1crn_final.pdb
@@ -1,329 +1,329 @@
-ATOM      1  N   THR A   1      17.054  14.171   3.574  1.00 13.79           N  
-ATOM      2  CA  THR A   1      16.956  12.878   4.361  1.00 10.80           C  
-ATOM      3  C   THR A   1      15.694  12.787   5.170  1.00  9.19           C  
-ATOM      4  O   THR A   1      15.240  13.804   5.683  1.00  9.85           O  
-ATOM      5  CB  THR A   1      18.164  12.763   5.286  1.00 13.02           C  
-ATOM      6  OG1 THR A   1      19.333  12.720   4.476  1.00 15.06           O  
-ATOM      7  CG2 THR A   1      18.169  11.510   6.180  1.00 14.23           C  
-ATOM      8  N   THR A   2      15.084  11.587   5.299  1.00  7.81           N  
-ATOM      9  CA  THR A   2      13.816  11.412   6.002  1.00  8.31           C  
-ATOM     10  C   THR A   2      14.023  10.683   7.313  1.00  5.80           C  
-ATOM     11  O   THR A   2      14.680   9.644   7.380  1.00  6.94           O  
-ATOM     12  CB  THR A   2      12.736  10.688   5.193  1.00 10.32           C  
-ATOM     13  OG1 THR A   2      13.134   9.386   4.786  1.00 12.81           O  
-ATOM     14  CG2 THR A   2      12.462  11.464   3.902  1.00 11.90           C  
-ATOM     15  N   CYS A   3      13.473  11.234   8.407  1.00  5.24           N  
-ATOM     16  CA  CYS A   3      13.656  10.729   9.760  1.00  5.39           C  
-ATOM     17  C   CYS A   3      12.287  10.484  10.372  1.00  4.45           C  
-ATOM     18  O   CYS A   3      11.413  11.341  10.265  1.00  6.54           O  
-ATOM     19  CB  CYS A   3      14.390  11.771  10.639  1.00  5.99           C  
-ATOM     20  SG  CYS A   3      15.949  12.375   9.925  1.00  7.01           S  
-ATOM     21  N   CYS A   4      12.028   9.323  11.004  1.00  3.90           N  
-ATOM     22  CA  CYS A   4      10.696   8.971  11.472  1.00  4.24           C  
-ATOM     23  C   CYS A   4      10.675   8.740  12.981  1.00  3.72           C  
-ATOM     24  O   CYS A   4      11.669   8.278  13.542  1.00  5.30           O  
-ATOM     25  CB  CYS A   4      10.174   7.709  10.748  1.00  4.41           C  
-ATOM     26  SG  CYS A   4       9.843   8.005   8.982  1.00  0.00           S  
-ATOM     27  N   PRO A   5       9.594   9.045  13.706  1.00  3.96           N  
-ATOM     28  CA  PRO A   5       9.574   8.974  15.169  1.00  4.25           C  
-ATOM     29  C   PRO A   5       9.321   7.566  15.681  1.00  4.96           C  
-ATOM     30  O   PRO A   5       9.405   7.339  16.886  1.00  7.44           O  
-ATOM     31  CB  PRO A   5       8.385   9.883  15.525  1.00  5.11           C  
-ATOM     32  CG  PRO A   5       7.412   9.677  14.365  1.00  5.24           C  
-ATOM     33  CD  PRO A   5       8.361   9.644  13.174  1.00  5.20           C  
-ATOM     34  N   SER A   6       8.942   6.610  14.817  1.00  4.83           N  
-ATOM     35  CA  SER A   6       8.656   5.258  15.239  1.00  4.45           C  
-ATOM     36  C   SER A   6       8.755   4.359  14.029  1.00  4.99           C  
-ATOM     37  O   SER A   6       8.704   4.806  12.882  1.00  4.61           O  
-ATOM     38  CB  SER A   6       7.275   5.074  15.951  1.00  5.05           C  
-ATOM     39  OG  SER A   6       6.154   5.096  15.055  1.00  6.39           O  
-ATOM     40  N   ILE A   7       8.881   3.041  14.260  1.00  4.94           N  
-ATOM     41  CA  ILE A   7       8.880   2.010  13.233  1.00  6.33           C  
-ATOM     42  C   ILE A   7       7.575   1.982  12.433  1.00  5.32           C  
-ATOM     43  O   ILE A   7       7.580   1.867  11.209  1.00  6.85           O  
-ATOM     44  CB  ILE A   7       9.219   0.669  13.889  1.00  8.43           C  
-ATOM     45  CG1 ILE A   7      10.712   0.675  14.316  1.00  9.78           C  
-ATOM     46  CG2 ILE A   7       8.911  -0.515  12.948  1.00 11.70           C  
-ATOM     47  CD1 ILE A   7      11.131  -0.544  15.149  1.00  9.92           C  
-ATOM     48  N   VAL A   8       6.413   2.162  13.098  1.00  5.02           N  
-ATOM     49  CA  VAL A   8       5.106   2.268  12.451  1.00  6.93           C  
-ATOM     50  C   VAL A   8       5.035   3.444  11.486  1.00  5.39           C  
-ATOM     51  O   VAL A   8       4.574   3.319  10.351  1.00  6.30           O  
-ATOM     52  CB  VAL A   8       4.001   2.393  13.502  1.00  9.64           C  
-ATOM     53  CG1 VAL A   8       2.644   2.810  12.895  1.00 13.85           C  
-ATOM     54  CG2 VAL A   8       3.843   1.036  14.213  1.00 11.97           C  
-ATOM     55  N   ALA A   9       5.556   4.612  11.904  1.00  3.73           N  
-ATOM     56  CA  ALA A   9       5.651   5.797  11.080  1.00  3.56           C  
-ATOM     57  C   ALA A   9       6.503   5.603   9.825  1.00  4.13           C  
-ATOM     58  O   ALA A   9       6.099   5.956   8.717  1.00  4.36           O  
-ATOM     59  CB  ALA A   9       6.218   6.923  11.958  1.00  4.80           C  
-ATOM     60  N   ARG A  10       7.680   4.956   9.957  1.00  3.73           N  
-ATOM     61  CA  ARG A  10       8.515   4.572   8.829  1.00  3.38           C  
-ATOM     62  C   ARG A  10       7.867   3.584   7.866  1.00  3.47           C  
-ATOM     63  O   ARG A  10       7.939   3.746   6.647  1.00  4.67           O  
-ATOM     64  CB  ARG A  10       9.854   3.986   9.335  1.00  3.95           C  
-ATOM     65  CG  ARG A  10      10.848   3.548   8.232  1.00  4.55           C  
-ATOM     66  CD  ARG A  10      11.295   4.648   7.258  1.00  5.89           C  
-ATOM     67  NE  ARG A  10      12.182   5.559   8.028  1.00  6.20           N  
-ATOM     68  CZ  ARG A  10      12.844   6.604   7.526  1.00  7.52           C  
-ATOM     69  NH1 ARG A  10      12.707   6.980   6.261  1.00 10.68           N  
-ATOM     70  NH2 ARG A  10      13.642   7.294   8.328  1.00  9.48           N  
-ATOM     71  N   SER A  11       7.186   2.541   8.375  1.00  5.19           N  
-ATOM     72  CA  SER A  11       6.457   1.587   7.545  1.00  4.60           C  
-ATOM     73  C   SER A  11       5.333   2.226   6.749  1.00  4.84           C  
-ATOM     74  O   SER A  11       5.209   2.009   5.543  1.00  5.84           O  
-ATOM     75  CB  SER A  11       5.870   0.429   8.382  1.00  5.91           C  
-ATOM     76  OG  SER A  11       6.937  -0.345   8.928  1.00  8.38           O  
-ATOM     77  N   ASN A  12       4.535   3.104   7.391  1.00  3.54           N  
-ATOM     78  CA  ASN A  12       3.523   3.918   6.732  1.00  4.57           C  
-ATOM     79  C   ASN A  12       4.115   4.877   5.698  1.00  4.14           C  
-ATOM     80  O   ASN A  12       3.563   5.047   4.611  1.00  5.52           O  
-ATOM     81  CB  ASN A  12       2.698   4.718   7.773  1.00  6.42           C  
-ATOM     82  CG  ASN A  12       1.868   3.763   8.626  1.00  8.25           C  
-ATOM     83  OD1 ASN A  12       1.608   2.613   8.274  1.00 12.72           O  
-ATOM     84  ND2 ASN A  12       1.396   4.261   9.791  1.00  9.92           N  
-ATOM     85  N   PHE A  13       5.281   5.504   5.985  1.00  3.43           N  
-ATOM     86  CA  PHE A  13       6.010   6.341   5.037  1.00  3.49           C  
-ATOM     87  C   PHE A  13       6.392   5.599   3.762  1.00  3.40           C  
-ATOM     88  O   PHE A  13       6.165   6.082   2.654  1.00  4.07           O  
-ATOM     89  CB  PHE A  13       7.300   6.904   5.708  1.00  5.48           C  
-ATOM     90  CG  PHE A  13       8.037   7.860   4.814  1.00  5.57           C  
-ATOM     91  CD1 PHE A  13       9.150   7.417   4.081  1.00  6.99           C  
-ATOM     92  CD2 PHE A  13       7.584   9.176   4.647  1.00  6.52           C  
-ATOM     93  CE1 PHE A  13       9.780   8.269   3.168  1.00  8.20           C  
-ATOM     94  CE2 PHE A  13       8.231  10.043   3.758  1.00  6.34           C  
-ATOM     95  CZ  PHE A  13       9.315   9.581   3.004  1.00  6.84           C  
-ATOM     96  N   ASN A  14       6.947   4.384   3.893  1.00  3.64           N  
-ATOM     97  CA  ASN A  14       7.351   3.572   2.762  1.00  4.31           C  
-ATOM     98  C   ASN A  14       6.173   3.165   1.871  1.00  3.98           C  
-ATOM     99  O   ASN A  14       6.252   3.279   0.650  1.00  6.22           O  
-ATOM    100  CB  ASN A  14       8.156   2.345   3.258  1.00  5.81           C  
-ATOM    101  CG  ASN A  14       9.487   2.798   3.861  1.00  6.82           C  
-ATOM    102  OD1 ASN A  14       9.980   3.912   3.674  1.00  9.43           O  
-ATOM    103  ND2 ASN A  14      10.139   1.880   4.610  1.00  8.21           N  
-ATOM    104  N   VAL A  15       5.022   2.759   2.455  1.00  3.76           N  
-ATOM    105  CA  VAL A  15       3.781   2.513   1.713  1.00  3.98           C  
-ATOM    106  C   VAL A  15       3.247   3.756   1.012  1.00  3.80           C  
-ATOM    107  O   VAL A  15       2.860   3.716  -0.155  1.00  4.85           O  
-ATOM    108  CB  VAL A  15       2.697   1.915   2.607  1.00  4.71           C  
-ATOM    109  CG1 VAL A  15       1.354   1.763   1.858  1.00  6.67           C  
-ATOM    110  CG2 VAL A  15       3.174   0.532   3.085  1.00  6.26           C  
-ATOM    111  N   CYS A  16       3.271   4.921   1.688  1.00  3.79           N  
-ATOM    112  CA  CYS A  16       2.893   6.207   1.122  1.00  3.54           C  
-ATOM    113  C   CYS A  16       3.723   6.592  -0.102  1.00  3.48           C  
-ATOM    114  O   CYS A  16       3.213   7.155  -1.071  1.00  4.63           O  
-ATOM    115  CB  CYS A  16       2.985   7.293   2.226  1.00  4.58           C  
-ATOM    116  SG  CYS A  16       2.414   8.945   1.706  1.00  0.00           S  
-ATOM    117  N   ARG A  17       5.030   6.276  -0.088  1.00  3.99           N  
-ATOM    118  CA  ARG A  17       5.942   6.526  -1.185  1.00  3.83           C  
-ATOM    119  C   ARG A  17       5.817   5.581  -2.379  1.00  3.79           C  
-ATOM    120  O   ARG A  17       6.272   5.933  -3.465  1.00  5.39           O  
-ATOM    121  CB  ARG A  17       7.400   6.499  -0.656  1.00  4.11           C  
-ATOM    122  CG  ARG A  17       7.758   7.717   0.223  1.00  4.69           C  
-ATOM    123  CD  ARG A  17       7.912   9.034  -0.545  1.00  5.10           C  
-ATOM    124  NE  ARG A  17       9.202   8.937  -1.300  1.00  4.71           N  
-ATOM    125  CZ  ARG A  17       9.506   9.609  -2.418  1.00  5.28           C  
-ATOM    126  NH1 ARG A  17       8.614  10.338  -3.083  1.00  6.67           N  
-ATOM    127  NH2 ARG A  17      10.762   9.554  -2.859  1.00  6.41           N  
-ATOM    128  N   LEU A  18       5.163   4.401  -2.253  1.00  4.70           N  
-ATOM    129  CA  LEU A  18       4.980   3.452  -3.355  1.00  5.46           C  
-ATOM    130  C   LEU A  18       4.292   4.004  -4.616  1.00  5.13           C  
-ATOM    131  O   LEU A  18       4.806   3.720  -5.698  1.00  5.55           O  
-ATOM    132  CB  LEU A  18       4.206   2.174  -2.910  1.00  6.47           C  
-ATOM    133  CG  LEU A  18       4.968   1.173  -2.017  1.00  7.43           C  
-ATOM    134  CD1 LEU A  18       4.002   0.071  -1.556  1.00  8.70           C  
-ATOM    135  CD2 LEU A  18       6.161   0.529  -2.738  1.00  9.39           C  
-ATOM    136  N   PRO A  19       3.208   4.786  -4.632  1.00  4.28           N  
-ATOM    137  CA  PRO A  19       2.691   5.375  -5.867  1.00  5.38           C  
-ATOM    138  C   PRO A  19       3.515   6.552  -6.371  1.00  6.30           C  
-ATOM    139  O   PRO A  19       3.161   7.117  -7.402  1.00  9.62           O  
-ATOM    140  CB  PRO A  19       1.239   5.769  -5.546  1.00  5.87           C  
-ATOM    141  CG  PRO A  19       1.128   5.814  -4.018  1.00  6.47           C  
-ATOM    142  CD  PRO A  19       2.280   4.945  -3.510  1.00  6.45           C  
-ATOM    143  N   GLY A  20       4.588   6.971  -5.668  1.00  4.94           N  
-ATOM    144  CA  GLY A  20       5.421   8.088  -6.100  1.00  5.39           C  
-ATOM    145  C   GLY A  20       5.081   9.403  -5.456  1.00  5.03           C  
-ATOM    146  O   GLY A  20       5.649  10.433  -5.813  1.00  7.34           O  
-ATOM    147  N   THR A  21       4.164   9.407  -4.466  1.00  4.10           N  
-ATOM    148  CA  THR A  21       3.759  10.567  -3.667  1.00  3.94           C  
-ATOM    149  C   THR A  21       4.944  11.388  -3.146  1.00  3.96           C  
-ATOM    150  O   THR A  21       5.889  10.786  -2.619  1.00  5.82           O  
-ATOM    151  CB  THR A  21       2.920  10.157  -2.463  1.00  4.13           C  
-ATOM    152  OG1 THR A  21       1.883   9.280  -2.872  1.00  5.45           O  
-ATOM    153  CG2 THR A  21       2.256  11.352  -1.752  1.00  5.41           C  
-ATOM    154  N   PRO A  22       5.013  12.721  -3.275  1.00  5.04           N  
-ATOM    155  CA  PRO A  22       6.090  13.540  -2.721  1.00  4.69           C  
-ATOM    156  C   PRO A  22       6.439  13.280  -1.268  1.00  4.19           C  
-ATOM    157  O   PRO A  22       5.541  13.035  -0.461  1.00  4.47           O  
-ATOM    158  CB  PRO A  22       5.630  14.990  -2.940  1.00  7.12           C  
-ATOM    159  CG  PRO A  22       4.670  14.910  -4.129  1.00  7.03           C  
-ATOM    160  CD  PRO A  22       4.008  13.543  -3.955  1.00  4.90           C  
-ATOM    161  N   GLU A  23       7.732  13.375  -0.891  1.00  5.16           N  
-ATOM    162  CA  GLU A  23       8.163  13.184   0.484  1.00  5.31           C  
-ATOM    163  C   GLU A  23       7.499  14.132   1.463  1.00  4.11           C  
-ATOM    164  O   GLU A  23       7.125  13.716   2.550  1.00  5.11           O  
-ATOM    165  CB  GLU A  23       9.702  13.264   0.646  1.00  6.16           C  
-ATOM    166  CG  GLU A  23      10.442  12.076  -0.009  1.00  7.48           C  
-ATOM    167  CD  GLU A  23      11.915  11.959   0.380  1.00  9.40           C  
-ATOM    168  OE1 GLU A  23      12.486  12.915   0.961  1.00 10.40           O  
-ATOM    169  OE2 GLU A  23      12.456  10.856   0.105  1.00 13.32           O  
-ATOM    170  N   ALA A  24       7.288  15.415   1.110  1.00  4.56           N  
-ATOM    171  CA  ALA A  24       6.611  16.374   1.966  1.00  4.49           C  
-ATOM    172  C   ALA A  24       5.170  16.008   2.335  1.00  4.10           C  
-ATOM    173  O   ALA A  24       4.766  16.103   3.492  1.00  5.64           O  
-ATOM    174  CB  ALA A  24       6.629  17.729   1.240  1.00  5.80           C  
-ATOM    175  N   ILE A  25       4.372  15.541   1.351  1.00  0.00           N  
-ATOM    176  CA  ILE A  25       3.024  15.030   1.578  1.00  0.00           C  
-ATOM    177  C   ILE A  25       3.036  13.747   2.388  1.00  0.00           C  
-ATOM    178  O   ILE A  25       2.260  13.576   3.323  1.00  0.00           O  
-ATOM    179  CB  ILE A  25       2.273  14.811   0.262  1.00  0.00           C  
-ATOM    180  CG1 ILE A  25       2.067  16.170  -0.447  1.00  0.00           C  
-ATOM    181  CG2 ILE A  25       0.907  14.117   0.502  1.00  0.00           C  
-ATOM    182  CD1 ILE A  25       1.529  16.047  -1.877  1.00  0.00           C  
-ATOM    183  N   CYS A  26       3.927  12.791   2.081  1.00  0.00           N  
-ATOM    184  CA  CYS A  26       4.009  11.594   2.899  1.00  0.00           C  
-ATOM    185  C   CYS A  26       4.529  11.797   4.300  1.00  0.00           C  
-ATOM    186  O   CYS A  26       3.941  11.279   5.246  1.00  0.00           O  
-ATOM    187  CB  CYS A  26       4.889  10.519   2.232  1.00  0.00           C  
-ATOM    188  SG  CYS A  26       4.040   9.792   0.827  1.00  0.00           S  
-ATOM    189  N   ALA A  27       5.634  12.538   4.483  1.00  0.00           N  
-ATOM    190  CA  ALA A  27       6.384  12.544   5.719  1.00  0.00           C  
-ATOM    191  C   ALA A  27       5.589  13.026   6.910  1.00  0.00           C  
-ATOM    192  O   ALA A  27       5.397  12.287   7.867  1.00  0.00           O  
-ATOM    193  CB  ALA A  27       7.658  13.402   5.567  1.00  0.00           C  
-ATOM    194  N   THR A  28       5.010  14.234   6.834  1.00  0.00           N  
-ATOM    195  CA  THR A  28       4.305  14.851   7.959  1.00  0.00           C  
-ATOM    196  C   THR A  28       3.107  14.039   8.415  1.00  0.00           C  
-ATOM    197  O   THR A  28       2.869  13.859   9.611  1.00  0.00           O  
-ATOM    198  CB  THR A  28       3.873  16.280   7.639  1.00  0.00           C  
-ATOM    199  OG1 THR A  28       5.017  17.068   7.334  1.00  0.00           O  
-ATOM    200  CG2 THR A  28       3.176  16.939   8.839  1.00  0.00           C  
-ATOM    201  N   TYR A  29       2.331  13.470   7.478  1.00  0.00           N  
-ATOM    202  CA  TYR A  29       1.126  12.728   7.800  1.00  0.00           C  
-ATOM    203  C   TYR A  29       1.393  11.299   8.262  1.00  0.00           C  
-ATOM    204  O   TYR A  29       0.542  10.661   8.880  1.00  0.00           O  
-ATOM    205  CB  TYR A  29       0.183  12.708   6.575  1.00  0.00           C  
-ATOM    206  CG  TYR A  29      -0.394  14.078   6.320  1.00  0.00           C  
-ATOM    207  CD1 TYR A  29       0.240  14.979   5.450  1.00  0.00           C  
-ATOM    208  CD2 TYR A  29      -1.612  14.459   6.909  1.00  0.00           C  
-ATOM    209  CE1 TYR A  29      -0.344  16.213   5.136  1.00  0.00           C  
-ATOM    210  CE2 TYR A  29      -2.204  15.693   6.597  1.00  0.00           C  
-ATOM    211  CZ  TYR A  29      -1.573  16.563   5.699  1.00  0.00           C  
-ATOM    212  OH  TYR A  29      -2.178  17.782   5.341  1.00  0.00           O  
-ATOM    213  N   THR A  30       2.602  10.759   8.031  1.00  0.00           N  
-ATOM    214  CA  THR A  30       2.995   9.465   8.585  1.00  0.00           C  
-ATOM    215  C   THR A  30       3.786   9.652   9.869  1.00  0.00           C  
-ATOM    216  O   THR A  30       4.098   8.696  10.569  1.00  0.00           O  
-ATOM    217  CB  THR A  30       3.810   8.627   7.603  1.00  0.00           C  
-ATOM    218  OG1 THR A  30       5.004   9.277   7.201  1.00  0.00           O  
-ATOM    219  CG2 THR A  30       2.980   8.371   6.329  1.00  0.00           C  
-ATOM    220  N   GLY A  31       4.060  10.915  10.258  1.00  0.00           N  
-ATOM    221  CA  GLY A  31       4.734  11.314  11.500  1.00  0.00           C  
-ATOM    222  C   GLY A  31       6.140  11.801  11.258  1.00  0.00           C  
-ATOM    223  O   GLY A  31       6.791  12.410  12.125  1.00  0.00           O  
-ATOM    224  N   CYS A  32       6.709  11.446  10.113  1.00  4.30           N  
-ATOM    225  CA  CYS A  32       8.082  11.671   9.731  1.00  4.89           C  
-ATOM    226  C   CYS A  32       8.442  13.104   9.313  1.00  5.50           C  
-ATOM    227  O   CYS A  32       7.599  13.952   9.020  1.00  5.82           O  
-ATOM    228  CB  CYS A  32       8.477  10.713   8.585  1.00  4.66           C  
-ATOM    229  SG  CYS A  32       8.066   8.980   8.957  1.00  0.00           S  
-ATOM    230  N   ILE A  33       9.756  13.416   9.272  1.00  6.02           N  
-ATOM    231  CA  ILE A  33      10.249  14.737   8.902  1.00  5.24           C  
-ATOM    232  C   ILE A  33      11.292  14.632   7.809  1.00  5.16           C  
-ATOM    233  O   ILE A  33      11.908  13.583   7.603  1.00  7.19           O  
-ATOM    234  CB  ILE A  33      10.816  15.522  10.088  1.00  5.49           C  
-ATOM    235  CG1 ILE A  33      12.042  14.825  10.725  1.00  6.85           C  
-ATOM    236  CG2 ILE A  33       9.671  15.725  11.105  1.00  6.45           C  
-ATOM    237  CD1 ILE A  33      12.736  15.657  11.809  1.00  8.94           C  
-ATOM    238  N   ILE A  34      11.521  15.741   7.079  1.00  5.52           N  
-ATOM    239  CA  ILE A  34      12.549  15.860   6.058  1.00  6.82           C  
-ATOM    240  C   ILE A  34      13.563  16.855   6.575  1.00  6.92           C  
-ATOM    241  O   ILE A  34      13.217  17.965   6.971  1.00  9.22           O  
-ATOM    242  CB  ILE A  34      12.028  16.370   4.712  1.00  8.11           C  
-ATOM    243  CG1 ILE A  34      10.933  15.436   4.161  1.00  9.59           C  
-ATOM    244  CG2 ILE A  34      13.184  16.503   3.685  1.00  9.73           C  
-ATOM    245  CD1 ILE A  34      10.163  16.060   2.998  1.00 13.41           C  
-ATOM    246  N   ILE A  35      14.854  16.477   6.590  1.00  7.06           N  
-ATOM    247  CA  ILE A  35      15.930  17.365   6.994  1.00  7.52           C  
-ATOM    248  C   ILE A  35      16.912  17.539   5.836  1.00  6.63           C  
-ATOM    249  O   ILE A  35      17.045  16.622   5.010  1.00  7.90           O  
-ATOM    250  CB  ILE A  35      16.650  16.903   8.263  1.00  8.07           C  
-ATOM    251  CG1 ILE A  35      17.336  15.529   8.101  1.00  9.41           C  
-ATOM    252  CG2 ILE A  35      15.627  16.901   9.422  1.00  9.46           C  
-ATOM    253  CD1 ILE A  35      18.260  15.186   9.274  1.00  9.85           C  
-ATOM    254  N   PRO A  36      17.608  18.681   5.702  1.00  8.07           N  
-ATOM    255  CA  PRO A  36      18.634  18.862   4.678  1.00  8.78           C  
-ATOM    256  C   PRO A  36      19.872  18.015   4.930  1.00  8.31           C  
-ATOM    257  O   PRO A  36      20.498  17.571   3.972  1.00  9.09           O  
-ATOM    258  CB  PRO A  36      18.953  20.373   4.676  1.00  9.67           C  
-ATOM    259  CG  PRO A  36      18.266  20.994   5.904  1.00 10.15           C  
-ATOM    260  CD  PRO A  36      17.370  19.899   6.490  1.00  9.53           C  
-ATOM    261  N   GLY A  37      20.256  17.801   6.207  1.00  8.48           N  
+ATOM      1  N   THR A   1      17.052  14.173   3.575  1.00 13.79           N  
+ATOM      2  CA  THR A   1      16.953  12.879   4.364  1.00 10.80           C  
+ATOM      3  C   THR A   1      15.693  12.789   5.176  1.00  9.19           C  
+ATOM      4  O   THR A   1      15.240  13.808   5.685  1.00  9.85           O  
+ATOM      5  CB  THR A   1      18.161  12.760   5.286  1.00 13.02           C  
+ATOM      6  OG1 THR A   1      19.334  12.709   4.486  1.00 15.06           O  
+ATOM      7  CG2 THR A   1      18.169  11.511   6.183  1.00 14.23           C  
+ATOM      8  N   THR A   2      15.084  11.589   5.311  1.00  7.81           N  
+ATOM      9  CA  THR A   2      13.816  11.413   6.012  1.00  8.31           C  
+ATOM     10  C   THR A   2      14.022  10.686   7.325  1.00  5.80           C  
+ATOM     11  O   THR A   2      14.679   9.648   7.395  1.00  6.94           O  
+ATOM     12  CB  THR A   2      12.738  10.690   5.200  1.00 10.32           C  
+ATOM     13  OG1 THR A   2      13.128   9.386   4.790  1.00 12.81           O  
+ATOM     14  CG2 THR A   2      12.469  11.465   3.907  1.00 11.90           C  
+ATOM     15  N   CYS A   3      13.469  11.238   8.419  1.00  5.24           N  
+ATOM     16  CA  CYS A   3      13.654  10.741   9.774  1.00  5.39           C  
+ATOM     17  C   CYS A   3      12.291  10.501  10.399  1.00  4.45           C  
+ATOM     18  O   CYS A   3      11.430  11.378  10.325  1.00  6.54           O  
+ATOM     19  CB  CYS A   3      14.406  11.785  10.639  1.00  5.99           C  
+ATOM     20  SG  CYS A   3      15.966  12.368   9.908  1.00  7.01           S  
+ATOM     21  N   CYS A   4      12.022   9.326  11.003  1.00  3.90           N  
+ATOM     22  CA  CYS A   4      10.694   8.962  11.470  1.00  4.24           C  
+ATOM     23  C   CYS A   4      10.654   8.765  12.985  1.00  3.72           C  
+ATOM     24  O   CYS A   4      11.638   8.318  13.568  1.00  5.30           O  
+ATOM     25  CB  CYS A   4      10.206   7.673  10.769  1.00  4.41           C  
+ATOM     26  SG  CYS A   4       9.829   7.938   9.013  1.00  0.00           S  
+ATOM     27  N   PRO A   5       9.561   9.088  13.685  1.00  3.96           N  
+ATOM     28  CA  PRO A   5       9.499   9.033  15.149  1.00  4.25           C  
+ATOM     29  C   PRO A   5       9.253   7.626  15.662  1.00  4.96           C  
+ATOM     30  O   PRO A   5       9.314   7.398  16.868  1.00  7.44           O  
+ATOM     31  CB  PRO A   5       8.288   9.930  15.467  1.00  5.11           C  
+ATOM     32  CG  PRO A   5       7.360   9.738  14.268  1.00  5.24           C  
+ATOM     33  CD  PRO A   5       8.355   9.700  13.117  1.00  5.20           C  
+ATOM     34  N   SER A   6       8.911   6.669  14.786  1.00  4.83           N  
+ATOM     35  CA  SER A   6       8.659   5.305  15.199  1.00  4.45           C  
+ATOM     36  C   SER A   6       8.773   4.379  14.008  1.00  4.99           C  
+ATOM     37  O   SER A   6       8.749   4.802  12.850  1.00  4.61           O  
+ATOM     38  CB  SER A   6       7.292   5.093  15.929  1.00  5.05           C  
+ATOM     39  OG  SER A   6       6.157   5.081  15.050  1.00  6.39           O  
+ATOM     40  N   ILE A   7       8.884   3.062  14.263  1.00  4.94           N  
+ATOM     41  CA  ILE A   7       8.880   2.016  13.248  1.00  6.33           C  
+ATOM     42  C   ILE A   7       7.574   1.977  12.449  1.00  5.32           C  
+ATOM     43  O   ILE A   7       7.580   1.854  11.227  1.00  6.85           O  
+ATOM     44  CB  ILE A   7       9.219   0.673  13.900  1.00  8.43           C  
+ATOM     45  CG1 ILE A   7      10.713   0.677  14.321  1.00  9.78           C  
+ATOM     46  CG2 ILE A   7       8.911  -0.511  12.955  1.00 11.70           C  
+ATOM     47  CD1 ILE A   7      11.133  -0.544  15.151  1.00  9.92           C  
+ATOM     48  N   VAL A   8       6.409   2.155  13.113  1.00  5.02           N  
+ATOM     49  CA  VAL A   8       5.102   2.253  12.461  1.00  6.93           C  
+ATOM     50  C   VAL A   8       5.037   3.423  11.490  1.00  5.39           C  
+ATOM     51  O   VAL A   8       4.578   3.293  10.354  1.00  6.30           O  
+ATOM     52  CB  VAL A   8       3.995   2.383  13.511  1.00  9.64           C  
+ATOM     53  CG1 VAL A   8       2.639   2.807  12.902  1.00 13.85           C  
+ATOM     54  CG2 VAL A   8       3.835   1.028  14.224  1.00 11.97           C  
+ATOM     55  N   ALA A   9       5.563   4.590  11.902  1.00  3.73           N  
+ATOM     56  CA  ALA A   9       5.687   5.763  11.069  1.00  3.56           C  
+ATOM     57  C   ALA A   9       6.556   5.548   9.827  1.00  4.13           C  
+ATOM     58  O   ALA A   9       6.179   5.905   8.711  1.00  4.36           O  
+ATOM     59  CB  ALA A   9       6.264   6.885  11.942  1.00  4.80           C  
+ATOM     60  N   ARG A  10       7.725   4.893   9.972  1.00  3.73           N  
+ATOM     61  CA  ARG A  10       8.555   4.491   8.846  1.00  3.38           C  
+ATOM     62  C   ARG A  10       7.910   3.488   7.897  1.00  3.47           C  
+ATOM     63  O   ARG A  10       8.003   3.624   6.676  1.00  4.67           O  
+ATOM     64  CB  ARG A  10       9.909   3.932   9.342  1.00  3.95           C  
+ATOM     65  CG  ARG A  10      10.899   3.516   8.225  1.00  4.55           C  
+ATOM     66  CD  ARG A  10      11.314   4.633   7.256  1.00  5.89           C  
+ATOM     67  NE  ARG A  10      12.188   5.556   8.026  1.00  6.20           N  
+ATOM     68  CZ  ARG A  10      12.844   6.606   7.526  1.00  7.52           C  
+ATOM     69  NH1 ARG A  10      12.708   6.981   6.261  1.00 10.68           N  
+ATOM     70  NH2 ARG A  10      13.638   7.300   8.327  1.00  9.48           N  
+ATOM     71  N   SER A  11       7.210   2.460   8.408  1.00  5.19           N  
+ATOM     72  CA  SER A  11       6.485   1.501   7.580  1.00  4.60           C  
+ATOM     73  C   SER A  11       5.380   2.135   6.759  1.00  4.84           C  
+ATOM     74  O   SER A  11       5.267   1.892   5.557  1.00  5.84           O  
+ATOM     75  CB  SER A  11       5.880   0.357   8.422  1.00  5.91           C  
+ATOM     76  OG  SER A  11       6.939  -0.419   8.981  1.00  8.38           O  
+ATOM     77  N   ASN A  12       4.586   3.037   7.371  1.00  3.54           N  
+ATOM     78  CA  ASN A  12       3.597   3.850   6.684  1.00  4.57           C  
+ATOM     79  C   ASN A  12       4.229   4.770   5.632  1.00  4.14           C  
+ATOM     80  O   ASN A  12       3.652   4.979   4.565  1.00  5.52           O  
+ATOM     81  CB  ASN A  12       2.759   4.673   7.701  1.00  6.42           C  
+ATOM     82  CG  ASN A  12       1.911   3.747   8.567  1.00  8.25           C  
+ATOM     83  OD1 ASN A  12       1.629   2.600   8.230  1.00 12.72           O  
+ATOM     84  ND2 ASN A  12       1.441   4.271   9.722  1.00  9.92           N  
+ATOM     85  N   PHE A  13       5.444   5.321   5.882  1.00  3.43           N  
+ATOM     86  CA  PHE A  13       6.194   6.136   4.923  1.00  3.49           C  
+ATOM     87  C   PHE A  13       6.522   5.401   3.640  1.00  3.40           C  
+ATOM     88  O   PHE A  13       6.270   5.901   2.543  1.00  4.07           O  
+ATOM     89  CB  PHE A  13       7.509   6.662   5.565  1.00  5.48           C  
+ATOM     90  CG  PHE A  13       8.230   7.626   4.670  1.00  5.57           C  
+ATOM     91  CD1 PHE A  13       9.402   7.223   4.022  1.00  6.99           C  
+ATOM     92  CD2 PHE A  13       7.700   8.896   4.411  1.00  6.52           C  
+ATOM     93  CE1 PHE A  13      10.014   8.055   3.090  1.00  8.20           C  
+ATOM     94  CE2 PHE A  13       8.350   9.772   3.530  1.00  6.34           C  
+ATOM     95  CZ  PHE A  13       9.481   9.323   2.839  1.00  6.84           C  
+ATOM     96  N   ASN A  14       7.044   4.174   3.756  1.00  3.64           N  
+ATOM     97  CA  ASN A  14       7.428   3.346   2.633  1.00  4.31           C  
+ATOM     98  C   ASN A  14       6.223   2.974   1.765  1.00  3.98           C  
+ATOM     99  O   ASN A  14       6.287   3.081   0.545  1.00  6.22           O  
+ATOM    100  CB  ASN A  14       8.242   2.129   3.152  1.00  5.81           C  
+ATOM    101  CG  ASN A  14       9.551   2.624   3.774  1.00  6.82           C  
+ATOM    102  OD1 ASN A  14      10.043   3.725   3.521  1.00  9.43           O  
+ATOM    103  ND2 ASN A  14      10.184   1.784   4.623  1.00  8.21           N  
+ATOM    104  N   VAL A  15       5.066   2.621   2.378  1.00  3.76           N  
+ATOM    105  CA  VAL A  15       3.797   2.421   1.672  1.00  3.98           C  
+ATOM    106  C   VAL A  15       3.271   3.675   0.984  1.00  3.80           C  
+ATOM    107  O   VAL A  15       2.866   3.640  -0.178  1.00  4.85           O  
+ATOM    108  CB  VAL A  15       2.713   1.874   2.600  1.00  4.71           C  
+ATOM    109  CG1 VAL A  15       1.354   1.740   1.872  1.00  6.67           C  
+ATOM    110  CG2 VAL A  15       3.168   0.491   3.100  1.00  6.26           C  
+ATOM    111  N   CYS A  16       3.301   4.838   1.664  1.00  3.79           N  
+ATOM    112  CA  CYS A  16       2.895   6.123   1.112  1.00  3.54           C  
+ATOM    113  C   CYS A  16       3.720   6.540  -0.103  1.00  3.48           C  
+ATOM    114  O   CYS A  16       3.206   7.107  -1.066  1.00  4.63           O  
+ATOM    115  CB  CYS A  16       2.959   7.195   2.230  1.00  4.58           C  
+ATOM    116  SG  CYS A  16       2.251   8.818   1.798  1.00  0.00           S  
+ATOM    117  N   ARG A  17       5.031   6.246  -0.088  1.00  3.99           N  
+ATOM    118  CA  ARG A  17       5.936   6.512  -1.187  1.00  3.83           C  
+ATOM    119  C   ARG A  17       5.817   5.572  -2.385  1.00  3.79           C  
+ATOM    120  O   ARG A  17       6.269   5.938  -3.468  1.00  5.39           O  
+ATOM    121  CB  ARG A  17       7.396   6.495  -0.666  1.00  4.11           C  
+ATOM    122  CG  ARG A  17       7.751   7.716   0.209  1.00  4.69           C  
+ATOM    123  CD  ARG A  17       7.905   9.034  -0.559  1.00  5.10           C  
+ATOM    124  NE  ARG A  17       9.197   8.936  -1.308  1.00  4.71           N  
+ATOM    125  CZ  ARG A  17       9.503   9.609  -2.425  1.00  5.28           C  
+ATOM    126  NH1 ARG A  17       8.614  10.341  -3.089  1.00  6.67           N  
+ATOM    127  NH2 ARG A  17      10.761   9.552  -2.866  1.00  6.41           N  
+ATOM    128  N   LEU A  18       5.173   4.385  -2.266  1.00  4.70           N  
+ATOM    129  CA  LEU A  18       4.988   3.441  -3.371  1.00  5.46           C  
+ATOM    130  C   LEU A  18       4.297   3.996  -4.631  1.00  5.13           C  
+ATOM    131  O   LEU A  18       4.812   3.718  -5.713  1.00  5.55           O  
+ATOM    132  CB  LEU A  18       4.207   2.166  -2.926  1.00  6.47           C  
+ATOM    133  CG  LEU A  18       4.963   1.162  -2.034  1.00  7.43           C  
+ATOM    134  CD1 LEU A  18       3.996   0.062  -1.566  1.00  8.70           C  
+ATOM    135  CD2 LEU A  18       6.162   0.520  -2.747  1.00  9.39           C  
+ATOM    136  N   PRO A  19       3.206   4.773  -4.647  1.00  4.28           N  
+ATOM    137  CA  PRO A  19       2.693   5.374  -5.878  1.00  5.38           C  
+ATOM    138  C   PRO A  19       3.520   6.549  -6.383  1.00  6.30           C  
+ATOM    139  O   PRO A  19       3.165   7.118  -7.411  1.00  9.62           O  
+ATOM    140  CB  PRO A  19       1.240   5.768  -5.554  1.00  5.87           C  
+ATOM    141  CG  PRO A  19       1.129   5.800  -4.025  1.00  6.47           C  
+ATOM    142  CD  PRO A  19       2.275   4.919  -3.526  1.00  6.45           C  
+ATOM    143  N   GLY A  20       4.599   6.967  -5.686  1.00  4.94           N  
+ATOM    144  CA  GLY A  20       5.442   8.073  -6.130  1.00  5.39           C  
+ATOM    145  C   GLY A  20       5.102   9.404  -5.519  1.00  5.03           C  
+ATOM    146  O   GLY A  20       5.693  10.422  -5.872  1.00  7.34           O  
+ATOM    147  N   THR A  21       4.157   9.429  -4.558  1.00  4.10           N  
+ATOM    148  CA  THR A  21       3.747  10.592  -3.765  1.00  3.94           C  
+ATOM    149  C   THR A  21       4.925  11.403  -3.218  1.00  3.96           C  
+ATOM    150  O   THR A  21       5.862  10.791  -2.690  1.00  5.82           O  
+ATOM    151  CB  THR A  21       2.876  10.175  -2.591  1.00  4.13           C  
+ATOM    152  OG1 THR A  21       1.830   9.329  -3.028  1.00  5.45           O  
+ATOM    153  CG2 THR A  21       2.221  11.363  -1.861  1.00  5.41           C  
+ATOM    154  N   PRO A  22       4.999  12.740  -3.319  1.00  5.04           N  
+ATOM    155  CA  PRO A  22       6.091  13.539  -2.762  1.00  4.69           C  
+ATOM    156  C   PRO A  22       6.446  13.262  -1.313  1.00  4.19           C  
+ATOM    157  O   PRO A  22       5.551  12.990  -0.510  1.00  4.47           O  
+ATOM    158  CB  PRO A  22       5.644  14.997  -2.957  1.00  7.12           C  
+ATOM    159  CG  PRO A  22       4.679  14.941  -4.143  1.00  7.03           C  
+ATOM    160  CD  PRO A  22       3.992  13.588  -3.964  1.00  4.90           C  
+ATOM    161  N   GLU A  23       7.738  13.370  -0.931  1.00  5.16           N  
+ATOM    162  CA  GLU A  23       8.167  13.188   0.444  1.00  5.31           C  
+ATOM    163  C   GLU A  23       7.493  14.141   1.412  1.00  4.11           C  
+ATOM    164  O   GLU A  23       7.076  13.723   2.476  1.00  5.11           O  
+ATOM    165  CB  GLU A  23       9.703  13.273   0.618  1.00  6.16           C  
+ATOM    166  CG  GLU A  23      10.449  12.081  -0.024  1.00  7.48           C  
+ATOM    167  CD  GLU A  23      11.916  11.960   0.385  1.00  9.40           C  
+ATOM    168  OE1 GLU A  23      12.491  12.919   0.955  1.00 10.40           O  
+ATOM    169  OE2 GLU A  23      12.449  10.845   0.134  1.00 13.32           O  
+ATOM    170  N   ALA A  24       7.304  15.431   1.065  1.00  4.56           N  
+ATOM    171  CA  ALA A  24       6.621  16.391   1.921  1.00  4.49           C  
+ATOM    172  C   ALA A  24       5.181  16.026   2.300  1.00  4.10           C  
+ATOM    173  O   ALA A  24       4.760  16.189   3.446  1.00  5.64           O  
+ATOM    174  CB  ALA A  24       6.633  17.758   1.211  1.00  5.80           C  
+ATOM    175  N   ILE A  25       4.394  15.498   1.342  1.00  0.00           N  
+ATOM    176  CA  ILE A  25       3.048  14.999   1.592  1.00  0.00           C  
+ATOM    177  C   ILE A  25       3.063  13.721   2.425  1.00  0.00           C  
+ATOM    178  O   ILE A  25       2.374  13.609   3.439  1.00  0.00           O  
+ATOM    179  CB  ILE A  25       2.315  14.813   0.256  1.00  0.00           C  
+ATOM    180  CG1 ILE A  25       2.106  16.205  -0.396  1.00  0.00           C  
+ATOM    181  CG2 ILE A  25       0.968  14.075   0.441  1.00  0.00           C  
+ATOM    182  CD1 ILE A  25       1.591  16.171  -1.842  1.00  0.00           C  
+ATOM    183  N   CYS A  26       3.900  12.738   2.044  1.00  0.00           N  
+ATOM    184  CA  CYS A  26       4.017  11.484   2.760  1.00  0.00           C  
+ATOM    185  C   CYS A  26       4.663  11.511   4.108  1.00  0.00           C  
+ATOM    186  O   CYS A  26       4.166  10.856   5.015  1.00  0.00           O  
+ATOM    187  CB  CYS A  26       4.774  10.456   1.922  1.00  0.00           C  
+ATOM    188  SG  CYS A  26       3.686   9.742   0.700  1.00  0.00           S  
+ATOM    189  N   ALA A  27       5.768  12.251   4.302  1.00  0.00           N  
+ATOM    190  CA  ALA A  27       6.485  12.285   5.562  1.00  0.00           C  
+ATOM    191  C   ALA A  27       5.597  12.815   6.671  1.00  0.00           C  
+ATOM    192  O   ALA A  27       5.416  12.207   7.723  1.00  0.00           O  
+ATOM    193  CB  ALA A  27       7.757  13.156   5.411  1.00  0.00           C  
+ATOM    194  N   THR A  28       4.900  13.915   6.374  1.00  0.00           N  
+ATOM    195  CA  THR A  28       3.941  14.548   7.262  1.00  0.00           C  
+ATOM    196  C   THR A  28       2.763  13.650   7.617  1.00  0.00           C  
+ATOM    197  O   THR A  28       2.370  13.577   8.777  1.00  0.00           O  
+ATOM    198  CB  THR A  28       3.430  15.867   6.695  1.00  0.00           C  
+ATOM    199  OG1 THR A  28       4.519  16.744   6.448  1.00  0.00           O  
+ATOM    200  CG2 THR A  28       2.505  16.576   7.695  1.00  0.00           C  
+ATOM    201  N   TYR A  29       2.188  12.890   6.652  1.00  0.00           N  
+ATOM    202  CA  TYR A  29       1.092  11.953   6.893  1.00  0.00           C  
+ATOM    203  C   TYR A  29       1.450  10.851   7.898  1.00  0.00           C  
+ATOM    204  O   TYR A  29       0.619  10.357   8.658  1.00  0.00           O  
+ATOM    205  CB  TYR A  29       0.627  11.317   5.543  1.00  0.00           C  
+ATOM    206  CG  TYR A  29      -0.631  10.495   5.714  1.00  0.00           C  
+ATOM    207  CD1 TYR A  29      -1.844  11.140   5.999  1.00  0.00           C  
+ATOM    208  CD2 TYR A  29      -0.603   9.088   5.676  1.00  0.00           C  
+ATOM    209  CE1 TYR A  29      -3.002  10.399   6.268  1.00  0.00           C  
+ATOM    210  CE2 TYR A  29      -1.763   8.343   5.945  1.00  0.00           C  
+ATOM    211  CZ  TYR A  29      -2.961   9.003   6.245  1.00  0.00           C  
+ATOM    212  OH  TYR A  29      -4.134   8.276   6.526  1.00  0.00           O  
+ATOM    213  N   THR A  30       2.716  10.423   7.904  1.00  0.00           N  
+ATOM    214  CA  THR A  30       3.193   9.261   8.634  1.00  0.00           C  
+ATOM    215  C   THR A  30       3.853   9.685   9.941  1.00  0.00           C  
+ATOM    216  O   THR A  30       4.161   8.862  10.791  1.00  0.00           O  
+ATOM    217  CB  THR A  30       4.182   8.494   7.759  1.00  0.00           C  
+ATOM    218  OG1 THR A  30       5.301   9.279   7.374  1.00  0.00           O  
+ATOM    219  CG2 THR A  30       3.475   8.099   6.458  1.00  0.00           C  
+ATOM    220  N   GLY A  31       4.006  11.011  10.161  1.00  0.00           N  
+ATOM    221  CA  GLY A  31       4.604  11.641  11.336  1.00  0.00           C  
+ATOM    222  C   GLY A  31       6.090  11.890  11.209  1.00  0.00           C  
+ATOM    223  O   GLY A  31       6.737  12.382  12.130  1.00  0.00           O  
+ATOM    224  N   CYS A  32       6.679  11.570  10.053  1.00  4.30           N  
+ATOM    225  CA  CYS A  32       8.086  11.718   9.747  1.00  4.89           C  
+ATOM    226  C   CYS A  32       8.454  13.114   9.283  1.00  5.50           C  
+ATOM    227  O   CYS A  32       7.612  13.925   8.913  1.00  5.82           O  
+ATOM    228  CB  CYS A  32       8.564  10.705   8.671  1.00  4.66           C  
+ATOM    229  SG  CYS A  32       8.099   8.989   9.053  1.00  0.00           S  
+ATOM    230  N   ILE A  33       9.758  13.438   9.290  1.00  6.02           N  
+ATOM    231  CA  ILE A  33      10.248  14.752   8.909  1.00  5.24           C  
+ATOM    232  C   ILE A  33      11.287  14.640   7.811  1.00  5.16           C  
+ATOM    233  O   ILE A  33      11.894  13.589   7.601  1.00  7.19           O  
+ATOM    234  CB  ILE A  33      10.819  15.542  10.089  1.00  5.49           C  
+ATOM    235  CG1 ILE A  33      12.043  14.838  10.721  1.00  6.85           C  
+ATOM    236  CG2 ILE A  33       9.676  15.745  11.110  1.00  6.45           C  
+ATOM    237  CD1 ILE A  33      12.740  15.662  11.808  1.00  8.94           C  
+ATOM    238  N   ILE A  34      11.518  15.747   7.076  1.00  5.52           N  
+ATOM    239  CA  ILE A  34      12.548  15.860   6.055  1.00  6.82           C  
+ATOM    240  C   ILE A  34      13.562  16.853   6.573  1.00  6.92           C  
+ATOM    241  O   ILE A  34      13.216  17.963   6.969  1.00  9.22           O  
+ATOM    242  CB  ILE A  34      12.026  16.368   4.709  1.00  8.11           C  
+ATOM    243  CG1 ILE A  34      10.930  15.433   4.159  1.00  9.59           C  
+ATOM    244  CG2 ILE A  34      13.182  16.502   3.683  1.00  9.73           C  
+ATOM    245  CD1 ILE A  34      10.157  16.054   2.997  1.00 13.41           C  
+ATOM    246  N   ILE A  35      14.853  16.476   6.590  1.00  7.06           N  
+ATOM    247  CA  ILE A  35      15.927  17.365   6.995  1.00  7.52           C  
+ATOM    248  C   ILE A  35      16.910  17.539   5.837  1.00  6.63           C  
+ATOM    249  O   ILE A  35      17.041  16.621   5.013  1.00  7.90           O  
+ATOM    250  CB  ILE A  35      16.649  16.904   8.262  1.00  8.07           C  
+ATOM    251  CG1 ILE A  35      17.338  15.530   8.100  1.00  9.41           C  
+ATOM    252  CG2 ILE A  35      15.627  16.902   9.422  1.00  9.46           C  
+ATOM    253  CD1 ILE A  35      18.261  15.187   9.273  1.00  9.85           C  
+ATOM    254  N   PRO A  36      17.609  18.681   5.702  1.00  8.07           N  
+ATOM    255  CA  PRO A  36      18.635  18.864   4.677  1.00  8.78           C  
+ATOM    256  C   PRO A  36      19.874  18.016   4.929  1.00  8.31           C  
+ATOM    257  O   PRO A  36      20.501  17.575   3.972  1.00  9.09           O  
+ATOM    258  CB  PRO A  36      18.954  20.375   4.676  1.00  9.67           C  
+ATOM    259  CG  PRO A  36      18.267  20.996   5.905  1.00 10.15           C  
+ATOM    260  CD  PRO A  36      17.373  19.898   6.489  1.00  9.53           C  
+ATOM    261  N   GLY A  37      20.257  17.801   6.206  1.00  8.48           N  
 ATOM    262  CA  GLY A  37      21.402  16.976   6.587  1.00  9.20           C  
-ATOM    263  C   GLY A  37      21.173  15.485   6.489  1.00 10.41           C  
-ATOM    264  O   GLY A  37      20.155  15.010   5.999  1.00 12.06           O  
-ATOM    265  N   ALA A  38      22.135  14.680   6.979  1.00  9.24           N  
-ATOM    266  CA  ALA A  38      22.045  13.228   6.942  1.00  9.24           C  
-ATOM    267  C   ALA A  38      21.924  12.592   8.321  1.00  9.60           C  
-ATOM    268  O   ALA A  38      21.783  11.379   8.449  1.00 13.65           O  
-ATOM    269  CB  ALA A  38      23.297  12.678   6.234  1.00 10.43           C  
-ATOM    270  N   THR A  39      21.931  13.409   9.387  1.00  8.70           N  
-ATOM    271  CA  THR A  39      22.003  12.917  10.760  1.00  9.46           C  
-ATOM    272  C   THR A  39      20.682  13.188  11.426  1.00  8.32           C  
-ATOM    273  O   THR A  39      20.369  14.322  11.783  1.00  9.89           O  
-ATOM    274  CB  THR A  39      23.100  13.597  11.581  1.00 10.72           C  
-ATOM    275  OG1 THR A  39      24.336  13.521  10.885  1.00 11.66           O  
-ATOM    276  CG2 THR A  39      23.303  12.893  12.932  1.00 11.81           C  
-ATOM    277  N   CYS A  40      19.840  12.152  11.591  1.00  7.64           N  
-ATOM    278  CA  CYS A  40      18.563  12.278  12.269  1.00  8.05           C  
-ATOM    279  C   CYS A  40      18.705  12.517  13.781  1.00  7.63           C  
-ATOM    280  O   CYS A  40      19.608  11.938  14.390  1.00  9.64           O  
-ATOM    281  CB  CYS A  40      17.680  11.035  12.004  1.00  7.80           C  
-ATOM    282  SG  CYS A  40      17.233  10.842  10.247  1.00  7.30           S  
-ATOM    283  N   PRO A  41      17.893  13.346  14.446  1.00  8.00           N  
-ATOM    284  CA  PRO A  41      17.917  13.485  15.903  1.00  8.96           C  
-ATOM    285  C   PRO A  41      17.359  12.262  16.626  1.00  9.06           C  
-ATOM    286  O   PRO A  41      16.727  11.405  16.011  1.00  8.82           O  
-ATOM    287  CB  PRO A  41      17.061  14.735  16.150  1.00 10.39           C  
-ATOM    288  CG  PRO A  41      16.045  14.729  15.006  1.00 10.99           C  
-ATOM    289  CD  PRO A  41      16.844  14.168  13.831  1.00 10.49           C  
-ATOM    290  N   GLY A  42      17.591  12.148  17.954  1.00  7.55           N  
-ATOM    291  CA  GLY A  42      17.291  10.934  18.720  1.00  8.00           C  
-ATOM    292  C   GLY A  42      15.836  10.630  18.985  1.00  7.22           C  
-ATOM    293  O   GLY A  42      15.495   9.518  19.377  1.00  8.41           O  
-ATOM    294  N   ASP A  43      14.941  11.596  18.754  1.00  5.54           N  
-ATOM    295  CA  ASP A  43      13.504  11.475  18.870  1.00  5.85           C  
-ATOM    296  C   ASP A  43      12.856  11.193  17.511  1.00  5.87           C  
-ATOM    297  O   ASP A  43      11.665  10.901  17.405  1.00  7.29           O  
-ATOM    298  CB  ASP A  43      12.946  12.768  19.532  1.00  6.72           C  
-ATOM    299  CG  ASP A  43      13.352  14.079  18.857  1.00  8.59           C  
-ATOM    300  OD1 ASP A  43      14.416  14.127  18.181  1.00  9.59           O  
-ATOM    301  OD2 ASP A  43      12.603  15.067  19.048  1.00 11.45           O  
-ATOM    302  N   TYR A  44      13.673  11.173  16.443  1.00  5.22           N  
-ATOM    303  CA  TYR A  44      13.270  10.779  15.107  1.00  5.56           C  
-ATOM    304  C   TYR A  44      14.263   9.746  14.604  1.00  4.61           C  
-ATOM    305  O   TYR A  44      14.912   9.900  13.573  1.00  6.04           O  
-ATOM    306  CB  TYR A  44      13.186  11.959  14.106  1.00  5.41           C  
-ATOM    307  CG  TYR A  44      12.011  12.846  14.407  1.00  5.34           C  
-ATOM    308  CD1 TYR A  44      12.101  13.885  15.347  1.00  6.59           C  
-ATOM    309  CD2 TYR A  44      10.794  12.642  13.735  1.00  5.94           C  
-ATOM    310  CE1 TYR A  44      10.991  14.698  15.620  1.00  5.97           C  
-ATOM    311  CE2 TYR A  44       9.684  13.453  14.005  1.00  5.17           C  
-ATOM    312  CZ  TYR A  44       9.783  14.479  14.951  1.00  5.96           C  
-ATOM    313  OH  TYR A  44       8.656  15.281  15.214  1.00  8.60           O  
-ATOM    314  N   ALA A  45      14.398   8.643  15.360  1.00  4.76           N  
-ATOM    315  CA  ALA A  45      15.468   7.679  15.216  1.00  5.89           C  
-ATOM    316  C   ALA A  45      15.166   6.498  14.298  1.00  6.67           C  
-ATOM    317  O   ALA A  45      15.957   5.556  14.205  1.00  7.56           O  
-ATOM    318  CB  ALA A  45      15.744   7.117  16.626  1.00  6.82           C  
-ATOM    319  N   ASN A  46      14.017   6.506  13.608  1.00  5.80           N  
-ATOM    320  CA  ASN A  46      13.588   5.407  12.773  1.00  6.15           C  
-ATOM    321  C   ASN A  46      13.309   5.866  11.326  1.00  6.61           C  
-ATOM    322  O   ASN A  46      13.556   7.045  10.958  1.00  7.18           O  
-ATOM    323  CB  ASN A  46      12.284   4.789  13.331  1.00  7.27           C  
-ATOM    324  CG  ASN A  46      12.476   4.235  14.733  1.00  7.98           C  
-ATOM    325  OD1 ASN A  46      11.756   4.568  15.674  1.00 11.00           O  
-ATOM    326  ND2 ASN A  46      13.442   3.303  14.897  1.00 10.32           N  
-ATOM    327  OXT ASN A  46      12.809   5.022  10.536  1.00  0.00           O  
+ATOM    263  C   GLY A  37      21.174  15.486   6.491  1.00 10.41           C  
+ATOM    264  O   GLY A  37      20.157  15.011   5.999  1.00 12.06           O  
+ATOM    265  N   ALA A  38      22.134  14.680   6.981  1.00  9.24           N  
+ATOM    266  CA  ALA A  38      22.043  13.228   6.943  1.00  9.24           C  
+ATOM    267  C   ALA A  38      21.922  12.594   8.323  1.00  9.60           C  
+ATOM    268  O   ALA A  38      21.784  11.380   8.453  1.00 13.65           O  
+ATOM    269  CB  ALA A  38      23.295  12.679   6.234  1.00 10.43           C  
+ATOM    270  N   THR A  39      21.928  13.411   9.389  1.00  8.70           N  
+ATOM    271  CA  THR A  39      22.003  12.918  10.760  1.00  9.46           C  
+ATOM    272  C   THR A  39      20.684  13.190  11.427  1.00  8.32           C  
+ATOM    273  O   THR A  39      20.372  14.325  11.782  1.00  9.89           O  
+ATOM    274  CB  THR A  39      23.100  13.596  11.580  1.00 10.72           C  
+ATOM    275  OG1 THR A  39      24.336  13.518  10.885  1.00 11.66           O  
+ATOM    276  CG2 THR A  39      23.303  12.894  12.932  1.00 11.81           C  
+ATOM    277  N   CYS A  40      19.843  12.153  11.594  1.00  7.64           N  
+ATOM    278  CA  CYS A  40      18.565  12.277  12.270  1.00  8.05           C  
+ATOM    279  C   CYS A  40      18.704  12.517  13.782  1.00  7.63           C  
+ATOM    280  O   CYS A  40      19.605  11.937  14.392  1.00  9.64           O  
+ATOM    281  CB  CYS A  40      17.684  11.031  12.004  1.00  7.80           C  
+ATOM    282  SG  CYS A  40      17.245  10.833  10.245  1.00  7.30           S  
+ATOM    283  N   PRO A  41      17.893  13.347  14.447  1.00  8.00           N  
+ATOM    284  CA  PRO A  41      17.917  13.484  15.903  1.00  8.96           C  
+ATOM    285  C   PRO A  41      17.360  12.260  16.624  1.00  9.06           C  
+ATOM    286  O   PRO A  41      16.727  11.406  16.008  1.00  8.82           O  
+ATOM    287  CB  PRO A  41      17.060  14.734  16.150  1.00 10.39           C  
+ATOM    288  CG  PRO A  41      16.045  14.730  15.006  1.00 10.99           C  
+ATOM    289  CD  PRO A  41      16.845  14.167  13.833  1.00 10.49           C  
+ATOM    290  N   GLY A  42      17.593  12.145  17.952  1.00  7.55           N  
+ATOM    291  CA  GLY A  42      17.292  10.933  18.720  1.00  8.00           C  
+ATOM    292  C   GLY A  42      15.837  10.632  18.984  1.00  7.22           C  
+ATOM    293  O   GLY A  42      15.498   9.519  19.374  1.00  8.41           O  
+ATOM    294  N   ASP A  43      14.940  11.597  18.753  1.00  5.54           N  
+ATOM    295  CA  ASP A  43      13.505  11.475  18.870  1.00  5.85           C  
+ATOM    296  C   ASP A  43      12.853  11.194  17.512  1.00  5.87           C  
+ATOM    297  O   ASP A  43      11.662  10.906  17.408  1.00  7.29           O  
+ATOM    298  CB  ASP A  43      12.946  12.768  19.533  1.00  6.72           C  
+ATOM    299  CG  ASP A  43      13.348  14.081  18.858  1.00  8.59           C  
+ATOM    300  OD1 ASP A  43      14.411  14.127  18.181  1.00  9.59           O  
+ATOM    301  OD2 ASP A  43      12.600  15.070  19.050  1.00 11.45           O  
+ATOM    302  N   TYR A  44      13.668  11.170  16.441  1.00  5.22           N  
+ATOM    303  CA  TYR A  44      13.259  10.777  15.107  1.00  5.56           C  
+ATOM    304  C   TYR A  44      14.250   9.744  14.603  1.00  4.61           C  
+ATOM    305  O   TYR A  44      14.895   9.898  13.569  1.00  6.04           O  
+ATOM    306  CB  TYR A  44      13.179  11.957  14.106  1.00  5.41           C  
+ATOM    307  CG  TYR A  44      12.007  12.847  14.404  1.00  5.34           C  
+ATOM    308  CD1 TYR A  44      12.096  13.886  15.343  1.00  6.59           C  
+ATOM    309  CD2 TYR A  44      10.790  12.641  13.733  1.00  5.94           C  
+ATOM    310  CE1 TYR A  44      10.986  14.700  15.614  1.00  5.97           C  
+ATOM    311  CE2 TYR A  44       9.679  13.451  14.003  1.00  5.17           C  
+ATOM    312  CZ  TYR A  44       9.778  14.480  14.945  1.00  5.96           C  
+ATOM    313  OH  TYR A  44       8.653  15.286  15.205  1.00  8.60           O  
+ATOM    314  N   ALA A  45      14.390   8.644  15.361  1.00  4.76           N  
+ATOM    315  CA  ALA A  45      15.463   7.684  15.218  1.00  5.89           C  
+ATOM    316  C   ALA A  45      15.163   6.504  14.299  1.00  6.67           C  
+ATOM    317  O   ALA A  45      15.957   5.565  14.203  1.00  7.56           O  
+ATOM    318  CB  ALA A  45      15.740   7.120  16.626  1.00  6.82           C  
+ATOM    319  N   ASN A  46      14.012   6.507  13.611  1.00  5.80           N  
+ATOM    320  CA  ASN A  46      13.586   5.411  12.773  1.00  6.15           C  
+ATOM    321  C   ASN A  46      13.322   5.867  11.321  1.00  6.61           C  
+ATOM    322  O   ASN A  46      13.563   7.047  10.952  1.00  7.18           O  
+ATOM    323  CB  ASN A  46      12.282   4.790  13.330  1.00  7.27           C  
+ATOM    324  CG  ASN A  46      12.473   4.235  14.734  1.00  7.98           C  
+ATOM    325  OD1 ASN A  46      11.756   4.566  15.677  1.00 11.00           O  
+ATOM    326  ND2 ASN A  46      13.438   3.300  14.896  1.00 10.32           N  
+ATOM    327  OXT ASN A  46      12.834   5.019  10.528  1.00  0.00           O  
 TER     328      ASN A  46                                                      
 END   
diff --git a/modelling/tests/data/1crn_rec.pdb b/modelling/tests/data/1crn_rec.pdb
index e78f6224eed82852786a737f9494605e2fdb3755..ff82efa903ff5647b49d6c22bfaa77734d532221 100644
--- a/modelling/tests/data/1crn_rec.pdb
+++ b/modelling/tests/data/1crn_rec.pdb
@@ -167,50 +167,50 @@ ATOM    166  CG  GLU A  23      10.440  12.093   0.063  1.00  7.48           C
 ATOM    167  CD  GLU A  23      11.941  12.170   0.391  1.00  9.40           C  
 ATOM    168  OE1 GLU A  23      12.416  13.225   0.681  1.00 10.40           O  
 ATOM    169  OE2 GLU A  23      12.539  11.070   0.292  1.00 13.32           O  
-ATOM    170  N   ALA A  24       7.206  15.339   0.972  1.00  4.56           N  
-ATOM    171  CA  ALA A  24       6.625  16.316   1.907  1.00  4.49           C  
-ATOM    172  C   ALA A  24       5.206  15.933   2.351  1.00  4.10           C  
-ATOM    173  O   ALA A  24       4.867  16.052   3.523  1.00  5.64           O  
-ATOM    174  CB  ALA A  24       6.585  17.662   1.246  1.00  5.80           C  
-ATOM    175  N   ILE A  25       4.400  15.462   1.405  1.00  0.00           N  
-ATOM    176  CA  ILE A  25       3.013  15.077   1.697  1.00  0.00           C  
-ATOM    177  C   ILE A  25       2.949  13.799   2.532  1.00  0.00           C  
-ATOM    178  O   ILE A  25       2.149  13.704   3.465  1.00  0.00           O  
-ATOM    179  CB  ILE A  25       2.276  14.865   0.408  1.00  0.00           C  
-ATOM    180  N   CYS A  26       3.801  12.828   2.191  1.00  0.00           N  
-ATOM    181  CA  CYS A  26       3.820  11.519   2.858  1.00  0.00           C  
-ATOM    182  C   CYS A  26       4.443  11.568   4.247  1.00  0.00           C  
-ATOM    183  O   CYS A  26       3.895  10.981   5.191  1.00  0.00           O  
-ATOM    184  CB  CYS A  26       4.593  10.553   2.011  1.00  0.00           C  
-ATOM    185  N   ALA A  27       5.577  12.255   4.371  1.00  0.00           N  
-ATOM    186  CA  ALA A  27       6.381  12.218   5.600  1.00  0.00           C  
-ATOM    187  C   ALA A  27       5.720  12.806   6.859  1.00  0.00           C  
-ATOM    188  O   ALA A  27       5.714  12.148   7.900  1.00  0.00           O  
-ATOM    189  CB  ALA A  27       7.654  12.970   5.347  1.00  0.00           C  
-ATOM    190  N   THR A  28       5.158  14.043   6.781  1.00  0.00           N  
-ATOM    191  CA  THR A  28       4.495  14.590   7.965  1.00  0.00           C  
-ATOM    192  C   THR A  28       3.288  13.781   8.406  1.00  0.00           C  
-ATOM    193  O   THR A  28       3.207  13.408   9.584  1.00  0.00           O  
-ATOM    194  CB  THR A  28       4.056  15.994   7.669  1.00  0.00           C  
-ATOM    195  N   TYR A  29       2.381  13.481   7.483  1.00  0.00           N  
-ATOM    196  CA  TYR A  29       1.150  12.736   7.809  1.00  0.00           C  
-ATOM    197  C   TYR A  29       1.442  11.314   8.293  1.00  0.00           C  
-ATOM    198  O   TYR A  29       0.559  10.652   8.849  1.00  0.00           O  
-ATOM    199  CB  TYR A  29       0.279  12.671   6.590  1.00  0.00           C  
-ATOM    200  N   THR A  30       2.676  10.862   8.093  1.00  0.00           N  
-ATOM    201  CA  THR A  30       3.102   9.534   8.547  1.00  0.00           C  
-ATOM    202  C   THR A  30       3.922   9.620   9.845  1.00  0.00           C  
-ATOM    203  O   THR A  30       4.406   8.609  10.339  1.00  0.00           O  
-ATOM    204  CB  THR A  30       3.931   8.885   7.478  1.00  0.00           C  
-ATOM    205  N   GLY A  31       4.092  10.832  10.363  1.00  0.00           N  
-ATOM    206  CA  GLY A  31       4.903  11.062  11.544  1.00  0.00           C  
-ATOM    207  C   GLY A  31       6.393  11.105  11.251  1.00  0.00           C  
-ATOM    208  O   GLY A  31       7.221  10.693  12.071  1.00  0.00           O  
-ATOM    209  N   CYS A  32       6.755  11.608  10.078  1.00  4.30           N  
-ATOM    210  CA  CYS A  32       8.167  11.695   9.659  1.00  4.89           C  
-ATOM    211  C   CYS A  32       8.465  13.129   9.146  1.00  5.50           C  
-ATOM    212  O   CYS A  32       7.601  13.916   8.762  1.00  5.82           O  
-ATOM    213  CB  CYS A  32       8.411  10.688   8.583  1.00  4.66           C  
+ATOM    170  N   ALA A  24       7.184  15.340   0.984  1.00  4.56           N  
+ATOM    171  CA  ALA A  24       6.630  16.325   1.910  1.00  4.49           C  
+ATOM    172  C   ALA A  24       5.224  15.922   2.335  1.00  4.10           C  
+ATOM    173  O   ALA A  24       4.841  16.076   3.489  1.00  5.64           O  
+ATOM    174  CB  ALA A  24       6.590  17.671   1.249  1.00  5.80           C  
+ATOM    175  N   ILE A  25       4.450  15.401   1.376  1.00  0.00           N  
+ATOM    176  CA  ILE A  25       3.092  14.965   1.629  1.00  0.00           C  
+ATOM    177  C   ILE A  25       3.062  13.609   2.333  1.00  0.00           C  
+ATOM    178  O   ILE A  25       2.371  13.438   3.344  1.00  0.00           O  
+ATOM    179  CB  ILE A  25       2.352  14.864   0.328  1.00  0.00           C  
+ATOM    180  N   CYS A  26       3.813  12.637   1.816  1.00  0.00           N  
+ATOM    181  CA  CYS A  26       3.822  11.305   2.416  1.00  0.00           C  
+ATOM    182  C   CYS A  26       4.463  11.271   3.789  1.00  0.00           C  
+ATOM    183  O   CYS A  26       3.868  10.786   4.744  1.00  0.00           O  
+ATOM    184  CB  CYS A  26       4.568  10.370   1.510  1.00  0.00           C  
+ATOM    185  N   ALA A  27       5.693  11.780   3.893  1.00  0.00           N  
+ATOM    186  CA  ALA A  27       6.413  11.794   5.153  1.00  0.00           C  
+ATOM    187  C   ALA A  27       5.608  12.397   6.310  1.00  0.00           C  
+ATOM    188  O   ALA A  27       5.543  11.812   7.398  1.00  0.00           O  
+ATOM    189  CB  ALA A  27       7.677  12.584   4.979  1.00  0.00           C  
+ATOM    190  N   THR A  28       4.988  13.552   6.073  1.00  0.00           N  
+ATOM    191  CA  THR A  28       4.196  14.207   7.124  1.00  0.00           C  
+ATOM    192  C   THR A  28       3.020  13.328   7.533  1.00  0.00           C  
+ATOM    193  O   THR A  28       2.658  13.279   8.714  1.00  0.00           O  
+ATOM    194  CB  THR A  28       3.687  15.525   6.622  1.00  0.00           C  
+ATOM    195  N   TYR A  29       2.415  12.636   6.571  1.00  0.00           N  
+ATOM    196  CA  TYR A  29       1.299  11.759   6.889  1.00  0.00           C  
+ATOM    197  C   TYR A  29       1.753  10.591   7.751  1.00  0.00           C  
+ATOM    198  O   TYR A  29       0.989  10.063   8.559  1.00  0.00           O  
+ATOM    199  CB  TYR A  29       0.696  11.238   5.618  1.00  0.00           C  
+ATOM    200  N   THR A  30       3.002  10.172   7.592  1.00  0.00           N  
+ATOM    201  CA  THR A  30       3.538   9.056   8.363  1.00  0.00           C  
+ATOM    202  C   THR A  30       4.131   9.513   9.681  1.00  0.00           C  
+ATOM    203  O   THR A  30       4.622   8.696  10.464  1.00  0.00           O  
+ATOM    204  CB  THR A  30       4.598   8.364   7.559  1.00  0.00           C  
+ATOM    205  N   GLY A  31       4.097  10.820   9.941  1.00  0.00           N  
+ATOM    206  CA  GLY A  31       4.647  11.345  11.171  1.00  0.00           C  
+ATOM    207  C   GLY A  31       6.147  11.478  11.136  1.00  0.00           C  
+ATOM    208  O   GLY A  31       6.797  11.474  12.181  1.00  0.00           O  
+ATOM    209  N   CYS A  32       6.705  11.609   9.935  1.00  4.30           N  
+ATOM    210  CA  CYS A  32       8.165  11.744   9.774  1.00  4.89           C  
+ATOM    211  C   CYS A  32       8.488  13.127   9.150  1.00  5.50           C  
+ATOM    212  O   CYS A  32       7.704  14.003   9.062  1.00  5.82           O  
+ATOM    213  CB  CYS A  32       8.662  10.640   8.894  1.00  4.66           C  
 ATOM    214  N   ILE A  33       9.793  13.410   9.173  1.00  6.02           N  
 ATOM    215  CA  ILE A  33      10.280  14.760   8.823  1.00  5.24           C  
 ATOM    216  C   ILE A  33      11.346  14.658   7.743  1.00  5.16           C  
diff --git a/modelling/tests/data/1crn_sc.pdb b/modelling/tests/data/1crn_sc.pdb
index 1bc10793e2bd3b935c6d09b8d60d057855accc46..45fb2b2d0974b048005efa8fc863ed3bcd3d9edb 100644
--- a/modelling/tests/data/1crn_sc.pdb
+++ b/modelling/tests/data/1crn_sc.pdb
@@ -167,66 +167,66 @@ ATOM    166  CG  GLU A  23      10.440  12.093   0.063  1.00  7.48           C
 ATOM    167  CD  GLU A  23      11.941  12.170   0.391  1.00  9.40           C  
 ATOM    168  OE1 GLU A  23      12.416  13.225   0.681  1.00 10.40           O  
 ATOM    169  OE2 GLU A  23      12.539  11.070   0.292  1.00 13.32           O  
-ATOM    170  N   ALA A  24       7.206  15.339   0.972  1.00  4.56           N  
-ATOM    171  CA  ALA A  24       6.625  16.316   1.907  1.00  4.49           C  
-ATOM    172  C   ALA A  24       5.206  15.933   2.351  1.00  4.10           C  
-ATOM    173  O   ALA A  24       4.867  16.052   3.523  1.00  5.64           O  
-ATOM    174  CB  ALA A  24       6.585  17.662   1.246  1.00  5.80           C  
-ATOM    175  N   ILE A  25       4.400  15.462   1.405  1.00  0.00           N  
-ATOM    176  CA  ILE A  25       3.013  15.077   1.697  1.00  0.00           C  
-ATOM    177  C   ILE A  25       2.949  13.799   2.532  1.00  0.00           C  
-ATOM    178  O   ILE A  25       2.149  13.704   3.465  1.00  0.00           O  
-ATOM    179  CB  ILE A  25       2.276  14.865   0.408  1.00  0.00           C  
-ATOM    180  CG1 ILE A  25       2.083  16.162  -0.418  1.00  0.00           C  
-ATOM    181  CG2 ILE A  25       0.958  14.073   0.562  1.00  0.00           C  
-ATOM    182  CD1 ILE A  25       1.575  15.925  -1.850  1.00  0.00           C  
-ATOM    183  N   CYS A  26       3.801  12.828   2.191  1.00  0.00           N  
-ATOM    184  CA  CYS A  26       3.820  11.519   2.858  1.00  0.00           C  
-ATOM    185  C   CYS A  26       4.443  11.568   4.247  1.00  0.00           C  
-ATOM    186  O   CYS A  26       3.895  10.981   5.191  1.00  0.00           O  
-ATOM    187  CB  CYS A  26       4.593  10.553   2.011  1.00  0.00           C  
-ATOM    188  SG  CYS A  26       3.768  10.129   0.427  1.00  0.00           S  
-ATOM    189  N   ALA A  27       5.577  12.255   4.371  1.00  0.00           N  
-ATOM    190  CA  ALA A  27       6.381  12.218   5.600  1.00  0.00           C  
-ATOM    191  C   ALA A  27       5.720  12.806   6.859  1.00  0.00           C  
-ATOM    192  O   ALA A  27       5.714  12.148   7.900  1.00  0.00           O  
-ATOM    193  CB  ALA A  27       7.654  12.970   5.347  1.00  0.00           C  
-ATOM    194  N   THR A  28       5.158  14.043   6.781  1.00  0.00           N  
-ATOM    195  CA  THR A  28       4.495  14.590   7.965  1.00  0.00           C  
-ATOM    196  C   THR A  28       3.288  13.781   8.406  1.00  0.00           C  
-ATOM    197  O   THR A  28       3.207  13.408   9.584  1.00  0.00           O  
-ATOM    198  CB  THR A  28       4.056  15.994   7.669  1.00  0.00           C  
-ATOM    199  OG1 THR A  28       5.156  16.850   7.373  1.00  0.00           O  
-ATOM    200  CG2 THR A  28       3.217  16.676   8.755  1.00  0.00           C  
-ATOM    201  N   TYR A  29       2.381  13.481   7.483  1.00  0.00           N  
-ATOM    202  CA  TYR A  29       1.150  12.736   7.809  1.00  0.00           C  
-ATOM    203  C   TYR A  29       1.442  11.314   8.293  1.00  0.00           C  
-ATOM    204  O   TYR A  29       0.559  10.652   8.849  1.00  0.00           O  
-ATOM    205  CB  TYR A  29       0.279  12.671   6.590  1.00  0.00           C  
-ATOM    206  CG  TYR A  29      -0.340  14.004   6.236  1.00  0.00           C  
-ATOM    207  CD1 TYR A  29       0.250  14.806   5.281  1.00  0.00           C  
-ATOM    208  CD2 TYR A  29      -1.494  14.418   6.869  1.00  0.00           C  
-ATOM    209  CE1 TYR A  29      -0.323  16.041   4.953  1.00  0.00           C  
-ATOM    210  CE2 TYR A  29      -2.067  15.653   6.541  1.00  0.00           C  
-ATOM    211  CZ  TYR A  29      -1.494  16.461   5.595  1.00  0.00           C  
-ATOM    212  OH  TYR A  29      -2.067  17.696   5.267  1.00  0.00           O  
-ATOM    213  N   THR A  30       2.676  10.862   8.093  1.00  0.00           N  
-ATOM    214  CA  THR A  30       3.102   9.534   8.547  1.00  0.00           C  
-ATOM    215  C   THR A  30       3.922   9.620   9.845  1.00  0.00           C  
-ATOM    216  O   THR A  30       4.406   8.609  10.339  1.00  0.00           O  
-ATOM    217  CB  THR A  30       3.931   8.885   7.478  1.00  0.00           C  
-ATOM    218  OG1 THR A  30       5.105   9.636   7.178  1.00  0.00           O  
-ATOM    219  CG2 THR A  30       3.213   8.599   6.155  1.00  0.00           C  
-ATOM    220  N   GLY A  31       4.092  10.832  10.363  1.00  0.00           N  
-ATOM    221  CA  GLY A  31       4.903  11.062  11.544  1.00  0.00           C  
-ATOM    222  C   GLY A  31       6.393  11.105  11.251  1.00  0.00           C  
-ATOM    223  O   GLY A  31       7.221  10.693  12.071  1.00  0.00           O  
-ATOM    224  N   CYS A  32       6.755  11.608  10.078  1.00  4.30           N  
-ATOM    225  CA  CYS A  32       8.167  11.695   9.659  1.00  4.89           C  
-ATOM    226  C   CYS A  32       8.465  13.129   9.146  1.00  5.50           C  
-ATOM    227  O   CYS A  32       7.601  13.916   8.762  1.00  5.82           O  
-ATOM    228  CB  CYS A  32       8.411  10.688   8.583  1.00  4.66           C  
-ATOM    229  SG  CYS A  32       8.094   8.955   9.101  1.00  0.00           S  
+ATOM    170  N   ALA A  24       7.184  15.340   0.984  1.00  4.56           N  
+ATOM    171  CA  ALA A  24       6.630  16.325   1.910  1.00  4.49           C  
+ATOM    172  C   ALA A  24       5.224  15.922   2.335  1.00  4.10           C  
+ATOM    173  O   ALA A  24       4.841  16.076   3.489  1.00  5.64           O  
+ATOM    174  CB  ALA A  24       6.590  17.671   1.249  1.00  5.80           C  
+ATOM    175  N   ILE A  25       4.450  15.401   1.376  1.00  0.00           N  
+ATOM    176  CA  ILE A  25       3.092  14.965   1.629  1.00  0.00           C  
+ATOM    177  C   ILE A  25       3.062  13.609   2.333  1.00  0.00           C  
+ATOM    178  O   ILE A  25       2.371  13.438   3.344  1.00  0.00           O  
+ATOM    179  CB  ILE A  25       2.352  14.864   0.328  1.00  0.00           C  
+ATOM    180  CG1 ILE A  25       2.149  16.228  -0.379  1.00  0.00           C  
+ATOM    181  CG2 ILE A  25       1.039  14.053   0.415  1.00  0.00           C  
+ATOM    182  CD1 ILE A  25       1.640  16.116  -1.826  1.00  0.00           C  
+ATOM    183  N   CYS A  26       3.813  12.637   1.816  1.00  0.00           N  
+ATOM    184  CA  CYS A  26       3.822  11.305   2.416  1.00  0.00           C  
+ATOM    185  C   CYS A  26       4.463  11.271   3.789  1.00  0.00           C  
+ATOM    186  O   CYS A  26       3.868  10.786   4.744  1.00  0.00           O  
+ATOM    187  CB  CYS A  26       4.568  10.370   1.510  1.00  0.00           C  
+ATOM    188  SG  CYS A  26       3.716  10.041  -0.082  1.00  0.00           S  
+ATOM    189  N   ALA A  27       5.693  11.780   3.893  1.00  0.00           N  
+ATOM    190  CA  ALA A  27       6.413  11.794   5.153  1.00  0.00           C  
+ATOM    191  C   ALA A  27       5.608  12.397   6.310  1.00  0.00           C  
+ATOM    192  O   ALA A  27       5.543  11.812   7.398  1.00  0.00           O  
+ATOM    193  CB  ALA A  27       7.677  12.584   4.979  1.00  0.00           C  
+ATOM    194  N   THR A  28       4.988  13.552   6.073  1.00  0.00           N  
+ATOM    195  CA  THR A  28       4.196  14.207   7.124  1.00  0.00           C  
+ATOM    196  C   THR A  28       3.020  13.328   7.533  1.00  0.00           C  
+ATOM    197  O   THR A  28       2.658  13.279   8.714  1.00  0.00           O  
+ATOM    198  CB  THR A  28       3.687  15.525   6.622  1.00  0.00           C  
+ATOM    199  OG1 THR A  28       4.746  16.413   6.274  1.00  0.00           O  
+ATOM    200  CG2 THR A  28       2.740  16.279   7.562  1.00  0.00           C  
+ATOM    201  N   TYR A  29       2.415  12.636   6.571  1.00  0.00           N  
+ATOM    202  CA  TYR A  29       1.299  11.759   6.889  1.00  0.00           C  
+ATOM    203  C   TYR A  29       1.753  10.591   7.751  1.00  0.00           C  
+ATOM    204  O   TYR A  29       0.989  10.063   8.559  1.00  0.00           O  
+ATOM    205  CB  TYR A  29       0.696  11.238   5.618  1.00  0.00           C  
+ATOM    206  CG  TYR A  29      -0.580  10.461   5.846  1.00  0.00           C  
+ATOM    207  CD1 TYR A  29      -1.759  11.132   6.101  1.00  0.00           C  
+ATOM    208  CD2 TYR A  29      -0.566   9.082   5.800  1.00  0.00           C  
+ATOM    209  CE1 TYR A  29      -2.942  10.412   6.313  1.00  0.00           C  
+ATOM    210  CE2 TYR A  29      -1.749   8.363   6.012  1.00  0.00           C  
+ATOM    211  CZ  TYR A  29      -2.928   9.013   6.266  1.00  0.00           C  
+ATOM    212  OH  TYR A  29      -4.110   8.294   6.478  1.00  0.00           O  
+ATOM    213  N   THR A  30       3.002  10.172   7.592  1.00  0.00           N  
+ATOM    214  CA  THR A  30       3.538   9.056   8.363  1.00  0.00           C  
+ATOM    215  C   THR A  30       4.131   9.513   9.681  1.00  0.00           C  
+ATOM    216  O   THR A  30       4.622   8.696  10.464  1.00  0.00           O  
+ATOM    217  CB  THR A  30       4.598   8.364   7.559  1.00  0.00           C  
+ATOM    218  OG1 THR A  30       5.684   9.231   7.243  1.00  0.00           O  
+ATOM    219  CG2 THR A  30       4.130   7.712   6.254  1.00  0.00           C  
+ATOM    220  N   GLY A  31       4.097  10.820   9.941  1.00  0.00           N  
+ATOM    221  CA  GLY A  31       4.647  11.345  11.171  1.00  0.00           C  
+ATOM    222  C   GLY A  31       6.147  11.478  11.136  1.00  0.00           C  
+ATOM    223  O   GLY A  31       6.797  11.474  12.181  1.00  0.00           O  
+ATOM    224  N   CYS A  32       6.705  11.609   9.935  1.00  4.30           N  
+ATOM    225  CA  CYS A  32       8.165  11.744   9.774  1.00  4.89           C  
+ATOM    226  C   CYS A  32       8.488  13.127   9.150  1.00  5.50           C  
+ATOM    227  O   CYS A  32       7.704  14.003   9.062  1.00  5.82           O  
+ATOM    228  CB  CYS A  32       8.662  10.640   8.894  1.00  4.66           C  
+ATOM    229  SG  CYS A  32       8.352   8.959   9.564  1.00  0.00           S  
 ATOM    230  N   ILE A  33       9.793  13.410   9.173  1.00  6.02           N  
 ATOM    231  CA  ILE A  33      10.280  14.760   8.823  1.00  5.24           C  
 ATOM    232  C   ILE A  33      11.346  14.658   7.743  1.00  5.16           C  
diff --git a/modelling/tests/test_pipeline.py b/modelling/tests/test_pipeline.py
index 38d6475e8a64be38979b4cbe8260928c2d182b2d..83d6e647c384f46a334aa8b870029c5fbb1b1a9b 100644
--- a/modelling/tests/test_pipeline.py
+++ b/modelling/tests/test_pipeline.py
@@ -27,6 +27,8 @@ from ost import io, mol
 # io.SaveAlignment(aln, "data/1crn.fasta")
 ################################################################
 # Code to generate reference solutions:
+# -> these files must be carefully (!!) updated each time
+#    parts of the pipeline change!
 ################################################################
 # from ost import io
 # from promod3 import loop,modelling
diff --git a/scripts/loop/backbone_scorer/cb_pot.dat b/scripts/loop/backbone_scorer/cb_pot.dat
deleted file mode 100644
index 6c9b2d2a0e3ed27145bbea120dec091732c4524d..0000000000000000000000000000000000000000
Binary files a/scripts/loop/backbone_scorer/cb_pot.dat and /dev/null differ
diff --git a/scripts/loop/backbone_scorer/cbeta_pot.dat b/scripts/loop/backbone_scorer/cbeta_pot.dat
new file mode 100644
index 0000000000000000000000000000000000000000..1c7b7a480c35b3e0e1a7690116bf2baad550ce12
Binary files /dev/null and b/scripts/loop/backbone_scorer/cbeta_pot.dat differ
diff --git a/scripts/loop/backbone_scorer/create_loop_scorer.py b/scripts/loop/backbone_scorer/create_loop_scorer.py
index 681dfdc037b1dd6ed962be9d29055d5c0e1a7c48..597675d341d2aad25d94a05fe0e741b55d14ce37 100644
--- a/scripts/loop/backbone_scorer/create_loop_scorer.py
+++ b/scripts/loop/backbone_scorer/create_loop_scorer.py
@@ -12,12 +12,14 @@ has to be adjusted accordingly for different needs
 """
 
 cb_packing_pot = CBPackingPotential.Load("cb_packing_pot.dat")
-cbeta_pot = CBetaPotential.Load("cb_pot.dat")
+cb_pot = CBetaPotential.Load("cbeta_pot.dat")
+reduced_pot = ReducedPotential.Load("reduced_pot.dat")
 torsion_pot = TorsionPotential.Load("torsion_pot.dat")
 hbond_pot = HBondPotential.Load("hbond_pot.dat")
 
 cb_packing_opts = cb_packing_pot.GetOptions()
-cbeta_opts = cbeta_pot.GetOptions()
+cb_opts = cb_pot.GetOptions()
+reduced_opts = reduced_pot.GetOptions()
 torsion_opts = torsion_pot.GetOptions()
 hbond_opts = hbond_pot.GetOptions()
 
@@ -27,6 +29,8 @@ for item in torsion_opts.group_identifier:
 
 #check whether the provided potentials are parametrized in a way 
 #promod can use them
+
+#check torsion
 if torsion_opts.number_of_bins[0] != 1:
   raise ValueError("Require torsion potential only looking at central phi/psi angles!")
 if torsion_opts.number_of_bins[1] != 1:
@@ -38,9 +42,34 @@ if torsion_opts.number_of_bins[5] != 1:
 if torsion_opts.number_of_bins[2] != torsion_opts.number_of_bins[3]:
   raise ValueError("Require same amount of phi and psi bin for central amino acid")
 
-if cbeta_opts.lower_cutoff != 0.0:
+
+#check cbeta interaction
+if cb_opts.lower_cutoff != 0.0:
   raise ValueError("Require lower cutoff in cbeta potential to be zero in cbeta potential")
 
+if cb_opts.number_of_bins < 1:
+  raise ValueError("Number of dist bins in cbeta potential must be >= 1")
+
+if cb_opts.sequence_sep < 1:
+  raise ValueError("Sequence separation in cbeta potential must be >= 1")
+
+#check reduced
+if reduced_opts.lower_cutoff != 0.0:
+  raise ValueError("Require lower cutoff in reduced potential to be zero in reduced potential")
+
+if reduced_opts.num_dist_bins < 1:
+  raise ValueError("Number of dist bins in reduced potential must be >= 1")
+
+if reduced_opts.num_angle_bins < 1:
+  raise ValueError("Number of angle bins in reduced potential must be >= 1")
+
+if reduced_opts.num_dihedral_bins < 1:
+  raise ValueError("Number of dihedral bins in reduced potential must be >= 1")
+
+if reduced_opts.sequence_sep < 1:
+  raise ValueError("Sequence separation in reduced potential must be >= 1")
+
+#check cb packing
 if(cb_packing_opts.bin_size != 1):
   raise ValueError("Expect bin size of cb packing potential to be 1!");
   
@@ -52,7 +81,8 @@ loop_scorer = loop.BackboneLoopScorer()
 
 #let's set the parameters
 loop_scorer.SetCBPackingPotentialParameters(cb_packing_opts.cutoff,cb_packing_opts.max_counts)
-loop_scorer.SetCBetaPotentialParameters(cbeta_opts.upper_cutoff, cbeta_opts.number_of_bins, cbeta_opts.sequence_sep)
+loop_scorer.SetCBetaPotentialParameters(cb_opts.upper_cutoff, cb_opts.number_of_bins, cb_opts.sequence_sep)
+loop_scorer.SetReducedPotentialParameters(reduced_opts.upper_cutoff,reduced_opts.num_dist_bins,reduced_opts.num_angle_bins,reduced_opts.num_dihedral_bins,reduced_opts.sequence_sep)
 loop_scorer.SetTorsionPotentialParameters(torsion_group_identifiers,torsion_opts.number_of_bins[3])
 loop_scorer.SetHBondPotentialParameters(hbond_opts.d_min, hbond_opts.d_max,
                                         hbond_opts.alpha_min, hbond_opts.alpha_max,
@@ -61,19 +91,42 @@ loop_scorer.SetHBondPotentialParameters(hbond_opts.d_min, hbond_opts.d_max,
                                         hbond_opts.d_bins, hbond_opts.alpha_bins,
                                         hbond_opts.beta_bins, hbond_opts.gamma_bins)
 
-
 #fill cbeta potential
-cbeta_bin_size = cbeta_opts.upper_cutoff / cbeta_opts.number_of_bins
+cbeta_bin_size = cb_opts.upper_cutoff / cb_opts.number_of_bins
 for i in range(ost.conop.XXX):
   aa_one = ost.conop.AminoAcid(i)
   for j in range(ost.conop.XXX):
     aa_two = ost.conop.AminoAcid(j)
     d = 0.001
-    for actual_bin in range(cbeta_opts.number_of_bins):
-      e = cbeta_pot.GetEnergy(aa_one,aa_two,d)
+    for actual_bin in range(cb_opts.number_of_bins):
+      e = cb_pot.GetEnergy(aa_one,aa_two,d)
       loop_scorer.SetCBetaEnergy(aa_one,aa_two,actual_bin,e)
       d += cbeta_bin_size
 
+#fill reduced
+reduced_dist_bin_size = reduced_opts.upper_cutoff / reduced_opts.num_dist_bins 
+reduced_angle_bin_size = np.pi / reduced_opts.num_angle_bins
+reduced_dihedral_bin_size = 2 * np.pi / reduced_opts.num_dihedral_bins 
+
+for i in range(ost.conop.XXX):
+  aa_one = ost.conop.AminoAcid(i)
+  for j in range(ost.conop.XXX):
+    aa_two = ost.conop.AminoAcid(j)
+    dist = 0.001
+    for k in range(reduced_opts.num_dist_bins):
+      alpha = 0.001
+      for l in range(reduced_opts.num_angle_bins):
+        beta = 0.001
+        for m in range(reduced_opts.num_angle_bins):
+          gamma = -np.pi + 0.001
+          for n in range(reduced_opts.num_dihedral_bins):
+            e = reduced_pot.GetEnergy(aa_one,aa_two,dist,alpha,beta,gamma)
+            loop_scorer.SetReducedEnergy(aa_one,aa_two,k,l,m,n,e)
+            gamma += reduced_dihedral_bin_size
+          beta += reduced_angle_bin_size
+        alpha += reduced_angle_bin_size
+      dist += reduced_dist_bin_size
+
 #fill torsion potential
 torsion_angles = list()
 for i in range(6):
@@ -122,5 +175,21 @@ for i in range(3):
       alpha += alpha_bin_size
     d += d_bin_size
 
+#fill ss_agreement
+psipred_states = ['H','E','C']
+psipred_confidences = [0,1,2,3,4,5,6,7,8,9]
+dssp_states = ['H','E','C','G','B','S','T','I']
+
+qmean_ss_agreement = SSAgreement()
+
+loop_scorer.SetSSAgreementParameters()
+for p_s in psipred_states:
+  for p_c in psipred_confidences:
+    for d_s in dssp_states:
+      score = qmean_ss_agreement.LogOddScore(d_s,p_s,p_c)
+      loop_scorer.SetSSAgreementScore(p_s,p_c,d_s,score)
+
+
+
 loop_scorer.Save("super_awesome_loop_scorer.dat")
 
diff --git a/scripts/loop/backbone_scorer/hbond_pot.dat b/scripts/loop/backbone_scorer/hbond_pot.dat
index 6986e10fc7d816c629e35557e5541ac20ad8f152..82b4a959624a2797c4d8a69554f410b865dc8b1a 100644
Binary files a/scripts/loop/backbone_scorer/hbond_pot.dat and b/scripts/loop/backbone_scorer/hbond_pot.dat differ
diff --git a/scripts/loop/backbone_scorer/reduced_pot.dat b/scripts/loop/backbone_scorer/reduced_pot.dat
new file mode 100644
index 0000000000000000000000000000000000000000..04443ad6e044b75563a6a99df2bc597e84f78a7f
Binary files /dev/null and b/scripts/loop/backbone_scorer/reduced_pot.dat differ
diff --git a/scripts/loop/backbone_scorer/super_awesome_loop_scorer.dat b/scripts/loop/backbone_scorer/super_awesome_loop_scorer.dat
new file mode 100644
index 0000000000000000000000000000000000000000..2d787a1dd00166fcac6b78c1fbcbbc4a95cd7bc4
Binary files /dev/null and b/scripts/loop/backbone_scorer/super_awesome_loop_scorer.dat differ