composite_step package#

Submodules#

composite_step.composite module#

Non-graphical part of the Composite step in a SEAMM flowchart

class composite_step.composite.Composite(flowchart=None, title='Composite', extension=None, logger=<Logger composite_step.composite (WARNING)>)[source]#

Bases: Node

The non-graphical part of a Composite step in a flowchart.

parser#

The parser object.

Type:

configargparse.ArgParser

options#

It contains a two item tuple containing the populated namespace and the list of remaining argument strings.

Type:

tuple

subflowchart#

A SEAMM Flowchart object that represents a subflowchart, if needed.

Type:

seamm.Flowchart

parameters#

The control parameters for Composite.

Type:

CompositeParameters

See also

TkComposite, Composite, CompositeParameters

analyze(indent='', **kwargs)[source]#

Nothing to analyze yet.

description_text(P=None)[source]#

Create the text description of what this step will do. The dictionary of control values is passed in as P so that the code can test values, etc.

Parameters:

P (dict) – An optional dictionary of the current values of the control parameters.

Returns:

A description of the current step.

Return type:

str

property git_revision#

The git version of this module.

run()[source]#

Run a Composite step: print what it does, which is nothing yet.

Returns:

The next node object in the flowchart.

Return type:

seamm.Node

property version#

The semantic version of this module.

composite_step.composite_parameters module#

Control parameters for the Composite step in a SEAMM flowchart

class composite_step.composite_parameters.CompositeParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for Composite.

You need to replace the “time” entry in dictionary below these comments with the definitions of parameters to control this step. The keys are parameters for the current plugin,the values are dictionaries as outlined below.

Examples

parameters = {
    "time": {
        "default": 100.0,
        "kind": "float",
        "default_units": "ps",
        "enumeration": tuple(),
        "format_string": ".1f",
        "description": "Simulation time:",
        "help_text": ("The time to simulate in the dynamics run.")
    },
}
parameters{str: {str: str}}

A dictionary containing the parameters for the current step. Each key of the dictionary is a dictionary that contains the the following keys:

parameters[“default”] :

The default value of the parameter, used to reset it.

parameters[“kind”]enum()

Specifies the kind of a variable. One of “integer”, “float”, “string”, “boolean”, or “enum”

While the “kind” of a variable might be a numeric value, it may still have enumerated custom values meaningful to the user. For instance, if the parameter is a convergence criterion for an optimizer, custom values like “normal”, “precise”, etc, might be adequate. In addition, any parameter can be set to a variable of expression, indicated by having “$” as the first character in the field. For example, $OPTIMIZER_CONV.

parameters[“default_units”]str

The default units, used for resetting the value.

parameters[“enumeration”]tuple

A tuple of enumerated values.

parameters[“format_string”]str

A format string for “pretty” output.

parameters[“description”]str

A short string used as a prompt in the GUI.

parameters[“help_text”]str

A longer string to display as help for the user.

See also

Composite, TkComposite, Composite, CompositeStep

parameters = {}#

composites are used through a Model Chemistry step.

Type:

No parameters yet

composite_step.composite_step module#

class composite_step.composite_step.CompositeStep(flowchart=None, gui=None)[source]#

Bases: object

Helper class needed for the stevedore integration.

This must provide a description() method that returns a dict containing a description of this node, and create_node() and create_tk_node() methods for creating the graphical and non-graphical nodes.

The dictionary for the description is the class variable just below these comments. The felds are as follows:

my_description{str, str}

A human-readable description of this step. It can be several lines long, and needs to be clear to non-expert users. It contains the following keys: description, group, name.

my_description[“description”]tuple

A description of the Composite step. It must be clear to non-experts.

my_description[“group”]str

Which group in the menus to put this step. If the group does not exist it will be created. Common groups are “Building”, “Control”, “Custom”, “Data”, and “Simulations”.

my_description[“name”]str

The name of this step, to be displayed in the menus.

