pymolpro package
Module contents
- class pymolpro.Orbital(node)
Bases:
object
Container for an orbital (usually molecular).
- property ID
- attribute(key)
- property axes
The coordinate system for the orbital. The \(z\) axis is the normalised vector \(\vec e_{z}\) that is the eigenvector of the second-moment tensor of largest eigenvalue, similarly for \(\vec e_y, \vec e_x\). The phase of each axis is chosen such that the largest of the coefficients specifying the axis in the global coordinate system is positive.
- Returns:
The axes, with the first index labelling the component in the base coordinate system, and the second index specifying which orbital axis.
- Return type:
np.array(3,3)
- centroid
Centroid of the orbital
- evaluate(points, values=False)
Evaluate orbital on a grid of points
- Parameters:
points – List of geometries specified as 3-list of values in bohr
values
- Returns:
array of dictionaries giving the occupation and values on the grid, or if ID is specified, a single dictionary, or if values==True, a numpy array
- grid(npt, method='erfinv', scale=1.0, grid_parameters=[], spherical_average=False)
Generate a grid centred on the orbital.
- Parameters:
npt – Number of desired points in each coordinate.
method – Algorithm for grid generation.
scale – Scale the grid by this factor.
- Returns:
points and weights (numpy array [npt,4])
- property kinetic_energy
Kinetic energy expectation value for the orbital.
- property local_second_moments
- occupation
Occupation of the orbital
- second_moment_eigenvalues
Eigenvalues of the orbital second-moment tensor (origin at centre of charge) in ascending order
- class pymolpro.Pair(node)
Bases:
Tuple
Container for a pair of orbitals
- property axes
The coordinate system for the pair of orbitals. The \(z\) axis is the vector \(\vec e_{z,10}=(\vec r_1-\vec r_0)/|\vec r_1-\vec r_0|\) from orbital 0 to orbital 1. The \(x\) axis is the along the vector \(\vec e_{x,10} = \vec e_{z,10} \times \vec e_z\) (or \(\vec e_y\) if necessary), normalised. Then \(\vec e_{y,10}=\vec e_{z,10}\times\vec e_{x,10}\). If \(|\vec r_1-\vec r_0|\) is small, the global coordinate axes are adopted.
- Returns:
The axes, with the first index labelling the component in the base coordinate system, and the second index specifying which pair axis.
- Return type:
np.array(3,3)
- property local_orbital_axes
The coordinate axes of the orbitals expressed in the basis of the pair coordinate system.
- Returns:
- Return type:
list(np.array(3,3))
- pymolpro.Project(name='', suffix=None, **kwargs)
This is a project factory. Based on filename suffix it decides which Project to create.
Extensions of pysjef which define a new project should add theirs to the
PROJECT_FACTORY
. The key is the suffix specifying the backend.Project(‘a’) # creates
a.sjef
Project(‘a.molpro’) # createsa.molpro
and sets suffix to.molpro
Project(‘a.sjef`, suffix=’molpro’) # createsa.sjef.molpro
and sets suffix to.molpro
- Parameters:
name – name of the file
suffix – suffix indicating which program to use
- Returns:
- class pymolpro.Tuple(node)
Bases:
object
Container for a tuple of orbitals
- Parameters:
node (lxml.etree.Element) – Node holding a correlation single or pair descriptor
- energy
Correlation energy contribution from a Single or Pair
- orbitals
Orbital objects forming the tuple
- spins
1(alpha) or -1(beta) for each orbital
- pymolpro.element_to_dict(node, attributes=True)
Convert an lxml.etree node tree into a dict.
- Parameters:
node (lxml.etree.ElementTree) – A node in an lxml tree
attributes (bool, optional) – whether to include attributes in the result
- Returns:
A dictionary representing the tree
- Return type:
dict
- pymolpro.no_errors(projects, ignore_warning=True)
Checks that none of the projects have any errors. Projects can by running.
- Parameters:
projects – list of projects to check for errors
ignore_warning – Whether to count warnings as well as errors.
- Returns:
True/False whether any projects have errors
- pymolpro.xyz_to_zmat(xyz: str, algorithm='chemcoord')
Converts from xyz to z-matrix coordinates.
- Parameters:
xyz – xyz-file
algorithm – algorithm to choose, default is the chemcoord algorithm
- Returns:
The Z matrix as a string, or None in case of unknown algorithm,
- Return type:
str
Submodules
pymolpro.project module
- class pymolpro.project.Project(name=None, geometry=None, method='hf', basis='cc-pVTZ', func='energy', extrapolate='', symm=True, ansatz=None, geometry_method=None, geometry_basis=None, preamble=None, postamble=None, initial=None, charge=None, spin=None, **kwargs)
Bases:
Project
A
Project
holds all the data associated with a single Molpro job. This includes input, output, any auxiliary files, and information about the state of the job.Project
acts as a reference to a sjef Project with some added functionality. All of the data is stored in the project bundle on the file system, with the consequence that it is safe to construct and recreate multipleProject
objects all mapping the same underlying project.The underlying functionality of sjef includes job submission and monitoring on local or remote machines, and structured searching of Molpro’s xml output stream. This class provides additional convenience operations:
Preparation of simple Molpro input from provided geometry, method, basis set and other options.
Molpro-specific error checking.
Computed properties, energies and geometries.
Computed orbitals, including their evaluation on a grid.
Values of Molpro variables.
- Parameters:
name (str) – The base filename of the filesystem bundle carrying the project. If the bundle does not yet exist, it is created.
geometry (str) – The geometry. If specified, the input for the job will be constructed, without the need for a subsequent call to
write_input()
. Any format recognised by Molpro can be used. This includes xyz, with or without the two header lines, or Z matrix, and lines can be separated either with newline or ;. The geometry can be specified either as a string, or a filename or url reference, in which case the contents of the reference are resolved now.method (str) – The computational method for constructed input. Anything accepted as Molpro input, including parameters and directives, can be given. If the method needs a preceding Hartree-Fock calculation, this is prepended automatically.
basis (str) – The orbital basis set for constructed input. Anything that can appear after basis= in Molpro input is accepted.
ansatz (str) – String of the form method/basis//geometry_method/geometry_basis or method/basis which is parsed to give the same effect as the
method and basis parameters. If geometry_method/geometry_basis is specified, the calculation will be preceded by a geometry optimisation at that level of theory. :param str func: This should be one of
energy for a single geometry
opt for a geometry optimisation
- Parameters:
extrapolate (str) – If specified, carry out basis-set extrapolation. Anything that can appear after extrapolate,basis= in Molpro input is accepted.
spin (int) – The spin multiplicity minus one
charge (int) – Electrical charge of molecule
- backend_get(backend, key)
Obtain the value of a field in the backend :param backend: :param key: :return:
- backend_names()
Get the names of all the backend objects associated with the object.
- backend_parameter_default(backend, param)
Returns default value for backend parameter
- Parameters:
backend – name of the backend
param – name of parameter
- backend_parameter_delete(backend, param)
Delete backend parameter from property file.
- Parameters:
backend – name of the backend
param – name of parameter
- backend_parameter_documentation(backend, param)
Returns documentation for backend parameter
- Parameters:
backend – name of the backend
param – name of parameter
- backend_parameter_get(backend, param)
Gets backend parameter from property file.
- Parameters:
backend – name of the backend
param – name of parameter
- backend_parameter_set(backend, param, value)
Sets backend parameter in property file. The parameter will be used by the backend when interacting with the current jobs.
- Parameters:
backend – name of the backend
param – name of parameter
value – parameter value to set
- backend_parameters(backend, doc=False)
Get all of the parameters referenced in the run_command of a backend
- Parameters:
backend – The name of the backend
doc – Whether to return documentation instead of default values
- Returns:
A dictionary where the keys are the parameter names, and the values the defaults.
- basis_registry()
Get the basis registry from the Molpro pointed to in the local backend
- Returns:
- Return type:
dict
- builtins = <module 'builtins' (built-in)>
- child(*attributes, nodename='', **kwargs_and_callables)
Utility wrapper over select routine to do a 1 level search of children and select a single one. If more than one child is selected, RuntimeError is thrown.
Arguments are translated into selectors by attribute name ( see select). Key word arguements are translated into selectors by attribute name ( see select).
Example:
- out = p.select(‘container[location, name=directory, exists(location)]’,
exists=os.path.exists)
is equivalent to
- out = p.child(‘location’, nodename=’container’, name=’directory’, ‘exists(location)’,
exists=os.path.exists)
- Parameters:
nodename – selector for name of the node class
attributes – list of attributes for defining selectors by name, [attribute] and callable selectors [func(attr1, attr2)] ( see select)
kwargs_and_callables – dictionary of other kwargs defining attribute selectors key = value and callable functions for callable selectors func = function_name
- Returns:
- clean(keep_run_directories=1)
Remove run directories from the project
- commandify_method(method)
- completed()
- Returns:
True if status is completed
- copy(name, location=None, force=False, keep_hash=False, keep_run_directories=1000000)
Make a copy of the project and its directory to a new path.
- Parameters:
name – name of the new project
location – path to the parent of the project, by default parent directory stays the same
force – whether to first remove anything already existing at the new location
keep_hash – whether to clone the project_hash, or allow a fresh one to be generated
keep_run_directories – how many run directories to retain in the copy
- Returns:
copied project
- copy_node()
Returns a copy of itself
- energies(*args, **kwargs)
Wrapper for
properties()
that restricts to energy values- Parameters:
args
kwargs
- Returns:
- energy(*args, **kwargs)
Wrapper for
energies()
that returns a single value as a scalar. An exception is thrown if more than one value is found.- Parameters:
args
kwargs
- Returns:
- erase(path=None)
Delete the project under path with its directory and all files.
- Parameters:
path – path to the project, defaults to current project
- Todo:
what should happend to attributes and children?
- errors(ignore_warning=True)
Return all error nodes
- Returns:
list of error nodes
- Return type:
lxml.etree
- evaluateOrbitals(points, instance=-1, minocc=1e-10, ID=None, values=False)
Evaluate molecular orbitals on a grid of points
- Parameters:
points – List of geometries specified as 3-list of values in bohr, or numpy [:,3] array
instance – Which set of orbitals
minocc – Only orbitals with at least this occupation will be returned
ID – Only the orbital whose ID attribute matches this will be selected
values
- Returns:
array of dictionaries giving the occupation and values on the grid, or if ID is specified, a single dictionary, or if values==True, a numpy array
- export_file(filename, location, overwrite)
Export one or more files from the project.
- Parameters:
filename – name of the file in the project
location – The relative or absolute path to the destination directory
overwrite – Whether to overwrite an existing file.
- filename(suffix='', name='', run=0)
Get the file name of the bundle, or a primary file of particular type, or a general file in the bundle
- Parameters:
suffix – If present without
name
, look for a primary file with that type. If absent, the file name of the bundle is instead selectedname – If present, look for a file of this name, appended with
.suffix
if that is non-blankrun –
0: the currently focussed run directory
other: the specified run directory
- Returns:
the fully-qualified name of the file
- findall(search_pattern)
- geometries(preamble='//')
Obtain all geometries from the job output
- Parameters:
preamble – Prepend this to the xpath search expression to locate the geometry
- Returns:
list of dictionaries holding the geometry. Coordinates are in bohr
- geometry(preamble='//', instance=-1)
Obtain the geometry from the job output
- Parameters:
preamble – Prepend this to the xpath search expression to locate the geometry
instance – In the case of multiple geometries in the output stream, which occurence
- Returns:
dictionary holding the geometry. Coordinates are in bohr
- gradient(instance=-1)
- import_file(location, overwrite=True)
Import file at path
location
into the project.- Parameters:
location – path to file
overwrite – if corresponding file already exists in the project, flags that it should be overwritten
- import_input(fpath)
Copy file into the project as input file, or write string to input file :param fpath: path to input file
- property input_file_path
- input_from_output(instance=-1)
Return a list of all defined input in the output stream
- Parameters:
instance – index of occurence of input node in output
- Returns:
- kill()
Kill the job started by
run()
- list_files()
Return a list of files in the project directory
- property local_molpro_root
Get the directory of the Molpro installation in the local backend :return: directory :rtype: pathlib.Path
- property location
Local path to the project directory
- move(name=None, location=None, force=False)
Move the project bundle to a new location
- Parameters:
name – new name of the project
location – path to the directory where project should be moved. Defaults to same directory as current project.
force – whether to first remove anything already existing at the new location
- property name
Name of the project
- orbitals(instance=-1, minocc=1.0, ID=None)
Obtain some or all of the orbitals in the job output
- Parameters:
instance – Which set of orbitals
minocc – Only orbitals with at least this occupation will be returned
ID – Only the orbital whose ID attribute matches this will be selected
- Returns:
a list of Orbital objects
- property out
- property output
- Returns:
node with Molpro’s output
- property output_file_path
- pairs(instance=-1)
Obtain some or all of the correlation pairs in the job output
- Parameters:
instance – Which set of pairs
- Returns:
a list of Pair objects
- parse(force=False, **options)
Parse the output file and save resultant node as a child :param force: reparse the output
- parse_ansatz(ansatz)
- procedures_registry()
Get the procedures registry from the Molpro pointed to in the local backend
- Returns:
- Return type:
dict
- properties(*args, **kwargs)
Obtain selected properties from the job output
- Parameters:
args – any trailing XPath qualifier, for example
'[@StateSymmetry = "1" or @StateSymmetry = "4"]'
. For restrictions that should be combined withand
, it’s simpler to instead use a kwarg argument, egStateSymmetry=1
kwargs – any attribute selectors for the select function, including the following
name – name of property
principal – restrict to principal property
preamble – XPath expression to prepend the search for the property node
command – restrict to properties contained in a jobstep with this command
dict – return property value, scalar float or list of floats as appropriate, if
False
or omitted. Otherwise, a dictionary containing all the data in the property node is returned
- Returns:
list of properties
- properties_old(name='Energy', principal=True, *, value=False, **kwargs)
Obtain selected properties from the job output
- Parameters:
name – name of property
principal – principal property
value – return by value
kwargs – any other attribute selectors for the select function
- Returns:
list of properties
Shorthand for p.select(‘//properties[name= {}, principal ={}, … ]’)
- property(*args, **kwargs)
Wrapper for
properties()
that returns a single value as a scalar. An exception is thrown if more than one value is found.- Parameters:
args
kwargs
- Returns:
- property_delete(*properties)
Delete properties
- property_get(*properties)
Return a dictionary of property, value pairs
- property_names()
Return names of all assigned properties
- property_set(properties)
Set the value of a project property
- recent_find(location)
- refresh_backends()
Reload the backends from the configuration file :return:
- registry(set=None)
Access the registry belonging to Molpro in the local backend.
- Parameters:
set – If present, obtain as a dictionary the specified registry set. If absent, obtain a list of all sets
- Returns:
- run(backend=None, verbosity=0, force=False, wait=False, options='')
Start a sjef job :param backend: name of the backend :param verbosity: If >0, show underlying processing :param force: whether to force submission of job even if run_needed() reports that it’s unnecessary :param wait: whether to wait until the job completes instead of returning after launchin it :param options: command-line options
- run_local_molpro(options: list)
- run_needed(verbosity=0)
Check weather the job has changed since the previous run and needs to be rerun :return: True/False
- select(selection_string, **options_and_callables)
Specialization of
pysjef.select()
which applies selection to the parsed output- Returns:
list of nodes that pass selection criteria
- singles(instance=-1)
Obtain some or all of the correlation singles in the job output
- Parameters:
instance – Which set of singles
- Returns:
a list of Single objects
- property status
String status of the project. Can be one of:
unknown
,running
,waiting
,completed
,unevaluated
,killed
, orfailed
.
- trash()
Move the project bundle to the trash
- tree_view(**options)
Build tree view from this node
- variable(name, instance=-1, list=False, dict=False)
Return the value of a variable in the output xml stream
- Parameters:
name – The name of the variable
instance – index of occurence in output
list – Whether to force returning a list. If true, a list is always returned; otherwise if the result is a scalar, a scalar is returned, and if no match is found, None is returned
dict – return property value, scalar float or list of floats as appropriate, if
False
or omitted. Otherwise, a dictionary containing all the data in the property node is returned
- Returns:
- variables(instance=-1)
Return a list of all defined variables
- Parameters:
instance – index of occurence of variables node in output
- Returns:
- property vibrations
Give information on normal vibrational modes
- Parameters:
instance (int)
- Returns:
Mass-weighted normal coordinates, vibrational wavenumbers, atomic masses, force constant matrix
- Return type:
dict
- view_input()
Opens the input file in editor as specified by ‘$EDITOR’ environment variable. Should by called from an interactive session
- view_output()
Opens the input file in editor as specified by ‘$EDITOR’ environment variable. Should by called from an interactive session
- wait(max_epoch=0.005)
Wait unconditionally for status() to return neither ‘waiting’ nor ‘running’ :param max_epoch: maximum time to wait between checking status (seconds)
- write_file(filename, content, overwrite=True)
Creates a file in the project with specified content
- Parameters:
filename – name of the file to create in the project
content – string content to write in the file
overwrite – if corresponding file already exists in the project, flags that it should be overwritten
- Returns:
True if file was created or overwritten, otherwise False
- write_input(content)
Create an input file with content specified as a string :param content: string with content for the input file
- property xml
- xpath(query, element=None)
Run xpath search on an element in the job xml, with support for default namespace
- Parameters:
query – Any xpath search expression supported by lxml.etree.Element
element – The root element for the search, defaulting to the job xml root element
- Returns:
list of etree.Element objects or of strings, depending on whether the xpath expression results in an attribute
- xpath_search(xpath_query, attribute='', run=0)
Simple XPath search on the xml document. For each matching node found, return a string that contains the value of a specified attribute, or if the attribute is omitted, the node contents.
- Parameters:
xpath_query
attribute
run
- xyz(preamble='//', instance=-1, title='')
Obtain a geometry in xyz file format
- Parameters:
instance – In the case of multiple geometries in the output stream, which occurence
preamble – Prepend this to the xpath search expression to locate the geometry
title – A title to be injected into the second line
- Returns:
A string containing the xyz representation of the geometry
- xyzs(preamble='//', title='')
Obtain a set of geometries in xyz file format
- Parameters:
preamble – Prepend this to the xpath search expression to locate the geometry
title – A title to be injected into the second line
- Returns:
A list of strings containing the xyz representation of the geometry
- pymolpro.project.element_to_dict(node, attributes=True)
Convert an lxml.etree node tree into a dict.
- Parameters:
node (lxml.etree.ElementTree) – A node in an lxml tree
attributes (bool, optional) – whether to include attributes in the result
- Returns:
A dictionary representing the tree
- Return type:
dict
- pymolpro.project.method_from_commands(commands)
- pymolpro.project.no_errors(projects, ignore_warning=True)
Checks that none of the projects have any errors. Projects can by running.
- Parameters:
projects – list of projects to check for errors
ignore_warning – Whether to count warnings as well as errors.
- Returns:
True/False whether any projects have errors
- pymolpro.project.resolve_geometry(geometry)
pymolpro.database module
- class pymolpro.database.Database(molecules={}, reactions={}, description=None, method=None, basis=None, options=None, project_directory=None)
Bases:
object
Database of molecular structures and reactions. The class contains and supports the following data.
Descriptions of molecules: geometry, charge, spin state.
Descriptions of reactions between the molecules: stochiometric factors.
Optionally, computed data: energies of molecules and/or reactions,s the parameters used to obtain them, and references to persistent data that can be used to further query or restart.
Description and external URLs that serve to further define the provenance of the data.
Specification of recommended subsets of the reactions
- Parameters:
molecules (list) – Initial molecules to be added with default options to
add_molecule()
.reactions (list) – Initial reactions to be added with default options to
add_reaction()
.description (str) – Text describing the database
method (str) – A string specifying the ansatz that was used to compute the energies. In the Molpro context, this will be a valid fragment of Molpro input.
basis (str) – A string specifying the orbital basis set that was used to compute the energies.
options (str) – A string specifying any additional options used to compute energies.
project_directory (str) – The path of the directory where support files that were generated in calculating energies can be found.
- add_molecule(name, geometry, energy=None, description=None, InChI=None, SMILES=None, spin=None, charge=None, preamble=None)
Add a molecule to the database. The minimal information that is stored is the geometry, but information from each of the optional arguments, if given, is also stored in the
molecules
dictionary.- Parameters:
name (str) – The key for the molecule in
molecules
.geometry (str) – The geometry. Any format recognised by Molpro can be used. This includes xyz, with or without the two header lines, or Z matrix, and lines can be separated either with newline or ;. The geometry can be specified either as a string, or a filename or url reference, in which case the contents of the reference are resolved now.
energy (float) – The reference value for the energy of the molecule in Hartree units
description (str) – Descriptive text
InChI (str) – InChI string describing the molecule
SMILES (str) – SMILES string describing the molecule
spin (int) – The spin multiplicity minus one
charge (int) – Electrical charge of molecule
preamble (str) – Additional Molpro input to be added before geometry
- Returns:
The added molecule
- Return type:
dict
- add_reaction(name, stoichiometry, energy=None, description=None)
Add a reaction to the database. The minimal information that is stored is the stoichiometry, which references existing molecules in the database, but information from each of the optional arguments, if given, is also stored in the
reactions
dictionary.- Parameters:
name – The key for the reaction in
reactions
.stoichiometry – A dictionary describing the stoichiometry of the reaction. Each key should be a key in
molecules
, and the value is an integer giving the number of equivalents of the molecule in the reaction, with the sign convention of positive for products, negative for reactants.energy – The reference value for the energy change of the reaction in Hartree units. If not given, and if all molecules in the reaction have an energy, it will be computed.
description – Descriptive text
- Returns:
The added reaction
- Return type:
dict
- add_reference(key, url)
- add_subset(subset_name, subset)
- basis
A string specifying the orbital basis-set used to compute the energies.
- calculate_reaction_energies(check=False)
- copy()
- description
Text describing the database
- dump(filename=None)
Dump the database in json format.
- Parameters:
filename (str) – If specified, the destination of the result
- Returns:
If
filename
is not specified, the json is returned as a string- Return type:
str
- load(source)
Load the database from a json dump in either the library, a file or a string
- Parameters:
source (str) – Source of dump
- Returns:
The database
- Return type:
- method
A string specifying the ansatz used to compute the energies. In the Molpro context, this will be a valid fragment of Molpro input.
- molecule_energies
A dictionary with molecule keys giving the molecular energy/Hartree reference values associated with the Database. The dictionary could be empty or only partly filled.
- molecules
Dictionary of molecules
- options
Any additional options used to compute reference values.
- preamble
any Molpro commands that should be executed before geometry specification. Typically angstrom could be specified if the geometry specification is in Z-matrix format with numerical values that would, by default, be interpreted as Bohr.
- project_directory
A string giving the path of the directory where support files generated in calculating energies can be found.
- projects
A dictionary with molecule handles pointing to filesystem project bundles for each Molpro job that has been run.
- reaction_energies
A dictionary with reaction keys giving the reaction energy/Hartree reference values associated with the Database. The dictionary could be empty or only partly filled. A database might have either, both or none of
molecule_energies
orreaction_energies
.
- references
A dictionary of external references to the data. The keys should be a short-form string that you want printed, eg author, year, and the values URLs that lead to the resource.
- subset(subset=None, open_shell=True, max_atoms=None, max_electrons=None)
Extract a subset of this database as a new database
- Parameters:
subset – Either a key in the
subsets
or a list of keys inreactions
. If not given, all the reactions in the databaseopen_shell – Whether to include reactions involving open-shell molecules, or prune to closed-shell only
max_atoms – Exclude reactions with one or more molecules with more than this number of atoms
max_electrons – Exclude reactions with one or more molecules with more than this number of electrons
- Returns:
The subset
- Return type:
- subsets
A dictionary defining named subsets of the database reactions
- pymolpro.database.analyse(databases, reference_database=None, unit=None, **kwargs)
Analyse and format the results in one or more databases
- Parameters:
reference_database (Database)
unit – Either a string or a float specifying desired units for the output. In the case of a string, it should match (case insensitive) one of the keys of
units
; if an explicit value is given, it should be the value of the desired units in atomic units, ie the results will be divided by the value.
- Returns:
A dictionary with keys, where possible,
molecule energies
molecule energy deviations
molecule statistics
molecule violin
reaction energies
reaction energy deviations
reaction statistics
reaction violin
The energy deviations are, for each molecule or reaction, the difference between the energies in each element of
databases
and the value inreference_database
. The values are pandas Dataframe objects, whose columns correspond to the elements ofdatabases
. In the case of the molecule or reaction energies or energy deviations, the rows correspond to the individual molecule or reaction. In the case of statistics, the rows areMSD: the mean of the deviations
STDEVD: the standard deviation of the deviations
MAD: the mean of the absolute value of the deviations
MAXD: the maximum absolute value of the deviations
RMSD: the root mean square deviation
- Return type:
dict
- pymolpro.database.basis_extrapolate(results, hf_results, x=None)
- pymolpro.database.load(source)
Construct a
Database
from a json dump in either the library, a file or a string- Parameters:
source (str) – Source of dump
- Returns:
The database
- Return type:
- pymolpro.database.run(db, ansatz=None, method='hf', basis='cc-pVTZ', location='.', parallel=None, backend='local', clean=False, initial='', check=False, check_energy=True, **kwargs)
Construct and run a Molpro job for each molecule in a
Database
, and compute reaction energies.- Parameters:
db (Database) – The database that defines molecules and reactions.
method (str) – The computational method for constructed input. Anything accepted as Molpro input, including parameters and directives, can be given. If the method needs a preceding Hartree-Fock calculation, this is prepended automatically.
basis (str) – The orbital basis set for constructed input. Anything that can appear after basis= in Molpro input is accepted.
ansatz (str) – String of the form method/basis//geometry_method/geometry_basis or method/basis which is parsed to give the same effect as the
method and basis parameters. If geometry_method/geometry_basis is specified, the calculation will be preceded by a geometry optimisation at that level of theory. :param str func: This should be one of
energy for a single geometry
opt for a geometry optimisation
- Parameters:
extrapolate (str) – If specified, carry out basis-set extrapolation. Anything that can appear after extrapolate,basis= in Molpro input is accepted.
location (str) – The filesystem directory in which projects will be constructed.
parallel (int) – The number of simultaneous jobs to be launched. The default is the number of cores on the local machine.
backend (str) – The sjef backend to be used for running jobs.
clean (bool) – Whether to destroy the project bundles on successful completion. This should not normally be done, since later invocations of
run()
will use cached results when possible. If there are errors, this parameter is ignored.initial (str) – Any valid molpro input to be placed before the geometry specification.
check (bool) – Whether to check for status of jobs instead of running them.
check_energy (bool) – Whether to throw an exception if any job did not set the Molpro ENERGY variable
kwargs – Any other options to pass to
project.Project.run()
, including func, extrapolate, preamble, postamble.
- Returns:
A new database which is a copy of
db
but with the new results overwriting any old ones- Return type:
- pymolpro.database.units = <pymolpro.database.Units object>
dictionary of units, giving their values in atomic units
pymolpro.grid module
- pymolpro.grid.cubical_grid(points1d, weights1d)
Take a one-dimensional grid, and construct a 3-dimensional outer-product cubical grid
- Parameters:
points1d
weights1d
- Returns:
points and weights (numpy array [npt,4])
- pymolpro.grid.evaluateBasis(molecule, points)
Evaluate the orbital basis set on a grid
- Parameters:
molecule – lxml.etree.Element holding the molecule
points – numpy :,3 array
- Returns:
numpy :,: array, first index basis function, second index brid point
- pymolpro.grid.evaluateOrbitals(molecule, points, minocc=1e-10, ID=None, values=False)
Evaluate the molecular orbitals on a grid
- Parameters:
molecule – lxml.etree.Element holding the molecule
points – numpy :,3 array
minocc – Only orbitals with at least this occupation will be returned
ID – Only the orbital whose ID attribute matches this will be selected
values
- Returns:
array of dictionaries giving the occupation and values on the grid, or if ID is specified, a single dictionary, or if values==True, a numpy array
- pymolpro.grid.spherical_grid(radial_points, radial_weights, l: int)
Take a one-dimensional grid, and use it for radial integration, together with a Lebedev grid of specified order, to generate a 3-dimensional grid (cartesian coordinates, weights) for quadrature.
- Parameters:
radial_points
radial_weights
l – Largest rank of spherical harmonic for which exact quadrature is wanted.
- Returns:
points and weights (numpy array [npt,4])
pymolpro.node_xml module
- class pymolpro.node_xml.AxesXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:axes Children: [list of doubles]
- class pymolpro.node_xml.BasisSetXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:basisSet - Container for a basis set Children: basisGroup, association Attributes: str id, str type, str angular, int groups, str primitives, int length, int cartesianLength
- class pymolpro.node_xml.CmlAtomXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
cml:atom - Output about a single atom
- class pymolpro.node_xml.CmlMoleculeXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
cml:molecule - Output about a single molecule Children: cml:atomarry, cml:symmetry
- class pymolpro.node_xml.CubeXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:cube - Metadata for a cube dataset Children: field, dimensions, origin, axes, step Attributes: str method
- class pymolpro.node_xml.DateXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:date - The time of the calculation. Children: [string datetime] Attributes: int year, int month, int day, int hour, int minute, int second
- class pymolpro.node_xml.DiagnosticsXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:diagnostics - Diagnostic info from the job Attributes: int warnings
- class pymolpro.node_xml.DimensionsXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:dimensions Children: [list of doubles]
- class pymolpro.node_xml.FieldXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:field Attributes: str quantity, str type, str number, str symmetry, double occupancy, double energy, str file
- class pymolpro.node_xml.InputXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:input - Molpro input dataset Children: p, include
- class pymolpro.node_xml.JobstepXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:jobstep - Output from a single job step Children: error, gradient, opt, property, cube, time, storage, vibrations, jobstep, cml:molecule, variables, instanton Attributes: str command, str commandset, bool displaced
- class pymolpro.node_xml.LicenceXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:licence Attributes: str id
- class pymolpro.node_xml.MachineXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:machine Attributes: str hostname
- class pymolpro.node_xml.MoleculeXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:molecule - Summary output about the job Children: cml:molecule, basisSet, vibrations, orbitals, stm:metadataList, platform Attributes: str id, str index, str InChI, str InChIKey, str SMILES, str title, str method, str basis, str geometryMethod, str geometryBasis, double energy
- class pymolpro.node_xml.NormalCoordinateXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:normalCoordinate - A normal vibrational coordinate Children: [list of doubles] Attributes: double wavenumber, str units, double IRintensity, str IRintensityunits, str symmetry, str real_zero_imag
- class pymolpro.node_xml.OrbitalXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:orbital - A Molpro molecular orbital Children: [string] Attributes: str symmetryID, double energy, double occupation
- class pymolpro.node_xml.OrbitalsXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:orbitals - Container for Molpro internal orbitals Children: orbital Attributes: str basis, str angular, str spin, str method
- class pymolpro.node_xml.OriginXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:origin Children: [list of doubles]
- class pymolpro.node_xml.ParallelXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:parallel Attributes: int processes, int nodes, int all_processes, int openmp
- class pymolpro.node_xml.PlatformXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:platform - Container for metadata about the platform Children: version, licence, parallel, machine, dimensions
- class pymolpro.node_xml.PlotXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:plot - Metadata for plot from a Molpro table Attributes: str table, str plot, str type Also attributes from http://www.w3.org/1999/xlink
- class pymolpro.node_xml.PropertyXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:property - Output about a single property of a single molecule Attributes: str name, any value
- class pymolpro.node_xml.StepXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:step Children: [list of doubles]
- class pymolpro.node_xml.VariableXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
TODO Doc
- class pymolpro.node_xml.VariablesXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:variables - Container for Molpro internal variables Children: variable
- class pymolpro.node_xml.VersionXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:version Children: [string], date Attributes: int major, int minor, str SHA, int integer_bits, str parallelism
- class pymolpro.node_xml.VibrationsXml(filename=None, xml=None, parent=None, suffix=None, **options)
Bases:
RootXml
molpro-output:vibrations - Container for info on molecular vibrations Children: normalCoordinate Attributes: str name, str type, str units, int length
- pymolpro.node_xml.tag_to_name(tag)
Takes XML tag with namespace, outputs raw node name.