Skip to content
Snippets Groups Projects
Commit e7de0041 authored by Gerardo Tauriello's avatar Gerardo Tauriello
Browse files

SCHWED-1740: resolve overlaps in MmSystemCreator

parent 682f66ee
No related branches found
No related tags found
No related merge requests found
#include <promod3/loop/mm_system_creator.hh>
#include <promod3/loop/hydrogen_constructor.hh>
#include <promod3/loop/idx_handler.hh>
#include <promod3/core/message.hh>
#include <promod3/core/runtime_profiling.hh>
......@@ -274,6 +275,10 @@ void MmSystemCreator::SetupSystem(const AllAtomPositions& all_pos,
// check data consistency
const uint num_loops = loop_start_indices.size();
if (num_loops != loop_lengths.size()) {
throw promod3::Error("Sizes of loop_start_indices and loop_lengths must "
"match in MmSystemCreator::SetupSystem!");
}
for (uint i_loop = 0; i_loop < num_loops; ++i_loop) {
// loop from start_idx to start_idx + loop_lengths[i_loop] - 1
const uint start_idx = loop_start_indices[i_loop];
......@@ -284,11 +289,11 @@ void MmSystemCreator::SetupSystem(const AllAtomPositions& all_pos,
}
if (is_n_ter.size() != res_indices.size()) {
throw promod3::Error("Sizes of res_indices and is_n_ter must match in "
"in MmSystemCreator::SetupSystem!");
"MmSystemCreator::SetupSystem!");
}
if (is_c_ter.size() != res_indices.size()) {
throw promod3::Error("Sizes of res_indices and is_c_ter must match in "
"in MmSystemCreator::SetupSystem!");
"MmSystemCreator::SetupSystem!");
}
for (uint i_res = 0; i_res < res_indices.size(); ++i_res) {
const uint res_idx = res_indices[i_res];
......@@ -301,21 +306,25 @@ void MmSystemCreator::SetupSystem(const AllAtomPositions& all_pos,
for (uint i = 0; i < disulfid_bridges.size(); ++i) {
if (disulfid_bridges[i].first >= res_indices.size()) {
throw promod3::Error("Invalid disulfid bridge residue index observed in "
"in MmSystemCreator::SetupSystem!");
"MmSystemCreator::SetupSystem!");
}
if (disulfid_bridges[i].second >= res_indices.size()) {
throw promod3::Error("Invalid disulfid bridge residue index observed in "
"in MmSystemCreator::SetupSystem!");
"MmSystemCreator::SetupSystem!");
}
}
// setup internal data (loop_..., is_X_ter_, ff_aa_, first_idx_)
num_loop_residues_ = 0;
for (uint i_loop = 0; i_loop < num_loops; ++i_loop) {
num_loop_residues_ += loop_lengths[i_loop];
}
loop_start_indices_ = loop_start_indices;
loop_lengths_ = loop_lengths;
IdxHandler::ResolveOverlaps(loop_start_indices_, loop_lengths_, true);
if (loop_lengths_.empty()) {
throw promod3::Error("No valid loops in MmSystemCreator::SetupSystem!");
}
num_loop_residues_ = 0;
for (uint i_loop = 0; i_loop < loop_lengths_.size(); ++i_loop) {
num_loop_residues_ += loop_lengths_[i_loop];
}
is_n_ter_ = is_n_ter;
is_c_ter_ = is_c_ter;
SetupNextIRes_(res_indices);
......@@ -338,7 +347,7 @@ void MmSystemCreator::UpdatePositions(const AllAtomPositions& all_pos,
// check data consistency
if (ff_aa_.size() != res_indices.size()) {
throw promod3::Error("Inconsistent size of res_indices in "
"in MmSystemCreator::SetupSystem!");
"MmSystemCreator::SetupSystem!");
}
for (uint i_res = 0; i_res < res_indices.size(); ++i_res) {
const uint res_idx = res_indices[i_res];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment