artn_c_wrappers

namespace artn_c_wrappers

Functions

subroutine setup_artn2c(cnat, cerror)

C wrapper to setup_artn C header

void setup_artn( const int nat, const char *filnam, bool *cerror)

subroutine artn_c(c_nat, c_etot_eng, c_force, c_ityp, c_tau, c_order, c_at, c_if_pos, c_disp_code, c_displ_vec, c_lconv)

C-wrapper to artn() routine. Visible as “artn()” from C.

C-header:

void artn(
          const int nat,
          const double *etot,
          const double *f,
          int const *ityp,
          double *const tau,
          const int *order,
          const double *lat,
          const int *if_pos,
          int *disp_code,
          double *disp_vec,
          bool *lconv);

subroutine move_mode_c(c_nat, c_order, c_force, c_vel, c_etot, c_nsteppos, c_dt_curr, c_alpha, c_alpha_init, c_dt_init, c_disp, c_displ_vec)

C-wrapper to move_mode() routine. Visible as “move_mode()” from C.

C-header:

void move_mode(const int nat,
               const int *order,
               double *const f,
               double *const vel,
               double *etot,
               int *nsteppos,
               double *dt_curr,
               double *alpha,
               const double *alpha_init,
               const double *dt_init,
               int *disp,
               double *disp_vec );

subroutine cclean_artn()
integer(c_int) function set_cdata (cname, crank, csize, cval)

general C setter for variables from d_artn_data

C-header:

int set_data( const char * const name, const int crank, const int* csize, const void *cval );

integer(c_int) function get_cdata (cname, cval)

general get_cdata for all types of variables in d_artn_data. Arrays are allocated explicitly with c_malloc(), thus they can be free’d by free() from C normally.

C-header:

int get_data ( const char *name, void** cval );

To cast the value, i.e. into double:

void *c_val;
int cerr;

if( get_data( "eigval_sad", &c_val) ){
   /* there is error */
   err_write( __FILE__, __LINE__ );
}
/* read the double value from void*, and free its allocation */
double eigval_sad = *(double *) c_val;
free( c_val );
printf( "eigenvalue at saddle value: %f\n", eigval_sad );

subroutine cartn_list_extract()

C-wrapper to artn_list_extract() from get_data.f90 header

{(.c)}
void artn_list_extract();

integer(c_int) function set_cparam (cname, crank, csize, cval)

wrapper to general set_param C-header:

int set_param( const char * const name, const int crank, const int* csize, const void *cval );

integer(c_int) function get_cparam (cname, cval)

generalize get_cparam for all variable types in d_artn_params. Arrays are allocated explicitly with c_malloc(), thus they can be free’d by free() from C normally.

C-header:

int get_param ( const char *name, void** cval );

To cast the value, i.e. into double:

void *c_val;
int cerr;

if( !get_param( "forc_thr", &c_val) ){
   /* there is error */
   err_write( __FILE__, __LINE__ );
}
/* read the double value from void*, and free its allocation */
double forc_thr = *(double *) c_val;
free( c_val );
printf( "forc threshold value: %f\n", forc_thr );

integer(c_int) function set_crunparam (cname, crank, csize, cval)
integer(c_int) function get_crunparam (cname, cval)

generalize get_cparam. Arrays are allocated explicitly with c_malloc(), thus they can be free’d by free() from C normally.

C-header:

int get_runparam ( const char *name, void** cval );

The void* cval needs to be freed afterwards.

subroutine cartn_list_set()
subroutine cartn_list_extract_param()
subroutine cdump_input(cname)
subroutine cdump_data(cname)
integer(c_int) function cread_datadump (cname)
subroutine permute_int1d_c(cdim1, carray, corder)

Wrapper for permute_int1d, corder should contain fortran-style indices (start at 1) C-header:

void permute_int1d( const int dim1, int *const array, const int* order );

subroutine unpermute_int1d_c(cdim1, carray, corder)

Wrapper for unpermute_int1d, corder shoudl contain fortran-style indices (start at 1)

void unpermute_int1d( const int dim1, int *const array, const int* order );

subroutine permute_real2d_c(cdim1, carray, corder)

Wrapper for permute_real2d, corder should contain fortran-style indices (start at 1)

void permute_real2d( const int dim1, double * const array, const int * order );

subroutine unpermute_real2d_c(cdim1, carray, corder)

Wrapper for unpermute_real2d, corder should contain fortran-style indices (start at 1)

void unpermute_real2d( const int dim1, double * const array, const int * order );

subroutine artn_cfree(cptr)

wrapper to call c_free on memory allocated by c_malloc in the pArtn-C interface (get_data, etc). From C you can directly call free( val ), but this wrapper is needed for the python interface.

void artn_free( void* );