pymolpro (version 1.15.5)

pymolpro is a Python library that provides support for working with the Molpro quantum chemistry package.

The principal feature is the Project() class that provides access to a complete Molpro job, including input and output files together with metadata such as job status information. The project is stored as a bundle implemented as a directory in the file system. The class is a Python binding of the sjef library with additional Molpro-specific customisation, and the project bundle can be accessed also through a command-line interface and the gmolpro graphical user interface.

For technical reasons, Project() invokes the submodular class pymolpro.project.Project(). Normally all that is required to instantiate a class, on either a new or existing bundle, is to pass a single argument which is the path of the bundle, with or without the compulsory suffix .molpro. Simply running Molpro and inspecting the output can be achieved as:

from pymolpro import Project
p=Project("Neon")
p.write_input("""
geometry={Ne}
rhf
ccsd(t)
""")
p.run()
print(p.out)

Normally, pymolpro.project.Project.run() launches the job in the background, potentially on a remote machine via a suitably configured backend, and its status is available through the pymolpro.project.Project.status attribute. Additionally, the job launching request is ignored if the project has already run the job successfully using the same input; this introduces the convenience of being able to re-run an entire workflow, for example in a Jupyter notebook, without needless recomputation.

Molpro produces an xml file that contains all the essential results, marked up using the molpro-output schema. The pymolpro Project class contains functions that interpret that output, and at the lowest level this can be achieved through a suitable XPath search. For extracting calculated properties, including energies, convenience functions pymolpro.project.Project.properties(), pymolpro.project.Project.energies(), that wrap suitable XPath searches, are provided. These functions can return either a Python dictionary containing all information about the property, or just its value. The following is a simple example where a job is created, run and analysed.:

from pymolpro import Project
p = Project("Neon")
p.write_input("geometry={Ne}; rhf; ccsd(t)")
p.run(wait=True)
assert p.status == 'completed' and not p.errors()
energies = {}
for node in p.xpath("//property[@name='Energy' or @name='total energy']"):
  energies[node.xpath("@method")[0]] = float(node.xpath("@value")[0])
energy_values = p.energies()
all_principal_properties_dict = p.properties(principal=True, dict=True)
final_energy = p.energy(method='CCSD(T)')

Installation

pymolpro is on conda forge and can be installed on most systems using conda install -c conda-forge pymolpro. On Microsoft Windows, you need to also install msys2, and then, in an msys command window, pacman -S rsync openssh.

For a complete set-up of pymolpro within Jupyter notebooks driven from the comand line on linux or macOS,

  • Install Molpro

  • Install Miniconda. On macOS with homebrew, this can be done with brew install miniconda. You may need to then type conda init and restart the shell.

  • Create a conda environment to contain at least these packages; of course you can add any others you need, e.g. matplotlib: conda create -n pymolpro-jupyter -c conda-forge pymolpro jupyter nb_conda_kernels.

  • If you intend to run Molpro jobs on a remote machine, set up password-free ssh access to it, using the following or otherwise: ssh-keygen; ssh-copy-id user@host. Then edit the file ~/.sjef/molpro/backends.xml to specify the backend.

  • Activate the environment: conda activate pymolpro-jupyter. To create a new notebook, jupyter notebook; to open an existing notebook jupyter notebook existing_file.ipynb

For a complete set-up of pymolpro within Jupyter notebooks on Windows,

  • Install Molpro, and msys2 as described above.

  • Install Anaconda3

  • Open Anaconda Navigator

  • Select the Environments tab and press the Create button. Give your new conda environment a name, e.g. pymolpro-jupyter.

  • With the Channels button, add the conda-forge channel, and then select Not installed and search for, and install pymolpro, jupyter, nb_conda_kernels, as well as any other packages you might want, such as matplotlib.

  • If you intend to run Molpro jobs on a remote machine, from the command menu run MSYS2, and (a) create a password-free ssh key by running ssh-keygen; (b) authorize that key for login on the desired remote machine: ssh-copy-id user@host; (c) edit the file .sjef\molpro\backends.xml (relative to your Windows home directory) to specify the backend.

  • Select the Home tab and run the Jupyter Notebook application, ensuring that the selected environment is pymolpro-jupyter.

Contents:

JSON schema for simplified Molpro input

https://www.molpro.net/molpro-input.json

Structured input for Molpro that covers the case of a single ansatz, with a given basis set at a given geometry. All fields are optional, with reasonable defaults, although at least geometry, method and basis will normally be specified

type

object

properties

  • geometry

The geometry, in any form that Molpro will accept. If the value is the name of a readable file, that file will be the source of the geometry specification; otherwise, the value will be interpreted directly, with or without enclosing {}.

type

string

default

He

  • job_type

The job type - single point, optimisation, frequencies etc.

default

SP

anyOf

Single point

Calculate at a single geometry

default

const

SP

Geometry optimisation

Optimise the geometry

const

OPT

Hessian

Calculate harmonic force constants and normal modes

const

FREQ

Optimise + vib frequencies

Optimise the geometry and then calculate normal modes

const

OPT+FREQ

Non-covalent complex

const

INTERACT

  • method

default

hf

oneOf

type

string

type

array

items

type

string

  • hamiltonian

The Hamiltonian to be used - Schrödinger all-electron, pseudopotential or scalar-relativistic.

enum

AE, PP, DK, DK3

default

PP

  • basis

Specification of the orbital basis set

type

object

properties

  • default

type

string

default

cc-pVTZ-PP

  • elements

type

object

additionalProperties

type

string

additionalProperties

False

  • core_correlation

Specification of core correlation

type

string

  • properties

type

array

items

type

string

uniqueItems

True

  • orbitals

Types of localised orbitals to be calculated.

type

array

items

enum

ibo, pipek, nbo, boys

uniqueItems

True

  • variables

Variables to be defined at the start of the job

type

object

  • parameter

Items for gparam in Molpro input

type

object

  • threshold

Items for gthresh in Molpro input

type

object

  • print

Items for gprint in Molpro input

type

object

  • job_type_commands

Commands for the job_type drivers

type

object

  • angstrom

Whether geometry is expressed in Ångstrom instead of Bohr.

type

boolean

  • orientation

Weighting of geometry to define centroid and principal axes.

enum

mass, charge, none

default

mass

  • symmetry

Whether to use molecular symmetry.

enum

automatic, none

default

automatic

  • density_fitting

Whether density fitting algorithms are to be used where possible.

type

boolean

default

False

  • prologue

Arbitrary Molpro commands to appear at the start of the job

oneOf

type

string

type

array

items

type

string

  • epilogue

Arbitrary Molpro commands to appear at the end of the job

oneOf

type

string

type

array

items

type

string

additionalProperties

False

Indices and tables