|
3 | 3 | #include "tool/rcman.h" |
4 | 4 |
|
5 | 5 | namespace tinker { |
6 | | -/// \ingroup box |
| 6 | +/// \addtogroup box |
| 7 | +/// \{ |
| 8 | + |
| 9 | +/// Shapes of the periodic box. |
7 | 10 | enum class BoxShape |
8 | 11 | { |
9 | | - UNBOUND, |
10 | | - ORTHO, |
11 | | - MONO, |
12 | | - TRI, |
13 | | - OCT |
| 12 | + UNBOUND, ///< unbound |
| 13 | + ORTHO, ///< orthorgonal |
| 14 | + MONO, ///< monoclinic |
| 15 | + TRI, ///< triclinic |
| 16 | + OCT ///< truncated octahedron |
14 | 17 | }; |
15 | 18 |
|
16 | | -/// \ingroup box |
17 | | -/// \brief Periodic boundary conditions (PBC). |
| 19 | +/// Internal data for the periodic boundary condition (PBC). |
18 | 20 | /// |
19 | 21 | /// PBC in Tinker is defined by lengths of three axes and three angles: |
20 | 22 | /// `a-axis`, `b-axis`, `c-axis`, `alpha`, `beta`, and `gamma`. |
@@ -51,90 +53,64 @@ enum class BoxShape |
51 | 53 | /// Reciprocal lattice (`recip`), is the inverse of `lvec`: |
52 | 54 | /// - Fortran: `recip(:,1)`, `recip(:,2)`, `recip(:,3)`; |
53 | 55 | /// - C++: `recip[0][]`, `recip[1][]`, `recip[2][]`; |
54 | | -/// - Fractional coordinates `fi (i=1,2,3) = recip(:,i) (xr,yr,zr)`; |
55 | | -/// - Cartesian coordinates `wr (w=1,2,3 or x,y,z) = inv_recip(:,w) (f1,f2,f3) |
56 | | -/// = lvec(:,w) (f1,f2,f3)`. |
| 56 | +/// - Fractional coordinates `fi = recip(:,i) (xr,yr,zr), (i=1,2,3)`; |
| 57 | +/// - Cartesian coordinates `wr = inv_recip(:,w) (f1,f2,f3) |
| 58 | +/// = lvec(:,w) (f1,f2,f3), (w=1,2,3 or x,y,z)`. |
57 | 59 | struct Box |
58 | 60 | { |
59 | 61 | BoxShape box_shape; |
60 | 62 | real3 lvec1, lvec2, lvec3; |
61 | 63 | real3 recipa, recipb, recipc; |
62 | 64 | }; |
63 | | -} |
64 | 65 |
|
65 | | -namespace tinker { |
66 | | -/// \ingroup box |
67 | | -void boxData(RcOp); |
68 | | -void boxDataP1(RcOp); |
69 | | -/// \ingroup box |
70 | | -void boxExtent(double newExtent); |
71 | | -/// \ingroup box |
72 | | -void boxSetCurrent(const Box& p); |
73 | | -/// \ingroup box |
74 | | -void boxGetCurrent(Box& p); |
75 | | -/// \ingroup box |
76 | | -void boxSetCurrentRecip(); |
77 | | -/// \ingroup box |
78 | | -void boxSetTinkerModule(const Box& p); |
79 | | - |
80 | | -/// \ingroup box |
81 | | -/// \brief Similar to Tinker `lattice` subroutine. |
82 | | -void boxLattice(Box& p, BoxShape sh, double a, double b, double c, // |
83 | | - double alphaDeg, double betaDeg, double gammaDeg); |
| 66 | +void boxData(RcOp); ///< Sets up box data on device. |
| 67 | +void boxDataP1(RcOp); ///< Internal function used in the setup. |
| 68 | +void boxExtent(double newExtent); ///< Sets up a hypothetical orthogonal box for the unbound box |
| 69 | + ///< whose a-axis equals the new extent. |
| 70 | +void boxSetCurrent(const Box& p); ///< Sets the box by the input and updates the box on device. |
| 71 | +void boxGetCurrent(Box& p); ///< Copies the current PBC box to the output variable. |
| 72 | +void boxSetCurrentRecip(); ///< Calculates the \c recip arrays by new \c lvec arrays and |
| 73 | + ///< updates the box on device |
| 74 | +void boxSetTinker(const Box& p); ///< Updates the related PBC modules of Tinker by \c p. |
84 | 75 |
|
85 | | -/// \ingroup box |
| 76 | +/// OpenACC only: Copies the current box data to device asynchronously. |
| 77 | +/// The implementations are empty for CPU and CUDA code because it is only in |
| 78 | +/// the OpenACC code that a copy of the PBC box is created on device. |
86 | 79 | void boxCopyin(); |
87 | 80 |
|
88 | | -/// \ingroup box |
89 | | -/// \brief Get the volume of the PBC box. |
| 81 | +/// Sets up the internal PBC data. Similar to Tinker \c lattice subroutine. |
| 82 | +void boxLattice(Box& p, BoxShape sh, // |
| 83 | + double a, double b, double c, // |
| 84 | + double alphaDeg, double betaDeg, double gammaDeg); |
| 85 | + |
| 86 | +/// Gets the volume of the PBC box. |
90 | 87 | /// \note This function may calculate the volume on-the-fly instead of using |
91 | 88 | /// an internal variable to save the volume. |
92 | 89 | /// \note The volume is undefined for the unbound box. |
93 | 90 | real boxVolume(); |
94 | | -} |
95 | 91 |
|
96 | 92 | //====================================================================// |
97 | 93 | // // |
98 | 94 | // Global Variables // |
99 | 95 | // // |
100 | 96 | //====================================================================// |
101 | 97 |
|
102 | | -namespace tinker { |
103 | | -/// \ingroup box |
104 | 98 | TINKER_EXTERN BoxShape box_shape; |
105 | | -/// \ingroup box |
106 | 99 | TINKER_EXTERN real3 lvec1; |
107 | | -/// \ingroup box |
108 | 100 | TINKER_EXTERN real3 lvec2; |
109 | | -/// \ingroup box |
110 | 101 | TINKER_EXTERN real3 lvec3; |
111 | | -/// \ingroup box |
112 | 102 | TINKER_EXTERN real3 recipa; |
113 | | -/// \ingroup box |
114 | 103 | TINKER_EXTERN real3 recipb; |
115 | | -/// \ingroup box |
116 | 104 | TINKER_EXTERN real3 recipc; |
117 | 105 |
|
118 | | -/// \def TINKER_IMAGE_LVEC_PARAMS |
119 | | -/// \ingroup box |
120 | | -/// \def TINKER_IMAGE_LVEC_ARGS |
121 | | -/// \ingroup box |
122 | | -/// \def TINKER_IMAGE_RECIP_PARAMS |
123 | | -/// \ingroup box |
124 | | -/// \def TINKER_IMAGE_RECIP_ARGS |
125 | | -/// \ingroup box |
126 | | -/// \def TINKER_IMAGE_PARAMS |
127 | | -/// \ingroup box |
128 | | -/// \def TINKER_IMAGE_ARGS |
129 | | -/// \ingroup box |
130 | 106 | #define TINKER_IMAGE_LVEC_PARAMS real3 lvec1, real3 lvec2, real3 lvec3 |
131 | 107 | #define TINKER_IMAGE_LVEC_ARGS lvec1, lvec2, lvec3 |
132 | 108 | #define TINKER_IMAGE_RECIP_PARAMS real3 recipa, real3 recipb, real3 recipc |
133 | 109 | #define TINKER_IMAGE_RECIP_ARGS recipa, recipb, recipc |
134 | 110 | #define TINKER_IMAGE_PARAMS BoxShape box_shape, TINKER_IMAGE_LVEC_PARAMS, TINKER_IMAGE_RECIP_PARAMS |
135 | 111 | #define TINKER_IMAGE_ARGS box_shape, TINKER_IMAGE_LVEC_ARGS, TINKER_IMAGE_RECIP_ARGS |
136 | 112 |
|
137 | | -/// \ingroup box |
138 | | -/// \brief Host pointer to the PBC boxes of a trajectory. |
139 | | -TINKER_EXTERN Box* trajbox; |
| 113 | +TINKER_EXTERN Box* trajbox; ///< Host pointer to the PBC boxes of a trajectory. |
| 114 | + |
| 115 | +/// \} |
140 | 116 | } |
0 commit comments