classmethod analyze_task(result, model_chemistry, configuration, **kwargs)[source]#

The component’s results with the energy replaced by the recipe’s E0 (kJ/mol), and the composite described under composite.

classmethod can_run_task(configuration, model_chemistry, **kwargs)[source]#

Whether one task per structure can compute this composite: only when E0 depends on one energy (the component’s own task), for a molecule.

create_node(flowchart=None, **kwargs)[source]#

Create and return the new node object.

Parameters:
  • flowchart (seamm.Node) – A non-graphical SEAMM node

  • **kwargs (keyword arguments) – Various keyword arguments such as title, namespace or extension representing the title displayed in the flowchart, the namespace for the plugins of a subflowchart and the extension, respectively.

Return type:

Composite

create_tk_node(canvas=None, **kwargs)[source]#

Create and return the graphical Tk node object.

Parameters:
  • canvas (tk.Canvas) – The Tk Canvas widget

  • **kwargs (keyword arguments) – Various keyword arguments such as tk_flowchart, node, x, y, w, h representing a graphical flowchart object, a non-graphical node for a step, and dimensions of the graphical node.

Return type:

TkComposite

description()[source]#

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

classmethod expected_fingerprints(configuration, model_chemistry, **kwargs)[source]#

For a one-energy recipe, the fingerprints of the composite record its result carries (composite_step.evaluate.composite_record()), one for each fingerprint the component’s program predicts. None for a recipe that combines several calculations: those are stored as their components.

classmethod get_model_chemistry_options(periodic_only=False, mdi_only=False, data_path=None)[source]#

The composite methods SEAMM provides: SEAMM:CMP@<recipe> for the newest version of each recipe found.

The recipes are the shipped set plus those in a recipes/ directory of each data_path entry (a job’s data, the user’s). Composites are molecular and have no MDI engine or gradients yet, so a periodic-only or MDI-only request gets nothing.

Whether the codes for a recipe’s components are installed is not checked here: that needs the other steps’ model chemistries, and asking for them from inside model-chemistry discovery would recurse. The step checks it before it runs anything (composite_step.recipes.check_capabilities()).

classmethod get_task(configuration, model_chemistry, **kwargs)[source]#

The task of a one-energy recipe: its component’s task. A recipe that combines several calculations runs through composite_step.evaluate.evaluate_recipe() instead.

classmethod make_evaluator(node, model_chemistry, **kwargs)[source]#

The evaluator for a recipe that combines several calculations (composite_step.evaluate.CompositeEvaluator), which seamm_exec.Evaluator(...) returns in its place; None for a one-energy recipe, which runs as its component’s own tasks.

my_description = {'description': 'An interface for Composite', 'group': 'Simulations', 'name': 'Composite'}#

composite_step.evaluate module#

Running a recipe: its components as ordinary calculations, then the combination.

Each component is an ordinary single point at the recipe’s geometry, run through its own model chemistry (ORCA:DFT@...) by seamm_exec’s Evaluator: one evaluator per component over all the structures, so the structures of a component run in parallel, as tasks or over MDI as the Evaluator chooses. Each component’s result is the code’s ordinary result with its ordinary calculation record and settings fingerprint, so the fragment store finds and keeps components, never composites, and a component shared by two recipes is computed once.

Energies are combined in kJ/mol, as the Evaluator returns them. Every result of a combine block scales like an energy (homogeneous of degree 1 in the energies, checked when the recipe is read: see composite_step.recipes.DEGREES), so the result is the same in any unit; only the empirical constants, which recipes give in E_h, are converted here. A recipe of one component therefore gives exactly that component’s energy, with no unit conversion of it.

class composite_step.evaluate.CompositeEvaluator(node, model_chemistry=None, recipe=None, *, properties=('energy', 'gradients'), path=None, directory=None, target=None, task_set_options=None, resources=None, name='Composite', component_lookup=None, available=None, evaluator_factory=None)[source]#

Bases: object

