OBMolAngleIter() wrong angles?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

OBMolAngleIter() wrong angles?

Iordan Hristov
Hello,

when I build a hydrogen peroxide from SMILES I get a wrong angle sequence (while the bonds and dihedral are ok).
Here is the output for the molecule (H-O-O-H):

mass [1.0079400000000001, 15.9994, 15.9994, 1.0079400000000001]
bonds [(1, 2), (2, 3), (3, 4)]
angles [(1, 0, 2), (2, 1, 3)]
dihedral [(0, 1, 2, 3)]

One would expect to get the angles as (0,1,2) and (1,2,3) so what's going on? I'm using OpenBabel 2-2-1 compiled from svn.

Thanks,
Iordan


p.s. the Python script:   

import openbabel

obConversion = openbabel.OBConversion()
obConversion.SetInAndOutFormats("smi", "mdl")
mol = openbabel.OBMol()
obConversion.ReadString(mol,"[H]OO[H]")

print 'mass', [i.GetAtomicMass() for i in openbabel.OBMolAtomIter(mol)]
print 'bonds', [(i.GetBeginAtomIdx(),i.GetEndAtomIdx()) for i in openbabel.OBMolBondIter(mol)]
print 'angles', [i for i in openbabel.OBMolAngleIter(mol)]
print 'dihedral', [i for i in openbabel.OBMolTorsionIter(mol)]

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OBMolAngleIter() wrong angles?

Geoffrey Hutchison
> angles [(1, 0, 2), (2, 1, 3)]
...
> One would expect to get the angles as (0,1,2) and (1,2,3) so what's  
> going on? I'm using OpenBabel 2-2-1 compiled from svn.

The Open Babel "FindAngles" method doesn't work like you're expecting.  
Instead, it starts at the first atom (0 in Pybel notation) and looks  
for two neighbors. Instead, you seem to be expecting that it finds the  
first atom, then goes to a neighbor, and then to the next.

The does seem to be some interest in using the ordering you mention.  
Other opinions from the list?

Cheers,
-Geoff

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OBMolAngleIter() wrong angles?

Iordan Hristov
The Open Babel "FindAngles" method doesn't work like you're expecting. Instead, it starts at the first atom (0 in Pybel notation) and looks for two neighbors.

If that was the case in H-O-O-H we would get the correct angle sequence H-O-O but we get O-H-O for the first angle.

Instead, you seem to be expecting that it finds the first atom, then goes to a neighbor, and then to the next.

Well, I think people who will use the iterator would expect nothing more or less than the angles that actually appear in their molecules. As it is right now we get some mangled version of the angles with the atoms permuted. If the intent of OBMolAngleIter() was to return a  sequence of atoms that form an angle only when rearranged that should be noted in the documentation. But why should the method rearrange the sequences it finds and not return them in the correct order (like H-O-O)? That must be a bug.


Thanks,
Iordan


On Apr 23, 2009, at 10:43 AM, Geoffrey Hutchison wrote:

angles [(1, 0, 2), (2, 1, 3)]
...
One would expect to get the angles as (0,1,2) and (1,2,3) so what's going on? I'm using OpenBabel 2-2-1 compiled from svn.

The Open Babel "FindAngles" method doesn't work like you're expecting. Instead, it starts at the first atom (0 in Pybel notation) and looks for two neighbors. Instead, you seem to be expecting that it finds the first atom, then goes to a neighbor, and then to the next.

The does seem to be some interest in using the ordering you mention. Other opinions from the list?

Cheers,
-Geoff


Hello,

when I build a hydrogen peroxide from SMILES I get a wrong angle sequence (while the bonds and dihedral are ok).
Here is the output for the molecule (H-O-O-H):

mass [1.0079400000000001, 15.9994, 15.9994, 1.0079400000000001]
bonds [(1, 2), (2, 3), (3, 4)]
angles [(1, 0, 2), (2, 1, 3)]
dihedral [(0, 1, 2, 3)]

One would expect to get the angles as (0,1,2) and (1,2,3) so what's going on? I'm using OpenBabel 2-2-1 compiled from svn.

Thanks,
Iordan


p.s. the Python script:   

import openbabel

obConversion = openbabel.OBConversion()
obConversion.SetInAndOutFormats("smi""mdl")
mol = openbabel.OBMol()
obConversion.ReadString(mol,"[H]OO[H]")

