Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
util.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 core/scoring/methods/util.cc
12 ///
13 /// @brief utility methods for scoring.
14 /// @author James Thompson
15 
16 // Unit headers
18 #include <basic/options/option.hh>
19 
20 #include <basic/Tracer.hh>
21 #include <core/types.hh>
22 
24 #include <core/id/AtomID.hh>
25 
26 #include <utility/exit.hh>
27 
28 
29 // option key includes
30 
31 #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
32 
33 #include <utility/vector1.hh>
34 
35 
36 
37 namespace core {
38 namespace scoring {
39 namespace methods {
40 
41 static basic::Tracer tr("core.scoring.methods");
42 
44  const char ss
45 ) {
46 
47  using namespace basic::options;
48  using namespace basic::options::OptionKeys;
49  core::Real rsd_wt = 1.0;
50  if ( ss == 'H' ) {
51  rsd_wt = option[ abinitio::rsd_wt_helix ]();
52  } else if ( ss == 'E' ) {
53  rsd_wt = option[ abinitio::rsd_wt_strand ]();
54  } else if ( ss == 'L' ) {
55  rsd_wt = option[ abinitio::rsd_wt_loop ]();
56  } else {
57  tr.Error << "Error: don't recognize secondary structure character '" << ss << "' " << std::endl;
58  rsd_wt = option[ abinitio::rsd_wt_loop ]();
59  }
60 
61  return rsd_wt;
62 } // get_residue_wt_by_ss
63 
65  conformation::Residue const & rsd1,
66  conformation::Residue const & rsd2,
67  core::Real const interaction_cutoff
68 ) {
69 
70  Real const rsd1_reach( rsd1.nbr_radius() ),
71  rsd2_reach( rsd2.nbr_radius() );
72  Distance const intxn_dist( rsd1_reach + rsd2_reach + interaction_cutoff );
73  DistanceSquared const intxn_dist2( intxn_dist * intxn_dist );
74  DistanceSquared const nbr_dist2(
75  rsd1.xyz( rsd1.nbr_atom() ).distance_squared( rsd2.xyz( rsd2.nbr_atom() ) )
76  );
77 
78  return ( nbr_dist2 < intxn_dist2 );
79 }
80 
82  conformation::Residue const & rsd1,
83  conformation::Residue const & rsd2,
84  core::id::AtomID const & id1,
85  core::id::AtomID const & id2,
86  core::Real const interaction_cutoff
87 ) {
88  assert( id1.rsd() == rsd1.seqpos() );
89  assert( id2.rsd() == rsd2.seqpos() );
90 
91  Distance const dist(
92  rsd1.xyz( id1.atomno() ).distance( rsd2.xyz( id2.atomno() ) )
93  );
94 
95  return ( dist < interaction_cutoff );
96 }
97 
98 } // namespace methods
99 } // namespace scoring
100 } // namespace core