18 #include <basic/options/option.hh>
19 #include <basic/options/keys/OptionKeys.hh>
20 #include <basic/options/keys/fingerprint.OptionKeys.gen.hh>
30 #include <basic/Tracer.hh>
31 #include <ObjexxFCL/string.functions.hh>
32 #include <basic/options/keys/pocket_grid.OptionKeys.gen.hh>
33 #include <basic/options/keys/out.OptionKeys.gen.hh>
34 #include <utility/io/ozstream.hh>
35 #include <utility/io/izstream.hh>
36 #include <numeric/xyz.functions.fwd.hh>
50 #include <utility/vector1.hh>
51 #include <numeric/xyz.functions.hh>
54 #include <numeric/random/random.fwd.hh>
59 static basic::Tracer
TR(
"core.grid.Pockets.PocketGrid");
64 return std::floor((
double) x);
68 return std::pow((
double) x, (
double) y);
72 return std::sqrt((
double) x);
114 if ((
int)
maxX<(
int)c2.
minX-1)
return false;
116 if ((
int)
maxY<(
int)c2.
minY-1)
return false;
118 if ((
int)
maxZ<(
int)c2.
minZ-1)
return false;
124 std::list<Cxyz>::iterator i =
points_.begin();
127 std::list<Cxyz>::iterator j = c2.
points_.begin();
128 int ictend=std::min(500,(
int)
points_.size()-icount);
129 for (
int ict=0; ict<ictend; ++i, ++ict){
132 int jctend=std::min(500,(
int)c2.
points_.size()-jcount);
133 for (
int jct=0; jct<jctend; ++j, ++jct){
134 if (abs((
int) i->x - (
int) j->x)<=1)
135 if (abs((
int) i->y - (
int) j->y)<=1)
136 if (abs((
int) i->z - (
int) j->z)<=1){
155 for (std::list<Cxyz>::iterator i =
points_.begin(); i!=
points_.end(); ++i){
156 for (std::list<Cxyz>::iterator j = c2.
points_.begin(); j!=c2.
points_.end(); ++j){
157 if (abs((
int) i->x - (
int) j->x)<=1)
158 if (abs((
int) i->y - (
int) j->y)<=1)
159 if (abs((
int) i->z - (
int) j->z)<=1){
198 c1->points_.splice(c1->points_.end(), c2->points_);
204 for (std::list<PCluster>::iterator j = i; j!=
clusters_.end(); ++j){
206 if (j->isClose(*i)) {
207 if (j->testNeighbor(*i)) {
208 std::list<PCluster>::iterator oldI = i;
221 if (!i->isTarget())
continue;
222 if (i->size()>largest_size){
223 largest_size=i->size();
226 largest_size = largest_size*pow(stepSize, 3)-minClusterSize;
227 if (largest_size > 0)
return largest_size;
235 if (!i->isTarget())
continue;
236 if (i->size()*pow(stepSize, 3) >minClusterSize){
237 total_size+=i->size()*pow(stepSize, 3)-minClusterSize;
240 if (total_size>0)
return total_size;
268 using namespace basic::options;
269 spacing_=option[ OptionKeys::pocket_grid::pocket_grid_spacing ]();
270 if (option[ OptionKeys::pocket_grid::pocket_grid_size ]()>0){
271 size_x_ = option[ OptionKeys::pocket_grid::pocket_grid_size ]();
272 size_y_ = option[ OptionKeys::pocket_grid::pocket_grid_size ]();
273 size_z_ = option[ OptionKeys::pocket_grid::pocket_grid_size ]();
275 size_x_ = option[ OptionKeys::pocket_grid::pocket_grid_size_x ]();
276 size_y_ = option[ OptionKeys::pocket_grid::pocket_grid_size_y ]();
277 size_z_ = option[ OptionKeys::pocket_grid::pocket_grid_size_z ]();
279 restrictSize_ = option[ OptionKeys::pocket_grid::pocket_restrict_size ]();
280 maxLen_ = option[ OptionKeys::pocket_grid::pocket_max_spacing ]();
284 probe_rad_=option[ OptionKeys::pocket_grid::pocket_probe_radius ]();
286 markpsp_=option[ OptionKeys::pocket_grid::pocket_psp ]();
287 marksps_=option[ OptionKeys::pocket_grid::pocket_sps ]();
288 surf_score_=option[ OptionKeys::pocket_grid::pocket_surface_score ]();
289 surf_dist_=option[ OptionKeys::pocket_grid::pocket_surface_dist ]();
290 bur_score_=option[ OptionKeys::pocket_grid::pocket_buried_score ]();
291 bur_dist_=option[ OptionKeys::pocket_grid::pocket_buried_dist ]();
292 minPockSize_=option[ OptionKeys::pocket_grid::pocket_min_size ]();
293 maxPockSize_=option[ OptionKeys::pocket_grid::pocket_max_size ]();
300 utility::pointer::ReferenceCount()
371 using namespace basic::options;
372 tag_=option[ OptionKeys::out::output_tag ]();
378 using namespace basic::options;
379 tag_=option[ OptionKeys::out::output_tag ]();
384 x = (
int) (numeric::random::uniform() *89 +1);
385 y = (
int) (numeric::random::uniform() *89 +1);
386 z = (
int) (numeric::random::uniform() *89 +1);
387 rot_mat_ = numeric::x_rotation_matrix_degrees(x);
417 using namespace basic::options;
418 tag_=option[ OptionKeys::out::output_tag ]();
424 using namespace basic::options;
425 tag_=option[ OptionKeys::out::output_tag ]();
430 initialize(xc, yc, zc, x, y, z, stepSize, psp, sps);
431 using namespace basic::options;
432 tag_=option[ OptionKeys::out::output_tag ]();
449 initialize(xc, yc, zc, x, stepSize, psp, sps);
450 using namespace basic::options;
451 tag_=option[ OptionKeys::out::output_tag ]();
472 using namespace basic::options;
473 tag_=option[ OptionKeys::out::output_tag ]();
514 initialize(center, x, y, z, stepSize, psp, sps);
515 using namespace basic::options;
516 tag_=option[ OptionKeys::out::output_tag ]();
538 center(1)+=central_rsd.
atom(i).
xyz()(1);
539 center(2)+=central_rsd.
atom(i).
xyz()(2);
540 center(3)+=central_rsd.
atom(i).
xyz()(3);
549 recenter(center(1), center(2), center(3));
559 int sz = central_rsds.size();
561 for (
int rnum = 0; rnum < sz; ++rnum){
564 assert( central_rsd->is_protein() );
565 for(
Size i = 1, i_end = central_rsd->nheavyatoms(); i <= i_end; ++i) {
566 if (central_rsd->atom(i).type()<18||central_rsd->atom(i).type()>21){
567 center(1)+=central_rsd->atom(i).xyz()(1);
568 center(2)+=central_rsd->atom(i).xyz()(2);
569 center(3)+=central_rsd->atom(i).xyz()(3);
579 recenter(center(1), center(2), center(3));
583 recenter(center(1), center(2), center(3));
587 std::vector< core::conformation::ResidueOP > residues;
591 std::string::size_type lastPos = resids.find_first_not_of(delimiters, 0);
594 std::string::size_type pos = resids.find_first_of(delimiters, lastPos);
596 while ( std::string::npos != pos || std::string::npos != lastPos ) {
597 std::string const & resid = resids.substr( lastPos, pos - lastPos );
598 lastPos = resids.find_first_not_of(delimiters, pos);
599 pos = resids.find_first_of(delimiters, lastPos);
601 int central_relax_pdb_number;
603 std::size_t fpos( resid.find(
':') );
604 if ( fpos != std::string::npos ) {
605 central_relax_pdb_number = ObjexxFCL::int_of( resid.substr(0,fpos) );
606 if (fpos != resid.size()-1 ) {
607 chain = resid[ fpos+1 ];
610 central_relax_pdb_number = ObjexxFCL::int_of( resid );
613 for (
int j = 1, resnum = input_pose.
total_residue(); j <= resnum; ++j ) {
614 if ( input_pose.
pdb_info()->number(j) == central_relax_pdb_number ) {
616 if ( input_pose.
pdb_info()->chain(j) == chain ) {
651 newSearch(thr, thr2, max1, max2,
false,
true);
673 touching=touching ||
fill(x2,y2,z2);
680 if ((x==0) || (y==0)||(z==0))
return true;
693 if (x!=0)
if (
grid_[x-1][y][z]==
EMPTY)
return true;
694 if (y!=0)
if (
grid_[x][y-1][z]==
EMPTY)
return true;
695 if (z!=0)
if (
grid_[x][y][z-1]==
EMPTY)
return true;
789 for(
core::Size x2=x1; x2<std::min(xdim_, x+2); ++x2){
790 for(
core::Size y2=y1; y2<std::min(ydim_, y+2); ++y2){
791 for(
core::Size z2=z1; z2<std::min(zdim_, z+2); ++z2){
801 std::vector<int> deltas;
803 deltas.push_back(0);deltas.push_back(0);deltas.push_back(1);
804 deltas.push_back(0);deltas.push_back(1);deltas.push_back(0);
805 deltas.push_back(1);deltas.push_back(0);deltas.push_back(0);
806 deltas.push_back(1);deltas.push_back(1);deltas.push_back(1);
807 deltas.push_back(-1);deltas.push_back(1);deltas.push_back(1);
808 deltas.push_back(-1);deltas.push_back(-1);deltas.push_back(1);
809 deltas.push_back(1);deltas.push_back(-1);deltas.push_back(1);
823 for (
int i=0;i<dirs*3;i+=3){
832 bool t_surf=tar_surf;
839 for (x=(
int)cx+deltas[i],y=(
int)cy+deltas[i+1],z=(
int)cz+deltas[i+2], count=0; count<(
int)max; x+=deltas[i],y+=deltas[i+1],z+=deltas[i+2], count++){
840 if (x<0 || x>=(
int)
xdim_)
break;
841 if (y<0 || y>=(
int)
ydim_)
break;
842 if (z<0 || z>=(
int)
zdim_)
break;
867 if ((count>(
int)thr && !psp)||psp||sps){
868 for (
int c=count;
c>0;
c--){
869 if (
grid_[x-
c*deltas[i]][y-
c*deltas[i+1]][z-
c*deltas[i+2]]==
HSURFACE ||
grid_[x-
c*deltas[i]][y-
c*deltas[i+1]][z-
c*deltas[i+2]] ==
PSURFACE ||
grid_[x-
c*deltas[i]][y-
c*deltas[i+1]][z-
c*deltas[i+2]]==
T_SURFACE) std::cout<<
"MAJOR ERROR, overwriting surface with pocket\n";
871 grid_[x-
c*deltas[i]][y-
c*deltas[i+1]][z-
c*deltas[i+2]]=
EMPTY;
877 if (
grid_[x-
c*deltas[i]][y-
c*deltas[i+1]][z-
c*deltas[i+2]]==
EMPTY)
grid_[x-
c*deltas[i]][y-
c*deltas[i+1]][z-
c*deltas[i+2]]=
PSP;
897 mark(center(1),center(2),center(3), vdWd, buffer, polar, targetResi);
913 minX=
int(std::max(ceil(((
core::Real)(xcen)-radius)-.5), 0.));
915 minY=
int(std::max(ceil(((
core::Real)(ycen)-radius)-.5), 0.));
917 minZ=
int(std::max(ceil(((
core::Real)(zcen)-radius)-.5), 0.));
920 for (
int xIter=minX; xIter<=maxX; ++xIter){
921 for (
int yIter=minY; yIter<=maxY; ++yIter){
922 int centerZ=std::max(minZ, zcen);
923 for (
int zIter=centerZ;zIter <= maxZ; ++zIter){
924 if (pow((xIter-xcen),2)+pow((yIter-ycen),2)+pow((zIter-zcen),2)>pow(radius, 2))
continue;
925 if (pow((xIter-xcen),2)+pow((yIter-ycen),2)+pow((zIter-zcen),2)>pow(vdW, 2)){
932 }
else if (targetResi)
grid_[xIter][yIter][zIter]=
TARGET;
942 centerZ=std::min(maxZ, zcen-1);
943 for (
int zIter=centerZ;zIter >= minZ; --zIter){
944 if (pow(xIter-xcen,2)+pow(yIter-ycen,2)+pow(zIter-zcen,2)>pow(radius, 2))
continue;
945 if (pow(xIter-xcen,2)+pow(yIter-ycen,2)+pow(zIter-zcen,2)>pow(vdW, 2)){
952 }
else if (targetResi)
grid_[xIter][yIter][zIter]=
TARGET;
978 std::cout<<std::endl;
980 std::cout<<std::endl;
994 utility::io::ozstream outPDB_stream;
995 outPDB_stream.open(output_filename, std::ios::out);
1000 for (x=0;x<(
xdim_); x++){
1001 for (y=0;y<(
ydim_); y++){
1002 for (z=0;z<(
zdim_); z++){
1004 concatenated_pdb_info +=
"ATOM ";
1005 std::stringstream tmp;
1007 if (counter2<10) concatenated_pdb_info +=
" ";
1008 else if (counter2<100) concatenated_pdb_info +=
" ";
1009 else if (counter2<1000) concatenated_pdb_info +=
" ";
1010 else if (counter2<10000) concatenated_pdb_info +=
" ";
1011 concatenated_pdb_info += tmp.str()+
" ";
1046 concatenated_pdb_info +=
"TS TS ";
1060 concatenated_pdb_info += tmp.str();
1062 outPDB_stream<<concatenated_pdb_info;
1069 else smallPocket=
false;
1070 for (std::list<PCluster::Cxyz>::iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
1072 concatenated_pdb_info +=
"ATOM ";
1073 std::stringstream tmp;
1075 if (counter2<10) concatenated_pdb_info +=
" ";
1076 else if (counter2<100) concatenated_pdb_info +=
" ";
1077 else if (counter2<1000) concatenated_pdb_info +=
" ";
1078 else if (counter2<10000) concatenated_pdb_info +=
" ";
1079 else concatenated_pdb_info +=
"";
1080 concatenated_pdb_info += tmp.str()+
" ";
1082 if (
grid_[pit->x][pit->y][pit->z]==
TP_POCKET) concatenated_pdb_info +=
"STP STP ";
1083 if (
grid_[pit->x][pit->y][pit->z]==
TP_SURF) concatenated_pdb_info +=
"STS STS ";
1084 if (
grid_[pit->x][pit->y][pit->z]==
TP_BURIED) concatenated_pdb_info +=
"STB STB ";
1085 if (
grid_[pit->x][pit->y][pit->z]==
TP_EDGE) concatenated_pdb_info +=
"STE STE ";
1087 if (
grid_[pit->x][pit->y][pit->z]==
TP_POCKET) concatenated_pdb_info +=
"TP TP ";
1088 if (
grid_[pit->x][pit->y][pit->z]==
TP_SURF) concatenated_pdb_info +=
"TPS TPS ";
1089 if (
grid_[pit->x][pit->y][pit->z]==
TP_BURIED) concatenated_pdb_info +=
"TPB TPB ";
1090 if (
grid_[pit->x][pit->y][pit->z]==
TP_EDGE) concatenated_pdb_info +=
"TPE TPE ";
1092 if (
grid_[pit->x][pit->y][pit->z]==
POCKET) concatenated_pdb_info +=
"PC PC ";
1093 if (
grid_[pit->x][pit->y][pit->z]==
PO_SURF) concatenated_pdb_info +=
"PCS PCS ";
1094 if (
grid_[pit->x][pit->y][pit->z]==
PO_BURIED) concatenated_pdb_info +=
"PCB PCB ";
1095 if (
grid_[pit->x][pit->y][pit->z]==
PO_EDGE) concatenated_pdb_info +=
"PCE PCE ";
1099 if (clustNo<10) concatenated_pdb_info +=
" ";
1100 else if (clustNo<100) concatenated_pdb_info +=
" ";
1101 else if (clustNo<1000) concatenated_pdb_info +=
" ";
1102 concatenated_pdb_info += tmp.str()+
" ";
1105 concatenated_pdb_info += tmp.str();
1107 outPDB_stream<<concatenated_pdb_info;
1112 outPDB_stream.close();
1113 outPDB_stream.clear();
1120 std::vector<int> deltas;
1122 deltas.push_back(0);deltas.push_back(-1);deltas.push_back(-1);
1123 deltas.push_back(0);deltas.push_back(-1);deltas.push_back(0);
1124 deltas.push_back(0);deltas.push_back(-1);deltas.push_back(1);
1125 deltas.push_back(0);deltas.push_back(0);deltas.push_back(-1);
1127 deltas.push_back(-1);deltas.push_back(-1);deltas.push_back(-1);
1128 deltas.push_back(-1);deltas.push_back(-1);deltas.push_back(0);
1129 deltas.push_back(-1);deltas.push_back(-1);deltas.push_back(1);
1130 deltas.push_back(-1);deltas.push_back(0);deltas.push_back(-1);
1131 deltas.push_back(-1);deltas.push_back(0);deltas.push_back(0);
1132 deltas.push_back(-1);deltas.push_back(0);deltas.push_back(1);
1133 deltas.push_back(-1);deltas.push_back(1);deltas.push_back(-1);
1134 deltas.push_back(-1);deltas.push_back(1);deltas.push_back(0);
1135 deltas.push_back(-1);deltas.push_back(1);deltas.push_back(1);
1138 std::vector < std::vector < std::vector <std::list<PCluster>::iterator> > > cluster_grid;
1139 cluster_grid.resize(
xdim_);
1141 cluster_grid[tx].resize(
ydim_);
1149 for (x=0;x<(
xdim_); x++){
1150 for (y=0;y<(
ydim_); y++){
1151 for (z=0;z<(
zdim_); z++){
1155 for (
int i=0;i<dirs*3;i+=3){
1156 int cx = (
int)x+deltas[i];
1157 int cy = (
int)y+deltas[i+1];
1158 int cz = (
int)z+deltas[i+2];
1159 if (cx<0 || cy<0 || cz<0 || cx>=(
int)xdim_ || cy>=(
int)
ydim_ || cz>=(
int)
zdim_)
continue;
1166 cluster_grid[x][y][z]=cluster_grid[cx][cy][cz];
1167 cluster_grid[x][y][z]->add(x,y,z);
1170 if (cluster_grid[cx][cy][cz]!=cluster_grid[x][y][z]){
1171 std::list<PCluster>::iterator old = cluster_grid[cx][cy][cz];
1172 for (std::list<PCluster::Cxyz>::iterator pit=old->points_.begin(); pit != old->points_.end(); ++pit){
1173 cluster_grid[pit->x][pit->y][pit->z]=cluster_grid[x][y][z];
1194 for (x=0;x<(
xdim_); x++){
1195 for (y=0;y<(
ydim_); y++){
1196 for (z=0;z<(
zdim_); z++){
1203 for (std::list<PCluster::Cxyz>::iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
1205 bool surf=
markOneEdgeDepth(pit->x,pit->y,pit->z, surf_d, bur_d, cit->isTarget());
1207 std::list<PCluster::Cxyz>::iterator tmp = pit;
1209 cit->points_.erase(tmp);
1229 if (x+ssteps>=
xdim_) {
1255 if (y+ssteps>=
ydim_) {
1281 if (z+ssteps>=
zdim_) {
1353 if (x+ssteps>=
xdim_)
1355 else xen=x+ssteps+1;
1359 if (y+ssteps>=
ydim_)
1361 else yen=y+ssteps+1;
1365 if (z+ssteps>=
zdim_)
1367 else zen=z+ssteps+1;
1397 if (x+ssteps>=
xdim_)
1399 else xen=x+ssteps+1;
1403 if (y+ssteps>=
ydim_)
1405 else yen=y+ssteps+1;
1409 if (z+ssteps>=
zdim_)
1411 else zen=z+ssteps+1;
1448 for (x=0;x<(
xdim_); x++){
1449 for (y=0;y<(
ydim_); y++){
1450 for (z=0;z<(
zdim_); z++){
1461 for (x=0;x<(
xdim_); x++){
1462 for (y=0;y<(
ydim_); y++){
1463 for (z=0;z<(
zdim_); z++){
1477 for (x=0;x<(
xdim_); x++){
1478 for (y=0;y<(
ydim_); y++){
1479 for (z=0;z<(
zdim_); z++){
1493 for (x=0;x<(
xdim_); x++){
1494 for (y=0;y<(
ydim_); y++){
1495 for (z=0;z<(
zdim_); z++){
1509 for (x=0;x<(
xdim_); x++){
1510 for (y=0;y<(
ydim_); y++){
1511 for (z=0;z<(
zdim_); z++){
1525 for (x=0;x<(
xdim_); x++){
1526 for (y=0;y<(
ydim_); y++){
1527 for (z=0;z<(
zdim_); z++){
1550 for (std::list<PCluster::Cxyz>::iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
1551 for (
int x = -1; x <2; x++){
1552 for (
int y = -1; y <2; y++){
1553 for (
int z = -1; z <2; z++){
1554 if (x==-1)
if (pit->x == 0)
continue;
1555 if (y==-1)
if (pit->y == 0)
continue;
1556 if (z==-1)
if (pit->z == 0)
continue;
1557 if (x==1)
if (pit->x ==
xdim_-1)
continue;
1558 if (y==1)
if (pit->y ==
ydim_-1)
continue;
1559 if (z==1)
if (pit->z ==
zdim_-1)
continue;
1563 pit=cit->points_.end();
1572 if (!cit->isTarget() ) {
1573 for (std::list<PCluster::Cxyz>::iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
1582 for (std::list<PCluster::Cxyz>::iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
1697 bool too_small=
true;
1701 for (
Size j = 1, resnum = total_residues; j <= resnum; ++j ) {
1704 if ( j == central_rsd.
seqpos() ) target=
true;
1706 using namespace basic::options;
1707 if (option[ OptionKeys::fingerprint::include_hydrogens ]()){
1708 total_atoms = rsd.natoms();
1710 total_atoms = rsd.nheavyatoms();
1712 for(
Size i = 1, i_end = total_atoms; i <= i_end; ++i) {
1713 bool target_res=target;
1720 mark(rpoint, rsd.atom_type(i).lj_radius(),
probe_rad_, rsd.is_polar(), target_res);
1761 bool too_small=
true;
1763 recenter( grid_center.x(), grid_center.y(), grid_center.z() );
1764 for (
Size j = 1, resnum = total_residues; j <= resnum; ++j ) {
1767 if ( j == central_rsd.
seqpos() ) target=
true;
1769 using namespace basic::options;
1770 if (option[ OptionKeys::fingerprint::include_hydrogens ]()){
1771 total_atoms = rsd.natoms();
1773 total_atoms = rsd.nheavyatoms();
1775 for(
Size i = 1, i_end = total_atoms; i <= i_end; ++i) {
1776 bool target_res=target;
1783 mark(rpoint, rsd.atom_type(i).lj_radius(),
probe_rad_, rsd.is_polar(), target_res);
1822 for (
Size j = 1, resnum = total_residues; j <= resnum; ++j ) {
1825 if ( j == central_rsd.
seqpos() ) target=
true;
1827 using namespace basic::options;
1828 if (option[ OptionKeys::fingerprint::include_hydrogens ]()){
1829 total_atoms = rsd.natoms();
1831 total_atoms = rsd.nheavyatoms();
1833 for(
Size i = 1, i_end = total_atoms; i <= i_end; ++i) {
1834 bool target_res=target;
1841 mark(rpoint, rsd.atom_type(i).lj_radius(),
probe_rad_, rsd.is_polar(), target_res);
1884 for (std::list<PCluster::Cxyz>::const_iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
1889 ++num_pocket_points;
1893 CoM_x/=num_pocket_points;
1894 CoM_y/=num_pocket_points;
1895 CoM_z/=num_pocket_points;
1897 Eigen::MatrixXf pocket_coors_matrix(num_pocket_points,3);
1902 for (std::list<PCluster::Cxyz>::const_iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
1914 Eigen::JacobiSVD<Eigen::MatrixXf> svd(pocket_coors_matrix, Eigen::ComputeFullU | Eigen::ComputeFullV );
1916 Eigen::MatrixXf svd_result(3,3);
1917 svd_result = svd.matrixV();
1923 identity_mat.to_identity();
1929 trans_vec.x() = -CoM_x;
1930 trans_vec.y() = -CoM_y;
1931 trans_vec.z() = -CoM_z;
1935 rot_mat.xx()=svd_result(0,0);
1936 rot_mat.xy()=svd_result(0,1);
1937 rot_mat.xz()=svd_result(0,2);
1938 rot_mat.yx()=svd_result(1,0);
1939 rot_mat.yy()=svd_result(1,1);
1940 rot_mat.yz()=svd_result(1,2);
1941 rot_mat.zx()=svd_result(2,0);
1942 rot_mat.zy()=svd_result(2,1);
1943 rot_mat.zz()=svd_result(2,2);
2027 bool write_comparison_pdb =
false;
2029 if ( comparison_pdbname.compare(
"") ) {
2030 write_comparison_pdb =
true;
2033 utility::io::ozstream comparisonPDB_stream;
2034 if ( write_comparison_pdb ) comparisonPDB_stream.open(comparison_pdbname, std::ios::out);
2037 core::Real const partial_match_weight = 0.25;
2046 for (std::list<PCluster::Cxyz>::const_iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
2047 if ( (template_pocket.
grid_[pit->x][pit->y][pit->z]==template_pocket.
TP_POCKET) || (template_pocket.
grid_[pit->x][pit->y][pit->z]==template_pocket.
TP_SURF) || (template_pocket.
grid_[pit->x][pit->y][pit->z]==template_pocket.
TP_EDGE) || (template_pocket.
grid_[pit->x][pit->y][pit->z]==template_pocket.
TP_BURIED) ) {
2049 ++template_num_points;
2061 if ( ( self_x_index <
xdim_ ) && ( self_y_index <
ydim_ ) && ( self_z_index <
zdim_ ) ) {
2067 if ( (
grid_[self_x_index][self_y_index][self_z_index] ==
TP_POCKET ) || (
grid_[self_x_index][self_y_index][self_z_index] ==
TP_SURF ) || (
grid_[self_x_index][self_y_index][self_z_index] ==
TP_EDGE ) || (
grid_[self_x_index][self_y_index][self_z_index] ==
TP_BURIED ) ) {
2069 core::Real curr_weight = partial_match_weight;
2070 if ( (
grid_[self_x_index][self_y_index][self_z_index] ==
TP_POCKET ) && (template_pocket.
grid_[pit->x][pit->y][pit->z]==template_pocket.
TP_POCKET) ) {
2071 curr_weight = full_match_weight;
2072 }
else if ( (
grid_[self_x_index][self_y_index][self_z_index] ==
TP_SURF ) && (template_pocket.
grid_[pit->x][pit->y][pit->z]==template_pocket.
TP_SURF) ) {
2073 curr_weight = full_match_weight;
2074 }
else if ( (
grid_[self_x_index][self_y_index][self_z_index] ==
TP_EDGE ) && (template_pocket.
grid_[pit->x][pit->y][pit->z]==template_pocket.
TP_EDGE) ) {
2075 curr_weight = full_match_weight;
2076 }
else if ( (
grid_[self_x_index][self_y_index][self_z_index] ==
TP_BURIED ) && (template_pocket.
grid_[pit->x][pit->y][pit->z]==template_pocket.
TP_BURIED) ) {
2077 curr_weight = full_match_weight;
2079 match_score += curr_weight;
2082 if ( write_comparison_pdb ) comparisonPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" C MPO A "<<std::setw(8)<<output_res_num<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_x<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_y<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_z<<std::endl;
2084 match_score += mismatch_weight;
2086 if ( write_comparison_pdb ) comparisonPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" C NPO A "<<std::setw(8)<<output_res_num<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_x<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_y<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_z<<std::endl;
2090 match_score += mismatch_weight;
2092 if ( write_comparison_pdb ) comparisonPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" C NPO A "<<std::setw(8)<<output_res_num<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_x<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_y<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_z<<std::endl;
2100 if ( write_comparison_pdb ) {
2101 comparisonPDB_stream.close();
2102 comparisonPDB_stream.clear();
2109 for (std::list<PCluster::Cxyz>::const_iterator pit=cit->points_.begin(); pit != cit->points_.end(); ++pit){
2117 match_score = 2. * match_score / ( template_num_points + self_num_points );
2118 TR <<
"PocketGrid match score = " << match_score << std::endl;
2120 return 1. - sqrt( match_score );
2128 using namespace basic::options;
2129 core::Real const extra_dist = option[ OptionKeys::pocket_grid::extra_eggshell_dist ];
2130 core::Size searchxmin, searchxmax, searchymin, searchymax, searchzmin, searchzmax, xx,yy,zz;
2141 if (x != ext_grd.
xdim_-1) {
2151 if (y != ext_grd.
ydim_-1) {
2161 if (z != ext_grd.
zdim_-1) {
2167 for (xx = searchxmin; xx<=searchxmax; ++xx){
2168 for (yy = searchymin; yy<=searchymax; ++yy){
2169 for (zz = searchzmin; zz<=searchzmax; ++zz){
2170 if (xx==x && yy==y && zz==z)
continue;
2176 bool nearby =
false;
2178 if (extra_coord == *eg) {
2182 if ( extra_coord.distance(*eg) < extra_dist ) {
2202 using namespace basic::options;
2203 if (option[ OptionKeys::pocket_grid::print_grid ]()){
2219 core::Size searchxmin, searchxmax, searchymin, searchymax, searchzmin, searchzmax, xx,yy,zz;
2229 if (x != gr.
xdim_-1) {
2239 if (y != gr.
ydim_-1) {
2249 if (z != gr.
zdim_-1) {
2255 for (xx = searchxmin; (xx<=searchxmax) && ! found; xx++){
2256 for (yy = searchymin; (yy<=searchymax) && ! found; yy++){
2257 for (zz = searchzmin; (zz<=searchzmax) && ! found; zz++){
2258 if (xx==x && yy==y && zz==z)
continue;
2279 using namespace basic::options;
2280 if (option[ OptionKeys::pocket_grid::print_grid ]()){
2292 utility::io::izstream instream;
2293 instream.open(fname, std::ios::in);
2306 while ( ! instream.eof() ) {
2307 instream >> x >> y >> z;
2327 utility::io::ozstream outstream;
2328 outstream.open(fname, std::ios::out);
2338 outstream << x <<
" " << y <<
" " << z << std::endl;
2352 utility::io::ozstream outPDB_stream;
2353 outPDB_stream.open(output_pdbname, std::ios::out);
2355 outPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" C EGG A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->x()<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->y()<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->z()<<std::endl;
2358 outPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" O EXT B 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->x()<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->y()<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->z()<<std::endl;
2360 outPDB_stream.close();
2361 outPDB_stream.clear();
2367 utility::io::ozstream outPDB_stream;
2368 outPDB_stream.open(output_pdbname, std::ios::out);
2373 outPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x*gr.
stepSize_+gr.
xcorn_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y*gr.
stepSize_+gr.
ycorn_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z*gr.
stepSize_+gr.
zcorn_<<std::endl;
2377 outPDB_stream.close();
2378 outPDB_stream.clear();
2387 for (std::list<
numeric::xyzVector<core::Real> >::const_iterator pd = pocketshell_coord_list.begin(); pd != pocketshell_coord_list.end(); ++pd) {
2388 pocketshell_CoM.x() += pd->x();
2389 pocketshell_CoM.y() += pd->y();
2390 pocketshell_CoM.z() += pd->z();
2392 pocketshell_CoM /= pocketshell_coord_list.size();
2393 return pocketshell_CoM;
2401 bool write_comparison_pdb =
false;
2403 if ( comparison_pdbname.compare(
"") ) {
2404 write_comparison_pdb =
true;
2407 utility::io::ozstream comparisonPDB_stream;
2408 if ( write_comparison_pdb ) comparisonPDB_stream.open(comparison_pdbname, std::ios::out);
2427 if ( ( self_x_index <
xdim_ ) && ( self_y_index <
ydim_ ) && ( self_z_index <
zdim_ ) ) {
2431 if (
grid_[self_x_index][self_y_index][self_z_index] ==
EGGSHELL ) {
2432 match_score += match_weight;
2434 if ( write_comparison_pdb ) comparisonPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" C MEG A "<<std::setw(8)<<output_res_num<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_x<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_y<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_z<<std::endl;
2437 match_score += mismatch_weight;
2439 if ( write_comparison_pdb ) comparisonPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" C NEG A "<<std::setw(8)<<output_res_num<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_x<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_y<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_z<<std::endl;
2443 match_score += mismatch_weight;
2445 if ( write_comparison_pdb ) comparisonPDB_stream<<
"HETATM "<<std::setw(2)<<1<<
" C NEG A "<<std::setw(8)<<output_res_num<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_x<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_y<<std::setw(8)<<std::fixed<<std::setprecision(3)<<template_z<<std::endl;
2450 if ( write_comparison_pdb ) {
2451 comparisonPDB_stream.close();
2452 comparisonPDB_stream.clear();
2456 TR <<
"Eggshell match score = " << match_score << std::endl;
2458 return 1. - match_score;