pysoftk.tools package

Submodules

pysoftk.tools.utils_func module

pysoftk.tools.utils_func.atom_neigh(mol, atom)[source]

Find the neighbours from an atoms inside a molecule.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • atom (str) – The placeholder atom

Returns:

neigh – List of neighbors

Return type:

list

pysoftk.tools.utils_func.count_plholder(mol, atom)[source]
Function to count the number of user defined

atomic placeholders.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • atom (class.str) – The placeholder atom

Returns:

num_br – Number of atomic place holders inside a molecule.

Return type:

class.int

pysoftk.tools.utils_func.create_pol(mol, atom, tpb)[source]

Function to create polymers.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • atom (str) – The placeholder atom

tpb: list

List of tuples with atoms to be connected

Returns:

rmwol1 – RDKit Mol object

Return type:

rdkit.Chem.rdchem.Mol

pysoftk.tools.utils_func.get_file_extension(path)[source]

Gets the extension of a file.

Parameters:

path (str) – The path to the file.

Returns:

The extension of the file.

Return type:

str

pysoftk.tools.utils_func.pattern_mol_seq(mols, pattern)[source]
Function to create a list of molecules based on a user

provided pattern.

Parameters:
  • pattern (class.str) – A string value containing the desired pattern.

  • mols (class.list) – List containing the names of the molecules to form a polymer with a given pattern.

Returns:

return – List with the correct sequence of molecular fragments to be merged.

Return type:

class.list

pysoftk.tools.utils_func.pattern_recon(pattern)[source]

Function to find unique values from a string pattern.

Parameters:

pattern (str) – Variable containing the pattern written in a string.

Returns:

result – Returns the unique values of the pattern in alphabetic order.

Return type:

list

pysoftk.tools.utils_func.pattern_repl(pattern, tup_repl)[source]
Function to perform a pattern replacement using tuples generated

by pattern and molecular names.

Parameters:

pattern (str) – Variable containing the pattern written in a string

Returns:

return – Returns the names of the molecules as provided by the string pattern.

Return type:

list

pysoftk.tools.utils_func.tuple_bonds(lst_atm_neigh)[source]

Function to seek atomic neighbours

Parameters:

lst_atm_neigh (class.list) – List containing atoms for getting neighbors.

Returns:

return – A list of tuples with the neighbors of the parsed atoms.

Return type:

class.list

pysoftk.tools.utils_ob module

pysoftk.tools.utils_ob.check_bond_order(file_name)[source]

Function to check and correct the bonds of a given file.

Parameters:

file_name (class.str) – An user-provided file containing a molecule in an accepted openbabel format.

Returns:

A new file containing checked bond and bond order molecular system.

Return type:

None

pysoftk.tools.utils_ob.ff_ob_relaxation(mol, FF='MMFF94', relax_iterations=100, ff_thr=1e-06)[source]
Setting up an openbabel FF for

geometry optimization.

Parameters:
  • mol (OBabel.Mol) – An user-provided OpenBabel moelcule.

  • FF (class.str) – Selected Force Field. Options are MMFF94, UFF, GAFF.

  • iter (class.int) – Number of iterations to be used for the FF.

Returns:

mol_new – Open Babel Molecule with optmised Geometry.

Return type:

Mol.OBabel.Mol

pysoftk.tools.utils_ob.global_opt(mol, FF='MMFF94', relax_iterations=150, rot_steps=125, ff_thr=1e-06)[source]

Setting up an openbabel FF for rotor optimization.

Parameters:
  • mol (OBabel.Mol) – An user-provided OpenBabel moelcule.

  • FF (class.str) – Selected Force Field. Options are MMFF94, UFF, GAFF.

  • rot_steps (class.int) – Number of iterations to be used for the rotational optimization.

Returns:

mol_new – Open Babel Molecule with optmised Geometry.

Return type:

Mol.OBabel.Mol

pysoftk.tools.utils_ob.rotor_opt(mol, FF='MMFF94', rot_steps=125)[source]

Setting up an openbabel FF for rotor optimization.

Parameters:
  • mol (OBabel.Mol) – An user-provided OpenBabel moelcule.

  • FF (class.str) – Selected Force Field. Options are MMFF94, UFF, GAFF.

  • rot_steps (class.int) – Number of iterations to be used for the rotational optimization.

Returns:

mol_new – Open Babel Molecule with optmised Geometry.

Return type:

Mol.OBabel.Mol

pysoftk.tools.utils_rdkit module

pysoftk.tools.utils_rdkit.MMFF_rel(mol, relax_iterations, vdw_par=0.001)[source]

Function to employ a MMFF molecular mechanics FF.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • relax_iterations (int) – Number of iterations to perform a FF geometry optimization.

  • vdw_par (float) – Extension of the vdW interaction range.

Returns:

mol – RDKit Mol object

Return type:

rdkit.Chem.rdchem.Mol

pysoftk.tools.utils_rdkit.UFF_rel(mol, relax_iterations, vdw_par=0.001)[source]

Function to employ an UFF molecular mechanics FF.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • relax_iterations (int) – Number of iterations to perform a FF geometry optimization.

  • vdw_par (float) – Extension of the vdW interaction range.

Returns:

mol – RDKit Mol object

Return type:

rdkit.Chem.rdchem.Mol

pysoftk.tools.utils_rdkit.etkdgv3_energies(mol, num_conf=1)[source]

Calculate molecular configurations using the RDKit-ETKDG3 method.

Parameters:
  • mol (rdkit.Chem.Mol) – RDKit Mol object

  • num_conf (int) – The number of configurations requested to be computed.

Returns:

datapoint – RDKit Mol object

Return type:

rdkit.Chem.rdistGeom.EmbedMultipleConfs

pysoftk.tools.utils_rdkit.no_swap(mol, relax_iterations, force_field='MMFF')[source]
Function to sanitize a molecule with Hydrogens

and the user defined atomic place holder.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • force_field (str) – Selected FF to perform a relaxation

  • relax_iterations (int) – Number of iterations to perform a FF geometry optimization.

Returns:

newMol_H – RDKit Mol object

Return type:

rdkit.Chem.rdchem.Mol

pysoftk.tools.utils_rdkit.plc_holder(mol, atom)[source]

Function Seeking for a specific placeholder atom.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • atom (str) – The placeholder atom

Returns:

return – List of neighbors from the place holder atom.

Return type:

list

pysoftk.tools.utils_rdkit.remove_plcholder(mol, atom)[source]

Function to remove atom placeholder.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • atom (str) – The placeholder atom

Returns:

return – RDKit mol object.

Return type:

RDKit.object

pysoftk.tools.utils_rdkit.swap_hyd(mol, relax_iterations, atom, force_field='MMFF')[source]

Function to swap atomic place holders to Hydrogen atoms.

Parameters:
  • mol (rdkit.Chem.rdchem.Mol) – RDKit Mol object

  • relax_iterations (int) – Number of iterations to perform a FF geometry optimization.

  • atom (str) – The placeholder atom to combine the molecules and form a new monomer.

  • force_field (str) – Selected FF to perform a geometry optimization.

Returns:

newMol_H – RDKit Mol object

Return type:

rdkit.Chem.rdchem.Mol

Module contents