scm_molsg.Options

class scm_molsg.Options

This class is used to specify different settings for generating molecular and atomic hashes.

The class can be initialized with a python dictionary containing keywords and values corresponding to the following:

Keyword Arguments
  • max_depth (int) – a value to specify the maximum depth to traverse when constructing the atomic environments. In other words, this is the largest path length allowed between the central atom and any other atom used to construct the hash of the central atom. A value of -1 indicates that there is no limit on the depth (the entire molecule is considered).

  • implicit_hs (bool) – whether to include information about neighboring Hs in the hash for every atom. This will change the information included in the hashes for atoms at exactly max_depth distance away from the central atom. Without this argument set to true, the H’s would be one layer too far to be included in the hash.

  • ignore_hs (bool) – do not consider the hydrogen atoms when constructing the hash, other than as information in atomic valences. Note that no hash values will be returned for any Hydrogen atoms with this option set to true.

  • aromatic (bool) – Whether to include information in the hash about whether an atom is aromatic

  • ring_membership (bool) – Whether to include the number of rings an atom is part of in the hash

  • smallest_ring (bool) – Whether to include information about the smallest ring an atom is part of

  • env_strings (bool) – Whether to additionally construct human-readable descriptions of each atomic environment. These strings should also be usable as SMARTS.

  • atom_stereoRS (bool) – Whether to include R/S stereochemistry information in the atomic and molecular hashes. Note that this requires input of a 3D geometry or stereogenic SMILES.

  • atom_stereoALL (bool) – Whether to include additional information to distinguish coordination complexes, surface site geometries, and other differences in geometry.

  • bond_stereoEZ (bool) – Whether to include information about E/Z bonds in the hash.

  • bond_torsion (bool) – Whether to include generic torsions in the hash. Note this settings can be used to distinguish rotational conformers.

Example

In this example, we’ll compute the atomic hashes of 3-Aminophenol using a max_depth argument of 1 and 2. These two different options for constructing hashes result in some atoms being marked equivalent for max_depth=1 that will not be equivalent when max_depth=2

/scm-uploads/doc/molsg/_images/3-aminophenol.png

Fig. 1 3-Aminophenol

import scm_molsg as molsg

# make two options instances with differing max_depth arguments
opt1 = molsg.Options({"max_depth":1,'ignore_hs':True})
opt2 = molsg.Options({"max_depth":2, 'ignore_hs':True})

# instantiate two calculators with these two options
calc1 = molsg.CalcSG(opt1)
calc2 = molsg.CalcSG(opt2)

mol = molsg.Input.read_smiles("c1(O)cc(N)ccc1")

print("Calculator 1:")
calc1.calc_sg_hashes(mol)
for atom in mol.atoms:
    if atom.symbol == "H": continue
    print (f"Atom ({atom.symbol}), hash: {atom.hash}")

print("Calculator 2:")
calc2.calc_sg_hashes(mol)
for atom in mol.atoms:
    if atom.symbol == "H": continue
    print (f"Atom ({atom.symbol}), hash: {atom.hash}")
Calculator 1:
Atom (C), hash: 9348233001878490356
Atom (O), hash: 3352425570813969785
Atom (C), hash: 12708908489948740161
Atom (C), hash: 2707277583378347021
Atom (N), hash: 10378244383614633463
Atom (C), hash: 12708908489948740161
Atom (C), hash: 12708908489948740161
Atom (C), hash: 12708908489948740161
Calculator 2:
Atom (C), hash: 9939030674721167915
Atom (O), hash: 9882152943765284397
Atom (C), hash: 1720592189611779214
Atom (C), hash: 3231186285899757061
Atom (N), hash: 10369715150866500786
Atom (C), hash: 13072859615947709232
Atom (C), hash: 3629709972587466969
Atom (C), hash: 12353097390185768048

Methods

get(self: scm_molsg_internal.Options, arg0: str)Union[bool, int]

Returns the value of the requested option

Parameters

key (str) – the name of the option to access

Example

opt = molsg.Options()
print(opt.get("max_depth"))
-1
reset_defaults(self: scm_molsg_internal.Options)None

Resets all the options to their default values.

set(self: scm_molsg_internal.Options, arg0: str, arg1: Union[bool, int])None

Set one of the options to another value.

Parameters
  • key (str) – the name of the option to change

  • val – the new value for the option

Example

opt = molsg.Options()
opt.set("max_depth",3)
show_options(self: scm_molsg_internal.Options)None

Displays the options keywords, the current values, and the default values. This is a great way to get started with experimenting with the options class.