10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-29 08:24:51 +02:00

Merge pull request #5 from scemama/master

Merge for error
This commit is contained in:
Thomas Applencourt 2015-04-07 17:06:47 +02:00
commit d92047176e
17 changed files with 121 additions and 105 deletions

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
*.irp.f linguist-language=IRPF90
*.f linguist-language=Fortran
*.ml linguist-language=Ocaml
*.sh linguist-language=Bash
*.py linguist-language=Python

View File

@ -4,6 +4,6 @@ determinants
n_det_max_jacobi 1000 n_det_max_jacobi 1000
threshold_generators 0.99 threshold_generators 0.99
threshold_selectors 0.999 threshold_selectors 0.999
read_wf False read_wf false
s2_eig False s2_eig false
only_single_double_dm False only_single_double_dm false

View File

@ -1,60 +1,17 @@
bielec_integrals
read_ao_integrals False
read_mo_integrals False
write_ao_integrals False
write_mo_integrals False
threshold_ao 1.e-15
threshold_mo 1.e-15
direct False
cis_dressed cis_dressed
n_state_cis 10 n_state_cis 10
n_core_cis 0 n_core_cis 0
n_act_cis mo_basis_mo_tot_num n_act_cis mo_basis_mo_tot_num
mp2_dressing False mp2_dressing false
standard_doubles True standard_doubles True
en_2_2 False en_2_2 false
determinants
n_states 1
n_states_diag determinants_n_states
n_det_max_jacobi 1000
threshold_generators 0.99
threshold_selectors 0.999
read_wf False
s2_eig False
only_single_double_dm False
full_ci
n_det_max_fci 10000
n_det_max_fci_property 50000
pt2_max 1.e-4
do_pt2_end True
var_pt2_ratio 0.75
all_singles all_singles
n_det_max_fci 50000 n_det_max_fci 50000
pt2_max 1.e-8 pt2_max 1.e-8
do_pt2_end False do_pt2_end false
cassd cassd
n_det_max_cassd 10000 n_det_max_cassd 10000
pt2_max 1.e-4 pt2_max 1.e-4
do_pt2_end True do_pt2_end True
hartree_fock
n_it_scf_max 200
thresh_scf 1.e-10
guess "Huckel"
cisd_selected
n_det_max_cisd 10000
pt2_max 1.e-4
cisd_sc2_selected
n_det_max_cisd_sc2 10000
pt2_max 1.e-4
do_pt2_end True
properties
z_one_point 3.9

View File

@ -94,7 +94,7 @@ let get_ezfio_default_in_file ~directory ~data ~filename =
match (String.lsplit2 ~on:' ' (String.strip line)) with match (String.lsplit2 ~on:' ' (String.strip line)) with
| Some (l,r) -> | Some (l,r) ->
if (l = data) then if (l = data) then
String.lowercase (String.strip r) String.strip r
else else
find_data rest find_data rest
| None -> raise Not_found | None -> raise Not_found

View File

@ -20,6 +20,10 @@ let run exe ezfio_file =
Printf.printf "===============\nQuantum Package\n===============\n\n"; Printf.printf "===============\nQuantum Package\n===============\n\n";
Printf.printf "Date : %s\n\n%!" (Time.to_string time_start); Printf.printf "Date : %s\n\n%!" (Time.to_string time_start);
match (Sys.command ("qp_edit -c "^ezfio_file)) with
| 0 -> ()
| i -> failwith "Error: Input inconsistent\n";
;
let exe = let exe =
match (List.find ~f:(fun (x,_) -> x = exe) executables) with match (List.find ~f:(fun (x,_) -> x = exe) executables) with
| None -> assert false | None -> assert false

View File

