On Fri, Jul 22, 2011 at 5:47 PM, Noel O'Boyle <baoille...@gmail.com> wrote:

> Conceptually, what SetTorsion does is to take a single bond and rotate
> it (not just move the one atom you specify in the command). As you've
> found, this is not quite what you were looking for. Open Babel can
> read and write z-matrices so there must be some code in there for
> doing what you suggest - you should probably look at some of those
> z-matrix formats. Alternatively, you could edit SetTorsion to avoid
> considering the other parts of the molecule that are attached to the
> end of the bond) and send in the patch.
>

I see that the issue really is that I wanted to use a method to do something
that it is actually not designed for. I will consider my next move. Thank
you for your help!

Regards,
Martin.


>
> - Noel
>
>
> On 21 July 2011 18:23, Martin Kamp Jensen <martin.kamp.jen...@gmail.com>
> wrote:
> > On Thu, Jul 21, 2011 at 6:26 PM, Noel O'Boyle <baoille...@gmail.com>
> wrote:
> >>
> >> Your molecule does not have 3D coordinates, so torsions are all messed
> up.
> >
> > Ah, I did that now and now and can show you what my original
> question/issue
> > is all about:
> >  OBConversion c = new OBConversion();
> > c.SetInFormat("smi");
> > OBMol m = new OBMol();
> > c.ReadString(m, "CCCC");
> > m.AddHydrogens();
> > OBBuilder b = new OBBuilder();
> > b.Build(m);
> >
> > System.out.println(m.GetTorsion(1, 2, 3, 10)); // C-C-C-H
> > System.out.println(m.GetTorsion(1, 2, 3, 11)); // C-C-C-H
> >  System.out.println("---");
> > m.SetTorsion(m.GetAtom(1), m.GetAtom(2), m.GetAtom(3), m.GetAtom(10),
> > Math.toRadians(50));
> > System.out.println(m.GetTorsion(1, 2, 3, 10));
> > System.out.println(m.GetTorsion(1, 2, 3, 11));
> >
> > System.out.println("---");
> > m.SetTorsion(m.GetAtom(1), m.GetAtom(2), m.GetAtom(3), m.GetAtom(11),
> > Math.toRadians(100));
> > System.out.println(m.GetTorsion(1, 2, 3, 10));
> > System.out.println(m.GetTorsion(1, 2, 3, 11));
> >
> > Output (my comments after //):
> > -179.9743765482302 // Original 1, 2, 3, 10
> > -59.999943704013745 // Original 1, 2, 3, 11
> > ---
> > 49.919061598456146 // 1, 2, 3, 10 as requested
> > 169.91902782077864 // 1, 2, 3, 11 was changed automatically to maintain
> 120
> > degree difference or something like that
> > ---
> > -19.999966222322385 // 1, 2, 3, 10 was changed automatically to maintain
> 120
> > degree difference or something like that
> > 99.99999999999997 // 1, 2, 3, 11 as requested
> > So it seems to be impossible to change the torsion angles (1, 2, 3, 10),
> and
> > (1, 2, 3, 11) independently of each other?
> > My current "way out there hack" is to have my own list of the torsion
> angles
> > and manipulate them, then calculate the Cartesian coordinates of all
> atoms
> > based on my stored values, and then finally assigning those coordinates
> to
> > all the OBAtoms of the OBMol. That's just... puh :)
> >>
> >> On 21 July 2011 17:21, Martin Kamp Jensen <martin.kamp.jen...@gmail.com
> >
> >> wrote:
> >> > On Wed, Jul 20, 2011 at 3:00 PM, Noel O'Boyle <baoille...@gmail.com>
> >> > wrote:
> >> >>
> >> >> Works for me from Python:
> >> >>
> >> >> >>> import pybel
> >> >> >>> mol = pybel.readstring("smi", "CCCC")
> >> >> >>> mol.make3D()
> >> >> >>> mol.OBMol.GetTorsion(1,2,3,4)
> >> >> -179.9743765482302
> >> >> >>> mol.OBMol.SetTorsion(1,2,3,4, 22.5*math.pi/180.)
> >> >> >>> mol.OBMol.GetTorsion(1,2,3,4)
> >> >> 22.500000000000004
> >> >
> >> > My issue is actually that by changing one angle, other angles (of
> bonded
> >> > neighbors) would be changed as well. Then there could be a situation
> >> > where
> >> > you change two different angle, and then the changes neutralize each
> >> > other.
> >> > I was going to show it, but the code below results in something else
> >> > than
> >> > yours even though I thought it should be the same... hmm.
> >> >>
> >> >> OBConversion c = new OBConversion();
> >> >>  c.SetInFormat("smi");
> >> >>  OBMol m = new OBMol();
> >> >>  c.ReadString(m, "CCCC");
> >> >>  System.out.println(m.GetTorsion(1, 2, 3, 4));
> >> >>  m.SetTorsion(m.GetAtom(1), m.GetAtom(2), m.GetAtom(3), m.GetAtom(4),
> >> >>  22.5*Math.PI/180);
> >> >>  System.out.println(m.GetTorsion(1, 2, 3, 4));
> >> >
> >> > Output:
> >> >>
> >> >> 180.0
> >> >> 180.0
> >> >>
> >> >> where SetTorsion is defined in the Python interface as:
> >> >>  void SetTorsion(int i, int j, int k, int l, double ang)
> >> >>  {
> >> >>    self->SetTorsion(self->GetAtom(i), self->GetAtom(j),
> >> >>                     self->GetAtom(k), self->GetAtom(l), ang);
> >> >>  }
> >> >>
> >> >> - Noel
> >> >>
> >> >> On 15 July 2011 21:41, Martin Kamp Jensen
> >> >> <martin.kamp.jen...@gmail.com>
> >> >> wrote:
> >> >> > Hello,
> >> >> > Maybe someone can explain to me how the SetTorsion method [1] of
> the
> >> >> > OBMol
> >> >> > class works? The documentation is "Set the torsion defined by these
> >> >> > atoms,
> >> >> > rotating bonded neighbors." It is the latter part about rotating
> >> >> > bonded
> >> >> > neighbors I am particularly interested in. My question arises
> because
> >> >> > I
> >> >> > have
> >> >> > noticed that if I use the SetTorsion method to change several
> torsion
> >> >> > angles
> >> >> > between bonded atoms in a molecule and then check the torsion
> angles
> >> >> > using
> >> >> > GetTorsion [2] then they are not identical to the values I wanted
> to
> >> >> > assign
> >> >> > (I am aware that GetTorsion returns a value in degrees while
> >> >> > SetTorsion
> >> >> > takes a value in radians). Further, it seems to matter in what
> order
> >> >> > I
> >> >> > change the angles. So it seems like changing a specific torsion
> angle
> >> >> > can
> >> >> > lead to other torsion angles changing. Can that be avoided?
> >> >> >
> >> >> >
> >> >> > [1]
> http://openbabel.org/api/2.3/classOpenBabel_1_1OBMol.shtml#a501e76993e9deb8ec8ab24c464d4ed3c
> >> >> >
> >> >> >
> >> >> > [2]
> http://openbabel.org/api/2.3/classOpenBabel_1_1OBMol.shtml#adfd902d8de9eeb32ea476fe916a329fd
> >> >> > Thanks,
> >> >> > Martin.
> >> >> >
> >> >> >
> >> >> >
> ------------------------------------------------------------------------------
> >> >> > AppSumo Presents a FREE Video for the SourceForge Community by Eric
> >> >> > Ries, the creator of the Lean Startup Methodology on "Lean Startup
> >> >> > Secrets Revealed." This video shows you how to validate your ideas,
> >> >> > optimize your ideas and identify your business strategy.
> >> >> > http://p.sf.net/sfu/appsumosfdev2dev
> >> >> > _______________________________________________
> >> >> > OpenBabel-discuss mailing list
> >> >> > OpenBabel-discuss@lists.sourceforge.net
> >> >> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
> >> >> >
> >> >> >
> >> >
> >> >
> >
> >
>
------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to