Re: [Open Babel] retain identifier with InChI conversions

2023-07-07 Thread Noel O'Boyle
obabel -Hinchi lists the options. Read option 'n' will do it.

obabel -:"InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3 Noel" -iinchi -osmi -an
CCO Noel

More importantly, do not convert InChIs to SMILES without understanding the
caveats. InChI is not a storage format for chemical structures.

Regards,
Noel

On Fri, 7 Jul 2023 at 02:26, Francois Berenger  wrote:

> Dear Sivani,
>
> Maybe, put all the identifiers in a new file using shell commands:
>
> $ obabel input.inchi -O output.smi
> $ cut -f2 input.inchi > input.names
>
> If the obabel conversion doesn't remove any line, it should be safe
> to use the following unix command:
>
> $ paste output.smi input.names > named_output.smi
>
> Regards,
> F.
>
> On 29/06/2023 23:23, Sivani Baskaran via OpenBabel-discuss wrote:
> > Hello,
> >
> > I am trying to generate a SMILES notation from standardized InChIs. I
> > have a long list of chemicals and would like to retain an identifier
> > in the output file like you do when parsing other conversions.
> >
> > I've tried a few different ways of doing this based on the
> > documentation, but the identifier is never included in the output
> > file.
> >
> > System/Version: Windows 11, CL Open Babel 3.1.1
> >
> > Goal: Convert an InChI file with InChI followed by the name or a
> > number of a chemical to a .smi file with the SMILES and the identifier
> > (name/integer) for a set of chemicals.
> >
> > Failed attempts:
> > * obabel "./substances.inchi" -O "./substances.SMI"
> > * obabel "./substances.inchi" -O "./substances.SMI" -n
> > * obabel -i inchi "./substances.inchi" -o smi -O "./substances.SMI"
> > * obabel -i inchi "./substances.inchi" -o smi -O "./substances.SMI" -n
> > * obabel -i inchi "./substances.inchi" -n -o smi -O "./substances.SMI"
> >
> > Contents of "substances.inchi" (also attached)
> > InChI=1S/C6H4ClNO2/c7-5-1-3-6(4-2-5)8(9)10/h1-4Hname
> > InChI=1S/C6H6N2O2/c7-5-1-3-6(4-2-5)8(9)10/h1-4H,7H2 another, name
> > InChI=1S/C6H5NO3/c8-6-3-1-5(2-4-6)7(9)10/h1-4,8H3
> > InChI=1S/C6H5ClO2S/c7-5-1-3-6(4-2-5)10(8)9/h1-4H,(H,8,9)name-2
> >
> > What I want the output to look like:
> > c1cc(ccc1Cl)N(=O)=O name
> > c1cc(ccc1N)N(=O)=O  another, name
> > c1cc(ccc1N(=O)=O)O  3
> > c1cc(ccc1Cl)S(=O)O  name-2
> >
> > How can I ensure the output will also have the identifier without
> > resorting to having an individual InChI file for each chemical? Please
> > note, all my identifiers are integers, but for testing purposes I
> > included text string examples.
> >
> > Thanks,
> > Sivani
> > The confidentiality or integrity of this message can not be guaranteed
> > following transmission on the Internet. The addressee should be aware
> > of this before using the contents of this message.
> >
> > ___
> > OpenBabel-discuss mailing list
> > OpenBabel-discuss@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Prevent addition of H during minimization

2023-03-31 Thread Noel O'Boyle
Hi Hetal,

As I always comment, "OB is not adding hydrogens. The hydrogens are already
there, just implicit." That is, your original MOL file is in fact Li(OH)2
(but you can't tell that unless you are familiar with the MOL file spec).

How are you creating the input file? Is there a way to set the valence? You
need to set the valence for the oxygens to force them to valence 1 (Roman
capital I), otherwise there's an implicit H.

Otherwise, just manually edit the file so that it looks something like:

  3  2  0  0  0  0  0  0  0  0999 V2000
0.0.0. Li  0  0  0  0  0  0  0  0  0  0  0  0
0.0.0. O   0  0  0  0  0  1  0  0  0  0  0  0
0.0.0. O   0  0  0  0  0  1  0  0  0  0  0  0
  1  2  1  0  0  0  0
  1  3  1  0  0  0  0
M  END

Regards,
Noel

On Fri, 31 Mar 2023 at 15:43, Hetal Patel  wrote:

> Hi,
>
> I am trying to use minimization feature using uff but it is adding
> hydrogens to fill the shell. How do I prevent from addition of any
> additional atoms beyond what is in the input file.
>
> Here is a same input and the command I am using.
>
> Input.mol
>
>
>
>
> 3  2   0  0  0  0  0  0  0  0999 V2000
> 0.   -0.   -0. Li   0  0  0  0  0  0  0  0  0  0  0  0
> 0.4622   -0.2286   -0.0600 O0  0  0  0  0  0  0  0  0  0  0  0
>-0.44340.21930.0576 O0  0  0  0  0  0  0  0  0  0  0  0
>  1 2  1  0  0  0  0
>  1 3  1  0  0  0  0
> M  END
>
> Command: obabel input.mol -O output.mol --minimize --steps 1 --sd --ff
> uff
>
>
> output.mol:
>
>
>  OpenBabel03302314253D
>
>   5  4  0  0  0  0  0  0  0  0999 V2000
>-0.0207   -0.0375   -0.0870 Li  0  0  0  0  0  0  0  0  0  0  0  0
> 1.7549   -0.3412   -0.5469 O   0  0  0  0  0  0  0  0  0  0  0  0
>-1.79570.26680.3744 O   0  0  0  0  0  0  0  0  0  0  0  0
> 2.27200.23590.0697 H   0  0  0  0  0  0  0  0  0  0  0  0
>-1.78700.32811.3627 H   0  0  0  0  0  0  0  0  0  0  0  0
>   1  2  1  0  0  0  0
>   1  3  1  0  0  0  0
>   2  4  1  0  0  0  0
>   3  5  1  0  0  0  0
> M  END
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] extracting ligands from macromolecular structures

2023-03-04 Thread Noel O'Boyle
Also OBMol::CopySubstructure as described at
https://baoilleach.blogspot.com/2018/05/when-all-you-want-is-ring.html and
https://openbabel.github.io/api/3.0/classOpenBabel_1_1OBMol.shtml#a3271860ee44de0d38a27102c79913b1b
. Should be quite a bit faster I would think.

On Fri, 3 Mar 2023, 14:19 Richard Overstreet, 
wrote:

> Hi Tim,
>
> Deleting residues can be tricky. I've found the following to work well.
>
> from openbabel import openbabel
> obconversion = openbabel.OBConversion()
> obconversion.SetInAndOutFormats("pdb", "pdb")
> mol = openbabel.OBMol()
> path = obconversion.ReadFile(mol, 'demo.pdb')
>
> non_lig_atoms=[]
>
> for i in range(mol.NumAtoms()):
> atom=mol.GetAtom(i+1)
> resname=atom.GetResidue().GetName()
> if resname != 'LIG':
> print(resname)
> non_lig_atoms.append(atom)
>
> for atom in non_lig_atoms:
> mol.DeleteAtom(atom)
>
> obconversion.WriteFile(mol,'nolig_demo.pdb')
>
> $ cat demo.pdb
> ATOM  1  N   ALA A   1  -0.525   1.362   0.000  1.00
> 0.00   N
> ATOM  2  CA  ALA A   1   0.000   0.000   0.000  1.00
> 0.00   C
> ATOM  3  C   ALA A   1   1.520   0.000   0.000  1.00
> 0.00   C
> ATOM  4  O   ALA A   1   2.152   0.808  -0.678  1.00
> 0.00   O
> ATOM  5  CB  ALA A   1  -0.507  -0.774  -1.206  1.00
> 0.00   C
> ATOM  6  O   LIG A   2   4.957  -2.553  -0.341  1.00
> 0.00   O
> ATOM  7  N   LIG A   2   2.116  -0.911   0.764  1.00
> 0.00   N
> ATOM  8  CB  LIG A   2   4.075  -0.753   2.287  1.00
> 0.00   C
> ATOM  9  CA  LIG A   2   3.571  -1.003   0.842  1.00
> 0.00   C
> ATOM 10  C6  LIG A   2   5.566  -0.553   2.346  1.00
> 0.00   C
> ATOM 11  C7  LIG A   2   6.420  -1.538   2.843  1.00
> 0.00   C
> ATOM 12  C8  LIG A   2   6.121   0.622   1.833  1.00
> 0.00   C
> ATOM 13  C   LIG A   2   3.965  -2.393   0.368  1.00
> 0.00   C
> ATOM 14  C10 LIG A   2   7.800  -1.358   2.825  1.00
> 0.00   C
> ATOM 15  C11 LIG A   2   7.500   0.804   1.811  1.00
> 0.00   C
> ATOM 16  C12 LIG A   2   8.342  -0.187   2.305  1.00
> 0.00   C
> ATOM 17  N   ALA A   3   3.188  -3.399   0.759  1.00
> 0.00   N
> ATOM 18  CA  ALA A   3   3.470  -4.776   0.365  1.00
> 0.00   C
> ATOM 19  C   ALA A   3   3.451  -4.925  -1.148  1.00
> 0.00   C
> ATOM 20  O   ALA A   3   3.668  -6.018  -1.670  1.00
> 0.00   O
> ATOM 21  CB  ALA A   3   2.461  -5.731   0.981  1.00
> 0.00   C
> ATOM 22  OXT ALA A   3   3.219  -3.956  -1.868  1.00
> 0.00   O
> TER  23  ALA A
> 3
> END
>
> The trick is to store a list of atoms to delete. This way is the more
> stable.
> On 3/3/23 03:34, Tim Dudgeon wrote:
>
> I'm trying to work out how to use openbabel from Python to perform
> operations such as extracting out ligands from macromolecules in PDB or CIF
> format. For instance, if I have a ligand that has the residue name of LIG,
> how do I create a new molecule with just that ligand so that I can write it
> out in, for instance, molfile format.
>
> If found that I can iterate through the residues and filter them with
> something like this:
>
> for obres in openbabel.OBResidueIter(obmol_from_cif_file):
> if obres.GetName() == 'LIG':
> print('ligand res')
> else:
> print('other res')
>
> But it's not clear to me how to create a new mol or to delete the residues
> I don't want. If I just use obmol_from_cif_file.DeleteResidue(obres) I
> end up getting a Segmentation fault.
>
> Thanks
> Tim
>
>
>
> ___
> OpenBabel-discuss mailing 
> listOpenBabel-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Explicit H as property

2023-02-22 Thread Noel O'Boyle
Indeed - Andrew's approach is all you can do at the moment. I've often
thought it would be a useful option to add, and just a one or two line
change to the C++ (just skip the part where the "organic subset" is treated
as special).

Regarding SMARTS, given that "CC" is also a valid SMARTS that would match
the SMILES "CC", it sounds like you want a bespoke conversion solution. But
either way, it's not available as an option.

Regards,
Noel

On Wed, 22 Feb 2023 at 11:06, Thomas  wrote:

> Thank you Andrew, your script does the job.
>
> Apparently, this was the original behaviour of OB back in 2011, then it
> has been preferred to write H as atoms instead (
> https://sourceforge.net/p/openbabel/mailman/message/26960761/).
>
> I would include your script under GPL license if you don't mind.
> Thank you
>
> Il giorno mer 22 feb 2023 alle ore 11:12 Andrew Dalke <
> da...@dalkescientific.com> ha scritto:
>
>> On Feb 21, 2023, at 19:23, Thomas  wrote:
>> > Is it possible to get SMILES with explicit hydrogens as a "property" of
>> another atom?
>> > For example from the SMILES "CC" I'd like to get '[CH3][CH3]' instead
>> of '[H]C(C([H])([H])[H])([H])[H]'
>>
>> I don't see a direct way to do it.
>>
>> I wrote to_H_smiles() at
>> https://paste.sr.ht/~dalke/8f51a0df8b37585010ca38b54a337f4efbec8667
>> which I think does what you want.
>>
>> In short, I add an atom class to each atom, generate the SMILES with the
>> 'a' option to include the atom class. As a side-effect, this also include
>> the H3 terms you're looking for. I then post-process the output SMILES to
>> adjust the atom classes, either to remove them (if the original atom didn't
>> have an atom class) or to use the original input value.
>>
>> > Furthermore, is it possible to generate SMARTS? For example from "CC"
>> I'd like to get '[#6]-[#6]'
>>
>> I don't know of one, though that doesn't mean there isn't one.
>>
>>
>> Andrew
>> da...@dalkescientific.com
>>
>>
>> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Avoid sanitization

2023-02-22 Thread Noel O'Boyle
Ah ok. Just a note that you can fragment the actual structure with Open
Babel and you will get the same results. There's a page in the docs on
this:
https://open-babel.readthedocs.io/en/latest/Aromaticity/Aromaticity.html.

On Tue, 21 Feb 2023 at 18:05, Thomas  wrote:

> Thank you Noel, the -a option solved my issue.
>
> I made a program that fragments molecular structures by fragmenting the
> SMILES string instead of the actual structure. Therefore, the resulting
> SMILES fragments can be a bit messed up, still I want them to match the
> original structure.
> Furthermore, the SMILES that I use as input are already processed by a
> chemical platform (called Vega), so for consistency sake I should not
> modify the information.
>
> Il giorno dom 19 feb 2023 alle ore 18:32 Noel O'Boyle <
> baoille...@gmail.com> ha scritto:
>
>> It would be useful to know what problem you are trying to solve here.
>>
>> OB does not support canonical Kekule SMILES, if you expect different
>> resonance forms to give the same canonical Kekule SMILES. Of course, you
>> can just write out an canonical aromatic SMILES, read it back in, and then
>> write it out in Kekule form (no need for canonical option).
>>
>> Regarding the second question, I don't know where you got that SMILES
>> from, but if you go to https://www.simolecule.com/cdkdepict/depict.html,
>> and paste the SMILES into the SMILES box, and the SMARTS pattern into the
>> SMARTS box, you will not see a match either. Both software by default apply
>> the Daylight aromaticity model (as best they can) leading to the bridging O
>> and C being aromatic.
>>
>> $ obabel -:"O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)" -osmi
>> O=C(NCCN(C)C)c12c(=O)c3c3oc12
>>
>> Note the lowercase 'o' and 'c' - this is why the SMARTS won't match. I
>> don't recommend it unless you know what you're doing, but OB can preserve
>> whatever aromaticity is in the input using the "a" input option to SMILES:
>>
>> $ obabel -:"O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)" -osmi -aa
>> O=C(NCCN(C)C)c12C(=O)c3c3Oc12
>>
>> Note that the uppercase 'O' and 'C' is preserved. Here's proof that it
>> matches the SMARTS:
>>
>> $ obabel -:"O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)" -s
>> "c12Cc3c3(Oc12)" -osmi
>> 0 molecules converted
>> $ obabel -:"O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)" -s
>> "c12Cc3c3(Oc12)" -osmi -aa
>> O=C(NCCN(C)C)c12C(=O)c3c3Oc12
>>
>> Regards,
>> Noel
>>
>>
>>
>> On Fri, 17 Feb 2023 at 18:50, Thomas  wrote:
>>
>>> Thank you Noel.
>>> I wanted to get the canonical SMILES, without changing the aromaticity
>>> of the input SMILES:
>>>
>>> mol = pybel.readstring('smi',
>>> 'O=C(NCCN(C)C)C1=CC=CN2C(=O)c3c3(N=C12)')
>>> mol.write(opt={"k": True, 'c':True})
>>> 'CN(CCNC(=O)C1=CC=CN2C1=NC1C=CC=CC=1C2=O)C\t\n'
>>> mol.write(opt={'c':True})
>>> 'CN(CCNC(=O)c1cccn2c1nc1c1c2=O)C\t\n'
>>>
>>> Furthermore, can you explain me this:
>>>
>>> mol = pybel.readstring('smi', "O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)")
>>> sma = pybel.Smarts("c12Cc3c3(Oc12)")
>>> sma.obsmarts.Match(mol.OBMol, True)
>>> False
>>>
>>> Thank you again
>>> Thomas
>>>
>>> Il giorno ven 17 feb 2023 alle ore 18:37 Noel O'Boyle <
>>> baoille...@gmail.com> ha scritto:
>>>
>>>> Hi Thomas,
>>>>
>>>> OB does not sanitize molecules when reading from SMILES (or any other
>>>> format). By default it writes aromatic SMILES though, but it sounds like
>>>> you want Kekule SMILES - see the obabel -Hsmi for the list of options. In
>>>> this case you want 'k':
>>>>
>>>> $ obabel -:"O=C1C=COC(=C1(O))C" -xk -osmi
>>>> O=C1C=COC(=C1O)C
>>>>
>>>> In Python, this is something like mol.write(opt={"k:" True}).
>>>>
>>>> Neither does it add Hs. A SMILES string exactly specifies the number of
>>>> Hs on each atom; this is preserved on reading/writing. If you could provide
>>>> information on a specific case, we could explain what's happening more
>>>> clearly.
>>>>
>>>> Regards
>>>> Noel
>>>>
>>>>
>>>> On Fri, 17 Feb 2023 at 16:18, Thomas  wrote:
>>>>
>>>>> Is there an option to avoid sanitization of 

Re: [Open Babel] Avoid sanitization

2023-02-19 Thread Noel O'Boyle
It would be useful to know what problem you are trying to solve here.

OB does not support canonical Kekule SMILES, if you expect different
resonance forms to give the same canonical Kekule SMILES. Of course, you
can just write out an canonical aromatic SMILES, read it back in, and then
write it out in Kekule form (no need for canonical option).

Regarding the second question, I don't know where you got that SMILES from,
but if you go to https://www.simolecule.com/cdkdepict/depict.html, and
paste the SMILES into the SMILES box, and the SMARTS pattern into the
SMARTS box, you will not see a match either. Both software by default apply
the Daylight aromaticity model (as best they can) leading to the bridging O
and C being aromatic.

$ obabel -:"O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)" -osmi
O=C(NCCN(C)C)c12c(=O)c3c3oc12

Note the lowercase 'o' and 'c' - this is why the SMARTS won't match. I
don't recommend it unless you know what you're doing, but OB can preserve
whatever aromaticity is in the input using the "a" input option to SMILES:

$ obabel -:"O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)" -osmi -aa
O=C(NCCN(C)C)c12C(=O)c3c3Oc12

Note that the uppercase 'O' and 'C' is preserved. Here's proof that it
matches the SMARTS:

$ obabel -:"O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)" -s
"c12Cc3c3(Oc12)" -osmi
0 molecules converted
$ obabel -:"O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)" -s
"c12Cc3c3(Oc12)" -osmi -aa
O=C(NCCN(C)C)c12C(=O)c3c3Oc12

Regards,
Noel



On Fri, 17 Feb 2023 at 18:50, Thomas  wrote:

> Thank you Noel.
> I wanted to get the canonical SMILES, without changing the aromaticity of
> the input SMILES:
>
> mol = pybel.readstring('smi', 'O=C(NCCN(C)C)C1=CC=CN2C(=O)c3c3(N=C12)')
> mol.write(opt={"k": True, 'c':True})
> 'CN(CCNC(=O)C1=CC=CN2C1=NC1C=CC=CC=1C2=O)C\t\n'
> mol.write(opt={'c':True})
> 'CN(CCNC(=O)c1cccn2c1nc1c1c2=O)C\t\n'
>
> Furthermore, can you explain me this:
>
> mol = pybel.readstring('smi', "O=C(NCCN(C)C)c12C(=O)c3c3(Oc12)")
> sma = pybel.Smarts("c12Cc3ccccc3(Oc12)")
> sma.obsmarts.Match(mol.OBMol, True)
> False
>
> Thank you again
> Thomas
>
> Il giorno ven 17 feb 2023 alle ore 18:37 Noel O'Boyle <
> baoille...@gmail.com> ha scritto:
>
>> Hi Thomas,
>>
>> OB does not sanitize molecules when reading from SMILES (or any other
>> format). By default it writes aromatic SMILES though, but it sounds like
>> you want Kekule SMILES - see the obabel -Hsmi for the list of options. In
>> this case you want 'k':
>>
>> $ obabel -:"O=C1C=COC(=C1(O))C" -xk -osmi
>> O=C1C=COC(=C1O)C
>>
>> In Python, this is something like mol.write(opt={"k:" True}).
>>
>> Neither does it add Hs. A SMILES string exactly specifies the number of
>> Hs on each atom; this is preserved on reading/writing. If you could provide
>> information on a specific case, we could explain what's happening more
>> clearly.
>>
>> Regards
>> Noel
>>
>>
>> On Fri, 17 Feb 2023 at 16:18, Thomas  wrote:
>>
>>> Is there an option to avoid sanitization of a molecule when reading from
>>> SMILES?
>>> For example I'd like the SMILES to remain unchanged if I read and write
>>> it:
>>>
>>> mol = pybel.readstring('smi', 'O=C1C=COC(=C1(O))C')
>>> mol.write()
>>> O=c1ccoc(c1O)C
>>>
>>> Beside kekulization issues, other unwanted sanitizations are the
>>> addition of Hs if I generate the molecule from SMILES fragments (partial
>>> SMILES)
>>>
>>> Thank you
>>> Thomas
>>> ___
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Avoid sanitization

2023-02-17 Thread Noel O'Boyle
Hi Thomas,

OB does not sanitize molecules when reading from SMILES (or any other
format). By default it writes aromatic SMILES though, but it sounds like
you want Kekule SMILES - see the obabel -Hsmi for the list of options. In
this case you want 'k':

$ obabel -:"O=C1C=COC(=C1(O))C" -xk -osmi
O=C1C=COC(=C1O)C

In Python, this is something like mol.write(opt={"k:" True}).

Neither does it add Hs. A SMILES string exactly specifies the number of Hs
on each atom; this is preserved on reading/writing. If you could provide
information on a specific case, we could explain what's happening more
clearly.

Regards
Noel


On Fri, 17 Feb 2023 at 16:18, Thomas  wrote:

> Is there an option to avoid sanitization of a molecule when reading from
> SMILES?
> For example I'd like the SMILES to remain unchanged if I read and write it:
>
> mol = pybel.readstring('smi', 'O=C1C=COC(=C1(O))C')
> mol.write()
> O=c1ccoc(c1O)C
>
> Beside kekulization issues, other unwanted sanitizations are the addition
> of Hs if I generate the molecule from SMILES fragments (partial SMILES)
>
> Thank you
> Thomas
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Writer Format - WLN Writer + Reader Functionality Expansion

2022-06-20 Thread Noel O'Boyle
I should add that I'm very much looking forward to this addition!

On Mon, 20 Jun 2022, 15:21 Noel O'Boyle,  wrote:

> Hi Michael,
>
> Just submit a pull request. To do this, your code changes should made to a
> fork of the project on github. We can then give feedback there.
>
> Regards,
> Noel
>
> On Mon, 20 Jun 2022, 14:57 Michael Blakey via OpenBabel-discuss, <
> openbabel-discuss@lists.sourceforge.net> wrote:
>
>> Hi There,
>>
>> I have made changes to Rogers code to expand the WLN reader capabilities
>> to cover significantly more of the language space. I have also created a
>> Writer that will go from Mol object to WLN notation and would like to add
>> the ‘win’ format to obconversion following publication of the work.
>>
>> What is the best way to submit these to OpenBabel for unit testing and
>> hopefully release?
>>
>> Michael Blakey
>> University of Southampton
>> Placement student of NextMove Software
>>
>> ___
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Writer Format - WLN Writer + Reader Functionality Expansion

2022-06-20 Thread Noel O'Boyle
Hi Michael,

Just submit a pull request. To do this, your code changes should made to a
fork of the project on github. We can then give feedback there.

Regards,
Noel

On Mon, 20 Jun 2022, 14:57 Michael Blakey via OpenBabel-discuss, <
openbabel-discuss@lists.sourceforge.net> wrote:

> Hi There,
>
> I have made changes to Rogers code to expand the WLN reader capabilities
> to cover significantly more of the language space. I have also created a
> Writer that will go from Mol object to WLN notation and would like to add
> the ‘win’ format to obconversion following publication of the work.
>
> What is the best way to submit these to OpenBabel for unit testing and
> hopefully release?
>
> Michael Blakey
> University of Southampton
> Placement student of NextMove Software
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Run obabel with n cpu cores?

2022-02-28 Thread Noel O'Boyle
See also using GNU parallel in combo with obabel. Some starting points on
my blog and in comments:
https://baoilleach.blogspot.com/2013/11/got-cpus-to-burn-put-em-to-work-with.html

When I need to do this myself these days I just use multiprocessing and
Python.

On Mon, 28 Feb 2022 at 00:50, Francois Berenger  wrote:

> On 28/02/2022 05:45, Rudy Richardson wrote:
> > 1. Is there a straightforward way to run obabel with n cpu cores?
>
> Straightforward, I am not sure.
>
> However, there are several ways:
> - xargs and its -L option
> - https://github.com/UnixJunkie/PAR
> - https://github.com/UnixJunkie/pardi
>
> If you show us the obabel command you want to use, plus an example
> input file, we might give you a runable example.
>
> >
> > 2. What about obabel on GPUs?
> >
> > Thanks.
> >
> > -- Rudy
> > ___
> > OpenBabel-discuss mailing list
> > OpenBabel-discuss@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] count chiral centers

2022-01-25 Thread Noel O'Boyle
See also the docs at
https://open-babel.readthedocs.io/en/latest/Stereochemistry/stereo.html.

On Mon, 24 Jan 2022 at 23:28, Richard Overstreet 
wrote:

> You could do something like this in python. Not sure how reliable this is
> but it is a start. This could also be ported over to c++ too.
>
> from openbabel import openbabel
>
> obconversion = openbabel.OBConversion()
> obconversion.SetInAndOutFormats("xyz", "xyz")
> mol = openbabel.OBMol()
> obconversion.ReadFile(mol, "demo.xyz")
>
> N_chiral=0
>
> mol_atoms = openbabel.OBMolAtomIter(mol)
> for atom in mol_atoms:
> if atom.IsChiral():
> N_chiral += 1
>
> print(N_chiral)
>
>
> Best,
>
> Richard
> On 1/24/22 04:20, Jan Hummel via OpenBabel-discuss wrote:
>
> Dear OpenBabel team!
>
>
>
> How do I calculate the number of chiral centers in OpenBabel and OBDotNet?
>
>
>
> I found a ‘obchiral’ command line tool in an earlier OpenBabel version,
> but it seems to not be distributed anymore?
>
>
>
> Thank you very much for a short answer!
>
> Best regards,
>
> Jan Hummel
>
>
> ___
> OpenBabel-discuss mailing 
> listOpenBabel-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] openbabel python binding for macOS

2021-11-17 Thread Noel O'Boyle
If no one here knows, ask whoever is responsible for that package.

On Mon, 15 Nov 2021, 20:03 Alan,  wrote:

> Hi there,
>
> Ok,
>
> brew install open-babel
>
> got me obabel, but I need the python openbabel. How to get it?
>
> thanks in advance
> --
> Alan
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Alternative to UsetPartialChargesPerceived() in 3.x

2021-09-16 Thread Noel O'Boyle
Hi Stefano,

Most of the changes in 3.0 are described at
https://open-babel.readthedocs.io/en/latest/UseTheLibrary/migration.html#molecule-atom-and-bond-flags.
In short, OBMol::SetPartialChargesPerceived(false). The rationale for this
change is described at https://github.com/openbabel/openbabel/pull/1951.

Regards,
Noel


On Wed, 15 Sept 2021 at 18:11, Stefano Forli  wrote:

> Hi,
>
> I'm cleaning up some of our code that was written for v.2 and I found
> something I don't know how to port to the new version.
> When assigning Gasteiger charges, it was possible to force the
> recalculation from scratch for molecules that already had charges by using
> the method OBMol::UnsetPartialChargesPerceived()
>
> The method is still listed in the comments in molchrg.cpp, but it's not in
> the OBMol anymore.
> I've tried looking for alternatives, possibly using the OBMol::UnsetFlag()
> method, but no luck.
>
> Any suggestions?
>
> Thank you!
>
> S
>
>
> --
>
>   Stefano Forli, PhD
>
>   Associate Professor
>   Dept. of Integrative Structural
>   and Computational Biology, MB-112A
>   Scripps Research
>   10550  North Torrey Pines Road
>   La Jolla,  CA 92037-1000,  USA.
>
>  tel: +1 (858)784-2055
>  email: fo...@scripps.edu
>  https://forlilab.org
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] split multi-molecule structure into single-molecules