Evaluates a composite model chemistry at many structures, with the interface of seamm_exec.Evaluator, which returns it from Evaluator(...) through CompositeStep.make_evaluator() when the recipe combines several calculations.

Each component runs as an ordinary Evaluator of its own program, over all the submitted structures (evaluate_recipe()), with that program’s own resources: a consumer’s resources are not passed on, since an F12 component needs other memory than a DFT one. The job’s target and the task set’s options are passed on.

Energies only: a composite has no gradients or stress yet.

The arguments node, model_chemistry, properties, path, directory, target, task_set_options, resources and name are as for seamm_exec.Evaluator. path (for tests only) is passed to every component’s evaluator; otherwise each chooses its own.

Parameters:
  • recipe (composite_step.recipes.Recipe, optional) – Default: the model chemistry’s.

  • component_lookup (callable, optional) – lookup(source, model_chemistry, key, configuration) -> (energy kJ/mol, how), (energy, how, record) or None (see evaluate_recipe()): a component energy the consumer already has (a fragment store, an earlier run), which is then not computed.

  • available (dict, optional) – The discovered model chemistries.

  • evaluator_factory (callable, optional) – For tests: makes the components’ evaluators.

cancel()[source]#

Stop: the component evaluator running now is cancelled, and no other component starts.

property cancelled#
close()[source]#
expected_fingerprints(configuration, **kwargs)[source]#

None: a composite is never stored as such, only its components (whose fingerprints the components’ programs predict).

mdi_capable = False#
path = 'batch'#
results()[source]#

Compute what has been submitted; yield an seamm_exec.evaluator.EvaluatorResult for each structure, once all its components are done.

submit(configuration, key=None, *, options=None)[source]#

Add a structure; returns its key (unique, filesystem-safe).

class composite_step.evaluate.CompositeResult(key: str, ok: bool, E0: float = None, results: dict = <factory>, components: dict = <factory>, reason: str = None)[source]#

Bases: object

One structure’s composite energy.

key#
Type:

str

ok#
Type:

bool

E0#

kJ/mol.

Type:

float or None

results#

Every value combine defines (E0 among them), kJ/mol.

Type:

dict

components#

Per component: energy (kJ/mol), how (“computed”, or what the consumer’s lookup said), record (the calculation record, if computed) and model_chemistry.

Type:

dict

reason#

Why it failed.

Type:

str or None

E0: float = None#
components: dict#
key: str#
ok: bool#
reason: str = None#
results: dict#
composite_step.evaluate.HARTREE_TO_KJ = 2625.4996394798254#

kJ/mol per E_h (CODATA 2018, as seamm_util’s pint registry).

composite_step.evaluate.component_energy(component, with_parts)[source]#

The energy of a component for the combination (kJ/mol), with its parts converted to kJ/mol when the recipe uses them.

composite_step.evaluate.component_levels(recipe)[source]#

{source: level spec} for every energy the recipe combines, the geometry level included when combine uses it. Phase 1 needs a complete level for each; method + basis on the recipe’s chosen code comes with the code choice (phase 2).

composite_step.evaluate.component_mc(recipe, source, available=None)[source]#

The _model_chemistry wrapper a component runs with: its level, plus the settings the recipe gives it (frozen core, relativistic Hamiltonian, nucleus model) as options, checked against what the program says it can do, and a level label that tells apart components of one level with other settings.

composite_step.evaluate.composite_data(recipe, model_chemistry, components, results)[source]#

data as consumers get it on either route: energy (E0, kJ/mol), composite (the recipe, the components’ energies and how they were obtained, every value combine defines) and calculation (the composite record, composite_record()).

composite_step.evaluate.composite_record(recipe, model_chemistry, components)[source]#

The calculation record of a composite energy, in the form of a code’s (seamm_util.fingerprint.calculation_record()): its fingerprint hashes the recipe’s fingerprint and every component’s settings fingerprint, so equal fingerprints mean the same recipe of the same calculations. The components’ own records are kept under components.

