Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScoreTypeManager.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
11 /// @brief
12 /// @author Andrew Leaver-Fay
13 
14 // Unit Heaaders
16 
17 
18 // Utility headers
19 #include <utility/exit.hh>
20 
21 // C++ headers
22 #include <map>
23 #include <string>
24 #include <iostream>
25 
26 #include <sstream>
27 #include <utility/vector1_bool.hh>
28 
29 #include <utility/vector1.hh>
30 
31 
32 namespace core {
33 namespace scoring {
34 
35 bool ScoreTypeManager::initialized_( false );
36 std::map< std::string, ScoreType > ScoreTypeManager::name2score_type_;
38 
39 
40 void fill_score_range(std::map< std::string, ScoreType > & M, std::string prefix, int first, int last)
41 {
42  M[ prefix + "_first" ] = ScoreType(first);
43  M[ prefix + "_last" ] = ScoreType(last);
44  for(int i=first+1; i<last; i++) {
45  std::ostringstream s; s << prefix << '_' << i;
46  M[ s.str() ] = ScoreType(i);
47  }
48 }
49 
50 
51 /// @brief initialize the ScoreType name vector and map
52 ///
53 /// @details initialize all the SCORETYPE string name into the vector then set up
54 /// the look-up map from string name to enum type
55 void
57 {
58  if ( initialized_ ) return;
59  initialized_ = true;
60 
61  name2score_type_[ "fa_atr" ] = fa_atr;
62  name2score_type_[ "fa_rep" ] = fa_rep;
63  name2score_type_[ "fa_sol" ] = fa_sol;
64  name2score_type_[ "lk_hack" ] = lk_hack;
65  name2score_type_[ "lk_ball" ] = lk_ball;
66  name2score_type_[ "lk_ball_iso" ] = lk_ball_iso;
67  name2score_type_[ "lk_costheta" ] = lk_costheta;
68  name2score_type_[ "lk_polar" ] = lk_polar;
69  name2score_type_[ "lk_nonpolar" ] = lk_nonpolar;
70  name2score_type_[ "fa_intra_atr" ] = fa_intra_atr;
71  name2score_type_[ "fa_intra_rep" ] = fa_intra_rep;
72  name2score_type_[ "fa_intra_sol" ] = fa_intra_sol;
73  name2score_type_[ "coarse_fa_atr" ] = coarse_fa_atr;
74  name2score_type_[ "coarse_fa_rep" ] = coarse_fa_rep;
75  name2score_type_[ "coarse_fa_sol" ] = coarse_fa_sol;
76  name2score_type_[ "coarse_beadlj" ] = coarse_beadlj;
77  name2score_type_[ "mm_lj_intra_rep" ] = mm_lj_intra_rep;
78  name2score_type_[ "mm_lj_intra_atr" ] = mm_lj_intra_atr;
79  name2score_type_[ "mm_lj_inter_rep" ] = mm_lj_inter_rep;
80  name2score_type_[ "mm_lj_inter_atr" ] = mm_lj_inter_atr;
81  name2score_type_[ "mm_twist" ] = mm_twist;
82  name2score_type_[ "mm_bend" ] = mm_bend;
83  name2score_type_[ "mm_stretch" ] = mm_stretch;
84  name2score_type_[ "cart_bonded" ] = cart_bonded;
85  name2score_type_[ "cart_bonded_angle" ] = cart_bonded_angle;
86  name2score_type_[ "cart_bonded_length" ] = cart_bonded_length;
87  name2score_type_[ "cart_bonded_torsion" ] = cart_bonded_torsion;
88 // name2score_type_[ "csd_torsion" ] = csd_torsion; kwk commenting out csd atom type related code until I have implemented them fully
89  name2score_type_[ "hack_elec" ] = hack_elec;
90  name2score_type_[ "hack_elec_bb_bb" ] = hack_elec_bb_bb;
91  name2score_type_[ "hack_elec_bb_sc" ] = hack_elec_bb_sc;
92  name2score_type_[ "hack_elec_sc_sc" ] = hack_elec_sc_sc;
93  name2score_type_[ "hack_elec_rna_phos_phos" ] = hack_elec_rna_phos_phos;
94  name2score_type_[ "hack_elec_rna_phos_sugr" ] = hack_elec_rna_phos_sugr;
95  name2score_type_[ "hack_elec_rna_phos_base" ] = hack_elec_rna_phos_base;
96  name2score_type_[ "hack_elec_rna_sugr_sugr" ] = hack_elec_rna_sugr_sugr;
97  name2score_type_[ "hack_elec_rna_sugr_base" ] = hack_elec_rna_sugr_base;
98  name2score_type_[ "hack_elec_rna_base_base" ] = hack_elec_rna_base_base;
99  name2score_type_[ "hack_elec_aro_aro" ] = hack_elec_aro_aro;
100  name2score_type_[ "hack_elec_aro_all" ] = hack_elec_aro_all;
101  name2score_type_[ "hack_aro" ] = hack_aro;
102  name2score_type_[ "h2o_hbond" ] = h2o_hbond;
103  name2score_type_[ "dna_dr" ] = dna_dr;
104  name2score_type_[ "dna_bs" ] = dna_bs;
105  name2score_type_[ "dna_bp" ] = dna_bp;
106  name2score_type_[ "pro_close" ] = pro_close;
107  name2score_type_[ "vdw" ] = vdw;
108  name2score_type_[ "cen_hb" ] = cen_hb;
109  name2score_type_[ "cenpack" ] = cenpack;
110  name2score_type_[ "hybrid_vdw" ] = hybrid_vdw;
111  name2score_type_[ "fa_cust_pair_dist" ] = fa_cust_pair_dist;
112  name2score_type_[ "gauss" ] = gauss;
113 
114 
115  // PyRosetta score types
119 
120  name2score_type_[ "python" ] = python;
121 
122  name2score_type_[ "fastsaxs" ] = fastsaxs;
123  name2score_type_[ "saxs_score" ] = saxs_score;
124  name2score_type_[ "saxs_fa_score" ] = saxs_fa_score;
125  name2score_type_[ "saxs_cen_score" ] = saxs_cen_score;
126  name2score_type_[ "pddf_score" ] = pddf_score;
127 
128  name2score_type_[ "fa_pair" ] = fa_pair; // fa_pair == fa_pair_pol_pol
129  name2score_type_[ "fa_pair_aro_aro" ] = fa_pair_aro_aro;
130  name2score_type_[ "fa_pair_aro_pol" ] = fa_pair_aro_pol;
131  name2score_type_[ "fa_pair_pol_pol" ] = fa_pair_pol_pol;
132  name2score_type_[ "fa_plane" ] = fa_plane;
133  name2score_type_[ "hbond_sr_bb" ] = hbond_sr_bb;
134  name2score_type_[ "hbond_lr_bb" ] = hbond_lr_bb;
135  name2score_type_[ "hbond_bb_sc" ] = hbond_bb_sc;
136  name2score_type_[ "hbond_sr_bb_sc" ] = hbond_sr_bb_sc;
137  name2score_type_[ "hbond_lr_bb_sc" ] = hbond_lr_bb_sc;
138  name2score_type_[ "hbond_sc" ] = hbond_sc;
139  name2score_type_[ "interchain_pair" ] = interchain_pair;
140  name2score_type_[ "interchain_vdw" ] = interchain_vdw;
141  name2score_type_[ "interface_dd_pair" ] = interface_dd_pair;
142 
143  name2score_type_[ "ch_bond" ] = ch_bond;
144  name2score_type_[ "ch_bond_bb_bb" ] = ch_bond_bb_bb;
145  name2score_type_[ "ch_bond_sc_sc" ] = ch_bond_sc_sc;
146  name2score_type_[ "ch_bond_bb_sc" ] = ch_bond_bb_sc;
147 
148  name2score_type_[ "neigh_vect" ] = neigh_vect;
149  name2score_type_[ "neigh_count" ] = neigh_count;
150  name2score_type_[ "neigh_vect_raw"] = neigh_vect_raw;
151  name2score_type_[ "symE_bonus" ] = symE_bonus;
152  name2score_type_[ "sym_lig" ] = sym_lig;
153 
154  name2score_type_[ "orbitals_hpol" ] = orbitals_hpol;
155  name2score_type_[ "orbitals_haro" ] = orbitals_haro;
156  name2score_type_["orbitals_hpol_bb"] = orbitals_hpol_bb;
157  name2score_type_["orbitals_orbitals"] = orbitals_orbitals;
158 
159  name2score_type_[ "geom_sol" ] = geom_sol;
160  name2score_type_[ "occ_sol_fitted" ] = occ_sol_fitted;
161  name2score_type_[ "occ_sol_fitted_onebody" ] = occ_sol_fitted_onebody;
162  name2score_type_[ "occ_sol_exact" ] = occ_sol_exact;
163 
164  name2score_type_[ "gb_elec" ] = gb_elec;
165  name2score_type_[ "PB_elec" ] = PB_elec;
166  name2score_type_[ "dslf_ss_dst" ] = dslf_ss_dst;
167  name2score_type_[ "dslf_cs_ang" ] = dslf_cs_ang;
168  name2score_type_[ "dslf_ss_dih" ] = dslf_ss_dih;
169  name2score_type_[ "dslf_ca_dih" ] = dslf_ca_dih;
170  name2score_type_[ "dslf_cbs_ds" ] = dslf_cbs_ds;
171  name2score_type_[ "dslfc_cen_dst" ] = dslfc_cen_dst;
172  name2score_type_[ "dslfc_cb_dst" ] = dslfc_cb_dst;
173  name2score_type_[ "dslfc_ang" ] = dslfc_ang;
174  name2score_type_[ "dslfc_cb_dih" ] = dslfc_cb_dih;
175  name2score_type_[ "dslfc_bb_dih" ] = dslfc_bb_dih;
176 
177  name2score_type_[ "dslfc_rot" ] = dslfc_rot;
178  name2score_type_[ "dslfc_trans" ] = dslfc_trans;
179  name2score_type_[ "dslfc_RT" ] = dslfc_RT;
180 
181  name2score_type_[ "custom_atom_pair" ] = custom_atom_pair;
182  name2score_type_[ "atom_pair_constraint" ] = atom_pair_constraint;
183  name2score_type_[ "dunbrack_constraint" ] = dunbrack_constraint;
184  name2score_type_[ "angle_constraint" ] = angle_constraint;
185  name2score_type_[ "dihedral_constraint" ] = dihedral_constraint;
186  name2score_type_[ "big_bin_constraint" ] = big_bin_constraint;
187  name2score_type_[ "constant_constraint" ] = constant_constraint;
188  name2score_type_[ "coordinate_constraint" ] = coordinate_constraint;
189  name2score_type_[ "site_constraint" ] = site_constraint;
190  name2score_type_[ "metalhash_constraint" ] = metalhash_constraint;
191 
192  name2score_type_[ "rama" ] = rama;
193  name2score_type_[ "rama2b" ] = rama2b;
194  name2score_type_[ "omega" ] = omega;
195  name2score_type_[ "fa_dun" ] = fa_dun;
196  name2score_type_[ "fa_dun_dev" ] = fa_dun_dev;
197  name2score_type_[ "fa_dun_rot" ] = fa_dun_rot;
198  name2score_type_[ "fa_dun_semi" ] = fa_dun_semi;
199  name2score_type_[ "dna_chi" ] = dna_chi;
200  name2score_type_[ "p_aa_pp" ] = p_aa_pp;
201  name2score_type_[ "yhh_planarity" ] = yhh_planarity;
202  name2score_type_[ "h2o_intra" ] = h2o_intra;
203  name2score_type_[ "ref" ] = ref;
204  name2score_type_[ "ref_nc" ] = ref_nc;
205  name2score_type_[ "seqdep_ref" ] = seqdep_ref;
206  name2score_type_[ "nmer_ref" ] = nmer_ref;
207  name2score_type_[ "nmer_pssm" ] = nmer_pssm;
208  name2score_type_[ "envsmooth" ] = envsmooth;
209  name2score_type_[ "e_pH" ] = e_pH;
210  name2score_type_[ "rna_bulge"] = rna_bulge;
211  name2score_type_[ "mg_ref"] = mg_ref;
212  // Variant type to flag rotamers for alternative scoring with varying weight
213  name2score_type_[ "special_rot"] = special_rot;
214 
215  name2score_type_[ "env" ] = env;
216  name2score_type_[ "burial" ] = burial;
217  name2score_type_[ "abego" ] = abego;
218  name2score_type_[ "pair" ] = pair;
219  name2score_type_[ "cbeta" ] = cbeta;
220  name2score_type_[ "DFIRE" ] = DFIRE;
221 
222  //bw membrane scoring terms
223  name2score_type_[ "Menv" ] = Menv;
224  name2score_type_[ "Menv_non_helix" ] = Menv_non_helix;
225  name2score_type_[ "Menv_termini" ] = Menv_termini;
226  name2score_type_[ "Menv_tm_proj" ] = Menv_tm_proj;
227  name2score_type_[ "Mcbeta" ] = Mcbeta;
228  name2score_type_[ "Mpair" ] = Mpair;
229  name2score_type_[ "Mlipo" ] = Mlipo;
230  //pba membrane all atom terms
231  name2score_type_[ "fa_mbenv" ] = fa_mbenv;
232  name2score_type_[ "fa_mbsolv" ] = fa_mbsolv;
233  name2score_type_[ "Menv_smooth" ] = Menv_smooth;
234 
235  name2score_type_[ "rg" ] = rg;
236  name2score_type_[ "co" ] = co;
237  name2score_type_[ "peptide_bond" ] = peptide_bond;
238  name2score_type_[ "pcs" ] = pcs;
239  name2score_type_[ "pcs2" ] = pcs2;
240  name2score_type_[ "dock_ens_conf" ] = dock_ens_conf;
241 
242  //fpd smooth (differentiable) centroid terms
243  name2score_type_[ "cen_hb" ] = cen_hb;
244  name2score_type_[ "cen_env_smooth" ] = cen_env_smooth;
245  name2score_type_[ "cen_pair_smooth" ] = cen_pair_smooth;
246  name2score_type_[ "cbeta_smooth" ] = cbeta_smooth;
247  name2score_type_[ "cenpack_smooth" ] = cenpack_smooth;
248 
249  name2score_type_[ "hs_pair" ] = hs_pair;
250  name2score_type_[ "ss_pair" ] = ss_pair;
251  name2score_type_[ "rsigma" ] = rsigma;
252  name2score_type_[ "sheet" ] = sheet;
253  name2score_type_[ "csa" ] = csa;
254  name2score_type_[ "dc" ] = dc;
255  name2score_type_[ "rdc" ] = rdc;
256  name2score_type_[ "rdc_segments" ] = rdc_segments;
257  name2score_type_[ "rdc_rohl" ] =rdc_rohl;
258  name2score_type_[ "holes" ] = holes;
259  name2score_type_[ "holes_resl" ] = holes_resl;
260  name2score_type_[ "holes_decoy" ] = holes_decoy;
261  name2score_type_[ "holes_min" ] = holes_min;
262  name2score_type_[ "holes_min_mean" ] = holes_min_mean;
263  name2score_type_[ "rna_chem_shift" ] = rna_chem_shift;
264  name2score_type_[ "dab_sasa" ] = dab_sasa;
265  name2score_type_[ "dab_sev" ] = dab_sev;
266  name2score_type_[ "sa" ] = sa;
267 
268  name2score_type_[ "interchain_env"] = interchain_env;
269  name2score_type_[ "interchain_contact"] = interchain_contact;
270 
271  name2score_type_[ "rna_rg"] = rna_rg;
272  name2score_type_[ "rna_vdw"] = rna_vdw;
273  name2score_type_[ "rna_base_backbone"] = rna_base_backbone;
274  name2score_type_[ "rna_backbone_backbone"] = rna_backbone_backbone;
275  name2score_type_[ "rna_repulsive"] = rna_repulsive;
276 
277  name2score_type_[ "rna_base_pair"] = rna_base_pair;
278  name2score_type_[ "rna_base_axis"] = rna_base_axis;
279  name2score_type_[ "rna_base_stagger"] = rna_base_stagger;
280  name2score_type_[ "rna_base_stack"] = rna_base_stack;
281  name2score_type_[ "rna_base_stack_axis"] = rna_base_stack_axis;
282  name2score_type_[ "rna_data_base"] = rna_data_base;
283  name2score_type_[ "rna_data_backbone"] = rna_data_backbone;
284  name2score_type_[ "rna_mg"] = rna_mg;
285  name2score_type_[ "rna_mg_rep"] = rna_mg_rep;
286  name2score_type_[ "rna_mg_indirect"] = rna_mg_indirect;
287  name2score_type_[ "mg_chem_pot"] = mg_chem_pot;
288 
289  //Will these ever really be used?
290  name2score_type_[ "rna_base_pair_pairwise"] = rna_base_pair_pairwise;
291  name2score_type_[ "rna_base_axis_pairwise"] = rna_base_axis_pairwise;
292  name2score_type_[ "rna_base_stagger_pairwise"] = rna_base_stagger_pairwise;
293  name2score_type_[ "rna_base_stack_pairwise"] = rna_base_stack_pairwise;
294  name2score_type_[ "rna_base_stack_axis_pairwise"] = rna_base_stack_axis_pairwise;
295 
296  name2score_type_[ "fa_stack"] = fa_stack;
297  // name2score_type_[ "fa_stack_purine"] = fa_stack_purine;
298  // name2score_type_[ "fa_stack_pyrimidine"] = fa_stack_pyrimidine;
299  name2score_type_[ "fa_stack_aro"] = fa_stack_aro;
300 
301  name2score_type_[ "rna_torsion"] = rna_torsion;
302  name2score_type_[ "rna_sugar_close"] = rna_sugar_close;
303  name2score_type_[ "rna_bond_geometry"] = rna_bond_geometry;
304  name2score_type_[ "rna_fa_atr_base"] = rna_fa_atr_base;
305  name2score_type_[ "rna_fa_rep_base"] = rna_fa_rep_base;
306 
307  ////////////Intra-res RNA specific score terms//////////////////
308  name2score_type_[ "lk_polar_intra_RNA" ] = lk_polar_intra_RNA;
309  name2score_type_[ "lk_nonpolar_intra_RNA" ] = lk_nonpolar_intra_RNA;
310  name2score_type_[ "fa_intra_RNA_base_phos_atr" ] = fa_intra_RNA_base_phos_atr;
311  name2score_type_[ "fa_intra_RNA_base_phos_rep" ] = fa_intra_RNA_base_phos_rep;
312  name2score_type_[ "fa_intra_RNA_base_phos_sol" ] = fa_intra_RNA_base_phos_sol;
313  name2score_type_[ "hbond_intra" ] = hbond_intra; //Currently affects only RNA.
314  name2score_type_[ "geom_sol_intra_RNA" ] = geom_sol_intra_RNA;
315  name2score_type_[ "CI_geom_sol" ] = CI_geom_sol;
316  name2score_type_[ "CI_geom_sol_intra_RNA" ] = CI_geom_sol_intra_RNA;
317 
318  name2score_type_[ "dna_bb_torsion"] = dna_bb_torsion;
319  name2score_type_[ "dna_sugar_close"] = dna_sugar_close;
320  name2score_type_[ "dna_base_distance"] = dna_base_distance;
321 
322  name2score_type_[ "chainbreak" ] = chainbreak;
323  name2score_type_[ "linear_chainbreak" ] = linear_chainbreak;
324  name2score_type_[ "overlap_chainbreak" ] = overlap_chainbreak;
325  name2score_type_[ "distance_chainbreak" ] = distance_chainbreak;
326  name2score_type_[ "dof_constraint" ] = dof_constraint;
327  name2score_type_[ "rms_energy" ] = rms;
328  name2score_type_[ "suck" ] = suck;
329  name2score_type_[ "res_type_constraint" ] = res_type_constraint;
330  name2score_type_[ "res_type_linking_constraint" ] = res_type_linking_constraint;
331  name2score_type_[ "pocket_constraint" ] = pocket_constraint;
332  name2score_type_[ "backbone_stub_constraint" ] = backbone_stub_constraint;
333  name2score_type_[ "suck" ] = suck;
334  name2score_type_[ "pack_stat" ] = pack_stat;
335 
336  name2score_type_[ "surface" ] = surface;
337  name2score_type_[ "hpatch" ] = hpatch;
338  name2score_type_[ "p_aa" ] = p_aa;
339  name2score_type_[ "unfolded" ] = unfolded;
340 
341  name2score_type_[ "elec_dens_fast" ] = elec_dens_fast;
342  name2score_type_[ "elec_dens_window" ] = elec_dens_window;
343  name2score_type_[ "elec_dens_whole_structure_ca" ] = elec_dens_whole_structure_ca;
344  name2score_type_[ "elec_dens_whole_structure_allatom" ] = elec_dens_whole_structure_allatom;
345  name2score_type_[ "elec_dens_atomwise" ] = elec_dens_atomwise;
346  name2score_type_[ "patterson_cc" ] = patterson_cc;
347 
348  name2score_type_[ "natbias_ss" ] = natbias_ss;
349  name2score_type_[ "natbias_hs" ] = natbias_hs;
350  name2score_type_[ "natbias_hh" ] = natbias_hh;
351  name2score_type_[ "natbias_stwist" ] = natbias_stwist;
352 
353  name2score_type_[ "aa_cmp" ] = aa_cmp;
354 
355  name2score_type_[ "total_score" ] = total_score;
356 
357 
359 
361  for ( std::map< std::string, ScoreType >::const_iterator iter = name2score_type_.begin(),
362  iter_end = name2score_type_.end(); iter != iter_end; ++iter ) {
363  score_type2name_[ iter->second ] = iter->first;
364  }
365 
366 }
367 
368 
369 
370 //////////////////////////////////////////////////////////////////////////////
371 /// @brief give a ScoreType string name and return its enum type
372 ScoreType
374 {
376  std::map< std::string, ScoreType >::const_iterator iter( name2score_type_.find( name ) );
377  if ( iter == name2score_type_.end() ) {
378  utility_exit_with_message("unrecognized score_type type "+name);
379  }
380  return iter->second;
381 }
382 
385 {
387  return score_type2name_[ score_type ];
388 }
389 
390 ///@brief
391 bool
393 {
395  std::map< std::string, ScoreType >::const_iterator iter( name2score_type_.find( name ) );
396  return iter != name2score_type_.end();
397 }
398 
399 }
400 }