kCalculateAmoebaCudaMutualInducedParticle.h 2.6 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

struct MutualInducedParticle {

    float x;
    float y;
    float z;

    float inducedDipole[3];
    float inducedDipolePolar[3];

    float thole;
    float damp;

    float field[3];
    float fieldPolar[3];

#ifdef GK
    float bornRadius;

    float inducedDipoleS[3];
    float inducedDipolePolarS[3];

    float fieldS[3];
    float fieldPolarS[3];
25
26
#else
    float padding;
Mark Friedrichs's avatar
Mark Friedrichs committed
27
#endif
Mark Friedrichs's avatar
Mark Friedrichs committed
28
29
30
31
32

#ifdef INCLUDE_MI_FIELD_BUFFERS
    float tempBuffer[3];
    float tempBufferP[3];
#endif
Mark Friedrichs's avatar
Mark Friedrichs committed
33
34
};

35
__device__ static void loadMutualInducedShared( MutualInducedParticle* sA, unsigned int atomI )
Mark Friedrichs's avatar
Mark Friedrichs committed
36
37
38
{
    // coordinates & charge

39
40
41
42
    float4 posq                  = cSim.pPosq[atomI];
    sA->x                        = posq.x;
    sA->y                        = posq.y;
    sA->z                        = posq.z;
Mark Friedrichs's avatar
Mark Friedrichs committed
43
44
45

    // dipole

46
47
48
    sA->inducedDipole[0]         = cAmoebaSim.pInducedDipole[atomI*3];
    sA->inducedDipole[1]         = cAmoebaSim.pInducedDipole[atomI*3+1];
    sA->inducedDipole[2]         = cAmoebaSim.pInducedDipole[atomI*3+2];
Mark Friedrichs's avatar
Mark Friedrichs committed
49
50
51

    // dipole polar

52
53
54
    sA->inducedDipolePolar[0]    = cAmoebaSim.pInducedDipolePolar[atomI*3];
    sA->inducedDipolePolar[1]    = cAmoebaSim.pInducedDipolePolar[atomI*3+1];
    sA->inducedDipolePolar[2]    = cAmoebaSim.pInducedDipolePolar[atomI*3+2];
Mark Friedrichs's avatar
Mark Friedrichs committed
55

56
57
58
    float2 dampingFactorAndThole = cAmoebaSim.pDampingFactorAndThole[atomI];
    sA->damp                     = dampingFactorAndThole.x;
    sA->thole                    = dampingFactorAndThole.y;
Mark Friedrichs's avatar
Mark Friedrichs committed
59
60
61

#ifdef GK

62
    sA->bornRadius               =  cSim.pBornRadii[atomI];
Mark Friedrichs's avatar
Mark Friedrichs committed
63
64
65

    // dipoleS

66
67
68
    sA->inducedDipoleS[0]        = cAmoebaSim.pInducedDipoleS[atomI*3];
    sA->inducedDipoleS[1]        = cAmoebaSim.pInducedDipoleS[atomI*3+1];
    sA->inducedDipoleS[2]        = cAmoebaSim.pInducedDipoleS[atomI*3+2];
Mark Friedrichs's avatar
Mark Friedrichs committed
69
70
71

    // dipole polar S

72
73
74
    sA->inducedDipolePolarS[0]   = cAmoebaSim.pInducedDipolePolarS[atomI*3];
    sA->inducedDipolePolarS[1]   = cAmoebaSim.pInducedDipolePolarS[atomI*3+1];
    sA->inducedDipolePolarS[2]   = cAmoebaSim.pInducedDipolePolarS[atomI*3+2];
Mark Friedrichs's avatar
Mark Friedrichs committed
75
76
77
78

#endif
}

79
__device__ static void zeroMutualInducedParticleSharedField( MutualInducedParticle* sA )
Mark Friedrichs's avatar
Mark Friedrichs committed
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

{
    // zero shared fields

    sA->field[0]              = 0.0f;
    sA->field[1]              = 0.0f;
    sA->field[2]              = 0.0f;

    sA->fieldPolar[0]         = 0.0f;
    sA->fieldPolar[1]         = 0.0f;
    sA->fieldPolar[2]         = 0.0f;

#ifdef GK
    sA->fieldS[0]             = 0.0f;
    sA->fieldS[1]             = 0.0f;
    sA->fieldS[2]             = 0.0f;

    sA->fieldPolarS[0]        = 0.0f;
    sA->fieldPolarS[1]        = 0.0f;
    sA->fieldPolarS[2]        = 0.0f;
#endif

}