The OBProcess class provides an interface to the obabel
executable, which is run in a separate process.
More...
#include <obprocess.h>
|
| OBProcess (QObject *parent_=0) |
|
QString | version () |
|
|
Operations that manipulate molecular representations.
|
bool | convert (const QByteArray &input, const QString &inFormat, const QString &outFormat, const QStringList &options=QStringList()) |
|
bool | convert (const QString &filename, const QString &inFormat, const QString &outFormat, const QStringList &options=QStringList()) |
|
void | convertFinished (const QByteArray &output) |
|
The obabel
executable used by this class can be overridden by setting the AVO_OBABEL_EXECUTABLE environment variable.
◆ version()
- Returns
- The output of obabel -V.
◆ obabelExecutable()
QString obabelExecutable |
( |
| ) |
const |
The obabel
executable used by the process.
◆ inUse()
- Returns
- True if the process is in use, false otherwise.
◆ abort
Abort any currently running processes.
This will cause aborted() to be emitted, but not any of the operation-specific "finished" signals.
◆ obError
Called when an error in the process occurs.
◆ aborted
Emitted when the abort() method has been called.
◆ queryReadFormats
bool queryReadFormats |
( |
| ) |
|
|
slot |
Request a list of all supported input formats from obabel.
After calling this method, the queryReadFormatsFinished signal will be emitted. This method executes
obabel -L formats read
and parses the output into a map (keys are format descriptions, values are format extensions).
If an error occurs, queryReadFormatsFinished will be emitted with an empty argument.
- Returns
- True if the process started successfully, false otherwise.
◆ queryWriteFormats
bool queryWriteFormats |
( |
| ) |
|
|
slot |
Request a list of all supported output formats from obabel.
After calling this method, the queryWriteFormatsFinished signal will be emitted. This method executes
obabel -L formats write
and parses the output into a map (keys are format descriptions, values are format extensions).
If an error occurs, queryWriteFormatsFinished will be emitted with an empty argument.
- Returns
- True if the process started successfully, false otherwise.
◆ queryReadFormatsFinished
void queryReadFormatsFinished |
( |
QMap< QString, QString > |
readFormats | ) |
|
|
signal |
Triggered when the process started by queryReadFormats() completes.
- Parameters
-
readFormats | The input file formats that OpenBabel understands. Keys are non-translated (english), human-readable descriptions of the formats, and the values are the corresponding file extensions. |
- Note
- readFormats will usually contain more than one extensions per format, so accessing the values with QMap::values() (instead of QMap::value()) is required.
If an error occurs, readFormats will be empty.
◆ queryWriteFormatsFinished
void queryWriteFormatsFinished |
( |
QMap< QString, QString > |
writeFormats | ) |
|
|
signal |
Triggered when the process started by queryWriteFormats() completes.
- Parameters
-
writeFormats | The file formats that OpenBabel can write. Keys are non-translated (english), human-readable descriptions of the formats, and the values are the corresponding file extensions. |
- Note
- writeFormats will usually contain more than one extensions per format, so accessing the values with QMap::values() (instead of QMap::value()) is required.
If an error occurs, writeFormats will be empty.
◆ convert [1/2]
bool convert |
( |
const QByteArray & |
input, |
|
|
const QString & |
inFormat, |
|
|
const QString & |
outFormat, |
|
|
const QStringList & |
options = QStringList() |
|
) |
| |
|
slot |
Convert the text representation in input from inFormat to outFormat.
- Parameters
-
input | Text representation of molecule in inFormat format. |
inFormat | File extension corresponding to input format (see obabel -L formats ). |
outFormat | File extension corresponding to output format. |
options | Additional options passed to obabel. |
After calling this method, the convertFinished signal will be emitted to indicate return status along with the requested representation of the molecule.
The conversion is performed as: obabel -i<inFormat> -o<outFormat> <options> < input > output
- Returns
- True if the process started succesfully, false otherwise.
◆ convert [2/2]
bool convert |
( |
const QString & |
filename, |
|
|
const QString & |
inFormat, |
|
|
const QString & |
outFormat, |
|
|
const QStringList & |
options = QStringList() |
|
) |
| |
|
slot |
Convert the file filename from inFormat to outFormat.
- Parameters
-
filename | File containing molecule representation in inFormat format. |
inFormat | File extension corresponding to input format (see obabel -L formats ). |
outFormat | File extension corresponding to output format. |
options | Additional options passed to obabel. |
After calling this method, the convertFinished signal will be emitted to indicate return status along with the requested representation of the molecule.
The conversion is performed as: obabel -i<inFormat> <filename> -o<outFormat> <options> > output
- Returns
- True if the process started succesfully, false otherwise.
◆ convertFinished
void convertFinished |
( |
const QByteArray & |
output | ) |
|
|
signal |
Emitted after a call to convert() finishes.
- Parameters
-
output | The molecule in CML format, or an empty QByteArray if an e error occurred. |
◆ queryForceFields
bool queryForceFields |
( |
| ) |
|
|
slot |
Request a list of all supported force fields from obabel.
After calling this method, the queryForceFieldsFinished signal will be emitted. This method executes
obabel -L forcefields
and parses the output.
If an error occurs, queryReadFormatsFinished will be emitted with an empty argument.
- Returns
- True if the process started successfully, false otherwise.
◆ queryForceFieldsFinished
void queryForceFieldsFinished |
( |
const QMap< QString, QString > & |
forceFields | ) |
|
|
signal |
Triggered when the process started by queryForceFields() completes.
- Parameters
-
forceFields | The force fields supported by OpenBabel. Keys are unique identifiers for the force fields, and the values are non-translated (english), human-readable descriptions. |
If an error occurs, forceFields will be empty.
◆ optimizeGeometry
bool optimizeGeometry |
( |
const QByteArray & |
cml, |
|
|
const QStringList & |
options |
|
) |
| |
|
slot |
Request that obabel optimize a molecular structure using its minimize operation.
- Parameters
-
cml | A Chemical Markup Language representation of the molecule. |
options | Options for the optimization. See OBForceFieldDialog::prompt for an easy method way to get the options from the user. |
After calling this method, the optimizeGeometryStatusUpdate signal will be emitted periodically to indicate the optimization's progress. Once the optimization finishes, optimizeGeometryFinished will be emitted with the result of the optimization.
The optimization is started with obabel -icml -ocml --minimize <options>
The standard output is recorded and returned by optimizeGeometryFinished. If options contains --log
, the obabel process's standard error stream is monitored for the data used in the optimizeGeometryStatusUpdate progress updates.
- Returns
- True if the process started successfully, false otherwise.
◆ optimizeGeometryFinished
void optimizeGeometryFinished |
( |
const QByteArray & |
cml | ) |
|
|
signal |
Emitted with the standard output of the process when it finishes. If an error occurs, the argument will not be valid CML.
◆ optimizeGeometryStatusUpdate
void optimizeGeometryStatusUpdate |
( |
int |
step, |
|
|
int |
maxSteps, |
|
|
double |
currentEnergy, |
|
|
double |
lastEnergy |
|
) |
| |
|
signal |
Emitted every 10 steps of the optimization to indicate the current progress.
- Parameters
-
step | The current step of the minimization algorithm. |
maxSteps | The maximum number of steps before the minimization is aborted. |
currentEnergy | The energy of the molecule at the current step. |
lastEnergy | The energy of the molecule at the previous minimization step. |
The documentation for this class was generated from the following file: