Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MMLJScore.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 core/scoring/mm/MMLJScore.cc
11 /// @brief Molecular mechanics lj score class
12 /// @author P. Douglas Renfrew (renfrew@unc.edu)
13 
14 // Unit headers
17 
18 // Project headers
20 
22 
23 // AUTO-REMOVED #include <basic/prof.hh>
24 
25 // Utility header
26 // AUTO-REMOVED #include <utility/keys/Key4Tuple.hh>
27 // AUTO-REMOVED #include <utility/keys/Key3Tuple.hh>
28 #include <utility/pointer/access_ptr.hh>
29 #include <utility/pointer/owning_ptr.hh>
30 #include <utility/pointer/ReferenceCount.hh>
31 
32 // C++ headers
33 #include <iostream>
34 #include <string>
35 #include <map>
36 #include <math.h>
37 
38 #include <utility/vector1.hh>
39 
40 
41 namespace core {
42 namespace scoring {
43 namespace mm {
44 
46  mm_lj_library_( scoring::ScoringManager::get_instance()->get_MMLJLibrary() )
47 { }
48 
50  mm_lj_library_( mmljl )
51 { }
52 
54 
55 /// @details blah
56 Energy
57 MMLJScore::score( Size atom1, Size atom2, Size path_distance, Real distance ) const
58 {
59  // lookup params
60  mm_lj_param_set atom1_params, atom2_params;
61  if( path_distance == 3 )
62  {
63  atom1_params = mm_lj_library_.lookup_three_bond( atom1 );
64  atom2_params = mm_lj_library_.lookup_three_bond( atom2 );
65  }
66  else
67  {
68  atom1_params = mm_lj_library_.lookup( atom1 );
69  atom2_params = mm_lj_library_.lookup( atom2 );
70  }
71 
72  // calc score
73  Real epsilon( sqrt( atom1_params.key2() * atom2_params.key2() ) );
74  Real rmin_over_dist( ( atom1_params.key1() + atom2_params.key1() ) / distance );
75  Real score( epsilon * ( pow( rmin_over_dist, 12 ) - 2 * pow( rmin_over_dist, 6 ) ) );
76 
77  return score;
78 }
79 
80 /// @details blah
81 Energy
82 MMLJScore::deriv_score( Size atom1, Size atom2, Size path_distance, Real distance ) const
83 {
84  // lookup params
85  mm_lj_param_set atom1_params, atom2_params;
86  if( path_distance == 3 )
87  {
88  atom1_params = mm_lj_library_.lookup_three_bond( atom1 );
89  atom2_params = mm_lj_library_.lookup_three_bond( atom2 );
90  }
91  else
92  {
93  atom1_params = mm_lj_library_.lookup( atom1 );
94  atom2_params = mm_lj_library_.lookup( atom2 );
95  }
96 
97  // calc deriv
98  Real epsilon( sqrt( atom1_params.key2() * atom2_params.key2() ) );
99  Real rmin ( atom1_params.key1() + atom2_params.key1() );
100  Real deriv( 12 * epsilon * ( ( pow( rmin, 6 ) / pow( distance, 7 ) ) - ( pow( rmin, 12 ) / pow( distance, 13 ) ) ) );
101 
102  return deriv;
103 }
104 
105 /// @derails blah
106 Real
107 MMLJScore::min_dist( Size atom1, Size atom2, Size path_distance ) const
108 {
109  // lookup params
110  mm_lj_param_set atom1_params, atom2_params;
111  if( path_distance == 3 )
112  {
113  atom1_params = mm_lj_library_.lookup_three_bond( atom1 );
114  atom2_params = mm_lj_library_.lookup_three_bond( atom2 );
115  }
116  else
117  {
118  atom1_params = mm_lj_library_.lookup( atom1 );
119  atom2_params = mm_lj_library_.lookup( atom2 );
120  }
121 
122  // calc min
123  Real rmin ( atom1_params.key1() + atom2_params.key1() );
124 
125  return rmin;
126 }
127 
128 } // namespace mm
129 } // namespace scoring
130 } // namespace core