2009-10-12 17:37:07 +02:00
|
|
|
BEGIN_SHELL [ /usr/bin/python ]
|
|
|
|
|
|
|
|
data = [ \
|
|
|
|
("nuclei_nucl_num" , "integer" , "" ),
|
|
|
|
("nuclei_nucl_charge" , "real" , "(nucl_num)" ),
|
|
|
|
("nuclei_nucl_coord" , "real" , "(nucl_num,3)" ),
|
|
|
|
("mo_basis_mo_coef" , "real" , "(ao_num,mo_tot_num)" ),
|
|
|
|
("mo_basis_mo_occ" , "real" , "(mo_tot_num)" ),
|
|
|
|
("electrons_elec_alpha_num" , "integer" , "" ),
|
|
|
|
("electrons_elec_beta_num" , "integer" , "" ),
|
|
|
|
("ao_basis_ao_num" , "integer" , "" ),
|
|
|
|
("ao_basis_ao_prim_num" , "integer" , "(ao_num)" ),
|
|
|
|
("ao_basis_ao_nucl" , "integer" , "(ao_num)" ),
|
|
|
|
("ao_basis_ao_power" , "integer" , "(ao_num,3)" ),
|
|
|
|
("ao_basis_ao_expo" , "real" , "(ao_num,ao_prim_num_max)" ),
|
|
|
|
("ao_basis_ao_coef" , "real" , "(ao_num,ao_prim_num_max)" ),
|
|
|
|
("determinants_det_num" , "integer" , "" ),
|
|
|
|
("determinants_det_coef" , "real" , "(det_num)" ),
|
|
|
|
("determinants_det_occ" , "integer" , "(elec_alpha_num-mo_closed_num,det_num,2)" ),
|
|
|
|
("grid_point_num" , "integer" , "(3)" ),
|
|
|
|
("grid_step_size" , "real" , "(3)" ),
|
|
|
|
("grid_origin" , "real" , "(3)" ),
|
|
|
|
("grid_opposite" , "real" , "(3)" ),
|
2009-11-06 00:27:24 +01:00
|
|
|
("compute_eplf" , "logical" , "" ),
|
|
|
|
("compute_eplf_grad" , "logical" , "" ),
|
|
|
|
("compute_eplf_lapl" , "logical" , "" ),
|
|
|
|
("compute_elf" , "logical" , "" ),
|
|
|
|
("compute_elf_grad" , "logical" , "" ),
|
|
|
|
("compute_elf_lapl" , "logical" , "" ),
|
|
|
|
("compute_density" , "logical" , "" ),
|
|
|
|
("compute_density_grad" , "logical" , "" ),
|
|
|
|
("compute_density_lapl" , "logical" , "" ),
|
2009-10-12 17:37:07 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
data_no_set = [\
|
|
|
|
("mo_basis_mo_tot_num" , "integer" , "" ),
|
|
|
|
("mo_basis_mo_active_num" , "integer" , "" ),
|
|
|
|
("mo_basis_mo_closed_num" , "integer" , "" ),
|
|
|
|
]
|
|
|
|
|
|
|
|
def do_subst(t0,d):
|
|
|
|
t = t0
|
|
|
|
t = t.replace("$X",d[0])
|
|
|
|
t = t.replace("$T",d[1])
|
|
|
|
t = t.replace("$D",d[2])
|
|
|
|
if d[1].startswith("character"):
|
|
|
|
size = d[1].split("*")[1][1:-1]
|
|
|
|
u = "character"
|
|
|
|
elif d[1].startswith("double precision"):
|
|
|
|
u = d[1].replace(" ","_")
|
|
|
|
size = "1"
|
|
|
|
elif "*" in d[1]:
|
|
|
|
size = "1"
|
|
|
|
u = d[1].replace("*","")
|
|
|
|
else:
|
|
|
|
size = "1"
|
|
|
|
u = d[1]
|
|
|
|
t = t.replace("$U",u)
|
|
|
|
if d[2] == "":
|
|
|
|
t = t.replace("$S",size)
|
|
|
|
else:
|
|
|
|
if size == "1":
|
|
|
|
t = t.replace("$S","size(res)")
|
|
|
|
else:
|
|
|
|
t = t.replace("$S","%s*size(res)"%(size))
|
|
|
|
print t
|
|
|
|
t0 = """
|
|
|
|
subroutine get_$X(res)
|
|
|
|
implicit none
|
|
|
|
IRP_IF MPI
|
|
|
|
include 'mpif.h'
|
|
|
|
IRP_ENDIF
|
|
|
|
$T :: res$D
|
|
|
|
integer :: ierr
|
|
|
|
logical :: exists
|
|
|
|
!$OMP CRITICAL (ezfio_critical)
|
|
|
|
PROVIDE ezfio_filename
|
|
|
|
if (mpi_master) then
|
|
|
|
call ezfio_has_$X(exists)
|
|
|
|
if (exists) then
|
|
|
|
call ezfio_get_$X(res)
|
|
|
|
else
|
|
|
|
call ezfio_set_$X(res)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
IRP_IF MPI
|
|
|
|
call MPI_BCAST(res,$S,MPI_$U,0,MPI_COMM_WORLD,ierr)
|
|
|
|
if (ierr /= MPI_SUCCESS) then
|
|
|
|
call abrt(irp_here,'Unable to broadcast $X')
|
|
|
|
endif
|
|
|
|
IRP_ENDIF
|
|
|
|
!$OMP END CRITICAL (ezfio_critical)
|
|
|
|
|
2009-12-04 16:14:23 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
subroutine set_$X(res)
|
|
|
|
$T :: res$D
|
|
|
|
implicit none
|
|
|
|
integer :: ierr
|
|
|
|
logical :: exists
|
|
|
|
!$OMP CRITICAL (ezfio_critical)
|
|
|
|
PROVIDE ezfio_filename
|
|
|
|
if (mpi_master) then
|
|
|
|
call ezfio_set_$X(res)
|
|
|
|
endif
|
|
|
|
!$OMP END CRITICAL (ezfio_critical)
|
|
|
|
|
2009-10-12 17:37:07 +02:00
|
|
|
end
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
t1 = """
|
|
|
|
subroutine get_$X(res)
|
|
|
|
implicit none
|
|
|
|
IRP_IF MPI
|
|
|
|
include 'mpif.h'
|
|
|
|
IRP_ENDIF
|
|
|
|
$T :: res$D
|
|
|
|
integer :: ierr
|
|
|
|
!$OMP CRITICAL (ezfio_critical)
|
|
|
|
PROVIDE ezfio_filename
|
|
|
|
if (mpi_master) then
|
|
|
|
call ezfio_get_$X(res)
|
|
|
|
endif
|
|
|
|
|
|
|
|
IRP_IF MPI
|
|
|
|
call MPI_BCAST(res,$S,MPI_$U,0,MPI_COMM_WORLD,ierr)
|
|
|
|
if (ierr /= MPI_SUCCESS) then
|
|
|
|
call abrt(irp_here,'Unable to broadcast $X')
|
|
|
|
endif
|
|
|
|
IRP_ENDIF
|
|
|
|
!$OMP END CRITICAL (ezfio_critical)
|
|
|
|
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
|
|
|
|
for d in data:
|
|
|
|
do_subst(t0,d)
|
|
|
|
|
|
|
|
for d in data_no_set:
|
|
|
|
do_subst(t1,d)
|
|
|
|
|
|
|
|
END_SHELL
|
|
|
|
|