Class 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
    • Field Detail

      • 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
      • linkTypes

        public static java.lang.String linkTypes
      • ERROR_TOLERANCE

        static double ERROR_TOLERANCE
      • reader

        CifReader reader
        reader will be null if filter includes TOPOS_IGNORE
      • 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
      • selectedNet

        java.lang.String selectedNet
      • topolFields

        private static final java.lang.String[] topolFields
      • topol_net_special_details

        private static final byte topol_net_special_details
        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_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_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_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_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_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
    • Constructor Detail

      • TopoCifParser

        public TopoCifParser()
    • Method Detail

      • getBondType

        static int getBondType​(java.lang.String type,
                               int order)
      • ProcessRecord

        public void ProcessRecord​(java.lang.String key,
                                  java.lang.String data)
                           throws java.lang.Exception
        process _topol_node.id 1
        Specified by:
        ProcessRecord in interface CifReader.Parser
        Throws:
        java.lang.Exception
      • processBlock

        public boolean processBlock​(java.lang.String key)
                             throws java.lang.Exception
        Specified by:
        processBlock in interface CifReader.Parser
        Throws:
        java.lang.Exception
      • processNets

        private void processNets()
                          throws java.lang.Exception
        Process 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.Exception
        PRIOR to symmetry application, process all internal symop/translation aspects.
        Specified by:
        finalizeReader in interface CifReader.Parser
        Throws:
        java.lang.Exception
      • selectNet

        private void selectNet()
      • finalizeSymmetry

        public void finalizeSymmetry​(boolean haveSymmetry)
                              throws java.lang.Exception
        Symmetry has been applied. Identify all of the connected atoms and process the group associations
        Specified by:
        finalizeSymmetry in interface CifReader.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 atom
        bsAtoms - 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)
      • setTAtom

        static void setTAtom​(Atom a,
                             Atom b)
      • setElementSymbol

        static void setElementSymbol​(Atom a,
                                     java.lang.String sym)
        Parameters:
        a - TNode or TAtom
        sym -
      • 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 TAtom
        ops -
        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 null
        label - or null
        forceNew - 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 linkSymop
        trans - match for linkTrans
        Returns:
        the node, or null if no such node was found