34 #include <basic/Tracer.hh>
35 #include <basic/datacache/CacheableData.hh>
36 #include <basic/datacache/DataCache.hh>
40 #include <basic/options/option.hh>
41 #include <basic/options/keys/pb_potential.OptionKeys.gen.hh>
44 #include <numeric/xyzVector.hh>
45 #include <utility/vector1.hh>
48 static basic::Tracer
TR(
"core.scoring.methods.PoissonBoltzmannEnergy");
63 basic::datacache::CacheableDataOP
86 std::map<std::string, bool> &
154 if( basic::options::option[basic::options::OptionKeys::pb_potential::epsilon].user() ) {
155 epsilon_ = basic::options::option[basic::options::OptionKeys::pb_potential::epsilon];
173 using namespace methods;
178 TR <<
"PB_LIFETIME_CACHE object is not initialized. Did you call SetupPoissonBoltzmannPotential mover? Terminaing the program..." << std::endl;
193 = basic::options::option[basic::options::OptionKeys::pb_potential::charged_chains];
194 std::map<std::string, bool> charged_residues;
195 TR <<
"Charged residues: [ ";
198 bool residue_charged =
false;
199 if ( std::find(charged_chains.begin(), charged_chains.end(), rsd.chain()) != charged_chains.end() ) {
200 residue_charged =
true;
201 TR << rsd.type().name() <<
",";
206 TR <<
"]" << std::endl;
210 std::string energy_state = cached_data->get_energy_state();
212 if( energy_state ==
"" ) {
213 energy_state =
"stateless";
215 TR <<
"Energy state: \"" << energy_state <<
"\" for scorefxn: " << scorefxn.
get_name() << std::endl;
217 const Size atom_index = 2;
223 if( cached_data->has_cache( energy_state ) ) {
230 TR <<
"Found cached pose for state: " << energy_state << std::endl;
233 if( energy_state == emoptions.pb_bound_tag() ) {
236 TR <<
"Atoms (" << atom_index <<
") in charged chains moved more than " ;
243 TR <<
"No cached pose for state: " << energy_state << std::endl;
269 bool create_new_lre_container(
false );
271 if ( energies.long_range_container( lr_type ) == 0 ) {
272 create_new_lre_container =
true;
278 create_new_lre_container =
true;
282 if ( create_new_lre_container ) {
283 TR <<
"Creating new one-to-all energy container (" << pose.
total_residue() <<
")" << std::endl;
285 energies.set_long_range_container( lr_type, new_dec );
321 for (
Size ichain=1; ichain<=chains.size(); ++ichain) {
322 if (rsd.
chain() == chains[ichain])
return true;
332 utility::vector1 <Size> chains = basic::options::option[basic::options::OptionKeys::pb_potential::revamp_near_chain]();
340 bool found_neighbor =
false;
345 if (distance < threshold) {
346 neighbor_count += 1.;
347 found_neighbor =
true;
351 if (found_neighbor)
break;
373 if(
const_cast<std::map<std::string, bool>&
>(
charged_residues_)[rsd.type().name()] ) {
377 Real PB_score_residue, PB_score_backbone, PB_score_sidechain;
378 Real PB_burial_weight(1.0);
379 if (basic::options::option[basic::options::OptionKeys::pb_potential::revamp_near_chain].user()) {
389 if (basic::options::option[basic::options::OptionKeys::pb_potential::sidechain_only]()) {
390 emap[
PB_elec ] += PB_score_sidechain;
393 emap[
PB_elec ] += PB_score_residue;
425 if( &pose1 == NULL || &pose2 == NULL ) {
428 if( &pose1 == NULL && &pose2 == NULL ) {
449 const Real delta = xyz1.distance(xyz2);