Skip to content

ProgramInputs

qcio.models.inputs

Input models for quantum chemistry calculations.

FileInput

File and command line argument inputs for a calculation.

Attributes:

Name Type Description
files Files

A dict mapping filename to str or bytes data.

cmdline_args List[str]

A list of command line arguments to be passed to the program.

extras Dict[str, Any]

Additional information to bundle with the object. Use for schema development and scratch space.

from_directory classmethod

from_directory(directory: Union[Path, str], **kwargs) -> Self

Create a new FileInput and collect all files in the directory.

Source code in qcio/models/inputs.py
37
38
39
40
41
42
43
@classmethod
def from_directory(cls, directory: Union[Path, str], **kwargs) -> Self:
    """Create a new FileInput and collect all files in the directory."""
    obj = cls(**kwargs)
    directory = Path(directory)
    obj.add_files(directory)
    return obj

ProgramArgs

Generic arguments for a program without a calctype or structure specification.

This class is used by DualProgramInput or multi-step calculations to specify subprogram_args or a basic program arguments multistep algorithm in BigChem. It is not intended to be used directly for single-step calculations since it lacks a calctype and structure.

Attributes:

Name Type Description
model Model

The model for the quantum chemistry calculation.

keywords Dict[str, Any]

A dict of keywords to be passed to the program excluding model and calctype. Defaults to an empty dict.

files Files

Files to be passed to the QC program.

extras Dict[str, Any]

Additional information to bundle with the object. Use for schema development and scratch space.

ProgramArgsSub

Generic arguments for a program that also calls a subprogram.

This class is needed for multi-step calculations where the calctype and structure are specified only once for the entire calculation, e.g., multistep_opt in BigChem.

Attributes:

Name Type Description
keywords

A dict of keywords to be passed to the program excluding model and calctype. Defaults to an empty dict.

files

Files to be passed to the QC program.

model Optional[Model]

The model for the quantum chemistry calculation

subprogram str

The name of the subprogram to use.

subprogram_args ProgramArgs

The ProgramArgs for the subprogram.

extras ProgramArgs

Additional information to bundle with the object. Use for schema development and scratch space.

ProgramInput

ProgramInput(**data: Any)

Input for a single quantum chemistry program. This is the most common input type.

Attributes:

Name Type Description
calctype CalcType

The type of calculation to perform.

model Model

The model for the quantum chemistry calculation.

keywords Dict[str, Any]

A dict of keywords to be passed to the program excluding model and calctype. Defaults to an empty dict.

structure Structure

The structure to be used in the calculation.

files Files

Files to be passed to the QC program.

extras Dict[str, Any]

Additional information to bundle with the object. Use for schema development and scratch space.

Example
from qcio.models import ProgramInput, Structure

struct = Structure.open("path/to/structure.xyz")

prog_inp = ProgramInput(
    calctype = "energy",
    structure = struct,
    model = {"method": "hf", "basis": "6-31G"},
    keywords = {"maxsteps": "250"},  # Optional
    files = {"file1": b"binary data"}  # Optional
)
Source code in qcio/models/inputs.py
58
59
60
61
62
63
64
65
66
67
68
69
def __init__(self, **data: Any):
    """Backwards compatibility for 'molecule' attribute."""

    # TODO: Remove in future versions.
    if "molecule" in data:
        warnings.warn(
            "Use of 'molecule' attribute is deprecated. Use 'structure' instead.",
            FutureWarning,
            stacklevel=2,
        )
        data["structure"] = data.pop("molecule")
    super().__init__(**data)

DualProgramInput

DualProgramInput(**data: Any)

Input for a two program calculation.

Attributes:

Name Type Description
calctype CalcType

The type of calculation to perform.

model Model

The model for the quantum chemistry calculation.

keywords Dict[str, Any]

A dict of keywords to be passed to the program excluding model and calctype. Defaults to an empty dict.

structure Structure

The structure to be used in the calculation.

files Files

Files to be passed to the QC program.

subprogram Files

The name of the subprogram to use.

subprogram_args ProgramArgs

The ProgramArgs for the subprogram.

extras Dict[str, Any]

Additional information to bundle with the object. Use for schema development and scratch space.

Example
from qcio.models import DualProgramInput, Structure

struct = Structure.open("path/to/structure.xyz")

prog_inp = DualProgramInput(
    calctype = "optimization",
    structure = struct,
    keywords = {"maxiter": "250"},  # Optional
    subprogram = "orca",
    subprogram_args = ProgramArgs(
        model = {"method": "wb97x-d3", "basis": "def2-SVP"},
        keywords = {"convthre": "1e-6"},  # Optional
    )
)
Source code in qcio/models/inputs.py
58
59
60
61
62
63
64
65
66
67
68
69
def __init__(self, **data: Any):
    """Backwards compatibility for 'molecule' attribute."""

    # TODO: Remove in future versions.
    if "molecule" in data:
        warnings.warn(
            "Use of 'molecule' attribute is deprecated. Use 'structure' instead.",
            FutureWarning,
            stacklevel=2,
        )
        data["structure"] = data.pop("molecule")
    super().__init__(**data)