Beispiel #1
0
int make_asa_list(LinusProtein *p, int hphob, int hphil, int hydrogens, int *flags)
{
    int PRESENT = 1;
    int CONTRIB = 2;
    /*
      // This should be in  Main/Calling function
      int flags[p->num_atoms];

      */
    if(hphob < 0)
        hphob = 1;
    if(hphil < 0)
        hphil = 0;
    if(hydrogens <0)
        hydrogens=0;

    int i;
    for (i=0; i<p->num_atoms; i++)
    {
        flags[i] = 0;
    }
    int minres,maxres;
    get_res_extents(p,&minres,&maxres);

    int r;
    for(r=minres; r<maxres; r++)
    {
        int first = p->res_fai[r];
        int last = p->res_fai[r+1];
        int at;
        for(at=first; at<last; at++)
        {
            if(!hydrogens && is_hydrogen(p->atoms[at].name))
                continue;


            int hydrophobic = is_hydrophobic(p->atoms[at].name);
            //printf("HPhobic - Atom %s %d is %d\n",p->atoms[at].name,p->atoms[at].resnum,hydrophobic);
            flags[at] = PRESENT;

            if(hphob && hydrophobic)
            {
                //printf("1 Flag for atom %s %d is %d\n",p->atoms[at].name,p->atoms[at].resnum,flags[at]);
                flags[at] = flags[at] | CONTRIB;
                //printf("2 Flag for atom %s %d is %d\n",p->atoms[at].name,p->atoms[at].resnum,flags[at]);
            }

            if(hphil && !hydrophobic)
            {
                //printf("3 Flag for atom %s %d is %d\n",p->atoms[at].name,p->atoms[at].resnum,flags[at]);
                flags[at] = flags[at] | CONTRIB;
                //printf("4 Flag for atom %s %d is %d\n",p->atoms[at].name,p->atoms[at].resnum,flags[at]);
            }

        }
    }//r minres maxres



}// make_asa_list
Beispiel #2
0
void rm_res_pbc(t_atoms *atoms, rvec *x, matrix box)
{
    int  i, start, n, d, nat;
    rvec xcg;

    start = 0;
    nat   = 0;
    clear_rvec(xcg);
    for (n = 0; n < atoms->nr; n++)
    {
        if (!is_hydrogen(*(atoms->atomname[n])))
        {
            nat++;
            rvec_inc(xcg, x[n]);
        }
        if ( (n+1 == atoms->nr) ||
             (atoms->atom[n+1].resind != atoms->atom[n].resind) )
        {
            /* if nat==0 we have only hydrogens in the solvent,
               we take last coordinate as cg */
            if (nat == 0)
            {
                nat = 1;
                copy_rvec(x[n], xcg);
            }
            svmul(1.0/nat, xcg, xcg);
            for (d = 0; d < DIM; d++)
            {
                while (xcg[d] < 0)
                {
                    for (i = start; i <= n; i++)
                    {
                        x[i][d] += box[d][d];
                    }
                    xcg[d] += box[d][d];
                }
                while (xcg[d] >= box[d][d])
                {
                    for (i = start; i <= n; i++)
                    {
                        x[i][d] -= box[d][d];
                    }
                    xcg[d] -= box[d][d];
                }
            }
            start = n+1;
            nat   = 0;
            clear_rvec(xcg);
        }
    }
}
Beispiel #3
0
Datei: sys.c Projekt: ilyak/vimol
void
sys_reset_bonds(struct sys *sys, struct sel *sel)
{
	struct spi *spi;
	struct pair pair;
	int i, j, k, n, *map;

	spi = spi_create();
	n = sel_get_count(sel);
	map = calloc(n, sizeof(int));

	sel_iter_start(sel);

	for (k = 0; sel_iter_next(sel, &i); k++) {
		spi_add_point(spi, sys_get_atom_xyz(sys, i));
		map[k] = i;
	}

	spi_compute(spi, 1.6);
	n = spi_get_pair_count(spi);

	for (k = 0; k < n; k++) {
		pair = spi_get_pair(spi, k);

		i = map[pair.i];
		j = map[pair.j];

		if (is_hydrogen(sys_get_atom_name(sys, i)) &&
		    is_hydrogen(sys_get_atom_name(sys, j)))
			continue;

		if (graph_edge_find(sys->graph, i, j) == NULL)
			graph_edge_create(sys->graph, i, j, 1);
	}

	spi_free(spi);
	free(map);
}
Beispiel #4
0
//! Returns true if the current atom is a mutable atom.
bool atom::is_mutable() const
{
	return is_hydrogen() || is_halogen();
}