Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScoringManager.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 sw=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/ScoringManager.cc
11 /// @brief Scoring manager class
12 /// @author Andrew Leaver-Fay (leaverfa@email.unc.edu)
13 
14 // Unit headers
16 
17 #include <basic/options/option.hh>
18 #include <basic/options/keys/score.OptionKeys.gen.hh>
19 // AUTO-REMOVED #include <basic/options/keys/orbitals.OptionKeys.gen.hh>
20 
29 //#include <core/pack/dunbrack/RotamerLibrary.hh>
30 //#include <core/pack/dunbrack/RotamericSingleResidueDunbrackLibrary.hh>
31 //#include <core/pack/dunbrack/RotamericSingleResidueDunbrackLibrary.tmpl.hh>
36 #include <core/scoring/AtomVDW.hh>
46 #include <core/scoring/P_AA.hh>
53 
54 // Package headers
58 
64 
68 
69 #include <core/scoring/types.hh>
71 
73 
74 #include <basic/database/open.hh>
75 
76 
77 // Utility headers
78 #include <utility/string_util.hh>
79 
81 #include <utility/vector1.hh>
82 
83 
84 namespace core {
85 namespace scoring {
86 
87 
88 ///////////////////////////////////////////////////////////////////////////////
89 ScoringManager* ScoringManager::instance_( 0 );
90 
91 ///////////////////////////////////////////////////////////////////////////////
92 //singleton class
93 /// SAFE singleton initialization; static from within a function ensures
94 /// proper load-time behavior
96 {
97  if ( instance_ == 0 ) {
98  instance_ = new ScoringManager();
99  }
100  return instance_;
101 }
102 
103 
105 
106 ///////////////////////////////////////////////////////////////////////////////
108  pairE_potential_( 0 ),
109  rama_( 0 ),
110  rama2b_( 0 ),
111  omega_( 0 ),
112  env_pair_potential_( 0 ),
113  smooth_env_pair_potential_( 0 ),
114  cen_hb_potential_( 0 ),
115  secondary_structure_potential_( 0 ),
116  atom_vdw_(),
117  rna_atom_vdw_( 0 ),
118  occ_hbond_sol_database_( 0 ),
119  dna_dr_potential_( 0 ),
120  mm_lj_library_( 0 ),
121  mm_lj_energy_table_( 0 ),
122  mm_torsion_library_( 0 ),
123  mm_bondangle_library_( 0 ),
124  dnabform_( 0 ),
125  dna_torsion_potential_( 0 ),
126  DNA_base_potential_( 0 ),
127  carbon_hbond_potential_( 0 ),
128  rna_low_resolution_potential_( 0 ),
129  rna_torsion_potential_( 0 ),
130  rna_chemical_shift_potential_( 0 ),
131  p_aa_( 0 ),
132  water_adduct_hbond_potential_( 0 ),
133  gen_born_potential_( 0 ),
134  fa_disulfide_potential_( 0 ),
135  cen_disulfide_potential_( 0 ),
136  disulfide_matching_potential_( 0 ),
137  membrane_potential_( 0 ),
138  membrane_fapotential_( 0 ), //pba
139  PB_potential_(0),
140  unf_state_( 0 ),
141  NV_lookup_table_(0),
142  orbitals_lookup_table_( 0 ),
143  DDP_lookup_table_(0),
144  method_creator_map_( n_score_types, 0 )
145 {}
146 
147 ///////////////////////////////////////////////////////////////////////////////
148 PairEPotential const &
150 {
151  if (pairE_potential_ == 0 )
152  {
154  }
155  return *pairE_potential_;
156 }
157 
158 /// @details The ScoringManager acts as an EnergyMethodFactory. All EnergyMethods must
159 /// create a helper class, an EnergyMethodCreator class, that will respond to a call to
160 /// its create_energy_method by returning a new instance of that EnergyMethod its helping.
161 /// This Creator class must also register itself with the ScoringManager at load time and
162 /// hand an instance of itself to the singleton ScoringManager instance.
163 void
165 {
166  ScoreTypes sts = creator->score_types_for_method();
167  for ( Size ii = 1; ii <= sts.size(); ++ii ) {
168  ///std::cout << "Registering " << (int) sts[ ii ] << " to " << creator() << std::endl;
169  // make sure no two EnergyMethodCreators lay claim to the same ScoreType
170  if ( method_creator_map_[ sts[ ii ] ] != 0 ) {
171  utility_exit_with_message( "Cannot register a term to two different EnergyMethodCreators. Term " + utility::to_string( sts[ ii ] ) + " has already been registered!" );
172  }
173  method_creator_map_[ sts[ ii ] ] = creator;
174  }
175 }
176 
177 
178 ///////////////////////////////////////////////////////////////////////////////
181 {
182  if (DNA_base_potential_ == 0 )
183  {
185  }
186  return *DNA_base_potential_;
187 }
188 
189 ///////////////////////////////////////////////////////////////////////////////
190 EnvPairPotential const &
192 {
193  if (env_pair_potential_ == 0 )
194  {
196  }
197  return *env_pair_potential_;
198 }
199 
200 ///////////////////////////////////////////////////////////////////////////////
203 {
204  if (smooth_env_pair_potential_ == 0 )
205  {
207  }
209 }
210 
211 ///////////////////////////////////////////////////////////////////////////////
212 CenHBPotential const &
214 {
215  if (cen_hb_potential_ == 0 )
216  {
218  }
219  return *cen_hb_potential_;
220 }
221 
222 ///////////////////////////////////////////////////////////////////////////////
223 MembranePotential const &
225 {
226  if (membrane_potential_ == 0 )
227  {
229  }
230  return *membrane_potential_;
231 }
232 
233 ///////////////////////////////////////////////////////////////////////////////
234 Membrane_FAPotential const &
236 {
237  if (membrane_fapotential_ == 0 )
238  {
240  }
241  return *membrane_fapotential_;
242 }
243 
244 ///////////////////////////////////////////////////////////////////////////////
247 {
249  {
251  }
253 }
254 
255 ///////////////////////////////////////////////////////////////////////////////
256 GenBornPotential const &
258 {
259  if (gen_born_potential_ == 0 )
260  {
262  }
263  return *gen_born_potential_;
264 }
265 
266 ///////////////////////////////////////////////////////////////////////////////
269 {
270  if ( PB_potential_ == 0 )
271  {
273  }
274  return *PB_potential_;
275 }
276 
277 ///////////////////////////////////////////////////////////////////////////////
278 AtomVDW const &
279 ScoringManager::get_AtomVDW( std::string const & atom_type_set_name ) const
280 {
281  if ( atom_vdw_.count( atom_type_set_name ) == 0 ) {
282  atom_vdw_[ atom_type_set_name ] = new AtomVDW( atom_type_set_name );
283  }
284  return * ( atom_vdw_[ atom_type_set_name ] );
285 }
286 
287 ///////////////////////////////////////////////////////////////////////////////
290 {
291  if (carbon_hbond_potential_ == 0 )
292  {
294  }
295  return *carbon_hbond_potential_;
296 }
297 
298 ///////////////////////////////////////////////////////////////////////////////
299 rna::RNA_AtomVDW const &
301 {
302  if (rna_atom_vdw_ == 0 )
303  {
305  }
306  return *rna_atom_vdw_;
307 }
308 
309 ///////////////////////////////////////////////////////////////////////////////
311 ScoringManager::get_DatabaseOccSolEne( std::string const & atom_type_set_name, Real const & min_occ_energy ) const
312 {
313  if (occ_hbond_sol_database_ == 0 )
314  {
315  occ_hbond_sol_database_ = new geometric_solvation::DatabaseOccSolEne( atom_type_set_name, min_occ_energy );
316  }
317  return *occ_hbond_sol_database_;
318 }
319 
320 ///////////////////////////////////////////////////////////////////////////////
323 {
325  {
327  }
329 }
330 
331 ///////////////////////////////////////////////////////////////////////////////
334 {
335  if (rna_torsion_potential_ == 0 )
336  {
338  }
339  return *rna_torsion_potential_;
340 }
341 
342 ///////////////////////////////////////////////////////////////////////////////
345 {
347  {
349  }
351 }
352 
353 ///////////////////////////////////////////////////////////////////////////////
356 {
357  if (dna_dr_potential_ == 0 )
358  {
360  }
361  return *dna_dr_potential_;
362 }
363 
364 P_AA const &
366 {
367  if ( p_aa_ == 0 ) {
368  p_aa_ = new P_AA;
369  }
370  return *p_aa_;
371 }
372 
375 {
376  if ( water_adduct_hbond_potential_ == 0 ) {
378  }
380 }
381 
382 
383 /////////////////////////////////////
384 //////////////////////////////
385 ////////////
386 //ScoringManager::RotamerLibrary &
387 //ScoringManager::get_RotamerLibrary() const
388 //{
389 // if (rotamer_Library_ == 0 )
390 // {
391 // rotamer_Library_ = new RotamerLibrary();
392 // read_dunbrack_library( *rotamer_Library_ );
393 // }
394 // return *rotamer_Library_;
395 //}
396 
397 ///////////////////////////////////////////////////////////////////////////////
398 Ramachandran const &
400 {
401  if ( rama_ == 0 )
402  {
403  rama_ = new Ramachandran;
404  }
405  return *rama_;
406 }
407 
408 ///////////////////////////////////////////////////////////////////////////////
409 Ramachandran2B const &
411 {
412  if ( rama2b_ == 0 )
413  {
414  rama2b_ = new Ramachandran2B;
415  }
416  return *rama2b_;
417 }
418 
419 ///////////////////////////////////////////////////////////////////////////////
420 OmegaTether const &
422 {
423  if ( omega_ == 0 )
424  {
425  omega_ = new OmegaTether();
426  }
427  return *omega_;
428 }
429 
430 ///////////////////////////////////////////////////////////////////////////////
433 {
434  if( dnabform_ == 0 )
435  {
437  }
438  return *dnabform_;
439 }
440 
441 ///////////////////////////////////////////////////////////////////////////////
442 
445 {
446  if (dna_torsion_potential_ == 0 )
447  {
449  }
450  return *dna_torsion_potential_;
451 }
452 
453 ///////////////////////////////////////////////////////////////////////////////
456 {
457  if ( mm_torsion_library_ == 0 )
458  {
460  ( basic::database::full_name( "chemical/mm_atom_type_sets/fa_standard/mm_torsion_params.txt" ),
462  }
463  return *mm_torsion_library_;
464 }
465 ///////////////////////////////////////////////////////////////////////////////
466 
469 {
470  if ( mm_lj_library_ == 0 )
471  {
474  }
475  return *mm_lj_library_;
476 }
477 
478 ///////////////////////////////////////////////////////////////////////////////
479 
482 {
483  if ( mm_lj_energy_table_ == 0 )
484  {
486  }
487  return *mm_lj_energy_table_;
488 }
489 
490 ///////////////////////////////////////////////////////////////////////////////
491 
494 {
495  if ( fa_disulfide_potential_ == 0 ) {
497  }
498  return *fa_disulfide_potential_;
499 }
500 
503 {
504  if ( cen_disulfide_potential_ == 0 ) {
506  }
507  return *cen_disulfide_potential_;
508 }
509 
512 {
513  if ( disulfide_matching_potential_ == 0 ) {
515  }
517 }
518 
519 ///////////////////////////////////////////////////////////////////////////////
520 
521 
522 nv::NVlookup const &
524 {
525  if(NV_lookup_table_ == 0)
526  {
527  using namespace basic::options;
528  using namespace basic::options::OptionKeys;
529  NV_lookup_table_ = new nv::NVlookup(basic::database::full_name(option[score::NV_table]()));
530  }
531  return *NV_lookup_table_;
532 
533 }
534 
535 ///////////////////////////////////////////////////////////////////////////////
538  {
539  if(orbitals_lookup_table_ == 0){
540  using namespace basic::options;
541  using namespace basic::options::OptionKeys;
542  utility::vector1<std::string> DHO_energies;
543  utility::vector1< std::string > AOH_energies;
544  utility::vector1< std::string > AOO_orb_orb_energies;
545  utility::vector1< std::string > DOO_orb_orb_energies;
546  utility::vector1< std::string > ACO_energies;
547 
548  DHO_energies.push_back("scoring/score_functions/orbitals/BiCubic_DHO_Hpol_scOrbH.txt");//DHO_energies[1]
549  DHO_energies.push_back("scoring/score_functions/orbitals/BiCubic_DHO_Hpol_bbOrbH.txt");//DHO_energies[2]
550  DHO_energies.push_back("scoring/score_functions/orbitals/BiCubic_DHO_Haro_scOrbH.txt");//DHO_energies[3]
551 
552  AOH_energies.push_back("scoring/score_functions/orbitals/BiCubic_AOH_Hpol_scOrbH.txt");//AOH_energies[1]
553  AOH_energies.push_back("scoring/score_functions/orbitals/BiCubic_AOH_Hpol_bbOrbH.txt");//AOH_energies[2]
554  AOH_energies.push_back("scoring/score_functions/orbitals/BiCubic_AOH_Haro_scOrbH.txt");//AOH_energies[3]
555 
556  AOO_orb_orb_energies.push_back("scoring/score_functions/orbitals/BiCubic_AOD_OrbOrb.txt");
557  DOO_orb_orb_energies.push_back("scoring/score_functions/orbitals/BiCubic_DOA_OrbOrb.txt");
558 
559 
560  ACO_energies.push_back("scoring/score_functions/orbitals/BiCubic_ACO.txt");
561 
563  DHO_energies, AOH_energies, AOO_orb_orb_energies, DOO_orb_orb_energies,ACO_energies );
564 
565  }
566  return *orbitals_lookup_table_;
567  }
568 
569 
570 
571 
572 ///////////////////////////////////////////////////////////////////////////////
573 
574 
575 interface::DDPlookup const &
577 {
578  if(DDP_lookup_table_ == 0)
579  {
580  using namespace basic::options;
581  using namespace basic::options::OptionKeys;
582  DDP_lookup_table_ = new interface::DDPlookup("scoring/score_functions/DDPscore/interface_ddp_score.txt");
583  }
584  return *DDP_lookup_table_;
585 }
586 
587 ///////////////////////////////////////////////////////////////////////////////
590 {
591  if ( mm_bondangle_library_ == 0 )
592  {
594  ( basic::database::full_name( "chemical/mm_atom_type_sets/fa_standard/par_all27_prot_na.prm" ),
596  }
597  return *mm_bondangle_library_;
598 }
599 
600 ///////////////////////////////////////////////////////////////////////////////
603 {
604  if ( mm_bondlength_library_ == 0 )
605  {
607  ( basic::database::full_name( "chemical/mm_atom_type_sets/fa_standard/par_all27_prot_na.prm" ),
609  }
610  return *mm_bondlength_library_;
611 }
612 
613 ///////////////////////////////////////////////////////////////////////////////
616 {
617  if ( unf_state_ == 0 ) {
618  if ( type == UNFOLDED_SCORE12 ) {
619  unf_state_ = new UnfoldedStatePotential( basic::database::full_name( "scoring/score_functions/unfolded/unfolded_state_residue_energies_score12" ) );
620  } else if ( type == UNFOLDED_MM_STD ) {
621  unf_state_ = new UnfoldedStatePotential( basic::database::full_name( "scoring/score_functions/unfolded/unfolded_state_residue_energies_mm_std" ) );
622  } else if ( type == UNFOLDED_RNA ) {
623  unf_state_ = new UnfoldedStatePotential( basic::database::full_name( "scoring/score_functions/unfolded/unfolded_state_residue_energies_rna" ) ); // This will later get more elaborated
624  } else {
625  utility_exit_with_message("unrecognized unfolded type: "+type );
626  }
627  }
628  return *unf_state_;
629 }
630 
631 ///////////////////////////////////////////////////////////////////////////////
632 void
634 {
635  assert( etables_.count(name) == 0 );
636  etables_[ name ] = etable;
637 }
638 
639 //XRW_B_T1
640 /*
641 ///////////////////////////////////////////////////////////////////////////////
642 void
643 ScoringManager::add_coarse_etable( std::string const &name, coarse::CoarseEtableOP etable )
644 {
645  assert( coarse_etables_.count(name) == 0);
646  coarse_etables_ [name] = etable;
647 }
648 */
649  //XRW_E_T1
650 
651 ///////////////////////////////////////////////////p////////////////////////////
652 void
654 {
655  assert( memb_etables_.count(name) == 0 );
656  memb_etables_[ name ] = etable;
657 }
658 
659 ///////////////////////////////////////////////////////////////////////////////
661 ScoringManager::memb_etable( std::string const & table_id ) const //pba
662 {
663  using namespace etable;
664 
665  if ( memb_etables_.find( table_id ) == memb_etables_.end() ) {
666  // try to build if possible
667  if ( table_id == FA_STANDARD_DEFAULT ) {
668  MembEtableOP etable_ptr
669  ( new MembEtable( chemical::ChemicalManager::get_instance()->atom_type_set( chemical::FA_STANDARD ),
670  EtableOptions() ) );
671  memb_etables_[ table_id ] = etable_ptr;
672  } else {
673  std::string msg = "unrecognized etable: "+table_id;
674  utility_exit_with_message( msg );
675  }
676  }
677  return (memb_etables_.find( table_id )->second)();
678 }
679 
680 ///////////////////////////////////////////////////////////////////////////////
682 ScoringManager::etable( std::string const & table_id ) const
683 {
684  using namespace etable;
685 
686  if ( etables_.find( table_id ) == etables_.end() ) {
687  // try to build if possible
688  if ( table_id == FA_STANDARD_DEFAULT ) {
689  EtableOP etable_ptr
690  ( new Etable( chemical::ChemicalManager::get_instance()->atom_type_set( chemical::FA_STANDARD ),
691  EtableOptions() ) );
692  etables_[ table_id ] = etable_ptr;
693  } else if ( table_id == FA_STANDARD_SOFT ) {
694  // soft rep etable: modified radii and also change to lj_switch_dis2sigma
695  EtableOptions options;
696  options.lj_switch_dis2sigma = 0.91;
697  EtableOP etable_ptr
698  ( new Etable( chemical::ChemicalManager::get_instance()->atom_type_set( chemical::FA_STANDARD ),
699  options, "SOFT" ) );
700  etables_[ table_id ] = etable_ptr;
701 
702  } else if ( table_id.substr(0, FA_STANDARD_DEFAULT.size() + 1 ) == FA_STANDARD_DEFAULT+"_" ) {
703  // note we check for soft rep 1st since that would match this as well -- confusing??
704  // apply a modification of the radii/wdepths
705  std::string const alternate_parameters( table_id.substr( FA_STANDARD_DEFAULT.size() + 1 ) );
706  EtableOP etable_ptr
707  ( new Etable( chemical::ChemicalManager::get_instance()->atom_type_set( chemical::FA_STANDARD ),
708  EtableOptions(), alternate_parameters ) );
709  etables_[ table_id ] = etable_ptr;
710 
711  } else {
712  std::cout << "1:" << table_id.substr(0, FA_STANDARD_DEFAULT.size() + 1 ) << '\n' <<
713  "2:" << FA_STANDARD_DEFAULT+"_" << std::endl;
714  utility_exit_with_message("unrecognized etable: "+table_id );
715  }
716  }
717  return (etables_.find( table_id )->second)();
718 }
719 
720 
721 ///////////////////////////////////////////////////////////////////////////////
722 ///////////////////////////////////////////////////////////////////////////////
723 //XRW_B_T1
724 /*
725 coarse::CoarseEtableCAP
726 ScoringManager::coarse_etable( std::string const & table_id ) const
727 {
728  using namespace etable;
729  if ( coarse_etables_.find( table_id ) == coarse_etables_.end() ) {
730  // try to build if possible
731  if ( table_id == chemical::COARSE_TWO_BEAD ) {
732  coarse::CoarseEtableOP etable_ptr
733  ( new coarse::CoarseEtable(
734  chemical::ChemicalManager::get_instance()->
735  atom_type_set( chemical::COARSE_TWO_BEAD ), chemical::COARSE_TWO_BEAD )
736  );
737  coarse_etables_[ table_id ] = etable_ptr;
738  } else {
739  std::string msg = "unrecognized etable: "+table_id;
740  utility_exit_with_message( msg );
741  }
742  }
743  return (coarse_etables_.find( table_id )->second)();
744 }
745 */
746  //XRW_E_T1
747 
748 ///////////////////////////////////////////////////////////////////////////////
749 /// alot of this was pulled from RotamerLibrary.cc
750 /*pack::dunbrack::SingleResidueRotamerLibraryCAP
751 ScoringManager::get_NCAARotamerLibrary( chemical::ResidueType const & rsd_type )
752 {
753  using namespace pack::dunbrack;
754 
755  // get some info about amino acid type
756  std::string aa_name3( rsd_type.name3() );
757  Size n_rotlib_chi( rsd_type.nchi() - rsd_type.n_proton_chi() );
758  chemical::AA aan( rsd_type.aa() );
759  bool dun02( true );
760 
761  if ( ncaa_rotlibs_.find( aa_name3 ) == ncaa_rotlibs_.end() ) {
762 
763  // create izstream from path
764  std::string dir_name = basic::database::full_name( "/rotamer/ncaa_rotlibs/" );
765  std::string file_name = rsd_type.get_ncaa_rotlib_path();
766  utility::io::izstream rotlib_in( dir_name + file_name );
767  std::cout << "Reading in rot lib " << dir_name + file_name << "...";
768 
769  // get an instance of RotamericSingleResidueDunbrackLibrary, but need a RotamerLibrary to do it
770  // this means that when ever you read in the NCAA libraries you will also read in the Dunbrack libraries
771  // this may need to be a pointer to the full type and not just a SRRLOP
772  std::string empty_string("");
773 
774  // this comes almost directally from RotmerLibrary.cc::create_rotameric_dunlib()
775  SingleResidueRotamerLibraryOP ncaa_rotlib;
776  RotamericSingleResidueDunbrackLibrary< ONE > * r1;
777  RotamericSingleResidueDunbrackLibrary< TWO > * r2;
778  RotamericSingleResidueDunbrackLibrary< THREE > * r3;
779  RotamericSingleResidueDunbrackLibrary< FOUR > * r4;
780 
781  switch ( n_rotlib_chi ) {
782  case 1:
783  r1 = new RotamericSingleResidueDunbrackLibrary< ONE >( aan, dun02 );
784  r1->set_n_chi_bins( rsd_type.get_ncaa_rotlib_n_bin_per_rot() );
785  r1->read_from_file( rotlib_in, false );
786  ncaa_rotlib = r1; break;
787  case 2:
788  r2 = new RotamericSingleResidueDunbrackLibrary< TWO >( aan, dun02 );
789  r2->set_n_chi_bins( rsd_type.get_ncaa_rotlib_n_bin_per_rot() );
790  r2->read_from_file( rotlib_in, false );
791  ncaa_rotlib = r2; break;
792  case 3:
793  r3 = new RotamericSingleResidueDunbrackLibrary< THREE >( aan, dun02 );
794  r3->set_n_chi_bins( rsd_type.get_ncaa_rotlib_n_bin_per_rot() );
795  r3->read_from_file( rotlib_in, false );
796  ncaa_rotlib = r3; break;
797  case 4:
798  r4 = new RotamericSingleResidueDunbrackLibrary< FOUR >( aan, dun02 );
799  r4->set_n_chi_bins( rsd_type.get_ncaa_rotlib_n_bin_per_rot() );
800  r4->read_from_file( rotlib_in, false );
801  ncaa_rotlib = r4; break;
802  default:
803  utility_exit_with_message( "ERROR: too many chi angles desired for ncaa library: " + n_rotlib_chi );
804  break;
805  }
806 
807  // add new rotamer library to map
808  ncaa_rotlibs_[ aa_name3 ] = ncaa_rotlib;
809  std::cout << "done!" << std::endl;
810  }
811  return ( ncaa_rotlibs_.find( aa_name3 )->second)();
812 }*/
813 
814 ///////////////////////////////////////////////////////////////////////////////
815 
816 /// @details When a ScoreFunction the weight for a particular ScoreType set from 0
817 /// to some non-zero value, it will request an instance of the EnergyMethod class
818 /// that is responsible for calculating that ScoreType. The ScoringManager responds
819 /// to that request by asking the EnergyMethodCreator that has claimed responsibility
820 /// for this ScoreType for a new instance. EnergyMethodCreators must first have
821 /// registered themselves with the ScoringManager. This should have been done at
822 /// load time, using a static-variable-initialization function call.
823 /// See src/core/scoring/etable/EtableEnergy.cc for an example of how the
824 /// EtableEnergyCreator class registers itself with the ScoringManager.
827  ScoreType const & score_type,
828  methods::EnergyMethodOptions const & options
829 ) const
830 {
831  if ( score_type > n_score_types ) {
832  /// Inactive score type requested. The program must be recompiled such that the desired score type
833  /// appears before the n_score_types element in the ScoreType enumeration. The program must now quit
834  /// or it will later produce a segmentation fault when the EnergyMethod responsible for this term
835  /// attempts to write into an EnergyMap object at a position that the EnergyMap has not allocated space
836  /// for.
837  std::cerr << "Critical error in ScoringManager::energy_method().\nRequested an inactive score_type '" << score_type;
838  std::cerr << "' defined at position " << (int) score_type << " in the ScoreType enumeration.\n";
839  std::cerr << "Active score types must appear before the n_score_types element ";
840  std::cerr << "(at position " << (int) n_score_types << ") as this element marks the end of the active score types.\n";
841  std::cerr << "Rosetta must be recompiled after src/core/scoring/ScoreType.hh is modified to include " << score_type;
842  std::cerr << " as an active score type." << std::endl;
843  utility_exit_with_message( "ERROR: Attempted to use an inactive score type" );
844  }
845 
846  if ( score_type == python ) return 0; /// python special case; this could now be changed...
847 
848  if ( method_creator_map_[ score_type ] == 0 ) {
849  utility_exit_with_message( "Requested ScoreType " + utility::to_string( score_type ) + " does not have a registered EnergyMethodCreator." );
850  }
851 
852  return method_creator_map_[ score_type ]->create_energy_method( options );
853 
854  /* OLD WAY
855  using namespace methods;
856  switch( score_type ) {
857  case fa_atr:
858  case fa_rep:
859  case fa_sol:
860  case fa_intra_atr:
861  case fa_intra_rep:
862  case fa_intra_sol:
863  return new etable::EtableEnergy( *etable( options.etable_type() ), options );
864  case lk_hack:
865  return new methods::LK_hack( *etable( options.etable_type() ));
866  case lk_costheta:
867  case lk_polar:
868  case lk_nonpolar:
869  return new methods::LK_CosThetaEnergy( *etable( options.etable_type() ));
870  case fa_mbenv: //pba
871  return new methods::Fa_MbenvEnergy( *memb_etable( options.etable_type() ));
872  case fa_mbsolv: //pba
873  return new methods::Fa_MbsolvEnergy( *etable( options.etable_type() ), *memb_etable( options.etable_type() ));
874  case coarse_fa_atr:
875  case coarse_fa_rep:
876  case coarse_fa_sol:
877  case coarse_beadlj:
878  return new etable::CoarseEtableEnergy( *etable( options.etable_type() ), options,
879  coarse_etable( chemical::COARSE_TWO_BEAD ) );
880  case hbond_lr_bb:
881  case hbond_sr_bb:
882  case hbond_bb_sc:
883  case hbond_sr_bb_sc:
884  case hbond_lr_bb_sc:
885  case hbond_sc:
886  return new hbonds::HBondEnergy( options.hbond_options() );
887  case ch_bond:
888  case ch_bond_sc_sc:
889  case ch_bond_bb_sc:
890  case ch_bond_bb_bb:
891  return new hbonds::CarbonHBondEnergy();
892  case geom_sol:
893  return new hbonds::GeometricSolEnergy( options );
894  case occ_sol_fitted:
895  return new geometric_solvation::OccludedHbondSolEnergy( options );
896  case occ_sol_fitted_onebody:
897  return new geometric_solvation::OccludedHbondSolEnergy_onebody( options );
898  case occ_sol_exact:
899  return new geometric_solvation::ExactOccludedHbondSolEnergy(
900  basic::options::option[basic::options::OptionKeys::score::exact_occ_pairwise],
901  basic::options::option[basic::options::OptionKeys::score::exact_occ_split_between_res],
902  ! basic::options::option[ basic::options::OptionKeys::score::exact_occ_self_res_no_occ ],
903  basic::options::option[basic::options::OptionKeys::score::exact_occ_radius_scaling] );
904  case dslf_ss_dst:
905  case dslf_cs_ang:
906  case dslf_ss_dih:
907  case dslf_ca_dih:
908  case dslf_cbs_ds:
909  return new disulfides::FullatomDisulfideEnergy( get_FullatomDisulfidePotential() );
910  case dslfc_cen_dst:
911  case dslfc_cb_dst:
912  case dslfc_ang:
913  case dslfc_cb_dih:
914  case dslfc_bb_dih:
915  return new disulfides::CentroidDisulfideEnergy( get_CentroidDisulfidePotential() );
916  case neigh_count:
917  case neigh_vect:
918  case neigh_vect_raw:
919  return new nv::NVscore();
920  case symE_bonus:
921  return new symDesign::symE();
922  case gb_elec:
923  return new methods::GenBornEnergy( options );
924  case fa_pair:
925  case fa_pair_aro_aro:
926  case fa_pair_aro_pol:
927  case fa_pair_pol_pol:
928  return new PairEnergy;
929  case fa_dun:
930  return new DunbrackEnergy;
931  case dna_chi:
932  return new dna::DNAChiEnergy;
933  case p_aa_pp:
934  return new P_AA_pp_Energy;
935  case pro_close:
936  return new ProClosureEnergy;
937  case h2o_intra:
938  return new WaterAdductIntraEnergy;
939  case h2o_hbond:
940  return new WaterAdductHBondEnergy;
941  case ref:
942  if ( options.has_method_weights( ref ) ) {
943  return new ReferenceEnergy( options.method_weights( ref ) );
944  } else {
945  return new ReferenceEnergy;
946  }
947  case rama:
948  return new RamachandranEnergy;
949  case rama2b:
950  return new RamachandranEnergy2B;
951  case omega:
952  return new OmegaTetherEnergy;
953  case chainbreak:
954  return new ChainbreakEnergy;
955  case linear_chainbreak:
956  case overlap_chainbreak:
957  return new LinearChainbreakEnergy;
958  case distance_chainbreak:
959  return new DistanceChainbreakEnergy;
960  case envsmooth:
961  return new EnvSmoothEnergy;
962  case e_pH:
963  return new pHEnergy;
964  case env:
965  case cbeta:
966  return new EnvEnergy;
967  case pair:
968  case cenpack:
969  return new CenPairEnergy;
970  case Menv:
971  return new MembraneEnvEnergy;
972  case Menv_non_helix:
973  case Menv_termini:
974  case Menv_tm_proj:
975  return new MembraneEnvPenalties;
976  case Mcbeta:
977  return new MembraneCbetaEnergy;
978  case Mpair:
979  return new MembraneCenPairEnergy;
980  case Mlipo:
981  return new MembraneLipo;
982  case interchain_env:
983  case interchain_contact:
984  return new InterchainEnvEnergy;
985  case interchain_pair:
986  case interchain_vdw:
987  return new InterchainPairEnergy;
988  case hs_pair:
989  case ss_pair:
990  case rsigma:
991  case sheet:
992  return new SecondaryStructureEnergy;
993  case rdc:
994  return new ResidualDipolarCouplingEnergy;
995  case rdc_rohl:
996  return new ResidualDipolarCouplingEnergy_Rohl;
997  case holes:
998  case holes_decoy:
999  case holes_resl:
1000  case holes_min:
1001  return new packing::HolesEnergy;
1002  case dab_sasa:
1003  case dab_sev:
1004  return new packing::SurfVolEnergy;
1005  case vdw:
1006  return new VDW_Energy( options );
1007  case hybrid_vdw:
1008  return new HybridVDW_Energy();
1009  case rna_rg:
1010  return new rna::RG_Energy_RNA;
1011  case rna_vdw:
1012  return new rna::RNA_VDW_Energy;
1013  case rna_base_pair:
1014  case rna_base_axis:
1015  case rna_base_stagger:
1016  case rna_base_stack:
1017  case rna_base_stack_axis:
1018  case rna_base_pair_pairwise:
1019  case rna_base_axis_pairwise:
1020  case rna_base_stagger_pairwise:
1021  case rna_base_stack_pairwise:
1022  case rna_base_stack_axis_pairwise:
1023  case rna_base_backbone:
1024  case rna_backbone_backbone:
1025  case rna_repulsive:
1026  return new rna::RNA_PairwiseLowResolutionEnergy;
1027  case fa_stack:
1028  return new rna::RNA_FullAtomStackingEnergy;
1029  case rna_torsion:
1030  case rna_sugar_close:
1031  return new rna::RNA_TorsionEnergy;
1032  case rna_fa_atr_base:
1033  case rna_fa_rep_base:
1034  return new rna::RNA_LJ_BaseEnergy( *etable( options.etable_type() ) );
1035  case dna_bb_torsion:
1036  case dna_sugar_close:
1037  case dna_base_distance:
1038  return new dna::DNATorsionEnergy;
1039  case rg:
1040  return new RG_Energy_Fast;
1041  case co:
1042  return new ContactOrderEnergy;
1043  case rms:
1044  return new RMS_Energy;
1045  case mm_twist:
1046  return new MMTorsionEnergy;
1047  case mm_bend:
1048  return new MMBondAngleEnergy( options );
1049 // case csd_torsion:
1050 // return new CSD_TorsionEnergy();
1051  case fa_cust_pair_dist:
1052  return new custom_pair_distance::FullatomCustomPairDistanceEnergy;
1053  case python:
1054  return NULL;
1055  case hack_elec:
1056  case hack_elec_bb_bb:
1057  case hack_elec_bb_sc:
1058  case hack_elec_sc_sc:
1059  return new hackelec::HackElecEnergy( options );
1060  case hack_elec_rna_phos_phos:
1061  case hack_elec_rna_phos_sugr:
1062  case hack_elec_rna_phos_base:
1063  case hack_elec_rna_sugr_sugr:
1064  case hack_elec_rna_sugr_base:
1065  case hack_elec_rna_base_base:
1066  return new hackelec::RNAHackElecEnergy( options );
1067  case dna_bp:
1068  case dna_bs:
1069  return new DNA_BaseEnergy;
1070  case dna_dr:
1071  return new DirectReadoutEnergy;
1072  case atom_pair_constraint:
1073  case angle_constraint:
1074  case dihedral_constraint:
1075  case constant_constraint:
1076  case coordinate_constraint:
1077  case dof_constraint:
1078  case res_type_constraint:
1079  case backbone_stub_constraint:
1080  case big_bin_constraint:
1081  case rna_bond_geometry:
1082  return new constraints::ConstraintsEnergy;
1083  case suck:
1084  return new SuckerEnergy;
1085  case gauss:
1086  return new GaussianOverlapEnergy;
1087  case pack_stat:
1088  return new PackStatEnergy;
1089  case surface:
1090  return new SurfaceEnergy;
1091  case p_aa:
1092  return new P_AA_Energy;
1093  case unfolded:
1094  if ( options.has_method_weights( unfolded ) ) {
1095  return new UnfoldedStateEnergy( options.method_weights( unfolded ) );
1096  } else {
1097  return new UnfoldedStateEnergy;
1098  }
1099  case elec_dens_window:
1100  return new ElecDensEnergy;
1101  case elec_dens_whole_structure_ca:
1102  return new ElecDensCenEnergy;
1103  case elec_dens_whole_structure_allatom:
1104  return new ElecDensAllAtomCenEnergy;
1105  case peptide_bond:
1106  return new PeptideBondEnergy;
1107  case pcs:
1108  return new pcs::PCS_Energy;
1109  default:
1110  utility_exit_with_message(
1111  "no energymethod for this score_type " + name_from_score_type( score_type )
1112  );
1113  }
1114  return 0;
1115  */
1116 }
1117 
1118 /// global etable_id
1119 std::string const FA_STANDARD_DEFAULT( "FA_STANDARD_DEFAULT" );
1120 std::string const FA_STANDARD_SOFT ( "FA_STANDARD_SOFT" );
1121 
1122 std::string const UNFOLDED_SCORE12( "UNFOLDED_SCORE12" );
1123 std::string const UNFOLDED_MM_STD( "UNFOLDED_MM_STD" );
1124 std::string const UNFOLDED_RNA( "UNFOLDED_RNA" ); // This will later get more elaborated
1125 
1126 } // namespace core
1127 } // namespace scoring
1128