@@ -408,11 +408,12 @@ void induceMutualPcg4_acc(real (*uind)[3])
408
408
const real debye = units::debye;
409
409
const real pcgpeek = polpcg::pcgpeek;
410
410
const int maxiter = 100 ; // see also subroutine induce0a in induce.f
411
+ const int miniter = std::min (3 , n);
411
412
412
413
bool done = false ;
413
414
int iter = 0 ;
414
415
real eps = 100 ;
415
- real epsold;
416
+ // real epsold;
416
417
417
418
while (not done) {
418
419
++iter;
@@ -436,8 +437,7 @@ void induceMutualPcg4_acc(real (*uind)[3])
436
437
real a;
437
438
a = darray::dotThenReturn (g::q0, n, conj, vec);
438
439
// a <- r M r / p T p
439
- if (a != 0 )
440
- a = sum / a;
440
+ if (a != 0 ) a = sum / a;
441
441
442
442
// u <- u + a p
443
443
// r <- r - a T p
@@ -466,8 +466,7 @@ void induceMutualPcg4_acc(real (*uind)[3])
466
466
real sum1;
467
467
sum1 = darray::dotThenReturn (g::q0, n, rsd, zrsd);
468
468
b = sum1 / sum;
469
- if (sum == 0 )
470
- b = 0 ;
469
+ if (sum == 0 ) b = 0 ;
471
470
472
471
// calculate/update p
473
472
#pragma acc parallel loop independent async\
@@ -482,7 +481,7 @@ void induceMutualPcg4_acc(real (*uind)[3])
482
481
483
482
real epsd;
484
483
epsd = darray::dotThenReturn (g::q0, n, rsd, rsd);
485
- epsold = eps;
484
+ // epsold = eps;
486
485
eps = epsd;
487
486
eps = debye * REAL_SQRT (eps / n);
488
487
@@ -495,12 +494,10 @@ void induceMutualPcg4_acc(real (*uind)[3])
495
494
print (stdout, " %8d %-16.10f\n " , iter, eps);
496
495
}
497
496
498
- if (eps < poleps)
499
- done = true ;
500
- // if (eps > epsold)
501
- // done = true;
502
- if (iter >= politer)
503
- done = true ;
497
+ if (eps < poleps) done = true ;
498
+ // if (eps > epsold) done = true;
499
+ if (iter < miniter) done = false ;
500
+ if (iter >= politer) done = true ;
504
501
505
502
// apply a "peek" iteration to the mutual induced dipoles
506
503
@@ -520,14 +517,13 @@ void induceMutualPcg4_acc(real (*uind)[3])
520
517
521
518
if (debug) {
522
519
print (stdout,
523
- " Induced Dipoles : Iterations %4d RMS "
524
- " Residual %14.10f\n " ,
520
+ " Induced Dipoles : Iterations %4d RMS"
521
+ " Residual %14.10f\n " ,
525
522
iter, eps);
526
523
}
527
524
528
525
// terminate the calculation if dipoles failed to converge
529
526
530
- // if (iter >= maxiter || eps > epsold) {
531
527
if (iter >= maxiter) {
532
528
printError ();
533
529
TINKER_THROW (" INDUCE -- Warning, Induced Dipoles are not Converged" );
0 commit comments