print 'mass', [i.GetAtomicMass() for i in openbabel.OBMolAtomIter(mol)]
print 'bonds', [(i.GetBeginAtomIdx(),i.GetEndAtomIdx()) for i in openbabel.OBMolBondIter(mol)]
print 'angles', [i for i in openbabel.OBMolAngleIter(mol)]
print 'dihedral', [i for i in openbabel.OBMolTorsionIter(mol)]


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OBMolAngleIter() wrong angles?

Tim Vandermeersch
On Thu, Apr 23, 2009 at 11:35 PM, Iordan Hristov <[hidden email]> wrote:
> The Open Babel "FindAngles" method doesn't work like you're expecting.
> Instead, it starts at the first atom (0 in Pybel notation) and looks for two
> neighbors.
>
> If that was the case in H-O-O-H we would get the correct angle sequence
> H-O-O but we get O-H-O for the first angle.

O-H-O is correct using the previously described notation as far as I
can see. The first O is the angle corner and the H and O are the
terminals. (note: O-H-O does not imply the hydrogen has two bonded
atoms!)

> Instead, you seem to be expecting that it finds the first atom, then goes to
> a neighbor, and then to the next.
>
> Well, I think people who will use the iterator would expect nothing more or
> less than the angles that actually appear in their molecules. As it is right
> now we get some mangled version of the angles with the atoms permuted. If
> the intent of OBMolAngleIter() was to return a  sequence of atoms that form
> an angle only when rearranged that should be noted in the documentation. But
> why should the method rearrange the sequences it finds and not return them
> in the correct order (like H-O-O)? That must be a bug.

The angles are actually found in this order. We iterate over all
atoms, iterate over their neighbor atoms and add the angles to the
list.

Tim

> Thanks,
> Iordan
>
> On Apr 23, 2009, at 10:43 AM, Geoffrey Hutchison wrote:
>
> angles [(1, 0, 2), (2, 1, 3)]
>
> ...
>
> One would expect to get the angles as (0,1,2) and (1,2,3) so what's going
> on? I'm using OpenBabel 2-2-1 compiled from svn.
>
> The Open Babel "FindAngles" method doesn't work like you're expecting.
> Instead, it starts at the first atom (0 in Pybel notation) and looks for two
> neighbors. Instead, you seem to be expecting that it finds the first atom,
> then goes to a neighbor, and then to the next.
>
> The does seem to be some interest in using the ordering you mention. Other
> opinions from the list?
>
> Cheers,
> -Geoff
>
>
> Hello,
> when I build a hydrogen peroxide from SMILES I get a wrong angle
> sequence (while the bonds and dihedral are ok).
> Here is the output for the molecule (H-O-O-H):
> mass [1.0079400000000001, 15.9994, 15.9994, 1.0079400000000001]
> bonds [(1, 2), (2, 3), (3, 4)]
> angles [(1, 0, 2), (2, 1, 3)]
> dihedral [(0, 1, 2, 3)]
> One would expect to get the angles as (0,1,2) and (1,2,3) so what's going
> on? I'm using OpenBabel 2-2-1 compiled from svn.
> Thanks,
> Iordan
>
> p.s. the Python script:
> import openbabel
> obConversion = openbabel.OBConversion()
> obConversion.SetInAndOutFormats("smi", "mdl")
> mol = openbabel.OBMol()
> obConversion.ReadString(mol,"[H]OO[H]")
> print 'mass', [i.GetAtomicMass() for i in openbabel.OBMolAtomIter(mol)]
> print 'bonds',
> [(i.GetBeginAtomIdx(),i.GetEndAtomIdx()) for i in openbabel.OBMolBondIter(mol)]
> print 'angles', [i for i in openbabel.OBMolAngleIter(mol)]
> print 'dihedral', [i for i in openbabel.OBMolTorsionIter(mol)]
>
> ------------------------------------------------------------------------------
> Crystal Reports &#45; New Free Runtime and 30 Day Trial
> Check out the new simplified licensign option that enables unlimited
> royalty&#45;free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OBMolAngleIter() wrong angles?

Noel O'Boyle
Administrator
The question is what set of angles does the user expect? The answer probably is a redundant set of all internal bond angles e.g. 6 angles for CH4. (The current result is actually no angles)

