Sorry, this is less a message and more a piece of the manual.

On 09/08/2010 18:40, Noel O'Boyle wrote:
> On 9 August 2010 18:16, Stuart Armstrong<stuart.armstr...@inhibox.com>  wrote:
>> The pdbqt format (after a little bit of tidying up and testing) should be
>> ready to submit by the end of the week.
>> One last thing is lacking, though, and that's the ability to pass a
>> numerical value to the write options (the number of rotatable bonds); how is
>> this done? If n is the option, then would it be:
>> -xn 99
>> -xn"99"
>> -n 99
>> -n"99"
>> (I haven't had any luck with any of these, nor have I managed to recuperate
>> the numerical value using pConv->IsOption("n",OBConversion::OUTOPTIONS) ).

On the command line -xn99 -xn 99 -xn"99" should all work.
In the code:

   const char* txt = pConv->IsOption("n",OBConversion::OUTOPTIONS) );
   int rotbonds;
   if(txt) //-xn present
     rotbonds = atoi(txt);
   else //no option present
     whatever

> We are moving from 'babel' to 'obabel' over time. Babel doesn't
> support write option parameters; obabel does. Number 1 or number 2
> should work with obabel. (ccing to Chris in case I'm wrong!).

Not quite; with babel, if you want freedom to safely place the  option 
anywhere on the command line, rather than being forced to put it at 
the end, you need to register the number of parameters it will take. 
This has to be the same across all output formats, which is a bit of a 
problem with single-letter options because there are now so many 
formats (and options).

If you try to register "n" as an output option with one parameter by 
putting

   OBConversion::RegisterOptionParam
       ("n", this, 1, OBConversion::OUTOPTIONS);

in your format's constructor and then start babel, say

   babel -V

you will get:

  *** Open Babel Error  in OpenBabel::OBConversion::RegisterOptionParam
  The number of parameters needed by option "n" in pdbqt format
  differs from an earlier registration.

It would be safer to use a multi-character option, e.g. --rotbonds:

   OBConversion::RegisterOptionParam
       ("rotbonds", this, 1, OBConversion::GENOPTIONS);
and

   OBConversion::RegisterOptionParam
       ("rotbonds", this, 1, OBConversion::GENOPTIONS);

Note that multi-character options for the command line are all GENOPTIONS.

obabel is a newer interface very similar to babel, but you have to 
specify an outputfile with a -O option, e.g.

   obabel infile.mol --rotbonds 3 -O outfile.pdbqt

With it, options don't have to be registered, can come anywhere after 
the input file name, and can have default values (which might be 
different from the value if the option is not specified.

It is probably better at the moment for normal formats to be 
compatible with babel, since that is what most people are using.

The format's Description() function should return information on 
possible options. For the above case the returned text would include:

"Write Options, e.g. --rotbonds 3\n"
" rotbonds # specify the number of rotatable bonds\n"

This text is parsed to make checkboxes, etc., for the GUI, so sticking 
to a standard form is a good idea.


Chris


>> On 5 August 2010 11:21, Stuart Armstrong<stuart.armstr...@inhibox.com>
>> wrote:
>>>
>>> Yay! It all works now; many many thanks.
>>> The PDBQT format is not yet close to ready; it still needs to be
>>> programmed so that it can do the root-and-branch layout for molecules with
>>> many rotatable bonds, and needs to be tidied up to remove the remaining bits
>>> of the PDB format from it (I used that as a template). I'll try and send it
>>> in next week?
>>> All the best,
>>> Stuart
>>>
>>> On 4 August 2010 15:51, Geoffrey Hutchison<ge...@geoffhutchison.net>
>>> wrote:
>>>>
>>>>> You didn't say whether you are using the subversion trunk or not - it
>>>>> sounds like you aren't. See http://openbabel.org/wiki/CMake for
>>>>> information on checking and compiling the development code.
>>>>
>>>> Or if you think the PDBQT format is close to ready, you can also send it
>>>> to Noel or myself and we'll add it to the SVN trunk for testing.
>>>>
>>>> There is a snapshot of 2.3.0b2 available:
>>>>
>>>> https://sourceforge.net/projects/openbabel/files/openbabel-snapshots/2010-08-03/openbabel-2.3.0b2-20100803-r3942.tar.gz/download
>>>>
>>>> Hope that helps,
>>>> -Geoff
>>
>>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.851 / Virus Database: 271.1.1/3060 - Release Date: 08/09/10 
> 07:35:00
>


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to