besmarts.core.assignments module¶
besmarts.core.assignments
Associates BESMARTS structures to data
There are two intepretations of the data. The first simpler model is the the graph_assignments, which contain (ic, data) pairs. The data is assumed to be a list of lists of independent samples, i.e. multiple conformers. This distinction means a “system” where there are two molecules interacting requires a list of graph assignments. These assignments are quite flexible and agnostic of the data. An additional layer is required to interpret data, which is provided, at least partially, to graph_db objects.
In constrast to the simple assignment objectives, the more complex graph_db system is explicitly designed to handle large systems with redundant graph information, e.g. a box of water where point triples use the same graph, and each triple exists in the same system and should be overlapping. See the documentation for graph_db for more information.
In general, most of the work is performed on assignments, and graph_db objects are designed to be a management system for the various types of data assigned to graphs, such as positions, gradients, and Hessians.
- class besmarts.core.assignments.angle_assignment_float(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.angle_assignment_float_matrix(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.angle_assignment_str(selections)[source]¶
Bases:
structure_assignment_str- selections¶
- topology¶
- class besmarts.core.assignments.atom_assignment_float(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.atom_assignment_str(selections)[source]¶
Bases:
structure_assignment_str- selections¶
- topology¶
- besmarts.core.assignments.b2matrix(pos, bonds=True, angles=True, torsions=True, outofplanes=True, pairs=True, remove1_3=False, linear_torsions=145.0)[source]¶
- besmarts.core.assignments.bmatrix(pos, bonds=True, angles=True, torsions=True, outofplanes=True, pairs=True, remove1_3=False, linear_torsions=145.0)[source]¶
- class besmarts.core.assignments.bond_assignment_float(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.bond_assignment_float_matrix(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.bond_assignment_str(selections)[source]¶
Bases:
structure_assignment_str- selections¶
- topology¶
- class besmarts.core.assignments.graph_assignment(smiles, assignments, graph)[source]¶
Bases:
smiles_assignmentAssign a subgraph selection some value.
- selections: Dict[Sequence[int], Any]¶
- smiles: str¶
- besmarts.core.assignments.graph_assignment_copy(ga: graph_assignment) graph_assignment[source]¶
- class besmarts.core.assignments.graph_assignment_float(graph, selections)[source]¶
Bases:
smiles_assignment- graph: str¶
- selections: Dict[Sequence[int], List[float]]¶
- class besmarts.core.assignments.graph_assignment_float_matrix(graphs, selections)[source]¶
Bases:
smiles_assignment- selections: Dict[Sequence[int], List[float]]¶
- besmarts.core.assignments.graph_assignment_geometry_angle_matrix(pos: List[graph_assignment_float], indices=None) angle_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_geometry_angles(pos: graph_assignment_float, indices=None) angle_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_geometry_bond_matrix(pos: List[graph_assignment_float], indices=None) bond_assignment_float_matrix[source]¶
- besmarts.core.assignments.graph_assignment_geometry_bonds(pos: graph_assignment_float, indices=None) bond_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_geometry_outofplane_matrix(pos: List[graph_assignment_float], indices=None) outofplane_assignment_float_matrix[source]¶
- besmarts.core.assignments.graph_assignment_geometry_outofplanes(pos: graph_assignment_float, indices=None) outofplane_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_geometry_pair_matrix(pos: List[graph_assignment_float], indices=None) bond_assignment_float_matrix[source]¶
- besmarts.core.assignments.graph_assignment_geometry_pairs(pos: graph_assignment_float, indices=None) bond_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_geometry_torsion_matrix(pos: List[graph_assignment_float], indices=None) torsion_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_geometry_torsions(pos: graph_assignment_float, indices=None) torsion_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_angle_matrix(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_angles(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_bond_matrix(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_bonds(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_outofplane_matrix(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_outofplanes(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_pair_matrix(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_pairs(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_torsion_matrix(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian2_torsions(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_angle_matrix(pos: List[smiles_assignment_float], indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_angles(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_bond_matrix(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_bonds(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_distance_matrix(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_distances(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_outofplane_matrix(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_outofplanes(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_pair_matrix(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_pairs(pos, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_torsion_matrix(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_jacobian_torsions(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.graph_assignment_to_format_xyz(pos: graph_assignment, comment='') List[str][source]¶
- besmarts.core.assignments.graph_assignment_to_graph_db_row(ga) graph_db_row[source]¶
- class besmarts.core.assignments.graph_db[source]¶
Bases:
objectHolds a heterogeneous set of data associated to graphs
Here is the layout of a graph_db. Defined here are the smiles, graphs, and selections which are indexed by a graph id (gid). The entries use a different id (eid) which points to a graph_db_table object. This object holds several tables indexed by a table id (tid), which are similar to types of data. Examples of tables are positions and Hessians. Each table points to graphs, which use the same gid as those in the graphs member here. Each graph then points to “rows” indexed by rid, which are analogous to individual systems/snapshots/frames. Each row can points to “columns” indexed by cid, which are analogous to conformations in the same system. Finally, each cid points to selection id (sid) and data id pairs (xid). The (sid, xid) pairs are similar to a graph assignment, except in this case the data is always a flat array and xid is the index in that array.
The structures have a corresponding member to traverse deeper; however, the simple array notation is supported. This means that rather than
gdb.entries[eid].tables[tid].graphs[gid].rows[rid].columns[cid].selections[sid].data[xid]
one can simply write
gdb[eid][tid][gid][rid][cid][sid][xid] -> float
TODO: most of the development has been on single molecules in gas phase. As such, some functions assume this and may not handle multigraph, multi conformation data gracefully.
- entries: Dict[int, graph_db_entry]¶
- selections: Dict[int, graph_db_selection]¶
- smiles: Dict[int, str]¶
- besmarts.core.assignments.graph_db_add_multi_molecule(gdb: graph_db, gde: graph_db_entry, positions: List[graph_assignment], gradients: List[graph_assignment] = None, hessian: List[graph_assignment] = None, energy: List[float] = None)[source]¶
- besmarts.core.assignments.graph_db_add_single_molecule_list(gdb: graph_db, positions: List[graph_assignment], gradients: List[graph_assignment] = None, hessian: List[graph_assignment] = None, energy: List[float] = None)[source]¶
- besmarts.core.assignments.graph_db_add_single_molecule_state(gdb: graph_db, positions: graph_assignment, gradients: graph_assignment = None, hessian: graph_assignment = None, energy: float = None, tables=None) Tuple[int, int][source]¶
A simple function to add a SMILES and positions to a gdb dataset
Assumes multiple confs are in the same state (columns)
Call this again for different systems
- class besmarts.core.assignments.graph_db_address(*, eid=None, tid=None, gid=None, rid=None, cid=None, sid=None, xid=None)[source]¶
Bases:
objectA query for information in a graph_db.
- class besmarts.core.assignments.graph_db_entry[source]¶
Bases:
objectData associated with a set of graphs
- tables: Dict[int, graph_db_table]¶
- besmarts.core.assignments.graph_db_get(GDB: graph_db, addr: graph_db_address) graph_db[source]¶
- class besmarts.core.assignments.graph_db_graph[source]¶
Bases:
object- rows: Dict[int, graph_db_row]¶
- besmarts.core.assignments.graph_db_graph_to_graph_assignment(gdb, eid, tid, gid=None, rid=None, cid=None) graph_assignment[source]¶
- class besmarts.core.assignments.graph_db_row[source]¶
Bases:
object- columns: Dict[int, graph_db_column]¶
- class besmarts.core.assignments.graph_db_selection[source]¶
Bases:
object- coords: Dict[int, Sequence[int]]¶
- class besmarts.core.assignments.graph_db_table(top)[source]¶
Bases:
objectHolds the data for a db of graphs that all share the same topology.
- graphs: Dict[int, graph_db_graph]¶
- topology: structure_topology¶
- values¶
- class besmarts.core.assignments.outofplane_assignment_float(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.outofplane_assignment_float_matrix(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.outofplane_assignment_str(selections)[source]¶
Bases:
structure_assignment_str- selections¶
- topology¶
- class besmarts.core.assignments.pair_assignment_float(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.pair_assignment_float_matrix(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- besmarts.core.assignments.parse_xyz(xyzdata: str) Tuple[List[str], List[List[Tuple[float, float, float]]]][source]¶
- class besmarts.core.assignments.smarts_assignment_float[source]¶
Bases:
smarts_assignment- selections¶
- smarts¶
- class besmarts.core.assignments.smarts_assignment_str[source]¶
Bases:
smarts_assignment- selections¶
- smarts¶
- class besmarts.core.assignments.smarts_hierarchy_assignment[source]¶
Bases:
object- assign(shier: smarts_hierarchy, gcd: graph_codec, smi: List[str], selections) smiles_assignment_group[source]¶
- assign_angles(shier: smarts_hierarchy, gcd: graph_codec, smi: List[str]) smiles_assignment_group[source]¶
- assign_atoms(shier: smarts_hierarchy, gcd: graph_codec, smi: List[str]) smiles_assignment_group[source]¶
- assign_bonds(shier: smarts_hierarchy, gcd: graph_codec, smi: List[str]) smiles_assignment_group[source]¶
- assign_outofplanes(shier: smarts_hierarchy, gcd: graph_codec, smi: List[str]) smiles_assignment_group[source]¶
- assign_torsions(shier: smarts_hierarchy, gcd: graph_codec, smi: List[str]) smiles_assignment_group[source]¶
- class besmarts.core.assignments.smiles_assignment(smiles, selections)[source]¶
Bases:
object- selections¶
- smiles¶
- besmarts.core.assignments.smiles_assignment_copy(sa: smiles_assignment) smiles_assignment[source]¶
- class besmarts.core.assignments.smiles_assignment_float(smiles, selections)[source]¶
Bases:
smiles_assignment- selections: Dict[Sequence[int], List[float]]¶
- smiles: str¶
- besmarts.core.assignments.smiles_assignment_geometry_angle_matrix(pos: List[smiles_assignment_float], indices) angle_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_angles(pos: smiles_assignment_float, indices) angle_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_distance_matrix(pos: smiles_assignment_float, indices) bond_assignment_float_matrix[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_distances(pos: smiles_assignment_float, indices) bond_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_outofplane_matrix(pos: List[smiles_assignment_float], indices=None) smiles_assignment[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_outofplanes(pos: smiles_assignment_float, indices=None) smiles_assignment[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_torsion_matrix(pos: List[smiles_assignment_float], indices=None) torsion_assignment_float_matrix[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_torsion_matrix_nonlinear(pos: List[smiles_assignment_float], indices=None, angle_degrees=145.0) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_torsions(pos: smiles_assignment_float, indices=None) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_geometry_torsions_nonlinear(pos: smiles_assignment_float, indices=None, angle_degrees=145.0) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_group_angles(assignments: List[smiles_assignment])[source]¶
- besmarts.core.assignments.smiles_assignment_group_atoms(assignments: List[smiles_assignment])[source]¶
- besmarts.core.assignments.smiles_assignment_group_bonds(assignments: List[smiles_assignment])[source]¶
- besmarts.core.assignments.smiles_assignment_group_concatenate(A: smiles_assignment_group, B: smiles_assignment_group)[source]¶
- besmarts.core.assignments.smiles_assignment_group_copy(sag: smiles_assignment_group) smiles_assignment_group[source]¶
- besmarts.core.assignments.smiles_assignment_group_outofplanes(assignments: List[smiles_assignment])[source]¶
- besmarts.core.assignments.smiles_assignment_group_pairs(assignments: List[smiles_assignment])[source]¶
- besmarts.core.assignments.smiles_assignment_group_to_graph_db_entry(sag, aid, gcd) graph_db_entry[source]¶
- besmarts.core.assignments.smiles_assignment_group_to_structure_assignment_group(smag: smiles_assignment_group, gcd: graph_codec) structure_assignment_group[source]¶
- besmarts.core.assignments.smiles_assignment_group_torsions(assignments: List[smiles_assignment])[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian2_angle_matrix(pos: smiles_assignment_float, indices) angle_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian2_angles(pos: smiles_assignment_float, indices) angle_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian2_distance_matrix(pos, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian2_distances(pos, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian2_outofplane_matrix(pos: smiles_assignment_float, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian2_outofplanes(pos: smiles_assignment_float, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian2_torsion_matrix(pos: smiles_assignment_float, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian2_torsions(pos: smiles_assignment_float, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian_angle_matrix(pos: List[smiles_assignment_float], indices) angle_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian_angles(pos: smiles_assignment_float, indices) angle_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian_distance_matrix(pos, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian_distances(pos, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian_outofplane_matrix(pos: List[smiles_assignment_float], indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian_outofplanes(pos: smiles_assignment_float, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian_torsion_matrix(pos: List[smiles_assignment_float], indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_jacobian_torsions(pos: smiles_assignment_float, indices) smiles_assignment_float[source]¶
- besmarts.core.assignments.smiles_assignment_to_graph_assignment(smas: smiles_assignment, gcd) graph_assignment[source]¶
- class besmarts.core.assignments.structure_assignment_float(topology, selections)[source]¶
Bases:
object- selections¶
- topology¶
- class besmarts.core.assignments.structure_assignment_group(assignments, topo)[source]¶
Bases:
smiles_assignment_groupA group of assignments that share the same topology.
- assignments: List[graph_assignment]¶
- topology: structure_topology¶
- besmarts.core.assignments.structure_assignment_group_copy(stuag: structure_assignment_group)[source]¶
- class besmarts.core.assignments.structure_assignment_str[source]¶
Bases:
object- selections¶
- topology¶
- class besmarts.core.assignments.torsion_assignment_float(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.torsion_assignment_float_matrix(selections)[source]¶
Bases:
structure_assignment_float- selections¶
- topology¶
- class besmarts.core.assignments.torsion_assignment_str(selections)[source]¶
Bases:
structure_assignment_str- selections¶
- topology¶
- besmarts.core.assignments.xyz_to_graph_assignment(gcd, smi, xyzdata: str, indices=None) graph_assignment[source]¶