2021-08-28 Thread Noel O'Boyle
Hi Jan,

Please don't use InChIs to store the structure, but rather as an identifier
that can be derived from the structure.

The easiest way to split the structure is to split on the dot in a SMILES
string. If you have salt forms that you want to retain you'll have to do a
bit more work to identify and keep these.

Regards,
Noel

On Fri, 27 Aug 2021, 15:26 Jan Hummel via OpenBabel-discuss, <
openbabel-discuss@lists.sourceforge.net> wrote:

> Dear OpenBabel team!
>
> Please consider PubChem Comound with ID 74935604
> https://pubchem.ncbi.nlm.nih.gov/compound/74935604
>
> The InChI reads as
>
> InChI=1S/C21H30O2.C11H16O2/c1-5-6-7-8-15-12-18(22)20-16-11-14(2)9-10-17(16)2
>
> 1(3,4)23-19(20)13-15;1-2-3-4-5-9-6-10(12)8-11(13)7-9/h11-13,16-17,22H,5-10H2
> ,1-4H3;6-8,12-13H,2-5H2,1H3
>
> My problem at hand is that we compiled a database of compounds where some
> of
> them are actually two molecules as shown in the example above.
> Is there any API in OpenBabel to recognize those compounds and even extract
> the different parts of a molecule into two separate molecules?
>
> Any help is welcome.
> I appreciate your time and effort!
> Best regards,
> Jan Hummel
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Validating a SMILES string

2021-08-27 Thread Noel O'Boyle
Hi Anonymous,

There is a one-line change source change that governs this behaviour, and
it's one that I've changed in the past, and maybe it should be an option.
If you have compiled Open Babel yourself, all you need to do is change
"return true" to "return false" in the right place.

The thing is, if this is set to "return false", then if you are converting
a million SMILES strings and the conversion fails on the 1000th SMILES
string, then at the command-line you will end up with only 1000 strings in
the output. What you actually want is a million lines, where one of the
lines is blank (or blank+title). The current behaviour is designed to make
this use case work.

If you want to know if there is an error when converting the SMILES string,
you just need to check the log before and after (I think that you can ask
for the number of errors).

I don't know the source of these SMILES strings, but if you want to check
whether the valence is chemically reasonable the code at
https://baoilleach.blogspot.com/2018/04/finding-texas-carbons-and-other-unusual.html
may be a useful starting point (you will need to port to OB3).

Regards,
Noel




On Fri, 27 Aug 2021 at 07:35,  wrote:

>
> Hi,
>
> I want to use openbabel to validate a SMILES string. I tried this:
>
> 
> #!/usr/bin/env python3
> from openbabel import openbabel
>
> mol = openbabel.OBMol()
> obConversion = openbabel.OBConversion()
> obConversion.SetInFormat('smi')
>
> # case_1: success is True
> success = obConversion.ReadString(mol, 'CC((CC')
> print(' success:', success)
>
> # case_2: success is False
> success = obConversion.ReadString(mol, 'CC((CCX')
> print(' success:', success)
> 
>
> The return value success is True for case_1, False for case_2.
> I was expecting success to be False in both cases,
> since both do not represent a valid SMILES string.
>
> I assume this is not the correct way to verify a SMILES string?
> Is there another way?
>
> Thanks in advance.
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Hide "Open Babel Error" error messages in openbabel/python

2021-08-26 Thread Noel O'Boyle
Sorry. Just noticed you did this. To disable messaging entirely, try
StopLogging().

On Thu, 26 Aug 2021, 15:24 Noel O'Boyle,  wrote:

> That code creates a new message handler. You want to get the existing
> message handler and change the settings. It's at openbabel.obErrorLog.
>
> On Thu, 26 Aug 2021, 14:07 ,  wrote:
>
>>
>> Hi,
>>
>> I want to use openbabel conversion in python like shown below.
>> But I do not want to get an error message thrown like this,
>> instead I can use the value of the success varible.
>>
>> > ./mwe.py
>> ==
>> *** Open Babel Error  in ParseSimple
>>   SMILES string contains a character 'X' which is invalid
>>
>>
>> I already tried to set the OutputLevel, but this is not working.
>> Whant can I do?
>>
>> TIA.
>>
>> 
>> #!/usr/bin/env python3
>> from openbabel import openbabel
>>
>> ob_log_handler = openbabel.OBMessageHandler()
>> ob_log_handler.SetOutputLevel(0)
>> openbabel.cvar.obErrorLog.SetOutputLevel(0)  # also tested this
>>
>> mol = openbabel.OBMol()
>> obConversion = openbabel.OBConversion()
>> obConversion.SetInAndOutFormats('smi', 'can')
>> success = obConversion.ReadString(mol, 'X')
>>
>> ___
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Hide "Open Babel Error" error messages in openbabel/python

2021-08-26 Thread Noel O'Boyle
That code creates a new message handler. You want to get the existing
message handler and change the settings. It's at openbabel.obErrorLog.

On Thu, 26 Aug 2021, 14:07 ,  wrote:

>
> Hi,
>
> I want to use openbabel conversion in python like shown below.
> But I do not want to get an error message thrown like this,
> instead I can use the value of the success varible.
>
> > ./mwe.py
> ==
> *** Open Babel Error  in ParseSimple
>   SMILES string contains a character 'X' which is invalid
>
>
> I already tried to set the OutputLevel, but this is not working.
> Whant can I do?
>
> TIA.
>
> 
> #!/usr/bin/env python3
> from openbabel import openbabel
>
> ob_log_handler = openbabel.OBMessageHandler()
> ob_log_handler.SetOutputLevel(0)
> openbabel.cvar.obErrorLog.SetOutputLevel(0)  # also tested this
>
> mol = openbabel.OBMol()
> obConversion = openbabel.OBConversion()
> obConversion.SetInAndOutFormats('smi', 'can')
> success = obConversion.ReadString(mol, 'X')
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Adding Hydrogen During Confab

2021-08-23 Thread Noel O'Boyle
The bond orders may not have been guessed correctly. I suggest you open the
sdf in Avogadro (for example) and check the structure.

On Mon, 23 Aug 2021, 15:24 Kevin Skinner,  wrote:

> I used Open Babel  to convert an XYZ file to an SDF file. Both contained
> 27 atoms. After using confab, the outputs contain 28 atoms. I am not
> familiar with SDF files, so do you have any suggestions as to where
> something might be wrong?
>
> - Kevin
>
> On Mon, Aug 23, 2021 at 9:51 AM Noel O'Boyle  wrote:
>
>> Which means that there is something wrong with your input. Or rather,
>> your input is not what you think it is. Take a look at that atom in the SDF
>> and see if you can figure it out.
>>
>> Regards,
>> Noel
>>
>> On Wed, 18 Aug 2021 at 22:25, Kevin Skinner  wrote:
>>
>>> Using an SDF file as the input did not correct the issue.
>>>
>>> - Kevin
>>>
>>> On Wed, Aug 18, 2021 at 5:17 PM Noel O'Boyle 
>>> wrote:
>>>
>>>> Ah OK. Try an sdf file, and then there will be no need for OB to guess
>>>> anything.
>>>>
>>>> On Wed, 18 Aug 2021, 21:50 Kevin Skinner,  wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> Thanks for the response. I already have all of the hydrogens that are
>>>>> present in the structure. Confab is adding an extra hydrogen because it
>>>>> thinks there should be one. Typically it does so in between, but over a
>>>>> bond (like a triangle). Is there a sway to approach this? If not, then
>>>>> would the sampling still be correct and I would just need to remove it 
>>>>> from
>>>>> all of the structures?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Kevin
>>>>>
>>>>> On Wed, Aug 18, 2021 at 3:47 PM Noel O'Boyle 
>>>>> wrote:
>>>>>
>>>>>> Hi Kevin,
>>>>>>
>>>>>> Working as intended. The forcefields and QM calculations require
>>>>>> explicit hydrogens to correctly calculate the energy. It's trivial to
>>>>>> remove the H afterwards, but this would be a bit unusual so think it 
>>>>>> over.
>>>>>>
>>>>>> Regards,
>>>>>> Noel
>>>>>>
>>>>>> On Wed, 18 Aug 2021 at 16:25, Kevin Skinner 
>>>>>> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am using confab to generate conformers, but while doing so it adds
>>>>>>> a hydrogen to the structure. I have used the iQMol optimizer, PM3, and 
>>>>>>> DFT
>>>>>>> for the optimizations and all have the same issue. I have tried using 
>>>>>>> both
>>>>>>> XYZ and MOL2 inputs. Is there a way to avoid this issue?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Kevin
>>>>>>>
>>>>>> ___
>>>>>>> OpenBabel-discuss mailing list
>>>>>>> OpenBabel-discuss@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>>>>>
>>>>>>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Adding Hydrogen During Confab

2021-08-23 Thread Noel O'Boyle
Which means that there is something wrong with your input. Or rather, your
input is not what you think it is. Take a look at that atom in the SDF and
see if you can figure it out.

Regards,
Noel

On Wed, 18 Aug 2021 at 22:25, Kevin Skinner  wrote:

> Using an SDF file as the input did not correct the issue.
>
> - Kevin
>
> On Wed, Aug 18, 2021 at 5:17 PM Noel O'Boyle  wrote:
>
>> Ah OK. Try an sdf file, and then there will be no need for OB to guess
>> anything.
>>
>> On Wed, 18 Aug 2021, 21:50 Kevin Skinner,  wrote:
>>
>>> Hello,
>>>
>>> Thanks for the response. I already have all of the hydrogens that are
>>> present in the structure. Confab is adding an extra hydrogen because it
>>> thinks there should be one. Typically it does so in between, but over a
>>> bond (like a triangle). Is there a sway to approach this? If not, then
>>> would the sampling still be correct and I would just need to remove it from
>>> all of the structures?
>>>
>>> Thanks,
>>>
>>> Kevin
>>>
>>> On Wed, Aug 18, 2021 at 3:47 PM Noel O'Boyle 
>>> wrote:
>>>
>>>> Hi Kevin,
>>>>
>>>> Working as intended. The forcefields and QM calculations require
>>>> explicit hydrogens to correctly calculate the energy. It's trivial to
>>>> remove the H afterwards, but this would be a bit unusual so think it over.
>>>>
>>>> Regards,
>>>> Noel
>>>>
>>>> On Wed, 18 Aug 2021 at 16:25, Kevin Skinner  wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I am using confab to generate conformers, but while doing so it adds a
>>>>> hydrogen to the structure. I have used the iQMol optimizer, PM3, and DFT
>>>>> for the optimizations and all have the same issue. I have tried using both
>>>>> XYZ and MOL2 inputs. Is there a way to avoid this issue?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Kevin
>>>>>
>>>> ___
>>>>> OpenBabel-discuss mailing list
>>>>> OpenBabel-discuss@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>>>
>>>>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Adding Hydrogen During Confab

2021-08-18 Thread Noel O'Boyle
Ah OK. Try an sdf file, and then there will be no need for OB to guess
anything.

On Wed, 18 Aug 2021, 21:50 Kevin Skinner,  wrote:

> Hello,
>
> Thanks for the response. I already have all of the hydrogens that are
> present in the structure. Confab is adding an extra hydrogen because it
> thinks there should be one. Typically it does so in between, but over a
> bond (like a triangle). Is there a sway to approach this? If not, then
> would the sampling still be correct and I would just need to remove it from
> all of the structures?
>
> Thanks,
>
> Kevin
>
> On Wed, Aug 18, 2021 at 3:47 PM Noel O'Boyle  wrote:
>
>> Hi Kevin,
>>
>> Working as intended. The forcefields and QM calculations require explicit
>> hydrogens to correctly calculate the energy. It's trivial to remove the H
>> afterwards, but this would be a bit unusual so think it over.
>>
>> Regards,
>> Noel
>>
>> On Wed, 18 Aug 2021 at 16:25, Kevin Skinner  wrote:
>>
>>> Hello,
>>>
>>> I am using confab to generate conformers, but while doing so it adds a
>>> hydrogen to the structure. I have used the iQMol optimizer, PM3, and DFT
>>> for the optimizations and all have the same issue. I have tried using both
>>> XYZ and MOL2 inputs. Is there a way to avoid this issue?
>>>
>>> Thanks,
>>>
>>> Kevin
>>>
>> ___
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Adding Hydrogen During Confab

2021-08-18 Thread Noel O'Boyle
Hi Kevin,

Working as intended. The forcefields and QM calculations require explicit
hydrogens to correctly calculate the energy. It's trivial to remove the H
afterwards, but this would be a bit unusual so think it over.

Regards,
Noel

On Wed, 18 Aug 2021 at 16:25, Kevin Skinner  wrote:

> Hello,
>
> I am using confab to generate conformers, but while doing so it adds a
> hydrogen to the structure. I have used the iQMol optimizer, PM3, and DFT
> for the optimizations and all have the same issue. I have tried using both
> XYZ and MOL2 inputs. Is there a way to avoid this issue?
>
> Thanks,
>
> Kevin
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Library not loaded

2021-08-16 Thread Noel O'Boyle
If the formula excluded the Schrodinger code (there's an option to do this
for this very reason) then the dependency goes away.

On Tue, 17 Aug 2021, 01:28 Francois Berenger,  wrote:

> On 13/08/2021 00:29, Chris Swain via OpenBabel-discuss wrote:
> > Hi,
> >
> > I’m sure I’ve seen mention of this error in the past but I can’t find
> > it.
> >
> > An iBabel user has installed openbabel using home-brew on a Mac and
> > they report this error
> >
> > Dyld: Library not loaded:
> > Usr/local/opt/boost/lib/libbost_iostreams-mt.dylib
> > Referenced from :/usr/local/bin/obabel
> > Reason image not found
> > Abort trap: 6
> >
> > Does this need to be installed separately?
>
> The formula doesn't mention any boost-related _direct_ dependencies:
>
> cf.
>
>
> https://github.com/Homebrew/homebrew-core/blob/f225ce6dce2cab361b835c5c7471405a05a83a67/Formula/open-babel.rb
>
> If brew can install the missing dependency (that was detected at
> runtime),
> then the formula should be corrected.
>
> > Cheers,
> >
> > Chris
> >
> > ___
> > OpenBabel-discuss mailing list
> > OpenBabel-discuss@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Turn off adding hydrogens

2021-04-25 Thread Noel O'Boyle
Based on this, your input SD file does not describe the deprotonated form.
You should take a look at the spec for SDF regarding charged atoms and
check your file against it.

On Sun, 25 Apr 2021, 13:28 David van der Spoel, 
wrote:

> On 2021-04-25 14:09, Peter Jarowski wrote:
> > Hi David:
> >
> > I would suggest you avoid inchi entirely for this as it has its own
> > rules regarding canonical protonation state and connectivity (tautomer).
> >
> > Stick with SMILES. There is no benefit to inchi unless you are
> > concerned with clashing because you have a very large database.
> >
> > SMILES will represent your molecule as you want, you can use explicite
> > hydrogens if you need to as well.
> Thanks for the suggestion, but:
>
> % obabel -osmi -isdf perfluorotridecanoic-acid.sdf
>
> FC(F)(C(F)(F)C(F)(F)C(F)(F)C(F)(F)C(F)(F)C(F)(F)F)C(F)(F)C(F)(F)C(F)(F)C(F)(F)C(F)(F)C(=O)O
> 3018355
>
> % obabel -osmi -isdf perfluorotridecanoate.sdf
>
> FC(F)(C(F)(F)C(F)(F)C(F)(F)C(F)(F)C(F)(F)C(F)(F)F)C(F)(F)C(F)(F)C(F)(F)C(F)(F)C(F)(F)C(=O)O
>
>
> Identical. With the -xt h flag I get no string whatsoever.
> % obabel -osmi -xt h -isdf perfluorotridecanoic-acid.sdf
> 3018355
>
> If I drop the smiles string for the charged compound into Pubchem I get
> the acid back, so there is still information missing.
>
> Maybe I'm still doing something wrong. The position of the hydrogens is
> crucial because the identifiers are coupled to quantum chemistry
> calculations.
>
> >
> > Best,
> >
> > Peter
> >
> > On Sun, 25 Apr 2021 at 12:52, David van der Spoel
> > mailto:david.vandersp...@icm.uu.se>>
> wrote:
> >
> > Hi,
> >
> > I would like to generate an Inchi fro my compound but without adding
> > hydrogens. Is there a flag for that?
> >
> > Here is an example for an acid and its deprotonated form that
> > yields the
> > same InChi:
> > % obabel -oinchi -isdf perfluorotridecanoic-acid.sdf
> >
>  
> InChI=1S/C13HF25O2/c14-2(15,1(39)40)3(16,17)4(18,19)5(20,21)6(22,23)7(24,25)8(26,27)9(28,29)10(30,31)11(32,33)12(34,35)13(36,37)38/h(H,39,40)
> > % obabel -oinchi -isdf perfluorotridecanoate.sdf
> >
>  
> InChI=1S/C13HF25O2/c14-2(15,1(39)40)3(16,17)4(18,19)5(20,21)6(22,23)7(24,25)8(26,27)9(28,29)10(30,31)11(32,33)12(34,35)13(36,37)38/h(H,39,40)
> >
> > --
> > David van der Spoel, Ph.D.,
> > Professor of Computational Molecular Biophysics
> > Uppsala University.
> > http://virtualchemistry.org 
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > När du har kontakt med oss på Uppsala universitet med e-post så
> > innebär det att vi behandlar dina personuppgifter. För att läsa
> > mer om hur vi gör det kan du läsa här:
> > http://www.uu.se/om-uu/dataskydd-personuppgifter/
> > 
> >
> > E-mailing Uppsala University means that we will process your
> > personal data. For more information on how this is performed,
> > please read here:
> > http://www.uu.se/en/about-uu/data-protection-policy
> > 
> >
> >
> > ___
> > OpenBabel-discuss mailing list
> > OpenBabel-discuss@lists.sourceforge.net
> > 
> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
> > 
> >
> > --
> > Peter Jarowski, Ph. D.
> > CEO / Co-founder
> > ChemAlive SA - Quantum Chemistry for All
> >
> > Twitter: @SAChemAlive 
> > LinkedIn: https://www.linkedin.com/company/chemalive-sa/
> > 
> > Web: http://www.chemalive.com 
> >
> > Try our Interface: https://www.app.chemalive.com
> > 
> >
> > 
> > MassChallenge Switzerland  Gold
> > Winners
> > Stage 3 Climate-KIC  Winners
>
>
> --
> David van der Spoel, Ph.D.,
> Professor of Computational Molecular Biophysics
> Uppsala University.
> http://virtualchemistry.org
>
>
>
>
>
>
>
>
>
> När du har kontakt med oss på Uppsala universitet med e-post så innebär
> det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör
> det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/
>
> E-mailing Uppsala University means that we will process your personal
> data. For more information on how this is performed, please read here:
> http://www.uu.se/en/about-uu/data-protection-policy
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list

Re: [Open Babel] XYZ Atom Order

2021-02-04 Thread Noel O'Boyle
It's the order of the atoms in the OBMol's vector of OBAtoms.

On Thu, 4 Feb 2021 at 12:54, Matt Bone  wrote:

> Dear OpenBabel,
>
> What determines the atom order in the XYZ files written by
> OpenBabel/Avogadro? It appears there is some logical pattern behind it, but
> I can't figure it out from the files. I've picked through xyzformat.cpp but
> that calls a general molecule class that I haven't been able to understand.
> I'd like to know the logic behind the ordering for some software I'm
> writing, is this order likely to change with newer versions of OpenBabel?
>
> Kind Regards,
>
> Matt
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Prevent warning messages (Python, OB 3.1.0)

2020-12-19 Thread Noel O'Boyle
That creates a new message handler. You need to get hold of the existing
one. It's something like obErrorLog. If you use dir() on ob, you will find
the exact name.

On Fri, 18 Dec 2020, 23:38 Stefano Forli,  wrote:

> Hi,
>
> I'm having a hard time disabling warning messages using the
> OBMessageHandler class using Python and OB 3.1.0 (installed from Conda):
>
>  ...
>  ==
>  *** Open Babel Warning  in PerceiveBondOrders
>Failed to kekulize aromatic bonds in OBMol::PerceiveBondOrders
>  ...
>
> I have tried the following code to suppress the messages with no success
> (I've stopped the logging after trying changing the output level):
>
>  ob_log = ob.OBMessageHandler()
>  ob_log.SetOutputLevel(0)
>  ob_log.StopLogging()
>
> Suggestions are welcome.
>
> S
>
> --
>
>   Stefano Forli, PhD
>
>   Assistant Professor
>   Dept. of Integrative Structural
>   and Computational Biology, MB-112A
>   Scripps Research
>   10550  North Torrey Pines Road
>   La Jolla,  CA 92037-1000,  USA.
>
>  tel: +1 (858)784-2055
>  email: fo...@scripps.edu
>  https://forlilab.org
>
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] problem installing python bindings

2020-12-03 Thread Noel O'Boyle
You'll need to install the latest OpenBabel.

On Tue, 1 Dec 2020, 19:09 Rita Ortega,  wrote:

> Hello,
>
> I am tryint to install the python bindings to use pybel but I keep
> gettin error messages.
>
> I reinstalled openbabel in the 2.3.1 version and I am using python 3.7
> version. I tried installing in these both ways:
> https://openbabel.org/docs/current/UseTheLibrary/PythonInstall.html and
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/PythonInstall.html
> But I keep having problems.
>
> This is the message it shows when I try to install it following the steps
> in https://openbabel.org/docs/current/UseTheLibrary/PythonInstall.html
>
> C:\Users\Rita>python -V
> Python 3.7.3
>
> C:\Users\Rita>obabel -V
> Open Babel 2.3.1 -- Oct  9 2011 -- 17:57:01
>
> C:\Users\Rita>obabel -Hsdf
> sdf  MDL MOL format
> Reads and writes V2000 and V3000 versions
>
> Read Options, e.g. -as
>  s  determine chirality from atom parity flags
>The default setting is to ignore atom parity and
>work out the chirality based on the bond
>stereochemistry.
>  T  read title only
>  P  read title and properties only
>When filtering an sdf file on title or properties
>only, avoid lengthy chemical interpretation by
>using the ``T`` or ``P`` option together with the
>:ref:`copy format `.
>
> Write Options, e.g. -x3
>  3  output V3000 not V2000 (used for >999 atoms/bonds)
>  m  write no properties
>  w  use wedge and hash bonds from input (2D structures only)
>  A  output in Alias form, e.g. Ph, if present
>
>
> Specification at: http://www.mdl.com/downloads/public/ctfile/ctfile.jsp
>
> C:\Users\Rita>dir "%BABEL_DATADIR%"\mr.txt
>  El volumen de la unidad C no tiene etiqueta.
>  El número de serie del volumen es: 9606-F203
>
>  Directorio de C:\ProgramData\OpenBabel-2.3.1\data
>
> 09/10/2011  17:47 4.295 mr.txt
>1 archivos  4.295 bytes
>0 dirs  863.775.387.648 bytes libres
>
> C:\Users\Rita>python
> Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit
> (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pybel
> Traceback (most recent call last):
>   File "", line 1, in 
>   File
> "C:\Users\Rita\AppData\Local\Programs\Python\Python37\lib\site-packages\pybel.py",
> line 16, in 
> import openbabel as ob
>   File
> "C:\Users\Rita\AppData\Local\Programs\Python\Python37\lib\site-packages\openbabel.py",
> line 30, in 
> _openbabel = swig_import_helper()
>   File
> "C:\Users\Rita\AppData\Local\Programs\Python\Python37\lib\site-packages\openbabel.py",
> line 26, in swig_import_helper
> _mod = imp.load_module('_openbabel', fp, pathname, description)
>   File "C:\Users\Rita\AppData\Local\Programs\Python\Python37\lib\imp.py",
> line 242, in load_module
> return load_dynamic(name, filename, file)
>   File "C:\Users\Rita\AppData\Local\Programs\Python\Python37\lib\imp.py",
> line 342, in load_dynamic
> return _load(spec)
> ImportError: DLL load failed: %1 no es una aplicación Win32 válida.
> >>>
>
>
> Could I have any help on this?
>
> Thank you
> --
> Rita Ortega Vallbona
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] mol.EndModify() and upgrade to ob3.0

2020-10-17 Thread Noel O'Boyle
Hi Simon,

I'm finding it a bit confusing to work out what's going on here. If you
could either provide the simplest possible self-contained example, or else
describe what you want to do. At the back of my mind is the fact that molA
+= molB is how you add one molecule to another in Open Babel - it is not
expected that users copy over each atom one-by-one.

Regards,
Noel

On Thu, 15 Oct 2020 at 13:41, Dürr Simon Leonard 
wrote:

> Hi,
>
>
> I am currently upgrading our code from openbabel 2.4.2 to openbabel 3.0
> (using the python bindings).
>
>
> I am having trouble with the EndModify command.
>
>
> What the code is doing:
>
>
>1. Load a pdb file and a mol2 file of an amino acid (aa_mol)  into
>seperate obMols
>2. Set both ObMol to BeginModify()
>3. Calculate a rotation vector and remove overlapping atoms via
>DeleteAtom() from aa_mol and pdb obmol
>4. Then create a new obatom in the pdb file and copy all information
>and remake the bonds
>new_atom.SetId(id)
>new_atom.SetVector(frag_atom.GetVector())
>new_atom.SetAtomicNum(frag_atom.GetAtomicNum())
>new_atom.SetType(frag_atom.GetType())
>new_atom.SetSpinMultiplicity(frag_atom.GetSpinMultiplicity())
>new_atom.SetFormalCharge(frag_atom.GetFormalCharge())
>#new_atom.SetImplicitValence(frag_atom.GetImplicitValence()) #old
>2.4.2 replaced with line below
>new_atom.SetImplicitHCount(frag_atom.GetImplicitHCount())
>new_atom.SetPartialCharge(frag_atom.GetPartialCharge())
>
>for obbond in openbabel.OBMolBondIter(fragment):
>
>begin_atom = obbond.GetBeginAtom()
>
>end_atom = obbond.GetEndAtom()
>
>mol.AddBond(obbond.GetBeginAtomIdx() + prevAtoms,
>obbond.GetEndAtomIdx() + prevAtoms, obbond.GetBondOrder(),
>obbond.GetFlags())
>
>
> 5. Renumber the atoms so that the newly inserted atoms are at the desired
> location
>
> 6. Make a bond between the fragment and the CA atom in the pdb file
>
> 7. Set name of residue.
>
> 8. Set Dihedral angle.
>
>
> Now this code was working perfectly fine in ob2.4.2, but now in 3.0 it
> does not anymore.
>
> I get a Segmentation fault when setting the Dihedral angle.
>
>
> If I move the mol.EndModify() before the SetTorsion command the
> segmentation fault disappears but all the atoms become unlinked (Residue
> UNL).
>
> If I write out a PDB file just before the EndModify command everything
> looks alright (correct CONECT statements, positions, order etc.).
>
>
> Any ideas where the problem is?
>
>
> Thank you for your help,
>
> Simon
>
>
> *Simon Dürr*
> i...@simonduerr.eu
> https://simonduerr.eu
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Chirality perception

2020-10-12 Thread Noel O'Boyle
Hi Stefano,

This is documented in the "0D structures" section: "if you wish to identify
additional stereocenters whose stereo configuration is unspecified, ...then
you may wish to trigger perception." The reason we don't do this by default
is simply for speed.

Regards,
Noel

On Mon, 12 Oct 2020 at 19:40, Stefano Forli  wrote:

