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
|
#ifndef FORCEFIELD_H
#define FORCEFIELD_H
#include "basetypes.h"
#include "rigidbody.h"
#include "attractrigidbody.h"
#include "pairlist.h"
namespace PTools
{
void PrintVec(const Vdouble& vec);
//! Generic forcefield (abstract class)
/**
*/
class ForceField
{
public:
///the function to optimize
virtual dbl Function(const Vdouble&)=0;
/// analytical derivative of the function above
virtual void Derivatives(const Vdouble& StateVars, Vdouble& delta)
{
NumDerivatives(StateVars, delta, true);
}
///numerical derivative for testing purpose. Not very accurate
virtual void NumDerivatives(const Vdouble& StateVars, Vdouble& delta, bool print=false);
///size of the problem (number of variables the minimizer must optimize)
virtual uint ProblemSize()=0;
///this function is called at the beginning of a minimization, by the minimizer (Lbfgs)
virtual void initMinimization()=0;
///virtual destructor (Effective C++ - Scott Meyers - Item 7)
virtual ~ForceField(){};
} ;
} //namespace PTools
#endif //#ifndef FORCEFIELD_H
|