User c23c5e9da4
15-04-2010 09:11:45
Is it possible to bring up the pKa plugin showing the macrospecies distribution graph through the api without the user having to go to the tools menu themselves?
User c23c5e9da4
15-04-2010 09:11:45
Is it possible to bring up the pKa plugin showing the macrospecies distribution graph through the api without the user having to go to the tools menu themselves?
ChemAxon e08c317633
16-04-2010 11:39:55
Yes, it is possible.
Code:
// import a molecule and clean it in 2D
// Note: clean is not required if the input mol has 2D coordinates
Molecule mol = MolImporter.importMol("OC(=O)C1CC=CN=C1");
mol.clean(2, null);
// instantiate plugin
pKaPlugin plugin = new pKaPlugin();
// set parameters
// set pH limits and step size for microspecies distribution calculation
plugin.setpHLower(0);
plugin.setpHUpper(14);
plugin.setpHStep(0.25);
// set molecule and run the calculation
plugin.setMolecule(mol);
plugin.run();
// instantiate plugin display, and display the results
CalculatorPluginDisplay display = new pKaPluginDisplay();
display.setPlugin(plugin);
display.store();
Component component = display.getResultComponent();
component.setVisible(true);
It will display the result panel of the pKa plugin (MarvinSketch: Tools>Protonation>pKa). The full source code is attached.
Note: pKaPluginDisplay class is not part of the publicĀ Marvin API (it is not listed in the javadoc), but it is public, and can be used.
Zsolt