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

Added function to extract the matrix of pairwise distances

between the atoms in two different views
parent 7575d2f5
Branches
Tags
No related merge requests found
......@@ -32,4 +32,5 @@ void export_StructureAnalysis()
def("CalculateAgreementWithDensityMap",&CalculateAgreementWithDensityMap,(arg("pos_list"),arg("density_map")));
#endif
def("WrapEntityInPeriodicCell",&WrapEntityInPeriodicCell,(arg("Entity"),arg("cell_center"),arg("ucell_size"),arg("ucell_angles")=geom::Vec3(),arg("group_res")=true));
def("PariwiseDistanceMatrix",&PariwiseDistanceMatrix,(arg("EntityView1"),arg("EntityView2")));
}
......@@ -59,6 +59,19 @@ Real CalculateAverageAgreementWithDensityMap(const geom::Vec3List& vl, img::MapH
}
return sum/float(vl.size());
}
std::vector< std::vector<Real> > PariwiseDistanceMatrix(const EntityView view1, const EntityView view2){
std::vector< std::vector<Real> > dist_mat;
unsigned int n1=view1.GetAtomCount(),n2=view2.GetAtomCount();
dist_mat.resize(n1,std::vector<Real>(n2,0));
AtomViewList atoms1=view1.GetAtomList(),atoms2=view2.GetAtomList();
for (unsigned int i=0; i!=n1; ++i){
for (unsigned int j=0; j!=n2; ++j) {
dist_mat[i][j]=geom::Distance(atoms1[i].GetPos(),atoms2[j].GetPos());
}
}
return dist_mat;
}
#endif
void DLLEXPORT_OST_MOL_ALG WrapEntityInPeriodicCell(EntityHandle eh, const geom::Vec3 cell_center, const geom::Vec3 ucell_size, \
......
......@@ -38,5 +38,6 @@ namespace ost { namespace mol { namespace alg {
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 ucell_size, const geom::Vec3 ucell_angles=geom::Vec3(), bool group_res=true);
std::vector< std::vector<Real> > DLLEXPORT_OST_MOL_ALG PariwiseDistanceMatrix(const EntityView view1, const EntityView view2);
}}}//ns
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment