graphmix

class graphmix.ChemicalRegistry(uow: ChemicalUnitOfWork | None = None, path: str | None = None)[source]

A registry for storing and retrieving chemical information. Uses a local database to store chemicals, and queries PubChem if a chemical is not found.

Chemical(name: str) Chemical[source]
__init__(uow: ChemicalUnitOfWork | None = None, path: str | None = None)[source]
add_chemical(chemical: Chemical)[source]

Add a chemical to the local database.

get_chemical(name: str) Chemical[source]

Get a chemical by name. If the chemical is not found in the local database, query PubChem for the chemical information.

property path: Path
pubchem: PubChemService
uow: ChemicalUnitOfWork
class graphmix.Solution(*, name: str, G: DiGraph = None, components: dict[str, Chemical | Solution] = {})[source]
G: DiGraph
add_entity(entity: Chemical | Solution)[source]
property chemicals: Generator[tuple[str, Chemical], None, None]
components: dict[str, Chemical | Solution]
property composition: Composition
dilute_with(solvent: Chemical | Solution, ratio: float, name: str | None = None) Solution[source]
in_edges(node: str) Generator[tuple[str, str, Quantity | float], None, None][source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'G': FieldInfo(annotation=DiGraph, required=False, default_factory=Annotated[DiGraph, _DiGraphPydanticAnnotation], metadata=[<class 'graphmix.graph.model._DiGraphPydanticAnnotation'>]), 'components': FieldInfo(annotation=dict[str, Union[Chemical, Solution]], required=False, default={}), 'name': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
with_component(component: Chemical | Solution, concentration: Quantity)[source]
with_components(components: dict[Chemical | Solution, Quantity])[source]
graphmix.plot_graph(G: ~networkx.classes.digraph.DiGraph, node_color: str = '#0d9488', font_color: str = '#ccfbf1', font_size: int = 8, node_size: int = 500, edge_colors: str = '#042f2e', edge_attr: str = 'concentration', line_width: float = 1.1, alpha: float = 0.8, ax: ~matplotlib.axes._axes.Axes = None, layout: ~collections.abc.Callable[[~networkx.classes.digraph.DiGraph], dict] = <function kamada_kawai_layout>) Axes[source]