Re: [OpenBabel-Devel] Segfault when deleting OBForceField

2010-10-13 Thread David Lonie
On Wed, Oct 13, 2010 at 11:47 AM, Geoffrey Hutchison
 wrote:
>> I'm getting a segfault on MSVC when I delete a pointer to an
>> OBForceField (or indeed an OBOp). But this should work okay right?
>
> No. These are static unique objects. We don't delete formats or other plugins 
> either.
>
>> The reason I'm doing this is that I want to create a new pff that is
>> wiped clean of previous calculations.
>
> This should happen as soon as you call setup on a new molecule.

Alternatively, you can call MakeNewInstance if you'd like to have a
new FF for each use, e.g.

OBForceField *pff =OBForceField::FindForceField("MMFF94");
becomes
OBForceField *pff =OBForceField::FindForceField("MMFF94")->MakeNewInstance();

Dave

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel


Re: [OpenBabel-Devel] Segfault when deleting OBForceField

2010-10-13 Thread Geoffrey Hutchison
> I'm getting a segfault on MSVC when I delete a pointer to an
> OBForceField (or indeed an OBOp). But this should work okay right?

No. These are static unique objects. We don't delete formats or other plugins 
either.

> The reason I'm doing this is that I want to create a new pff that is
> wiped clean of previous calculations.

This should happen as soon as you call setup on a new molecule.

-Geoff
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel


[OpenBabel-Devel] Segfault when deleting OBForceField

2010-10-13 Thread Noel O'Boyle
Hi all,

I'm getting a segfault on MSVC when I delete a pointer to an
OBForceField (or indeed an OBOp). But this should work okay right?

  // Define location of file formats for testing
OBConversion conv;

OBForceField *pff = OBForceField::FindForceField("MMFF94");
if (pff == NULL) {
  cout << "Bail out!\n";
  return -1;
}
delete pff;

The reason I'm doing this is that I want to create a new pff that is
wiped clean of previous calculations. Maybe I should try to write a
Reset method that does this somehow.

- Noel

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel