Dalton package: add versions and variants (#28226)

* Update existing 2020.0 version to use tag
* Add versions 2018.2 and master
* Add patches for GCC/Intel
* Use MPI compiler wrappers when +mpi
* Constrain CMake build dependency (need >= 3.1)
* Add variants for optional components (e.g QFIT library)
This commit is contained in:
Jógvan Magnus Haugaard Olsen 2022-01-08 03:59:17 +01:00 committed by GitHub
parent 34f0222fdd
commit 897616f073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 225 additions and 26 deletions

View file

@ -0,0 +1,57 @@
--- a/DALTON/include/cbiexc.h
+++ b/DALTON/include/cbiexc.h
@@ -1,34 +1,25 @@
!
! cbiexc.h - Control common block for abacus/abaexc.F
!
- LOGICAL SKIP, CUT, DIPSTR, ROTSTR, ROTVEL, FNAC, EXCTRP,
-CPFP
-C & SUMRUL, OOTV
- & SUMRUL, OOTV, MAGPRP,
-Cend-PFP
-CClark:7/1/2016
- & STOPPW
- REAL*8 QMIN,QMAX,QSTEP
- REAL*8 VMIN,VMAX,VSTEP
- INTEGER LQ,LVEL
-CClark:end
- PARAMETER (MAXPP = 200)
- CHARACTER*8 LABAPP
- COMMON /PPLBL / LABAPP(MAXPP), LABSYM(MAXPP)
- COMMON /CBIEXC/ THREXC,
-CClark:7/1/2016
- & QMIN,QMAX,QSTEP,
- & VMIN,VMAX,VSTEP,
- & LQ,LVEL,
-CClark:end
- & NEXCIT(8), MAXITE, MXNEXI, MXRM,
+ INTEGER, PARAMETER :: MAXPP = 200
+ LOGICAL :: SKIP, CUT, DIPSTR, ROTSTR, ROTVEL, FNAC, EXCTRP,
+ & SUMRUL, OOTV, MAGPRP, STOPPW
+ INTEGER :: LQ, LVEL, NEXCIT(8), MAXITE, MXNEXI, MXRM,
+ & MXPHP, NABAPP, IPREXC, IPR1IN
+ REAL*8 :: QMIN, QMAX, QSTEP, VMIN, VMAX, VSTEP, QINP,
+ & THREXC
+ CHARACTER*8 :: LABAPP(MAXPP)
+ INTEGER :: LABSYM(MAXPP)
+!
+!
+ COMMON /PPLBL / LABAPP, LABSYM
+! LOGICAL
+ COMMON /CBIEXC/ SKIP, CUT, DIPSTR, ROTSTR, ROTVEL, FNAC,
+ & EXCTRP, SUMRUL, OOTV, MAGPRP, STOPPW,
+! INTEGER
+ & LQ, LVEL, NEXCIT, MAXITE, MXNEXI, MXRM,
& MXPHP, NABAPP, IPREXC, IPR1IN,
- & SKIP, CUT, DIPSTR, ROTSTR, ROTVEL, FNAC, EXCTRP,
-CPFP
-C & SUMRUL, OOTV
- & SUMRUL, OOTV, MAGPRP,
-Cend-PFP
-CClark:7/1/2016
- & STOPPW
-CClark:end
+! REAL
+ & QINP, THREXC, QMIN, QMAX, QSTEP, VMIN, VMAX,
+ & VSTEP
! -- end of abaexc.h --

View file

@ -7,40 +7,67 @@
class Dalton(CMakePackage):
"""
The Dalto nprogram is designed to allow convenient,
automated determination of a largenumber of molecular properties
based on an HF, HF-srDFT, DFT, MP2, CC, CI, MCSCF or MC-srDFT
reference wave function.
"""Molecular electronic-structure program with extensive
functionality for calculations of molecular properties
at the HF, DFT, MCSCF, MC-srDFT, and CC levels of theory.
"""
homepage = "https://daltonprogram.org"
git = 'https://gitlab.com/dalton/dalton.git'
git = 'https://gitlab.com/dalton/dalton.git'
version('2020.0', branch='Dalton2020.0', submodules=True)
maintainers = ['foeroyingur']
depends_on('blas')
depends_on('lapack')
depends_on('mpi')
version('master', branch='master', submodules=True)
version('2020.0', tag='2020.0', submodules=True)
version('2018.2', tag='2018.2', submodules=True)
variant('build_type', default='Release', values=('Debug', 'Release'),
description='CMake build type')
variant('ilp64', default=False, description='Use 64-bit integers')
variant('mpi', default=True, description='Use MPI')
variant('gen1int', default=True, description='Build Gen1Int library')
variant('pelib', default=True, when='~ilp64',
description='Build PE library to enable polarizable embedding calculations')
variant('pde', default=True, when='@2020.0: +pelib',
description='Enable polarizable density embedding through the PE library')
variant('qfitlib', default=True, description='Build QFIT library')
depends_on('cmake@3.1:', type='build')
depends_on('blas', type='link')
depends_on('lapack', type='link')
with when('+pde'):
depends_on('hdf5+fortran', when='+mpi', type='link')
depends_on('hdf5+fortran~mpi', when='~mpi', type='link')
depends_on('mpi', when='+mpi', type=('build', 'link', 'run'))
patch('pelib-master.patch', when='@master+mpi+pelib%gcc@10:',
working_dir='external/pelib')
patch('pelib-2020.0.patch', when='@2020.0+mpi+pelib%gcc@10:',
working_dir='external/pelib')
patch('soppa-2018.2.patch', when='@2018.2%intel')
patch('cbiexc-2018.2.patch', when='@2018.2%intel')
conflicts('%gcc@10:', when='@2018.2',
msg='Dalton 2018.2 cannot be built with GCC >= 10, please use an older'
' version or a different compiler suite.')
def setup_run_environment(self, env):
env.prepend_path('PATH', self.spec.prefix.join('dalton'))
def cmake_args(self):
spec = self.spec
args = ['-DENABLE_BUILTIN_BLAS=OFF',
'-DENABLE_BUILTIN_LAPACK=OFF',
'-DUSE_BUILTIN_LAPACK=OFF',
'-DENABLE_STATIC_LINKING=OFF',
'-DENABLE_MPI=ON',
'-DCMAKE_C_COMPILER={0}'.format(
spec['mpi'].prefix.bin.mpicc),
'-DCMAKE_CXX_COMPILER={0}'.format(
spec['mpi'].prefix.bin.mpicxx),
'-DCMAKE_Fortran_COMPILER={0}'.format(
spec['mpi'].prefix.bin.mpif90),
'-DMPIEXEC_MAX_NUMPROCS=128'
]
math_libs = self.spec['lapack'].libs + self.spec['blas'].libs
if '+mpi' in self.spec:
env['CC'] = self.spec['mpi'].mpicc
env['CXX'] = self.spec['mpi'].mpicxx
env['F77'] = self.spec['mpi'].mpif77
env['FC'] = self.spec['mpi'].mpifc
args = ['-DEXPLICIT_LIBS:STRING={0}'.format(math_libs.ld_flags),
self.define('ENABLE_AUTO_BLAS', False),
self.define('ENABLE_AUTO_LAPACK', False),
self.define_from_variant('ENABLE_MPI', variant='mpi'),
self.define_from_variant('ENABLE_64BIT_INTEGERS', variant='ilp64'),
self.define_from_variant('ENABLE_GEN1INT', variant='gen1int'),
self.define_from_variant('ENABLE_PELIB', variant='pelib'),
self.define_from_variant('ENABLE_PDE', variant='pde'),
self.define_from_variant('ENABLE_QFITLIB', variant='qfitlib')]
return args

View file

@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -101,7 +101,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} --coverage")
endif()
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -Ofast -mtune=native")
- set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -Og -pedantic -fcheck=all -fbacktrace -Wall -Wextra -Warray-temporaries -Wcharacter-truncation -Wconversion-extra -Wsurprising -Wimplicit-interface -Wimplicit-procedure -Wrealloc-lhs -Wrealloc-lhs-all")
+ set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -Og -fcheck=all -fbacktrace -Wall -Wextra -Warray-temporaries -Wcharacter-truncation -Wconversion-extra -Wsurprising -Wimplicit-interface -Wimplicit-procedure -Wrealloc-lhs -Wrealloc-lhs-all")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "8.2.0")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -std=f2008ts")
else()

View file

@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,7 +107,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} --coverage")
endif()
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -Ofast -march=native -mtune=native")
- set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -Og -pedantic -fcheck=all -fbacktrace -Wall -Wextra -Warray-temporaries -Wcharacter-truncation -Wconversion-extra -Wsurprising -Wimplicit-interface -Wimplicit-procedure -Wrealloc-lhs -Wrealloc-lhs-all")
+ set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -Og -fcheck=all -fbacktrace -Wall -Wextra -Warray-temporaries -Wcharacter-truncation -Wconversion-extra -Wsurprising -Wimplicit-interface -Wimplicit-procedure -Wrealloc-lhs -Wrealloc-lhs-all")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "8.2.0")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -std=f2008ts")
else()

View file

@ -0,0 +1,93 @@
--- a/DALTON/soppa/so_stoppw.F
+++ b/DALTON/soppa/so_stoppw.F
@@ -1,19 +1,22 @@
C
-C /* Deck so_stoppw */
- SUBROUTINE SO_STOPPW(STOPP,TRGOS,ISYMTR,IEXCI,EXENG,QVAL)
+ SUBROUTINE SO_STOPPW(RSTOPP,TRGOS,ISYMTR,IEXCI,EXENG,QVAL)
C
C This routine is part of the atomic integral directSOPPA program.
-C
+C The charge Z of the incoming ions is set to 1 here.
C Zhiwen Shi (Clark), Stephan P. A. Sauer, January 2016
-C
C PURPOSE: Calculate Stopping Power.
C
-#include "implicit.h"
-#include "cbiexc.h"
-#include "ccorb.h"
+ implicit none
+#include "cbiexc.h" ! LVEL, MXNEXI
+#include "ccorb.h" ! NSYM
+#include "pi.h" ! PI
C
- DIMENSION STOPP(3,LVEL),TRGOS(3),EXENG(NSYM,MXNEXI)
- REAL*8 QVAL,VELOC,QMAXV,QMINV
+ REAL*8, INTENT(INOUT) :: RSTOPP(3,LVEL,2)
+ REAL*8, INTENT(IN) :: TRGOS(3), EXENG(NSYM,MXNEXI), QVAL
+ INTEGER, INTENT(IN) :: ISYMTR, IEXCI
+ REAL*8 :: VELOC, QMAXV, QMINV
+ REAL*8, PARAMETER :: D4 = 4.0D0
+ INTEGER :: IVEL
C
C------------------
C Add to trace.
@@ -28,19 +31,52 @@ C
DO IVEL=1, LVEL
C
VELOC = VMIN+(IVEL-1)*VSTEP
-C
QMAXV = VELOC*2
QMINV = EXENG(ISYMTR,IEXCI)/VELOC
C
IF (QMINV .LE. QMAXV) THEN
C
- IF ((QVAL .GE. QMINV) .AND. (QVAL .LE. QMAXV)) THEN
+ IF ((QVAL .GE. QMINV) .AND. (QVAL .LE. QMAXV)) THEN
+C
+ RSTOPP(1,IVEL,1) = RSTOPP(1,IVEL,1) + TRGOS(1)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
+ RSTOPP(2,IVEL,1) = RSTOPP(2,IVEL,1) + TRGOS(2)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
+ RSTOPP(3,IVEL,1) = RSTOPP(3,IVEL,1) + TRGOS(3)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
+
+ ENDIF
+C
+C The next line makes sure that the split integration will be applied
+C after the velocity is larger than half of Q value.
+C This velocity as half of chosen Q value corresponds to
+C the highest excitation energy for given basis set.
+C i.e. integration can be split after this velocity.
+C
+ IF (VELOC .GE. QINP/2.0d0) THEN
+C
+ IF ((QVAL .GE. QMINV) .AND. (QVAL .LE. QINP)
+ & .AND. (QVAL .LE. QMAXV)) THEN
+C
+ RSTOPP(1,IVEL,2) = RSTOPP(1,IVEL,2) + TRGOS(1)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
+ RSTOPP(2,IVEL,2) = RSTOPP(2,IVEL,2) + TRGOS(2)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
+ RSTOPP(3,IVEL,2) = RSTOPP(3,IVEL,2) + TRGOS(3)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
+C
+ ENDIF
+C
+ ELSEIF ((QVAL .GE. QMINV) .AND. (QVAL .LE. QMAXV)) THEN
C
- STOPP(1,IVEL) = STOPP(1,IVEL) + TRGOS(1)*QSTEP
- STOPP(2,IVEL) = STOPP(2,IVEL) + TRGOS(2)*QSTEP
- STOPP(3,IVEL) = STOPP(3,IVEL) + TRGOS(3)*QSTEP
+ RSTOPP(1,IVEL,2) = RSTOPP(1,IVEL,2) + TRGOS(1)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
+ RSTOPP(2,IVEL,2) = RSTOPP(2,IVEL,2) + TRGOS(2)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
+ RSTOPP(3,IVEL,2) = RSTOPP(3,IVEL,2) + TRGOS(3)*QSTEP*
+ & PI*D4/(QVAL*VELOC*VELOC)
C
- ENDIF
+ ENDIF
C
ENDIF
C