#include <time.h>
#include <math.h>
+#include <fpu_control.h>
+
+#ifdef PARALLEL
+#include <omp.h>
+#endif
+
#include "moldyn.h"
#include "report/report.h"
#include "potentials/tersoff.h"
#endif
+/* pse */
+#define PSE_NAME
+#define PSE_COL
+#include "pse.h"
+#undef PSE_NAME
+#undef PSE_COL
+
/*
* the moldyn functions
*/
printf("[moldyn] init\n");
+ /* only needed if compiled without -msse2 (float-store prob!) */
+ //fpu_set_rtd();
+
memset(moldyn,0,sizeof(t_moldyn));
moldyn->argc=argc;
}
if(lc->cells<27)
- printf("[moldyn] FATAL: less then 27 subcells!\n");
+ printf("[moldyn] FATAL: less then 27 subcells! (%d)\n",
+ lc->cells);
if(vol) {
#ifdef STATIC_LISTS
link_cell_update(moldyn);
/* forces depending on chosen potential */
+#ifndef ALBE_FAST
potential_force_calc(moldyn);
+#else
+ albe_potential_force_calc(moldyn);
+#endif
for(i=0;i<count;i++) {
/* check whether fixed atom */
memset(&(moldyn->gvir),0,sizeof(t_virial));
/* reset force, site energy and virial of every atom */
+#ifdef PARALLEL
+ #pragma omp parallel for private(virial)
+#endif
for(i=0;i<count;i++) {
/* reset force */
jtom=&(atom[neighbour_i[j][p]]);
p++;
-
- if(jtom==&(itom[i]))
- continue;
-
- if((jtom->attr&ATOM_ATTR_2BP)&
- (itom[i].attr&ATOM_ATTR_2BP)) {
- moldyn->func2b(moldyn,
- &(itom[i]),
- jtom,
- bc_ij);
- }
- }
#else
this=&(neighbour_i[j]);
list_reset_f(this);
do {
jtom=this->current->data;
+#endif
if(jtom==&(itom[i]))
continue;
jtom,
bc_ij);
}
+#ifdef STATIC_LISTS
+ }
+#else
} while(list_next_f(this)!=L_NO_NEXT_ELEMENT);
#endif
#endif
/* some postprocessing */
+#ifdef PARALLEL
+ #pragma omp parallel for
+#endif
for(i=0;i<count;i++) {
/* calculate global virial */
moldyn->gvir.xx+=itom[i].r.x*itom[i].f.x;
int p;
#else
t_list neighbour[27];
+ t_list *this;
#endif
u8 bc;
t_atom *itom,*jtom;
int i,j;
- t_list *this;
lc=&(moldyn->lc);
itom=moldyn->atom;
return 0;
}
+/*
+ * fpu cntrol functions
+ */
+
+// set rounding to double (eliminates -ffloat-store!)
+int fpu_set_rtd(void) {
+
+ fpu_control_t ctrl;
+
+ _FPU_GETCW(ctrl);
+
+ ctrl&=~_FPU_EXTENDED;
+ ctrl|=_FPU_DOUBLE;
+
+ _FPU_SETCW(ctrl);
+
+ return 0;
+}
+