Parameters:

components ({str: dict}) – Per component, its record (the code’s calculation record, or None when the energy came from a store or an earlier run without one) and model_chemistry.

composite_step.evaluate.cost_key(model_chemistry, name='')[source]#

A sort key that puts cheap components first: the type, the method (DLPNO cheaper, F12 dearer), then the basis set’s cardinal number.

composite_step.evaluate.delegate(model_chemistry)[source]#

(recipe, source, the source’s _model_chemistry, its provider) for a recipe whose E0 depends on one energy; RecipeError otherwise.

composite_step.evaluate.delegated_analyze_task(result, model_chemistry, configuration, **kwargs)[source]#

analyze_task of a one-energy recipe: the component’s own results, with the energy replaced by the recipe’s E0 (kJ/mol) and the composite noted.

composite_step.evaluate.delegated_get_task(configuration, model_chemistry, **kwargs)[source]#

get_task of a one-energy recipe: the component’s own task.

composite_step.evaluate.energy_sources(recipe)[source]#

The names combine takes energies from: components, and geometry when the geometry level’s energy is used. Components named only inside hf_part/corr_part count too.

composite_step.evaluate.evaluate_recipe(node, recipe, structures, *, directory=None, lookup=None, constants=None, available=None, evaluator_factory=None, name='Composite', options=None)[source]#

The composite energy of each structure.

The components run one after another, cheapest first (cost_key()), each over all the structures at once. A structure that fails a component is not sent to the later ones.

Parameters:
  • node (seamm.Node) – The step running it (its flowchart, executor, directory).

  • recipe (composite_step.recipes.Recipe)

  • structures ({str: configuration}) – The structures, by key (filesystem-safe keys: they name the tasks).

  • directory (Path, optional) – Where the components’ tasks go, <directory>/<component>.

  • lookup (callable, optional) – lookup(source, model_chemistry, key, configuration) -> (energy kJ/mol, how) or (energy, how, record), or None: a value the consumer already has (from the fragment store or an earlier run), which is then not computed. record (at least its fingerprint) keeps the composite record the same as when the component is computed.

  • constants ({str: float}, optional) – The recipe’s empirical values, E_h; converted to kJ/mol here.

  • available (dict, optional) – The discovered model chemistries (to avoid discovering them again).

  • evaluator_factory (callable, optional) – Makes the evaluators, factory(node, mc, properties=, directory=, name=); seamm_exec.Evaluator by default (tests replace it).

  • name (str)

  • options ({str: dict}, optional) – Per structure (by key), the options it is submitted with to every component (charge, multiplicity, atom_indices, …).

Returns:

{str – In the order of structures.

Return type:

CompositeResult}

composite_step.evaluate.provider_of(step)[source]#

The plug-in class (get_task/analyze_task) of a step, by its stevedore name in org.molssi.seamm, as model-chemistry discovery finds it.

composite_step.evaluate.resolve_level(level, available=None)[source]#

The _model_chemistry wrapper of a level spec, as the Model Chemistry step resolves it (any basis for an offered owner/type/method).

composite_step.evaluate.single_source(recipe)[source]#

The one energy E0 depends on, or None when it needs several (or the HF part of one, which a plain energy does not give).

composite_step.metadata module#

This file contains metadata describing the results from Composite

composite_step.metadata.metadata = {}#

Description of the computational models for Composite.

Hamiltonians, approximations, and basis set or parameterizations, only if appropriate for this code. For example:

metadata["computational models"] = {
    "Hartree-Fock": {
        "models": {
            "PM7": {
                "parameterizations": {
                    "PM7": {
                        "elements": "1-60,62-83",
                        "periodic": True,
                        "reactions": True,
                        "optimization": True,
                        "code": "mopac",
                    },
                    "PM7-TS": {
                        "elements": "1-60,62-83",
                        "periodic": True,
                        "reactions": True,
                        "optimization": False,
                        "code": "mopac",
                    },
                },
            },
        },
    },
}

