10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-03 20:54:00 +01:00

Multi-state in qmcpack (#218)

* Fixes #211

* Removed debug print

* Revert input coordinates

* Fix MPI

* Multi-state modification for qmcpack

* Removed useless file
This commit is contained in:
Anthony Scemama 2017-12-19 18:33:34 +01:00 committed by GitHub
parent 7ebc2ac896
commit e70bf2800e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 87 deletions

View File

@ -1,56 +0,0 @@
0 X Dummy 0.000000
1 H Hydrogen 1.007900
2 He Helium 4.002600
3 Li Lithium 6.941000
4 Be Beryllium 9.012180
5 B Boron 10.810000
6 C Carbon 12.011000
7 N Nitrogen 14.006700
8 O Oxygen 15.999400
9 F Fluorine 18.998403
10 Ne Neon 20.179000
11 Na Sodium 22.989770
12 Mg Magnesium 24.305000
13 Al Aluminum 26.981540
14 Si Silicon 28.085500
15 P Phosphorus 30.973760
16 S Sulfur 32.060000
17 Cl Chlorine 35.453000
18 Ar Argon 39.948000
19 K Potassium 39.098300
20 Ca Calcium 40.080000
21 Sc Scandium 44.955900
22 Ti Titanium 47.900000
23 V Vanadium 50.941500
24 Cr Chromium 51.996000
25 Mn Manganese 54.938000
26 Fe Iron 55.933200
27 Co Cobalt 58.933200
28 Ni Nickel 58.700000
29 Cu Copper 63.546000
30 Zn Zinc 65.380000
31 Ga Gallium 69.720000
32 Ge Germanium 72.590000
33 As Arsenic 74.921600
34 Se Selenium 78.960000
35 Br Bromine 79.904000
36 Kr Krypton 83.800000
37 Rb Rubidium 85.467800
38 Sr Strontium 87.620000
39 Y Yttrium 88.905840
40 Zr Zirconium 91.224000
41 Nb Niobium 92.906370
42 Mo Molybdenum 95.950000
43 Tc Technetium 98.000000
44 Ru Ruthenium 101.070000
45 Rh Rhodium 102.905500
46 Pd Palladium 106.420000
47 Ag Silver 107.868200
48 Cd Cadmium 112.414000
49 In Indium 114.818000
50 Sn Tin 118.710000
51 Sb Antimony 121.760000
52 Te Tellurium 127.600000
53 I Iodine 126.904470
54 Xe Xenon 131.293000
78 Pt Platinum 195.084000

View File

@ -2,6 +2,14 @@
QmcChem Module QmcChem Module
============== ==============
For multi-state calculations, to extract state 2 use:
``
QP_STATE=2 qp_run save_for_qmcpack x.ezfio
``
(state 1 is the ground state).
Documentation Documentation
============= =============

View File

@ -345,7 +345,10 @@ print "mo_num", mo_num
print "det_num", n_det print "det_num", n_det
print "" print ""
state = 0 if "QP_STATE" in os.environ:
state = int(os.environ["QP_STATE"])-1
else:
state = 0
psi_coef = psi_coef[state] psi_coef = psi_coef[state]
encode = 8*bit_kind encode = 8*bit_kind

View File

@ -24,9 +24,13 @@ subroutine generate_sym_coord(n_sym_points,result)
END_DOC END_DOC
integer :: i, xyz integer :: i, xyz
call random_number(result) do i=1,n_sym_points
call random_number(result(1,i))
call random_number(result(2,i))
call random_number(result(3,i))
enddo
do xyz=1,3 do xyz=1,3
result(xyz,:) = sym_box(xyz,1) + result(xyz,:) * (sym_box(xyz,2)-sym_box(xyz,1)) result(xyz,1:n_sym_points) = sym_box(xyz,1) + result(xyz,:) * (sym_box(xyz,2)-sym_box(xyz,1))
enddo enddo
end end
@ -43,27 +47,36 @@ subroutine compute_sym_ao_values(sym_points, n_sym_points, result)
integer :: i, j integer :: i, j
double precision :: x, y, z double precision :: x, y, z
double precision :: x2, y2, z2 double precision :: x2, y2, z2
integer :: k
result (:,:) = 0.d0 result (:,:) = 0.d0
print *, sym_molecule_rotation_inv
print *, ''
print *, sym_molecule_rotation
stop
do j=1,ao_num do j=1,ao_num
do i=1,n_sym_points do i=1,n_sym_points
x = sym_points(1,i) - nucl_coord_sym_transp(1,ao_nucl(j)) x2 = sym_points(1,i)
y = sym_points(2,i) - nucl_coord_sym_transp(2,ao_nucl(j)) y2 = sym_points(2,i)
z = sym_points(3,i) - nucl_coord_sym_transp(3,ao_nucl(j)) z2 = sym_points(3,i)
x2 = x*sym_molecule_rotation_inv(1,1) + y*sym_molecule_rotation_inv(2,1) + z*sym_molecule_rotation_inv(3,1) x = x2*sym_molecule_rotation_inv(1,1) + y2*sym_molecule_rotation_inv(2,1) + z2*sym_molecule_rotation_inv(3,1)
y2 = x*sym_molecule_rotation_inv(1,2) + y*sym_molecule_rotation_inv(2,2) + z*sym_molecule_rotation_inv(3,2) y = x2*sym_molecule_rotation_inv(1,2) + y2*sym_molecule_rotation_inv(2,2) + z2*sym_molecule_rotation_inv(3,2)
z2 = x*sym_molecule_rotation_inv(1,3) + y*sym_molecule_rotation_inv(2,3) + z*sym_molecule_rotation_inv(3,3) z = x2*sym_molecule_rotation_inv(1,3) + y2*sym_molecule_rotation_inv(2,3) + z2*sym_molecule_rotation_inv(3,3)
x = x2**ao_power(j,1) x = x - nucl_coord_transp(1,ao_nucl(j))
y = y2**ao_power(j,2) y = y - nucl_coord_transp(2,ao_nucl(j))
z = z2**ao_power(j,3) z = z - nucl_coord_transp(3,ao_nucl(j))
result(i,j) = x*y*z*exp(-(x*x+y*y+z*z)) x2 = x*x + y*y + z*z
! result(i,j) = x*y*z result(i,j) = 0.d0
! if (result(i,j) > 0.d0) then do k=1,ao_prim_num(j)
! result(i,j) = 1.d0 result(i,j) += ao_coef_normalized_ordered_transp(k,j)*exp(-ao_expo_ordered_transp(k,j)*x2)
! else if (result(i,j) < 0.d0) then enddo
! result(i,j) = -1.d0 print *, real(x), ao_power(j,1), real(y), ao_power(j,2), real(z), ao_power(j,3)
! else x = x**ao_power(j,1)
! result(i,j) = 0.d0 y = y**ao_power(j,2)
! endif z = z**ao_power(j,3)
print *, result(i,j)
result(i,j) = x*y*z*result(i,j)
print *, result(i,j)
enddo enddo
enddo enddo
@ -81,6 +94,11 @@ subroutine compute_sym_mo_values(sym_points, n_sym_points, result)
double precision, allocatable :: tmp(:,:) double precision, allocatable :: tmp(:,:)
allocate(tmp(n_sym_points,ao_num)) allocate(tmp(n_sym_points,ao_num))
call compute_sym_ao_values(sym_points,n_sym_points,tmp) call compute_sym_ao_values(sym_points,n_sym_points,tmp)
integer :: i
do i=1,ao_num
print *, tmp(:,i)
enddo
stop
call dgemm('N','N',n_sym_points,mo_tot_num,ao_num, & call dgemm('N','N',n_sym_points,mo_tot_num,ao_num, &
1.d0, tmp,size(tmp,1), mo_coef, size(mo_coef,1), & 1.d0, tmp,size(tmp,1), mo_coef, size(mo_coef,1), &
0.d0, result,size(result,1)) 0.d0, result,size(result,1))

View File

@ -369,7 +369,7 @@ BEGIN_PROVIDER [ integer, mo_sym, (mo_tot_num) ]
double precision :: sym_operations_on_mos(mo_tot_num) double precision :: sym_operations_on_mos(mo_tot_num)
logical :: possible_irrep(n_irrep,mo_tot_num) logical :: possible_irrep(n_irrep,mo_tot_num)
n_sym_points = 10000 n_sym_points = 10
allocate(val(n_sym_points,mo_tot_num,2), sym_points(3,n_sym_points), ref_points(3,n_sym_points)) allocate(val(n_sym_points,mo_tot_num,2), sym_points(3,n_sym_points), ref_points(3,n_sym_points))
call generate_sym_coord(n_sym_points,ref_points) call generate_sym_coord(n_sym_points,ref_points)
@ -402,10 +402,12 @@ BEGIN_PROVIDER [ integer, mo_sym, (mo_tot_num) ]
call sym_apply_diagonal_reflexion(molecule_principal_axis,ref_points(1,ipoint),sym_points(1,ipoint)) call sym_apply_diagonal_reflexion(molecule_principal_axis,ref_points(1,ipoint),sym_points(1,ipoint))
enddo enddo
else if (sym_operation(iop) == 'C2''') then else if (sym_operation(iop) == 'C2''') then
angle = 2.d0
do ipoint=1,n_sym_points do ipoint=1,n_sym_points
call sym_apply_rotation(angle,molecule_secondary_axis,ref_points(1,ipoint),sym_points(1,ipoint)) call sym_apply_rotation(angle,molecule_secondary_axis,ref_points(1,ipoint),sym_points(1,ipoint))
enddo enddo
else if (sym_operation(iop) == 'C2"') then else if (sym_operation(iop) == 'C2"') then
angle = 2.d0
do ipoint=1,n_sym_points do ipoint=1,n_sym_points
call sym_apply_rotation(angle,molecule_ternary_axis,ref_points(1,ipoint),sym_points(1,ipoint)) call sym_apply_rotation(angle,molecule_ternary_axis,ref_points(1,ipoint),sym_points(1,ipoint))
enddo enddo
@ -414,9 +416,12 @@ BEGIN_PROVIDER [ integer, mo_sym, (mo_tot_num) ]
if (sym_operation(iop)(l:l) == '^') exit if (sym_operation(iop)(l:l) == '^') exit
enddo enddo
read(sym_operation(iop)(2:l-1), *) iangle read(sym_operation(iop)(2:l-1), *) iangle
if (l == len(sym_operation(iop))+1) then
l=1 l=1
else
read(sym_operation(iop)(l+1:), *, err=10, end=10) l read(sym_operation(iop)(l+1:), *, err=10, end=10) l
10 continue 10 continue
endif
angle = dble(iangle)/(dble(l)) angle = dble(iangle)/(dble(l))
if (sym_operation(iop)(1:1) == 'C') then if (sym_operation(iop)(1:1) == 'C') then
do ipoint=1,n_sym_points do ipoint=1,n_sym_points
@ -432,23 +437,23 @@ BEGIN_PROVIDER [ integer, mo_sym, (mo_tot_num) ]
call compute_sym_mo_values(sym_points,n_sym_points,val(1,1,1)) call compute_sym_mo_values(sym_points,n_sym_points,val(1,1,1))
print *, sym_operation(iop) print *, sym_operation(iop)
double precision :: icount
do imo=1,mo_tot_num do imo=1,mo_tot_num
sym_operations_on_mos(imo) = 0.d0 sym_operations_on_mos(imo) = 0.d0
icount = 0
do ipoint=1,n_sym_points do ipoint=1,n_sym_points
double precision :: x double precision :: x
if (dabs(val(ipoint,imo,1)) < 1.d-5) cycle
icount += 1.d0
x = val(ipoint,imo,1)/val(ipoint,imo,2) x = val(ipoint,imo,1)/val(ipoint,imo,2)
if (dabs(x) > 1.d0) then if (dabs(x) > 1.d0) then
x = 1.d0/x x = 1.d0/x
endif endif
sym_operations_on_mos(imo) += x sym_operations_on_mos(imo) += x
enddo enddo
sym_operations_on_mos(imo) *= 1.d0/n_sym_points sym_operations_on_mos(imo) *= 1.d0/icount
print *, iop, imo, sym_operations_on_mos(imo) print *, iop, imo, sym_operations_on_mos(imo)
if (dabs(sym_operations_on_mos(imo)-1.d0) < 1.d-2) then print *, val(:,imo,1)
sym_operations_on_mos(imo)=1.d0
else if (dabs(sym_operations_on_mos(imo)+1.d0) < 1.d-2) then
sym_operations_on_mos(imo)=-1.d0
endif
do i=1,n_irrep do i=1,n_irrep
if (character_table(i,iop) /= sym_operations_on_mos(imo)) then if (character_table(i,iop) /= sym_operations_on_mos(imo)) then
possible_irrep(i,imo) = .False. possible_irrep(i,imo) = .False.