Skip to content

Commit de1defa

Browse files
committed
fix when usolve-cutoff is 0
1 parent 6b19991 commit de1defa

File tree

7 files changed

+18
-8
lines changed

7 files changed

+18
-8
lines changed

src/acc/amoeba/induce.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "ff/atom.h"
44
#include "ff/image.h"
55
#include "ff/nblist.h"
6+
#include "ff/switch.h"
67
#include "math/lu.h"
78
#include "seq/add.h"
89
#include "seq/damp.h"
@@ -50,7 +51,7 @@ void induceMutualPcg1_acc(real (*uind)[3], real (*uinp)[3])
5051

5152
// use sparse matrix preconditioner
5253
// or just use diagonal matrix preconditioner
53-
const bool sparse_prec = polpcg::pcgprec;
54+
const bool sparse_prec = polpcg::pcgprec and (switchOff(Switch::USOLVE) > 0);
5455
bool dirguess = polpcg::pcgguess;
5556
bool predict = polpred != UPred::NONE;
5657
if (predict and nualt < maxualt) {

src/acc/aplus/induce.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "ff/atom.h"
55
#include "ff/image.h"
66
#include "ff/nblist.h"
7+
#include "ff/switch.h"
78
#include "seq/add.h"
89
#include "seq/damp.h"
910
#include "tool/error.h"
@@ -26,7 +27,7 @@ void induceMutualPcg3_acc(real (*uind)[3])
2627
bool dirguess = polpcg::pcgguess;
2728
// use sparse matrix preconditioner
2829
// or just use diagonal matrix preconditioner
29-
const bool sparse_prec = polpcg::pcgprec;
30+
const bool sparse_prec = polpcg::pcgprec and (switchOff(Switch::USOLVE) > 0);
3031

3132
// zero out the induced dipoles at each site
3233

src/acc/hippo/induce.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "ff/hippomod.h"
66
#include "ff/image.h"
77
#include "ff/nblist.h"
8+
#include "ff/switch.h"
89
#include "math/lu.h"
910
#include "seq/add.h"
1011
#include "seq/damp_hippo.h"
@@ -47,7 +48,7 @@ void induceMutualPcg2_acc(real (*uind)[3])
4748
bool dirguess = polpcg::pcgguess;
4849
// use sparse matrix preconditioner
4950
// or just use diagonal matrix preconditioner
50-
const bool sparse_prec = polpcg::pcgprec;
51+
const bool sparse_prec = polpcg::pcgprec and (switchOff(Switch::USOLVE) > 0);
5152

5253
// zero out the induced dipoles at each site
5354

src/cu/amoeba/pcg.cu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "ff/amoeba/induce.h"
22
#include "ff/amoebamod.h"
3+
#include "ff/switch.h"
34
#include "seq/launch.h"
45
#include "tool/error.h"
56
#include "tool/ioprint.h"
@@ -150,7 +151,7 @@ void induceMutualPcg1_cu(real (*uind)[3], real (*uinp)[3])
150151
auto* vec = work09_;
151152
auto* vecp = work10_;
152153

153-
const bool sparse_prec = polpcg::pcgprec;
154+
const bool sparse_prec = polpcg::pcgprec and (switchOff(Switch::USOLVE) > 0);
154155
bool dirguess = polpcg::pcgguess;
155156
bool predict = polpred != UPred::NONE;
156157
if (predict and nualt < maxualt) {

src/cu/aplus/pcg.cu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "ff/amoeba/induce.h"
22
#include "ff/amoebamod.h"
33
#include "ff/aplus/induce.h"
4+
#include "ff/switch.h"
45
#include "seq/launch.h"
56
#include "tool/error.h"
67
#include "tool/ioprint.h"
@@ -119,7 +120,7 @@ void induceMutualPcg3_cu(real (*uind)[3])
119120
auto* conj = work04_;
120121
auto* vec = work05_;
121122

122-
const bool sparse_prec = polpcg::pcgprec;
123+
const bool sparse_prec = polpcg::pcgprec and (switchOff(Switch::USOLVE) > 0);
123124
bool dirguess = polpcg::pcgguess;
124125
bool predict = polpred != UPred::NONE;
125126
if (predict and nualt < maxualt) {

src/cu/hippo/pcg.cu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "ff/amoeba/induce.h"
22
#include "ff/amoebamod.h"
33
#include "ff/hippo/induce.h"
4+
#include "ff/switch.h"
45
#include "seq/launch.h"
56
#include "tool/error.h"
67
#include "tool/ioprint.h"
@@ -119,7 +120,7 @@ void induceMutualPcg2_cu(real (*uind)[3])
119120
auto* conj = work04_;
120121
auto* vec = work05_;
121122

122-
const bool sparse_prec = polpcg::pcgprec;
123+
const bool sparse_prec = polpcg::pcgprec and (switchOff(Switch::USOLVE) > 0);
123124
bool dirguess = polpcg::pcgguess;
124125
bool predict = polpred != UPred::NONE;
125126
if (predict and nualt < maxualt) {

src/nblist.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,14 @@ Nbl ulistVersion()
148148
if (not use(Potent::POLAR)) {
149149
u = Nbl::UNDEFINED;
150150
} else if (!limits::use_ulist) {
151+
// if usolvcut > 0, the preconditioner is still used even though use_ulist is false
152+
if (switchOff(Switch::USOLVE) <= 0)
153+
u = Nbl::UNDEFINED;
154+
else
151155
#if TINKER_GPULANG_CUDA
152-
u = Nbl::SPATIAL;
156+
u = Nbl::SPATIAL;
153157
#else
154-
u = Nbl::DOUBLE_LOOP, pltfm_config = Platform::ACC;
158+
u = Nbl::DOUBLE_LOOP, pltfm_config = Platform::ACC;
155159
#endif
156160
} else if (!bound::use_bounds) {
157161
#if TINKER_GPULANG_CUDA

0 commit comments

Comments
 (0)