Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions var/spack/repos/builtin/packages/vasp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# VASP Spack Package Notes

Note that VASP is proprietary software, and that users must obtain their own licensed copy of the source code. The patches in this package contain minimal amounts of VASP source code, and are publicized with the permission of the VASP developers. The VASPsol++ patches were written by Craig Plaisance and are used here with permission.
27 changes: 24 additions & 3 deletions var/spack/repos/builtin/packages/vasp/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ class Vasp(MakefilePackage, CudaPackage):
when="+vaspsol",
)

# specify exact commit as there is no appropriate tag available
resource(
name="vaspsolpp",
git="https://github.com/VASPsol/VASPsol.git",
commit="6626f27",
when="@6.3.2 +vaspsolpp",
)

resource(
name="vtsttools",
url="https://theory.cm.utexas.edu/code/vtstcode-209.tgz",
sha256="8f88265ab200ba61a3cbae119d05677e2744b5338fb9073ce6d901f38c17774b",
when="@6.5.1 +vtsttools"
when="@6.5.1,6.3.2 +vtsttools"
)

variant("openmp", default=False, when="@6:", description="Enable openmp build")
Expand All @@ -73,17 +81,28 @@ class Vasp(MakefilePackage, CudaPackage):
description="Enable VASPsol implicit solvation model\n"
"https://github.com/henniggroup/VASPsol",
)
variant(
"vaspsolpp",
default=False,
when="@6.3.2",
description="Enable VASPsol++ implicit solvation model\n"
"https://github.com/VASPSol/VASPsol",
)
variant("shmem", default=True, description="Enable use_shmem build flag")
variant("hdf5", default=False, when="@6.2:", description="Enabled HDF5 support")
variant(
"vtsttools",
default=False,
when="@6.5.1",
when="@6.3.2,6.5.1",
description="Enable VASP TST Tools\n"
"https://theory.cm.utexas.edu/vtsttools/index.html",
)

patch("vtsttools-6.5.1.patch", when="@6.5.1 +vtsttools")
patch("vtsttools-6.3.2.patch", when="@6.3.2 +vtsttools")
patch("vaspsol++-vasp_6.3.2.patch", when="@6.3.2 +vaspsolpp~vtsttools")
patch("vaspsol++-vtst-vasp_6.3.2.patch", when="@6.3.2 +vaspsolpp+vtsttools")
patch("vaspsol++-remove-intel.patch", when="@6.3.2 +vaspsolpp")

depends_on("rsync", type="build")
depends_on("blas")
Expand Down Expand Up @@ -286,13 +305,15 @@ def edit(self, spec, prefix):
cflags.extend(["-DGPUSHMEM=300", "-DHAVE_CUBLAS"])
filter_file(r"^CUDA_ROOT[ \t]*\?=.*$", spec["cuda"].prefix, make_include)

if spec.satisfies("+vaspsol"):
if spec.satisfies("+vaspsol") or spec.satisfies("+vaspsolpp"):
cpp_options.append("-Dsol_compat")
copy("VASPsol/src/solvation.F", "src/")

if spec.satisfies("+vtsttools"):
if spec.satisfies("@6.5.1"):
copy_tree("vtstcode-209/vtstcode6.5.1", "src")
elif spec.satisfies("@6.3.2"):
copy_tree("vtstcode-209/vtstcode6.3", "src")

if spec.satisfies("+hdf5"):
cpp_options.append("-DVASP_HDF5")
Expand Down
152 changes: 152 additions & 0 deletions var/spack/repos/builtin/packages/vasp/vaspsol++-remove-intel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
diff --git a/VASPsol/src/solvation.F b/VASPsol/src/solvation.F
index 1fba277..ef8fb77 100644
--- a/VASPsol/src/solvation.F
+++ b/VASPsol/src/solvation.F
@@ -35,8 +35,6 @@
#define ifdsol !
#endif

-#define ABORT CALL TRACEBACKQQ; CALL M_exit(); CALL ABORT
-
#define dsol_io ifdsol sol_io


@@ -56,7 +54,6 @@ MODULE solvation_grid
USE poscar, ONLY : type_info
USE lattice, ONLY : latt
USE mgrid, ONLY : grid_3d
- USE IFCORE

IMPLICIT NONE

@@ -1072,7 +1069,6 @@ MODULE solvation_lpcm
USE base
USE constant
USE mpimy
- USE IFCORE
USE solvation_grid

IMPLICIT NONE
@@ -1516,7 +1512,6 @@ MODULE solvation_nlpcm
USE base
USE constant
USE mpimy
- USE IFCORE
USE solvation_grid

IMPLICIT NONE
@@ -2355,7 +2350,7 @@ END SUBROUTINE SET_LPB
IF (LNLDIEL) THEN
ALLOCATE(x0(DIMREAL(GRIDC%MPLWV)))
x0 = PBETA*E_loc(:,4)
- CALL fzero_vec(F_floc, a, b, tol, f_loc, x0)
+ CALL fzero_vec(a, b, tol, f_loc, x0)
ELSE
f_loc = 1._q/(1._q - (alpha_pol+alpha0_rot)*invalpha_sic)
ENDIF
@@ -2363,24 +2358,6 @@ END SUBROUTINE SET_LPB
DO I = 1,4
E_loc(:,I) = f_loc*E_loc(:,I)
END DO
-
-
-CONTAINS
-
-
-ELEMENTAL REAL(q) FUNCTION F_floc(f_loc, x0)
- REAL(q), INTENT(IN) :: f_loc, x0
- REAL(q) :: x, g_rot
- x = f_loc*x0
- ! g_rot has relative fp error of 1e-8
- IF (x < 2e-4_q) THEN
- g_rot = 1._q
- ELSE
- g_rot = 3._q*(x-TANH(x))/(x**2*TANH(x))
- ENDIF
- F_floc = 1._q /(1._q - (g_rot*alpha0_rot + alpha_pol)*invalpha_sic) - f_loc
-END FUNCTION F_floc
-

END SUBROUTINE SOLVE_E_LOC

@@ -2390,20 +2367,13 @@ END SUBROUTINE SOLVE_E_LOC
!! Uses Brent's method - adapted from:
!! https://people.math.sc.edu/Burkardt/f_src/brent/brent.f90
!!============================================================================
-SUBROUTINE fzero_vec(f, a0, b0, tol, x, x0)
+SUBROUTINE fzero_vec(a0, b0, tol, x, x0)

USE prec

REAL(q), INTENT(IN) :: a0, b0, tol, x0(:)
REAL(q), INTENT(OUT) :: x(:)

- INTERFACE
- ELEMENTAL REAL(q) FUNCTION f(x, x0)
- USE prec
- REAL(q), INTENT(IN) :: x, x0
- END FUNCTION f
- END INTERFACE
-
REAL(q), ALLOCATABLE :: a(:), b(:), c(:), d(:), e(:), m(:), p(:), r(:), s1(:), s2(:), s3(:), fa(:), fb(:), fc(:)
REAL(q), ALLOCATABLE :: tol_abs(:)

@@ -2425,8 +2395,8 @@ SUBROUTINE fzero_vec(f, a0, b0, tol, x, x0)

a = a0
b = b0
- fa = f(a, x0)
- fb = f(b, x0)
+ fa = calc_F(a, x0)
+ fb = calc_F(b, x0)

!IF ( ANY( ((fa>0._q).AND.(fb>0._q)) .OR. ((fa<0._q).AND.(fb<0._q)) ) ) THEN
! ABORT
@@ -2509,12 +2479,28 @@ SUBROUTINE fzero_vec(f, a0, b0, tol, x, x0)
! Next point
a = b; fa = fb
b = b + SIGN( MAX(ABS(d), tol_abs), m )
- fb = f(b, x0)
+ fb = calc_F(b, x0)

ENDDO

x = b

+CONTAINS
+
+ FUNCTION calc_F(f_loc, x0) RESULT(F)
+ REAL(q), INTENT(IN) :: f_loc(:), x0(:)
+ REAL(q) :: F(SIZE(x0))
+ REAL(q) :: x(SIZE(x0)), g_rot(SIZE(x0))
+ x = f_loc*x0
+ ! g_rot has relative fp error of 1e-8
+ WHERE (x < 2e-4_q)
+ g_rot = 1._q
+ ELSEWHERE
+ g_rot = 3._q*(x-TANH(x))/(x**2*TANH(x))
+ ENDWHERE
+ F = 1._q /(1._q - (g_rot*alpha0_rot + alpha_pol)*invalpha_sic) - f_loc
+ END FUNCTION calc_F
+
END SUBROUTINE fzero_vec


@@ -3432,7 +3418,7 @@ END SUBROUTINE update_NELECT
!! check if Fermi level is converged for constant potential calculation
!!
!!====================================================================
-PURE FUNCTION check_EFERMI(EFERMI)
+FUNCTION check_EFERMI(EFERMI)

LOGICAL :: check_EFERMI
REAL(q), INTENT(IN) :: EFERMI
@@ -3447,7 +3433,7 @@ END FUNCTION check_EFERMI
!! Constant potential calculation?
!!
!!====================================================================
-PURE FUNCTION L_const_pot
+FUNCTION L_const_pot()
LOGICAL :: L_const_pot
L_const_pot = (EFERMI_ref < 0._q)
END FUNCTION L_const_pot
Loading