potentials work

This commit is contained in:
Daniel Knüttel 2019-07-15 22:27:12 +02:00
parent d2336cded2
commit 5a6e039e28

View File

@ -13,19 +13,22 @@ interaction_force_function
{ {
float result = 0; float result = 0;
int i; int i;
result = coefficients[0]; result = coefficients[0] * coefficients[8];
for(i = 1; i < 7; i++) for(i = 1; i < 7; i++)
{ {
result += coefficients[i] * (powf(r, i - 1) + coefficients[8]*powf(r, i)); result += coefficients[i] * (powf(r, i - 1) / i + coefficients[8]*powf(r, i));
} }
result *= coefficients[7] * expf(coefficients[8] * (r - coefficients[9])); result *= coefficients[7] * expf(coefficients[8] * (r - coefficients[9]));
result += coefficients[10] * coefficients[11] * expf(coefficients[11] * (r - coefficients[12])); result += coefficients[10] * coefficients[11]
* expf(coefficients[11] * (r - coefficients[12]));
result += coefficients[13] result += coefficients[13]
* 2 * (r - coefficients[15]) * 2 * (r - coefficients[15])
* coefficients[14] * expf(coefficients[14] * raise2(r - coefficients[15])); * coefficients[14]
* expf(coefficients[14] * raise2(r - coefficients[15]));
result += coefficients[16] result += coefficients[16]
* 2 * (r - coefficients[18]) * 2 * (r - coefficients[18])
* coefficients[17] * expf(coefficients[17] * raise2(r - coefficients[18])); * coefficients[17]
* expf(coefficients[17] * raise2(r - coefficients[18]));
return result; return result;
} }
static float static float
@ -193,10 +196,10 @@ interaction_ufunc_float2D
} }
#endif #endif
//printf("%d, %d: %f, %f\n", i, j, delta_p_x, delta_p_y); //printf("%d, %d: %f, %f\n", i, j, delta_p_x, delta_p_y);
*(float *)(p_x_new + i*p_x_new_steps) += dt*delta_p_x; *(float *)(p_x_new + i*p_x_new_steps) -= dt*delta_p_x;
*(float *)(p_y_new + i*p_y_new_steps) += dt*delta_p_y; *(float *)(p_y_new + i*p_y_new_steps) -= dt*delta_p_y;
*(float *)(p_x_new + j*p_x_new_steps) -= dt*delta_p_x; *(float *)(p_x_new + j*p_x_new_steps) += dt*delta_p_x;
*(float *)(p_y_new + j*p_y_new_steps) -= dt*delta_p_y; *(float *)(p_y_new + j*p_y_new_steps) += dt*delta_p_y;
} }
} }
//NPY_END_THREADS; //NPY_END_THREADS;