Exemplo n.º 1
0
void add_zombie(world *w, int x, int y){
    int ind0 = xy2ind(w->N, x, y);
    if (w->grid[ind0] == SZ)
        return;
    else {
        w->grid[ind0] = SZ;
        w->S -= 1;
        w->Z += 1;

        w->sites[w->nsites] = ind0;
        w->nsites += 1;
        if (w->minx > x) w->minx = x;
        if (w->miny > y) w->miny = y;
        if (w->maxx < x) w->maxx = x;
        if (w->maxy < y) w->maxy = y;
    }

    for (int i=-1; i<=1; i+=2){
        int ind1 = xy2ind(w->N, mod(x+i, w->N), y);
        add_bond(w, ind0, ind1);
    }
    for (int i=-1; i<=1; i+=2){
        int ind1 = xy2ind(w->N, x, mod(y+i, w->N));
        add_bond(w, ind0, ind1);
    }
}
Exemplo n.º 2
0
void parse_bond()
{
    INT ids[2];
    DOUBLE temp[3];
    parse_ints( ids, 2 );
    parse_doubles( temp, 3 );
    if( strtok( NULL, " \t\n" ) )
        UNERR("Wrong line in " BOND_TAG " too many columns");
    add_bond( resolve_pos(ids[0]), resolve_pos(ids[1]),
              temp[0], temp[1], temp[2] );
}