Electrons
Table of Contents
1 Context
The following data stored in the context:
date |
uint64t | Last modification date of the coordinates |
uninitialized |
int32t | Keeps bit set for uninitialized data |
num |
int64t | Total number of electrons |
up_num |
int64t | Number of up-spin electrons |
down_num |
int64t | Number of down-spin electrons |
walk_num |
int64t | Number of walkers |
provided |
bool | If true, electron is valid |
coord_new |
double[walknum][3][num] | New set of electron coordinates |
coord_old |
double[walknum][3][num] | Old set of electron coordinates |
1.1 Data structure
typedef struct qmckl_electron_struct { int64_t date; int64_t num; int64_t up_num; int64_t down_num; int64_t walk_num; double* coord_new; double* coord_old; int32_t uninitialized; bool provided; } qmckl_electron_struct;
The uninitialized
integer contains one bit set to one for each
initialization function which has not bee called. It becomes equal
to zero after all initialization functions have been called. The
struct is then initialized and provided == true
.
1.2 Access functions
When all the data relative to electrons have been set, the
following function returns true
.
bool qmckl_electron_provided (const qmckl_context context);
1.3 Initialization functions
To set the data relative to the electrons in the context, the
following functions need to be called. When the data structure is
initialized, the coord_new
and coord_old
arrays are both allocated.
qmckl_exit_code qmckl_set_electron_num (qmckl_context context, const int64_t up_num, const int64_t down_num); qmckl_exit_code qmckl_set_electron_walk_num (qmckl_context context, const int64_t walk_num); qmckl_exit_code qmckl_set_electron_coord (qmckl_context context, const double* coord);
To set the number of electrons, we give the number of up-spin and down-spin electrons to the context and we set the number of walkers.
The following function sets the electron coordinates of all the walkers. When this is done, the pointers to the old and new sets of coordinates are swapped, and the new coordinates are overwritten. This can be done only when the data relative to electrons have been set.
1.4 Test
/* Reference input data */ #define up_num ((int64_t) 3) #define down_num ((int64_t) 2) #define walk_num ((int64_t) 2) #define num (up_num+down_num) double coord[walk_num*3*num] = { 7.303633091022677881e+00, 1.375868694453235719e+01, 1.167371490471771217e-01, 4.547755371567960836e+00, 3.245907105524011182e+00, 2.410764357550297110e-01, 5.932816068137344523e+00, 1.491671465549257469e+01, 3.825374039119375236e-01, 7.347336142660052083e+00, 1.341946976062362129e+00, 1.648917914228352322e+00, 5.735221530102248444e+00, 1.064667491680036271e+01, 4.227201772236627297e-01, 8.099550978782254163e+00, 6.861498941099086757e+00, 4.015884841159429036e-02, 1.014757367558326173e+01, 5.219335322173662917e+00, 5.037004126899931322e-02, 1.484094322159507051e+01, 9.777903829455864226e+00, 5.243007994024882767e-02, 9.081723054990456845e+00, 5.499568496038920173e+00, 2.910446438899221347e-02, 2.583154239492383653e+00, 1.442282811294904432e+00, 6.387191629878670451e-02 }; /* --- */ qmckl_exit_code rc; munit_assert(!qmckl_electron_provided(context)); rc = qmckl_set_electron_num (context, up_num, down_num); munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert(!qmckl_electron_provided(context)); rc = qmckl_set_electron_walk_num (context, walk_num); munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert(qmckl_electron_provided(context)); rc = qmckl_set_electron_coord (context, coord); munit_assert_int64(rc, ==, QMCKL_SUCCESS);