Commit 22a4c6b8 authored by Micael Oliveira's avatar Micael Oliveira
Browse files

Merge branch...

Merge branch '40-the-build-system-does-not-set-library-flags-of-libxml2-and-gsl-for-pkg-config' into 'develop'

Resolve "The build system does not set library flags of LibXML2 and GSL for pkg-config"

Closes #40

See merge request !31
parents 8c448aa0 321cadce
Pipeline #1532 passed with stage
in 1 minute and 27 seconds
......@@ -2,10 +2,12 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
pio_lib_f=@pio_lib_f@
pio_lib_f=@pio_lib_f_pc@
pio_lib_gsl=@pio_lib_gsl_pc@
pio_lib_xml=@pio_lib_xml_pc@
Name: pspio
Description: Agnostic Pseudopotential I/O Library
Version: @VERSION@
Libs: -L${libdir} ${pio_lib_f} -lpspio
Libs: -L${libdir} ${pio_lib_f} -lpspio ${pio_lib_xml} ${pio_lib_gsl}
Cflags: -I${includedir}
......@@ -79,7 +79,7 @@ AC_ARG_ENABLE([gsl],
AC_HELP_STRING([--enable-gsl],
[Enable support for GSL (default: enabled)]),
[],
[enable_gsl="yes"])
[enable_gsl="no"])
AC_ARG_WITH([gsl-incs],
AC_HELP_STRING([--with-gsl-incs],
[Includes for the GSL library]))
......@@ -344,15 +344,29 @@ fi
# ---------------------------------------------------------------------------- #
#
# Fortran configuration
# Export configuration
#
# Send Fortran status to pkg-config
pio_lib_f=""
pio_lib_f_pc=""
if test "${enable_fortran}" = "yes"; then
pio_lib_f="-lpspiof"
pio_lib_f_pc="-lpspiof"
fi
AC_SUBST(pio_lib_f)
AC_SUBST(pio_lib_f_pc)
# Send GSL status to pkg-config
pio_lib_gsl_pc=""
if test "${enable_gsl}" = "yes"; then
pio_lib_gsl_pc="${pio_gsl_libs}"
fi
AC_SUBST(pio_lib_gsl_pc)
# Send XML status to pkg-config
pio_lib_xml_pc=""
if test "${enable_xml}" = "yes"; then
pio_lib_xml_pc="${pio_xml_libs}"
fi
AC_SUBST(pio_lib_xml_pc)
# ---------------------------------------------------------------------------- #
......
......@@ -31,6 +31,17 @@
#include "config.h"
#endif
#if defined HAVE_GSL
#define TOL_FUNC 1.0e-10
#define TOL_DER1 1.0e-10
#define TOL_DER2 1.0e-10
#else
#define TOL_FUNC 1.0e-6
#define TOL_DER1 3.5e-1
#define TOL_DER2 1.5e-1
#endif
static pspio_mesh_t *m1 = NULL, *m2 = NULL;
static pspio_meshfunc_t *mf11 = NULL, *mf12 = NULL, *mf2 = NULL;
static double *f11, *f11p, *f11pp;
......@@ -114,7 +125,7 @@ void meshfunc_teardown(void)
free(f2pp);
}
void meshfunc_compare_values(const pspio_mesh_t *mesh, const pspio_meshfunc_t *meshfunc, const double *f, const double *fp, const double *fpp, const double tol)
void meshfunc_compare_values(const pspio_mesh_t *mesh, const pspio_meshfunc_t *meshfunc, const double *f, const double *fp, const double *fpp, const double tol_func, const double tol_der1, const double tol_der2)
{
int i;
const double *ff, *ffp, *ffpp;
......@@ -124,9 +135,9 @@ void meshfunc_compare_values(const pspio_mesh_t *mesh, const pspio_meshfunc_t *m
ffp = pspio_meshfunc_get_deriv1(meshfunc);
ffpp = pspio_meshfunc_get_deriv2(meshfunc);
for (i=0; i<pspio_mesh_get_np(mesh); i++) {
ck_assert_msg( fabs(f[i] - ff[i]) < tol, "function at point %i: interp= %16.10e expected=%16.10e\n", i, ff[i], f[i]);
ck_assert_msg( fabs(fp[i] - ffp[i]) < tol, "deriv at point %i: interp= %16.10e expected=%16.10e\n", i, ffp[i], fp[i]);
ck_assert_msg( fabs(fpp[i] - ffpp[i]) < tol, "deriv2 at point %i: interp= %16.10e expected=%16.10e\n", i, ffpp[i], fpp[i]);
ck_assert_msg( fabs(f[i] - ff[i]) < tol_func, "function at point %i: interp= %16.10e expected=%16.10e\n", i, ff[i], f[i]);
ck_assert_msg( fabs(fp[i] - ffp[i]) < tol_der1, "deriv at point %i: interp= %16.10e expected=%16.10e\n", i, ffp[i], fp[i]);
ck_assert_msg( fabs(fpp[i] - ffpp[i]) < tol_der2, "deriv2 at point %i: interp= %16.10e expected=%16.10e\n", i, ffpp[i], fpp[i]);
}
}
......@@ -144,7 +155,7 @@ START_TEST(test_meshfunc_init1)
2.0295953518e+00, 1.8895268024e+00, 2.4601351993e+00, 0.0};
ck_assert(pspio_meshfunc_init(mf11, m1, f11, NULL, NULL) == PSPIO_SUCCESS);
meshfunc_compare_values(m1, mf11, f11, fp, fpp, 1e-10);
meshfunc_compare_values(m1, mf11, f11, fp, fpp, TOL_FUNC, TOL_DER1, TOL_DER2);
}
END_TEST
......@@ -154,14 +165,14 @@ START_TEST(test_meshfunc_init2)
2.0295953518e+00, 1.8895268024e+00, 2.4601351993e+00, 0.0};
ck_assert(pspio_meshfunc_init(mf11, m1, f11, f11p, NULL) == PSPIO_SUCCESS);
meshfunc_compare_values(m1, mf11, f11, f11p, fpp, 1e-10);
meshfunc_compare_values(m1, mf11, f11, f11p, fpp, TOL_FUNC, TOL_DER1, TOL_DER2);
}
END_TEST
START_TEST(test_meshfunc_init3)
{
ck_assert(pspio_meshfunc_init(mf11, m1, f11, f11p, f11pp) == PSPIO_SUCCESS);
meshfunc_compare_values(m1, mf11, f11, f11p, f11pp, 1e-10);
meshfunc_compare_values(m1, mf11, f11, f11p, f11pp, TOL_FUNC, TOL_DER1, TOL_DER2);
}
END_TEST
......@@ -299,10 +310,11 @@ START_TEST(test_meshfunc_eval)
{
pspio_meshfunc_init(mf11, m1, f12, f12p, f12pp);
/* Interpolation */
ck_assert(fabs(pspio_meshfunc_eval(mf11, 0.001) - 2.688989e-08) <= 1e-10);
ck_assert_msg(fabs(pspio_meshfunc_eval(mf11, 0.001) - 2.688989e-08) <= TOL_FUNC,
"function at x=%16.10e: interp= %16.10e expected=%16.10e\n", 0.001, pspio_meshfunc_eval(mf11, 0.001), 2.688989e-08);
/* Extrapolation */
ck_assert(fabs(pspio_meshfunc_eval(mf11, -0.1) + 2.500000e-04) <= 1e-10);
ck_assert(fabs(pspio_meshfunc_eval(mf11, 1.1) - 1.257250e+00) <= 1e-10);
ck_assert(fabs(pspio_meshfunc_eval(mf11, -0.1) + 2.500000e-04) <= TOL_FUNC);
ck_assert(fabs(pspio_meshfunc_eval(mf11, 1.1) - 1.257250e+00) <= TOL_FUNC);
}
END_TEST
......@@ -310,10 +322,10 @@ START_TEST(test_meshfunc_eval_deriv)
{
pspio_meshfunc_init(mf11, m1, f12, f12p, f12pp);
/* Interpolation */
ck_assert(fabs(pspio_meshfunc_eval_deriv(mf11, 0.001) - 8.697106e-05) <= 1e-10);
ck_assert(fabs(pspio_meshfunc_eval_deriv(mf11, 0.001) - 8.697106e-05) <= TOL_DER1);
/* Extrapolation */
ck_assert(fabs(pspio_meshfunc_eval_deriv(mf11, -0.1) + 1.500000e-02) <= 1e-10);
ck_assert(fabs(pspio_meshfunc_eval_deriv(mf11, 1.1) - 3.555000e+00) <= 1e-10);
ck_assert(fabs(pspio_meshfunc_eval_deriv(mf11, -0.1) + 1.500000e-02) <= TOL_DER1);
ck_assert(fabs(pspio_meshfunc_eval_deriv(mf11, 1.1) - 3.555000e+00) <= TOL_DER1);
}
END_TEST
......@@ -321,10 +333,10 @@ START_TEST(test_meshfunc_eval_deriv2)
{
pspio_meshfunc_init(mf11, m1, f12, f12p, f12pp);
/* Interpolation */
ck_assert(fabs(pspio_meshfunc_eval_deriv2(mf11, 0.001) - 6.000000e-03) <= 1e-10);
ck_assert(fabs(pspio_meshfunc_eval_deriv2(mf11, 0.001) - 6.000000e-03) <= TOL_DER2);
/* Extrapolation */
ck_assert(fabs(pspio_meshfunc_eval_deriv2(mf11, -0.1) + 6.000000e-01) <= 1e-10);
ck_assert(fabs(pspio_meshfunc_eval_deriv2(mf11, 1.1) - 6.600000e+00) <= 1e-10);
ck_assert(fabs(pspio_meshfunc_eval_deriv2(mf11, -0.1) + 6.000000e-01) <= TOL_DER2);
ck_assert(fabs(pspio_meshfunc_eval_deriv2(mf11, 1.1) - 6.600000e+00) <= TOL_DER2);
}
END_TEST
......
......@@ -26,6 +26,20 @@
#include "pspio_error.h"
#include "pspio_potential.h"
#if defined HAVE_CONFIG_H
#include "config.h"
#endif
#if defined HAVE_GSL
#define TOL_FUNC 1.0e-10
#define TOL_DER1 1.0e-10
#define TOL_DER2 1.0e-10
#else
#define TOL_FUNC 1.0e-10
#define TOL_DER1 1.0e+0
#define TOL_DER2 1.0e-10
#endif
static pspio_mesh_t *m1 = NULL, *m2 = NULL;
static pspio_qn_t *qn11 = NULL, *qn12 = NULL, *qn2 = NULL;
......@@ -199,7 +213,7 @@ START_TEST(test_potential_eval)
pspio_potential_init(pot11, qn11, m1, v11);
eval = pspio_potential_eval(pot11, 0.01);
expect = 1.6456049569e+00;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "potential eval returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_FUNC, "potential eval returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......@@ -210,7 +224,7 @@ START_TEST(test_potential_eval_deriv)
pspio_potential_init(pot11, qn11, m1, v11);
eval = pspio_potential_eval_deriv(pot11, 0.01);
expect = -1.5477352024e-01;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "potential eval deriv returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_DER1, "potential eval deriv returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......@@ -221,7 +235,7 @@ START_TEST(test_potential_eval_deriv2)
pspio_potential_init(pot11, qn11, m1, v11);
eval = pspio_potential_eval_deriv2(pot11, 0.01);
expect = -5.8963771072e-03;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "potential eval deriv2 returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_DER2, "potential eval deriv2 returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......
......@@ -26,6 +26,19 @@
#include "pspio_error.h"
#include "pspio_projector.h"
#if defined HAVE_CONFIG_H
#include "config.h"
#endif
#if defined HAVE_GSL
#define TOL_FUNC 1.0e-10
#define TOL_DER1 1.0e-10
#define TOL_DER2 1.0e-10
#else
#define TOL_FUNC 1.0e-10
#define TOL_DER1 1.0e-1
#define TOL_DER2 1.0e-10
#endif
static pspio_mesh_t *m1 = NULL, *m2 = NULL;
......@@ -131,7 +144,7 @@ END_TEST
START_TEST(test_projector_init)
{
ck_assert(pspio_projector_init(proj11, qn11, e11, m1, p11) == PSPIO_SUCCESS);
projector_compare_values(m1, proj11, qn11, e11, p11, 1e-10);
projector_compare_values(m1, proj11, qn11, e11, p11, TOL_FUNC);
}
END_TEST
......@@ -216,7 +229,7 @@ START_TEST(test_projector_eval)
pspio_projector_init(proj11, qn11, e11, m1, p11);
eval = pspio_projector_eval(proj11, 0.01);
expect = 1.6456049569e+00;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "projector eval returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_FUNC, "projector eval returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......@@ -227,7 +240,7 @@ START_TEST(test_projector_eval_deriv)
pspio_projector_init(proj11, qn11, e11, m1, p11);
eval = pspio_projector_eval_deriv(proj11, 0.01);
expect = -1.5477352024e-01;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "projector eval deriv returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_DER1, "projector eval deriv returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......@@ -238,7 +251,7 @@ START_TEST(test_projector_eval_deriv2)
pspio_projector_init(proj11, qn11, e11, m1, p11);
eval = pspio_projector_eval_deriv2(proj11, 0.01);
expect = -5.8963771072e-03;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "projector eval deriv2 returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_DER2, "projector eval deriv2 returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......
......@@ -27,6 +27,16 @@
#include "pspio_error.h"
#include "pspio_state.h"
#if defined HAVE_GSL
#define TOL_FUNC 1.0e-10
#define TOL_DER1 1.0e-10
#define TOL_DER2 1.0e-10
#else
#define TOL_FUNC 1.0e-10
#define TOL_DER1 6.5e-2
#define TOL_DER2 1.0e-10
#endif
static pspio_mesh_t *m1 = NULL, *m2 = NULL;
static pspio_qn_t *qn11 = NULL, *qn12 = NULL, *qn2 = NULL;
......@@ -139,14 +149,14 @@ END_TEST
START_TEST(test_state_init)
{
ck_assert(pspio_state_init(state11, e11, qn11, occ11, rc11, m1, wf11, "1s0.5") == PSPIO_SUCCESS);
state_compare_values(state11, e11, qn11, occ11, rc11, m1, wf11, "1s0.5", 1e-10);
state_compare_values(state11, e11, qn11, occ11, rc11, m1, wf11, "1s0.5", TOL_FUNC);
}
END_TEST
START_TEST(test_state_init_label)
{
ck_assert(pspio_state_init(state11, e11, qn11, occ11, rc11, m1, wf11, NULL) == PSPIO_SUCCESS);
state_compare_values(state11, e11, qn11, occ11, rc11, m1, wf11, "2s0.5", 1e-10);
state_compare_values(state11, e11, qn11, occ11, rc11, m1, wf11, "2s0.5", TOL_FUNC);
}
END_TEST
......@@ -319,7 +329,7 @@ START_TEST(test_state_wf_eval)
pspio_state_init(state11, e11, qn11, occ11, rc11, m1, wf11, NULL);
eval = pspio_state_wf_eval(state11, 0.01);
expect = 1.6456049569e+00;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "wavefunction eval returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_FUNC, "wavefunction eval returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......@@ -330,7 +340,7 @@ START_TEST(test_state_wf_eval_deriv)
pspio_state_init(state11, e11, qn11, occ11, rc11, m1, wf11, NULL);
eval = pspio_state_wf_eval_deriv(state11, 0.01);
expect = -1.5477352024e-01;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "wavefunction eval deriv returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_DER1, "wavefunction eval deriv returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......@@ -341,7 +351,7 @@ START_TEST(test_state_wf_eval_deriv2)
pspio_state_init(state11, e11, qn11, occ11, rc11, m1, wf11, NULL);
eval = pspio_state_wf_eval_deriv2(state11, 0.01);
expect = -5.8963771072e-03;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "wavefunction eval deriv2 returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_DER2, "wavefunction eval deriv2 returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......
......@@ -26,6 +26,16 @@
#include "pspio_error.h"
#include "pspio_xc.h"
#if defined HAVE_GSL
#define TOL_FUNC 1.0e-10
#define TOL_DER1 1.0e-10
#define TOL_DER2 1.0e-10
#else
#define TOL_FUNC 1.0e-10
#define TOL_DER1 6.5e-2
#define TOL_DER2 1.0e-10
#endif
static pspio_mesh_t *m1 = NULL, *m2 = NULL;
static pspio_xc_t *xc11 = NULL, *xc12 = NULL, *xc2 = NULL;
......@@ -153,7 +163,7 @@ START_TEST(test_xc_setget_nlcc_density)
ck_assert(pspio_xc_set_nlcc_density(xc11, m1, cd11, NULL, NULL) == PSPIO_SUCCESS);
cd = pspio_meshfunc_get_function(pspio_xc_get_nlcc_density(xc11));
for (i=0; i<pspio_mesh_get_np(m1); i++) {
ck_assert( fabs(cd[i] - cd11[i]) < 1e-10);
ck_assert( fabs(cd[i] - cd11[i]) < TOL_FUNC);
}
}
END_TEST
......@@ -161,7 +171,7 @@ END_TEST
START_TEST(test_xc_init)
{
ck_assert(pspio_xc_init(xc11, xid11, cid11, nlcc11, nlccpfs11, nlccpfv11, m1, cd11, NULL, NULL) == PSPIO_SUCCESS);
xc_compare_values(xc11, xid11, cid11, nlcc11, nlccpfs11, nlccpfv11, m1, cd11, 1e-10);
xc_compare_values(xc11, xid11, cid11, nlcc11, nlccpfs11, nlccpfv11, m1, cd11, TOL_FUNC);
}
END_TEST
......@@ -240,7 +250,7 @@ START_TEST(test_xc_nlcc_density_eval)
pspio_xc_init(xc11, xid11, cid11, nlcc11, nlccpfs11, nlccpfv11, m1, cd11, NULL, NULL);
eval = pspio_xc_nlcc_density_eval(xc11, 0.01);
expect = 1.6456049569e+00;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "nlcc density eval returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_FUNC, "nlcc density eval returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......@@ -251,7 +261,7 @@ START_TEST(test_xc_nlcc_density_eval_deriv)
pspio_xc_init(xc11, xid11, cid11, nlcc11, nlccpfs11, nlccpfv11, m1, cd11, NULL, NULL);
eval = pspio_xc_nlcc_density_eval_deriv(xc11, 0.01);
expect = -1.5477352024e-01;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "nlcc density eval deriv returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_DER1, "nlcc density eval deriv returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......@@ -262,7 +272,7 @@ START_TEST(test_xc_nlcc_density_eval_deriv2)
pspio_xc_init(xc11, xid11, cid11, nlcc11, nlccpfs11, nlccpfv11, m1, cd11, NULL, NULL);
eval = pspio_xc_nlcc_density_eval_deriv2(xc11, 0.01);
expect = -5.8963771072e-03;
ck_assert_msg(fabs(eval - expect) <= 1e-10, "nlcc density eval deriv2 returned= %16.10e expected= %16.10e\n", eval, expect);
ck_assert_msg(fabs(eval - expect) <= TOL_DER2, "nlcc density eval deriv2 returned= %16.10e expected= %16.10e\n", eval, expect);
}
END_TEST
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment