#include "../math/math.h"
#include "albe.h"
+#ifdef PTHREADS
+typedef struct s_kdata {
+ t_moldyn *moldyn;
+ t_atom *itom,*jtom;
+} t_kdata;
+#endif
+
/*
* virial calculation
*/
#endif
u8 bc_ij,bc_ik;
int dnlc;
+#ifdef PTHREADS
+ int ret;
+ t_kdata kdata[27];
+ pthread_t kthread[27];
+#endif
// needed to work
t_atom *ai;
/* first loop over atoms k */
for(k=0;k<27;k++) {
+#ifdef PTHREADS
+ // create threads
+ kdata.moldyn=moldyn;
+ kdata.jtom=jtom;
+ kdata.itom=&(itom[i]);
+ ret=pthread_create(&(kthread[k]),NULL,k1_thread,&(kdata[k]));
+ if(ret) {
+ perror("[albe fast] thread create");
+ return ret;
+ }
+#else
bc_ik=(k<dnlc)?0:1;
#ifdef STATIC_LISTS
q=0;
/* increase k counter */
kcount++;
-#endif // PTHREADS
-
#ifdef STATIC_LISTS
}
#elif LOWMEM_LISTS
L_NO_NEXT_ELEMENT);
#endif
+#endif // PTHREADS
+
}
+#ifdef PTHREADS
+ // join threads
+ for(k=0;k<27;k++) {
+ ret=pthread_join(kthread[k],NULL);
+ if(ret) {
+ perror("[albe fast] join thread");
+ return ret;
+ }
+ }
+#endif
+
/* j2 func here ... */