Overview
A Python interface has been written allowing computational jobs to be submitted to Python and results obtained from WebMO. In addition to the command line, WebMO supports JupyterLab as a convenient web-based Python programming environment. Consult these two help pages for additional details.
The webmo Python library contains four modules:
- WebMOREST
- util
- gui
- spectrum
This help page provides an overview of the methods and function in these modules. For additional details, one can refer to the build-in documentation. For example,
#webmohelp.py
from webmo import WebMOREST
#list namespace of the module
print(dir(WebMOREST))
#output detailed documentation for the entire module
help(WebMOREST)
#or for a specific function
help(WebMOREST.get_job_geometry)
and similarly for the util
, gui
, and spectrum
modules.
The JupyterLab help page contains example Jupyter notebooks that illustrate the use of the library functions.
WebMOREST
Function | Description |
---|---|
WebMOREST(base_url, username, password='', expiration=24) | Initializes a WebMOREST object and also generates and stores a newly session token |
delete_job(job_number) | Permanently deletes a WebMO job |
generate_input(template,variables,auto_defaults=True) | Generates an input file by populating the specified job template with the provided variables |
get_engines(target_user='') | Fetches a list of computational engines available to the current user or specified target user |
get_folders(target_user='') | Fetches a list of folders owned by the current user or the specified target user |
get_group_info(groupname) | Returns information about the specified group |
get_groups() | Fetches a list of available WebMO groups |
get_job_archive(job_number) | Returns a WebMO archive from the specified job |
get_job_geometry(job_number) | Returns the final optimized geometry from the specified job |
get_job_info(job_number) | Returns information about the specified job |
get_job_output(job_number) | Returns the raw text output from the specified job |
get_job_results(job_number) | Returns detailed results of the calculation (e.g. energy, properties) from the specified job |
get_job_spreadsheet(job_numbers) | Generates and returns a CSV-formatted spreadsheet summary of the specified job(s) |
get_jobs(engine='', status='', folder_id='', job_name='', target_user='') | Fetches a list of jobs satisfying the specified filter criteria |
get_status_info() | Returns information about the specified WebMO instance |
get_templates(engine) | Fetches a list of job templates associated with the specified computational engine |
get_user_info(username) | Returns information about the specified user |
get_users() | Fetches a list of available WebMO users |
import_job(job_name, output_filename, engine) | Imports an existing output file into WebMO |
submit_job(job_name, input_contents, engine, queue=None) | Submits and executes a new WebMO job |
wait_for_job(job_number, poll_frequency=5) | Waits for completion of the specified WebMO jobs |
In addition the following IPython function is available within Jupyter Notebooks:
Function | Description |
---|---|
async display_job_property(job_number, property_name, property_index=1, peak_width=0.0, tms_shift=0.0, proton_coupling=0.0, nmr_field=400.0, x_range=None, y_range=None, width=400, height=400, background_color=(255, 255, 255), transparent_background=False, rotate=(0.0, 0.0, 0.0)) | Uses Javascript and IPython to display an image of the specified molecule and property, calculated from a previous WebMO job |
util
Function | Description |
---|---|
get_bond_angle(results, index1, index2, index3) | Returns the specified bond angle between three atoms from the job results |
get_bond_length(results, index1, index2) | Returns the specified bond length between two atoms from the job results |
get_dihedral_angle(results, index1, index2, index3, index4) | Returns the specified dihedral angle between four atoms from the job results |
get_dipole_moment(results) | Returns the dipole moment from the job results |
get_energies(results, include_units=False) | Returns a dictionary of available energies from the job results |
get_energy(results, include_units=False) | Returns the molecular energy (ground state at the requested level of theory) from the job results |
get_geometry(results) | Returns the XYZ-formatted final geometry from the job results |
get_property(results, property_name) | Returns an arbitrary calculated property from the job results; Hint: print(results) to see available properties |
get_stoichiometry(results) | Returns the stoichiometry from the job results |
xyz_from_name(name) | Obtains an XYZ-formatted geometry for the molecule name via PubChem lookup |
gui
Function | Description |
---|---|
ConsoleGUI(template, query_vars, additional_vars=None) | Initializes a text-based interface for setting up WebMO jobs |
JupyterGUI(template, query_vars, additional_vars=None) | Initializes a menu-driven Jupyter GUI interface for setting up WebMO jobs |
display() | Presents the menu to the user |
get_variables() | Returns a populated variables dictionary |
spectrum
Function | Description |
---|---|
construct_spectrum(points, intensities, lineshape='gauss', frac_loren=0.5, width=10, start=0, stop=4000, step=1) | Construct an entire spectrum from peak frequencies and intensities, returned as x-axis and y-axis numpy arrays |
Use the "help" function as illustrated above for argument data types and returned data type. The help function will also include any recent changes made to the library.
The source code for the webmo Python library is available on github.