If a definitive set of angles cannot be agreed then this function may be of little use to others. Perhaps it would be better simply to point users to the GetAngle() method of OBAngle so that they can calculate the angles themselves.

- Noel

2009/4/23 Tim Vandermeersch <[hidden email]>
On Thu, Apr 23, 2009 at 11:35 PM, Iordan Hristov <[hidden email]> wrote:
> The Open Babel "FindAngles" method doesn't work like you're expecting.
> Instead, it starts at the first atom (0 in Pybel notation) and looks for two
> neighbors.
>
> If that was the case in H-O-O-H we would get the correct angle sequence
> H-O-O but we get O-H-O for the first angle.

O-H-O is correct using the previously described notation as far as I
can see. The first O is the angle corner and the H and O are the
terminals. (note: O-H-O does not imply the hydrogen has two bonded
atoms!)

> Instead, you seem to be expecting that it finds the first atom, then goes to
> a neighbor, and then to the next.
>
> Well, I think people who will use the iterator would expect nothing more or
> less than the angles that actually appear in their molecules. As it is right
> now we get some mangled version of the angles with the atoms permuted. If
> the intent of OBMolAngleIter() was to return a  sequence of atoms that form
> an angle only when rearranged that should be noted in the documentation. But
> why should the method rearrange the sequences it finds and not return them
> in the correct order (like H-O-O)? That must be a bug.

The angles are actually found in this order. We iterate over all
atoms, iterate over their neighbor atoms and add the angles to the
list.

Tim

> Thanks,
> Iordan
>
> On Apr 23, 2009, at 10:43 AM, Geoffrey Hutchison wrote:
>
> angles [(1, 0, 2), (2, 1, 3)]
>
> ...
>
> One would expect to get the angles as (0,1,2) and (1,2,3) so what's going
> on? I'm using OpenBabel 2-2-1 compiled from svn.
>
> The Open Babel "FindAngles" method doesn't work like you're expecting.
> Instead, it starts at the first atom (0 in Pybel notation) and looks for two
> neighbors. Instead, you seem to be expecting that it finds the first atom,
> then goes to a neighbor, and then to the next.
>
> The does seem to be some interest in using the ordering you mention. Other
> opinions from the list?
>
> Cheers,
> -Geoff
>
>
> Hello,
> when I build a hydrogen peroxide from SMILES I get a wrong angle
> sequence (while the bonds and dihedral are ok).
> Here is the output for the molecule (H-O-O-H):
> mass [1.0079400000000001, 15.9994, 15.9994, 1.0079400000000001]
> bonds [(1, 2), (2, 3), (3, 4)]
> angles [(1, 0, 2), (2, 1, 3)]
> dihedral [(0, 1, 2, 3)]
> One would expect to get the angles as (0,1,2) and (1,2,3) so what's going
> on? I'm using OpenBabel 2-2-1 compiled from svn.
> Thanks,
> Iordan
>
> p.s. the Python script:
> import openbabel
> obConversion = openbabel.OBConversion()
> obConversion.SetInAndOutFormats("smi", "mdl")
> mol = openbabel.OBMol()
> obConversion.ReadString(mol,"[H]OO[H]")
> print 'mass', [i.GetAtomicMass() for i in openbabel.OBMolAtomIter(mol)]
> print 'bonds',
> [(i.GetBeginAtomIdx(),i.GetEndAtomIdx()) for i in openbabel.OBMolBondIter(mol)]
> print 'angles', [i for i in openbabel.OBMolAngleIter(mol)]
> print 'dihedral', [i for i in openbabel.OBMolTorsionIter(mol)]
>
> ------------------------------------------------------------------------------
> Crystal Reports &#45; New Free Runtime and 30 Day Trial
> Check out the new simplified licensign option that enables unlimited
> royalty&#45;free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OBMolAngleIter() wrong angles?

Geoffrey Hutchison

On Apr 24, 2009, at 4:14 AM, Noel O'Boyle wrote:

> The question is what set of angles does the user expect?

Well, I'll grant that the user may expect angles similar to a set of  
internal coordinates -- e.g., start at the first atom, then one  
neighbor, then the next. But I don't think the current code is all  
that unexpected -- start with the first atom as the vertex, generate  
angles around that, then move to the second atom, etc.

