API functions

namespace artn_api

Functions

integer function, public artn_create ()

Prepare pARTn to be called through the API: set some variables to avoid reading/writing to files.

This is not strictly needed to execute, but take care when omitting it.

Example:

use artn_api, only: artn_create
integer :: ierr
ierr = artn_create()

C-wrapper:

#include artn.h
int ierr = artn_create()

integer(c_int) function artn_create_c ()

C-wrapper

subroutine, public artn_destroy ()

Destroy all data and parameters to free the memory from artn. After this call, data/params cannot be extracted anymore.

interface artn_extract

The preferred way to extract generated data from pARTn is through artn_extract, which checks the proper datatypes, and performs allocation where needed, and converts the precision.

! signature:
! function artn_extract( name, val ) result( ierr )
!
! description:
! name : character(*), name of variable
! val  : the obtained value
! ierr : integer, negative on error, zero otherwise
use artn_api, only: artn_extract
integer :: ierr
real, allocatable :: coords_saddle(:,:)
ierr = artn_extract( "tau_sad", coords_saddle )
if( ierr /= 0 ) then
   ! there is an error
endif

interface artn_set

The preferred way to set input parameters is through artn_set, which also does checks on data type, rank, and size. It also converts the data to proper precision.

! signature:
! subroutine artn_set( name, val, ierr )
!
! description:
! name : character(*), name of variable
! val  : the value to set
! ierr [optional] : integer, negative on error, zero otherwise
use artn_api, only: artn_set
call artn_set( "engine_units", "lammps/metal")
call artn_set( "forc_thr", 0.02 )
call artn_set( "push_ids", [23, 25, 68] )