Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OopMover.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/simple_moves/oop/OopMover.cc
11 /// @brief OopMover methods implemented
12 /// @author Kevin Drew, kdrew@nyu.edu
13 
14 // Unit Headers
16 // Package Headers
17 
18 // Project Headers
28 #include <core/pose/Pose.hh>
29 #include <core/id/AtomID.hh>
30 // Utility Headers
31 #include <numeric/xyz.functions.hh>
32 #include <basic/Tracer.hh>
33 #include <basic/basic.hh>
34 #include <core/types.hh>
35 
36 // C++ Headers
37 
38 using basic::T;
39 using basic::Error;
40 using basic::Warning;
41 
42 static basic::Tracer TR( "protocols.simple_moves.oop.OopMover" );
43 
44 
45 using namespace core;
46 using namespace conformation;
47 using namespace chemical;
48 using namespace core::id;
49 
50 namespace protocols {
51 namespace simple_moves {
52 namespace oop {
53 
54 /*
55 kdrew: the helper function moves a single oop with the given move
56 pose: pose to make change to
57 oop_pre_pos: position of first residue of oop to make change to
58 phi_angle: value to change phi angle to
59 psi_angle: value to change psi angle to
60 */
61 void OopMover::apply( core::pose::Pose & pose )
62 {
63  using numeric::conversions::radians;
64  using numeric::conversions::degrees;
65 
66  runtime_assert ( pose.residue(oop_pre_pos_).has_variant_type(chemical::OOP_PRE) == 1) ;
67  runtime_assert ( pose.residue(oop_post_pos_).has_variant_type(chemical::OOP_POST) == 1) ;
68  //kdrew: an oop pre position cannot be last position
69  runtime_assert ( oop_pre_pos_ != pose.total_residue() );
70  //kdrew: an oop post position cannot be first position
71  runtime_assert ( oop_post_pos_ != 1 );
72 
73  //kdrew: first residue is a special case, no phi torsion
74  if( pose.residue_type( oop_pre_pos_ ).is_lower_terminus() )
75  {
76  //kdrew: no phi angle, adjust CYP-N-Ca-C torsion
77  Real offset = 180 + phi_angle_ ;
78 
79  AtomID aidCYP( pose.residue(oop_pre_pos_).atom_index("CYP"), oop_pre_pos_ );
80  AtomID aidN( pose.residue(oop_pre_pos_).atom_index("N"), oop_pre_pos_ );
81  AtomID aidCA( pose.residue(oop_pre_pos_).atom_index("CA"), oop_pre_pos_ );
82  AtomID aidC( pose.residue(oop_pre_pos_).atom_index("C"), oop_pre_pos_ );
83 
84  pose.conformation().set_torsion_angle( aidCYP, aidN, aidCA, aidC, radians( offset ) );
85  }
86 
87 
88  TR << "current oop_pre ("<< oop_pre_pos_<< ") PHI: " << pose.phi(oop_pre_pos_) << std::endl;
89  pose.set_phi(oop_pre_pos_, phi_angle_);
90  TR << "new oop_pre ("<< oop_pre_pos_<< ") PHI: " << pose.phi(oop_pre_pos_) << std::endl;
91  //pose.dump_pdb( "rosetta_out_oop_pre.pdb" );
92  TR << "current oop_pre ("<< oop_pre_pos_<< ") PSI: " << pose.psi(oop_pre_pos_) << std::endl;
93  pose.set_psi(oop_pre_pos_, psi_angle_);
94  TR << "new oop_pre ("<< oop_pre_pos_<< ") PSI: " << pose.psi(oop_pre_pos_) << std::endl;
95  //pose.dump_pdb( "rosetta_out_oop_pre_pos_t.pdb" );
96 
97  update_hydrogens_( pose );
98 
99 }
100 
102 OopMover::get_name() const {
103  return "OopMover";
104 }
105 
106 ///@brief
107 OopMover::OopMover(
108  core::Size oop_seq_position
109  ): Mover(), oop_pre_pos_(oop_seq_position), oop_post_pos_(oop_seq_position+1)
110 {
111  Mover::type( "OopMover" );
112 }
113 
115  core::Size oop_seq_position,
116  core::Real phi_angle,
117  core::Real psi_angle
118  ): Mover(), oop_pre_pos_(oop_seq_position), oop_post_pos_(oop_seq_position+1), phi_angle_(phi_angle), psi_angle_(psi_angle)
119 {
120  Mover::type( "OopMover" );
121 
122 }
123 
125 
127 {
128  using numeric::conversions::radians;
129  using numeric::conversions::degrees;
130 
131  AtomID aidVZP( pose.residue(oop_pre_pos_).atom_index("VZP"), oop_pre_pos_);
132  AtomID aidCYP( pose.residue(oop_pre_pos_).atom_index("CYP"), oop_pre_pos_);
134  AtomID aidCA( pose.residue(oop_pre_pos_).atom_index("CA"), oop_pre_pos_);
135  AtomID aid1HYP( pose.residue(oop_pre_pos_).atom_index("1HYP"), oop_pre_pos_);
136  AtomID aidVYP( pose.residue(oop_post_pos_).atom_index("VYP"), oop_post_pos_);
137  AtomID aidCZP( pose.residue(oop_post_pos_).atom_index("CZP"), oop_post_pos_);
138  AtomID aidN_Z( pose.residue(oop_post_pos_).atom_index("N"), oop_post_pos_);
139  AtomID aidCA_Z( pose.residue(oop_post_pos_).atom_index("CA"), oop_post_pos_);
140  AtomID aid1HZP( pose.residue(oop_post_pos_).atom_index("1HZP"), oop_post_pos_);
141 
142  //kdrew: definitions for xyz coordinates
143  Vector const& CA_xyz ( pose.residue(oop_pre_pos_).xyz("CA") );
144  Vector const& N_xyz ( pose.residue(oop_pre_pos_).xyz("N") );
145  Vector const& CYP_xyz ( pose.residue(oop_pre_pos_).xyz("CYP") );
146  Vector const& CAZ_xyz ( pose.residue(oop_post_pos_).xyz("CA") );
147  Vector const& NZ_xyz ( pose.residue(oop_post_pos_).xyz("N") );
148  Vector const& CZP_xyz ( pose.residue(oop_post_pos_).xyz("CZP") );
149 
150 
151  //kdrew: VZP and VYP are relative to the 1Hs, so move the 1Hs and VZP|VYP and 2H moves with it
152  //kdrew: calculate the difference between the virtual atom VZP torsion and the torsion involving the real CZP atom (on the post residue)
153  Real VZP_torsion_correction = numeric::dihedral_degrees( CZP_xyz, CYP_xyz, N_xyz, CA_xyz ) - degrees( pose.conformation().torsion_angle( aidVZP, aidCYP, aidN, aidCA ) );
154  //kdrew: change the 1HYP torsion by the corrected amount
155  Real torsion_1HYP = degrees(pose.conformation().torsion_angle(aid1HYP,aidCYP,aidN,aidCA)) + VZP_torsion_correction;
156  pose.conformation().set_torsion_angle(aid1HYP,aidCYP,aidN,aidCA,radians(torsion_1HYP));
157  //pose.dump_pdb( "rosetta_out_oop_pre_mvH.pdb" );
158 
159  //kdrew: calculate the difference between the virtual atom VYP torsion and the torsion involving the real CYP atom (on the pre residue)
160  Real VYP_torsion_correction = numeric::dihedral_degrees( CYP_xyz, CZP_xyz, NZ_xyz, CAZ_xyz ) - degrees( pose.conformation().torsion_angle( aidVYP, aidCZP, aidN_Z, aidCA_Z ));
161  //kdrew: change the 1HZP torsion by the corrected amount
162  Real torsion_1HZP = degrees(pose.conformation().torsion_angle(aid1HZP,aidCZP,aidN_Z,aidCA_Z)) + VYP_torsion_correction;
163  pose.conformation().set_torsion_angle(aid1HZP,aidCZP,aidN_Z,aidCA_Z,radians(torsion_1HZP));
164  //pose.dump_pdb( "rosetta_out_oop_pre_pos_t_mvH.pdb" );
165 
166  //kdrew: possibly minimize pose here
167 
168  //kdrew: debug printing
169  //kdrew: VZP CYP N CA
170  TR<<"VZP-CYP-N-CA: "<< degrees(pose.conformation().torsion_angle(aidVZP,aidCYP,aidN,aidCA)) <<std::endl;
171  //kdrew: CZP CYP N CA
172  TR<<"CZP-CYP-N-CA: "<< numeric::dihedral_degrees(CZP_xyz,CYP_xyz,N_xyz,CA_xyz) <<std::endl;
173  //kdrew: 1HYP CYP N CA
174  TR<<"1HYP-CYP-N-CA: "<< degrees(pose.conformation().torsion_angle(aid1HYP,aidCYP,aidN,aidCA)) <<std::endl;
175 
176  //kdrew: VYP CZP N_Z CA_Z
177  TR<<"VYP-CZP-N-CA: "<< degrees(pose.conformation().torsion_angle(aidVYP,aidCZP,aidN_Z,aidCA_Z)) << std::endl;
178  //kdrew: CYP CZP N_Z CA_Z
179  TR<<"CYP-CZP-N-CA: "<< numeric::dihedral_degrees(CYP_xyz,CZP_xyz,NZ_xyz,CAZ_xyz) <<std::endl;
180  //kdrew: 1HZP CZP N_Z CA_Z
181  TR<<"1HZP-CZP-N-CA: "<< degrees(pose.conformation().torsion_angle(aid1HZP,aidCZP,aidN_Z,aidCA_Z)) << std::endl;
182 
183 }
184 
185 }//oop
186 }//simple_moves
187 }//protocols
188