/**
* JNA-InChI - Library for calling InChI from Java
* Copyright © 2018 Daniel Lowe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see
* Given
* A E
* \ /
* C = D
* / \
* B F
*
* atom1 is A (or B)
* atom2 is C
* atom3 is D
* atom4 is E (or F)
* and the parity is whether atom1 and atom2 are on the same side; {@link InchiStereoParity#ODD} if on the same side
* Atom1/2 should be chosen such that neither are implicit hydrogen
*
* For a cumulene (NOTE stereochemistry on cumulenes with more than 3 double bonds are unsupported by InChI)
* Given
* A G
* \ /
* C = D = E = F
* / \
* B H
*
* atom1 is A (or B)
* atom2 is D
* atom3 is E
* atom4 is G (or H)
*
* Atom1/2 should be chosen such that neither are implicit hydrogen
*
* For the 2 adjacent double-bond case use {@link InchiStereo#createAllenalStereo(InchiAtom, InchiAtom, InchiAtom, InchiAtom, InchiAtom, InchiStereoParity)}
*
* @param atom1
* @param atom2
* @param atom3
* @param atom4
* @param parity
* @return
*/
public static InchiStereo createDoubleBondStereo(InchiAtom atom1, InchiAtom atom2, InchiAtom atom3, InchiAtom atom4, InchiStereoParity parity) {
if (STEREO_IMPLICIT_H == atom1 || STEREO_IMPLICIT_H == atom2|| STEREO_IMPLICIT_H == atom3 || STEREO_IMPLICIT_H == atom4) {
throw new IllegalArgumentException("Double bond stereo should use non-implicit hydrogn atoms");
}
return new InchiStereo(new InchiAtom[] {atom1, atom2, atom3, atom4}, null, InchiStereoType.DoubleBond, parity);
}
/**
*
* Defines the stereo configuration of an allenal stereocentre, these behave like an extended tetrahedron.
* The four vertexes of the tetrahedron should be given along with the parity.
* If one of the vertexes is an implicit hydrogen use {@link #STEREO_IMPLICIT_H}.
*
* Given
* A F
* \ /
* C = D = E
* / \
* B G
*
* centralAtom is D
* atom1 is A
* atom2 is B
* atom3 is F
* atom4 is G
*
* (NOTE allenal centers with more than 2 double bonds are unsupported by InChI)
*
* @param centralAtom
* @param atom1
* @param atom2
* @param atom3
* @param atom4
* @param parity
* @return
*/
public static InchiStereo createAllenalStereo(InchiAtom centralAtom, InchiAtom atom1, InchiAtom atom2, InchiAtom atom3, InchiAtom atom4, InchiStereoParity parity) {
return new InchiStereo(new InchiAtom[] {atom1, atom2, atom3, atom4}, centralAtom, InchiStereoType.Allene, parity);
}
public InchiAtom[] getAtoms() {
return atoms;
}
/**
* Null for {@link InchiStereoType#DoubleBond}
* @return
*/
public InchiAtom getCentralAtom() {
return centralAtom;
}
public InchiStereoType getType() {
return type;
}
public InchiStereoParity getParity() {
return parity;
}
}