Esempio n. 1
0
  private double calcSingleAsa(int i) {
    Atom atom_i = atoms[i];
    ArrayList<Integer> neighbor_indices = findNeighborIndices(i);
    int n_neighbor = neighbor_indices.size();
    int j_closest_neighbor = 0;
    double radius = probe + radii[i];

    int n_accessible_point = 0;

    for (Point3d point : spherePoints) {
      boolean is_accessible = true;
      Point3d test_point =
          new Point3d(
              point.x * radius + atom_i.getX(),
              point.y * radius + atom_i.getY(),
              point.z * radius + atom_i.getZ());

      int[] cycled_indices = new int[n_neighbor];
      int arind = 0;
      for (int ind = j_closest_neighbor; ind < n_neighbor; ind++) {
        cycled_indices[arind] = ind;
        arind++;
      }
      for (int ind = 0; ind < j_closest_neighbor; ind++) {
        cycled_indices[arind] = ind;
        arind++;
      }

      for (int j : cycled_indices) {
        Atom atom_j = atoms[neighbor_indices.get(j)];
        double r = radii[neighbor_indices.get(j)] + probe;
        double diff_sq = test_point.distanceSquared(new Point3d(atom_j.getCoords()));
        if (diff_sq < r * r) {
          j_closest_neighbor = j;
          is_accessible = false;
          break;
        }
      }
      if (is_accessible) {
        n_accessible_point++;
      }
    }
    return cons * n_accessible_point * radius * radius;
  }