From 6b92a6bdba26aae624dac4e6a8c7eaabd853e4d5 Mon Sep 17 00:00:00 2001 From: Eric Bylaska Date: Fri, 23 Jun 2023 18:32:53 -0700 Subject: [PATCH] Checking in psp library changes...EJB --- src/nwpw/nwpwlib/control/control.F | 21 +++++++++++++++++++++ src/nwpw/nwpwlib/control/control.fh | 6 ++++-- src/nwpw/pspw/cpsd/inner_loop.F | 12 +++++++++--- src/nwpw/pspw/cpsd/psi_lmbda_paw.f | 9 +++++++-- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/nwpw/nwpwlib/control/control.F b/src/nwpw/nwpwlib/control/control.F index ca16830bfe..b790ba62df 100644 --- a/src/nwpw/nwpwlib/control/control.F +++ b/src/nwpw/nwpwlib/control/control.F @@ -1280,6 +1280,12 @@ c return > 'nwpw:gram-schmidt',mt_log,1,gram_schmidt)) > gram_schmidt = .false. +* **** set gram_schmidt2 *** + gram_schmidt2 = .false. + if (.not.btdb_get(rtdb, + > 'nwpw:gram-schmidt2',mt_log,1,gram_schmidt2)) + > gram_schmidt2 = .false. + * **** set translation *** translation = control_allow_translation() dof_translation = translation @@ -4532,6 +4538,21 @@ c end if return end +* *************************** +* * * +* * control_gram_schmidt2 * +* * * +* *************************** + logical function control_gram_schmidt2() + implicit none + +#include "control.fh" + + control_gram_schmidt2=gram_schmidt2 + return + end + + * *************************** * * * diff --git a/src/nwpw/nwpwlib/control/control.fh b/src/nwpw/nwpwlib/control/control.fh index f5da40dd87..7169b4caea 100644 --- a/src/nwpw/nwpwlib/control/control.fh +++ b/src/nwpw/nwpwlib/control/control.fh @@ -26,7 +26,8 @@ integer code,gga,fmm_lmax,fmm_lr integer ispin,multiplicity integer est_finish_time,est_step_time - logical move,frac_coord,SA,fei,fei_quench,gram_schmidt + logical move,frac_coord,SA,fei,fei_quench + logical gram_schmidt,gram_schmidt2 logical rotation,translation,dof_rotation,dof_translation logical balance,spin_orbit,dipole_motion logical two_comp_ppot,frozen,pio,fast_erf,fmm,smooth_cutoff @@ -52,7 +53,8 @@ > ks_algorithm,minimizer, > symm_number, > move,frac_coord,SA,fei,fei_quench, - > gram_schmidt,rotation,translation, + > gram_schmidt,gram_schmidt2, + > rotation,translation, > dof_rotation,dof_translation, > balance,spin_orbit,dipole_motion, > two_comp_ppot,frozen,pio,fast_erf, diff --git a/src/nwpw/pspw/cpsd/inner_loop.F b/src/nwpw/pspw/cpsd/inner_loop.F index 94fe4fd3b0..961e9f11f5 100644 --- a/src/nwpw/pspw/cpsd/inner_loop.F +++ b/src/nwpw/pspw/cpsd/inner_loop.F @@ -94,8 +94,8 @@ c real*8 fion(3,natmx) integer nion1 * ***** external functions **** - logical control_gram_schmidt - external control_gram_schmidt + logical control_gram_schmidt,control_gram_schmidt2 + external control_gram_schmidt,control_gram_schmidt2 logical control_move,psp_semicore,psp_pawexist,control_Fei logical pspw_SIC,pspw_SIC_relaxed logical pspw_HFX,pspw_HFX_relaxed @@ -663,8 +663,14 @@ c call Pack_cc_Sum(1,psi2(1,n),psi1(1,n),psi2(1,n)) if (psp_pawexist()) then call psp_overlap_S(ispin,ne,psi1,psi_r) if (move) call phafac2() + if (control_gram_schmidt()) then - call Dneall_f_Sortho(ms,psi2,psi_r,npack1) + if (control_gram_schmidt2()) then + call Dneall_f_GramSchmidt(ms,psi2,npack1) + else + call Dneall_f_Sortho(ms,psi2,psi_r,npack1) + end if + else call psi_lmbda_paw(ispin,ne,nemax,npack1,psi_r,psi2, > dte, diff --git a/src/nwpw/pspw/cpsd/psi_lmbda_paw.f b/src/nwpw/pspw/cpsd/psi_lmbda_paw.f index 29922a5afd..d08a7f4a6c 100644 --- a/src/nwpw/pspw/cpsd/psi_lmbda_paw.f +++ b/src/nwpw/pspw/cpsd/psi_lmbda_paw.f @@ -30,6 +30,8 @@ c $Id: psi_lmbda_paw.f 21177 2011-10-10 17:09:43Z bylaska $ integer st1,st2 integer A,B,C,U,D,Ba,Bs,fnm integer i,j + logical control_gram_schmidt2 + external control_gram_schmidt2 call nwpw_timing_start(3) @@ -100,8 +102,11 @@ c end if write(*,*) ' +Try using a smaller time step' write(*,*) ' +Gram-Schmidt being performed, spin:',ms end if - call Dneall_f_GramSchmidt(ms,psi2,npack1) -c call Dneall_f_Sortho(ms,psi2,psi1,npack1) + if (control_gram_schmidt2() then + call Dneall_f_GramSchmidt(ms,psi2,npack1) + else + call Dneall_f_Sortho(ms,psi2,psi1,npack1) + end if ierr = 1 else