void IMGDock::rotateLigandFragment(Size fragment, Size bond, int degree) { const vector<StaticLigandFragment*>* ligand_fragments = scoring_function_->getStaticLigandFragments(); if (ligand_fragments->size() < fragment) { String s="There are less than "; s = s+String(fragment+1)+" fragments!"; throw Exception::GeneralException(__FILE__, __LINE__, "Rotation error", s); return; } StaticLigandFragment* lf = (*ligand_fragments)[fragment]; if (lf->connections.size() < bond) { String s="Fragment has less than "; s = s+String(bond+1)+" bonds!"; throw Exception::GeneralException(__FILE__, __LINE__, "Rotation error", s); return; } StaticLigandFragment::Connection* nc = &lf->connections[bond]; TMatrix4x4<float> M; TAngle<float> angle(degree, false); Vector3 axis = nc->neighbor_atom->getPosition() - nc->atom->getPosition(); M.setRotation(angle, axis); Vector3 origin = nc->atom->getPosition(); rotateLigandFragment(lf, M, origin, nc->fragment->ID); }
void GridAnalysis::rotateProbeGroup_(int axis, int degree) { TMatrix4x4<float> M; TAngle<float> angle(degree, false); Vector3 axis_vector(axis == 0, axis == 1, axis == 2); M.setRotation(angle, axis_vector); for (AtomIterator it = probe_group_.beginAtom(); it != probe_group_.endAtom(); it++) { it->setPosition(M*(it->getPosition()-center_)+center_); } }
void IMGDock::rotateLigand(int a, int degree) { TMatrix4x4<float> M; TAngle<float> angle(degree, false); Vector3 axis(a == 0, a == 1, a == 2); M.setRotation(angle, axis); const Vector3& origin = scoring_function_->getLigandCenter(); for (AtomIterator it = ligand_->beginAtom(); it != ligand_->endAtom(); it++) { it->setPosition(M*(it->getPosition()-origin)+origin); } }