mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Fixed provider for potential energy. #41
This commit is contained in:
parent
dcc5f09724
commit
7bf52f0e01
@ -775,7 +775,7 @@ qmckl_exit_code qmckl_get_potential_energy(qmckl_context context, double * const
|
||||
assert (ctx != NULL);
|
||||
|
||||
size_t sze = ctx->electron.walk_num * sizeof(double);
|
||||
memcpy(potential_energy, ctx->local_energy.e_kin, sze);
|
||||
memcpy(potential_energy, ctx->local_energy.e_pot, sze);
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
@ -833,22 +833,22 @@ qmckl_exit_code qmckl_provide_potential_energy(qmckl_context context) {
|
||||
}
|
||||
|
||||
/* Compute if necessary */
|
||||
if (ctx->electron.coord_new_date > ctx->local_energy.e_kin_date) {
|
||||
if (ctx->electron.coord_new_date > ctx->local_energy.e_pot_date) {
|
||||
|
||||
/* Allocate array */
|
||||
if (ctx->local_energy.e_kin == NULL) {
|
||||
if (ctx->local_energy.e_pot == NULL) {
|
||||
|
||||
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
||||
mem_info.size = ctx->electron.walk_num * sizeof(double);
|
||||
double* e_kin = (double*) qmckl_malloc(context, mem_info);
|
||||
double* e_pot = (double*) qmckl_malloc(context, mem_info);
|
||||
|
||||
if (e_kin == NULL) {
|
||||
if (e_pot == NULL) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_ALLOCATION_FAILED,
|
||||
"qmckl_e_kin",
|
||||
"qmckl_e_pot",
|
||||
NULL);
|
||||
}
|
||||
ctx->local_energy.e_kin = e_kin;
|
||||
ctx->local_energy.e_pot = e_pot;
|
||||
}
|
||||
|
||||
qmckl_exit_code rc;
|
||||
@ -860,7 +860,7 @@ qmckl_exit_code qmckl_provide_potential_energy(qmckl_context context) {
|
||||
ctx->electron.ee_pot,
|
||||
ctx->nucleus.en_pot,
|
||||
ctx->nucleus.repulsion,
|
||||
ctx->local_energy.e_kin);
|
||||
ctx->local_energy.e_pot);
|
||||
} else {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_FAILURE,
|
||||
@ -871,7 +871,7 @@ qmckl_exit_code qmckl_provide_potential_energy(qmckl_context context) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
ctx->local_energy.e_kin_date = ctx->date;
|
||||
ctx->local_energy.e_pot_date = ctx->date;
|
||||
}
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
@ -1128,7 +1128,6 @@ qmckl_exit_code qmckl_provide_local_energy(qmckl_context context) {
|
||||
ctx->local_energy.e_local = local_energy;
|
||||
}
|
||||
|
||||
qmckl_exit_code rc;
|
||||
if (ctx->det.type == 'G') {
|
||||
rc = qmckl_compute_local_energy(context,
|
||||
ctx->det.walk_num,
|
||||
|
Loading…
Reference in New Issue
Block a user