Awesome. Thanks Chris. Returning false from my existing code seems to
do the job - I didn't realise the purpose of the return value. It does
have the side-effect of saying "0 molecules converted" but I guess
that's not too bad - I'm not actually strictly converting molecules
here in any case.

Just for the record, I have added the conformers to the original
molecule, and am outputing via:

    for (; c < mol.NumConformers(); ++c) {
      mol.SetConformer(c);
      if(!pConv->GetOutFormat()->WriteMolecule(&mol, pConv))
        break;
    }

    return false; // Suppress output through normal route

- Noel

On 27 April 2013 15:12, Chris Morley <c.mor...@gaseq.co.uk> wrote:
> On 27/04/2013 13:58, Noel O'Boyle wrote:
>>
>> I'm trying to turn the confab executable into an op as I would prefer
>> not to maintain the executable.
>>
>> Essentially, the op generates conformers for each input molecule, and
>> then it writes them to the output stream.
>>
>> The only problem is that OBConversion then calls the normal output
>> writer and writes the original input to the output. Is there any way
>> around this? Ideally, I'd like to completely skip the output writer.
>>
>> Please find attached my code (which relies on additional API functions
>> to actually generate the conformers).
>
>
>>Or maybe I'm trying to fit a square peg into a round hole, and I
>>should just go with my existing (and working) executable...
>
> I think this well worth doing. There have been issues with multiple molecule
> outputs from ops previously, but I can't remember the details, so the
> following may not work.
>
> Approach 1
> Suppress the output of the original molecules by returning false from Do().
> Output a newly generated conformer molecule with pConv->AddChemObject(pmol).
>
> Approach 2
> Add the conformers to the original molecule, output normally with the
> existing option writeconformers. (That this option is not an op bodes ill.)
>
> I'll try to write a mock-up of a model op with multiple outputs to remind
> myself of the issues, but which could be generally useful if they are
> resolved.
>
> Chris
>
>
>

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to