File: uhligCavFreeEnergyProcessor.C

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 239,888 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; makefile: 95
file content (134 lines) | stat: -rw-r--r-- 3,509 bytes parent folder | download | duplicates (8)
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
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: uhligCavFreeEnergyProcessor.C,v 1.11 2002/12/16 12:30:37 amoll Exp $

#include <BALL/SOLVATION/uhligCavFreeEnergyProcessor.h>
#include <BALL/STRUCTURE/numericalSAS.h>

using std::endl;

namespace BALL
{

	const char* UhligCavFreeEnergyProcessor::Option::VERBOSITY = "verbosity";
	const char* UhligCavFreeEnergyProcessor::Option::PROBE_RADIUS 
		= "probe_radius";
	const char* UhligCavFreeEnergyProcessor::Option::SURFACE_TENSION 
		= "surface_tension";
	const char* UhligCavFreeEnergyProcessor::Option::CONSTANT = "constant";

	const int UhligCavFreeEnergyProcessor::Default::VERBOSITY = 0;
	const float UhligCavFreeEnergyProcessor::Default::PROBE_RADIUS = 1.385;
	const float UhligCavFreeEnergyProcessor::Default::SURFACE_TENSION 
		= 22.63544;
	const float UhligCavFreeEnergyProcessor::Default::CONSTANT 
		= 3854.606;


	UhligCavFreeEnergyProcessor::UhligCavFreeEnergyProcessor()
		:	EnergyProcessor()
	{
		setDefaultOptions();

		valid_ = true;
	}


	UhligCavFreeEnergyProcessor::UhligCavFreeEnergyProcessor
	(const UhligCavFreeEnergyProcessor& proc)
		: EnergyProcessor(proc)
	{
	}


	UhligCavFreeEnergyProcessor::~UhligCavFreeEnergyProcessor()
	{
		clear();

		valid_ = false;
	}


	void UhligCavFreeEnergyProcessor::clear()
	{
		EnergyProcessor::clear();
		setDefaultOptions();

		valid_ = true;
	}

	const UhligCavFreeEnergyProcessor& UhligCavFreeEnergyProcessor::operator = (const UhligCavFreeEnergyProcessor& proc) 
	{
		valid_=proc.valid_;
		energy_=proc.energy_;
		fragment_=proc.fragment_;
		return *this;
	}

	bool UhligCavFreeEnergyProcessor::operator == (const UhligCavFreeEnergyProcessor& proc) const
	{
		bool result;
		if ((fragment_ == 0) && (proc.fragment_ == 0))
		{
			result = ((energy_ == proc.energy_) && (valid_ == proc.valid_));
		}
		else
		{
			if ((fragment_ == 0) || (proc.fragment_ == 0))
			{
				result = false;
			}
			else
			{
				result = ((*fragment_ == *proc.fragment_) && (energy_ 	 == proc.energy_) && (valid_ 	 == proc.valid_));
			}
		}
		return result;
	}

	bool UhligCavFreeEnergyProcessor::finish()
	{

		// first check for user settings

		// for now, there is nothing to report
		int verbosity = (int) options.getInteger(Option::VERBOSITY);
		// the solvent radius [ A ]
		double solvent_radius = options.getReal(Option::PROBE_RADIUS);
		// the surface tension [ J/mol/A^2 ]
		double gamma = options.getReal(Option::SURFACE_TENSION);
		// an additive constant [ J/mol ]
		double C = options.getReal(Option::CONSTANT);
		
		NumericalSAS sas_computer;
		sas_computer.options[NumericalSAS::Option::PROBE_RADIUS  ] = solvent_radius;
		sas_computer.options[NumericalSAS::Option::COMPUTE_VOLUME] = false;

		sas_computer(*fragment_);
		double A = sas_computer.getTotalArea();
		
		if (verbosity > 0)
		{
			Log.info() << "Uhlig parameters and calculated values:" << endl
			<< "solvent radius:  " << solvent_radius << endl
			<< "surface tension: " << gamma << endl
			<< "constant:        " << C << endl
			<< "SAS area:        " << A << endl;
		}

		// return energy in units of kJ/mol
		energy_ = (gamma * A + C)/1000; 
		return 1;
	}


	void UhligCavFreeEnergyProcessor::setDefaultOptions()
	{
		options.setDefaultInteger(Option::VERBOSITY, Default::VERBOSITY);
		options.setDefaultReal(Option::PROBE_RADIUS, Default::PROBE_RADIUS);
		options.setDefaultReal(Option::SURFACE_TENSION, Default::SURFACE_TENSION);
		options.setDefaultReal(Option::CONSTANT, Default::CONSTANT);
	}

} // namespace BALL