Inputs
Data structures for specifying quantum chemistry calculations. The most commonly used structure is a ProgramInput
which defines a single calculation.
A DualProgramInput
is used when two inputs are required for a calculation. For example, doing a geometry optimization with geomeTRIC
while using a subprogram
like TeraChem
or Psi4
to compute the gradients.
A FileInput
is an escape hatch that allows you to run any calculation in any QC program (or any program for that matter), even if it isn't a supported CalcType
in qcio
yet. You can use a FileInput
to store the native input files (text and binary) for a QC program along with the relevant command line args. Using qcop you can submit a FileInput
a QC program and all output files and logs
produced by that program will be collected and returned in a user-friendly Results
object. FileInput
allows you to continue to use qcio
even for calculations that haven't yet been standardized.
qcio.ProgramInput
¶
ProgramInput(**data: Any)
Core input for a quantum chemistry calculation. 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 src/qcio/models/inputs.py
65 66 67 68 69 70 71 72 73 74 75 76 |
|
add_file
¶
add_file(
filepath: Path | str, relative_dir: Path | None = None
) -> None
Add a file to the object. The file will be added at to the files
attribute
with the filename as the key and the file data as the value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
Path | str
|
The path to the file. |
required |
relative_dir
|
Path | None
|
The directory to make the file relative to. Helpful when adding files from a subdirectory. |
None
|
Example
my_obj.add_file("path/to/file.txt")
print(my_obj.files)
# Output: {"file.txt": "file data"}
Source code in src/qcio/models/base_models.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
add_files
¶
add_files(
directory: StrOrPath,
recursive: bool = False,
exclude: list[str] | None = None,
) -> None
Add all files in a directory to the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
StrOrPath
|
The directory to add files from. |
required |
recursive
|
bool
|
Whether to recursively add files from subdirectories. |
False
|
exclude
|
list[str] | None
|
A list of filenames to exclude from the directory. |
None
|
Source code in src/qcio/models/base_models.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
save_files
¶
save_files(directory: StrOrPath = Path('.')) -> None
Write all files to the specified directory
Source code in src/qcio/models/base_models.py
311 312 313 314 315 316 317 318 319 320 |
|
qcio.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, ProgramArgs, 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 src/qcio/models/inputs.py
65 66 67 68 69 70 71 72 73 74 75 76 |
|
add_file
¶
add_file(
filepath: Path | str, relative_dir: Path | None = None
) -> None
Add a file to the object. The file will be added at to the files
attribute
with the filename as the key and the file data as the value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
Path | str
|
The path to the file. |
required |
relative_dir
|
Path | None
|
The directory to make the file relative to. Helpful when adding files from a subdirectory. |
None
|
Example
my_obj.add_file("path/to/file.txt")
print(my_obj.files)
# Output: {"file.txt": "file data"}
Source code in src/qcio/models/base_models.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
add_files
¶
add_files(
directory: StrOrPath,
recursive: bool = False,
exclude: list[str] | None = None,
) -> None
Add all files in a directory to the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
StrOrPath
|
The directory to add files from. |
required |
recursive
|
bool
|
Whether to recursively add files from subdirectories. |
False
|
exclude
|
list[str] | None
|
A list of filenames to exclude from the directory. |
None
|
Source code in src/qcio/models/base_models.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
save_files
¶
save_files(directory: StrOrPath = Path('.')) -> None
Write all files to the specified directory
Source code in src/qcio/models/base_models.py
311 312 313 314 315 316 317 318 319 320 |
|
qcio.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. |
add_file
¶
add_file(
filepath: Path | str, relative_dir: Path | None = None
) -> None
Add a file to the object. The file will be added at to the files
attribute
with the filename as the key and the file data as the value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
Path | str
|
The path to the file. |
required |
relative_dir
|
Path | None
|
The directory to make the file relative to. Helpful when adding files from a subdirectory. |
None
|
Example
my_obj.add_file("path/to/file.txt")
print(my_obj.files)
# Output: {"file.txt": "file data"}
Source code in src/qcio/models/base_models.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
add_files
¶
add_files(
directory: StrOrPath,
recursive: bool = False,
exclude: list[str] | None = None,
) -> None
Add all files in a directory to the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
StrOrPath
|
The directory to add files from. |
required |
recursive
|
bool
|
Whether to recursively add files from subdirectories. |
False
|
exclude
|
list[str] | None
|
A list of filenames to exclude from the directory. |
None
|
Source code in src/qcio/models/base_models.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
save_files
¶
save_files(directory: StrOrPath = Path('.')) -> None
Write all files to the specified directory
Source code in src/qcio/models/base_models.py
311 312 313 314 315 316 317 318 319 320 |
|
from_directory
classmethod
¶
from_directory(directory: Path | str, **kwargs) -> Self
Create a new FileInput and collect all files in the directory.
Source code in src/qcio/models/inputs.py
37 38 39 40 41 42 43 |
|
qcio.ProgramArgs
¶
Core arguments for a calculation without a calctype or structure.
This class is used by DualProgramInput
or multi-step calculations to
specify subprogram_args
or basic program arguments for a 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. |
add_file
¶
add_file(
filepath: Path | str, relative_dir: Path | None = None
) -> None
Add a file to the object. The file will be added at to the files
attribute
with the filename as the key and the file data as the value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
Path | str
|
The path to the file. |
required |
relative_dir
|
Path | None
|
The directory to make the file relative to. Helpful when adding files from a subdirectory. |
None
|
Example
my_obj.add_file("path/to/file.txt")
print(my_obj.files)
# Output: {"file.txt": "file data"}
Source code in src/qcio/models/base_models.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
add_files
¶
add_files(
directory: StrOrPath,
recursive: bool = False,
exclude: list[str] | None = None,
) -> None
Add all files in a directory to the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
StrOrPath
|
The directory to add files from. |
required |
recursive
|
bool
|
Whether to recursively add files from subdirectories. |
False
|
exclude
|
list[str] | None
|
A list of filenames to exclude from the directory. |
None
|
Source code in src/qcio/models/base_models.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
save_files
¶
save_files(directory: StrOrPath = Path('.')) -> None
Write all files to the specified directory
Source code in src/qcio/models/base_models.py
311 312 313 314 315 316 317 318 319 320 |
|