Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Residue.functions.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 src/core/conformation/Residue.functions.cc
11 /// @brief Implementation of non-member functions that operate on Residue objects
12 /// @author Andrew Leaver-Fay
13 
14 // Unit headers
16 
17 // Package headers
19 // AUTO-REMOVED #include <core/conformation/Conformation.hh>
20 
21 // Project headers
23 #include <core/types.hh>
24 
25 #include <core/kinematics/Jump.hh>
26 #include <utility/vector1.hh>
27 #include <numeric/xyz.functions.hh>
28 
29 
30 namespace core {
31 namespace conformation {
32 
33 
34 void
36  Residue & res,
37  Conformation const & conf
38 )
39 {
40 // assert( res.seqpos() != -1 ); // commented out: seqpos is Size, so can number be negative
41  utility::vector1< bool > atoms_placed( res.natoms(), false );
42  for ( Size ii = 1; ii <= res.nheavyatoms(); ++ii ) atoms_placed[ ii ] = true;
43  int n_remaining = res.natoms() - res.nheavyatoms();
44 
45  /// Some hydrogen atom locations are calculated as a function of
46  /// other hydrogen atom locations. 2HB on phe depends on 1HB, e.g.
47  /// There must be some hydrogen whose coordinates are determined
48  /// entirely by heavy atoms. Usually, this hydrogen appears first
49  /// in a list of hydrogens, but this isn't guaranteed by the ResidueType
50  /// atom ordering, so this function makes several passes over the set of
51  /// hydrogens (at most 3 passes assuming we never work with methane)
52 
53  while ( n_remaining > 0 ) {
54  Size n_placed_this_iteration = 0;
55  for ( Size ii = res.nheavyatoms() + 1; ii <= res.natoms(); ++ii ) {
56  bool all_stubs_placed = true;
57  for ( Size jj = 1; jj <= 3; ++jj ) {
58  // assume that all atoms on neighboring residues have been placed
59  // but check for all internal atoms whether they have been placed.
60  if ( res.icoor( ii ).stub_atom( jj ).is_internal() &&
61  ! atoms_placed[ res.icoor( ii ).stub_atom( jj ).atomno() ] ) {
62  all_stubs_placed = false;
63  break;
64  }
65  }
66  if ( all_stubs_placed ) {
67  Vector iixyz = res.icoor( ii ).build( res, conf );
68  res.set_xyz( ii, iixyz );
69  ++n_placed_this_iteration;
70  atoms_placed[ ii ] = true;
71  --n_remaining;
72  }
73  }
74  if ( n_placed_this_iteration == 0 ) {
75  std::cerr << "Error from core::conformation::Residue.functions.cc.";
76  std::cerr << "Could not place the following hydrogens: ";
77  for ( Size ii = 1; ii <= res.natoms(); ++ii ) {
78  if ( ! atoms_placed[ ii ] ) {
79  std::cerr << res.atom_name( ii ) << " with atom stubs: ";
80  std::cerr << res.atom_name( res.icoor( ii ).stub_atom(1).atomno() ) << ", ";
81  std::cerr << res.atom_name( res.icoor( ii ).stub_atom(2).atomno() ) << ", & ";
82  std::cerr << res.atom_name( res.icoor( ii ).stub_atom(3).atomno() ) << std::endl;
83  }
84  }
85  utility_exit_with_message( "Failed to place ideal hydrogen positions" );
86  }
87  }
88 
89 }
90 
91 /// @details hokey "update chi from coordinates" useful for when
92 /// the coordinates are known for a rotamer (specifically, a residue
93 /// living outside of a conformation object); after the coordinates are
94 /// set, the chis have to be updated -- that won't happen automatically.
96  conformation::Residue & rotamer
97 )
98 {
99  for ( Size ii = 1; ii <= rotamer.nchi(); ++ii ) {
100  chemical::AtomIndices const & ii_chi_atoms( rotamer.chi_atoms( ii ) );
101  Real const ii_chi = numeric::dihedral(
102  rotamer.xyz( ii_chi_atoms[ 1 ]),
103  rotamer.xyz( ii_chi_atoms[ 2 ]),
104  rotamer.xyz( ii_chi_atoms[ 3 ]),
105  rotamer.xyz( ii_chi_atoms[ 4 ]) );
106  rotamer.chi()[ ii ] = ii_chi;
107  }
108  if ( rotamer.is_protein() ) {
109 
110  }
111 }
112 
113 }
114 }