# -*- 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.2
categories          science
platforms           darwin
license             GPL-3
maintainers         gmail.com:cram5431 \
                    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  1871a1f97bf91a07be618e1bc8015deecac6e23b \
                    sha256  d96b73442a3b6281f73c45dd1ab1af3d6a50e607497265d41ea6303bdf570807 \
                    size    5642390

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:libxc
    compilers.enforce_fortran libxc
    configure.args-append   --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