Skip to content

Commit

Permalink
Added SR_change_bound_Rp flag and corresponding min/max bounds to inp…
Browse files Browse the repository at this point in the history
…ut namelists. Allows to control limits for WF parameters and proton displacements/forces separately.
  • Loading branch information
Ithanil committed Aug 22, 2017
1 parent fbe081d commit 9ca5113
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
3 changes: 3 additions & 0 deletions input_templates/dati_SR.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ SR_max_SVD_MIN=0.000001 !maximum Singula Value Decomposition minimum valu
SR_change_bound=T !set some bounds on the change of the variational parameters ?
SR_min_change=0. !minimum change (in percentage) of the variational parameters in a SR step
SR_max_change=10. !maximum change (in percentage) of the variational parameters in a SR step
SR_change_bound_Rp=T !set some bounds on the change of the protonic displacements (also affects force output!) ?
SR_min_change_Rp=0. !minimum change (in percentage) of the protonic positions in a SR step
SR_max_change_Rp=10. !maximum change (in percentage) of the protonic positions in a SR step
SR_adaptative_beta=F !use the adaptative beta scheme ? (increase beta when SR does not found a new minimum for too long)
SR_lambda=T !use the lambda adaptative scheme ? (explained in reference ...)
lambda_init=1. !initial value for lambda
Expand Down
10 changes: 5 additions & 5 deletions source/module_dati_mc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ MODULE dati_mc
REAL (KIND=8), SAVE :: time_VMC_start
CHARACTER (LEN=9) :: SR_kind
LOGICAL, PROTECTED, SAVE :: SR_adaptative_beta, SR_lambda, SR_lambda_Rp
LOGICAL, PROTECTED, SAVE :: SR_change_bound, SR_change_bound_Rp = .FALSE.
REAL(KIND=8), SAVE :: SR_beta, SR_beta_Rp, SR_max_change, SR_min_change, SR_max_SVD_MIN, SR_maxdeltaPsi
LOGICAL, PROTECTED, SAVE :: SR_change_bound, SR_change_bound_Rp
REAL(KIND=8), SAVE :: SR_beta, SR_beta_Rp, SR_max_change, SR_min_change, SR_max_change_Rp, SR_min_change_Rp, SR_max_SVD_MIN, SR_maxdeltaPsi
REAL(KIND=8), SAVE :: lambda_init, min_lambda, max_lambda, lambda_Rp_init, min_lambda_Rp, max_lambda_Rp
INTEGER, PROTECTED, SAVE :: SR_num_max_WO_MIN

Expand All @@ -45,9 +45,9 @@ SUBROUTINE inizializza_dati_mc()
NAMELIST /dati_ottimizzazione/ opt_SDe, opt_orbital, opt_dynamic_backflow, opt_A_Jee, opt_F_Jee, opt_A_Jep, &
opt_F_Jep, opt_Jse, opt_Kse, opt_Jsesp, opt_SDse, opt_c_eff_dnfH, opt_rp, costri_rp, costri_rp_param, opt_L

NAMELIST /dati_SR/ SR_kind, SR_num_max_WO_MIN, SR_beta, SR_beta_Rp, SR_maxdeltaPsi, SR_max_SVD_MIN, &
SR_change_bound, SR_min_change, SR_max_change, SR_adaptative_beta, &
SR_lambda, lambda_init, min_lambda, max_lambda, &
NAMELIST /dati_SR/ SR_kind, SR_num_max_WO_MIN, SR_beta, SR_beta_Rp, SR_maxdeltaPsi, SR_max_SVD_MIN, &
SR_change_bound, SR_min_change, SR_max_change, SR_change_bound_Rp, SR_min_change_Rp, SR_max_change_Rp, &
SR_adaptative_beta, SR_lambda, lambda_init, min_lambda, max_lambda, &
SR_lambda_Rp, lambda_Rp_init, min_lambda_Rp, max_lambda_Rp

