10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-22 20:35:19 +01:00

Add Read / Write for Nuclear Repulsion (usefull for PBC)

This commit is contained in:
TApplencourt 2017-05-08 16:27:29 +00:00
parent cd4ea7dd54
commit 414aa32463
5 changed files with 59 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

@ -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

@ -20,3 +20,14 @@ 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,11 +141,25 @@ 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
IF (disk_access_nuclear_repulsion.EQ.'Read') THEN
print*, 'nuclear_repulsion read from disk'
LOGICAL :: has
call ezfio_has_nuclei_nuclear_repulsion(has)
if (has) then
call ezfio_get_nuclei_nuclear_repulsion(nuclear_repulsion)
else
print *, 'nuclei/nuclear_repulsion not found in EZFIO file'
stop 1
endif
ELSE
integer :: k,l integer :: k,l
double precision :: Z12, r2, x(3) double precision :: Z12, r2, x(3)
nuclear_repulsion = 0.d0 nuclear_repulsion = 0.d0
@ -163,10 +177,15 @@ END_PROVIDER
enddo enddo
enddo enddo
nuclear_repulsion *= 0.5d0 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)]