Class TopoCifParser

java.lang.Object
org.jmol.adapter.readers.cif.TopoCifParser
All Implemented Interfaces:
CifReader.Parser

public class TopoCifParser extends 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 Details

    • TOPOL_GROUP

      static final int TOPOL_GROUP
      See Also:
    • TOPOL_NODE

      static final int TOPOL_NODE
      See Also:
    • linkTypes

      public static String linkTypes
    • 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
    • nets

      javajs.util.Lst<TopoCifParser.TNet> nets
      list of TOPOL_NET loop or single data item data
    • 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

      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 String allowedTypes
    • netNotes

      String netNotes
    • sym

      private SymmetryInterface sym
    • selectedNet

      String selectedNet
    • topolFields

      private static final String[] topolFields
    • topol_net_id

      private static final byte topol_net_id
      See Also:
    • topol_net_label

      private static final byte topol_net_label
      See Also:
    • topol_net_special_details

      private static final byte topol_net_special_details
      See Also:
    • topol_node_id

      private static final byte topol_node_id
      See Also:
    • topol_node_net_id

      private static final byte topol_node_net_id
      See Also:
    • topol_node_label

      private static final byte topol_node_label
      See Also:
    • topol_node_symop_id

      private static final byte topol_node_symop_id
      See Also:
    • topol_node_translation

      private static final byte topol_node_translation
      See Also:
    • topol_node_translation_x

      private static final byte topol_node_translation_x
      See Also:
    • topol_node_translation_y

      private static final byte topol_node_translation_y
      See Also:
    • topol_node_translation_z

      private static final byte topol_node_translation_z
      See Also:
    • topol_node_fract_x

      private static final byte topol_node_fract_x
      See Also:
    • topol_node_fract_y

      private static final byte topol_node_fract_y
      See Also:
    • topol_node_fract_z

      private static final byte topol_node_fract_z
      See Also:
    • topol_atom_id

      private static final byte topol_atom_id
      See Also:
    • topol_atom_atom_label

      private static final byte topol_atom_atom_label
      See Also:
    • topol_atom_node_id

      private static final byte topol_atom_node_id
      See Also:
    • topol_atom_symop_id

      private static final byte topol_atom_symop_id
      See Also:
    • topol_atom_translation

      private static final byte topol_atom_translation
      See Also:
    • topol_atom_translation_x

      private static final byte topol_atom_translation_x
      See Also:
    • topol_atom_translation_y

      private static final byte topol_atom_translation_y
      See Also:
    • topol_atom_translation_z

      private static final byte topol_atom_translation_z
      See Also:
    • topol_atom_fract_x

      private static final byte topol_atom_fract_x
      See Also:
    • topol_atom_fract_y

      private static final byte topol_atom_fract_y
      See Also:
    • topol_atom_fract_z

      private static final byte topol_atom_fract_z
      See Also:
    • topol_atom_element_symbol

      private static final byte topol_atom_element_symbol
      See Also:
    • ZERO

      static final javajs.util.P3 ZERO
  • Constructor Details

    • TopoCifParser

      public TopoCifParser()
  • Method Details

    • getBondType

      static int getBondType(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:
      setReader in interface CifReader.Parser
    • ProcessRecord

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

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

      private void processNets() throws Exception
      Process all nets. Note that the nets list is self-populating with a "Net1" value if there is no TOPOL_NET section.
      Throws:
      Exception
    • processLinks

      private void processLinks() throws Exception
      Throws:
      Exception
    • processNodes

      private void processNodes() throws Exception
      Throws:
      Exception
    • processAtoms

      private void processAtoms() throws Exception
      Throws:
      Exception
    • processTranslation

      private int[] processTranslation(int p, int[] t, String field)
    • finalizeReader

      public boolean finalizeReader() throws Exception
      PRIOR to symmetry application, process all internal symop/translation aspects.
      Specified by:
      finalizeReader in interface CifReader.Parser
      Throws:
      Exception
    • selectNet

      private void selectNet()
    • finalizeSymmetry

      public void finalizeSymmetry(boolean haveSymmetry) throws Exception
      Symmetry has been applied. Identify all of the connected atoms and process the group associations
      Specified by:
      finalizeSymmetry in interface CifReader.Parser
      Throws:
      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 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(String f)
    • getFloat

      private float getFloat(String f)
    • getMF

      static String getMF(javajs.util.Lst<TopoCifParser.TAtom> tatoms)
    • setTAtom

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

      static void setElementSymbol(Atom a, 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(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(String atomLabel)
    • calculateDistance

      float calculateDistance(javajs.util.P3 p1, javajs.util.P3 p2)
    • getNetFor

      public TopoCifParser.TNet getNetFor(String id, 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(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