CosolvKit

Submodules

cosolvkit.analysis module

class cosolvkit.analysis.Analysis(atomgroup, gridsize=0.5, **kwargs)

Bases: AnalysisBase

Analysis class to generate density grids

Parameters:

AnalysisBase (AnalysisBase) – Base MDAnalysis class

atomic_grid_free_energy(volume, temperature=300.0, atom_radius=1.4, smoothing=True)

Compute grid free energy.

export_atomic_grid_free_energy(fname, gridsize=0.5, center=None, box_size=None)

Export atomic grid free energy

export_density(fname, gridsize=0.5, center=None, box_size=None)

Export density maps

export_histogram(fname, gridsize=0.5, center=None, box_size=None)

Export histogram maps

class cosolvkit.analysis.Report(log_file, traj_file, top_file, cosolvents_path)

Bases: object

Report class. This is the main class that takes care of post MD simulation processing and analysis.

generate_density_maps(out_path, analysis_selection_string='')

Generates the desnity maps for the target cosolvents.

Parameters:
  • out_path (str) – path to where to save the density files.

  • analysis_selection_string (str, optional) – MD Analysis selection string if want to generate densities only for specific molecules, defaults to “”

generate_pymol_reports(topology, trajectory, density_files, selection_string, out_path)

Generate the PyMol reports from the density maps.

Parameters:
  • topology (str) – Topology generated by CosolvKit.

  • trajectory (str) – Trajectory generated by MD Simulation.

  • density_files (list) – list of density files to include in the same PyMol session. Limited to 5.

  • selection_string (str) – PyMol selection string if willing to specify target residues.

  • out_path (str) – path to where to save the PyMol session.

generate_report(out_path)

Creates the main plots for RDFs, autocorrelations and equilibration.

Parameters:

out_path (str) – path to where to save the results.

cosolvkit.config module

class cosolvkit.config.Config(cosolvents=None, forcefields=None, md_format=None, receptor=True, protein_path=None, clean_protein=True, keep_heterogens=False, variants_d={}, add_repulsive=False, repulsive_residues=[], epsilon=None, sigma=None, solvent_smiles=None, solvent_copies=None, membrane=False, lipid_type=None, lipid_patch_path=None, cosolvent_placement=0, waters_to_keep=[], radius=None, output=None, run_cosolvent_system=True, run_md=False)

Bases: object

This class handles the config.json options and the whole Cosolvent setup.

Parameters:

object (object) – inherits from the base class

classmethod from_config(config)

Sets up the parameters to run cosolvent from the config.json file supplied.

Parameters:

config (str) – loads the config.json file and populates the class attributes

Raises:

ValueError – raises an error if some attributes are not recognized

Returns:

instance of the Config class

Return type:

Config

classmethod get_defaults_dict()

Returns a dictionary of all the class attributes

Returns:

dictionary of class attributes

Return type:

dict

cosolvkit.cosolvent_system module

class cosolvkit.cosolvent_system.CosolventMembraneSystem(cosolvents: str, forcefields: str, simulation_format: str, modeller: Modeller, padding: Quantity = Quantity(value=12, unit=angstrom), radius: Quantity | None = None, lipid_type: str | None = None, lipid_patch_path: str | None = None)

Bases: CosolventSystem

add_membrane(cosolvent_placement: int = 0, neutralize: bool = True, waters_to_keep: list | None = None)

Create a membrane system

Parameters:
  • cosolvent_placement (int, optional) – determines on what side of the membrane will the cosolvents be placed, defaults to 0. * -1: inside the membrane * +1: outside the membrane * 0: everywhere

  • neutralize (bool, optional) – if neutralize the system when solvating the membrane, defaults to True

  • waters_to_keep (list, optional) – a list of the indices of key waters that should not be deleted, defaults to None

Raises:

SystemError – if OpenMM is not able to relax the system after adding the membrane a SystemError is raised

build(neutralize: bool = True, iteratively_adjust_copies: bool = False)

Adds the cosolvent molecules to the system

