mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Fix fortran strings in trexio interface
This commit is contained in:
parent
2ffcf25492
commit
73399e24ec
26
.github/workflows/test-build.yml
vendored
26
.github/workflows/test-build.yml
vendored
@ -40,7 +40,9 @@ jobs:
|
|||||||
- name: Build QMCkl
|
- name: Build QMCkl
|
||||||
run: |
|
run: |
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure --enable-silent-rules --enable-debug
|
mkdir _build
|
||||||
|
cd _build
|
||||||
|
../configure --enable-silent-rules --enable-debug
|
||||||
make -j 4
|
make -j 4
|
||||||
|
|
||||||
- name: Run test
|
- name: Run test
|
||||||
@ -89,6 +91,28 @@ jobs:
|
|||||||
git clone https://github.com/TREX-CoE/trexio.git
|
git clone https://github.com/TREX-CoE/trexio.git
|
||||||
cd trexio
|
cd trexio
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
|
mkdir _build
|
||||||
|
cd _build
|
||||||
|
../configure --enable-silent-rules
|
||||||
|
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-ubuntu
|
||||||
|
path: test-suite.log
|
||||||
|
|
||||||
|
- name: Dist test
|
||||||
|
run: make distcheck
|
||||||
|
|
||||||
|
- name: Archive test log file
|
||||||
|
if: failure()
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
./configure --prefix=${PWD}/_install --enable-silent-rules
|
./configure --prefix=${PWD}/_install --enable-silent-rules
|
||||||
make -j 4
|
make -j 4
|
||||||
make install
|
make install
|
||||||
|
@ -2822,6 +2822,72 @@ qmckl_get_ao_basis_ao_vgl (qmckl_context context,
|
|||||||
end interface
|
end interface
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
Uses the give array to compute the VGL.
|
||||||
|
|
||||||
|
#+begin_src c :comments org :tangle (eval h_func) :noweb yes
|
||||||
|
qmckl_exit_code
|
||||||
|
qmckl_get_ao_basis_ao_vgl_inplace (qmckl_context context,
|
||||||
|
double* const ao_vgl,
|
||||||
|
const int64_t size_max);
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||||
|
qmckl_exit_code
|
||||||
|
qmckl_get_ao_basis_ao_vgl_inplace (qmckl_context context,
|
||||||
|
double* const ao_vgl,
|
||||||
|
const int64_t size_max)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||||
|
return qmckl_failwith( context,
|
||||||
|
QMCKL_INVALID_CONTEXT,
|
||||||
|
"qmckl_get_ao_basis_ao_vgl",
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
qmckl_exit_code rc;
|
||||||
|
|
||||||
|
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||||
|
assert (ctx != NULL);
|
||||||
|
|
||||||
|
int64_t sze = ctx->ao_basis.ao_num * 5 * ctx->point.num;
|
||||||
|
if (size_max < sze) {
|
||||||
|
return qmckl_failwith( context,
|
||||||
|
QMCKL_INVALID_ARG_3,
|
||||||
|
"qmckl_get_ao_basis_ao_vgl",
|
||||||
|
"input array too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = qmckl_context_touch(context);
|
||||||
|
if (rc != QMCKL_SUCCESS) return rc;
|
||||||
|
|
||||||
|
double* old_array = ctx->ao_basis.ao_vgl;
|
||||||
|
|
||||||
|
ctx->ao_basis.ao_vgl = ao_vgl;
|
||||||
|
|
||||||
|
rc = qmckl_provide_ao_vgl(context);
|
||||||
|
if (rc != QMCKL_SUCCESS) return rc;
|
||||||
|
|
||||||
|
ctx->ao_basis.ao_vgl = old_array;
|
||||||
|
|
||||||
|
return QMCKL_SUCCESS;
|
||||||
|
}
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
|
interface
|
||||||
|
integer(c_int32_t) function qmckl_get_ao_basis_ao_vgl_inplace (context, &
|
||||||
|
ao_vgl, size_max) bind(C)
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
|
import
|
||||||
|
implicit none
|
||||||
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
|
double precision, intent(out) :: ao_vgl(*)
|
||||||
|
integer (c_int64_t) , intent(in) , value :: size_max
|
||||||
|
end function qmckl_get_ao_basis_ao_vgl_inplace
|
||||||
|
end interface
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Radial part
|
* Radial part
|
||||||
|
|
||||||
** General functions for Gaussian basis functions
|
** General functions for Gaussian basis functions
|
||||||
|
@ -668,14 +668,14 @@ assert(!qmckl_nucleus_provided(context));
|
|||||||
rc = qmckl_get_nucleus_coord (context, 'N', nucl_coord2, 3*nucl_num);
|
rc = qmckl_get_nucleus_coord (context, 'N', nucl_coord2, 3*nucl_num);
|
||||||
assert(rc == QMCKL_SUCCESS);
|
assert(rc == QMCKL_SUCCESS);
|
||||||
for (size_t k=0 ; k<3 ; ++k) {
|
for (size_t k=0 ; k<3 ; ++k) {
|
||||||
for (size_t i=0 ; i<nucl_num ; ++i) {
|
for (int64_t i=0 ; i<nucl_num ; ++i) {
|
||||||
assert( nucl_coord[nucl_num*k+i] == nucl_coord2[3*i+k] );
|
assert( nucl_coord[nucl_num*k+i] == nucl_coord2[3*i+k] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = qmckl_get_nucleus_coord (context, 'T', nucl_coord2, 3*nucl_num);
|
rc = qmckl_get_nucleus_coord (context, 'T', nucl_coord2, 3*nucl_num);
|
||||||
assert(rc == QMCKL_SUCCESS);
|
assert(rc == QMCKL_SUCCESS);
|
||||||
for (size_t i=0 ; i<3*nucl_num ; ++i) {
|
for (int64_t i=0 ; i<3*nucl_num ; ++i) {
|
||||||
assert( nucl_coord[i] == nucl_coord2[i] );
|
assert( nucl_coord[i] == nucl_coord2[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,7 +689,7 @@ assert(rc == QMCKL_SUCCESS);
|
|||||||
|
|
||||||
rc = qmckl_get_nucleus_charge(context, nucl_charge2, nucl_num);
|
rc = qmckl_get_nucleus_charge(context, nucl_charge2, nucl_num);
|
||||||
assert(rc == QMCKL_SUCCESS);
|
assert(rc == QMCKL_SUCCESS);
|
||||||
for (size_t i=0 ; i<nucl_num ; ++i) {
|
for (int64_t i=0 ; i<nucl_num ; ++i) {
|
||||||
assert( nucl_charge[i] == nucl_charge2[i] );
|
assert( nucl_charge[i] == nucl_charge2[i] );
|
||||||
}
|
}
|
||||||
assert(qmckl_nucleus_provided(context));
|
assert(qmckl_nucleus_provided(context));
|
||||||
|
@ -1055,20 +1055,22 @@ qmckl_trexio_read_mo_X(qmckl_context context, trexio_t* const file)
|
|||||||
#+begin_src c :tangle (eval h_func)
|
#+begin_src c :tangle (eval h_func)
|
||||||
qmckl_exit_code
|
qmckl_exit_code
|
||||||
qmckl_trexio_read(const qmckl_context context,
|
qmckl_trexio_read(const qmckl_context context,
|
||||||
const char* file_name);
|
const char* file_name,
|
||||||
|
const int64_t size_max);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
interface
|
interface
|
||||||
integer(c_int32_t) function qmckl_trexio_read &
|
integer(c_int32_t) function qmckl_trexio_read &
|
||||||
(context, file_name) &
|
(context, file_name, size_max) &
|
||||||
bind(C)
|
bind(C)
|
||||||
use, intrinsic :: iso_c_binding
|
use, intrinsic :: iso_c_binding
|
||||||
import
|
import
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) , value :: context
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
character(c_char ) , intent(in) :: file_name(*)
|
integer (c_int64_t) , intent(in) , value :: size_max
|
||||||
|
character(c_char ) , intent(in) :: file_name(size_max)
|
||||||
|
|
||||||
end function qmckl_trexio_read
|
end function qmckl_trexio_read
|
||||||
end interface
|
end interface
|
||||||
@ -1076,16 +1078,19 @@ qmckl_trexio_read(const qmckl_context context,
|
|||||||
|
|
||||||
#+begin_src c :tangle (eval c)
|
#+begin_src c :tangle (eval c)
|
||||||
qmckl_exit_code
|
qmckl_exit_code
|
||||||
qmckl_trexio_read(const qmckl_context context, const char* file_name)
|
qmckl_trexio_read(const qmckl_context context, const char* file_name, const int64_t size_max)
|
||||||
{
|
{
|
||||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qmckl_exit_code rc;
|
qmckl_exit_code rc;
|
||||||
|
char file_name_new[size_max+1];
|
||||||
|
strncpy(file_name_new, file_name, size_max+1);
|
||||||
|
file_name_new[size_max] = '\0';
|
||||||
|
|
||||||
#ifdef HAVE_TREXIO
|
#ifdef HAVE_TREXIO
|
||||||
trexio_t* file = qmckl_trexio_open_X(file_name, &rc);
|
trexio_t* file = qmckl_trexio_open_X(file_name_new, &rc);
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
trexio_close(file);
|
trexio_close(file);
|
||||||
return qmckl_failwith( context,
|
return qmckl_failwith( context,
|
||||||
@ -1164,7 +1169,7 @@ strncat(fname, "/chbrclf", 255);
|
|||||||
printf("Test file: %s\n", fname);
|
printf("Test file: %s\n", fname);
|
||||||
|
|
||||||
rc = qmckl_set_electron_walk_num(context, walk_num);
|
rc = qmckl_set_electron_walk_num(context, walk_num);
|
||||||
rc = qmckl_trexio_read(context, fname);
|
rc = qmckl_trexio_read(context, fname, 255);
|
||||||
|
|
||||||
if (rc != QMCKL_SUCCESS) {
|
if (rc != QMCKL_SUCCESS) {
|
||||||
printf("%s\n", qmckl_string_of_error(rc));
|
printf("%s\n", qmckl_string_of_error(rc));
|
||||||
|
Loading…
Reference in New Issue
Block a user