composite_step.recipes module#

Composite-method recipes: the file format, its checks, the combination of the component energies, the capability check and the thermal terms.

A recipe is a declarative YAML file that says exactly how an energy is made from ordinary calculations: the geometry and frequency level, the single-point components at that geometry, and an expression (combine) that combines them. The result is itself a model chemistry, SEAMM:CMP@<recipe>.

This module has no GUI and no SEAMM flowchart dependencies, so it can be used and tested on its own. See NOTES_composite_methods.md (the design) for the reasons.

Units: a recipe’s empirical constants are in hartree (E_h). Every result of combine must scale like an energy (degree 1 in the energies; checked when the recipe is read), so the components may be combined in any one unit, E_h or kJ/mol, with the constants in the same unit. The thermal terms likewise.

composite_step.recipes.ALLOWED_PAIR_DIFFERENCES = ({'method'}, {'basis'}, {'frozen core'}, {'relativistic'}, {'basis', 'relativistic'})#

one thing at a time (a relativistic correction changes the Hamiltonian and, with it, to a recontracted basis)

Type:

The ways the two components of a difference may differ

composite_step.recipes.COMPONENT_FIELDS = {'basis', 'code', 'convergence', 'decontract', 'density_fitting', 'f12', 'frozen_core', 'level', 'method', 'nucleus', 'omit', 'options', 'reference', 'relativistic', 'sp_shells'}#

The fields of a component (one ordinary single point at the recipe’s geometry).

class composite_step.recipes.ComponentEnergy(total: float, hf: float = None, parts: dict = <factory>, factors: dict = <factory>, reference: str = None)[source]#

Bases: object

The energy of one component, with the parts a combination may need.

Parameters:
  • total (float) – The total energy.

  • hf (float, optional) – The HF (reference) part of a correlated energy, in the same unit. Taken from parts["HF"] when not given.

  • parts ({str: float}, optional) – The named parts of the energy (the program’s energy parts), in the same unit as total.

  • factors ({str: float}, optional) – Dimensionless factors, e.g. "(T) scale f".

  • reference (str, optional) – The reference the correlation is built on: “RHF”, “UHF” or “QRO”.

property correlation#

E - HF - CABS singles (an F12 run’s CABS singles belong to neither the HF part nor the correlation).

Type:

The correlation energy alone

factors: dict#
hf: float = None#
part(name)[source]#

A named part: stored, or one of DERIVED_PARTS.

parts: dict#
reference: str = None#
total: float#
composite_step.recipes.DEGREES = {'cbs_power': ((1, 1, 0, 0, 0), 1), 'corr_part': ((1,), 1), 'hf_extrapolate_exp': ((1, 1, 0, 0), 1), 'hf_part': ((1,), 1), 'part': ((1, 0), 1), 'scale': ((1, 0), 1), 'schwenke': ((1, 1, 0), 1)}#

1 for an energy, 0 for a pure number (a cardinal number, an exponent, a factor). Every function is homogeneous of degree 1 in its energy arguments, so a combination gives the same result in any energy unit. A new function must be too: a fitted exponent, for example, enters only through a ratio of energy differences (degree 0), as in Feller’s three-point form.

Type:

The degree of each function’s arguments and result in the energies

composite_step.recipes.DERIVED_PARTS = {'(T*)': <function _scaled_triples.<locals>.scaled>, 'CCSD-F12 correlation': <function <lambda>>, 'DLPNO-(T0*)': <function _scaled_triples.<locals>.scaled>, 'DLPNO-CCSD-F12 correlation': <function <lambda>>, 'HF+CABS': <function <lambda>>}#

Parts computed at use from the stored ones, never stored themselves.

composite_step.recipes.DESCRIPTIVE = {'description', 'doi', 'frozen_core_sources', 'reference', 'uncertainty', 'validation'}#

Fields that describe a recipe without changing its energy; they are left out of the fingerprint.

composite_step.recipes.FIELDS = {'allow_mixed_reference', 'atoms', 'combine', 'components', 'description', 'doi', 'empirical', 'frequencies', 'frozen_core', 'frozen_core_definitions', 'frozen_core_sources', 'geometry', 'open_shell_reference', 'recipe', 'reference', 'requires', 'uncertainty', 'validation', 'version'}#

The top-level fields of a recipe file.

composite_step.recipes.FINGERPRINT_EXCLUDED = {'description', 'doi', 'frozen_core_sources', 'open_shell_reference', 'reference', 'uncertainty', 'validation'}#

the open-shell reference changes only open-shell calculations, and those are told apart by their components’ fingerprints, which the composite’s fingerprint includes. Left out, it changes nothing for closed-shell species, whose results stay reusable when a recipe adds it.

Type:

Fields left out of the recipe’s own fingerprint although they matter

composite_step.recipes.FORBIDDEN_IN_NAME = ':@/|'#

they are the separators of the model-chemistry grammar [owner:]type@method/basis|....

Type:

Characters a recipe name may not contain

composite_step.recipes.FUNCTIONS = {'cbs_power': (<function cbs_power>, 4, 5), 'hf_extrapolate_exp': (<function hf_extrapolate_exp>, 4, 4), 'scale': (<function scale>, 2, 2), 'schwenke': (<function schwenke>, 3, 3)}#

The functions combine may call, with the number of positional arguments they take (min, max).

composite_step.recipes.GEOMETRY = 'geometry'#

The name of the geometry level’s own energy inside combine.

composite_step.recipes.HF_TYPE_PARTS = {'HF', 'HF+CABS'}#

The parts that are the reference’s energy, whose references must agree

composite_step.recipes.OPEN_SHELL_REFERENCES = ('UHF', 'QRO')#

unrestricted Hartree-Fock, or quasi-restricted orbitals built from it (ROHF is refused by ORCA’s canonical coupled cluster). Closed-shell components are not affected.

Type:

The references open-shell components can use

composite_step.recipes.OWNER = 'SEAMM'#

The owner and type of SEAMM’s recipes as model chemistries.

composite_step.recipes.PART_FUNCTIONS = {'corr_part', 'hf_part', 'part'}#

Functions of a component itself, not of its energy.

class composite_step.recipes.Recipe(data: dict, path: Path = None, source: str = 'shipped', statements: list = <factory>)[source]#

Bases: object

A composite method read from a recipe file.

Use load_recipe() or from_dict(), which check it.

combine(components, constants=None)[source]#

E0 and the other results from the components’ energies (E_h).

components must include the geometry level’s energy as geometry when the combination uses it.

property components#
data: dict#
property description#
fingerprint(component_fingerprints=None)[source]#

A hash of the normalized recipe (its descriptive fields left out), and of the components’ own fingerprints when given.

classmethod from_dict(data, path=None, source='shipped')[source]#
property geometry#
property model_chemistry#

The level spec of this recipe, SEAMM:CMP@<name>.

property name#
property needs_parts#

The components whose parts combine uses (hf_part, corr_part, part).

path: Path = None#
property requires#
source: str = 'shipped'#
statements: list#
thermal(E0, geometry)[source]#

H(0 K) and H(T) from E0 and the frequency level’s values.

Parameters:
  • E0 (float) – The recipe’s electronic energy.

  • geometry (dict) – E (the frequency level’s electronic energy), ZPE (unscaled) and optionally H (its enthalpy at T: E + ZPE + thermal), in the same units as E0.

Returns:

E0, ZPE (unscaled), ZPE scaled, H0 and, with H, H. H0 = E0 + s ZPE and H = E0 + s ZPE + [H - E - ZPE] at the frequency level: only the ZPE is scaled.

Return type:

dict

property uses_default_frozen_core#

Whether a component leaves the frozen core to the program’s default.

property version#
property zpe_scale#

