How can I call the "optimize geometry" method?

Hi,

I would use the method to optimize a geometry (ForceFieldCommand class).
But it is a part of an extension with many dependencies and without
accessibility. Is there a way to use it easily ?

Regards,
Mickaël Gadroy
WebRep
Overall rating

Hi Mickaël,

I’ve needed to do this myself at some point, but I ended up using the
OpenBabel forcefield code directly (this is actually how the
ForceField extension works). AFAIK, there is no way to access an
extension’s members from within another extension.

See http://openbabel.org/dev-api/classOpenBabel_1_1OBForceField.shtml
for more, here’s one of the examples for a geo opt with conjugate
gradients and MMFF94:

  #include <openbabel/forcefield.h>
  #include <openbabel/mol.h>

  ......

  OBMol mol;
  OBForceField* pFF = OBForceField::FindForceField("MMFF94");
  // Make sure we have a valid pointer
  if (!pFF)
  // exit...
  pFF->SetLogFile(&cerr);
  pFF->SetLogLevel(OBFF_LOGLVL_LOW);
  if (!pFF->Setup(mol)) {
  cerr << "ERROR: could not setup force field." << endl;
  }
  // Perform the actual minimization, maximum 1000 steps
  pFF->ConjugateGradients(1000);
  ......

(The OBMol object can be obtained from your avogadro molecule via
Avogadro::Molecule::OBMol(), then just copy coordinates back or use
setOBMol())

Hope this helps,
Dave

On Mon, Jun 6, 2011 at 4:40 AM, Mickaël Gadroy mickael.gadroy@gmail.com wrote:

Hi,

I would use the method to optimize a geometry (ForceFieldCommand class). But it is a part of an extension with many dependencies and without accessibility. Is there a way to use it easily ?

Regards,
Mickaël Gadroy
WebRep
Overall rating


Simplify data backup and recovery for your virtual environment with vRanger.
Installation’s a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering’s about.
Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options

On Mon, Jun 6, 2011 at 10:17 AM, David Lonie loniedavid@gmail.com wrote:

Hi Mickaël,

I’ve needed to do this myself at some point, but I ended up using the
OpenBabel forcefield code directly (this is actually how the
ForceField extension works). AFAIK, there is no way to access an
extension’s members from within another extension.

See http://openbabel.org/dev-api/classOpenBabel_1_1OBForceField.shtml
for more, here’s one of the examples for a geo opt with conjugate
gradients and MMFF94:

Also, if you need a progress indication, the optimization can be
performed stepwise. Dig around in the forcefield extension’s sources
to see how this works.

Dave

Thanks you very much!

Best Regards
Mickaël Gadroy

2011/6/6 David Lonie loniedavid@gmail.com

On Mon, Jun 6, 2011 at 10:17 AM, David Lonie loniedavid@gmail.com wrote:

Hi Mickaël,

I’ve needed to do this myself at some point, but I ended up using the
OpenBabel forcefield code directly (this is actually how the
ForceField extension works). AFAIK, there is no way to access an
extension’s members from within another extension.

See http://openbabel.org/dev-api/classOpenBabel_1_1OBForceField.shtml
for more, here’s one of the examples for a geo opt with conjugate
gradients and MMFF94:

Also, if you need a progress indication, the optimization can be
performed stepwise. Dig around in the forcefield extension’s sources
to see how this works.

Dave

WebRep
Overall rating

On Mon, Jun 6, 2011 at 11:32 AM, Mickaël Gadroy
mickael.gadroy@gmail.com wrote:

Thanks you very much!

No problem :slight_smile: If you run into any problems, let us (or the
openbabel-devel list) know.

Dave