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
68a16c3a
Commit
68a16c3a
authored
May 19, 2021
by
Marco Govoni
Browse files
Merge branch 'forpy_fixes' into 'develop'
Forpy fixes See merge request west-devel/West!28
parents
e20e0db3
a6070f38
Changes
2
Hide whitespace changes
Inline
Side-by-side
Modules/west_version.f90.in
View file @
68a16c3a
!
!
! Copyright (C) 2015-2019 M. Govoni
! Copyright (C) 2015-2019 M. Govoni
! This file is distributed under the terms of the
! This file is distributed under the terms of the
! GNU General Public License. See the file `LICENSE'
! GNU General Public License. See the file `LICENSE'
! in the root directory of the present distribution,
! in the root directory of the present distribution,
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
!
!
! This file is part of WEST.
! This file is part of WEST.
!
!
! Contributors to this file:
! Contributors to this file:
! Marco Govoni
! Marco Govoni
!
!
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
...
@@ -20,33 +20,51 @@ MODULE west_version
...
@@ -20,33 +20,51 @@ MODULE west_version
!
!
SAVE
SAVE
!
!
CHARACTER (LEN=6) :: west_version_number = 'checkit'
CHARACTER(LEN=*), PARAMETER :: west_version_number = 'checkit'
CHARACTER (LEN=512) :: west_git_revision = 'unknown'
CHARACTER(LEN=*), PARAMETER :: west_git_revision = 'unknown'
CHARACTER (LEN=512) :: west_topdir = 'unset'
CHARACTER(LEN=*), PARAMETER :: west_topdir = 'unset'
TYPE(list) :: paths
LOGICAL, PARAMETER :: forpy_use_numpy = .FALSE.
TYPE(list) :: paths
!
!
CONTAINS
CONTAINS
!
!
SUBROUTINE start_forpy()
SUBROUTINE start_forpy()
USE forpy_mod, ONLY: forpy_initialize, get_sys_path
!
USE forpy_mod, ONLY: forpy_initialize,get_sys_path,module_py,import_py,forpy_finalize
!
IMPLICIT NONE
IMPLICIT NONE
!
INTEGER :: IERR
INTEGER :: IERR
TYPE(module_py) :: pymod
!
!
IERR = forpy_initialize()
IERR = forpy_initialize(
forpy_use_numpy
)
IF(IERR/=0) CALL errore('forpy','Err: cannot init forpy',1)
IF(IERR/=0) CALL errore('forpy','Err: cannot init forpy',1)
!
!
IERR = get_sys_path(paths)
IERR = get_sys_path(paths)
IF(IERR/=0) CALL errore('forpy','Err: cannot get_sys_path',1)
IF(IERR/=0) CALL errore('forpy','Err: cannot get_sys_path',1)
!
!
IERR = paths%append(TRIM(ADJUSTL(west_topdir))//"/Pytools")
IERR = paths%append(TRIM(ADJUSTL(west_topdir))//"/Pytools")
IF(IERR/=0) CALL errore('forpy','Err: cannot append paths',1)
IF(IERR/=0) CALL errore('forpy','Err: cannot append paths',1)
!
! Test: import west_fetch_input
!
IERR = import_py(pymod,'west_fetch_input')
IF(IERR/=0) THEN
CALL forpy_finalize()
CALL errore('forpy','Err: cannot import module',1)
ENDIF
!
END SUBROUTINE
END SUBROUTINE
!
!
SUBROUTINE end_forpy()
SUBROUTINE end_forpy()
!
USE forpy_mod, ONLY: forpy_finalize
USE forpy_mod, ONLY: forpy_finalize
!
IMPLICIT NONE
IMPLICIT NONE
!
CALL paths%destroy()
CALL paths%destroy()
CALL forpy_finalize()
CALL forpy_finalize()
!
END SUBROUTINE
END SUBROUTINE
!
!
END MODULE
END MODULE
Tools/fetch_input.f90
View file @
68a16c3a
...
@@ -153,6 +153,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -153,6 +153,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
CHARACTER
(
LEN
=
:),
ALLOCATABLE
::
cvalue
CHARACTER
(
LEN
=
:),
ALLOCATABLE
::
cvalue
TYPE
(
json_file
)
::
json
TYPE
(
json_file
)
::
json
INTEGER
::
iunit
,
lenc
INTEGER
::
iunit
,
lenc
INTEGER
,
PARAMETER
::
DUMMY_DEFAULT
=
-1210
!
!
CALL
start_clock
(
'fetch_input'
)
CALL
start_clock
(
'fetch_input'
)
!
!
...
@@ -207,11 +208,11 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -207,11 +208,11 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
CALL
return_obj
%
destroy
CALL
return_obj
%
destroy
!
!
IERR
=
return_dict
%
getitem
(
cvalue
,
"wstat_calculation"
);
wstat_calculation
=
TRIM
(
ADJUSTL
(
cvalue
))
IERR
=
return_dict
%
getitem
(
cvalue
,
"wstat_calculation"
);
wstat_calculation
=
TRIM
(
ADJUSTL
(
cvalue
))
IERR
=
return_dict
%
get
item
(
n_pdep_eigen
,
"n_pdep_eigen"
)
IERR
=
return_dict
%
get
(
n_pdep_eigen
,
"n_pdep_eigen"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
get
item
(
n_pdep_times
,
"n_pdep_times"
)
IERR
=
return_dict
%
get
(
n_pdep_times
,
"n_pdep_times"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
get
item
(
n_pdep_maxiter
,
"n_pdep_maxiter"
)
IERR
=
return_dict
%
get
(
n_pdep_maxiter
,
"n_pdep_maxiter"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
get
item
(
n_dfpt_maxiter
,
"n_dfpt_maxiter"
)
IERR
=
return_dict
%
get
(
n_dfpt_maxiter
,
"n_dfpt_maxiter"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
get
item
(
n_pdep_read_from_file
,
"n_pdep_read_from_file"
)
IERR
=
return_dict
%
get
(
n_pdep_read_from_file
,
"n_pdep_read_from_file"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
getitem
(
trev_pdep
,
"trev_pdep"
)
IERR
=
return_dict
%
getitem
(
trev_pdep
,
"trev_pdep"
)
IERR
=
return_dict
%
getitem
(
trev_pdep_rel
,
"trev_pdep_rel"
)
IERR
=
return_dict
%
getitem
(
trev_pdep_rel
,
"trev_pdep_rel"
)
IERR
=
return_dict
%
getitem
(
tr2_dfpt
,
"tr2_dfpt"
)
IERR
=
return_dict
%
getitem
(
tr2_dfpt
,
"tr2_dfpt"
)
...
@@ -251,7 +252,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -251,7 +252,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
CALL
return_obj
%
destroy
CALL
return_obj
%
destroy
!
!
IERR
=
return_dict
%
getitem
(
cvalue
,
"wfreq_calculation"
);
wfreq_calculation
=
TRIM
(
ADJUSTL
(
cvalue
))
IERR
=
return_dict
%
getitem
(
cvalue
,
"wfreq_calculation"
);
wfreq_calculation
=
TRIM
(
ADJUSTL
(
cvalue
))
IERR
=
return_dict
%
get
item
(
n_pdep_eigen_to_use
,
"n_pdep_eigen_to_use"
)
IERR
=
return_dict
%
get
(
n_pdep_eigen_to_use
,
"n_pdep_eigen_to_use"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
getitem
(
tmp_obj
,
"qp_bandrange"
)
IERR
=
return_dict
%
getitem
(
tmp_obj
,
"qp_bandrange"
)
IERR
=
cast
(
tmp_list
,
tmp_obj
)
IERR
=
cast
(
tmp_list
,
tmp_obj
)
IERR
=
tmp_list
%
len
(
list_len
)
IERR
=
tmp_list
%
len
(
list_len
)
...
@@ -260,13 +261,13 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -260,13 +261,13 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
CALL
tmp_list
%
destroy
CALL
tmp_list
%
destroy
CALL
tmp_obj
%
destroy
CALL
tmp_obj
%
destroy
IERR
=
return_dict
%
getitem
(
cvalue
,
"macropol_calculation"
);
macropol_calculation
=
TRIM
(
ADJUSTL
(
cvalue
))
IERR
=
return_dict
%
getitem
(
cvalue
,
"macropol_calculation"
);
macropol_calculation
=
TRIM
(
ADJUSTL
(
cvalue
))
IERR
=
return_dict
%
get
item
(
n_lanczos
,
"n_lanczos"
)
IERR
=
return_dict
%
get
(
n_lanczos
,
"n_lanczos"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
get
item
(
n_imfreq
,
"n_imfreq"
)
IERR
=
return_dict
%
get
(
n_imfreq
,
"n_imfreq"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
get
item
(
n_refreq
,
"n_refreq"
)
IERR
=
return_dict
%
get
(
n_refreq
,
"n_refreq"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
getitem
(
ecut_imfreq
,
"ecut_imfreq"
)
IERR
=
return_dict
%
getitem
(
ecut_imfreq
,
"ecut_imfreq"
)
IERR
=
return_dict
%
getitem
(
ecut_refreq
,
"ecut_refreq"
)
IERR
=
return_dict
%
getitem
(
ecut_refreq
,
"ecut_refreq"
)
IERR
=
return_dict
%
getitem
(
wfreq_eta
,
"wfreq_eta"
)
IERR
=
return_dict
%
getitem
(
wfreq_eta
,
"wfreq_eta"
)
IERR
=
return_dict
%
get
item
(
n_secant_maxiter
,
"n_secant_maxiter"
)
IERR
=
return_dict
%
get
(
n_secant_maxiter
,
"n_secant_maxiter"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
getitem
(
trev_secant
,
"trev_secant"
)
IERR
=
return_dict
%
getitem
(
trev_secant
,
"trev_secant"
)
IERR
=
return_dict
%
getitem
(
l_enable_lanczos
,
"l_enable_lanczos"
)
IERR
=
return_dict
%
getitem
(
l_enable_lanczos
,
"l_enable_lanczos"
)
IERR
=
return_dict
%
getitem
(
l_enable_gwetot
,
"l_enable_gwetot"
)
IERR
=
return_dict
%
getitem
(
l_enable_gwetot
,
"l_enable_gwetot"
)
...
@@ -277,7 +278,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -277,7 +278,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
IERR
=
tmp_list
%
getitem
(
ecut_spectralf
(
2
),
1
)
! Fortran indices start at 1
IERR
=
tmp_list
%
getitem
(
ecut_spectralf
(
2
),
1
)
! Fortran indices start at 1
CALL
tmp_list
%
destroy
CALL
tmp_list
%
destroy
CALL
tmp_obj
%
destroy
CALL
tmp_obj
%
destroy
IERR
=
return_dict
%
get
item
(
n_spectralf
,
"n_spectralf"
)
IERR
=
return_dict
%
get
(
n_spectralf
,
"n_spectralf"
,
DUMMY_DEFAULT
)
!
!
CALL
return_dict
%
destroy
CALL
return_dict
%
destroy
!
!
...
@@ -307,7 +308,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -307,7 +308,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
CALL
tmp_obj
%
destroy
CALL
tmp_obj
%
destroy
IERR
=
return_dict
%
getitem
(
cvalue
,
"westpp_format"
);
westpp_format
=
TRIM
(
ADJUSTL
(
cvalue
))
IERR
=
return_dict
%
getitem
(
cvalue
,
"westpp_format"
);
westpp_format
=
TRIM
(
ADJUSTL
(
cvalue
))
IERR
=
return_dict
%
getitem
(
westpp_sign
,
"westpp_sign"
)
IERR
=
return_dict
%
getitem
(
westpp_sign
,
"westpp_sign"
)
IERR
=
return_dict
%
get
item
(
westpp_n_pdep_eigen_to_use
,
"westpp_n_pdep_eigen_to_use"
)
IERR
=
return_dict
%
get
(
westpp_n_pdep_eigen_to_use
,
"westpp_n_pdep_eigen_to_use"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
getitem
(
tmp_obj
,
"westpp_r0"
)
IERR
=
return_dict
%
getitem
(
tmp_obj
,
"westpp_r0"
)
IERR
=
cast
(
tmp_list
,
tmp_obj
)
IERR
=
cast
(
tmp_list
,
tmp_obj
)
IERR
=
tmp_list
%
getitem
(
westpp_r0
(
1
),
0
)
! Fortran indices start at 1
IERR
=
tmp_list
%
getitem
(
westpp_r0
(
1
),
0
)
! Fortran indices start at 1
...
@@ -315,7 +316,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -315,7 +316,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
IERR
=
tmp_list
%
getitem
(
westpp_r0
(
3
),
2
)
! Fortran indices start at 1
IERR
=
tmp_list
%
getitem
(
westpp_r0
(
3
),
2
)
! Fortran indices start at 1
CALL
tmp_list
%
destroy
CALL
tmp_list
%
destroy
CALL
tmp_obj
%
destroy
CALL
tmp_obj
%
destroy
IERR
=
return_dict
%
get
item
(
westpp_nr
,
"westpp_nr"
)
IERR
=
return_dict
%
get
(
westpp_nr
,
"westpp_nr"
,
DUMMY_DEFAULT
)
IERR
=
return_dict
%
getitem
(
westpp_rmax
,
"westpp_rmax"
)
IERR
=
return_dict
%
getitem
(
westpp_rmax
,
"westpp_rmax"
)
IERR
=
return_dict
%
getitem
(
westpp_epsinfty
,
"westpp_epsinfty"
)
IERR
=
return_dict
%
getitem
(
westpp_epsinfty
,
"westpp_epsinfty"
)
!
!
...
@@ -393,6 +394,11 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -393,6 +394,11 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
IF
(
tr2_dfpt
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: tr2_dfpt<0.'
,
1
)
IF
(
tr2_dfpt
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: tr2_dfpt<0.'
,
1
)
IF
(
trev_pdep
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: trev_pdep<0.'
,
1
)
IF
(
trev_pdep
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: trev_pdep<0.'
,
1
)
IF
(
trev_pdep_rel
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: trev_pdep_rel<0.'
,
1
)
IF
(
trev_pdep_rel
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: trev_pdep_rel<0.'
,
1
)
IF
(
n_pdep_eigen
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_pdep_eigen'
)
IF
(
n_pdep_times
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_pdep_times'
)
IF
(
n_pdep_maxiter
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_pdep_maxiter'
)
IF
(
n_dfpt_maxiter
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_dfpt_maxiter'
)
IF
(
n_pdep_read_from_file
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_pdep_read_from_file'
)
IF
(
gamma_only
)
THEN
IF
(
gamma_only
)
THEN
IF
(
SIZE
(
qlist
)/
=
1
)
CALL
errore
(
'fetch_input'
,
'Err: SIZE(qlist)/=1.'
,
1
)
IF
(
SIZE
(
qlist
)/
=
1
)
CALL
errore
(
'fetch_input'
,
'Err: SIZE(qlist)/=1.'
,
1
)
ELSE
ELSE
...
@@ -438,6 +444,12 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -438,6 +444,12 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
IF
(
wfreq_eta
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: wfreq_eta<0.'
,
1
)
IF
(
wfreq_eta
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: wfreq_eta<0.'
,
1
)
IF
(
n_secant_maxiter
<
0
)
CALL
errore
(
'fetch_input'
,
'Err: n_secant_maxiter<0'
,
1
)
IF
(
n_secant_maxiter
<
0
)
CALL
errore
(
'fetch_input'
,
'Err: n_secant_maxiter<0'
,
1
)
IF
(
trev_secant
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: trev_secant<0.'
,
1
)
IF
(
trev_secant
<=
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: trev_secant<0.'
,
1
)
IF
(
n_pdep_eigen_to_use
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_pdep_eigen_to_use'
)
IF
(
n_lanczos
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_lanczos'
)
IF
(
n_imfreq
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_imfreq'
)
IF
(
n_refreq
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_refreq'
)
IF
(
n_secant_maxiter
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_secant_maxiter'
)
IF
(
n_spectralf
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read n_spectralf'
)
SELECT
CASE
(
macropol_calculation
)
SELECT
CASE
(
macropol_calculation
)
CASE
(
'N'
,
'n'
,
'C'
,
'c'
)
CASE
(
'N'
,
'n'
,
'C'
,
'c'
)
CASE
DEFAULT
CASE
DEFAULT
...
@@ -465,8 +477,10 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
...
@@ -465,8 +477,10 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
IF
(
westpp_range
(
2
)
<
westpp_range
(
1
)
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_range(2)<westpp_range(1)'
,
1
)
IF
(
westpp_range
(
2
)
<
westpp_range
(
1
)
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_range(2)<westpp_range(1)'
,
1
)
IF
(
westpp_nr
<
1
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_nr<1'
,
1
)
IF
(
westpp_nr
<
1
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_nr<1'
,
1
)
IF
(
westpp_n_pdep_eigen_to_use
<
1
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_n_pdep_eigen_to_use<1'
,
1
)
IF
(
westpp_n_pdep_eigen_to_use
<
1
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_n_pdep_eigen_to_use<1'
,
1
)
IF
(
westpp_rmax
<
0.d0
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_rmax<0'
,
1
)
IF
(
westpp_rmax
<
0._DP
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_rmax<0.'
,
1
)
IF
(
westpp_epsinfty
<
1.d0
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_epsinfty<1'
,
1
)
IF
(
westpp_epsinfty
<
1._DP
)
CALL
errore
(
'fetch_input'
,
'Err: westpp_epsinfty<1.'
,
1
)
IF
(
westpp_n_pdep_eigen_to_use
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read westpp_n_pdep_eigen_to_use'
)
IF
(
westpp_nr
==
DUMMY_DEFAULT
)
CALL
errore
(
'fetch_input'
,
'Err: cannot read westpp_nr'
)
!
!
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