13 #include <basic/Tracer.hh>
14 #include <basic/database/open.hh>
20 #include <utility/pointer/ReferenceCount.hh>
21 #include <utility/exit.hh>
22 #include <utility/io/izstream.hh>
25 #include <numeric/xyzVector.hh>
26 #include <boost/algorithm/string/trim.hpp>
28 #include <utility/vector1.hh>
39 static basic::Tracer
TR(
"core.scoring.methods.DFIRE_Potential");
44 : potential_is_loaded_(false)
55 boost::algorithm::trim(atom1_trimmed);
56 boost::algorithm::trim(atom2_trimmed);
59 string const joint_id1( res1 +
" " + atom1_trimmed +
" " + res2 +
" " + atom2_trimmed);
62 string const joint_id2( res2 +
" " + atom2_trimmed +
" " + res1 +
" " + atom1_trimmed );
75 utility::io::izstream input;
76 basic::database::open( input, fn );
77 if ( !input.good() ) {
78 std::string const msg(
"Error opening file: " + fn );
79 utility_exit_with_message( msg );
82 while (getline(input,line) ) {
83 if ( line.substr(0,1) !=
"#" ) {
84 std::istringstream ss(line);
85 string res1(
""), atom1(
""), res2(
""), atom2(
"");
86 ss >> res1 >> atom1 >> res2 >> atom2;
96 while ( !ss.fail() ) {
97 pair_potential.push_back(value);
103 string const joint_id(
get_joint_id(res1,atom1,res2,atom2));
125 boost::algorithm::trim(res_name);
126 if ( res_name ==
"ASP" )
return 1;
127 else if ( res_name ==
"PRO" )
return 2;
128 else if ( res_name ==
"LYS" )
return 3;
129 else if ( res_name ==
"ILE" )
return 4;
130 else if ( res_name ==
"TRP" )
return 5;
131 else if ( res_name ==
"CYS" )
return 6;
132 else if ( res_name ==
"GLY" )
return 7;
133 else if ( res_name ==
"PHE" )
return 8;
134 else if ( res_name ==
"GLN" )
return 9;
135 else if ( res_name ==
"SER" )
return 10;
136 else if ( res_name ==
"ASN" )
return 11;
137 else if ( res_name ==
"LEU" )
return 12;
138 else if ( res_name ==
"VAL" )
return 13;
139 else if ( res_name ==
"TYR" )
return 14;
140 else if ( res_name ==
"GLU" )
return 15;
141 else if ( res_name ==
"ARG" )
return 16;
142 else if ( res_name ==
"THR" )
return 17;
143 else if ( res_name ==
"ALA" )
return 18;
144 else if ( res_name ==
"MET" )
return 19;
145 else if ( res_name ==
"HIS" )
return 20;
153 if ( atom_name ==
"N" )
return 1;
154 else if ( atom_name ==
"CA" )
return 2;
155 else if ( atom_name ==
"C" )
return 3;
156 else if ( atom_name ==
"O" )
return 4;
157 else if ( atom_name ==
"CB" )
return 5;
177 for (
Size ii = 1; ii <= natoms1; ++ii ) {
178 for (
Size jj = 1; jj <= natoms2; ++jj ) {
179 Real const dist = rsd1.
xyz(ii).distance( rsd2.
xyz(jj) );
180 Size const dist_bin_idx = (
Size) (2*dist + 0.5);
182 if ( dist_bin_idx < 30 ) {
185 string const res_id1 ( rsd1.
type().
name3() );
186 string const res_id2 ( rsd2.
type().
name3() );
187 string const joint_bin_id(
get_joint_id( res_id1, atom_id1, res_id2, atom_id2 ) );
188 boost::unordered_map< string, Size >::const_iterator it =
atom_res_idx_.find(joint_bin_id);
190 if ( it !=
atom_res_idx_.end() && dist_bin_idx <= scores.size() ) {
191 score += scores[dist_bin_idx];