Networking

Networking

Author:

Orion Cohen, Tingzheng Hou, Kara Fong

Year:

2021

Copyright:

GNU Public License v3

Study the topology and structure of solute-solvent networks.

Networking yields a complete description of coordinated solute-solvent networks in the solute, regardless of identify. This could include cation-anion networks or hydrogen bond networks.

While networking can be used in isolation, it is meant to be used as an attribute of the Solute class. This makes instantiating it and calculating the solvation data a non-issue.

class solvation_analysis.networking.Networking[source]

Calculate the number and size of solute-solvent networks.

A network is defined as a bipartite graph of solutes and solvents, where edges are defined by coordination in the solvation_data DataFrame. A single solvent or multiple solvents can be selected, but coordination between solvents will not be included, only coordination between solutes and solvents.

Networking uses the solvation_data to construct an adjacency matrix and then extracts the connected subgraphs within it. These connected subgraphs are stored in a DataFrame in Networking.network_df.

Several other representations of the networking data are included in the attributes.

Parameters:
  • solvents (str or list[str]) – the solvents to include in the solute-solvent network.

  • solvation_data (pandas.DataFrame) – a dataframe of solvation data with columns “frame”, “solute_atom”, “solvent_atom”, “distance”, “solvent_name”, and “solvent”.

  • solute_res_ix (np.ndarray) – the residue indices of the solutes in solvation_data

  • res_name_map (pd.Series) – a mapping between residue indices and the solute & solvent names in a Solute.

Examples

# first define Li, BN, and FEC AtomGroups
>>> solute = Solute.from_atoms(Li, {'BN': BN, 'FEC': FEC, 'PF6': PF6})
>>> networking = Networking.from_solute(solute, 'PF6')
__init__(solvents, solvation_data, solute_res_ix, res_name_map)[source]
static from_solute(solute, solvents)[source]

Generate a Networking object from a solute and solvent names.

Parameters:
  • solute (Solute)

  • solvents (str or list of str) – the strings should be the name of solvents in the Solute. The strings must match exactly for Networking to work properly. The selected solvents will be used to construct the networking graph that is described in documentation for the Networking class.

Return type:

Networking

get_network_res_ix(network_index, frame)[source]

Return the indexes of all residues in a selected network.

The network_index and frame must be provided to fully specify the network. Once the indexes are returned, they can be used to select an AtomGroup with the species of interest, see Examples.

Parameters:
  • network_index (int) – The index of the network of interest

  • frame (int) – the frame in the trajectory to perform selection at. Defaults to the current trajectory frame.

Returns:

res_ix

Return type:

np.ndarray

Examples

# first define Li, BN, and FEC AtomGroups
>>> solute = Solute(Li, {'BN': BN, 'FEC': FEC, 'PF6': PF6})
>>> networking = Networking.from_solute(solute, 'PF6')
>>> res_ix = networking.get_network_res_ix(1, 5)
>>> solute.u.residues[res_ix].atoms
<AtomGroup with 126 Atoms>
property network_df

The dataframe containing all networking data. the indices are the frame and network index, respectively. the columns are the solvent_name and res_ix.

property network_sizes

A dataframe of network sizes. the index is the frame. the column headers are network sizes, or the number of solutes + solvents in the network, so the columns might be [2, 3, 4, …]. the values in each column are the number of networks with that size in each frame.

property solute_status

A dictionary where the keys are the “status” of the solute and the values are the fraction of solute with that status, averaged over all frames. “isolated” means that the solute not coordinated with any of the networking solvents, network size is 1. “paired” means the solute and is coordinated with a single networking solvent and that solvent is not coordinated to any other solutes, network size is 2. “networked” means that the solute is coordinated to more than one solvent or its solvent is coordinated to more than one solute, network size >= 3.

property solute_status_by_frame

As described above, except organized into a dataframe where each row is a unique frame and the columns are “isolated”, “paired”, and “networked”.