> Hi,
>
> I've found a solution that works, so I'm posting it here for posterity.
> By forcing mol.SetChiralityPerceived(False) right after reading the
> molecule I can get the proper behavior restored:
>
> (3.1.0)
> 0 True IsChiral()
> 0 True HasTetrahedralStereo()
>
> I think I can see why this can make sense, in the perspective of forcing
> to keep the information in the input.
> An interesting behavior worth reporting in the docs.
>
> Thanks,
>
> S
>
>
> On 10/10/20 11:27 PM, Stefano Forli wrote:
> > Hi all,
> >
> > we've been looking at migrating our OB2 code to OB3 and we have found
> differences in how to deal with chirality, which I don't know how to sort
> out. I wrote the test code below, which returns different results for
> "C(Br)(Cl)F" depending on the version. In particular, with v2, the first
> carbon atom is:
> >
> >0 True IsChiral()
> >0 True HasTetrahedralStereo()
> >
> > while for v3:
> >
> >0 False IsChiral()
> >0 False HasTetrahedralStereo()
> >
> > While it would make more sense that no tetrahedral configuration is
> defined, I would expect the atom to be perceived as chiral. I've read the
> latest documentation I could find from Noel (
> https://open-babel.readthedocs.io/en/latest/Stereochemistry/stereo.html)
> with no success.
> > Since it seems that the OBMol.IsChiral() method does not exist anymore,
> I have no clues on how to detect if a molecule is chiral, and if so, which
> atoms are chiral.
> >
> > Any suggestions?
> >
> > Thanks,
> >
> > S
> >
> >
> > --
> > import sys
> > try: # 3
> >  from openbabel import openbabel as ob
> > except: # 2
> >  import openbabel as ob
> > print(ob.OBReleaseVersion())
> > conv = ob.OBConversion()
> > conv.SetInFormat("smi")
> > mol = ob.OBMol()
> > conv.ReadString(mol, "C(Br)(Cl)F")
> > try:
> >  # not available anymore in OB3
> >  print(mol.IsChiral(), "IsChiral()")
> > except:
> >  pass
> > facade = ob.OBStereoFacade(mol, True)
> > for a in ob.OBMolAtomIter(mol):
> >  idx = a.GetId()
> >  print(idx, a.IsChiral(), "IsChiral()")
> >  print(idx, facade.HasTetrahedralStereo(idx),
> "HasTetrahedralStereo()")
> > --
> >
> >
> >
> >
> >
> >
> >
>
> --
>
>   Stefano Forli, PhD
>
>   Assistant Professor
>   Dept. of Integrative Structural
>   and Computational Biology, MB-112A
>   Scripps Research
>   10550  North Torrey Pines Road
>   La Jolla,  CA 92037-1000,  USA.
>
>  tel: +1 (858)784-2055
>  email: fo...@scripps.edu
>  http://www.scripps.edu/faculty/forli/
>
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Failed to kekulize aromatic bonds | structure building

2020-07-14 Thread Noel O'Boyle
If they are protonated by Chimera that means you should have the bonds and
bond orders for everything. In which case, you shouldn't need to do any of
this, just get Chimera to export the structure including this information.

- Noel

On Tue, 14 Jul 2020 at 14:58, Lukas Pravda  wrote:

> Hi Noel,
>
>
>
> Thanks for a prompt reply. The structures I use are actually protonated
> using ChimeraX so all the hydrogens are explicit. If I understand you
> correctly the 3.0 version should work better in my case, however I’m
> getting this warning and quite possibly because of that there is a data
> discrepancy downstream, so I wonder what can I do to find out what is wrong
> in my case.
>
>
>
> Best,
>
> Lukas
>
>
>
> *From: *Noel O'Boyle 
> *Date: *Tuesday, 14 July 2020 at 15:13
> *To: *Lukas Pravda 
> *Cc: *"openbabel-discuss@lists.sourceforge.net" <
> openbabel-discuss@lists.sourceforge.net>
> *Subject: *Re: [Open Babel] Failed to kekulize aromatic bonds | structure
> building
>
>
>
> Before 3.0, aromaticity perception was performed as if the position of the
> hydrogens were unknown, and the hydrogens were inferred afterwards. This
> makes sense for structures from the PDB, but not for anything else (e.g.
> SMILES) where there were occasional errors and it was much slower than
> necessary. Now, the perception is the other way around; it makes sense for
> everything except for structures where the bond order is unknown, like for
> PDB structures.
>
>
>
> It would be nice to return the PDB structure perception to the same level
> as before - I 'just' need to adapt the old procedure to the job. But in the
> short term, for this particular problem, you may find it best to use OB
> 2.4.1.
>
>
>
> Regards,
>
> - Noel
>
>
>
> On Tue, 14 Jul 2020 at 13:49, Lukas Pravda  wrote:
>
> Dear all,
>
>
>
> I’m maintaining a package to perceive molecular interactions that depends
> on openbabel functionality using python. Historically it used openbabel
> 2.4.1, but recently I’ve learned that there is a version 3.x  so I wanted
> to give it a go (newer should be better right? ). I made few changes
> according to the document here:
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/migration.html
> to comply with the breaking changes…. Long story short, in certain cases
> the interactions perceived by the software are not the same as with
> underlying openbabel 2.4.1. Namely there are missing plane-plane
> interactions. I can see the following message in the log that was not there
> with the previous version:
>
>
>
> *** Open Babel Warning  in PerceiveBondOrders
>
>   Failed to kekulize aromatic bonds in OBMol::PerceiveBondOrders
>
>
>
> So I suspect this may be root of the problem
>
>
>
> So my question is twofold:
>
>1. Is there a way how can I find out what is possibly wrong with the
>structure so that I can fix it?
>2. Is there any change in the way protein structure is being
>constructured If I do it myself?
>
>
>
> This is essentially what I do:
>
>
>
> import openbabel.openbabel as ob
>
>
>
> mol = ob.OBMol()
>
> mol.BeginModify()
>
>
>
> # residue is created like this
>
> res = mol.NewResidue()
>
> res.SetChainNum(chain_num)
>
> res.SetNum(res_id)
>
> res.SetName(res_name)
>
> res.SetInsertionCode(ins_code)
>
>
>
> # atom is created in a residue like this:
>
> atom = mol.NewAtom(atom_id)
>
> atom.SetVector(x,y,z)
>
>
>
> atomic_num = ob.GetAtomicNum(element)
>
> atom.SetAtomicNum(atomic_num)
>
> atom.SetFormalCharge(_format_formal_charge(atom_sites, i))
>
>
>
> res.AddAtom(atom)
>
> res.SetHetAtom(atom, atom_sites["group_PDB"][i] == "HETATM")
>
> res.SetSerialNum(atom, int(atom_sites["id"][i]))
>
>
>
> # after atom reading is done this is the post-processing
>
> mol.EndModify()
>
> mol.ConnectTheDots()
>
> ob.OBAromaticTyper().AssignAromaticFlags(mol)
>
> mol.PerceiveBondOrders()
>
>
>
>
>
>
>
> My setup:
>
> Mac os: 10.15.5
>
> Python: 3.7
>
>
>
> Best,
>
> Lukas
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Failed to kekulize aromatic bonds | structure building

2020-07-14 Thread Noel O'Boyle
Before 3.0, aromaticity perception was performed as if the position of the
hydrogens were unknown, and the hydrogens were inferred afterwards. This
makes sense for structures from the PDB, but not for anything else (e.g.
SMILES) where there were occasional errors and it was much slower than
necessary. Now, the perception is the other way around; it makes sense for
everything except for structures where the bond order is unknown, like for
PDB structures.

It would be nice to return the PDB structure perception to the same level
as before - I 'just' need to adapt the old procedure to the job. But in the
short term, for this particular problem, you may find it best to use OB
2.4.1.

Regards,
- Noel

On Tue, 14 Jul 2020 at 13:49, Lukas Pravda  wrote:

> Dear all,
>
>
>
> I’m maintaining a package to perceive molecular interactions that depends
> on openbabel functionality using python. Historically it used openbabel
> 2.4.1, but recently I’ve learned that there is a version 3.x  so I wanted
> to give it a go (newer should be better right? ). I made few changes
> according to the document here:
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/migration.html
> to comply with the breaking changes…. Long story short, in certain cases
> the interactions perceived by the software are not the same as with
> underlying openbabel 2.4.1. Namely there are missing plane-plane
> interactions. I can see the following message in the log that was not there
> with the previous version:
>
>
>
> *** Open Babel Warning  in PerceiveBondOrders
>
>   Failed to kekulize aromatic bonds in OBMol::PerceiveBondOrders
>
>
>
> So I suspect this may be root of the problem
>
>
>
> So my question is twofold:
>
>1. Is there a way how can I find out what is possibly wrong with the
>structure so that I can fix it?
>2. Is there any change in the way protein structure is being
>constructured If I do it myself?
>
>
>
> This is essentially what I do:
>
>
>
> import openbabel.openbabel as ob
>
>
>
> mol = ob.OBMol()
>
> mol.BeginModify()
>
>
>
> # residue is created like this
>
> res = mol.NewResidue()
>
> res.SetChainNum(chain_num)
>
> res.SetNum(res_id)
>
> res.SetName(res_name)
>
> res.SetInsertionCode(ins_code)
>
>
>
> # atom is created in a residue like this:
>
> atom = mol.NewAtom(atom_id)
>
> atom.SetVector(x,y,z)
>
>
>
> atomic_num = ob.GetAtomicNum(element)
>
> atom.SetAtomicNum(atomic_num)
>
> atom.SetFormalCharge(_format_formal_charge(atom_sites, i))
>
>
>
> res.AddAtom(atom)
>
> res.SetHetAtom(atom, atom_sites["group_PDB"][i] == "HETATM")
>
> res.SetSerialNum(atom, int(atom_sites["id"][i]))
>
>
>
> # after atom reading is done this is the post-processing
>
> mol.EndModify()
>
> mol.ConnectTheDots()
>
> ob.OBAromaticTyper().AssignAromaticFlags(mol)
>
> mol.PerceiveBondOrders()
>
>
>
>
>
>
>
> My setup:
>
> Mac os: 10.15.5
>
> Python: 3.7
>
>
>
> Best,
>
> Lukas
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Python scripts, Open Babel and SMOG output

2020-06-21 Thread Noel O'Boyle
Hi Anthony,

You're on the right track. "etab" is gone now, as you've found.
"ob.GetAtomicNum(element)" is the replacement you're looking for.

Looking through the code, I think it should work now. FYI, if you want to
use Python 3 instead of Python 2, you may also need to replace "f.next()"
with "next(f)".

Regards,
- Noel

On Fri, 19 Jun 2020 at 17:32, C Anthony Lewis 
wrote:

> Dear Colleagues,
>
>
>
> I hope you are all safe and well at this extraordinary time.
>
>
>
> This is a follow-up to messages I sent to the list in late 2013 and early
> 2014 regarding an old DOS-based program 'SMOG' (see CCL archives
> http://www.ccl.net/cca/software/MS-DOS/SMOG/index.shtml and
> http://pubs.acs.org/doi/abs/10.1021/ci950393z) that generates isomers
> given a molecular formula and a set of structural constraints. Although the
> output is in the form of a connection table it was not understood by other
> applications I was aware of and I thought OpenBabel might work. However, at
> the time this was not an option and Noel kindly provided me with a Python
> script (smog.py – attached as a txt file) that took the SMOG output and
> generated SMILES. I believe there was an intention to include this in
> future versions of Open Babel but I appreciate there are many calls on time
> and I don’t think this has yet happened.
>
>
>
> Fast forwarding seven years or so, during which my attention was taken by
> other duties, I have now returned to working on the additional SMOG output
> I have available and I naively thought I would be able to install current
> versions of Open Babel and Python, fire up the script and everything would
> work as before. Unfortunately, things didn’t go quite to plan and the
> following is what happened.
>
>
>
> I Installed Anaconda Powershell and OpenBabel 3.0.0 and, I think, the
> bindings ('pip install -U openbabel') correctly.
>
>
>
> I ran through the commands given in the ‘Test the installation’ box on
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/PythonInstall.html
> and obtained a structure in a separate window so it seemed that things were
> working okay. I then ran smog.py as attached and got the following:
>
>
>
> (base) PS C:\users\anthony\anaconda2> python smog.py myfile.res
> myoutputfile.smi
>
> Traceback (most recent call last):
>
>   File "smog.py", line 5, in 
>
> import pybel
>
> ImportError: No module named pybel
>
>
>
> Having looked at
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/PythonInstall.html
> again and also the ‘Updating to Open Babel 3.0 from 2.x’ page (
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/migration.html),
> I changed line 5 in smog.py from ‘import pybel’ to ‘from openbabel import
> pybel’ and ran smog.py again with the following result:
>
>
>
> (base) PS C:\users\anthony\anaconda2> python smog.py myfile.res
> myoutputfile.smi
>
> Traceback (most recent call last):
>
>   File "smog.py", line 60, in 
>
> for mol in readSMOG(options['inputfile']):
>
>   File "smog.py", line 41, in readSMOG
>
> yield smog2mol(lines)
>
>   File "smog.py", line 16, in smog2mol
>
> atm.SetAtomicNum(ob.cvar.etab.GetAtomicNum(element))
>
> AttributeError: Unknown C global variable 'etab'
>
>
>
> At this point I am well beyond my capabilities but I assume there have
> been changes since version 2.x'ish that I used in the past and the global
> variable 'etab' and is absent. I did find 'etab' defined on line 468 at
> https://github.com/openbabel/documentation/blob/master/pybel.py (dated 14
> Oct 2012) but I don't know what to do with this information!
>
>
>
> I guess this is a similar issue to one posted to the list at the end of
> May and I'm hoping that someone can provide some assistance and, if it's
> possible, show me how I can get the smog.py working again. Maybe this is my
> chance to learn Python after all the times I’ve said I would…
>
>
>
> My apologies for the lengthy post and many thanks for any assistance
> received,
>
>
>
> Anthony
>
>
>
>
>
>
>
> C. Anthony Lewis
>
> Petroleum & Environmental Geochemistry Group & Centre for Chemical
> Sciences,
>
> School of Geography, Earth and Environmental Sciences,
>
> Plymouth University,
>
> Plymouth, Devon PL4 8AA, U.K.
>
>
>
> tel: +44 (0)1752 584554
>
> email: cale...@plymouth.ac.uk
>
> web: http://www.pegg.org.uk
>
> http://www.plymouth.ac.uk/chemistry
>
>
> --
> 
>
> This email and any files with it are confidential and intended solely for
> the use of the recipient to whom it is addressed. If you are not the
> intended recipient then copying, distribution or other use of the
> information contained is strictly prohibited and you should not rely on it.
> If you have received this email in error please let the sender know
> immediately and delete it from your system(s). Internet emails are not
> necessarily secure. While we take every care, University of Plymouth
> accepts no responsibility for viruses 

Re: [Open Babel] Babel not recognised

2020-05-26 Thread Noel O'Boyle
The release notes at
https://open-babel.readthedocs.io/en/latest/ReleaseNotes/ob300.html explain
that 'babel' has been removed.

- Noel

On Mon, 25 May 2020 at 19:18, Tanya Jaiswal 
wrote:

> Hello,
> I downloaded the v2.3  of open babel earlier but without noticing it I
> downloaded the v3.0 today.  Thereafter I deleted the v2.3 but now the
> command line is saying babel not recognised although the obabel commands
> are working.
> Please help
> Thanking you,
> Tanya Jaiswal
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Openbabel and Python 3.8

2020-05-26 Thread Noel O'Boyle
It works fine on Linux if you have Swig 4.0. Just doesn't work on Windows.

On Tue, 26 May 2020 at 13:10, Hongyi Zhao  wrote:

> Noel O'Boyle  于2020年5月26日周二 下午7:55写道:
> >
> > Those listed at https://pypi.org/project/openbabel/3.1.1/.
> Unfortunately, we were not able to support Py 3.8 as the latest version of
> Swig (which is required for Py 3.8) did not work for us.
>
> I successfully compiled openbabel git master version with a Py 3.8.3
> based virtualenv on Ubuntu 20.04.
>
> Regards,
> HY
>
> >
> > On Tue, 26 May 2020 at 11:45, MD Simulation 
> wrote:
> >>
> >> What Python version is supported?
> >>
> >> Thanks!
> >>
> >> On Tue, May 26, 2020, 3:39 AM Noel O'Boyle 
> wrote:
> >>>
> >>> 3.8 is not supported on Windows.
> >>>
> >>> On Mon, 25 May 2020, 19:54 MD Simulation, 
> wrote:
> >>>>
> >>>> Hello,
> >>>>
> >>>> I followed the instructions to install Openbabel using pip from:
> >>>>
> >>>>
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/PythonInstall.html#windows
> >>>>
> >>>>  I'm using Python 3.8 and have installed the most recent Openbabl but
> when I tried to use pip, the installation of the python bindings failed
> (failure at bottom).
> >>>>
> >>>> Any ideas?
> >>>>
> >>>> Thanks,
> >>>> Stacey
> >>>>
> >>>> Collecting openbabel
> >>>>   Using cached openbabel-3.1.1.1.tar.gz (82 kB)
> >>>> Using legacy setup.py install for openbabel, since package 'wheel' is
> not installed.
> >>>> Installing collected packages: openbabel
> >>>> Running setup.py install for openbabel ... error
> >>>> ERROR: Command errored out with exit status 1:
> >>>>  command:
> 'c:\users\im2405\appdata\local\programs\python\python38-32\python.exe' -u
> -c 'import sys, setuptools, tokenize; sys.argv[0] =
> '"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';
> __file__='"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';f=getattr(tokenize,
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
> install --record
> 'C:\Users\im2405\AppData\Local\Temp\pip-record-1c4w3a0b\install-record.txt'
> --single-version-externally-managed --compile --install-headers
> 'c:\users\im2405\appdata\local\programs\python\python38-32\Include\openbabel'
> >>>>  cwd:
> C:\Users\im2405\AppData\Local\Temp\pip-install-zbgb0ke4\openbabel\
> >>>> Complete output (14 lines):
> >>>> running install
> >>>> running build_ext
> >>>> Warning: invalid version number '3.1.1.1'.
> >>>> Guessing Open Babel location:
> >>>> - include_dirs:
> ['c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\include',
> 'c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\include',
> '/usr/local/include/openbabel3']
> >>>> - library_dirs:
> ['c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\libs',
> 'c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\PCbuild\\win32',
> '/usr/local/lib']
> >>>> building 'openbabel._openbabel' extension
> >>>> swigging openbabel\openbabel-python.i to
> openbabel\openbabel-python_wrap.cpp
> >>>> swig.exe -python -c++ -small -O -templatereduce -naturalvar
> -Ic:\users\im2405\appdata\local\programs\python\python38-32\include
> -Ic:\users\im2405\appdata\local\programs\python\python38-32\include
> -I/usr/local/include/openbabel3 -o openbabel\openbabel-python_wrap.cpp
> openbabel\openbabel-python.i
> >>>>
> >>>> Error: SWIG failed. Is Open Babel installed?
> >>>> You may need to manually specify the location of Open Babel
> include and library directories. For example:
> >>>>   python setup.py build_ext -I/usr/local/include/openbabel3
> -L/usr/local/lib
> >>>>   python setup.py install
> >>>> 
> >>>> ERROR: Command errored out with exit status 1:
> 'c:\users\im2405\appdata\local\programs\python\python38-32\python.exe' -u
> -c 'import sys, setuptools, t

Re: [Open Babel] Openbabel and Python 3.8

2020-05-26 Thread Noel O'Boyle
Those listed at https://pypi.org/project/openbabel/3.1.1/. Unfortunately,
we were not able to support Py 3.8 as the latest version of Swig (which is
required for Py 3.8) did not work for us.

On Tue, 26 May 2020 at 11:45, MD Simulation 
wrote:

> What Python version is supported?
>
> Thanks!
>
> On Tue, May 26, 2020, 3:39 AM Noel O'Boyle  wrote:
>
>> 3.8 is not supported on Windows.
>>
>> On Mon, 25 May 2020, 19:54 MD Simulation, 
>> wrote:
>>
>>> Hello,
>>>
>>> I followed the instructions to install Openbabel using pip from:
>>>
>>>
>>> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/PythonInstall.html#windows
>>>
>>>
>>>  I'm using Python 3.8 and have installed the most recent Openbabl but
>>> when I tried to use pip, the installation of the python bindings
>>> failed (failure at bottom).
>>>
>>> Any ideas?
>>>
>>> Thanks,
>>> Stacey
>>>
>>> Collecting openbabel
>>>   Using cached openbabel-3.1.1.1.tar.gz (82 kB)
>>> Using legacy setup.py install for openbabel, since package 'wheel' is
>>> not installed.
>>> Installing collected packages: openbabel
>>> Running setup.py install for openbabel ... error
>>> ERROR: Command errored out with exit status 1:
>>>  command:
>>> 'c:\users\im2405\appdata\local\programs\python\python38-32\python.exe' -u
>>> -c 'import sys, setuptools, tokenize; sys.argv[0] =
>>> '"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';
>>> __file__='"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';f=getattr(tokenize,
>>> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
>>> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
>>> install --record
>>> 'C:\Users\im2405\AppData\Local\Temp\pip-record-1c4w3a0b\install-record.txt'
>>> --single-version-externally-managed --compile --install-headers
>>> 'c:\users\im2405\appdata\local\programs\python\python38-32\Include\openbabel'
>>>  cwd:
>>> C:\Users\im2405\AppData\Local\Temp\pip-install-zbgb0ke4\openbabel\
>>> Complete output (14 lines):
>>> running install
>>> running build_ext
>>> Warning: invalid version number '3.1.1.1'.
>>> Guessing Open Babel location:
>>> - include_dirs:
>>> ['c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\include',
>>> 'c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\include',
>>> '/usr/local/include/openbabel3']
>>> - library_dirs:
>>> ['c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\libs',
>>> 'c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\PCbuild\\win32',
>>> '/usr/local/lib']
>>> building 'openbabel._openbabel' extension
>>> swigging openbabel\openbabel-python.i to
>>> openbabel\openbabel-python_wrap.cpp
>>> swig.exe -python -c++ -small -O -templatereduce -naturalvar
>>> -Ic:\users\im2405\appdata\local\programs\python\python38-32\include
>>> -Ic:\users\im2405\appdata\local\programs\python\python38-32\include
>>> -I/usr/local/include/openbabel3 -o openbabel\openbabel-python_wrap.cpp
>>> openbabel\openbabel-python.i
>>>
>>> Error: SWIG failed. Is Open Babel installed?
>>> You may need to manually specify the location of Open Babel include
>>> and library directories. For example:
>>>   python setup.py build_ext -I/usr/local/include/openbabel3
>>> -L/usr/local/lib
>>>   python setup.py install
>>> 
>>> ERROR: Command errored out with exit status 1:
>>> 'c:\users\im2405\appdata\local\programs\python\python38-32\python.exe' -u
>>> -c 'import sys, setuptools, tokenize; sys.argv[0] =
>>> '"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';
>>> __file__='"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';f=getattr(tokenize,
>>> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
>>> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
>>> install --record
>>> 'C:\Users\im2405\AppData\Local\Temp\pip-record-1c4w3a0b\install-record.txt'
>>> --single-version-externally-managed --compile --install-headers
>>> 'c:\users\im2405\appdata\local\programs\python\python38-32\Include\openbabel'
>>> Check the logs for full command output.
>>> ___
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Openbabel and Python 3.8

2020-05-26 Thread Noel O'Boyle
3.8 is not supported on Windows.

On Mon, 25 May 2020, 19:54 MD Simulation, 
wrote:

> Hello,
>
> I followed the instructions to install Openbabel using pip from:
>
>
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/PythonInstall.html#windows
>
>
>  I'm using Python 3.8 and have installed the most recent Openbabl but when
> I tried to use pip, the installation of the python bindings failed (failure
> at bottom).
>
> Any ideas?
>
> Thanks,
> Stacey
>
> Collecting openbabel
>   Using cached openbabel-3.1.1.1.tar.gz (82 kB)
> Using legacy setup.py install for openbabel, since package 'wheel' is not
> installed.
> Installing collected packages: openbabel
> Running setup.py install for openbabel ... error
> ERROR: Command errored out with exit status 1:
>  command:
> 'c:\users\im2405\appdata\local\programs\python\python38-32\python.exe' -u
> -c 'import sys, setuptools, tokenize; sys.argv[0] =
> '"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';
> __file__='"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';f=getattr(tokenize,
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
> install --record
> 'C:\Users\im2405\AppData\Local\Temp\pip-record-1c4w3a0b\install-record.txt'
> --single-version-externally-managed --compile --install-headers
> 'c:\users\im2405\appdata\local\programs\python\python38-32\Include\openbabel'
>  cwd:
> C:\Users\im2405\AppData\Local\Temp\pip-install-zbgb0ke4\openbabel\
> Complete output (14 lines):
> running install
> running build_ext
> Warning: invalid version number '3.1.1.1'.
> Guessing Open Babel location:
> - include_dirs:
> ['c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\include',
> 'c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\include',
> '/usr/local/include/openbabel3']
> - library_dirs:
> ['c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\libs',
> 'c:\\users\\im2405\\appdata\\local\\programs\\python\\python38-32\\PCbuild\\win32',
> '/usr/local/lib']
> building 'openbabel._openbabel' extension
> swigging openbabel\openbabel-python.i to
> openbabel\openbabel-python_wrap.cpp
> swig.exe -python -c++ -small -O -templatereduce -naturalvar
> -Ic:\users\im2405\appdata\local\programs\python\python38-32\include
> -Ic:\users\im2405\appdata\local\programs\python\python38-32\include
> -I/usr/local/include/openbabel3 -o openbabel\openbabel-python_wrap.cpp
> openbabel\openbabel-python.i
>
> Error: SWIG failed. Is Open Babel installed?
> You may need to manually specify the location of Open Babel include
> and library directories. For example:
>   python setup.py build_ext -I/usr/local/include/openbabel3
> -L/usr/local/lib
>   python setup.py install
> 
> ERROR: Command errored out with exit status 1:
> 'c:\users\im2405\appdata\local\programs\python\python38-32\python.exe' -u
> -c 'import sys, setuptools, tokenize; sys.argv[0] =
> '"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';
> __file__='"'"'C:\\Users\\im2405\\AppData\\Local\\Temp\\pip-install-zbgb0ke4\\openbabel\\setup.py'"'"';f=getattr(tokenize,
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
> install --record
> 'C:\Users\im2405\AppData\Local\Temp\pip-record-1c4w3a0b\install-record.txt'
> --single-version-externally-managed --compile --install-headers
> 'c:\users\im2405\appdata\local\programs\python\python38-32\Include\openbabel'
> Check the logs for full command output.
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] installing and importing openbabel

2020-05-17 Thread Noel O'Boyle
The current version of OB is 3.1.1, not 2.0.

On Fri, 15 May 2020 at 16:13, Weise, David  wrote:

> Hi,
>  Try another method listed:
> http://openbabel.org/wiki/Category:Macintosh
>
> I was able to do it on linux with conda.
>
> --David
>
>
> David Weise
> Linux Systems Admin
> Penn Medicine Academic Computing Services (PMACS)
> Richards Medical Labs
> 3700 Hamilton Walk | Philadelphia, PA 19104
> http://www.med.upenn.edu/pmacs/
>
>
>
> 
> From: Beliz Sertcan 
> Sent: Friday, May 15, 2020 10:13 AM
> To: openbabel-discuss@lists.sourceforge.net
> Subject: [Open Babel] installing and importing openbabel
>
> Hello,
>
> I have a couple of questions about building openbabel on mac os catalina.
> I cannot install openbabel with pip command and I am using python installed
> through pip so I don’t want to install openbabel through conda. For
> openbabel installation, I followed the instructions on the webpage. I
> downloaded openbabel from sourceforge, the version is 2.0. Then I create
> build directory and go in there and run the following commands in order:
>
> cmake ../ -DPYTHON_EXECUTABLE=/usr/local/bin/python3 -DPYTHON_BINDINGS=ON
> -DRUN_SWIG=ON
> make -j8
> make install
>
> Then I have to run export PYTHONPATH=/usr/local/lib:$PYTHONPATH for python
> to see openbabel. Unless I run this command I cannot install openbabel.
>
> Question1:
>
> I run the following commands:
>
> import openbabel
> from openbabel import pybel
>
> and I get the error:
>
> ImportError: cannot import name 'pybel' from 'openbabel' (unknown location)
>
> I think I am missing some flags in cmake, maybe you can help me with this.
> My python packages are in /usr/local/lib/python3.7/site-packages. What
> needs to be done to solve this?
>
> Question 2:
>
> I am using pymatgen and I want to use the module molecule_matcher. I get
> the following error:
>
> RuntimeError: BabelMolAdaptor requires openbabel to be installed with
> Python bindings. Please get it at http://openbabel.org (version >=3.0.0).
>
> Even though openbabel is installed and I can import it, somehow pymatgen
> fails to see it. I think this problem is also related to question 1. Again,
> what do I need to do?
>
> Thanks in advance,
> Beliz
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] cmake problems

2020-04-23 Thread Noel O'Boyle
Hi David,

Can you provide the output from running Cmake on a clean build of Open
Babel 3.0? What exact OS is this?

- Noel

On Wed, 22 Apr 2020, 19:17 Weise, David,  wrote:

> Hello Everybody,
>  I've been trying to compile openbabel for a hpc lsf environment. I'm
> having a problem with cmake and ld.  It can't find -pthreads. Can someone
> shed some light on this? The error is below:
> Determining if the include file conio.h exists failed with the following
> output:
> Change Dir: /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp
>
> Run Build Command(s):/bin/gmake cmTC_126b6/fast
> /bin/gmake -f CMakeFiles/cmTC_126b6.dir/build.make
> CMakeFiles/cmTC_126b6.dir/build
> gmake[1]: Entering directory
> `/misc/appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp'
> Building C object CMakeFiles/cmTC_126b6.dir/CheckIncludeFile.c.o
> /appl/gcc-4.9.4/bin/cc   -fPIE   -o
> CMakeFiles/cmTC_126b6.dir/CheckIncludeFile.c.o   -c
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:19:
> fatal error: conio.h: No such file or directory
>  #include 
>^
> compilation terminated.
> gmake[1]: *** [CMakeFiles/cmTC_126b6.dir/CheckIncludeFile.c.o] Error 1
> gmake[1]: Leaving directory
> `/misc/appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp'
> gmake: *** [cmTC_126b6/fast] Error 2
>
>
> Determining if the rint exist failed with the following output:
> Change Dir: /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp
>
> Run Build Command(s):/bin/gmake cmTC_71986/fast
> /bin/gmake -f CMakeFiles/cmTC_71986.dir/build.make
> CMakeFiles/cmTC_71986.dir/build
> gmake[1]: Entering directory
> `/misc/appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp'
> Building C object CMakeFiles/cmTC_71986.dir/CheckSymbolExists.c.o
> /appl/gcc-4.9.4/bin/cc   -fPIE   -o
> CMakeFiles/cmTC_71986.dir/CheckSymbolExists.c.o   -c
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
> Linking C executable cmTC_71986
> /appl/cmake-3.14.5/bin/cmake -E cmake_link_script
> CMakeFiles/cmTC_71986.dir/link.txt --verbose=1
> /appl/gcc-4.9.4/bin/cc  -rdynamic
> CMakeFiles/cmTC_71986.dir/CheckSymbolExists.c.o  -o cmTC_71986
> CMakeFiles/cmTC_71986.dir/CheckSymbolExists.c.o: In function `main':
> CheckSymbolExists.c:(.text+0x1b): undefined reference to `rint'
> collect2: error: ld returned 1 exit status
> gmake[1]: *** [cmTC_71986] Error 1
> gmake[1]: Leaving directory
> `/misc/appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp'
> gmake: *** [cmTC_71986/fast] Error 2
>
> File
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
> /* */
> #include 
>
> int main(int argc, char** argv)
> {
>   (void)argv;
> #ifndef rint
>   return ((int*)())[argc];
> #else
>   (void)argc;
>   return 0;
> #endif
> }
>
> Determining if the sranddev exist failed with the following output:
> Change Dir: /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp
>
> Run Build Command(s):/bin/gmake cmTC_c4a93/fast
> /bin/gmake -f CMakeFiles/cmTC_c4a93.dir/build.make
> CMakeFiles/cmTC_c4a93.dir/build
> gmake[1]: Entering directory
> `/misc/appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp'
> Building C object CMakeFiles/cmTC_c4a93.dir/CheckSymbolExists.c.o
> /appl/gcc-4.9.4/bin/cc   -fPIE   -o
> CMakeFiles/cmTC_c4a93.dir/CheckSymbolExists.c.o   -c
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
> In function ‘main’:
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19:
> error: ‘sranddev’ undeclared (first use in this function)
>return ((int*)())[argc];
>^
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19:
> note: each undeclared identifier is reported only once for each function it
> appears in
> gmake[1]: *** [CMakeFiles/cmTC_c4a93.dir/CheckSymbolExists.c.o] Error 1
> gmake[1]: Leaving directory
> `/misc/appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp'
> gmake: *** [cmTC_c4a93/fast] Error 2
>
> File
> /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
> /* */
> #include 
>
> int main(int argc, char** argv)
> {
>   (void)argv;
> #ifndef sranddev
>   return ((int*)())[argc];
> #else
>   (void)argc;
>   return 0;
> #endif
> }
>
> Performing C SOURCE FILE Test SCANDIR_NEEDS_CONST failed with the
> following output:
> Change Dir: /appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp
>
> Run Build Command(s):/bin/gmake cmTC_9679c/fast
> /bin/gmake -f CMakeFiles/cmTC_9679c.dir/build.make
> CMakeFiles/cmTC_9679c.dir/build
> gmake[1]: Entering directory
> `/misc/appl/src/openbabel-openbabel-3-0-0/build/CMakeFiles/CMakeTmp'
> Building C object 

Re: [Open Babel] compiling python bindings for obabel 3.0

2020-04-20 Thread Noel O'Boyle
Yes 3.0. E.g. from https://github.com/openbabel/openbabel/releases

On Thu, 16 Apr 2020 at 21:25, Bennion, Brian  wrote:

> Is there a later version than 2.3.1.tar.gz that I can download?
> --
> *From:* Noel O'Boyle 
> *Sent:* Thursday, April 16, 2020 1:16 PM
> *To:* Bennion, Brian 
> *Cc:* openbabel-discuss@lists.sourceforge.net <
> openbabel-discuss@lists.sourceforge.net>
> *Subject:* Re: compiling python bindings for obabel 3.0
>
> If you use CMAKE_INSTALL_PREFIX=wherever, then the Python bindings will be
> installed locally, along with the rest of Open Babel. There is no need for
> Conda or pip, etc. Are you saying that this wouldn't work for you for some
> reason? To use it, you just need to set a couple of environment variables.
>
> - Noel
>
> On Thu, 16 Apr 2020 at 21:03, Bennion, Brian  wrote:
>
> I would love to edit the the subject line but outlook online does not
> offer that option that I can find so I am starting a new thread.
>
> The issue we have is that unless I want to have my own personally managed
> and updated python installation (not using our LC compute clusters) the
> current install regime will not work as it tries to modify site package
> directories that I have no write access to.
>
> I would like to have our LC people support this directly so all users have
> access to the tool, but that is not an option right now.
>
> so my options are not use python bindings, a pain in the neck
> create some virtual environment like conda or pip for myself and then
> everyone else has to have access to it or build their own env.
>
> Other options?
> brian
>
>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] compiling python bindings for obabel 3.0

2020-04-16 Thread Noel O'Boyle
If you use CMAKE_INSTALL_PREFIX=wherever, then the Python bindings will be
installed locally, along with the rest of Open Babel. There is no need for
Conda or pip, etc. Are you saying that this wouldn't work for you for some
reason? To use it, you just need to set a couple of environment variables.

- Noel

On Thu, 16 Apr 2020 at 21:03, Bennion, Brian  wrote:

> I would love to edit the the subject line but outlook online does not
> offer that option that I can find so I am starting a new thread.
>
> The issue we have is that unless I want to have my own personally managed
> and updated python installation (not using our LC compute clusters) the
> current install regime will not work as it tries to modify site package
> directories that I have no write access to.
>
> I would like to have our LC people support this directly so all users have
> access to the tool, but that is not an option right now.
>
> so my options are not use python bindings, a pain in the neck
> create some virtual environment like conda or pip for myself and then
> everyone else has to have access to it or build their own env.
>
> Other options?
> brian
>
>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] OpenBabel-discuss Digest, Vol 167, Issue 10

2020-04-16 Thread Noel O'Boyle
Hi Brian,

(Note that it's a good idea to edit the subject when replying to a digest.)

Let's get you set up with the Python bindings. Try it again from a clean
build, and report what you find. Note that the 3.0 release requires that
you have Swig and pass -DRUN_SWIG=TRUE (an oversight on our part).

Regards,
- Noel

On Wed, 15 Apr 2020 at 19:14, Bennion, Brian via OpenBabel-discuss <
openbabel-discuss@lists.sourceforge.net> wrote:

> More context.  I have 500K ligands in a single sdf file.  The names for
> each ligand was found after the sdf file was created.  I would like to
> either replace the label at the top with the appropriate title or add to a
> property value.  Unfortunately, I and others at LLNL have never been able
> to compile python bindings to obabel.
> I am not familiar with pybabel but can look at it.
> Due to the source of the sdf files RDKit chokes on about 50% of them so
> manipulation is not easy there.
>
> Brian
>
>
> -Original Message-
> From: openbabel-discuss-requ...@lists.sourceforge.net <
> openbabel-discuss-requ...@lists.sourceforge.net>
> Sent: Tuesday, April 14, 2020 6:55 AM
> To: openbabel-discuss@lists.sourceforge.net
> Subject: OpenBabel-discuss Digest, Vol 167, Issue 10
>
> Send OpenBabel-discuss mailing list submissions to
> openbabel-discuss@lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
> or, via email, send a message with subject or body 'help' to
> openbabel-discuss-requ...@lists.sourceforge.net
>
> You can reach the person managing the list at
> openbabel-discuss-ow...@lists.sourceforge.net
>
> When replying, please edit your Subject line so it is more specific than
> "Re: Contents of OpenBabel-discuss digest..."
>
>
> Today's Topics:
>
>1. Re: Operating on multi molecule sdf files (Geoffrey Hutchison)
>2. Structure size scaling in 2D depiction (Bakary N'tji Diallo)
>
>
> --
>
> Message: 1
> Date: Tue, 14 Apr 2020 09:53:59 -0400
> From: Geoffrey Hutchison 
> To: "Bennion, Brian" 
> Cc: "openbabel-discuss@lists.sourceforge.net"
> 
> Subject: Re: [Open Babel] Operating on multi molecule sdf files
> Message-ID: 
> Content-Type: text/plain; charset="utf-8"
>
> > After reading the docs I think that adding individual properties to
> individual molecules in a multi molecule sdf files is probably not
> possible?
> > I have an sdf file with 500k molecules and I would like to add a little
> unique identifier that isn?t a supported descriptor to each molecule and
> then write out the altered sdf file.
>
> Personally,  I'd do this with a quick Python script, since a Pybel
> molecule has a data property:
>
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/Python_PybelAPI.html#pybel.Molecule.data
> <
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/Python_PybelAPI.html#pybel.Molecule.data
> >
>
> -Geoff
>
> -- next part --
> An HTML attachment was scrubbed...
>
> --
>
> Message: 2
> Date: Mon, 13 Apr 2020 21:07:56 +0200
> From: "Bakary N'tji Diallo" 
> To: "openbabel-discuss@lists.sourceforge.net mailinglist"
> 
> Subject: [Open Babel] Structure size scaling in 2D depiction
> Message-ID:
>  bu1xjo+qwsjkoj6hpjfwyg...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear all,
>
> I have the following depiction for a structure file. As you can see the
> first compound is scaled up.
>
> [image: image.png]
> Is there way to maintain a uniform structure size.
> I am using the following command: "obabel structure.smi -O out.svg -xC -xe
> -d"
>
> Thanks
> Best regards
> --
>
> Bakary N?tji DIALLO
>
> PhD Student (Bioinformatics) ,
> Research Unit in Bioinformatics (RUBi) 
>
> Mail: diallobaka...@gmail.com |  Skype: diallobakary4
>
> Tel:  +27798233845 | +223 74 56 57 22 | +223 97 39 77 14
> -- next part --
> An HTML attachment was scrubbed...
> -- next part --
> A non-text attachment was scrubbed...
> Name: image.png
> Type: image/png
> Size: 33868 bytes
> Desc: not available
>
> --
>
>
>
> --
>
> Subject: Digest Footer
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
> --
>
> End of OpenBabel-discuss Digest, Vol 167, Issue 10
> **
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___

Re: [Open Babel] Operating on multi molecule sdf files

2020-04-14 Thread Noel O'Boyle
Apart from --addoutindex I think that's right. I'm not sure how we would
implement that in any case, though suggestions are welcome. Can you give a
specific example of what you want to do? Where are these identifiers coming
from?

On the other hand, it's straightforward to do it from Python. As you loop
over the molecules you can add whatever fields you want.


On Tue, 14 Apr 2020, 06:48 Bennion, Brian via OpenBabel-discuss, <
openbabel-discuss@lists.sourceforge.net> wrote:

> Hello
> After reading the docs I think that adding individual properties to
> individual molecules in a multi molecule sdf files is probably not
> possible?
> I have an sdf file with 500k molecules and I would like to add a little
> unique identifier that isn’t a supported descriptor to each molecule and
> then write out the altered sdf file.
> The brute force way would be to output each molecule operate on it and
> then cat them all together.
> Thoughts
>
> Brian
>
>
> ---
> Sent from Workspace ONE Boxer 
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] read molecules from xyz files and merge them

2020-04-10 Thread Noel O'Boyle
Just to add that "addh" and "removeh" don't add and remove hydrogens, they
convert the hydrogens that are explicit in the molecular graph into
implicit hydrogens. I appreciate that the names are misleading, but it's
hard to change them at this point. To actually delete an explicit hydrogen,
you need to use OBMol.DeleteAtom(). To change the number of implicit
hydrogens you would instead use OBAtom.SetImplicitHCount().

To check whether something is correct, you can just write out the SMILES
string.

On Thu, 9 Apr 2020 at 17:31, Geoffrey Hutchison 
wrote:

> >> m1 = mol1.OBMol
> >> m2 = mol2.OBMol
>
>
> You'll want to count the number of atoms in each molecule before you do
> the addition.
>
> >> m1 +=
> m2
> #merging the two molecules
> >> m1.AddBond(1,2,1)
>  ## how do I give the right
> indices here?
>
>
> You just added a bond between atom 1 and atom 2. Most likely these are
> both in mol1.
>
> If you have benzene as m1 and methane as m2, then you have 6 atoms in m1
> and 1 atom in m2, so you want to link atom 1 and atom 7.
>
> Moreover I would like to check whether the bond I have inserted is correct.
>
>
> Probably you want to do this in a Jupyter notebook and depict the molecule.
>
> Certainly, you can get properties from the bond (e.g., start and end atom
> index) but those will be exactly what you specified.
>
> Personally, if you're trying to grow a molecule, I do this all in SMILES
> and generate 3D coordinates later.
>
> 'c1c1' + 'C' = 'c1c1C' # toluene
>
> Now you don't always have the SMILES in the right atom order, but you can
> always abuse SMILES syntax:
>
> 'c1%99c[C]1' + '.C%99' # new bond created to the atom I want...
>
> Hope that helps,
> -Geoff
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] read molecules from xyz files and merge them

2020-04-09 Thread Noel O'Boyle
Use the Python keyword "next" on an iterator to get the next item:

mol1 = next(pybel.readfile()

You can add an OBMol to an existing one:

m1 += m2

I'd recommend writing it out as SMILES at this point, just to check the
structure:

print(pybel.Molecule(m1).write("smi"))

If the hydrogens are explicit in the XYZ, then you can call DeleteAtom() on
the hydrogens to delete them. To create a bond, use AddBond(). See the
Doxygen documentation.

- Noel

On Wed, 8 Apr 2020 at 17:31, Marco Di Gennaro (TME) <
marco.di.genn...@external.toyota-europe.com> wrote:

> Hello everyone,
>
>
>
> I have two molecules (benzene and methane) in two separate xyz files.
>
> I would like to create a methylbenzene molecule out of these and relax it
> with a UFF.
>
> I am new to pybel (and babel in general). I would like to:
>
>- open the two files
>- remove one hydrogen from the benzene and one from the methane
>- create a bond among the two carbons
>- perform UFF relaxation.
>
>
>
> So far I have tried several things, mostly trying to follow this
> discussion (which is a bit outdated actually):
> http://forums.openbabel.org/OBGenericData-and-OBPairData-td4651441.html#a4651899
>
> I could not get much out of it for the moment:
>
>- I could read the files with readfile(), but why do I get an iterator?
>- Is OBBuilder() what I am looking for? How to use it properly?
>- Should I rather use OBPairData() ?
>- I know I can use -d to remove (all) hydrogens in babel. How do I do
>it for specific atoms in pybel?
>
>
>
> Below you can find the little code I could write at the moment. I am
> attaching the two xyz files.
>
> Any help would be greatly appreciated.
>
> Thank you.
>
> Marco
>
>
>
> import pybel as pb
>
> mol1 = [ m for m in pb.readfile('xyz', 'benzene.xyz')][0]
>
> mol2 = [ m for m in pb.readfile('xyz', 'methane.xyz')][0]
>
>
>
> mol1 + mol2 # This gives a TypeError: unsupported operand type(s) for +:
> ‘Molecule’ and ‘Molecule’
>
>
>
> m1 = mol1.OBMol
>
> m2 = mol2.OBMol
>
> m3 = m1 + m2  # This gives a TypeError: unsupported operand type(s) for +:
> ‘OBMol’ and ‘OBMol’
>
>
>
>
>
>
>
> ==
>
> Marco Di Gennaro, Ph.D.
>
> Toyota Motor Europe
>
>
>
> This e-mail may contain confidential information. If you are not an
> addressee or otherwise authorised to receive this message, you should not
> use, copy, disclose or take any action based on this e-mail. If you have
> received this e-mail in error, please inform the sender promptly and delete
> this message and any attachments immediately.
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] compiling openbabel3 on Ubuntu 18.04

2020-04-05 Thread Noel O'Boyle
Hi Thomas,

Just to take a step back, if you need to change the Python that CMake
finds, the relevant CMake variables are (with example values):

-DPYTHON_EXECUTABLE=/usr/bin/python3
-DPYTHON_INCLUDE_DIR=/usr/include/python3.5m -DPYTHON_LIBRARY=/usr/lib64/
libpython3.5m.so

Regarding your question, you'll need to post the output from running cmake
in a clean directory. And the result of running "grep PYTHON
CMakeCache.txt".

Regards,
- Noel

On Thu, 2 Apr 2020 at 17:20, Thomas  wrote:

> Ok, I've went thru all the issues, the installation went smooth and now my
> install folder contains: bin, include, lib, share
>
> I've added this line in my .bashrc:  export
> PYTHONPATH=~/WORKSPACE/OpenBabel/openbabel-3.0.0_INSTALL
> but still i get "ModuleNotFoundError: No module named 'openbabel'"
>
> I don't know if it can be useful, but if I add this path instead:
> ~/WORKSPACE/OpenBabel/openbabel-3.0.0_INSTALL/lib  (the "lib" sub-directory)
> and i digit "import openbabel" it actually imports that namespace, but
> it's pretty empty.
> if i try with "from openbabel import openbabel" instead, I get a different
> error: "ImportError: cannot import name 'openbabel'"
>
>
>
> Il giorno gio 2 apr 2020 alle ore 12:19 Thomas 
> ha scritto:
>
>> Hi there,
>>   I'm trying to compile the latest openbabel 3 on my Ubunu 18.04 machine
>> (at present only openbabel 2 is available on ubuntu's repositories)
>>
>> The cmake output is giving me some issues:
>>
>> cmake ../openbabel-3.0.0
>> -DCMAKE_INSTALL_PREFIX=~/WORKSPACE/OpenBabel/openbabel-3.0.0_INSTALL
>> -DPYTHON_BINDINGS=ON
>>
>>
>> 1) -- Found PythonInterp: /usr/bin/python (found version "2.7.17")
>>
>> I have python 2.7 and 3.6. I'd like to keep them both.
>> I have openbabel 2 installed system wide from the ubuntu repository and
>> bound to python 2 (I want to keep it as it is).
>> I want to bind my fresh openbabel 3 to python 3 (it's a local install, it
>> should be possible).
>> How can I specify which python interpreter to use?
>>
>>
>> 2) -- Attempting to build the GUI
>>  --wxWidgets not found => GUI will not be built
>>
>> Even if i didn't specify to build the GUI, it's doing so. Ok, why not...
>> I've installed wx-common, wx3.0-headers, libwxbase3.0-dev ... still it
>> doesnt find wxWidget. Why?
>> I notice also that i can import wx only from python2, not from python3.
>> How can i get wx available to python3?
>>
>>
>> 3) Warning: Python bindings NOT found. Generate using -DRUN_SWIG=ON
>>
>> What does it means?
>>
>>
>> BTW, in the doc at
>> https://open-babel.readthedocs.io/en/latest/Installation/install.html#compiling-open-babel
>> there are many obsolete information and broken links, where can i report it
>> to get it fixed?
>>
>> Thank you
>> Thomas
>>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Filter options

2020-03-29 Thread Noel O'Boyle
Hi Chris,

Sorry for the delay.

The only detail is whatever you get when you type "obabel -L" and the name
of the descriptor.

To answer some of the questions, descriptors that return 'true' or 'false'
are really filters, e.g. the "-s". They are handled by the same code that
handles true descriptors. And I agree about Lipinski - this should have
returned the number of failures, rather than a true or false - it has
always bugged me. Making this change breaks any code relying on this, but
it's almost useless as it is.

We also need a HAC (heavy atom count) and 'atoms' should always return the
same results regardless of whether hydrogens or explicit or not (this
should be true for all descriptors).

Regarding cansmi (the following example probably makes more sense where the
input is not SMILES):
obabel -:CO -:OC --filter "cansmi=CO" -osmi
CO
OC

Actually, this should be fixed as the following should really give the same
result:
  obabel -:CO -:OC --filter "cansmi=OC" -osmi
but currently gives 0 results. There's no reason why OB can't convert OC to
CO before doing the search.

Formula would be similar.

As you hint, it would be good to extend 'nF' to arbitary atoms. There's
nothing special about fluorine.

Maybe this is an area worth refreshing over the next while, both in terms
of documentation and functionality.

Regards,
- Noel


On Fri, 20 Mar 2020 at 15:11, Chris Swain via OpenBabel-discuss <
openbabel-discuss@lists.sourceforge.net> wrote:

> Hi
>
> I’m looking at the —filter option and as I read the docs the available
> descriptors are and I’ve added, in brackets, a comment/question/guess about
> options for filtering based on the descriptors. Does anyone know if these
> are described in detail anywhere, otherwise I guess I’ll be spending a
> while wit trial and error.
>
> obabel -L descriptors
> abondsNumber of aromatic bonds (integer,>, <, =)
> atomsNumber of atoms (integer,>, <, =)
> bondsNumber of bonds (integer,>, <, =)
> cansmiCanonical SMILES (is this for SMARTS matching? include/exclude?)
> cansmiNSCanonical SMILES without isotopes or stereo
> dbondsNumber of double bonds (integer,>, <, =)
> formulaChemical formula (not sure how to filter)
> HBA1Number of Hydrogen Bond Acceptors 1 (JoelLib) (integer,>, <, =)
> HBA2Number of Hydrogen Bond Acceptors 2 (JoelLib) (integer,>, <, =)
> what is the difference to above?
> HBDNumber of Hydrogen Bond Donors (JoelLib) (integer,>, <, =)
> InChIIUPAC InChI identifier (matches or is this a text string
> comparison?)
> InChIKeyInChIKey (matches,  or is this a text string comparison?)
> L5Lipinski Rule of Five (how is this implemented? According to
> Lipinski you can violate one property?)
> logPoctanol/water partition coefficient (float,>, <, =)
> MPMelting point (is this a calculated property?)
> MRmolar refractivity (float ,>, <, =)
> MWMolecular Weight filter (float ,>, <, =)
> nFNumber of Fluorine Atoms (Integer ,>, <, =, only Fluorine, or does
> it work with other elements eg nCl, nPo)
> rotorsRotatable bonds filter Is this a totable bond count?
> sSMARTS filter (how is this a descriptor of a molecule?)
> sbondsNumber of single bonds (integer ,>, <, =)
> smartsSMARTS filter (is this different to above?)
> tbondsNumber of triple bonds (integer ,>, <, =)
> titleFor comparing a molecule's title (exact text match, case
> sensitive, can use wild cards)
> TPSAtopological polar surface area (float ,>, <, =)
>
> Cheers,
>
> Chris
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Problems deleting a OBMol object

2020-03-07 Thread Noel O'Boyle
TER.cpp"
>
> #include "../LiBELa/COORD_MC.cpp"
>
> #include 
>
> #include 
>
> #include 
>
> #include 
>
>
>
> using namespace std;
>
>
> int main(int argc, char* argv[]) {
>
>
> 
> printf("\n");
>
> 
> printf("\n");
>
> printf("*McConf - Conformer Generation for 
> McLiBELa*\n");
>
> printf("* 
>  *\n");
>
> printf("* University of Sao Paulo 
>  *\n");
>
> printf("* More Info:  
>  *\n");
>
> printf("*  http://www.biotechmol.ifsc.usp.br/ 
>  *\n");
>
> printf("* 
>  *\n");
>
> 
> printf("\n");
>
> 
> printf("\n");
>
>
>
> if (argc < 2){
>
> printf("Usage: %s file.mol2 [input_file]\n", argv[0]);
>
> exit(1);
>
> }
>
>
> PARSER* Input = new PARSER;
>
> Mol2* Mol = new Mol2(Input, string(argv[1]));
>
> WRITER* Writer = new WRITER("McConf", Input);
>
>
> if (argc > 2){
>
> Input->set_parameters(argv[2]);
>
> }
>
>
> Input->write_mol2 = true;
>
> Input->dock_mode = true;
>
>
>
> bool file_read;
>
> OBMol* mol = new OBMol ;
>
> OBConversion* conv = new OBConversion;
>
> OBFormat *format = conv->FormatFromExt(argv[1]);
>
> if (!format || !conv->SetInFormat(format)) {
>
> printf("Could not find input format for file\n");
>
> exit(1);
>
> }
>
>
> ifstream ifs(argv[1]);
>
> if (!ifs) {
>
> printf("Could not open %s for reading\n", argv[1]);
>
> exit(1);
>
> }
>
>
> if (!conv->Read(mol, )) {
>
> printf("Could not read molecule from file\n");
>
> exit(1);
>
> }
>
>
> OBMol* ref_mol = new OBMol;
>
> ifstream ifs2(argv[1]);
>
> conv->Read(ref_mol, );
>
>
> delete conv;
>
> format->~OBFormat();
>
>
> OBForceField* OBff = OBForceField::FindForceField("GAFF");
>
>
> if (!OBff){
>
> printf("Could not find OpenBabel FF parameters!\n");
>
> exit(1);
>
> }
>
>
> // Original conformation energy
>
> OBff->Setup(*mol);
>
> mol->SetTotalCharge(mol->GetTotalCharge());
>
> double energy = OBff->Energy();
>
> if (OBff->GetUnit() == "kJ/mol"){   // Converting to kcal/mol, if 
> needed.
>
> energy = energy/4.18;
>
> }
>
>
> printf("Original energy for molecule %s: %10.4f\n", argv[1], energy);
>
>
> // Conformer Search
>
> OBff->DiverseConfGen(0.5, 1000, 50.0, false);
>
> OBff->GetConformers(*mol);
>
>
> double rmsd;
>
> int conformers = Input->lig_conformers;
>
> if (mol->NumConformers() > 0){
>
> int i=0;
>
> if (mol->NumConformers() < conformers) {
>
> conformers = mol->NumConformers();
>
> }
>
> while (i < conformers){
>
> double *xyz = new double [mol->NumAtoms()*3];
>
> vector v3;
>
> vector > xyz_tmp;
>
> mol->SetConformer(i);
>
> OBff->Setup(*mol);
>
> OBff->GetCoordinates(*mol);
>
> energy = OBff->Energy();
>
> if (OBff->GetUnit() == "kJ/mol"){   // Converting to 
> kcal/mol, if needed.
>
> energy = energy/4.18;
>
> }
>
>
> OBAlign* align = new OBAlign;
>
> align->SetRefMol(

Re: [Open Babel] Other ob tools

2020-03-03 Thread Noel O'Boyle
Well, I don't really agree. They could just add it to obabel in the first
place and get the feedback from the development version. The problem is
that people find it easier to add new executables, rather than spending a
bit of time figuring out how to add a plugin for obabel.

Regards,
- Noel

On Tue, 3 Mar 2020 at 07:52, Chris Swain  wrote:

> Hi,
>
> It is clear that a number of the obtools have been incorporated into
> obabel, however I’m not sure they are all suitable for every file type.
>
> It is perhaps better to think of obtools as way to develop new tools that
> others can hopefully try out and provide feedback. Tools that are regularly
> used and prove to be robust and useful could then be rolled into obabel.
>
> And no I don’t know of a process to do this.
>
> Cheers,
>
> Chris
>
>
> On 2 Mar 2020, at 20:11, Noel O'Boyle  wrote:
>
> It's not a popular opinion, but I think we should have a single robust
> executable. I've never used any of the others, and they are mostly untested.
>
> On Sat, 29 Feb 2020, 18:21 Chris Swain via OpenBabel-discuss, <
> openbabel-discuss@lists.sourceforge.net> wrote:
>
>> Hi,
>>
>> I’m working on an update to iBabel, and was hoping to clear out the tools
>> tab particularly as I’m not sure if some are now supported with OpenBabel
>> 3.0
>>
>> Looking through the directory of openbabel tools that are installed we
>> have
>>
>> obconformer  equiv to  obabel --conformer
>> obdistgen  (generate rough 3D coordinates) now use obabel --gen3D
>> obenergy  equiv to obabel  --energy
>> obfit equiv to --obabel --align
>> obfitall not sure what this is?
>> obgen   equiv to obabel --gen3D (fastest --ff MMFF94s)
>> obgrep equiv to obabel structure searching
>> obminimize  equiv to obabel --minimize (--ff MMFF94s --steps 1000 --sd)
>> obmm apparently this is a this is a 'full featured' MM program but may
>> not be generally useful
>> obprobe (create electrostatic probe grid)
>> obprop (print standard molecular properties), would be more useful if we
>> could get individual properties,e.g. obabel —props   (MW LogP
>> TPSA HBA  HBD RBC)
>> obrms (Calculate the heavy-atom RMSD between two chemically identical
>> structures) perhaps this should be an obabel option?
>> obrotamer (generate conformer/rotamer coordinates, not minimized) better
>> to use —conformer?
>> obrotate  (batch-rotate dihedral angles matching SMARTS patterns)
>> obspectrophore (calculate spectrophore)
>> obsym (detect 3D point group symmetry, only cif files?) sounds like it is
>> to deprecated
>> obtautomer (enumerate tautomer SMILES and canonical tautomer SMILES)
>> obthermo (extract the thermochemistry for a molecule, what file format is
>> needed?)
>>
>> Any insights very welcome,
>>
>> Cheers,
>>
>> Chris
>>
>>
>>
>>
>> ___
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Other ob tools

2020-03-02 Thread Noel O'Boyle
It's not a popular opinion, but I think we should have a single robust
executable. I've never used any of the others, and they are mostly untested.

On Sat, 29 Feb 2020, 18:21 Chris Swain via OpenBabel-discuss, <
openbabel-discuss@lists.sourceforge.net> wrote:

> Hi,
>
> I’m working on an update to iBabel, and was hoping to clear out the tools
> tab particularly as I’m not sure if some are now supported with OpenBabel
> 3.0
>
> Looking through the directory of openbabel tools that are installed we
> have
>
> obconformer  equiv to  obabel --conformer
> obdistgen  (generate rough 3D coordinates) now use obabel --gen3D
> obenergy  equiv to obabel  --energy
> obfit equiv to --obabel --align
> obfitall not sure what this is?
> obgen   equiv to obabel --gen3D (fastest --ff MMFF94s)
> obgrep equiv to obabel structure searching
> obminimize  equiv to obabel --minimize (--ff MMFF94s --steps 1000 --sd)
> obmm apparently this is a this is a 'full featured' MM program but may not
> be generally useful
> obprobe (create electrostatic probe grid)
> obprop (print standard molecular properties), would be more useful if we
> could get individual properties,e.g. obabel —props   (MW LogP
> TPSA HBA  HBD RBC)
> obrms (Calculate the heavy-atom RMSD between two chemically identical
> structures) perhaps this should be an obabel option?
> obrotamer (generate conformer/rotamer coordinates, not minimized) better
> to use —conformer?
> obrotate  (batch-rotate dihedral angles matching SMARTS patterns)
> obspectrophore (calculate spectrophore)
> obsym (detect 3D point group symmetry, only cif files?) sounds like it is
> to deprecated
> obtautomer (enumerate tautomer SMILES and canonical tautomer SMILES)
> obthermo (extract the thermochemistry for a molecule, what file format is
> needed?)
>
> Any insights very welcome,
>
> Cheers,
>
> Chris
>
>
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Problems deleting a OBMol object

2020-03-01 Thread Noel O'Boyle
It would help us if you could provide the shortest possible (but complete)
example code that exhibits the problem. As it is, you say the problem is
when you delete the molecule, but there is no line that deletes the
molecule.

On Thu, 27 Feb 2020 at 16:19, Alessandro S. Nascimento <
asnascime...@ifsc.usp.br> wrote:

> Dear OpenBabel users,
>
> I am trying to write a piece of C++ code to generate conformers using the
> OpenBabel API. My current code is mostly based on OB tutorials... not
> really a big deal.
>
> Almost everything seems to be working. The problem is with memory
> allocation. When my function gets out of scope, it gives me a mem leak:
> malloc: *** error for object 0x103300350: pointer being freed was not
> allocated
> *** set a breakpoint in malloc_error_break to debug.
> which seems to be related to the object mol (OBMol mol).
>
> I tried the dynamic allocation with new/delete and got exactly the same
> thing when trying to delete the object mol in the second function below. No
> problems when deleting the ref_mol object.
>
> My initial guess was that I had to clear the conformers generated before
> deleting the object. I then tried to use DeleteConformer function with no
> success.
>
> Any clues/ideas? They are all very welcome!
>
> My OB version is 3.0.0 and my current OS is MacOS Sierra 10.12.6:
> $g++ -v
> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
> --with-gxx-include-dir=/usr/include/c++/4.2.1
> Apple LLVM version 9.0.0 (clang-900.0.39.2)
> Target: x86_64-apple-darwin16.7.0
> Thread model: posix
> InstalledDir:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>
> Thanks in advance,
>
> -Alessandro
>
> OBMol Conformer::GetMol(const std::string ){
>
> OBMol mol;
>
> OBConversion conv;
>
> OBFormat *format = conv.FormatFromExt(molfile.c_str());
>
> if (!format || !conv.SetInFormat(format)) {
>
> printf("Could not find input format for file\n");
>
> return mol;
>
>   }
>
> ifstream ifs(molfile.c_str());
>
> if (!ifs) {
>
> printf("Could not open %s for reading\n", molfile.c_str());
>
> return mol;
>
> }
>
> if (!conv.Read(, )) {
>
> printf("Could not read molecule from file\n");
>
> return mol;
>
> }
>
> return mol;
>
> }
>
>
> **
>
> bool file_read;
>
> OBMol mol = this->GetMol(molfile);
>
> OBMol ref_mol = this->GetMol(molfile);
>
>
> OBForceField* OBff;
>
> if (Input->ligand_energy_model == "GAFF" or Input->ligand_energy_model == 
> "gaff"){
>
> OBff = OBForceField::FindForceField("GAFF");
>
> }
>
> else {
>
> OBff = OBForceField::FindForceField("MMFF94");
>
> }
>
>
> if (!OBff){
>
> printf("Could not find OpenBabel FF parameters!\n");
>
> exit(1);
>
> }
>
>
> OBff->Setup(mol);
>
> mol.SetTotalCharge(mol.GetTotalCharge()); // necessary?
>
> double energy = OBff->Energy();
>
> if (OBff->GetUnit() == "kJ/mol"){   // Converting to kcal/mol, if 
> needed.
>
> energy = energy/4.18;
>
> }
>
> Lig->conformer_energies.push_back(energy);
>
> Lig->mcoords.push_back(Lig->xyz);
>
>
> // Conformer
>
> OBff->DiverseConfGen(0.5, 1000, 50.0, false);
>
> OBff->GetConformers(mol);
>
>
> if (mol.NumConformers() > 0){
>
> for (int i=0; i
> double* xyz = new double[mol.NumAtoms()*3];
>
> vector v3;
>
> vector > xyz_tmp;
>
> mol.SetConformer(i);
>
> OBff->Setup(mol);
>
> OBff->GetCoordinates(mol);
>
> energy = OBff->Energy();
>
> if (OBff->GetUnit() == "kJ/mol"){   // Converting to 
> kcal/mol, if needed.
>
> energy = energy/4.18;
>
> }
>
> Lig->conformer_energies.push_back(energy);
>
>
> OBAlign* align = new OBAlign;
>
> align->SetRefMol(ref_mol);
>
> align->SetTargetMol(mol);
>
> align->Align();
>
> align->UpdateCoords();
>
> delete align;
>
>
> xyz = mol.GetCoordinates();
>
> for (unsigned j=0; j
> v3.push_back(xyz[3*j]);
>
> v3.push_back(xyz[(3*j)+1]);
>
> v3.push_back(xyz[(3*j)+2]);
>
> xyz_tmp.push_back(v3);
>
> v3.clear();
>
> }
>
> Lig->mcoords.push_back(xyz_tmp);
>
> xyz_tmp.clear();
>
>
> delete[] xyz;
>
> }
>
> file_read = true;
>
> }
>
> else {
>
> file_read = false;
>
> }
>
>
> ref_mol.Clear();
>
> mol.Clear();
>
>
> return file_read;
>
>
> --
> 
> Alessandro S. Nascimento
> Professor
> São Carlos Institute of Physics (IFSC)
> University of São Paulo (USP)
> E-mail: asnascime...@ifsc.usp.br
> Phone: 

Re: [Open Babel] First steps with OpenBabel

2020-03-01 Thread Noel O'Boyle
atom.GetResidue() has the PDB information.

for atom in ob.OBMolAtomIter(mol.OBMol):
residue = atom.GetResidue()
print("%d %s %s" % (residue.GetIdx(), residue.GetName(),
residue.GetAtomID(atom)))

Regarding addh(), I'm not sure what DSSP is.

On Sun, 16 Feb 2020 at 15:40, Athanasios Anastasiou 
wrote:

> Hello
>
> I am trying to obtain some information from a PDB file, using openbabel,
> but I find myself going in a roundabout way getting itand this is not a
> good sign, so I was wondering if I could get some help around the following
> (?):
>
> 1. Having read a PDB and obtained a reference to a pybel.Atom / OBAtom,
> which attribute corresponds to the "Element Symbol" of the ATOM record?
> Alternatively, what would be a generic way of inferring it from the "type"?
> Is it always "[A-Z][a-z]*[0-9]+"?
>
> 2. Alternatively to 1, how can I select all atoms that belong to a main
> chain of a molecule?
>
> 3. How close is the "addh()" function to the way the DSSP works? Once
> "addh()" is called, hydrogens are added and their bond lengths are worked
> out. Each "H" is marked as a "donor_h" and adjacent atoms are marked with
> donor / acceptor attributes. However, that "H" appears to be attached only
> on one side (to its donor) and the acceptor is flagged but not "attached".
> Would I be too wrong if I run a "nearest neighbour that is also acceptor"
> query and "attach" it myself? And if I was to do this wouldn't I now know
> where the hydrogen bonds are and from the respective distances to all known
> atoms, be able to work out its energy (?). (Just as DSSP does).
>
> 4. There are H Bonds that are also flagged away from (what I think is) the
> main chain of a molecule. In one example, there are two H that are flagged
> as the hbond_donor_h's which are attached to a "Nam" (?) that is marked as
> "donor". This in turn is attached to a C and that C is also attached to an
> O. That O is marked as an "acceptor". What happens in that case? Would I
> simply ignore that or attempt to still go ahead and infer a bond?
>
> All the best
> thanOS
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Removal from Mail List

2020-02-05 Thread Noel O'Boyle
Hi Emmanuel,

To unsubscribe, please follow the link at the bottom of every mailing list
email. If this doesn't work, please let us know and we can do it from this
end.

Regards,
- Noel

On Wed, 5 Feb 2020 at 10:00, Emmanuel Adeyemi via OpenBabel-discuss <
openbabel-discuss@lists.sourceforge.net> wrote:

> Dear Team,
>
> Thank you for the help with my work. However, I would like to stop
> receiving emails from the forum. I would appreciate if my email could be
> removed from your list.
>
> Best Regards,
>
> Emmanuel Adeyemi
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Python: Getting atomic forces after a FF optimization

2020-02-04 Thread Noel O'Boyle
Untested, but try "mol.GetData(ob.ConformerData)". I note that the value of
ConformerData is 4 not 1.

- Noel

On Tue, 4 Feb 2020 at 00:10, Shiring, Stephen B  wrote:

> Hi all,
>
>
>
> I’m writing a Python script to screen a bunch of molecules, and for part
> of that I would like to read in and optimize a geometry using OpenBabel’s
> ForceField methods subjected to a couple constraints. I would like to
> obtain the resulting forces for each atom from the optimization to use as
> an initial cut off. Avagadro will print out force arrows during an
> optimization and I see in the API documentation that functions exist to
> obtain the forces, however, I keep getting an error when I try to implement
> this. For reference, I am using OpenBabel 2.4.1 installed through conda.
>
>
>
> Using the openbabel module with
>
> --
>
> conv = openbabel.OBConversion()
>
> conv.SetInAndOutFormats('xyz','xyz')
>
>
>
> mol = openbabel.OBMol()
>
> conv.ReadFile(mol,'my_molecule.xyz’)
>
>
>
> constraints = openbabel.OBFFConstraints()
>
> constraints.AddAtomConstraint(1)
>
> constraints.AddAtomConstraint(2)
>
>
>
> forcefield = openbabel.OBForceField.FindForceField("UFF")
>
> forcefield.Setup(mol, constraints)
>
> forcefield.SetConstraints(constraints)
>
>
>
> forcefield.ConjugateGradients(500)
>
> forcefield.GetCoordinates(mol)
>
>
>
> data = openbabel.toConformerData(mol.GetData(1))
>
> f = data.GetForces()
>
>
>
> --
>
>
>
> I get this error:
>
> --
>
> terminate called after throwing an instance of 'std::bad_alloc'
>
>   what():  std::bad_alloc
>
> Aborted
>
> --
>
>
>
> Can anyone shed any light on this and possibly point me in the right
> direction?
>
>
>
> Thanks for your time,
>
>
> Stephen
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Using Pybel to generate mopac input files

2020-01-07 Thread Noel O'Boyle
Sorry, FindType().

On Tue, 7 Jan 2020, 20:38 Markus Grimm via OpenBabel-discuss, <
openbabel-discuss@lists.sourceforge.net> wrote:

> Hi Noel,
>
> thank you very much!
>
> Unfortunately I got an error when I tried the FindPlugin() function.
>
> Code:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *import pybel# Set up converterconv =
> pybel.ob.OBConversion()conv.SetOutFormat("mop")conv.AddOption("k",
> conv.OUTOPTIONS, "SYMMETRY PM7 UHF STATIC")conv.Convert()gen3d =
> openbabel.OBOp.FindPlugin("gen3d")# Get a moleculemol = readstring("smi",
> "C=C(C)CCC")gen3d.Do(mol.OBMol)output = conv.WriteString(mol.OBMol)print
> (output)*
>
> What did I do wrong?
>
> However I had a look at the Pybel API documentation on Github and I found
> the make3D function.
> With the following code and your suggestion of getting rid of the
> Conversion Object I achieved the result I wanted:
>
> *mol = readstring("smi", "C=C(C)CCC")*
>
>
> *mol.make3D()output = out = mol.write("mop", opt={"k":"SYMMETRY PM7 UHF
> STATIC"})*
> *print(output)*
>
> Output:
>
> SYMMETRY PM7 UHF STATIC
>
>
> C   0.89335 1  0.00286 1 -0.01617 1
> C   2.23793 1  0.02055 1  0.00771 1
> C   2.97498 1  0.80100 1  1.06089 1
> C   3.03015 1 -0.74861 1 -1.03024 1
> C   4.54982 1 -0.63509 1 -0.87704 1
> C   5.29276 1 -1.42196 1 -1.93888 1
> H   0.30804 1  0.54711 1  0.71827 1
> H   0.34596 1 -0.55513 1 -0.76914 1
> H   2.29548 1  1.31150 1  1.74978 1
> H   3.60564 1  1.56767 1  0.59910 1
> H   3.60564 1  0.13608 1  1.65997 1
> H   2.74736 1 -0.39011 1 -2.02913 1
> H   2.74735 1 -1.80860 1 -0.97797 1
> H   4.85585 1 -1.00644 1  0.10783 1
> H   4.85585 1  0.41523 1 -0.94569 1
> H   5.04484 1 -2.48579 1 -1.88112 1
> H   6.37179 1 -1.31269 1 -1.79142 1
> H   5.04484 1 -1.05708 1 -2.93985 1
>
> Thank you very much Noel!
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Using Pybel to generate mopac input files

2020-01-07 Thread Noel O'Boyle
Hi Markus,

In the world of Open Babel, "gen3d" is an 'operation' rather than an input
or output option. These are only triggered when using
OBConversion::Convert, which is not very friendly for Python use (we should
do something about this). Anyway, you just need to trigger the operation
yourself on the molecule after reading it in, e.g. gen3d =
openbabel.OBOp.FindPlugin("gen3d") and then gen3d.Do(mol.OBMol).

And just to note in passing that you can simplify things a bit by using
Pybel to write out the file, e.g. out = mol.write("mop",
opt={"k":"MYKEYWORDS"}), rather than messing around with OBConversion.

- Noel

On Wed, 8 Jan 2020 at 01:03, Markus Grimm via OpenBabel-discuss <
openbabel-discuss@lists.sourceforge.net> wrote:

> Hello everyone,
> I'm trying to generate some mopac files with some specified key words from
> smiles. In obabel in the command line I use the following code for instance:
>
> *obabel -:"C=C(C)CCC" -xk "SYMMETRY PM7 UHF STATIC" -omop -OE1.mop --gen3D*
>
> Now I'm trying to reproduce this in Pybel. SO far I have the following
> code with the corresponding output:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *import pybel# Set up converterconv =
> pybel.ob.OBConversion()conv.SetOutFormat("mop")conv.AddOption("k",
> conv.OUTOPTIONS, "SYMMETRY PM7 UHF STATIC")conv.AddOption("gen3d",
> conv.OUTOPTIONS)#conv.Convert()# Get a moleculemol = readstring("smi",
> "C=C(C)CCC")output = conv.WriteString(mol.OBMol)print (output)*
>
> Output E1.mop file:
>
> SYMMETRY PM7 UHF STATIC
>
>
> C   0.0 1  0.0 1  0.0 1
> C   0.0 1  0.0 1  0.0 1
> C   0.0 1  0.0 1  0.0 1
> C   0.0 1  0.0 1  0.0 1
> C   0.0 1  0.0 1  0.0 1
> C   0.0 1  0.0 1  0.0 1
>
> As you can see the generated E1.mop file has no 3D coordinates. Every atom is 
> on the same position.
>
> How can I incorporate the option gen3D in pybel for the generation of valid 
> mopac files?
>
> Thank you very much in advance for any help!
>
> Best regards,
>
> Markus Grimm
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] cmake and make Errors with OpenBabel Compiling

2020-01-07 Thread Noel O'Boyle
Hi Justice,

It looks like CMake is not part of Xcode. You can just download and install
it separately from https://cmake.org/download/.

When you run this, it will create the Makefile that "make" will use.

Regards,
- Noel

On Tue, 7 Jan 2020 at 14:24, Justice Calderon  wrote:

> To whom this may concern,
>
> I am trying to compile openbabel on Mac OS Catalina with the gcc compiler
> and I am getting errors with the cmake and make commands. I have Xcode
> installed so the command lines should be available unless there is
> something missing. Would you mind being of assistance with this matter? I
> have the .out files attached here. Thank you!
>
> Best,
> Justice Calderon
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Concatenate Smiles

2019-11-18 Thread Noel O'Boyle
Hi Markus,

Concatenating SMILES strings may not be the best way to solve this problem.
I would just create a bond between the two atoms from Python and set the
charges to zero, and adjust hydrogens (if necessary).

But since you asked...:-)

$ obabel -:"O=C1CCC(=O)[N-]1" -xf 7 -osmi
[N-]1C(=O)CCC1=O

$ obabel -:"C1=C2CCCN3CCC(=C23)C=C1[CH+]C1=CC2=C3C(=C1)CCCN3CC2" -xl 13
-osmi
c1c2CCCN3CCc(c23)cc1[C+](c1cc2c3c(c1)CCCN3CC2)

With Python's string replace(), replace [N-] with N, and [C+] with C
(assuming only a single instance of each in the strings), then concatenate:

c1c2CCCN3CCc(c23)cc1C(c1cc2c3c(c1)CCCN3CC2)N1C(=O)CCC1=O

You might be wondering where I got the numbers 7 and 13 from. Well, I just
counted atoms in the SMILES string from the left starting at 1. If using
Python, just get the Idx() of the atom that is a nitrogen and has a
positive charge (and similarly for the C+).

Regards,
- Noel



On Sun, 17 Nov 2019 at 16:58, Markus Grimm via OpenBabel-discuss <
openbabel-discuss@lists.sourceforge.net> wrote:

> Hello everyone,
>
> I'm trying to concatenate two smiles to get the product of some reactions.
> In general, it is mostly clear where the bond is formed. An example:
>
> Nucleophile: O=C1CCC(=O)[N-]1
> Substrate: C1=C2CCCN3CCC(=C23)C=C1[CH+]C1=CC2=C3C(=C1)CCCN3CC2
> I want to rearrange the smiles always under some conditions. In this
> example depending on where the charge is located respectively. So the bond
> is formed between the [N-] and the [CH+]. I know openbabel can reorder the
> smiles based on the atom number. But I'm clueless about how to use it. Is
> there any way how to implement my problem in pybel?
>
> Best regards,
> Markus
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Using Openbabel with a New Package

2019-11-04 Thread Noel O'Boyle
People are working on it (see
https://github.com/conda-forge/openbabel-feedstock) but there are some
problems, as far as I understand.

On Mon, 14 Oct 2019 at 16:17, Asim Alenaizan  wrote:

> I see that Openbabel 3.0.0 has been released. Can I request that a windows
> conda package is added to the conda-forge channel in addition to the linux
> and mac packages available there?
>
> Thanks,
> Asim
>
> On Wed, Oct 2, 2019 at 4:59 PM Asem Alenaizan 
> wrote:
>
>> Excellent! This seems to work.
>>
>> A second point is that I still need to set BABEL_DATADIR to the correct
>> path when I use the conda package in Windows, unlike in Linux and Mac. This
>> is a minor issue but It would be convenient if users do not need to mess
>> with environment variables.
>>
>>
>>
>> Thanks for your help,
>>
>> Asim
>>
>>
>>
>> *From: *Noel O'Boyle 
>> *Sent: *Wednesday, October 2, 2019 4:09 PM
>> *To: *Asem Alenaizan 
>> *Cc: *Geoffrey Hutchison ;
>> openbabel-discuss@lists.sourceforge.net
>> *Subject: *Re: [Open Babel] Using Openbabel with a New Package
>>
>>
>>
>> It took me a little while to figure it out, but try adding the following
>> to your CMake file:
>>
>> add_definitions(-DUSING_DYNAMIC_LIBS)
>>
>>
>>
>> On Wed, 2 Oct 2019 at 12:34, Noel O'Boyle  wrote:
>>
>> I will try and get some time to look at this. My only thought at the
>> moment is that the Windows build has its own babelconfig.h; I forget the
>> details at the moment, but you need to include that instead of the
>> 'default' one.
>>
>>
>>
>> - Noel
>>
>>
>>
>> On Sun, 29 Sep 2019 at 19:51, Asem Alenaizan 
>> wrote:
>>
>> It seems the problem is not related to the conda package. Even when I
>> compile openbabel myself and link to it, and compile my program with the
>> same compiler, I still fail to find the force field. Is there a reason that
>> this is the case? This is specific to windows. I did not find this issue
>> for Linux and Mac.
>>
>>
>>
>> Asim
>>
>>
>>
>>
>>
>> *From: *Asem Alenaizan 
>> *Sent: *Friday, September 27, 2019 4:06 PM
>> *To: *Geoffrey Hutchison 
>> *Cc: *Noel O'Boyle ;
>> openbabel-discuss@lists.sourceforge.net
>> *Subject: *RE: [Open Babel] Using Openbabel with a New Package
>>
>>
>>
>> Setting BABEL_LIBDIR does not fix the problem.
>>
>>
>>
>> Asim
>>
>>
>>
>>
>>
>> *From: *Geoffrey Hutchison 
>> *Sent: *Friday, September 27, 2019 3:09 PM
>> *To: *Asem Alenaizan 
>> *Cc: *Noel O'Boyle ;
>> openbabel-discuss@lists.sourceforge.net
>> *Subject: *Re: [Open Babel] Using Openbabel with a New Package
>>
>>
>>
>> The program can be compiled and linked correctly against openbabel, but I
>> cannot find the force field.
>>
>>
>>
>> Noel's question is whether you can use the standard command-line tools
>> and convert files:
>>
>>
>>
>> obabel -L forcefields
>>
>> obabel -: -omol --gen3d
>>
>>
>>
>> Finding the plugins is done using the BABEL_LIBDIR environment variable:
>>
>> https://openbabel.org/docs/dev/Installation/install.html
>>
>>
>>
>> Hope that helps,
>>
>> -Geoff
>>
>>
>>
>>
>>
>>
>>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] How to install pybel?

2019-11-04 Thread Noel O'Boyle
Yes - up to date documentation can be found at
https://openbabel.github.io/docs/3.0/. Is it possible to do a redirect,
Geoff?

On Thu, 31 Oct 2019 at 22:58, Peng Yu  wrote:

> So the documentation
> https://openbabel.org/docs/dev/UseTheLibrary/Python_PybelAPI.html#pybel-api
> is outdated? Thanks.
>
> On 10/31/19, Geoffrey Hutchison  wrote:
> >> This one does seem to be the same the above one.
> >> https://pypi.org/project/pybel
> >
> > You want:
> > https://pypi.org/project/openbabel/  >
> >
> > Or:
> > https://anaconda.org/conda-forge/openbabel
> > 
> >
> > See
> >
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/migration.html#migrating-to-3-0
> > <
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/migration.html#migrating-to-3-0
> >
> > for more details.
> >
> > (Not sure when all of these will get updated to 3.0.0)
> >
> > -Geoff
>
>
> --
> Regards,
> Peng
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Strange behaviour with pdbqt format

2019-11-04 Thread Noel O'Boyle
"snap install openbabel" on ubuntu will install version 3.0. To run it, use
openbabel.obabel.

On Mon, 21 Oct 2019 at 13:33, Horacio Pérez Sánchez  wrote:

> Last Ubuntu version
> Thanks
>
> On 10 Oct 2019, at 02:27, Geoffrey Hutchison 
> wrote:
>
> Is it possible to get the binary of the last development version? Or only
> the source?
>
>
> We are currently building binaries of 3.0 - what platform do you use?
>
> -Geoff
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
>
> --
> "Este mensaje es privado y confidencial y se dirige exclusivamente a su
> destinatario. Si usted recibe este mensaje por error, no debe revelar,
> distribuir o copiar este e-mail. Por favor, comuníquelo al remitente y
> borre el mensaje y los archivos adjuntos de su sistema. No hay renuncia a la
> confidencialidad ni a ningún privilegio a causa de una transmisión
> errónea o por mal funcionamiento".
>
> "This message is private and confidential and it is intended exclusively
> for the addressee. If your receive this message by mistake, you should not
> disseminate, distribute or copy this e-mail. Please inform the sender and
> delete the message and attachments from your system. No confidentiality or
> any privilege regarding the information is waived or lost by any
> mistransmission or malfunction".
>
> No me imprimas si no es necesario.
> Don't print me unless it's necessary.
>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] How to draw structure from SMILES?

2019-11-01 Thread Noel O'Boyle
The "brew info" is describing the new version, which appears to include
cairo. Why not get rid of 2.4.1 and install 3.0.0, and see if that works?

On Thu, 31 Oct 2019 at 23:03, Peng Yu  wrote:

> I got the following error. Do you know what is wrong? Thanks.
>
> $ obabel '-:C(=O)Cl' -O acidchloride.png
> ==
> *** Open Babel Error  in PNG Format
>   PNG2Format not found. Probably the Cairo library is not loaded.
> -1 PNG_files converted
> $  obabel --version
> No input file or format spec or possibly a misplaced option.
> Most options must come after the input files. (-i -o -O -m can be
> anywhwere.)
>
> Open Babel 2.4.1 -- May  7 2017 -- 19:35:41
> Usage:
> obabel [-i]  [-o] -O
> [Options]
> Try  -H option for more information.
> $ brew info open-babel
> open-babel: stable 3.0.0 (bottled), HEAD
> Chemical toolbox
> https://openbabel.org
> /usr/local/Cellar/open-babel/2.4.1 (313 files, 15.5MB) *
>   Built from source on 2017-05-07 at 19:36:16
> From:
> https://github.com/Homebrew/homebrew-core/blob/master/Formula/open-babel.rb
> ==> Dependencies
> Build: cmake ✘, pkg-config ✔, rapidjson ✘, swig ✔
> Required: cairo ✔, eigen ✘, python ✔
> ==> Options
> --HEAD
> Install HEAD version
> ==> Analytics
> install: 263 (30 days), 591 (90 days), 2,380 (365 days)
> install_on_request: 248 (30 days), 564 (90 days), 2,259 (365 days)
> build_error: 0 (30 days)
>
> On 10/31/19, Geoffrey Hutchison  wrote:
> >> Although there are many online tools (e.g., PubChem sketcher) to draw
> >> structure from SMILES
> >
> >
> > You can generate 2D depictions as mentioned in the docs:
> > https://open-babel.readthedocs.io/en/latest/Depiction/depiction.html
> > 
> >
> > Hope that helps,
> > -Geoff
>
>
> --
> Regards,
> Peng
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Strange behaviour with pdbqt format

2019-10-03 Thread Noel O'Boyle
Have you tried the latest code? If the problem persists with the latest
development code, could you please file a bug.

Thanks,
   Noel

On Wed, 18 Sep 2019 at 11:38, HORACIO EMILIO PEREZ SANCHEZ 
wrote:

> Hi,
>we are using Open Babel 2.4.1 and we have found a very strange
> behaviour when converting pdbqt format; for instance:
>
>
>   a) babel 3CQA.pdbqt 3CQA_2.pdbqt
>
>   (file is pasted below)
>
>   it makes unnecessary modifications to several parts of the file
>
>   or
>
>   b) babel *.pdbqt -opdbqt test_join.pdbqt
>
>   in our case this could be
>
>   babel 3CQA.pdbqt 3CQA.pdbqt -opdbqt test_join.pdbqt
>
>   when we want to join all pdbqt files into a single one, it distorts
> some of the pdbqt files
>
>   What can be the reason?
>
>   Thanks
>
>
>
>   === 3CQA.pdbqt =
>   REMARK  12 active torsions:
> REMARK  status: ('A' for Active; 'I' for Inactive)
> REMARK1  Abetween atoms: C1_1  and  C16_40
> REMARK2  Abetween atoms: C1_1  and  O7_41
> REMARK3  Abetween atoms: C3_5  and  O6_38
> REMARK4  Abetween atoms: C4_7  and  O5_36
> REMARK5  Abetween atoms: C5_9  and  O1_14
> REMARK6  Abetween atoms: O1_14  and  C7_15
> REMARK7  Abetween atoms: C7_15  and  C8_17
> REMARK8  Abetween atoms: C7_15  and  O2_19
> REMARK9  Abetween atoms: C9_21  and  C10_23
> REMARK   10  Abetween atoms: C13_28  and  O3_32
> REMARK   11  Abetween atoms: C14_29  and  O4_34
> REMARK   12  Abetween atoms: C16_40  and  O9_44
> ROOT
> ATOM  1  C1  <1> d   1  -5.339   2.673  -0.768  0.00  0.00
> 0.141 C
> ATOM  2  C2  <1> d   1  -5.512   3.793  -1.794  0.00  0.00
>  -0.096 C
> ATOM  3  H21 <1> d   1  -6.503   4.255  -1.674  0.00  0.00
> 0.079 H
> ATOM  4  H22 <1> d   1  -5.532   3.384  -2.813  0.00  0.00
> 0.079 H
> ATOM  5  C3  <1> d   1  -4.427   4.866  -1.699  0.00  0.00
> 0.153 C
> ATOM  6  H3  <1> d   1  -3.474   4.479  -2.074  0.00  0.00
> 0.104 H
> ATOM  7  C4  <1> d   1  -4.255   5.402  -0.271  0.00  0.00
> 0.075 C
> ATOM  8  H4  <1> d   1  -3.426   6.119  -0.264  0.00  0.00
> 0.052 H
> ATOM  9  C5  <1> d   1  -4.032   4.272   0.749  0.00  0.00
> 0.127 C
> ATOM 10  H5  <1> d   1  -4.049   4.682   1.767  0.00  0.00
> 0.054 H
> ATOM 11  C6  <1> d   1  -5.144   3.220   0.654  0.00  0.00
>  -0.102 C
> ATOM 12  H61 <1> d   1  -4.922   2.389   1.336  0.00  0.00
> 0.076 H
> ATOM 13  H62 <1> d   1  -6.089   3.654   1.007  0.00  0.00
> 0.076 H
> ENDROOT
> BRANCH   9  14
> ATOM 14  O1  <1> d   1  -2.801   3.581   0.554  0.00  0.00
>  -0.449 OA
> BRANCH  14  15
> ATOM 15  C7  <1> d   1  -1.660   4.418   0.690  0.00  0.00
> 0.364 C
> ATOM 16  H7  <1> d   1  -1.848   5.393   0.240  0.00  0.00
>  -0.371 H
> BRANCH  15  17
> ATOM 17  C8  <1> d   1  -0.527   3.740  -0.014  0.00  0.00
> 0.121 C
> ATOM 18  H8  <1> d   1  -0.754   3.451  -1.040  0.00  0.00
>  -0.190 H
> ATOM 19  C9  <1> d   1   0.682   3.466   0.497  0.00  0.00
>  -0.337 C
> ATOM 20  H9  <1> d   1   0.943   3.761   1.510  0.00  0.00
> 0.216 H
> BRANCH  19  21
> ATOM 21  C10 <1> d   1   1.728   2.772  -0.260  0.00  0.00
>  -0.114 A
> ATOM 22  C11 <1> d   1   3.040   3.277  -0.228  0.00  0.00
> 0.135 A
> ATOM 23  H11 <1> d   1   3.261   4.187   0.327  0.00  0.00
>  -0.050 H
> ATOM 24  C15 <1> d   1   4.075   2.632  -0.914  0.00  0.00
> 0.065 A
> ATOM 25  C14 <1> d   1   3.792   1.470  -1.619  0.00  0.00
> 0.206 A
> ATOM 26  H15 <1> d   1   5.078   3.047  -0.880  0.00  0.00
>  -0.001 H
> ATOM 27  C13 <1> d   1   2.500   0.954  -1.640  0.00  0.00
>  -0.073 A
> ATOM 28  C12 <1> d   1   1.465   1.592  -0.970  0.00  0.00
>  -0.117 A
> ATOM 29  H12 <1> d   1   0.468   1.161  -0.995  0.00  0.00
> 0.138 H
> BRANCH  25  30
> ATOM 30  O4  <1> d   1   4.749   0.781  -2.312  0.00  0.00
>  -0.493 OA
> ATOM 31  H4  <1> d   1   5.586   1.270  -2.230  0.00  0.00
> 0.437 HD
> ENDBRANCH  25  30
> BRANCH  27  32
> ATOM 32  O3  <1> d   1   2.256  -0.203  -2.325  0.00  0.00
>  -0.417 OA
> ATOM 33  H3  <1> d   1   3.131  -0.454  -2.689  0.00  0.00
> 0.337 HD
> ENDBRANCH  27  32
> ENDBRANCH  19  21
> ENDBRANCH  15  17
> BRANCH  15  34
> ATOM 34  O2  <1> d   1  -1.363   4.691   2.048  0.00  0.00
>  -0.108 OA
> ATOM 35  H2  <1> d   1  -1.190   3.852   2.482  0.00  0.00
> 0.450 HD
> ENDBRANCH  15  34
> ENDBRANCH  14  15
> ENDBRANCH   9  14
> BRANCH   7  36
> ATOM 36  O5  <1> d   1  -5.439   6.147   0.051  0.00  0.00
>  -0.542 OA
> ATOM 37  H5  <1> d   1  -5.301   6.565   0.921  0.00  0.00
> 0.430 HD
> ENDBRANCH   7  36
> BRANCH   5  38
> ATOM 38  O6  <1> d   1  -4.805   5.961  -2.541  0.00  0.00
>  -0.599 OA
> ATOM 39  H6  <1> d   1  -5.461   6.464  -2.013  0.00  0.00
> 0.409 HD
> ENDBRANCH   5  

Re: [Open Babel] Using Openbabel with a New Package

2019-10-02 Thread Noel O'Boyle
I will try and get some time to look at this. My only thought at the moment
is that the Windows build has its own babelconfig.h; I forget the details
at the moment, but you need to include that instead of the 'default' one.

- Noel

On Sun, 29 Sep 2019 at 19:51, Asem Alenaizan  wrote:

> It seems the problem is not related to the conda package. Even when I
> compile openbabel myself and link to it, and compile my program with the
> same compiler, I still fail to find the force field. Is there a reason that
> this is the case? This is specific to windows. I did not find this issue
> for Linux and Mac.
>
>
>
> Asim
>
>
>
>
>
> *From: *Asem Alenaizan 
> *Sent: *Friday, September 27, 2019 4:06 PM
> *To: *Geoffrey Hutchison 
> *Cc: *Noel O'Boyle ;
> openbabel-discuss@lists.sourceforge.net
> *Subject: *RE: [Open Babel] Using Openbabel with a New Package
>
>
>
> Setting BABEL_LIBDIR does not fix the problem.
>
>
>
> Asim
>
>
>
>
>
> *From: *Geoffrey Hutchison 
> *Sent: *Friday, September 27, 2019 3:09 PM
> *To: *Asem Alenaizan 
> *Cc: *Noel O'Boyle ;
> openbabel-discuss@lists.sourceforge.net
> *Subject: *Re: [Open Babel] Using Openbabel with a New Package
>
>
>
> The program can be compiled and linked correctly against openbabel, but I
> cannot find the force field.
>
>
>
> Noel's question is whether you can use the standard command-line tools and
> convert files:
>
>
>
> obabel -L forcefields
>
> obabel -: -omol --gen3d
>
>
>
> Finding the plugins is done using the BABEL_LIBDIR environment variable:
>
> https://openbabel.org/docs/dev/Installation/install.html
>
>
>
> Hope that helps,
>
> -Geoff
>
>
>
>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Using Openbabel with a New Package

2019-09-27 Thread Noel O'Boyle
Have you tried copying the various DLLs and obf files into the same folder
as your own program? Or checking the PATH to see whether you have a version
of OB installed that is interfering?

On Fri, 27 Sep 2019, 19:08 Asem Alenaizan,  wrote:

> I found in the conda-forge meta.yaml file these entries in the build
> section:
>
> “   - vs2015_runtime 14.0.25420 0
>
> - vs2015_win-64 14.0.25123 h17c34da_3”
>
> And these in the host section:
>
> “- vc 14 0
>
> - vs2015_runtime 14.0.25420 0”
>
> Additionally, in conda_build_config.yaml:
>
> “c_compiler: vs2015
>
> cxx_compiler: vs2015”
>
>
>
> So I installed visual studio 2015 and compiled my program. The cl command
> for the x86_amd64 gives this information:
>
> “Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64”
>
>
>
> The program can be compiled and linked correctly against openbabel, but I
> cannot find the force field.
>
> I also tried with newer visual studios but had the same problem.
>
>
>
> Asim
>
>
>
> *From: *Noel O'Boyle 
> *Sent: *Thursday, September 26, 2019 4:10 PM
> *To: *Asem Alenaizan 
> *Cc: *openbabel-discuss@lists.sourceforge.net
> *Subject: *Re: [Open Babel] Using Openbabel with a New Package
>
>
>
> Were those conda packages built with the same compiler?
>
>
>
> On Thu, 26 Sep 2019, 21:05 Asim Alenaizan,  wrote:
>
> I do not compile Open Babel. I use the pre-compiled library provided in
> conda-forge. And yes, the binaries work if I set BABEL_DATADIR to the
> correct path.
>
> Asim
>
>
>
> On Thu, Sep 26, 2019 at 3:52 PM Noel O'Boyle  wrote:
>
> When you compile Open Babel, do the binaries work? e.g. "obabel -:
> -omol --gen3d"
>
>
>
> Regarding 3.0 versus 2.4.1, the release is imminent. Whether you wait or
> not, is up to you.
>
>
>
> - Noel
>
>
>
> On Thu, 26 Sep 2019 at 17:54, Asem Alenaizan  wrote:
>
> Hello,
>
>
>
> We are currently working on developing a package for predicting the
> structure of proto-nucleic acids. In this program, users can input
> arbitrary backbone structure and other parameters. Then, the program
> performs a conformational search over the dihedral angles of the backbone
> to predict whether the given backbone can be used to form a stable nucleic
> acid structure. We use the C++ OpenBabel API for all the manipulation of
> the molecule and computation of the energies. Additionally we have a python
> wrapper that uses pybind11 and a graphical user interface that uses Jupyter
> notebook.
>
>
>
> The program is hosted at https://github.com/alenaizan/pnab. I managed to
> make the program work in Linux and Mac but I have repeatedly failed to make
> it work in Windows. This is one of last remaining issues that I need to
> implement before we officially release the software. I always get the error
> that force fields cannot be found, even though I set the BABEL_DATADIR
> environment variable to the appropriate data folder. Neither Linux nor Mac
> requires the manual setting of BABEL_DATADIR if I install openbabel through
> conda. I use the openbabel 2.4.1 package available in conda-forge and the
> 2019 visual studio build tools. I appreciate some help on how to fix this
> issue.
>
>
>
> On another note, I noticed that the alpha release of openbabel 3.0.0 has
> been announced. What is the expected timeline for the release of a stable
> version, and is it necessary for our program to wait until openbabel 3 is
> released?
>
>
>
> Regards,
>
> Asem
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Using Openbabel with a New Package

2019-09-26 Thread Noel O'Boyle
Were those conda packages built with the same compiler?

On Thu, 26 Sep 2019, 21:05 Asim Alenaizan,  wrote:

> I do not compile Open Babel. I use the pre-compiled library provided in
> conda-forge. And yes, the binaries work if I set BABEL_DATADIR to the
> correct path.
>
> Asim
>
> On Thu, Sep 26, 2019 at 3:52 PM Noel O'Boyle  wrote:
>
>> When you compile Open Babel, do the binaries work? e.g. "obabel -:
>> -omol --gen3d"
>>
>> Regarding 3.0 versus 2.4.1, the release is imminent. Whether you wait or
>> not, is up to you.
>>
>> - Noel
>>
>> On Thu, 26 Sep 2019 at 17:54, Asem Alenaizan 
>> wrote:
>>
>>> Hello,
>>>
>>>
>>>
>>> We are currently working on developing a package for predicting the
>>> structure of proto-nucleic acids. In this program, users can input
>>> arbitrary backbone structure and other parameters. Then, the program
>>> performs a conformational search over the dihedral angles of the backbone
>>> to predict whether the given backbone can be used to form a stable nucleic
>>> acid structure. We use the C++ OpenBabel API for all the manipulation of
>>> the molecule and computation of the energies. Additionally we have a python
>>> wrapper that uses pybind11 and a graphical user interface that uses Jupyter
>>> notebook.
>>>
>>>
>>>
>>> The program is hosted at https://github.com/alenaizan/pnab. I managed
>>> to make the program work in Linux and Mac but I have repeatedly failed to
>>> make it work in Windows. This is one of last remaining issues that I need
>>> to implement before we officially release the software. I always get the
>>> error that force fields cannot be found, even though I set the
>>> BABEL_DATADIR environment variable to the appropriate data folder. Neither
>>> Linux nor Mac requires the manual setting of BABEL_DATADIR if I install
>>> openbabel through conda. I use the openbabel 2.4.1 package available in
>>> conda-forge and the 2019 visual studio build tools. I appreciate some help
>>> on how to fix this issue.
>>>
>>>
>>>
>>> On another note, I noticed that the alpha release of openbabel 3.0.0 has
>>> been announced. What is the expected timeline for the release of a stable
>>> version, and is it necessary for our program to wait until openbabel 3 is
>>> released?
>>>
>>>
>>>
>>> Regards,
>>>
>>> Asem
>>> ___
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Using Openbabel with a New Package

2019-09-26 Thread Noel O'Boyle
When you compile Open Babel, do the binaries work? e.g. "obabel -:
-omol --gen3d"

Regarding 3.0 versus 2.4.1, the release is imminent. Whether you wait or
not, is up to you.

- Noel

On Thu, 26 Sep 2019 at 17:54, Asem Alenaizan  wrote:

> Hello,
>
>
>
> We are currently working on developing a package for predicting the
> structure of proto-nucleic acids. In this program, users can input
> arbitrary backbone structure and other parameters. Then, the program
> performs a conformational search over the dihedral angles of the backbone
> to predict whether the given backbone can be used to form a stable nucleic
> acid structure. We use the C++ OpenBabel API for all the manipulation of
> the molecule and computation of the energies. Additionally we have a python
> wrapper that uses pybind11 and a graphical user interface that uses Jupyter
> notebook.
>
>
>
> The program is hosted at https://github.com/alenaizan/pnab. I managed to
> make the program work in Linux and Mac but I have repeatedly failed to make
> it work in Windows. This is one of last remaining issues that I need to
> implement before we officially release the software. I always get the error
> that force fields cannot be found, even though I set the BABEL_DATADIR
> environment variable to the appropriate data folder. Neither Linux nor Mac
> requires the manual setting of BABEL_DATADIR if I install openbabel through
> conda. I use the openbabel 2.4.1 package available in conda-forge and the
> 2019 visual studio build tools. I appreciate some help on how to fix this
> issue.
>
>
>
> On another note, I noticed that the alpha release of openbabel 3.0.0 has
> been announced. What is the expected timeline for the release of a stable
> version, and is it necessary for our program to wait until openbabel 3 is
> released?
>
>
>
> Regards,
>
> Asem
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Error handling with smi file in pybel?

2019-09-11 Thread Noel O'Boyle
Hi Vin,

By default the command-line application stops on error, a behavior that can
be overridden by "-e". I have to say that this behavior drives me bananas.
But anyway...

I've just been trying to do the same through Python, but have been failing.
Adding obconversion.AddOption("e", obconversion.GENOPTIONS) should work but
doesn't. So I'll file a bug.

But for your purposes you don't need this. Just do what I always do :-)

# loop through molecules and print InChI strings to a file
with open("mySMILES.smi") as inp:
with open("InChI_ouput.inchi", 'w') as f:
for line in inp:
try:
mol = pybel.readstring("smi", line)
except IOError:
f.write("Open_Babel_Error\n")
continue

Pro-tip: name your file handles "inp" and "out" instead of "f", etc. I've
been there. :-)

Regarding what you're trying to do, AddHydrogens doesn't actually add
hydrogens (I know, I know), it converts from implicit hydrogens to
explicit. The hydrogens are already there on every atom. But it's no harm
making them explicit, and you should get the same InChI either way.
Similarly, I'd have to check to be sure, but I think the code that uses the
InChI has "/DoNoAddH" implicitly (it's done through the API). Again, no
harm specifying it.

On Mon, 9 Sep 2019 at 22:05, Scalfani, Vincent  wrote:

> Dear All,
>
>
>
> I am trying to process a SMILES file (.smi) and calculate InChIs, where
> there are some SMILES that Open Babel will not be able to read, due to
> syntax or other errors. In those cases, I would like to print a string such
> as “Open_Babel_Error” on the line (or something even more descriptive).
>
>
>
> However, everything I have tried results in Open Babel stopping once it
> reads a SMILES string it cannot parse. Here is where I am at (code below),
> I did read the Errors and Warnings documentation with OBMessageHandler
> class, but I could not figure out how to incorporate that. Any
> direction/examples would be much appreciated.
>
>
>
> Thanks
>
>
>
> Vin
>
> --
>
> import pybel
>
>
>
> # Set up conversion to InChI
>
> conv = pybel.ob.OBConversion()
>
> conv.SetOutFormat("inchi")
>
> conv.AddOption("X", conv.OUTOPTIONS, "DoNotAddH")
>
>
>
> # Read a SMILES file
>
> mols = pybel.readfile("smi","mySMILES.smi")
>
>
>
> # loop through molecules and print InChI strings to a file
>
> with open("InChI_ouput.inchi", 'w') as f:
>
> for mol in mols:
>
> if not mol:
>
> f.write("Open_Babel_Error\n".format(inchi))
>
> continue
>
> # N.B. Adding H's to OB Molecular Object, and not through InChI
>
> mol.OBMol.AddHydrogens()
>
> inchi = conv.WriteString(mol.OBMol)
>
> f.write("{}".format(inchi))
>
> f.close()
>
>
>
> —-
>
> Vincent F. Scalfani, Ph.D.
>
> University Libraries
> The University of Alabama
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] substructure search fails

2019-09-10 Thread Noel O'Boyle
Can you provide a single example of a molecule that it misses? We can then
try to explain why or work out a solution.

Regards,
- Noel

On Tue, 10 Sep 2019 at 13:33, Vaibhav Dixit  wrote:

> Dear Openbabel community,
> I'm trying to extract all compounds from an sdf file which contain an OH
> group (phenolic or aliphatic).
> For this I have tried the following command in my anaconda prompt
> installation of babel. But I'm not getting the expected result and no
> molecule is retrieved.
> I get results using similarity cutoff but these also include compounds
> with ether linkages which I don't want.
> Can you please suggest the usage to get the expected result if this is
> possible in babel?
>
> babel Drugbank-3D-structures.sdf -sOC1=CC=CC=C1 sim-phenol.smi
> *0 molecules converted*
> 95585 audit log messages
>
> babel Drugbank-3D-structures.fs -ifs -sOC1=CC=CC=C1 sim-phenol.smi -at0.5
> 23 molecules converted
> 335 audit log messages
>
> Thank you.
>
> --
>
> Regards,
>
> Dr. Vaibhav A. Dixit,
>
> Visiting Scientist at the Manchester Institute of Biotechnology (MIB), The
> University of Manchester, 131 Princess Street, Manchester M1 7DN, UK.
> AND
> Assistant Professor,
> Department of Pharmacy,
> ▄
> Birla Institute of Technology and Sciences Pilani (BITS-Pilani),
> VidyaVihar Campus, street number 41, Pilani, Rajasthan 333031.
> India.
> Phone No. +91 1596 255652, Mob. No. +91-7709129400,
> Email: vaibhav.di...@pilani.bits-pilani.ac.in, vaibhavadi...@gmail.com
> http://www.bits-pilani.ac.in/pilani/vaibhavdixit/profile
> https://www.linkedin.com/in/vaibhav-dixit-b1a07a39/
>
> ORCID ID: https://orcid.org/-0003-4015-2941
>
> http://scholar.google.co.in/citations?user=X876BKcJ=en=sra
>
> P Please consider the environment before printing this e-mail
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Smiles

2019-08-19 Thread Noel O'Boyle
Hi Markus,

Only possible with the development version (available as snap for example).
"-Hsmi" gives the output options, of which one is 'k':

$ obabel -:c1c1 -osmi -xk
C1C=CC=CC=1

- Noel

On Mon, 19 Aug 2019 at 14:36, Markus Grimm via OpenBabel-discuss <
openbabel-discuss@lists.sourceforge.net> wrote:

> Hey guys,
>
> can someone tell me how I convert standard smiles into kekule form smiles?
>
> Right now I'm using obabel to generate smiles from mol files:
>
> obabel -imol E_1.mol -osmi -OE_1.smi
>
>
> Thanks in advance!
> - Markus
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] obabel not drawing thick lines from command line

2019-08-02 Thread Noel O'Boyle
All output options must be preceded by "-x", so "-xt" in this case.

On Thu, 25 Jul 2019 at 18:09, JacksonBurns  wrote:

> Hi everyone!
> In the Open Babel GUI, I am able to move from .mol to .png and select the
> "use thicker lines" options and everything works fine.
> The issue is that I need to make this same request from the command line
> for
> my application. The documentation indicates I should use:
> obabel serotonin.mol -O serotonin.ong -T
> but this yields thin lines. Lowercase t errors out.
> Any help is appreciated!
>
>
>
> --
> Sent from: http://forums.openbabel.org/General-discussion-f3090658.html
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] 3D Rendering of Molecules via POVRay

2019-06-25 Thread Noel O'Boyle
The pov file is intended as a starting point for the user. But you're
right, rotating the molecule to be face-on as Avogadro does would be a good
idea.

- Noel

On Mon, 24 Jun 2019, 22:27 Malte Frank Gerdes, 
wrote:

> Hi,
>
> I'm trying to generate 3D Molecules via POVRay. The camera seems to not
> be in the 'optimal' spot. I've read the code and the camera is placed 10
> units away from the centroid, looking at the centroid. The problem now
> is: for (rather complex) molecules this leads to extremely bad camera
> positioning (example as attachment).
>
> Is there any other output format supported by OpenBabel which lets me
> generate 3D Molecules with a better camera positioning?
>
> Do i have to manually edit the .pov file?
>
> Or maybe the best solution is to just hack the exporter to give me more
> control?
>
> Any Hints appreciated! If there is another tool which works better than
> OpenBabel for this case please tell me :).
>
> Best Regards,
> Malte
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] calculate chemical descriptors from published paper

2019-05-14 Thread Noel O'Boyle
Ah right. No - we don't do R and S assignment. But I don't see how a
sensible QSAR model could possibly relate the count of R and S centers to a
physical property. What does that even mean?

OBAtom.IsChiral() does not do what you think it's doing. In fact, in the
development version it has been removed.

I'm afraid you'll have to figure out the floodfill yourself unless someone
wants to help out. It's a standard graph algorithm that can be done with a
breadth first or depth first search using a stack. If you google it up, or
read Sedgewick's Algorithms you should be able to figure it out.

Regards,
- Noel

On Tue, 14 May 2019 at 03:59, Spencer Trinh  wrote:

> Hi Noel,
>
>
> Thanks for response. The paper didn't really mention the R/S configuration
> but their supplemental had it. Here is the first two rows of their
> supplemental dataset.
>
> CID SMILES MW N O XLogP HBD HBA RotB tPSA nStereo R S
> Lipitor 60823 CC(C)C1=C(C(=C(N1CC[C@H](C[C@H
> ](CC(=O)O)O)O)C2=CC=C(C=C2)F)C3=CC=CC=C3)C(=O)NC4=CC=CC=C4 558,64 2 5 5,7
> 4 7 12 112,0 2 2 0
> Nexium 4594 CC1=CN=C(C(=C1OC)C)CS(=O)C2=NC3=C(N2)C=C(C=C3)OC 345,42 3 3
> 0,6 1 6 5 77,1 1 1 0
>
>
> For the stereocenters I wrote:
>
> nStereo=0
> for atom in mol:
> if atom.OBAtom.IsChiral() and atom.OBAtom.GetAtomicNum() == 6:
> nStereo+=1
>
> Would that work just like OBStereoFacade? I'm not familiar with using that
> class.
>
> I'm not sure how to conduct a floodfill search of a molecule. Are there
> examples that you can point me to? I simply wrote this but I lack the
> knowledge to carry on:
>
> mol =
> pybel.readstring('smi','CC(=O)SC1CC2=CC(=O)CCC2(C3C1C4CCC5(C4(CC3)C)CCC(=O)O5)C')
> for a in mol:
> if a.OBAtom.IsInRing():
> print(f'{a.idx}, {a.atomicnum}, {a.cidx}')
>
> Can you provide further assistance? Thanks.
>
>
> Best regards,
>
>
> Spencer
>
>
> Vào Th 2, 13 thg 5, 2019 vào lúc 09:45 Noel O'Boyle <
> baoille...@gmail.com> đã viết:
>
>> Hi Spencer,
>>
>> To count the number of ring systems, simply find a ring atom that you
>> have not yet visited (OBAtom.IsInRing()) and floodfill through all of the
>> adjacent ring atoms via bonds that are in a ring. That's ring system 1.
>> Repeat to find additional ring systems.
>>
>> In the reference you point to, they don't count the number of R
>> stereocenters and S stereocenters. They use "chiralCenterCount()", defined
>> as " Calculates the number of tetrahedral stereogenic centers" (
>> https://forum.chemaxon.com/ftopic2417.html). If you use the
>> OBStereoFacade, you should be able to count up the stereo centers.
>> Hopefully this number is the same as you are expecting.
>>
>> Regards,
>>Noel
>>
>>
>>
>> On Mon, 13 May 2019 at 02:03, Spencer Trinh 
>> wrote:
>>
>>> Hi Openbabel developers,
>>>
>>> I am trying to reproduce the data from this paper:
>>> https://www.ncbi.nlm.nih.gov/pubmed/25618349
>>>
>>> They listed 20 chemical descriptors used for a pca analysis. I am having
>>> trouble figuring out how they calculated the ring system count. Is there a
>>> way to count the number of ring systems as opposed to standard rings? For
>>> example, spiro rings are considered one instead of two, etc. I simply know
>>> how to get ring count through: mol.OBMol.GetSSSR(). Also, I don't know how
>>> to count the number of R stereocenters and S stereocenters. Is this
>>> possible with Openbabel? I would assume so since it can do a lot of things.
>>> Thank you.
>>>
>>>
>>>
>>> Best regards,
>>>
>>>
>>> Spencer
>>> ___
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] calculate chemical descriptors from published paper

2019-05-13 Thread Noel O'Boyle
Hi Spencer,

To count the number of ring systems, simply find a ring atom that you have
not yet visited (OBAtom.IsInRing()) and floodfill through all of the
adjacent ring atoms via bonds that are in a ring. That's ring system 1.
Repeat to find additional ring systems.

In the reference you point to, they don't count the number of R
stereocenters and S stereocenters. They use "chiralCenterCount()", defined
as " Calculates the number of tetrahedral stereogenic centers" (
https://forum.chemaxon.com/ftopic2417.html). If you use the OBStereoFacade,
you should be able to count up the stereo centers. Hopefully this number is
the same as you are expecting.

Regards,
   Noel



On Mon, 13 May 2019 at 02:03, Spencer Trinh  wrote:

> Hi Openbabel developers,
>
> I am trying to reproduce the data from this paper:
> https://www.ncbi.nlm.nih.gov/pubmed/25618349
>
> They listed 20 chemical descriptors used for a pca analysis. I am having
> trouble figuring out how they calculated the ring system count. Is there a
> way to count the number of ring systems as opposed to standard rings? For
> example, spiro rings are considered one instead of two, etc. I simply know
> how to get ring count through: mol.OBMol.GetSSSR(). Also, I don't know how
> to count the number of R stereocenters and S stereocenters. Is this
> possible with Openbabel? I would assume so since it can do a lot of things.
> Thank you.
>
>
>
> Best regards,
>
>
> Spencer
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Extract properties of mol2 molecules, along with properties ?

2019-05-03 Thread Noel O'Boyle
Looks like a Scitegic extension to a Tripos format. In theory we could add
support but in the meanwhile, it might be better to see whether a Scitegic
tool can be use to convert the file to an SDF file, for example, where Open
Babel's property support is much stronger.

- Noel

On Thu, 2 May 2019 at 16:03, ajay4pal  wrote:

> Hi
> I have mol2 datafile from molecular docking
> I am extracting molecules using openbabel
> > obabel test.mol2 -O t.mol2 --filter "title='AK-968'"
>
> ## last few lines of molecule mol2 format #
> 25 23 21 ar
> 26 24 21 1
> @SUBSTRUCTURE
> 1  1
> @MOL_PROPERTY
> Name
> SciTegic.value.StringValue
> AK-968
> @MOL_PROPERTY
> minimizedAffinity
> SciTegic.value.StringValue
> -8.02212
> ### end of molecule 
>
> openbabel extracts the molecules but doesn't include minimizedAffinity
> property.
> Is there a way to extract this property as well
> tried using --append and --property args.
>
>
> Thanks
>
>
>
> --
> Sent from: http://forums.openbabel.org/General-discussion-f3090658.html
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] ​How to combine t​wo OB​Mol objects​ ​​in python?

2019-04-27 Thread Noel O'Boyle
Have you tried molA += molB?

On Fri, 26 Apr 2019, 18:20 Lux QC,  wrote:

> Dear All,
>
> Greetings!
>
> What I want to do is to combine two molecules.
>
> I tried to combine two OBMol objects together, to obtain an OBMol object
> which contains the coordinates of the two molecules.
>
> After checking the class reference of openbabel, I found OBMoleculeFormat.
> When I import it from openbabel in python, however, I was told it doesn't
> exist. Then I checked openbabel.py, there is no OBMoleculeFormat in it.
>
> Is there any other way to do this?
>
> Thank you in advance.
>
> Best regards,
> QC
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


[Open Babel] Information on breaking API changes in forthcoming 3.0 release

2019-04-27 Thread Noel O'Boyle
Hi there,

As we work towards the next release, Geoff has asked me to put together
some documentation on the API changes introduced that might affect your
code:

https://open-babel.readthedocs.io/en/latest/UseTheLibrary/migration.html

This not a "What's New?" - that will have to be done separately, but rather
a "What Might Break My Code, and How to Fix it?"

Any feedback you have is welcome.

Regards,
- Noel
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] protonation using Python

2019-04-22 Thread Noel O'Boyle
The CLI doesn't use ReadString/WriteString. If you want the CLI behaviour,
that's the Convert() method of OBConversion. These extra options will
probably work with that.

On Wed, 17 Apr 2019 at 09:30, Tim Dudgeon  wrote:

> Yes, but I don't see how that helps work out how to call it from Python.
> I was trying something like this:
>
> obConversion.AddOption("p", obConversion.GENOPTIONS, "3.0")
>
> That seems vaguely consistent with how to set the option from Python given
> how the CLI option works, but unfortunately it doesn't seem to work.
>
> Tim
> On 15/04/2019 13:03, Noel O'Boyle wrote:
>
> Hi Tim,
>
> Many of these options are just wrappers around API functions, so it's
> worthwhile taking a look at the API documentation. In this case, here's the
> link to the relevant docs:
>
> http://openbabel.org/api/2.3/classOpenBabel_1_1OBPhModel.shtml
>
> Regards,
> - Noel
>
> On Thu, 11 Apr 2019 at 16:11, Tim Dudgeon  wrote:
>
>> Another Python options question.
>> I can use the protonation option on the CLI:
>>
>> > echo "C1=C(NC=N1)C[C@@H](C(=O)O)N" | obabel -i smi -o mol -p 3
>> But I can't figure it out with the Python API:
>>
>> > import openbabel
>> >
>> > obConversion = openbabel.OBConversion()
>> > obConversion.SetInAndOutFormats("smi", "mol")
>> > mol = openbabel.OBMol()
>> > obConversion.AddOption("p", obConversion.GENOPTIONS, "3.0")
>> > obConversion.ReadString(mol, "C1=C(NC=N1)C[C@@H](C(=O)O)N")
>> > output = obConversion.WriteString(mol)
>> > print output
>> Output is generated but it's not protonated. Same if using OUTOPTIONS
>> instead of GENOPTIONS.
>>
>> Is the use of the options in Python documented anywhere?
>>
>>
>>
>>
>>
>> ___
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] ImportError: cannot import name 'OBElementTable' from 'openbabel' (unknown location)

2019-04-20 Thread Noel O'Boyle
The dev version will be 3.0. I've written up docs on the migration but am
away from that computer right now. Looking at the Python tests (
https://github.com/openbabel/openbabel/blob/master/test/testbindings.py) I
see:

from openbabel import openbabel as ob
ob.GetAtomicNum()
o


On Sat, 20 Apr 2019 at 13:36, Thomas Evangelidis  wrote:

> Greetings,
>
> I have a rather old code which was working with OpenBabel-2.4.1. However, I 
> yesterday switched to the latest development version (I think VERSION 2.8.10) 
> from github.
>
> https://github.com/openbabel/openbabel
>
> After installing it I got an ImportError saying that 'OBElementTable' is 
> missing. Was this table really removed, and if yes, how can I adapt my code 
> below to work with the latest version?
>
> I thank you in advance.
>
> Thomas
>
>
>
> from openbabel.openbabel import OBElementTable
>>
>> # ELEMENT TABLE TO DETERMINE VDW AND COVALENT BONDS
>> et = OBElementTable()
>>
> # CONVERT ELEMENT SYMBOLS TO ATOMIC NUMBERS
> atomicnums = (et.GetAtomicNum(str(element)) for element in config['elements'])
>
> # GET ATOM RADII FOR THE LIGAND ATOM
> hetatm_cov = et.GetCovalentRad(hetatm.GetAtomicNum())
> hetatm_vdw = et.GetVdwRad(hetatm.GetAtomicNum())
>
> label = "{0}.{1}-B{2}".format(et.GetSymbol(x), et.GetSymbol(y), i)
>
>
>
> --
>
> ==
>
> Dr. Thomas Evangelidis
>
> Research Scientist
>
> IOCB - Institute of Organic Chemistry and Biochemistry of the Czech
> Academy of Sciences , 
> Prague,
> Czech Republic
>   &
> CEITEC - Central European Institute of Technology 
> , Brno, Czech Republic
>
> email: teva...@gmail.com, Twitter: tevangelidis
> , LinkedIn: Thomas Evangelidis
> 
>
> website: https://sites.google.com/site/thomasevangelidishomepage/
>
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Contributed code for new file format

2019-02-21 Thread Noel O'Boyle
Hi Paul,

Sounds great.

It'd be definitely nice to have some test cases to ensure that it actually
works as intended and will keep working. It's sound like you have some
already. I can help integrate these if you wish. There is also information
over at
https://open-babel.readthedocs.io/en/latest/Contributing/Testing.html

The usual way to submit code is via Github - this also helps us keep track
of things. Are you happy to send a pull request via that route?

Regarding release forms, I don't think that's something we can help with.
We don't require it. That is, it's between you and your employer whether
you have permission to give us this code under the GPL.

Regards,
- Noel

On Wed, 20 Feb 2019 at 18:07, Paul Becherer  wrote:

> Dear all,
>
> At the software company that I work for (Culgi B.V., Leiden, The
> Netherlands, ​https://www.culgi.com/), we have been using Open Babel for
> a while now, for conversion between our file format and other formats. To
> get this working, we have added a file format to the Open Babel source, and
> we currently build a 'custom' executable with this extra file.
>
> To comply with the GNU GPL we do not link our proprietary software to Open
> Babel, but just run the executable using input and output files, and we've
> always made the modified Open Babel source available to our users under the
> GPL.
>
> Of course in the long run it would be easier for us, and for our users, to
> have this file format support integrated into the regular Open Babel
> distribution. We'd like to contribute the code that we use for that. I have
> attached a patch that should work against the latest source from GitHub.
>
> As it will be primarily our customers and ourselves who will benefit from
> this (at least at this time) we're willing to assume responsibility for
> maintaining this code for the foreseeable future.
>
> We could not really find hard guidelines for coding standards, or what
> kinds of tests are desired, so I'd appreciate any feedback on that. The
> code in the patch is based on the exampleformat.cpp template and was
> further developed by two colleagues and myself at Culgi. We presently test
> conversion to and from the MOL and MOL2 formats in our own test suite.
>
> I can imagine that some kind of release form or other document from my
> employer is required before the code can be integrated into the regular
> Open Babel source. I'd be very grateful if anyone could guide us through
> any formalities here.
>
>
> Kind regards,
>
> Paul Becherer
>
> Development Scientist
>
> Culgi B.V.
> Galileiweg 8
> 2333 BD Leiden
> The Netherlands
>
> Phone: + 31 71 33 22 056
> www.culgi.com
>
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] ImportError: DLL load failed

2019-02-14 Thread Noel O'Boyle
I'm afraid the installation instructions are out of date. The current
version is 2.4.1. The corresponding Python bindings can be installed with
pip.

On Sun, 10 Feb 2019 at 21:07, Matthew Bliss  wrote:

> For the GUI, I downloaded this: OpenBabel2.3.2a_Windows_Installer.exe
> For the python bindings: openbabel-python-1.8.py33.exe
>
>
>
> On Sun, Feb 10, 2019 at 5:15 AM Noel O'Boyle  wrote:
>
>> I think it is a version problem. Can you paste in the exact file names of
>> the files you downloaded? I note that you are using a 32-bit Python, and so
>> you will need to ensure that you use the 32-bit Open Babel and bindings.
>>
>> - Noel
>>
>> On Thu, 7 Feb 2019 at 22:13, Tayeb Kakeshpour  wrote:
>>
>>> Maybe this is not what you are looking for, but in think the easiest way
>>> to get pybel to work with python is to install it through the anaconda
>>> cloud.
>>>
>>> -Tayeb
>>>
>>> Tayeb Kakeshpour
>>> Graduate Research Assistant
>>> Jackson Research Group
>>> Michigan State University
>>> Department of Chemistry
>>> 578 S. Shaw Lane, room 535
>>> East Lansing, MI 48824
>>> kakes...@msu.edu
>>>
>>>
>>>
>>> On Feb 7, 2019, at 3:42 PM, Matthew Bliss  wrote:
>>>
>>> I installed the OpenBabelGUI v2.3.2a and OpenBabel Python Bindings v1.8
>>> according to the instructions here:
>>> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/PythonInstall.html#windows
>>>
>>> When testing the installation, I was able to make it to the "import
>>> pybel" command before my output deviated from those in the instructions.
>>> After making the "import pybel" command, I received the following error
>>> message:
>>>
>>> C:\Users\Matt>python
>>>> Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32
>>>> bit (Intel)] on win32
>>>> Type "help", "copyright", "credits" or "license" for more information.
>>>> >>> import pybel
>>>> Traceback (most recent call last):
>>>>   File "", line 1, in 
>>>>   File
>>>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pybel.py",
>>>> line 52, in 
>>>> import openbabel as ob
>>>>   File
>>>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openbabel.py",
>>>> line 37, in 
>>>> _openbabel = swig_import_helper()
>>>>   File
>>>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openbabel.py",
>>>> line 33, in swig_import_helper
>>>> _mod = imp.load_module('_openbabel', fp, pathname, description)
>>>>   File
>>>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\imp.py", line
>>>> 243, in load_module
>>>> return load_dynamic(name, filename, file)
>>>>   File
>>>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\imp.py", line
>>>> 343, in load_dynamic
>>>> return _load(spec)
>>>> ImportError: DLL load failed: The specified module could not be found.
>>>
>>>
>>> I looked in the archives for this list and the threads with similar
>>> error messages were not useful. I have python 3.7.0, should I be using
>>> python 3.3 instead?
>>>
>>> ___
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>>> ___
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Problem with ring detection

2019-02-14 Thread Noel O'Boyle
In Python, for example, call the IsInRing() method of an atom to find this
out.

On Sun, 27 Jan 2019 at 18:03, Tang, Dai  wrote:

> Hi,
>
>
> I have a problem with the ring detection using Open Babel 2.4.1. My goal
> is to know which carbon atoms (or other element) of a molecule belong to a
> ring structure. So far the method I tried is to grep the label 'TYPE: Car'
> in .molreport file.
>
>
> Successful case:
>
> CC1=CC=CC=C1
>
> The SMILE code is converted into .molreport file, which shows 6 carbon
> atoms as 'TYPE: Car'.
>
>
> Unsuccessful case:
>
> C=C1C1
>
> Similarly, from SMILE code to get .molreport file, and no carbon atoms are
> labeled as 'TYPE: Car'. However, this molecule dose have one 6-membered
> ring structure, which is proved by using 'obprop' function, that
> 'num_rings  1'. That is also proved by plotting this molecule.
>
>
> name 7.sk.nt.2.smi 2
>
> formula  C7H12
>
> mol_weight   96.1702
>
> exact_mass   96.0939
>
> canonical_SMILES C=C1C1
>
>
> InChIInChI=1S/C7H12/c1-7-5-3-2-4-6-7/h1-6H2
>
>
> num_atoms19
>
> num_bonds19
>
> num_residues 0
>
> num_rotors   0
>
> sequence -
>
> num_rings1
>
> logP 2.5067
>
> PSA  0
>
> MR   33.175
>
> 
>
> I have a group of molecules whose ring structure can not be detected, such
> as C=C1C=CCC=C1, CC1=CC=CCC1, CC1CC=CC=C1 etc.
>
>
>
> Thank you very much for any help you can offer to this issue.
>
>
>
>
>
> Best,
>
> Dai
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] ImportError: DLL load failed

2019-02-10 Thread Noel O'Boyle
I think it is a version problem. Can you paste in the exact file names of
the files you downloaded? I note that you are using a 32-bit Python, and so
you will need to ensure that you use the 32-bit Open Babel and bindings.

- Noel

On Thu, 7 Feb 2019 at 22:13, Tayeb Kakeshpour  wrote:

> Maybe this is not what you are looking for, but in think the easiest way
> to get pybel to work with python is to install it through the anaconda
> cloud.
>
> -Tayeb
>
> Tayeb Kakeshpour
> Graduate Research Assistant
> Jackson Research Group
> Michigan State University
> Department of Chemistry
> 578 S. Shaw Lane, room 535
> East Lansing, MI 48824
> kakes...@msu.edu
>
>
>
> On Feb 7, 2019, at 3:42 PM, Matthew Bliss  wrote:
>
> I installed the OpenBabelGUI v2.3.2a and OpenBabel Python Bindings v1.8
> according to the instructions here:
> https://open-babel.readthedocs.io/en/latest/UseTheLibrary/PythonInstall.html#windows
>
> When testing the installation, I was able to make it to the "import pybel"
> command before my output deviated from those in the instructions. After
> making the "import pybel" command, I received the following error message:
>
> C:\Users\Matt>python
>> Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32
>> bit (Intel)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import pybel
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File
>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pybel.py",
>> line 52, in 
>> import openbabel as ob
>>   File
>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openbabel.py",
>> line 37, in 
>> _openbabel = swig_import_helper()
>>   File
>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openbabel.py",
>> line 33, in swig_import_helper
>> _mod = imp.load_module('_openbabel', fp, pathname, description)
>>   File
>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\imp.py", line
>> 243, in load_module
>> return load_dynamic(name, filename, file)
>>   File
>> "C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\lib\imp.py", line
>> 343, in load_dynamic
>> return _load(spec)
>> ImportError: DLL load failed: The specified module could not be found.
>
>
> I looked in the archives for this list and the threads with similar error
> messages were not useful. I have python 3.7.0, should I be using python 3.3
> instead?
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] install openbabel on pythonanywhere server

2019-01-28 Thread Noel O'Boyle
I don't know. For sure the "pip" won't work as it doesn't include the
binaries, and the wheels we provide I think are just for Windows.

For support, you should contact the developers of www.pythonanywhere.com

- Noel

On Sun, 27 Jan 2019 at 23:11, Spencer Trinh  wrote:

> Hi,
>
> I wanted to install opebabel on the pythonanywhere bash console (
> https://www.pythonanywhere.com), but when trying pip install openbabel,
> it gives me:
>
> Error: SWIG failed. Is Open Babel installed?
>
> I tried installing the .whl file and it said :
>
> is not a supported wheel on this platform
>
> I also tried installing the .tar file and it tells me to specify the
> location of include and libraries directories. I'm not sure where those
> reside? Any guidance would be greatly appreciated. Is this even possible?
> Thanks.
>
>
> Best regards,
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Python 2.7.15 cannot find Open Babel 2.4.1

2019-01-11 Thread Noel O'Boyle
It wasn't able to find the module because PYTHONPATH was only set for the
terminal in which you ran the export command. You will need to set it in
your .bashrc (or equivalent) to enable it for all terminals.

To see the current value from within the Python interpreter, do "import
sys" and then "print(sys.path)". This shows all of the directories searched
for openbabel.py. You can also edit sys.path from within Python.

- Noel

On Fri, 11 Jan 2019 at 02:55, Tayeb Kakeshpour  wrote:

> I suggest installing openbabel through anaconda which solved a similar
> issue for me. For that, you will need two steps:
>
> 1) Install anaconda: google how to do this. The installation is designed
> to be simple, so users with less experience with Linux can use it.
> 2) after installation of anaconda, type “conda install -c openbabel
> openbabel” in your terminal. You could also google the second step.
>
> After this you will have obabel working both with terminal and python.
>
> I did this last year and everything went through smoothly. I hope it works
> for you too.
>
> -Tayeb
>
> Tayeb Kakeshpour
> Graduate Research Assistant
> Jackson Research Group
> Michigan State University
> Department of Chemistry
> 578 S. Shaw Lane, room 535
> East Lansing, MI 48824
> kakes...@msu.edu
>
>
>
> On Jan 8, 2019, at 10:49 AM, Ruben Kuiper 
> wrote:
>
> Hi there,
>
> I'm trying to install Open Babel 2.4.1 on Fedora 29 and then access it
> through Python 2.7.15, but when I try to I receive the following error
> message: ImportError: No module named openbabel.
> I'm pretty sure I did not receive any error messages during the
> installation, so I'm wondering where it went wrong.
> These are the commands I ran in order to install Open Babel, after downloading
> and extracting Eigen 3.3.7 and downloading openbabel-2.4.1.tar.gz:
>
> $ *tar zxf openbabel-2.4.1.tar.gz*
> *$ mkdir build*
> *$ cd build*
> *$ cmake ../openbabel-2.4.1
> -DEIGEN3_INCLUDE_DIR=/home/my_name/Downloads/eigen-eigen-323c052e1731
> -DEIGEN3_VERSION_OK=ON -DPYTHON_BINDINGS=ON
> -DPYTHON_INCLUDE_DIR=/usr/include/python2.7
> -DPYTHON_LIBRARY=/usr/lib64/python2.7/config/libpython2.7.so
> *
> *$ make*
> *$ sudo make install*
> *$ export PYTHONPATH=/usr/local/lib:$PYTHONPATH*
>
> After that I opened Python in Terminal and received the aforementioned
> error message by entering "import openbabel".
> Any ideas on how I might fix this problem?
>
> Thanks in advance,
>
> Ruben.
>
> PS: I'm not very experienced with Linux or programming, so please keep
> that in mind when trying to explain something.
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] changes to fingerprint generation, and FPS output

2019-01-10 Thread Noel O'Boyle
I do appreciate that you're willing to help out with this, but I would go
for proposal 4. No API change required, zero maintainence, and it will
never be incorrect. We can always provide information after a release that
the fingerprint didn't change between versions.

Regards,
- Noel

On Wed, 9 Jan 2019 at 20:23, Andrew Dalke  wrote:

> On Jan 9, 2019, at 15:45, Noel O'Boyle  wrote:
> > Making such an API addition adds a maintainence would commit us to
> correctly maintaining the underlying information, and that's a maintainence
> task I'm not willing to take on.
>
> Certainly, and I appreciate that maintenance is an important factor.
>
> Let me try this again.
>
> Hi! Open Babel supports the FPS output format. What can I do to help
> maintain that plugin?
>
> When Open Babel decided to support the FPS format, I realized they took on
> a maintenance task. For example, the FPS format at that time, at
> https://code.google.com/archive/p/chem-fingerprints/wikis/FPS.wiki , says
> "The version MUST change whenever the underlying fingerprint algorithm
> changes."
>
> I noticed that the implementations in version control have changed. I want
> to help update the version numbers so they will be ready for the next
> release.
>
> I have a lot of Python experience but haven't really used C++ in 20 years
> - and even then without shared library experience - so I'm afraid I don't
> really know what I'm doing with that language. But I'll try!
>
> My proposals to simply update the version number to "/3", and to change
> the plugin API to allow version numbers, don't seem like they were
> acceptable. What about changing the plugin so it is structured like this:
>
>   const char *plugin_version = "1";
>   const char *plugin_id = _pFP->GetID();
>
>   if (!strcmp(plugin_id, "MACCS"))) {
> plugin_version = "3";
>   }
>   ...
> << "#type=OpenBabel-" << plugin_id << "/" << plugin_version << '\n'
>
> so that it is possible to have different version numbers for each
> fingerprint type, embedded as logic inside of the plugin?
>
> If this third alternative seems like it might be acceptable, then I can
> work on it further and submit a pull request for a more detailed
> examination.
>
> > In addition, I don't personally think that this information adds
> anything beyond reporting the version number.
>
> And I personally think it does. I know I've liked it when chemfp reported
> mismatched versions when I accidentally used an outdated file.
>
> But that's okay. Open Babel doesn't need to follow my feelings. I can
> totally see that if the overall fingerprint generation process in Open
> Babel effectively changes for every release, then the type version adds
> nothing.
>
> In that case, here's a fourth proposal. Change the FPS plugin so the
> output "#type" includes the Babel version, that is:
>
> << "#type=OpenBabel-" << _pFP->GetID() << "/" <<  BABEL_VERSION <<
> '\n'
>
> The output would look like something like "OpenBabel-MACCS/2.4.1", which
> is a valid FPS fingerprint type string.
>
> This type string provides a hint to all downstream users that they need to
> re-build their fingerprints after every Open Babel upgrade.
>
> If this seems like it might be acceptable, then I can submit a pull
> request for it.
>
>
> For some background on why there is a "#type" line with a fingerprint type
> version, and a "#software" line with a version of the software, that's
> because other tools have different needs than Open Babel. I might have my
> own tool built on Open Babel which generates fingerprints. The releases are:
>
>   1.0 - initial release, v1 of the fingerprint
>
>   1.1 - performance improvements, fingerprints don't change
>
>   1.2 - fix a bug in my implementation, call the new version v2,
>  but allow v1 to be selected as a command-line option
>
>   1.3 - port to MS Windows, otherwise unchanged
>
>   1.4 - change to require C++14 instead of C++03, otherwise unchanged
>
>   1.5 - switch to faster PRNG as the default, call it v3,
>  and allow v1 and v2 to be selected as a command-line option.
>
> That is, version 1.5 of my program can generate versions 1, 2, and 3 of
> the fingerprint type I created, selectable at run-time. These fingerprint
> types might be available for reproducibility or contractual reasons, among
> others.
>
> In this case, the program version cannot be used to distinguish between
> the fingerprint types, which is why there is a distinct type.
>
> As another example, RDKit's an

Re: [Open Babel] changes to fingerprint generation, and FPS output

2019-01-09 Thread Noel O'Boyle
Making such an API addition adds a maintainence would commit us to
correctly maintaining the underlying information, and that's a maintainence
task I'm not willing to take on.

In addition, I don't personally think that this information adds anything
beyond reporting the version number. The nature of development code is that
its behaviour may change. This includes everything from interpreting SMILES
strings to writing fingerprints. If people use a development version for
scientific work and don't report the git revision (or even just the date),
that's a problem...but it's not our problem. In other words, fingerprints
generated with a development version of Open Babel (or anything else for
that matter) should not be considered stable. If a user pulls down a new
version they should update their fingerprints (and their canonical SMILES
strings, etc.).

Regards,
- Noel


On Tue, 8 Jan 2019, 15:40 Andrew Dalke  > On Jan 7, 2019, at 14:10, Noel O'Boyle  wrote:
> >
> > Can you clarify the requirement for bumping the version? That is, which
> of the following is the invariant:
> > 1. Any molecule represented in any format changes must create the same
> fingerprint
> > 2. Any SMILES string must create the same fingerprint
> > 3. Any OBMol must create the same fingerprint
>
> I don't know how to answer that question. I think the answer is (2), but
> where "SMILES" is replaced with "input structure record".
>
> The idea of the version in the chemfp type string is to let people know if
> it's reasonable to use the same fingerprint data set after changing to a
> new version of a toolkit.
>
> For example, I might use Open Babel to generate MACCS fingerprints from a
> ChEMBL SD file, and the same version of Open Babel to convert a query
> SMILES into a query fingerprint to find the k=10 nearest neighbors. After a
> period of time I upgrade to a new version of Open Babel. I would like get a
> warning if the generation method has changed enough that I should
> re-compute the MACCS keys.
>
> Or, someone may publish a paper which uses an Open Babel-generated FP2
> data set. I download the dataset and want to know if my installed version
> of Open Babel is likely compatible with it.
>
> My criteria hasn't been so strict as "any" change. For example, if the SD
> parser was changed to better support information which is in 1 out of every
> 100,000 PubChem record, and that change sometimes affects one bit of a
> fingerprint, then in principle the version number could be bumped.
>
> Usually that's between the threshold of noticeability. Fingerprints are
> blunt tools for comparing molecules, and we already expect some level of
> error when working with structure and fingerprint files.
>
> On the other hand, a change in 1% of the records seems like enough to bump
> the version number.
>
> Chemfp has a "software" header which helps in cases where more
> fine-grained versioning might be needed. For example,:
>
>   #software=OpenBabel/2.4.1 chemfp/3.0
>
> says that the data set was generated with Open Babel 2.4.1 using chemfp
> 3.0. However, it's impossible for software to look at "2.4.0" vs. "2.4.1"
> or "2.4.90" and tell if the fingerprint generation method changed.
>
> (Plus, the 2.4.90 has been the same since 2017-10-11 so isn't enough
> information if someone wants to reproduce an analysis. Ideally someone who
> publishes a paper based on a version installed from version control should
> include the relevant git commit id.)
>
> > Since you know where to edit, you can if you wish make the change
> directly on github, if you have an account there. But otherwise, I can do
> it.
>
> I can make the change. I'm trying to figure out what change to make.
>
> If there were two significant periods of time since 2.4.1 was released,
> with different fingerprint generation methods, then I would build versions
> of Open Babel for those periods so that chemfp's versioning captures that
> information. Eg, have a "/3" and a "/4". But Open Babel would only need the
> "/4".
>
> If there's only one significant implementation change, which is what it
> now seems like, then the easiest code change is to bump all versions to
> "/3".
>
> I'm fine with that.
>
> In principle I would like to add a "version" string to the plugin system,
> so that I can replace:
>
> << "#type=OpenBabel-" << _pFP->GetID() << "/1" << '\n'
>
> with something like
>
> << "#type=OpenBabel-" << _pFP->GetID() << "/" <<
> _pFP->GetVersion() << '\n'
>
> which means the i

Re: [Open Babel] NxN Tanimoto similarity calculations/searches

2019-01-08 Thread Noel O'Boyle
Right now, the best approach is to use Andrew Dalke's chemfp.

- Noel

On Mon, 7 Jan 2019 at 15:12, John Hutchinson  wrote:

> Hello all,
>
>
>
> I have a list of ~4000 SMILES codes. For each substance, I want to
> determine all the substances with Tanimoto similarity >70%. I generated a
> fastsearch index and have been using the “-at0.7” command, but I can only
> do 1 query molecule at a time. Can someone recommend a simple way to
> automate this (for someone without a programming background)? I searched
> the mailing list archive and a few users had (as recently as 2015)
> expressed a desire to perform NxN or “all by all” tanimoto similarity
> calculations. I have seen chemfp recommended, but I am not running Linux.
> Has any additional work been done in this area?
>
>
>
> Thanks!
>
> John
>
>
>
> [image: cid:image005.gif@01D08C9B.9D1B0E80]
>
>
>
> *John Hutchinson, PhD, DABT*
> Corporate Toxicology and Environmental Science
> 3M Sustainability and Product Stewardship
> 3M Center, Building 0220-06-E-03 | St. Paul, MN 55144
> Office: 651 736 0087
>
> jhutchins...@mmm.com | www.3M.com 
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] changes to fingerprint generation, and FPS output

2019-01-07 Thread Noel O'Boyle
Sorry - a more careful read is that it means (3). And indeed this has
changed.

Off the top of my head, I don't believe any other commits have changed
this, but they may have. For example, I rewrote the handling of explicit
hydrogens, fixing many related bugs along the way.

Regards,
- Noel

On Mon, 7 Jan 2019 at 13:10, Noel O'Boyle  wrote:

> Can you clarify the requirement for bumping the version? That is, which of
> the following is the invariant:
> 1. Any molecule represented in any format changes must create the same
> fingerprint
> 2. Any SMILES string must create the same fingerprint
> 3. Any OBMol must create the same fingerprint
>
> Since you know where to edit, you can if you wish make the change directly
> on github, if you have an account there. But otherwise, I can do it.
>
> - Noel
>
> On Mon, 7 Jan 2019 at 10:50, Andrew Dalke 
> wrote:
>
>> Hi all,
>>
>>   I just updated from OB 2.4.1 to the most recent version from version
>> control. (This is part of a migration to Python 3.7.)
>>
>> I noticed that the MACCS key implementation changed for about 1% of the
>> first 27008 ChEMBL-24 structures, and the FP2 fingerprints changed for a
>> bit more than 1% of the structures. Here's a reproducible for MACCS:
>>
>> % cat CHEMBL23759.smi
>> O=C1CC(=O)[N+](CC2CC2)=C2SC=CN12 CHEMBL23759
>>
>> [py36-all] [xebulon:~/tmp] dalke% obabel CHEMBL23759.smi -ofps -xfMACCS
>> #FPS1
>> #num_bits=166
>> #type=OpenBabel-MACCS/1
>> #software=OpenBabel/2.4.1
>> #source=CHEMBL23759.smi
>> #date=2019-01-07T09:35:01
>> 2840010001b495891b63d043c9e12c6f1f  CHEMBL23759
>> 1 molecule converted
>>
>> [py37-2019-1] [xebulon:~/tmp] dalke% obabel CHEMBL23759.smi -ofps -xfMACCS
>> #FPS1
>> #num_bits=166
>> #type=OpenBabel-MACCS/1
>> #software=OpenBabel/2.4.90
>> #source=CHEMBL23759.smi
>> #date=2019-01-07T09:34:39
>> 285001b495891f63d04389612c6f1d  CHEMBL23759
>> 1 molecule converted
>>
>> If you compare the two strings you'll see several differences (I picked
>> one with many differences)
>>
>>
>> 2840010001b495891b63d043c9e12c6f1f
>> 285001b495891f63d04389612c6f1d
>>  ^   ^  ^ ^  ^
>>
>> The most common changes from the subset of ChEMBL I tested are:
>>
>>   Fewer matches in the new code for:
>> [#8]!:*:*   Onot%A%A
>> c:n   C%N
>> [!#1]!:*:*!:[!#1]   Anot%A%Anot%A
>> a   Aromatic
>>
>>   More matches for:
>> [#6]=[#6]   C=C
>>
>>   Different matches for:
>> [#7]!:*:*   Nnot%A%A
>>
>>
>> The same structure (CHEMBL23759) also has a number of changes for the FP2
>> fingerprint, and changes for the FP3 and FP4 fingerprints. I haven't
>> analyzed how many structures have changed for the latter two.
>>
>> I assume it's a side effect of a change to aromaticity perception, and my
>> guess is it's due to the following commit:
>>
>> commit 1991439efd920f27cd9755fe8abf5c18699d4a58
>> Merge: a06e271 d78062b
>> Author: Geoff Hutchison 
>> Date:   Mon Oct 2 16:40:08 2017 -0400
>>
>> Merge pull request #1638 from baoilleach/daylightarom
>>
>> Implement the Daylight aromaticity model as described by John Mayfield
>>
>>
>> Is my diagnosis correct?
>>
>> Has there only been one such change between the 2.4.1 release and now?
>>
>> Since the fingerprint output has changed, would someone update the
>> version number in Open Babel's FPS output from "1" to something higher?
>>
>> The "type" version should be updated when the fingerprint implementation
>> changes. Chemfp currently has:
>>
>>   OpenBabel-MACCS/1 -- for pre-2012 versions, before a bug-fix in the
>> SMARTS definitions
>>   OpenBabel-MACCS/2 -- for OB 2.4.1
>>
>> and /1 for the FP2, FP3, and FP4 types.
>>
>> The version information helps identify possible incompatibility problems.
>>
>> I am about to add the following types to chemfp, for the tentative reason
>> "support the Daylight aromaticity model added in October 2017":
>>
>>   OpenBabel-MACCS/2 to OpenBabel-MACCS/3
>>   OpenBabel-FP2/1 to OpenBabel-FP2/2
>>   OpenBabel-FP3/1 to OpenBabel-FP3/2
>>   OpenBabel-FP4/1 to OpenBabel-FP4/2
>>
>> I would appreciate it if Open Babel produced the same version string as
>> chemfp.
>>
>> The relevant code is in src/formats/fpsformat.cpp line 130:
>>
>> << "#type=OpenBabe

Re: [Open Babel] changes to fingerprint generation, and FPS output

2019-01-07 Thread Noel O'Boyle
Can you clarify the requirement for bumping the version? That is, which of
the following is the invariant:
1. Any molecule represented in any format changes must create the same
fingerprint
2. Any SMILES string must create the same fingerprint
3. Any OBMol must create the same fingerprint

Since you know where to edit, you can if you wish make the change directly
on github, if you have an account there. But otherwise, I can do it.

- Noel

On Mon, 7 Jan 2019 at 10:50, Andrew Dalke  wrote:

> Hi all,
>
>   I just updated from OB 2.4.1 to the most recent version from version
> control. (This is part of a migration to Python 3.7.)
>
> I noticed that the MACCS key implementation changed for about 1% of the
> first 27008 ChEMBL-24 structures, and the FP2 fingerprints changed for a
> bit more than 1% of the structures. Here's a reproducible for MACCS:
>
> % cat CHEMBL23759.smi
> O=C1CC(=O)[N+](CC2CC2)=C2SC=CN12 CHEMBL23759
>
> [py36-all] [xebulon:~/tmp] dalke% obabel CHEMBL23759.smi -ofps -xfMACCS
> #FPS1
> #num_bits=166
> #type=OpenBabel-MACCS/1
> #software=OpenBabel/2.4.1
> #source=CHEMBL23759.smi
> #date=2019-01-07T09:35:01
> 2840010001b495891b63d043c9e12c6f1f  CHEMBL23759
> 1 molecule converted
>
> [py37-2019-1] [xebulon:~/tmp] dalke% obabel CHEMBL23759.smi -ofps -xfMACCS
> #FPS1
> #num_bits=166
> #type=OpenBabel-MACCS/1
> #software=OpenBabel/2.4.90
> #source=CHEMBL23759.smi
> #date=2019-01-07T09:34:39
> 285001b495891f63d04389612c6f1d  CHEMBL23759
> 1 molecule converted
>
> If you compare the two strings you'll see several differences (I picked
> one with many differences)
>
>
> 2840010001b495891b63d043c9e12c6f1f
> 285001b495891f63d04389612c6f1d
>  ^   ^  ^ ^  ^
>
> The most common changes from the subset of ChEMBL I tested are:
>
>   Fewer matches in the new code for:
> [#8]!:*:*   Onot%A%A
> c:n   C%N
> [!#1]!:*:*!:[!#1]   Anot%A%Anot%A
> a   Aromatic
>
>   More matches for:
> [#6]=[#6]   C=C
>
>   Different matches for:
> [#7]!:*:*   Nnot%A%A
>
>
> The same structure (CHEMBL23759) also has a number of changes for the FP2
> fingerprint, and changes for the FP3 and FP4 fingerprints. I haven't
> analyzed how many structures have changed for the latter two.
>
> I assume it's a side effect of a change to aromaticity perception, and my
> guess is it's due to the following commit:
>
> commit 1991439efd920f27cd9755fe8abf5c18699d4a58
> Merge: a06e271 d78062b
> Author: Geoff Hutchison 
> Date:   Mon Oct 2 16:40:08 2017 -0400
>
> Merge pull request #1638 from baoilleach/daylightarom
>
> Implement the Daylight aromaticity model as described by John Mayfield
>
>
> Is my diagnosis correct?
>
> Has there only been one such change between the 2.4.1 release and now?
>
> Since the fingerprint output has changed, would someone update the version
> number in Open Babel's FPS output from "1" to something higher?
>
> The "type" version should be updated when the fingerprint implementation
> changes. Chemfp currently has:
>
>   OpenBabel-MACCS/1 -- for pre-2012 versions, before a bug-fix in the
> SMARTS definitions
>   OpenBabel-MACCS/2 -- for OB 2.4.1
>
> and /1 for the FP2, FP3, and FP4 types.
>
> The version information helps identify possible incompatibility problems.
>
> I am about to add the following types to chemfp, for the tentative reason
> "support the Daylight aromaticity model added in October 2017":
>
>   OpenBabel-MACCS/2 to OpenBabel-MACCS/3
>   OpenBabel-FP2/1 to OpenBabel-FP2/2
>   OpenBabel-FP3/1 to OpenBabel-FP3/2
>   OpenBabel-FP4/1 to OpenBabel-FP4/2
>
> I would appreciate it if Open Babel produced the same version string as
> chemfp.
>
> The relevant code is in src/formats/fpsformat.cpp line 130:
>
> << "#type=OpenBabel-" << _pFP->GetID() << "/1" << '\n'
>
> That's a hard-coded version number for all fingerprint types.
>
> I don't think the OB registry system supports versioning of the entire
> fingerprinting process, which makes sense from the plugin view because the
> plugin only knows about the format part, and not the fingerprint generation
> code. I don't know how the code might change to handle that information in
> the future.
>
> (Chemfp internally has a similar problem. Even there I'm not sure how I'll
> handle it.)
>
> The easy fix for now is likely to replace the "/1" with a "/3".
>
> If the Open Babel developers decide to make that change then use
> "OpenBabel-FP2/3", etc. instead of "/2".
>
> That means there wouldn't be an "OpenBabel-FP2/2", FP3/2, or FP4/2, but I
> think that's okay.
>
> Best regards,
>
> Andrew
> da...@dalkescientific.com
>
>
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list

Re: [Open Babel] be removed from the list

2018-12-23 Thread Noel O'Boyle
There's a link at the bottom of every email.

On Sun, 23 Dec 2018, 10:02 Yu Guo  Hi,
>
> I want to be removed from the list of
> openbabel-discuss@lists.sourceforge.net. Thank you!
>
>
> Yu Guo
>
> ​
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] generate image dynamically

2018-12-22 Thread Noel O'Boyle
Sure. Have the html include an img with src pointing to an svg file, and
have this request handled by flask which should return the svg file
generated dynamically based on the url. The important step is that flask
should set the mimetype correctly.

On Sat, 22 Dec 2018, 19:22 Spencer Trinh  Hi,
>
> Im new to openbabel. I wanted to make a webservice (using Flask) that can
> do smart searching on a database. How can I dynamically display SVG images
> on html template without having to write the file to a directory and point
> it to a physical location. Is it possible to render the image dynamically
> based on a user's query search and not save it to a physical location? I've
> seen some plotting packages that are able to use a function, i.e.
> `render_to_uri()` and embed it into the html code. Is there a similar
> function in pybel? How may one approach this? Thanks.
>
>
>
> Regards,
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Open Babel installation on Mac

2018-12-21 Thread Noel O'Boyle
We are not the developers of iBabel. I see there is a "contact me" link
over at https://www.macinchem.org/ibabel/.

On Fri, 21 Dec 2018 at 13:02, Zabdiel Alvarado Martinez 
wrote:

> Hello
> I appreciate this very powerful tool that this team has designed, however,
> I am new to Mac and have recently downloaded the iBabel software on my
> computer, but when I try to convert molecules it does not do anything. Any
> idea of what might be the cause of this?
>
> Best regards
> Zabdiel
>
> --
> Zabdiel Alvarado-Martinez
> PhD student in BISI Graduate Program-MOCB Concentration Area
> University of Maryland-College Park
> Email: zalva...@umd.edu
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] atom mapped RXN file to PNG

2018-12-21 Thread Noel O'Boyle
Unfortunately, the PNG depiction doesn't depict reactions (as far as I
know).

On Fri, 21 Dec 2018 at 13:02, gpreciat  wrote:

> Hi all,
> I'm trying to convert my database of RXN files into PNG files for faster
> visualization. I have tried different commands in the terminal but so far
> none has worked.
> Could you tell me if it is possible to do it and if so how?
> Thanks,
> Kind regards
>
>
>
> --
> Sent from: http://forums.openbabel.org/General-discussion-f3090658.html
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Weighted rotor search in parallel

2018-12-21 Thread Noel O'Boyle
I'm afraid not. :-/ You could try one of the other approaches like the
genetic algorithm, and see whether it progresses faster.

On Wed, 12 Dec 2018 at 21:45, Michele Galasso 
wrote:

> Hello everyone!
>
>
> I am using the weighted rotor search implemented in Open Babel in order to
> search for low-energy conformers of a huge molecule.
>
>
> Since the total number of rotamers is of the order 10^16, I cannot explore
> a decent portion of the search space by running the code serially (I use a
> python script, which calls the function WeightedRotorSearch).
>
>
> Is it possible to parallelize the optimization of trial conformers on many
> cores? How to do that properly?
>
>
>
> Thank you in advance for your help,
>
> Michele Galasso
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] << ECFP4 in OpenBabel >>

2018-12-07 Thread Noel O'Boyle
Just a note regarding the use of fingerprints for repeating structures such
as nanotubes. The bits in the fingerprint quickly become saturated as they
are based on local structural information which is the same again and again
within the repeating structure. For this reason, all peptides, for example,
appear equally similar to all other peptides (to a first approximation).
And all carbon nanotubes may appear equally similar also. Something to bear
in mind. This is one of the arguments for measuring similarity in a
different way, for example graph edit distance, or a descriptor that
captures some measurable global structural property related to a physical
property of interest.

- Noel

On Fri, 7 Dec 2018 at 10:22, Noel O'Boyle  wrote:

> An ECFP4 implementation could use a single bit or a million bits. The
> actual information that is being encoded is an element of a set of size of
> more than billions (I forget the details). So it's hashed to something
> manageable. The shorter the length, the more bit collisions (everything
> will collide with a single bit, for example). Open Babel uses 4096. I would
> regard this as the minimum.
>
> When converting from hex, you could concatenate the binaries. Or you could
> use pybel which doesn't the conversion for you:
> >>> pybel.readstring("smi", "c1c1C(=O)Cl").calcfp("ecfp4").bits
> [556, 1348, 1509, 1547, 1993, 2078, 2089, 2378, 2487, 2531, 2700, 3017,
> 3023, 3117, 3324, 3395, 3599, 4036]
>
> These are the bits that are set. If you use "len", you can get the number
> of them.
>
> Regards,
> - Noel
>
>
> On Fri, 7 Dec 2018 at 09:49, I. Camps  wrote:
>
>> @Geoff
>> I use Python.
>> I already made an script to convert hex to binary, but as I wrote
>> previously, the fingerprint (fp) from OpenBabel is in the form of a set of
>> hex numbers. I converted each one to binary and then concatenate all the
>> binaries. Is it that okay?
>> If it is okay, the second problem is that the fp is much longer (6040)
>> than the RDKit (1024). I really do not understand the "folded" issue
>> because any read about ECFP4 talk about a 1024 bit string and not higher.
>>
>> @Francois
>> I certainly will take a look!
>>
>> thank you both.
>>
>> Camps
>>
>>
>> On Fri, Dec 7, 2018 at 1:59 AM Geoffrey Hutchison <
>> geoff.hutchi...@gmail.com> wrote:
>>
>>> Using OpenBabel, I got a file with the information that the fingerprint
>>> is a 6040 bits set and got hexadecimal numbers.
>>> Using PyBioMed, which is based in RDKIT, I got a binary string of 1024
>>> bits, very different from that obtained with OpenBabel.
>>>
>>>
>>> The RDKit binary string will be "folded" down to 1024 bits, so of course
>>> they will be very different bit strings.
>>>
>>> 2-) How can I convert the ECFP4 obtained from OpenBabel in hexadecimal
>>> form to a bit string with only ones and zeros?
>>>
>>>
>>> What programming language are you using? For example in Python, a quick
>>> search on StackExchange:
>>>  https://stackoverflow.com/questions/1425493/convert-hex-to-binary
>>>
>>> Hope that helps,
>>> -Geoff
>>>
>> ___
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] << ECFP4 in OpenBabel >>

2018-12-07 Thread Noel O'Boyle
An ECFP4 implementation could use a single bit or a million bits. The
actual information that is being encoded is an element of a set of size of
more than billions (I forget the details). So it's hashed to something
manageable. The shorter the length, the more bit collisions (everything
will collide with a single bit, for example). Open Babel uses 4096. I would
regard this as the minimum.

When converting from hex, you could concatenate the binaries. Or you could
use pybel which doesn't the conversion for you:
>>> pybel.readstring("smi", "c1c1C(=O)Cl").calcfp("ecfp4").bits
[556, 1348, 1509, 1547, 1993, 2078, 2089, 2378, 2487, 2531, 2700, 3017,
3023, 3117, 3324, 3395, 3599, 4036]

These are the bits that are set. If you use "len", you can get the number
of them.

Regards,
- Noel


On Fri, 7 Dec 2018 at 09:49, I. Camps  wrote:

> @Geoff
> I use Python.
> I already made an script to convert hex to binary, but as I wrote
> previously, the fingerprint (fp) from OpenBabel is in the form of a set of
> hex numbers. I converted each one to binary and then concatenate all the
> binaries. Is it that okay?
> If it is okay, the second problem is that the fp is much longer (6040)
> than the RDKit (1024). I really do not understand the "folded" issue
> because any read about ECFP4 talk about a 1024 bit string and not higher.
>
> @Francois
> I certainly will take a look!
>
> thank you both.
>
> Camps
>
>
> On Fri, Dec 7, 2018 at 1:59 AM Geoffrey Hutchison <
> geoff.hutchi...@gmail.com> wrote:
>
>> Using OpenBabel, I got a file with the information that the fingerprint
>> is a 6040 bits set and got hexadecimal numbers.
>> Using PyBioMed, which is based in RDKIT, I got a binary string of 1024
>> bits, very different from that obtained with OpenBabel.
>>
>>
>> The RDKit binary string will be "folded" down to 1024 bits, so of course
>> they will be very different bit strings.
>>
>> 2-) How can I convert the ECFP4 obtained from OpenBabel in hexadecimal
>> form to a bit string with only ones and zeros?
>>
>>
>> What programming language are you using? For example in Python, a quick
>> search on StackExchange:
>>  https://stackoverflow.com/questions/1425493/convert-hex-to-binary
>>
>> Hope that helps,
>> -Geoff
>>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Math multiplication symbol in SMARTs

2018-11-24 Thread Noel O'Boyle
The source code for filter-it is open. Also it's documented.

http://silicos-it.be.s3-website-eu-west-1.amazonaws.com/software/filter-it/1.0.2/filter-it.html#logs




On Fri, 23 Nov 2018, 13:15 Leif Peterson  I changed it to an X and might try x since results are off a little.  some
> compounds also result in large differences in LogS compared with Silicos-IT
> method.   it would be nice if there was a .NET implementation of
> CalcDesc(), but with 4-5 of the LogP variants and LogS values generated at
> SwissADME.  I should be able to obtain identical values of the Silicos-IT
> values of LogS provided at SwissADME, but I am off slightly.  They never
> replied on how they prep molecules before LogS.
>
> Get Outlook for Android 
>
>
>
>
> On Wed, Nov 21, 2018 at 1:32 AM -0600, "Craig James" <
> cja...@emolecules.com> wrote:
>
> See:
>>
>> http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html
>>
>> Look at the first section,  "4.1 SMARTS Atomic Primitives" section. Both
>> "x" and "X" are valid, but not with spaces.
>>
>> Craig
>>
>> On Tue, Nov 20, 2018 at 9:21 AM Leif Peterson <
>> outlook_ea1c3adb71ba7...@outlook.com> wrote:
>>
>>> I am using OB and SmartsPattern fetching in 2D compounds, and need to
>>> fetch a published SMARTS which looks like the following:
>>>
>>> [CX4;H]([#6 × 4,c,F,Cl,Br,I])([#6 × 4,c,F,Cl,Br,I])[#6 × 4,c,F,Cl,Br,I]
>>>
>>> and there are actually spaces around the × symbols between the 6 and 4.
>>>
>>> Question is, should I change this multiplication notation to a lower
>>> case "x", delete the spaces, or really use some sort of ASCII symbol which
>>> represents multiplication? I didn't see a multiplication symbol anywhere in
>>> the Daylight SMARTS description.
>>>
>>>
>>> ___
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>>
>>
>> --
>> -
>> Craig A. James
>> Chief Technology Officer
>> eMolecules, Inc.
>> -
>>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Determining if carbons are hydrophobic

2018-11-21 Thread Noel O'Boyle
You need to look at the definition in the original reference; you won't be
able to reproduce the model unless you use the same definitions.

I'm pretty sure that it doesn't involve 3d structures or partial charge
calculations. Think about how you would identify hydrophobic atoms given a
molecular diagram. Everything that's not carbon, would be a good starting
point. Regarding the carbons, is it only sp3 they mean? Who knows.

- Noel

On Tue, 20 Nov 2018 at 23:53, Leif Peterson 
wrote:

> One of the weights for a particular LogS method requires the number of
> hydrophobic carbons.  So I added hydrogens,  transformed to three
> dimensions, energy minimized with gradient descent (don't need conformers
> here), then parsed the mol2 output to fetch the partial charge on the far
> right side.  While this is the partial charge of each atom in its 3d
> protonated form, I wonder if this is overkill?  OBAtom doesn't have an
> atom.IsPolar or atom.HasCovalentBond, and the atom.GetpartialCharge is zero
> for every carbon.  Is there an easy way to do this for LogS?
>
>
>
>
>
> Get Outlook for Android 
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Math multiplication symbol in SMARTs

2018-11-20 Thread Noel O'Boyle
It's probably a capital X4 without spaces messed up by the journal. What's
the ref?

On Tue, 20 Nov 2018, 17:21 Leif Peterson <
outlook_ea1c3adb71ba7...@outlook.com wrote:

> I am using OB and SmartsPattern fetching in 2D compounds, and need to
> fetch a published SMARTS which looks like the following:
>
> [CX4;H]([#6 × 4,c,F,Cl,Br,I])([#6 × 4,c,F,Cl,Br,I])[#6 × 4,c,F,Cl,Br,I]
>
> and there are actually spaces around the × symbols between the 6 and 4.
>
> Question is, should I change this multiplication notation to a lower case
> "x", delete the spaces, or really use some sort of ASCII symbol which
> represents multiplication? I didn't see a multiplication symbol anywhere in
> the Daylight SMARTS description.
>
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Aromaticity perception/parsing

2018-11-16 Thread Noel O'Boyle
Have you tried the development version? This has been rewritten.

On Fri, 16 Nov 2018, 00:19 Stefano Forli  Hi,
>
> I've found a series of molecules that trigger what looks like a bug but I
> want to make sure there isn't something clearly wrong with the structures,
> before reporting it.
>
> The molecules look fine when inspecting them in 3D (Pymol), but OpenBabel
> (both 2.3 and 2.4) parse the structures removing entirely the aromaticity
> information.
>
> $ obabel ZINC08616812.mol2 -ocan
> C[C@@H]1CC[C@@H]([C@@H]2[C@@H]1[NH2+][C@@H](C)CC2=O)Cl  ZINC08616812
> 1 molecule converted
>
> $ obabel  ZINC00119428.mol2 -ocan
> Cl[C@@H]1CC[C@@H](CC1)N1NNN[C@@H]1[C@H]1C[NH2+][C@@H]2[C@@H](C1=O)2
> ZINC00119428
> 1 molecule converted
>
> I don't think in this form the 4-pyridone is aromatic, but I still think
> there's something wrong with the way the valence information is lost when
> parsing the structures.
>
> Any clues?
>
> Thanks,
>
> S
> --
>
>   Stefano Forli, PhD
>
>   Assistant Professor
>   Dept. of Integrative Structural
>   and Computational Biology, MB-112A
>   The Scripps Research Institute
>   10550  North Torrey Pines Road
>   La Jolqla,  CA 92037-1000,  USA.
>
>  tel: +1 (858)784-2055
>  fax: +1 (858)784-2860
>  email: fo...@scripps.edu
>  http://www.scripps.edu/faculty/forli/
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] python3 bindings bug updates?

2018-11-15 Thread Noel O'Boyle
That bug is filed against some other project, not Open Babel, and so it's
news to us. Thanks for bringing it to our attention. I'll file a bug for
Open Babel.

The bindings work just fine, though - I use them all the time. But I'll
look into the problem with the test script and sort it out.

Regards,
- Noel

On Thu, 15 Nov 2018 at 15:56, Bennion, Brian  wrote:

> https://github.com/harryjubb/openbabel_python_docker/issues/1
>
> This is the same issue that I am observing. So I dont think that I should
> submit another report.
>
> Brian
>
>
>
>
> On November 15, 2018 at 2:05:03 AM PST, Noel O'Boyle 
> wrote:
>
> Works for me. Can you file a bug report? You're going to need to give us
> more information about versions of everything. We haven't deprecated Python
> 2.
>
> Regards,
> - Noel
>
> On Thu, 15 Nov 2018 at 01:18, Bennion, Brian via OpenBabel-discuss <
> openbabel-discuss@lists.sourceforge.net> wrote:
>
> Hello
> I tried to compile obabel with python bindings. During testing the last 4
> tests fail.  When I searched for the error I found a bug report from June
> 2018.  Has there been any progress on this since python2 will be deprecated?
>
> Thanks
> Brian Bennion
>
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


  1   2   3   4   5   6   7   >