gmx_bool bShakeOnly,gmx_bool bSettle);
/* Build a graph from an idef description. The graph can be used
* to generate mol-shift indices.
+ * at_start and at_end should coincide will molecule boundaries,
+ * for the whole system this is simply 0 and natoms.
* If bShakeOnly, only the connections in the shake list are used.
* If bSettle && bShakeOnly the settles are used too.
*/
typedef enum { egcolWhite, egcolGrey, egcolBlack, egcolNR } egCol;
typedef struct {
+ int at0; /* The first atom the graph was constructed for */
+ int at1; /* The last atom the graph was constructed for */
int nnodes; /* The number of nodes, nnodes=at_end-at_start */
int nbound; /* The number of nodes with edges */
- int natoms; /* Total range for this graph: 0 to natoms */
int at_start; /* The first connected atom in this graph */
int at_end; /* The last+1 connected atom in this graph */
int *nedge; /* For each node the number of edges */
int i,nbtot;
gmx_bool bMultiPart;
- if (at_start != 0) {
- gmx_incons("In mk_graph_ilist at_start can not be != 0");
- }
- g->natoms = at_end;
+ /* The naming is somewhat confusing, but we need g->at0 and g->at1
+ * for shifthing coordinates to a new array (not in place) when
+ * some atoms are not connected by the graph, which runs from
+ * g->at_start (>= g->at0) to g->at_end (<= g->at1).
+ */
+ g->at0 = at_start;
+ g->at1 = at_end;
snew(nbond,at_end);
nbtot = calc_start_end(fplog,g,ilist,at_start,at_end,nbond);
sfree(nbond);
- snew(g->ishift,g->natoms);
+ snew(g->ishift,g->at1);
if (gmx_debug_at)
p_graph(debug,"graph",g);
* at all. If we return without doing this for a system without bonds
* (i.e. only settles) all water molecules are moved to the opposite octant
*/
- for(i=0; (i<g->natoms); i++) {
+ for(i=g->at0; (i<g->at1); i++) {
g->ishift[i][XX]=g->ishift[i][YY]=g->ishift[i][ZZ]=0;
}
g1 = g->at_end;
is = g->ishift;
- for(j=0; j<g0; j++) {
+ for(j=g->at0; j<g0; j++) {
copy_rvec(x[j],x_s[j]);
}
}
}
- for(j=g1; j<g->natoms; j++) {
+ for(j=g1; j<g->at1; j++) {
copy_rvec(x[j],x_s[j]);
}
}
g1 = g->at_end;
is = g->ishift;
- for(j=0; j<g0; j++) {
+ for(j=g->at0; j<g0; j++) {
copy_rvec(x_s[j],x[j]);
}
}
}
- for(j=g1; j<g->natoms; j++) {
+ for(j=g1; j<g->at1; j++) {
copy_rvec(x_s[j],x[j]);
}
}