Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OrbitalsAssigned.cc
Go to the documentation of this file.
1 /*
2  * OrbitalsAssigned.cc
3  *
4  * Created on: Jun 2, 2010
5  * Author: combss
6  */
7 
13 #include <utility/vector1.hh>
14 #include <numeric/xyzVector.hh>
16 #include <core/pose/Pose.hh>
17 #include <numeric/constants.hh>
19 
20 //option headers
21 #include <basic/options/option.hh>
22 #include <basic/options/keys/run.OptionKeys.gen.hh>
23 #include <basic/options/keys/packing.OptionKeys.gen.hh>
24 #include <basic/options/keys/score.OptionKeys.gen.hh>
25 
26 
27 namespace core{
28 namespace scoring{
29 namespace orbitals{
30 
31 
32 
33 
35  core::conformation::Residue const & residue
36 )
37 {
38  core::Real dist = 0.7;
43 
44 
45  if(residue.is_aromatic() ){
46  vector_d = residue.atom("CG").xyz() - residue.atom("CD1").xyz();
47  vector_f = residue.atom("CG").xyz() - residue.atom("CD2").xyz();
48  lp_holder_xyz = cp_function("aroC", vector_d, vector_f, residue, dist);
49  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
50  //utility::vector1< numeric::xyzVector<core::Real> > lp_holder_xyz2 = aromatic_ring_center(vector_d, vector_f, residue, dist);
51  //lp_xyz.insert(lp_xyz.end(), lp_holder_xyz2.begin(), lp_holder_xyz2.end());
52  if(residue.name3() == "TRP"){
53  lp_holder_xyz = cp_function("Ntrp", vector_d, vector_f, residue, dist);
54  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
55 
56 
57  }
58  if(residue.name3() == "TYR"){
59  lp_holder_xyz = (CoordinatesTetrahedral("OH", "CZ", "HH", dist, residue));
60  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
61  }
62  }
63  else if(residue.name3() == "GLU"){
64  vector_d = residue.atom("CD").xyz() - residue.atom("OE1").xyz();
65  vector_f = residue.atom("CD").xyz() - residue.atom("OE2").xyz();
66 
67  lp_holder_xyz = cp_function("COO", vector_d, vector_f, residue, dist);
68  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
69 
70  lp_holder_xyz = cp_function("OOC", vector_d, vector_f, residue, dist);
71  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
72 
73  lp_holder_xyz = CoordinatesDihedral("OE1", "CD", "OE2", dist,residue);
74  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
75 
76  lp_holder_xyz = CoordinatesDihedral("OE2", "CD", "OE1", dist,residue);
77  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
78 
79  }
80  else if(residue.name3() == "ASP"){
81  vector_d = residue.atom("CG").xyz() - residue.atom("OD1").xyz();
82  vector_f = residue.atom("CG").xyz() - residue.atom("OD2").xyz();
83 
84  lp_holder_xyz = cp_function("COO", vector_d, vector_f, residue, dist);
85  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
86 
87  lp_holder_xyz = cp_function("OOC", vector_d, vector_f, residue, dist);
88  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
89 
90  lp_holder_xyz = CoordinatesDihedral("OD1", "CG", "OD2", dist, residue);
91  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
92 
93  lp_holder_xyz = CoordinatesDihedral("OD2", "CG", "OD1", dist, residue);
94  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
95  }
96  else if(residue.name3() == "ASN"){
97  vector_d = residue.atom("CG").xyz() - residue.atom("OD1").xyz();
98  vector_f = residue.atom("CG").xyz() - residue.atom("ND2").xyz();
99  lp_holder_xyz = cp_function("CNH2", vector_d, vector_f, residue, dist);
100  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
101 
102  lp_holder_xyz = cp_function("ONH2", vector_d, vector_f, residue, dist);
103  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
104 
105 
106  lp_holder_xyz = CoordinatesDihedral("OD1", "CG", "ND2", dist, residue);
107  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
108 
109  //vector_d = residue.atom("ND2").xyz() - residue.atom("CG").xyz();
110  //vector_f = residue.atom("ND2").xyz() - residue.atom("OD1").xyz();
111  lp_holder_xyz = cp_function("NH2O", vector_d, vector_f, residue, dist);
112  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
113 
114 
115 
116  }
117  else if(residue.name3() == "GLN"){
118  vector_d = residue.atom("CD").xyz() - residue.atom("OE1").xyz();
119  vector_f = residue.atom("CD").xyz() - residue.atom("NE2").xyz();
120 
121  lp_holder_xyz = cp_function("CNH2", vector_d, vector_f, residue, dist);
122  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
123 
124  lp_holder_xyz = cp_function("ONH2", vector_d, vector_f, residue, dist);
125  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
126 
127  lp_holder_xyz = CoordinatesDihedral("OE1", "CD", "NE2", dist, residue);
128  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
129 
130  //vector_d = residue.atom("NE2").xyz() - residue.atom("CD").xyz();
131  //vector_f = residue.atom("NE2").xyz() - residue.atom("OE1").xyz();
132  lp_holder_xyz = cp_function("NH2O", vector_d, vector_f, residue, dist);
133  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
134 
135  }
136  else if(residue.name3() == "HIS"){
137 
138  vector_d = residue.atom("ND1").xyz() - residue.atom("CE1").xyz();
139  vector_f = residue.atom("ND1").xyz() - residue.atom("CG").xyz();
140 
141 
142  //vector_d = residue.atom("CG").xyz() - residue.atom("CE1").xyz();
143  //vector_f = residue.atom("CG").xyz() - residue.atom("CD2").xyz();
144  lp_holder_xyz = cp_function("aroC", vector_d, vector_f, residue, dist);
145  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
146  //utility::vector1< numeric::xyzVector<core::Real> > lp_holder_xyz2 = aromatic_ring_center(vector_d, vector_f, residue, dist);
147  //lp_xyz.insert(lp_xyz.end(), lp_holder_xyz2.begin(), lp_holder_xyz2.end());
148 
149 
150  numeric::xyzVector<core::Real> vector_df_norm = vector_d.normalized()+vector_f.normalized();
151 
152  lp_holder_xyz = cp_function("Nhis", vector_d, vector_f, residue, dist);
153  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
154 
155  lp_holder_xyz = cp_function("Ntrp", vector_d, vector_f, residue, dist);
156  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
157 
158  lp_xyz.push_back((vector_df_norm.normalized()*dist)+residue.atom("ND1").xyz());
159 
160  numeric::xyzVector<core::Real> vector_a = residue.atom("NE2").xyz() - residue.atom("CD2").xyz();
161  numeric::xyzVector<core::Real> vector_b = residue.atom("NE2").xyz() - residue.atom("CE1").xyz();
162  numeric::xyzVector<core::Real> vector_ab_norm = vector_a.normalized()+vector_b.normalized();
163 
164  lp_xyz.push_back((vector_ab_norm.normalized()*dist)+residue.atom("NE2").xyz());
165 
166  }
167 
168 
169 
170  else if(residue.name3() == "ARG"){
171  vector_d = residue.atom("NH1").xyz() - residue.atom("CZ").xyz();
172  vector_f = residue.atom("NH1").xyz() - residue.atom("NH2").xyz();
173  lp_holder_xyz = cp_function("Narg", vector_d, vector_f, residue, dist);
174  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
175  lp_holder_xyz = cp_function("aroC", vector_d, vector_f, residue, dist);
176  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
177 
178 
179  }
180  else if(residue.name3() == "PRO"){
181  vector_d = residue.atom("N").xyz() - residue.atom("CA").xyz();
182  vector_f = residue.atom("N").xyz() - residue.atom("CD").xyz();
183  lp_holder_xyz = cp_function("Npro", vector_d, vector_f, residue, dist);
184  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
185 
186 
187  }
188 
189  else if(residue.name3() == "SER"){
190  lp_holder_xyz = (CoordinatesTetrahedral("OG", "CB", "HG", dist, residue));
191  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
192  }
193  else if(residue.name3() == "THR"){
194  lp_holder_xyz = (CoordinatesTetrahedral("OG1", "CB", "HG1", dist, residue));
195  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
196  }
197 
198 
199  else if(residue.name3() == "CYS"){
200  lp_holder_xyz = (CoordinatesTetrahedral("SG", "CB", "HG", dist, residue));
201  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
202  }
203  else if(residue.name3() == "MET"){
204  lp_holder_xyz = (CoordinatesTetrahedral("SD", "CG", "CE", dist, residue));
205  lp_xyz.insert(lp_xyz.end(), lp_holder_xyz.begin(), lp_holder_xyz.end());
206  }
207 
208  std::cout << residue.name3() << residue.seqpos() << std::endl;
209  for(core::Real i = 1; i <= lp_xyz.size(); ++i){
210  printf("ATOM 1 H FLR D %3i %3.3f %3.3f %3.3f \n", residue.seqpos(), lp_xyz[i].x(), lp_xyz[i].y(), lp_xyz[i].z() );
211  }
212 
213 
214  return lp_xyz;
215 }
216 
217 //Taken from BCL!!!
219  std::string atom1,
220  std::string atom2,
221  std::string atom3,
222  core::Real distance_xa,
223  core::conformation::Residue const & residue
224 ){
226 
227  numeric::xyzVector<core::Real> vector_a = residue.atom(atom1).xyz();
228  numeric::xyzVector<core::Real> vector_b = residue.atom(atom2).xyz();
229  numeric::xyzVector<core::Real> vector_c = residue.atom(atom3).xyz();
230 
231  //core::Real distance_xa = 01.0;
232  core::Real angle_xab = numeric::constants::r::pi_2_over_3; //120 degrees
233  //for one point it should be 180 for another it should be 0
234  //core::Real dihedral_xabc = numeric::constants::r::pi;
235 
236  numeric::xyzVector<core::Real> a( (vector_a - vector_b).normalized());
237  numeric::xyzVector<core::Real> b((vector_b - vector_c).normalized());
238  numeric::xyzVector<core::Real> c(cross_product(a,b).normalized());
239  numeric::xyzVector<core::Real> d(cross_product(a,c).normalized());
240 
241  core::Real dihedral_xabc1 = numeric::constants::r::pi;
242  core::Real dihedral_xabc2 = 0;
243 
244  numeric::xyzVector<core::Real> v1 = a * std::cos(numeric::constants::r::pi - angle_xab);
245  numeric::xyzVector<core::Real> v2 = c * std::sin(numeric::constants::r::pi - angle_xab);
246  numeric::xyzVector<core::Real> v3 = d * std::sin(numeric::constants::r::pi - angle_xab);
247 
249  (
250  (
251  v1 - v2 * std::sin(dihedral_xabc1) + v3 * std::cos(dihedral_xabc1)
252  ) * distance_xa
253  );
254 
256  (
257  (
258  v1 - v2 * std::sin(dihedral_xabc2) + v3 * std::cos(dihedral_xabc2)
259  ) * distance_xa
260  );
261 
262 
263  lp_xyz.push_back(vector_a+x1);
264  lp_xyz.push_back(vector_a+x2);
265  return lp_xyz;
266 }
267 
268 //Taken from the BCL!!
270  std::string atom1,
271  std::string atom2,
272  std::string atom3,
274  core::conformation::Residue const & residue
275 
276 ){
280 
281  numeric::xyzVector<core::Real> vector_a = residue.atom(atom1).xyz();
282  numeric::xyzVector<core::Real> vector_b = residue.atom(atom2).xyz();
283  numeric::xyzVector<core::Real> vector_c = residue.atom(atom3).xyz();
284 
285  core::Real distance_xa = (distance * std::cos( 54.75 / 180 * numeric::constants::r::pi));
286 
287  numeric::xyzVector<core::Real> x( (((vector_a - vector_b).normalized() + (vector_a - vector_c).normalized() ).normalized() * distance_xa));
288 
289  foot_point = (vector_a + x);
290 
291  core::Real distance_x_a = (distance * std::sin( 54.75 / 180 * numeric::constants::r::pi));
292 
293  offset = (distance_x_a * cross_product(vector_a-vector_b, vector_a-vector_c).normalized());
294 
295  lp_xyz.push_back(foot_point + offset);
296  lp_xyz.push_back(foot_point - offset);
297 
298  return lp_xyz;
299 
300 
301 }
302 
303 
304 
305 
306 
310  core::conformation::Residue const & residue,
311  core::Real dist
312 
313 ){
315  numeric::xyzVector<core::Real> lp_holder_xyz_right = cross_product(vector_d, vector_f);
316  numeric::xyzVector<core::Real> lp_holder_xyz_left = cross_product(-vector_d, vector_f);
329  for(core::Real i=1; i <= residue.atoms().size(); ++i){
330  if(residue.atom_name(i) == " CZ " && residue.name3() == "TYR" || residue.atom_name(i) == " CG " && residue.name3() == "PHE"){
331  cz_right = residue.atom(i).xyz();
332  cz_left = residue.atom(i).xyz();
333  }
334  if(
335  residue.atom_name(i) == " CG " && residue.name3() == "TYR" || residue.atom_name(i) == " CG " && residue.name3() == "PHE"
336  ){
337  cg_right = residue.atom(i).xyz();
338  cg_left = residue.atom(i).xyz();
339 
340  }
341  if(residue.name3() == "TRP"){
342  if(residue.atom_name(i) == " CE2"){
343  ce2_r = residue.atom(i).xyz();
344  }
345  if(residue.atom_name(i) == " CD2"){
346  cd2_r = residue.atom(i).xyz();
347  }
348  if(residue.atom_name(i) == " CZ3"){
349  cz3_r = residue.atom(i).xyz();
350 
351  }
352  if(residue.atom_name(i) == " CD1"){
353  cd1_r = residue.atom(i).xyz();
354 
355  }
356  if(residue.atom_name(i) == " CE2"){
357  ce2_l = residue.atom(i).xyz();
358  }
359  if(residue.atom_name(i) == " CD2"){
360  cd2_l = residue.atom(i).xyz();
361  }
362  if(residue.atom_name(i) == " CZ3"){
363  cz3_l = residue.atom(i).xyz();
364 
365  }
366  if(residue.atom_name(i) == " CD1"){
367  cd1_l = residue.atom(i).xyz();
368  }
369  }
370  if(residue.name3() == "HIS"){
371  if(residue.atom_name(i) == " CD2"){
372  cd2_r = residue.atom(i).xyz();
373  }
374  if(residue.atom_name(i) == " CG "){
375  cg_right = residue.atom(i).xyz();
376  }
377  if(residue.atom_name(i) == " CE1"){
378  ce2_r = residue.atom(i).xyz();
379  }
380  if(residue.atom_name(i) == " CD2"){
381  cd2_l = residue.atom(i).xyz();
382  }
383  if(residue.atom_name(i) == " CG "){
384  cg_left = residue.atom(i).xyz();
385  }
386  if(residue.atom_name(i) == " CE1"){
387  ce2_l = residue.atom(i).xyz();
388  }
389  }
390  }
391 
392  if(residue.name3() == "TYR" || residue.name3() == "PHE"){
393  lp_xyz.push_back( ((cg_right+cz_right)/2) + (lp_holder_xyz_right.normalized() * dist));
394  lp_xyz.push_back( ((cg_left+cz_left)/2) + (lp_holder_xyz_left.normalized() * dist));
395  }
396  if(residue.name3() == "TRP"){
397  lp_xyz.push_back( (ce2_r+cz3_r)/2 + (lp_holder_xyz_right.normalized() * dist));
398  lp_xyz.push_back( ((ce2_r+cd2_r)/2 + cd1_r)/2 + (lp_holder_xyz_right.normalized() * dist));
399  lp_xyz.push_back( (ce2_l+cz3_l)/2 + (lp_holder_xyz_left.normalized() * dist));
400  lp_xyz.push_back( ((ce2_l+cd2_l)/2 + cd1_l)/2 + (lp_holder_xyz_left.normalized() * dist));
401  }
402  if(residue.name3() == "HIS"){
403  lp_xyz.push_back( ((cd2_r+cg_right)/2 + ce2_r)/2 + (lp_holder_xyz_right.normalized() * dist));
404  lp_xyz.push_back( ((cd2_l+cg_left)/2 + ce2_l)/2 + (lp_holder_xyz_left.normalized() * dist) );
405  }
406  return lp_xyz;
407 }
408 
409 
410 
411 
412 
413 
414 
416  std::string atomtype,
419  core::conformation::Residue const & residue,
420  core::Real dist
421 
422 ){
424  numeric::xyzVector<core::Real> lp_holder_xyz_right = cross_product(vector_d, vector_f);
425  numeric::xyzVector<core::Real> lp_holder_xyz_left = cross_product(-vector_d, vector_f);
426  for(core::Real i=1; i <= residue.atoms().size(); ++i)
427  {
428  if( residue.atom_type(i).name() == atomtype){
429  lp_xyz.push_back( (lp_holder_xyz_right.normalized() * dist)+residue.atom(i).xyz());
430  lp_xyz.push_back( (lp_holder_xyz_left.normalized() * dist)+residue.atom(i).xyz());
431 
432  }
433  }
434  return lp_xyz;
435 }
436 
438  core::conformation::Residue const & resid1
439 ){
441  for(core::Real i=1; i <= resid1.atoms().size(); ++i)
442  {
443  if( resid1.atom_type(i).name() == "Haro" || resid1.atom_type(i).name() == "Hpol"){
444  std::pair< numeric::xyzVector< core::Real >, std::string > new_pair(resid1.atom(i).xyz(), resid1.atom_type(i).name());
445  resid1_H_xyz.push_back( new_pair );
446 
447  }
448  }
449  return resid1_H_xyz;
450 }
451 
452 }
453 }
454 }