@@ -1768,9 +1768,13 @@ def _repr_png_(self):
17681768 os .unlink (temp_file_name )
17691769 return png
17701770
1771- def from_inchi (self , inchistr , backend = 'try-all ' , raise_atomtype_exception = True ):
1771+ def from_inchi (self , inchistr , backend = 'openbabel-first ' , raise_atomtype_exception = True ):
17721772 """
17731773 Convert an InChI string `inchistr` to a molecular structure.
1774+
1775+ RDKit and Open Babel are the two backends used in RMG. It is possible to use a
1776+ single backend or try different backends in sequence. The available options for the ``backend``
1777+ argument: 'openbabel-first'(default), 'rdkit-first', 'rdkit', or 'openbabel'.
17741778 """
17751779 translator .from_inchi (self , inchistr , backend , raise_atomtype_exception = raise_atomtype_exception )
17761780 return self
@@ -1782,9 +1786,13 @@ def from_augmented_inchi(self, aug_inchi, raise_atomtype_exception=True):
17821786 translator .from_augmented_inchi (self , aug_inchi , raise_atomtype_exception = raise_atomtype_exception )
17831787 return self
17841788
1785- def from_smiles (self , smilesstr , backend = 'try-all ' , raise_atomtype_exception = True ):
1789+ def from_smiles (self , smilesstr , backend = 'openbabel-first ' , raise_atomtype_exception = True ):
17861790 """
17871791 Convert a SMILES string `smilesstr` to a molecular structure.
1792+
1793+ RDKit and Open Babel are the two backends used in RMG. It is possible to use a
1794+ single backend or try different backends in sequence. The available options for the ``backend``
1795+ argument: 'openbabel-first'(default), 'rdkit-first', 'rdkit', or 'openbabel'.
17881796 """
17891797 translator .from_smiles (self , smilesstr , backend , raise_atomtype_exception = raise_atomtype_exception )
17901798 return self
@@ -1863,62 +1871,78 @@ def to_single_bonds(self, raise_atomtype_exception=True):
18631871 new_mol .update_atomtypes (raise_exception = raise_atomtype_exception )
18641872 return new_mol
18651873
1866- def to_inchi (self ):
1874+ def to_inchi (self , backend = 'rdkit-first' ):
18671875 """
18681876 Convert a molecular structure to an InChI string. Uses
18691877 `RDKit <http://rdkit.org/>`_ to perform the conversion.
18701878 Perceives aromaticity.
1871-
1879+
18721880 or
1873-
1881+
18741882 Convert a molecular structure to an InChI string. Uses
18751883 `OpenBabel <http://openbabel.org/>`_ to perform the conversion.
1884+
1885+ It is possible to use a single backend or try different backends in sequence.
1886+ The available options for the ``backend`` argument: 'rdkit-first'(default),
1887+ 'openbabel-first', 'rdkit', or 'openbabel'.
18761888 """
18771889 try :
1878- return translator .to_inchi (self )
1890+ return translator .to_inchi (self , backend = backend )
18791891 except :
18801892 logging .exception (f"Error for molecule \n { self .to_adjacency_list ()} " )
18811893 raise
18821894
1883- def to_augmented_inchi (self ):
1895+ def to_augmented_inchi (self , backend = 'rdkit-first' ):
18841896 """
18851897 Adds an extra layer to the InChI denoting the multiplicity
18861898 of the molecule.
1887-
1899+
18881900 Separate layer with a forward slash character.
1901+
1902+ RDKit and Open Babel are the two backends used in RMG. It is possible to use a
1903+ single backend or try different backends in sequence. The available options for the ``backend``
1904+ argument: 'rdkit-first'(default), 'openbabel-first', 'rdkit', or 'openbabel'.
18891905 """
18901906 try :
1891- return translator .to_inchi (self , aug_level = 2 )
1907+ return translator .to_inchi (self , backend = backend , aug_level = 2 )
18921908 except :
18931909 logging .exception (f"Error for molecule \n { self .to_adjacency_list ()} " )
18941910 raise
18951911
1896- def to_inchi_key (self ):
1912+ def to_inchi_key (self , backend = 'rdkit-first' ):
18971913 """
18981914 Convert a molecular structure to an InChI Key string. Uses
18991915 `OpenBabel <http://openbabel.org/>`_ to perform the conversion.
1900-
1901- or
1902-
1916+
1917+ or
1918+
19031919 Convert a molecular structure to an InChI Key string. Uses
19041920 `RDKit <http://rdkit.org/>`_ to perform the conversion.
1921+
1922+ It is possible to use a single backend or try different backends in sequence.
1923+ The available options for the ``backend`` argument: 'rdkit-first'(default),
1924+ 'openbabel-first', 'rdkit', or 'openbabel'.
19051925 """
19061926 try :
1907- return translator .to_inchi_key (self )
1927+ return translator .to_inchi_key (self , backend = backend )
19081928 except :
19091929 logging .exception (f"Error for molecule \n { self .to_adjacency_list ()} " )
19101930 raise
19111931
1912- def to_augmented_inchi_key (self ):
1932+ def to_augmented_inchi_key (self , backend = 'rdkit-first' ):
19131933 """
19141934 Adds an extra layer to the InChIKey denoting the multiplicity
19151935 of the molecule.
19161936
19171937 Simply append the multiplicity string, do not separate by a
19181938 character like forward slash.
1939+
1940+ RDKit and Open Babel are the two backends used in RMG. It is possible to use a
1941+ single backend or try different backends in sequence. The available options for the ``backend``
1942+ argument: 'rdkit-first'(default), 'openbabel-first', 'rdkit', or 'openbabel'.
19191943 """
19201944 try :
1921- return translator .to_inchi_key (self , aug_level = 2 )
1945+ return translator .to_inchi_key (self , backend = backend , aug_level = 2 )
19221946 except :
19231947 logging .exception (f"Error for molecule \n { self .to_adjacency_list ()} " )
19241948 raise
0 commit comments