source: src/samples/bspline.cpp@ ac6d04

Last change on this file since ac6d04 was ac6d04, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Merge recent changes of the vmg library into ScaFaCos.

Includes a fix for the communication problems on Jugene.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1666 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[dfed1c]1/**
2 * @file bspline.cpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Nov 21 13:27:22 2011
5 *
6 * @brief B-Splines for molecular dynamics.
7 *
8 */
9
10#ifdef HAVE_CONFIG_H
11#include <config.h>
12#endif
13
14#ifndef BSPLINE_DEGREE
15#error BSPLINE_DEGREE not defined.
16#endif
17
18#if BSPLINE_DEGREE < 3 || BSPLINE_DEGREE > 6
19#error Please choose a B-Spline degree between 3 and 6
20#endif
21
22#include "base/helper.hpp"
[ac6d04]23#include "base/math.hpp"
[dfed1c]24#include "samples/bspline.hpp"
25
26#define POW(x,y) Helper::pow(x,y)
27
28using namespace VMG;
29
30BSpline::BSpline(const vmg_float& width) :
[ac6d04]31 spline_nom(BSPLINE_DEGREE/2+1),
32 spline_denom(BSPLINE_DEGREE/2+1),
33 potential_nom(BSPLINE_DEGREE/2+2),
34 potential_denom(BSPLINE_DEGREE/2+2),
35 intervals(BSPLINE_DEGREE/2+1),
[dfed1c]36 R(width)
37{
38 for (unsigned int i=0; i<intervals.size(); ++i)
39 intervals[i] = R * ( -1.0 + 2.0 / static_cast<vmg_float>(BSPLINE_DEGREE) * (i + BSPLINE_DEGREE/2 + 1));
40
41#if BSPLINE_DEGREE == 3
42
43 spline_nom[0] = Polynomial(2, 81.0*POW(R,2), 0.0, -243.0);
44 spline_nom[1] = Polynomial(2, 243.0*POW(R,2), -486.0*R, 243.0);
45
[ac6d04]46 spline_denom[0] = Polynomial(0, 16.0 * Math::pi * POW(R,5));
47 spline_denom[1] = Polynomial(0, 32.0 * Math::pi * POW(R,5));
[dfed1c]48
49 potential_nom[0] = Polynomial(5,
50 0.0,
51 -195.0*POW(R,4),
52 0.0,
53 270.0*POW(R,2),
54 0.0,
55 -243.0);
56
57 potential_nom[1] = Polynomial(5,
58 2.0*POW(R,5),
59 -405.0*POW(R,4),
60 0.0,
61 810.0*POW(R,2),
62 -810.0*R,
63 243.0);
64
65 potential_nom[2] = Polynomial(0, -1.0);
66
[ac6d04]67 potential_denom[0] = Polynomial(0, 80.0*POW(R,5));
68 potential_denom[1] = Polynomial(0, 160.0*POW(R,5));
69 potential_denom[2] = Polynomial(0, 1.0);
[dfed1c]70
[ac6d04]71 antid = 13.0 / 48.0 * R;
[dfed1c]72
[ac6d04]73#else
74#error B-Spline degree not supported. Choose 3.
[dfed1c]75#endif /* BSPLINE_DEGREE */
76}
Note: See TracBrowser for help on using the repository browser.