42 #include <basic/Tracer.hh>
68 #include <basic/datacache/BasicDataCache.hh>
72 #include <basic/database/open.hh>
76 #include <numeric/random/random.hh>
77 #include <numeric/xyz.functions.hh>
79 #include <utility/io/izstream.hh>
82 #include <numeric/constants.hh>
87 #include <ObjexxFCL/format.hh>
95 #include <utility/vector1.hh>
96 #include <ObjexxFCL/FArray3D.hh>
104 namespace rotamer_set {
106 static numeric::random::RandomGenerator
RG(32241);
108 static basic::Tracer
tt(
"core.pack.rotamer_set.rotamer_building_functions",basic::t_info );
112 utility::io::izstream & lib_stream,
117 const string delimiters(
" ");
120 while ( !lib_stream.eof() ) {
125 getline( lib_stream, line );
128 Size last_pos = line.find_first_not_of( delimiters, 0 );
130 Size pos = line.find_first_of( delimiters, last_pos );
132 while ( string::npos != pos || string::npos != last_pos ) {
134 const string next_dih( line.substr( last_pos, pos-last_pos) );
135 dihedrals->push_back( strtod( next_dih.c_str(), NULL) );
138 last_pos = line.find_first_not_of( delimiters, pos );
141 pos = line.find_first_of( delimiters, last_pos );
144 if ( dihedrals->size() < 7)
147 library.push_back( dihedrals );
160 using namespace basic;
161 using namespace pose;
162 using namespace conformation;
163 using namespace optimization;
166 using namespace scoring;
167 using namespace constraints;
169 bool const minimize_rotamers(
true );
170 Real const distance_cutoff( 2.0 );
171 Real min_tolerance( 1e-2 );
172 Real const pi( numeric::constants::d::pi );
174 Real const std_length( .145 );
175 Real const std_angle ( .38 );
176 Real const dist_tol ( .2 );
177 Real const angle_tol ( 30 );
178 Real const rad2deg ( 180/pi );
181 assert( existing_residue.is_NA() && concrete_residue->is_NA() );
183 bool const simple_way( existing_residue.is_terminus() );
187 rot->set_chi( 1, existing_residue.chi(1) );
190 rotamers.push_back(
rot );
197 Size const seqpos(2);
200 assert( rsd.is_NA() && mini_pose.
residue(seqpos-1).
is_NA() );
202 Vector const P_O3( ( next_rsd.xyz(
"P") - rsd.xyz(
"O3*") ) );
203 Real const target_distance( P_O3.length() );
205 Real const P_bond_angle (angle_of( next_rsd.xyz(
"O5*"), next_rsd.xyz(
"P") , rsd.xyz(
"O3*") ));
206 Real const O3_bond_angle(angle_of( next_rsd.xyz(
"P") , rsd.xyz(
"O3*"), rsd.xyz(
"C3*") ));
211 cst_set->add_constraint(
new AtomPairConstraint( AtomID(rsd.atom_index(
"O3*"),seqpos), AtomID(next_rsd.atom_index(
"P"),seqpos+1),
213 cst_set->add_constraint(
new AngleConstraint ( AtomID(next_rsd.atom_index(
"O5*"),seqpos+1), AtomID(next_rsd.atom_index(
"P"),seqpos+1),
214 AtomID(rsd.atom_index(
"O3*"),seqpos),
new HarmonicFunc( P_bond_angle, std_angle ) ) );
215 cst_set->add_constraint(
new AngleConstraint ( AtomID(next_rsd.atom_index(
"P"),seqpos+1), AtomID(next_rsd.atom_index(
"O3*"),seqpos),
216 AtomID(rsd.atom_index(
"C3*"),seqpos),
new HarmonicFunc( O3_bond_angle, std_angle ) ) );
226 MinimizerOptions options(
"dfpmin" , min_tolerance,
true ,
false ,
false );
230 mm.
set( TorsionID(seqpos-1,
BB, 6),
true );
231 mm.
set( TorsionID(seqpos ,
BB, 1),
true );
232 mm.
set( TorsionID(seqpos ,
BB, 2),
true );
233 mm.
set( TorsionID(seqpos ,
BB, 3),
true );
234 mm.
set( TorsionID(seqpos ,
BB, 4),
true );
237 for ( ; lib_iter!=library.end(); lib_iter++ ) {
240 bool accept_rotamer(
true ) ;
243 Size const nbb( rsd.n_mainchain_atoms() );
244 for (
int i=1; i<=6; ++i ) {
245 TorsionID
const id ( ( i==1 ) ? ( TorsionID( seqpos-1,
BB, nbb ) ) : ( TorsionID( seqpos,
BB, i-1 ) ) );
249 TorsionID
const id ( seqpos,
CHI, 1 );
252 Vector const rot_P_O3( ( next_rsd.xyz(
"P") - mini_pose.
residue(seqpos).
xyz(
"O3*") ) );
255 if ( fabs( target_distance - rot_P_O3.length() ) < distance_cutoff ) {
257 accept_rotamer =
true;
259 if ( minimize_rotamers ) {
263 AtomTreeMinimizer().run( mini_pose, mm, sf, options );
278 for (
int i=1; i<=5; ++i ) {
279 TorsionID
const id ( ( i==1 ) ? ( TorsionID( seqpos-1,
BB, nbb ) ) : ( TorsionID( seqpos,
BB, i-1 ) ) );
280 Real diff_i = fabs( mini_pose.
torsion(
id ) - (*dihedrals)[i] );
285 if ( diff_i > angle_tol )
286 accept_rotamer =
false;
293 if (accept_rotamer) {
295 cur_rsd( mini_pose.
residue( seqpos ) ),
296 cur_next_rsd( mini_pose.
residue(seqpos+1) );
297 Vector const cur_P_O3( ( cur_next_rsd.xyz(
"P") - cur_rsd.xyz(
"O3*") ) );
298 Real const cur_P_bond_angle ( angle_of( cur_next_rsd.xyz(
"O5*"), cur_next_rsd.xyz(
"P") , cur_rsd.xyz(
"O3*") ) );
299 Real const cur_O3_bond_angle( angle_of( cur_next_rsd.xyz(
"P") , cur_rsd.xyz(
"O3*"), cur_rsd.xyz(
"C3*") ) );
301 Real const diff_length ( fabs( cur_P_O3.length() - target_distance ) );
303 Real diff_P_angle ( rad2deg * fabs( cur_P_bond_angle - P_bond_angle ) );
304 Real diff_O3_angle( rad2deg * fabs( cur_O3_bond_angle - O3_bond_angle ) );
305 if ( diff_P_angle > 180 )
306 diff_P_angle = 360 - diff_P_angle;
307 if ( diff_O3_angle > 180 )
308 diff_O3_angle = 360 - diff_O3_angle;
310 if ( ( diff_P_angle > angle_tol ) || ( diff_O3_angle > angle_tol ) || ( diff_length > dist_tol ) )
311 accept_rotamer =
false;
321 if ( accept_rotamer ) {
325 new_rot->seqpos( existing_residue.seqpos() );
326 new_rot->chain ( existing_residue.chain () );
327 new_rot->copy_residue_connections( existing_residue );
328 rotamers.push_back( new_rot );
334 tt <<
"Built " << rotamers.size() <<
" rotamers for " << resid <<
" " << concrete_residue->name() << std::endl;
351 using namespace pose;
352 using namespace conformation;
354 using namespace pack::task;
357 Real const max_rotation( 5.0 );
358 bool const tether_bond_distance(
true );
359 bool const tether_bond_angle(
false );
361 int nrot_to_build(1);
385 nrot_to_build = 1000;
389 std::cerr <<
"Error in RotamerSet_::set_extrachi_samples, invalid ExtraChiSample type" << std::endl;
395 assert( existing_residue.is_NA() && concrete_residue->is_NA() );
397 if ( existing_residue.is_terminus() ) nrot_to_build = 1;
404 rot->set_chi( 1, existing_residue.chi(1) );
415 rotamers.push_back(
rot );
417 if ( nrot_to_build > 1 ) {
427 Size const seqpos(2);
429 prev_rsd( mini_pose.
residue(seqpos-1) ),
430 rsd( mini_pose.
residue(seqpos ) ),
431 next_rsd( mini_pose.
residue(seqpos+1) );
433 assert( rsd.is_DNA() && prev_rsd.is_DNA() );
437 atoms.push_back( prev_rsd.xyz(
"O3*") );
438 atoms.push_back( rsd.xyz(
"P") );
439 atoms.push_back( rsd.xyz(
"O5*") );
440 atoms.push_back( rsd.xyz(
"C5*") );
441 atoms.push_back( rsd.xyz(
"C4*") );
443 Vector const r( rsd.xyz(
"O3*") );
445 Vector const n1( ( next_rsd.xyz(
"P") - rsd.xyz(
"O3*" ) ).normalized() );
446 Vector const n2( ( next_rsd.xyz(
"O5*") - next_rsd.xyz(
"P" ) ).normalized() );
451 for (
int i=1; i<= 4; ++i ) {
452 Vector const bi( ( atoms[i+1] - atoms[i] ).normalized() );
453 Vector const ci( atoms[i+1] );
454 v1[i] = n1.dot( bi.cross( r - ci ) );
455 v2[i] = n2.dot( bi.cross( r - ci ) );
469 l1 = std::sqrt( l1 );
471 for (
int i=1; i<= 4; ++i ) {
473 v1_dot_v2 += v1[i] * v2[i];
478 for (
int i=1; i<= 4; ++i ) {
479 v2[i] -= v1_dot_v2 * v1[i];
484 for (
int i=1; i<= 4; ++i ) v2[i] /= l2;
487 Real tmp1(0.0), tmp2(0.0), tmp12(0.0);
488 for (
int i=1; i<= 4; ++i ) {
489 tmp1 += v1[i] * v1[i];
490 tmp2 += v2[i] * v2[i];
491 tmp12 += v1[i] * v2[i];
493 assert( std::abs(tmp1-1)<1e-3 && std::abs(tmp2-1)<1e-3 && std::abs(tmp12)<1e-3 );
497 for (
int r=1; r<= nrot_to_build-1; ++r ) {
502 Real dot1(0.0), dot2(0.0);
503 for (
int i=1; i<= 4; ++i ) {
504 e[i] = max_rotation - 2*
RG.uniform()*max_rotation;
505 dot1 += e[i] * v1[i];
506 dot2 += e[i] * v2[i];
509 for (
int i=1; i<= 4; ++i ) {
510 if ( tether_bond_distance ) e[i] -= dot1 * v1[i];
511 if ( tether_bond_angle ) e[i] -= dot2 * v2[i];
516 for (
int i=1; i<= 4; ++i ) {
517 dot1 += e[i] * v1[i];
518 dot2 += e[i] * v2[i];
520 if ( tether_bond_distance ) assert( std::abs( dot1 ) < 1e-3 );
521 if ( tether_bond_angle ) assert( tether_bond_distance && std::abs( dot2 ) < 1e-3 );
525 Size const nbb( rsd.n_mainchain_atoms() );
526 for (
int i=1; i<= 4; ++i ) {
528 TorsionID
const id ( ( i==1 ) ? ( TorsionID( seqpos-1,
BB, nbb ) ) : ( TorsionID( seqpos,
BB, i-1 ) ) );
529 TorsionID
const id0( ( i==1 ) ? ( TorsionID( resid-1,
BB, nbb ) ) : ( TorsionID( resid,
BB, i-1 ) ) );
534 TorsionID
const id ( seqpos,
CHI, 1 );
535 TorsionID
const id0( resid,
CHI, 1 );
539 rotamers.push_back( mini_pose.
residue(seqpos).
clone() );
545 assert(
Size(
rot->seqpos()) == resid );
546 rotamers[ rotamers.size() ]->seqpos( resid );
547 rotamers[ rotamers.size() ]->chain(
rot->chain() );
548 rotamers[ rotamers.size() ]->copy_residue_connections( existing_residue );
584 utility::io::izstream lib_stream;
585 basic::database::open( lib_stream,
"rotamer/dna/VQ-DNA-64.rotlib" );
596 for ( ; lib_iter!=library.end(); lib_iter++ )
604 for (
Size ii=1; ii<= new_rotamers.size(); ++ii ) {
618 int const other_resid( couplings[ resid ].first );
619 if ( other_resid && !task.
pack_residue( other_resid ) ) {
621 if ( !matcher( *rot, pose.
residue( other_resid ) ) ) {
626 rotamers.push_back( rot );
631 rotamers.push_back( rot );
642 Real const & center,
Real const & width )
644 using namespace conformation;
645 for (
Size n = 1 ; n <= chi_steps.size(); n++ ) {
647 new_rot->set_chi( 1, center + chi_steps[n] * width );
648 rotamers.push_back( new_rot );
659 using namespace conformation;
660 using namespace scoring::rna;
661 using namespace pack::task;
664 chi_steps.push_back( 0.0 );
672 chi_steps.push_back(1);
673 chi_steps.push_back(-1);
676 chi_steps.push_back(0.5);
677 chi_steps.push_back(-0.5);
680 chi_steps.push_back(1);
681 chi_steps.push_back(2);
682 chi_steps.push_back(-1);
683 chi_steps.push_back(-2);
686 chi_steps.push_back(0.5);
687 chi_steps.push_back(1);
688 chi_steps.push_back(-0.5);
689 chi_steps.push_back(-1);
692 chi_steps.push_back(0.5);
693 chi_steps.push_back(1);
694 chi_steps.push_back(1.5);
695 chi_steps.push_back(2.0);
696 chi_steps.push_back(-0.5);
697 chi_steps.push_back(-1);
698 chi_steps.push_back(-1.5);
699 chi_steps.push_back(-2);
702 chi_steps.push_back(0.33);
703 chi_steps.push_back(0.67);
704 chi_steps.push_back(1);
705 chi_steps.push_back(-0.33);
706 chi_steps.push_back(-0.67);
707 chi_steps.push_back(-1);
710 chi_steps.push_back(0.25);
711 chi_steps.push_back(0.5);
712 chi_steps.push_back(0.75);
713 chi_steps.push_back(1);
714 chi_steps.push_back(1.25);
715 chi_steps.push_back(1.5);
716 chi_steps.push_back(-0.25);
717 chi_steps.push_back(-0.5);
718 chi_steps.push_back(-0.75);
719 chi_steps.push_back(-1);
720 chi_steps.push_back(-1.25);
721 chi_steps.push_back(-1.5);
725 std::cerr <<
"Error in RotamerSet_::set_extrachi_samples, invalid ExtraChiSample type" << std::endl;
730 Gaussian_parameter
const & gaussian_parameter( gaussian_parameter_set[1] );
733 gaussian_parameter.center, gaussian_parameter.width );
737 Gaussian_parameter
const & gaussian_parameter2( gaussian_parameter_set[2] );
740 gaussian_parameter2.center, gaussian_parameter2.width );
753 bool const sample_rna_chi,
bool const & include_current,
757 using namespace pose;
758 using namespace conformation;
760 using namespace pack::task;
767 assert( existing_residue.is_RNA() && concrete_residue->is_RNA() );
791 if ( include_current && sample_rna_chi ) {
794 rotamers.push_back( new_rot );
797 if (!sample_rna_chi && level == 0)
return;
800 if ( delta <= delta_cutoff ) {
818 Size & id_for_current_rotamer
821 using namespace conformation;
837 if ( task.
include_current( resid ) && existing_residue.name() == concrete_residue->name() ) {
839 new_rotamers.push_back( rot );
840 id_for_current_rotamer = new_rotamers.size();
852 Size const n_proton_chi = concrete_residue->n_proton_chi();
854 if ( n_proton_chi > 0 ) {
859 for (
Size ii = 1; ii <= n_proton_chi; ++ii ) {
863 concrete_residue->proton_chi_2_chi( ii ),
866 ii, proton_chi_chisets);
870 Size const number_of_starting_new_rotamers = new_rotamers.size();
871 for (
Size n = 1 ; n <= number_of_starting_new_rotamers; ++n ) {
873 for (
Size ii = 1; ii <= proton_chi_chisets.size(); ++ii ) {
875 new_rotamers.push_back( new_rotamers[n]->
clone() );
876 Size const new_rotamer_number = new_rotamers.size();
878 for (
Size jj = 1; jj <= n_proton_chi; ++jj ) {
880 Size const jj_protchi( concrete_residue->proton_chi_2_chi( jj ) );
881 new_rotamers[ new_rotamer_number ]->set_chi( jj_protchi,
882 proton_chi_chisets[ ii ]->chi[ jj_protchi ] );
900 for (
Size ii=1; ii<= rotamers.size(); ++ii ) {
903 tt <<
"Rotamer at position " << rot->seqpos() << std::endl;
904 tt <<
" of type " << rot->type().name() << std::endl;
906 for(
Size jj=1; jj <= rot->natoms() ; ++jj ){
908 tt <<
"Atom " << rot->atom_name( jj ) <<
" at " << atm.
xyz()[0] <<
" " << atm.
xyz()[1] <<
" " << atm.
xyz()[2] << std::endl;
927 Vector const tp5_O( tp5.
xyz(
"O") ), tp5_atom1( tp5.
xyz( name1 ) ), tp5_atom2( tp5.
xyz( name2 ) );
929 Vector const xyz_midpoint( xyz_O + ( xyz_atom1 - xyz_O ).normalized() + ( xyz_atom2 - xyz_O ).normalized() );
930 Vector const tp5_midpoint( tp5_O + ( tp5_atom1 - tp5_O ).normalized() + ( tp5_atom2 - tp5_O ).normalized() );
936 assert( rot->natoms() == 3 );
937 rot->set_xyz(
"O", xyz_O );
955 using numeric::conversions::degrees;
957 static Real const heavy_atom_cutoff2( 3.3 * 3.3 );
958 Real const min_theta( 90.0 );
959 Real const max_theta( 180.0 );
962 assert( h2o_type.
natoms() == 3 );
965 Vector const & xyz_O( existing_rsd.nbr_atom_xyz() );
978 ir = packer_neighbor_graph->get_node( seqpos )->const_edge_list_begin(),
979 ire = packer_neighbor_graph->get_node( seqpos )->const_edge_list_end();
981 Size const i( (*ir)->get_other_ind( seqpos ) );
982 assert( i != seqpos );
986 for ( chemical::AtomIndices::const_iterator
987 hnum = rsd.Hpos_polar().begin(),
988 hnume = rsd.Hpos_polar().end(); hnum != hnume; ++hnum ) {
989 Vector const &
xyz( rsd.xyz( rsd.atom_base( *hnum ) ) );
990 if ( xyz_O.distance_squared( xyz ) < heavy_atom_cutoff2 ) {
991 donors.push_back( xyz );
996 for ( chemical::AtomIndices::const_iterator
997 anum = rsd.accpt_pos().begin(),
998 anume = rsd.accpt_pos().end(); anum != anume; ++anum ) {
1000 if ( xyz_O.distance_squared(
xyz ) < heavy_atom_cutoff2 ) {
1001 acceptors.push_back(
xyz );
1009 for (
Size i=1; i<= donors.size(); ++i ) {
1010 Vector const & xyz1( donors[i] );
1013 for (
Size j=i+1; j<= donors.size(); ++j ) {
1014 Vector const & xyz2( donors[j] );
1016 Real const theta( degrees( angle_of( xyz1, xyz_O, xyz2 ) ) );
1017 if ( theta > min_theta && theta < max_theta ) {
1025 for (
Size j=1; j<= acceptors.size(); ++j ) {
1026 Vector const & xyz2( acceptors[j] );
1028 Real const theta( degrees( angle_of( xyz1, xyz_O, xyz2 ) ) );
1029 if ( theta > min_theta && theta < max_theta ) {
1039 for (
Size i=1; i<= acceptors.size(); ++i ) {
1040 Vector const & xyz1( acceptors[i] );
1041 for (
Size j=i+1; j<= acceptors.size(); ++j ) {
1042 Vector const & xyz2( acceptors[j] );
1043 Real const theta( degrees( angle_of( xyz1, xyz_O, xyz2 ) ) );
1045 if ( theta > min_theta && theta < max_theta ) {
1054 for (
Size i=1; i<= new_rotamers.size(); ++i ) {
1055 new_rotamers[i]->seqpos( seqpos );
1056 new_rotamers[i]->chain( existing_rsd.chain() );
1061 tt <<
"build_water_rotamers seqpos= " << seqpos <<
" found " << donors.size() <<
" nearby donors, " <<
1062 acceptors.size() <<
" nearby acceptors. Built " << new_rotamers.size() <<
" rotamers." << std::endl;
1085 return ( dxyz + distance * ( hxyz - dxyz ).normalized() );
1098 using numeric::conversions::radians;
1099 using namespace chemical;
1103 Real theta(0.0), step_size(0.0);
1105 phi_steps.push_back( -4 );
1106 phi_steps.push_back( -2 );
1107 phi_steps.push_back( -1 );
1108 phi_steps.push_back( 0 );
1109 phi_steps.push_back( 1 );
1110 phi_steps.push_back( 2 );
1111 phi_steps.push_back( 4 );
1115 theta = 180.0 - 120.0;
1117 phi_list.push_back( 0.0 );
1118 phi_list.push_back( 180.0 );
1121 theta = 180.0 - 109.0;
1123 phi_list.push_back( 120.0 );
1124 phi_list.push_back( 240.0 );
1127 b1_xyz = 0.5 * ( b1_xyz + b2_xyz );
1130 phi_steps.push_back( 0.0 );
1131 phi_list.push_back( 0.0 );
1135 tt <<
"Bad hybridization type for acceptor " << hybrid <<
'\n';
1140 for (
Size i=1; i<= phi_list.size(); ++i ) {
1141 for (
Size j=1; j<= phi_steps.size(); ++j ) {
1142 O_list.push_back( stub.
spherical( radians( phi_list[i] + step_size * phi_steps[j]), radians( theta ), distance));
1161 using namespace scoring::hbonds;
1163 HBondOptions hbondopts;
1165 Real const o12_dis2_cutoff( 25.0 );
1166 Real const hbond_energy_threshold( -0.10 );
1168 Vector const & hatm1_xyz( rsd1.
xyz( hatm1 ) );
1170 Vector const & hatm2_xyz( rsd2.
xyz( hatm2 ) );
1176 Real const o12_dis2( o1.distance_squared( o2 ) );
1177 if ( o1.distance_squared( o2 ) > o12_dis2_cutoff )
return;
1179 assert( nstep >= 2 && nstep%2 == 0 );
1180 for (
Size step=0; step<= nstep; ++step ) {
1183 Vector const xyz_O( o1 + (
Real(step)/nstep) * ( o2 - o1 ) );
1189 Real energy1(0.0), energy2(0.0);
1195 rot->xyz(
"O"), rot->xyz(
"H1"), rot->xyz(
"H2"), energy1 );
1204 rot->xyz(
"O"), rot->xyz(
"H1"), rot->xyz(
"H2"), energy2 );
1206 if ( energy1 > hbond_energy_threshold )
return;
1207 if ( energy2 > hbond_energy_threshold )
return;
1209 tt <<
"hbenergies: dd step= " << step <<
" nstep= " << nstep <<
1210 " E1= " << ObjexxFCL::fmt::F(9,3,energy1) <<
" E2= " << ObjexxFCL::fmt::F(9,3,energy2) <<
1211 " o12_distance= " << ObjexxFCL::fmt::F(9,3,std::sqrt( o12_dis2 )) <<
'\n';
1215 new_waters.push_back( rot );
1232 using namespace scoring::hbonds;
1234 HBondOptions hbondopts;
1236 Real const o12_dis2_cutoff( 25.0 );
1237 Real const hbond_energy_threshold( -0.10 );
1239 Vector const & hatm1_xyz( rsd1.
xyz( hatm1 ) );
1241 Vector const & aatm2_xyz( rsd2.
xyz( aatm2 ) );
1250 for (
Size jj=1; jj<= o2_pos_list.size(); ++jj ) {
1251 Vector const & o2( o2_pos_list[jj] );
1253 Real const o12_dis2( o1.distance_squared( o2 ) );
1254 if ( o1.distance_squared( o2 ) > o12_dis2_cutoff )
continue;
1256 assert( nstep>= 2 && nstep%2 == 0 );
1258 for (
Size step=0; step<= nstep; ++step ) {
1261 Vector const xyz_O( o1 + (
Real(step)/nstep) * ( o2 - o1 ) );
1271 hb_energy_deriv( *hb_database, hbondopts, hbe_type, datm1_xyz, hatm1_xyz,
1272 rot->xyz(
"O"), rot->xyz(
"H1"), rot->xyz(
"H2"), energy1 );
1278 using namespace chemical;
1279 HBEvalTuple
const hbe_type
1281 hb_energy_deriv( *hb_database, hbondopts, hbe_type, rot->xyz(
"O"), rot->xyz(
"H1"),
1282 aatm2_xyz, aatm2_base_xyz, aatm2_base2_xyz, energy2 );
1285 if ( energy1 > hbond_energy_threshold )
continue;
1286 if ( energy2 > hbond_energy_threshold )
continue;
1288 tt <<
"hbenergies: da step= " << step <<
" nstep= " << nstep <<
1289 " E1= " << ObjexxFCL::fmt::F(9,3,energy1) <<
" E2= " << ObjexxFCL::fmt::F(9,3,energy2) <<
1290 " o12_distance= " << ObjexxFCL::fmt::F(9,3,std::sqrt( o12_dis2 )) <<
'\n';
1295 new_waters.push_back( rot );
1297 "EP1",
"H2", tp5 ) );
1332 using namespace scoring::hbonds;
1334 HBondOptions hbondopts;
1336 Real const o12_dis2_cutoff( 25.0 );
1337 Real const hbond_energy_threshold( -0.10 );
1339 Vector const & aatm1_xyz( rsd1.
xyz( aatm1 ) );
1343 Vector const & aatm2_xyz( rsd2.
xyz( aatm2 ) );
1355 for (
Size ii=1; ii<= o1_pos_list.size(); ++ii ) {
1356 Vector const & o1( o1_pos_list[ii] );
1358 for (
Size jj=1; jj<= o2_pos_list.size(); ++jj ) {
1359 Vector const & o2( o2_pos_list[jj] );
1361 Real const o12_dis2( o1.distance_squared( o2 ) );
1362 if ( o1.distance_squared( o2 ) > o12_dis2_cutoff )
continue;
1364 assert( nstep>= 2 && nstep%2 == 0 );
1366 for (
Size step=0; step<= nstep; ++step ) {
1369 Vector const xyz_O( o1 + (
Real(step)/nstep) * ( o2 - o1 ) );
1376 Real energy1(0.0), energy2( 0.0 );
1379 using namespace chemical;
1381 hb_energy_deriv( *hb_database, hbondopts, hbe_type, rot->xyz(
"O"), rot->xyz(
"H1"),
1382 aatm1_xyz, aatm1_base_xyz, aatm1_base2_xyz, energy1 );
1386 using namespace chemical;
1387 HBEvalTuple
const hbe_type
1389 hb_energy_deriv( *hb_database, hbondopts, hbe_type, rot->xyz(
"O"), rot->xyz(
"H2"),
1390 aatm2_xyz, aatm2_base_xyz, aatm2_base2_xyz, energy2 );
1393 if ( energy1 > hbond_energy_threshold )
continue;
1394 if ( energy2 > hbond_energy_threshold )
continue;
1396 tt <<
"hbenergies: aa step= " << step <<
" nstep= " << nstep <<
1397 " E1= " << ObjexxFCL::fmt::F(9,3,energy1) <<
" E2= " << ObjexxFCL::fmt::F(9,3,energy2) <<
1398 " o12_distance= " << ObjexxFCL::fmt::F(9,3,std::sqrt( o12_dis2 )) <<
'\n';
1403 new_waters.push_back( rot );
1413 Size const anchor_atom,
1422 Real const dis2_cutoff( 36.0 );
1426 tt <<
"build_moving_O_bridge_waters " << rsd1.
seqpos() <<
' ' << rsd1.
name() <<
' ' << rsd2.
seqpos() <<
1427 ' ' << rsd2.
name() <<
'\n';
1431 Vector const & anchor_xyz( rsd1.
xyz( anchor_atom ) );
1436 for ( chemical::AtomIndices::const_iterator
1438 hnume = rsd2.
Hpos_polar().end(); hnum != hnume; ++hnum ) {
1439 Size const hatm( *hnum );
1441 if ( rsd2.
xyz( hatm ).distance_squared( anchor_xyz ) > dis2_cutoff )
continue;
1443 Size const old_size( new_rotamers.size() );
1445 if ( anchor_is_donor ) {
1451 if ( new_rotamers.size() > old_size ) {
1452 tt <<
"built " << new_rotamers.size() - old_size <<
" rotamers between " <<
1460 for ( chemical::AtomIndices::const_iterator
1462 anume = rsd2.
accpt_pos().end(); anum != anume; ++anum ) {
1463 Size const aatm( *anum );
1465 if ( rsd2.
xyz( aatm ).distance_squared( anchor_xyz ) > dis2_cutoff )
continue;
1467 Size const old_size( new_rotamers.size() );
1469 if ( anchor_is_donor ) {
1475 if ( new_rotamers.size() > old_size ) {
1476 tt <<
"built " << new_rotamers.size() - old_size <<
" rotamers between " <<
1498 using numeric::conversions::degrees;
1500 assert( h2o_type.
natoms() == 3 );
1503 if ( nstep < 2 ) nstep = 2;
1504 if ( nstep%2 == 1 ) ++nstep;
1512 tt <<
"build_moving_O_water_rotamers_dependent: anchor_pos= " << i <<
'\n';
1522 for (
Size ii=1; ii<= rotset->num_rotamers(); ++ii ) {
1523 rsd1_list.push_back( rotset->rotamer(ii)() );
1526 rsd1_list.push_back( &(pose.
residue(i) ) );
1535 jr = packer_neighbor_graph->get_node( i )->const_edge_list_begin(),
1536 jre = packer_neighbor_graph->get_node( i )->const_edge_list_end();
1538 Size const j( (*jr)->get_other_ind( i ) );
1551 for (
Size jj=1; jj<= rotset->num_rotamers(); ++jj ) {
1552 rsd2_list.push_back( rotset->rotamer(jj)() );
1555 rsd2_list.push_back( &(pose.
residue(j) ) );
1562 for (
Size ii=1; ii<= rsd1_list.size(); ++ii ) {
1563 Residue const & rsd1( *rsd1_list[ii] );
1567 for (
Size jj=1; jj<= rsd2_list.size(); ++jj ) {
1587 using numeric::conversions::degrees;
1589 assert( h2o_type.
natoms() == 3 );
1592 if ( nstep < 2 ) nstep = 2;
1593 if ( nstep%2 == 1 ) ++nstep;
1597 tt <<
"build_moving_O_water_rotamers_independent: anchor_pos= " << i <<
'\n';
1614 jr = packer_neighbor_graph->get_node( i )->const_edge_list_begin(),
1615 jre = packer_neighbor_graph->get_node( i )->const_edge_list_end();
1617 Size const j( (*jr)->get_other_ind( i ) );
1632 Size const seqpos_water,
1643 tt <<
"water " << seqpos_water <<
" nbrs:";
1645 jr = packer_neighbor_graph->get_node( seqpos_water )->const_edge_list_begin(),
1646 jre = packer_neighbor_graph->get_node( seqpos_water )->const_edge_list_end();
1648 tt <<
' ' << (*jr)->get_other_ind( seqpos_water );
1659 packer_neighbor_graph, new_rotamers );
1671 Size const seqpos_water,
1686 packer_neighbor_graph, new_rotamers );