mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-29 06:35:28 -04:00
Add MAX_FILE_SIZE_MB keyword to MO_CUBES section
This commit is contained in:
parent
9050283254
commit
53a46e880a
5 changed files with 45 additions and 18 deletions
|
|
@ -38,17 +38,20 @@ CONTAINS
|
|||
!> \param particles ...
|
||||
!> \param zeff ...
|
||||
!> \param stride ...
|
||||
!> \param max_file_size_mb ...
|
||||
!> \param zero_tails ...
|
||||
!> \param silent minimal I/O
|
||||
!> \param mpi_io True if cube should be written in parallel using MPI
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE cp_pw_to_cube(pw, unit_nr, title, particles, zeff, stride, zero_tails, silent, mpi_io)
|
||||
SUBROUTINE cp_pw_to_cube(pw, unit_nr, title, particles, zeff, stride, max_file_size_mb, &
|
||||
zero_tails, silent, mpi_io)
|
||||
TYPE(pw_r3d_rs_type), INTENT(IN) :: pw
|
||||
INTEGER, INTENT(IN) :: unit_nr
|
||||
CHARACTER(*), INTENT(IN), OPTIONAL :: title
|
||||
TYPE(particle_list_type), POINTER :: particles
|
||||
REAL(KIND=dp), DIMENSION(:), OPTIONAL :: zeff
|
||||
INTEGER, DIMENSION(:), OPTIONAL, POINTER :: stride
|
||||
REAL(KIND=dp), INTENT(IN), OPTIONAL :: max_file_size_mb
|
||||
LOGICAL, INTENT(IN), OPTIONAL :: zero_tails, silent, mpi_io
|
||||
|
||||
INTEGER :: i, n
|
||||
|
|
@ -70,12 +73,12 @@ CONTAINS
|
|||
CALL pw_to_cube(pw=pw, unit_nr=unit_nr, title=title, &
|
||||
particles_z=particles_z, particles_r=particles_r, &
|
||||
particles_zeff=zeff, &
|
||||
stride=stride, zero_tails=zero_tails, &
|
||||
silent=silent, mpi_io=mpi_io)
|
||||
stride=stride, max_file_size_mb=max_file_size_mb, &
|
||||
zero_tails=zero_tails, silent=silent, mpi_io=mpi_io)
|
||||
ELSE
|
||||
CALL pw_to_cube(pw=pw, unit_nr=unit_nr, title=title, &
|
||||
stride=stride, zero_tails=zero_tails, &
|
||||
silent=silent, mpi_io=mpi_io)
|
||||
stride=stride, max_file_size_mb=max_file_size_mb, &
|
||||
zero_tails=zero_tails, silent=silent, mpi_io=mpi_io)
|
||||
END IF
|
||||
|
||||
END SUBROUTINE cp_pw_to_cube
|
||||
|
|
|
|||
|
|
@ -2203,6 +2203,7 @@ CONTAINS
|
|||
" In this case, the density corresponding to the time dependent MO is printed"// &
|
||||
" instead of the wave-function.", &
|
||||
print_level=high_print_level, filename="")
|
||||
|
||||
CALL keyword_create(keyword, __LOCATION__, name="stride", &
|
||||
description="The stride (X,Y,Z) used to write the cube file "// &
|
||||
"(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
|
||||
|
|
@ -2211,6 +2212,12 @@ CONTAINS
|
|||
CALL section_add_keyword(print_key, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, __LOCATION__, name="max_file_size_mb", &
|
||||
description="Limits the size of the cube file by choosing a suitable stride. Zero means no limit.", &
|
||||
usage="MAX_FILE_SIZE_MB 1.5", default_r_val=0.0_dp)
|
||||
CALL section_add_keyword(print_key, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, __LOCATION__, name="write_cube", &
|
||||
description="If the MO cube file should be written. If false, the eigenvalues are still computed."// &
|
||||
" Can also be useful in combination with STM calculations", &
|
||||
|
|
@ -2224,6 +2231,7 @@ CONTAINS
|
|||
default_i_val=0)
|
||||
CALL section_add_keyword(print_key, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create( &
|
||||
keyword, __LOCATION__, name="nhomo", &
|
||||
description="If the printkey is activated controls the number of homos that dumped as a cube (-1=all),"// &
|
||||
|
|
|
|||
|
|
@ -43,12 +43,13 @@ CONTAINS
|
|||
!> \param particles_z ...
|
||||
!> \param particles_zeff ...
|
||||
!> \param stride ...
|
||||
!> \param max_file_size_mb ...
|
||||
!> \param zero_tails ...
|
||||
!> \param silent ...
|
||||
!> \param mpi_io ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE pw_to_cube(pw, unit_nr, title, particles_r, particles_z, particles_zeff, &
|
||||
stride, zero_tails, silent, mpi_io)
|
||||
stride, max_file_size_mb, zero_tails, silent, mpi_io)
|
||||
TYPE(pw_r3d_rs_type), INTENT(IN) :: pw
|
||||
INTEGER, INTENT(IN) :: unit_nr
|
||||
CHARACTER(*), INTENT(IN), OPTIONAL :: title
|
||||
|
|
@ -57,6 +58,7 @@ CONTAINS
|
|||
INTEGER, DIMENSION(:), INTENT(IN), OPTIONAL :: particles_z
|
||||
REAL(KIND=dp), DIMENSION(:), INTENT(IN), OPTIONAL :: particles_zeff
|
||||
INTEGER, DIMENSION(:), OPTIONAL, POINTER :: stride
|
||||
REAL(KIND=dp), INTENT(IN), OPTIONAL :: max_file_size_mb
|
||||
LOGICAL, INTENT(IN), OPTIONAL :: zero_tails, silent, mpi_io
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'pw_to_cube'
|
||||
|
|
@ -65,6 +67,7 @@ CONTAINS
|
|||
INTEGER :: checksum, dest, handle, i, I1, I2, I3, iat, ip, L1, L2, L3, msglen, my_rank, &
|
||||
my_stride(3), np, num_linebreak, num_pe, rank(2), size_of_z, source, tag, U1, U2, U3
|
||||
LOGICAL :: be_silent, my_zero_tails, parallel_write
|
||||
REAL(KIND=dp) :: compression_factor, my_max_file_size_mb
|
||||
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: buf
|
||||
TYPE(mp_comm_type) :: gid
|
||||
TYPE(mp_file_type) :: mp_unit
|
||||
|
|
@ -74,9 +77,13 @@ CONTAINS
|
|||
my_zero_tails = .FALSE.
|
||||
be_silent = .FALSE.
|
||||
parallel_write = .FALSE.
|
||||
my_max_file_size_mb = 0.0_dp
|
||||
IF (PRESENT(zero_tails)) my_zero_tails = zero_tails
|
||||
IF (PRESENT(silent)) be_silent = silent
|
||||
IF (PRESENT(mpi_io)) parallel_write = mpi_io
|
||||
IF (PRESENT(max_file_size_mb)) my_max_file_size_mb = max_file_size_mb
|
||||
CPASSERT(my_max_file_size_mb >= 0)
|
||||
|
||||
my_stride = 1
|
||||
IF (PRESENT(stride)) THEN
|
||||
IF (SIZE(stride) /= 1 .AND. SIZE(stride) /= 3) &
|
||||
|
|
@ -89,11 +96,18 @@ CONTAINS
|
|||
ELSE
|
||||
my_stride = stride(1:3)
|
||||
END IF
|
||||
CPASSERT(my_stride(1) > 0)
|
||||
CPASSERT(my_stride(2) > 0)
|
||||
CPASSERT(my_stride(3) > 0)
|
||||
END IF
|
||||
|
||||
IF (my_max_file_size_mb > 0) THEN
|
||||
! A single grid point takes up 13 bytes, which is 1.3e-05 MB.
|
||||
compression_factor = 1.3e-05_dp*PRODUCT(REAL(pw%pw_grid%npts, dp))/max_file_size_mb
|
||||
my_stride(:) = INT(compression_factor**(1.0/3.0)) + 1
|
||||
END IF
|
||||
|
||||
CPASSERT(my_stride(1) > 0)
|
||||
CPASSERT(my_stride(2) > 0)
|
||||
CPASSERT(my_stride(3) > 0)
|
||||
|
||||
IF (.NOT. parallel_write) THEN
|
||||
IF (unit_nr > 0) THEN
|
||||
! this format seems to work for e.g. molekel and gOpenmol
|
||||
|
|
|
|||
|
|
@ -214,8 +214,6 @@ MODULE qs_scf_post_gpw
|
|||
|
||||
PUBLIC :: make_lumo_gpw
|
||||
|
||||
! **************************************************************************************************
|
||||
|
||||
CONTAINS
|
||||
|
||||
! **************************************************************************************************
|
||||
|
|
@ -1081,7 +1079,9 @@ CONTAINS
|
|||
mpi_io=mpi_io)
|
||||
WRITE (title, *) "WAVEFUNCTION ", ivector, " spin ", ispin, " i.e. HOMO - ", ivector - homo
|
||||
CALL cp_pw_to_cube(wf_r, unit_nr, title, particles=particles, &
|
||||
stride=section_get_ivals(dft_section, "PRINT%MO_CUBES%STRIDE"), mpi_io=mpi_io)
|
||||
stride=section_get_ivals(dft_section, "PRINT%MO_CUBES%STRIDE"), &
|
||||
max_file_size_mb=section_get_rval(dft_section, "PRINT%MO_CUBES%MAX_FILE_SIZE_MB"), &
|
||||
mpi_io=mpi_io)
|
||||
CALL cp_print_key_finished_output(unit_nr, logger, input, "DFT%PRINT%MO_CUBES", mpi_io=mpi_io)
|
||||
END DO
|
||||
IF (ASSOCIATED(list_index)) DEALLOCATE (list_index)
|
||||
|
|
@ -1168,7 +1168,9 @@ CONTAINS
|
|||
mpi_io=mpi_io)
|
||||
WRITE (title, *) "WAVEFUNCTION ", index_mo, " spin ", ispin, " i.e. LUMO + ", ifirst + ivector - 2
|
||||
CALL cp_pw_to_cube(wf_r, unit_nr, title, particles=particles, &
|
||||
stride=section_get_ivals(dft_section, "PRINT%MO_CUBES%STRIDE"), mpi_io=mpi_io)
|
||||
stride=section_get_ivals(dft_section, "PRINT%MO_CUBES%STRIDE"), &
|
||||
max_file_size_mb=section_get_rval(dft_section, "PRINT%MO_CUBES%MAX_FILE_SIZE_MB"), &
|
||||
mpi_io=mpi_io)
|
||||
CALL cp_print_key_finished_output(unit_nr, logger, input, "DFT%PRINT%MO_CUBES", mpi_io=mpi_io)
|
||||
END DO
|
||||
END IF
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@
|
|||
QS_SCF 100
|
||||
&END EACH
|
||||
&END MO
|
||||
## &MO_CUBES
|
||||
## NHOMO 64
|
||||
## NLUMO 20
|
||||
## WRITE_CUBE F
|
||||
## &END
|
||||
&MO_CUBES
|
||||
MAX_FILE_SIZE_MB 0.01
|
||||
NHOMO 1
|
||||
NLUMO 1
|
||||
&END MO_CUBES
|
||||
&END PRINT
|
||||
&QS
|
||||
EXTRAPOLATION PS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue