aboutsummaryrefslogtreecommitdiff
path: root/science/cp2k/Makefile
blob: ef21041ed5a4cbad9f81ec6aa02b0f056bd55a15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
PORTNAME=	cp2k
DISTVERSIONPREFIX=	v
DISTVERSION=	2026.1
PORTREVISION=	1
CATEGORIES=	science

MAINTAINER=	yuri@FreeBSD.org
COMMENT=	Quantum chemistry and solid state physics software package
WWW=		https://www.cp2k.org/ \
		https://github.com/cp2k/cp2k

LICENSE=	GPLv2+
LICENSE_FILE=	${WRKSRC}/LICENSE

.if !exists(/usr/include/omp.h)
BROKEN=		requires OpenMP support that is missing on this architecture
.endif

BUILD_DEPENDS=	fypp:devel/py-fypp@${PY_FLAVOR}
LIB_DEPENDS=	libdbcsr.so:math/dbcsr \
		libfftw3.so:math/fftw3 \
		libopenblas.so:math/openblas
RUN_DEPENDS=	cp2k-data>0:science/cp2k-data
TEST_DEPENDS=	bash:shells/bash

USES=		cmake fortran localbase:ldflags python:build,test shebangfix tar:bz2
USE_GCC=	yes # OpenMP is used from both Fortan and C code, therefore C code should be compiled with GCC, otherwise it fails at run-time (same in dbcsr)

USE_GITHUB=	yes

SHEBANG_GLOB=	*.py

GCC_VERSION=	${GCC_DEFAULT}

MAKE_ARGS=	XARCH=FreeBSD-gfortran VERSION=${VERSION} FC=gfortran${GCC_VERSION} CC=${CC} LD=gfortran${GCC_VERSION} \
		DATA_DIR=${DATADIR}

FFLAGS+=	-D__NO_STATM_ACCESS

BINARY_ALIAS=	python=${PYTHON_CMD} python3=${PYTHON_CMD}

OPTIONS_DEFINE=		LIBINT MPIX
OPTIONS_DEFAULT=	MPIX # LIBINT

LIBINT_DESC=		Use libint to evaluate integrals
LIBINT_CMAKE_BOOL=	CP2K_USE_LIBINT2
LIBINT_LIB_DEPENDS=	libint2.so:science/libint2
LIBINT_BROKEN=		missing fortran support

MPIX_DESC=		Enable MPI
MPIX_CMAKE_BOOL=	CP2K_USE_MPI
MPIX_USES=		mpi:mpich
MPIX_LIB_DEPENDS=	libscalapack.so:math/scalapack
MPIX_VARS=		EXE_VERSION=psmp
MPIX_VARS_OFF=		EXE_VERSION=ssmp

PLIST_SUB=		SUFFIX=.${EXE_VERSION}

do-test: install
	@cd ${WRKSRC}/ && \
		${SETENV} ${MAKE_ENV} CP2K_STEM=${PREFIX}/bin/cp2k \
			./tests/do_regtest.py ${BUILD_WRKSRC}/bin ${EXE_VERSION}

# build instructions: https://github.com/cp2k/cp2k/blob/master/INSTALL.md

# tests as of 2026.1:
# Number of FAILED  tests 0
# Number of WRONG   tests 0
# Number of CORRECT tests 3038
# Total number of   tests 3038
#
# Summary: correct: 3038 / 3038; 20min
# Status: OK

.include <bsd.port.mk>