Skip to content
Snippets Groups Projects
Commit 8a6a2bbf authored by Studer Gabriel's avatar Studer Gabriel
Browse files

Implement extraction of RRMRotamer from FRMRotamer

parent 1697f819
No related branches found
No related tags found
No related merge requests found
......@@ -310,7 +310,7 @@ Rotamers
.. method:: ApplyOnResidue(res, consider_hydrogens=False, new_res_name="")
Iterates over every particle of the first subrotamer and searches for the
Iterates over every particle of the active subrotamer and searches for the
according atom in **res**. If it's present, the position gets reset to the
particle position. If not, a new atom gets added to **res**.
......@@ -330,7 +330,7 @@ Rotamers
.. method:: ApplyOnResidue(all_atom, res_idx)
Set all sidechain atom positions for given residue to the positions of the
particles in the rotamer.
particles in the active surotamer.
:param all_atom: Container to which to apply rotamer
:param res_idx: Residue index into *all_atom*
......@@ -350,6 +350,15 @@ Rotamers
:returns: The constructed :class:`FrameResidue`
.. method:: ToRRMRotamer()
Generates and returns a :class:`RRMRotamer` based on the internal
particles of the active subrotamer. Following parameters of the
returned rotamer get set: probability (probability of the whole FRMRotamer),
internal_e_prefactor (prefactor of the whole FRMRotamer),
frame_energy (The frame energy of that particular subrotamer if already
calculated), internal_energy (the internal energy of the whole FRMRotamer)
.. method:: GetSubrotamerDefinition(index)
:param index: Index of subrotamer
......@@ -460,8 +469,9 @@ Rotamers
The provided **idx** relates to the subrotamer definitions added at the
rotamer buildup. This idx controls which subrotamer is used when
:func:`ApplyOnResidue` of :func:`ToFrameResidue` gets called.
By default, the value is 0 => first added subrotamer definition gets used.
:func:`ApplyOnResidue`, :func:`ToFrameResidue` or :func:`ToRRMRotamer`
gets called. By default, the value is 0 => first added subrotamer
definition gets used.
:param idx: Index of subrotamer definition applied on residues
......
......@@ -187,6 +187,7 @@ void export_Rotamer()
.def("ApplyOnResidue", WrapFRMApplyOnResAA,
(arg("all_atom"), arg("res_idx")))
.def("ToFrameResidue", &FRMRotamer::ToFrameResidue, (arg("res_idx")))
.def("ToRRMRotamer", &FRMRotamer::ToRRMRotamer)
.def("GetInternalEnergyPrefactor",&FRMRotamer::GetInternalEnergyPrefactor)
.def("GetInternalEnergy",&FRMRotamer::GetInternalEnergy)
.def("GetFrameEnergy",&GetFRMFrameEnergyOne)
......
......@@ -98,14 +98,13 @@ void FRMRotamer::ApplyOnResidue(ost::mol::ResidueHandle& res,
throw promod3::Error("At least one subrotamer must be set in FRM rotamer!");
}
ost::mol::XCSEditor ed = res.GetEntity().EditXCS(ost::mol::BUFFERED_EDIT);
if(active_subrotamer_ >= subrotamer_definitions_.size()){
throw promod3::Error("Need to add subrotamer definitions to "
"apply FRMRotamer to residue!");
}
ost::mol::XCSEditor ed = res.GetEntity().EditXCS(ost::mol::BUFFERED_EDIT);
const std::vector<int>& sub_def = subrotamer_definitions_[active_subrotamer_];
ost::mol::AtomHandle a;
for (uint i = 0; i < sub_def.size(); ++i) {
......@@ -159,6 +158,11 @@ void FRMRotamer::ApplyOnResidue(loop::AllAtomPositions& all_atom,
FrameResiduePtr FRMRotamer::ToFrameResidue(uint res_idx) const {
if(active_subrotamer_ >= subrotamer_definitions_.size()){
throw promod3::Error("Need to add subrotamer definitions to "
"generate FrameResidue!");
}
const std::vector<int>& sub_def = subrotamer_definitions_[active_subrotamer_];
std::vector<Particle> particles(sub_def.size());
for(uint i = 0; i < sub_def.size(); ++i){
......@@ -168,4 +172,22 @@ FrameResiduePtr FRMRotamer::ToFrameResidue(uint res_idx) const {
return frame_res;
}
RRMRotamerPtr FRMRotamer::ToRRMRotamer() const {
if(active_subrotamer_ >= subrotamer_definitions_.size()){
throw promod3::Error("Need to add subrotamer definitions to "
"to generate RRMRotamer!");
}
const std::vector<int>& sub_def = subrotamer_definitions_[active_subrotamer_];
std::vector<Particle> particles(sub_def.size());
for(uint i = 0; i < sub_def.size(); ++i){
particles[i] = particles_[sub_def[i]];
}
RRMRotamerPtr rot(new RRMRotamer(particles, probability_, internal_e_prefactor_));
rot->SetFrameEnergy(frame_energies_[active_subrotamer_]);
rot->SetInternalEnergy(internal_energy_);
return rot;
}
}}//ns
......@@ -102,6 +102,8 @@ public:
FrameResiduePtr ToFrameResidue(uint res_idx) const;
RRMRotamerPtr ToRRMRotamer() const;
void AddSubrotamerDefinition(const std::vector<int>& definition);
void SetActiveSubrotamer(uint idx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment