Fetching contributors…
Cannot retrieve contributors at this time
219 lines (183 sloc) 8.18 KB
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup mpi 1.0
PortGroup linear_algebra 1.0
name abinit
version 8.8.3
categories science
platforms darwin
license GPL-3
maintainers \
description Full-featured atomic-scale first-principles simulation software
long_description ABINIT is a package whose main program allows one to find the total energy, \
charge density and electronic structure of systems made of electrons and nuclei \
(molecules and periodic solids) within Density Functional Theory (DFT), \
using pseudopotentials and a planewave or wavelet basis. \
ABINIT also includes options to optimize the geometry according to the DFT forces \
and stresses, or to perform molecular dynamics simulations using these forces, \
or to generate dynamical matrices, Born effective charges, and dielectric tensors, \
based on Density-Functional Perturbation Theory, and many more properties. \
Excited states can be computed within the Many-Body Perturbation Theory \
(the GW approximation and the Bethe-Salpeter equation), and \
Time-Dependent Density Functional Theory (for molecules). \
In addition to the main ABINIT code, different utility programs are provided. \
ABINIT is a project that favours development and collaboration.
master_sites ${homepage}/sites/default/files/packages
checksums rmd160 575f25a1853a6974caff1422747130a2323003a3 \
sha256 cceb397d1c8b81dc616e65bfb2986a8a1764e59be98e3c887b0392dfba0d4652 \
size 82567680
compilers.choose cc cxx fc
# g95 is no longer supported by abinit
mpi.setup default require_fortran -g95
configure.args-append --enable-gw-dpc
configure.fcflags-append -ffree-line-length-none
configure.optflags -O3
use_parallel_build yes
# We do not need to use ABINIT's own approach to parallel builds, which only is relevant if
# the "fallbacks" are used, namely if we asked for libxc, wannier90, etc. support
# but did not provide the libraries. That situation should never happen for this port. multi multi_nprocs=4
default_variants +libxc +wannier90
pre-configure {
if { [variant_isset netcdf] } {
configure.args-append --with-trio-flavor="netcdf"
} else {
configure.args-append --with-trio-flavor="none"
set dft-flavor "none"
if { [variant_isset libxc] } {
if { ${dft-flavor} eq "none" } {
set dft-flavor libxc
} else {
set dft-flavor ${dft-flavor}+libxc
if { [variant_isset wannier90] } {
if { ${dft-flavor} eq "none" } {
set dft-flavor wannier90
} else {
set dft-flavor ${dft-flavor}+wannier90
# if { [variant_isset bigdft] } {
# if { ${dft-flavor} eq "none" } {
# set dft-flavor bigdft
# } else {
# set dft-flavor ${dft-flavor}+bigdft
# }
# }
# if { [variant_isset atompaw] } {
# if { ${dft-flavor} eq "none" } {
# set dft-flavor atompaw
# } else {
# set dft-flavor ${dft-flavor}+atompaw
# }
# }
configure.args-append --with-dft-flavor="${dft-flavor}"
set linalg-flavor "none"
if { [variant_isset atlas] } {
set linalg-flavor atlas
} else {
set linalg-flavor netlib
if { [variant_isset scalapack] } {
set linalg-flavor ${linalg-flavor}+scalapack
set linalglib "${linalglib} -lscalapack"
configure.args-append --with-linalg-flavor="${linalg-flavor}"
configure.args-append --with-linalg-libs="${linalglib}"
# install binaries and pkgconfig but not the very large number of test files install-exec install-data-local
#universal variant not allowed for libxc
universal_variant no yes
test.cmd tests/
# args -t0 for no timeout since it cannot be found anyway; or: set depends_build-append port:timeout built-in fast tutorespfn tutorial unitary built-in fast tutorespfn tutorial unitary v1 v2 v3 v4 v5 v6 v67mbpt v7
# for +scalapack +atlas -libxc:
# hang in test [v2][t79].
# :info:test [tutorial][tspin_6][np=1]: failed: absolute error 2.7e-08 > 2.5e-08
# other config options to add:
# --enable-mpi-inplace
# --with-atompaw-libs; --with-atompaw-incs
pre-test {
if {[mpi_variant_isset]} { paral mpiio tutoparal
reinplace "s|mpirun -np|${mpi.exec} -np|" ${worksrcpath}/tests/pymods/
test.args-append -n 1
} else { seq
pre-configure {
configure.args-append FCCPP="${} -E -ansi"
if {[mpi_variant_isset]} {
configure.args-append --enable-mpi="yes" --enable-mpi-io="yes"
} else {
configure.args-append --enable-mpi="no"
variant fftw3 description {Build with support for fftw-3 FFT library} {
depends_lib-append port:fftw-3 port:fftw-3-single
compilers.enforce_some_fortran fftw-3 fftw-3-single
if { [variant_isset threads] } {
configure.args-append --with-fft-flavor="fftw3-threads"
configure.args-append --with-fft-libs="-lfftw3_threads -lfftw3 -lfftw3f"
} else {
configure.args-append --with-fft-flavor="fftw3"
configure.args-append --with-fft-libs="-lfftw3 -lfftw3f"
variant threads description {Build with support for OpenMP threads} {
configure.args-append --enable-openmp
configure.fcflags-append -fopenmp
variant netcdf description {Build with support for NetCDF transferable I/O} {
depends_lib-append port:netcdf-fortran
compilers.enforce_fortran netcdf-fortran
configure.args-append --with-netcdf-incs="-I${prefix}/include"
configure.args-append --with-netcdf-libs="-L${prefix}/lib -lnetcdf -lnetcdff"
# check compatibility with MPI?
# add support for gsl, yaml?
variant libxc description {Build with support for libXC exchange-correlation library} {
# configure explicitly forbids libxc > 4.0.0 for some reason
depends_lib-append port:libxc
compilers.enforce_fortran libxc
configure.args-append --with-libxc-incs="-I${prefix}/include"
configure.args-append --with-libxc-libs="-L${prefix}/lib -lxc -lxcf90" libxc
variant scalapack description {Build with ScaLAPACK for parallel linear algebra} {
depends_lib-append port:scalapack
if {![mpi_variant_isset]} {
ui_error "+scalapack requires an MPI variant. Choose +mpich, +mpich_devel, +openmpi, or +openmpi_devel."
return -code error "+scalapack requires an MPI variant."
mpi.setup require
mpi.enforce_variant scalapack
variant wannier90 description {Build with support for Wannier90} {
depends_lib-append port:wannier90 wannier90 tutoplugs vdwxc
# FIXME: the code's build system will download BigDFT itself, which is contrary to the
# way MacPorts should work. Make a bigdft port to support this.
# There is an error compiling anyway, which could be fixed with a patch,
# but it is unpatchable since the download occurs after the patch phase.
#variant bigdft description {Build with support for the wavelet BigDFT library} {
# avoid this error (and equivalent with OpenCL)
# :info:build ar cru libCUDA.a
# :info:build ar: no archive members specified
# patchfiles-append
# FIXME: same problem as for BigDFT, it gets downloaded. Make a separate port.
#variant atompaw description {Build including AtomPAW atomic dataset generator} {
livecheck.type regex
livecheck.url ${homepage}/packages
livecheck.regex ABINIT v (\[0-9.\]+)