CALL CPU_TIME(time_VMC_start)
Expand Down
12 changes: 6 additions & 6 deletions source/module_variational_opt.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1776,11 +1776,11 @@ SUBROUTINE stochastic_reconfiguration(p0,N,auto_stop,AV_accu)
END IF
END IF
IF (SR_change_bound_Rp) THEN
!setto il lambda_Rp in modo che il cambio delle posizioni protoniche non sia maggiore di SR_max_change%
IF ( lambda_Rp*lambda2_Rp > DSQRT(((0.01d0*SR_max_change)**2)*&
!setto il lambda_Rp in modo che il cambio delle posizioni protoniche non sia maggiore di SR_max_change_Rp%
IF ( lambda_Rp*lambda2_Rp > DSQRT(((0.01d0*SR_max_change_Rp)**2)*&
DOT_PRODUCT(p0(N-num_coord_Rp+1:N),p0(N-num_coord_Rp+1:N))/&
DOT_PRODUCT(dp(N-num_coord_Rp+1:N),dp(N-num_coord_Rp+1:N))) ) THEN
lambda2_Rp=(0.01d0*SR_max_change/lambda_Rp)*&
lambda2_Rp=(0.01d0*SR_max_change_Rp/lambda_Rp)*&
DSQRT( DOT_PRODUCT(p0(N-num_coord_Rp+1:N),p0(N-num_coord_Rp+1:N))/&
DOT_PRODUCT(dp(N-num_coord_Rp+1:N),dp(N-num_coord_Rp+1:N)) )
IF (mpi_myrank==0) THEN
Expand All @@ -1790,11 +1790,11 @@ SUBROUTINE stochastic_reconfiguration(p0,N,auto_stop,AV_accu)
"VAR_OPT: [change_bound] Cambio delle posizioni protoniche troppo grande, lo riduco di ", lambda2_Rp
END IF
END IF
!setto il lambda in modo che il cambio delle posizioni protoniche non sia minore di SR_min_change%
IF ( lambda_Rp*lambda2_Rp < DSQRT(((0.01d0*SR_min_change)**2)*&
!setto il lambda in modo che il cambio delle posizioni protoniche non sia minore di SR_min_change_Rp%
IF ( lambda_Rp*lambda2_Rp < DSQRT(((0.01d0*SR_min_change_Rp)**2)*&
DOT_PRODUCT(p0(N-num_coord_Rp+1:N),p0(N-num_coord_Rp+1:N))/&
DOT_PRODUCT(dp(N-num_coord_Rp+1:N),dp(N-num_coord_Rp+1:N))) ) THEN
lambda2_Rp=(0.01d0*SR_min_change/lambda_Rp)*&
lambda2_Rp=(0.01d0*SR_min_change_Rp/lambda_Rp)*&
DSQRT( DOT_PRODUCT(p0(N-num_coord_Rp+1:N),p0(N-num_coord_Rp+1:N))/&
DOT_PRODUCT(dp(N-num_coord_Rp+1:N),dp(N-num_coord_Rp+1:N)) )
IF (mpi_myrank==0) THEN
Expand Down
3 changes: 3 additions & 0 deletions test/cmp/templatest.cmp/dati_SR.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ SR_max_SVD_MIN=0.000001 !maximum Singula Value Decomposition minimum valu
SR_change_bound=T !set some bounds on the change of the variational parameters ?
SR_min_change=0. !minimum change (in percentage) of the variational parameters in a SR step
SR_max_change=10. !maximum change (in percentage) of the variational parameters in a SR step
SR_change_bound_Rp=T !set some bounds on the change of the protonic displacements (also affects force output!) ?
SR_min_change_Rp=0. !minimum change (in percentage) of the protonic positions in a SR step
SR_max_change_Rp=10. !maximum change (in percentage) of the protonic positions in a SR step
SR_adaptative_beta=F !use the adaptative beta scheme ? (increase beta when SR does not found a new minimum for too long)
SR_lambda=T !use the lambda adaptative scheme ? (explained in reference ...)
lambda_init=1. !initial value for lambda
Expand Down
3 changes: 3 additions & 0 deletions test/inp/templatest.inp/dati_SR.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ SR_max_SVD_MIN=0.000001 !maximum Singula Value Decomposition minimum valu
SR_change_bound=T !set some bounds on the change of the variational parameters ?
SR_min_change=0. !minimum change (in percentage) of the variational parameters in a SR step
SR_max_change=10. !maximum change (in percentage) of the variational parameters in a SR step
SR_change_bound_Rp=T !set some bounds on the change of the protonic displacements (also affects force output!) ?
SR_min_change_Rp=0. !minimum change (in percentage) of the protonic positions in a SR step
SR_max_change_Rp=10. !maximum change (in percentage) of the protonic positions in a SR step
SR_adaptative_beta=F !use the adaptative beta scheme ? (increase beta when SR does not found a new minimum for too long)
SR_lambda=T !use the lambda adaptative scheme ? (explained in reference ...)
lambda_init=1. !initial value for lambda
Expand Down

0 comments on commit 9ca5113

Please sign in to comment.