]> hackdaworld.org Git - physik/posic.git/commitdiff
muss zum c3a ...
authorhackbard <hackbard>
Thu, 27 Apr 2006 15:51:06 +0000 (15:51 +0000)
committerhackbard <hackbard>
Thu, 27 Apr 2006 15:51:06 +0000 (15:51 +0000)
moldyn.c

index dbb3e6c642d64b1648f60012a5fb7ba2309b0969..17720675c4f5c0c76dea880ac40eb5787f772eb0 100644 (file)
--- a/moldyn.c
+++ b/moldyn.c
@@ -511,19 +511,23 @@ int moldyn_integrate(t_moldyn *moldyn) {
                return -1;
        }
 
-       /* create the verlet list */
-       verlet_list_update(moldyn);
+       /* create the neighbour list */
+       //verlet_list_update(moldyn);
+       link_cell_update(moldyn);
 
        /* calculate initial forces */
        moldyn->force(moldyn);
 
        for(i=0;i<moldyn->time_steps;i++) {
-               /* check for velet list update */
+               /* show runs */
                printf(".");
-               if(moldyn->dr_max1+moldyn->dr_max2>rlc) {
-                       printf("\n");
-                       verlet_list_update(moldyn);
-               }
+
+               /* neighbour list update */
+               link_cell_update(moldyn);
+               //if(moldyn->dr_max1+moldyn->dr_max2>rlc) {
+               //      printf("\n");
+               //      verlet_list_update(moldyn);
+               //}
 
                /* integration step */
                moldyn->integrate(moldyn);
@@ -597,13 +601,13 @@ int velocity_verlet(t_moldyn *moldyn) {
                v3_add(&(atom[i].dr),&(atom[i].dr),&delta);
                v3_per_bound(&(atom[i].r),&(moldyn->dim));
 
-               /* set maximum dr (possible list update) */
-               dr=v3_norm(&(atom[i].dr));
-               if(dr>moldyn->dr_max1) {
-                       moldyn->dr_max2=moldyn->dr_max1;
-                       moldyn->dr_max1=dr;
-               }
-               else if(dr>moldyn->dr_max2) moldyn->dr_max2=dr;
+               /* set maximum dr (possible list update) [obsolete] */
+               //dr=v3_norm(&(atom[i].dr));
+               //if(dr>moldyn->dr_max1) {
+               //      moldyn->dr_max2=moldyn->dr_max1;
+               //      moldyn->dr_max1=dr;
+               //}
+               //else if(dr>moldyn->dr_max2) moldyn->dr_max2=dr;
 
                /* velocities */
                v3_scale(&delta,&(atom[i].f),0.5*tau/atom[i].mass);
@@ -701,15 +705,19 @@ double potential_lennard_jones(t_moldyn *moldyn) {
 
        t_lj_params *params;
        t_atom *atom,*btom;
+       t_linkcell *lc;
        int i;
        int count;
        t_3dvec distance;
        double d,help;
        double u;
        double eps,sig6,sig12;
+       int i,j,k;
+       int ni,nj,nk;
 
        params=moldyn->pot_params;
        atom=moldyn->atom;
+       lc=&(moldyn->lc);
        count=moldyn->count;
        eps=params->epsilon4;
        sig6=params->sigma6;
@@ -717,8 +725,15 @@ double potential_lennard_jones(t_moldyn *moldyn) {
 
        u=0.0;
        for(i=0;i<count;i++) {
-               list_reset(&(atom[i].verlet));
-               if(atom[i].verlet.current==NULL) continue;
+               /* verlet list [obsolete] */
+               //list_reset(&(atom[i].verlet));
+               //if(atom[i].verlet.current==NULL) continue;
+
+               /* determine cell */
+               ni=atom[i].r.x/lc->x;
+               nj=atom[i].r.y/lc->y;
+               nk=atom[i].r.z/lc->z;
+
                while(1) {
                        btom=atom[i].verlet.current->data;
                        v3_sub(&distance,&(atom[i].r),&(btom->r));