├── Doc ├── images │ └── logo.jpg ├── _static │ └── theme_overrides.css ├── Makefile ├── overview.rst ├── acknowledge.rst ├── index.rst ├── quickreference.rst ├── installations │ ├── macos.rst │ ├── dgx.rst │ ├── midway3.rst │ ├── midway2.rst │ ├── swing.rst │ ├── bebop.rst │ ├── leonardo.rst │ ├── cori.rst │ └── polaris.rst ├── tutorial.rst └── installation.rst ├── VERSION.json ├── Pytools ├── setup.py ├── Makefile ├── read_json.py ├── pyproject.toml ├── west_utils.py └── west_read_bse.py ├── test-suite ├── parameters.json ├── test019 │ ├── Makefile │ └── prepare_inputs.sh ├── test023 │ ├── Makefile │ └── prepare_inputs.sh ├── test024 │ ├── Makefile │ └── prepare_inputs.sh ├── test008 │ ├── Makefile │ ├── test_dipole.py │ ├── test_localization.py │ ├── test_wannier.py │ └── prepare_inputs.sh ├── test020 │ ├── Makefile │ └── prepare_inputs.sh ├── maketest.inc ├── test004 │ ├── Makefile │ └── prepare_inputs.sh ├── test001 │ ├── Makefile │ └── prepare_inputs.sh ├── test012 │ ├── Makefile │ └── prepare_inputs.sh ├── test002 │ ├── Makefile │ └── prepare_inputs.sh ├── test005 │ ├── Makefile │ └── prepare_inputs.sh ├── test007 │ ├── Makefile │ └── prepare_inputs.sh ├── test011 │ ├── Makefile │ └── prepare_inputs.sh ├── test006 │ ├── Makefile │ └── prepare_inputs.sh ├── test013 │ ├── Makefile │ └── prepare_inputs.sh ├── test015 │ ├── Makefile │ └── prepare_inputs.sh ├── test009 │ ├── Makefile │ └── prepare_inputs.sh ├── test027 │ ├── Makefile │ ├── test_exc_decomp.py │ └── prepare_inputs.sh ├── test010 │ ├── Makefile │ └── prepare_inputs.sh ├── test018 │ ├── Makefile │ └── prepare_inputs.sh ├── Makefile ├── test003 │ ├── Makefile │ └── prepare_inputs.sh ├── test014 │ ├── Makefile │ └── prepare_inputs.sh ├── test021 │ ├── Makefile │ └── prepare_inputs.sh ├── test025 │ ├── Makefile │ └── prepare_inputs.sh ├── test026 │ ├── Makefile │ └── prepare_inputs.sh ├── test022 │ ├── Makefile │ └── prepare_inputs.sh ├── test016 │ ├── Makefile │ └── prepare_inputs.sh ├── test017 │ ├── Makefile │ └── prepare_inputs.sh └── README.md ├── Libraries ├── Json-test │ ├── check.py │ ├── Makefile │ └── test.f90 ├── Forpy │ └── Makefile ├── Base64 │ ├── Makefile │ ├── cbase64.h │ └── base64module.f90 ├── Json │ ├── json_initialize_dummy_arguments.inc │ ├── Makefile │ ├── json_get_vec_by_path.inc │ ├── json_get_scalar_by_path.inc │ ├── json_get_vec_by_path_alloc.inc │ ├── json_macros.inc │ └── README └── Makefile ├── .gitignore ├── .github ├── ISSUE_TEMPLATE │ └── bug-report.md └── workflows │ ├── doc.yml │ ├── ci.yml │ └── nightly.yml ├── Coulomb_kernel ├── types_coulomb.f90 └── Makefile ├── Westpp ├── westpp_setup.f90 └── Makefile ├── Tools ├── clean_scratchfiles.f90 ├── exx_ungo.f90 ├── destroy_pw_arrays.f90 ├── Makefile ├── conversions.f90 ├── my_mkdir.f90 ├── get_alpha_pv.f90 ├── parse_command_arguments.f90 ├── set_dirs.f90 ├── set_eprec.f90 ├── west_readin.f90 └── human_readable_time.f90 ├── FFT_kernel └── Makefile ├── Para_kernel ├── Makefile └── distribution_center.f90 ├── Hamiltonian_kernel ├── Makefile ├── glbrak.f90 └── k_psi.f90 ├── DFPT_kernel ├── Makefile ├── precondition_m_wfcts.f90 └── apply_sternheimerop_to_m_wfcs.f90 ├── Wstat ├── wstat_setup.f90 ├── wstat.f90 └── Makefile ├── Modules ├── Makefile ├── update_west_version └── west_version.f90.in ├── IO_kernel └── Makefile ├── AUTHORS.md ├── Wbse ├── wbse_init.f90 ├── wbse.f90 ├── Makefile └── wbse_dot.f90 ├── README.md └── Wfreq ├── set_freqlists.f90 ├── Makefile └── wfreq.f90 /Doc/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/west-code-development/West/HEAD/Doc/images/logo.jpg -------------------------------------------------------------------------------- /VERSION.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "WEST", 3 | "version" : "6.2.1", 4 | "url" : "https://west-code.org", 5 | "license" : "GPLv3" 6 | } 7 | -------------------------------------------------------------------------------- /Pytools/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | import json 3 | 4 | with open("../VERSION.json", "r") as file: 5 | data = json.load(file) 6 | 7 | setup(version=data["version"]) 8 | -------------------------------------------------------------------------------- /test-suite/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "tolerance": { 3 | "total_energy": "1e-6", 4 | "pdep_eigenvalue": "1e-4", 5 | "singleparticle_energy": "1e-4", 6 | "westpp": "1e-6", 7 | "qdet": "1e-4", 8 | "bse": "1e-4", 9 | "forces": "1e-5" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Libraries/Json-test/check.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import json 3 | 4 | with open('input_file.json',"r") as file: 5 | idata = json.load(file) 6 | 7 | with open('output_file.json',"r") as file: 8 | odata = json.load(file) 9 | 10 | assert( idata == odata ) 11 | 12 | print("Test passed.") 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.x 3 | *.mod 4 | *.MOD 5 | *.save 6 | *.restart 7 | *.upf 8 | *.UPF 9 | *.dSYM 10 | *.a 11 | *.out 12 | *.swp 13 | Doc/_build/ 14 | Modules/west_version.f90 15 | west_make.inc 16 | make.depend 17 | __pycache__ 18 | Pytools/WEST.egg-info/ 19 | Pytools/dist/ 20 | Pytools/files.txt 21 | .ipynb_checkpoints/ 22 | tags 23 | .DS_Store 24 | -------------------------------------------------------------------------------- /Pytools/Makefile: -------------------------------------------------------------------------------- 1 | #PYT=python3 2 | 3 | include ../west_make.inc 4 | 5 | all: \ 6 | title \ 7 | install 8 | 9 | install: 10 | - ${PYT} -m pip install --user . 11 | 12 | clean: 13 | - rm -rf west.egg-info 14 | - rm -rf build 15 | - rm -rf dist 16 | - rm -f files.txt 17 | 18 | title : 19 | @echo 20 | @echo "##############" 21 | @echo "### Pytools ##" 22 | @echo "##############" 23 | @echo 24 | -------------------------------------------------------------------------------- /Pytools/read_json.py: -------------------------------------------------------------------------------- 1 | import json 2 | import sys 3 | import os.path 4 | 5 | 6 | def main(): 7 | fname = str(sys.argv[1]) 8 | key = str(sys.argv[2]) 9 | 10 | if os.path.isfile(fname): 11 | with open(fname, "r") as file: 12 | data = json.load(file) 13 | else: 14 | print("Cannot find FILE: ", fname) 15 | print(data[key]) 16 | 17 | 18 | if __name__ == "__main__": 19 | main() 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a problem of the code 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Description** 11 | A concise description of the problem. 12 | 13 | **Code version** 14 | - QE: 7.4.1 15 | - WEST: 6.2.1 16 | 17 | **How to reproduce** 18 | `mpirun -n 16 wstst.x -ni 4 -i wstat.in` 19 | 20 | **Input/output files** 21 | Attach input and output files if applicable. 22 | -------------------------------------------------------------------------------- /Libraries/Forpy/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Forpy 2 | 3 | include ../../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(MOD_FLAG). 7 | 8 | FORPY_OBJS = \ 9 | forpy_mod.o 10 | 11 | all : title libforpy.a 12 | 13 | libforpy.a : $(FORPY_OBJS) 14 | $(AR) $(ARFLAGS) $@ $? 15 | $(RANLIB) $@ 16 | 17 | clean : 18 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 19 | - /bin/rm -f libforpy.a 20 | 21 | title : 22 | @echo 23 | @echo "##############" 24 | @echo "### Forpy ####" 25 | @echo "##############" 26 | @echo 27 | -------------------------------------------------------------------------------- /Libraries/Base64/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Base64 2 | 3 | include ../../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(MOD_FLAG). 7 | 8 | BASE64_OBJS = \ 9 | cbase64.o \ 10 | base64module.o 11 | 12 | all : title libbase64.a 13 | 14 | libbase64.a : $(BASE64_OBJS) 15 | $(AR) $(ARFLAGS) $@ $? 16 | $(RANLIB) $@ 17 | 18 | clean : 19 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 20 | - /bin/rm -f libbase64.a 21 | 22 | title : 23 | @echo 24 | @echo "##############" 25 | @echo "### Base64 ###" 26 | @echo "##############" 27 | @echo 28 | -------------------------------------------------------------------------------- /Doc/_static/theme_overrides.css: -------------------------------------------------------------------------------- 1 | /* override table width restrictions */ 2 | @media screen and (min-width: 767px) { 3 | 4 | .wy-table-responsive table td { 5 | /* !important prevents the common CSS stylesheets from overriding 6 | this as on RTD they are loaded after this stylesheet */ 7 | white-space: normal !important; 8 | } 9 | 10 | .wy-table-responsive { 11 | overflow: visible !important; 12 | } 13 | 14 | } 15 | 16 | .wy-side-nav-search { 17 | background-color: #B80000; 18 | color: #fcfcfc; 19 | } 20 | 21 | .version { 22 | color:white !important; 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/doc.yml: -------------------------------------------------------------------------------- 1 | name: Doc 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | doc: 7 | runs-on: ubuntu-latest 8 | container: continuumio/miniconda3:latest 9 | 10 | steps: 11 | - uses: actions/checkout@v4 12 | - name: Init 13 | run: | 14 | apt-get update 15 | apt-get install -qq make 16 | apt-get install -qq pandoc 17 | pip install -q -U pip 18 | pip install -q -U nbsphinx 19 | pip install -q -U sphinx_rtd_theme 20 | pip install -q -U ipython 21 | pip install -q -U ipykernel 22 | - name: Doc 23 | run: | 24 | cd Doc 25 | make html 26 | -------------------------------------------------------------------------------- /Libraries/Json/json_initialize_dummy_arguments.inc: -------------------------------------------------------------------------------- 1 | ! The dummy argument list for the various `initialize` subroutines. 2 | ! 3 | ! See also: json_initialize_argument.inc 4 | 5 | verbose,& 6 | compact_reals,& 7 | print_signs,& 8 | real_format,& 9 | spaces_per_tab,& 10 | strict_type_checking,& 11 | trailing_spaces_significant,& 12 | case_sensitive_keys,& 13 | no_whitespace,& 14 | unescape_strings,& 15 | comment_char,& 16 | path_mode,& 17 | path_separator,& 18 | compress_vectors,& 19 | allow_duplicate_keys,& 20 | escape_solidus,& 21 | stop_on_error,& 22 | null_to_real_mode,& 23 | non_normal_mode,& 24 | use_quiet_nan, & 25 | strict_integer_type_checking, & 26 | allow_trailing_comma & -------------------------------------------------------------------------------- /Doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = west 8 | SOURCEDIR = ./ 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /Libraries/Json/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Json 2 | 3 | include ../../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(MOD_FLAG). 7 | 8 | JSON_OBJS = \ 9 | json_kinds.o \ 10 | json_parameters.o \ 11 | json_string_utilities.o \ 12 | json_value_module.o \ 13 | json_file_module.o \ 14 | json_module.o 15 | 16 | all : title libjson.a 17 | 18 | libjson.a : $(JSON_OBJS) 19 | $(AR) $(ARFLAGS) $@ $? 20 | $(RANLIB) $@ 21 | 22 | clean : 23 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 24 | - /bin/rm -f libjson.a 25 | 26 | title : 27 | @echo 28 | @echo "##############" 29 | @echo "### Json ####" 30 | @echo "##############" 31 | @echo 32 | 33 | include make.depend 34 | -------------------------------------------------------------------------------- /Coulomb_kernel/types_coulomb.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | MODULE types_coulomb 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE class_coulomb, ONLY : coulomb 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | TYPE(coulomb) :: pot3D 22 | ! 23 | END MODULE 24 | -------------------------------------------------------------------------------- /Libraries/Json-test/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Json-test 2 | 3 | include ../../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(MOD_FLAG)../Json \ 7 | $(MOD_FLAG). 8 | 9 | JSONTEST_OBJS = \ 10 | test.o 11 | 12 | JSON_OBJS = ../Json/libjson.a 13 | 14 | all : title test.x 15 | 16 | test.x : $(JSONTEST_OBJS) $(LIBOBJS) 17 | $(LD) $(LDFLAGS) -o test.x \ 18 | $(JSONTEST_OBJS) $(JSON_OBJS) $(LIBOBJS) $(LIBS) 19 | - ./test.x 20 | - python check.py 21 | 22 | clean : 23 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L *.json 24 | 25 | title : 26 | @echo 27 | @echo "##############" 28 | @echo "# JSON test ##" 29 | @echo "##############" 30 | @echo 31 | 32 | include make.depend 33 | -------------------------------------------------------------------------------- /test-suite/test019/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 19 | 20 | clean: 21 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 22 | 23 | title: 24 | @echo 25 | @echo "###############" 26 | @echo "### test019 ###" 27 | @echo "###############" 28 | @echo 29 | 30 | description: 31 | @echo 32 | @echo "Formaldehyde molecule gamma_only TDDFT (PBE) forces" 33 | @echo 34 | -------------------------------------------------------------------------------- /test-suite/test023/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 19 | 20 | clean: 21 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 22 | 23 | title: 24 | @echo 25 | @echo "###############" 26 | @echo "### test023 ###" 27 | @echo "###############" 28 | @echo 29 | 30 | description: 31 | @echo 32 | @echo "O2 molecule gamma_only spin-flip TDDFT (LDA) forces" 33 | @echo 34 | -------------------------------------------------------------------------------- /test-suite/test024/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 19 | 20 | clean: 21 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 22 | 23 | title: 24 | @echo 25 | @echo "###############" 26 | @echo "### test024 ###" 27 | @echo "###############" 28 | @echo 29 | 30 | description: 31 | @echo 32 | @echo "O2 molecule gamma_only spin-flip TDDFT (PBE) forces" 33 | @echo 34 | -------------------------------------------------------------------------------- /test-suite/test008/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw westpp 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | westpp: pw 18 | ${PARA_PREFIX} ${BINDIR}/westpp.x -nimage ${NIMAGE} -i westpp.in > westpp.out 2> westpp.err 19 | 20 | clean: 21 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 22 | 23 | title: 24 | @echo 25 | @echo "###############" 26 | @echo "### test008 ###" 27 | @echo "###############" 28 | @echo 29 | 30 | description: 31 | @echo 32 | @echo "MgO gamma_only localization factor, Wannier localization, dipole moment" 33 | @echo 34 | -------------------------------------------------------------------------------- /test-suite/test020/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 19 | 20 | clean: 21 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 22 | 23 | title: 24 | @echo 25 | @echo "###############" 26 | @echo "### test020 ###" 27 | @echo "###############" 28 | @echo 29 | 30 | description: 31 | @echo 32 | @echo "NV- diamond gamma_only spin-polarized TDDFT (PBE) forces" 33 | @echo 34 | -------------------------------------------------------------------------------- /Pytools/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [project] 6 | name = "WEST" 7 | authors = [ 8 | {name = "Marco Govoni", email = "mgovoni@unimore.it"}, 9 | ] 10 | description = "Python tools for WEST" 11 | requires-python = ">=3.6, <4" 12 | license = "GPL-3.0-only" 13 | dependencies = [ 14 | "numpy", 15 | "scipy", 16 | "matplotlib", 17 | "h5py", 18 | "pyyaml", 19 | "pytest", 20 | "datetime", 21 | "setuptools", 22 | "sphinx_rtd_theme", 23 | ] 24 | dynamic = ["version"] 25 | 26 | [project.urls] 27 | Homepage = "https://west-code.org/" 28 | Documentation = "https://west-code.org/doc/West/latest/" 29 | Repository = "https://github.com/west-code-development/West" 30 | 31 | [tool.setuptools.packages] 32 | find = {} 33 | -------------------------------------------------------------------------------- /test-suite/maketest.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Parallel execution knobs 3 | # 4 | 5 | export NP=8 # Number of MPI processes 6 | export NI=1 # Number of images 7 | export NK=1 # Number of pools 8 | export NB=1 # Number of band groups 9 | export NT=1 # Number of OpenMP threads 10 | 11 | # 12 | # Commands needed by the scripts 13 | # 14 | 15 | # Directory where the executables (*.x) are located 16 | export BINDIR=../../../bin 17 | 18 | # How to run West parallel executables with MPI 19 | export PARA_PREFIX=mpirun -np ${NP} 20 | 21 | # How to run QE parallel executables with MPI 22 | export PARA_PREFIX_QE=mpirun -np 2 23 | 24 | # How to download files 25 | export WGET=wget -N -q 26 | 27 | ###### DO NOT TOUCH BELOW ###### 28 | 29 | export NIMAGE=${NI} 30 | export NPOOL=${NK} 31 | export NBAND=${NB} 32 | export OMP_NUM_THREADS=${NT} 33 | 34 | -------------------------------------------------------------------------------- /Westpp/westpp_setup.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE westpp_setup 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE westcom, ONLY : westpp_save_dir 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | CALL do_setup() 22 | ! 23 | CALL set_npwq() 24 | ! 25 | CALL set_nbndocc() 26 | ! 27 | CALL my_mkdir(westpp_save_dir) 28 | ! 29 | END SUBROUTINE 30 | -------------------------------------------------------------------------------- /Tools/clean_scratchfiles.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE clean_scratchfiles() 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE buffers, ONLY : close_buffer 18 | USE mp_global, ONLY : my_image_id 19 | USE westcom, ONLY : iuwfc 20 | ! 21 | IMPLICIT NONE 22 | ! 23 | IF (my_image_id==0) THEN 24 | CALL close_buffer ( iuwfc, 'DELETE' ) 25 | ENDIF 26 | ! 27 | END SUBROUTINE 28 | -------------------------------------------------------------------------------- /FFT_kernel/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for FFT_kernel 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../Modules \ 8 | $(MOD_FLAG). 9 | 10 | FFT_KERNEL_OBJS = \ 11 | fft_at_gamma.o \ 12 | fft_at_k.o \ 13 | fft_interpolation.o 14 | 15 | TLDEPS = bindir mods pwlibs pw 16 | 17 | all : title tldeps lib_fft_kernel.a 18 | 19 | tldeps : 20 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 21 | 22 | lib_fft_kernel.a : $(FFT_KERNEL_OBJS) 23 | $(AR) $(ARFLAGS) $@ $? 24 | $(RANLIB) $@ 25 | 26 | clean : 27 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 28 | - /bin/rm -f lib_fft_kernel.a 29 | 30 | title : 31 | @echo 32 | @echo "###################" 33 | @echo "### FFT_kernel ####" 34 | @echo "###################" 35 | @echo 36 | 37 | include make.depend 38 | -------------------------------------------------------------------------------- /test-suite/test004/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test004 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "Si bulk kmesh 1x1x2 GW" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test001/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test001 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only GW" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test012/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test012 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only QDET" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test002/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test002 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "CH4 molecule gamma_only GW JSON input" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test005/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat westpp 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | westpp: wstat 21 | ${PARA_PREFIX} ${BINDIR}/westpp.x -nimage ${NIMAGE} -i westpp.in > westpp.out 2> westpp.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test005 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only output eigenpotential" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test007/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test007 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "Si bulk kmesh 1x1x2 GW hybrid ACE" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test011/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test011 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only GW qp_bands" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test006/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test006 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only GW hybrid ACE" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test013/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test013 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only QDET verbosity" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test015/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test015 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only GW hybrid no ACE" 36 | @echo 37 | -------------------------------------------------------------------------------- /Libraries/Json/json_get_vec_by_path.inc: -------------------------------------------------------------------------------- 1 | type(json_value),pointer :: p 2 | 3 | if ( json%exception_thrown ) then 4 | if (present(default)) vec = default 5 | call flag_not_found(found) 6 | return 7 | end if 8 | 9 | nullify(p) 10 | call json%get(me=me, path=path, p=p) 11 | 12 | if (.not. associated(p)) then 13 | call json%throw_exception('Error in '//routine//':'//& 14 | ' Unable to resolve path: '// trim(path),found) 15 | else 16 | call json%get(p,vec) 17 | end if 18 | 19 | if ( json%exception_thrown ) then 20 | if ( present(found) .or. present(default)) then 21 | call flag_not_found(found) 22 | if (present(default)) vec = default 23 | call json%clear_exceptions() 24 | end if 25 | else 26 | if ( present(found) ) found = .true. 27 | end if 28 | -------------------------------------------------------------------------------- /test-suite/test009/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test009 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "O2 molecule gamma_only GW fractional occupation" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test027/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse westpp 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 19 | 20 | westpp: wbse 21 | ${PARA_PREFIX} ${BINDIR}/westpp.x -nimage ${NIMAGE} -i westpp.in > westpp.out 2> westpp.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test027 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "Formaldehyde molecule gamma_only excited state decomposition" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test010/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test010 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only GW l_enable_off_diagonal" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test018/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse_init wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse_init: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse_init.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse_init.in > wbse_init.out 2> wbse_init.err 19 | 20 | wbse: wbse_init 21 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test018 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "SiH4 molecule gamma_only TDDFT (PBE0) Lanczos" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | ############### 4 | # Directories # Note that the directories to check are listed in main_test.py 5 | ############### 6 | 7 | testdirs:= test001 test002 test003 test004 test005 test006 test007 test008 test009 test010 test011 test012 test013 test014 test015 test016 test017 test018 test019 test020 test021 test022 test023 test024 test025 test026 test027 8 | 9 | default: all 10 | 11 | all: 12 | @echo 13 | @echo "#################" 14 | @echo "## RUNNING... ##" 15 | @echo "#################" 16 | @echo 17 | for d in $(testdirs); do cd $$d; $(MAKE); cd ..; done 18 | @echo 19 | @echo "#################" 20 | @echo "## CHECKING... ##" 21 | @echo "#################" 22 | @echo 23 | python3 -m pytest -v --capture=tee-sys --durations=0 24 | 25 | clean: 26 | for d in $(testdirs); do cd $$d; $(MAKE) clean; cd ..; done 27 | - /bin/rm -rf __pycache__ .pytest_cache > /dev/null 2>&1 28 | -------------------------------------------------------------------------------- /Coulomb_kernel/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Coulomb_kernel 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../Modules \ 8 | $(MOD_FLAG)../Tools \ 9 | $(MOD_FLAG). 10 | 11 | COULOMB_KERNEL_OBJS = \ 12 | class_coulomb.o \ 13 | types_coulomb.o 14 | 15 | TLDEPS = bindir mods pwlibs pw 16 | 17 | all : tldeps lib_coulomb_kernel.a 18 | 19 | tldeps : 20 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 21 | 22 | lib_coulomb_kernel.a : $(COULOMB_KERNEL_OBJS) 23 | $(AR) $(ARFLAGS) $@ $? 24 | $(RANLIB) $@ 25 | 26 | clean : 27 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 28 | - /bin/rm -f lib_coulomb_kernel.a 29 | 30 | title : 31 | @echo 32 | @echo "#######################" 33 | @echo "### Coulomb_kernel ####" 34 | @echo "#######################" 35 | @echo 36 | 37 | include make.depend 38 | -------------------------------------------------------------------------------- /Para_kernel/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Para_kernel 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../Tools \ 8 | $(MOD_FLAG). 9 | 10 | PARA_KERNEL_OBJS = \ 11 | class_idistribute.o \ 12 | distribution_center.o \ 13 | parallel_distributed_diago.o \ 14 | west_mp.o 15 | 16 | TLDEPS = bindir mods pwlibs pw 17 | 18 | all : title tldeps lib_para_kernel.a 19 | 20 | tldeps : 21 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 22 | 23 | lib_para_kernel.a : $(PARA_KERNEL_OBJS) 24 | $(AR) $(ARFLAGS) $@ $? 25 | $(RANLIB) $@ 26 | 27 | clean : 28 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 29 | - /bin/rm -f lib_para_kernel.a 30 | 31 | title : 32 | @echo 33 | @echo "####################" 34 | @echo "### Para_kernel ####" 35 | @echo "####################" 36 | @echo 37 | 38 | include make.depend 39 | -------------------------------------------------------------------------------- /test-suite/test003/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test003 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "CH4 molecule gamma_only spin-polarized GW" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test014/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wfreq 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wfreq: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wfreq.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wfreq.in > wfreq.out 2> wfreq.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test014 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "NV- diamond gamma_only spin-polarized QDET" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test021/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse_init wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse_init: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse_init.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse_init.in > wbse_init.out 2> wbse_init.err 19 | 20 | wbse: wbse_init 21 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test021 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "Formaldehyde molecule gamma_only TDDFT (PBE0) forces" 36 | @echo 37 | -------------------------------------------------------------------------------- /Doc/overview.rst: -------------------------------------------------------------------------------- 1 | .. _overview: 2 | 3 | Overview 4 | ======== 5 | 6 | **WEST** (Without Empty STates) is a massively parallel software for large scale electronic structure calculations within many-body perturbation theory. 7 | 8 | Features: 9 | 10 | - GW self-energy (full-frequency) [*GPU enabled*] 11 | - Absorption spectra and energies with TDDFT or BSE [*GPU enabled*] 12 | - Excited states forces with TDDFT [*GPU enabled*] 13 | - CI-in-DFT quantum defect embedding theory (QDET) [*GPU enabled*] 14 | - Electron-phonon *under development* 15 | 16 | WEST uses as starting point the charge density and Kohn-Sham orbitals obtained with hybrid or semilocal DFT. WEST uses the plane-wave pseudopotential method. 17 | 18 | .. seealso:: 19 | **WESTpy** is a Python package, designed to assist users of the WEST code in pre- and post-process massively parallel calculations. Click `here `_ to know more. 20 | -------------------------------------------------------------------------------- /test-suite/test025/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse_init wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse_init: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse_init.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wbse_init.in > wbse_init.out 2> wbse_init.err 19 | 20 | wbse: wbse_init 21 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test025 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "O2 molecule gamma_only spin-flip TDDFT (PBE0) forces" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test026/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse_init wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse_init: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse_init.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wbse_init.in > wbse_init.out 2> wbse_init.err 19 | 20 | wbse: wbse_init 21 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test026 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "O2 molecule gamma_only spin-flip TDDFT (HSE) forces" 36 | @echo 37 | -------------------------------------------------------------------------------- /test-suite/test022/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wbse_init wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wbse_init: pw 18 | ${PARA_PREFIX} ${BINDIR}/wbse_init.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wbse_init.in > wbse_init.out 2> wbse_init.err 19 | 20 | wbse: wbse_init 21 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -npool ${NPOOL} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 22 | 23 | clean: 24 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 25 | 26 | title: 27 | @echo 28 | @echo "###############" 29 | @echo "### test022 ###" 30 | @echo "###############" 31 | @echo 32 | 33 | description: 34 | @echo 35 | @echo "NV- diamond gamma_only spin-polarized TDDFT (DDH) forces" 36 | @echo 37 | -------------------------------------------------------------------------------- /Para_kernel/distribution_center.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | MODULE distribution_center 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE class_idistribute, ONLY : idistribute 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | TYPE(idistribute) :: pert 22 | TYPE(idistribute) :: macropert 23 | TYPE(idistribute) :: ifr 24 | TYPE(idistribute) :: rfr 25 | TYPE(idistribute) :: aband 26 | TYPE(idistribute) :: occband 27 | TYPE(idistribute) :: band_group 28 | TYPE(idistribute) :: kpt_pool 29 | TYPE(idistribute) :: bandpair 30 | ! 31 | END MODULE 32 | -------------------------------------------------------------------------------- /Libraries/Json/json_get_scalar_by_path.inc: -------------------------------------------------------------------------------- 1 | type(json_value),pointer :: p 2 | 3 | if (present(default)) then 4 | value = default 5 | else 6 | value = default_if_not_specified 7 | end if 8 | 9 | if ( json%exception_thrown ) then 10 | call flag_not_found(found) 11 | return 12 | end if 13 | 14 | nullify(p) 15 | call json%get(me=me, path=path, p=p) 16 | 17 | if (.not. associated(p)) then 18 | call json%throw_exception('Error in '//routine//':'//& 19 | ' Unable to resolve path: '// trim(path),found) 20 | else 21 | call json%get(p,value) 22 | end if 23 | 24 | if ( json%exception_thrown ) then 25 | if ( present(found) .or. present(default)) then 26 | call flag_not_found(found) 27 | if (present(default)) value = default 28 | call json%clear_exceptions() 29 | end if 30 | else 31 | if ( present(found) ) found = .true. 32 | end if 33 | -------------------------------------------------------------------------------- /test-suite/test016/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wbse_init wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wbse_init: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wbse_init.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse_init.in > wbse_init.out 2> wbse_init.err 22 | 23 | wbse: wbse_init 24 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 25 | 26 | clean: 27 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 28 | 29 | title: 30 | @echo 31 | @echo "###############" 32 | @echo "### test016 ###" 33 | @echo "###############" 34 | @echo 35 | 36 | description: 37 | @echo 38 | @echo "SiH4 molecule gamma_only BSE Lanczos" 39 | @echo 40 | -------------------------------------------------------------------------------- /test-suite/test017/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | include ../maketest.inc 4 | 5 | default: title description all 6 | 7 | all: prepare_inputs run 8 | 9 | prepare_inputs: 10 | bash prepare_inputs.sh 11 | 12 | run: pw wstat wbse_init wbse 13 | 14 | pw: 15 | ${PARA_PREFIX_QE} ${BINDIR}/pw.x -i pw.in > pw.out 2> pw.err 16 | 17 | wstat: pw 18 | ${PARA_PREFIX} ${BINDIR}/wstat.x -nimage ${NIMAGE} -nband ${NBAND} -i wstat.in > wstat.out 2> wstat.err 19 | 20 | wbse_init: wstat 21 | ${PARA_PREFIX} ${BINDIR}/wbse_init.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse_init.in > wbse_init.out 2> wbse_init.err 22 | 23 | wbse: wbse_init 24 | ${PARA_PREFIX} ${BINDIR}/wbse.x -nimage ${NIMAGE} -nband ${NBAND} -i wbse.in > wbse.out 2> wbse.err 25 | 26 | clean: 27 | - /bin/rm -rf *out *err *in *xml *upf *tab *restart *save *wfc* CRASH > /dev/null 2>&1 28 | 29 | title: 30 | @echo 31 | @echo "###############" 32 | @echo "### test017 ###" 33 | @echo "###############" 34 | @echo 35 | 36 | description: 37 | @echo 38 | @echo "SiH4 molecule gamma_only BSE Davidson" 39 | @echo 40 | -------------------------------------------------------------------------------- /Pytools/west_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # 4 | # Copyright (C) 2015-2025 M. Govoni 5 | # This file is distributed under the terms of the 6 | # GNU General Public License. See the file `License' 7 | # in the root directory of the present distribution, 8 | # or http://www.gnu.org/copyleft/gpl.txt . 9 | # 10 | # This file is part of WEST. 11 | # 12 | 13 | from os import mkdir 14 | import sys 15 | 16 | ############# 17 | # INTERFACE # 18 | ############# 19 | 20 | 21 | def my_mkdir(*args, **kwargs): 22 | # 23 | path = args[0] 24 | # 25 | try: 26 | mkdir(path) 27 | except OSError: 28 | # print (f"Creation of the directory {path} failed") 29 | pass 30 | else: 31 | # print (f"Successfully created the directory {path} ") 32 | pass 33 | sys.stdout.flush() 34 | 35 | 36 | ######## 37 | # TEST # 38 | ######## 39 | 40 | 41 | def test(): 42 | # 43 | dirname = "./wstat.save" 44 | # 45 | my_mkdir(dirname) 46 | 47 | 48 | if __name__ == "__main__": 49 | # execute only if run as a script 50 | test() 51 | -------------------------------------------------------------------------------- /Tools/exx_ungo.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE exx_ungo() 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE exx, ONLY : deallocate_exx 18 | USE xc_lib, ONLY : xclib_dft_is,stop_exx 19 | USE command_line_options, ONLY : command_line 20 | ! 21 | IMPLICIT NONE 22 | ! 23 | ! Workspace 24 | ! 25 | LOGICAL :: is_westpp 26 | LOGICAL, EXTERNAL :: matches 27 | ! 28 | is_westpp = matches('westpp.x',command_line) 29 | ! 30 | IF(xclib_dft_is('hybrid') .AND. .NOT. is_westpp) THEN 31 | CALL stop_exx 32 | CALL deallocate_exx 33 | ENDIF 34 | ! 35 | END SUBROUTINE 36 | -------------------------------------------------------------------------------- /test-suite/test008/test_dipole.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import json 3 | 4 | 5 | def read_dipole_from_json(fileName): 6 | """ 7 | Read transition dipole moments from JSON file. 8 | """ 9 | 10 | with open(fileName, "r") as f: 11 | raw_ = json.load(f) 12 | 13 | dip = {} 14 | for key in raw_["output"]["D"]["K000001"]["dipole"]: 15 | dip[key] = np.array(raw_["output"]["D"]["K000001"]["dipole"][key], dtype=float) 16 | 17 | return dip 18 | 19 | 20 | def test_dipole(): 21 | """ 22 | Test transition dipole moments. 23 | """ 24 | # get parameters from JSON file 25 | with open("./parameters.json", "r") as f: 26 | parameters = json.load(f) 27 | 28 | ref_dip = read_dipole_from_json("./test008/ref/westpp.json") 29 | test_dip = read_dipole_from_json("./test008/test.westpp.save/westpp.json") 30 | 31 | for key in ref_dip: 32 | np.testing.assert_almost_equal( 33 | np.abs(ref_dip[key]), 34 | np.abs(test_dip[key]), 35 | decimal=-np.log10(float(parameters["tolerance"]["westpp"])), 36 | ) 37 | -------------------------------------------------------------------------------- /Hamiltonian_kernel/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Hamiltonian_kernel 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../../PW/src \ 8 | $(MOD_FLAG)../Modules \ 9 | $(MOD_FLAG). 10 | 11 | HAMILTONIAN_KERNEL_OBJS = \ 12 | apply_alpha_pa_to_m_wfcs.o \ 13 | apply_alpha_pc_to_m_wfcs.o \ 14 | apply_alpha_pv_to_m_wfcs.o \ 15 | apply_hqp_to_m_wfcs.o \ 16 | commut_Hx_psi.o \ 17 | glbrak.o \ 18 | k_psi.o 19 | 20 | TLDEPS = bindir mods pwlibs pw 21 | 22 | all : title tldeps lib_hamiltonian_kernel.a 23 | 24 | tldeps : 25 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 26 | 27 | lib_hamiltonian_kernel.a : $(HAMILTONIAN_KERNEL_OBJS) 28 | $(AR) $(ARFLAGS) $@ $? 29 | $(RANLIB) $@ 30 | 31 | clean : 32 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 33 | - /bin/rm -f lib_hamiltonian_kernel.a 34 | 35 | title : 36 | @echo 37 | @echo "###########################" 38 | @echo "### Hamiltonian_kernel ####" 39 | @echo "###########################" 40 | @echo 41 | 42 | include make.depend 43 | -------------------------------------------------------------------------------- /DFPT_kernel/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for DFPT_kernel 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../../PW/src \ 8 | $(MOD_FLAG)../FFT_kernel \ 9 | $(MOD_FLAG)../Modules \ 10 | $(MOD_FLAG)../Para_kernel \ 11 | $(MOD_FLAG)../Tools \ 12 | $(MOD_FLAG). 13 | 14 | DFPT_KERNEL_OBJS = \ 15 | apply_sternheimerop_to_m_wfcs.o \ 16 | dfpt_module.o \ 17 | linsolve_commut_Hx.o \ 18 | linsolve_sternheimer_m_wfcts.o \ 19 | precondition_m_wfcts.o 20 | 21 | TLDEPS = bindir mods pwlibs pw 22 | 23 | all : title tldeps lib_dfpt_kernel.a 24 | 25 | tldeps : 26 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 27 | 28 | lib_dfpt_kernel.a : $(DFPT_KERNEL_OBJS) 29 | $(AR) $(ARFLAGS) $@ $? 30 | $(RANLIB) $@ 31 | 32 | clean : 33 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 34 | - /bin/rm -f lib_dfpt_kernel.a 35 | 36 | title : 37 | @echo 38 | @echo "####################" 39 | @echo "### DFPT_kernel ####" 40 | @echo "####################" 41 | @echo 42 | 43 | include make.depend 44 | -------------------------------------------------------------------------------- /Wstat/wstat_setup.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE wstat_setup 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE westcom, ONLY : alphapv_dfpt,n_pdep_basis,n_pdep_eigen,& 18 | & n_pdep_times,wstat_save_dir 19 | USE kinds, ONLY : DP 20 | ! 21 | IMPLICIT NONE 22 | ! 23 | COMPLEX(DP), EXTERNAL :: get_alpha_pv 24 | ! 25 | CALL do_setup() 26 | ! 27 | ! Calculate ALPHA_PV 28 | ! 29 | alphapv_dfpt = get_alpha_pv() 30 | ! 31 | CALL set_npwq() 32 | ! 33 | CALL set_nbndocc() 34 | ! 35 | CALL my_mkdir(wstat_save_dir) 36 | ! 37 | n_pdep_basis = n_pdep_eigen * n_pdep_times 38 | ! 39 | END SUBROUTINE 40 | -------------------------------------------------------------------------------- /Modules/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Modules 2 | 3 | include ../west_make.inc 4 | include ../../make.inc 5 | 6 | # location of needed modules 7 | MODFLAGS = $(MOD_FLAG)../../Modules \ 8 | $(MOD_FLAG)../../FFTXlib/src \ 9 | $(MOD_FLAG)../../PW/src \ 10 | $(MOD_FLAG)../../UtilXlib \ 11 | $(MOD_FLAG)../../upflib \ 12 | $(MOD_FLAG)../Libraries/Forpy \ 13 | $(MOD_FLAG). 14 | 15 | MODULES_OBJS = \ 16 | west_gpu.o \ 17 | west_version.o \ 18 | westcom.o 19 | 20 | TLDEPS = bindir mods pwlibs pw 21 | 22 | all : title tldeps update libmodules.a 23 | 24 | tldeps : 25 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 26 | 27 | update : 28 | ./update_west_version ${WESTDIR} `${PYT} ../Pytools/read_json.py ../VERSION.json version` 29 | 30 | libmodules.a : $(MODULES_OBJS) 31 | $(AR) $(ARFLAGS) $@ $? 32 | $(RANLIB) $@ 33 | 34 | clean : 35 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 36 | - /bin/rm -f libmodules.a 37 | - /bin/rm -f west_version.f90 38 | 39 | title : 40 | @echo 41 | @echo "################" 42 | @echo "### Modules ####" 43 | @echo "################" 44 | @echo 45 | 46 | include make.depend 47 | -------------------------------------------------------------------------------- /Tools/destroy_pw_arrays.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE destroy_pw_arrays( ) 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE mp_global, ONLY : my_image_id 18 | USE buffers, ONLY : close_buffer 19 | USE control_flags, ONLY : gamma_only 20 | USE xc_lib, ONLY : xclib_dft_is 21 | USE klist, ONLY : nks 22 | USE westcom, ONLY : iuwfc 23 | ! 24 | IMPLICIT NONE 25 | ! 26 | CALL start_clock('des_pw_ar') 27 | ! 28 | IF(my_image_id == 0) THEN 29 | IF(.NOT. (gamma_only .AND. nks == 1 .AND. .NOT. xclib_dft_is('hybrid'))) THEN 30 | CALL close_buffer(iuwfc,'DELETE') 31 | ENDIF 32 | ENDIF 33 | ! 34 | CALL stop_clock('des_pw_ar') 35 | ! 36 | END SUBROUTINE 37 | -------------------------------------------------------------------------------- /test-suite/test027/test_exc_decomp.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import json 3 | 4 | 5 | def read_proj_matrix_from_json(fileName): 6 | """ 7 | Read projection matrix from JSON file. 8 | """ 9 | 10 | with open(fileName, "r") as f: 11 | raw_ = json.load(f) 12 | 13 | proj = {} 14 | nexc = raw_["input"]["westpp_control"]["westpp_n_liouville_to_use"] 15 | 16 | for iexc in range(nexc): 17 | label = f"E{(iexc+1):06d}" 18 | proj[label] = np.array( 19 | raw_["output"][label]["K000001"]["projection"]["vals"], dtype=float 20 | ) 21 | 22 | return proj 23 | 24 | 25 | def test_proj_matrix(): 26 | """ 27 | Test projection matrix. 28 | """ 29 | # get parameters from JSON file 30 | with open("./parameters.json", "r") as f: 31 | parameters = json.load(f) 32 | 33 | ref_proj = read_proj_matrix_from_json("./test027/ref/westpp.json") 34 | test_proj = read_proj_matrix_from_json("./test027/test.westpp.save/westpp.json") 35 | 36 | for iexc in ref_proj: 37 | np.testing.assert_almost_equal( 38 | np.abs(ref_proj[iexc]), 39 | np.abs(test_proj[iexc]), 40 | decimal=-np.log10(float(parameters["tolerance"]["westpp"])), 41 | ) 42 | -------------------------------------------------------------------------------- /IO_kernel/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for IO_kernel 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../../PW/src \ 8 | $(MOD_FLAG)../FFT_kernel \ 9 | $(MOD_FLAG)../Libraries/Base64 \ 10 | $(MOD_FLAG)../Libraries/Forpy \ 11 | $(MOD_FLAG)../Libraries/Json \ 12 | $(MOD_FLAG)../Modules \ 13 | $(MOD_FLAG)../Para_kernel \ 14 | $(MOD_FLAG)../Tools \ 15 | $(MOD_FLAG). 16 | 17 | IO_KERNEL_OBJS = \ 18 | cubefile.o \ 19 | function3d.o \ 20 | mod_west_io.o \ 21 | pdep_db.o \ 22 | pdep_io.o \ 23 | plep_db.o \ 24 | plep_io.o \ 25 | qbox_interface.o \ 26 | wbse_io.o \ 27 | wfreq_db.o \ 28 | wfreq_io.o 29 | 30 | TLDEPS = bindir mods pwlibs pw 31 | 32 | all : title tldeps lib_io_kernel.a 33 | 34 | tldeps : 35 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 36 | 37 | lib_io_kernel.a : $(IO_KERNEL_OBJS) 38 | $(AR) $(ARFLAGS) $@ $? 39 | $(RANLIB) $@ 40 | 41 | clean : 42 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 43 | - /bin/rm -f lib_io_kernel.a 44 | 45 | title : 46 | @echo 47 | @echo "##################" 48 | @echo "### IO_kernel ####" 49 | @echo "##################" 50 | @echo 51 | 52 | include make.depend 53 | -------------------------------------------------------------------------------- /Modules/update_west_version: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | westdir_=$1 4 | echo "WESTDIR = " $westdir_ 5 | 6 | west_version_number_=$2 7 | echo "WEST_VERSION_NUMBER = " $west_version_number_ 8 | 9 | # check if svn info available (do not write anything) 10 | git remote -v 2> /dev/null > /dev/null 11 | 12 | if [ $? = 0 ] ; then 13 | # svn info available: get svn revision 14 | git_rev=$(git describe) 15 | else 16 | # svn info available: revert to no info 17 | git_rev=unknown 18 | fi 19 | echo "GITREV = " $git_rev 20 | 21 | # write svn into file version_tmp.f90 22 | cat west_version.f90.in | sed "s,checkit,${west_version_number_},;s/unknown/$git_rev/;s&unset&${westdir_}&" > west_version.f90.tmp 23 | 24 | # check if a previous version.f90 file exists 25 | if test -f west_version.f90 ; then 26 | 27 | # version.f90 existing: check if new and previous files differ 28 | diff -wib west_version.f90.tmp west_version.f90 2> /dev/null > /dev/null 29 | 30 | if [ $? = 1 ] ; then 31 | # they differ: update file version.f90 32 | mv west_version.f90.tmp west_version.f90 33 | else 34 | # do not update if files are the same (prevents useless recompilation) 35 | rm west_version.f90.tmp 36 | fi 37 | else 38 | 39 | # file version.f90 not existing: create one 40 | mv west_version.f90.tmp west_version.f90 41 | 42 | fi 43 | -------------------------------------------------------------------------------- /Doc/acknowledge.rst: -------------------------------------------------------------------------------- 1 | .. _acknowledge: 2 | 3 | Credits 4 | ======= 5 | 6 | The development of **WEST** is funded by `MICCoM `_, as part of the CMS Program funded by the U.S. DOE-BES. 7 | 8 | 9 | Project Leads 10 | ------------- 11 | 12 | - Marco Govoni (University of Modena and Reggio Emilia, Argonne National Lab, University of Chicago) 13 | - Giulia Galli (University of Chicago and Argonne National Lab) 14 | 15 | Developers 16 | ---------- 17 | 18 | - Marco Govoni (University of Modena and Reggio Emilia, Argonne National Lab, University of Chicago) 19 | - Yu Jin (University of Chicago) 20 | - Victor Yu (Argonne National Lab) 21 | 22 | Contributors 23 | ------------ 24 | 25 | - Francois Gygi (University of California, Davis) 26 | - Ikutaro Hamada (Osaka University) 27 | - Yuan Ping (University of Wisconsin, Madison) 28 | - Jonathan Skone (Lawrence Berkeley National Lab) 29 | 30 | Former Developers 31 | ----------------- 32 | 33 | - Nicholas Brawand (2016-2018) 34 | - Sijia Dong (2019-2020) 35 | - Matteo Gerosa (2017-2018) 36 | - Lan Huang (2019-2020) 37 | - He Ma (2017-2020) 38 | - Ryan McAvoy (2017-2018) 39 | - Ngoc Linh Nguyen (2017-2018) 40 | - Peter Scherpelz (2016-2018) 41 | - Nan Sheng (2020-2022) 42 | - Christian Vorwerk (2021-2022) 43 | - Han Yang (2017-2022) 44 | - Huihuo Zheng (2016-2018) 45 | -------------------------------------------------------------------------------- /test-suite/test024/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 4 | 5 | cat > pw.in << EOF 6 | &control 7 | calculation = 'scf' 8 | restart_mode = 'from_scratch' 9 | pseudo_dir = './' 10 | outdir = './' 11 | prefix = 'test' 12 | / 13 | &system 14 | ibrav = 1 15 | celldm(1) = 20 16 | nat = 2 17 | ntyp = 1 18 | nspin = 2 19 | ecutwfc = 25 20 | nbnd = 16 21 | tot_magnetization = 2. 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | O 16.00 O_ONCV_PBE-1.2.upf 28 | ATOMIC_POSITIONS crystal 29 | O 0.460000000 0.500000000 0.500000000 30 | O 0.540000000 0.500000000 0.500000000 31 | K_POINTS gamma 32 | EOF 33 | 34 | 35 | cat > wbse.in << EOF 36 | input_west: 37 | qe_prefix: test 38 | west_prefix: test 39 | outdir: ./ 40 | 41 | wbse_init_control: 42 | wbse_init_calculation: S 43 | solver: TDDFT 44 | 45 | wbse_control: 46 | wbse_calculation: D 47 | n_liouville_eigen: 4 48 | n_liouville_times: 10 49 | trev_liouville: 0.00000001 50 | trev_liouville_rel: 0.000001 51 | l_pre_shift: True 52 | l_spin_flip: True 53 | l_spin_flip_kernel: True 54 | l_spin_flip_alda0: False 55 | l_forces: True 56 | forces_state: 4 57 | EOF 58 | -------------------------------------------------------------------------------- /test-suite/test004/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 4 | 5 | cat > pw.in << EOF 6 | &control 7 | calculation = 'scf' 8 | restart_mode = 'from_scratch' 9 | pseudo_dir = './' 10 | outdir = './' 11 | prefix = 'test' 12 | / 13 | &system 14 | ibrav = 2 15 | a = 5.43 16 | nat = 2 17 | ntyp = 1 18 | ecutwfc = 25 19 | nbnd = 10 20 | noinv = .true. 21 | nosym = .true. 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | conv_thr = 1.e-12 26 | / 27 | ATOMIC_SPECIES 28 | Si 28.085 Si_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS crystal 30 | Si 0.0000 0.0000 0.0000 31 | Si 0.2500 0.2500 0.2500 32 | K_POINTS automatic 33 | 1 1 2 0 0 0 34 | EOF 35 | 36 | 37 | cat > wstat.in << EOF 38 | input_west: 39 | qe_prefix: test 40 | west_prefix: test 41 | outdir: ./ 42 | 43 | wstat_control: 44 | wstat_calculation: S 45 | n_pdep_eigen: 10 46 | EOF 47 | 48 | 49 | cat > wfreq.in << EOF 50 | input_west: 51 | qe_prefix: test 52 | west_prefix: test 53 | outdir: ./ 54 | 55 | wstat_control: 56 | wstat_calculation: S 57 | n_pdep_eigen: 10 58 | 59 | wfreq_control: 60 | wfreq_calculation: XWGQ 61 | n_pdep_eigen_to_use: 10 62 | qp_bandrange: [2,6] 63 | n_refreq: 300 64 | ecut_refreq: 2.0 65 | macropol_calculation: C 66 | EOF 67 | -------------------------------------------------------------------------------- /test-suite/test023/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 4 | 5 | cat > pw.in << EOF 6 | &control 7 | calculation = 'scf' 8 | restart_mode = 'from_scratch' 9 | pseudo_dir = './' 10 | outdir = './' 11 | prefix = 'test' 12 | / 13 | &system 14 | ibrav = 1 15 | celldm(1) = 20 16 | nat = 2 17 | ntyp = 1 18 | nspin = 2 19 | ecutwfc = 25 20 | nbnd = 16 21 | tot_magnetization = 2. 22 | input_dft = 'LDA' 23 | / 24 | &electrons 25 | diago_full_acc = .true. 26 | / 27 | ATOMIC_SPECIES 28 | O 16.00 O_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS crystal 30 | O 0.460000000 0.500000000 0.500000000 31 | O 0.540000000 0.500000000 0.500000000 32 | K_POINTS gamma 33 | EOF 34 | 35 | 36 | cat > wbse.in << EOF 37 | input_west: 38 | qe_prefix: test 39 | west_prefix: test 40 | outdir: ./ 41 | 42 | wbse_init_control: 43 | wbse_init_calculation: S 44 | solver: TDDFT 45 | 46 | wbse_control: 47 | wbse_calculation: D 48 | n_liouville_eigen: 4 49 | n_liouville_times: 10 50 | trev_liouville: 0.00000001 51 | trev_liouville_rel: 0.000001 52 | l_pre_shift: True 53 | l_spin_flip: True 54 | l_spin_flip_kernel: True 55 | l_spin_flip_alda0: False 56 | l_forces: True 57 | forces_state: 4 58 | EOF 59 | -------------------------------------------------------------------------------- /Libraries/Json-test/test.f90: -------------------------------------------------------------------------------- 1 | PROGRAM test 2 | 3 | USE json_module, ONLY : json_file 4 | 5 | INTEGER, PARAMETER :: DP = selected_real_kind(14,200) 6 | 7 | TYPE(json_file) :: json 8 | INTEGER :: i 9 | INTEGER :: iiarg, nargs 10 | INTEGER :: numsp 11 | LOGICAL :: found 12 | CHARACTER(LEN=512) :: input_file 13 | CHARACTER(LEN=:),ALLOCATABLE :: cval 14 | REAL(DP) :: rval 15 | INTEGER :: ival 16 | INTEGER,ALLOCATABLE :: ivec(:) 17 | REAL(DP),ALLOCATABLE :: rvec(:) 18 | LOGICAL :: lval 19 | ! 20 | INTEGER :: iunit 21 | INTEGER :: i0, i0_ 22 | ! 23 | CHARACTER(LEN=512),PARAMETER :: ifile="input_file.json" 24 | CHARACTER(LEN=512),PARAMETER :: ofile="output_file.json" 25 | ! 26 | ! INIT INPUT FILE 27 | ! 28 | OPEN( NEWUNIT=iunit, FILE=TRIM(ifile) ) 29 | WRITE( iunit, * ) '{ "test" : { "i0" : 100} }' 30 | CLOSE( iunit ) 31 | ! 32 | ! INIT OUTPUT FILE 33 | ! 34 | OPEN( NEWUNIT=iunit, FILE=TRIM(ofile) ) 35 | WRITE( iunit, * ) '{}' 36 | CLOSE( iunit ) 37 | ! 38 | ! READ 39 | ! 40 | CALL json%initialize() 41 | CALL json%load_file(filename = TRIM(ifile)) 42 | CALL json%get('test.i0', i0, found) 43 | i0_ = 0 44 | IF( found ) i0_ = i0 45 | CALL json%destroy() 46 | ! 47 | ! WRITE 48 | ! 49 | CALL json%initialize() 50 | CALL json%load_file(filename = TRIM(ofile)) 51 | CALL json%add('test.i0', i0_) 52 | ! 53 | OPEN( NEWUNIT=iunit, FILE=TRIM(ofile) ) 54 | CALL json%print_file( iunit ) 55 | CLOSE( iunit ) 56 | CALL json%destroy() 57 | 58 | END PROGRAM 59 | -------------------------------------------------------------------------------- /test-suite/test009/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 4 | 5 | cat > pw.in << EOF 6 | &control 7 | calculation = 'scf' 8 | restart_mode = 'from_scratch' 9 | pseudo_dir = './' 10 | outdir = './' 11 | prefix = 'test' 12 | / 13 | &system 14 | ibrav = 1 15 | celldm(1) = 20 16 | nat = 2 17 | ntyp = 1 18 | ecutwfc = 25 19 | nbnd = 12 20 | assume_isolated = 'mp' 21 | occupations = 'from_input' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | O 15.9994 O_ONCV_PBE-1.2.upf 28 | ATOMIC_POSITIONS angstrom 29 | O 6.25001033 6.25001033 5.64063432 30 | O 6.25001033 6.25001033 6.84863432 31 | K_POINTS gamma 32 | OCCUPATIONS 33 | 2 2 2 2 2 1 1 0 0 0 34 | 0 0 35 | EOF 36 | 37 | 38 | cat > wstat.in << EOF 39 | input_west: 40 | qe_prefix: test 41 | west_prefix: test 42 | outdir: ./ 43 | 44 | wstat_control: 45 | wstat_calculation: S 46 | n_pdep_eigen: 50 47 | EOF 48 | 49 | 50 | cat > wfreq.in << EOF 51 | input_west: 52 | qe_prefix: test 53 | west_prefix: test 54 | outdir: ./ 55 | 56 | wstat_control: 57 | wstat_calculation: S 58 | n_pdep_eigen: 50 59 | 60 | wfreq_control: 61 | wfreq_calculation: XWGQ 62 | macropol_calculation: N 63 | n_pdep_eigen_to_use: 50 64 | qp_bandrange: [1,7] 65 | n_refreq: 300 66 | ecut_refreq: 2.0 67 | EOF 68 | -------------------------------------------------------------------------------- /Doc/index.rst: -------------------------------------------------------------------------------- 1 | .. west documentation master file 2 | You can adapt this file completely to your liking, but it should at least 3 | contain the root `toctree` directive. 4 | 5 | Welcome to West's documentation! 6 | ================================== 7 | 8 | .. .. important:: 9 | 10 | This is documentation for the **WEST** *code*, which is part of the WEST_ framework. 11 | 12 | .. _WEST: https://west-code.org 13 | 14 | Contents 15 | -------- 16 | 17 | .. toctree:: 18 | :hidden: 19 | :maxdepth: 2 20 | 21 | overview 22 | installation 23 | tutorial 24 | quickreference 25 | manual 26 | acknowledge 27 | 28 | .. glossary:: 29 | 30 | :ref:`overview` 31 | An illustration of **WEST**. 32 | 33 | :ref:`installation` 34 | Instructions on how to install **WEST**. 35 | 36 | :ref:`tutorial` 37 | Compact demonstration of usage of **WEST**. 38 | 39 | :ref:`quickreference` 40 | Quick reference for **WEST** input file examples. 41 | 42 | :ref:`manual` 43 | The complete reference. 44 | 45 | :ref:`acknowledge` 46 | Instructions on how to acknowledge this software in publications. 47 | 48 | .. note:: 49 | 50 | To get help using the **WEST** package, send an email to `mgovoni@unimore.it `_. 51 | 52 | The **WEST** package is hosted on `GitHub `_ and licensed under the open-source GPLv3 license. 53 | 54 | -------------------------------------------------------------------------------- /Libraries/Json/json_get_vec_by_path_alloc.inc: -------------------------------------------------------------------------------- 1 | type(json_value),pointer :: p 2 | 3 | if ( json%exception_thrown ) then 4 | if (present(default)) then 5 | vec = default 6 | if (present(default_ilen)) then 7 | ilen = default_ilen 8 | else 9 | allocate(ilen(size(default))) 10 | ilen = len(default) 11 | end if 12 | end if 13 | call flag_not_found(found) 14 | return 15 | end if 16 | 17 | nullify(p) 18 | call json%get(me=me, path=path, p=p) 19 | 20 | if (.not. associated(p)) then 21 | call json%throw_exception('Error in '//routine//':'//& 22 | ' Unable to resolve path: '// trim(path),found) 23 | else 24 | call json%get(p,vec,ilen) 25 | end if 26 | 27 | if ( json%exception_thrown ) then 28 | if ( present(found) .or. present(default)) then 29 | call flag_not_found(found) 30 | if (present(default)) then 31 | vec = default 32 | if (present(default_ilen)) then 33 | ilen = default_ilen 34 | else 35 | allocate(ilen(size(default))) 36 | ilen = len(default) 37 | end if 38 | end if 39 | call json%clear_exceptions() 40 | end if 41 | else 42 | if ( present(found) ) found = .true. 43 | end if 44 | -------------------------------------------------------------------------------- /Doc/quickreference.rst: -------------------------------------------------------------------------------- 1 | .. _quickreference: 2 | 3 | Quick Reference 4 | =============== 5 | 6 | These are quick references for **WEST** input file examples. 7 | 8 | .. seealso:: 9 | All input keywords are referenced and explained in the :ref:`manual`. 10 | 11 | wstat.x 12 | ~~~~~~~ 13 | 14 | This is a typical input for ``wstat.x``. 15 | 16 | .. code-block:: yaml 17 | 18 | input_west: 19 | qe_prefix: silane 20 | west_prefix: silane 21 | outdir: ./ 22 | 23 | wstat_control: 24 | wstat_calculation: S 25 | n_pdep_eigen: 50 26 | 27 | wfreq.x 28 | ~~~~~~~ 29 | 30 | This is a typical input for ``wfreq.x``. 31 | 32 | .. code-block:: yaml 33 | 34 | input_west: 35 | qe_prefix: silane 36 | west_prefix: silane 37 | outdir: ./ 38 | 39 | wstat_control: 40 | wstat_calculation: S 41 | n_pdep_eigen: 50 42 | 43 | wfreq_control: 44 | wfreq_calculation: XWGQ 45 | n_pdep_eigen_to_use: 50 46 | qp_bandrange: [1,5] 47 | ecut_refreq: 2.0 48 | n_refreq: 300 49 | 50 | westpp.x 51 | ~~~~~~~~ 52 | 53 | This is a typical input for ``westpp.x``. 54 | 55 | .. code-block:: yaml 56 | 57 | input_west: 58 | qe_prefix: silane 59 | west_prefix: silane 60 | outdir: ./ 61 | 62 | wstat_control: 63 | wstat_calculation: S 64 | n_pdep_eigen: 50 65 | 66 | westpp_control: 67 | westpp_calculation: E 68 | westpp_range: [1,2] 69 | westpp_format: C 70 | westpp_sign: True 71 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | env: 6 | QE_VERSION: qe-7.4.1 7 | 8 | jobs: 9 | test: 10 | runs-on: [self-hosted, linux] 11 | container: miccomcenter/bot:gcc1330_0001 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | with: 16 | path: West 17 | - name: Build QE 18 | run: | 19 | rm -rf qe 20 | git clone -b $QE_VERSION --single-branch --depth 1 https://gitlab.com/QEF/q-e.git qe 21 | cd qe 22 | git describe --tags --always 23 | ./configure 24 | make -j8 pw 25 | ls bin 26 | - name: Build WEST 27 | run: | 28 | pip3 install -q -U pip 29 | pip3 install -q -U numpy 30 | pip3 install -q -U pytest 31 | pip3 install -q -U setuptools 32 | mv West qe 33 | cd qe/West 34 | git describe --tags --always 35 | make conf PYT=python3 PYT_LDFLAGS="`python3-config --ldflags --embed`" 36 | make -j8 all 37 | ls ../bin 38 | - name: Test 39 | run: | 40 | cd qe/West/test-suite 41 | make NP=8 42 | - name: Archive artifacts 43 | uses: actions/upload-artifact@v4 44 | if: failure() 45 | with: 46 | name: artifacts 47 | path: | 48 | qe/West/test-suite/test*/*.out 49 | qe/West/test-suite/test*/*.err 50 | qe/West/test-suite/test*/*.xml 51 | qe/West/test-suite/test*/test*/w*.json 52 | retention-days: 1 53 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | This file lists the authors of the WEST code as well as the known contributors. 2 | 3 | # Project Leads 4 | 5 | - Marco Govoni (University of Modena and Reggio Emilia, Argonne National Laboratory, University of Chicago) 6 | - Giulia Galli (University of Chicago and Argonne National Laboratory) 7 | 8 | # Developers 9 | 10 | The current list of developers, in alphabetical order: 11 | 12 | - Siyuan Chen (University of Chicago) 13 | - Marco Govoni (University of Modena and Reggio Emilia, Argonne National Lab, University of Chicago) 14 | - Yu Jin (University of Chicago) 15 | - Victor Yu (Argonne National Lab) 16 | 17 | # Former Developers 18 | 19 | The former list of developers, in alphabetical order: 20 | 21 | - Nicholas Brawand (2016-2018) 22 | - Sijia Dong (2019-2020) 23 | - Matteo Gerosa (2017-2018) 24 | - Lan Huang (2019-2020) 25 | - He Ma (2017-2020) 26 | - Ryan McAvoy (2017-2018) 27 | - Ngoc Linh Nguyen (2017-2018) 28 | - Peter Scherpelz (2016-2018) 29 | - Nan Sheng (2020-2022) 30 | - Christian Vorwerk (2021-2022) 31 | - Han Yang (2017-2022) 32 | - Huihuo Zheng (2016-2018) 33 | 34 | # Contributors 35 | 36 | We would like to thank the following people for their contributions, in alphabetical order: 37 | 38 | - Francois Gygi (University of California, Davis) 39 | - Ikutaro Hamada (Osaka University) 40 | - Yuan Ping (University of Wisconsin, Madison) 41 | - Jonathan Skone (Lawrence Berkeley National Lab) 42 | 43 | Please, don't hesitate to contact us if you see that information is wrong or missing in this file. 44 | -------------------------------------------------------------------------------- /Tools/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Tools 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../../PW/src \ 8 | $(MOD_FLAG)../Libraries/Base64 \ 9 | $(MOD_FLAG)../Libraries/Forpy \ 10 | $(MOD_FLAG)../Libraries/Json \ 11 | $(MOD_FLAG)../Modules \ 12 | $(MOD_FLAG). 13 | 14 | TOOLS_OBJS = \ 15 | bar.o \ 16 | class_bz_grid.o \ 17 | clean_scratchfiles.o \ 18 | conversions.o \ 19 | destroy_pw_arrays.o \ 20 | do_setup.o \ 21 | exx_go.o \ 22 | exx_ungo.o \ 23 | fetch_input.o \ 24 | get_alpha_pv.o \ 25 | heapsort.o \ 26 | human_readable_time.o \ 27 | init_pw_arrays.o \ 28 | io_push.o \ 29 | linear_algebra_kernel.o \ 30 | my_mkdir.o \ 31 | parse_command_arguments.o \ 32 | pw_memory_report.o \ 33 | set_dirs.o \ 34 | set_eprec.o \ 35 | set_nbndocc.o \ 36 | set_npwq.o \ 37 | types_bz_grid.o \ 38 | wannier.o \ 39 | west_environment.o \ 40 | west_readin.o \ 41 | west_print_clocks.o 42 | 43 | TLDEPS = bindir mods pwlibs pw 44 | 45 | all : title tldeps libtools.a 46 | 47 | tldeps : 48 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 49 | 50 | libtools.a : $(TOOLS_OBJS) 51 | $(AR) $(ARFLAGS) $@ $? 52 | $(RANLIB) $@ 53 | 54 | clean : 55 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 56 | - /bin/rm -f libtools.a 57 | 58 | title : 59 | @echo 60 | @echo "##############" 61 | @echo "### Tools ####" 62 | @echo "##############" 63 | @echo 64 | 65 | include make.depend 66 | -------------------------------------------------------------------------------- /test-suite/test007/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 4 | 5 | cat > pw.in << EOF 6 | &control 7 | calculation = 'scf' 8 | restart_mode = 'from_scratch' 9 | pseudo_dir = './' 10 | outdir = './' 11 | prefix = 'test' 12 | / 13 | &system 14 | ibrav = 2 15 | a = 5.43 16 | nat = 2 17 | ntyp = 1 18 | ecutwfc = 25 19 | nbnd = 16 20 | noinv = .true. 21 | nosym = .true. 22 | input_dft = 'pbe0' 23 | / 24 | &electrons 25 | diago_full_acc = .true. 26 | conv_thr = 1.e-12 27 | / 28 | ATOMIC_SPECIES 29 | Si 28.085 Si_ONCV_PBE-1.2.upf 30 | ATOMIC_POSITIONS crystal 31 | Si 0.0000 0.0000 0.0000 32 | Si 0.2500 0.2500 0.2500 33 | K_POINTS automatic 34 | 1 1 2 0 0 0 35 | EOF 36 | 37 | 38 | cat > wstat.in << EOF 39 | input_west: 40 | qe_prefix: test 41 | west_prefix: test 42 | outdir: ./ 43 | 44 | wstat_control: 45 | wstat_calculation: S 46 | n_pdep_eigen: 10 47 | l_minimize_exx_if_active: True 48 | n_exx_lowrank: 30 49 | EOF 50 | 51 | 52 | cat > wfreq.in << EOF 53 | input_west: 54 | qe_prefix: test 55 | west_prefix: test 56 | outdir: ./ 57 | 58 | wstat_control: 59 | wstat_calculation: S 60 | n_pdep_eigen: 10 61 | l_minimize_exx_if_active: True 62 | n_exx_lowrank: 30 63 | 64 | wfreq_control: 65 | wfreq_calculation: XWGQ 66 | n_pdep_eigen_to_use: 10 67 | qp_bandrange: [1,5] 68 | n_refreq: 300 69 | ecut_refreq: 2.0 70 | macropol_calculation: C 71 | EOF 72 | -------------------------------------------------------------------------------- /Tools/conversions.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `LICENSE' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | MODULE conversions 15 | !----------------------------------------------------------------------- 16 | USE kinds, ONLY : DP 17 | IMPLICIT NONE 18 | CONTAINS 19 | ! 20 | FUNCTION ltoa(l) RESULT(res) 21 | IMPLICIT NONE 22 | CHARACTER(:),ALLOCATABLE :: res 23 | LOGICAL,INTENT(IN) :: l 24 | CHARACTER(4) :: t="true" 25 | CHARACTER(5) :: f="false" 26 | IF( l ) THEN 27 | res = t 28 | ELSE 29 | res =f 30 | ENDIF 31 | END FUNCTION 32 | ! 33 | FUNCTION itoa(i) RESULT(res) 34 | IMPLICIT NONE 35 | CHARACTER(:),ALLOCATABLE :: res 36 | INTEGER,INTENT(IN) :: i 37 | CHARACTER(RANGE(i)+2) :: tmp 38 | WRITE(tmp,'(I0)') i 39 | res = TRIM(tmp) 40 | END FUNCTION 41 | ! 42 | FUNCTION dtoa(d) RESULT(res) 43 | IMPLICIT NONE 44 | CHARACTER(:),ALLOCATABLE :: res 45 | REAL(DP),INTENT(IN) :: d 46 | CHARACTER(14) :: tmp 47 | WRITE(tmp,'(ES14.6)') d 48 | res = TRIM(tmp) 49 | END FUNCTION 50 | END MODULE 51 | -------------------------------------------------------------------------------- /Wstat/wstat.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | PROGRAM wstat 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! This is the main program that calculates the static screening. 18 | ! 19 | USE check_stop, ONLY : check_stop_init 20 | USE mp_global, ONLY : mp_startup, mp_global_end 21 | USE west_environment, ONLY : west_environment_start, west_environment_end 22 | ! 23 | IMPLICIT NONE 24 | ! 25 | CHARACTER(LEN=9) :: code = 'WSTAT' 26 | ! 27 | ! *** START *** 28 | ! 29 | CALL check_stop_init( ) 30 | ! 31 | ! Initialize MPI, clocks, print initial messages 32 | ! 33 | #if defined(__MPI) 34 | CALL mp_startup( start_images = .TRUE. ) 35 | #endif 36 | ! 37 | CALL west_environment_start( code ) 38 | ! 39 | CALL west_readin( code ) 40 | ! 41 | CALL wstat_setup( ) 42 | ! 43 | CALL davidson_diago( ) 44 | ! 45 | CALL exx_ungo( ) 46 | ! 47 | CALL clean_scratchfiles( ) 48 | ! 49 | CALL west_print_clocks( ) 50 | ! 51 | CALL west_environment_end( code ) 52 | ! 53 | CALL mp_global_end( ) 54 | ! 55 | END PROGRAM 56 | -------------------------------------------------------------------------------- /Tools/my_mkdir.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE my_mkdir(dirname) 15 | !------------------------------------------------------------------------ 16 | ! 17 | USE mp, ONLY : mp_barrier 18 | USE mp_world, ONLY : mpime,root,world_comm 19 | USE forpy_mod, ONLY : call_py_noret,import_py,module_py,tuple,tuple_create,dict,dict_create 20 | ! 21 | IMPLICIT NONE 22 | ! 23 | ! I/O 24 | ! 25 | CHARACTER(LEN=*), INTENT(IN) :: dirname 26 | ! 27 | ! Workspace 28 | ! 29 | INTEGER :: ierr 30 | TYPE(tuple) :: args 31 | TYPE(dict) :: kwargs 32 | TYPE(module_py) :: pymod 33 | ! 34 | IF(mpime == root) THEN 35 | ! 36 | ierr = import_py(pymod, "west_utils") 37 | ! 38 | ierr = tuple_create(args, 1) 39 | ierr = args%setitem(0, TRIM(ADJUSTL(dirname))) 40 | ierr = dict_create(kwargs) 41 | ierr = call_py_noret(pymod, "my_mkdir", args, kwargs) 42 | ! 43 | CALL kwargs%destroy 44 | CALL args%destroy 45 | CALL pymod%destroy 46 | ! 47 | ENDIF 48 | ! 49 | ! BARRIER 50 | ! 51 | CALL mp_barrier(world_comm) 52 | ! 53 | END SUBROUTINE 54 | -------------------------------------------------------------------------------- /Wbse/wbse_init.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Ngoc Linh Nguyen, Victor Yu 12 | ! 13 | !----------------------------------------------------------------------- 14 | PROGRAM wbse_init 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! This is the main program that calculates the static screening. 18 | ! 19 | USE check_stop, ONLY : check_stop_init 20 | USE mp_global, ONLY : mp_startup,mp_global_end 21 | USE west_environment, ONLY : west_environment_start,west_environment_end 22 | ! 23 | IMPLICIT NONE 24 | ! 25 | CHARACTER(LEN=9) :: code = 'WBSE_INIT' 26 | ! 27 | ! *** START *** 28 | ! 29 | CALL check_stop_init( ) 30 | ! 31 | ! Initialize MPI, clocks, print initial messages 32 | ! 33 | #if defined(__MPI) 34 | CALL mp_startup( start_images = .TRUE. ) 35 | #endif 36 | ! 37 | CALL west_environment_start( code ) 38 | ! 39 | CALL west_readin( code ) 40 | ! 41 | CALL wbse_init_setup( ) 42 | ! 43 | CALL calc_tau( ) 44 | ! 45 | CALL exx_ungo( ) 46 | ! 47 | CALL clean_scratchfiles( ) 48 | ! 49 | CALL west_print_clocks( ) 50 | ! 51 | CALL west_environment_end( code ) 52 | ! 53 | CALL mp_global_end( ) 54 | ! 55 | END PROGRAM 56 | -------------------------------------------------------------------------------- /test-suite/test019/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 5 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 6 | 7 | cat > pw.in << EOF 8 | &control 9 | calculation = 'scf' 10 | restart_mode = 'from_scratch' 11 | pseudo_dir = './' 12 | outdir = './' 13 | prefix = 'test' 14 | / 15 | &system 16 | ibrav = 1 17 | celldm(1) = 20 18 | nat = 4 19 | ntyp = 3 20 | ecutwfc = 25 21 | nbnd = 16 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | C 12.0107 C_ONCV_PBE-1.2.upf 28 | H 1.0079 H_ONCV_PBE-1.2.upf 29 | O 16.00 O_ONCV_PBE-1.2.upf 30 | ATOMIC_POSITIONS crystal 31 | C 0.452400000 0.500000000 0.500000000 32 | H 0.397141530 0.411608770 0.500000000 33 | H 0.397141530 0.588391230 0.500000000 34 | O 0.565022174 0.500000000 0.500000000 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wbse.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wbse_init_control: 46 | wbse_init_calculation: S 47 | solver: TDDFT 48 | 49 | wbse_control: 50 | wbse_calculation: D 51 | n_liouville_eigen: 4 52 | n_liouville_times: 10 53 | trev_liouville: 0.00000001 54 | trev_liouville_rel: 0.000001 55 | l_pre_shift: True 56 | l_forces: True 57 | forces_state: 1 58 | EOF 59 | -------------------------------------------------------------------------------- /test-suite/test018/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 30 21 | assume_isolated = 'mp' 22 | input_dft = 'pbe0' 23 | / 24 | &electrons 25 | diago_full_acc = .true. 26 | / 27 | ATOMIC_SPECIES 28 | Si 28.0855 Si_ONCV_PBE-1.2.upf 29 | H 1.00794 H_ONCV_PBE-1.2.upf 30 | ATOMIC_POSITIONS bohr 31 | Si 10.000000 10.000000 10.000000 32 | H 11.614581 11.614581 11.614581 33 | H 8.385418 8.385418 11.614581 34 | H 8.385418 11.614581 8.385418 35 | H 11.614581 8.385418 8.385418 36 | K_POINTS gamma 37 | EOF 38 | 39 | 40 | cat > wbse_init.in << EOF 41 | input_west: 42 | qe_prefix: test 43 | west_prefix: test 44 | outdir: ./ 45 | 46 | wbse_init_control: 47 | wbse_init_calculation: S 48 | solver: TDDFT 49 | EOF 50 | 51 | 52 | cat > wbse.in << EOF 53 | input_west: 54 | qe_prefix: test 55 | west_prefix: test 56 | outdir: ./ 57 | 58 | wbse_init_control: 59 | wbse_init_calculation: S 60 | solver: TDDFT 61 | 62 | wbse_control: 63 | wbse_calculation: L 64 | l_dipole_realspace: True 65 | n_lanczos: 200 66 | EOF 67 | -------------------------------------------------------------------------------- /test-suite/test025/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 4 | 5 | cat > pw.in << EOF 6 | &control 7 | calculation = 'scf' 8 | restart_mode = 'from_scratch' 9 | pseudo_dir = './' 10 | outdir = './' 11 | prefix = 'test' 12 | / 13 | &system 14 | ibrav = 1 15 | celldm(1) = 20 16 | nat = 2 17 | ntyp = 1 18 | nspin = 2 19 | ecutwfc = 25 20 | nbnd = 30 21 | tot_magnetization = 2. 22 | input_dft = 'pbe0' 23 | / 24 | &electrons 25 | diago_full_acc = .true. 26 | / 27 | ATOMIC_SPECIES 28 | O 16.00 O_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS crystal 30 | O 0.460000000 0.500000000 0.500000000 31 | O 0.540000000 0.500000000 0.500000000 32 | K_POINTS gamma 33 | EOF 34 | 35 | 36 | cat > wbse_init.in << EOF 37 | input_west: 38 | qe_prefix: test 39 | west_prefix: test 40 | outdir: ./ 41 | 42 | wbse_init_control: 43 | wbse_init_calculation: S 44 | solver: TDDFT 45 | EOF 46 | 47 | 48 | cat > wbse.in << EOF 49 | input_west: 50 | qe_prefix: test 51 | west_prefix: test 52 | outdir: ./ 53 | 54 | wbse_init_control: 55 | wbse_init_calculation: S 56 | solver: TDDFT 57 | 58 | wbse_control: 59 | wbse_calculation: D 60 | n_liouville_eigen: 4 61 | n_liouville_times: 10 62 | trev_liouville: 0.00000001 63 | trev_liouville_rel: 0.000001 64 | l_pre_shift: True 65 | l_spin_flip: True 66 | l_spin_flip_kernel: True 67 | l_spin_flip_alda0: False 68 | l_forces: True 69 | forces_state: 4 70 | EOF 71 | -------------------------------------------------------------------------------- /test-suite/test026/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 4 | 5 | cat > pw.in << EOF 6 | &control 7 | calculation = 'scf' 8 | restart_mode = 'from_scratch' 9 | pseudo_dir = './' 10 | outdir = './' 11 | prefix = 'test' 12 | / 13 | &system 14 | ibrav = 1 15 | celldm(1) = 20 16 | nat = 2 17 | ntyp = 1 18 | nspin = 2 19 | ecutwfc = 25 20 | nbnd = 30 21 | tot_magnetization = 2. 22 | input_dft = 'hse' 23 | / 24 | &electrons 25 | diago_full_acc = .true. 26 | / 27 | ATOMIC_SPECIES 28 | O 16.00 O_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS crystal 30 | O 0.460000000 0.500000000 0.500000000 31 | O 0.540000000 0.500000000 0.500000000 32 | K_POINTS gamma 33 | EOF 34 | 35 | 36 | cat > wbse_init.in << EOF 37 | input_west: 38 | qe_prefix: test 39 | west_prefix: test 40 | outdir: ./ 41 | 42 | wbse_init_control: 43 | wbse_init_calculation: S 44 | solver: TDDFT 45 | EOF 46 | 47 | 48 | cat > wbse.in << EOF 49 | input_west: 50 | qe_prefix: test 51 | west_prefix: test 52 | outdir: ./ 53 | 54 | wbse_init_control: 55 | wbse_init_calculation: S 56 | solver: TDDFT 57 | 58 | wbse_control: 59 | wbse_calculation: D 60 | n_liouville_eigen: 4 61 | n_liouville_times: 10 62 | trev_liouville: 0.00000001 63 | trev_liouville_rel: 0.000001 64 | l_pre_shift: True 65 | l_spin_flip: True 66 | l_spin_flip_kernel: True 67 | l_spin_flip_alda0: False 68 | l_forces: True 69 | forces_state: 4 70 | EOF 71 | -------------------------------------------------------------------------------- /Doc/installations/macos.rst: -------------------------------------------------------------------------------- 1 | .. _macos: 2 | 3 | ===== 4 | macOS 5 | ===== 6 | 7 | The following instructions have been tested on macOS 15.3 (with Apple M4). 8 | 9 | Requirements: 10 | 11 | - C and Fortran compilers (e.g. gcc/gfortran in `GCC `_) 12 | - MPI (e.g. `OpenMPI `_) 13 | - BLAS/LAPACK (e.g. `Apple Accelerate `_) 14 | - `FFTW3 `_ 15 | - Python3 16 | 17 | The dependencies can be installed via `Homebrew `_ or compiled manually from source. 18 | 19 | Building WEST 20 | ~~~~~~~~~~~~~ 21 | 22 | WEST executables can be compiled using the following script: 23 | 24 | .. code-block:: bash 25 | 26 | $ cat build_west.sh 27 | #!/bin/bash 28 | 29 | export MPIF90=mpif90 30 | export F90=gfortran 31 | export CC=gcc 32 | export BLAS_LIBS="-framework Accelerate" 33 | export LAPACK_LIBS="-framework Accelerate" 34 | export LIBDIRS="-L/PATH/TO/FFTW3/lib" 35 | 36 | ./configure 37 | 38 | # Add -I/PATH/TO/FFTW3/include to IFLAGS if needed 39 | make -j 4 pw 40 | 41 | cd West 42 | 43 | make conf PYT=python3 PYT_LDFLAGS="`python3-config --ldflags --embed`" 44 | make -j 4 all 45 | 46 | To use the script do: 47 | 48 | .. code-block:: bash 49 | 50 | $ bash build_west.sh 51 | 52 | 53 | Running WEST 54 | ~~~~~~~~~~~~ 55 | 56 | We can run the `wstat.x` WEST executables on 2 cores using the following command: 57 | 58 | .. code-block:: bash 59 | 60 | $ export OMP_NUM_THREADS=1 61 | $ mpirun -np 2 ./wstat.x -i wstat.in > wstat.out 62 | -------------------------------------------------------------------------------- /test-suite/test005/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | Si 28.0855 Si_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS bohr 30 | Si 10.000000 10.000000 10.000000 31 | H 11.614581 11.614581 11.614581 32 | H 8.385418 8.385418 11.614581 33 | H 8.385418 11.614581 8.385418 34 | H 11.614581 8.385418 8.385418 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wstat_control: 46 | wstat_calculation: S 47 | n_pdep_eigen: 50 48 | EOF 49 | 50 | 51 | cat > westpp.in << EOF 52 | input_west: 53 | qe_prefix: test 54 | west_prefix: test 55 | outdir: ./ 56 | 57 | wstat_control: 58 | wstat_calculation: S 59 | n_pdep_eigen: 50 60 | 61 | westpp_control: 62 | westpp_calculation: E 63 | westpp_n_pdep_eigen_to_use: 10 64 | westpp_range: [1,2] 65 | westpp_format: C 66 | westpp_sign: True 67 | EOF 68 | -------------------------------------------------------------------------------- /test-suite/test003/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | nspin = 2 20 | ecutwfc = 25 21 | nbnd = 10 22 | assume_isolated = 'mp' 23 | tot_magnetization = 0 24 | / 25 | &electrons 26 | diago_full_acc = .true. 27 | / 28 | ATOMIC_SPECIES 29 | C 12.0107 C_ONCV_PBE-1.2.upf 30 | H 1.00794 H_ONCV_PBE-1.2.upf 31 | ATOMIC_POSITIONS angstrom 32 | C 0.0000 0.0000 0.0000 33 | H 0.6276 -0.6275 0.6276 34 | H -0.6276 0.6276 0.6276 35 | H -0.6276 -0.6276 -0.6276 36 | H 0.6276 0.6276 -0.6276 37 | K_POINTS gamma 38 | EOF 39 | 40 | 41 | cat > wstat.in << EOF 42 | input_west: 43 | qe_prefix: test 44 | west_prefix: test 45 | outdir: ./ 46 | 47 | wstat_control: 48 | wstat_calculation: S 49 | n_pdep_eigen: 50 50 | EOF 51 | 52 | 53 | cat > wfreq.in << EOF 54 | input_west: 55 | qe_prefix: test 56 | west_prefix: test 57 | outdir: ./ 58 | 59 | wstat_control: 60 | wstat_calculation: S 61 | n_pdep_eigen: 50 62 | 63 | wfreq_control: 64 | wfreq_calculation: XWGQ 65 | macropol_calculation: N 66 | n_pdep_eigen_to_use: 50 67 | qp_bandrange: [2,6] 68 | n_refreq: 300 69 | ecut_refreq: 2.0 70 | EOF 71 | -------------------------------------------------------------------------------- /test-suite/test011/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | Si 28.0855 Si_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS bohr 30 | Si 10.000000 10.000000 10.000000 31 | H 11.614581 11.614581 11.614581 32 | H 8.385418 8.385418 11.614581 33 | H 8.385418 11.614581 8.385418 34 | H 11.614581 8.385418 8.385418 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wstat_control: 46 | wstat_calculation: S 47 | n_pdep_eigen: 50 48 | EOF 49 | 50 | 51 | cat > wfreq.in << EOF 52 | input_west: 53 | qe_prefix: test 54 | west_prefix: test 55 | outdir: ./ 56 | 57 | wstat_control: 58 | wstat_calculation: S 59 | n_pdep_eigen: 50 60 | 61 | wfreq_control: 62 | wfreq_calculation: XWGQ 63 | macropol_calculation: N 64 | n_pdep_eigen_to_use: 50 65 | qp_bands: [1,3,5] 66 | n_refreq: 300 67 | ecut_refreq: 2.0 68 | EOF 69 | -------------------------------------------------------------------------------- /test-suite/test001/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | Si 28.0855 Si_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS bohr 30 | Si 10.000000 10.000000 10.000000 31 | H 11.614581 11.614581 11.614581 32 | H 8.385418 8.385418 11.614581 33 | H 8.385418 11.614581 8.385418 34 | H 11.614581 8.385418 8.385418 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wstat_control: 46 | wstat_calculation: S 47 | n_pdep_eigen: 50 48 | EOF 49 | 50 | 51 | cat > wfreq.in << EOF 52 | input_west: 53 | qe_prefix: test 54 | west_prefix: test 55 | outdir: ./ 56 | 57 | wstat_control: 58 | wstat_calculation: S 59 | n_pdep_eigen: 50 60 | 61 | wfreq_control: 62 | wfreq_calculation: XWGQ 63 | macropol_calculation: N 64 | n_pdep_eigen_to_use: 50 65 | qp_bandrange: [1,5] 66 | n_refreq: 300 67 | ecut_refreq: 2.0 68 | EOF 69 | -------------------------------------------------------------------------------- /Libraries/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Libraries 2 | 3 | default: all 4 | 5 | all: title forpy_do json_do base64_do 6 | 7 | test: json_test_do 8 | 9 | forpy_do: 10 | if test -d Forpy ; then \ 11 | ( cd Forpy ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \ 12 | else $(MAKE) $(MFLAGS) all ; fi ) ; fi 13 | 14 | json_do: 15 | if test -d Json ; then \ 16 | ( cd Json ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \ 17 | else $(MAKE) $(MFLAGS) all ; fi ) ; fi 18 | 19 | base64_do: 20 | if test -d Base64 ; then \ 21 | ( cd Base64 ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \ 22 | else $(MAKE) $(MFLAGS) all ; fi ) ; fi 23 | 24 | json_test_do: 25 | if test -d Json-test ; then \ 26 | ( cd Json-test ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \ 27 | else $(MAKE) $(MFLAGS) all ; fi ) ; fi 28 | 29 | clean: forpy_undo json_undo base64_undo json_test_undo 30 | 31 | forpy_undo: 32 | if test -d Forpy ; then \ 33 | ( cd Forpy ; if test "$(MAKE)" = "" ; then make clean ; \ 34 | else $(MAKE) clean ; fi ) ; fi 35 | 36 | json_undo: 37 | if test -d Json ; then \ 38 | ( cd Json ; if test "$(MAKE)" = "" ; then make clean ; \ 39 | else $(MAKE) clean ; fi ) ; fi 40 | 41 | base64_undo: 42 | if test -d Base64 ; then \ 43 | ( cd Base64 ; if test "$(MAKE)" = "" ; then make clean ; \ 44 | else $(MAKE) clean ; fi ) ; fi 45 | 46 | json_test_undo: 47 | if test -d Json-test ; then \ 48 | ( cd Json-test ; if test "$(MAKE)" = "" ; then make clean ; \ 49 | else $(MAKE) clean ; fi ) ; fi 50 | 51 | distclean: clean 52 | 53 | title : 54 | @echo 55 | @echo "##############" 56 | @echo "## Libraries #" 57 | @echo "##############" 58 | @echo 59 | -------------------------------------------------------------------------------- /test-suite/test010/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | Si 28.0855 Si_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS bohr 30 | Si 10.000000 10.000000 10.000000 31 | H 11.614581 11.614581 11.614581 32 | H 8.385418 8.385418 11.614581 33 | H 8.385418 11.614581 8.385418 34 | H 11.614581 8.385418 8.385418 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wstat_control: 46 | wstat_calculation: S 47 | n_pdep_eigen: 50 48 | EOF 49 | 50 | 51 | cat > wfreq.in << EOF 52 | input_west: 53 | qe_prefix: test 54 | west_prefix: test 55 | outdir: ./ 56 | 57 | wstat_control: 58 | wstat_calculation: S 59 | n_pdep_eigen: 50 60 | 61 | wfreq_control: 62 | wfreq_calculation: XWGQ 63 | macropol_calculation: N 64 | n_pdep_eigen_to_use: 50 65 | qp_bandrange: [1,5] 66 | n_refreq: 300 67 | ecut_refreq: 2.0 68 | l_enable_off_diagonal: True 69 | EOF 70 | -------------------------------------------------------------------------------- /test-suite/test012/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | Si 28.0855 Si_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS bohr 30 | Si 10.000000 10.000000 10.000000 31 | H 11.614581 11.614581 11.614581 32 | H 8.385418 8.385418 11.614581 33 | H 8.385418 11.614581 8.385418 34 | H 11.614581 8.385418 8.385418 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wstat_control: 46 | wstat_calculation: S 47 | n_pdep_eigen: 50 48 | EOF 49 | 50 | 51 | cat > wfreq.in << EOF 52 | input_west: 53 | qe_prefix: test 54 | west_prefix: test 55 | outdir: ./ 56 | 57 | wstat_control: 58 | wstat_calculation: S 59 | n_pdep_eigen: 50 60 | 61 | wfreq_control: 62 | wfreq_calculation: XWGQH 63 | macropol_calculation: N 64 | l_enable_off_diagonal: True 65 | n_pdep_eigen_to_use: 50 66 | qp_bands: [8,9,10] 67 | n_refreq: 300 68 | ecut_refreq: 2.0 69 | EOF 70 | -------------------------------------------------------------------------------- /test-suite/test013/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | Si 28.0855 Si_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS bohr 30 | Si 10.000000 10.000000 10.000000 31 | H 11.614581 11.614581 11.614581 32 | H 8.385418 8.385418 11.614581 33 | H 8.385418 11.614581 8.385418 34 | H 11.614581 8.385418 8.385418 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wstat_control: 46 | wstat_calculation: S 47 | n_pdep_eigen: 50 48 | EOF 49 | 50 | 51 | cat > wfreq.in << EOF 52 | input_west: 53 | qe_prefix: test 54 | west_prefix: test 55 | outdir: ./ 56 | 57 | wstat_control: 58 | wstat_calculation: S 59 | n_pdep_eigen: 50 60 | 61 | wfreq_control: 62 | wfreq_calculation: XWGQH 63 | macropol_calculation: N 64 | l_qdet_verbose: True 65 | l_enable_off_diagonal: True 66 | n_pdep_eigen_to_use: 50 67 | qp_bands: [8,9,10] 68 | n_refreq: 300 69 | ecut_refreq: 2.0 70 | EOF 71 | -------------------------------------------------------------------------------- /Tools/get_alpha_pv.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | FUNCTION get_alpha_pv() 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE pwcom, ONLY : nbnd,et,nks 18 | USE kinds, ONLY : DP 19 | USE mp, ONLY : mp_min,mp_max 20 | USE mp_global, ONLY : inter_pool_comm 21 | USE westcom, ONLY : nbnd_occ 22 | ! 23 | IMPLICIT NONE 24 | ! 25 | COMPLEX(DP) :: get_alpha_pv 26 | ! 27 | INTEGER :: ibnd,iks 28 | REAL(DP) :: emin,emax 29 | REAL(DP) :: alpha_pv 30 | ! 31 | CALL set_nbndocc() 32 | ! 33 | ! Calculate ALPHA_PV 34 | ! 35 | emin = et(1,1) 36 | DO iks = 1,nks 37 | DO ibnd = 1,nbnd 38 | emin = MIN(emin,et(ibnd,iks)) 39 | ENDDO 40 | ENDDO 41 | ! 42 | CALL mp_min(emin,inter_pool_comm) 43 | ! 44 | emax = et(1,1) 45 | DO iks = 1,nks 46 | DO ibnd = 1,nbnd_occ(iks) 47 | emax = MAX(emax,et(ibnd,iks)) 48 | ENDDO 49 | ENDDO 50 | ! 51 | CALL mp_max(emax,inter_pool_comm) 52 | ! 53 | alpha_pv = 2._DP*(emax-emin) 54 | ! 55 | ! avoid zero value for alpha_pv 56 | ! 57 | alpha_pv = MAX(alpha_pv,0.01_DP) 58 | ! 59 | get_alpha_pv = CMPLX(alpha_pv,0._DP,KIND=DP) 60 | ! 61 | END FUNCTION 62 | -------------------------------------------------------------------------------- /DFPT_kernel/precondition_m_wfcts.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE precondition_m_wfcts (m,f,pf,eprec) 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE kinds, ONLY : DP 18 | USE wvfct, ONLY : g2kin 19 | USE noncollin_module, ONLY : noncolin,npol 20 | USE pwcom, ONLY : npw,npwx 21 | ! 22 | IMPLICIT NONE 23 | ! 24 | ! I/O 25 | ! 26 | INTEGER,INTENT(IN) :: m 27 | COMPLEX(DP),INTENT(IN) :: f(npwx*npol,m) 28 | COMPLEX(DP),INTENT(OUT) :: pf(npwx*npol,m) 29 | REAL(DP),INTENT(IN) :: eprec(m) 30 | ! 31 | ! Workspace 32 | ! 33 | INTEGER :: ibnd, ig 34 | ! 35 | !$acc parallel loop collapse(2) present(pf,f,g2kin,eprec) 36 | DO ibnd = 1,m 37 | DO ig = 1,npwx 38 | IF(ig <= npw) THEN 39 | pf(ig,ibnd) = f(ig,ibnd)/MAX(1._DP,g2kin(ig)/eprec(ibnd)) 40 | IF(noncolin) THEN 41 | pf(npwx+ig,ibnd) = f(npwx+ig,ibnd)/MAX(1._DP,g2kin(ig)/eprec(ibnd)) 42 | ENDIF 43 | ELSE 44 | pf(ig,ibnd) = 0._DP 45 | IF(noncolin) THEN 46 | pf(npwx+ig,ibnd) = 0._DP 47 | ENDIF 48 | ENDIF 49 | ENDDO 50 | ENDDO 51 | !$acc end parallel 52 | ! 53 | END SUBROUTINE 54 | -------------------------------------------------------------------------------- /Tools/parse_command_arguments.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE parse_command_arguments( ) 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE westcom, ONLY : main_input_file !, main_output_file 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | INTEGER :: nargs, iiarg 22 | LOGICAL :: ifound !, ofound 23 | CHARACTER(LEN=512) :: string 24 | ! 25 | ifound = .FALSE. 26 | !ofound = .FALSE. 27 | ! 28 | nargs = command_argument_count() 29 | string = ' ' 30 | ! 31 | DO iiarg = 1, ( nargs - 1 ) 32 | ! 33 | CALL get_command_argument( iiarg, string ) 34 | ! 35 | IF ( .NOT. ifound .AND. TRIM( string ) == '-i' ) THEN 36 | CALL get_command_argument( ( iiarg + 1 ) , main_input_file ) 37 | ifound =.TRUE. 38 | ENDIF 39 | ! 40 | !IF ( .NOT. ofound .AND. TRIM( string ) == '-o' ) THEN 41 | ! CALL get_command_argument( ( iiarg + 1 ) , main_output_file ) 42 | ! ofound =.TRUE. 43 | !ENDIF 44 | ! 45 | !IF( ifound .AND. ofound ) EXIT 46 | IF( ifound ) EXIT 47 | ! 48 | ENDDO 49 | ! 50 | IF( .NOT. ifound ) CALL errore('parse_cmd','Cannot find input file (-i)',1) 51 | !IF( .NOT. ofound ) CALL errore('parse_cmd','Cannot find output file (-o)',1) 52 | ! 53 | END SUBROUTINE 54 | -------------------------------------------------------------------------------- /Wbse/wbse.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Ngoc Linh Nguyen, Victor Yu 12 | ! 13 | !----------------------------------------------------------------------- 14 | PROGRAM wbse 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! This is the main program that calculates the static screening. 18 | ! 19 | USE check_stop, ONLY : check_stop_init 20 | USE mp_global, ONLY : mp_startup,mp_global_end 21 | USE west_environment, ONLY : west_environment_start,west_environment_end 22 | USE westcom, ONLY : l_davidson,l_lanczos 23 | ! 24 | IMPLICIT NONE 25 | ! 26 | CHARACTER(LEN=9) :: code = 'WBSE' 27 | ! 28 | ! *** START *** 29 | ! 30 | CALL check_stop_init( ) 31 | ! 32 | ! Initialize MPI, clocks, print initial messages 33 | ! 34 | #if defined(__MPI) 35 | CALL mp_startup( start_images = .TRUE. ) 36 | #endif 37 | ! 38 | CALL west_environment_start( code ) 39 | ! 40 | CALL west_readin( code ) 41 | ! 42 | CALL wbse_setup( ) 43 | ! 44 | IF( l_davidson ) THEN 45 | CALL wbse_davidson_diago( ) 46 | ENDIF 47 | ! 48 | IF( l_lanczos ) THEN 49 | CALL wbse_lanczos_diago( ) 50 | ENDIF 51 | ! 52 | CALL exx_ungo( ) 53 | ! 54 | CALL clean_scratchfiles( ) 55 | ! 56 | CALL west_print_clocks( ) 57 | ! 58 | CALL west_environment_end( code ) 59 | ! 60 | CALL mp_global_end( ) 61 | ! 62 | END PROGRAM 63 | -------------------------------------------------------------------------------- /test-suite/test006/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 30 21 | assume_isolated = 'mp' 22 | input_dft = 'pbe0' 23 | / 24 | &electrons 25 | diago_full_acc = .true. 26 | / 27 | ATOMIC_SPECIES 28 | Si 28.0855 Si_ONCV_PBE-1.2.upf 29 | H 1.00794 H_ONCV_PBE-1.2.upf 30 | ATOMIC_POSITIONS bohr 31 | Si 10.000000 10.000000 10.000000 32 | H 11.614581 11.614581 11.614581 33 | H 8.385418 8.385418 11.614581 34 | H 8.385418 11.614581 8.385418 35 | H 11.614581 8.385418 8.385418 36 | K_POINTS gamma 37 | EOF 38 | 39 | 40 | cat > wstat.in << EOF 41 | input_west: 42 | qe_prefix: test 43 | west_prefix: test 44 | outdir: ./ 45 | 46 | wstat_control: 47 | wstat_calculation: S 48 | n_pdep_eigen: 30 49 | l_minimize_exx_if_active: True 50 | EOF 51 | 52 | 53 | cat > wfreq.in << EOF 54 | input_west: 55 | qe_prefix: test 56 | west_prefix: test 57 | outdir: ./ 58 | 59 | wstat_control: 60 | wstat_calculation: S 61 | n_pdep_eigen: 30 62 | l_minimize_exx_if_active: True 63 | 64 | wfreq_control: 65 | wfreq_calculation: XWGQ 66 | macropol_calculation: N 67 | n_pdep_eigen_to_use: 30 68 | qp_bandrange: [1,5] 69 | n_refreq: 300 70 | ecut_refreq: 2.0 71 | EOF 72 | -------------------------------------------------------------------------------- /test-suite/test002/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | C 12.0107 C_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS angstrom 30 | C 0.0000 0.0000 0.0000 31 | H 0.6276 -0.6275 0.6276 32 | H -0.6276 0.6276 0.6276 33 | H -0.6276 -0.6276 -0.6276 34 | H 0.6276 0.6276 -0.6276 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | { 41 | "input_west": { 42 | "qe_prefix": "test", 43 | "west_prefix": "test", 44 | "outdir": "./" 45 | }, 46 | "wstat_control": { 47 | "wstat_calculation": "S", 48 | "n_pdep_eigen": 50 49 | } 50 | } 51 | EOF 52 | 53 | 54 | cat > wfreq.in << EOF 55 | { 56 | "input_west": { 57 | "qe_prefix": "test", 58 | "west_prefix": "test", 59 | "outdir": "./" 60 | }, 61 | "wstat_control": { 62 | "wstat_calculation": "S", 63 | "n_pdep_eigen": 50 64 | }, 65 | "wfreq_control": { 66 | "wfreq_calculation": "XWGQ", 67 | "macropol_calculation": "N", 68 | "n_pdep_eigen_to_use": 50, 69 | "qp_bandrange": [1,5], 70 | "n_refreq": 300, 71 | "ecut_refreq": 2.0 72 | } 73 | } 74 | EOF 75 | -------------------------------------------------------------------------------- /test-suite/test008/test_localization.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import json 3 | 4 | 5 | def read_localization_from_json(fileName): 6 | """ 7 | Read localization factor from JSON file. 8 | """ 9 | 10 | with open(fileName, "r") as f: 11 | raw_ = json.load(f) 12 | 13 | return np.array(raw_["output"]["L"]["K000001"]["local_factor"], dtype=float) 14 | 15 | 16 | def read_ipr_from_json(fileName): 17 | """ 18 | Read inverse participation ratio (IPR) from JSON file. 19 | """ 20 | 21 | with open(fileName, "r") as f: 22 | raw_ = json.load(f) 23 | 24 | return np.array(raw_["output"]["L"]["K000001"]["ipr"], dtype=float) 25 | 26 | 27 | def test_localization(): 28 | """ 29 | Test localization factor. 30 | """ 31 | # get parameters from JSON file 32 | with open("./parameters.json", "r") as f: 33 | parameters = json.load(f) 34 | 35 | ref_loc = read_localization_from_json("./test008/ref/westpp.json") 36 | test_loc = read_localization_from_json("./test008/test.westpp.save/westpp.json") 37 | 38 | np.testing.assert_almost_equal( 39 | ref_loc, 40 | test_loc, 41 | decimal=-np.log10(float(parameters["tolerance"]["westpp"])), 42 | ) 43 | 44 | 45 | def test_ipr(): 46 | """ 47 | Test IPR. 48 | """ 49 | # get parameters from JSON file 50 | with open("./parameters.json", "r") as f: 51 | parameters = json.load(f) 52 | 53 | ref_ipr = read_ipr_from_json("./test008/ref/westpp.json") 54 | test_ipr = read_ipr_from_json("./test008/test.westpp.save/westpp.json") 55 | 56 | np.testing.assert_almost_equal( 57 | ref_ipr, 58 | test_ipr, 59 | decimal=-np.log10(float(parameters["tolerance"]["westpp"])), 60 | ) 61 | -------------------------------------------------------------------------------- /test-suite/test015/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 30 21 | assume_isolated = 'mp' 22 | input_dft = 'pbe0' 23 | / 24 | &electrons 25 | diago_full_acc = .true. 26 | / 27 | ATOMIC_SPECIES 28 | Si 28.0855 Si_ONCV_PBE-1.2.upf 29 | H 1.00794 H_ONCV_PBE-1.2.upf 30 | ATOMIC_POSITIONS bohr 31 | Si 10.000000 10.000000 10.000000 32 | H 11.614581 11.614581 11.614581 33 | H 8.385418 8.385418 11.614581 34 | H 8.385418 11.614581 8.385418 35 | H 11.614581 8.385418 8.385418 36 | K_POINTS gamma 37 | EOF 38 | 39 | 40 | cat > wstat.in << EOF 41 | input_west: 42 | qe_prefix: test 43 | west_prefix: test 44 | outdir: ./ 45 | 46 | wstat_control: 47 | wstat_calculation: S 48 | n_pdep_eigen: 30 49 | l_minimize_exx_if_active: True 50 | n_exx_lowrank: 0 51 | EOF 52 | 53 | 54 | cat > wfreq.in << EOF 55 | input_west: 56 | qe_prefix: test 57 | west_prefix: test 58 | outdir: ./ 59 | 60 | wstat_control: 61 | wstat_calculation: S 62 | n_pdep_eigen: 30 63 | l_minimize_exx_if_active: True 64 | n_exx_lowrank: 0 65 | 66 | wfreq_control: 67 | wfreq_calculation: XWGQ 68 | macropol_calculation: N 69 | n_pdep_eigen_to_use: 30 70 | qp_bandrange: [1,5] 71 | n_refreq: 300 72 | ecut_refreq: 2.0 73 | EOF 74 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | [![license](https://img.shields.io/github/license/west-code-development/West.svg)](https://github.com/west-code-development/West/blob/master/LICENSE) 4 | [![website](https://img.shields.io/badge/website-WEST-red)](https://west-code.org) 5 | [![download](https://img.shields.io/badge/download-releases-blue)](https://github.com/west-code-development/West/tags/) 6 | 7 | **[WEST](https://west-code.org)** (Without Empty STates) is a massively parallel software package for large-scale electronic structure calculations within many-body perturbation theory. 8 | 9 | * **[Source code](https://github.com/west-code-development/west)** 10 | 11 | * **[Installation](https://west-code.org/doc/West/latest/installation.html)** 12 | 13 | * **[Documentation](https://west-code.org/doc/West/latest/)** 14 | 15 | * **[Tutorials](https://west-code.org/doc/West/latest/tutorial.html)** 16 | 17 | * **[Change log](CHANGELOG.md)** 18 | 19 | * **[Contributing](CONTRIBUTING.md)** 20 | 21 | * **[Authors](AUTHORS.md)** 22 | 23 | **WEST** is licensed under the open-source [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.html). 24 | 25 | In publications arising from the use of **WEST**, please cite: 26 | 27 | * Govoni and Galli, J. Chem. Theory Comput. 11, 2680-2696 (2015) [![doi](https://img.shields.io/badge/doi-10.1021/ct500958p-blue.svg)](https://doi.org/10.1021/ct500958p) 28 | * Yu and Govoni, J. Chem. Theory Comput. 18, 4690-4707 (2022) [![doi](https://img.shields.io/badge/doi-10.1021/acs.jctc.2c00241-blue.svg)](https://doi.org/10.1021/acs.jctc.2c00241) 29 | 30 | See also [**WESTpy**](https://github.com/west-code-development/westpy), a Python package that simplifies the pre- and post-processing of **WEST** calculations. 31 | -------------------------------------------------------------------------------- /test-suite/test027/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 5 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 6 | 7 | cat > pw.in << EOF 8 | &control 9 | calculation = 'scf' 10 | restart_mode = 'from_scratch' 11 | pseudo_dir = './' 12 | outdir = './' 13 | prefix = 'test' 14 | / 15 | &system 16 | ibrav = 1 17 | celldm(1) = 20 18 | nat = 4 19 | ntyp = 3 20 | ecutwfc = 25 21 | nbnd = 16 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | C 12.0107 C_ONCV_PBE-1.2.upf 28 | H 1.0079 H_ONCV_PBE-1.2.upf 29 | O 16.00 O_ONCV_PBE-1.2.upf 30 | ATOMIC_POSITIONS crystal 31 | C 0.452400000 0.500000000 0.500000000 32 | H 0.397141530 0.411608770 0.500000000 33 | H 0.397141530 0.588391230 0.500000000 34 | O 0.565022174 0.500000000 0.500000000 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wbse.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wbse_init_control: 46 | wbse_init_calculation: S 47 | solver: TDDFT 48 | 49 | wbse_control: 50 | wbse_calculation: D 51 | n_liouville_eigen: 4 52 | n_liouville_times: 10 53 | trev_liouville: 0.00000001 54 | trev_liouville_rel: 0.000001 55 | l_pre_shift: True 56 | EOF 57 | 58 | 59 | cat > westpp.in << EOF 60 | input_west: 61 | qe_prefix: test 62 | west_prefix: test 63 | outdir: ./ 64 | 65 | westpp_control: 66 | westpp_calculation: C 67 | westpp_range: [1,4] 68 | westpp_n_liouville_to_use: 4 69 | westpp_l_compute_tdm: True 70 | EOF 71 | -------------------------------------------------------------------------------- /Libraries/Base64/cbase64.h: -------------------------------------------------------------------------------- 1 | /* 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. It is created based on Base64Transcoder.h in Qbox 9 | ! 10 | ! Contributors to this file: 11 | ! Huihuo Zheng 12 | */ 13 | #include 14 | typedef unsigned char byte; 15 | 16 | char etable[64]; // encode table 17 | byte dtable[256]; // decode table 18 | 19 | void b64init(); 20 | 21 | int encode(int nbytes, const byte* const from, char* const to); 22 | 23 | int encode_complex(double complex* from, int n, char* const to) { 24 | // n -- dimension of complex array 25 | int nbytes=sizeof(double complex)*n; 26 | return encode(nbytes, (byte*) from, to); 27 | } 28 | 29 | int encode_double(double* from, int n, char* const to) { 30 | // n -- dimension of array 31 | int nbytes=sizeof(double)*n; 32 | return encode(nbytes, (byte*) from, to); 33 | } 34 | 35 | int decode(int nc, const char* const from, byte* const to ); 36 | 37 | void byteswap_double(int nbytes, double* const x); 38 | 39 | void byteswap_complex(int nbytes, double complex* const x) { 40 | byteswap_double(nbytes, (double*) x); 41 | }; 42 | 43 | int nchars(int nbytes) { return 4*((nbytes + 2) / 3 ); } 44 | 45 | int nbytes(int nc) { return 3*nc/4; } 46 | 47 | int decode_double(const char* const from, int n, double* to ) { 48 | int nb = sizeof(double)*n; 49 | int nc=nchars(nb); 50 | return decode(nc, from, (byte*) to); 51 | }; 52 | 53 | int decode_complex(const char* const from, int n, double complex* to ) { 54 | int nc=nchars(sizeof(double complex)*n); 55 | return decode(nc, from, (byte*) to); 56 | }; 57 | -------------------------------------------------------------------------------- /test-suite/test021/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 5 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 6 | 7 | cat > pw.in << EOF 8 | &control 9 | calculation = 'scf' 10 | restart_mode = 'from_scratch' 11 | pseudo_dir = './' 12 | outdir = './' 13 | prefix = 'test' 14 | / 15 | &system 16 | ibrav = 1 17 | celldm(1) = 20 18 | nat = 4 19 | ntyp = 3 20 | ecutwfc = 25 21 | nbnd = 30 22 | input_dft = 'pbe0' 23 | / 24 | &electrons 25 | diago_full_acc = .true. 26 | / 27 | ATOMIC_SPECIES 28 | C 12.0107 C_ONCV_PBE-1.2.upf 29 | H 1.0079 H_ONCV_PBE-1.2.upf 30 | O 16.00 O_ONCV_PBE-1.2.upf 31 | ATOMIC_POSITIONS crystal 32 | C 0.452400000 0.500000000 0.500000000 33 | H 0.397141530 0.411608770 0.500000000 34 | H 0.397141530 0.588391230 0.500000000 35 | O 0.565022174 0.500000000 0.500000000 36 | K_POINTS gamma 37 | EOF 38 | 39 | 40 | cat > wbse_init.in << EOF 41 | input_west: 42 | qe_prefix: test 43 | west_prefix: test 44 | outdir: ./ 45 | 46 | wbse_init_control: 47 | wbse_init_calculation: S 48 | solver: TDDFT 49 | EOF 50 | 51 | 52 | cat > wbse.in << EOF 53 | input_west: 54 | qe_prefix: test 55 | west_prefix: test 56 | outdir: ./ 57 | 58 | wbse_init_control: 59 | wbse_init_calculation: S 60 | solver: TDDFT 61 | 62 | wbse_control: 63 | wbse_calculation: D 64 | n_liouville_eigen: 4 65 | n_liouville_times: 10 66 | trev_liouville: 0.00000001 67 | trev_liouville_rel: 0.000001 68 | l_pre_shift: True 69 | l_forces: True 70 | forces_state: 1 71 | EOF 72 | -------------------------------------------------------------------------------- /Tools/set_dirs.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE set_dirs( ) 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE io_files, ONLY : tmp_dir 18 | USE westcom, ONLY : west_prefix, wstat_save_dir, wstat_restart_dir, & 19 | & westpp_save_dir, wfreq_save_dir, wfreq_restart_dir, & 20 | & wbse_init_save_dir, wbse_init_restart_dir, & 21 | & wbse_save_dir, wbse_restart_dir 22 | ! 23 | IMPLICIT NONE 24 | ! 25 | wstat_save_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.wstat.save' 26 | wstat_restart_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.wstat.restart' 27 | wfreq_save_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.wfreq.save' 28 | wfreq_restart_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.wfreq.restart' 29 | westpp_save_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.westpp.save' 30 | wbse_init_save_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.wbse_init.save' 31 | wbse_init_restart_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.wbse_init.restart' 32 | wbse_save_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.wbse.save' 33 | wbse_restart_dir = TRIM( tmp_dir ) // TRIM( west_prefix ) // '.wbse.restart' 34 | ! 35 | END SUBROUTINE 36 | -------------------------------------------------------------------------------- /test-suite/test017/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | Si 28.0855 Si_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS bohr 30 | Si 10.000000 10.000000 10.000000 31 | H 11.614581 11.614581 11.614581 32 | H 8.385418 8.385418 11.614581 33 | H 8.385418 11.614581 8.385418 34 | H 11.614581 8.385418 8.385418 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wstat_control: 46 | wstat_calculation: S 47 | n_pdep_eigen: 50 48 | EOF 49 | 50 | 51 | cat > wbse_init.in << EOF 52 | input_west: 53 | qe_prefix: test 54 | west_prefix: test 55 | outdir: ./ 56 | 57 | wbse_init_control: 58 | wbse_init_calculation: S 59 | bse_method: PDEP 60 | n_pdep_eigen_to_use: 50 61 | EOF 62 | 63 | 64 | cat > wbse.in << EOF 65 | input_west: 66 | qe_prefix: test 67 | west_prefix: test 68 | outdir: ./ 69 | 70 | wbse_init_control: 71 | wbse_init_calculation: S 72 | bse_method: PDEP 73 | n_pdep_eigen_to_use: 50 74 | 75 | wbse_control: 76 | wbse_calculation: D 77 | scissor_ope: 0.4476 78 | n_liouville_eigen: 10 79 | EOF 80 | -------------------------------------------------------------------------------- /test-suite/test008/test_wannier.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import json 3 | 4 | 5 | def read_trans_matrix_from_json(fileName): 6 | """ 7 | Read unitary transformation matrix from JSON file. 8 | """ 9 | 10 | with open(fileName, "r") as f: 11 | raw_ = json.load(f) 12 | 13 | return np.array(raw_["output"]["B"]["K000001"]["trans_matrix"], dtype=float) 14 | 15 | 16 | def read_wannier_center_from_json(fileName): 17 | """ 18 | Read Wannier centers from JSON file. 19 | """ 20 | 21 | with open(fileName, "r") as f: 22 | raw_ = json.load(f) 23 | 24 | return np.array(raw_["output"]["B"]["K000001"]["wan_center"], dtype=float) 25 | 26 | 27 | def test_trans_matrix(): 28 | """ 29 | Test unitary transformation matrix. 30 | """ 31 | # get parameters from JSON file 32 | with open("./parameters.json", "r") as f: 33 | parameters = json.load(f) 34 | 35 | ref_trans = read_trans_matrix_from_json("./test008/ref/westpp.json") 36 | test_trans = read_trans_matrix_from_json("./test008/test.westpp.save/westpp.json") 37 | 38 | np.testing.assert_almost_equal( 39 | np.abs(ref_trans), 40 | np.abs(test_trans), 41 | decimal=-np.log10(float(parameters["tolerance"]["westpp"])), 42 | ) 43 | 44 | 45 | def test_wannier_center(): 46 | """ 47 | Test Wannier centers. 48 | """ 49 | # get parameters from JSON file 50 | with open("./parameters.json", "r") as f: 51 | parameters = json.load(f) 52 | 53 | ref_wanc = read_wannier_center_from_json("./test008/ref/westpp.json") 54 | test_wanc = read_wannier_center_from_json("./test008/test.westpp.save/westpp.json") 55 | 56 | np.testing.assert_almost_equal( 57 | ref_wanc, 58 | test_wanc, 59 | decimal=-np.log10(float(parameters["tolerance"]["westpp"])), 60 | ) 61 | -------------------------------------------------------------------------------- /test-suite/test016/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 1 16 | celldm(1) = 20 17 | nat = 5 18 | ntyp = 2 19 | ecutwfc = 25 20 | nbnd = 10 21 | assume_isolated = 'mp' 22 | / 23 | &electrons 24 | diago_full_acc = .true. 25 | / 26 | ATOMIC_SPECIES 27 | Si 28.0855 Si_ONCV_PBE-1.2.upf 28 | H 1.00794 H_ONCV_PBE-1.2.upf 29 | ATOMIC_POSITIONS bohr 30 | Si 10.000000 10.000000 10.000000 31 | H 11.614581 11.614581 11.614581 32 | H 8.385418 8.385418 11.614581 33 | H 8.385418 11.614581 8.385418 34 | H 11.614581 8.385418 8.385418 35 | K_POINTS gamma 36 | EOF 37 | 38 | 39 | cat > wstat.in << EOF 40 | input_west: 41 | qe_prefix: test 42 | west_prefix: test 43 | outdir: ./ 44 | 45 | wstat_control: 46 | wstat_calculation: S 47 | n_pdep_eigen: 50 48 | EOF 49 | 50 | 51 | cat > wbse_init.in << EOF 52 | input_west: 53 | qe_prefix: test 54 | west_prefix: test 55 | outdir: ./ 56 | 57 | wbse_init_control: 58 | wbse_init_calculation: S 59 | bse_method: PDEP 60 | n_pdep_eigen_to_use: 50 61 | EOF 62 | 63 | 64 | cat > wbse.in << EOF 65 | input_west: 66 | qe_prefix: test 67 | west_prefix: test 68 | outdir: ./ 69 | 70 | wbse_init_control: 71 | wbse_init_calculation: S 72 | bse_method: PDEP 73 | n_pdep_eigen_to_use: 50 74 | 75 | wbse_control: 76 | wbse_calculation: L 77 | l_dipole_realspace: True 78 | scissor_ope: 0.4476 79 | n_lanczos: 200 80 | EOF 81 | -------------------------------------------------------------------------------- /Tools/set_eprec.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE set_eprec(m,wfc,eprec) 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! Set eprec, for precondiconditioning 18 | ! 19 | USE kinds, ONLY : DP 20 | USE wvfct, ONLY : g2kin 21 | USE noncollin_module, ONLY : noncolin,npol 22 | USE pwcom, ONLY : npw,npwx 23 | USE mp, ONLY : mp_sum 24 | USE mp_global, ONLY : intra_bgrp_comm 25 | ! 26 | IMPLICIT NONE 27 | ! 28 | ! I/O 29 | ! 30 | INTEGER,INTENT(IN) :: m 31 | COMPLEX(DP),INTENT(IN) :: wfc(npwx*npol,m) 32 | REAL(DP),INTENT(OUT) :: eprec(m) 33 | ! 34 | ! Workspace 35 | ! 36 | INTEGER :: ibnd,ig 37 | REAL(DP) :: reduce 38 | REAL(DP),PARAMETER :: factor = 1.35_DP 39 | ! 40 | !$acc parallel vector_length(1024) present(wfc,g2kin,eprec) 41 | !$acc loop 42 | DO ibnd = 1,m 43 | reduce = 0._DP 44 | !$acc loop reduction(+:reduce) 45 | DO ig = 1,npw 46 | reduce = reduce+CONJG(wfc(ig,ibnd))*wfc(ig,ibnd)*g2kin(ig) 47 | IF(noncolin) THEN 48 | reduce = reduce+CONJG(wfc(ig+npwx,ibnd))*wfc(ig+npwx,ibnd)*g2kin(ig) 49 | ENDIF 50 | ENDDO 51 | eprec(ibnd) = reduce*factor 52 | ENDDO 53 | !$acc end parallel 54 | ! 55 | !$acc host_data use_device(eprec) 56 | CALL mp_sum(eprec,intra_bgrp_comm) 57 | !$acc end host_data 58 | ! 59 | END SUBROUTINE 60 | -------------------------------------------------------------------------------- /test-suite/test008/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Mg_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/O_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 0 16 | nat = 15 17 | ntyp = 2 18 | ecutwfc = 20 19 | nbnd = 80 20 | / 21 | &electrons 22 | / 23 | ATOMIC_SPECIES 24 | Mg 24.3050 Mg_ONCV_PBE-1.2.upf 25 | O 15.9994 O_ONCV_PBE-1.2.upf 26 | ATOMIC_POSITIONS crystal 27 | Mg 0.000000000 0.000000000 0.000000000 28 | Mg -0.002103461 -0.002103461 0.502103461 29 | Mg -0.002103461 0.502103461 -0.002103461 30 | Mg -0.002103461 0.502103461 0.502103461 31 | Mg 0.502103461 -0.002103461 -0.002103461 32 | Mg 0.502103461 -0.002103461 0.502103461 33 | Mg 0.502103461 0.502103461 -0.002103461 34 | Mg 0.500000000 0.500000000 0.500000000 35 | O 0.250000000 0.250000000 0.750000000 36 | O 0.250000000 0.750000000 0.250000000 37 | O 0.250000000 0.750000000 0.750000000 38 | O 0.750000000 0.250000000 0.250000000 39 | O 0.750000000 0.250000000 0.750000000 40 | O 0.750000000 0.750000000 0.250000000 41 | O 0.750000000 0.750000000 0.750000000 42 | K_POINTS gamma 43 | CELL_PARAMETERS angstrom 44 | 0.000000 4.249236 4.249236 45 | 4.249236 0.000000 4.249236 46 | 4.249236 4.249236 0.000000 47 | EOF 48 | 49 | 50 | cat > westpp.in << EOF 51 | input_west: 52 | qe_prefix: test 53 | west_prefix: test 54 | outdir: ./ 55 | 56 | westpp_control: 57 | westpp_calculation: LBD 58 | westpp_range: [61,80] 59 | westpp_box: [4.015, 12.045, 4.015, 12.045, 0.00, 8.03] 60 | EOF 61 | -------------------------------------------------------------------------------- /Pytools/west_read_bse.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # 4 | # Copyright (C) 2015-2025 M. Govoni 5 | # This file is distributed under the terms of the 6 | # GNU General Public License. See the file `License' 7 | # in the root directory of the present distribution, 8 | # or http://www.gnu.org/copyleft/gpl.txt . 9 | # 10 | # This file is part of WEST. 11 | # 12 | 13 | import h5py 14 | import numpy as np 15 | 16 | 17 | def bse_read_qb_param(*args, **kwargs): 18 | # 19 | fileName = args[0] 20 | # 21 | data = {} 22 | # 23 | with h5py.File(fileName, "r") as f: 24 | data["nwfcs"] = f["wfcs"].attrs.get("nwfcs") 25 | data["nx"] = f["wfcs"].attrs.get("nx") 26 | data["ny"] = f["wfcs"].attrs.get("ny") 27 | data["nz"] = f["wfcs"].attrs.get("nz") 28 | # return dictionary 29 | return data 30 | 31 | 32 | def bse_read_qb_wfc(*args, **kwargs): 33 | # 34 | fileName = args[0] 35 | iwfc = int(args[1]) 36 | # 37 | with h5py.File(fileName, "r") as f: 38 | wfc = f[f"wfcs/wfc{iwfc}"][:] 39 | # return numpy ndarray 40 | return wfc 41 | 42 | 43 | def test(): 44 | # 45 | fileName = "qb_wfc.1" 46 | nwfcs = 4 47 | nx = 30 48 | ny = 30 49 | nz = 30 50 | data = np.ones(nx * ny * nz, dtype="float64") 51 | # 52 | with h5py.File(fileName, "w") as f: 53 | # metadata 54 | wfcs = f.create_group("wfcs") 55 | wfcs.attrs.create("nwfcs", nwfcs) 56 | wfcs.attrs.create("nx", nx) 57 | wfcs.attrs.create("ny", ny) 58 | wfcs.attrs.create("nz", nz) 59 | # data 60 | for iwfc in range(nwfcs): 61 | wfcs.create_dataset(f"wfc{iwfc+1}", data=data) 62 | # 63 | print(bse_read_qb_param(fileName)) 64 | print(bse_read_qb_wfc(fileName, 1)) 65 | 66 | 67 | if __name__ == "__main__": 68 | # execute only if run as a script 69 | test() 70 | -------------------------------------------------------------------------------- /Doc/tutorial.rst: -------------------------------------------------------------------------------- 1 | .. _tutorial: 2 | 3 | Tutorials 4 | ========= 5 | 6 | The following tutorials demonstrate how to utilize core features of **WEST**. 7 | 8 | Intro tutorials: 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | 13 | tutorials/basic/basic_001.ipynb 14 | tutorials/basic/basic_002.ipynb 15 | tutorials/basic/basic_003.ipynb 16 | tutorials/basic/basic_004.ipynb 17 | tutorials/basic/basic_005.ipynb 18 | tutorials/basic/basic_006.ipynb 19 | tutorials/basic/basic_007.ipynb 20 | tutorials/basic/basic_008.ipynb 21 | tutorials/basic/basic_009.ipynb 22 | tutorials/basic/basic_010.ipynb 23 | tutorials/basic/basic_011.ipynb 24 | tutorials/basic/basic_012.ipynb 25 | tutorials/basic/basic_013.ipynb 26 | 27 | Advanced tutorials: 28 | 29 | .. toctree:: 30 | :maxdepth: 1 31 | 32 | tutorials/advanced/advanced_001.ipynb 33 | tutorials/advanced/advanced_002.ipynb 34 | tutorials/advanced/advanced_003.ipynb 35 | tutorials/advanced/advanced_004.ipynb 36 | 37 | The following tutorials were used in `MICCoM Workshop & Hands-on Tutorials 2022 `_: 38 | 39 | .. toctree:: 40 | :maxdepth: 1 41 | 42 | tutorials/MICCoM_School_2022/miccom_000.ipynb 43 | tutorials/MICCoM_School_2022/miccom_001.ipynb 44 | tutorials/MICCoM_School_2022/miccom_002.ipynb 45 | tutorials/MICCoM_School_2022/miccom_003.ipynb 46 | 47 | The following tutorials were used in `MICCoM Computational School 2017 `_: 48 | 49 | .. toctree:: 50 | :maxdepth: 1 51 | 52 | tutorials/MICCoM_School_2017/miccom_000.ipynb 53 | tutorials/MICCoM_School_2017/miccom_001.ipynb 54 | tutorials/MICCoM_School_2017/miccom_002.ipynb 55 | tutorials/MICCoM_School_2017/miccom_003.ipynb 56 | tutorials/MICCoM_School_2017/miccom_004.ipynb 57 | tutorials/MICCoM_School_2017/miccom_005.ipynb 58 | tutorials/MICCoM_School_2017/miccom_006.ipynb 59 | -------------------------------------------------------------------------------- /Wfreq/set_freqlists.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE set_freqlists() 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! ... This subroutine sets both the real and im freq lists 18 | ! 19 | USE kinds, ONLY : DP 20 | USE westcom, ONLY : ecut_imfreq,imfreq_list,n_imfreq,frequency_list_power,& 21 | & ecut_refreq,refreq_list,n_refreq 22 | USE distribution_center, ONLY : ifr,rfr 23 | ! 24 | IMPLICIT NONE 25 | ! 26 | ! Workspace 27 | ! 28 | INTEGER :: ifreq,glob_ifreq 29 | ! 30 | REAL(DP) :: p,y 31 | ! 32 | ! Im Freq 33 | ! 34 | IF(ALLOCATED(imfreq_list)) DEALLOCATE(imfreq_list) 35 | ALLOCATE(imfreq_list(ifr%nloc)) 36 | ! 37 | ! freq_n = p * ( y_n ** (-1/alpha) -1 ) 38 | ! y_n = 1 - (i-1)/N 39 | ! p = Ec / ( N**(1/alpha)-1 ) 40 | ! 41 | p = ecut_imfreq / ( REAL( n_imfreq, KIND=DP)**(1._DP/frequency_list_power) - 1._DP ) 42 | ! 43 | DO ifreq = 1, ifr%nloc 44 | glob_ifreq = ifr%l2g(ifreq) 45 | ! 46 | y = 1._DP - REAL( glob_ifreq-1, KIND=DP) / REAL(n_imfreq, KIND=DP) 47 | imfreq_list(ifreq) = p * ( y**(-1._DP/frequency_list_power) - 1._DP ) 48 | ! 49 | ENDDO 50 | ! 51 | ! Re Freq 52 | ! 53 | IF(ALLOCATED(refreq_list)) DEALLOCATE(refreq_list) 54 | ALLOCATE(refreq_list(rfr%nloc)) 55 | ! 56 | DO ifreq = 1, rfr%nloc 57 | glob_ifreq = rfr%l2g(ifreq) 58 | ! 59 | refreq_list(ifreq) = ecut_refreq / REAL(n_refreq-1,KIND=DP) * REAL(glob_ifreq-1,KIND=DP) 60 | ! 61 | ENDDO 62 | ! 63 | END SUBROUTINE 64 | -------------------------------------------------------------------------------- /Westpp/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Westpp 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../../PW/src \ 8 | $(MOD_FLAG)../Coulomb_kernel \ 9 | $(MOD_FLAG)../FFT_kernel \ 10 | $(MOD_FLAG)../IO_kernel \ 11 | $(MOD_FLAG)../Libraries/Json \ 12 | $(MOD_FLAG)../Modules \ 13 | $(MOD_FLAG)../Para_kernel \ 14 | $(MOD_FLAG)../Tools \ 15 | $(MOD_FLAG). 16 | 17 | WESTPP_OBJS = \ 18 | do_dip.o \ 19 | do_eigenpot2.o \ 20 | do_exc.o \ 21 | do_exc_comp.o \ 22 | do_exc_spin.o \ 23 | do_rho.o \ 24 | do_sxx.o \ 25 | do_wann.o \ 26 | do_wfc2.o \ 27 | do_loc.o \ 28 | do_resp.o \ 29 | dump_r.o \ 30 | westpp.o \ 31 | westpp_setup.o \ 32 | write_wfc_1d_r.o \ 33 | write_wfc_spav.o 34 | 35 | PWOBJS = ../../PW/src/libpw.a 36 | 37 | QEMODS = ../../KS_Solvers/libks_solvers.a ../../dft-d3/libdftd3qe.a $(BASEMODS) 38 | 39 | WESTLIBS = \ 40 | ../Wbse/libwbse.a \ 41 | ../IO_kernel/lib_io_kernel.a \ 42 | ../DFPT_kernel/lib_dfpt_kernel.a \ 43 | ../Hamiltonian_kernel/lib_hamiltonian_kernel.a \ 44 | ../Para_kernel/lib_para_kernel.a \ 45 | ../Coulomb_kernel/lib_coulomb_kernel.a \ 46 | ../FFT_kernel/lib_fft_kernel.a \ 47 | ../Tools/libtools.a \ 48 | ../Modules/libmodules.a \ 49 | ../Libraries/Forpy/libforpy.a \ 50 | ../Libraries/Json/libjson.a \ 51 | ../Libraries/Base64/libbase64.a 52 | 53 | TLDEPS = bindir mods pwlibs pw 54 | 55 | all : title tldeps westpp.x 56 | 57 | westpp.x : $(WESTPP_OBJS) $(WESTLIBS) $(PWOBJS) $(QEMODS) 58 | $(LD) $(LDFLAGS) -o $@ $^ $(QELIBS) $(PYT_LDFLAGS) 59 | - ( cd ../../bin ; ln -fs ../West/Westpp/westpp.x . ) 60 | 61 | tldeps : 62 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 63 | 64 | clean : 65 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 66 | - /bin/rm -f ../../bin/westpp.x 67 | 68 | title : 69 | @echo 70 | @echo "##############" 71 | @echo "### Westpp ###" 72 | @echo "##############" 73 | @echo 74 | 75 | include make.depend 76 | -------------------------------------------------------------------------------- /Doc/installations/dgx.rst: -------------------------------------------------------------------------------- 1 | .. _dgx: 2 | 3 | =============== 4 | NVIDIA DGX A100 5 | =============== 6 | 7 | The following instructions have been tested on an NVIDIA DGX A100 machine. 8 | 9 | Requirements: 10 | 11 | - NVIDIA HPC SDK (23.5) 12 | - Python3 13 | 14 | To download and install NVIDIA HPC SDK, do: 15 | 16 | .. code-block:: bash 17 | 18 | $ wget https://developer.download.nvidia.com/hpc-sdk/23.5/nvhpc_2023_235_Linux_x86_64_cuda_multi.tar.gz 19 | $ tar xpzf nvhpc_2023_235_Linux_x86_64_cuda_multi.tar.gz 20 | $ nvhpc_2023_235_Linux_x86_64_cuda_multi/install 21 | 22 | Building WEST 23 | ~~~~~~~~~~~~~ 24 | 25 | WEST executables can be compiled using the following script: 26 | 27 | .. code-block:: bash 28 | 29 | $ cat build_west.sh 30 | #!/bin/bash 31 | 32 | export LD_LIBRARY_PATH=/path/to/nvidia/hpc_sdk/Linux_x86_64/23.5/compilers/lib:$LD_LIBRARY_PATH 33 | export LD_LIBRARY_PATH=/path/to/nvidia/hpc_sdk/Linux_x86_64/23.5/comm_libs/11.8/openmpi4/openmpi-4.1.5/lib:$LD_LIBRARY_PATH 34 | export LD_LIBRARY_PATH=/path/to/nvidia/hpc_sdk/Linux_x86_64/23.5/cuda/11.8/targets/x86_64-linux/lib:$LD_LIBRARY_PATH 35 | export PATH=/path/to/nvidia/hpc_sdk/Linux_x86_64/23.5/compilers/bin:$PATH 36 | export PATH=/path/to/nvidia/hpc_sdk/Linux_x86_64/23.5/comm_libs/11.8/openmpi4/openmpi-4.1.5/bin:$PATH 37 | export SCALAPACK_LIBS=/path/to/nvidia/hpc_sdk/Linux_x86_64/23.5/comm_libs/11.8/openmpi4/openmpi-4.1.5/lib/libscalapack.a 38 | 39 | ./configure --with-cuda=/path/to/nvidia/hpc_sdk/Linux_x86_64/23.5/cuda/11.8 --with-cuda-cc=80 --with-cuda-runtime=11.8 40 | 41 | make -j 8 pw 42 | 43 | cd West 44 | 45 | make conf PYT=python3 PYT_LDFLAGS="-L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8" 46 | make -j 8 all 47 | 48 | To use the script do: 49 | 50 | .. code-block:: bash 51 | 52 | $ bash build_west.sh 53 | 54 | Running WEST 55 | ~~~~~~~~~~~~ 56 | 57 | We can run the `wstat.x` WEST executables on 2 GPUs using the following command: 58 | 59 | .. code-block:: bash 60 | 61 | $ export OMP_NUM_THREADS=1 62 | $ mpirun -np 2 ./wstat.x -i wstat.in > wstat.out 63 | -------------------------------------------------------------------------------- /Wstat/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Wstat 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../../PW/src \ 8 | $(MOD_FLAG)../Coulomb_kernel \ 9 | $(MOD_FLAG)../DFPT_kernel \ 10 | $(MOD_FLAG)../FFT_kernel \ 11 | $(MOD_FLAG)../IO_kernel \ 12 | $(MOD_FLAG)../Libraries/Base64 \ 13 | $(MOD_FLAG)../Libraries/Forpy \ 14 | $(MOD_FLAG)../Libraries/Json \ 15 | $(MOD_FLAG)../Modules \ 16 | $(MOD_FLAG)../Para_kernel \ 17 | $(MOD_FLAG)../Tools \ 18 | $(MOD_FLAG). 19 | 20 | WSTAT_OBJS = \ 21 | apply_operator.o \ 22 | davidson_diago.o \ 23 | davidson_restart.o \ 24 | wstat.o \ 25 | wstat_memory_report.o \ 26 | wstat_setup.o \ 27 | wstat_tools.o 28 | 29 | PWOBJS = ../../PW/src/libpw.a 30 | 31 | QEMODS = ../../KS_Solvers/libks_solvers.a ../../dft-d3/libdftd3qe.a $(BASEMODS) 32 | 33 | WESTLIBS = \ 34 | ../IO_kernel/lib_io_kernel.a \ 35 | ../DFPT_kernel/lib_dfpt_kernel.a \ 36 | ../Hamiltonian_kernel/lib_hamiltonian_kernel.a \ 37 | ../Para_kernel/lib_para_kernel.a \ 38 | ../Coulomb_kernel/lib_coulomb_kernel.a \ 39 | ../FFT_kernel/lib_fft_kernel.a \ 40 | ../Tools/libtools.a \ 41 | ../Modules/libmodules.a \ 42 | ../Libraries/Forpy/libforpy.a \ 43 | ../Libraries/Json/libjson.a \ 44 | ../Libraries/Base64/libbase64.a 45 | 46 | TLDEPS = bindir mods pwlibs pw 47 | 48 | all : title tldeps wstat.x libwstat.a 49 | 50 | wstat.x : $(WSTAT_OBJS) $(WESTLIBS) $(PWOBJS) $(QEMODS) 51 | $(LD) $(LDFLAGS) -o $@ $^ $(QELIBS) $(PYT_LDFLAGS) 52 | - ( cd ../../bin ; ln -fs ../West/Wstat/wstat.x . ) 53 | 54 | tldeps : 55 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 56 | 57 | libwstat.a : $(WSTAT_OBJS) 58 | $(AR) $(ARFLAGS) $@ $? 59 | $(RANLIB) $@ 60 | 61 | clean : 62 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 63 | - /bin/rm -f ../../bin/wstat.x 64 | 65 | title : 66 | @echo 67 | @echo "##############" 68 | @echo "### Wstat ####" 69 | @echo "##############" 70 | @echo 71 | 72 | include make.depend 73 | -------------------------------------------------------------------------------- /.github/workflows/nightly.yml: -------------------------------------------------------------------------------- 1 | name: Nightly CI 2 | 3 | on: 4 | schedule: 5 | - cron: "0 4 * * *" 6 | 7 | env: 8 | QE_VERSION: qe-7.4.1 9 | 10 | jobs: 11 | test: 12 | runs-on: [self-hosted, linux] 13 | container: miccomcenter/bot:gcc1330_0002 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | with: 18 | path: West 19 | - name: Build QE 20 | run: | 21 | rm -rf qe 22 | git clone -b $QE_VERSION --single-branch --depth 1 https://gitlab.com/QEF/q-e.git qe 23 | cd qe 24 | git describe --tags --always 25 | ./configure 26 | make -j8 pw 27 | ls bin 28 | - name: Build WEST 29 | id: west 30 | run: | 31 | pip3 install -q -U pip 32 | pip3 install -q -U numpy 33 | pip3 install -q -U pytest 34 | pip3 install -q -U setuptools 35 | mv West qe 36 | cd qe/West 37 | git describe --tags --always 38 | make conf PYT=python3 PYT_LDFLAGS="`python3-config --ldflags --embed`" 39 | make -j8 all 40 | ls ../bin 41 | - name: Test images 42 | if: steps.west.outcome == 'success' 43 | run: | 44 | cp -r qe/West/test-suite qe/West/test-ni 45 | cd qe/West/test-ni 46 | make clean 47 | make NP=8 NI=2 48 | - name: Test pools 49 | if: steps.west.outcome == 'success' 50 | run: | 51 | cp -r qe/West/test-suite qe/West/test-nk 52 | cd qe/West/test-nk 53 | make clean 54 | make NP=8 NK=2 55 | - name: Test band groups 56 | if: steps.west.outcome == 'success' 57 | run: | 58 | cp -r qe/West/test-suite qe/West/test-nb 59 | cd qe/West/test-nb 60 | make clean 61 | make NP=8 NB=2 62 | - name: Archive artifacts 63 | uses: actions/upload-artifact@v4 64 | if: '!success()' 65 | with: 66 | name: artifacts 67 | path: | 68 | qe/West/test-*/test*/*.out 69 | qe/West/test-*/test*/*.err 70 | qe/West/test-*/test*/*.xml 71 | qe/West/test-*/test*/test*/w*.json 72 | retention-days: 1 73 | -------------------------------------------------------------------------------- /Wfreq/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Wfreq 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../../PW/src \ 8 | $(MOD_FLAG)../Coulomb_kernel \ 9 | $(MOD_FLAG)../FFT_kernel \ 10 | $(MOD_FLAG)../IO_kernel \ 11 | $(MOD_FLAG)../Libraries/Base64 \ 12 | $(MOD_FLAG)../Libraries/Json \ 13 | $(MOD_FLAG)../Modules \ 14 | $(MOD_FLAG)../Para_kernel \ 15 | $(MOD_FLAG)../Tools \ 16 | $(MOD_FLAG). 17 | 18 | WFREQ_OBJS = \ 19 | calc_corr.o \ 20 | calc_exx2.o \ 21 | calc_vxc.o \ 22 | chi_invert.o \ 23 | diago_lanczos.o \ 24 | get_brak_hyper_parallel.o \ 25 | set_freqlists.o \ 26 | solve_deflated_lanczos_w_full_ortho.o \ 27 | solve_eri.o \ 28 | solve_gfreq.o \ 29 | solve_h1e.o \ 30 | solve_hf.o \ 31 | solve_qp.o \ 32 | solve_wfreq.o \ 33 | wfreq.o \ 34 | wfreq_memory_report.o \ 35 | wfreq_setup.o 36 | 37 | PWOBJS = ../../PW/src/libpw.a 38 | 39 | QEMODS = ../../KS_Solvers/libks_solvers.a ../../dft-d3/libdftd3qe.a $(BASEMODS) 40 | 41 | WESTLIBS = \ 42 | ../IO_kernel/lib_io_kernel.a \ 43 | ../DFPT_kernel/lib_dfpt_kernel.a \ 44 | ../Hamiltonian_kernel/lib_hamiltonian_kernel.a \ 45 | ../Para_kernel/lib_para_kernel.a \ 46 | ../Coulomb_kernel/lib_coulomb_kernel.a \ 47 | ../FFT_kernel/lib_fft_kernel.a \ 48 | ../Tools/libtools.a \ 49 | ../Modules/libmodules.a \ 50 | ../Libraries/Forpy/libforpy.a \ 51 | ../Libraries/Json/libjson.a \ 52 | ../Libraries/Base64/libbase64.a 53 | 54 | TLDEPS = bindir mods pwlibs pw 55 | 56 | all : title tldeps wfreq.x 57 | 58 | wfreq.x : $(WFREQ_OBJS) $(WESTLIBS) $(PWOBJS) $(QEMODS) 59 | $(LD) $(LDFLAGS) -o $@ $^ $(QELIBS) ${PYT_LDFLAGS} 60 | - ( cd ../../bin ; ln -fs ../West/Wfreq/wfreq.x . ) 61 | 62 | tldeps : 63 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 64 | 65 | clean : 66 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 67 | - /bin/rm -f ../../bin/wfreq.x 68 | 69 | title : 70 | @echo 71 | @echo "##############" 72 | @echo "### Wfreq ####" 73 | @echo "##############" 74 | @echo 75 | 76 | include make.depend 77 | -------------------------------------------------------------------------------- /Modules/west_version.f90.in: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2024 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `LICENSE' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | MODULE west_version 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE forpy_mod, ONLY: list 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | CHARACTER(LEN=*), PARAMETER :: west_version_number = 'checkit' 22 | CHARACTER(LEN=*), PARAMETER :: west_git_revision = 'unknown' 23 | CHARACTER(LEN=*), PARAMETER :: west_topdir = 'unset' 24 | LOGICAL, PARAMETER :: forpy_use_numpy = .TRUE. 25 | TYPE(list) :: paths 26 | ! 27 | CONTAINS 28 | ! 29 | SUBROUTINE start_forpy() 30 | ! 31 | USE forpy_mod, ONLY: forpy_initialize,get_sys_path,module_py,import_py,forpy_finalize 32 | ! 33 | IMPLICIT NONE 34 | ! 35 | INTEGER :: IERR 36 | TYPE(module_py) :: pymod 37 | ! 38 | IERR = forpy_initialize(forpy_use_numpy) 39 | IF(IERR /= 0) CALL errore('forpy','Err: cannot init forpy',1) 40 | ! 41 | IERR = get_sys_path(paths) 42 | IF(IERR /= 0) CALL errore('forpy','Err: cannot get_sys_path',1) 43 | ! 44 | IERR = paths%append(TRIM(ADJUSTL(west_topdir))//"/Pytools") 45 | IF(IERR /= 0) CALL errore('forpy','Err: cannot append paths',1) 46 | ! 47 | ! Test: import west_fetch_input 48 | ! 49 | IERR = import_py(pymod,'west_fetch_input') 50 | IF(IERR /= 0) THEN 51 | CALL forpy_finalize() 52 | CALL errore('forpy','Err: cannot import module',1) 53 | ENDIF 54 | ! 55 | END SUBROUTINE 56 | ! 57 | SUBROUTINE end_forpy() 58 | ! 59 | USE forpy_mod, ONLY: forpy_finalize 60 | ! 61 | IMPLICIT NONE 62 | ! 63 | CALL paths%destroy() 64 | CALL forpy_finalize() 65 | ! 66 | END SUBROUTINE 67 | ! 68 | END MODULE 69 | -------------------------------------------------------------------------------- /test-suite/README.md: -------------------------------------------------------------------------------- 1 | # WEST test-suite 2 | 3 | ## List of tests 4 | 5 | 1. SiH4 molecule, GW, Gamma only 6 | 2. CH4 molecule, GW, Gamma only, JSON input 7 | 3. CH4 molecule, spin-polarized GW, Gamma only 8 | 4. Si bulk, GW, k-mesh 1x1x2 9 | 5. SiH4 molecule, westpp output PDEP, Gamma only 10 | 6. SiH4 molecule, GW hybrid ACE, Gamma only 11 | 7. Si bulk, GW hybrid ACE, k-mesh 1x1x2 12 | 8. MgO, westpp localization factor, Wannier localization, dipole moment, Gamma only 13 | 9. O2 molecule, GW fractional occupation, Gamma only 14 | 10. SiH4 molecule, GW `l_off_diagonal`, Gamma only 15 | 11. SiH4 molecule, GW `qp_bands`, Gamma only 16 | 12. SiH4 molecule, QDET, Gamma only 17 | 13. SiH4 molecule, QDET verbosity, Gamma only 18 | 14. NV- diamond, spin-polarized QDET, Gamma only 19 | 15. SiH4 molecule, GW hybrid no ACE, Gamma only 20 | 16. SiH4 molecule, BSE Lanczos, Gamma only 21 | 17. SiH4 molecule, BSE Davidson, Gamma only 22 | 18. SiH4 molecule, TDDFT (PBE0) Lanczos, Gamma only 23 | 19. Formaldehyde molecule, TDDFT (PBE) forces, Gamma only 24 | 20. NV- diamond spin-polarized TDDFT (PBE) forces, Gamma only 25 | 21. Formaldehyde molecule, TDDFT (PBE0) forces, Gamma only 26 | 22. NV- diamond spin-polarized TDDFT (DDH) forces, Gamma only 27 | 23. O2 molecule, spin-flip TDDFT (LDA) forces, Gamma only 28 | 24. O2 molecule, spin-flip TDDFT (PBE) forces, Gamma only 29 | 25. O2 molecule, spin-flip TDDFT (PBE0) forces, Gamma only 30 | 26. O2 molecule, spin-flip TDDFT (HSE) forces, Gamma only 31 | 27. Formaldehyde molecule, westpp excited state decomposition, Gamma only 32 | 33 | ## Executing tests 34 | 35 | In order to manually run the test, simply run `make` or `make all` in the test-suite. 36 | 37 | ## Adding new tests 38 | 39 | Additional tests can be added with the following procedure: 40 | 41 | 1) Create a new test directory with: 42 | - `prepare_inputs.sh`, to generate all inputs (including links to download pseudopotential files) 43 | - `ref` subdirectory, that contains reference data 44 | - `Makefile`, that contains instructions about the execution of the codes 45 | 46 | We recommend that you copy and adjust an existing test script. 47 | 48 | 2) Add the new subdirectory name to the list in the `test-suite/Makefile`. 49 | 50 | 3) Customize the file `main_test.py`. 51 | 52 | 4) Add a short description of the new test to the list above. 53 | -------------------------------------------------------------------------------- /Doc/installations/midway3.rst: -------------------------------------------------------------------------------- 1 | .. _midway3: 2 | 3 | ================ 4 | UChicago-Midway3 5 | ================ 6 | 7 | Midway3 is the HPC cluster of the University of Chicago, maintained by UChicago's `RCC `_. 8 | 9 | .. code-block:: bash 10 | 11 | $ ssh @midway3.rcc.uchicago.edu 12 | 13 | Building WEST 14 | ~~~~~~~~~~~~~ 15 | 16 | WEST executables can be compiled using the following script (tested on November 26, 2024): 17 | 18 | .. code-block:: bash 19 | 20 | $ cat build_west.sh 21 | #!/bin/bash 22 | 23 | module load intel/19.1.1 24 | module load intelmpi/2019.up7+intel-19.1.1 25 | module load mkl/2020.up1 26 | module load python/anaconda-2020.11 27 | 28 | export MPIF90=mpiifort 29 | export F90=ifort 30 | export CC=icc 31 | export SCALAPACK_LIBS="-lmkl_scalapack_lp64 -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lmkl_blacs_intelmpi_lp64 -Wl,--end-group" 32 | 33 | ./configure --with-scalapack=intel 34 | make -j 8 pw 35 | 36 | cd West 37 | 38 | make conf PYT=python3 PYT_LDFLAGS="$PYTHON_DIR/lib/libpython3.8.so" 39 | make -j 8 all 40 | 41 | To use the script do: 42 | 43 | .. code-block:: bash 44 | 45 | $ bash build_west.sh 46 | 47 | 48 | Running WEST Jobs 49 | ~~~~~~~~~~~~~~~~~ 50 | 51 | The following is an example executable script `run_west.sh` to run the `wstat.x` WEST executable on two nodes of Midway3 with 48 MPI ranks per node. The and must be replaced with an active project allocation. 52 | 53 | .. code-block:: bash 54 | 55 | $ cat run_west.sh 56 | #!/bin/bash 57 | #SBATCH --time=00:20:00 58 | #SBATCH --partition= 59 | #SBATCH --account= 60 | #SBATCH --nodes=2 61 | #SBATCH --ntasks-per-node=48 62 | #SBATCH --cpus-per-task=1 63 | 64 | module load intel/19.1.1 65 | module load intelmpi/2019.up7+intel-19.1.1 66 | module load mkl/2020.up1 67 | module load python/anaconda-2020.11 68 | 69 | export LD_LIBRARY_PATH=$PYTHON_DIR/lib:$LD_LIBRARY_PATH 70 | export OMP_NUM_THREADS=1 71 | 72 | mpirun -np 96 ./wstat.x -i wstat.in > wstat.out 73 | 74 | Job submission is done with the following: 75 | 76 | .. code-block:: bash 77 | 78 | $ sbatch run_west.sh 79 | 80 | .. seealso:: 81 | For more information, visit the `RCC user guide `_. 82 | -------------------------------------------------------------------------------- /test-suite/test020/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/N_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 0 16 | nat = 15 17 | ntyp = 2 18 | ecutwfc = 25 19 | nosym = .true. 20 | tot_charge = -1 21 | nspin = 2 22 | nbnd = 40 23 | tot_magnetization = 2 24 | / 25 | &electrons 26 | diago_full_acc = .true. 27 | / 28 | ATOMIC_SPECIES 29 | C 12.0107 C_ONCV_PBE-1.2.upf 30 | N 14.0067 N_ONCV_PBE-1.2.upf 31 | ATOMIC_POSITIONS crystal 32 | C -0.0011453699 -0.0011377611 0.0067006607 33 | C -0.0002744852 -0.0002672037 0.5008176648 34 | C -0.0011044829 0.4955610337 0.0066821802 35 | C 0.0450632327 0.4851167525 0.4846789951 36 | C 0.4955573223 -0.0010991005 0.0066828147 37 | C 0.4851269633 0.0450567053 0.4846639674 38 | N 0.4994339805 0.4994639176 0.0018025833 39 | C 0.4850798144 0.4850821394 0.4846967685 40 | C 0.1230453760 0.1230396916 0.1309068249 41 | C 0.1272210852 0.1272104167 0.6248827206 42 | C 0.1356116446 0.6167545386 0.1309034755 43 | C 0.1272035150 0.6206680852 0.6249000996 44 | C 0.6167608167 0.1356077552 0.1308943700 45 | C 0.6206777059 0.1271982848 0.6248928293 46 | C 0.6167428815 0.6167447445 0.1308940454 47 | K_POINTS gamma 48 | CELL_PARAMETERS angstrom 49 | -0.000000 3.566790 3.566790 50 | 3.566790 0.000000 3.566790 51 | 3.566790 3.566790 0.000000 52 | EOF 53 | 54 | 55 | cat > wbse.in << EOF 56 | input_west: 57 | qe_prefix: test 58 | west_prefix: test 59 | outdir: ./ 60 | 61 | wbse_init_control: 62 | wbse_init_calculation: S 63 | solver: TDDFT 64 | 65 | wbse_control: 66 | wbse_calculation: D 67 | n_liouville_eigen: 2 68 | n_liouville_times: 20 69 | trev_liouville: 0.00000001 70 | trev_liouville_rel: 0.000001 71 | l_pre_shift: False 72 | l_forces: True 73 | forces_state: 1 74 | EOF 75 | -------------------------------------------------------------------------------- /Hamiltonian_kernel/glbrak.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE glbrak_gamma(a,b,c,ng,ngx,na,nb,ldc,np) 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! g -> gspace 18 | ! l -> local 19 | ! 20 | ! c_ij = < a_i | b_j > ( i = 1, na ; j = 1, nb ) 21 | ! 22 | USE kinds, ONLY : DP 23 | USE gvect, ONLY : gstart 24 | #if defined(__CUDA) 25 | USE cublas 26 | #endif 27 | ! 28 | IMPLICIT NONE 29 | ! 30 | ! I/O 31 | ! 32 | INTEGER, INTENT(IN) :: ng,ngx,np 33 | INTEGER, INTENT(IN) :: na,nb,ldc 34 | REAL(DP), INTENT(IN) :: a(2*ngx,na) ! complex passed as real for cublas compatibility 35 | REAL(DP), INTENT(IN) :: b(2*ngx,nb) ! same as a 36 | REAL(DP), INTENT(OUT) :: c(ldc,nb) 37 | ! 38 | !$acc host_data use_device(a,b,c) 39 | CALL DGEMM('C','N',na,nb,2*ng,2._DP,a,2*ngx,b,2*ngx,0._DP,c,ldc) 40 | IF(gstart == 2) CALL DGER(na,nb,-1._DP,a,2*ngx,b,2*ngx,c,ldc) 41 | !$acc end host_data 42 | ! 43 | END SUBROUTINE 44 | ! 45 | !----------------------------------------------------------------------- 46 | SUBROUTINE glbrak_k(a,b,c,ng,ngx,na,nb,ldc,np) 47 | !----------------------------------------------------------------------- 48 | ! 49 | ! g -> gspace 50 | ! l -> local 51 | ! 52 | ! c_ij = < a_i | b_j > ( i = 1, na ; j = 1, nb ) 53 | ! 54 | USE kinds, ONLY : DP 55 | #if defined(__CUDA) 56 | USE cublas 57 | #endif 58 | ! 59 | IMPLICIT NONE 60 | ! 61 | ! I/O 62 | ! 63 | INTEGER, INTENT(IN) :: ng,ngx,np 64 | INTEGER, INTENT(IN) :: na,nb,ldc 65 | COMPLEX(DP), INTENT(IN) :: a(ngx*np,na) 66 | COMPLEX(DP), INTENT(IN) :: b(ngx*np,nb) 67 | COMPLEX(DP), INTENT(OUT) :: c(ldc,nb) 68 | ! 69 | ! Workspace 70 | ! 71 | COMPLEX(DP), PARAMETER :: zero = (0._DP,0._DP) 72 | COMPLEX(DP), PARAMETER :: one = (1._DP,0._DP) 73 | ! 74 | !$acc host_data use_device(a,b,c) 75 | CALL ZGEMM('C','N',na,nb,ng,one,a,ngx*np,b,ngx*np,zero,c,ldc) 76 | IF(np == 2) CALL ZGEMM('C','N',na,nb,ng,one,a(ngx+1,1),ngx*np,b(1+ngx,1),ngx*np,one,c,ldc) 77 | !$acc end host_data 78 | ! 79 | END SUBROUTINE 80 | -------------------------------------------------------------------------------- /Doc/installations/midway2.rst: -------------------------------------------------------------------------------- 1 | .. _midway2: 2 | 3 | ================ 4 | UChicago-Midway2 5 | ================ 6 | 7 | Midway2 is the HPC cluster of the University of Chicago, maintained by UChicago's `RCC `_. 8 | 9 | .. code-block:: bash 10 | 11 | $ ssh @midway2.rcc.uchicago.edu 12 | 13 | Building WEST 14 | ~~~~~~~~~~~~~ 15 | 16 | WEST executables can be compiled using the following script (tested on June 23, 2022): 17 | 18 | .. code-block:: bash 19 | 20 | $ cat build_west.sh 21 | #!/bin/bash 22 | 23 | module load intel/19.1.1 24 | module load intelmpi/2019.up7+intel-19.1.1 25 | module load mkl/2020.up1 26 | module load python/cpython-3.8.5 27 | 28 | export MPIF90=mpiifort 29 | export F90=ifort 30 | export CC=icc 31 | export SCALAPACK_LIBS="-lmkl_scalapack_lp64 -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -Wl,--end-group" 32 | 33 | ./configure --with-scalapack=intel --enable-openmp 34 | make -j 8 pw 35 | 36 | cd West 37 | make conf PYT=python3 PYT_LDFLAGS="`python3-config --ldflags --embed`" 38 | sed -i 's/-L.*config-3.8-x86_64-linux-gnu //' west_make.inc 39 | make -j 8 all 40 | 41 | To use the script do: 42 | 43 | .. code-block:: bash 44 | 45 | $ bash build_west.sh 46 | 47 | 48 | Running WEST Jobs 49 | ~~~~~~~~~~~~~~~~~ 50 | 51 | The following is an example executable script `run_west.sh` to run the `wstat.x` WEST executable on two nodes of Midway2 with 32 MPI ranks per node. The and must be replaced with an active project allocation. 52 | 53 | .. code-block:: bash 54 | 55 | $ cat run_west.sh 56 | #!/bin/bash 57 | #SBATCH --time=00:20:00 58 | #SBATCH --partition= 59 | #SBATCH --account= 60 | #SBATCH --nodes=2 61 | #SBATCH --ntasks-per-node=48 62 | #SBATCH --cpus-per-task=1 63 | 64 | module load intel/19.1.1 65 | module load intelmpi/2019.up7+intel-19.1.1 66 | module load mkl/2020.up1 67 | module load python/cpython-3.8.5 68 | 69 | export I_MPI_PMI_LIBRARY=/software/slurm-current-$DISTARCH/lib/libpmi.so 70 | export LD_LIBRARY_PATH=/software/python-3.8.5-el7-x86_64/lib:$LD_LIBRARY_PATH 71 | export OMP_NUM_THREADS=1 72 | 73 | srun -n 96 -N 2 ./wstat.x -i wstat.in > wstat.out 74 | 75 | Job submission is done with the following: 76 | 77 | .. code-block:: bash 78 | 79 | $ sbatch run_west.sh 80 | 81 | .. seealso:: 82 | For more information, visit the `RCC user guide `_. 83 | -------------------------------------------------------------------------------- /DFPT_kernel/apply_sternheimerop_to_m_wfcs.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE apply_sternheimerop_to_m_wfcs(nbndval, psi, hpsi, e, alpha, m) 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE kinds, ONLY : DP 18 | USE pwcom, ONLY : npw,npwx 19 | USE noncollin_module, ONLY : npol,noncolin 20 | USE westcom, ONLY : l_kinetic_only 21 | ! 22 | IMPLICIT NONE 23 | ! 24 | ! I/O 25 | ! 26 | INTEGER, INTENT(IN) :: nbndval, m 27 | ! input: the number of val bands 28 | ! input: the number of bands 29 | REAL(DP), INTENT(IN) :: e (m) 30 | COMPLEX(DP), INTENT(IN) :: alpha 31 | ! input: the eigenvalue 32 | COMPLEX(DP), INTENT(IN) :: psi (npwx*npol,m) 33 | COMPLEX(DP), INTENT(OUT) :: hpsi (npwx*npol,m) 34 | ! input: the vector 35 | ! output: the operator applied to the vector 36 | ! 37 | ! Workspace 38 | ! 39 | INTEGER :: ibnd,ig 40 | ! 41 | #if defined(__CUDA) 42 | CALL start_clock_gpu('stern') 43 | #else 44 | CALL start_clock('stern') 45 | #endif 46 | ! 47 | ! compute the product of the hamiltonian with the h vector 48 | ! 49 | IF(l_kinetic_only) THEN 50 | CALL k_psi( npwx, npw, m, psi, hpsi ) 51 | ELSE 52 | ! 53 | ! use h_psi_, i.e. h_psi without band parallelization, as west 54 | ! handles band parallelization by itself 55 | ! 56 | #if defined(__CUDA) 57 | CALL h_psi__gpu( npwx, npw, m, psi, hpsi ) 58 | #else 59 | CALL h_psi_( npwx, npw, m, psi, hpsi ) 60 | #endif 61 | ENDIF 62 | ! 63 | ! then we compute the operator H-epsilon S 64 | ! 65 | !$acc parallel loop collapse(2) present(hpsi,e,psi) 66 | DO ibnd = 1,m 67 | DO ig = 1,npw 68 | hpsi(ig,ibnd) = hpsi(ig,ibnd)-e(ibnd)*psi(ig,ibnd) 69 | IF(noncolin) THEN 70 | hpsi(npwx+ig,ibnd) = hpsi(npwx+ig,ibnd)-e(ibnd)*psi(npwx+ig,ibnd) 71 | ENDIF 72 | ENDDO 73 | ENDDO 74 | !$acc end parallel 75 | ! 76 | CALL apply_alpha_pv_to_m_wfcs(nbndval,m,psi,hpsi,alpha) 77 | ! 78 | #if defined(__CUDA) 79 | CALL stop_clock_gpu('stern') 80 | #else 81 | CALL stop_clock('stern') 82 | #endif 83 | ! 84 | END SUBROUTINE 85 | -------------------------------------------------------------------------------- /Doc/installations/swing.rst: -------------------------------------------------------------------------------- 1 | .. _swing: 2 | 3 | ============== 4 | ANL-LCRC-Swing 5 | ============== 6 | 7 | Swing is an HPC cluster maintained by the `Laboratory Computing Resource Center (LCRC) `_ at Argonne National Laboratory. 8 | 9 | .. code-block:: bash 10 | 11 | $ ssh @swing.lcrc.anl.gov 12 | 13 | Building WEST 14 | ~~~~~~~~~~~~~ 15 | 16 | WEST executables can be compiled using the following script (tested on December 21, 2022): 17 | 18 | .. code-block:: bash 19 | 20 | $ cat build_west.sh 21 | #!/bin/bash 22 | 23 | module load nvhpc/21.9-4pt64om 24 | export NVHPC_HOME=/gpfs/fs1/soft/swing/spack-0.16.1/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/nvhpc-21.9-4pt64om/Linux_x86_64/21.9 25 | export LD_LIBRARY_PATH=$NVHPC_HOME/comm_libs/openmpi4/openmpi-4.0.5/lib:$LD_LIBRARY_PATH 26 | export PATH=$NVHPC_HOME/comm_libs/openmpi4/openmpi-4.0.5/bin:$PATH 27 | export SCALAPACK_LIBS=$NVHPC_HOME/comm_libs/openmpi4/openmpi-4.0.5/lib/libscalapack.a 28 | 29 | ./configure --with-cuda=$NVHPC_HOME/cuda/11.0 --with-cuda-cc=80 --with-cuda-runtime=11.0 30 | 31 | make -j 8 pw 32 | 33 | cd West 34 | 35 | make conf PYT=python3 PYT_LDFLAGS="-L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8" 36 | make -j 8 all 37 | 38 | To use the script do: 39 | 40 | .. code-block:: bash 41 | 42 | $ bash build_west.sh 43 | 44 | 45 | Running WEST Jobs 46 | ~~~~~~~~~~~~~~~~~ 47 | 48 | The following is an example executable script `run_west.sh` to run the `wstat.x` WEST executable on one node of Swing with 8 MPI ranks and 8 GPUs. The must be replaced with an active project allocation. 49 | 50 | .. code-block:: bash 51 | 52 | $ cat run_west.sh 53 | #!/bin/bash 54 | #SBATCH --time=00:20:00 55 | #SBATCH --account= 56 | #SBATCH --nodes=1 57 | #SBATCH --gres=gpu:8 58 | 59 | module load nvhpc/21.9-4pt64om 60 | export NVHPC_HOME=/gpfs/fs1/soft/swing/spack-0.16.1/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/nvhpc-21.9-4pt64om/Linux_x86_64/21.9 61 | export LD_LIBRARY_PATH=$NVHPC_HOME/comm_libs/openmpi4/openmpi-4.0.5/lib:$LD_LIBRARY_PATH 62 | export PATH=$NVHPC_HOME/comm_libs/openmpi4/openmpi-4.0.5/bin:$PATH 63 | 64 | export OMP_NUM_THREADS=1 65 | 66 | mpirun -n 8 ./wstat.x -i wstat.in > wstat.out 67 | 68 | Job submission is done with the following: 69 | 70 | .. code-block:: bash 71 | 72 | $ sbatch run_west.sh 73 | 74 | .. seealso:: 75 | For more information, visit the `LCRC user guide `_. 76 | -------------------------------------------------------------------------------- /Hamiltonian_kernel/k_psi.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE k_psi(lda,n,m,psi,hpsi) 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! ... This routine computes the product of the Hamiltonian (kinetic-only) 18 | ! ... matrix with m wavefunctions contained in psi 19 | ! 20 | ! ... input: 21 | ! ... lda leading dimension of arrays psi, spsi, hpsi 22 | ! ... n true dimension of psi, spsi, hpsi 23 | ! ... m number of states psi 24 | ! ... psi 25 | ! 26 | ! ... output: 27 | ! ... hpsi H*psi 28 | ! 29 | USE kinds, ONLY : DP 30 | USE gvect, ONLY : gstart 31 | USE control_flags, ONLY : gamma_only 32 | USE noncollin_module, ONLY : npol,noncolin 33 | USE wvfct, ONLY : g2kin 34 | ! 35 | IMPLICIT NONE 36 | ! 37 | INTEGER, INTENT(IN) :: lda,n,m 38 | COMPLEX(DP), INTENT(IN) :: psi(lda*npol,m) 39 | COMPLEX(DP), INTENT(OUT) :: hpsi(lda*npol,m) 40 | ! 41 | INTEGER :: ibnd,ig 42 | ! 43 | #if defined(__CUDA) 44 | CALL start_clock_gpu('k_psi') 45 | #else 46 | CALL start_clock('k_psi') 47 | #endif 48 | ! 49 | ! ... Here we apply the kinetic energy (k+G)^2 psi 50 | ! 51 | !$acc parallel loop collapse(2) present(hpsi,g2kin,psi) 52 | DO ibnd = 1,m 53 | DO ig = 1,lda 54 | IF(ig <= n) THEN 55 | hpsi(ig,ibnd) = g2kin(ig)*psi(ig,ibnd) 56 | IF(noncolin) THEN 57 | hpsi(lda+ig,ibnd) = g2kin(ig)*psi(lda+ig,ibnd) 58 | ENDIF 59 | ELSE 60 | hpsi(ig,ibnd) = 0._DP 61 | IF(noncolin) THEN 62 | hpsi(lda+ig,ibnd) = 0._DP 63 | ENDIF 64 | ENDIF 65 | ENDDO 66 | ENDDO 67 | !$acc end parallel 68 | ! 69 | ! ... Gamma-only trick: set to zero the imaginary part of hpsi at G=0 70 | ! 71 | IF(gamma_only .AND. gstart == 2) THEN 72 | !$acc parallel loop present(hpsi) 73 | DO ibnd = 1,m 74 | hpsi(1,ibnd) = CMPLX(REAL(hpsi(1,ibnd),KIND=DP),0._DP,KIND=DP) 75 | ENDDO 76 | !$acc end parallel 77 | ENDIF 78 | ! 79 | #if defined(__CUDA) 80 | CALL stop_clock_gpu('k_psi') 81 | #else 82 | CALL stop_clock('k_psi') 83 | #endif 84 | ! 85 | END SUBROUTINE 86 | -------------------------------------------------------------------------------- /test-suite/test014/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/N_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 0 16 | nat = 15 17 | ntyp = 2 18 | ecutwfc = 25 19 | nosym = .true. 20 | tot_charge = -1 21 | nspin = 2 22 | nbnd = 40 23 | tot_magnetization = 2 24 | / 25 | &electrons 26 | diago_full_acc = .true. 27 | / 28 | ATOMIC_SPECIES 29 | C 12.0107 C_ONCV_PBE-1.2.upf 30 | N 14.0067 N_ONCV_PBE-1.2.upf 31 | ATOMIC_POSITIONS crystal 32 | C -0.0011453699 -0.0011377611 0.0067006607 33 | C -0.0002744852 -0.0002672037 0.5008176648 34 | C -0.0011044829 0.4955610337 0.0066821802 35 | C 0.0450632327 0.4851167525 0.4846789951 36 | C 0.4955573223 -0.0010991005 0.0066828147 37 | C 0.4851269633 0.0450567053 0.4846639674 38 | N 0.4994339805 0.4994639176 0.0018025833 39 | C 0.4850798144 0.4850821394 0.4846967685 40 | C 0.1230453760 0.1230396916 0.1309068249 41 | C 0.1272210852 0.1272104167 0.6248827206 42 | C 0.1356116446 0.6167545386 0.1309034755 43 | C 0.1272035150 0.6206680852 0.6249000996 44 | C 0.6167608167 0.1356077552 0.1308943700 45 | C 0.6206777059 0.1271982848 0.6248928293 46 | C 0.6167428815 0.6167447445 0.1308940454 47 | K_POINTS gamma 48 | CELL_PARAMETERS angstrom 49 | -0.000000 3.566790 3.566790 50 | 3.566790 0.000000 3.566790 51 | 3.566790 3.566790 0.000000 52 | EOF 53 | 54 | 55 | cat > wstat.in << EOF 56 | input_west: 57 | qe_prefix: test 58 | west_prefix: test 59 | outdir: ./ 60 | 61 | wstat_control: 62 | wstat_calculation: S 63 | n_pdep_eigen: 30 64 | EOF 65 | 66 | 67 | cat > wfreq.in << EOF 68 | input_west: 69 | qe_prefix: test 70 | west_prefix: test 71 | outdir: ./ 72 | 73 | wstat_control: 74 | wstat_calculation: S 75 | n_pdep_eigen: 30 76 | 77 | wfreq_control: 78 | wfreq_calculation: XWGQH 79 | l_enable_off_diagonal: True 80 | macropol_calculation: C 81 | n_pdep_eigen_to_use: 30 82 | qp_bands: [30,31,32] 83 | n_refreq: 300 84 | ecut_refreq: 2.0 85 | EOF 86 | -------------------------------------------------------------------------------- /Doc/installations/bebop.rst: -------------------------------------------------------------------------------- 1 | .. _bebop: 2 | 3 | ============== 4 | ANL-LCRC-Bebop 5 | ============== 6 | 7 | Bebop is an HPC cluster maintained by the `Laboratory Computing Resource Center (LCRC) `_ at Argonne National Laboratory. 8 | 9 | .. code-block:: bash 10 | 11 | $ ssh @bebop.lcrc.anl.gov 12 | 13 | Building WEST 14 | ~~~~~~~~~~~~~ 15 | 16 | WEST executables can be compiled using the following script (tested on December 21, 2022): 17 | 18 | .. code-block:: bash 19 | 20 | $ cat build_west.sh 21 | #!/bin/bash 22 | 23 | module purge 24 | module load git/2.31.1-6p7naeb 25 | module load intel-oneapi/2021.4.0.3422 26 | module load anaconda3/2021.05 27 | 28 | export MPIF90=mpiifort 29 | export F90=ifort 30 | export CC=icc 31 | export SCALAPACK_LIBS="-lmkl_scalapack_lp64 -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -Wl,--end-group" 32 | 33 | ./configure --with-scalapack=intel --enable-openmp 34 | make -j 8 pw 35 | 36 | cd West 37 | 38 | make conf PYT=python3 PYT_LDFLAGS="-L/gpfs/fs1/home/software/anaconda3/2021.05/lib -lpython3.8" 39 | make -j 8 all 40 | 41 | To use the script do: 42 | 43 | .. code-block:: bash 44 | 45 | $ bash build_west.sh 46 | 47 | 48 | Running WEST Jobs 49 | ~~~~~~~~~~~~~~~~~ 50 | 51 | The following is an example executable script `run_west.sh` to run the `wstat.x` WEST executable on two nodes of Bebop (Broadwell partition) with 36 MPI ranks per node. The must be replaced with an active project allocation. 52 | 53 | .. code-block:: bash 54 | 55 | $ cat run_west.sh 56 | #!/bin/bash 57 | #SBATCH --time=00:20:00 58 | #SBATCH --partition=bdwall 59 | #SBATCH --account= 60 | #SBATCH --nodes=2 61 | #SBATCH --ntasks-per-node=36 62 | #SBATCH --cpus-per-task=1 63 | 64 | module purge 65 | module load intel-oneapi/2021.4.0.3422 66 | module load anaconda3/2021.05 67 | 68 | export LD_LIBRARY_PATH=/gpfs/fs1/home/software/anaconda3/2021.05/lib:$LD_LIBRARY_PATH 69 | export OMP_NUM_THREADS=1 70 | 71 | ulimit -s unlimited 72 | 73 | srun -n 2 -N 72 ./wstat.x -i wstat.in > wstat.out 74 | 75 | To run on the KNL partition, use the following flags: 76 | 77 | .. code-block:: bash 78 | 79 | #SBATCH --partition=knlall 80 | #SBATCH --constraint knl,quad,cache 81 | #SBATCH --ntasks-per-node=64 82 | 83 | Job submission is done with the following: 84 | 85 | .. code-block:: bash 86 | 87 | $ sbatch run_west.sh 88 | 89 | .. seealso:: 90 | For more information, visit the `LCRC user guide `_. 91 | -------------------------------------------------------------------------------- /Libraries/Json/json_macros.inc: -------------------------------------------------------------------------------- 1 | ! JSON-Fortran preprocessor macros. 2 | ! 3 | ! License 4 | ! JSON-Fortran is released under a BSD-style license. 5 | ! See the [LICENSE](https://github.com/jacobwilliams/json-fortran/blob/master/LICENSE) 6 | ! file for details. 7 | 8 | !********************************************************* 9 | ! File encoding preprocessor macro. 10 | ! 11 | #if defined __GFORTRAN__ && defined USE_UCS4 12 | ! gfortran compiler AND UCS4 support requested, & silence redefine warning: 13 | ! Make sure we output files with utf-8 encoding too 14 | #define FILE_ENCODING ,encoding='UTF-8' 15 | #else 16 | ! don't ask for utf-8 file encoding unless using UCS4 17 | ! this may let us use unformatted stream io to read in files more quickly 18 | ! even with unicode support turned on `inquire( ... encoding=FL_ENCODING)` 19 | ! may be able to detect json files in which each character is exactly one 20 | ! byte 21 | #define FILE_ENCODING 22 | #endif 23 | !********************************************************* 24 | 25 | !********************************************************* 26 | ! This C preprocessor macro will take a procedure name as an 27 | ! input, and output either that same procedure name if the 28 | ! code is compiled without USE_UCS4 being defined or it will 29 | ! expand the procedure name to the original procedure name, 30 | ! followed by a comma and then the original procedure name 31 | ! with 'wrap_' prepended to it. This is suitable for creating 32 | ! overloaded interfaces that will accept UCS4 character actual 33 | ! arguments as well as DEFAULT/ASCII character arguments, 34 | ! based on whether or not ISO 10646 is supported and requested. 35 | ! 36 | # ifdef USE_UCS4 37 | # ifdef __GFORTRAN__ 38 | ! gfortran uses cpp in old-school compatibility mode so 39 | ! the # stringify and ## concatenate operators don't work 40 | ! but we can use C/C++ style comment to ensure PROCEDURE is 41 | ! correctly tokenized and prepended with 'wrap_' when the 42 | ! macro is expanded 43 | # define MAYBEWRAP(PROCEDURE) PROCEDURE , wrap_/**/PROCEDURE 44 | # endif 45 | ! ifdef __INTEL_COMPILER 46 | ! Intel's fpp does support the more contemporary ## concatenation 47 | ! operator, but doesn't treat the C/C++ comments the same way. 48 | ! If you use the gfortran approach and pass the -noB switch to 49 | ! fpp, the macro will expand, but with a space between wrap_ and 50 | ! whatever PROCEDURE expands to 51 | ! Intel doesn't support ISO 10646 yet, but this is here to 52 | ! ease the transition once they do. 53 | ! define MAYBEWRAP(PROCEDURE) PROCEDURE , wrap_##PROCEDURE 54 | ! endif 55 | # else 56 | # define MAYBEWRAP(PROCEDURE) PROCEDURE 57 | # endif 58 | !********************************************************* 59 | -------------------------------------------------------------------------------- /Doc/installation.rst: -------------------------------------------------------------------------------- 1 | .. _installation: 2 | 3 | ============ 4 | Installation 5 | ============ 6 | 7 | In order to install WEST you need to download `Quantum ESPRESSO 7.4.1 `_. 8 | 9 | `Quantum ESPRESSO `_ (QE) is an integrated suite of open-source computer codes for electronic-structure calculations and materials modeling at the nanoscale, based on density-functional theory (DFT), plane waves (PW), and pseudopotentials (PP). 10 | 11 | QE can be installed with HDF5 support. Currently the installation of QE with CMake is not supported by WEST. Configure QE by running the ``configure`` script that comes with the QE distribution. WEST requires `MPI `_ support. `HDF5 `_ is recommended, but optional. For large-scale calculations, `ScaLAPACK `_ and `ELPA `_ are also recommended. If all the environment variables (compilers, libraries etc.) have been set according to the QE configure guide, this would simply be: 12 | 13 | .. code-block:: bash 14 | 15 | $ git clone -b 'qe-7.4.1' --single-branch --depth 1 https://gitlab.com/QEF/q-e.git QEdir 16 | $ cd QEdir 17 | $ git clone -b 'v6.2.1' --single-branch --depth 1 https://github.com/west-code-development/West.git West 18 | $ ./configure 19 | 20 | .. note:: 21 | Note that since v4.0.0 WEST requires dynamic linking and Python3. 22 | 23 | It's now time to create the ``pw.x``, ``wstat.x``, ``wfreq.x``, and ``westpp.x`` executables by doing: 24 | 25 | .. code-block:: bash 26 | 27 | $ cd QEdir 28 | $ make pw 29 | $ cd QEdir/West 30 | $ make conf PYT=python3 PYT_LDFLAGS="`python3-config --ldflags --embed`" 31 | $ make all 32 | 33 | You have succefully installed QE and WEST if you see the executables ``pw.x``, ``wstat.x``, ``wfreq.x``, ``wbse.x``, and ``westpp.x`` created in the QEdir/bin directory. 34 | 35 | .. code-block:: bash 36 | 37 | $ ls QEdir/bin/ 38 | pw.x 39 | wstat.x 40 | wfreq.x 41 | wbse.x 42 | westpp.x 43 | ... (other content) ... 44 | 45 | Congratulations, you are all set for running QE and WEST! 46 | 47 | 48 | Suggested configuration options 49 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 50 | 51 | .. toctree:: 52 | :maxdepth: 1 53 | 54 | installations/polaris.rst 55 | installations/theta.rst 56 | installations/bebop.rst 57 | installations/swing.rst 58 | installations/leonardo.rst 59 | installations/macos.rst 60 | installations/cori.rst 61 | installations/perlmutter.rst 62 | installations/dgx.rst 63 | installations/summit.rst 64 | installations/midway2.rst 65 | installations/midway3.rst 66 | -------------------------------------------------------------------------------- /test-suite/test022/prepare_inputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.2.upf 4 | ${WGET} http://www.quantum-simulation.org/potentials/sg15_oncv/upf/N_ONCV_PBE-1.2.upf 5 | 6 | cat > pw.in << EOF 7 | &control 8 | calculation = 'scf' 9 | restart_mode = 'from_scratch' 10 | pseudo_dir = './' 11 | outdir = './' 12 | prefix = 'test' 13 | / 14 | &system 15 | ibrav = 0 16 | nat = 15 17 | ntyp = 2 18 | ecutwfc = 25 19 | nosym = .true. 20 | tot_charge = -1 21 | nspin = 2 22 | nbnd = 40 23 | tot_magnetization = 2 24 | input_dft = 'pbe0' 25 | exx_fraction = 0.18 26 | / 27 | &electrons 28 | diago_full_acc = .true. 29 | / 30 | ATOMIC_SPECIES 31 | C 12.0107 C_ONCV_PBE-1.2.upf 32 | N 14.0067 N_ONCV_PBE-1.2.upf 33 | ATOMIC_POSITIONS crystal 34 | C -0.0011453699 -0.0011377611 0.0067006607 35 | C -0.0002744852 -0.0002672037 0.5008176648 36 | C -0.0011044829 0.4955610337 0.0066821802 37 | C 0.0450632327 0.4851167525 0.4846789951 38 | C 0.4955573223 -0.0010991005 0.0066828147 39 | C 0.4851269633 0.0450567053 0.4846639674 40 | N 0.4994339805 0.4994639176 0.0018025833 41 | C 0.4850798144 0.4850821394 0.4846967685 42 | C 0.1230453760 0.1230396916 0.1309068249 43 | C 0.1272210852 0.1272104167 0.6248827206 44 | C 0.1356116446 0.6167545386 0.1309034755 45 | C 0.1272035150 0.6206680852 0.6249000996 46 | C 0.6167608167 0.1356077552 0.1308943700 47 | C 0.6206777059 0.1271982848 0.6248928293 48 | C 0.6167428815 0.6167447445 0.1308940454 49 | K_POINTS gamma 50 | CELL_PARAMETERS angstrom 51 | -0.000000 3.566790 3.566790 52 | 3.566790 0.000000 3.566790 53 | 3.566790 3.566790 0.000000 54 | EOF 55 | 56 | 57 | cat > wbse_init.in << EOF 58 | input_west: 59 | qe_prefix: test 60 | west_prefix: test 61 | outdir: ./ 62 | 63 | wbse_init_control: 64 | wbse_init_calculation: S 65 | solver: TDDFT 66 | EOF 67 | 68 | 69 | cat > wbse.in << EOF 70 | input_west: 71 | qe_prefix: test 72 | west_prefix: test 73 | outdir: ./ 74 | 75 | wbse_init_control: 76 | wbse_init_calculation: S 77 | solver: TDDFT 78 | 79 | wbse_control: 80 | wbse_calculation: D 81 | n_liouville_eigen: 2 82 | n_liouville_times: 20 83 | trev_liouville: 0.00000001 84 | trev_liouville_rel: 0.000001 85 | l_pre_shift: False 86 | l_forces: True 87 | forces_state: 1 88 | EOF 89 | -------------------------------------------------------------------------------- /Wbse/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Wbse 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS = $(BASEMOD_FLAGS) \ 7 | $(MOD_FLAG)../../PW/src \ 8 | $(MOD_FLAG)../../LR_Modules \ 9 | $(MOD_FLAG)../Coulomb_kernel \ 10 | $(MOD_FLAG)../DFPT_kernel \ 11 | $(MOD_FLAG)../FFT_kernel \ 12 | $(MOD_FLAG)../IO_kernel \ 13 | $(MOD_FLAG)../Libraries/Base64 \ 14 | $(MOD_FLAG)../Libraries/Forpy \ 15 | $(MOD_FLAG)../Libraries/Json \ 16 | $(MOD_FLAG)../Modules \ 17 | $(MOD_FLAG)../Para_kernel \ 18 | $(MOD_FLAG)../Tools \ 19 | $(MOD_FLAG)../Wstat \ 20 | $(MOD_FLAG). 21 | 22 | WBSE_OBJS = \ 23 | bse_kernel.o \ 24 | build_rhs_zvector_eq.o \ 25 | calc_tau.o \ 26 | check_ovl_wfc.o \ 27 | hybrid_kernel.o \ 28 | lanczos_restart.o \ 29 | solve_zvector_eq_cg.o \ 30 | td_liouville_oper.o \ 31 | wbse_bgrp.o \ 32 | wbse_calc_dens.o \ 33 | wbse_calc_forces.o \ 34 | wbse_davidson_diago.o \ 35 | wbse_dot.o \ 36 | wbse_dv.o \ 37 | wbse_init_setup.o \ 38 | wbse_lanczos_diago.o \ 39 | wbse_localization.o\ 40 | wbse_memory_report.o \ 41 | wbse_setup.o \ 42 | wbse_solve_e_psi.o \ 43 | wbse_tools.o 44 | 45 | PWOBJS = ../../PW/src/libpw.a 46 | 47 | QEMODS = ../../LR_Modules/liblrmod.a ../../KS_Solvers/libks_solvers.a ../../dft-d3/libdftd3qe.a $(BASEMODS) 48 | 49 | WESTLIBS = \ 50 | ../Wstat/libwstat.a \ 51 | ../IO_kernel/lib_io_kernel.a \ 52 | ../DFPT_kernel/lib_dfpt_kernel.a \ 53 | ../Hamiltonian_kernel/lib_hamiltonian_kernel.a \ 54 | ../Para_kernel/lib_para_kernel.a \ 55 | ../Coulomb_kernel/lib_coulomb_kernel.a \ 56 | ../FFT_kernel/lib_fft_kernel.a \ 57 | ../Tools/libtools.a \ 58 | ../Modules/libmodules.a \ 59 | ../Libraries/Forpy/libforpy.a \ 60 | ../Libraries/Json/libjson.a \ 61 | ../Libraries/Base64/libbase64.a 62 | 63 | TLDEPS = bindir mods pwlibs pw 64 | 65 | all : title tldeps wbse.x wbse_init.x libwbse.a 66 | 67 | wbse.x : wbse.o $(WBSE_OBJS) $(WESTLIBS) $(PWOBJS) $(QEMODS) 68 | $(LD) $(LDFLAGS) -o $@ $^ $(QELIBS) $(PYT_LDFLAGS) 69 | - ( cd ../../bin ; ln -fs ../West/Wbse/wbse.x . ) 70 | 71 | wbse_init.x : wbse_init.o $(WBSE_OBJS) $(WESTLIBS) $(PWOBJS) $(QEMODS) 72 | $(LD) $(LDFLAGS) -o $@ $^ $(QELIBS) $(PYT_LDFLAGS) 73 | - ( cd ../../bin ; ln -fs ../West/Wbse/wbse_init.x . ) 74 | 75 | tldeps : 76 | test -n "$(TLDEPS)" && ( cd ../.. ; $(MAKE) $(MFLAGS) $(TLDEPS) || exit 1) || : 77 | 78 | libwbse.a : $(WBSE_OBJS) 79 | $(AR) $(ARFLAGS) $@ $? 80 | $(RANLIB) $@ 81 | 82 | clean : 83 | - /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L 84 | - /bin/rm -f ../../bin/wbse.x ../../bin/wbse_init.x 85 | 86 | title : 87 | @echo 88 | @echo "#############" 89 | @echo "### Wbse ####" 90 | @echo "#############" 91 | @echo 92 | 93 | include make.depend 94 | -------------------------------------------------------------------------------- /Wbse/wbse_dot.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Ngoc Linh Nguyen, Victor Yu 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE wbse_dot(x,y,m,dotp) 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE kinds, ONLY : DP 18 | USE mp_global, ONLY : inter_pool_comm,inter_bgrp_comm,intra_bgrp_comm 19 | USE mp, ONLY : mp_sum 20 | USE pwcom, ONLY : wg,nspin,npw,npwx,ngk 21 | USE gvect, ONLY : gstart 22 | USE westcom, ONLY : nbnd_occ,n_trunc_bands 23 | USE distribution_center, ONLY : kpt_pool,band_group 24 | ! 25 | IMPLICIT NONE 26 | ! 27 | ! I/O 28 | ! 29 | INTEGER, INTENT(IN) :: m 30 | COMPLEX(DP), INTENT(IN) :: x(npwx,m,kpt_pool%nloc) 31 | COMPLEX(DP), INTENT(IN) :: y(npwx,m,kpt_pool%nloc) 32 | COMPLEX(DP), INTENT(OUT) :: dotp(nspin) 33 | ! 34 | ! Workspace 35 | ! 36 | INTEGER :: ig, lbnd, ibnd, iks, iks_g, nbndval, band_group_myoffset 37 | REAL(DP) :: tmp_r 38 | ! 39 | band_group_myoffset = band_group%myoffset 40 | ! 41 | dotp(:) = (0._DP,0._DP) 42 | ! 43 | DO iks = 1, kpt_pool%nloc 44 | ! 45 | iks_g = kpt_pool%l2g(iks) 46 | npw = ngk(iks) 47 | nbndval = nbnd_occ(iks) 48 | tmp_r = 0._DP 49 | ! 50 | !$acc parallel loop collapse(2) reduction(+:tmp_r) present(wg,x,y) copy(tmp_r) 51 | DO lbnd = 1, m 52 | DO ig = 1, npw 53 | ! 54 | ibnd = band_group_myoffset+lbnd+n_trunc_bands 55 | ! 56 | tmp_r = tmp_r + wg(ibnd,iks)*2._DP*(REAL(x(ig,lbnd,iks),KIND=DP)*REAL(y(ig,lbnd,iks),KIND=DP) & 57 | & + AIMAG(x(ig,lbnd,iks))*AIMAG(y(ig,lbnd,iks))) 58 | ! 59 | ENDDO 60 | ENDDO 61 | !$acc end parallel 62 | ! 63 | IF(gstart == 2) THEN 64 | !$acc parallel loop reduction(+:tmp_r) present(wg,x,y) copy(tmp_r) 65 | DO lbnd = 1, m 66 | ! 67 | ibnd = band_group_myoffset+lbnd+n_trunc_bands 68 | ! 69 | tmp_r = tmp_r - wg(ibnd,iks)*REAL(x(1,lbnd,iks),KIND=DP)*REAL(y(1,lbnd,iks),KIND=DP) 70 | ! 71 | ENDDO 72 | !$acc end parallel 73 | ENDIF 74 | ! 75 | dotp(iks_g) = CMPLX(tmp_r*nspin/2._DP,KIND=DP) 76 | ! 77 | ENDDO 78 | ! 79 | CALL mp_sum(dotp,intra_bgrp_comm) 80 | CALL mp_sum(dotp,inter_bgrp_comm) 81 | CALL mp_sum(dotp,inter_pool_comm) 82 | ! 83 | END SUBROUTINE 84 | -------------------------------------------------------------------------------- /Doc/installations/leonardo.rst: -------------------------------------------------------------------------------- 1 | .. _leonardo: 2 | 3 | =============== 4 | CINECA-Leonardo 5 | =============== 6 | 7 | Leonardo is a GPU-accelerated supercomputer located at `CINECA `_. 8 | 9 | .. code-block:: bash 10 | 11 | $ ssh @login.leonardo.cineca.it 12 | 13 | Building WEST 14 | ~~~~~~~~~~~~~ 15 | 16 | WEST executables can be compiled using the following script (tested on March 10, 2025): 17 | 18 | .. code-block:: bash 19 | 20 | $ cat build_west.sh 21 | #!/bin/bash 22 | 23 | module load anaconda3/2023.09-0 24 | module load nvhpc/23.11 25 | module load openmpi/4.1.6--nvhpc--23.11 26 | module load fftw/3.3.10--openmpi--4.1.6--nvhpc--23.11 27 | module load openblas/0.3.24--nvhpc--23.11 28 | 29 | export MPIF90=mpif90 30 | export F90=nvfortran 31 | export CC=nvc 32 | export BLAS_LIBS="-L$OPENBLAS_LIB -lopenblas" 33 | export LAPACK_LIBS="-L$OPENBLAS_LIB -lopenblas" 34 | 35 | ./configure --with-cuda=/leonardo/prod/opt/compilers/cuda/12.3/none --with-cuda-runtime=12.3 --with-cuda-cc=80 --with-cuda-mpi=yes 36 | 37 | make -j 8 pw 38 | 39 | cd West 40 | 41 | make conf PYT=python3 PYT_LDFLAGS="$ANACONDA3_LIB/libpython3.11.so" 42 | make -j 8 all 43 | 44 | To use the script do: 45 | 46 | .. code-block:: bash 47 | 48 | $ bash build_west.sh 49 | 50 | 51 | Running WEST Jobs 52 | ~~~~~~~~~~~~~~~~~ 53 | 54 | The following is an example executable script `run_west.sh` to run the `wstat.x` WEST executable on one node of Leonardo with 4 MPI ranks and 4 GPUs. The must be replaced with an active project allocation. 55 | 56 | .. code-block:: bash 57 | 58 | $ cat run_west.sh 59 | #!/bin/bash 60 | #SBATCH --time=00:20:00 61 | #SBATCH --account= 62 | #SBATCH --partition=boost_usr_prod 63 | #SBATCH --qos=boost_qos_dbg 64 | #SBATCH --nodes=1 65 | #SBATCH --ntasks-per-node=4 66 | #SBATCH --gres=gpu:4 67 | #SBATCH --cpus-per-task=8 68 | #SBATCH --threads-per-core=1 69 | 70 | module load anaconda3/2023.09-0 71 | module load nvhpc/23.11 72 | module load openmpi/4.1.6--nvhpc--23.11 73 | module load fftw/3.3.10--openmpi--4.1.6--nvhpc--23.11 74 | module load openblas/0.3.24--nvhpc--23.11 75 | 76 | export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK 77 | export OMP_PLACES=cores 78 | export OMP_PROC_BIND=close 79 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NVHPC_HOME/Linux_x86_64/23.11/cuda/12.3/lib64 80 | 81 | mpirun -np $SLURM_NTASKS --map-by socket:PE=$SLURM_CPUS_PER_TASK --rank-by core \ 82 | wstat.x -i wstat.in > wstat.out 83 | 84 | 85 | Job submission is done with the following: 86 | 87 | .. code-block:: bash 88 | 89 | $ sbatch run_west.sh 90 | 91 | .. seealso:: 92 | For more information, visit the `CINECA user guide `_. 93 | -------------------------------------------------------------------------------- /Tools/west_readin.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | SUBROUTINE west_readin(code) 15 | !----------------------------------------------------------------------- 16 | ! 17 | USE gvecs, ONLY : doublegrid 18 | USE uspp, ONLY : okvan 19 | USE mp_global, ONLY : npool,nbgrp 20 | USE pwcom, ONLY : nkstot,lsda 21 | USE symm_base, ONLY : nosym 22 | USE control_flags, ONLY : noinv 23 | USE westcom, ONLY : l_spin_flip 24 | ! 25 | IMPLICIT NONE 26 | ! 27 | ! I/O 28 | ! 29 | CHARACTER(*),INTENT(IN) :: code 30 | ! 31 | ! Workspace 32 | ! 33 | LOGICAL :: needwf 34 | INTEGER :: nkpt 35 | ! 36 | CALL start_clock('west_readin') 37 | ! 38 | ! Read west_control 39 | ! 40 | CALL fetch_input_yml(1,(/1/),.TRUE.) 41 | ! 42 | ! Read pwscf 43 | ! 44 | needwf = .TRUE. 45 | CALL read_file_new(needwf) 46 | ! 47 | ! Read other input sections 48 | ! 49 | SELECT CASE(TRIM(code)) 50 | CASE('WSTAT') 51 | CALL fetch_input_yml(2,(/2,5/),.TRUE.) 52 | CASE('WFREQ') 53 | CALL fetch_input_yml(2,(/2,3/),.TRUE.) 54 | CASE('WESTPP') 55 | CALL fetch_input_yml(2,(/2,4/),.TRUE.) 56 | CASE('WBSE_INIT') 57 | CALL fetch_input_yml(2,(/5,6/),.TRUE.) 58 | CASE('WBSE') 59 | CALL fetch_input_yml(2,(/6,7/),.TRUE.) 60 | CASE DEFAULT 61 | CALL errore('west_readin','unknown code',1) 62 | END SELECT 63 | ! 64 | ! General checks 65 | ! 66 | IF(lsda) THEN 67 | nkpt = nkstot/2 68 | ELSE 69 | nkpt = nkstot 70 | ENDIF 71 | ! 72 | IF(okvan) CALL errore('west_readin','ultrasoft pseudopotential not implemented',1) 73 | IF(doublegrid) CALL errore('west_readin','double grid not implemented',1) 74 | IF(nkpt > 1) THEN 75 | IF(npool > 1) CALL errore('west_readin','pools only implemented for spin, not k-points',1) 76 | IF(.NOT. nosym) CALL errore('west_readin','pwscf flags nosym, noinv required for k-points',1) 77 | IF(.NOT. noinv) CALL errore('west_readin','pwscf flags nosym, noinv required for k-points',1) 78 | ENDIF 79 | ! 80 | ! Code specific checks 81 | ! 82 | SELECT CASE(TRIM(code)) 83 | CASE('WESTPP') 84 | IF(nbgrp > 1) CALL errore('west_readin','band groups not implemented for westpp',1) 85 | IF(npool > 1) CALL errore('west_readin','pools not implemented for westpp',1) 86 | CASE('WBSE_INIT','WBSE') 87 | IF(npool > 1 .AND. l_spin_flip) CALL errore('west_readin','pools not implemented for spin flip',1) 88 | END SELECT 89 | ! 90 | CALL stop_clock('west_readin') 91 | ! 92 | END SUBROUTINE 93 | -------------------------------------------------------------------------------- /Doc/installations/cori.rst: -------------------------------------------------------------------------------- 1 | .. _cori: 2 | 3 | ========== 4 | NERSC-Cori 5 | ========== 6 | 7 | Cori (**retired** on May 31, 2023) was a Cray XC40 located at National Energy Research Scientific Computing Center (`NERSC `_). 8 | 9 | .. code-block:: bash 10 | 11 | $ ssh @cori.nersc.gov 12 | 13 | Building WEST 14 | ~~~~~~~~~~~~~ 15 | 16 | WEST executables can be compiled using the following script: 17 | 18 | .. code-block:: bash 19 | 20 | $ cat build_west.sh 21 | #!/bin/bash 22 | 23 | module unload cray-libsci 24 | module load cray-python/3.9.7.1 25 | 26 | export CRAYPE_LINK_TYPE=dynamic 27 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/python/3.9.7.1/lib 28 | export MPIF90=ftn 29 | export F90=ftn 30 | export CC=cc 31 | export SCALAPACK_LIBS="$MKLROOT/lib/intel64/libmkl_scalapack_lp64.so -Wl,--start-group $MKLROOT/lib/intel64/libmkl_intel_lp64.so $MKLROOT/lib/intel64/libmkl_intel_thread.so $MKLROOT/lib/intel64/libmkl_core.so $MKLROOT/lib/intel64/libmkl_blacs_intelmpi_lp64.so -Wl,--end-group" 32 | 33 | ./configure --enable-openmp --with-scalapack=intel 34 | 35 | make -j 8 pw 36 | 37 | cd West 38 | 39 | make conf PYT=python3 PYT_LDFLAGS="`python3-config --ldflags --embed`" 40 | make -j 8 all 41 | 42 | To use the script do: 43 | 44 | .. code-block:: bash 45 | 46 | $ bash build_west.sh 47 | 48 | Running WEST Jobs 49 | ~~~~~~~~~~~~~~~~~ 50 | 51 | The following is an example executable script `run_west.sh` to run the `wstat.x` WEST executable on two nodes of Cori (Haswell partition) with 32 MPI ranks per node. The must be replaced with an active project allocation. 52 | 53 | **Important**: The following environment variable is needed to work around a bug in ROMIO, Cray MPICH. 54 | 55 | .. code-block:: bash 56 | 57 | export ROMIO_FSTYPE_FORCE="ufs:" 58 | 59 | .. code-block:: bash 60 | 61 | $ cat run_west.sh 62 | #!/bin/bash 63 | 64 | #SBATCH --job-name=WEST 65 | #SBATCH --time=00:20:00 66 | #SBATCH --account= 67 | #SBATCH --constraint=haswell 68 | #SBATCH --qos=debug 69 | #SBATCH --nodes=2 70 | #SBATCH --ntasks-per-node=32 71 | #SBATCH --cpus-per-task=2 72 | 73 | module unload cray-libsci 74 | module load cray-python/3.9.7.1 75 | 76 | export CRAYPE_LINK_TYPE=dynamic 77 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/python/3.9.7.1/lib 78 | 79 | export ROMIO_FSTYPE_FORCE="ufs:" 80 | 81 | export OMP_NUM_THREADS=1 82 | export OMP_PLACE=threads 83 | export OMP_PROC_BIND=spread 84 | export MKL_NUM_THREADS=$OMP_NUM_THREADS 85 | 86 | NTASKS=$(($SLURM_NTASKS_PER_NODE * $SLURM_JOB_NUM_NODES)) 87 | 88 | srun -N $SLURM_JOB_NUM_NODES -n $NTASKS -c $SLURM_CPUS_PER_TASK ./wstat.x -i wstat.in &> wstat.out 89 | 90 | Job submission is done with the following: 91 | 92 | .. code-block:: bash 93 | 94 | $ sbatch run_west.sh 95 | 96 | .. seealso:: 97 | For more information, visit the `NERSC user guide `_. 98 | -------------------------------------------------------------------------------- /Libraries/Base64/base64module.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Huihuo Zheng, Marco Govoni 12 | ! 13 | !------------------------------------------------------------------- 14 | module base64_module 15 | !------------------------------------------------------------------- 16 | ! 17 | USE, INTRINSIC :: ISO_C_Binding, ONLY : C_DOUBLE, C_DOUBLE_COMPLEX, C_CHAR, C_SIGNED_CHAR, C_PTR, C_NULL_PTR, C_INT 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | SAVE 22 | ! 23 | INTERFACE 24 | ! 25 | SUBROUTINE base64_init() BIND(C, NAME="b64init") 26 | IMPORT 27 | END SUBROUTINE 28 | ! 29 | SUBROUTINE base64_encode_double(from, n, to) BIND(C, NAME="encode_double") 30 | IMPORT 31 | INTEGER(C_INT), VALUE, INTENT(IN) :: n 32 | REAL(C_DOUBLE), INTENT(IN) :: from(*) 33 | CHARACTER(C_CHAR), INTENT(OUT) :: to(*) 34 | END SUBROUTINE 35 | ! 36 | SUBROUTINE base64_decode_double(from, n, to) BIND(C, NAME="decode_double") 37 | IMPORT 38 | INTEGER(C_int), VALUE, INTENT(IN) :: n 39 | REAL(C_DOUBLE), INTENT(IN) :: to(*) 40 | CHARACTER(C_CHAR), INTENT(OUT) :: from(*) 41 | END SUBROUTINE 42 | ! 43 | SUBROUTINE base64_encode_complex(from, n, to) BIND(C, NAME="encode_complex") 44 | IMPORT 45 | INTEGER(C_INT), VALUE, INTENT(IN) :: n 46 | COMPLEX(C_DOUBLE_COMPLEX), INTENT(IN) :: from(*) 47 | CHARACTER(C_CHAR), INTENT(OUT) :: to(*) 48 | END SUBROUTINE 49 | ! 50 | SUBROUTINE base64_decode_complex(from, n, to) BIND(C, NAME="decode_complex") 51 | IMPORT 52 | INTEGER(C_INT), VALUE, INTENT(IN) :: n 53 | COMPLEX(C_DOUBLE_COMPLEX), INTENT(IN) :: to(*) 54 | CHARACTER(C_CHAR), INTENT(OUT) :: from(*) 55 | END SUBROUTINE 56 | ! 57 | SUBROUTINE base64_byteswap_complex(n, to) BIND(C, NAME="byteswap_complex") 58 | IMPORT 59 | INTEGER(C_INT), VALUE, INTENT(IN) :: n 60 | COMPLEX(C_DOUBLE_COMPLEX), INTENT(INOUT) :: to(*) 61 | END SUBROUTINE 62 | ! 63 | SUBROUTINE base64_byteswap_double(n, to) BIND(C, NAME="byteswap_double") 64 | IMPORT 65 | INTEGER(C_INT), VALUE, INTENT(IN) :: n 66 | REAL(C_DOUBLE), INTENT(INOUT) :: to(*) 67 | END SUBROUTINE 68 | ! 69 | END INTERFACE 70 | ! 71 | CONTAINS 72 | ! 73 | INTEGER FUNCTION lenbase64( nbytes ) 74 | IMPLICIT NONE 75 | INTEGER,INTENT(IN) :: nbytes 76 | lenbase64 = ( ( nbytes + 2 ) / 3 ) * 4 77 | END FUNCTION 78 | ! 79 | LOGICAL FUNCTION islittleendian( ) 80 | IMPLICIT NONE 81 | INTEGER :: ICHAR 82 | islittleendian = (.NOT.( ICHAR( TRANSFER(1,'a') ) == 0 )) 83 | END FUNCTION 84 | ! 85 | END MODULE 86 | -------------------------------------------------------------------------------- /Doc/installations/polaris.rst: -------------------------------------------------------------------------------- 1 | .. _polaris: 2 | 3 | ============ 4 | ALCF-Polaris 5 | ============ 6 | 7 | Polaris is a GPU-accelerated supercomputer located at Argonne National Laboratory, maintained by `ALCF `_. 8 | 9 | .. code-block:: bash 10 | 11 | $ ssh @polaris.alcf.anl.gov 12 | 13 | Building WEST 14 | ~~~~~~~~~~~~~ 15 | 16 | WEST executables can be compiled using the following script (tested on April 28, 2025): 17 | 18 | .. code-block:: bash 19 | 20 | $ cat build_west.sh 21 | #!/bin/bash 22 | 23 | module load craype-accel-nvidia80 24 | module load nvhpc/23.9 25 | module load cray-libsci/23.12.5 26 | module load cray-python/3.11.5 27 | 28 | export MPICH_GPU_SUPPORT_ENABLED=1 29 | 30 | ./configure --with-cuda=$NVIDIA_PATH/cuda/12.2 --with-cuda-runtime=12.2 --with-cuda-cc=80 --with-cuda-mpi=yes 31 | 32 | # Manually edit make.inc: 33 | 34 | # MPIF90 = ftn 35 | # F90 = ftn 36 | # CC = cc 37 | # LD = ftn 38 | # BLAS_LIBS = # leave blank 39 | # LAPACK_LIBS = # leave blank 40 | 41 | make -j 8 pw 42 | 43 | cd West 44 | 45 | make conf PYT=python3 PYT_LDFLAGS="$PYTHON_PATH/lib/libpython3.11.so" 46 | make -j 8 all 47 | 48 | To use the script do: 49 | 50 | .. code-block:: bash 51 | 52 | $ bash build_west.sh 53 | 54 | Running WEST Jobs 55 | ~~~~~~~~~~~~~~~~~ 56 | 57 | The following is an example executable script `run_west.sh` to run the `wstat.x` WEST executable on two nodes of Polaris with 4 MPI ranks and 4 GPUs per node. The must be replaced with an active project allocation. 58 | 59 | **Important**: It is recommended to run the calculation from one of the Lustre file systems (`/grand` or `/eagle` instead of `/home`). 60 | 61 | .. code-block:: bash 62 | 63 | $ cat run_west.sh 64 | #!/bin/bash -l 65 | #PBS -l select=1:system=polaris 66 | #PBS -l place=scatter 67 | #PBS -l walltime=0:20:00 68 | #PBS -l filesystems=home:grand 69 | #PBS -j oe 70 | #PBS -q debug 71 | #PBS -A 72 | #PBS -N job_name 73 | 74 | module load craype-accel-nvidia80 75 | module load nvhpc/23.9 76 | module load cray-libsci/23.12.5 77 | module load cray-python/3.11.5 78 | 79 | export MPICH_GPU_SUPPORT_ENABLED=1 80 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PYTHON_PATH/lib 81 | 82 | NNODES=`wc -l < $PBS_NODEFILE` 83 | NRANKS_PER_NODE=$(nvidia-smi -L | wc -l) 84 | NDEPTH=8 85 | NTHREADS=1 86 | NTOTRANKS=$(( NNODES * NRANKS_PER_NODE )) 87 | 88 | cd ${PBS_O_WORKDIR} 89 | 90 | mpiexec -n ${NTOTRANKS} --ppn ${NRANKS_PER_NODE} --depth=${NDEPTH} --cpu-bind depth --env OMP_NUM_THREADS=${NTHREADS} -env OMP_PLACES=threads ./wstat.x -i wstat.in &> wstat.out 91 | 92 | Job submission is done with the following: 93 | 94 | .. code-block:: bash 95 | 96 | $ qsub run_west.sh 97 | 98 | .. seealso:: 99 | For more information, visit the `ALCF user guide `_. 100 | -------------------------------------------------------------------------------- /Wfreq/wfreq.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | PROGRAM wfreq 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! This is the main program that calculates the GW. 18 | ! 19 | USE check_stop, ONLY : check_stop_init 20 | USE mp_global, ONLY : mp_startup, mp_global_end 21 | USE west_environment, ONLY : west_environment_start, west_environment_end 22 | USE westcom, ONLY : wfreq_calculation 23 | ! 24 | IMPLICIT NONE 25 | ! 26 | CHARACTER(LEN=9) :: code = 'WFREQ' 27 | LOGICAL :: lgate(9) 28 | INTEGER :: i 29 | ! 30 | ! *** START *** 31 | ! 32 | CALL check_stop_init( ) 33 | ! 34 | ! Initialize MPI, clocks, print initial messages 35 | ! 36 | #if defined(__MPI) 37 | CALL mp_startup ( start_images = .TRUE. ) 38 | #endif 39 | ! 40 | CALL west_environment_start( code ) 41 | ! 42 | CALL west_readin( code ) 43 | ! 44 | CALL wfreq_setup( ) 45 | ! 46 | lgate = .FALSE. 47 | DO i = 1, 9 48 | IF( wfreq_calculation(i:i) == 'X' ) lgate(1) = .TRUE. 49 | IF( wfreq_calculation(i:i) == 'W' ) lgate(2) = .TRUE. 50 | IF( wfreq_calculation(i:i) == 'w' ) lgate(3) = .TRUE. 51 | IF( wfreq_calculation(i:i) == 'G' ) lgate(4) = .TRUE. 52 | IF( wfreq_calculation(i:i) == 'g' ) lgate(5) = .TRUE. 53 | IF( wfreq_calculation(i:i) == 'Q' ) lgate(6) = .TRUE. 54 | IF( wfreq_calculation(i:i) == 'O' ) lgate(7) = .TRUE. 55 | IF( wfreq_calculation(i:i) == 'P' ) lgate(8) = .TRUE. 56 | IF( wfreq_calculation(i:i) == 'H' ) lgate(9) = .TRUE. 57 | ENDDO 58 | ! 59 | IF( lgate(1) ) THEN 60 | CALL solve_hf() 61 | ENDIF 62 | ! 63 | IF( lgate(2) ) THEN 64 | CALL solve_wfreq( .FALSE., lgate(7), .FALSE. ) 65 | ENDIF 66 | ! 67 | IF( lgate(3) ) THEN 68 | CALL solve_wfreq( .TRUE., lgate(7), .FALSE. ) 69 | ENDIF 70 | ! 71 | IF( lgate(9) ) THEN 72 | CALL solve_wfreq( .TRUE., lgate(7), .TRUE. ) 73 | ENDIF 74 | ! 75 | IF( lgate(4) ) THEN 76 | CALL solve_gfreq( .FALSE. ) 77 | ENDIF 78 | ! 79 | IF( lgate(5) ) THEN 80 | CALL solve_gfreq( .TRUE. ) 81 | ENDIF 82 | ! 83 | IF( lgate(6) .OR. lgate(8) ) THEN 84 | CALL solve_qp( lgate(6), lgate(8), .FALSE. ) 85 | ENDIF 86 | ! 87 | IF( lgate(9) ) THEN 88 | CALL solve_eri( 1, .TRUE. ) 89 | CALL solve_h1e( ) 90 | ENDIF 91 | ! 92 | CALL exx_ungo( ) 93 | ! 94 | CALL clean_scratchfiles( ) 95 | ! 96 | CALL west_print_clocks( ) 97 | ! 98 | CALL west_environment_end( code ) 99 | ! 100 | CALL mp_global_end( ) 101 | ! 102 | END PROGRAM 103 | -------------------------------------------------------------------------------- /Tools/human_readable_time.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015-2025 M. Govoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! This file is part of WEST. 9 | ! 10 | ! Contributors to this file: 11 | ! Marco Govoni 12 | ! 13 | !----------------------------------------------------------------------- 14 | FUNCTION human_readable_time(time) 15 | !----------------------------------------------------------------------- 16 | ! 17 | ! ... Given a time in seconds, the result is : 18 | ! ... 9999d-23h-59m-59.9s 19 | ! 20 | USE kinds, ONLY : DP 21 | ! 22 | IMPLICIT NONE 23 | ! 24 | ! I/O 25 | ! 26 | REAL(DP), INTENT(IN) :: time 27 | CHARACTER(20) :: human_readable_time 28 | ! 29 | ! Workspace 30 | ! 31 | CHARACTER(20) :: ds_temp,s_temp,m_temp,h_temp,d_temp 32 | REAL(DP) :: seconds 33 | INTEGER :: minutes,hours,days 34 | ! 35 | ! If < 0.1 s 36 | ! 37 | IF(time<0.1_DP) THEN 38 | human_readable_time="< 00.1s" 39 | RETURN 40 | ENDIF 41 | ! 42 | ! If seconds 43 | ! 44 | IF(time<60.0_DP) THEN 45 | seconds=time 46 | WRITE(s_temp,'(i2.2)') INT(seconds) 47 | WRITE(ds_temp,'(i1.1)') INT(seconds*10.0 - 10.0*INT(seconds)) 48 | human_readable_time=TRIM(ADJUSTL(s_temp))//"."//TRIM(ADJUSTL(ds_temp))//"s" 49 | RETURN 50 | ENDIF 51 | ! 52 | ! If minutes 53 | ! 54 | IF(time<3600.0_DP) THEN 55 | minutes=INT(time/60.0_DP) 56 | WRITE(m_temp,'(i2.2)') minutes 57 | seconds=time-minutes*60.0_DP 58 | WRITE(s_temp,'(i2.2)') INT(seconds) 59 | WRITE(ds_temp,'(i1.1)') INT(seconds*10.0_DP - 10.0_DP*INT(seconds)) 60 | human_readable_time=TRIM(ADJUSTL(m_temp))//"m-"//TRIM(ADJUSTL(s_temp))//"."//TRIM(ADJUSTL(ds_temp))//"s" 61 | RETURN 62 | ENDIF 63 | ! 64 | ! If hours 65 | ! 66 | IF(time<86400.0_DP) THEN 67 | hours=INT(time/3600.0_DP) 68 | WRITE(h_temp,'(i2.2)') hours 69 | minutes=INT((time-hours*3600.0_DP)/60.0_DP) 70 | WRITE(m_temp,'(i2.2)') minutes 71 | seconds=time-hours*3600.0_DP-minutes*60.0_DP 72 | WRITE(s_temp,'(i2.2)') INT(seconds) 73 | WRITE(ds_temp,'(i1.1)') INT(seconds*10.0_DP - 10.0_DP*INT(seconds)) 74 | human_readable_time=TRIM(ADJUSTL(h_temp))//"h-"//TRIM(ADJUSTL(m_temp))//"m-"//TRIM(ADJUSTL(s_temp))//& 75 | "."//TRIM(ADJUSTL(ds_temp))//"s" 76 | RETURN 77 | ENDIF 78 | ! 79 | ! If days 80 | ! 81 | days=INT(time/86400.0_DP) 82 | WRITE(d_temp,'(i5)') days 83 | hours=INT((time-days*86400.0_DP)/3600.0_DP) 84 | WRITE(h_temp,'(i2.2)') hours 85 | minutes=INT((time-days*86400.0_DP-hours*3600.0_DP)/60.0_DP) 86 | WRITE(m_temp,'(i2.2)') minutes 87 | seconds=time-days*86400.0_DP-hours*3600.0_DP-minutes*60.0_DP 88 | WRITE(s_temp,'(i2.2)') INT(seconds) 89 | WRITE(ds_temp,'(i1.1)') INT(seconds*10.0_DP - 10.0_DP*INT(seconds)) 90 | human_readable_time=& 91 | TRIM(ADJUSTL(d_temp))//"d-"//TRIM(ADJUSTL(h_temp))//"h-"//TRIM(ADJUSTL(m_temp))//"m-"//TRIM(ADJUSTL(s_temp))//& 92 | "."//TRIM(ADJUSTL(ds_temp))//"s" 93 | ! 94 | END FUNCTION 95 | -------------------------------------------------------------------------------- /Libraries/Json/README: -------------------------------------------------------------------------------- 1 | ========================================== 2 | Based on the library: json-fortran v 9.0.3 3 | ========================================== 4 | JSON-Fortran: A Modern Fortran JSON API 5 | 6 | 7 | Copyright (c) 2014-2024, Jacob Williams 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this 14 | list of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or 18 | other materials provided with the distribution. 19 | 20 | * The names of its contributors may not be used to endorse or promote products 21 | derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 30 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | > ----------------------------------------------------------------------------------------- 35 | > 36 | > Original FSON License: 37 | > 38 | > Copyright (c) 2012 Joseph A. Levin 39 | > 40 | > Permission is hereby granted, free of charge, to any person obtaining a copy of this 41 | > software and associated documentation files (the "Software"), to deal in the Software 42 | > without restriction, including without limitation the rights to use, copy, modify, merge, 43 | > publish, distribute, sublicense, and/or sell copies of the Software, and to permit 44 | > persons to whom the Software is furnished to do so, subject to the following conditions: 45 | > 46 | > The above copyright notice and this permission notice shall be included in all copies or 47 | > substantial portions of the Software. 48 | > 49 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 50 | > INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 51 | > PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 52 | > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 53 | > OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 54 | > DEALINGS IN THE SOFTWARE. 55 | > 56 | > ----------------------------------------------------------------------------------------- 57 | --------------------------------------------------------------------------------