Parameters:
  • neutralize (bool, optional) – if neutralize the system during solvation, defaults to True

  • iteratively_adjust_copies (bool, optional) – if True, the number of copies of each cosolvent will iteratively be reduced until a valid starting configuration is found

class cosolvkit.cosolvent_system.CosolventMolecule(name: str, smiles: str | None = None, mol_save_dir: str | None = None, mol_filename: str | None = None, resname: str | None = None, copies: int | None = None, concentration: float | None = None)

Bases: object

class cosolvkit.cosolvent_system.CosolventSystem(cosolvents: dict, forcefields: dict, simulation_format: str, modeller: Modeller, padding: Quantity = Quantity(value=12, unit=angstrom), radius: Quantity | None = None)

Bases: object

accept_reject(xyz: ndarray, halton: list, kdtree: cKDTree, valid_ids: list, lowerBound: Quantity | Vec3, upperBound: Quantity | Vec3, protein_kdtree: cKDTree, max_num_trials: int = 10000) tuple[ndarray, list]

Accepts or reject the halton move. A random halton point is selected and checked, if accepted the cosolvent is placed there, otherwise a local search is performed in the neighbors of the point (1 tile). If the local search produces no clashes the new position is accepted, otherwise a new random halton point is selected and the old one is marked as not good. The algorithm stops when a move is accepted or 10000 of num_trialss are done and no move is accepted.

Parameters:
  • xyz (np.ndarray) – 3D coordinates of the cosolvent molecule

  • halton (list) – halton sequence

  • kdtree (spatial.cKDTree) – tree of the cosolvent molecules positions already placed in the box

  • valid_ids (list) – valid halton indices

  • lowerBound (Union[openmm.unit.Quantity, Vec3]) – lower bound of the box

  • upperBound (Union[openmm.unit.Quantity, Vec3]) – upper bound of the box

  • protein_kdtree (spatial.cKDTree) – tree of the protein’s positions

  • max_num_trials – the maximum number of halton moves to make

  • max_num_trials – int

Returns:

accepted coordinates for the cosolvent and the used halton ids

Return type:

Tuple[np.ndarray, list]

add_cosolvents(cosolvents: dict, vectors: tuple[Vec3, Vec3, Vec3], lowerBound: Quantity | Vec3, upperBound: Quantity | Vec3, receptor_positions: list, max_attempts_per_mol: int = 10) dict

This function adds the desired number of cosolvent molecules using the halton sequence to generate random uniformly distributed points inside the grid where to place the cosolvent molecules. At first, if a receptor/protein is present the halton sequence points that would clash with the protein are pruned. We note that each molecule is attempted to be inserted max_attempts_per_mol times, and if this condition is not satisfied, then the program terminates (as we were unable to add the desired number of cosolvent molecules).

Parameters:
  • cosolvents (dict) – keys are cosolvent molecules and values are 3D coordinates of the molecule

  • vectors (Tuple[openmm.Vec3, openmm.Vec3, openmm.Vec3]) – vectors defining the simulation box

  • lowerBound (Union[openmm.unit.Quantity, Vec3]) – lower bound of the simulation box

  • upperBound ([openmm.unit.Quantity, Vec3]) – upper bound of the simulation box

  • receptor_positions (list) – list of 3D coordinates of the receptor

  • max_attempts_per_mol (int) – the maximum number of times we attempt to insert a single molecule

Returns:

keys are cosolvent molecules and values are 3D coordinates of the newly added cosolvent molecules

Return type:

dict

add_cosolvents_adaptive(cosolvents: dict, vectors: tuple[Vec3, Vec3, Vec3], lowerBound: Quantity | Vec3, upperBound: Quantity | Vec3, receptor_positions: list, max_autoadjust_attempts: int = 10, copies_factor_reduction: float = 0.9, max_num_trials: int = 2500) dict

