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

Merge branch 'develop' into QS-Scores

parents 4a8fa08a a83e67df
Branches
Tags
No related merge requests found
...@@ -24,14 +24,15 @@ struct Cube { ...@@ -24,14 +24,15 @@ struct Cube {
}; };
struct CubeGrid { struct CubeGrid {
CubeGrid(Real cel, int x_cubes, int y_cubes, int z_cubes, CubeGrid(Real cel, int x_c, int y_c, int z_c,
Real x_min, Real y_min, Real z_min): cube_edge_length(cel), Real x_min, Real y_min, Real z_min): cube_edge_length(cel),
x_cubes(x_cubes), x_min(x_min),
y_cubes(y_cubes), y_min(y_min),
z_cubes(z_cubes), z_min(z_min) {
x_min(x_min),
y_min(y_min), x_cubes = std::max(1, x_c);
z_min(z_min) { y_cubes = std::max(1, y_c);
z_cubes = std::max(1, z_c);
int num_cubes = x_cubes * y_cubes * z_cubes; int num_cubes = x_cubes * y_cubes * z_cubes;
cubes = new Cube*[num_cubes]; cubes = new Cube*[num_cubes];
// assign NULL to each cube // assign NULL to each cube
...@@ -49,11 +50,18 @@ struct CubeGrid { ...@@ -49,11 +50,18 @@ struct CubeGrid {
delete [] cubes; delete [] cubes;
} }
int GetCubeIdx(Real x, Real y, Real z) {
int x_cube = std::min(static_cast<int>((x - x_min) / cube_edge_length),
x_cubes - 1);
int y_cube = std::min(static_cast<int>((y - y_min) / cube_edge_length),
y_cubes - 1);
int z_cube = std::min(static_cast<int>((z - z_min) / cube_edge_length),
z_cubes - 1);
return x_cube * y_cubes * z_cubes + y_cube * z_cubes + z_cube;
}
void AddIndex(Real x, Real y, Real z, int idx) { void AddIndex(Real x, Real y, Real z, int idx) {
int x_cube = (x - x_min) / cube_edge_length; int cube_idx = this->GetCubeIdx(x, y, z);
int y_cube = (y - y_min) / cube_edge_length;
int z_cube = (z - z_min) / cube_edge_length;
int cube_idx = x_cube * y_cubes * z_cubes + y_cube * z_cubes + z_cube;
if(cubes[cube_idx] == NULL) cubes[cube_idx] = new Cube; if(cubes[cube_idx] == NULL) cubes[cube_idx] = new Cube;
cubes[cube_idx]->AddIndex(idx); cubes[cube_idx]->AddIndex(idx);
} }
......
...@@ -1865,7 +1865,7 @@ Other Entity-Related Functions ...@@ -1865,7 +1865,7 @@ Other Entity-Related Functions
Residue Numbering Residue Numbering
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
.. class:: ResNum(num, ins_code='\0') .. class:: ResNum(num, ins_code='\\0')
Number for a residue. The residue number has a numeric part and an (optional) Number for a residue. The residue number has a numeric part and an (optional)
insertion-code. You can work with this object as if it was an integer and insertion-code. You can work with this object as if it was an integer and
......
...@@ -197,10 +197,10 @@ void export_EntityView() ...@@ -197,10 +197,10 @@ void export_EntityView()
make_function(&EntityView::GetBondList, make_function(&EntityView::GetBondList,
return_value_policy<reference_existing_object>())) return_value_policy<reference_existing_object>()))
.def("GetChainList", &EntityView::GetChainList, .def("GetChainList", &EntityView::GetChainList,
return_value_policy<reference_existing_object>()) return_value_policy<copy_const_reference>())
.add_property("chains", .add_property("chains",
make_function(&EntityView::GetChainList, make_function(&EntityView::GetChainList,
return_value_policy<reference_existing_object>())) return_value_policy<copy_const_reference>()))
.def(self==self) .def(self==self)
.def(self!=self) .def(self!=self)
.def("Dump", &EntityView::Dump) .def("Dump", &EntityView::Dump)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment