8#include "shiftToMinimum.h"
17 IntVec<1> shiftToMinimum(IntVec<1>& v, IntVec<1> d, UnitCell<1>
const & cell)
23 if (v[0] < -(d[0]/2) ) {
33 IntVec<2> shiftToMinimum(IntVec<2>& v, IntVec<2> d, UnitCell<2>
const & cell)
36 const double epsilon = 1.0E-6;
37 double Gsq = cell.ksq(v);
38 double Gsq_min_lo = Gsq - epsilon;
39 double Gsq_min_hi = Gsq + epsilon;
46 for (s0 = -q; s0 < q+1; ++s0) {
47 u[0] = v[0] + s0*d[0];
48 for (s1 = -q; s1 < q+1; ++s1) {
49 u[1] = v[1] + s1*d[1];
51 if (Gsq < Gsq_min_hi) {
52 if ((Gsq < Gsq_min_lo) || (r < u)) {
53 Gsq_min_lo = Gsq - epsilon;
54 Gsq_min_hi = Gsq + epsilon;
64 IntVec<3> shiftToMinimum(IntVec<3>& v, IntVec<3> d, UnitCell<3>
const & cell)
67 const double epsilon = 1.0E-6;
68 double Gsq = cell.ksq(v);
69 double Gsq_min_lo = Gsq - epsilon;
70 double Gsq_min_hi = Gsq + epsilon;
77 for (s0 = -q; s0 < q + 1; ++s0) {
78 u[0] = v[0] + s0*d[0];
79 for (s1 = -q; s1 < q + 1; ++s1) {
80 u[1] = v[1] + s1*d[1];
81 for (s2 = -q; s2 < q + 1; ++s2) {
82 u[2] = v[2] + s2*d[2];
84 if (Gsq < Gsq_min_hi) {
85 if ((Gsq < Gsq_min_lo) || (r < u)) {
86 Gsq_min_lo = Gsq - epsilon;
87 Gsq_min_hi = Gsq + epsilon;
File containing preprocessor macros for error handling.
#define UTIL_ASSERT(condition)
Assertion macro suitable for debugging serial or parallel code.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.