mirror of
https://gitlab.com/scemama/qp_plugins_scemama.git
synced 2024-08-30 07:53:39 +02:00
added the possibility to have a gradient based convergence in casscf
This commit is contained in:
parent
08b3f247f0
commit
501cc317d6
@ -10,12 +10,6 @@ doc: Calculated |FCI| energy + |PT2|
|
|||||||
interface: ezfio
|
interface: ezfio
|
||||||
size: (determinants.n_states)
|
size: (determinants.n_states)
|
||||||
|
|
||||||
[cisd_guess]
|
|
||||||
type: logical
|
|
||||||
doc: If true, the CASSCF starts with a CISD wave function
|
|
||||||
interface: ezfio,provider,ocaml
|
|
||||||
default: True
|
|
||||||
|
|
||||||
[state_following_casscf]
|
[state_following_casscf]
|
||||||
type: logical
|
type: logical
|
||||||
doc: If |true|, the CASSCF will try to follow the guess CI vector and orbitals
|
doc: If |true|, the CASSCF will try to follow the guess CI vector and orbitals
|
||||||
@ -48,3 +42,10 @@ type: logical
|
|||||||
doc: If true, the two-rdm are computed with a fast algo
|
doc: If true, the two-rdm are computed with a fast algo
|
||||||
interface: ezfio,provider,ocaml
|
interface: ezfio,provider,ocaml
|
||||||
default: True
|
default: True
|
||||||
|
|
||||||
|
[criterion_casscf]
|
||||||
|
type: character*(32)
|
||||||
|
doc: choice of the criterion for the convergence of the casscf: can be energy or gradients
|
||||||
|
interface: ezfio, provider, ocaml
|
||||||
|
default: energy
|
||||||
|
|
||||||
|
@ -41,12 +41,19 @@ subroutine run
|
|||||||
call write_double(6,norm_grad_vec2_tab(3), ' Active-virtual gradients = ')
|
call write_double(6,norm_grad_vec2_tab(3), ' Active-virtual gradients = ')
|
||||||
call write_double(6,energy_improvement, 'Predicted energy improvement = ')
|
call write_double(6,energy_improvement, 'Predicted energy improvement = ')
|
||||||
|
|
||||||
|
if(criterion_casscf == "energy")then
|
||||||
converged = dabs(energy_improvement) < thresh_scf
|
converged = dabs(energy_improvement) < thresh_scf
|
||||||
|
else if (criterion_casscf == "gradients")then
|
||||||
|
converged = norm_grad_vec2 < thresh_scf
|
||||||
|
else
|
||||||
|
converged = dabs(energy_improvement) < thresh_scf
|
||||||
|
endif
|
||||||
pt2_max = dabs(energy_improvement / pt2_relative_error)
|
pt2_max = dabs(energy_improvement / pt2_relative_error)
|
||||||
|
|
||||||
mo_coef = NewOrbs
|
mo_coef = NewOrbs
|
||||||
mo_occ = occnum
|
mo_occ = occnum
|
||||||
call save_mos
|
call save_mos
|
||||||
|
if(.not.converged)then
|
||||||
iteration += 1
|
iteration += 1
|
||||||
N_det = max(N_det/2 ,N_states)
|
N_det = max(N_det/2 ,N_states)
|
||||||
psi_det = psi_det_sorted
|
psi_det = psi_det_sorted
|
||||||
@ -58,6 +65,7 @@ subroutine run
|
|||||||
state_following_casscf = state_following_casscf_save
|
state_following_casscf = state_following_casscf_save
|
||||||
touch state_following_casscf
|
touch state_following_casscf
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ END_PROVIDER
|
|||||||
! Eigenvectors/eigenvalues of the single-excitation matrix
|
! Eigenvectors/eigenvalues of the single-excitation matrix
|
||||||
END_DOC
|
END_DOC
|
||||||
if(nMonoEx+1.gt.n_det_max_full)then
|
if(nMonoEx+1.gt.n_det_max_full)then
|
||||||
! if(bavard)then
|
if(bavard)then
|
||||||
print*,'Using the Davidson algorithm to diagonalize the SXmatrix'
|
print*,'Using the Davidson algorithm to diagonalize the SXmatrix'
|
||||||
! endif
|
endif
|
||||||
double precision, allocatable :: u_in(:,:),energies(:)
|
double precision, allocatable :: u_in(:,:),energies(:)
|
||||||
allocate(u_in(nMonoEx+1,n_states_diag),energies(n_guess_sx_mat))
|
allocate(u_in(nMonoEx+1,n_states_diag),energies(n_guess_sx_mat))
|
||||||
call davidson_diag_sx_mat(n_guess_sx_mat, u_in, energies)
|
call davidson_diag_sx_mat(n_guess_sx_mat, u_in, energies)
|
||||||
@ -70,9 +70,9 @@ END_PROVIDER
|
|||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
else
|
else
|
||||||
! if(bavard)then
|
if(bavard)then
|
||||||
print*,'Diagonalize the SXmatrix with Jacobi'
|
print*,'Diagonalize the SXmatrix with Jacobi'
|
||||||
! endif
|
endif
|
||||||
call lapack_diag(SXeigenval,SXeigenvec,SXmatrix,nMonoEx+1,nMonoEx+1)
|
call lapack_diag(SXeigenval,SXeigenvec,SXmatrix,nMonoEx+1,nMonoEx+1)
|
||||||
endif
|
endif
|
||||||
if (bavard) then
|
if (bavard) then
|
||||||
@ -84,9 +84,9 @@ END_PROVIDER
|
|||||||
write(6,*) ' 4 - ',SXeigenval(4),SXeigenvec(1,4)
|
write(6,*) ' 4 - ',SXeigenval(4),SXeigenvec(1,4)
|
||||||
write(6,*) ' 5 - ',SXeigenval(5),SXeigenvec(1,5)
|
write(6,*) ' 5 - ',SXeigenval(5),SXeigenvec(1,5)
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
write(6,*)
|
write(6,*)
|
||||||
write(6,*) ' SXdiag : lowest eigenvalue = ',SXeigenval(1)
|
write(6,*) ' SXdiag : lowest eigenvalue = ',SXeigenval(1)
|
||||||
|
endif
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
BEGIN_PROVIDER [real*8, energy_improvement]
|
BEGIN_PROVIDER [real*8, energy_improvement]
|
||||||
|
Loading…
Reference in New Issue
Block a user