From: Noel O'B. <bao...@gm...> - 2008-10-14 10:43:10
|
The enum part is fine. e.g. openbabel.OBConversion.GENOPTIONS is 1, etc. Even if you use this, you get a segfault. 2008/10/14 Chris Morley <c.m...@ga...>: > Jérôme Hert wrote: >> Dear Colleaugues, >> >> I was trying to use an option when converting a file into a different >> format. >> >> I use Perl so I write something like >> use Chemistry::OpenBabel; >> my $obMol = new Chemistry::OpenBabel::OBMol; >> my $obConversion = new Chemistry::OpenBabel::OBConversion; >> $obConversion->SetInAndOutFormats( "mol2", "pdb" ); >> $obConversion->ReadFile( $obMol, "infile.mol2"); >> $obConversion->WriteFile( $obMol, "outfile.pdb" ); >> >> That works fine. >> >> Now I am trying to add something like: >> $obConversion->AddOption("d"); >> before reading thr file in, the program doesn't complain but nothing >> happens (i.e., the hydrogens are still present in the output file). >> >> Anybody has any idea how these options are named? Any has any clue about >> all those GetOptions, SetOption, GetOptions etc of that class in Perl? >> > In C++ it would be necessary to use: > > obConversion->AddOption("d", OBConversion::GENOPTIONS); > > where the second parameter is an enum. I don't know how this is > translated with the scripting interfaces. > > There are three types of option INOPTIONS, OUTOPTIONS and GENOPTIONS. > On the babel command-line the INOPTIONS, OUTOPTIONS have a prefix, > e.g. -as and -xn respectively. > The default for this function is OUTOPTIONS, but -d needs GENOPTIONS. > Multi-character options are all GENOPTIONS. > > It's a bit confusing for the scripting interface user, and perhaps we > need something like AddGenOption("d") > > You could also use a direct function call of DeleteHydrogens(). > > Chris > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |