ReferencePME.h 3.5 KB
Newer Older
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
/* 
 * Reference implementation of PME reciprocal space interactions.
 * 
 * Copyright (c) 2009, Erik Lindahl, Rossen Apostolov, Szilard Pall
 * All rights reserved.
 * Contact: lindahl@cbr.su.se Stockholm University, Sweden.
 * 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this 
 * list of conditions and the following disclaimer. Redistributions in binary 
 * form must reproduce the above copyright notice, this list of conditions and 
 * the following disclaimer in the documentation and/or other materials provided 
 * with the distribution.
 * Neither the name of the author/university nor the names of its contributors may 
 * be used to endorse or promote products derived from this software without 
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 */

32
33
34
#ifndef __ReferencePME_H__
#define __ReferencePME_H__

35
#include "RealVec.h"
36
#include "openmm/internal/windowsExport.h"
37
#include <vector>
38

39
40
namespace OpenMM {

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
typedef RealOpenMM rvec[3];


typedef struct pme *
pme_t;

/*
 * Initialize a PME calculation and set up data structures
 *
 * Arguments:
 * 
 * ppme        Pointer to an opaque pme_t object
 * ewaldcoeff  Coefficient derived from the beta factor to participate
 *             direct/reciprocal space. See gromacs code for documentation!
 *             We assume that you are using nm units...
 * natoms      Number of atoms to set up data structure sof
 * ngrid       Size of the full pme grid
 * pme_order   Interpolation order, almost always 4
 * epsilon_r   Dielectric coefficient, typically 1.0.
 */
61
int OPENMM_EXPORT
62
pme_init(pme_t *       ppme,
peastman's avatar
peastman committed
63
         RealOpenMM    ewaldcoeff,
64
         int           natoms,
peastman's avatar
peastman committed
65
         const int     ngrid[3],
66
         int           pme_order,
peastman's avatar
peastman committed
67
         RealOpenMM    epsilon_r);
68
69
70
71
72
73
74
75
76
77
78
79
80

/*
 * Evaluate reciprocal space PME energy and forces.
 *
 * Args:
 *
 * pme         Opaque pme_t object, must have been initialized with pme_init()
 * x           Pointer to coordinate data array (nm)
 * f           Pointer to force data array (will be written as kJ/mol/nm)
 * charge      Array of charges (units of e)
 * box         Simulation cell dimensions (nm)
 * energy      Total energy (will be written in units of kJ/mol)
 */
81
int OPENMM_EXPORT
82
pme_exec(pme_t       pme,
83
         const std::vector<OpenMM::RealVec>& atomCoordinates,
peastman's avatar
peastman committed
84
         std::vector<OpenMM::RealVec>& forces,
85
         const std::vector<RealOpenMM>& charges,
86
87
         const OpenMM::RealVec  periodicBoxVectors[3],
         RealOpenMM *    energy);
88
89
90
91



/* Release all memory in pme structure */
92
int OPENMM_EXPORT
93
pme_destroy(pme_t    pme);
94
95
96
97

} // namespace OpenMM

#endif // __ReferencePME_H__