Package org.jmol.adapter.readers.cif
Class TopoCifParser
- java.lang.Object
-
- org.jmol.adapter.readers.cif.TopoCifParser
-
- All Implemented Interfaces:
CifReader.Parser
public class TopoCifParser extends java.lang.Object implements CifReader.Parser
see https://github.com/COMCIFS/TopoCif Basic idea: We have TLinks, TNodes, and TAtoms TLinks each have two TNodes and may also be associated with bridging TAtom sets. TNode extends TAtom and may also maintain a list of TAtoms. TAtoms extend Atom and may have symmetry aspects.- Author:
- Bob Hanson hansonr@stolaf.edu 2020.11.17 2021.05.07
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classTopoCifParser.TAtomprivate classTopoCifParser.TLinkA class to hold the TOPOL_LINK data item information and transform it as needed.private classTopoCifParser.TNetprivate classTopoCifParser.TNodeprivate static interfaceTopoCifParser.TPoint
-
Field Summary
Fields Modifier and Type Field Description private intac0private java.lang.StringallowedTypes(package private) intatomCount(package private) javajs.util.Lst<TopoCifParser.TAtom>atomslist of TOPOL_ATOM loop data(package private) intb0base bond index to be added to any bond bitsetsprivate intbc0private javajs.api.GenericCifDataParsercifParser(package private) static doubleERROR_TOLERANCE(package private) java.lang.Stringfailedand indictor that we should abort, and why(package private) inti0base atom index to be added to any atom bitsetsstatic intLINK_TYPE_AROMstatic intLINK_TYPE_BITSstatic intLINK_TYPE_DELOstatic intLINK_TYPE_DOUBLEstatic intLINK_TYPE_GENERIC_LINKtypes set by filter TOPOSE_TYPES in the format of one or more of {v, vw, hb} separated by "+"; default is v+hbstatic intLINK_TYPE_HBONDstatic intLINK_TYPE_OCTUPLEstatic intLINK_TYPE_OTHERstatic intLINK_TYPE_PIstatic intLINK_TYPE_POLYstatic intLINK_TYPE_QUADRUPLEstatic intLINK_TYPE_QUINTUPLEstatic intLINK_TYPE_SEPTUPLEstatic intLINK_TYPE_SEXTUPLEstatic intLINK_TYPE_SINGLEstatic intLINK_TYPE_TRIPLEstatic intLINK_TYPE_VDW(package private) intlinkCount(package private) javajs.util.Lst<TopoCifParser.TLink>linkslist of TOPOL_LINK loop datastatic java.lang.StringlinkTypes(package private) intnetCount(package private) java.lang.StringnetNotes(package private) javajs.util.Lst<TopoCifParser.TNet>netslist of TOPOL_NET loop or single data item data(package private) javajs.util.Lst<TopoCifParser.TNode>nodeslist of TOPOL_NODE loop data(package private) javajs.util.M4[]opssymmetry operations for this space group(package private) CifReaderreaderreader will be null if filter includes TOPOS_IGNORE(package private) java.lang.StringselectedNet(package private) TopoCifParser.TNetsingleNetstorage for a single net from a non-looped data itemprivate SymmetryInterfacesym(package private) javajs.util.T3temp1(package private) javajs.util.T3temp2private static bytetopol_atom_atom_labelprivate static bytetopol_atom_element_symbolprivate static bytetopol_atom_fract_xprivate static bytetopol_atom_fract_yprivate static bytetopol_atom_fract_zprivate static bytetopol_atom_idprivate static bytetopol_atom_link_idprivate static bytetopol_atom_node_idprivate static bytetopol_atom_symop_idprivate static bytetopol_atom_translationprivate static bytetopol_atom_translation_xprivate static bytetopol_atom_translation_yprivate static bytetopol_atom_translation_z(package private) static intTOPOL_GROUP(package private) static intTOPOL_LINKprivate static bytetopol_link_distanceprivate static bytetopol_link_idprivate static bytetopol_link_multiplicityprivate static bytetopol_link_net_idprivate static bytetopol_link_node_id_1private static bytetopol_link_node_id_2private static bytetopol_link_node_label_1_DEPRECATEDprivate static bytetopol_link_node_label_2_DEPRECATEDprivate static bytetopol_link_orderprivate static bytetopol_link_site_symmetry_symop_1_DEPRECATEDprivate static bytetopol_link_site_symmetry_symop_2_DEPRECATEDprivate static bytetopol_link_site_symmetry_translation_1_DEPRECATEDprivate static bytetopol_link_site_symmetry_translation_1_x_DEPRECATEDprivate static bytetopol_link_site_symmetry_translation_1_y_DEPRECATEDprivate static bytetopol_link_site_symmetry_translation_1_z_DEPRECATEDprivate static bytetopol_link_site_symmetry_translation_2_DEPRECATEDprivate static bytetopol_link_site_symmetry_translation_2_x_DEPRECATEDprivate static bytetopol_link_site_symmetry_translation_2_y_DEPRECATEDprivate static bytetopol_link_site_symmetry_translation_2_z_DEPRECATEDprivate static bytetopol_link_symop_id_1private static bytetopol_link_symop_id_2private static bytetopol_link_translation_1private static bytetopol_link_translation_1_xprivate static bytetopol_link_translation_1_yprivate static bytetopol_link_translation_1_zprivate static bytetopol_link_translation_2private static bytetopol_link_translation_2_xprivate static bytetopol_link_translation_2_yprivate static bytetopol_link_translation_2_zprivate static bytetopol_link_typeprivate static bytetopol_link_voronoi_solidangleprivate static bytetopol_net_idprivate static bytetopol_net_labelprivate static bytetopol_net_special_details(package private) static intTOPOL_NODEprivate static bytetopol_node_fract_xprivate static bytetopol_node_fract_yprivate static bytetopol_node_fract_zprivate static bytetopol_node_idprivate static bytetopol_node_labelprivate static bytetopol_node_net_idprivate static bytetopol_node_symop_idprivate static bytetopol_node_translationprivate static bytetopol_node_translation_xprivate static bytetopol_node_translation_yprivate static bytetopol_node_translation_zprivate static java.lang.String[]topolFieldsprivate static javajs.util.P3ZERO
-
Constructor Summary
Constructors Constructor Description TopoCifParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static voidapplySymmetry(Atom a, javajs.util.M4[] ops, int op, javajs.util.T3 t)Apply the symmetry and translation(package private) floatcalculateDistance(javajs.util.P3 p1, javajs.util.P3 p2)booleanfinalizeReader()PRIOR to symmetry application, process all internal symop/translation aspects.voidfinalizeSymmetry(boolean haveSymmetry)Symmetry has been applied.TopoCifParser.TNodefindNode(java.lang.String nodeID, int op, javajs.util.P3 trans)Called from TLink and TAtom to find a node with the given symmetry.(package private) TopoCifParser.TNodegetAssociatedNodeByIdx(int idx)Find the node for this TAtom.(package private) TopoCifParser.TLinkgetAssoiatedLinkByIdx(int idx)Find the link for this TAtom.AtomgetAtomFromName(java.lang.String atomLabel)(package private) static intgetBondType(java.lang.String type, int order)private java.lang.StringgetDataValue(byte key)Read the data value.private floatgetFloat(java.lang.String f)private intgetInt(java.lang.String f)(package private) static java.lang.StringgetMF(javajs.util.Lst<TopoCifParser.TAtom> tatoms)TopoCifParser.TNetgetNetByID(java.lang.String id)Find or create a net with this netID, giving it a default name "Net"+idTopoCifParser.TNetgetNetFor(java.lang.String id, java.lang.String label, boolean forceNew)Find or create a TNet for this id and label.(package private) static booleanisEqualD(javajs.util.T3 p1, javajs.util.T3 p2, double d)private intprocessAssociations(javajs.util.BS bsConnected, javajs.util.BS bsAtoms)Find and process all "bonds" associated with all links and nodes.private voidprocessAtoms()booleanprocessBlock(java.lang.String key)private voidprocessLinks()private voidprocessNets()Process all nets.private voidprocessNodes()voidProcessRecord(java.lang.String key, java.lang.String data)process _topol_node.id 1private int[]processTranslation(int p, int[] t, java.lang.String field)private voidselectNet()(package private) static voidsetElementSymbol(Atom a, java.lang.String sym)TopoCifParsersetReader(CifReader reader)filter "TOPOS_TYPES=hb" will only load hydrogen bonds; options include v, vw, and hb(package private) static voidsetTAtom(Atom a, Atom b)(package private) static javajs.util.BSshiftBits(javajs.util.BS bsAtoms, javajs.util.BS bs)Shift bits to the left to account for missing atoms in the final atom list.
-
-
-
Field Detail
-
TOPOL_LINK
static final int TOPOL_LINK
- See Also:
- Constant Field Values
-
TOPOL_GROUP
static final int TOPOL_GROUP
- See Also:
- Constant Field Values
-
TOPOL_NODE
static final int TOPOL_NODE
- See Also:
- Constant Field Values
-
LINK_TYPE_GENERIC_LINK
public static final int LINK_TYPE_GENERIC_LINK
types set by filter TOPOSE_TYPES in the format of one or more of {v, vw, hb} separated by "+"; default is v+hb- See Also:
- Constant Field Values
-
LINK_TYPE_SINGLE
public static final int LINK_TYPE_SINGLE
- See Also:
- Constant Field Values
-
LINK_TYPE_DOUBLE
public static final int LINK_TYPE_DOUBLE
- See Also:
- Constant Field Values
-
LINK_TYPE_TRIPLE
public static final int LINK_TYPE_TRIPLE
- See Also:
- Constant Field Values
-
LINK_TYPE_QUADRUPLE
public static final int LINK_TYPE_QUADRUPLE
- See Also:
- Constant Field Values
-
LINK_TYPE_QUINTUPLE
public static final int LINK_TYPE_QUINTUPLE
- See Also:
- Constant Field Values
-
LINK_TYPE_SEXTUPLE
public static final int LINK_TYPE_SEXTUPLE
- See Also:
- Constant Field Values
-
LINK_TYPE_SEPTUPLE
public static final int LINK_TYPE_SEPTUPLE
- See Also:
- Constant Field Values
-
LINK_TYPE_OCTUPLE
public static final int LINK_TYPE_OCTUPLE
- See Also:
- Constant Field Values
-
LINK_TYPE_AROM
public static final int LINK_TYPE_AROM
- See Also:
- Constant Field Values
-
LINK_TYPE_POLY
public static final int LINK_TYPE_POLY
- See Also:
- Constant Field Values
-
LINK_TYPE_DELO
public static final int LINK_TYPE_DELO
- See Also:
- Constant Field Values
-
LINK_TYPE_PI
public static final int LINK_TYPE_PI
- See Also:
- Constant Field Values
-
LINK_TYPE_HBOND
public static final int LINK_TYPE_HBOND
- See Also:
- Constant Field Values
-
LINK_TYPE_VDW
public static final int LINK_TYPE_VDW
- See Also:
- Constant Field Values
-
LINK_TYPE_OTHER
public static final int LINK_TYPE_OTHER
- See Also:
- Constant Field Values
-
linkTypes
public static java.lang.String linkTypes
-
LINK_TYPE_BITS
public static final int LINK_TYPE_BITS
- See Also:
- Constant Field Values
-
ERROR_TOLERANCE
static double ERROR_TOLERANCE
-
reader
CifReader reader
reader will be null if filter includes TOPOS_IGNORE
-
atoms
javajs.util.Lst<TopoCifParser.TAtom> atoms
list of TOPOL_ATOM loop data
-
nodes
javajs.util.Lst<TopoCifParser.TNode> nodes
list of TOPOL_NODE loop data
-
links
javajs.util.Lst<TopoCifParser.TLink> links
list of TOPOL_LINK loop data
-
nets
javajs.util.Lst<TopoCifParser.TNet> nets
list of TOPOL_NET loop or single data item data
-
singleNet
TopoCifParser.TNet singleNet
storage for a single net from a non-looped data item
-
netCount
int netCount
-
linkCount
int linkCount
-
atomCount
int atomCount
-
temp1
javajs.util.T3 temp1
-
temp2
javajs.util.T3 temp2
-
ac0
private int ac0
-
bc0
private int bc0
-
cifParser
private javajs.api.GenericCifDataParser cifParser
-
failed
java.lang.String failed
and indictor that we should abort, and why
-
ops
javajs.util.M4[] ops
symmetry operations for this space group
-
i0
int i0
base atom index to be added to any atom bitsets
-
b0
int b0
base bond index to be added to any bond bitsets
-
allowedTypes
private java.lang.String allowedTypes
-
netNotes
java.lang.String netNotes
-
sym
private SymmetryInterface sym
-
selectedNet
java.lang.String selectedNet
-
topolFields
private static final java.lang.String[] topolFields
-
topol_net_id
private static final byte topol_net_id
- See Also:
- Constant Field Values
-
topol_net_label
private static final byte topol_net_label
- See Also:
- Constant Field Values
-
topol_net_special_details
private static final byte topol_net_special_details
- See Also:
- Constant Field Values
-
topol_link_id
private static final byte topol_link_id
- See Also:
- Constant Field Values
-
topol_link_net_id
private static final byte topol_link_net_id
- See Also:
- Constant Field Values
-
topol_link_node_id_1
private static final byte topol_link_node_id_1
- See Also:
- Constant Field Values
-
topol_link_node_id_2
private static final byte topol_link_node_id_2
- See Also:
- Constant Field Values
-
topol_link_symop_id_1
private static final byte topol_link_symop_id_1
- See Also:
- Constant Field Values
-
topol_link_translation_1
private static final byte topol_link_translation_1
- See Also:
- Constant Field Values
-
topol_link_translation_1_x
private static final byte topol_link_translation_1_x
- See Also:
- Constant Field Values
-
topol_link_translation_1_y
private static final byte topol_link_translation_1_y
- See Also:
- Constant Field Values
-
topol_link_translation_1_z
private static final byte topol_link_translation_1_z
- See Also:
- Constant Field Values
-
topol_link_symop_id_2
private static final byte topol_link_symop_id_2
- See Also:
- Constant Field Values
-
topol_link_translation_2
private static final byte topol_link_translation_2
- See Also:
- Constant Field Values
-
topol_link_translation_2_x
private static final byte topol_link_translation_2_x
- See Also:
- Constant Field Values
-
topol_link_translation_2_y
private static final byte topol_link_translation_2_y
- See Also:
- Constant Field Values
-
topol_link_translation_2_z
private static final byte topol_link_translation_2_z
- See Also:
- Constant Field Values
-
topol_link_distance
private static final byte topol_link_distance
- See Also:
- Constant Field Values
-
topol_link_type
private static final byte topol_link_type
- See Also:
- Constant Field Values
-
topol_link_multiplicity
private static final byte topol_link_multiplicity
- See Also:
- Constant Field Values
-
topol_link_voronoi_solidangle
private static final byte topol_link_voronoi_solidangle
- See Also:
- Constant Field Values
-
topol_link_order
private static final byte topol_link_order
- See Also:
- Constant Field Values
-
topol_node_id
private static final byte topol_node_id
- See Also:
- Constant Field Values
-
topol_node_net_id
private static final byte topol_node_net_id
- See Also:
- Constant Field Values
-
topol_node_label
private static final byte topol_node_label
- See Also:
- Constant Field Values
-
topol_node_symop_id
private static final byte topol_node_symop_id
- See Also:
- Constant Field Values
-
topol_node_translation
private static final byte topol_node_translation
- See Also:
- Constant Field Values
-
topol_node_translation_x
private static final byte topol_node_translation_x
- See Also:
- Constant Field Values
-
topol_node_translation_y
private static final byte topol_node_translation_y
- See Also:
- Constant Field Values
-
topol_node_translation_z
private static final byte topol_node_translation_z
- See Also:
- Constant Field Values
-
topol_node_fract_x
private static final byte topol_node_fract_x
- See Also:
- Constant Field Values
-
topol_node_fract_y
private static final byte topol_node_fract_y
- See Also:
- Constant Field Values
-
topol_node_fract_z
private static final byte topol_node_fract_z
- See Also:
- Constant Field Values
-
topol_atom_id
private static final byte topol_atom_id
- See Also:
- Constant Field Values
-
topol_atom_atom_label
private static final byte topol_atom_atom_label
- See Also:
- Constant Field Values
-
topol_atom_node_id
private static final byte topol_atom_node_id
- See Also:
- Constant Field Values
-
topol_atom_link_id
private static final byte topol_atom_link_id
- See Also:
- Constant Field Values
-
topol_atom_symop_id
private static final byte topol_atom_symop_id
- See Also:
- Constant Field Values
-
topol_atom_translation
private static final byte topol_atom_translation
- See Also:
- Constant Field Values
-
topol_atom_translation_x
private static final byte topol_atom_translation_x
- See Also:
- Constant Field Values
-
topol_atom_translation_y
private static final byte topol_atom_translation_y
- See Also:
- Constant Field Values
-
topol_atom_translation_z
private static final byte topol_atom_translation_z
- See Also:
- Constant Field Values
-
topol_atom_fract_x
private static final byte topol_atom_fract_x
- See Also:
- Constant Field Values
-
topol_atom_fract_y
private static final byte topol_atom_fract_y
- See Also:
- Constant Field Values
-
topol_atom_fract_z
private static final byte topol_atom_fract_z
- See Also:
- Constant Field Values
-
topol_atom_element_symbol
private static final byte topol_atom_element_symbol
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_symop_1_DEPRECATED
private static final byte topol_link_site_symmetry_symop_1_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_translation_1_x_DEPRECATED
private static final byte topol_link_site_symmetry_translation_1_x_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_translation_1_y_DEPRECATED
private static final byte topol_link_site_symmetry_translation_1_y_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_translation_1_z_DEPRECATED
private static final byte topol_link_site_symmetry_translation_1_z_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_symop_2_DEPRECATED
private static final byte topol_link_site_symmetry_symop_2_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_translation_2_x_DEPRECATED
private static final byte topol_link_site_symmetry_translation_2_x_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_translation_2_y_DEPRECATED
private static final byte topol_link_site_symmetry_translation_2_y_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_translation_2_z_DEPRECATED
private static final byte topol_link_site_symmetry_translation_2_z_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_translation_1_DEPRECATED
private static final byte topol_link_site_symmetry_translation_1_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_site_symmetry_translation_2_DEPRECATED
private static final byte topol_link_site_symmetry_translation_2_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_node_label_1_DEPRECATED
private static final byte topol_link_node_label_1_DEPRECATED
- See Also:
- Constant Field Values
-
topol_link_node_label_2_DEPRECATED
private static final byte topol_link_node_label_2_DEPRECATED
- See Also:
- Constant Field Values
-
ZERO
private static final javajs.util.P3 ZERO
-
-
Method Detail
-
getBondType
static int getBondType(java.lang.String type, int order)
-
setReader
public TopoCifParser setReader(CifReader reader)
filter "TOPOS_TYPES=hb" will only load hydrogen bonds; options include v, vw, and hb- Specified by:
setReaderin interfaceCifReader.Parser
-
ProcessRecord
public void ProcessRecord(java.lang.String key, java.lang.String data) throws java.lang.Exceptionprocess _topol_node.id 1- Specified by:
ProcessRecordin interfaceCifReader.Parser- Throws:
java.lang.Exception
-
processBlock
public boolean processBlock(java.lang.String key) throws java.lang.Exception- Specified by:
processBlockin interfaceCifReader.Parser- Throws:
java.lang.Exception
-
processNets
private void processNets() throws java.lang.ExceptionProcess all nets. Note that the nets list is self-populating with a "Net1" value if there is no TOPOL_NET section.- Throws:
java.lang.Exception
-
processLinks
private void processLinks() throws java.lang.Exception- Throws:
java.lang.Exception
-
processNodes
private void processNodes() throws java.lang.Exception- Throws:
java.lang.Exception
-
processAtoms
private void processAtoms() throws java.lang.Exception- Throws:
java.lang.Exception
-
processTranslation
private int[] processTranslation(int p, int[] t, java.lang.String field)
-
finalizeReader
public boolean finalizeReader() throws java.lang.ExceptionPRIOR to symmetry application, process all internal symop/translation aspects.- Specified by:
finalizeReaderin interfaceCifReader.Parser- Throws:
java.lang.Exception
-
selectNet
private void selectNet()
-
finalizeSymmetry
public void finalizeSymmetry(boolean haveSymmetry) throws java.lang.ExceptionSymmetry has been applied. Identify all of the connected atoms and process the group associations- Specified by:
finalizeSymmetryin interfaceCifReader.Parser- Throws:
java.lang.Exception
-
shiftBits
static javajs.util.BS shiftBits(javajs.util.BS bsAtoms, javajs.util.BS bs)Shift bits to the left to account for missing atoms in the final atom list.- Parameters:
bsAtoms-bs-- Returns:
- shifted bitset
-
processAssociations
private int processAssociations(javajs.util.BS bsConnected, javajs.util.BS bsAtoms)Find and process all "bonds" associated with all links and nodes. This method runs AFTER generation of all the symmetry-related atoms. BOND_LINK + index indicates linked nodes BOND_GROUP + index indicates associated nodes- Parameters:
bsConnected- prevent Jmol from adding bonds to this atombsAtoms- allow Jmol to add bonds to these atoms, inclusively- Returns:
- number of bonds created
-
isEqualD
static boolean isEqualD(javajs.util.T3 p1, javajs.util.T3 p2, double d)
-
getDataValue
private java.lang.String getDataValue(byte key)
Read the data value.- Parameters:
key-- Returns:
- the value or null if does not exist or is '.' or '?'
-
getInt
private int getInt(java.lang.String f)
-
getFloat
private float getFloat(java.lang.String f)
-
getMF
static java.lang.String getMF(javajs.util.Lst<TopoCifParser.TAtom> tatoms)
-
setElementSymbol
static void setElementSymbol(Atom a, java.lang.String sym)
- Parameters:
a- TNode or TAtomsym-
-
applySymmetry
static void applySymmetry(Atom a, javajs.util.M4[] ops, int op, javajs.util.T3 t)
Apply the symmetry and translation- Parameters:
a- TNode or TAtomops-op-t-
-
getNetByID
public TopoCifParser.TNet getNetByID(java.lang.String id)
Find or create a net with this netID, giving it a default name "Net"+id- Parameters:
id-- Returns:
- net, never null
-
getAtomFromName
public Atom getAtomFromName(java.lang.String atomLabel)
-
calculateDistance
float calculateDistance(javajs.util.P3 p1, javajs.util.P3 p2)
-
getNetFor
public TopoCifParser.TNet getNetFor(java.lang.String id, java.lang.String label, boolean forceNew)
Find or create a TNet for this id and label.- Parameters:
id- or nulllabel- or nullforceNew- true to create a new net- Returns:
- a net, or null if not forceNew and not found
-
getAssociatedNodeByIdx
TopoCifParser.TNode getAssociatedNodeByIdx(int idx)
Find the node for this TAtom.- Parameters:
idx-- Returns:
- the node or null
-
getAssoiatedLinkByIdx
TopoCifParser.TLink getAssoiatedLinkByIdx(int idx)
Find the link for this TAtom.- Parameters:
idx-- Returns:
- the link or null
-
findNode
public TopoCifParser.TNode findNode(java.lang.String nodeID, int op, javajs.util.P3 trans)
Called from TLink and TAtom to find a node with the given symmetry.- Parameters:
nodeID-op- match for linkSymoptrans- match for linkTrans- Returns:
- the node, or null if no such node was found
-
-