20 #include <basic/options/option.hh>
21 #include <basic/Tracer.hh>
25 #include <utility/vector1.hh>
26 #include <utility/keys/Key3Tuple.hh>
27 #include <utility/keys/Key2Tuple.hh>
28 #include <utility/pointer/access_ptr.hh>
29 #include <utility/pointer/owning_ptr.hh>
30 #include <utility/pointer/ReferenceCount.hh>
33 #include <numeric/conversions.hh>
43 #include <basic/options/keys/MM.OptionKeys.gen.hh>
59 static basic::Tracer
TR(
"core.mm.MMBondAngleLibrary");
72 std::ifstream data( filename.c_str() );
74 bool in_bonds_section =
false;
75 while( getline( data, line ) ) {
76 std::istringstream l( line );
77 if( line.size() < 1 || line[0] ==
'!' || line[0] ==
' ' )
continue;
78 if (line ==
"DIHEDRALS") in_bonds_section =
false;
79 if (in_bonds_section) lines.push_back( line );
80 if (line ==
"ANGLES") in_bonds_section =
true;
84 for(
Size i = 1; i <= lines.size(); ++i ) {
86 std::istringstream l( lines[i] );
91 l >> atom_type_string_1 >> atom_type_string_2
92 >> atom_type_string_3;
95 if ( !
mm_atom_set_->contains_atom_type( atom_type_string_1 ) )
continue;
96 if ( !
mm_atom_set_->contains_atom_type( atom_type_string_2 ) )
continue;
97 if ( !
mm_atom_set_->contains_atom_type( atom_type_string_3 ) )
continue;
100 int atom_type_int1 =
mm_atom_set_->atom_type_index( atom_type_string_1 );
101 int atom_type_int2 =
mm_atom_set_->atom_type_index( atom_type_string_2 );
102 int atom_type_int3 =
mm_atom_set_->atom_type_index( atom_type_string_3 );
105 Real k_theta, minimum;
106 l >> k_theta >> minimum;
107 minimum = numeric::conversions::radians( minimum );
113 if( atom_type_string_1 ==
"X" && atom_type_string_3 ==
"X" )
128 int const virt_type =
mm_atom_set_->atom_type_index(
"VIRT");
129 Real const no_op_k_theta( 0.0 );
130 Real const no_op_minimum( 0.0 );
154 if( fully_assigned_mm_bondangle_library_.count(
157 return fully_assigned_mm_bondangle_library_.equal_range(
159 }
else if( fully_assigned_mm_bondangle_library_.count(
162 return fully_assigned_mm_bondangle_library_.equal_range(
166 int const virt_atom_type = mm_atom_set_->atom_type_index( virt_string );
169 if ( atom1 == virt_atom_type ||
170 atom2 == virt_atom_type ||
171 atom3 == virt_atom_type ) {
172 return fully_assigned_mm_bondangle_library_.equal_range(
177 int const wild_atom_type = mm_atom_set_->atom_type_index( x_string );
179 if( wildcard_mm_bondangle_library_.count(
182 return wildcard_mm_bondangle_library_.equal_range(
186 TR <<
"No parameters for " << (*mm_atom_set_)[atom1].name() <<
"-" << (*mm_atom_set_)[atom2].name() <<
"-"
187 << (*mm_atom_set_)[atom3].name() << std::endl;
190 if ( ! basic::options::option[ basic::options::OptionKeys::MM::ignore_missing_bondangle_params ]() )
191 utility_exit_with_message(
"COULD NOT FIND BOND ANGLE PARAMS FOR " + atom1 +
' ' + atom2 +
' ' + atom3 );
204 return (*this).lookup( mm_atom_set_->atom_type_index( atom1 ),
205 mm_atom_set_->atom_type_index( atom2 ),
206 mm_atom_set_->atom_type_index( atom3 ) );
215 TR << (i->first).key1() <<
"\t"
216 << (i->first).key2() <<
"\t"
217 << (i->first).key3() <<
"\t"
218 << (i->second).key1() <<
"\t"
219 << (i->second).key2() <<
"\t"
225 TR << (i->first).key1() <<
"\t"
226 << (i->first).key2() <<
"\t"
227 << (i->first).key3() <<
"\t"
228 << (i->second).key1() <<
"\t"
229 << (i->second).key2() <<
"\t"
239 TR << (i->first).key1() <<
"\t"
240 << (i->first).key2() <<
"\t"
241 << (i->first).key3() <<
"\t"
242 << (i->second).key1() <<
"\t"
243 << (i->second).key2() <<
"\t"
253 TR << (i->first).key1() <<
"\t"
254 << (i->first).key2() <<
"\t"
255 << (i->first).key3() <<
"\t"
256 << (i->second).key1() <<
"\t"
257 << (i->second).key2() <<
"\t"