(factor, source) for the ZPE at the frequency level.

exception composite_step.recipes.RecipeError[source]#

Bases: ValueError

A recipe file that is not valid, or a combination that cannot be made.

class composite_step.recipes.RecipeLibrary(user_directory=None, extra_directories=(), shipped=True)[source]#

Bases: object

The recipes available: the shipped set, the user directory and any job’s.

A local (user or job) recipe with the name of a shipped one is refused unless it carries another version, so a shipped name and version always mean the shipped recipe. Problems are collected in problems, not raised, so one bad local file does not hide the others.

get(name, version=None)[source]#

The recipe of that name: the given version, or the newest.

names()[source]#
versions(name)[source]#
composite_step.recipes.cbs_power(e_x, e_y, x, y, alpha=3.0)[source]#

Two-point inverse-power extrapolation (Helgaker 1997, Halkier 1998): E(n) = E_CBS + A n^-alpha, solved from cardinal numbers x and y.

composite_step.recipes.check_capabilities(recipe, available_levels=None, capabilities=None)[source]#

What a code lacks to run a recipe; an empty list if it can.

Parameters:
  • recipe (Recipe)

  • available_levels (collection of str, or callable, optional) – The model chemistries available (e.g. the keys of discover_model_chemistries()), compared case-insensitively; or a function of a level spec returning whether it is available (e.g. one using match_model_chemistry, which lets the basis be any).

  • capabilities (collection of str, optional) – What the code offers for the recipe’s requires list, as the same strings (CCSD(T), basis:cc-pVTZ-F12, F12/RI, …).

composite_step.recipes.component_settings(recipe, comp)[source]#

The settings a component’s program is given beyond its level – frozen_core (orbitals per element, “none” or “default”), relativistic and nucleus, and the open-shell reference – and a label for the level that tells them apart, so two components of one level (all electrons and frozen core) are never mixed up.

The reference is not in the label: it changes nothing for closed-shell species, whose calculations stay the same (and reusable) whatever a recipe says, and for open-shell species the settings fingerprint of the calculation tells UHF and QRO apart.

composite_step.recipes.effective_reference(data, comp)[source]#

The open-shell reference a component runs with: its own reference, else the recipe’s open_shell_reference, else None (the program’s default).

composite_step.recipes.evaluate(statements, components, constants=None, allow_mixed_reference=False)[source]#

Evaluate parsed combine statements.

Parameters:
  • statements ([(str, ast.AST)]) – From parse_combine().

  • components ({str: ComponentEnergy or float}) – The energies of the components (and of the geometry level), E_h.

  • constants ({str: float}, optional) – Other named values: empirical terms, spin-orbit, E_h.

  • allow_mixed_reference (bool) – Allow HF-type parts of components with different references (RHF, UHF, QRO) in one combination; refused otherwise.

Returns:

{str – Every result the statements define, in order; E0 among them.

Return type:

float}

composite_step.recipes.frozen_core_key(frozen_core)[source]#

A canonical key for a frozen core: “none”, “default”, or a short hash of the per-element counts, so the same counts give the same key whatever a recipe calls the set, and different counts never share one.

composite_step.recipes.hf_extrapolate_exp(e_x, e_y, n, alpha)[source]#

Two-point extrapolation of the HF energy in the form E(n) = E_CBS + B (n + 1) exp(-alpha sqrt(n)), from cardinal numbers n and n + 1.

G4 uses alpha = 1.63 (Curtiss 2007); Karton and Martin (2006) use alpha = 9.

composite_step.recipes.load_recipe(path, source='shipped')[source]#

Read and check one recipe file.

composite_step.recipes.parse_combine(text)[source]#

Parse a combine block into a list of (name, expression AST).

Each line is name = expression. An expression may use numbers, the names of components and of earlier results, + - * / and parentheses, and the functions in FUNCTIONS and PART_FUNCTIONS. Nothing else is accepted: the text is parsed with ast and never given to eval.

