Hi Eric

> Dear all,
>
> I would like to align two molecules.
>
> In the python API, pybel.operations include align, so I guess it is
> supported.
> However, I can hardly find a way to access the function. It is not clear in
> the documentation (
> http://openbabel.org/docs/dev/UseTheLibrary/Python_PybelAPI.html#pybel.operations
> ).
>
> Anyone has any ideas? Must I use the c++ API to align two molecules?
>
> Eric

That might be because the action "align" is not actually wrapped in a
function but a method associated with an object of the OBOp class
(stands for OpenBabelOperation). So you first need to initialize the
object with the appropriate action name and then use it's "Do" function
to have it do what it's made for. Something along the lines of the
following should work (not tested and obviously incomplete):

import openbabel as op
operation = op.OBOp.FindType("align")
LOAD MOLECULE 1
LOAD MOLECULE 2
operation.Do(MOLECULE, options)

However, I am unsure of the other options that need to be passed to the
"Do" method as I am about the way the two structures should be passed to
the method since it takes only one object of the OBMol class. Looking
into src/ops/opalign.cpp and include/openbabel/op.h might help, though.
Maybe even no options are needed and it's sufficient to have the first
molecule as the first "conformer" and the second molecule as the second
"conformer" in the OBMol object. And I don't think you need the C++-API
for this.

Hope this helps somewhat,
Torsten

------------------------------------------------------------------------------
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to