BALL 1.5.0
Loading...
Searching...
No Matches
scoringFunction.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_SCORING_COMMON_SCORINGFUNCTION_H
6#define BALL_SCORING_COMMON_SCORINGFUNCTION_H
7
8#include <set>
9
10#include <BALL/KERNEL/system.h>
20
21namespace BALL
22{
23 typedef std::list<std::pair<Atom*, Atom*> > AtomPairList;
24 typedef std::vector<std::pair<Atom*, Atom*> > AtomPairVector;
25
26 class ScoringComponent;
27
29 {
30
32 friend class SideChainOptimizer;
33
34 public:
35
36 static const char* SUBCATEGORY_NAME;
37
38 struct Option
39 {
42 static const char* VERBOSITY;
43
46 static const char* BASE_FUNCTION_TYPE;
47
50 static const char* HASHGRID_RESOLUTION;
51
54 static const char* HASHGRID_SIZE;
55
58 static const char* NONBONDED_CUTOFF;
59
62 static const char* CONFORMATION_SCALE;
63
66 static const char* ALL_LIG_NONB_PAIRS;
67
70 static const char* USE_STATIC_LIG_FRAGMENTS;
71
74 static const char* IGNORE_H_CLASHES;
75
78 static const char* ALLOWED_INTERMOL_OVERLAP;
79
82 static const char* ALLOWED_INTRAMOL_OVERLAP;
83
86 static const char* BURIAL_DEPTH_SCALE;
87 };
88
89
90 struct Default
91 {
94 static const Size VERBOSITY;
95
99
101 static double HASHGRID_RESOLUTION;
102
104 static int HASHGRID_SIZE;
105
106 static double NONBONDED_CUTOFF;
107
109 static double CONFORMATION_SCALE;
110
113
116
118 static bool IGNORE_H_CLASHES;
119
122
125
127 };
128
131
134
137
140 const Options& options);
141
143 AtomContainer& ligand, Options& options);
144
149 ScoringFunction(AtomContainer& receptor, Vector3& hashgrid_origin, Options& options);
150
153
155 virtual void clear();
156
158 ScoringFunction& operator = (const ScoringFunction& sf);
159
161 bool setup();
162
164 bool setup(AtomContainer& receptor, AtomContainer& ligand);
165
167 bool setup(AtomContainer& receptor, AtomContainer& ligand, const Options& options);
168
171
174
177
180
183
186
190 void setReceptor(AtomContainer& receptor);
191
196
201
206
208 void setIntercept(double intercept);
209
211 double getIntercept() const;
212
215
220
226
232 void insertComponent(ScoringComponent* component, float coefficient);
233
239 void removeComponent(const ScoringComponent* component);
240
247 void removeComponent(const String& name);
248
253 void setCoefficient(const ScoringComponent* component, float coefficient);
254
260 void setCoefficient(const String& name, float coefficient);
261
266 bool getCoefficient(const ScoringComponent* component,
267 float& coefficient) const;
268
273 bool getCoefficient(const String& name, float& coefficient) const;
274
279
283 ScoringComponent* getComponent(const Size index) const;
284
287
290
293
296 Vector3& center,
297 double& resolution,
298 int hashgrid_size);
299
305
307
311 String convertTime(double seconds);
312
316 virtual void update();
317
321 virtual double updateScore();
322
327 virtual void printResult(bool detail = 0);
328
329 void getScoreContributions(vector<double>& score_contributions, vector<String>& names);
330
334 static void getDefaultOptions(Options& options);
335
340
345 void enableStoreInteractions(bool b = true);
346
351
353
354 String valueToString(double value);
355
361
366 void setNormalizationParameters(double stddev, double mean);
367
369
373 const Vector3& getLigandCenter() const;
374
375 double getLigandRadius() const;
376
382
388
393
398
403
411
412 const vector<Bond*>* getRotatableLigandBonds() const;
413
414 const vector<StaticLigandFragment*>* getStaticLigandFragments() const;
415
417
418 void setFlexibleResidues(const std::set<Residue*>& flexible_residues);
419
427 bool assignRotamer(Residue* residue, ResidueRotamerSet* rotamer_set, const Rotamer* rotamer);
428
435
442 double distance_threshold,
443 bool onePerCell = 0,
444 int* number_of_overlaps = 0) const;
445
446 void resetResiduePositions(Residue* residue, list<Vector3>& old_positions);
447
451 double getScore();
452
453 const std::map<Atom*, int>* getAtomFragmentMap();
454
460 list<Constraint*> constraints {};
461
462 protected:
463 /* @name Protected structs */
464 struct Result
465 {
470
475
479 vector<double> refArea_penalties;
480 };
481
485 void setName(String name);
486
488
493 Vector3 calculateGeometricalCenter(AtomContainer* s, int* no_ligand_atoms = NULL);
494
499
501
507 virtual void setupReferenceLigand();
508
512 int checkForAtomOverlaps(const AtomPairVector* pair_vector);
513
525 AtomPairVector* createNonbondedPairVector(HashGrid3<Atom*>* hashgrid, int& overlaps, bool rec_lig, bool check_fragments = 0, bool intra_fragment = 0);
526
535 AtomPairVector* createLigandNonbondedPairVector(bool intra_fragment, int& overlaps);
536
538
543
548
553 void enableInteractionComponents_(const list<String>& type_names);
554
555 virtual double getES();
556
561
567 void fetchStaticLigandFragment(Atom* a1, int index);
568
573 int countCovalentBonds(const Atom* atom, int threshold = -1);
574
581
587
591 bool isPeptideBond(const Bond* bond) const;
592
596 String name_ {""};
597
601 Options options_ {};
602
606 AtomContainer* receptor_ {nullptr};
607
611 AtomContainer* ligand_ {nullptr};
612
616 double score_ {0.0};
617
621 double intercept_ {0.0};
622
626 ScoringBaseFunction* base_function_ {nullptr};
627
631 vector<ScoringComponent*> scoring_components_ {};
632
636 HashSet<const Atom*> unassigned_atoms_ {};
637
641 Size max_number_of_errors_ {0};
642
646 Size number_of_errors_ {0};
647
651 double ligand_radius_ {0.0};
652
657 int ligand_atoms_ {0};
658
662 Vector3 ligand_center_ {};
663
667 HashGrid3<Atom*>* hashgrid_ {nullptr};
668
669 HashGrid3<Atom*>* all_residues_hashgrid_ {nullptr};
670 HashGrid3<Atom*>* static_residues_hashgrid_ {nullptr};
671 HashGrid3<Atom*>* flexible_residues_hashgrid_ {nullptr};
672
676 double resolution_ {0.0};
677
681 std::map<Atom*, int> atoms_to_fragments_ {};
682
687 int reference_neighbors_ {0};
688
693 int neighboring_target_atoms_ {0};
694
699 int misplaced_ligand_atoms_ {0};
700
704 int hashgrid_search_radius_ {0};
705
709 double nonbonded_cutoff_ {0.0};
710
714 double nonbonded_cutoff_2_ {0.0};
715
719 bool ignore_h_clashes_ {false};
720
724 int overlaps_ {0};
725
729 int ligand_intramol_overlaps_ {0};
730
735 double allowed_intermolecular_overlap_ {0.0};
736
741 double allowed_intramolecular_overlap_ {0.0};
742
747 double neighbor_cutoff_2_ {0.0};
748
756 vector<StaticLigandFragment*> static_ligand_fragments_ {};
757
763 bool store_interactions_ {false};
764
765 bool store_interactions_phC_only_ {false};
766
770 AtomPairVector* all_ligand_nonbonded_ {nullptr};
771
775 double conformation_scale_ {0.0};
776
780 bool use_all_lig_nonb_ {false};
781
785 bool use_static_lig_fragments_ {false};
786
787 int burial_depth_scale_ {0};
788
792 double exp_energy_stddev_ {0.0};
793
797 double exp_energy_mean_ {0.0};
798
799 std::set<Residue*> flexible_residues_ {};
800
804 Result result_ {};
805
809 double static_ligand_energy_ {0.0};
810
815 vector<Bond*> rotatable_ligand_bonds_ {};
816
821 list<list<Vector3> > flexres_org_positions_ {};
822
823 };
824
825} // namespace BALL
826
827#endif // BALL_SCORING_COMMON_SCORINGFUNCTION_H
std::vector< std::pair< Atom *, Atom * > > AtomPairVector
std::list< std::pair< Atom *, Atom * > > AtomPairList
Three-dimensional Hash Grid Class.
Definition hashGrid.h:755
HashSet< const Atom * > & getUnassignedAtoms()
bool hasPharmacophoreConstraints_()
void setReceptor(AtomContainer &receptor)
String valueToString(double value)
void updateComponent(int id, AtomPairList *)
void enableInteractionComponents_(const list< String > &type_names)
Vector3 calculateGeometricalCenter(AtomContainer *s, int *no_ligand_atoms=NULL)
bool getCoefficient(const ScoringComponent *component, float &coefficient) const
void setCoefficient(const String &name, float coefficient)
static const char * SUBCATEGORY_NAME
const vector< Bond * > * getRotatableLigandBonds() const
void insertComponent(ScoringComponent *component)
Options * getOptionsToModify()
AtomContainer * getSecondMolecule() const
AtomContainer * getReceptor() const
void createStaticLigandFragments()
void setBaseFunction(ScoringBaseFunction &base_function)
Set the instance of BaseFunction for the scoring function.
virtual void clear()
virtual int getNoNeighboringReceptorAtoms()
void setName(String name)
ScoringComponent * getComponent(const Size index) const
void setFlexibleResidues(const std::set< Residue * > &flexible_residues)
bool getCoefficient(const String &name, float &coefficient) const
ScoringFunction(AtomContainer &receptor, Vector3 &hashgrid_origin, Options &options)
virtual void createAllLigandNonBondedPairs()
const Vector3 & getLigandCenter() const
Size countNeighboringReceptorAtoms(const Atom *atom, double distance_threshold, bool onePerCell=0, int *number_of_overlaps=0) const
AtomPairVector * createNonbondedPairVector(HashGrid3< Atom * > *hashgrid, int &overlaps, bool rec_lig, bool check_fragments=0, bool intra_fragment=0)
void enableStoreInteractions(bool b=true)
virtual double updateScore()
double getLigandRadius() const
void removeComponent(const ScoringComponent *component)
void setCoefficient(const ScoringComponent *component, float coefficient)
AtomContainer * getFirstMolecule() const
static HashGrid3< Atom * > * initializeHashGrid(AtomContainer *sys, Vector3 &center, double &resolution, int hashgrid_size)
void setLigand(AtomContainer &ligand)
static void getDefaultOptions(Options &options)
void setMaximumNumberOfErrors(Size nr)
ScoringFunction(AtomContainer &receptor, AtomContainer &ligand, Options &options)
virtual double getES()
bool setup(AtomContainer &receptor, AtomContainer &ligand)
virtual double calculateStaticLigandFragmentEnergy()
ScoringFunction(AtomContainer &receptor, AtomContainer &ligand)
void setNormalizationParameters(double stddev, double mean)
void setFirstMolecule(AtomContainer &molecule1)
AtomContainer * getLigand() const
int checkForAtomOverlaps(const AtomPairVector *pair_vector)
String convertTime(double seconds)
double calculateMoleculeRadius(AtomContainer *sys, Vector3 &center)
int countCovalentBonds(const Atom *atom, int threshold=-1)
ScoringComponent * getComponent(const String &name) const
void insertComponent(ScoringComponent *component, float coefficient)
const HashGrid3< Atom * > * getHashGrid()
double getIntercept() const
double calculateConstraintsScore()
Size getMaximumNumberOfErrors() const
ScoringFunction(const ScoringFunction &sf)
bool assignRotamer(Residue *residue, ResidueRotamerSet *rotamer_set, const Rotamer *rotamer)
void getScoreContributions(vector< double > &score_contributions, vector< String > &names)
bool isPeptideBond(const Bond *bond) const
const std::map< Atom *, int > * getAtomFragmentMap()
bool setup(AtomContainer &receptor, AtomContainer &ligand, const Options &options)
void setSecondMolecule(AtomContainer &molecule2)
virtual ~ScoringFunction()
virtual void printResult(bool detail=0)
void resetResiduePositions(Residue *residue, list< Vector3 > &old_positions)
AtomPairVector * createLigandNonbondedPairVector(bool intra_fragment, int &overlaps)
void enableStoreInteractionsOnlyForPhContraints()
const HashSet< const Atom * > & getUnassignedAtoms() const
const vector< StaticLigandFragment * > * getStaticLigandFragments() const
void removeComponent(const String &name)
void fetchStaticLigandFragment(Atom *a1, int index)
virtual void setupReferenceLigand()
void setIntercept(double intercept)
ScoringBaseFunction * getBaseFunction() const
ScoringFunction(AtomContainer &receptor, AtomContainer &ligand, const Options &options)
virtual void update()
static const char * HASHGRID_RESOLUTION
static const char * IGNORE_H_CLASHES
static const char * HASHGRID_SIZE
static const char * BASE_FUNCTION_TYPE
static const char * BURIAL_DEPTH_SCALE
static const char * CONFORMATION_SCALE
static const char * ALLOWED_INTRAMOL_OVERLAP
static const char * ALL_LIG_NONB_PAIRS
static const char * USE_STATIC_LIG_FRAGMENTS
static const char * ALLOWED_INTERMOL_OVERLAP
static const char * VERBOSITY
static const char * NONBONDED_CUTOFF
static const Size BASE_FUNCTION_TYPE
#define BALL_EXPORT