class CIPChirality.CIPAtom extends java.lang.Object implements java.lang.Comparable<CIPChirality.CIPAtom>, java.lang.Cloneable
Modifier and Type | Field and 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 and Description |
---|
CIPAtom() |
Modifier and Type | Method and 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.
|
boolean isRule5Pseudo
private int id
private int sphere
private int rootDistance
private boolean isSet
boolean isDuplicate
boolean isTerminal
private boolean isAlkene
SimpleNode atom
int atomIndex
int bondCount
float elemNo
private float mass
CIPChirality.CIPAtom parent
CIPChirality.CIPAtom rootSubstituent
int h1Count
CIPChirality.CIPAtom[] atoms
private int nAtoms
private javajs.util.BS bsPath
java.lang.String myPath
int[] oldPriorities
int[] priorities
int oldNPriorities
int nPriorities
int priority
private java.lang.String chiralPath
int nRootDuplicates
java.util.Map<java.lang.Integer,java.lang.Integer> htPathPoints
int rule6refIndex
private javajs.util.BS bsRule6Subs
private CIPChirality.CIPAtom alkeneParent
private CIPChirality.CIPAtom alkeneChild
private boolean isAlkeneAtom2
private boolean isKekuleAmbiguous
private CIPChirality.CIPAtom nextSP2
private boolean multipleBondDuplicate
private boolean isEvenEne
private int auxEZ
boolean isSP3
private char auxChirality
private CIPChirality.CIPAtom nextChiralBranch
private boolean isChiralPath
int rule4Type
private javajs.util.BS bsTemp
private int rule4Ref
javajs.util.BS[] listRS
CIPChirality.CIPAtom create(SimpleNode atom, CIPChirality.CIPAtom parent, boolean isAlkene, boolean isDuplicate, boolean isParentBond)
atom
- or null to indicate a null placeholderparent
- isAlkene
- isDuplicate
- isParentBond
- int getEneTop()
int getRule6Descriptor(boolean isAux)
isAux
- private void saveRestorePriorities(boolean isRestore)
isRestore
- private int countAuxDuplicates(int index)
index
- private float getMass()
private boolean isType(java.lang.String rule2Type)
private float getKekuleElementNumber()
boolean setNode()
private void setEne()
private CIPChirality.CIPAtom addAtom(int i, SimpleNode other, boolean isDuplicate, boolean isAlkene, boolean isParentBond)
i
- other
- isDuplicate
- isAlkene
- isParentBond
- boolean sortSubstituents(int sphere)
sphere
- current working sphere; Integer.MIN_VALUE to not break tiesprivate java.lang.String dots()
private int breakTie(CIPChirality.CIPAtom b, int sphere)
b
- sphere
- current working spherepublic int compareTo(CIPChirality.CIPAtom b)
compareTo
in interface java.lang.Comparable<CIPChirality.CIPAtom>
private int checkCurrentRule(CIPChirality.CIPAtom b)
b
- private int unlikeDuplicates(CIPChirality.CIPAtom b)
b
- private int compareRule1a(CIPChirality.CIPAtom b)
b
- private int compareRule1b(CIPChirality.CIPAtom b)
b
- private int compareRule2(CIPChirality.CIPAtom b)
b
- private int compareRule3(CIPChirality.CIPAtom b)
b
- private int compareRules4ac(CIPChirality.CIPAtom b, java.lang.String test)
b
- test
- String to test against; depends upon subrule being checkedprivate int compareRule4b5(CIPChirality.CIPAtom b)
b
- private int compareRule6(CIPChirality.CIPAtom b)
b
- void clearRule4Lists()
private javajs.util.BS getBetter4bList()
private javajs.util.BS rank4bAndRead(javajs.util.BS bsR)
bsR
- null if this is for R or the R-ref list if this is for Sprivate void addChiralAtoms(javajs.util.Lst<CIPChirality.CIPAtom> chiralAtoms, int ref)
chiralAtoms
- ref
- private javajs.util.BS compareLikeUnlike(javajs.util.BS bsA, javajs.util.BS bsB)
boolean createAuxiliaryDescriptors(CIPChirality.CIPAtom node1, CIPChirality.CIPAtom[] ret)
node1
- first node; sphere 1ret
- CIPAtom of next stereochemical branching pointprivate boolean auxSort(int rule)
rule
- private int getAuxEneWinnerChirality(CIPChirality.CIPAtom end1, CIPChirality.CIPAtom end2, boolean isAxial, int[] retRule2)
end1
- end2
- isAxial
- retRule2
- return for rule found for child end (furthest from root)private CIPChirality.CIPAtom getAuxEneEndWinner(CIPChirality.CIPAtom end, CIPChirality.CIPAtom prevSP2, int[] retRule)
end
- prevSP2
- retRule
- return for deciding ruleprivate void addReturnPath(CIPChirality.CIPAtom newParent, CIPChirality.CIPAtom fromAtom)
newParent
- fromAtom
- private void replaceParentSubstituent(CIPChirality.CIPAtom oldSub, CIPChirality.CIPAtom newParent, CIPChirality.CIPAtom newSub)
oldSub
- newParent
- newSub
- private int sign(int score)
score
- public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object