This function attempts to add the desired number of cosolvent molecules using the halton sequence to generate random uniformly distributed points inside the grid where to place the cosolvent molecules. At first, if a receptor/protein is present the halton sequence points that would clash with the protein are pruned. Concentrations are iteratively reduced if initial conditions do not result in a valid starting configuration.

Parameters:
  • cosolvents (dict) – keys are cosolvent molecules and values are 3D coordinates of the molecule

  • vectors (tuple[openmm.Vec3, openmm.Vec3, openmm.Vec3]) – vectors defining the simulation box

  • lowerBound (openmm.unit.Quantity | Vec3) – lower bound of the simulation box

  • upperBound (openmm.unit.Quantity | Vec3) – upper bound of the simulation box

  • receptor_positions (list) – list of 3D coordinates of the receptor

  • max_autoadjust_attempts (int) – the maximum number of times we attempt to retry to add cosolvents after adjusting molecule copy numbers

  • copies_factor_reduction (float) – the multiplicative factor by which we reduce molecule copy numbers (i.e n*copies_factor_reduction)

  • max_num_trials – the maximum number of halton moves to make

  • max_num_trials – int

Returns:

keys are cosolvent molecules and values are 3D coordinates of the newly added cosolvent molecules

Return type:

dict

add_repulsive_forces(residues_names: list, epsilon: float = 0.01, sigma: float = 10.0)

This function adds a LJ repulsive potential between the specified molecules.

Parameters:
  • residues_names (list) – list of residue names

  • epsilon (float, optional) – depth of the potential well in kcal/mol, defaults to 0.01

  • sigma (float, optional) – inter-particle distance in Angstrom, defaults to 10.0

build(solvent_smiles: str = 'H2O', n_solvent_molecules: int | None = None, neutralize: bool = True, iteratively_adjust_copies: bool = False)

This function adds the cosolvents specified in the CosolvSystem and solvates with the desired solvent. If n_solvent_molecules is not passed the function will try to fill the box with the desired solvent to a certain extent. Please note that the solvation with solvents different from water may highly impact the execution time.

Parameters:
  • solvent_smiles (str, optional) – smiles string defining the desired solvent to use, defaults to “H2O”

  • n_solvent_molecules (int, optional) – number of molecules of solvent to add, defaults to None

  • neutralize (bool, optional) – if True, the system charge will be neutralized by OpenMM, defaults to True

  • iteratively_adjust_copies (bool, optional) – if True, the number of copies of each cosolvent will iteratively be reduced until a valid starting configuration is found

calculate_mol_volume(mol_positions: ndarray) float

Calculates the volume occupied by the 3D coordinates provided based on voxelization.

Parameters:

mol_positions (np.ndarray) – 3D coordinates of the molecule

Returns:

volume occupied in nm**3

Return type:

float

check_coordinates_to_add(new_coords: ndarray, cosolvent_kdtree: cKDTree, protein_kdtree: cKDTree) bool

Checks that the new coordinates don’t clash with the receptor (if present) and/or other cosolvent molecules

Parameters:
  • new_coords (np.ndarray) – coordinates of the new molecule of shape (n, 3)

  • cosolvent_kdtree (spatial.cKDTree) – tree of the cosolvent molecules present in the box

  • protein_kdtree (spatial.cKDTree) – tree of the receptor’s coordinates

Returns:

True if there are no clashes, False otherwise

Return type:

bool

cubic_nanometers_to_liters(vol: float) float

Converts cubic nanometers in liters

Parameters:

vol (float) – volume to convert

Returns:

converted volume

Return type:

float

delete_edges_points(xyzs, lowerBound, upperBound, distance, used_halton_ids)
fitting_checks() float | None

Checks if the required cosolvents can fit in the box and do not exceed the 50% of the available fillable volume (volume not occupied by the receptor, if present).

Returns:

available volume if the cosolvents can fit, None otherwise

Return type:

Union[float, None]

generate_rotation(coords: ndarray) ndarray
Rotate a list of 3D [x,y,z] vectors about corresponding random uniformly

distributed quaternion [w, x, y, z]

Parameters:

