コード例 #1
0
ファイル: CIPTool.java プロジェクト: jaypat87/cdk
  /**
   * Returns the R or S chirality according to the CIP rules, based on the given chirality
   * information.
   *
   * @param container {@link IAtomContainer} to which the <code>stereoCenter</code> belongs.
   * @param stereoCenter Chiral center for which the CIP chirality is to be determined as {@link
   *     ITetrahedralChirality} object.
   * @return A {@link CIP_CHIRALITY} value.
   */
  public static CIP_CHIRALITY getCIPChirality(
      IAtomContainer container, ITetrahedralChirality stereoCenter) {

    // the LigancyFourChirality is kind of redundant but we keep for an
    // easy way to get the ILigands array
    LigancyFourChirality tmp = new LigancyFourChirality(container, stereoCenter);
    Stereo stereo = stereoCenter.getStereo();

    int parity = permParity(tmp.getLigands());

    if (parity == 0) return CIP_CHIRALITY.NONE;
    if (parity < 0) stereo = stereo.invert();

    if (stereo == Stereo.CLOCKWISE) return CIP_CHIRALITY.R;
    if (stereo == Stereo.ANTI_CLOCKWISE) return CIP_CHIRALITY.S;

    return CIP_CHIRALITY.NONE;
  }