introduced lowmem lists
[physik/posic.git] / potentials / albe_fast.c
index 4523938..45ebff9 100644 (file)
@@ -45,7 +45,9 @@ int albe_potential_force_calc(t_moldyn *moldyn) {
 #ifdef STATIC_LISTS
        int *neighbour_i[27];
        int p,q;
-       t_atom *atom;
+#elif LOWMEM_LISTS
+       int neighbour_i[27];
+       int p,q;
 #else
        t_list neighbour_i[27];
        t_list neighbour_i2[27];
@@ -102,9 +104,6 @@ int albe_potential_force_calc(t_moldyn *moldyn) {
        count=moldyn->count;
        itom=moldyn->atom;
        lc=&(moldyn->lc);
-#ifdef STATIC_LISTS
-       atom=moldyn->atom;
-#endif
 
        // optimized
        params=moldyn->pot_params;
@@ -157,7 +156,9 @@ int albe_potential_force_calc(t_moldyn *moldyn) {
                dnlc=lc->dnlc;
 
                /* copy the neighbour lists */
-#ifndef STATIC_LISTS
+#ifdef STATIC_LISTS
+#elif LOWMEM_LISTS
+#else
                memcpy(neighbour_i2,neighbour_i,27*sizeof(t_list));
 #endif
 
@@ -173,8 +174,15 @@ int albe_potential_force_calc(t_moldyn *moldyn) {
 
                        while(neighbour_i[j][p]!=-1) {
 
-                               jtom=&(atom[neighbour_i[j][p]]);
+                               jtom=&(itom[neighbour_i[j][p]]);
                                p++;
+#elif LOWMEM_LISTS
+                       p=neighbour_i[j];
+
+                       while(p!=-1) {
+
+                               jtom=&(itom[p]);
+                               p=lc->subcell->list[p];
 #else
                        this=&(neighbour_i[j]);
                        list_reset_f(this);
@@ -238,8 +246,15 @@ int albe_potential_force_calc(t_moldyn *moldyn) {
 
                                        while(neighbour_i[k][q]!=-1) {
 
-                                               ktom=&(atom[neighbour_i[k][q]]);
+                                               ktom=&(itom[neighbour_i[k][q]]);
                                                q++;
+#elif LOWMEM_LISTS
+                                       q=neighbour_i[k];
+
+                                       while(q!=-1) {
+
+                                               ktom=&(itom[q]);
+                                               q=lc->subcell->list[q];
 #else
                                        that=&(neighbour_i2[k]);
                                        list_reset_f(that);
@@ -359,6 +374,8 @@ int albe_potential_force_calc(t_moldyn *moldyn) {
 
 #ifdef STATIC_LISTS
                                        }
+#elif LOWMEM_LISTS
+                                       }
 #else
                                        } while(list_next_f(that)!=\
                                                L_NO_NEXT_ELEMENT);
@@ -468,8 +485,15 @@ if(moldyn->time>DSTART&&moldyn->time<DEND) {
 
                                        while(neighbour_i[k][q]!=-1) {
 
-                                               ktom=&(atom[neighbour_i[k][q]]);
+                                               ktom=&(itom[neighbour_i[k][q]]);
                                                q++;
+#elif LOWMEM_LISTS
+                                       q=neighbour_i[k];
+
+                                       while(q!=-1) {
+
+                                               ktom=&(itom[q]);
+                                               q=lc->subcell->list[q];
 #else
                                        that=&(neighbour_i2[k]);
                                        list_reset_f(that);
@@ -597,6 +621,8 @@ if(moldyn->time>DSTART&&moldyn->time<DEND) {
 
 #ifdef STATIC_LISTS
                                        }
+#elif LOWMEM_LISTS
+                                       }
 #else
                                        } while(list_next_f(that)!=\
                                                L_NO_NEXT_ELEMENT);
@@ -606,6 +632,8 @@ if(moldyn->time>DSTART&&moldyn->time<DEND) {
                                
 #ifdef STATIC_LISTS
                        }
+#elif LOWMEM_LISTS
+                       }
 #else
                        } while(list_next_f(this)!=L_NO_NEXT_ELEMENT);
 #endif