# -*- 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           compilers 1.0
PortGroup           linear_algebra 1.0

name                atompaw
version             4.1.0.6
revision            1
categories          science
platforms           darwin
license             GPL-3
maintainers         {gmail.com:cram5431 @mtorrent} \
                    openmaintainer

description         Software for generating PAW atomic datasets to be used by first-principle simulation codes

long_description    ATOMPAW is a program to be used for the generation of atomic datasets \
                    needed by first-principles simulation software based on the \
                    "Projector Augmented-Wave" (PAW) approach, which computes \
                    the electronic structure of materials within the Density-Functional theory. \
                    ATOMPAW produces, for a given atomic species, a set of basis and projectors \
                    functions, as well as some additional atomic data stored in a PAW dataset \
                    (text file). PAW datasets can be written in a XML file (conforming to XML-PAW \
                    standard) or in several proprietary formats (ABINIT, SOCORRO, Quantum Espresso, ...).

master_sites        http://users.wfu.edu/natalie/papers/pwpaw
homepage            ${master_sites}/man.html

checksums           rmd160  a0d6a1c852e2b3e057ce06be6af33c9be78f2ff9 \
                    sha256  42a46c0569367c0b971fbc3dcaf5eaec7020bdff111022b6f320de9f11c41c2c \
                    size    5648591

compilers.choose    fc
compilers.setup     require_fortran
configure.optflags  -O3
if {[fortran_variant_name] eq "g95"} {
    configure.fcflags-append -ffree-line-length-huge
} else {
    configure.fcflags-append -ffree-line-length-none
}

#apparently, parallel build does not work
#not an issue; this is a small code
use_parallel_build  no

default_variants +libxc

pre-configure {
    configure.args-append   --with-linalg-libs=${linalglib}
}

variant libxc description {Build with support for libXC exchange-correlation library} {
    depends_lib-append      port:libxc4
    compilers.enforce_fortran libxc4
    configure.args-append   --enable-libxc --with-libxc-prefix=${prefix}
}

#universal variant not allowed for libxc
universal_variant   no

#there is no check yet that results are correct
test.run            yes
test.cmd            src/atompaw
test.target         < example/F/lda/F.input

pre-configure {
    configure.args-append  FCCPP="${configure.cc} -E -ansi"
}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     atompaw-(\[0-9.\]+).tar.gz