diff --git a/modules/mol/alg/pymod/export_structure_analysis.cc b/modules/mol/alg/pymod/export_structure_analysis.cc index 85fbc230d34a1a568b1565672278b61a85a1b5b6..f9f58347d1313d30d7a6d71f20e9733c2df243bc 100644 --- a/modules/mol/alg/pymod/export_structure_analysis.cc +++ b/modules/mol/alg/pymod/export_structure_analysis.cc @@ -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)); } diff --git a/modules/mol/alg/src/structure_analysis.cc b/modules/mol/alg/src/structure_analysis.cc index 50689dfca3a27c1a62ef999e5ce9a048baeeffda..de7a176b13a98c7a0257dea47df463530bb01904 100644 --- a/modules/mol/alg/src/structure_analysis.cc +++ b/modules/mol/alg/src/structure_analysis.cc @@ -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(); diff --git a/modules/mol/alg/src/structure_analysis.hh b/modules/mol/alg/src/structure_analysis.hh index 45cb601f8b32ba80656d031a211f5672202f4aed..7ad8ad575cb0ebdb448e800748408f251fd69c49 100644 --- a/modules/mol/alg/src/structure_analysis.hh +++ b/modules/mol/alg/src/structure_analysis.hh @@ -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