cryos / avogadro

Avogadro 1 is not under active development, the repository was archived in September 2021. Development of Avogadro 2 is being done at https://github.com/openchemistry/avogadrolibs. Avogadro is an advanced molecular editor designed for cross-platform use in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas.
http://avogadro.cc/
GNU General Public License v2.0
334 stars 156 forks source link

Calling performAction from python terminal #867

Closed acaly closed 7 years ago

acaly commented 7 years ago

Hi,

I am new to Avogadro and python. I want to perform the "Auto Optimize" action from the python terminal but have not succeeded in this. The code I am using is similar to

import Avogadro
ext = Avogadro.PluginManager.instance.extension("ForceField")
act = ext.actions[0]
ext.performAction(act, Avogadro.GLWidget.current())

The program crashes when the performAction is executing. Could you please help me to point out where is the mistake?

Thanks in advance.

ghutchis commented 7 years ago

My guess is that you have a null pointer somewhere in there, e.g., the extension isn't returned properly.

At this point, the Python interface in Avogadro v1 is unmaintained. It was a great idea, but there are too many points that can break. We're working on a better Python interface and terminal for Avogadro v2.

acaly commented 7 years ago

Thank you!