Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
west-public
West
Commits
23a85a15
Commit
23a85a15
authored
May 22, 2017
by
Marco Govoni
Browse files
half way done db.
parent
0eb18278
Changes
2
Hide whitespace changes
Inline
Side-by-side
IO_kernel/pdep_db.f90
View file @
23a85a15
...
...
@@ -45,6 +45,7 @@ MODULE pdep_db
USE
pdep_io
,
ONLY
:
pdep_merge_and_write_G
USE
io_push
,
ONLY
:
io_push_bar
USE
distribution_center
,
ONLY
:
pert
USE
json_module
,
ONLY
:
json_file
!
IMPLICIT
NONE
!
...
...
@@ -55,6 +56,9 @@ MODULE pdep_db
CHARACTER
(
20
),
EXTERNAL
::
human_readable_time
INTEGER
::
iunout
,
global_j
,
local_j
INTEGER
::
ierr
TYPE
(
json_file
)
::
json
INTEGER
::
iunit
!
! MPI BARRIER
!
...
...
@@ -65,71 +69,20 @@ MODULE pdep_db
CALL
start_clock
(
'pdep_db'
)
time_spent
(
1
)
=
get_clock
(
'pdep_db'
)
!
! 1) CREATE THE INPUT FILE
!
IF
(
mpime
==
root
)
THEN
!
! ... open XML descriptor
!
CALL
iotk_free_unit
(
iunout
,
ierr
)
CALL
iotk_open_write
(
iunout
,
FILE
=
TRIM
(
wstat_save_dir
)
//
'/'
//
TRIM
(
"input-file.xml"
)
,
BINARY
=
.FALSE.
,
IERR
=
ierr
)
!
END
IF
!
CALL
mp_bcast
(
ierr
,
root
,
world_comm
)
CALL
errore
(
'pdep_db'
,
'cannot open input-file.xml for writing'
,
ierr
)
!
IF
(
mpime
==
root
)
THEN
!
CALL
iotk_write_begin
(
iunout
,
"WSTAT_CONTROL"
)
!
CALL
iotk_write_dat
(
iunout
,
"wstat_calculation"
,
wstat_calculation
)
CALL
iotk_write_dat
(
iunout
,
"n_pdep_eigen"
,
n_pdep_eigen
)
CALL
iotk_write_dat
(
iunout
,
"n_pdep_times"
,
n_pdep_times
)
CALL
iotk_write_dat
(
iunout
,
"n_pdep_maxiter"
,
n_pdep_maxiter
)
CALL
iotk_write_dat
(
iunout
,
"n_dfpt_maxiter"
,
n_dfpt_maxiter
)
CALL
iotk_write_dat
(
iunout
,
"n_pdep_read_from_file"
,
n_pdep_read_from_file
)
CALL
iotk_write_dat
(
iunout
,
"trev_pdep"
,
trev_pdep
)
CALL
iotk_write_dat
(
iunout
,
"trev_pdep_rel"
,
trev_pdep_rel
)
CALL
iotk_write_dat
(
iunout
,
"tr2_dfpt"
,
tr2_dfpt
)
CALL
iotk_write_dat
(
iunout
,
"l_kinetic_only"
,
l_kinetic_only
)
CALL
iotk_write_dat
(
iunout
,
"l_minimize_exx_if_active"
,
l_minimize_exx_if_active
)
CALL
iotk_write_dat
(
iunout
,
"l_use_ecutrho"
,
l_use_ecutrho
)
!
CALL
iotk_write_end
(
iunout
,
"WSTAT_CONTROL"
)
!
! ... close XML descriptor
!
CALL
iotk_close_write
(
iunout
)
!
END
IF
!
! 2) CREATE THE EIGENVALUE FILE
!
IF
(
mpime
==
root
)
THEN
!
! ... open XML descriptor
!
CALL
iotk_free_unit
(
iunout
,
ierr
)
CALL
iotk_open_write
(
iunout
,
FILE
=
TRIM
(
wstat_save_dir
)
//
'/'
//
TRIM
(
"dbs_eigenvalues.xml"
),
BINARY
=
.FALSE.
,
IERR
=
ierr
)
!
END
IF
!
CALL
mp_bcast
(
ierr
,
root
,
world_comm
)
CALL
errore
(
'pdep_db'
,
'cannot open dbs_eigenvalues.xml file for writing'
,
ierr
)
!
IF
(
mpime
==
root
)
THEN
!
CALL
iotk_write_begin
(
iunout
,
"EIGENVALUES"
)
CALL
iotk_write_dat
(
iunout
,
"ndim"
,
n_pdep_eigen
)
CALL
iotk_write_dat
(
iunout
,
"ev"
,
ev
(
1
:
n_pdep_eigen
))
CALL
iotk_write_end
(
iunout
,
"EIGENVALUES"
)
CALL
json
%
initialize
()
!
! ... close XML descriptor
CALL
add_intput_parameters_to_json_file
(
2
,(/
1
,
2
/)
,
json
)
!
CALL
json
%
add
(
'eigenvalues.ev'
,
ev
(
1
:
n_pdep_eigen
))
!
CALL
iotk_close_write
(
iunout
)
OPEN
(
NEWUNIT
=
iunit
,
FILE
=
TRIM
(
wstat_save_dir
)
//
'/'
//
TRIM
(
'wstat-save.json'
)
)
CALL
json
%
print_file
(
iunit
)
CLOSE
(
iunit
)
CALL
json
%
destroy
()
!
END
IF
ENDIF
!
! 3) CREATE THE EIGENVECTOR FILES
!
...
...
@@ -180,6 +133,7 @@ MODULE pdep_db
USE
pdep_io
,
ONLY
:
pdep_read_G_and_distribute
USE
io_push
,
ONLY
:
io_push_bar
USE
distribution_center
,
ONLY
:
pert
USE
json_module
,
ONLY
:
json_file
!
IMPLICIT
NONE
!
...
...
@@ -194,6 +148,8 @@ MODULE pdep_db
INTEGER
::
tmp_n_pdep_eigen
INTEGER
::
dime
,
iun
,
global_j
,
local_j
REAL
(
DP
),
ALLOCATABLE
::
tmp_ev
(:)
LOGICAL
::
found
TYPE
(
json_file
)
::
json
!
! MPI BARRIER
!
...
...
@@ -211,29 +167,16 @@ MODULE pdep_db
!
! 1) READ THE INPUT FILE
!
ierr
=
0
!
IF
(
mpime
==
root
)
THEN
!
! ... open XML descriptor
!
CALL
iotk_free_unit
(
iun
,
ierr
)
CALL
iotk_open_read
(
iun
,
FILE
=
TRIM
(
dirname
)
//
'/'
//
TRIM
(
'input-file.xml'
),
IERR
=
ierr
)
!
ENDIF
!
CALL
mp_bcast
(
ierr
,
root
,
world_comm
)
IF
(
ierr
/
=
0
)
CALL
errore
(
'pdep_db'
,
'cannot open input-file.xml file for reading'
,
ierr
)
!
IF
(
mpime
==
root
)
THEN
!
CALL
iotk_scan_begin
(
iun
,
"WSTAT_CONTROL"
)
CALL
iotk_scan_dat
(
iun
,
"n_pdep_eigen"
,
tmp_n_pdep_eigen
)
CALL
iotk_scan_end
(
iun
,
"WSTAT_CONTROL"
)
IF
(
mpime
==
root
)
THEN
!
! ... close XML descriptor
CALL
json
%
initialize
()
CALL
json
%
load_file
(
filename
=
TRIM
(
dirname
)
//
'/'
//
TRIM
(
'wstat-save.json'
)
)
!
CALL
json
%
get
(
'input.wstat_control.n_pdep_eigen'
,
tmp_n_pdep_eigen
,
found
)
CALL
json
%
get
(
'eigenvalues.ev'
,
tmp_ev
,
found
)
!
CALL
iotk_close_read
(
iun
)
CALL
json
%
destroy
(
)
!
ENDIF
!
...
...
@@ -248,41 +191,8 @@ MODULE pdep_db
n_eigen_to_get
=
MIN
(
tmp_n_pdep_eigen
,
nglob_to_be_read
)
ENDIF
!
! 2) READ THE EIGENVALUES FILE
!
IF
(
.NOT.
ALLOCATED
(
ev
))
ALLOCATE
(
ev
(
n_eigen_to_get
))
!
ierr
=
0
!
IF
(
mpime
==
root
)
THEN
!
! ... open XML descriptor
!
CALL
iotk_free_unit
(
iun
,
ierr
)
CALL
iotk_open_read
(
iun
,
FILE
=
TRIM
(
dirname
)
//
'/'
//
TRIM
(
'dbs_eigenvalues.xml'
),
IERR
=
ierr
)
!
ENDIF
!
CALL
mp_bcast
(
ierr
,
root
,
world_comm
)
!
IF
(
ierr
/
=
0
)
CALL
errore
(
'pdep_db'
,
'cannot open dbs_eigenvalues.xml file for reading'
,
ierr
)
!
IF
(
mpime
==
root
)
THEN
!
CALL
iotk_scan_begin
(
iun
,
"EIGENVALUES"
)
CALL
iotk_scan_dat
(
iun
,
"ndim"
,
dime
)
ALLOCATE
(
tmp_ev
(
dime
))
CALL
iotk_scan_dat
(
iun
,
"ev"
,
tmp_ev
)
CALL
iotk_scan_end
(
iun
,
"EIGENVALUES"
)
!
! ... close XML descriptor
!
CALL
iotk_close_read
(
iun
)
ev
(
1
:
nglob_to_be_read
)
=
tmp_ev
(
1
:
nglob_to_be_read
)
DEALLOCATE
(
tmp_ev
)
!
ENDIF
!
IF
(
mpime
==
root
)
ev
(
1
:
nglob_to_be_read
)
=
tmp_ev
(
1
:
nglob_to_be_read
)
CALL
mp_bcast
(
ev
,
root
,
world_comm
)
!
! 3) READ THE EIGENVECTOR FILES
...
...
Tools/fetch_input.f90
View file @
23a85a15
...
...
@@ -44,6 +44,8 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
CHARACTER
(
LEN
=
:),
ALLOCATABLE
::
cval
REAL
(
DP
)
::
rval
INTEGER
::
ival
INTEGER
,
ALLOCATABLE
::
ivec
(:)
REAL
(
DP
),
ALLOCATABLE
::
rvec
(:)
LOGICAL
::
lval
INTEGER
::
iunit
!
...
...
@@ -159,10 +161,10 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
IF
(
found
)
wfreq_calculation
=
cval
CALL
json
%
get
(
'wfreq_control.n_pdep_eigen_to_use'
,
ival
,
found
)
IF
(
found
)
n_pdep_eigen_to_use
=
ival
CALL
json
%
get
(
'wfreq_control.qp_bandrange
(1)'
,
rval
,
found
)
IF
(
found
)
qp_bandrange
(
1
)
=
rval
CALL
json
%
get
(
'wfreq_control.qp_bandrange(2)'
,
rval
,
found
)
IF
(
found
)
qp_bandrange
(
2
)
=
rval
CALL
json
%
get
(
'wfreq_control.qp_bandrange
'
,
ivec
,
found
)
IF
(
found
)
qp_bandrange
(
1
:
2
)
=
ivec
(:)
!
CALL json%get('wfreq_control.qp_bandrange(2)', rval, found)
!
IF( found ) qp_bandrange(2) = rval
CALL
json
%
get
(
'wfreq_control.macropol_calculation'
,
cval
,
found
)
IF
(
found
)
macropol_calculation
=
cval
CALL
json
%
get
(
'wfreq_control.n_lanczos'
,
ival
,
found
)
...
...
@@ -189,10 +191,10 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
IF
(
found
)
div_kind_hf
=
ival
CALL
json
%
get
(
'wfreq_control.o_restart_time'
,
rval
,
found
)
IF
(
found
)
o_restart_time
=
rval
CALL
json
%
get
(
'wfreq_control.ecut_spectralf
(1)
'
,
rv
al
,
found
)
IF
(
found
)
ecut_spectralf
(
1
)
=
rv
al
CALL
json
%
get
(
'wfreq_control.ecut_spectralf(2)'
,
rval
,
found
)
IF
(
found
)
ecut_spectralf
(
2
)
=
rval
CALL
json
%
get
(
'wfreq_control.ecut_spectralf'
,
rv
ec
,
found
)
IF
(
found
)
ecut_spectralf
(
1
:
2
)
=
rv
ec
(
1
:
2
)
!
CALL json%get('wfreq_control.ecut_spectralf(2)', rval, found)
!
IF( found ) ecut_spectralf(2) = rval
CALL
json
%
get
(
'wfreq_control.n_spectralf'
,
ival
,
found
)
IF
(
found
)
n_spectralf
=
ival
ENDIF
...
...
@@ -200,22 +202,22 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
IF
(
ANY
(
driver
(:)
==
4
)
)
THEN
CALL
json
%
get
(
'westpp_control.westpp_calculation'
,
cval
,
found
)
IF
(
found
)
westpp_calculation
=
cval
CALL
json
%
get
(
'westpp_control.westpp_range
(1)
'
,
rv
al
,
found
)
IF
(
found
)
westpp_range
(
1
)
=
rv
al
CALL
json
%
get
(
'westpp_control.westpp_range(2)'
,
rval
,
found
)
IF
(
found
)
westpp_range
(
2
)
=
rval
CALL
json
%
get
(
'westpp_control.westpp_range'
,
rv
ec
,
found
)
IF
(
found
)
westpp_range
(
1
:
2
)
=
rv
ec
(
1
:
2
)
!
CALL json%get('westpp_control.westpp_range(2)', rval, found)
!
IF( found ) westpp_range(2) = rval
CALL
json
%
get
(
'westpp_control.westpp_format'
,
cval
,
found
)
IF
(
found
)
westpp_format
=
cval
CALL
json
%
get
(
'westpp_control.westpp_sign'
,
lval
,
found
)
IF
(
found
)
westpp_sign
=
lval
CALL
json
%
get
(
'westpp_control.westpp_n_pdep_eigen_to_use'
,
ival
,
found
)
IF
(
found
)
westpp_n_pdep_eigen_to_use
=
ival
CALL
json
%
get
(
'westpp_control.westpp_r0
(1)
'
,
rv
al
,
found
)
IF
(
found
)
westpp_r0
(
1
)
=
rv
al
CALL
json
%
get
(
'westpp_control.westpp_r0(2)'
,
rval
,
found
)
IF
(
found
)
westpp_r0
(
2
)
=
rval
CALL
json
%
get
(
'westpp_control.westpp_r0(3)'
,
rval
,
found
)
IF
(
found
)
westpp_r0
(
3
)
=
rval
CALL
json
%
get
(
'westpp_control.westpp_r0'
,
rv
ec
,
found
)
IF
(
found
)
westpp_r0
(
1
:
3
)
=
rv
ec
(
1
:
3
)
!
CALL json%get('westpp_control.westpp_r0(2)', rval, found)
!
IF( found ) westpp_r0(2) = rval
!
CALL json%get('westpp_control.westpp_r0(3)', rval, found)
!
IF( found ) westpp_r0(3) = rval
CALL
json
%
get
(
'westpp_control.westpp_nr'
,
ival
,
found
)
IF
(
found
)
westpp_nr
=
ival
CALL
json
%
get
(
'westpp_control.westpp_rmax'
,
rval
,
found
)
...
...
@@ -456,6 +458,7 @@ SUBROUTINE fetch_input( num_drivers, driver, verbose )
CALL
json
%
print_file
(
iunit
)
CLOSE
(
iunit
)
CALL
json
%
destroy
()
!
ENDIF
!
ENDIF
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment