mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-23 12:57:20 +01:00
commit
754c795932
108
.github/workflows/test-build.yml
vendored
108
.github/workflows/test-build.yml
vendored
@ -18,70 +18,94 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install emacs autoconf libhdf5-dev
|
||||
|
||||
- name: Install trexio
|
||||
#- name: Install trexio from the distribution tarball
|
||||
# run: |
|
||||
# export TAG=v2.1.0
|
||||
# export VERSION=2.1.0
|
||||
# wget https://github.com/TREX-CoE/trexio/releases/download/${TAG}/trexio-${VERSION}.tar.gz
|
||||
# tar -zxf trexio-${VERSION}.tar.gz
|
||||
# cd trexio-${VERSION}
|
||||
# ./configure --prefix=/usr
|
||||
# make -j 4
|
||||
# sudo make install
|
||||
- name: Install the latest TREXIO from the GitHub clone
|
||||
run: |
|
||||
export TAG=v2.1.0
|
||||
export VERSION=2.1.0
|
||||
wget https://github.com/TREX-CoE/trexio/releases/download/${TAG}/trexio-${VERSION}.tar.gz
|
||||
tar -zxf trexio-${VERSION}.tar.gz
|
||||
cd trexio-${VERSION}
|
||||
git clone https://github.com/TREX-CoE/trexio.git
|
||||
cd trexio
|
||||
./autogen.sh
|
||||
./configure --prefix=/usr
|
||||
make -j 8
|
||||
make -j 4
|
||||
sudo make install
|
||||
|
||||
- name: Build
|
||||
- name: Build QMCkl
|
||||
run: |
|
||||
./autogen.sh
|
||||
./configure --enable-silent-rules --enable-debug
|
||||
make -j 8
|
||||
make -j 4
|
||||
|
||||
- name: Run test
|
||||
run: |
|
||||
make -j check
|
||||
run: make -j 4 check
|
||||
|
||||
- name: Archive test log file
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: test-report
|
||||
name: test-report-ubuntu
|
||||
path: test-suite.log
|
||||
|
||||
- name: Dist test
|
||||
run: |
|
||||
make distcheck
|
||||
run: make distcheck
|
||||
|
||||
- name: Archive test log file
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dist-report
|
||||
name: dist-report-ubuntu
|
||||
path: test-suite.log
|
||||
|
||||
x86_macos:
|
||||
|
||||
# x86_macos:
|
||||
#
|
||||
# runs-on: macos-latest
|
||||
# name: x86 MacOS latest
|
||||
#
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - name: install dependencies
|
||||
# run: |
|
||||
# brew install gfortran-10
|
||||
# brew install emacs
|
||||
# brew install autoconf automake libtool
|
||||
# - name: install trexio
|
||||
# run: |
|
||||
# wget https://github.com/TREX-CoE/trexio/releases/download/v1.0/trexio-1.0.0.tar.gz
|
||||
# tar -zxf trexio-1.0.0.tar.gz
|
||||
# cd trexio-1.0.0
|
||||
# ./configure
|
||||
# make -j 8
|
||||
# sudo make install
|
||||
# - name: Run test
|
||||
# run: |
|
||||
# ./autogen.sh
|
||||
# ./configure --enable-silent-rules --enable-debug
|
||||
# make -j 8
|
||||
# make -j check
|
||||
# make distcheck
|
||||
runs-on: macos-latest
|
||||
name: x86 MacOS latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: install dependencies
|
||||
run: brew install emacs hdf5 automake pkg-config
|
||||
|
||||
- name: Symlink gfortran (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
# make sure gfortran is available
|
||||
# https://github.com/actions/virtual-environments/issues/2524
|
||||
# https://github.com/cbg-ethz/dce/blob/master/.github/workflows/pkgdown.yaml
|
||||
sudo ln -s /usr/local/bin/gfortran-10 /usr/local/bin/gfortran
|
||||
sudo mkdir /usr/local/gfortran
|
||||
sudo ln -s /usr/local/Cellar/gcc@10/*/lib/gcc/10 /usr/local/gfortran/lib
|
||||
gfortran --version
|
||||
|
||||
- name: Install the latest TREXIO from the GitHub clone
|
||||
run: |
|
||||
git clone https://github.com/TREX-CoE/trexio.git
|
||||
cd trexio
|
||||
./autogen.sh
|
||||
./configure --prefix=${PWD}/_install --enable-silent-rules
|
||||
make -j 4
|
||||
make install
|
||||
|
||||
- name: Build QMCkl
|
||||
run: |
|
||||
export PKG_CONFIG_PATH=${PWD}/trexio/_install/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||
./autogen.sh
|
||||
./configure --enable-silent-rules --enable-debug
|
||||
make -j 4
|
||||
|
||||
- name: Run test
|
||||
run: make -j 4 check
|
||||
|
||||
- name: Archive test log file
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: test-report-macos
|
||||
path: test-suite.log
|
||||
|
@ -75,7 +75,6 @@ AC_PROG_CC
|
||||
m4_version_prereq([2.70],[], [AC_PROG_CC_C99])
|
||||
AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
|
||||
AC_PROG_CC_C_O
|
||||
AC_PROG_F77
|
||||
AC_PROG_FC
|
||||
AC_PROG_FC_C_O
|
||||
AC_FC_SRCEXT([f90])
|
||||
|
@ -349,7 +349,7 @@ qmckl_exit_code qmckl_init_jastrow(qmckl_context context) {
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||
assert (ctx != NULL);
|
||||
|
||||
ctx->jastrow.uninitialized = (1 << 6) - 1;
|
||||
ctx->jastrow.uninitialized = (1 << 5) - 1;
|
||||
|
||||
/* Default values */
|
||||
|
||||
@ -633,7 +633,6 @@ qmckl_exit_code qmckl_set_jastrow_type_nucl_vector (qmckl_context context, con
|
||||
qmckl_exit_code qmckl_set_jastrow_aord_vector (qmckl_context context, const double * aord_vector);
|
||||
qmckl_exit_code qmckl_set_jastrow_bord_vector (qmckl_context context, const double * bord_vector);
|
||||
qmckl_exit_code qmckl_set_jastrow_cord_vector (qmckl_context context, const double * cord_vector);
|
||||
qmckl_exit_code qmckl_set_jastrow_dependencies (qmckl_context context);
|
||||
#+end_src
|
||||
|
||||
#+NAME:pre2
|
||||
@ -650,8 +649,8 @@ qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||
ctx->jastrow.uninitialized &= ~mask;
|
||||
ctx->jastrow.provided = (ctx->jastrow.uninitialized == 0);
|
||||
if (ctx->jastrow.provided) {
|
||||
//qmckl_exit_code rc_ = qmckl_set_jastrow_dependencies(context);
|
||||
//if (rc_ != QMCKL_SUCCESS) return rc_;
|
||||
qmckl_exit_code rc_ = qmckl_finalize_jastrow(context);
|
||||
if (rc_ != QMCKL_SUCCESS) return rc_;
|
||||
}
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
@ -918,30 +917,6 @@ qmckl_exit_code qmckl_set_jastrow_cord_vector(qmckl_context context, double cons
|
||||
<<post2>>
|
||||
}
|
||||
|
||||
qmckl_exit_code qmckl_set_jastrow_dependencies(qmckl_context context) {
|
||||
<<pre2>>
|
||||
|
||||
/* Check for electron data */
|
||||
if (!(ctx->electron.provided)) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_NOT_PROVIDED,
|
||||
"qmckl_provide_ee_distance",
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Check for nucleus data */
|
||||
if (!(ctx->nucleus.provided)) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_NOT_PROVIDED,
|
||||
"qmckl_provide_en_distance",
|
||||
NULL);
|
||||
}
|
||||
|
||||
int32_t mask = 1 << 6;
|
||||
|
||||
<<post2>>
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
When the required information is completely entered, other data structures are
|
||||
@ -988,13 +963,9 @@ qmckl_exit_code qmckl_finalize_jastrow(qmckl_context context) {
|
||||
NULL);
|
||||
}
|
||||
|
||||
qmckl_exit_code rc = QMCKL_FAILURE;
|
||||
qmckl_exit_code rc = QMCKL_SUCCESS;
|
||||
return rc;
|
||||
|
||||
/* ----------------------------------- */
|
||||
/* Start calculation of data */
|
||||
/* ----------------------------------- */
|
||||
|
||||
|
||||
}
|
||||
#+end_src
|
||||
@ -1332,17 +1303,40 @@ integer function qmckl_compute_asymp_jasb_f(context, bord_num, bord_vector, resc
|
||||
end function qmckl_compute_asymp_jasb_f
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes
|
||||
qmckl_exit_code qmckl_compute_asymp_jasb (
|
||||
const qmckl_context context,
|
||||
const int64_t bord_num,
|
||||
const double* bord_vector,
|
||||
const double rescale_factor_kappa_ee,
|
||||
double* const asymp_jasb ) {
|
||||
// Put some code here
|
||||
|
||||
double kappa_inv, x, asym_one;
|
||||
|
||||
kappa_inv = 1.0 / rescale_factor_kappa_ee;
|
||||
|
||||
if (context == QMCKL_NULL_CONTEXT){
|
||||
return QMCKL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
if (bord_num <= 0) {
|
||||
return QMCKL_INVALID_ARG_2;
|
||||
}
|
||||
|
||||
asym_one = bord_vector[0] * kappa_inv / (1.0 + bord_vector[1] * kappa_inv);
|
||||
asymp_jasb[0] = asym_one;
|
||||
asymp_jasb[1] = 0.5 * asym_one;
|
||||
|
||||
for (int i = 0 ; i <= 1; ++i) {
|
||||
x = kappa_inv;
|
||||
for (int p = 1; p < bord_num; ++p){
|
||||
x = x * kappa_inv;
|
||||
asymp_jasb[i] = asymp_jasb[i] + bord_vector[p + 1] * x;
|
||||
}
|
||||
}
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
} // end function qmckl_exit_code
|
||||
}
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_asymp_jasb_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
@ -1415,8 +1409,6 @@ rc = qmckl_set_jastrow_bord_vector(context, bord_vector);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
rc = qmckl_set_jastrow_cord_vector(context, cord_vector);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
rc = qmckl_set_jastrow_dependencies(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
/* Check if Jastrow is properly initialized */
|
||||
assert(qmckl_jastrow_provided(context));
|
||||
@ -1619,6 +1611,70 @@ integer function qmckl_compute_factor_ee_f(context, walk_num, elec_num, up_num,
|
||||
end function qmckl_compute_factor_ee_f
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes
|
||||
qmckl_exit_code qmckl_compute_factor_ee (
|
||||
const qmckl_context context,
|
||||
const int64_t walk_num,
|
||||
const int64_t elec_num,
|
||||
const int64_t up_num,
|
||||
const int64_t bord_num,
|
||||
const double* bord_vector,
|
||||
const double* ee_distance_rescaled,
|
||||
const double* asymp_jasb,
|
||||
double* const factor_ee ) {
|
||||
|
||||
int ipar; // can we use a smaller integer?
|
||||
double pow_ser, x, spin_fact, power_ser;
|
||||
|
||||
if (context == QMCKL_NULL_CONTEXT) {
|
||||
return QMCKL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
if (walk_num <= 0) {
|
||||
return QMCKL_INVALID_ARG_2;
|
||||
}
|
||||
|
||||
if (elec_num <= 0) {
|
||||
return QMCKL_INVALID_ARG_3;
|
||||
}
|
||||
|
||||
if (bord_num <= 0) {
|
||||
return QMCKL_INVALID_ARG_4;
|
||||
}
|
||||
|
||||
for (int nw = 0; nw < walk_num; ++nw) {
|
||||
factor_ee[nw] = 0.0; // put init array here.
|
||||
for (int j = 0; j < elec_num; ++j ) {
|
||||
for (int i = 0; i < j; ++i) {
|
||||
x = ee_distance_rescaled[j + elec_num*(i + elec_num*nw)];
|
||||
power_ser = 0.0;
|
||||
spin_fact = 1.0;
|
||||
ipar = 0; // index of asymp_jasb
|
||||
|
||||
for (int p = 1; p < bord_num; ++p) {
|
||||
x = x * ee_distance_rescaled[j + elec_num*(i + elec_num*nw)];
|
||||
power_ser = power_ser + bord_vector[p + 1] * x;
|
||||
}
|
||||
|
||||
if(j <= up_num || i > up_num) {
|
||||
spin_fact = 0.5;
|
||||
ipar = 1;
|
||||
}
|
||||
|
||||
factor_ee[nw] = factor_ee[nw] + spin_fact * bord_vector[0] * \
|
||||
ee_distance_rescaled[j + elec_num*(i + elec_num*nw)] / \
|
||||
(1.0 + bord_vector[1] * \
|
||||
ee_distance_rescaled[j + elec_num*(i + elec_num*nw)]) \
|
||||
-asymp_jasb[ipar] + power_ser;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_factor_ee_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
|
||||
#+RESULTS:
|
||||
@ -1638,47 +1694,6 @@ end function qmckl_compute_factor_ee_f
|
||||
|
||||
#+CALL: generate_c_interface(table=qmckl_factor_ee_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_compute_factor_ee &
|
||||
(context, &
|
||||
walk_num, &
|
||||
elec_num, &
|
||||
up_num, &
|
||||
bord_num, &
|
||||
bord_vector, &
|
||||
ee_distance_rescaled, &
|
||||
asymp_jasb, &
|
||||
factor_ee) &
|
||||
bind(C) result(info)
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
implicit none
|
||||
|
||||
integer (c_int64_t) , intent(in) , value :: context
|
||||
integer (c_int64_t) , intent(in) , value :: walk_num
|
||||
integer (c_int64_t) , intent(in) , value :: elec_num
|
||||
integer (c_int64_t) , intent(in) , value :: up_num
|
||||
integer (c_int64_t) , intent(in) , value :: bord_num
|
||||
real (c_double ) , intent(in) :: bord_vector(bord_num + 1)
|
||||
real (c_double ) , intent(in) :: ee_distance_rescaled(elec_num,elec_num,walk_num)
|
||||
real (c_double ) , intent(in) :: asymp_jasb(2)
|
||||
real (c_double ) , intent(out) :: factor_ee(walk_num)
|
||||
|
||||
integer(c_int32_t), external :: qmckl_compute_factor_ee_f
|
||||
info = qmckl_compute_factor_ee_f &
|
||||
(context, &
|
||||
walk_num, &
|
||||
elec_num, &
|
||||
up_num, &
|
||||
bord_num, &
|
||||
bord_vector, &
|
||||
ee_distance_rescaled, &
|
||||
asymp_jasb, &
|
||||
factor_ee)
|
||||
|
||||
end function qmckl_compute_factor_ee
|
||||
#+end_src
|
||||
|
||||
*** Test
|
||||
#+begin_src python :results output :exports none :noweb yes
|
||||
|
@ -2,10 +2,12 @@ rank_metadata_code 0
|
||||
rank_metadata_author 0
|
||||
metadata_code_num_isSet 0
|
||||
metadata_author_num_isSet 0
|
||||
metadata_unsafe_isSet 0
|
||||
len_metadata_package_version 6
|
||||
metadata_package_version
|
||||
2.0.0
|
||||
2.2.0
|
||||
len_metadata_description 0
|
||||
metadata_description
|
||||
metadata_code
|
||||
metadata_author
|
||||
metadata_unsafe_isSet 0
|
||||
|
Loading…
Reference in New Issue
Block a user