pymatgen.analysis.chemenv.connectivity.connected_components module

Connected components.

class ConnectedComponent(environments=None, links=None, environments_data=None, links_data=None, graph=None)[source]

Bases: MSONable

Class used to describe the connected components in a structure in terms of coordination environments.

Constructor for the ConnectedComponent object.

Parameters:
  • environments – Environments in the connected component.

  • links – Links between environments in the connected component.

  • environments_data – Data of environment nodes.

  • links_data – Data of links between environment nodes.

  • graph – Graph of the connected component.

Returns:

Instance of this class

Return type:

ConnectedComponent

as_dict()[source]

Bson-serializable dict representation of the ConnectedComponent object.

Returns:

Bson-serializable dict representation of the ConnectedComponent object.

Return type:

dict

compute_periodicity(algorithm='all_simple_paths')[source]
Parameters:

() (algorithm) –

Returns:

compute_periodicity_all_simple_paths_algorithm()[source]

Returns:

compute_periodicity_cycle_basis()[source]

Returns:

coordination_sequence(source_node, path_size=5, coordination='number', include_source=False)[source]

Get the coordination sequence for a given node.

Parameters:
  • source_node – Node for which the coordination sequence is computed.

  • path_size – Maximum length of the path for the coordination sequence.

  • coordination – Type of coordination sequence. The default (“number”) corresponds to the number of environment nodes that are reachable by following paths of sizes between 1 and path_size. For coordination “env:number”, this resulting coordination sequence is a sequence of dictionaries mapping the type of environment to the number of such environment reachable by following paths of sizes between 1 and path_size.

  • include_source – Whether to include the source_node in the coordination sequence.

Returns:

Mapping between the nth “layer” of the connected component with the corresponding coordination.

Return type:

dict

Examples

The corner-sharing octahedral framework (as in perovskites) have the following coordination sequence (up to a path of size 6) : {1: 6, 2: 18, 3: 38, 4: 66, 5: 102, 6: 146} Considering both the octahedrons and the cuboctahedrons of the typical BaTiO3 perovskite, the “env:number” coordination sequence (up to a path of size 6) starting on the Ti octahedron and Ba cuboctahedron are the following : Starting on the Ti octahedron : {1: {‘O:6’: 6, ‘C:12’: 8}, 2: {‘O:6’: 26, ‘C:12’: 48},

3: {‘O:6’: 90, ‘C:12’: 128}, 4: {‘O:6’: 194, ‘C:12’: 248}, 5: {‘O:6’: 338, ‘C:12’: 408}, 6: {‘O:6’: 522, ‘C:12’: 608}}

Starting on the Ba cuboctahedron{1: {‘O:6’: 8, ‘C:12’: 18}, 2: {‘O:6’: 48, ‘C:12’: 74},

3: {‘O:6’: 128, ‘C:12’: 170}, 4: {‘O:6’: 248, ‘C:12’: 306}, 5: {‘O:6’: 408, ‘C:12’: 482}, 6: {‘O:6’: 608, ‘C:12’: 698}}

If include_source is set to True, the source node is included in the sequence, e.g. for the corner-sharing octahedral framework : {0: 1, 1: 6, 2: 18, 3: 38, 4: 66, 5: 102, 6: 146}. For the “env:number” coordination starting on a Ba cuboctahedron (as shown above), the coordination sequence is then : {0: {‘C:12’: 1}, 1: {‘O:6’: 8, ‘C:12’: 18}, 2: {‘O:6’: 48, ‘C:12’: 74}, 3: {‘O:6’: 128, ‘C:12’: 170},

4: {‘O:6’: 248, ‘C:12’: 306}, 5: {‘O:6’: 408, ‘C:12’: 482}, 6: {‘O:6’: 608, ‘C:12’: 698}}

description(full=False)[source]
Parameters:

() (full) –

Returns:

elastic_centered_graph(start_node=None)[source]
Parameters:

() (start_node) –

Returns:

classmethod from_dict(d)[source]

Reconstructs the ConnectedComponent object from a dict representation of the ConnectedComponent object created using the as_dict method.

Parameters:

d (dict) – dict representation of the ConnectedComponent object

Returns:

The connected component representing the links of a given set of environments.

Return type:

ConnectedComponent

classmethod from_graph(g)[source]

Constructor for the ConnectedComponent object from a graph of the connected component

Parameters:

g (MultiGraph) – Graph of the connected component.

Returns:

The connected component representing the links of a given set of environments.

Return type:

ConnectedComponent

property graph[source]

Return the graph of this connected component.

Returns:

Networkx MultiGraph object with environment as nodes and links between these nodes as edges

with information about the image cell difference if any.

Return type:

MultiGraph

property is_0d[source]

Returns:

property is_1d[source]

Returns:

property is_2d[source]

Returns:

property is_3d[source]

Returns:

property is_periodic[source]

Returns:

make_supergraph(multiplicity)[source]
Parameters:

() (multiplicity) –

Returns:

property periodicity[source]

Returns:

property periodicity_vectors[source]

Returns:

show_graph(graph=None, save_file=None, drawing_type='internal', pltshow=True)[source]
Parameters:
  • () (pltshow) –

  • ()

  • ()

  • ()

Returns:

draw_network(env_graph, pos, ax, sg=None, periodicity_vectors=None)[source]

Draw network of environments in a matplotlib figure axes.

Parameters:
  • env_graph – Graph of environments.

  • pos – Positions of the nodes of the environments in the 2D figure.

  • ax – Axes object in which the network should be drawn.

  • sg – Not used currently (drawing of supergraphs).

  • periodicity_vectors – List of periodicity vectors that should be drawn.

Returns: None

make_supergraph(graph, multiplicity, periodicity_vectors)[source]

Make supergraph from a graph of environments.

Parameters:
  • graph – Graph of environments.

  • multiplicity – Multiplicity of the supergraph.

  • periodicity_vectors – Periodicity vectors needed to make the supergraph.

Returns: Super graph of the environments.