9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-10 15:33:37 +01:00
qp2/src/kohn_sham/ks_scf.irp.f
Anthony Scemama 49e9488f62
Develop (#10)
* fixed laplacian of aos

* corrected the laplacians of aos

* added dft_one_e

* added new feature for new dft functionals

* changed the configure to add new functionals

* changed the configure

* added dft_one_e/README.rst

* added README.rst in new_functionals

* added source/programmers_guide/new_ks.rst

* Thesis Yann

* Added gmp installation in configure

* improved qp_e_conv_fci

* Doc

* Typos

* Added variance_max

* Fixed completion in qp_create

* modif TODO

* fixed DFT potential for n_states gt 1

* improved pot pbe

* trying to improve sr PBE

* fixed potential pbe

* fixed the vxc smashed for pbe sr and normal

* Comments in selection

* bug fixed by peter

* Fixed bug with zero beta electrons

* Update README.rst

* Update e_xc_new_func.irp.f

* Update links.rst

* Update quickstart.rst

* Update quickstart.rst

* updated cipsi

* Fixed energies of non-expected s2 (#9)

* Moved diag_algorithm in Davdison
2019-02-22 19:19:58 +01:00

98 lines
2.3 KiB
Fortran

program ks_scf
BEGIN_DOC
! Produce `Kohn_Sham` MO orbital
! output: mo_basis.mo_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ
! output: kohn_sham.energy
! optional: mo_basis.mo_coef
END_DOC
io_mo_one_e_integrals = "None"
touch io_mo_one_e_integrals
io_ao_one_e_integrals = "None"
touch io_ao_one_e_integrals
density_for_dft ="KS"
touch density_for_dft
print*, '**************************'
print*, 'mu_erf_dft = ',mu_erf_dft
print*, '**************************'
call check_coherence_functional
call create_guess
call orthonormalize_mos
call run
end
subroutine check_coherence_functional
implicit none
integer :: ifound_x,ifound_c
if(exchange_functional.eq."None")then
ifound_x = 1
else
ifound_x = index(exchange_functional,"short_range")
endif
if(correlation_functional.eq."None")then
ifound_c = 1
else
ifound_c = index(correlation_functional,"short_range")
endif
print*,ifound_x,ifound_c
if(ifound_x .ne.0 .or. ifound_c .ne. 0)then
print*,'YOU ARE USING THE RANGE SEPARATED KS PROGRAM BUT YOUR INPUT KEYWORD FOR '
print*,'exchange_functional is ',exchange_functional
print*,'correlation_functional is ',correlation_functional
print*,'CHANGE THE exchange_functional and correlation_functional keywords to range separated functionals'
print*,'or switch to the KS_SCF program that uses regular functionals'
stop
endif
end
subroutine create_guess
implicit none
BEGIN_DOC
! Create a MO guess if no MOs are present in the EZFIO directory
END_DOC
logical :: exists
PROVIDE ezfio_filename
call ezfio_has_mo_basis_mo_coef(exists)
if (.not.exists) then
if (mo_guess_type == "HCore") then
mo_coef = ao_ortho_lowdin_coef
TOUCH mo_coef
mo_label = 'Guess'
call mo_as_eigvectors_of_mo_matrix(mo_one_e_integrals,size(mo_one_e_integrals,1),size(mo_one_e_integrals,2),mo_label,.false.)
SOFT_TOUCH mo_coef mo_label
else if (mo_guess_type == "Huckel") then
call huckel_guess
else
print *, 'Unrecognized MO guess type : '//mo_guess_type
stop 1
endif
endif
end
subroutine run
BEGIN_DOC
! Run SCF calculation
END_DOC
use bitmasks
implicit none
double precision :: EHF
EHF = KS_energy
mo_label = "Orthonormalized"
! Choose SCF algorithm
call Roothaan_Hall_SCF
end