coords (np.ndarray) – list of [x, y, z] cartesian vector coordinates

Returns:

rotated coordinates

Return type:

np.ndarray

is_in_box(xyzs: ndarray, lowerBound: Quantity | Vec3, upperBound: Quantity | Vec3) bool

Checks if the coordinates are in the box or not

Parameters:
  • xyzs (np.ndarray) – coordinates to check

  • lowerBound (Union[openmmunit.Quantity, Vec3]) – lower bound of the box

  • upperBound (Union[openmmunit.Quantity, Vec3]) – upper bound of the box

Returns:

True if all the coordinates are in the box, Flase otherwise

Return type:

bool

liters_to_cubic_nanometers(liters: float | Quantity) float

Converts liters in cubic nanometers

Parameters:

liters (Union[float, openmm.unit.Quantity]) – volume to convert

Returns:

converted volume

Return type:

float

load_system(system_path: str) System

Loads the specified openmm system.

Parameters:

system_path (str) – path to the system file.

Returns:

a system instance.

Return type:

openmm.System

Return all the possible moves in the 1 tile neighbors

Returns:

combinations

Return type:

list

reduce_copies(factor_reduction: float)

Reduces the number of copies of each cosolvent by a constant factor

Parameters:

factor_reduction (float) – value between 0-1 representing reduction factor to apply to number of cosolvent copies

save_pdb(topology: Topology, positions: list, out_path: str)

Saves the specified topology and position to the out_path file.

Parameters:
  • topology (openmm.app.Topology) – topology used

  • positions (list) – list of 3D coords

  • out_path (str) – path to where to save the dile

save_system(out_path: str, system: System)

Saves the openmm system to the desired out path.

Parameters:
  • out_path (str) – path where to save the System

  • system (openmm.System) – system to save

save_topology(topology: Topology, positions: list, system: System, simulation_format: str, forcefield: ForceField, out_path: str)

Save the topology files necessary for MD simulations according to the simulation engine specified.

Parameters:
  • topology (openmm.app.Topology) – openmm topology

  • positions (list) – list of 3D coordinates

  • system (openmm.System) – openmm system

  • simulation_format (str) – name of the simulation engine

  • forcefield (openmm.app.ForceField) – openmm forcefield

  • out_path (str) – output path to where to save the topology files

cosolvkit.simulation module

cosolvkit.simulation.run_simulation(simulation_format: str = 'OPENMM', results_path: str = 'output', topology: str | None = None, positions: str | None = None, pdb: str = 'output/system.pdb', system: str = 'output/system.xml', traj_write_freq: int = 25000, time_step: float = 0.004, warming_steps: int = 100000, simulation_steps: int = 25000000, seed: int | None = None)

_summary_

Parameters:
  • simulation_format (str, optional) – determines what MD engine will be used, defaults to ‘OPENMM’. Available engines are: [AMBER, GROMACS, CHARMM, OPENMM]

  • results_path (str, optional) – path to where to save the results, defaults to “output”

  • topology (str, optional) – path to the topology file if using simulation_format different from OPENMM, defaults to None

  • positions (str, optional) – path to the positions file if using simulation_format different from OPENMM, defaults to None

  • pdb (str, optional) – path to the pdb file if using simulation_format OPENMM, defaults to ‘output/system.pdb’

  • system (str, optional) – path to the system.xml file if using simulation_format OPENMM, defaults to ‘output/system.xml’

  • warming_steps (int, optional) – number of warming steps, defaults to 100000

  • simulation_steps (int, optional) – number of simulation steps, defaults to 25000000

  • seed (int, optional) – random seed for reproducibility, defaults to None

Raises:

ValueError – different checks are performed and expections are raised if some of the fail.

cosolvkit.utils module

exception cosolvkit.utils.MutuallyExclusiveParametersError

Bases: Exception

A custom exception.

Parameters:

Exception (Exception) – this is a custom exception for mutually exclusive parameters

cosolvkit.utils.add_variants(topology: Topology, positions: list, variants: list = []) Tuple[Topology, List]

