File: slickScore.C

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-11.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 239,928 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; javascript: 164; makefile: 88
file content (216 lines) | stat: -rw-r--r-- 5,295 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: slickScore.C,v 1.3 2006/05/21 18:15:29 anker Exp $

#include <BALL/SCORING/FUNCTIONS/slickScore.h>
#include <BALL/SCORING/COMPONENTS/vanDerWaalsSlick.h>
#include <BALL/SCORING/COMPONENTS/CHPISlick.h>
#include <BALL/SCORING/COMPONENTS/polarSolvation.h>
#include <BALL/SCORING/COMPONENTS/hydrogenBondSlick.h>

#include <BALL/SYSTEM/path.h>
#include <BALL/KERNEL/PTE.h>
#include <BALL/KERNEL/standardPredicates.h>
#include <BALL/KERNEL/bondIterator.h>
#include <BALL/KERNEL/forEach.h>
#include <BALL/MOLMEC/PARAMETER/templates.h>

namespace BALL
{

	const char* SLICKScore::Option::CONST = "const";
	const char* SLICKScore::Option::HB = "hb_coefficient";
	const char* SLICKScore::Option::CHPI = "chpi_coefficient";
	const char* SLICKScore::Option::VDW = "vdw_coefficient";
	const char* SLICKScore::Option::POLAR = "polar_coefficient";


	// Parameters for the SLICK/score scoring function
	// [anker 2006/02/09]
	const float SLICKScore::Default::CONST    =  0.0f;
	const float SLICKScore::Default::HB       = -2.0f;
	const float SLICKScore::Default::CHPI     = -2.0f;
	const float SLICKScore::Default::VDW      =  0.1f;
	const float SLICKScore::Default::POLAR    =  0.05f;


	SLICKScore::SLICKScore()
		:	ScoringFunction()
	{
	}


	SLICKScore::SLICKScore(Molecule& protein, Molecule& ligand,
			Options& new_options)
		:	ScoringFunction(protein, ligand, new_options)
	{
		setup();
	}


	SLICKScore::SLICKScore(const SLICKScore& slick)
		:	ScoringFunction(slick)
	{
	}


	SLICKScore::~SLICKScore()
	{
		clear();
	}


	void SLICKScore::clear()
	{
		ScoringFunction::clear();
	}


	bool SLICKScore::setup()
	{
		setName("SLICKScore");

		// Set VDW to use a cut repulsive potential with a limit of 5 kJ/mol per interaction
		options_.setInteger(VanDerWaalsSlick::Option::VDW_METHOD, VanDerWaalsSlick::CALCULATION__SOFTENED_LJ_POTENTIAL_LOG);
		options_.setReal(VanDerWaalsSlick::Option::VDW_SOFTENING_LIMIT, 5.0f);

		// Use simple (and fast) Coulomb interactions for the scoring
		options_.setInteger(PolarSolvation::Option::POLAR_METHOD, PolarSolvation::CALCULATION__COULOMB);

		// Now extract options_ from options table and set the coefficients of
		// the components accordingly.
		float CONST = options_.setDefaultReal(SLICKScore::Option::CONST, SLICKScore::Default::CONST);
		setIntercept(CONST);

		// register all components of the force field
		registerComponents_();

		// check whether we know which molecule is the protein and which is the
		// ligand in this complex. In case we don't know, we have to guess.
		// This can be wrong if we got two PDB files which will both be tagged
		// as protein.
		if ((getReceptor() == 0) || (getLigand() == 0))
		{
			Log.error() << "I don't know what the protein and the ligand is." 
				<< std::endl;
			return false;
		}

		return true;
	}


	const SLICKScore& SLICKScore::operator = (const SLICKScore& slick)
	{
		// avoid self assignment
		if (&slick != this)
		{
			ScoringFunction::operator = (slick);
		}
		
		return *this;
	}


	double SLICKScore::getCHPIScore() const
	{
		const ScoringComponent* component = getComponent("CHPISlick");
		if (component != 0)
		{
			return component->getRawScore();
		} 
		else 
		{
			return 0;
		}
	}


	double SLICKScore::getVDWScore() const
	{
		const ScoringComponent* component = getComponent("vanDerWaalsSlick");
		if (component != 0)
		{
			return component->getRawScore();
		} 
		else 
		{
			return 0;
		}
	}


	double SLICKScore::getPolarSolvationScore() const
	{
		const ScoringComponent* component = getComponent("Polar Solvation");
		if (component != 0)
		{
			return component->getRawScore();
		} 
		else 
		{
			return 0;
		}
	}


	double SLICKScore::getNonpolarSolvationScore() const
	{
		const ScoringComponent* component = getComponent("Nonpolar Solvation");
		if (component != 0)
		{
			return component->getRawScore();
		} 
		else 
		{
			return 0;
		}
	}

	double SLICKScore::getHydrogenBondScore() const
	{
		const ScoringComponent* component = getComponent("SLICK HydrogenBond");
		if (component != 0)
		{
			return component->getRawScore();
		} 
		else 
		{
			return 0;
		}
	}
	
	void SLICKScore::registerComponents_()
	{
		float coeff_CHPI = options_.setDefaultReal(SLICKScore::Option::CHPI, SLICKScore::Default::CHPI);
		float coeff_HB = options_.setDefaultReal(SLICKScore::Option::HB, SLICKScore::Default::HB);
		float coeff_VDW = options_.setDefaultReal(SLICKScore::Option::VDW, SLICKScore::Default::VDW);
		float coeff_PS = options_.setDefaultReal(SLICKScore::Option::POLAR, SLICKScore::Default::POLAR);

		CHPISlick* chpi = new CHPISlick(*this);
		chpi->setCoefficient(coeff_CHPI);
		chpi->setup();
		chpi->setNormalizationParameters(0.0, 0.0);
		insertComponent(chpi);

		HydrogenBondSlick* hb = new HydrogenBondSlick(*this);
		hb->setCoefficient(coeff_HB);
		hb->setup();
		hb->setNormalizationParameters(0.0, 0.0);
		insertComponent(hb);

		VanDerWaalsSlick* vdws = new VanDerWaalsSlick(*this);
		vdws->setCoefficient(coeff_VDW);
		vdws->setup();
		vdws->setNormalizationParameters(0.0, 0.0);
		insertComponent(vdws);

		PolarSolvation* ps = new PolarSolvation(*this);
		ps->setCoefficient(coeff_PS);
		ps->setup();
		ps->setNormalizationParameters(0.0, 0.0);
		insertComponent(ps);
	}

} // namespace BALL