Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SurfaceOrientMover.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;
2 // rm-trailing-spaces:t -*-
3 // vi: set ts=2 noet:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available
7 // under license.
8 // (c) The Rosetta software is developed by the contributing members of the
9 // Rosetta Commons.
10 // (c) For more information, see http://www.rosettacommons.org. Questions about
11 // this can be
12 // (c) addressed to University of Washington UW TechTransfer,
13 // email: license@u.washington.edu.
14 
15 /// @file SurfaceOrientMover.cc
16 /// @author Robin A Thottungal (raugust1@jhu.edu)
17 
18 
19 // Unit Headers
21 
22 // Package Headers
24 
25 // Project headers
26 #include <core/pose/Pose.hh>
27 #include <protocols/moves/Mover.hh>
32 // for adding data to pose
33 #include <basic/datacache/BasicDataCache.hh>
35 
36 #include <core/pose/PDBInfo.hh>
37 
38 //Utility Headers
39 #include <utility/exit.hh>
40 #include <basic/prof.hh>
41 #include <basic/Tracer.hh>
42 
43 #include <algorithm>
44 
45 using basic::T;
46 using basic::Error;
47 using basic::Warning;
48 
49 static basic::Tracer TR("protocols.SurfaceDocking.SurfaceOrientMover");
50 
51 ////using core::pose::datacache::CacheableDataType::SURFACE_PARAMS;
52 
53 namespace protocols {
54 namespace surface_docking {
55 
56 using namespace core;
57 using namespace protocols::moves;
58 using namespace protocols::surface_docking;
59 
60 //constructor
62  Mover::type( "SurfaceOrientMover");
63  }
64 
65 //destructor
67 
69 
70  //Commenting the complete apply for compilation
71  // Making sure Surface Vectors are read in properly
72  assert( pose.data().get_ptr( core::pose::datacache::CacheableDataType::SURFACE_PARAMS )()!=NULL);
73  // Calculate the Centroid of the protein and surface ProteinCG, SurfaceCG
74  Vector ProteinCG, SurfaceCG;
75  Size const rb_jump=pose.num_jump();
76  // Last jump is the one that connect the surface with protein
77  TR<<"Number of Jumps:"<<pose.num_jump()<<std::endl;
78  protocols::geometry::centroids_by_jump (pose, rb_jump,SurfaceCG,ProteinCG);
79  TR<<"Initial Protein Centroid:"<<ProteinCG<<std::endl;
80  TR<<"Surface Centroid:"<<SurfaceCG<<std::endl;
81  surface_docking::SurfaceParameters & surfaceVectors=
82  *( static_cast< surface_docking::SurfaceParameters * >
84  /***
85  // Extracting surfaceVector info
86  TR<<"Extracting surfaceVector info from remarks in SurfaceOrientMover:"<<std::endl;
87  std::string SurfVectors[3];
88  for(Size i=0; i<pose.pdb_info()->remarks().size(); i++) {
89  TR << pose.pdb_info()->remarks().at(i).num << " " << pose.pdb_info()->remarks().at(i).value << std::endl;
90  SurfVectors[i]=pose.pdb_info()->remarks().at(i).value;
91  }
92  surface_docking::SurfaceParametersOP surfaceVectors=
93  new surface_docking::SurfaceParameters(SurfVectors[0],SurfVectors[1],SurfVectors[2]);
94  ***/
95  //Logic Used: If the AB vector is zero, the the surfaceparameters has
96  //not been created yet. This will make sure that the surfaceparamters are
97  //only calculated once.
98 
99 
100  //if (surfaceVectors.vecAB.x()==0.0){
101  // TR<<"Calculating SurfaceParameters:......"<<std::endl;
102  // surfaceVectors.GenerateSurfaceParameters(SurfaceCG);
103  // }
104 
105  // added to see if protein NAN issue is due to this or not! on Jan 28
106  surfaceVectors.GenerateSurfaceParameters(SurfaceCG);
107 
108  // Calculating the point of intersection of proteinCG and the plane
109  // described by the surface basis vectors
110  Vector surfacePointIntersection=
111  surfaceVectors.PlanePointIntersection(ProteinCG);
112 
113  TR<<"SurfacePointIntersection:"<<surfacePointIntersection<<std::endl;
114 
115  // Calculating the distance between the proteinCG and the surfacePoint
116  // intersection (how far is the proteinCG from the surface)
117  Real ProteinZdistance=surfacePointIntersection.distance(ProteinCG);
118 
119  Vector AC_Intersect=
120  surfaceVectors.CalcAxisIntersect(surfacePointIntersection,SurfaceCG,
121  surfaceVectors.vecAC,surfaceVectors.vecAB);
122 
123  Vector AB_Intersect=
124  surfaceVectors.CalcAxisIntersect(surfacePointIntersection,SurfaceCG,
125  surfaceVectors.vecAB,surfaceVectors.vecAC);
126  TR<<"AC_Intersect:"<<AC_Intersect<<std::endl;
127  TR<<"AB_Intersect:"<<AB_Intersect<<std::endl;
128 
129  // Calculating the distance between the SurfaceCG and the point that is
130  // parallel to the AB & AC vector
131 
132  Real ProjectionDistanceAC= AC_Intersect.distance(surfacePointIntersection);
133 
134  Real ProjectionDistanceAB= AB_Intersect.distance(surfacePointIntersection);
135  // Identifying the translation vector!!!
136 
137  Real ABdistance=surfaceVectors.A.distance(surfaceVectors.B);
138  Real ACdistance=surfaceVectors.A.distance(surfaceVectors.C);
139  TR<<"AC Distance:"<<ACdistance<<std::endl;
140  TR<<"AB Distance:"<<ABdistance<<std::endl;
141  Vector Trans_AB_Vec,Trans_AC_Vec;
142 
143  if (ProjectionDistanceAB <= ABdistance/2.0
144  && ProjectionDistanceAC <= ACdistance/2.0) {
145  ProteinCG = ProteinCG;
146  Trans_AB_Vec=0;
147  Trans_AB_Vec=0;
148  }
149 
150  Trans_AB_Vec=CalcTransVec(ProjectionDistanceAB,
151  ABdistance,surfaceVectors.vecAB);
152  Trans_AC_Vec=CalcTransVec(ProjectionDistanceAC,
153  ACdistance,surfaceVectors.vecAC);
154 
155  TR<<"Trans AC Vec:"<<Trans_AC_Vec<<std::endl;
156  TR<<"Trans AB Vec:"<<Trans_AB_Vec<<std::endl;
157  TR<<"ProteinZdistance:"<<ProteinZdistance<<std::endl;
158 
159  // Add the vector to the point A to get the new co-ordinates
160  Vector NewProteinCG;
161  NewProteinCG.x()=Trans_AB_Vec.x()+SurfaceCG.x();
162  NewProteinCG.y()=Trans_AC_Vec.y()+SurfaceCG.y();
163  NewProteinCG.z()=ProteinZdistance+SurfaceCG.z();
164  // Identify the Z coordinate on the surface and moving ProteinZdistance
165  // along the normal vector axis
166  Real a=surfaceVectors.surfacePlane[1];
167  Real b=surfaceVectors.surfacePlane[2];
168  Real c=surfaceVectors.surfacePlane[3];
169  Real d=surfaceVectors.surfacePlane[4];
170  Real ZCord4ProteinOnSurface=-((a*NewProteinCG.x())+(b*NewProteinCG.y())+d)/c;
171  NewProteinCG.z()=ZCord4ProteinOnSurface;
172  Vector UnitNormal=surfaceVectors.unitsurfaceNormalVec;
173  TR<<"Projection of Protein CG on Plane (test)"<<NewProteinCG<<std::endl;
174  NewProteinCG=NewProteinCG+(ProteinZdistance*UnitNormal);
175 
176  TR<<"Translated ProteinCG:"<<NewProteinCG<<std::endl;
177  // For Testing Purpose
178  Vector surfaceNewProteinCGIntersection=
179  surfaceVectors.PlanePointIntersection(NewProteinCG);
180  TR<<"Intersection point of Translated ProteinCG on the plane:"
181  <<surfaceNewProteinCGIntersection<<std::endl;
182  // Calculating the distance between the ProteinCentroid and
183  // New_ProteinCentroid
184  Real trans_magnitude=ProteinCG.distance(NewProteinCG);
185  // Moves trans_magnitude distance along the trans_axis
186  rigid::RigidBodyTransMoverOP TransMover( new rigid::RigidBodyTransMover(pose,rb_jump));
187  TransMover->trans_axis(NewProteinCG-ProteinCG);
188  //TransMover->trans_axis(ProteinCG-NewProteinCG);
189  TransMover->step_size( trans_magnitude );
190  TransMover->apply(pose);
191 
192  // Setting the transAxis
193  TR<<"Translated ProteinCGIntersection:"<<
194  surfaceNewProteinCGIntersection-NewProteinCG<<std::endl;
195  surfaceVectors.slideaxis=surfaceNewProteinCGIntersection-NewProteinCG;
196  TR<<"SlideAxis:"<<surfaceVectors.slideaxis<<std::endl;
197 
198  // Invoking a slide into contact to remove any van der waals clash
199  // move the protein away from the surface and apply the slideintosurface
200  TransMover->trans_axis(UnitNormal);
201  TransMover->step_size( 10.0 );
202 
203  FaSlideIntoSurface surfaceContact(pose.num_jump());
204  surfaceContact.apply(pose);
205 
206 }
207 
209  VectorDistance, Vector Vec){
210  Real bb,ibb,floor_ceil_ibb;
211  Vector TransVec;
212  TransVec=0;
213  if ( ProjectionDistance > VectorDistance/2.0 ){
214  bb = ProjectionDistance / VectorDistance ;
215  ibb = floor(bb);
216  floor_ceil_ibb = bb - ibb;
217  //if (ibb >= 1.0){
218  if (floor_ceil_ibb <= 0.5){
219  TransVec=floor_ceil_ibb*Vec; // Scaling the vector
220  }
221  else{
222  TransVec=floor_ceil_ibb*Vec; // Scaling the vector
223  }
224  }
225  //}
226  return TransVec;
227 }
228 
230  return "SurfaceOrientMover";
231  }
232 
233 
234 
235 } //surfaceDockingProtocol
236 
237 } //protocol