Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BBTorsionAndAnglesSRFD.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file
12 /// @brief
13 /// @author Florian Richter (floric@u.washington.edu)
14 /// @date Wed Oct 20 12:08:31 2007
15 ///
16 
17 // Unit Headers
19 
20 // Project Headers
21 #include <core/pose/Pose.hh>
24 
25 // Utility headers
26 #include <basic/Tracer.hh>
27 
28 #include <utility/vector1.hh>
29 
30 
31 namespace core {
32 namespace fragment {
33 
34 static basic::Tracer tr("core.fragment.BBTorsionAndAnglesSRFD");
35 
36 bool BBTorsionAndAnglesSRFD::apply( pose::Pose& pose, Size seqpos ) const {
37  bool const success ( Parent::apply( pose, seqpos ) );
38 
39  // only move forward with changes if prior ops successful
40  if ( success ) {
41  for ( Size i = 1; i <= angles_.size(); ++i ) {
43  core::id::AtomID ((angles_[i].first)[0], seqpos),
44  core::id::AtomID ((angles_[i].first)[1], seqpos ),
45  core::id::AtomID ((angles_[i].first)[2], seqpos ),
46  angles_[i].second
47  );
48  }
49  }
50  return success; //can something go wrong ?
51 }
52 
53 /// @brief insert backbone torsions and angles into pose at position seqpos
54 /// if all bb torsions are moveable in MoveMap
55 /// @return True if *all* torsions and angles are inserted and superclass apply()
56 /// is successful, otherwise False.
57 /// @remarks This is currently all or nothing -- all torsions for seqpos
58 /// must be moveable because it's not entirely clear what the behavior
59 /// of partial angle insertion is. In addition, DOF_IDs are not made
60 /// explicitly available within this class, meaning there is no way to
61 /// look them up within the MoveMap; the implementation in this class
62 /// must be changed if this is desired.
63 bool BBTorsionAndAnglesSRFD::apply( kinematics::MoveMap const & movemap, pose::Pose & pose, Size const seqpos ) const {
64  // parent apply() successful?
65  if ( !Parent::apply( movemap, pose, seqpos ) ) {
66  return false; // punt
67  }
68 
69  // first check to see if all torsions moveable
70  bool success2 = true; // true only if all torsions moveable
71  for ( Size j = 1, je = nbb(); j <= je; ++j ) {
72  success2 = success2 && movemap.get( id::TorsionID( seqpos, id::BB, j ) );
73  }
74 
75  // insert all angles only if all torsions moveable
76  if ( success2 ) {
77  for ( Size i = 1; i <= angles_.size(); ++i ) {
79  core::id::AtomID ((angles_[i].first)[0], seqpos),
80  core::id::AtomID ((angles_[i].first)[1], seqpos ),
81  core::id::AtomID ((angles_[i].first)[2], seqpos ),
82  angles_[i].second
83  );
84  }
85  }
86  return success2;
87 }
88 
89 bool BBTorsionAndAnglesSRFD::steal( pose::Pose const& pose, Size seqpos ) {
90  runtime_assert( angles_.size() > 0 );
91  bool success ( Parent::steal( pose, seqpos ) );
92 
93  for ( Size i=1; i<= angles_.size(); ++i ) {
94  angles_[i].second = pose.conformation().bond_angle(
95  core::id::AtomID ((angles_[i].first)[0], seqpos),
96  core::id::AtomID ((angles_[i].first)[1], seqpos),
97  core::id::AtomID ((angles_[i].first)[2], seqpos) );
98  }
99  return success; //can something go wrong ?
100 }
101 
103  if ( dynamic_cast< BBTorsionAndAnglesSRFD const * > ( & aSRFD ) ) {
104  BBTorsionAndAnglesSRFD const & bbtaasrfd = static_cast< BBTorsionAndAnglesSRFD const & > ( aSRFD );
105  return ( (bbtaasrfd.nbb() == nbb()) && (bbtaasrfd.nangles() == nangles()) );
106  }
107  return false; //wrong SRFD-type (cast not successfull)
108 }
109 
110 /// @details there is no information in the MoveMap as to which angles can be moved, so this function
111 /// @details will return its value solely based on the parent
112 bool BBTorsionAndAnglesSRFD::is_applicable( kinematics::MoveMap const& move_map, Size seqpos) const {
113  if ( ! Parent::is_applicable( move_map, seqpos ) ) return false;
114  return true;
115 }
116 
117 void BBTorsionAndAnglesSRFD::show( std::ostream &out ) const {
118  Parent::show( out );
119 }
120 
121 void BBTorsionAndAnglesSRFD::read( std::istream &in ) {
122  Parent::read_data( in );
123 }
124 
125 } //fragment
126 } //core