| 6 |
|
* redistribute this software in source and binary code form, provided |
| 7 |
|
* that the following conditions are met: |
| 8 |
|
* |
| 9 |
< |
* 1. Acknowledgement of the program authors must be made in any |
| 10 |
< |
* publication of scientific results based in part on use of the |
| 11 |
< |
* program. An acceptable form of acknowledgement is citation of |
| 12 |
< |
* the article in which the program was described (Matthew |
| 13 |
< |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
| 14 |
< |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
| 15 |
< |
* Parallel Simulation Engine for Molecular Dynamics," |
| 16 |
< |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
| 17 |
< |
* |
| 18 |
< |
* 2. Redistributions of source code must retain the above copyright |
| 9 |
> |
* 1. Redistributions of source code must retain the above copyright |
| 10 |
|
* notice, this list of conditions and the following disclaimer. |
| 11 |
|
* |
| 12 |
< |
* 3. Redistributions in binary form must reproduce the above copyright |
| 12 |
> |
* 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
|
* notice, this list of conditions and the following disclaimer in the |
| 14 |
|
* documentation and/or other materials provided with the |
| 15 |
|
* distribution. |
| 28 |
|
* arising out of the use of or inability to use software, even if the |
| 29 |
|
* University of Notre Dame has been advised of the possibility of |
| 30 |
|
* such damages. |
| 31 |
+ |
* |
| 32 |
+ |
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
| 33 |
+ |
* research, please cite the appropriate papers when you publish your |
| 34 |
+ |
* work. Good starting points are: |
| 35 |
+ |
* |
| 36 |
+ |
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
+ |
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
+ |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 39 |
+ |
* [4] Vardeman & Gezelter, in progress (2009). |
| 40 |
|
*/ |
| 41 |
|
|
| 42 |
|
/** |
| 51 |
|
#include "utils/NumericConstant.hpp" |
| 52 |
|
#include "utils/simError.h" |
| 53 |
|
#include "utils/Utility.hpp" |
| 54 |
< |
namespace oopse { |
| 54 |
> |
namespace OpenMD { |
| 55 |
|
|
| 56 |
|
void Snapshot::setHmat(const Mat3x3d& m) { |
| 57 |
– |
const double orthoTolerance = NumericConstant::epsilon; |
| 57 |
|
hmat_ = m; |
| 58 |
|
invHmat_ = hmat_.inverse(); |
| 59 |
|
|
| 60 |
+ |
|
| 61 |
|
//prepare fortran Hmat |
| 62 |
< |
double fortranHmat[9]; |
| 63 |
< |
double fortranInvHmat[9]; |
| 62 |
> |
RealType fortranHmat[9]; |
| 63 |
> |
RealType fortranInvHmat[9]; |
| 64 |
|
hmat_.getArray(fortranHmat); |
| 65 |
|
invHmat_.getArray(fortranInvHmat); |
| 66 |
|
|
| 67 |
|
//determine whether the box is orthoTolerance or not |
| 68 |
|
int oldOrthoRhombic = orthoRhombic_; |
| 69 |
|
|
| 70 |
< |
double smallDiag = fabs(hmat_(0, 0)); |
| 70 |
> |
RealType smallDiag = fabs(hmat_(0, 0)); |
| 71 |
|
if(smallDiag > fabs(hmat_(1, 1))) smallDiag = fabs(hmat_(1, 1)); |
| 72 |
|
if(smallDiag > fabs(hmat_(2, 2))) smallDiag = fabs(hmat_(2, 2)); |
| 73 |
< |
double tol = smallDiag * orthoTolerance; |
| 73 |
> |
RealType tol = smallDiag * orthoTolerance_; |
| 74 |
|
|
| 75 |
|
orthoRhombic_ = 1; |
| 76 |
|
|
| 89 |
|
|
| 90 |
|
if( orthoRhombic_ ) { |
| 91 |
|
sprintf( painCave.errMsg, |
| 92 |
< |
"OOPSE is switching from the default Non-Orthorhombic\n" |
| 92 |
> |
"OpenMD is switching from the default Non-Orthorhombic\n" |
| 93 |
|
"\tto the faster Orthorhombic periodic boundary computations.\n" |
| 94 |
|
"\tThis is usually a good thing, but if you want the\n" |
| 95 |
|
"\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" |
| 96 |
|
"\tvariable ( currently set to %G ) smaller.\n", |
| 97 |
< |
orthoTolerance); |
| 98 |
< |
painCave.severity = OOPSE_INFO; |
| 97 |
> |
orthoTolerance_); |
| 98 |
> |
painCave.severity = OPENMD_INFO; |
| 99 |
|
simError(); |
| 100 |
|
} |
| 101 |
|
else { |
| 102 |
|
sprintf( painCave.errMsg, |
| 103 |
< |
"OOPSE is switching from the faster Orthorhombic to the more\n" |
| 103 |
> |
"OpenMD is switching from the faster Orthorhombic to the more\n" |
| 104 |
|
"\tflexible Non-Orthorhombic periodic boundary computations.\n" |
| 105 |
|
"\tThis is usually because the box has deformed under\n" |
| 106 |
|
"\tNPTf integration. If you want to live on the edge with\n" |
| 107 |
|
"\tthe Orthorhombic computations, make the orthoBoxTolerance\n" |
| 108 |
|
"\tvariable ( currently set to %G ) larger.\n", |
| 109 |
< |
orthoTolerance); |
| 110 |
< |
painCave.severity = OOPSE_WARNING; |
| 109 |
> |
orthoTolerance_); |
| 110 |
> |
painCave.severity = OPENMD_WARNING; |
| 111 |
|
simError(); |
| 112 |
|
} |
| 113 |
|
} |
| 156 |
|
|
| 157 |
|
} |
| 158 |
|
|
| 159 |
+ |
Vector3d Snapshot::getCOM() { |
| 160 |
+ |
if( !hasCOM_ ) { |
| 161 |
+ |
sprintf( painCave.errMsg, "COM was requested before COM was computed!\n"); |
| 162 |
+ |
painCave.severity = OPENMD_ERROR; |
| 163 |
+ |
simError(); |
| 164 |
+ |
} |
| 165 |
+ |
return COM_; |
| 166 |
+ |
} |
| 167 |
+ |
|
| 168 |
+ |
Vector3d Snapshot::getCOMvel() { |
| 169 |
+ |
if( !hasCOM_ ) { |
| 170 |
+ |
sprintf( painCave.errMsg, "COMvel was requested before COM was computed!\n"); |
| 171 |
+ |
painCave.severity = OPENMD_ERROR; |
| 172 |
+ |
simError(); |
| 173 |
+ |
} |
| 174 |
+ |
return COMvel_; |
| 175 |
+ |
} |
| 176 |
+ |
|
| 177 |
+ |
Vector3d Snapshot::getCOMw() { |
| 178 |
+ |
if( !hasCOM_ ) { |
| 179 |
+ |
sprintf( painCave.errMsg, "COMw was requested before COM was computed!\n"); |
| 180 |
+ |
painCave.severity = OPENMD_ERROR; |
| 181 |
+ |
simError(); |
| 182 |
+ |
} |
| 183 |
+ |
return COMw_; |
| 184 |
+ |
} |
| 185 |
+ |
|
| 186 |
|
} |
| 187 |
|
|