Skip to content

ProgramInputs

More extensive documentation is available at https://qcio.coltonhicks.com

qcio.models.inputs.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)

qcio.models.inputs.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 str

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)

qcio.models.inputs.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