Package org.jmol.adapter.readers.cif
Class TopoCifParser
java.lang.Object
org.jmol.adapter.readers.cif.TopoCifParser
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescriptionprivate class
private class
A class to hold the TOPOL_LINK data item information and transform it as needed.private class
private class
private static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private String
(package private) int
(package private) javajs.util.Lst<TopoCifParser.TAtom>
list of TOPOL_ATOM loop data(package private) int
base bond index to be added to any bond bitsetsprivate int
private javajs.api.GenericCifDataParser
(package private) static double
(package private) String
and indictor that we should abort, and why(package private) int
base atom index to be added to any atom bitsetsstatic final int
static final int
static final int
static final int
static final int
types set by filter TOPOSE_TYPES in the format of one or more of {v, vw, hb} separated by "+"; default is v+hbstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
(package private) int
(package private) javajs.util.Lst<TopoCifParser.TLink>
list of TOPOL_LINK loop datastatic String
(package private) int
(package private) String
(package private) javajs.util.Lst<TopoCifParser.TNet>
list of TOPOL_NET loop or single data item data(package private) javajs.util.Lst<TopoCifParser.TNode>
list of TOPOL_NODE loop data(package private) javajs.util.M4[]
symmetry operations for this space group(package private) CifReader
reader will be null if filter includes TOPOS_IGNORE(package private) String
(package private) TopoCifParser.TNet
storage for a single net from a non-looped data itemprivate SymmetryInterface
(package private) javajs.util.T3
(package private) javajs.util.T3
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
(package private) static final int
(package private) static final int
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
(package private) static final int
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final String[]
(package private) static final javajs.util.P3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
applySymmetry
(Atom a, javajs.util.M4[] ops, int op, javajs.util.T3 t) Apply the symmetry and translation(package private) float
calculateDistance
(javajs.util.P3 p1, javajs.util.P3 p2) boolean
PRIOR to symmetry application, process all internal symop/translation aspects.void
finalizeSymmetry
(boolean haveSymmetry) Symmetry has been applied.Called from TLink and TAtom to find a node with the given symmetry.(package private) TopoCifParser.TNode
getAssociatedNodeByIdx
(int idx) Find the node for this TAtom.(package private) TopoCifParser.TLink
getAssoiatedLinkByIdx
(int idx) Find the link for this TAtom.getAtomFromName
(String atomLabel) (package private) static int
getBondType
(String type, int order) private String
getDataValue
(byte key) Read the data value.private float
private int
(package private) static String
getMF
(javajs.util.Lst<TopoCifParser.TAtom> tatoms) getNetByID
(String id) Find or create a net with this netID, giving it a default name "Net"+idFind or create a TNet for this id and label.(package private) static boolean
isEqualD
(javajs.util.T3 p1, javajs.util.T3 p2, double d) private int
processAssociations
(javajs.util.BS bsConnected, javajs.util.BS bsAtoms) Find and process all "bonds" associated with all links and nodes.private void
boolean
processBlock
(String key) private void
private void
Process all nets.private void
void
ProcessRecord
(String key, String data) process _topol_node.id 1private int[]
processTranslation
(int p, int[] t, String field) private void
(package private) static void
setElementSymbol
(Atom a, String sym) filter "TOPOS_TYPES=hb" will only load hydrogen bonds; options include v, vw, and hb(package private) static void
(package private) 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.
-
Field Details
-
TOPOL_LINK
static final int TOPOL_LINK- See Also:
-
TOPOL_GROUP
static final int TOPOL_GROUP- See Also:
-
TOPOL_NODE
static final int TOPOL_NODE- See Also:
-
LINK_TYPE_GENERIC_LINK
public static final int LINK_TYPE_GENERIC_LINKtypes set by filter TOPOSE_TYPES in the format of one or more of {v, vw, hb} separated by "+"; default is v+hb- See Also:
-
LINK_TYPE_SINGLE
public static final int LINK_TYPE_SINGLE- See Also:
-
LINK_TYPE_DOUBLE
public static final int LINK_TYPE_DOUBLE- See Also:
-
LINK_TYPE_TRIPLE
public static final int LINK_TYPE_TRIPLE- See Also:
-
LINK_TYPE_QUADRUPLE
public static final int LINK_TYPE_QUADRUPLE- See Also:
-
LINK_TYPE_QUINTUPLE
public static final int LINK_TYPE_QUINTUPLE- See Also:
-
LINK_TYPE_SEXTUPLE
public static final int LINK_TYPE_SEXTUPLE- See Also:
-
LINK_TYPE_SEPTUPLE
public static final int LINK_TYPE_SEPTUPLE- See Also:
-
LINK_TYPE_OCTUPLE
public static final int LINK_TYPE_OCTUPLE- See Also:
-
LINK_TYPE_AROM
public static final int LINK_TYPE_AROM- See Also:
-
LINK_TYPE_POLY
public static final int LINK_TYPE_POLY- See Also:
-
LINK_TYPE_DELO
public static final int LINK_TYPE_DELO- See Also:
-
LINK_TYPE_PI
public static final int LINK_TYPE_PI- See Also:
-
LINK_TYPE_HBOND
public static final int LINK_TYPE_HBOND- See Also:
-
LINK_TYPE_VDW
public static final int LINK_TYPE_VDW- See Also:
-
LINK_TYPE_OTHER
public static final int LINK_TYPE_OTHER- See Also:
-
linkTypes
-
LINK_TYPE_BITS
public static final int LINK_TYPE_BITS- See Also:
-
ERROR_TOLERANCE
static double ERROR_TOLERANCE -
reader
CifReader readerreader will be null if filter includes TOPOS_IGNORE -
atoms
javajs.util.Lst<TopoCifParser.TAtom> atomslist of TOPOL_ATOM loop data -
nodes
javajs.util.Lst<TopoCifParser.TNode> nodeslist of TOPOL_NODE loop data -
links
javajs.util.Lst<TopoCifParser.TLink> linkslist of TOPOL_LINK loop data -
nets
javajs.util.Lst<TopoCifParser.TNet> netslist of TOPOL_NET loop or single data item data -
singleNet
TopoCifParser.TNet singleNetstorage 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 failedand indictor that we should abort, and why -
ops
javajs.util.M4[] opssymmetry operations for this space group -
i0
int i0base atom index to be added to any atom bitsets -
b0
int b0base bond index to be added to any bond bitsets -
allowedTypes
-
netNotes
String netNotes -
sym
-
selectedNet
String selectedNet -
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_link_id
private static final byte topol_link_id- See Also:
-
topol_link_net_id
private static final byte topol_link_net_id- See Also:
-
topol_link_node_id_1
private static final byte topol_link_node_id_1- See Also:
-
topol_link_node_id_2
private static final byte topol_link_node_id_2- See Also:
-
topol_link_symop_id_1
private static final byte topol_link_symop_id_1- See Also:
-
topol_link_translation_1
private static final byte topol_link_translation_1- See Also:
-
topol_link_translation_1_x
private static final byte topol_link_translation_1_x- See Also:
-
topol_link_translation_1_y
private static final byte topol_link_translation_1_y- See Also:
-
topol_link_translation_1_z
private static final byte topol_link_translation_1_z- See Also:
-
topol_link_symop_id_2
private static final byte topol_link_symop_id_2- See Also:
-
topol_link_translation_2
private static final byte topol_link_translation_2- See Also:
-
topol_link_translation_2_x
private static final byte topol_link_translation_2_x- See Also:
-
topol_link_translation_2_y
private static final byte topol_link_translation_2_y- See Also:
-
topol_link_translation_2_z
private static final byte topol_link_translation_2_z- See Also:
-
topol_link_distance
private static final byte topol_link_distance- See Also:
-
topol_link_type
private static final byte topol_link_type- See Also:
-
topol_link_multiplicity
private static final byte topol_link_multiplicity- See Also:
-
topol_link_voronoi_solidangle
private static final byte topol_link_voronoi_solidangle- See Also:
-
topol_link_order
private static final byte topol_link_order- 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_link_id
private static final byte topol_atom_link_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:
-
topol_link_site_symmetry_symop_1_DEPRECATED
private static final byte topol_link_site_symmetry_symop_1_DEPRECATED- See Also:
-
topol_link_site_symmetry_translation_1_x_DEPRECATED
private static final byte topol_link_site_symmetry_translation_1_x_DEPRECATED- See Also:
-
topol_link_site_symmetry_translation_1_y_DEPRECATED
private static final byte topol_link_site_symmetry_translation_1_y_DEPRECATED- See Also:
-
topol_link_site_symmetry_translation_1_z_DEPRECATED
private static final byte topol_link_site_symmetry_translation_1_z_DEPRECATED- See Also:
-
topol_link_site_symmetry_symop_2_DEPRECATED
private static final byte topol_link_site_symmetry_symop_2_DEPRECATED- See Also:
-
topol_link_site_symmetry_translation_2_x_DEPRECATED
private static final byte topol_link_site_symmetry_translation_2_x_DEPRECATED- See Also:
-
topol_link_site_symmetry_translation_2_y_DEPRECATED
private static final byte topol_link_site_symmetry_translation_2_y_DEPRECATED- See Also:
-
topol_link_site_symmetry_translation_2_z_DEPRECATED
private static final byte topol_link_site_symmetry_translation_2_z_DEPRECATED- See Also:
-
topol_link_site_symmetry_translation_1_DEPRECATED
private static final byte topol_link_site_symmetry_translation_1_DEPRECATED- See Also:
-
topol_link_site_symmetry_translation_2_DEPRECATED
private static final byte topol_link_site_symmetry_translation_2_DEPRECATED- See Also:
-
topol_link_node_label_1_DEPRECATED
private static final byte topol_link_node_label_1_DEPRECATED- See Also:
-
topol_link_node_label_2_DEPRECATED
private static final byte topol_link_node_label_2_DEPRECATED- See Also:
-
ZERO
static final javajs.util.P3 ZERO
-
-
Constructor Details
-
TopoCifParser
public TopoCifParser()
-
-
Method Details
-
getBondType
-
setReader
filter "TOPOS_TYPES=hb" will only load hydrogen bonds; options include v, vw, and hb- Specified by:
setReader
in interfaceCifReader.Parser
-
ProcessRecord
process _topol_node.id 1- Specified by:
ProcessRecord
in interfaceCifReader.Parser
- Throws:
Exception
-
processBlock
- Specified by:
processBlock
in interfaceCifReader.Parser
- Throws:
Exception
-
processNets
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
- Throws:
Exception
-
processNodes
- Throws:
Exception
-
processAtoms
- Throws:
Exception
-
processTranslation
-
finalizeReader
PRIOR to symmetry application, process all internal symop/translation aspects.- Specified by:
finalizeReader
in interfaceCifReader.Parser
- Throws:
Exception
-
selectNet
private void selectNet() -
finalizeSymmetry
Symmetry has been applied. Identify all of the connected atoms and process the group associations- Specified by:
finalizeSymmetry
in interfaceCifReader.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 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
Read the data value.- Parameters:
key
-- Returns:
- the value or null if does not exist or is '.' or '?'
-
getInt
-
getFloat
-
getMF
-
setTAtom
-
setElementSymbol
- Parameters:
a
- TNode or TAtomsym
-
-
applySymmetry
Apply the symmetry and translation- Parameters:
a
- TNode or TAtomops
-op
-t
-
-
getNetByID
Find or create a net with this netID, giving it a default name "Net"+id- Parameters:
id
-- Returns:
- net, never null
-
getAtomFromName
-
calculateDistance
float calculateDistance(javajs.util.P3 p1, javajs.util.P3 p2) -
getNetFor
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
Find the node for this TAtom.- Parameters:
idx
-- Returns:
- the node or null
-
getAssoiatedLinkByIdx
Find the link for this TAtom.- Parameters:
idx
-- Returns:
- the link or null
-
findNode
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
-