Adds variants for specific protonation states.

Parameters:
  • topology (Topology) – openmm topology

  • positions (list) – openmm positions

  • variants (list, optional) – list of variants to apply for the protonation states, defaults to list()

Returns:

topology and positions with added protonation states

Return type:

tuple[Topology, list]

cosolvkit.utils.fix_pdb(pdbfile: str, pdbxfile: str, keep_heterogens: bool = False) Tuple[Topology, List]
Fixes common problems in PDB such as:
  • missing atoms

  • missing residues

  • missing hydrogens

  • remove nonstandard residues

Parameters:
  • pdbfile (str) – pdb string old format

  • pdbxfile (str) – pdb string new format

  • keep_heterogens (bool, optional) – if False all heterogen atoms but waters are deleted, defaults to False

Returns:

new topology and positions

Return type:

tuple[Topology, list]

Module contents

class cosolvkit.CosolventMolecule(name: str, smiles: str | None = None, mol_save_dir: str | None = None, mol_filename: str | None = None, resname: str | None = None, copies: int | None = None, concentration: float | None = None)

Bases: object

class cosolvkit.CosolventSystem(cosolvents: dict, forcefields: dict, simulation_format: str, modeller: Modeller, padding: Quantity = Quantity(value=12, unit=angstrom), radius: Quantity | None = None)

Bases: object

accept_reject(xyz: ndarray, halton: list, kdtree: cKDTree, valid_ids: list, lowerBound: Quantity | Vec3, upperBound: Quantity | Vec3, protein_kdtree: cKDTree, max_num_trials: int = 10000) tuple[ndarray, list]

Accepts or reject the halton move. A random halton point is selected and checked, if accepted the cosolvent is placed there, otherwise a local search is performed in the neighbors of the point (1 tile). If the local search produces no clashes the new position is accepted, otherwise a new random halton point is selected and the old one is marked as not good. The algorithm stops when a move is accepted or 10000 of num_trialss are done and no move is accepted.

Parameters:
  • xyz (np.ndarray) – 3D coordinates of the cosolvent molecule

  • halton (list) – halton sequence

  • kdtree (spatial.cKDTree) – tree of the cosolvent molecules positions already placed in the box

  • valid_ids (list) – valid halton indices

  • lowerBound (Union[openmm.unit.Quantity, Vec3]) – lower bound of the box

  • upperBound (Union[openmm.unit.Quantity, Vec3]) – upper bound of the box

  • protein_kdtree (spatial.cKDTree) – tree of the protein’s positions

  • max_num_trials – the maximum number of halton moves to make

  • max_num_trials – int

Returns:

accepted coordinates for the cosolvent and the used halton ids

Return type:

Tuple[np.ndarray, list]

add_cosolvents(cosolvents: dict, vectors: tuple[Vec3, Vec3, Vec3], lowerBound: Quantity | Vec3, upperBound: Quantity | Vec3, receptor_positions: list, max_attempts_per_mol: int = 10) dict

This function adds the desired number of cosolvent molecules using the halton sequence to generate random uniformly distributed points inside the grid where to place the cosolvent molecules. At first, if a receptor/protein is present the halton sequence points that would clash with the protein are pruned. We note that each molecule is attempted to be inserted max_attempts_per_mol times, and if this condition is not satisfied, then the program terminates (as we were unable to add the desired number of cosolvent molecules).

Parameters:
  • cosolvents (dict) – keys are cosolvent molecules and values are 3D coordinates of the molecule

  • vectors (Tuple[openmm.Vec3, openmm.Vec3, openmm.Vec3]) – vectors defining the simulation box

  • lowerBound (Union[openmm.unit.Quantity, Vec3]) – lower bound of the simulation box

  • upperBound ([openmm.unit.Quantity, Vec3]) – upper bound of the simulation box

  • receptor_positions (list) – list of 3D coordinates of the receptor

  • max_attempts_per_mol (int) – the maximum number of times we attempt to insert a single molecule

