File: forceFieldComponent.C

package info (click to toggle)
ball 1.4.3~beta1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 318,984 kB
  • sloc: cpp: 346,579; ansic: 4,097; python: 2,664; yacc: 1,778; lex: 1,099; xml: 964; sh: 688; sql: 316; awk: 118; makefile: 108
file content (117 lines) | stat: -rw-r--r-- 2,101 bytes parent folder | download | duplicates (3)
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
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: forceFieldComponent.C,v 1.12.26.1 2007/03/25 22:00:30 oliver Exp $
//


#include <BALL/MOLMEC/COMMON/forceFieldComponent.h>

using namespace std;

namespace BALL 
{

	// default constructor 
	ForceFieldComponent::ForceFieldComponent()
		: force_field_(0),
			energy_(0),
			name_("GenericForceFieldComponent"),
			enabled_(1)
	{
	}

	// constructor 
	ForceFieldComponent::ForceFieldComponent(ForceField& force_field)
		: force_field_(&force_field),
			energy_(0),
			name_("GenericForceFieldComponent"),
			enabled_(true)
	{
	}

	// copy constructor 
	ForceFieldComponent::ForceFieldComponent(const ForceFieldComponent& force_field_component)
		: force_field_(force_field_component.force_field_),
			energy_(force_field_component.energy_),
			name_(force_field_component.name_),
			enabled_(force_field_component.enabled_)
	{
	}


	// destructor
	ForceFieldComponent::~ForceFieldComponent()
	{
	}

	// setup
	bool ForceFieldComponent::setup()
		throw(Exception::TooManyErrors)
	{
		return true;
	}

	// update pair lists - empty!
	void update()
		throw(Exception::TooManyErrors)
	{
	}

	// Set the name of the component
	void ForceFieldComponent::setName(const String& name)
	{
		name_ = name;
	}

	// Return the name of the component
	String ForceFieldComponent::getName() const
	{
		return name_;
	}

	// Return a pointer to the force field
	ForceField* ForceFieldComponent::getForceField() const
	{
		return force_field_;
	}

	// Set the force field to force_field 
	void ForceFieldComponent::setForceField(ForceField& force_field)
	{
		force_field_ = &force_field;
	}

	double ForceFieldComponent::getEnergy() const
	{
		if (!isEnabled()) return 0.;
		return energy_;
	}

	double ForceFieldComponent::updateEnergy()
	{
		return 0.0;
	}

	void ForceFieldComponent::updateForces() 
	{
	}

	void ForceFieldComponent::update()
		throw(Exception::TooManyErrors)
	{
	}

	double ForceFieldComponent::updateScore()
	{
		score_ = updateEnergy();

		/*
		scaleScore();
		return score_;
		*/

		return getScaledScore();
	}

} // namespace BALL