Source code for CDTK.an_getHessian

#*  **************************************************************************
#*
#*  CDTK, Chemical Dynamics Toolkit
#*  A modular system for chemical dynamics applications and more
#*
#*  Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016
#*  Oriol Vendrell, DESY, <oriol.vendrell@desy.de>
#*
#*  Copyright (C) 2017, 2018, 2019
#*  Ralph Welsch, DESY, <ralph.welsch@desy.de>
#*
#*  Copyright (C) 2020, 2021, 2022, 2023
#*  Ludger Inhester, DESY, ludger.inhester@cfel.de
#*
#*  This file is part of CDTK.
#*
#*  CDTK 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.
#*
#*  This program 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/>.
#*
#*  **************************************************************************

import sys
from optparse import OptionParser

import numpy as np

import CDTK.Tools.Utils as uti
import CDTK.Interfaces.GamessUSInterface as gi

[docs] def start(): """ Wrapper for starting the program. Needed for good unit test coding. """ # -------------------------------------------------------------------------- # Parse command line options # -------------------------------------------------------------------------- parser=OptionParser() parser.add_option('-H','--hessian_file', dest='hessian_file', type='str', default=None, help='file with Hessian information') parser.add_option('-t','--file_type', dest='file_type', type='str', default='gamess', help='File type {gamess|...}') opts, args = parser.parse_args(sys.argv[1:]) if not sys.argv[1:]: # called without any option parser.print_help() sys.exit(0) # get hessian from interface and write to stdout if opts.file_type == 'gamess': H = gi.parse_hessian(opts.hessian_file) for hrow in H: for h in hrow: sys.stdout.write( ' {0: >16.12e}'.format(h) ) sys.stdout.write('\n')
if __name__ == "__main__": start()