GpuFreeEnergyCudaKernels.h 7.21 KB
Newer Older
Mark Friedrichs's avatar
Mark Friedrichs committed
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
#ifndef __GPU_FREE_ENERGY_KERNELS_H__
#define __GPU_FREE_ENERGY_KERNELS_H__

/* -------------------------------------------------------------------------- *
 *                                   OpenMM                                   *
 * -------------------------------------------------------------------------- *
 * This is part of the OpenMM molecular simulation toolkit originating from   *
 * Simbios, the NIH National Center for Physics-Based Simulation of           *
 * Biological Structures at Stanford, funded under the NIH Roadmap for        *
 * Medical Research, grant U54 GM072970. See https://simtk.org.               *
 *                                                                            *
 * Portions copyright (c) 2009 Stanford University and the Authors.           *
 * Authors: Scott Le Grand, Peter Eastman                                     *
 * Contributors:                                                              *
 *                                                                            *
 * This program is free software: you can redistribute it and/or modify       *
 * it under the terms of the GNU Lesser General Public License as published   *
 * by the Free Software Foundation, either version 3 of the License, or       *
 * (at your option) any later version.                                        *
 *                                                                            *
 * This program is distributed in the hope that it will be useful,            *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU Lesser General Public License for more details.                        *
 *                                                                            *
 * You should have received a copy of the GNU Lesser General Public License   *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.      *
 * -------------------------------------------------------------------------- */

#include "gputypes.h"
#include "cudatypes.h"
#include "GpuNonbondedSoftcore.h"
#include "GpuLJ14Softcore.h"
#include "GpuObcGbsaSoftcore.h"
#include "GpuGBVISoftcore.h"
#include <vector>

// Function prototypes

// CDLJ softcore

// setup methods called from CudaFreeEnergyKernels
// nonbonded and 1-4 ixns

extern "C" 
GpuNonbondedSoftcore* gpuSetNonbondedSoftcoreParameters(gpuContext gpu, float epsfac, const std::vector<int>& atom, const std::vector<float>& c6,
                                                        const std::vector<float>& c12, const std::vector<float>& q,
                                                        const std::vector<float>& softcoreLJLambdaArray, const std::vector<char>& symbol,
                                                        const std::vector<std::vector<int> >& exclusions, CudaNonbondedMethod method);

extern "C" 
GpuLJ14Softcore* gpuSetLJ14SoftcoreParameters(gpuContext gpu, float epsfac, float fudge, const std::vector<int>& atom1,
                                              const std::vector<int>& atom2, const std::vector<float>& c6, const std::vector<float>& c12,
                                              const std::vector<float>& q1, const std::vector<float>& q2, const std::vector<float>& softcoreLJLambdaArray);

// delete supplemtentary objects, ...

extern "C"
void gpuDeleteNonbondedSoftcoreParameters( void* gpuNonbondedSoftcore);

// write address's to device

extern "C"
void SetCalculateCDLJSoftcoreGpuSim( gpuContext gpu );

extern "C"
void SetCalculateCDLJSoftcoreSupplementarySim( float* gpuParticleSoftCoreLJLambda);

extern "C"
void SetCalculateLocalSoftcoreGpuSim( gpuContext gpu );

// kernel calls to device

extern "C"
void kCalculateCDLJSoftcoreForces(gpuContext gpu );

extern void kCalculateLocalSoftcoreForces( gpuContext gpu );



// GB/VI softcore

// setup method called from CudaFreeEnergyKernels

extern "C" 
GpuGBVISoftcore* gpuSetGBVISoftcoreParameters(gpuContext gpu, float innerDielectric, float solventDielectric, const std::vector<int>& atom, const std::vector<float>& radius, 
                                              const std::vector<float>& gamma, const std::vector<float>& scaledRadii,
                                              const std::vector<float>& bornRadiusScaleFactors, const std::vector<float>& quinticSplineParameters);

// delete supplemtentary objects, ...

