adducts

class isicle.adducts.AdductEnsemble[source]
clear() None.  Remove all items from D.[source]
copy() a shallow copy of D[source]
get_structures()[source]
has_key(k)[source]
keys() a set-like object providing a view on D's keys[source]
update([E, ]**F) None.  Update D from dict/iterable E and F.[source]

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values[source]
class isicle.adducts.CRESTIonizationWrapper(**kwargs)[source]
_abc_impl = <_abc._abc_data object>
_check_valid()[source]

Performs substructure search and checks if supported by CREST documentation

_default_value = None
_defaults = ('geom', 'adducts')
_filter_supported_by_xtb(unknown_valid_list)[source]

Filters ions by what is supported by xtb software. consult https://github.com/grimme-lab/crest/issues/2 for supported ions by xtb CREST xtb supports alkali and alkaline earth metals.

_negative_mode(geom, forcefield, ewin, anion, optlevel, dryrun, processes, solvation, ignore_topology)[source]

Call isicle.md.md for specified geom and anion

_parse_ion_charge(ion)[source]
_positive_mode(geom, forcefield, ewin, cation, optlevel, dryrun, processes, solvation, ignore_topology)[source]

Call isicle.md.md for specified geom and cation

_set_ions(ion_path=None, ion_list=None)[source]
_update_geometry_charge(geom, adduct, ion_charge, mode)[source]
configure(ion_path=None, ion_list=None)[source]

Configure the run.

finish()[source]

Parse results.

Return type:

CRESTIonizationWrapper

get_adducts()[source]

Extract all structures from containing object as an adduct ensemble.

Returns:

Adduct ensemble.

Return type:

AdductEnsemble

get_structures()[source]

Extract all structures from containing object as a conformational ensemble.

Returns:

Conformational ensemble.

Return type:

ConformationalEnsemble

run(geom, ion_path=None, ion_list=None, **kwargs)[source]

Ionize geometry via with supplied geometry and file containing list of ions. :param geom: Molecule representation. :type geom: Geometry :param ion_method: Alias for ionaztion method selection (explicit). :type ion_method: str :param ion_list: List of ion str.

See :meth`~isicle.adducts.parse_ions`.

Parameters:

**kwargs – Keyword arguments to configure how ionization is run. See generator()

Return type:

CRESTIonizationWrapper

save(path)[source]

Save this class instance.

Parameters:

path (str) – Path to save object to.

save_pickle(path)[source]

Pickle this class instance.

Parameters:

path (str) – Path to save pickle object to.

set_geometry(geom)[source]

Set Geometry instance for simulation.

Parameters:

geom (Geometry) – Molecule representation.

submit(forcefield='gfn2', ewin=30, optlevel='Normal', dryrun=False, processes=1, solvation=None, ignore_topology=False)[source]

Call positive_mode and negative_mode to ionize according to parsed ion lists isicle.md.md returned by both modes to self.anion, self.cation, self.complex in form of {ion : xyz object [returned by xtb]}

Input

see isicle.md.md for forcefield, ewin, optlevel, dryrun molecular_charge is net charge of structure pre-ionization, default neutral, 0

class isicle.adducts.ExplicitIonizationWrapper(**kwargs)[source]
_abc_impl = <_abc._abc_data object>
_add_ion(init_mol, base_atom_idx, ion_atomic_num, sanitize, forcefield, ff_iter)[source]

Adds specified ion (by atomic num) to specified base atom (by atom’s index).

Parameters:
  • init_mol (RDKit mol object)

  • base_atom_idx (Int) – Integer denoting the the atom to which an ion will be added

  • ion_atomic_num (Int) – Integer denoting the atomic number of the ion to be added

  • sanitize (Bool) – Kekulize, check valencies, set aromaticity, conjugation and hybridization

  • forcefield (str) – Specify “UFF” for Universal Force Field optimization by RDKit Specify “MMFF” or “MMFF94” for Merck Molecular Force Field 94 Specify “MMFF94s” for the MMFF94 s variant

  • ff_iter (Int) – Integer specifying the max iterations for the specified forcefield

Return type:

Ionized RDKit mol object

_apply_add_ion(init_mol, atom_dict, ion_atomic_num, sanitize, forcefield, ff_iter)[source]

Iteratively ionize all atoms in a supplied dictionary.

