Commit 5ddaee08 authored by Marco Govoni's avatar Marco Govoni
Browse files

Merge tag 'v4.1.0' of http://greatfire.uchicago.edu/west-devel/West

Version 4.1.0
parents 93b9b9e2 b75d3783
Pipeline #1550 passed with stages
in 13 minutes and 5 seconds
Change Log
==========
v4.1.0 (2019/10/18)
-------------------
- Improved usability of client/server mode with `server_control`
- Reduced execution time of wfreq (W) for solids
- Added build instructions for RCC-Midway and MacOSX
- Updated build instructions for ALCF-Theta
- Updated manual
v4.0.0 (2019/09/30)
-------------------
- Added client/server mode
- Added coupling to Qbox code (http://qbox-code.org)
- Added coupling to Qbox code (http://qboxcode.org)
- Added python3 interface
- Simplified the input format (now accepting both JSON and YAML formats)
- Expanded documentation
......
......@@ -20,7 +20,7 @@ MODULE west_version
!
SAVE
!
CHARACTER (LEN=6) :: west_version_number = '4.0.0'
CHARACTER (LEN=6) :: west_version_number = '4.1.0'
CHARACTER (LEN=512) :: west_git_revision = 'unknown'
CHARACTER (LEN=512) :: west_forpy_path = 'unset'
TYPE(list) :: paths
......
......@@ -125,6 +125,14 @@ MODULE wstat_center
CHARACTER(LEN=512) :: wstat_restart_dir
LOGICAL :: l_is_wstat_converged
!
END MODULE
!
MODULE server_center
SAVE
!
! INPUT for server_control
!
CHARACTER(LEN=:),ALLOCATABLE :: document
END MODULE
!
!
......@@ -252,6 +260,7 @@ MODULE westcom
USE scratch_area
USE westin
USE wstat_center
USE server_center
USE wfreq_center
USE westpp_center
USE wan_center
......
......@@ -25,5 +25,6 @@ MODULE distribution_center
TYPE(idistribute) :: ifr
TYPE(idistribute) :: rfr
TYPE(idistribute) :: aband
TYPE(idistribute) :: occband
!
END MODULE
......@@ -13,6 +13,7 @@
from time import sleep, perf_counter as pc
from os import path, remove
from abc import ABC, abstractmethod
import json
##############
# SUPERCLASS #
......@@ -20,11 +21,12 @@ from abc import ABC, abstractmethod
class ClientServer(ABC):
#
def __init__(self,client_lockfile,maxsec=21600,sleepsec=10):
def __init__(self,client_lockfile,maxsec=21600,sleepsec=10,document={}):
#
self.client_lockfile = client_lockfile
self.maxsec = maxsec
self.sleepsec = sleepsec
self.document = document
super().__init__()
#
@abstractmethod
......@@ -73,6 +75,21 @@ class QboxServer(ClientServer) :
#
def before_sleep(self):
#
command_suffix = ""
if "response" in self.document.keys() :
if self.document["response"] == "RPA" :
command_suffix += "-RPA "
if self.document["response"] == "IPA" :
command_suffix += "-IPA "
if "amplitude" in self.document.keys() :
command_suffix += f'-amplitude {self.document["amplitude"]} '
if "nitscf" in self.document.keys() :
command_suffix += f'{self.document["nitscf"]} '
else :
command_suffix += '100 '
if "nite" in self.document.keys() :
command_suffix += f'{self.document["nite"]}'
#
# Determine the name of the server file
#
client_image = self.client_lockfile.split(".")[1]
......@@ -87,13 +104,12 @@ class QboxServer(ClientServer) :
#
# Create the input file for the server
#
with open(self.server_inputfile,"w") as f:
f.write("load gs.xml\n")
f.write("set xc PBE\n")
f.write("set wf_dyn PSDA\n")
f.write("set scf_tol 1.e-8\n")
with open(self.server_inputfile,"w") as f:
if "script" in self.document.keys() :
for line in self.document["script"] :
f.write(line+"\n")
for pert in perturbation_list :
f.write(f"response -vext {pert} -IPA -amplitude 0 20\n")
f.write(f"response -vext {pert} "+command_suffix+"\n")
#
# Awake server, by removing its lockfile
#
......@@ -120,6 +136,7 @@ def sleep_and_wait(*args, **kwargs):
client_lockfile = args[0] # name of client lockfile
maxsec = 12 * 60 * 60 # 12 hours, Max sleep time (in s)
sleepsec = 1 # 1 second, Sleep interval (in s)
document = {}
#
# change defaults
#
......@@ -127,8 +144,10 @@ def sleep_and_wait(*args, **kwargs):
maxsec = kwargs["maxsec"]
if "sleepsec" in kwargs.keys() :
sleepsec = kwargs["sleepsec"]
if "document" in kwargs.keys() :
document = json.loads(kwargs["document"])
#
server = QboxServer(client_lockfile,maxsec,sleepsec)
server = QboxServer(client_lockfile,maxsec,sleepsec,document)
return_int = server.start()
#
return return_int
......@@ -139,8 +158,8 @@ def sleep_and_wait(*args, **kwargs):
def test() :
with open("I.1.lock","w") as f :
f.write(" ")
sleep_and_wait("I.1.lock",maxsec=60,sleepsec=2)
f.write("I.1_P.1.xml")
sleep_and_wait("I.1.lock",maxsec=60,sleepsec=2,document='{"response": "IPA", "amplitude": 0, "script" : ["set xc PBE"]}')
if __name__ == "__main__":
# execute only if run as a script
......
......@@ -73,6 +73,10 @@ default["westpp_control"]["westpp_r0"] = [0., 0., 0.]
default["westpp_control"]["westpp_nr"] = 100
default["westpp_control"]["westpp_rmax"] = 1.
default["westpp_control"]["westpp_epsinfty"] = 1.
# server_control
default["server_control"] = {}
default["server_control"]["document"] = "{}"
############################
# DYNAMICAL DEFAULT VALUES #
......@@ -124,6 +128,11 @@ def open_and_parse_file(fileName="west.in") :
except :
print("Cannot open file : ",fileName)
#
if "server_control" in data.keys() :
if "document" in data["server_control"].keys() :
jsonText = json.dumps(data["server_control"]["document"])
data["server_control"]["document"] = jsonText
#
return data
##############
......@@ -223,10 +232,9 @@ def read_keyword_from_file(*args, **kwargs):
# Read input file
#
input_data = open_and_parse_file(fileName)
parsed_data = {}
if keyword in input_data.keys() :
parsed_data = input_data[keyword]
else :
parsed_data = {}
#
# Compare defaults and input variables
#
......@@ -256,12 +264,15 @@ input_west :
wstat_control :
wstat_calculation : R # this is a comment
unknown_key : value # this line will be read but not passed
server_control :
document : {}
""")
#
read_keyword_from_file(fileName,"input_west",True)
read_keyword_from_file(fileName,"wstat_control",True,nq=20,nelec=10)
read_keyword_from_file(fileName,"wfreq_control",True,nelec=10,ecutrho=30.)
read_keyword_from_file(fileName,"westpp_control",True)
read_keyword_from_file(fileName,"server_control",True)
#
remove(fileName)
......
......@@ -96,6 +96,12 @@ SUBROUTINE add_intput_parameters_to_json_file( num_drivers, driver, json )
!
ENDIF
!
IF ( ANY(driver(:)==5) ) THEN
!
CALL json%add('input.server_control.document',TRIM(document))
!
ENDIF
!
ENDIF
!
END SUBROUTINE
......@@ -146,7 +152,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
CHARACTER(LEN=512), EXTERNAL :: trimcheck
CHARACTER(LEN=:),ALLOCATABLE :: cvalue
TYPE(json_file) :: json
INTEGER :: iunit
INTEGER :: iunit, lenc
!
CALL start_clock('fetch_input')
!
......@@ -317,8 +323,30 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
!
ENDIF
!
IF ( ANY(driver(:)==5) ) THEN
!
IERR = tuple_create(args, 3)
IERR = args%setitem(0, TRIM(ADJUSTL(main_input_file)) )
IERR = args%setitem(1, "server_control" )
IERR = args%setitem(2, verbose )
IERR = dict_create(kwargs)
!
IERR = call_py(return_obj, pymod, "read_keyword_from_file", args, kwargs)
IERR = cast(return_dict, return_obj)
!
CALL args%destroy
CALL kwargs%destroy
CALL return_obj%destroy
!
IERR = return_dict%getitem(cvalue, "document"); document = TRIM(ADJUSTL(cvalue))
!
CALL return_dict%destroy
!
ENDIF
!
CALL pymod%destroy
!
!
ENDIF
!
! BCAST & CHECKS
......@@ -442,6 +470,15 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
!
ENDIF
!
IF ( ANY(driver(:)==5) ) THEN
!
lenc = LEN(document)
CALL mp_bcast(lenc,root,world_comm)
IF(mpime/=root) ALLOCATE(CHARACTER(LEN=lenc) :: document)
CALL mp_bcast(document,root,world_comm)
!
ENDIF
!
CALL mp_barrier(world_comm)
!
! REPORT
......@@ -545,6 +582,19 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
!
ENDIF
!
IF ( ANY(driver(:)==5) ) THEN
!
! REPORT
!
CALL io_push_title('I/O Summary : server_control')
!
numsp=40
CALL io_push_value('document',document,numsp)
!
CALL io_push_bar()
!
ENDIF
!
ENDIF
!
IF ( verbose .AND. mpime == root ) THEN
......
......@@ -61,7 +61,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
USE noncollin_module, ONLY : noncolin,npol
USE buffers, ONLY : get_buffer
USE bar, ONLY : bar_type,start_bar_type,update_bar_type,stop_bar_type
USE distribution_center, ONLY : pert,macropert,ifr,rfr
USE distribution_center, ONLY : pert,macropert,ifr,rfr,occband
USE class_idistribute, ONLY : idistribute
USE wfreq_restart, ONLY : solvewfreq_restart_write,solvewfreq_restart_read,bks_type
USE types_bz_grid, ONLY : k_grid
......@@ -76,7 +76,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
! Workspace
!
INTEGER :: i1,i2,i3,im,ip,ig,glob_ip,ir,iv,iks,ipol,m
INTEGER :: i1,i2,i3,im,ip,ig,glob_ip,ir,iv,ivloc,iks,ipol,m
CHARACTER(LEN=25) :: filepot
CHARACTER(LEN=:),ALLOCATABLE :: fname
CHARACTER(LEN=6) :: my_label_b
......@@ -85,7 +85,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
REAL(DP),ALLOCATABLE :: diago( :, : ), subdiago( :, :), bnorm(:), braket(:, :, :)
COMPLEX(DP),ALLOCATABLE :: q_s( :, :, : )
COMPLEX(DP),ALLOCATABLE :: dvpsi(:,:)
COMPLEX(DP),ALLOCATABLE :: phi(:,:)
COMPLEX(DP),ALLOCATABLE :: phi(:,:), phis(:,:,:)
COMPLEX(DP),ALLOCATABLE :: phi_tmp(:,:)
COMPLEX(DP),ALLOCATABLE :: pertg(:),pertr(:)
COMPLEX(DP) :: zkonstant
......@@ -217,23 +217,24 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
bks%max_band = nbndval
bks%min_band = 1
!
ALLOCATE(dvpsi(npwx*npol,mypara%nlocx))
!
time_spent(1) = get_clock( 'wlanczos' )
!
! LOOP over band states
!
DO iv = 1, nbndval
IF(iks==bks%lastdone_ks .AND. iv <= bks%lastdone_band ) CYCLE
! Parallel macropol
IF(l_macropol) THEN
!
! MACROPOL CASE
! PHI
!
IF(l_macropol) THEN
CALL occband%init(nbndval,'i','occband',.FALSE.)
!
ALLOCATE(phis(npwx*npol,3,occband%nloc))
!
phis = 0._DP
!
ALLOCATE(phi(npwx*npol,3))
ALLOCATE(phi_tmp(npwx*npol,3))
!
DO ivloc = 1, occband%nloc
!
! PHI
iv = occband%l2g(ivloc)
!
ALLOCATE(phi(npwx*npol,3))
ALLOCATE(phi_tmp(npwx*npol,3))
CALL commutator_Hx_psi (iks, 1, 1, evc(1,iv), phi_tmp(1,1), l_skip_nl_part_of_hcomr)
CALL commutator_Hx_psi (iks, 1, 2, evc(1,iv), phi_tmp(1,2), l_skip_nl_part_of_hcomr)
CALL commutator_Hx_psi (iks, 1, 3, evc(1,iv), phi_tmp(1,3), l_skip_nl_part_of_hcomr)
......@@ -266,9 +267,40 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
WRITE(stdout, '(7X,"** WARNING : MACROPOL not converged, ierr = ",i8)') ierr
ENDIF
!
phis(:,:,ivloc) = phi(:,:)
!
DEALLOCATE( eprec )
DEALLOCATE( e )
DEALLOCATE( phi_tmp )
!
END DO
!
DEALLOCATE( phi, phi_tmp )
!
ENDIF ! macropol
!
ALLOCATE(dvpsi(npwx*npol,mypara%nlocx))
!
time_spent(1) = get_clock( 'wlanczos' )
!
! LOOP over band states
!
DO iv = 1, nbndval
IF(iks==bks%lastdone_ks .AND. iv <= bks%lastdone_band ) CYCLE
!
! MACROPOL CASE
!
IF(l_macropol) THEN
!
ALLOCATE(phi(npwx*npol,3))
phi = 0._DP
!
DO ivloc = 1, occband%nloc
IF( occband%l2g(ivloc) == iv ) THEN
phi(:,:) = phis(:,:,ivloc)
ENDIF
END DO
!
CALL mp_sum(phi, inter_image_comm)
!
ENDIF
!
......@@ -501,6 +533,8 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
!
ENDDO ! BANDS
!
IF(l_macropol) DEALLOCATE(phis)
!
DEALLOCATE(dvpsi)
!
ENDDO ! KPOINT-SPIN
......@@ -612,7 +646,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
USE noncollin_module, ONLY : noncolin,npol
USE buffers, ONLY : get_buffer
USE bar, ONLY : bar_type,start_bar_type,update_bar_type,stop_bar_type
USE distribution_center, ONLY : pert,macropert,ifr,rfr
USE distribution_center, ONLY : pert,macropert,ifr,rfr,occband
USE class_idistribute, ONLY : idistribute
USE wfreq_restart, ONLY : solvewfreq_restart_write,solvewfreq_restart_read,bksq_type
USE types_bz_grid, ONLY : k_grid, q_grid, compute_phase
......@@ -627,7 +661,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
! Workspace
!
INTEGER :: i1,i2,i3,im,ip,ig,glob_ip,ir,iv,iks,ik,is,iq,ikqs,ikq,ipol,m
INTEGER :: i1,i2,i3,im,ip,ig,glob_ip,ir,iv,ivloc,iks,ik,is,iq,ikqs,ikq,ipol,m
CHARACTER(LEN=25) :: filepot
CHARACTER(LEN=:),ALLOCATABLE :: fname
CHARACTER(LEN=6) :: my_label_b
......@@ -638,7 +672,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
COMPLEX(DP),ALLOCATABLE :: braket(:, :, :)
COMPLEX(DP),ALLOCATABLE :: q_s( :, :, : )
COMPLEX(DP),ALLOCATABLE :: dvpsi(:,:)
COMPLEX(DP),ALLOCATABLE :: phi(:,:)
COMPLEX(DP),ALLOCATABLE :: phi(:,:), phis(:,:,:)
COMPLEX(DP),ALLOCATABLE :: phi_tmp(:,:)
COMPLEX(DP),ALLOCATABLE :: pertg(:),pertr(:)
COMPLEX(DP),ALLOCATABLE :: evckpq(:,:)
......@@ -817,23 +851,25 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
bksq%max_band = nbndval
bksq%min_band = 1
!
ALLOCATE(dvpsi(npwx*npol,mypara%nlocx))
!
time_spent(1) = get_clock( 'wlanczos' )
!
! LOOP over band states
! MACROPOL CASE
!
DO iv = 1, nbndval
IF(iq==bksq%lastdone_q .AND. iks==bksq%lastdone_ks .AND. iv <= bksq%lastdone_band ) CYCLE
IF(l_macropol .AND. l_gammaq) THEN
!
! MACROPOL CASE
! PHI
!
IF(l_macropol .AND. l_gammaq) THEN
CALL occband%init(nbndval,'i','occband',.TRUE.)
!
ALLOCATE(phis(npwx*npol,3,occband%nloc))
!
phis = 0._DP
!
ALLOCATE(phi(npwx*npol,3))
ALLOCATE(phi_tmp(npwx*npol,3))
!
DO ivloc = 1, occband%nloc
!
! PHI
iv = occband%l2g(ivloc)
!
ALLOCATE(phi(npwx*npol,3))
ALLOCATE(phi_tmp(npwx*npol,3))
CALL commutator_Hx_psi (iks, 1, 1, evc(1,iv), phi_tmp(1,1), l_skip_nl_part_of_hcomr)
CALL commutator_Hx_psi (iks, 1, 2, evc(1,iv), phi_tmp(1,2), l_skip_nl_part_of_hcomr)
CALL commutator_Hx_psi (iks, 1, 3, evc(1,iv), phi_tmp(1,3), l_skip_nl_part_of_hcomr)
......@@ -866,10 +902,40 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
WRITE(stdout, '(7X,"** WARNING : MACROPOL not converged, ierr = ",i8)') ierr
ENDIF
!
phis(:,:,ivloc) = phi(:,:)
!
DEALLOCATE( eprec )
DEALLOCATE( e )
DEALLOCATE( phi_tmp )
!
END DO
!
DEALLOCATE( phi, phi_tmp )
!
ENDIF ! macropol
!
ALLOCATE(dvpsi(npwx*npol,mypara%nlocx))
!
time_spent(1) = get_clock( 'wlanczos' )
!
! LOOP over band states
!
DO iv = 1, nbndval
IF(iq==bksq%lastdone_q .AND. iks==bksq%lastdone_ks .AND. iv <= bksq%lastdone_band ) CYCLE
!
! MACROPOL CASE
!
IF(l_macropol .AND. l_gammaq) THEN
!
ALLOCATE(phi(npwx*npol,3))
phi = 0._DP
!
DO ivloc = 1, occband%nloc
IF( occband%l2g(ivloc) == iv ) THEN
phi(:,:) = phis(:,:,ivloc)
ENDIF
END DO
!
CALL mp_sum(phi, inter_image_comm)
!
ENDIF
!
......@@ -1124,6 +1190,8 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
!
ENDDO ! BANDS
!
IF(l_macropol .AND. l_gammaq) DEALLOCATE(phis)
!
DEALLOCATE(dvpsi)
!
ENDDO ! KPOINT-SPIN
......
......@@ -25,7 +25,7 @@ SUBROUTINE wfreq_setup
USE kinds, ONLY : DP
USE gvect, ONLY : gstart,g
USE io_files, ONLY : tmp_dir
USE distribution_center, ONLY : pert,macropert,ifr,rfr,aband
USE distribution_center, ONLY : pert,macropert,ifr,rfr,aband,occband
USE class_idistribute, ONLY : idistribute
USE wavefunctions_module, ONLY : evc
USE mod_mpiio, ONLY : set_io_comm
......@@ -64,6 +64,7 @@ SUBROUTINE wfreq_setup
CALL rfr%init(n_refreq,'z','n_refreq',.TRUE.)
aband = idistribute()
CALL aband%init(nbnd,'i','nbnd',.TRUE.)
occband = idistribute()
!
CALL set_freqlists( )
!
......
......@@ -95,7 +95,7 @@ SUBROUTINE calc_outsourced (m,dvg,dng,iq)
!
USE kinds, ONLY : DP
USE mp, ONLY : mp_barrier
USE westcom, ONLY : npwq,npwqx,fftdriver,igq_q
USE westcom, ONLY : npwq,npwqx,fftdriver,igq_q
USE mp_global, ONLY : intra_image_comm,inter_pool_comm,my_image_id,me_bgrp
USE fft_at_k, ONLY : single_fwfft_k,single_invfft_k
USE fft_at_gamma, ONLY : single_fwfft_gamma,single_invfft_gamma,double_fwfft_gamma,double_invfft_gamma
......@@ -210,6 +210,7 @@ END SUBROUTINE
SUBROUTINE sleep_and_wait_for_lock_to_be_removed(lockfile)
!
USE westcom, ONLY: document
USE forpy_mod, ONLY: call_py, call_py_noret, import_py, module_py
USE forpy_mod, ONLY: tuple, tuple_create
USE forpy_mod, ONLY: dict, dict_create
......@@ -233,6 +234,7 @@ SUBROUTINE sleep_and_wait_for_lock_to_be_removed(lockfile)
IERR = tuple_create(args, 1)
IERR = args%setitem(0, TRIM(ADJUSTL(lockfile)) )
IERR = dict_create(kwargs)
IERR = kwargs%setitem("document",document)
!
IERR = call_py(return_obj, pymod, "sleep_and_wait", args, kwargs)
!
......
......@@ -52,7 +52,7 @@ SUBROUTINE wstat_readin()
!
! READ other sections of the input file
!
CALL fetch_input_yml(1,(/2/),.TRUE.,.FALSE.)
CALL fetch_input_yml(2,(/2,5/),.TRUE.,.FALSE.)
!
CALL stop_clock('wstat_readin')
!
......
......@@ -64,7 +64,7 @@ author = u'Marco Govoni'
# built documents.
#
# The short X.Y version.
version = '4.0.0'
version = '4.1.0'
# The full version, including alpha/beta/rc tags.
release = version
......
......@@ -13,11 +13,11 @@ Configure QuantumEspresso by running the ``configure`` script that comes with th
$ git clone -b 'qe-6.1.0' --single-branch --depth 1 https://gitlab.com/QEF/q-e.git QEdir
$ cd QEdir
$ git clone -b 'v4.0.0' --single-branch --depth 1 http://greatfire.uchicago.edu/west-public/West.git West
$ git clone -b 'v4.1.0' --single-branch --depth 1 http://greatfire.uchicago.edu/west-public/West.git West
$ ./configure LD_LIBS="`python3-config --ldflags`"
.. note::
Note that since v4.0.0 WEST requires dynamic compilation and python3.
Note that since v4.0.0 WEST requires dynamic linking and python3.
It's now time to create the ``pw.x``, ``wstat.x``, ``wfreq.x``, and ``westpp.x`` executables by doing:
......@@ -49,3 +49,5 @@ Suggested configuration options
:maxdepth: 1
installations/theta.rst
installations/midway.rst
installations/macosx.rst