extern "C"
void gpuDeleteGBVISoftcoreParameters( void* gpuNonbondedSoftcore);

// write address's to device

extern "C"
void SetCalculateGBVISoftcoreForcesSim( gpuContext gpu, float* softCoreLJLambda);

extern "C"
void SetCalculateGBVISoftcoreBornSumGpuSim( gpuContext gpu);

extern "C"
void SetCalculateGBVISoftcoreSupplementarySim( GpuGBVISoftcore* gpuGBVISoftcore );

106
107
108
109
110
111
extern "C"
void SetCalculateGBVISoftcoreForces2Sim(gpuContext gpu);

extern "C"
void GetCalculateGBVISoftcoreForces2Sim(gpuContext gpu);

Mark Friedrichs's avatar
Mark Friedrichs committed
112
113
114
115
116
// kernel calls to device

extern void kReduceGBVIBornSumQuinticScaling( gpuContext gpu, GpuGBVISoftcore* gpuGBVISoftcore );
extern void kCalculateGBVISoftcoreBornSum( gpuContext gpu );
extern void kReduceGBVIBornForcesQuinticScaling( gpuContext gpu );
117
extern void kCalculateGBVISoftcoreForces2( gpuContext gpu );
Mark Friedrichs's avatar
Mark Friedrichs committed
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

// Obc softcore

// setup method called from CudaFreeEnergyKernels

/** 
 * Initialize parameters for Cuda Obc softcore
 * 
 * @param gpu                  gpu context
 * @param innerDielectric      solute dielectric
 * @param solventDielectric    solvent dielectric
 * @param radius               intrinsic Born radii
 * @param scale                Obc scaling factors
 * @param charge               atomic charges (possibly overwritten by other methods?)
 * @param nonPolarScalingFactors non-polar scaling factors
 *
 */

extern "C" 
137
138
GpuObcGbsaSoftcore* gpuSetObcSoftcoreParameters(gpuContext gpu, float innerDielectric, float solventDielectric, float nonPolarPrefactor,
                                                const std::vector<float>& radius, const std::vector<float>& scale,
Mark Friedrichs's avatar
Mark Friedrichs committed
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
                                                const std::vector<float>& charge, const std::vector<float>& nonPolarScalingFactors);

// delete supplemtentary objects, ...

extern "C"
void gpuDeleteObcSoftcoreParameters( void* gpuNonbondedSoftcore);

// write address's to device

extern "C"
void SetCalculateObcGbsaSoftcoreBornSumSim( gpuContext gpu );

extern "C"
void SetCalculateObcGbsaSoftcoreNonPolarScalingFactorsSim( float* nonPolarScalingFactors );

// this method and kCalculateObcGbsaSoftcoreForces2() are being
// used until changes in OpenMM version are made 
extern "C"
void SetCalculateObcGbsaSoftcoreForces2Sim( gpuContext gpu );

// kernel calls to device

161
extern void kReduceObcGbsaSoftcoreBornForces( gpuContext gpu );
Mark Friedrichs's avatar
Mark Friedrichs committed
162
163
164
165
extern void kCalculateObcGbsaSoftcoreBornSum( gpuContext gpu );

// this method is not needed; the OpenMM version can be used
extern void kCalculateObcGbsaSoftcoreForces2( gpuContext gpu );
166
extern void kPrintForces( gpuContext gpu, std::string idString, int call );
Mark Friedrichs's avatar
Mark Friedrichs committed
167
168
169
170
171
172
173
174
175
176
177
178
179


// shared

extern "C"
void SetCalculateCDLJObcGbsaSoftcoreGpu1Sim( gpuContext gpu );

extern "C"
void SetCalculateCDLJObcGbsaSoftcoreSupplementary1Sim( float* gpuParticleSoftCoreLJLambda);

extern void kCalculateCDLJObcGbsaSoftcoreForces1( gpuContext gpu );

#endif //__GPU_FREE_ENERGY_KERNELS_H__