# 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/># --"""Gaussian Input Module."""fromtypingimportCallable,Optional,TextIOfrom..docstringsimportdocument_write_inputfrom..iodataimportIODatafrom..periodicimportnum2symfrom..utilsimportangstromfrom.commonimportwrite_input_base__all__=()default_template="""\#n {lot}/{obasis_name}{run_type}{title}{charge}{spinmult}{geometry}"""
[docs]defdefault_atom_line(data:IOData,iatom:int):"""Format atom line for Gaussian input."""symbol=num2sym[data.atnums[iatom]]atcoord=data.atcoords[iatom]/angstromreturnf"{symbol:3s}{atcoord[0]:10.6f}{atcoord[1]:10.6f}{atcoord[2]:10.6f}"
[docs]@document_write_input("GAUSSIAN",["atnums","atcoords"],["title","run_type","lot","obasis_name","spinmult","charge"],)defwrite_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 Gaussian-specific defaults and field names.iftemplateisNone:template=default_templateifatom_lineisNone:atom_line=default_atom_linegaussian_keywords={"energy":"sp","energy_force":"force","opt":"opt","scan":"scan","freq":"freq",}fields={"lot":data.lotor"hf","obasis_name":data.obasis_nameor"sto-3g","run_type":gaussian_keywords[(data.run_typeor"energy").lower()],}# User-specifield fields have priority, may overwrite default ones.fields.update(kwargs)write_input_base(fh,data,template,atom_line,fields)