composite_step.recipes.parts_used(statements)[source]#

{component: set of what is used of it}: “hf_part”, “corr_part” and the names given to part().

composite_step.recipes.scale(e, factor)[source]#

An energy times a factor.

composite_step.recipes.schwenke(e_x, e_y, factor)[source]#

Schwenke’s (2005) two-point extrapolation: E_CBS = e_x + F (e_y - e_x).

composite_step.recipes.shipped_directory()[source]#

The directory of the recipes released with composite_step.

composite_step.recipes.validate(data)[source]#

Check a recipe dict; return its parsed combine statements.

composite_step.substep module#

Base class for substeps in the Composite step.

class composite_step.substep.Substep(flowchart=None, title='no title', extension=None, logger=<Logger composite_step.substep (WARNING)>, module=None)[source]#

Bases: Node

A base class for substeps in the Composite subflowchart.

The top-level Composite step iterates over the substeps of its subflowchart and calls each substep’s run() method. Each substep is responsible for preparing its own input, invoking Composite, analyzing its output, and storing its results.

This base class provides:

  • is_runable - whether the top-level loop should call run() on this substep. Override to return False for substeps that only contribute input (e.g., an Initialization step) rather than invoking the code.

  • input_only - a flag for “write input but don’t run” mode, useful for debugging and testing.

  • options / global_options - delegated to the parent step so that command-line options reach substeps uniformly.

  • header - a printable header for this section of step.out.

  • version / git_revision - delegated to the plug-in package so that every substep reports the plug-in’s version, not seamm.Node’s.

property git_revision#

The git revision of the composite_step package.

property global_options#

The global SEAMM options, delegated to the parent step.

property header#

A printable header for this section of output.

property input_only#

Whether to write the input only, not run Composite.

property is_runable#

Whether this substep should be run by the top-level loop.

Override to return False for substeps that only contribute input (e.g., an Initialization step) rather than invoking Composite themselves.

property options#

The Composite options, delegated to the parent step.

property version#

The semantic version of the composite_step package.

composite_step.tk_composite module#

The graphical part of a Composite step

class composite_step.tk_composite.TkComposite(tk_flowchart=None, node=None, canvas=None, x=None, y=None, w=200, h=50)[source]#

Bases: TkNode

The graphical part of a Composite step in a flowchart.

tk_flowchart#

The flowchart that we belong to.

Type:

TkFlowchart = None

node#

The corresponding node of the non-graphical flowchart

Type:

Node = None

namespace#

The namespace of the current step.

Type:

str

tk_subflowchart#

A graphical Flowchart representing a subflowchart

Type:

TkFlowchart

canvas#

The Tk Canvas to draw on

Type:

tkCanvas = None

dialog#

The Pmw dialog object

Type:

Dialog

x#

The x-coordinate of the center of the picture of the node

Type:

int = None

y#

The y-coordinate of the center of the picture of the node

Type:

int = None

w#

The width in pixels of the picture of the node

Type:

int = 200

h#

The height in pixels of the picture of the node

Type:

int = 50

self[widget]#

A dictionary of tk widgets built using the information contained in Composite_parameters.py

Type:

dict

See also

Composite, TkComposite, CompositeParameters

create_dialog()[source]#

Create the dialog. A set of widgets will be chosen by default based on what is specified in the Composite_parameters module.

Parameters:

None

Return type:

None

reset_dialog(widget=None)[source]#

Layout the widgets in the dialog.

The widgets are chosen by default from the information in Composite_parameter.

This function simply lays them out row by row with aligned labels. You may wish a more complicated layout that is controlled by values of some of the control parameters. If so, edit or override this method

Parameters:

widget (Tk Widget = None)

Return type:

None

right_click(event)[source]#

Handles the right click event on the node.

Parameters:

event (Tk Event)

Return type:

None

See also

TkComposite.edit

Module contents#

composite_step A SEAMM plug-in for composite methods: energies from recipes of ordinary calculations