From: hackbard Date: Thu, 30 Oct 2008 10:51:14 +0000 (+0100) Subject: virial calc define + default amount threads -> 2 X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23cc92be2a2ac2eed0fd38fd0c3e59189821bf41;p=physik%2Fposic.git virial calc define + default amount threads -> 2 --- diff --git a/potentials/albe_fast.c b/potentials/albe_fast.c index 603606e..0db5f66 100644 --- a/potentials/albe_fast.c +++ b/potentials/albe_fast.c @@ -23,7 +23,7 @@ #ifdef PTHREADS #include -#define MAX_THREADS 4 +#define MAX_THREADS 2 #endif #include "../moldyn.h" @@ -39,12 +39,12 @@ extern pthread_mutex_t emutex; * virial calculation */ -#define albe_v_calc(a,f,d) a->virial.xx+=f->x*d->x; \ - a->virial.yy+=f->y*d->y; \ - a->virial.zz+=f->z*d->z; \ - a->virial.xy+=f->x*d->y; \ - a->virial.xz+=f->x*d->z; \ - a->virial.yz+=f->y*d->z +#define albe_v_calc(a,f,d) (a)->virial.xx+=(f)->x*(d)->x; \ + (a)->virial.yy+=(f)->y*(d)->y; \ + (a)->virial.zz+=(f)->z*(d)->z; \ + (a)->virial.xy+=(f)->x*(d)->y; \ + (a)->virial.xz+=(f)->x*(d)->z; \ + (a)->virial.yz+=(f)->y*(d)->z #ifndef PTHREADS @@ -461,7 +461,8 @@ int albe_potential_force_calc(t_moldyn *moldyn) { v3_add(&(jtom->f),&(jtom->f),&force); /* virial */ - virial_calc(ai,&force,&(dist_ij)); + albe_v_calc(ai,&force,&(dist_ij)); + //virial_calc(ai,&force,&(dist_ij)); #ifdef DEBUG if(moldyn->time>DSTART&&moldyn->timetime>DSTART&&moldyn->timetime>DSTART&&moldyn->timetag])); - virial_calc(ai,&force,&(dist_ij)); + albe_v_calc(ai,&force,&(dist_ij)); + //virial_calc(ai,&force,&(dist_ij)); pthread_mutex_unlock(&(amutex[ai->tag])); #ifdef DEBUG @@ -1236,7 +1240,8 @@ if(moldyn->time>DSTART&&moldyn->timetag])); - virial_calc(ai,&force,&dist_ij); + albe_v_calc(ai,&force,&dist_ij); + //virial_calc(ai,&force,&dist_ij); /* force contribution to atom i */ v3_scale(&force,&force,-1.0); @@ -1268,7 +1273,8 @@ if(moldyn->time>DSTART&&moldyn->timetag])); - virial_calc(ai,&force,&dist_ik); + albe_v_calc(ai,&force,&dist_ik); + //virial_calc(ai,&force,&dist_ik); /* force contribution to atom i */ v3_scale(&force,&force,-1.0); @@ -1368,7 +1374,7 @@ int albe_potential_force_calc(t_moldyn *moldyn) { /* prepare thread data */ pft_data[j].moldyn=moldyn; - pft_data[j].start=j*count/MAX_THREADS; + pft_data[j].start=j*(count/MAX_THREADS); if(j==MAX_THREADS-1) { pft_data[j].end=count; }