> The answer probably is a redundant set of all internal bond angles  
> e.g. 6 angles for CH4. (The current result is actually no angles)

I'm open to expanding methods to a redundant set, but the current code  
generates angle terms for force fields -- in which case, redundancy is  
not necessarily welcome.

I'm not sure why methane would generate no angles. I would normally  
expect three angles. I'll have to set up a test.

-Geoff

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OBMolAngleIter() wrong angles?

Iordan Hristov
> Well, I'll grant that the user may expect angles similar to a set of  
> internal coordinates -- e.g., start at the first atom, then one  
> neighbor, then the next. But I don't think the current code is all  
> that unexpected -- start with the first atom as the vertex, generate  
> angles around that, then move to the second atom, etc.
>

This will look more consistent with the way OBMolTorsionIter() reports  
the torsions.

>> The answer probably is a redundant set of all internal bond angles  
>> e.g. 6 angles for CH4. (The current result is actually no angles)
>
> I'm open to expanding methods to a redundant set, but the current  
> code generates angle terms for force fields -- in which case,  
> redundancy is not necessarily welcome.
>
> I'm not sure why methane would generate no angles. I would normally  
> expect three angles. I'll have to set up a test.
>
> -Geoff

If the forcefield implements a "H-C-H" bending potential for CH4 it's  
likely it uses the redundant set of angles. I think forcefields that  
don't use such a set would screen the redundant angles based on the  
atom names, say have a H1-C-H2 bending potential entry but not a H1-C-
H4 entry. Maybe OBMolAngleIter() and OBMolTorsionIter() could have the  
default redundant behavior (as it's determined by connectivity alone)  
and take an optional forcefield argument that would chop off the  
redundant (for that forcefield) angles.

Iordan

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OBMolAngleIter() wrong angles?

Iordan Hristov
>>> The answer probably is a redundant set of all internal bond angles  
>>> e.g. 6 angles for CH4. (The current result is actually no angles)
>>
>> I'm open to expanding methods to a redundant set, but the current  
>> code generates angle terms for force fields -- in which case,  
>> redundancy is not necessarily welcome.
>>
>> I'm not sure why methane would generate no angles. I would normally  
>> expect three angles. I'll have to set up a test.
>>
>> -Geoff
>
> If the forcefield implements a "H-C-H" bending potential for CH4  
> it's likely it uses the redundant set of angles. I think forcefields  
> that don't use such a set would screen the redundant angles based on  
> the atom names, say have a H1-C-H2 bending potential entry but not a  
> H1-C-H4 entry. Maybe OBMolAngleIter() and OBMolTorsionIter() could  
> have the default redundant behavior (as it's determined by  
> connectivity alone) and take an optional forcefield argument that  
> would chop off the redundant (for that forcefield) angles.
>
> Iordan

I just tested methane (as [H]C([H])([H])[H]) with OpenBabel 2-2-1 and  
it actually reports all angles, including redundant ones:

bonds [(1, 2), (2, 3), (2, 4), (2, 5)]
angles [(1, 0, 2), (1, 0, 3), (1, 0, 4), (1, 2, 3), (1, 2, 4), (1, 3,  
4)]

So all is good!

Iordan

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OBMolAngleIter() wrong angles?

Geoffrey Hutchison
In reply to this post by Iordan Hristov
I always flag a few e-mails for upcoming releases. Do you still want to propose a different ordering for FindAngles / OBMolAngleIter?

-Geoff

On Apr 23, 2009, at 5:35 PM, Iordan Hristov wrote:

>> The Open Babel "FindAngles" method doesn't work like you're expecting. Instead, it starts at the first atom (0 in Pybel notation) and looks for two neighbors.
>
> If that was the case in H-O-O-H we would get the correct angle sequence H-O-O but we get O-H-O for the first angle.
>
>> Instead, you seem to be expecting that it finds the first atom, then goes to a neighbor, and then to the next.
>
> Well, I think people who will use the iterator would expect nothing more or less than the angles that actually appear in their molecules. As it is right now we get some mangled version of the angles with the atoms permuted. If the intent of OBMolAngleIter() was to return a  sequence of atoms that form an angle only when rearranged that should be noted in the documentation. But why should the method rearrange the sequences it finds and not return them in the correct order (like H-O-O)? That must be a bug.



------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss