Exemplo n.º 1
0
int is_donacc(int i, int j)
{
    int debug=0;
    
    if (!nnbflg)
    {
	if (atom[i].aacode<TOTNAA && donors[atom[i].aacode][atom[i].atmtyp] == 0)
	    return(0); /*atom i is not recognized donor from a recognized residue*/
	if (debug==2)
	    printf("First atom is a donor\n");
	
	if (atom[j].aacode<TOTNAA && accepts[atom[j].aacode][atom[j].atmtyp] == 0)
	    return(0); /*atom j is not recognized acceptor from a recognized residue*/
	if (debug==2)
	    printf("Second atom is an acceptor\n");

	if ( atom[i].ssflg )
	    return(0); /* one or the other atom is in an S-S bridge */
	/* adjusted by IM to 'the donor is in a disulphide bridge' */
	if (debug==2)
	    printf("Not a ss bridge\n");
    }
    
    if (alreadybonded(i,j))
	return(0);
    	/* atoms i and j are bonded */
    if (debug==2)
	printf("Not already bonded\n");
    
    if (bondedwithin(i,j,numcovbonds))/* was  (nearlybonded(i,j)) */
	return(0); /* atoms i and j are 1-3 or 1-4 */
    /* adjusted by IM to be only 1-3 thrown out */
    if (debug==2)
	printf("pair not already bonded or nearly bonded\n");
    
    if (!nnbflg) 
    {
	if (atom[i].aacode == TOTNAA) /* atom i is from ligand/solvent */
	{
	    if ( atom[i].atmnam[1] == 'N'  ||
		(atom[i].atmnam[1] == 'O'  && iswater(atom[i].resnam)))
	    { 
		/* this ligand atom is potential donor */
	    }
	    else
		return(0); /* atom i not a donor, so next k */
	} 
	if (atom[j].aacode == TOTNAA && atom[j].atmnam[1] != 'O')
	    return(0); /* ignore ligand atoms as acceptors if they
			 are not oxygen */
    }
    return(1);
    
}
Exemplo n.º 2
0
static bool has_water(u16 x, u16 y)
{
  Core::StaticList vec;
  vec.clear();
  Core::readstatics(vec, x, y);
  for (const auto& rec : vec)
  {
    if (iswater(rec.graphic))
      return true;
  }
  return false;
}
Exemplo n.º 3
0
void readwater()
{
  USTRUCT_IDX idxrec;

  fseek( sidxfile, 0, SEEK_SET );
  for ( int xblock = 0; xblock < 6144 / 8; ++xblock )
  {
    INFO_PRINT << xblock << "..";
    for ( int yblock = 0; yblock < 4096 / 8; ++yblock )
    {
      if ( fread( &idxrec, sizeof idxrec, 1, sidxfile ) != 1 )
        throw std::runtime_error( "readwater: fread(idxrec) failed." );
      int xbase = xblock * 8;
      int ybase = yblock * 8;

      if ( idxrec.length != 0xFFffFFffLu )
      {
        fseek( statfile, idxrec.offset, SEEK_SET );

        for ( idxrec.length /= 7; idxrec.length > 0; --idxrec.length )
        {
          USTRUCT_STATIC srec;
          if ( fread( &srec, sizeof srec, 1, statfile ) != 1 )
            throw std::runtime_error( "readwater: fread(srec) failed." );

          if ( srec.z == -5 && iswater( srec.graphic ) )
          {
            int x = xbase + srec.x_offset;
            int y = ybase + srec.y_offset;
            unsigned int xy = x << 16 | y;
            water.insert( xy );
          }
        }
      }
    }
  }
}