Skip to content
Snippets Groups Projects
Commit 5a553966 authored by Niklaus Johner's avatar Niklaus Johner
Browse files

Correct wrapping for the cases when residues are not whole but split by the PBC

The residues first get wrapped and then the entity. The wrapping is per residue
and each residue gets wrapped according to the position of its center of mass
parent bde4f38d
Branches
Tags
No related merge requests found
......@@ -31,5 +31,5 @@ void export_StructureAnalysis()
def("CalculateAverageAgreementWithDensityMap",&CalculateAverageAgreementWithDensityMap,(arg("pos_list"),arg("density_map")));
def("CalculateAgreementWithDensityMap",&CalculateAgreementWithDensityMap,(arg("pos_list"),arg("density_map")));
#endif
def("WrapEntityInPeriodicCell",&WrapEntityInPeriodicCell,(arg("Entity"),arg("cell_center"),arg("nasis_vec")));
def("WrapEntityInPeriodicCell",&WrapEntityInPeriodicCell,(arg("Entity"),arg("cell_center"),arg("basis_vec"),arg("group_res")=true));
}
......@@ -61,12 +61,21 @@ Real CalculateAverageAgreementWithDensityMap(const geom::Vec3List& vl, img::MapH
}
#endif
void DLLEXPORT_OST_MOL_ALG WrapEntityInPeriodicCell(EntityHandle eh, const geom::Vec3 cell_center, const geom::Vec3 basis_vec){
void DLLEXPORT_OST_MOL_ALG WrapEntityInPeriodicCell(EntityHandle eh, const geom::Vec3 cell_center, const geom::Vec3 basis_vec, bool group_residues){
mol::XCSEditor edi=eh.EditXCS(mol::BUFFERED_EDIT);
geom::Vec3 cm,wrapped_cm,shift;
edi=eh.EditXCS();
ResidueHandleList residues=eh.GetResidueList();
unsigned int n_residues=eh.GetResidueCount();
if (group_residues) {
for (unsigned int i=0; i<n_residues; ++i) {
ResidueHandle r=residues[i];
AtomHandleList atoms=r.GetAtomList();
geom::Vec3 ref_pos=atoms[0].GetPos();
for (AtomHandleList::iterator a=atoms.begin(), e=atoms.end(); a!=e; ++a) {
edi.SetAtomPos((*a),geom::WrapVec3((*a).GetPos(),ref_pos,basis_vec));
}
}
}
for (unsigned int i=0; i<n_residues; ++i) {
ResidueHandle r=residues[i];
cm=r.GetCenterOfMass();
......
......@@ -37,6 +37,6 @@ namespace ost { namespace mol { namespace alg {
std::vector<Real> DLLEXPORT_OST_MOL_ALG CalculateAgreementWithDensityMap(const geom::Vec3List& vl, img::MapHandle& density_map);
Real DLLEXPORT_OST_MOL_ALG CalculateAverageAgreementWithDensityMap(const geom::Vec3List& vl, img::MapHandle& density_map);
#endif
void DLLEXPORT_OST_MOL_ALG WrapEntityInPeriodicCell(EntityHandle eh, const geom::Vec3 cell_center, const geom::Vec3 basis_vec);
void DLLEXPORT_OST_MOL_ALG WrapEntityInPeriodicCell(EntityHandle eh, const geom::Vec3 cell_center, const geom::Vec3 basis_vec, bool group_res=true);
}}}//ns
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment