mirror of
https://gitlab.com/scemama/eplf
synced 2024-10-10 01:53:31 +02:00
Added Fortran to_cube
This commit is contained in:
parent
b0556c4f98
commit
d105bd8b6e
@ -111,8 +111,10 @@ def write_ezfioFile(res,filename):
|
||||
ezfio.mo_basis_mo_tot_num = mo_tot_num
|
||||
|
||||
MoTag = res.mo_types[-1]
|
||||
if res.occ_num.keys != []:
|
||||
try:
|
||||
ezfio.mo_basis_mo_occ = res.occ_num[MoTag]
|
||||
except:
|
||||
pass
|
||||
|
||||
mo = res.mo_sets[MoTag]
|
||||
if len(mo) < mo_tot_num:
|
||||
@ -177,7 +179,7 @@ def write_ezfioFile(res,filename):
|
||||
|
||||
|
||||
ezfio.compute_eplf = True
|
||||
for i in "density density_lapl elf_grad eplf_lapl density_grad elf_grad elf_lapl eplf_grad".split():
|
||||
for i in "density density_lapl elf elf_grad eplf_lapl density_grad elf_grad elf_lapl eplf_grad".split():
|
||||
exec "ezfio.compute_%s = False" % i
|
||||
|
||||
write_ezfioFile(file,firstArg+".ezfio")
|
||||
|
@ -3,8 +3,9 @@ include ../make.config
|
||||
SRC=
|
||||
OBJ=
|
||||
|
||||
eplf: main
|
||||
eplf: main to_cube
|
||||
mv main ../bin/eplf
|
||||
mv to_cube ../bin/
|
||||
|
||||
include irpf90.make
|
||||
|
||||
|
@ -30,6 +30,15 @@ data = [ \
|
||||
("compute_density" , "logical" , "" ),
|
||||
("compute_density_grad" , "logical" , "" ),
|
||||
("compute_density_lapl" , "logical" , "" ),
|
||||
("grid_data_eplf" , "real" , "(grid_x_num,grid_y_num,grid_z_num)" ),
|
||||
("grid_data_eplf_grad" , "real" , "(grid_x_num,grid_y_num,grid_z_num,4)" ),
|
||||
("grid_data_eplf_lapl" , "real" , "(grid_x_num,grid_y_num,grid_z_num)" ),
|
||||
("grid_data_elf" , "real" , "(grid_x_num,grid_y_num,grid_z_num)" ),
|
||||
("grid_data_elf_grad" , "real" , "(grid_x_num,grid_y_num,grid_z_num,4)" ),
|
||||
("grid_data_elf_lapl" , "real" , "(grid_x_num,grid_y_num,grid_z_num)" ),
|
||||
("grid_data_density" , "real" , "(grid_x_num,grid_y_num,grid_z_num)" ),
|
||||
("grid_data_density_grad" , "real" , "(grid_x_num,grid_y_num,grid_z_num,4)" ),
|
||||
("grid_data_density_lapl" , "real" , "(grid_x_num,grid_y_num,grid_z_num)" ),
|
||||
]
|
||||
|
||||
data_no_set = [\
|
||||
@ -95,12 +104,12 @@ subroutine get_$X(res)
|
||||
end
|
||||
|
||||
subroutine set_$X(res)
|
||||
$T :: res$D
|
||||
implicit none
|
||||
$T :: res$D
|
||||
integer :: ierr
|
||||
logical :: exists
|
||||
!$OMP CRITICAL (ezfio_critical)
|
||||
PROVIDE ezfio_filename
|
||||
!$OMP CRITICAL (ezfio_critical)
|
||||
if (mpi_master) then
|
||||
call ezfio_set_$X(res)
|
||||
endif
|
||||
|
@ -220,27 +220,6 @@ END_PROVIDER
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
subroutine set_grid_data_$X(buffer)
|
||||
real :: buffer(grid_x_num,grid_y_num,grid_z_num)
|
||||
if (mpi_master) then
|
||||
call ezfio_set_grid_data_$X(buffer)
|
||||
endif
|
||||
end
|
||||
|
||||
subroutine set_grid_data_$X_grad(buffer)
|
||||
real :: buffer(grid_x_num,grid_y_num,grid_z_num,4)
|
||||
if (mpi_master) then
|
||||
call ezfio_set_grid_data_$X_grad(buffer)
|
||||
endif
|
||||
end
|
||||
|
||||
subroutine set_grid_data_$X_lapl(buffer)
|
||||
real :: buffer(grid_x_num,grid_y_num,grid_z_num)
|
||||
if (mpi_master) then
|
||||
call ezfio_set_grid_data_$X_lapl(buffer)
|
||||
endif
|
||||
end
|
||||
|
||||
SUBST [ X ]
|
||||
eplf;;
|
||||
elf;;
|
||||
|
@ -5,38 +5,58 @@ program to_cube
|
||||
integer :: l
|
||||
integer :: ix, iy, iz
|
||||
integer :: iargc
|
||||
character*(32) :: filename
|
||||
character*(32) :: grid_type
|
||||
character*(128) :: filename
|
||||
character*(128) :: grid_type
|
||||
real, allocatable :: grid4D(:,:,:,:)
|
||||
real, allocatable :: grid3D(:,:,:)
|
||||
|
||||
if (iragc() /= 2) then
|
||||
print *, 'usage: to_cube ',trim(filename), trim(grid_type)
|
||||
stop 1
|
||||
endif
|
||||
call getarg(1,filename)
|
||||
call getarg(2,grid_type)
|
||||
if (.not.mpi_master) then
|
||||
return
|
||||
endif
|
||||
open(unit=99,file=grid_cube_filename,status='UNKNOWN',action='WRITE')
|
||||
write (99,*) 'Cube File'
|
||||
write (99,*) 'Analytical EPLF grid'
|
||||
write (99,10) nucl_num,(grid_eplf_origin(i), i=1,3)
|
||||
write (99,10) grid_eplf_x_num, grid_eplf_step(1), 0., 0.
|
||||
write (99,10) grid_eplf_y_num, 0., grid_eplf_step(2), 0.
|
||||
write (99,10) grid_eplf_z_num, 0., 0., grid_eplf_step(3)
|
||||
if (iargc() /= 2) then
|
||||
print *, 'usage: to_cube filename grid_type'
|
||||
stop 1
|
||||
endif
|
||||
call getarg(2,grid_type)
|
||||
filename = trim(ezfio_filename)//'_'//trim(grid_type)//'.cube'
|
||||
open(unit=90,file=filename,status='UNKNOWN')
|
||||
write (90,*) 'Cube File'
|
||||
write (90,*) trim(ezfio_filename), ' ', trim(grid_type)
|
||||
write (90,10) nucl_num,(grid_origin(i), i=1,3)
|
||||
write (90,10) grid_x_num, grid_step(1), 0., 0.
|
||||
write (90,10) grid_y_num, 0., grid_step(2), 0.
|
||||
write (90,10) grid_z_num, 0., 0., grid_step(3)
|
||||
do i=1,nucl_num
|
||||
write (99,11) integer(nucl_charge(i)), nucl_charge(i),
|
||||
write (90,11) int(nucl_charge(i)), nucl_charge(i), &
|
||||
(nucl_coord(i,l),l=1,3)
|
||||
enddo
|
||||
do ix = 1, grid_eplf_x_num
|
||||
do iy = 1, grid_eplf_y_num
|
||||
write (99,20) (grid_eplf(ix,iy,iz), iz=1, grid_eplf_z_num)
|
||||
BEGIN_TEMPLATE
|
||||
if (trim(grid_type) == '$X') then
|
||||
allocate (grid$DimD(grid_x_num,grid_y_num,grid_z_num $D))
|
||||
call get_grid_data_$X(grid$DimD)
|
||||
do ix = 1, grid_x_num
|
||||
do iy = 1, grid_y_num
|
||||
write (90,20) (grid$DimD(ix,iy,iz $D), iz=1, grid_z_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(grid$DimD)
|
||||
endif
|
||||
SUBST [ X, Dim, D ]
|
||||
eplf; 3; ;;
|
||||
density;3; ;;
|
||||
density_lapl;3; ;;
|
||||
elf;3; ;;
|
||||
eplf_lapl;3; ;;
|
||||
elf_lapl;3; ;;
|
||||
elf_grad;4;,4;;
|
||||
density_grad;4;,4;;
|
||||
elf_grad;4;,4;;
|
||||
eplf_grad;4;,4;;
|
||||
END_TEMPLATE
|
||||
10 format (2X,I3,3(2X,F10.6))
|
||||
11 format (2X,I3,4(2X,F10.6))
|
||||
20 format (6(E13.5))
|
||||
close(99)
|
||||
close(90)
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user