10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-19 04:22:36 +01:00

Merge branch 'LCPQ-master'

This commit is contained in:
Anthony Scemama 2017-05-10 01:35:03 +02:00
commit a1367c13bc
10 changed files with 217 additions and 29 deletions

View File

@ -7,5 +7,5 @@ include Input_bitmasks;;
include Input_determinants_by_hand;; include Input_determinants_by_hand;;
include Input_electrons;; include Input_electrons;;
include Input_mo_basis;; include Input_mo_basis;;
include Input_nuclei;; include Input_nuclei_by_hand;;
include Input_auto_generated;; include Input_auto_generated;;

View File

@ -2,7 +2,7 @@ open Qptypes;;
open Qputils;; open Qputils;;
open Core.Std;; open Core.Std;;
module Nuclei : sig module Nuclei_by_hand : sig
type t = type t =
{ nucl_num : Nucl_number.t ; { nucl_num : Nucl_number.t ;
nucl_label : Element.t array; nucl_label : Element.t array;

View File

@ -0,0 +1 @@
Integrals_Monoelec Integrals_Bielec

View File

@ -0,0 +1,30 @@
=============
read_integral
=============
Warning: CAN NOT CHANGE THE NUMBER OF MO !
Needed Modules
==============
.. Do not edit this section It was auto-generated
.. by the `update_README.py` script.
.. image:: tree_dependency.png
* `Integrals_Monoelec <http://github.com/LCPQ/quantum_package/tree/master/src/Integrals_Monoelec>`_
* `Integrals_Bielec <http://github.com/LCPQ/quantum_package/tree/master/src/Integrals_Bielec>`_
Documentation
=============
.. Do not edit this section It was auto-generated
.. by the `update_README.py` script.
`print_integrals <http://github.com/LCPQ/quantum_package/tree/master/plugins/read_integral/read_integrals_mo.irp.f#L1>`_
Undocumented
`run <http://github.com/LCPQ/quantum_package/tree/master/plugins/read_integral/read_integrals_mo.irp.f#L8>`_
Undocumented

View File

@ -0,0 +1,61 @@
program print_integrals
implicit none
integer :: iunit
integer :: getunitandopen
integer ::i,j,k,l
double precision :: integral
iunit = getunitandopen('kinetic_mo','w')
do i=1,mo_tot_num
do j=1,mo_tot_num
write(iunit,*) i,j, mo_kinetic_integral(i,j)
enddo
enddo
close(iunit)
iunit = getunitandopen('overlap_mo','w')
do i=1,mo_tot_num
do j=1,mo_tot_num
write(iunit,*) i,j, mo_overlap(i,j)
enddo
enddo
close(iunit)
iunit = getunitandopen('nuclear_mo','w')
do i=1,mo_tot_num
do j=1,mo_tot_num
write(iunit,*) i,j, mo_nucl_elec_integral(i,j)
enddo
enddo
close(iunit)
!iunit = getunitandopen('pseudo_mo','w')
!do i=1,mo_tot_num
! do j=1,mo_tot_num
! write(iunit,*) i,j, mo_pseudo_integral(i,j)
! enddo
!enddo
!close(iunit)
PROVIDE mo_bielec_integrals_in_map
iunit = getunitandopen('bielec_mo','w')
do l=1,mo_tot_num
do k=1,mo_tot_num
do j=l,mo_tot_num
do i=k,mo_tot_num
!if (i>=j) then
double precision :: get_mo_bielec_integral
integral = get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
if (dabs(integral) > mo_integrals_threshold) then
write (iunit,'(4(I5,X),D22.15)') i,j,k,l, integral
endif
!end if
enddo
enddo
enddo
enddo
close(iunit)
end

View File

@ -0,0 +1,66 @@
program print_integrals
call run
end
subroutine run
use map_module
implicit none
integer :: iunit
integer :: getunitandopen
integer ::i,j,k,l
double precision :: integral
double precision, allocatable :: A(:,:)
integer :: n_integrals
integer(key_kind), allocatable :: buffer_i(:)
real(integral_kind), allocatable :: buffer_values(:)
integer(key_kind) :: key
call ezfio_set_mo_basis_mo_tot_num(mo_tot_num)
allocate (A(mo_tot_num_align,mo_tot_num))
iunit = getunitandopen('kinetic_mo','r')
do
read (iunit,*,end=10) i,j, integral
A(i,j) = integral
enddo
10 continue
close(iunit)
call write_one_e_integrals('mo_kinetic_integral', A, size(A,1), size(A,2))
iunit = getunitandopen('nuclear_mo','r')
do
read (iunit,*,end=12) i,j, integral
A(i,j) = integral
enddo
12 continue
close(iunit)
call write_one_e_integrals('mo_ne_integral', A, size(A,1), size(A,2))
call ezfio_set_integrals_monoelec_disk_access_mo_one_integrals("Read")
allocate(buffer_i(mo_tot_num**4), buffer_values(mo_tot_num**4))
iunit = getunitandopen('bielec_mo','r')
n_integrals=0
do
read (iunit,*,end=13) i,j,k,l, integral
n_integrals += 1
call bielec_integrals_index(i, j, k, l, buffer_i(n_integrals) )
buffer_values(n_integrals) = integral
enddo
13 continue
close(iunit)
call insert_into_mo_integrals_map(n_integrals,buffer_i,buffer_values)
call map_sort(mo_integrals_map)
call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map)
call ezfio_set_integrals_bielec_disk_access_mo_integrals("Read")
end

View File

@ -20,7 +20,7 @@ type keyword =
| Determinants_by_hand | Determinants_by_hand
| Electrons | Electrons
| Mo_basis | Mo_basis
| Nuclei | Nuclei_by_hand
{keywords} {keywords}
@ -30,7 +30,7 @@ let keyword_to_string = function
| Determinants_by_hand -> "Determinants_by_hand" | Determinants_by_hand -> "Determinants_by_hand"
| Electrons -> "Electrons" | Electrons -> "Electrons"
| Mo_basis -> "MO basis" | Mo_basis -> "MO basis"
| Nuclei -> "Molecule" | Nuclei_by_hand -> "Molecule"
{keywords_to_string} {keywords_to_string}
@ -74,8 +74,8 @@ let get s =
f Mo_basis.(read, to_rst) f Mo_basis.(read, to_rst)
| Electrons -> | Electrons ->
f Electrons.(read, to_rst) f Electrons.(read, to_rst)
| Nuclei -> | Nuclei_by_hand ->
f Nuclei.(read, to_rst) f Nuclei_by_hand.(read, to_rst)
| Ao_basis -> | Ao_basis ->
f Ao_basis.(read, to_rst) f Ao_basis.(read, to_rst)
| Determinants_by_hand -> | Determinants_by_hand ->
@ -121,7 +121,7 @@ let set str s =
{write} {write}
| Electrons -> write Electrons.(of_rst, write) s | Electrons -> write Electrons.(of_rst, write) s
| Determinants_by_hand -> write Determinants_by_hand.(of_rst, write) s | Determinants_by_hand -> write Determinants_by_hand.(of_rst, write) s
| Nuclei -> write Nuclei.(of_rst, write) s | Nuclei_by_hand -> write Nuclei_by_hand.(of_rst, write) s
| Ao_basis -> () (* TODO *) | Ao_basis -> () (* TODO *)
| Mo_basis -> () (* TODO *) | Mo_basis -> () (* TODO *)
end end
@ -184,7 +184,7 @@ let run check_only ?ndet ?state ezfio_filename =
*) *)
let tasks = [ let tasks = [
Nuclei ; Nuclei_by_hand ;
Ao_basis; Ao_basis;
Electrons ; Electrons ;
{tasks} {tasks}

View File

@ -19,4 +19,15 @@ interface: ezfio, provider
doc: Nuclear coordinates in the format (:, {x,y,z}) doc: Nuclear coordinates in the format (:, {x,y,z})
type: double precision type: double precision
size: (nuclei.nucl_num,3) size: (nuclei.nucl_num,3)
interface: ezfio interface: ezfio
[disk_access_nuclear_repulsion]
doc: Read/Write Nuclear Repulsion from/to disk [ Write | Read | None ]
type: Disk_access
interface: ezfio,provider,ocaml
default: None
[nuclear_repulsion]
doc: Nuclear repulsion (Computed automaticaly or Read in the EZFIO)
type:double precision
interface: ezfio

View File

@ -141,34 +141,53 @@ BEGIN_PROVIDER [ double precision, positive_charge_barycentre,(3)]
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, nuclear_repulsion ] BEGIN_PROVIDER [ double precision, nuclear_repulsion ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Nuclear repulsion energy ! Nuclear repulsion energy
END_DOC END_DOC
integer :: k,l
double precision :: Z12, r2, x(3) IF (disk_access_nuclear_repulsion.EQ.'Read') THEN
nuclear_repulsion = 0.d0 print*, 'nuclear_repulsion read from disk'
do l = 1, nucl_num LOGICAL :: has
do k = 1, nucl_num call ezfio_has_nuclei_nuclear_repulsion(has)
if(k == l) then if (has) then
cycle call ezfio_get_nuclei_nuclear_repulsion(nuclear_repulsion)
endif else
Z12 = nucl_charge(k)*nucl_charge(l) print *, 'nuclei/nuclear_repulsion not found in EZFIO file'
x(1) = nucl_coord(k,1) - nucl_coord(l,1) stop 1
x(2) = nucl_coord(k,2) - nucl_coord(l,2) endif
x(3) = nucl_coord(k,3) - nucl_coord(l,3)
r2 = x(1)*x(1) + x(2)*x(2) + x(3)*x(3) ELSE
nuclear_repulsion += Z12/dsqrt(r2)
enddo integer :: k,l
enddo double precision :: Z12, r2, x(3)
nuclear_repulsion *= 0.5d0 nuclear_repulsion = 0.d0
do l = 1, nucl_num
do k = 1, nucl_num
if(k == l) then
cycle
endif
Z12 = nucl_charge(k)*nucl_charge(l)
x(1) = nucl_coord(k,1) - nucl_coord(l,1)
x(2) = nucl_coord(k,2) - nucl_coord(l,2)
x(3) = nucl_coord(k,3) - nucl_coord(l,3)
r2 = x(1)*x(1) + x(2)*x(2) + x(3)*x(3)
nuclear_repulsion += Z12/dsqrt(r2)
enddo
enddo
nuclear_repulsion *= 0.5d0
END IF
call write_time(output_Nuclei) call write_time(output_Nuclei)
call write_double(output_Nuclei,nuclear_repulsion, & call write_double(output_Nuclei,nuclear_repulsion, &
'Nuclear repulsion energy') 'Nuclear repulsion energy')
IF (disk_access_nuclear_repulsion.EQ.'Write') THEN
call ezfio_set_nuclei_nuclear_repulsion(nuclear_repulsion)
END IF
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ character*(128), element_name, (78)] BEGIN_PROVIDER [ character*(128), element_name, (78)]
BEGIN_DOC BEGIN_DOC
! Array of the name of element, sorted by nuclear charge (integer) ! Array of the name of element, sorted by nuclear charge (integer)