/**
   * Gets the radius for given nucleotide atom
   *
   * @param atom
   * @return
   */
  private static double getRadiusForNucl(NucleotideImpl nuc, Atom atom) {

    if (atom.getElement().equals(Element.H)) return Element.H.getVDWRadius();
    if (atom.getElement().equals(Element.D)) return Element.D.getVDWRadius();

    if (atom.getElement() == Element.C) return NUC_CARBON_VDW;

    if (atom.getElement() == Element.N) return NUC_NITROGEN_VDW;

    if (atom.getElement() == Element.P) return PHOSPHOROUS_VDW;

    if (atom.getElement() == Element.O) return OXIGEN_VDW;

    System.err.println(
        "Warning: unexpected atom "
            + atom.getName()
            + " for nucleotide "
            + nuc.getPDBName()
            + ", assigning its standard vdw radius");
    return atom.getElement().getVDWRadius();
  }
  /**
   * Gets the radius for given amino acid and atom
   *
   * @param aa
   * @param atom
   * @return
   */
  private static double getRadiusForAmino(AminoAcid amino, Atom atom) {

    if (atom.getElement().equals(Element.H)) return Element.H.getVDWRadius();
    // some unusual entries (e.g. 1tes) contain Deuterium atoms in standard aminoacids
    if (atom.getElement().equals(Element.D)) return Element.D.getVDWRadius();

    String atomCode = atom.getName();
    char aa = amino.getAminoType();

    // here we use the values that Chothia gives in his paper (as NACCESS does)
    if (atom.getElement() == Element.O) {
      return OXIGEN_VDW;
    } else if (atom.getElement() == Element.S) {
      return SULFUR_VDW;
    } else if (atom.getElement() == Element.N) {
      if (atomCode.equals("NZ")) return TETRAHEDRAL_NITROGEN_VDW; // tetrahedral Nitrogen
      return TRIGONAL_NITROGEN_VDW; // trigonal Nitrogen
    } else if (atom.getElement() == Element.C) { // it must be a carbon
      if (atomCode.equals("C")
          || atomCode.equals("CE1")
          || atomCode.equals("CE2")
          || atomCode.equals("CE3")
          || atomCode.equals("CH2")
          || atomCode.equals("CZ")
          || atomCode.equals("CZ2")
          || atomCode.equals("CZ3")) {
        return TRIGONAL_CARBON_VDW; // trigonal Carbon
      } else if (atomCode.equals("CA")
          || atomCode.equals("CB")
          || atomCode.equals("CE")
          || atomCode.equals("CG1")
          || atomCode.equals("CG2")) {
        return TETRAHEDRAL_CARBON_VDW; // tetrahedral Carbon
      }
      // the rest of the cases (CD, CD1, CD2, CG) depend on amino acid
      else {
        switch (aa) {
          case 'F':
          case 'W':
          case 'Y':
          case 'H':
          case 'D':
          case 'N':
            return TRIGONAL_CARBON_VDW;

          case 'P':
          case 'K':
          case 'R':
          case 'M':
          case 'I':
          case 'L':
            return TETRAHEDRAL_CARBON_VDW;

          case 'Q':
          case 'E':
            if (atomCode.equals("CD")) return TRIGONAL_CARBON_VDW;
            else if (atomCode.equals("CG")) return TETRAHEDRAL_CARBON_VDW;

          default:
            System.err.println(
                "Warning: unexpected carbon atom "
                    + atomCode
                    + " for aminoacid "
                    + aa
                    + ", assigning its standard vdw radius");
            return Element.C.getVDWRadius();
        }
      }

      // not any of the expected atoms
    } else {
      System.err.println(
          "Warning: unexpected atom "
              + atomCode
              + " for aminoacid "
              + aa
              + ", assigning its standard vdw radius");
      return atom.getElement().getVDWRadius();
    }
  }