Parameters:
  • init_mol (RDKit mol object)

  • atom_dict (Dict) – Dictionary of format {<atom.rdkit.obj>:[atom Symbol, atom Total Valence, atom Degree, # bonded H atoms]}

  • ion_atomic_num (Int) – Integer denoting the atomic number of the ion to be added

  • sanitize (Bool) – Kekulize, check valencies, set aromaticity, conjugation and hybridization

  • forcefield (str) – Specify “UFF” for Universal Force Field optimization by RDKit Specify “MMFF” or “MMFF94” for Merck Molecular Force Field 94 Specify “MMFF94s” for the MMFF94 s variant

  • ff_iter (Int) – Integer specifying the max iterations for the specified forcefield

Returns:

Dictionary of style {base atom index

Return type:

ionized RDKit mol object}

_apply_remove_ion(init_mol, atom_dict, ion_atomic_num, sanitize, forcefield, ff_iter)[source]

Iteratively deionize all atoms in a supplied dictionary.

Parameters:
  • init_mol (RDKit mol object)

  • atom_dict (Dict) – Dictionary of format {<atom.rdkit.obj>:[atom Symbol, atom Total Valence, atom Degree, # bonded H atoms]}

  • ion_atomic_num (Int) – Integer denoting the atomic number of the ion to be removed

  • sanitize (Bool) – Kekulize, check valencies, set aromaticity, conjugation and hybridization

  • forcefield (str) – Specify “UFF” for Universal Force Field optimization by RDKit Specify “MMFF” or “MMFF94” for Merck Molecular Force Field 94 Specify “MMFF94s” for the MMFF94 s variant

  • ff_iter (Int) – Integer specifying the max iterations for the specified forcefield

Returns:

Dictionary of style {base atom index

Return type:

deionized RDKit mol object}

_check_valid()[source]

Perform substructure search.

_default_value = None
_defaults = ('geom', 'adducts')
_forcefield_selector(forcefield, mw)[source]

Checks if user specified forcefield is compatible with supplied mol

Parameters:
  • forcefield (str) – Specify “UFF” for Universal Force Field optimization by RDKit Specify “MMFF” or “MMFF94” for Merck Molecular Force Field 94 Specify “MMFF94s” for the MMFF94 s variant

  • mw (RDKit mol object)

Return type:

RDKit forcefield optimization function that must be implemented

_modify_atom_dict(init_mol, ion_atomic_num, mode=None, include_Alkali_ne=False)[source]

Downselect atom sites that can accept ions

Parameters:
  • init_mol (RDKit mol object)

  • ion_atomic_num (Int) – Integer denoting the atomic number of the ion to be added or removed

  • mode (str) – ‘positive’ for positive mode ‘negative’ for negative mode

  • include_Alkaline_ne (Bool) – If False: removes alkali and alkaline metals from base atoms to be ionized (default) If True: Adducts are attempted to be formed at these atoms, in addition to other atoms.

Returns:

all_atom_dict defined as {<atom.rdkit.obj> – -atom.GetSymbol() returns atomic symbol e.g. ‘C’ -atom.GetTotalValence() returns total (explicit+implicit) valence -atom.GetDegree() returns number of directly-bonded neighbours

indep. of bond order, dep. of Hs set to explicit

-atom.GetTotalNumHs returns total (explicit+implicit) Hs on atom

Return type:

[‘C’,3,2,1]}

_negative_mode(init_mol, ion_atomic_num, batch, index_list, element_list, sanitize, forcefield, ff_iter, include_Alkali_ne)[source]

Subsets atoms in supplied mol by specified index or elemental constraints, or feasibilty based upon supplied ion atomic number.

Parameters:
  • init_mol (RDKit mol object)

  • ion_atomic_num (Int) – Integer denoting the atomic number of the ion to be removed

  • batch (Bool) – Whether adducts should be formed from all possible heavy atoms

  • index_list (list) – list of integers denoting IUPAC atom indexes of base atoms to be deionized (eg. [0,1])

  • element_list (list) – list of atoms symbols denoting base atom types to be ionized (eg. [‘O’,’N’])

  • sanitize (Bool) – Kekulize, check valencies, set aromaticity, conjugation and hybridization

  • forcefield (str) – Specify “UFF” for Universal Force Field optimization by RDKit Specify “MMFF” or “MMFF94” for Merck Molecular Force Field 94 Specify “MMFF94s” for the MMFF94 s variant

  • ff_iter (Int) – Integer specifying the max iterations for the specified forcefield

  • include_Alkaline_ne (Bool) – If False: removes alkali and alkaline metals from base atoms to be deionized If True: Adducts are attempted to be formed at these atoms, in addition to other atoms.

Returns:

Dictionary of style {base atom index

Return type:

deionized RDKit mol object}

_positive_mode(init_mol, ion_atomic_num, batch, index_list, element_list, sanitize, forcefield, ff_iter, include_Alkali_ne)[source]

Subsets atoms in supplied mol by specified index or elemental constraints, or feasibilty based upon supplied ion atomic number.

Parameters:
  • init_mol (RDKit mol object)

  • ion_atomic_num (Int) – Integer denoting the atomic number of the ion to be added

  • batch (Bool) – Whether adducts should be formed from all possible heavy atoms

  • index_list (list) – list of integers denoting IUPAC atom indexes of base atoms to be ionized (eg. [0,1])

  • element_list (list) – list of atoms symbols denoting base atom types to be ionized (eg. [‘O’,’N’])

  • sanitize (Bool) – Kekulize, check valencies, set aromaticity, conjugation and hybridization

  • forcefield (str) – Specify “UFF” for Universal Force Field optimization by RDKit Specify “MMFF” or “MMFF94” for Merck Molecular Force Field 94 Specify “MMFF94s” for the MMFF94 s variant

  • ff_iter (Int) – Integer specifying the max iterations for the specified forcefield

  • include_Alkaline_ne (Bool) – If False: removes alkali and alkaline metals from base atoms to be ionized If True: Adducts are attempted to be formed at these atoms, in addition to other atoms.

Returns:

Dictionary of style {base atom index

Return type:

ionized RDKit mol object}

_remove_ion(init_mol, base_atom_idx, ion_atomic_num, sanitize, forcefield, ff_iter)[source]

Removes specified ion (by atomic num) from specified base atom (by atom’s index).

Parameters:
  • init_mol (RDKit mol object)

  • base_atom_idx (Int) – Integer denoting the the atom from which an ion will be removed from

  • ion_atomic_num (Int) – Integer denoting the atomic number of the ion to be removed

  • sanitize (Bool) – Kekulize, check valencies, set aromaticity, conjugation and hybridization

  • forcefield (str) – Specify “UFF” for Universal Force Field optimization by RDKit Specify “MMFF” or “MMFF94” for Merck Molecular Force Field 94 Specify “MMFF94s” for the MMFF94 s variant

  • ff_iter (Int) – Integer specifying the max iterations for the specified forcefield

Return type:

Deionized RDKit mol object

_set_ions(ion_path=None, ion_list=None)[source]
_subset_atom_dict(atom_dict, index_list=None, element_list=None)[source]

Downselect atom sites to user supplied atom indices or element symbols

Params

atom_dict: Dict

Dictionary of format {<atom.rdkit.obj>:[atom Symbol, atom Total Valence, atom Degree, # bonded H atoms]}

index_list: list

list of integers denoting IUPAC atom indexes of base atoms to be ionized (eg. [0,1])

element_list: list

list of atoms symbols denoting base atom types to be ionized (eg. [‘O’,’N’])

returns:

subset_atom_dict defined as {<atom.rdkit.obj> – -atom.GetSymbol() returns atomic symbol e.g. ‘C’ -atom.GetTotalValence() returns total (explicit+implicit) valence -atom.GetDegree() returns number of directly-bonded neighbours

indep. of bond order, dep. of Hs set to explicit

-atom.GetTotalNumHs returns total (explicit+implicit) Hs on atom

rtype:

[‘C’,3,2,1]}

_update_geometry_charge(geom)[source]
configure(ion_path=None, ion_list=None)[source]
finish()[source]

Parse results.

Return type:

ExplicitIonizationWrapper

get_adducts()[source]

Extract all structures from containing object as an adduct ensemble.

Returns:

Adduct ensemble.

Return type:

AdductEnsemble

get_structures()[source]

Extract all structures from containing object as a conformational ensemble.

Returns:

Conformational ensemble.

Return type:

ConformationalEnsemble

run(geom, ion_path=None, ion_list=None, **kwargs)[source]

Ionize geometry via with supplied geometry and file containing list of ions.

Parameters:
  • geom (Geometry) – Molecule representation.

  • ion_path (str) – Filepath to text file containing ions with charge (eg. H+) to be considered Either ion_path or ion_list must be specified

  • ion_list (list) – List of strings of adducts to be considered. Must be specifed in syntax Atom+ or Atom-, eg. H+, Na+, H-Na+ Either ion_path or ion_list must be specified

  • **kwargs – Keyword arguments to configure how ionization is run. See submit().

Return type:

ExplicitIonizationWrapper

save(path)[source]

Save this class instance.

Parameters:

path (str) – Path to save object to.

save_pickle(path)[source]

Pickle this class instance.

Parameters:

path (str) – Path to save pickle object to.

set_geometry(geom)[source]

Set Geometry instance for simulation.

Parameters:

geometry (Geometry) – Molecule representation.

submit(batch=True, index_list=None, element_list=None, sanitize=True, forcefield='UFF', ff_iter=200, include_Alkali_ne=False)[source]

Calls positive or negative ionization modes based upon supplied ion list.

Parameters:
  • batch (Bool) – Whether adducts should be formed from all possible heavy atoms

  • index_list (list) – list of integers denoting IUPAC atom indexes of base atoms to be ionized (eg. [0,1])

  • element_list (list) – list of atoms symbols denoting base atom types to be ionized (eg. [O,`N`])

  • sanitize (Bool) – Kekulize, check valencies, set aromaticity, conjugation and hybridization

  • forcefield (str) – Specify UFF for Universal Force Field optimization by RDKit (default) Specify MMFF or MMFF94 for Merck Molecular Force Field 94 Specify MMFF94s for the MMFF94 s variant

  • ff_iter (Int) – Integer specifying the max iterations for the specified forcefield (200 default)

  • include_Alkaline_ne (Bool) – If False: removes alkali and alkaline metals from base atoms to be ionized (default) If True: Adducts are attempted to be formed at these atoms, in addition to other atoms.

Returns:

Dictionary of style {base atom index

Return type:

ionized RDKit mol object}

isicle.adducts._check_atom_group(ion_atomic_num)[source]

Checks periodic group atom belongs to

Params

ion_atomic_num: Int

rtype:

Bool

isicle.adducts._filter_by_substructure_match(init_mol, unknown_valid_list)[source]

Filters ions in supplied list that are a substructure match to the supplied mol

Params

init_mol: RDKit mol object unknown_valid_list: list of str

List of ions (eg. [H-])

isicle.adducts._parse_file_ions(path)[source]

Read adduct ions (eg. ‘Na+’, ‘H+’, ‘Mg2+’) from file.

Parameters:

path (str) – Path to ions text file (.txt, etc.), each ion should be a new line.

Returns:

List of ions from given text file.

Return type:

parsed_contents

isicle.adducts._parse_ions(ion_path=None, ion_list=None)[source]

Parses supplied ion information to recognized format

Params

ion_path: str

Filepath to text file with an ion on each new line For more layout information, see: adducts._parse_file_ions()

ion_list: list of str

List of ions in format ‘ioncharge’ (eg. ‘H+’ or ‘Na+’) For more information on complex ions, see: adducts._parse_list_ions()

rtype:

Tuple of (cations, anions, complex ions)

isicle.adducts._parse_list_ions(ion_list)[source]

Parse and categorize list of ions by ion type.

Input

ion_list: list

List of all ions to be considered, eg. [‘K+’,’H-‘,’H-Na+’] Strings in list must have notation ‘IonCharge’ eg. ‘H+’, not ‘+H’ Complex ions should be arranged in order of desired operation. (i.e. ‘H-K+’ specifies deprotonatin first, potassium added second)

returns:
  • anions (list) – List of anions, default None

  • cations (list) – List of cations, default None

  • complex (list) – List of complex ions, default None

isicle.adducts.build_adduct_ensemble(geometries)[source]
isicle.adducts.get_nested_dict_values(d)[source]
isicle.adducts.ionize(ion_method)[source]

Selects a supported ionization method.

Parameters:

ion_method (str) – Alias for ion method selection (e.g. explicit).

Returns:

Wrapped functionality of the selected program. Must implement AdductInterface.

Return type:

program

isicle.adducts.write(IonizationWrapper, path, fmt)[source]

Write mol objects to file.

Parameters:
  • path (str) – Directory to write output files

  • fmt (str) – Format in which to save the RDKit mol object (eg. ‘mol2’, ‘pdb’)