Package: qcio
Quantum Chemistry I/OBeautiful and user friendly data structures for quantum chemistry.Inspired byQCElemental. Built for consistency and rapid development.qcioworks in harmony with a suite of other quantum chemistry tools for fast, structured, and interoperable quantum chemistry.The QC Suite of Programsqcio- Beautiful and user friendly data structures for quantum chemistry.qcparse- A library for efficient parsing of quantum chemistry data into structuredqcioobjects.qcop- A package for operating quantum chemistry programs usingqciostandardized data structures. Compatible withTeraChem,psi4,QChem,NWChem,ORCA,Molpro,geomeTRICand many more.BigChem- A distributed application for running quantum chemistry calculations at scale across clusters of computers or the cloud. Bring multi-node scaling to your favorite quantum chemistry program.ChemCloud- Aweb applicationand associatedPython clientfor exposing a BigChem cluster securely over the internet.InstallationpipinstallqcioQuickstartqciois built around a simple mental model:Inputobjects are used to define inputs for a quantum chemistry program, andOutputobjects are used to capture the outputs from a quantum chemistry program.Allqcioobjects can be serialized and saved to disk by calling.save("filename.json")and loaded from disk by calling.open("filename.json").qciosupportsjson,yaml, andtomlfile formats. Binary data will be automatically base64 encoded and decoded when saving and loading.Input ObjectsProgramInput - Core input object for a single QC program.fromqcioimportMolecule,ProgramInput# xyz files or saved Molecule objects can be opened from diskcaffeine=Molecule.open("caffeine.xyz")# Define the program inputprog_input=ProgramInput(molecule=caffeine,calctype="energy",keywords={"purify":"no","restricted":False},model={"method":"hf","basis":"sto-3g"},extras={"comment":"This is a comment"},# Anything extra not in the schema)# Binary or other files used as input can be addedprog_input.open_file("wfn.dat")prog_input.keywords["initial_guess"]="wfn.dat"# Save the input to disk in json, yaml, or toml formatprog_input.save("input.json")# Open the input from diskprog_input=ProgramInput.open("input.json")DualProgramInput - Input object for a workflow that uses multiple QC programs.DualProgramInputobjects can be used to power workflows that require multiple QC programs. For example, a geometry optimization workflow might usegeomeTRICto power the optimization and useterachemto compute the energies and gradients.fromqcioimportMolecule,DualProgramInput# xyz files or saved Molecule objects can be opened from diskcaffeine=Molecule.open("caffeine.xyz")# Define the program inputprog_input=DualProgramInput(molecule=caffeine,calctype="optimization",keywords={"maxiter":250},subprogram="terachem",subprogram_args={"model":{"method":"hf","basis":"sto-3g"},"keywords":{"purify":"no","restricted":False},},extras={"comment":"This is a comment"},# Anything extra not in the schema)FileInput - Input object for a QC programs using native file formats.qcioalso supports the native file formats of each QC program with aFileInputobject. Assume you have a directory like this with your input files forpsi4:psi4/
    input.dat
    geometry.xyz
    wfn.datYou can collect these native files and any associated command line arguments needed to specify a calculation into aFileInputobject like this:fromqcioimportFileInputpsi4_input=FileInput.from_directory("psi4")# All input files will be loaded into the `files` attributepsi4_input.files# {'input.dat': '...', 'geometry.xyz': '...', 'wfn.dat': '...'}# Add psi4 command line args to the inputpsi4_input.cmdline_args.extend(["-n","4"])# Files can be dumped to a directory for a calculationpsi4_input.save_files("psi4")Modifying Input ObjectsObjects are immutable by default so if you want to modify an object cast it to a dictionary, make the desired modification, and then instantiate a new object. This prevents accidentally modifying objects that may already be referenced in other calculations--perhaps as.input_dataon anOutputobject.# Cast to a dictionary and modifynew_input_dict=prog_input.model_dumps()new_input_dict["model"]["method"]="b3lyp"# Instantiate a new objectnew_prog_input=ProgramInput(**new_input_dict)Output ObjectsSinglePointOutput and OptimizationOutputCurrently supportedOutputobjects includeSinglePointOutputfor energy, gradient, and hessian calculations; andOptimizationOutputfor optimization and transition state calculations. AllOutputobjects have the same basic API:output.input_data# Input data used by the QC programoutput.success# Whether the calculation succeededoutput.results# All structured results from the calculationoutput.stdout# Stdout log from the calculationoutput.pstdout# Shortcut to print out the stdout in human readable formatoutput.files# Any files returned by the calculationoutput.provenance# Provenance information about the calculationoutput.extras# Any extra information not in the schemaThe only difference between aSinglePointOutputand anOptimizationOutputis theresultsattribute.SinglePointOutputobjects have aSinglePointResultsobject, andOptimizationOutputobjects have anOptimizationResultsobject. Available attributes for each result type can be found by callingdir()on the object.dir(output.results)Results can be saved to disk in json, yaml, or toml format by calling.save("filename.{json/yaml/toml}")and loaded from disk by calling.open("filename.{json/yaml/toml}").ProgramFailureFailed calculations are represented by aProgramFailureobject. This object has the same API asOutputobjects but also has a.tracebackattribute that captures the stack trace.output.traceback# Stack trace from the failed calculationoutput.ptraceback# Shortcut to print out the traceback in human readable formatSupportIf you have any issues withqcioor would like to request a feature, please open anissue.