Returns:

keys are cosolvent molecules and values are 3D coordinates of the newly added cosolvent molecules

Return type:

dict

add_cosolvents_adaptive(cosolvents: dict, vectors: tuple[Vec3, Vec3, Vec3], lowerBound: Quantity | Vec3, upperBound: Quantity | Vec3, receptor_positions: list, max_autoadjust_attempts: int = 10, copies_factor_reduction: float = 0.9, max_num_trials: int = 2500) dict

This function attempts to add the desired number of cosolvent molecules using the halton sequence to generate random uniformly distributed points inside the grid where to place the cosolvent molecules. At first, if a receptor/protein is present the halton sequence points that would clash with the protein are pruned. Concentrations are iteratively reduced if initial conditions do not result in a valid starting configuration.

Parameters:
  • cosolvents (dict) – keys are cosolvent molecules and values are 3D coordinates of the molecule

  • vectors (tuple[openmm.Vec3, openmm.Vec3, openmm.Vec3]) – vectors defining the simulation box

  • lowerBound (openmm.unit.Quantity | Vec3) – lower bound of the simulation box

  • upperBound (openmm.unit.Quantity | Vec3) – upper bound of the simulation box

  • receptor_positions (list) – list of 3D coordinates of the receptor

  • max_autoadjust_attempts (int) – the maximum number of times we attempt to retry to add cosolvents after adjusting molecule copy numbers

  • copies_factor_reduction (float) – the multiplicative factor by which we reduce molecule copy numbers (i.e n*copies_factor_reduction)

  • max_num_trials – the maximum number of halton moves to make

  • max_num_trials – int

Returns:

keys are cosolvent molecules and values are 3D coordinates of the newly added cosolvent molecules

Return type:

dict

add_repulsive_forces(residues_names: list, epsilon: float = 0.01, sigma: float = 10.0)

This function adds a LJ repulsive potential between the specified molecules.

Parameters:
  • residues_names (list) – list of residue names

  • epsilon (float, optional) – depth of the potential well in kcal/mol, defaults to 0.01

  • sigma (float, optional) – inter-particle distance in Angstrom, defaults to 10.0

build(solvent_smiles: str = 'H2O', n_solvent_molecules: int | None = None, neutralize: bool = True, iteratively_adjust_copies: bool = False)

This function adds the cosolvents specified in the CosolvSystem and solvates with the desired solvent. If n_solvent_molecules is not passed the function will try to fill the box with the desired solvent to a certain extent. Please note that the solvation with solvents different from water may highly impact the execution time.

Parameters:
  • solvent_smiles (str, optional) – smiles string defining the desired solvent to use, defaults to “H2O”

  • n_solvent_molecules (int, optional) – number of molecules of solvent to add, defaults to None

  • neutralize (bool, optional) – if True, the system charge will be neutralized by OpenMM, defaults to True

  • iteratively_adjust_copies (bool, optional) – if True, the number of copies of each cosolvent will iteratively be reduced until a valid starting configuration is found

calculate_mol_volume(mol_positions: ndarray) float

Calculates the volume occupied by the 3D coordinates provided based on voxelization.

Parameters:

mol_positions (np.ndarray) – 3D coordinates of the molecule

Returns:

volume occupied in nm**3

Return type:

float

check_coordinates_to_add(new_coords: ndarray, cosolvent_kdtree: cKDTree, protein_kdtree: cKDTree) bool

Checks that the new coordinates don’t clash with the receptor (if present) and/or other cosolvent molecules

Parameters:
  • new_coords (np.ndarray) – coordinates of the new molecule of shape (n, 3)

  • cosolvent_kdtree (spatial.cKDTree) – tree of the cosolvent molecules present in the box

  • protein_kdtree (spatial.cKDTree) – tree of the receptor’s coordinates

Returns:

True if there are no clashes, False otherwise

Return type:

bool

cubic_nanometers_to_liters(vol: float) float

Converts cubic nanometers in liters

