/*
    public Atom getAtom(byte specialAtomID) {
      return (specialAtomID == JmolConstants.ATOMID_NUCLEIC_PHOSPHORUS
              ? getLeadAtom()
              : null);
    }

    public Point3f getAtomPoint(byte specialAtomID) {
      return (specialAtomID == JmolConstants.ATOMID_NUCLEIC_PHOSPHORUS
              ? getLeadAtomPoint()
              : null);
    }
  */
  boolean isConnectedAfter(Monomer possiblyPreviousMonomer) {
    if (possiblyPreviousMonomer == null) return true;
    if (!(possiblyPreviousMonomer instanceof PhosphorusMonomer)) return false;
    // 1PN8 73:d and 74:d are 7.001 angstroms apart
    // but some P atoms are up to 7.4 angstroms apart
    float distance = getLeadAtomPoint().distance(possiblyPreviousMonomer.getLeadAtomPoint());
    return distance <= MAX_ADJACENT_PHOSPHORUS_DISTANCE;
  }
Esempio n. 2
0
 /**
  * Updatetes the matrix by linking the parameter monomer to the corresponding cell if it is empty.
  * If the matrix is two small it is created again with larger size.
  *
  * @param monomer
  * @return true upon success and false upon failur, that is in case the cell was already occupied.
  */
 public boolean update(Monomer monomer) {
   protein = monomer.protein;
   int x = monomer.getX();
   int y = monomer.getY();
   int z = monomer.getZ();
   boolean modified = false;
   if (x < minX) {
     minX = x;
     modified = true;
   } else if (x > maxX) {
     maxX = x + 1;
     modified = true;
   }
   if (y < minY) {
     minY = y;
     modified = true;
   } else if (y > maxY) {
     maxY = y + 1;
     modified = true;
   }
   if (z < minZ) {
     minZ = z;
     modified = true;
   } else if (z > maxZ) {
     maxZ = z + 1;
     modified = true;
   }
   if (modified) {
     grid = new Monomer[maxX - minX + 1][maxY - minY + 1][maxZ - minZ + 1];
     for (Monomer CurrentMonomer : protein) {
       if (CurrentMonomer == monomer) break;
       if (!setCell(
           CurrentMonomer.getX(), CurrentMonomer.getY(), CurrentMonomer.getZ(), CurrentMonomer))
         throw new RuntimeException(
             "Overlaping monomers "
                 + getCell(CurrentMonomer.getX(), CurrentMonomer.getY(), CurrentMonomer.getZ())
                 + " and "
                 + CurrentMonomer);
     }
   }
   return (setCell(x, y, z, monomer)); // true if the (x,y,z) cell was empty and false otherwis.
 }
Esempio n. 3
0
  /**
   * Counts the number of HH contacts between the
   *
   * @param monomer and its neighbors with higher spetial indeces. The other contacts will be taken
   *     care of by the other monomers.
   * @return the number of contacts
   */
  public int countContacts(Monomer monomer) {
    Monomer monomer1;
    Vector3f pos = monomer.getR();

    if (monomer.type != MonomerType.H) return 0;
    int count = 0;
    int x = monomer.getX();
    int y = monomer.getY();
    int z = monomer.getZ();
    if (!xEdge(x)) {
      monomer1 = getCell(x + 1, y, z);
      if ((GARun.debug) && (monomer1 != null) && (monomer.protein != monomer1.protein))
        throw new RuntimeException(
            "Two proteins on the grid\n" + monomer.protein + "\n" + monomer1.protein);
      if ((monomer1 != null)
          && (monomer1 != monomer.getPrev())
          && (monomer1 != monomer.getNext())
          && (monomer1.type == MonomerType.H)) count++;
    }
    if (!yEdge(y)) {
      monomer1 = getCell(x, y + 1, z);
      if ((GARun.debug) && (monomer1 != null) && (monomer.protein != monomer1.protein))
        throw new RuntimeException(
            "Two proteins on the grid\n" + monomer.protein + "\n" + monomer1.protein);
      if ((monomer1 != null)
          && (monomer1 != monomer.getPrev())
          && (monomer1 != monomer.getNext())
          && (monomer1.type == MonomerType.H)) count++;
    }
    if (!zEdge(z)) {
      monomer1 = getCell(x, y, z + 1);
      if ((GARun.debug) && (monomer1 != null) && (monomer.protein != monomer1.protein))
        throw new RuntimeException(
            "Two proteins on the grid\n" + monomer.protein + "\n" + monomer1.protein);
      if ((monomer1 != null)
          && (monomer1 != monomer.getPrev())
          && (monomer1 != monomer.getNext())
          && (monomer1.type == MonomerType.H)) count++;
    }
    return count;
  }
Esempio n. 4
0
 public void reset(Monomer monomer) {
   grid[monomer.getX() - minX][monomer.getY() - minY][monomer.getZ() - minZ] = null;
 }