Class CIPChirality.CIPAtom

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private CIPChirality.CIPAtom alkeneChild
      last atom of an alkene or cumulene atom
      private CIPChirality.CIPAtom alkeneParent
      first atom of an alkene or cumulene atom
      (package private) SimpleNode atom
      the associated Jmol (or otherwise) atom; use of the SimpleNode interface allows us to implement this in SMILES or Jmol as well as providing an interface other programs could use if implementing this code
      (package private) int atomIndex
      the application-assigned unique atom index for this atom; used in updating lstSmallRings
      (package private) CIPChirality.CIPAtom[] atoms
      the substituents -- up to four supported here at this time
      private char auxChirality
      auxiliary chirality as determined in createAuxiliaryRule4Data; possibilities include R/S, r/s, M/P, m/p, C/T (but not c/t), or ~ (ASCII 126, no stereochemistry); for sorting purposes C=M=R < p=r=s < ~
      private int auxEZ
      auxiliary chirality E/Z for this atom node
      (package private) int bondCount
      true atom covalent bond count; cached for better performance
      private javajs.util.BS bsPath
      bitset of indices of the associated atoms in the path to this atom node from the root; used to keep track of the path to this atom in order to prevent infinite cycling; the last atom in the path when cyclic is a duplicate atom.
      private javajs.util.BS bsRule6Subs
      a list of only the undifferentiated ligands in Rule 6 -- root atom only
      private javajs.util.BS bsTemp
      used to count the number of priorities
      private java.lang.String chiralPath
      ASCII-encoded priority string
      (package private) float elemNo
      Rule 1a nominal element number; may be fractional for Kekule issues
      (package private) int h1Count
      a count of how many 1H atoms we have found on this atom; used to halt further processing of this atom
      (package private) java.util.Map<java.lang.Integer,​java.lang.Integer> htPathPoints
      Rule 1b hash table that maintains distance of the associated nonduplicated atom node
      private int id
      unique ID for this CIPAtom for debugging only
      private boolean isAlkene
      is one atom of a double bond
      private boolean isAlkeneAtom2
      a flag used in Rule 3 to indicate the second carbon of a double bond
      private boolean isChiralPath
      a check for downstream chirality
      (package private) boolean isDuplicate
      a flag to indicate atom that is a duplicate, either due to ring closure or multiple bonding -- element number and mass, but no substituents; slightly lower in priority than standard atoms.
      private boolean isEvenEne
      alkene or even cumulene, so chirality will be EZ, not MP
      private boolean isKekuleAmbiguous
      is an atom that is involved in more than one Kekule form
      (package private) boolean isRule5Pseudo
      odd/even toggle for comparisons of Rule5 results that would make for R/S, not r/s, if this flag is false.
      private boolean isSet
      a flag to prevent finalization of an atom node more than once
      (package private) boolean isSP3
      a flag set false in evaluation of Rule 5 to indicate that there was more than one R/S decision made, so this center cannot be r/s; initially just indicates that the atom has 4 covalent bonds or is trigonal pyriamidal
      (package private) boolean isTerminal
      a flag to indicate an atom that has no substituents; a branch end point; typically H or a halogen (F, Cl, Br, I); also set TRUE if there is a problem setting an atom; does not include duplicates
      (package private) javajs.util.BS[] listRS
      bitsets for tracking R and S for Rule 4b
      private float mass
      Rule 2 isotope mass number if identified or average atomic mass if not C (12.011) > 12C, O (15.999) < 16O, and F (18.998) < 19F Source:
      private boolean multipleBondDuplicate
      potentially useful information that this duplicate is from an double- or triple-bond, not a ring closure
      (package private) java.lang.String myPath
      String path, for debugging
      private int nAtoms
      number of substituent atoms (non-null atoms[] entries)
      private CIPChirality.CIPAtom nextChiralBranch
      points to next branching point that has two or more chiral branches
      private CIPChirality.CIPAtom nextSP2
      first =X= atom in a string of =X=X=X=...
      (package private) int nPriorities
      the number of distinct priorities determined for this atom for the current rule; 0-4 for the root atom; 0-3 for all others
      (package private) int nRootDuplicates
      number of root-duplicate atoms (root atom only
      (package private) int oldNPriorities
      the number of distinct priorities determined for this atom for the current rule; 0-4 for the root atom; 0-3 for all others
      (package private) int[] oldPriorities
      priorities associated with each subsituent from high (0) to low (3); due to equivaliencies at a given rule level, these numbers may duplicate and have gaps - for example, [0 2 0 3]
      (package private) CIPChirality.CIPAtom parent
      direct ancestor of this atom
      (package private) int[] priorities
      priorities associated with each subsituent from high (0) to low (3); due to equivaliencies at a given rule level, these numbers may duplicate and have gaps - for example, [0 2 0 3]
      (package private) int priority
      current priority 0-3; used for Rule 4b and 5 priority sorting
      private int rootDistance
      Rule 1b measure: Distance from root of the corresponding nonduplicated atom (duplicate nodes only).
      (package private) CIPChirality.CIPAtom rootSubstituent
      sphere-1 node in this atom's root branch
      private int rule4Ref
      Rule 4b reference chirality (R or S, 1 or 2); root only
      (package private) int rule4Type
      the auxiiary chirality type: 0: ~, 1: R, 2: S; normalized to R/S even if M/P or C/T
      (package private) int rule6refIndex
      reference index for Rule 6 -- root atom only
      private int sphere
      bond distance from the root atom to this atom
    • Constructor Summary

      Constructors 
      Constructor Description
      CIPAtom()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private CIPChirality.CIPAtom addAtom​(int i, SimpleNode other, boolean isDuplicate, boolean isAlkene, boolean isParentBond)
      Add a new atom or return null
      private void addChiralAtoms​(javajs.util.Lst<CIPChirality.CIPAtom> chiralAtoms, int ref)
      Create an ASCII string that allows the list of descriptors to be generated in order.
      private void addReturnPath​(CIPChirality.CIPAtom newParent, CIPChirality.CIPAtom fromAtom)
      Add the path back to the root for an auxiliary center.
      private boolean auxSort​(int rule)
      Sort by a given rule, preserving currentRule, which could be 4 or 5
      private int breakTie​(CIPChirality.CIPAtom b, int sphere)
      Break a tie at any level in the iteration between to atoms that otherwise are the same by sorting their substituents.
      private int checkCurrentRule​(CIPChirality.CIPAtom b)
      Check this atom "A" vs a challenger "B" against the current rule.
      (package private) void clearRule4Lists()
      Clear Rule 4b information if Rule-5 pseudochiral centers have been found, as that could change the order of descriptors in the Mata list.
      java.lang.Object clone()  
      private javajs.util.BS compareLikeUnlike​(javajs.util.BS bsA, javajs.util.BS bsB)  
      private int compareRule1a​(CIPChirality.CIPAtom b)
      Looking for phantom atom (atom number 0) or element number
      private int compareRule1b​(CIPChirality.CIPAtom b)
      Looking for root distance -- duplicate atoms only.
      private int compareRule2​(CIPChirality.CIPAtom b)
      Chapter 9 Rule 2.
      private int compareRule3​(CIPChirality.CIPAtom b)
      Chapter 9 Rule 3.
      private int compareRule4b5​(CIPChirality.CIPAtom b)
      Compare the better R-ref or S-ref list for A with the same for B.
      private int compareRule6​(CIPChirality.CIPAtom b)
      Just look for match with the Rule 6 reference atom index
      private int compareRules4ac​(CIPChirality.CIPAtom b, java.lang.String test)
      Chapter 9 Rules 4a and 4c.
      int compareTo​(CIPChirality.CIPAtom b)
      Used in Array.sort when an atom is set and Collection.sort when determining the Mata like/unlike sequence for Rules 4b and 5.
      private int countAuxDuplicates​(int index)
      Get a count of the number of duplicate nodes to the auxiliary atom.
      (package private) CIPChirality.CIPAtom create​(SimpleNode atom, CIPChirality.CIPAtom parent, boolean isAlkene, boolean isDuplicate, boolean isParentBond)  
      (package private) boolean createAuxiliaryDescriptors​(CIPChirality.CIPAtom node1, CIPChirality.CIPAtom[] ret)
      By far the most complex of the methods, this method creates a list of downstream (higher-sphere) auxiliary chirality designators, starting with those furthest from the root and moving in, toward the root.
      private java.lang.String dots()
      Provide an indent for clarity in debugging messages
      private CIPChirality.CIPAtom getAuxEneEndWinner​(CIPChirality.CIPAtom end, CIPChirality.CIPAtom prevSP2, int[] retRule)
      Get the atom that is the highest priority of two atoms on the end of a double bond after sorting from Rule 1a through a given rule (Rule 3 or Rule 5)
      private int getAuxEneWinnerChirality​(CIPChirality.CIPAtom end1, CIPChirality.CIPAtom end2, boolean isAxial, int[] retRule2)
      Determine the winner on one end of an alkene or cumulene and return also the rule by which that was determined.
      private javajs.util.BS getBetter4bList()
      Create Mata-style linear atom.listRS and return the better of R-ref or S-ref.
      (package private) int getEneTop()
      Check ene for first nonduplicate.
      private float getKekuleElementNumber()
      Calculate the average element numbers of associated double-bond atoms weighted by their most significant Kekule resonance contributor(s).
      private float getMass()
      get the atomic mass only if needed by Rule 2, testing for three special conditions in the case of isotopes: If a duplicate, or an isotope that is 100% nat abundant is specified, or isotopic mass is not specified, just use the average mass.
      (package private) int getRule6Descriptor​(boolean isAux)
      The original Rule 6 implementation; allows cubane, tetrahedrane, and bicyclo[2.2.2]octane to be ns.
      private boolean isType​(java.lang.String rule2Type)  
      private javajs.util.BS rank4bAndRead​(javajs.util.BS bsR)
      A thread-based sphere-ordered implementation that takes into account that lists cross the boundaries of branches.
      private void replaceParentSubstituent​(CIPChirality.CIPAtom oldSub, CIPChirality.CIPAtom newParent, CIPChirality.CIPAtom newSub)
      Swap a substituent and the parent in preparation for reverse traversal of this path back to the root atom.
      private void saveRestorePriorities​(boolean isRestore)
      Reset priorities after each Rule 6 test.
      private void setEne()
      Set all ene-related fields upon finding the second atom.
      (package private) boolean setNode()
      Set the atom to have substituents.
      private int sign​(int score)
      Just a simple signum for integers
      (package private) boolean sortSubstituents​(int sphere)
      Deep-Sort the substituents of an atom, setting the node's atoms[] and priorities[] arrays.
      java.lang.String toString()  
      private int unlikeDuplicates​(CIPChirality.CIPAtom b)
      This check is not technically one of those listed in the rules, but it is useful when preparing to check substituents because if one of the atoms has substituents and the other doesn't, we are done -- there is no reason to check substituents.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • isRule5Pseudo

        boolean isRule5Pseudo
        odd/even toggle for comparisons of Rule5 results that would make for R/S, not r/s, if this flag is false.
      • id

        private int id
        unique ID for this CIPAtom for debugging only
      • sphere

        private int sphere
        bond distance from the root atom to this atom
      • rootDistance

        private int rootDistance
        Rule 1b measure: Distance from root of the corresponding nonduplicated atom (duplicate nodes only). AMENDED HERE for duplicate nodes associated with a double-bond in a 6-membered-ring benzenoid (benzene, naphthalene, pyridine, pyrazoline, etc.) "Kekule-ambiguous" system to be its sphere.
      • isSet

        private boolean isSet
        a flag to prevent finalization of an atom node more than once
      • isDuplicate

        boolean isDuplicate
        a flag to indicate atom that is a duplicate, either due to ring closure or multiple bonding -- element number and mass, but no substituents; slightly lower in priority than standard atoms.
      • isTerminal

        boolean isTerminal
        a flag to indicate an atom that has no substituents; a branch end point; typically H or a halogen (F, Cl, Br, I); also set TRUE if there is a problem setting an atom; does not include duplicates
      • isAlkene

        private boolean isAlkene
        is one atom of a double bond
      • atom

        SimpleNode atom
        the associated Jmol (or otherwise) atom; use of the SimpleNode interface allows us to implement this in SMILES or Jmol as well as providing an interface other programs could use if implementing this code
      • atomIndex

        int atomIndex
        the application-assigned unique atom index for this atom; used in updating lstSmallRings
      • bondCount

        int bondCount
        true atom covalent bond count; cached for better performance
      • elemNo

        float elemNo
        Rule 1a nominal element number; may be fractional for Kekule issues
      • mass

        private float mass
        Rule 2 isotope mass number if identified or average atomic mass if not C (12.011) > 12C, O (15.999) < 16O, and F (18.998) < 19F Source:
      • h1Count

        int h1Count
        a count of how many 1H atoms we have found on this atom; used to halt further processing of this atom
      • nAtoms

        private int nAtoms
        number of substituent atoms (non-null atoms[] entries)
      • bsPath

        private javajs.util.BS bsPath
        bitset of indices of the associated atoms in the path to this atom node from the root; used to keep track of the path to this atom in order to prevent infinite cycling; the last atom in the path when cyclic is a duplicate atom.
      • myPath

        java.lang.String myPath
        String path, for debugging
      • oldPriorities

        int[] oldPriorities
        priorities associated with each subsituent from high (0) to low (3); due to equivaliencies at a given rule level, these numbers may duplicate and have gaps - for example, [0 2 0 3]
      • priorities

        int[] priorities
        priorities associated with each subsituent from high (0) to low (3); due to equivaliencies at a given rule level, these numbers may duplicate and have gaps - for example, [0 2 0 3]
      • oldNPriorities

        int oldNPriorities
        the number of distinct priorities determined for this atom for the current rule; 0-4 for the root atom; 0-3 for all others
      • nPriorities

        int nPriorities
        the number of distinct priorities determined for this atom for the current rule; 0-4 for the root atom; 0-3 for all others
      • priority

        int priority
        current priority 0-3; used for Rule 4b and 5 priority sorting
      • chiralPath

        private java.lang.String chiralPath
        ASCII-encoded priority string
      • nRootDuplicates

        int nRootDuplicates
        number of root-duplicate atoms (root atom only
      • htPathPoints

        java.util.Map<java.lang.Integer,​java.lang.Integer> htPathPoints
        Rule 1b hash table that maintains distance of the associated nonduplicated atom node
      • rule6refIndex

        int rule6refIndex
        reference index for Rule 6 -- root atom only
      • bsRule6Subs

        private javajs.util.BS bsRule6Subs
        a list of only the undifferentiated ligands in Rule 6 -- root atom only
      • isAlkeneAtom2

        private boolean isAlkeneAtom2
        a flag used in Rule 3 to indicate the second carbon of a double bond
      • isKekuleAmbiguous

        private boolean isKekuleAmbiguous
        is an atom that is involved in more than one Kekule form
      • multipleBondDuplicate

        private boolean multipleBondDuplicate
        potentially useful information that this duplicate is from an double- or triple-bond, not a ring closure
      • isEvenEne

        private boolean isEvenEne
        alkene or even cumulene, so chirality will be EZ, not MP
      • auxEZ

        private int auxEZ
        auxiliary chirality E/Z for this atom node
      • isSP3

        boolean isSP3
        a flag set false in evaluation of Rule 5 to indicate that there was more than one R/S decision made, so this center cannot be r/s; initially just indicates that the atom has 4 covalent bonds or is trigonal pyriamidal
      • auxChirality

        private char auxChirality
        auxiliary chirality as determined in createAuxiliaryRule4Data; possibilities include R/S, r/s, M/P, m/p, C/T (but not c/t), or ~ (ASCII 126, no stereochemistry); for sorting purposes C=M=R < p=r=s < ~
      • nextChiralBranch

        private CIPChirality.CIPAtom nextChiralBranch
        points to next branching point that has two or more chiral branches
      • isChiralPath

        private boolean isChiralPath
        a check for downstream chirality
      • rule4Type

        int rule4Type
        the auxiiary chirality type: 0: ~, 1: R, 2: S; normalized to R/S even if M/P or C/T
      • bsTemp

        private javajs.util.BS bsTemp
        used to count the number of priorities
      • rule4Ref

        private int rule4Ref
        Rule 4b reference chirality (R or S, 1 or 2); root only
      • listRS

        javajs.util.BS[] listRS
        bitsets for tracking R and S for Rule 4b
    • Constructor Detail

      • CIPAtom

        CIPAtom()
    • Method Detail

      • create

        CIPChirality.CIPAtom create​(SimpleNode atom,
                                    CIPChirality.CIPAtom parent,
                                    boolean isAlkene,
                                    boolean isDuplicate,
                                    boolean isParentBond)
        Parameters:
        atom - or null to indicate a null placeholder
        parent -
        isAlkene -
        isDuplicate -
        isParentBond -
        Returns:
        this
      • getEneTop

        int getEneTop()
        Check ene for first nonduplicate.
        Returns:
        1 or 2
      • getRule6Descriptor

        int getRule6Descriptor​(boolean isAux)
        The original Rule 6 implementation; allows cubane, tetrahedrane, and bicyclo[2.2.2]octane to be ns.
        Parameters:
        isAux -
        Returns:
        NO_CHIRALITY or descriptor
      • saveRestorePriorities

        private void saveRestorePriorities​(boolean isRestore)
        Reset priorities after each Rule 6 test.
        Parameters:
        isRestore -
      • countAuxDuplicates

        private int countAuxDuplicates​(int index)
        Get a count of the number of duplicate nodes to the auxiliary atom.
        Parameters:
        index -
        Returns:
        the number of dublicates to the auxiliary center
      • getMass

        private float getMass()
        get the atomic mass only if needed by Rule 2, testing for three special conditions in the case of isotopes: If a duplicate, or an isotope that is 100% nat abundant is specified, or isotopic mass is not specified, just use the average mass. Otherwise, use the integer isotope mass number, taking care in the cases of 16O, 52Cr, 96Mo, and 175Lu, to reduce this integer by 0.1 so as to put it in the correct relationship to the element's average mass.
        Returns:
        mass or mass surrogate
      • isType

        private boolean isType​(java.lang.String rule2Type)
      • getKekuleElementNumber

        private float getKekuleElementNumber()
        Calculate the average element numbers of associated double-bond atoms weighted by their most significant Kekule resonance contributor(s). We only consider simple benzenoid systems -- 6-membered rings and their 6-memebered rings fused to them. Calculated for the parent of an sp2-duplicate atom.
        Returns:
        an averaged element number
      • setNode

        boolean setNode()
        Set the atom to have substituents.
        Returns:
        true if a valid atom for consideration
      • setEne

        private void setEne()
        Set all ene-related fields upon finding the second atom.
      • addAtom

        private CIPChirality.CIPAtom addAtom​(int i,
                                             SimpleNode other,
                                             boolean isDuplicate,
                                             boolean isAlkene,
                                             boolean isParentBond)
        Add a new atom or return null
        Parameters:
        i -
        other -
        isDuplicate -
        isAlkene -
        isParentBond -
        Returns:
        new atom or null
      • sortSubstituents

        boolean sortSubstituents​(int sphere)
        Deep-Sort the substituents of an atom, setting the node's atoms[] and priorities[] arrays. Checking for "ties" that will lead to pseudochirality is also done here.
        Parameters:
        sphere - current working sphere; Integer.MIN_VALUE to not break ties
        Returns:
        all priorities assigned
      • dots

        private java.lang.String dots()
        Provide an indent for clarity in debugging messages
        Returns:
        a string of dots based on the value of atom.sphere.
      • breakTie

        private int breakTie​(CIPChirality.CIPAtom b,
                             int sphere)
        Break a tie at any level in the iteration between to atoms that otherwise are the same by sorting their substituents.
        Parameters:
        b -
        sphere - current working sphere
        Returns:
        [0 (TIED), -1 (A_WINS), or 1 (B_WINS)] * (sphere where broken)
      • compareTo

        public int compareTo​(CIPChirality.CIPAtom b)
        Used in Array.sort when an atom is set and Collection.sort when determining the Mata like/unlike sequence for Rules 4b and 5. Includes a preliminary check for duplicates, since we know that that atom will ultimately be lower priority if all other rules are tied. *
        Specified by:
        compareTo in interface java.lang.Comparable<CIPChirality.CIPAtom>
        Returns:
        0 (TIED), -1 (A_WINS), or 1 (B_WINS)
      • checkCurrentRule

        private int checkCurrentRule​(CIPChirality.CIPAtom b)
        Check this atom "A" vs a challenger "B" against the current rule. Note that example BB 2013 page 1258, P93.5.2.3 requires that RULE_1b be applied only after RULE_1a has been applied exhaustively for a sphere; otherwise C1 is R, not S (AY-236.53).
        Parameters:
        b -
        Returns:
        0 (TIED), -1 (A_WINS), or 1 (B_WINS), or Intege.MIN_VALUE (IGNORE)
      • unlikeDuplicates

        private int unlikeDuplicates​(CIPChirality.CIPAtom b)
        This check is not technically one of those listed in the rules, but it is useful when preparing to check substituents because if one of the atoms has substituents and the other doesn't, we are done -- there is no reason to check substituents.
        Parameters:
        b -
        Returns:
        0 (TIED), -1 (A_WINS), or 1 (B_WINS)
      • compareRule1a

        private int compareRule1a​(CIPChirality.CIPAtom b)
        Looking for phantom atom (atom number 0) or element number
        Parameters:
        b -
        Returns:
        0 (TIED), -1 (A_WINS), or 1 (B_WINS)
      • compareRule1b

        private int compareRule1b​(CIPChirality.CIPAtom b)
        Looking for root distance -- duplicate atoms only. (We have checked for
        Parameters:
        b -
        Returns:
        0 (TIED), -1 (A_WINS), or 1 (B_WINS)
      • compareRule2

        private int compareRule2​(CIPChirality.CIPAtom b)
        Chapter 9 Rule 2. atomic mass, with possible reversal due to use of mass numbers. Also checks for temporary Rule 6 promotion for full Rule 6 implemenation (rr bicyclo[2.2.2]octane)
        Parameters:
        b -
        Returns:
        0 (TIED), -1 (A_WINS), or 1 (B_WINS)
      • compareRule3

        private int compareRule3​(CIPChirality.CIPAtom b)
        Chapter 9 Rule 3. E/Z. We carry out this step only as a tie in the sphere AFTER the final atom of the alkene or even-cumulene. If the this atom and the comparison atom b are on the same parent, then this is simply a request to break their tie based on Rule 3; otherwise two paths are being checked for one being seqCis and one being seqTrans.
        Parameters:
        b -
        Returns:
        0 (TIED), -1 (A_WINS), or 1 (B_WINS)
      • compareRules4ac

        private int compareRules4ac​(CIPChirality.CIPAtom b,
                                    java.lang.String test)
        Chapter 9 Rules 4a and 4c. This method allows for "RS" to be checked as "either R or S". See AY236.66, AY236.67, AY236.147,148,156,170,171,201,202, etc. (4a)
        Parameters:
        b -
        test - String to test against; depends upon subrule being checked
        Returns:
        0 (TIED), -1 (A_WINS), or 1 (B_WINS)
      • compareRule4b5

        private int compareRule4b5​(CIPChirality.CIPAtom b)
        Compare the better R-ref or S-ref list for A with the same for B.
        Parameters:
        b -
        Returns:
        A_WINS, B_WINS, or IGNORE
      • compareRule6

        private int compareRule6​(CIPChirality.CIPAtom b)
        Just look for match with the Rule 6 reference atom index
        Parameters:
        b -
        Returns:
        A_WINS, B_WINS, or TIED
      • clearRule4Lists

        void clearRule4Lists()
        Clear Rule 4b information if Rule-5 pseudochiral centers have been found, as that could change the order of descriptors in the Mata list.
      • getBetter4bList

        private javajs.util.BS getBetter4bList()
        Create Mata-style linear atom.listRS and return the better of R-ref or S-ref. Used first in Rule 4b and again in Rule 5.
        Returns:
        the better 4b list
      • rank4bAndRead

        private javajs.util.BS rank4bAndRead​(javajs.util.BS bsR)
        A thread-based sphere-ordered implementation that takes into account that lists cross the boundaries of branches.
        Parameters:
        bsR - null if this is for R or the R-ref list if this is for S
        Returns:
        ranked list
      • addChiralAtoms

        private void addChiralAtoms​(javajs.util.Lst<CIPChirality.CIPAtom> chiralAtoms,
                                    int ref)
        Create an ASCII string that allows the list of descriptors to be generated in order. This list must take into account both the current (Rule 4a or Rule 4c) priority group (0 highest to 3 lowest) of each point along the path back to the root for this node. This is done by multiplying the priority group by 4 and adding in the like- unlike-ness of the node as one of 0 (ns), 1 (like), or 2 (unlike). In this way, we can get cross-branch sorting, not just the typical breadth-first sorting that we usually use for ranking. For example, in BH_64_085, two branches of a ligand each have two branches that have identical Rule 4a priorities, leading to four branches that must be sorted as the "highest-priority" set in Rule 4b.
        Parameters:
        chiralAtoms -
        ref -
      • compareLikeUnlike

        private javajs.util.BS compareLikeUnlike​(javajs.util.BS bsA,
                                                 javajs.util.BS bsB)
      • createAuxiliaryDescriptors

        boolean createAuxiliaryDescriptors​(CIPChirality.CIPAtom node1,
                                           CIPChirality.CIPAtom[] ret)
        By far the most complex of the methods, this method creates a list of downstream (higher-sphere) auxiliary chirality designators, starting with those furthest from the root and moving in, toward the root.
        Parameters:
        node1 - first node; sphere 1
        ret - CIPAtom of next stereochemical branching point
        Returns:
        collective string, with setting of rule4List
      • auxSort

        private boolean auxSort​(int rule)
        Sort by a given rule, preserving currentRule, which could be 4 or 5
        Parameters:
        rule -
        Returns:
        true if a decision has been made
      • getAuxEneWinnerChirality

        private int getAuxEneWinnerChirality​(CIPChirality.CIPAtom end1,
                                             CIPChirality.CIPAtom end2,
                                             boolean isAxial,
                                             int[] retRule2)
        Determine the winner on one end of an alkene or cumulene and return also the rule by which that was determined.
        Parameters:
        end1 -
        end2 -
        isAxial -
        retRule2 - return for rule found for child end (furthest from root)
        Returns:
        one of: {NO_CHIRALITY | STEREO_Z | STEREO_E | STEREO_M | STEREO_P}
      • getAuxEneEndWinner

        private CIPChirality.CIPAtom getAuxEneEndWinner​(CIPChirality.CIPAtom end,
                                                        CIPChirality.CIPAtom prevSP2,
                                                        int[] retRule)
        Get the atom that is the highest priority of two atoms on the end of a double bond after sorting from Rule 1a through a given rule (Rule 3 or Rule 5)
        Parameters:
        end -
        prevSP2 -
        retRule - return for deciding rule
        Returns:
        higher-priority atom, or null if they are equivalent
      • addReturnPath

        private void addReturnPath​(CIPChirality.CIPAtom newParent,
                                   CIPChirality.CIPAtom fromAtom)
        Add the path back to the root for an auxiliary center.
        Parameters:
        newParent -
        fromAtom -
      • replaceParentSubstituent

        private void replaceParentSubstituent​(CIPChirality.CIPAtom oldSub,
                                              CIPChirality.CIPAtom newParent,
                                              CIPChirality.CIPAtom newSub)
        Swap a substituent and the parent in preparation for reverse traversal of this path back to the root atom.
        Parameters:
        oldSub -
        newParent -
        newSub -
      • sign

        private int sign​(int score)
        Just a simple signum for integers
        Parameters:
        score -
        Returns:
        0, -1, or 1
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object