Parameters:

vol (float) – volume to convert

Returns:

converted volume

Return type:

float

delete_edges_points(xyzs, lowerBound, upperBound, distance, used_halton_ids)
fitting_checks() float | None

Checks if the required cosolvents can fit in the box and do not exceed the 50% of the available fillable volume (volume not occupied by the receptor, if present).

Returns:

available volume if the cosolvents can fit, None otherwise

Return type:

Union[float, None]

generate_rotation(coords: ndarray) ndarray
Rotate a list of 3D [x,y,z] vectors about corresponding random uniformly

distributed quaternion [w, x, y, z]

Parameters:

coords (np.ndarray) – list of [x, y, z] cartesian vector coordinates

Returns:

rotated coordinates

Return type:

np.ndarray

is_in_box(xyzs: ndarray, lowerBound: Quantity | Vec3, upperBound: Quantity | Vec3) bool

Checks if the coordinates are in the box or not

Parameters:
  • xyzs (np.ndarray) – coordinates to check

  • lowerBound (Union[openmmunit.Quantity, Vec3]) – lower bound of the box

  • upperBound (Union[openmmunit.Quantity, Vec3]) – upper bound of the box

Returns:

True if all the coordinates are in the box, Flase otherwise

Return type:

bool

liters_to_cubic_nanometers(liters: float | Quantity) float

Converts liters in cubic nanometers

Parameters:

liters (Union[float, openmm.unit.Quantity]) – volume to convert

Returns:

converted volume

Return type:

float

load_system(system_path: str) System

Loads the specified openmm system.

Parameters:

system_path (str) – path to the system file.

Returns:

a system instance.

Return type:

openmm.System

Return all the possible moves in the 1 tile neighbors

Returns:

combinations

Return type:

list

reduce_copies(factor_reduction: float)

Reduces the number of copies of each cosolvent by a constant factor

Parameters:

factor_reduction (float) – value between 0-1 representing reduction factor to apply to number of cosolvent copies

save_pdb(topology: Topology, positions: list, out_path: str)

Saves the specified topology and position to the out_path file.

Parameters:
  • topology (openmm.app.Topology) – topology used

  • positions (list) – list of 3D coords

  • out_path (str) – path to where to save the dile

save_system(out_path: str, system: System)

Saves the openmm system to the desired out path.

Parameters:
  • out_path (str) – path where to save the System

  • system (openmm.System) – system to save

save_topology(topology: Topology, positions: list, system: System, simulation_format: str, forcefield: ForceField, out_path: str)

Save the topology files necessary for MD simulations according to the simulation engine specified.

Parameters:
  • topology (openmm.app.Topology) – openmm topology

  • positions (list) – list of 3D coordinates

  • system (openmm.System) – openmm system

  • simulation_format (str) – name of the simulation engine

  • forcefield (openmm.app.ForceField) – openmm forcefield

  • out_path (str) – output path to where to save the topology files

class cosolvkit.Report(log_file, traj_file, top_file, cosolvents_path)

Bases: object

Report class. This is the main class that takes care of post MD simulation processing and analysis.

generate_density_maps(out_path, analysis_selection_string='')

Generates the desnity maps for the target cosolvents.

Parameters:
  • out_path (str) – path to where to save the density files.

  • analysis_selection_string (str, optional) – MD Analysis selection string if want to generate densities only for specific molecules, defaults to “”

generate_pymol_reports(topology, trajectory, density_files, selection_string, out_path)

Generate the PyMol reports from the density maps.

Parameters:
  • topology (str) – Topology generated by CosolvKit.

  • trajectory (str) – Trajectory generated by MD Simulation.

  • density_files (list) – list of density files to include in the same PyMol session. Limited to 5.

  • selection_string (str) – PyMol selection string if willing to specify target residues.

  • out_path (str) – path to where to save the PyMol session.

generate_report(out_path)

Creates the main plots for RDFs, autocorrelations and equilibration.

Parameters:

out_path (str) – path to where to save the results.