@ -150,15 +150,12 @@ end = struct
let to_string = function let to_string = function
| Huckel -> \"Huckel\" | Huckel -> \"Huckel\"
| HCore -> \"HCore\" | HCore -> \"Hcore\"
let of_string s = let of_string s =
let s =
String.lowercase s
in
match s with match s with
| \"huckel\" -> Huckel | \"Huckel\" -> Huckel
| \"hcore\" -> HCore | \"Hcore\" -> HCore
| _ -> failwith (\"Wrong Guess type : \"^s) | _ -> failwith (\"Wrong Guess type : \"^s)
end end
@ -179,13 +176,10 @@ end = struct
| Write -> \"Write\" | Write -> \"Write\"
| None -> \"None\" | None -> \"None\"
let of_string s = let of_string s =
let s =
String.lowercase s
in
match s with match s with
| \"read\" -> Read | \"Read\" -> Read
| \"write\" -> Write | \"Write\" -> Write
| \"none\" -> None | \"None\" -> None
| _ -> failwith (\"Wrong IO type : \"^s) | _ -> failwith (\"Wrong IO type : \"^s)
end end

View File

@ -12,8 +12,8 @@ By default all the option are executed.
Options: Options:
-h --help -h --help
--path The path of the `EZFIO.cfg`, by default will look in the ${pwd} --path The path of the `EZFIO.cfg`, by default will look in the ${pwd}
--irpf90 Create the `ezfio_interface.ipf90` --irpf90 Create the `ezfio_interface.irpf90`
who containt all the provider needed which contains all the providers needed
(aka all with the `interface: input` parameter) (aka all with the `interface: input` parameter)
in `${pwd}` in `${pwd}`
--ezfio_config Create the `${module_lower}_ezfio_interface_config` in --ezfio_config Create the `${module_lower}_ezfio_interface_config` in
@ -28,7 +28,7 @@ Options:
Format specification : Format specification :
[provider_name] | the name of the provider in irp.f90 [provider_name] | the name of the provider in irp.f90
doc:{str} | Is the doc doc:{str} | Is the doc
Type:{str} | Is a fancy_type support by the ocaml Type:{str} | Is a fancy_type supported by the ocaml
ezfio_name:{str} | Will be the name of the file for the ezfio ezfio_name:{str} | Will be the name of the file for the ezfio
(optional by default is the name of the provider) (optional by default is the name of the provider)
interface:{str} | The provider is a imput or a output interface:{str} | The provider is a imput or a output
@ -67,13 +67,13 @@ Type = namedtuple('Type', 'fancy ocaml fortran')
def is_bool(str_): def is_bool(str_):
""" """
Take a string, if is a bool return the convert into Take a string, if is a bool return the conversion into
fortran and ocaml one. fortran and ocaml.
""" """
if str_.lower() in ['true', '.true.']: if str_.lower() in ['true', '.true.']:
return Type(None, "True", ".True.") return Type(None, "true", ".True.")
elif str_.lower() in ['false', '.False.']: elif str_.lower() in ['false', '.false.']:
return Type(None, "False", ".False") return Type(None, "false", ".False")
else: else:
raise TypeError raise TypeError
@ -81,7 +81,7 @@ def is_bool(str_):
def get_type_dict(): def get_type_dict():
""" """
This function makes the correspondance between the type of value read in This function makes the correspondance between the type of value read in
ezfio.cfg into the f90 and Ocam Type ezfio.cfg into the f90 and Ocaml Type
return fancy_type[fancy_type] = namedtuple('Type', 'ocaml fortran') return fancy_type[fancy_type] = namedtuple('Type', 'ocaml fortran')
For example fancy_type['Ndet'].fortran = interger For example fancy_type['Ndet'].fortran = interger
.ocaml = int .ocaml = int
@ -154,7 +154,7 @@ def get_type_dict():
# q p _ t y p e s _ g e n e r a t e # # q p _ t y p e s _ g e n e r a t e #
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
# Read the fancy_type, the ocaml. and convert the ocam to the fortran # Read the fancy_type, the ocaml. and convert the ocaml to the fortran
for i in l_gen + l_un: for i in l_gen + l_un:
str_fancy_type = i.split()[1].strip() str_fancy_type = i.split()[1].strip()
str_ocaml_type = i.split()[3] str_ocaml_type = i.split()[3]

View File

@ -121,6 +121,8 @@ END_PROVIDER
v = buffer[1] v = buffer[1]
name = self.name name = self.name
try: try:
true = True
false = False
v_eval = eval(v) v_eval = eval(v)
if type(v_eval) == bool: if type(v_eval) == bool:
v = '.%s.'%(v) v = '.%s.'%(v)

View File

@ -7,26 +7,26 @@ ezfio_name: direct
[disk_access_mo_integrals] [disk_access_mo_integrals]
type: Disk_access type: Disk_access
doc: Write, Read, None for MO integrals from disk (EZFIO folder) doc: Read/Write MO integrals from/to disk [ Write | Read | None ]
interface: input interface: input
default: None default: None
[disk_access_ao_integrals] [disk_access_ao_integrals]
type: Disk_access type: Disk_access
doc: Write or Read or None for AO integrals from disk (EZFIO folder) doc: Read/Write AO integrals from/to disk [ Write | Read | None ]
interface: input interface: input
default: None default: None
[ao_integrals_threshold] [ao_integrals_threshold]
type: Threshold type: Threshold
doc: If <pq|rs> < ao_integrals_threshold then <pq|rs> is null doc: If |<pq|rs>| < ao_integrals_threshold then <pq|rs> is zero
interface: input interface: input
default: 1.e-15 default: 1.e-15
ezfio_name: threshold_ao ezfio_name: threshold_ao
[mo_integrals_threshold] [mo_integrals_threshold]
type: Threshold type: Threshold
doc: If <ij|kl> < ao_integrals_threshold then <pq|rs> is null doc: If |<ij|kl>| < ao_integrals_threshold then <pq|rs> is zero
interface: input interface: input
default: 1.e-15 default: 1.e-15
ezfio_name: threshold_mo ezfio_name: threshold_mo

View File

@ -13,8 +13,5 @@ program cisd
print *, 'E_corr = ',CI_electronic_energy(i) - ref_bitmask_energy print *, 'E_corr = ',CI_electronic_energy(i) - ref_bitmask_energy
enddo enddo
! call CISD_SC2(psi_det,psi_coef,eigvalues,size(psi_coef,1),N_det,N_states,N_int) call save_wavefunction
! do i = 1, N_states
! print*,'eigvalues(i) = ',eigvalues(i)
! enddo
end end

View File

@ -1,6 +1,6 @@
[N_det_max_cisd_sc2] [N_det_max_cisd_sc2]
type: Det_number_max type: Det_number_max
doc: Get n_det_max_cisd_sc2 from EZFIO file doc: Max number of determinants
interface: input interface: input
default: 10000 default: 10000
@ -12,8 +12,8 @@ default: true
[PT2_max] [PT2_max]
type: PT2_energy type: PT2_energy
doc: The selection process stops when the largest PT2 (for all the state) is lower doc: The selection process stops when the largest PT2 (for all the states) is lower
than pt2_max in absolute value than abs(pt2_max)
interface: input interface: input
default: 0.0001 default: 0.0001

View File

@ -3,7 +3,7 @@ program det_svd
BEGIN_DOC BEGIN_DOC
! Computes the SVD of the Alpha x Beta determinant coefficient matrix ! Computes the SVD of the Alpha x Beta determinant coefficient matrix
END_DOC END_DOC
integer :: i,j integer :: i,j,k
read_wf = .True. read_wf = .True.
TOUCH read_wf TOUCH read_wf
@ -40,17 +40,22 @@ program det_svd
print *, 'N_det_alpha = ', N_det_alpha_unique print *, 'N_det_alpha = ', N_det_alpha_unique
print *, 'N_det_beta = ', N_det_beta_unique print *, 'N_det_beta = ', N_det_beta_unique
print *, '' print *, ''
! do i=1,N_det_alpha_unique
! do j=1,N_det_beta_unique
! print *, i,j,psi_svd_matrix(i,j,:)
! enddo
! enddo
print *, '' print *, ''
call diagonalize_ci
print *, 'Energy = ', ci_energy print *, 'Energy = ', ci_energy
do i=1,N_det_alpha_unique
do j=1,N_det_beta_unique
do k=1,N_states
if (dabs(psi_svd_matrix(i,j,k)) < 1.d-15) then
psi_svd_matrix(i,j,k) = 0.d0
endif
enddo
enddo
enddo
print *, '' print *, ''
print *, psi_svd_coefs(1:20,1) print *, psi_svd_coefs(1:20,1)
! call save_wavefunction call save_wavefunction
end end

View File

@ -42,8 +42,10 @@ subroutine save_dets_qmcchem
enddo enddo
close(31) close(31)
call system('gzip -f '//trim(ezfio_filename)//'/mo_basis/mo_classif') call system('gzip -f '//trim(ezfio_filename)//'/mo_basis/mo_classif')
end end
program save_for_qmc program save_for_qmc
call save_dets_qmcchem call save_dets_qmcchem
call write_spindeterminants
end end

View File

@ -7,4 +7,8 @@ spindeterminants
psi_det_alpha integer*8 (spindeterminants_n_int*spindeterminants_bit_kind/8,spindeterminants_n_det_alpha) psi_det_alpha integer*8 (spindeterminants_n_int*spindeterminants_bit_kind/8,spindeterminants_n_det_alpha)
psi_det_beta integer*8 (spindeterminants_n_int*spindeterminants_bit_kind/8,spindeterminants_n_det_beta) psi_det_beta integer*8 (spindeterminants_n_int*spindeterminants_bit_kind/8,spindeterminants_n_det_beta)
psi_coef_matrix double precision (spindeterminants_n_det_alpha,spindeterminants_n_det_beta,spindeterminants_n_states) psi_coef_matrix double precision (spindeterminants_n_det_alpha,spindeterminants_n_det_beta,spindeterminants_n_states)
n_svd_coefs integer
psi_svd_alpha double precision (spindeterminants_n_det_alpha,spindeterminants_n_svd_coefs,spindeterminants_n_states)
psi_svd_beta double precision (spindeterminants_n_det_beta,spindeterminants_n_svd_coefs,spindeterminants_n_states)
psi_svd_coefs double precision (spindeterminants_n_svd_coefs,spindeterminants_n_states)

View File

@ -26,7 +26,7 @@ subroutine write_spindeterminants
enddo enddo
call ezfio_set_spindeterminants_psi_det_alpha(psi_det_alpha_unique) call ezfio_set_spindeterminants_psi_det_alpha(psi_det_alpha_unique)
deallocate(tmpdet) deallocate(tmpdet)
allocate(tmpdet(N_int2,N_det_beta_unique)) allocate(tmpdet(N_int2,N_det_beta_unique))
do i=1,N_det_beta_unique do i=1,N_det_beta_unique
do k=1,N_int do k=1,N_int
@ -38,7 +38,54 @@ subroutine write_spindeterminants
enddo enddo
call ezfio_set_spindeterminants_psi_det_beta(psi_det_beta_unique) call ezfio_set_spindeterminants_psi_det_beta(psi_det_beta_unique)
deallocate(tmpdet) deallocate(tmpdet)
call ezfio_set_spindeterminants_psi_coef_matrix(psi_svd_matrix) call ezfio_set_spindeterminants_psi_coef_matrix(psi_svd_matrix)
integer :: n_svd_coefs
double precision :: norm, f
f = 1.d0/dble(N_states)
norm = 1.d0
do n_svd_coefs=1,N_det_alpha_unique
do k=1,N_states
norm -= psi_svd_coefs(n_svd_coefs,k)*psi_svd_coefs(n_svd_coefs,k)
enddo
if (norm < 1.d-6) then
exit
endif
enddo
n_svd_coefs -= 1
call ezfio_set_spindeterminants_n_svd_coefs(n_svd_coefs)
double precision, allocatable :: dtmp(:,:,:)
allocate(dtmp(N_det_alpha_unique,n_svd_coefs,N_states))
do k=1,N_states
do j=1,n_svd_coefs
do i=1,N_det_alpha_unique
dtmp(i,j,k) = psi_svd_alpha(i,j,k)
enddo
enddo
enddo
call ezfio_set_spindeterminants_psi_svd_alpha(dtmp)
deallocate(dtmp)
allocate(dtmp(N_det_beta_unique,n_svd_coefs,N_states))
do k=1,N_states
do j=1,n_svd_coefs
do i=1,N_det_beta_unique
dtmp(i,j,k) = psi_svd_beta(i,j,k)
enddo
enddo
enddo
call ezfio_set_spindeterminants_psi_svd_beta(dtmp)
deallocate(dtmp)
allocate(dtmp(n_svd_coefs,N_states,1))
do k=1,N_states
do j=1,n_svd_coefs
dtmp(j,k,1) = psi_svd_coefs(j,k)
enddo
enddo
call ezfio_set_spindeterminants_psi_svd_coefs(dtmp)
deallocate(dtmp)
end end

View File

@ -32,11 +32,11 @@ default: 0.75
[energy] [energy]
type: double precision type: double precision
doc: "Calculated Full CI energy" doc: Calculated Selected FCI energy
interface: output interface: output
[energy_pt2] [energy_pt2]
type: double precision type: double precision
doc: "Calculated Full CI energy" doc: Calculated FCI energy + PT2
interface: output interface: output

View File

@ -12,7 +12,6 @@ subroutine run
print *, N_det_cas print *, N_det_cas
print *, N_det_sd print *, N_det_sd
! call update_generators
integer :: i integer :: i
print *, 'CAS' print *, 'CAS'
print *, '===' print *, '==='
@ -21,13 +20,13 @@ subroutine run
call debug_det(psi_cas(1,1,i),N_int) call debug_det(psi_cas(1,1,i),N_int)
enddo enddo
! print *, 'SD' print *, 'SD'
! print *, '==' print *, '=='
! do i=1,N_det_sd do i=1,N_det_sd
! print *, psi_sd_coefs(i,:) print *, psi_sd_coefs(i,:)
! call debug_det(psi_sd(1,1,i),N_int) call debug_det(psi_sd(1,1,i),N_int)
! enddo enddo
!
print *, 'MRCC' print *, 'MRCC'
print *, '====' print *, '===='
print *, ci_energy(:) print *, ci_energy(:)