Source code for iodata.inputs.orca

# IODATA is an input and output module for quantum chemistry.
# Copyright (C) 2011-2019 The IODATA Development Team
#
# This file is part of IODATA.
#
# IODATA is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# IODATA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
# --
"""Orca Input Module."""

from typing import Callable, Optional, TextIO

from ..docstrings import document_write_input
from ..iodata import IOData
from ..periodic import num2sym
from ..utils import angstrom
from .common import write_input_base

__all__ = ()


default_template = """\
! {lot} {obasis_name} {run_type}
# {title}
*xyz {charge} {spinmult}
{geometry}
*"""


[docs] def default_atom_line(data: IOData, iatom: int): """Format atom line for ORCA input.""" symbol = num2sym[data.atnums[iatom]] atcoord = data.atcoords[iatom] / angstrom return f"{symbol:3s} {atcoord[0]:10.6f} {atcoord[1]:10.6f} {atcoord[2]:10.6f}"
[docs] @document_write_input( "ORCA", ["atnums", "atcoords"], ["title", "run_type", "lot", "obasis_name", "spinmult", "charge"], ) def write_input( fh: TextIO, data: IOData, template: Optional[str] = None, atom_line: Optional[Callable] = None, **kwargs, ): """Do not edit this docstring. It will be overwritten.""" # Fill in some ORCA-specific defaults and field names. if template is None: template = default_template if atom_line is None: atom_line = default_atom_line orca_keywords = {"energy": "Energy", "freq": "Freq", "opt": "Opt"} # Set format-specific defaults. fields = { "lot": data.lot or "HF", "obasis_name": data.obasis_name or "STO-3G", "run_type": orca_keywords[(data.run_type or "energy").lower()], } # User-specifield fields have priority, may overwrite default ones. fields.update(kwargs) write_input_base(fh, data, template, atom_line, fields)