├── .gitignore ├── AUTHORS ├── INSTRUCTIONS ├── LICENSE ├── Makefile.am ├── Makefile.in ├── README.md ├── aclocal.m4 ├── autotoolize.sh ├── configure ├── configure.ac ├── doc ├── fcc_analyzer_PyQt5_man.pdf ├── fcc_analyzer_PyQt5_man.tex ├── fcc_analyzer_man.pdf ├── fcc_analyzer_man.tex ├── fcc_tools_man.pdf ├── fcc_tools_man.tex └── figs │ ├── butt_edit.jpg │ ├── butt_move.jpg │ ├── butt_save.jpg │ ├── butt_zoom.jpg │ ├── fcc_analyzer_screeshot.png │ └── fig_src │ └── fcc_analyzer_screeshot.xcf ├── fix_time_stamps.sh ├── generators ├── Makefile.am ├── Makefile.in ├── MakefileGen ├── Makefile_simple ├── gen_fcc_dipfile.f90 ├── gen_fcc_state.f90 └── get_git_version.sh ├── install-sh ├── missing ├── modules ├── alerts.f90 ├── constants.f90 ├── fcc_basics.f90 ├── io │ ├── cfour_manage.f90 │ ├── cp2k_manage.f90 │ ├── fcc_io.f90 │ ├── fcc_manage.f90 │ ├── gamess_manage.f90 │ ├── gaussian_manage.f90 │ ├── gmx_manage.f90 │ ├── gro_manage.f90 │ ├── molcas_manage.f90 │ ├── molcasgradient.f90 │ ├── molden_manage.f90 │ ├── molpro_manage.f90 │ ├── orca_manage.f90 │ ├── psi4_manage.f90 │ ├── qchem_manage.f90 │ └── turbomol_manage.f90 ├── line_preprocess.f90 ├── maths │ ├── MatrixMod_red.f90 │ ├── dft.f90 │ ├── fft.f90 │ ├── fftw.f90 │ ├── fftw3.f │ ├── general_math.f90 │ ├── matrix.f90 │ └── matrix_print.f90 ├── verbosity.f90 └── vibrational_analysis.f90 ├── postprocessing ├── Makefile.am ├── Makefile.in ├── addconvolution.f90 ├── addconvolution_RR.f90 ├── convolute_RR.f90 ├── excitation_RR.f90 ├── get_git_version.sh ├── reconvolute_TD.f90 └── reconvolute_TI.f90 ├── python ├── Makefile.am ├── Makefile.in ├── fcc_RRinspector_PyQt5.py ├── fcc_analyzer_PyQt5.py ├── get_git_version.sh └── sum_spectra.py ├── run_test.sh └── tests ├── HQ_gamess.out ├── HQ_gaussian.log ├── HQ_orca.hess ├── Makefile.am ├── Makefile.in ├── azabenz-ccl4-s2-neq-fr.fchk ├── azabenz-ccl4-s2-neq-fr.log ├── diacetylene.fchk ├── diacetylene.log ├── h2o_molpro.out ├── h2o_psi4.out ├── naphthol-s1_qchem.out ├── s-methyloxirane_gs_aug.out └── s0_mq-GP_edit.UnSym /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled objects 2 | *.o 3 | *.mod 4 | # Latex garbage 5 | *.aux 6 | *.backup 7 | *.log 8 | # Specific bins for this project 9 | src/generators/gen_fcc_state 10 | src/generators/gen_fcc_dipfile 11 | 12 | # python things (compiled objects and pyinstall files) 13 | *.pyc 14 | *.spec 15 | 16 | # Do not track tar files 17 | *.tar.gz 18 | 19 | # Makefiles generated by configure/make 20 | # are not needed (can be generate in-place) 21 | Makefile 22 | #Makefile.in 23 | #configure 24 | 25 | # Other configure things 26 | config.log 27 | config.status 28 | .dirstamp 29 | 30 | # Links generated by autools 31 | depcomp 32 | #install-sh 33 | #missing 34 | 35 | # m4 auxiliars 36 | #aclocal.m4 37 | autom4te.cache/ 38 | 39 | # Specific locations for this project 40 | src/test/ 41 | contribution_users/ 42 | python/app 43 | python/version_tag.py 44 | 45 | # Additional compilation files generated in-place 46 | version.f90 47 | 48 | # Other non-distributed things 49 | TODO 50 | 51 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Javier Cerezo 2 | Istituto di Chimica dei Composti Organometallici 3 | ICCOM-CNR UOS di Pisa 4 | Pisa (Italy) 5 | E-mail: 6 | j.cerezo@pi.iccom.cnr.it 7 | 8 | -------------------------------------------------------------------------------- /INSTRUCTIONS: -------------------------------------------------------------------------------- 1 | =============== 2 | 1) COMPILATION 3 | ================ 4 | 1.1. Prerequisites 5 | LAPACK: 6 | This packages uses lapack routines to perform matrix manipulations. 7 | The MKL version is also supported 8 | 9 | 1.2. Compilation instructions 10 | To compile, just type: 11 | 12 | ./configure [--with-mkl] [--prefix INSTALL_PATH] 13 | make 14 | 15 | The binary will be generated in src/generators 16 | 17 | To test the program, type: 18 | 19 | make test 20 | 21 | This will run all the tests in tests/ 22 | 23 | To move the binary to the installation path (e.g. set by 24 | ./configure --prefix=/PATH/TO/INSTALL/FOLDER), type 25 | 26 | make install 27 | 28 | ============= 29 | 2) USAGE 30 | ============ 31 | Provided gen_fcc_state and gen_fcc_dipfile are in your path, type 32 | 33 | gen_fcc_state -i input-file [-ft filetype] [-o state_file] [-h] 34 | 35 | gen_fcc_dipfile -i input-file [-ft filetype] [-o state_file] [-Si ] [-Sf ] [-noders] [-h] 36 | 37 | To know more about the supported filetypes, consult the help statements in: 38 | gen_fcc_state -h 39 | gen_fcc_dipfile -h 40 | 41 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = subdir-objects 2 | 3 | SUBDIRS = generators/ postprocessing/ tests/ python/ 4 | 5 | EXTRA_DIST = LICENSE INSTRUCTIONS AUTHORS modules run_test.sh doc tests/* 6 | 7 | .PHONY: test version.f90 8 | test: 9 | ./run_test.sh 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fcc_tools 2 | Tools to facilitate input generation and analysis of FCclasses (see http://www.pi.iccom.cnr.it/en/fcclasses) 3 | 4 | ## Includes: 5 | * Generation of inptut data: 6 | - `fcc_gen_state`: generate state_files and an initial template for the input file, from output of different QM programs (check `gen_fcc_state -h`) 7 | - `fcc_gen_dipfile`: generates eldip and magdip files from output of QM programs (check `fcc_gen_dipfile -h`) 8 | * Post-processing tools: 9 | - `reconvolute_TD` and `reconvolute_TI`: regenerate the spectrum with a new convolution scheme once the TI or TD calculation is done 10 | - `convolute_RR`: apply a convolution to the stick RR spectra produced by FCclasses3 11 | * Analysis GUIs: 12 | - `fcc_analyzer_PyQt5.py`: a GUI to analyze stick spectra from the output of a TI calculation (check documentation). Requires `python3` and packages `numpy` and `matplotlib` and `PyQt5`. The interface looks as scketched below. 13 | - `fcc_RRinspector_PyQt5.py`: a GUI for the inspection of vibrational RR spectra at different incident frequencies (i.e. inspect data from `RR_Spectra_2D.dat`) 14 | 15 | ![fcc_analyzer_screeshot](https://github.com/jcerezochem/fcc_tools/blob/master/doc/figs/fcc_analyzer_screeshot.png) 16 | 17 | 18 | ## Install 19 | Download the zip or git clone this repository. Then: 20 | 21 | 1. `./fix_time_stamps.sh` 22 | 23 | 2. `./configure --bindir INSTALLPATH` 24 | 25 | (where INSTALLPATH is the location where the binaries will be placed) 26 | 27 | 3. `make` 28 | 29 | If you have set an appropriate PATH for installation, also: 30 | 31 | 4. `make install` 32 | 33 | Otherwise, the programs are installed in src/generators 34 | 35 | -------------------------------------------------------------------------------- /autotoolize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script run ac tools, fix the configure script to handle MKL test properly and runs am with proper flags 3 | 4 | aclocal; autoconf; sed -i "s/-lmkl_intel/-lmkl_intel_lp64 -lmkl_sequential -lmkl_core/g" configure; automake -a --foreign 5 | 6 | 7 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # Process this file with autoconf to produce a configure script. 3 | 4 | AC_PREREQ([2.68]) 5 | AC_INIT([fcc_tools],[dev],[fabrizio.santoro@iccom.cnr.it]) 6 | AM_INIT_AUTOMAKE 7 | # AM_EXTRA_RECURSIVE_TARGETS([python-update-version python-standalone]) 8 | AC_LANG([Fortran]) 9 | 10 | ################################### 11 | # 12 | # COMPILER CHECKS 13 | # 14 | ################################### 15 | AC_LANG([Fortran]) 16 | 17 | #-------------- 18 | # Flags f77 19 | #-------------- 20 | # Prevent autoconf from adding flags automatically (e.g. -g) 21 | if test -z $FFLAGS; then 22 | # FFLAGS='-O2 -pg' 23 | # FFLAGS='-g -fbounds-check -pg' 24 | FFLAGS='-O3' 25 | # FFLAGS='-g -fcheck=all -fbounds-check' 26 | fi 27 | 28 | #-------------- 29 | # Flags f90 30 | #-------------- 31 | if test -z $FCFLAGS; then 32 | # FCFLAGS='-O2 -pg' 33 | # FCFLAGS='-g -fbounds-check -pg' 34 | FCFLAGS='-O3' 35 | # FCFLAGS='-g -fcheck=all -fbounds-check' # -ffpe-trap=zero,denormal' 36 | fi 37 | 38 | #-------------- 39 | # Set compiler 40 | #-------------- 41 | # FCFLAGS="$FCFLAGS -fopenmp" 42 | # FFLAGS="$FCFLAGS -fopenmp" 43 | AC_PROG_F77([ifort,gfortran]) 44 | # ifort compiler works, but gfortran does not! 45 | AC_PROG_FC([ifort,gfortran]) 46 | 47 | 48 | ######################### 49 | # 50 | # LIBRARY CHECKS 51 | # 52 | ######################### 53 | 54 | #-------------------------------- 55 | # MKL support (LAPACK and BLAS) 56 | #-------------------------------- 57 | AC_ARG_WITH([mkl], 58 | AS_HELP_STRING([--with-mkl], [Use Intel MKL library for lapak subroutines]), 59 | , 60 | [with_mkl=no]) 61 | 62 | AS_IF([test "x$with_mkl" = "xyes"], 63 | # Using macro: 64 | # AC_CHECK_LIB (library, function, [action-if-found], [action-if-not-found], [other-libraries]) 65 | # where we use the last (optional) argument [other-libraries] to enter the additional libs 66 | # needed to use mkl lapack. (Previously this was done post-processing the configure: not nice) 67 | [AC_CHECK_LIB([mkl_intel_lp64],[zsytrf], 68 | [LIBS="$LIBS -lmkl_intel_lp64 -lmkl_sequential -lmkl_core"], # default: add libraries to LIBS 69 | [AC_MSG_WARN([MKL library requested but not found (LAPACK)]);use_lapack=yes], 70 | [-lmkl_sequential -lmkl_core])], 71 | [use_lapack=yes]) 72 | 73 | AS_IF([test "x$with_mkl" = "xyes"], 74 | # Using macro: 75 | # AC_CHECK_LIB (library, function, [action-if-found], [action-if-not-found], [other-libraries]) 76 | # where we use the last (optional) argument [other-libraries] to enter the additional libs 77 | # needed to use mkl lapack. (Previously this was done post-processing the configure: not nice) 78 | [AC_CHECK_LIB([mkl_intel_lp64],[dgemm], 79 | [LIBS="$LIBS -lmkl_intel_lp64 -lmkl_sequential -lmkl_core"], # default: add libraries to LIBS 80 | [AC_MSG_WARN([MKL library requested but not found (BLAS)]);use_blas=yes], 81 | [-lmkl_sequential -lmkl_core])], 82 | [use_blas=yes]) 83 | 84 | 85 | #------------- 86 | # LAPACK 87 | #------------- 88 | AS_IF([test "x$use_lapack" = "xyes"], 89 | [AC_CHECK_LIB([lapack],[zsytrf], 90 | [have_lapack_funct=yes;LIBS="$LIBS -llapack"], 91 | [have_lapack_funct=no])], 92 | [have_lapack_funct=yes]) 93 | 94 | AS_IF([test "x$have_lapack_funct" != "xyes"], 95 | [AC_MSG_ERROR([No lapack library found])], 96 | [have_lapack_funct=no]) 97 | 98 | 99 | #------------- 100 | # BLAS 101 | #------------- 102 | AS_IF([test "x$use_blas" = "xyes"], 103 | [AC_CHECK_LIB([blas],[dgemm], 104 | [have_blas_funct=yes;LIBS="$LIBS -lblas"], 105 | [have_blas_funct=no])], 106 | [have_blas_funct=yes]) 107 | 108 | AS_IF([test "x$have_blas_funct" != "xyes"], 109 | [AC_MSG_ERROR([No blas library found])], 110 | [have_blas_funct=no]) 111 | 112 | 113 | #------------- 114 | # FFTW3 115 | #------------- 116 | AC_ARG_WITH([fftw], 117 | AS_HELP_STRING([--with-fftw], [Use the Fastes Fourier Transform in the West (FFTW)]), 118 | , 119 | [with_fftw=no;use_fftw=no]) 120 | # FFTW is mandatory since FFT is broken for the corrected DFT -> FT manipulation (to be resolved..) 121 | # with_fftw=yes 122 | 123 | AS_IF([test "x$with_fftw" = "xyes"], 124 | [AC_CHECK_LIB([fftw3],[dfftw_plan_dft_1d], 125 | [use_fftw=yes;LIBS="$LIBS -lfftw3"], 126 | [AC_MSG_ERROR([No fftw library found])])], 127 | [use_fftw=no]) 128 | #The WARNING instead of the error when FFT is fixed will be: 129 | # [AC_MSG_WARN([FFTW functionalities cannot be used]);use_fftw=no])], 130 | 131 | # Set conditional to be used by automake 132 | AM_CONDITIONAL([FFTW], [test x$use_fftw = xyes]) 133 | 134 | # # Checks for files in the distribution 135 | # AC_CHECK_FILE ([$srcdir/python/dist/fcc_analyzer] 136 | # [install_pythonbin="yes"] 137 | # [install_pythonbin="no"]) 138 | # AM_CONDITIONAL([INSTALL_PYTHONBIN], [test "$install_pythonbin" = "yes"]) 139 | 140 | 141 | 142 | AC_CONFIG_FILES([Makefile 143 | generators/Makefile 144 | postprocessing/Makefile 145 | python/Makefile 146 | tests/Makefile]) 147 | AC_OUTPUT 148 | 149 | -------------------------------------------------------------------------------- /doc/fcc_analyzer_PyQt5_man.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/fcc_analyzer_PyQt5_man.pdf -------------------------------------------------------------------------------- /doc/fcc_analyzer_PyQt5_man.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,11pt]{article} 2 | \usepackage[T1]{fontenc} 3 | 4 | %opening 5 | \title{\texttt{fcc\_analyzer\_PyQt5}\\ a GUI to visualize \fcc\ output} 6 | \date{\textsc{Version: 0.1}\\\today} 7 | \author{Javier Cerezo\\\href{mailto:javier.cerezo@uam.es}{\texttt{javier.cerezo@uam.es}}} 8 | 9 | % Margins 10 | \textheight 22.0cm \textwidth 14.7cm \oddsidemargin 1cm 11 | \evensidemargin 1cm \topmargin -0.25cm 12 | 13 | %Packages 14 | \usepackage{graphics} 15 | \usepackage[pdftex]{graphicx} 16 | 17 | \usepackage{amsmath} 18 | \usepackage{amssymb} 19 | \usepackage{color} 20 | \usepackage{xcolor} 21 | 22 | \usepackage{hyperref} 23 | % The following metadata will show up in the PDF properties 24 | \hypersetup{ 25 | colorlinks = true, 26 | urlcolor = blue, 27 | } 28 | 29 | 30 | \begin{document} 31 | \setlength{\parskip}{0.5em} 32 | \newcommand{\fcc}{$\mathcal{FC}$\textit{classes}} 33 | 34 | \maketitle 35 | 36 | \section{Description} 37 | \texttt{fcc\_analyzer\_PyQt5} is a graphical user interface (GUI) written in python3 and relying on the PyQt5 and matplotlib libraries. It reads the output from \fcc\ (for a TI calculation), namely fort.21/Assigments.dat (assignments) and either fort.22/Bin\_Spectrum.dat (spectral histogram) or fort.18 (final convoluted spectrum), and opens an interactive plot that facilitates the analysis of the transitions, the investigation of different broadening schemes (if fort.22/Bin\_Spectrum.dat is available) and the comparison with reference spectral data. 38 | 39 | \section{Installation} 40 | 41 | \subsection{Precompiled binary} 42 | System-specific binaries generated with \texttt{cx-Freeze} or \texttt{pyinstaller} may be available from the author upon request. 43 | 44 | \subsection{Python script} 45 | The source can be run directly as a python script from any computer architechture where a python interpreter is available. The python script is located in \texttt{src/}. \texttt{python} version 3 is required along with following modules (the minimum version tested is specified): 46 | 47 | \begin{itemize} 48 | \item \texttt{matplotlib} (version $\geq1.4.2$) 49 | \item \texttt{numpy} (version $\geq1.9.1$) 50 | \end{itemize} 51 | 52 | PyQt binding are also needed, as provided through the module PyQt5\footnote{A version relying on PyQt4 is also available but is deprecated and no loger mantained. It requires python 2.7.} 53 | 54 | \begin{itemize} 55 | \item \texttt{PyQt5} (version $\geq5.9.2$) 56 | \end{itemize} 57 | 58 | % \clearpage 59 | 60 | One of the most straightfoward methods to get a working python environment is through the \href{http://conda.pydata.org/docs/intro.html}{\texttt{conda}} package manager, which allows to install and manage different python versions easily. Among the advantages, it can be installed at the user folders/account not requiring admin (or root) privileges and it is available for different operating systems as a simple installer. A very suitable package for conda is miniconda, a light-weight version that can be downloaded from \href{https://docs.conda.io/en/latest/miniconda.html}{\texttt{https://docs.conda.io/en/latest/miniconda.html}}. 61 | 62 | Once installed, the required modules to run the \texttt{fcc\_analyzer\_PyQt5} script can be installed through the command line (under any of the supported operating systems) by simply typing:\\ 63 | 64 | \texttt{conda install pyqt numpy matplotlib python=3}\\ 65 | 66 | The user is refered to the oficial \texttt{conda} documentation for further details. 67 | 68 | % \clearpage 69 | 70 | \section{Running the application} 71 | 72 | \subsection{Launch the application} 73 | The application should be invoked in the folder were the fort.21 and either fort.22 or fort.18 files that will be analysed reside, using the following syntax from the command line:\\ 74 | 75 | \texttt{fcc\_analyzer\_PyQt5 [flags]}\\ 76 | 77 | If no fort.21 is found in the current directory, a dialog to set the path to the files will be opened (this is useful when the program is called by mouser-clicking, e.g. in Windows). The following optional flags can be used when called from the command line: 78 | 79 | \begin{tabular}{lll} 80 | \texttt{-type (abs|emi|ecd|cpl)} && \begin{minipage}[t]{0.65\textwidth} 81 | Type of {\fcc} calculation performed. 82 | \end{minipage}\\\\ 83 | \texttt{-maxC N} && \begin{minipage}[t]{0.65\textwidth} 84 | Maximum class to by loaded (\texttt{N}$\leq7$). 85 | \end{minipage}\\\\ 86 | \texttt{-h} && \begin{minipage}[t]{0.65\textwidth} 87 | Show help. 88 | \end{minipage}\\\\ 89 | \end{tabular} 90 | 91 | \clearpage 92 | 93 | \subsection{Using the application} 94 | The GUI consists of the following parts: 95 | 96 | \begin{figure}[h!] 97 | \begin{center} 98 | \includegraphics[width=15cm]{figs/fcc_analyzer_screeshot.png} 99 | \end{center} 100 | \caption{Screenshot of \texttt{fcc\_analyzer\_PyQt5} highlighting the different parts.} 101 | \end{figure} 102 | 103 | The interaction and analysis of the simulated spectrum are performed with the different widgets in the plot. Below, the different parts are described. 104 | 105 | \subsubsection{Menu Box} 106 | \begin{itemize} 107 | \item File 108 | \begin{itemize} 109 | \item Save plot: save plot to a png file. 110 | \item Export to xmgrace: export plot data (including labels) to xmgrace file. A export assistant is first raised to select how to organize the plots: 111 | \begin{itemize} 112 | \item Overlaid graphs: place the stick and spectra in different graphs, that are overlaid, as in the matplotlib plot. 113 | \item Same graph: include sticks and spectra in the same graph. The spectra are normalized to the maximum stick intensity. 114 | \end{itemize} 115 | 116 | \item Import plot: Load reference spectrum to the Spectrum Area. Units: (eV|cm$^{-1}$|nm). 117 | \item Quit: exit the application 118 | \end{itemize} 119 | 120 | \item Analyse 121 | \begin{itemize} 122 | \item Momenta: compute momenta of the convoluted and write to the Analysis Box. 123 | \end{itemize} 124 | 125 | \item Manipulate 126 | \begin{itemize} 127 | \item Shift to simulated: shift reference spectrum (if loaded) to match the convoluted spectrum. 128 | \item Scale to convoluted: scale reference spectrum (if loaded) to match the convoluted spectrum. 129 | \end{itemize} 130 | 131 | \item Help 132 | \begin{itemize} 133 | \item Instructions: show a short guide to use the application. 134 | \item About: show general info about the application. 135 | \end{itemize} 136 | \end{itemize} 137 | 138 | \subsubsection{Spectrum Area} 139 | This area is interactive. The following actions are possible: 140 | \begin{itemize} 141 | \item Right-mouse click on a stick: highlight and get info about the transition (written into Analysis Box). 142 | \item Left-mouse click on a stick: add label over the stick 143 | \item Right-mouse click on a label: drag the label 144 | \item Right-mouse click on a legend line: activate/deactivate plot 145 | \item Press ``+''/``-'' keys to browse back and forward between highlighted stick 146 | \end{itemize} 147 | 148 | \subsubsection{Analysis Box} 149 | In this box, the information about the highlighted transitions is shown, as well as the analysis of the momenta. This box is not editable, but the info can be copied. 150 | 151 | \subsubsection{Search Box} 152 | Selector of transitions. The general syntax is the following: 153 | 154 | { 155 | \scriptsize 156 | \texttt{Mode1'(Quanta1'),Mode2'(Quanta2')... {-}{-}> Mode1(Quanta1),Mode2(Quanta2)...} 157 | }\\ 158 | 159 | where \texttt{Mode1'(Quanta1')} refer to mode \texttt{Mode1'} in the initial state that is excited \texttt{Quanta1'} quanta, and \texttt{Mode1(Quanta1)} are the equivalent entities for the final state. 160 | 161 | The ground vibrational state is represented by a zero (\texttt{0}). When the initial state is in the ground state, the initial part, \texttt{0{-}{-}>} can be omitted. Some examples: 162 | 163 | \begin{itemize} 164 | \item \texttt{8(1),9(2)}: select the transition from the ground initial state to the final state where mode 8 is excited 1 quantum and mode 9 is excited 2 quanta. 165 | \item \texttt{0{-}{-}>8(1),9(2)}: same as above 166 | \item \texttt{8(1){-}{-}>0}: select transition from initial state excited 1 quantum on mode 8 to the final ground state. 167 | \item \texttt{0{-}{-}>0}: select 0-0 transition 168 | \end{itemize} 169 | 170 | To select a progression in the final state, use \texttt{P} instead of the number of quanta. This keyword can only be used for one mode in the same selection. Some examples: 171 | 172 | \begin{itemize} 173 | \item \texttt{8(p)}: select progression of mode 8 in the final state. 174 | \item \texttt{0{-}{-}>8(p),9(2)}: select progression of mode 8 in the final state when, simultaneously, mode 9 is excited 2 quanta. 175 | \item \texttt{1(1){-}{-}>8(p)}: select progression of mode 8 in the final state, starting from the initial state where mode 1 is excited one quantum. 176 | \end{itemize} 177 | 178 | \subsubsection{Plot Toolbar} 179 | This is formed by two check boxes and the standard matplotlib toolbar with PyQt5 back-end. The check boxes are: 180 | \begin{itemize} 181 | \item Fix y-axis: whether or not scale y-axis when the convolution or the data type are updated. 182 | \item Fix legend: whether the legend can be displaced with the mouse of not. 183 | \end{itemize} 184 | 185 | The matplotlib toolbar include: 186 | \begin{itemize} 187 | \item \includegraphics[width=0.5cm]{figs/butt_zoom.jpg}: zoom into (left mouse click) or out (right mouse click) a rectangle. 188 | \item \includegraphics[width=0.5cm]{figs/butt_move.jpg}: move the spectrum (left mouse click) or zoom (right mouse click). 189 | \item \includegraphics[width=0.5cm]{figs/butt_save.jpg}: export image. 190 | \item \includegraphics[width=0.5cm]{figs/butt_edit.jpg}: customize axes properties. 191 | \end{itemize} 192 | 193 | \subsubsection{Cleaning Buttons} 194 | \begin{itemize} 195 | \item Clean(Panel): remove highlight on transitions and clear the analysis box. 196 | \item Clean(Labels): clear all labels added to the spectrum 197 | \end{itemize} 198 | 199 | \subsubsection{Convolution Controls} 200 | These controls are only active if the fort.22 file is available. Note that this is not present for old versions of \fcc. 201 | \begin{itemize} 202 | \item Broadening selector [Gau|Lor]: type of broadening function 203 | \item HWHM slider and box: set the HWHM of the broadening function. The box is editable and allows a more precise selection of the value, even beyond the slider limits (0.01 to 0.1\,eV). 204 | \item Input bins check box: use the bins given in the input fort.22 file. Otherwise, a new histogram with only 1000 bins is used (which is faster). 205 | \end{itemize} 206 | 207 | \subsubsection{Data Type Selector} 208 | Select the type of spectrum: [Intensity|Lineshape]. 209 | 210 | \subsubsection{Ref. Spectrum Table} 211 | Information about the reference spectrum (loaded with File->Import plot). 212 | 213 | \begin{itemize} 214 | \item Loaded?: whether reference spectrum is loaded. If so the file name is shown. The red button with the cross deletes the reference spectrum. 215 | \item Shift(eV): shift applied to the reference spectrum (in eV). This box is editable. The value always refer to the originally loaded value, unless the blue T button is pressed, which resets the reference value to the current one. 216 | \item Y-scale: scaling applied to the reference spectrum Y-axis. This box is editable. The value always refer to the originally loaded value, unless the blue T button is pressed, which resets the reference value to the current one. 217 | \end{itemize} 218 | 219 | 220 | \end{document} 221 | -------------------------------------------------------------------------------- /doc/fcc_analyzer_man.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/fcc_analyzer_man.pdf -------------------------------------------------------------------------------- /doc/fcc_analyzer_man.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,11pt]{article} 2 | \usepackage[utf8]{inputenc} 3 | 4 | %opening 5 | \title{\texttt{fcc\_analyzer}: a tool to visualize \fcc\ output} 6 | \date{\textsc{Version: 0.2}\\\today} 7 | \author{Javier Cerezo\\\texttt{j.cerezo@pi.iccom.cnr.it}} 8 | 9 | % Margins 10 | \textheight 22.0cm \textwidth 14.7cm \oddsidemargin 1cm 11 | \evensidemargin 1cm \topmargin -0.25cm 12 | 13 | %Packages 14 | \usepackage{graphics} 15 | \usepackage[pdftex]{graphicx} 16 | 17 | \usepackage{amsmath} 18 | \usepackage{amssymb} 19 | \usepackage{color} 20 | \usepackage{xcolor} 21 | \usepackage{listings} 22 | \usepackage{courier} 23 | \lstset{ 24 | basicstyle=\footnotesize\ttfamily, % Standardschrift 25 | %numbers=left, % Ort der Zeilennummern 26 | numberstyle=\tiny, % Stil der Zeilennummern 27 | %stepnumber=2, % Abstand zwischen den Zeilennummern 28 | numbersep=5pt, % Abstand der Nummern zum Text 29 | tabsize=2, % Groesse von Tabs 30 | extendedchars=true, % 31 | breaklines=true, % Zeilen werden Umgebrochen 32 | keywordstyle=\color{red}, 33 | frame=b, 34 | % keywordstyle=[1]\textbf, % Stil der Keywords 35 | % keywordstyle=[2]\textbf, % 36 | % keywordstyle=[3]\textbf, % 37 | % keywordstyle=[4]\textbf, \sqrt{\sqrt{}} % 38 | stringstyle=\color{white}\ttfamily, % Farbe der String 39 | showspaces=false, % Leerzeichen anzeigen ? 40 | showtabs=false, % Tabs anzeigen ? 41 | xleftmargin=17pt, 42 | framexleftmargin=17pt, 43 | framexrightmargin=5pt, 44 | framexbottommargin=4pt, 45 | %backgroundcolor=\color{lightgray}, 46 | showstringspaces=false % Leerzeichen in Strings anzeigen ? 47 | } 48 | \lstloadlanguages{% Check Dokumentation for further languages ... 49 | %[Visual]Basic 50 | %Pascal 51 | %C 52 | %C++ 53 | %XML 54 | %HTML 55 | Java 56 | } 57 | %\DeclareCaptionFont{blue}{\color{blue}} 58 | 59 | %\captionsetup[lstlisting]{singlelinecheck=false, labelfont={blue}, textfont={blue}} 60 | \usepackage{caption} 61 | \DeclareCaptionFont{white}{\color{white}} 62 | \DeclareCaptionFormat{listing}{\colorbox[cmyk]{0.43, 0.35, 0.35,0.01}{\parbox{\textwidth}{\hspace{15pt}#1#2#3}}} 63 | \captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, singlelinecheck=false, margin=0pt, font={bf,footnotesize}} 64 | 65 | \begin{document} 66 | \newcommand{\fcc}{$\mathcal{FC}$\textit{classes}} 67 | 68 | \maketitle 69 | 70 | \section{Description} 71 | \texttt{fcc\_analyzer} is a python/matplotlib based tool that reads the output from \fcc\ (for a TI calculation), namely fort.21 (assignments) and fort.18 (spectrum), providing a graphical interface to get the assignments of the each individual transition. 72 | 73 | \section{Installation} 74 | 75 | \subsection{Local python installation} 76 | No installation is required, but a proper version of the python interpreter along with numpy and matplotlib modules is needed. The program was developed using the following version of each element: 77 | 78 | \begin{itemize} 79 | \item \texttt{python-2.7.5}\footnote{This program will \textbf{not} work with python-3.} 80 | \item \texttt{numpy-1.9.1} 81 | \item \texttt{matplotlib-1.4.2} 82 | \end{itemize} 83 | 84 | In most distributions, python-2.7 is already included (and is the default), but the modules numpy and matplotlib should be installed. Both modules are already available from Ubuntu or Fedora repositories (among many others), through either: 85 | 86 | \begin{minipage}{0.5\textwidth} 87 | \begin{lstlisting}[label=ubuntu_repo,caption=\texttt{matplotlib} from Ubuntu] 88 | apt-get install python-matplotlib 89 | \end{lstlisting} 90 | \end{minipage} 91 | \hspace*{0.1cm} 92 | \begin{minipage}{0.45\textwidth} 93 | \begin{lstlisting}[label=fedora_repo,caption=\texttt{matplotlib} from Fedora] 94 | yum install python-matplotlib 95 | \end{lstlisting} 96 | \end{minipage} 97 | 98 | However, these packaged versions might not be recent enough, and the script may behave wrongly\footnote{Attempts with \texttt{matplotlib-1.3.1} work, but with some capabilities disabled.}. Therefore, it is advisable to install them from the python setuptools (\texttt{pip}). Below, the installation steps followed in \textit{fresh}\footnote{Default installation plus the compilers (gcc, gfortran and g++).} Ubuntu 14.04 and Fedora 21 distributions are described. 99 | 100 | \begin{minipage}{0.46\textwidth} 101 | \begin{lstlisting}[label=ubuntu_install,caption=Installing \texttt{matplotlib} in Ubuntu 14.04.] 102 | #Install python-pip package 103 | apt-get install python-pip 104 | #Install python-dev package 105 | apt-get install python-dev 106 | #Install numpy 107 | pip install numpy 108 | #freetype and png required 109 | apt-get install libfreetype6-dev 110 | #Install matplotlib 111 | pip install matplotlib 112 | \end{lstlisting} 113 | \end{minipage} 114 | \hspace*{0.1cm} 115 | \begin{minipage}{0.46\textwidth} 116 | \begin{lstlisting}[label=fedora_install,caption=Installing \texttt{matplotlib} in Fedora 21.] 117 | #Install python-pip package 118 | yum install python-pip 119 | #Install python-devel package 120 | yum install python-devel 121 | #Install numpy 122 | pip install numpy 123 | #freetype and png required 124 | yum install freetype-devel 125 | #Install matplotlib 126 | pip install numpy 127 | \end{lstlisting} 128 | \end{minipage} 129 | 130 | After the above, you should have \texttt{matplotlib-1.4.2} (or above). If not, please, check the documentation of matplotlib, numpy and python in their respective websites. You can use \texttt{pip freeze} to see the version of all python modules installed. 131 | 132 | \subsection{Self-contained application} 133 | A binary produced with\\ 134 | \texttt{pyinstaller fcc\_analyzer.py --onefile}\\ is also provided. This contains, in principle, all python modules incorporated and 135 | would work on a machine without python installed. In practice, some dependencies make it not working for some cases, but one can give it a try. 136 | 137 | \section{Using \texttt{fcc\_analyzer}} 138 | After running a TI calculation with \fcc, and on the same folder, type (providing \texttt{fcc\_analyzer.py} is in your \texttt{PATH}): 139 | \vspace*{0.2cm} 140 | 141 | \texttt{fcc\_analyzer.py} 142 | \vspace*{0.2cm} 143 | 144 | \noindent This will open a \texttt{matplotlib} plot with all the transition divided by \textit{classes} (read from fort.21) and the final convoluted spectrum (read from fort.18). The following operations are possible: 145 | 146 | \subsection{Identifying transitions} 147 | \begin{itemize} 148 | \item \textbf{Right-mouse click over a transition}: show assignment of the highlighted transition. The rest of the info for this transition on fort.21 is shown on console. 149 | \item \textbf{Press \texttt{'+'} or \texttt{'-'}}: browse over the transitions, highlighting the following (\texttt{'+'}) or previous (\texttt{'-'}) one. 150 | \item \textbf{Left-mouse click over the legend items (classes)}: hide the class on the plot. 151 | \end{itemize} 152 | 153 | \subsection{Managing labels} 154 | \begin{itemize} 155 | \item \textbf{Left-mouse click over a transition}: place a label over the transition showing the final modes. 156 | \item \textbf{Right-mouse click over a label (and hold)}: move the label. The pointer line will follow the label. 157 | \item \textbf{Left-mouse click over a label}: erase the label 158 | \end{itemize} 159 | 160 | \subsection{Cleaning} 161 | \begin{itemize} 162 | \item \textbf{Right-mouse click over the plot title}: erase all labels and transition info. 163 | \item \textbf{Left-mouse click over a plot title}: erase transition info only. 164 | \end{itemize} 165 | 166 | \subsection{Using matplotlib backend functionalities\footnote{The availability of these options (and the aspect of the buttons) depends on the backend you are using for matplotlib. The ones shown here correspond to \textit{Qt4Agg} backend, which requires PyQt4 module (in Ubuntu and Fedora, it can be installed from the \texttt{python-qt4-dev} or \texttt{PyQt4-devel} packages.)}} 167 | \begin{itemize} 168 | \item \textbf{Press \texttt{'o'} or zoom button, \includegraphics[width=0.5cm]{figs/butt_zoom.jpg}}: zoom into (left mouse click) or out (right mouse click) a rectangle. 169 | \item \textbf{Press \texttt{'p'} or move button, \includegraphics[width=0.5cm]{figs/butt_move.jpg}}: move the spectrum (left mouse click) or zoom (right mouse click). 170 | \item \textbf{Press save button, \includegraphics[width=0.5cm]{figs/butt_save.jpg}}: export image. 171 | \item \textbf{Press edit button, \includegraphics[width=0.5cm]{figs/butt_edit.jpg}}: customize, among others, the plot title. 172 | \end{itemize} 173 | (Note: mouse-click interactions with the plot are not active in zoom or move modes). 174 | 175 | \subsection{Export plot to xmgrace} 176 | \begin{itemize} 177 | \item \textbf{Central-mouse click over the plot title}: this will create a xmgrace file called \texttt{fcc\_analyzer.agr}, containing the convoluted and stick spectra and the labels selected in the plot. The axis ranges are kept. Note that the resulting file starts with the grace version number, which may be different in your case. The version number can be obtained by running: 178 | 179 | \begin{minipage}{1.0\textwidth} 180 | \begin{lstlisting}[label=get_graceversion,caption=Getting \texttt{grace} version] 181 | xmgrace -version 2>/dev/null | grep Grace- | sed "s/\./0/" | sed "s/\.//" | sed "s/Grace-//" 182 | \end{lstlisting} 183 | \end{minipage} 184 | 185 | \end{itemize} 186 | 187 | \section{Error messages} 188 | 189 | \begin{itemize} 190 | \item \texttt{ERROR: Check 0-0 transition} 191 | 192 | The program could not read the intensity for the 0-0 transition on fort.21. In old \fcc\ versions, there was a bug on the format for this value on fort.21, and it is not printed if it is over 10. You have to insert it manually below \texttt{SPECTRUM} on the \texttt{0-0 TRANSITION} section of the file. The actual value can be taken from fort.8. 193 | \end{itemize} 194 | 195 | Any other error might be a result of a wrong input file (the sanity checks are generally performed). In case of getting an error with ``good'' output files, feel free to send my a mail to: \texttt{j.cerezo@pi.iccom.cnr.it} 196 | 197 | \end{document} 198 | -------------------------------------------------------------------------------- /doc/fcc_tools_man.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/fcc_tools_man.pdf -------------------------------------------------------------------------------- /doc/fcc_tools_man.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,11pt]{article} 2 | \usepackage[T1]{fontenc} 3 | 4 | %opening 5 | \title{\texttt{fcc\_tools}\\ a set of tools to facilitate input generation and analysis of FCclasses} 6 | \date{\textsc{Version: 0.1}\\\today} 7 | \author{Javier Cerezo\\\href{mailto:javier.cerezo@uam.es}{\texttt{javier.cerezo@uam.es}}} 8 | 9 | % Margins 10 | \textheight 22.0cm \textwidth 14.7cm \oddsidemargin 1cm 11 | \evensidemargin 1cm \topmargin -0.25cm 12 | 13 | %Packages 14 | \usepackage{graphics} 15 | \usepackage[pdftex]{graphicx} 16 | 17 | \usepackage{amsmath} 18 | \usepackage{amssymb} 19 | \usepackage{color} 20 | \usepackage{xcolor} 21 | 22 | \usepackage{hyperref} 23 | % The following metadata will show up in the PDF properties 24 | \hypersetup{ 25 | colorlinks = true, 26 | urlcolor = blue, 27 | } 28 | 29 | 30 | \begin{document} 31 | \setlength{\parskip}{0.5em} 32 | \newcommand{\fcc}{$\mathcal{FC}$\textit{classes}} 33 | \newcommand{\fccIII}{$\mathcal{FC}$\textit{classes3}} 34 | 35 | \maketitle 36 | 37 | \section{Description} 38 | \texttt{fcc\_tools} package provide programs to generate the required data files to run the code from the output of different QM progrms. It also includes some post-processing tools, e.g. to modifiy the broadening scheme, and for analysis. Note that the specific tool to analyze the transitions from TI calculations through a GUI has a specific documentation. 39 | 40 | \section{Installation} 41 | 42 | The code is compiled using the usual \texttt{./configure} and \texttt{Makefiles} scripts. 43 | 44 | % \clearpage 45 | 46 | \subsection{Tools to prepare data files} 47 | The code is provided along with a number of tools to facilitate the preparation of the data files (state, electric dipole...) from the output of a number of electronic structure codes. Codes to post-process the final spectra, allowing to change the broadening scheme without the need of re-running \fccIII\ are also provided. Finally, a GUI to analyze the transitions from a TI calculation is included. 48 | 49 | \subsubsection{\texttt{gen\_fcc\_state}} 50 | 51 | \begin{itemize} 52 | \item[] \textit{Description}: 53 | 54 | A code to generate state files (fcc format) from the output of different electronic structure codes, including Gaussian (fchk and log), Molpro, [Open]Molcas, Turbomol, Gamess, Psi4, Orca and QChem. Molecular Mechanics Hessian and gradients from Gromacs can also be used to build the state files. 55 | 56 | \item[] \textit{Usage}: The code is executed from the command-line: 57 | 58 | \texttt{gen\_fcc\_state -i [options]} 59 | 60 | Only the name of the file from which to read the data is mandatory, while the rest of the settings (i.e. state file name) are set automatically from the input base name. Other options, e.g., to read some specific data from different files, can also be set. A complete list of options can be printed to screen with \texttt{gen\_fcc\_state -h}. The options are summarized in the following table. 61 | 62 | \begin{tabular}{lll} 63 | Flag & Description \\\hline 64 | \texttt{-i} & File to read data from \\ 65 | \texttt{-fts} & Set file format \\ 66 | \texttt{-ih} & File to read Hessian from \\ 67 | \texttt{-fth} & Set file format (Hess) \\ 68 | \texttt{-ig} & File to read Gradient from \\ 69 | \texttt{-ftg} & Set file format (Grad) \\ 70 | \texttt{-ie} & File to read Energy from \\ 71 | \texttt{-fte} & Set file format (Ener) \\ 72 | \texttt{-im} & File to read Mass from \\ 73 | \texttt{-o} & File to write state to \\ 74 | \texttt{-filt} & Filter atoms for output \\ 75 | \texttt{-write-modes} & Print normal modes \\ 76 | \texttt{-h} & Print help\\ \hline 77 | \multicolumn{2}{c}{Old-\fcc\ specific options} \\\hline 78 | \texttt{-write-fcc2} & Write old \fcc\ files \\ 79 | \texttt{-ofcc2}& File to write old-style state to \\ 80 | \texttt{-om} & File to write masses to \\ 81 | \texttt{-force-real} & Turn real all imag freqs \\ 82 | \hline 83 | \end{tabular} 84 | 85 | 86 | \end{itemize} 87 | 88 | 89 | 90 | \subsubsection{\texttt{gen\_fcc\_dipfile}} 91 | 92 | \begin{itemize} 93 | \item[] \textit{Description}: 94 | 95 | A code to generate dipole files (\texttt{ELDIP\_FILE} and \texttt{MAGDIP\_FILE}) from the output of different electronic structure codes, including Gaussian (fchk and log), and Psi4. It can also generate \texttt{NAC\_FILE} (for Gaussian only). 96 | 97 | \item[] \textit{Usage}: 98 | 99 | The code is executed from the command-line: 100 | 101 | \texttt{gen\_fcc\_dipfile -i [options]} 102 | 103 | Only the name of the file from which to read the data is mandatory, while the rest of the settings are set automatically (e.g., output names generated from the input base name unless otherwise stated). Other options, e.g., to specify the initial and final states if different from those indicated in the data file, can also be set. A complete list of options can be printed to screen with \texttt{gen\_fcc\_dipfile -h}. The options are summarized in the following table. 104 | 105 | \begin{tabular}{lll} 106 | Flag & Description \\\hline 107 | \texttt{-i} & File to read data from \\ 108 | \texttt{-ft} & Set file format \\ 109 | \texttt{-Si} & Initial electronic state (root) \\ 110 | \texttt{-Sf} & Final electronic state (root) \\ 111 | \texttt{-oe} & File to write eldips to \\ 112 | \texttt{-om} & File to write magdips to \\ 113 | \texttt{-on} & File to write NACs to \\ 114 | \texttt{-filt} & Filter atoms for output \\ 115 | \texttt{-der} & Read and write tr dipole derivatives \\ 116 | \texttt{-nac} & Read and write NACs \\ 117 | \texttt{-h} & Print help\\ \hline 118 | \hline 119 | \end{tabular} 120 | 121 | 122 | \end{itemize} 123 | 124 | 125 | \subsection{Post-calculations tools} 126 | \subsubsection{\texttt{reconvolute\_TD}} 127 | 128 | \begin{itemize} 129 | \item[] \textit{Description}: 130 | 131 | A code to regenerate the spectrum from the correlation function re-adjusting the broadening function (type and width). 132 | 133 | \item[] \textit{Usage}: 134 | 135 | The code is executed from the command-line: 136 | 137 | \texttt{reconvolute\_TD -hwhm -fccout fcc.out} 138 | 139 | The code must be run on the folder where a TD spectrum calculation has been carried out with \fccIII. It uses some of the files generated in the run (namely \texttt{corr.dat}) along with information included in the output file (since \fccIII\ applies a shift to reduce the computational cost of the TD calculation). The name of the \fccIII\ output will be guessed as \texttt{fcc.out}, but it can be set, along with the value of the new HWHM. Other options, e.g. the type of broadening function, can also be specified. A complete list of options can be printed to screen with \texttt{reconvolute\_TD -h}. The options are summarized in the following table. 140 | 141 | \begin{tabular}{lll} 142 | Flag & Description \\\hline 143 | \texttt{-f} & File with correlation function \\ 144 | \texttt{-brd} & Type of broadening function (Gau,Lor,Voi) \\ 145 | \texttt{-hwhm} & Width as HWHM in eV \\ 146 | \texttt{-damp} & Add a damping function to avoid numerical issues \\ 147 | \texttt{-prop} & Property computed in the \fccIII\ run \\ 148 | \texttt{-Eshift}& Shift to be applied \\ 149 | \texttt{-fccout}& File to read shift from \\ 150 | \texttt{-h} & Print help\\ \hline 151 | \hline 152 | \end{tabular} 153 | 154 | \end{itemize} 155 | 156 | 157 | \subsubsection{\texttt{reconvolute\_TI}} 158 | 159 | \begin{itemize} 160 | \item[] \textit{Description}: 161 | 162 | A code to regenerate the spectrum from the binned spectrum re-adjusting the broadening function (type and width). 163 | 164 | \item[] \textit{Usage}: 165 | 166 | The code is executed from the command-line: 167 | 168 | \texttt{reconvolute\_TI -hwhm } 169 | 170 | The code must be run on the folder where a TI spectrum calculation has been carried out with \fccIII. It uses some of the files generated in the run (namely \texttt{Bin\_Spectrum.dat}). The value of the new HWHM is set from the command line. Other options, e.g. the type of broadening function, can also be specified. Note that this tool allows a Voight convolution of the data, which is not still available within the \fccIII\ code for TI calculations. A complete list of options can be printed to screen with \texttt{reconvolute\_TI -h}. The options are summarized in the following table. 171 | 172 | \begin{tabular}{lll} 173 | Flag & Description \\\hline 174 | \texttt{-f} & File with correlation function \\ 175 | \texttt{-brd} & Type of broadening function (Gau,Lor,Voi) \\ 176 | \texttt{-hwhm} & Width as HWHM in eV \\ 177 | \texttt{-prop} & Property computed in the \fccIII\ run \\ 178 | \texttt{-Eshift}& Shift to be applied \\ 179 | \texttt{-h} & Print help\\ \hline 180 | \hline 181 | \end{tabular} 182 | 183 | \end{itemize} 184 | 185 | 186 | \subsubsection{\texttt{convolute\_RR}} 187 | \label{S:convolute_RR} 188 | 189 | \begin{itemize} 190 | \item[] \textit{Description}: 191 | 192 | A code to generate the RR spectrum from the 1D or 2D file spectrum adjusting the broadening function (type and width). 193 | 194 | \item[] \textit{Usage}: 195 | 196 | The code is executed from the command-line: 197 | 198 | \texttt{convolute\_RR -type [1D|2D] -hwhm } 199 | 200 | The code must be run on the folder where a RR spectrum calculation has been carried out with \fccIII\ either TD or TI). It uses some of the files generated in the run, namely \texttt{RR\_Spectrum\_VertE.dat} (default for \texttt{-type 1D}) or \texttt{RR\_Spectrum\_2D.dat} (for \texttt{-type 2D}). The value of the new HWHM is set from the command line. When reading the 2D spectrum file, the incident frequency is given on input (\texttt{-wI} flag). The programs looks for the closest value from those included in the 2D file. Other options, e.g. the type of broadening function, can also be specified. A complete list of options can be printed to screen with \texttt{convolute\_RR -h}. The options are summarized in the following table. 201 | 202 | \begin{tabular}{lll} 203 | Flag & Description \\\hline 204 | \texttt{-f} & File with correlation function \\ 205 | \texttt{-brd} & Type of broadening function (Gau,Lor) \\ 206 | \texttt{-hwhm} & Width as HWHM in cm$^{-1}$ \\ 207 | \texttt{-resol}& Resolution of spectrum in cm$^{-1}$ \\ 208 | \texttt{-type} & Type of output file (1D or 2D) \\ 209 | \texttt{-wI} & Selected incident freq (for 2D) \\ 210 | \texttt{-h} & Print help\\ \hline 211 | \hline 212 | \end{tabular} 213 | 214 | \end{itemize} 215 | 216 | \subsection{Analysis tools} 217 | \subsubsection{\texttt{fcc\_analyzer\_PyQt5.py}} 218 | \begin{itemize} 219 | \item[] \textit{Description}: 220 | A graphical application to analyze the output of a TI calculation. Graphical interface is build with PyQt5 library. It is a single file script and requires Python3, with packages \texttt{numpy}, \texttt{matplotlib} and \texttt{PyQt5}. It includes the identification of the transitions in terms of the initial and final vibrational states, comparison with experiment or adjustment of the convolution. A brief description of the graphical elements is included in Figure \ref{F:fcc_analyzer}. For a detailed description of the capabilities of the code, consult the specific manual\footnote{\href{https://github.com/jcerezochem/fcc_tools/raw/master/doc/fcc_analyzer_PyQt5_man.pdf}{\texttt{https://github.com/jcerezochem/fcc\_tools/raw/master/doc/fcc\_analyzer\_PyQt5\_man.pdf}}}. The application supports OPA, EMI, ECD, CPL, MCD, TPA and TPCD spectroscopies. 221 | \end{itemize} 222 | 223 | 224 | \begin{figure}[h!] 225 | \begin{center} 226 | \includegraphics[width=15cm]{figs/fcc_analyzer_screeshot.png} 227 | \end{center} 228 | \caption{Screenshot of the GUI to analyze TI results.} 229 | \label{F:fcc_analyzer} 230 | \end{figure} 231 | 232 | \subsubsection{\texttt{fcc\_RRinspector\_PyQt5.py}} 233 | \begin{itemize} 234 | \item[] \textit{Description}: 235 | A graphical application visualize RR spectra, from \texttt{RR\_Spectrum\_2D.dat}. It allows to change the convolution of the RR spectrum (not the damping factor to compute the transtions polarizability) and the indicident frequency. 236 | \end{itemize} 237 | 238 | 239 | \end{document} 240 | -------------------------------------------------------------------------------- /doc/figs/butt_edit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/figs/butt_edit.jpg -------------------------------------------------------------------------------- /doc/figs/butt_move.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/figs/butt_move.jpg -------------------------------------------------------------------------------- /doc/figs/butt_save.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/figs/butt_save.jpg -------------------------------------------------------------------------------- /doc/figs/butt_zoom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/figs/butt_zoom.jpg -------------------------------------------------------------------------------- /doc/figs/fcc_analyzer_screeshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/figs/fcc_analyzer_screeshot.png -------------------------------------------------------------------------------- /doc/figs/fig_src/fcc_analyzer_screeshot.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcerezochem/fcc_tools/88b3dbcf70290a0dd2ab643b19bfbdc3cd9e6101/doc/figs/fig_src/fcc_analyzer_screeshot.xcf -------------------------------------------------------------------------------- /fix_time_stamps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | touch aclocal.m4 configure Makefile.in Makefile.am 4 | 5 | -------------------------------------------------------------------------------- /generators/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = subdir-objects 2 | 3 | bin_PROGRAMS = gen_fcc_state gen_fcc_dipfile 4 | 5 | gen_fcc_state_SOURCES = version.f90\ 6 | ../modules/verbosity.f90\ 7 | ../modules/constants.f90\ 8 | ../modules/alerts.f90\ 9 | ../modules/line_preprocess.f90\ 10 | ../modules/maths/MatrixMod_red.f90\ 11 | ../modules/fcc_basics.f90\ 12 | ../modules/vibrational_analysis.f90\ 13 | ../modules/io/gamess_manage.f90\ 14 | ../modules/io/gaussian_manage.f90\ 15 | ../modules/io/cfour_manage.f90\ 16 | ../modules/io/gmx_manage.f90\ 17 | ../modules/io/psi4_manage.f90\ 18 | ../modules/io/molcas_manage.f90\ 19 | ../modules/io/molden_manage.f90\ 20 | ../modules/io/molpro_manage.f90\ 21 | ../modules/io/turbomol_manage.f90\ 22 | ../modules/io/orca_manage.f90\ 23 | ../modules/io/qchem_manage.f90\ 24 | ../modules/io/fcc_manage.f90\ 25 | ../modules/io/cp2k_manage.f90\ 26 | ../modules/io/fcc_io.f90\ 27 | gen_fcc_state.f90 28 | 29 | gen_fcc_state_LDFLAGS = @LIBS@ 30 | 31 | gen_fcc_dipfile_SOURCES = version.f90\ 32 | ../modules/verbosity.f90\ 33 | ../modules/constants.f90\ 34 | ../modules/alerts.f90\ 35 | ../modules/line_preprocess.f90\ 36 | ../modules/maths/MatrixMod_red.f90\ 37 | ../modules/fcc_basics.f90\ 38 | ../modules/io/gamess_manage.f90\ 39 | ../modules/io/gaussian_manage.f90\ 40 | ../modules/io/cfour_manage.f90\ 41 | ../modules/io/gmx_manage.f90\ 42 | ../modules/io/psi4_manage.f90\ 43 | ../modules/io/molcas_manage.f90\ 44 | ../modules/io/molden_manage.f90\ 45 | ../modules/io/molpro_manage.f90\ 46 | ../modules/io/turbomol_manage.f90\ 47 | ../modules/io/orca_manage.f90\ 48 | ../modules/io/qchem_manage.f90\ 49 | ../modules/io/fcc_manage.f90\ 50 | ../modules/io/cp2k_manage.f90\ 51 | ../modules/vibrational_analysis.f90\ 52 | ../modules/io/fcc_io.f90\ 53 | gen_fcc_dipfile.f90 54 | 55 | gen_fcc_dipfile_LDFLAGS = @LIBS@ 56 | 57 | CLEANFILES=*.mod 58 | 59 | .PHONY: ../modules/line_preprocess.f90 ../modules/alerts.f90 ../modules/constants.f90 60 | 61 | # .PHONY: version.f90 62 | version.f90: get_git_version 63 | get_git_version: 64 | @bash ./get_git_version.sh $(FCFLAGS) $(LIBS) || echo "Reusing version file" 65 | 66 | 67 | -------------------------------------------------------------------------------- /generators/MakefileGen: -------------------------------------------------------------------------------- 1 | #ifort ../modules/constants_mod.f90 ../modules/MatrixMod_red.f90 ../modules/alerts.f90 ../modules/line_preprocess.f90 ../modules/fcc_tools_routines.f90 ../modules/gaussian_manage_lowlevel.f90 ../modules/vibrational_analysis.f90 test_freq.f90 -o test_freq -llapack 2 | 3 | FC = gfortran 4 | OBJECTS = constants_mod.o\ 5 | alerts.o\ 6 | MatrixMod_red.o\ 7 | line_preprocess.o\ 8 | fcc_basics.o\ 9 | gamess_manage.o\ 10 | gaussian_manage.o\ 11 | psi4_manage.o\ 12 | molcas_manage.o\ 13 | fcc_io.o\ 14 | vibrational_analysis.o\ 15 | gen_fcc_state.o 16 | LIBS=-llapack 17 | .PHONY:clean 18 | 19 | gen_fcc_state:$(OBJECTS) 20 | $(FC) $(OBJECTS) -o gen_fcc_state $(LIBS) 21 | 22 | gen_fcc_state.o:gen_fcc_state.f90 23 | $(FC) -c $< 24 | 25 | %.o : ../modules/%.f90 26 | $(FC) -c $< 27 | 28 | clean: 29 | rm $(OBJECTS) *mod 30 | 31 | -------------------------------------------------------------------------------- /generators/Makefile_simple: -------------------------------------------------------------------------------- 1 | #ifort ../modules/constants_mod.f90 ../modules/MatrixMod_red.f90 ../modules/alerts.f90 ../modules/line_preprocess.f90 ../modules/fcc_tools_routines.f90 ../modules/gaussian_manage_lowlevel.f90 ../modules/vibrational_analysis.f90 test_freq.f90 -o test_freq -llapack 2 | 3 | FC = gfortran 4 | OBJECTS = constants_mod.o\ 5 | alerts.o\ 6 | MatrixMod_red.o\ 7 | line_preprocess.o\ 8 | fcc_tools_routines.o\ 9 | gamess_manage.o\ 10 | gaussian_manage_lowlevel.o\ 11 | vibrational_analysis.o\ 12 | gen_fcc_state.o 13 | LIBS=-llapack 14 | .PHONY:clean 15 | 16 | gen_fcc_state:$(OBJECTS) 17 | $(FC) $(OBJECTS) -o gen_fcc_state $(LIBS) 18 | 19 | gen_fcc_state.o:gen_fcc_state.f90 20 | $(FC) -c $< 21 | 22 | %.o : ../modules/%.f90 23 | $(FC) -c $< 24 | 25 | clean: 26 | rm $(OBJECTS) *mod 27 | 28 | -------------------------------------------------------------------------------- /generators/get_git_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git show -s --format=%ci &>/dev/null 4 | not_git_repo=$? 5 | 6 | if (( $not_git_repo )); then 7 | 8 | if [ -e version.f90 ]; then 9 | echo "" 10 | echo "*************************************************" 11 | echo "Not git and version.f90 exists. Reusing it." 12 | echo "*************************************************" 13 | echo "" 14 | else 15 | cat < version.f90 16 | subroutine print_version(unt) 17 | 18 | integer,intent(in) :: unt 19 | 20 | write(unt,'(/,X,A)') "GIT VERSION INFO -- Not Available" 21 | write(unt,'(X,A,/)') " First config date: $(date)" 22 | 23 | return 24 | end subroutine 25 | EOF 26 | 27 | fi 28 | 29 | else 30 | 31 | git_hash=$(git describe --long --dirty --always) 32 | git_date=$(git show -s --format=%ci) 33 | user=$USER 34 | 35 | if [ -f version.f90 ]; then 36 | old_git_hash=$(grep "Commit id :" version.f90) 37 | old_git_hash=${old_git_hash##*Commit id : } 38 | old_git_hash=${old_git_hash%\"} 39 | else 40 | old_git_hash="" 41 | fi 42 | 43 | 44 | if [ "$old_git_hash" != "$git_hash" ]; then 45 | echo "" 46 | echo "*************************************************" 47 | echo "Git hash changed from previous compilation: " 48 | echo " Old: $old_git_hash" 49 | echo " New: $git_hash" 50 | echo " A new version.f90 file will be generated" 51 | echo "*************************************************" 52 | echo "" 53 | cat < version.f90 54 | subroutine print_version(unt) 55 | 56 | integer,intent(in) :: unt 57 | 58 | write(unt,'(/,X,A)') "GIT VERSION INFO" 59 | write(unt,'(X,A)') " Commit id : $git_hash" 60 | write(unt,'(X,A,/)') " Commit date: $git_date" 61 | 62 | return 63 | end subroutine 64 | EOF 65 | 66 | else 67 | echo "" 68 | echo "*************************************************" 69 | echo "Git hash did not change from previous compilation" 70 | echo "*************************************************" 71 | echo "" 72 | fi 73 | 74 | fi -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common wrapper for a few potentially missing GNU programs. 3 | 4 | scriptversion=2013-10-28.13; # UTC 5 | 6 | # Copyright (C) 1996-2014 Free Software Foundation, Inc. 7 | # Originally written by Fran,cois Pinard , 1996. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | if test $# -eq 0; then 28 | echo 1>&2 "Try '$0 --help' for more information" 29 | exit 1 30 | fi 31 | 32 | case $1 in 33 | 34 | --is-lightweight) 35 | # Used by our autoconf macros to check whether the available missing 36 | # script is modern enough. 37 | exit 0 38 | ;; 39 | 40 | --run) 41 | # Back-compat with the calling convention used by older automake. 42 | shift 43 | ;; 44 | 45 | -h|--h|--he|--hel|--help) 46 | echo "\ 47 | $0 [OPTION]... PROGRAM [ARGUMENT]... 48 | 49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50 | to PROGRAM being missing or too old. 51 | 52 | Options: 53 | -h, --help display this help and exit 54 | -v, --version output version information and exit 55 | 56 | Supported PROGRAM values: 57 | aclocal autoconf autoheader autom4te automake makeinfo 58 | bison yacc flex lex help2man 59 | 60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61 | 'g' are ignored when checking the name. 62 | 63 | Send bug reports to ." 64 | exit $? 65 | ;; 66 | 67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68 | echo "missing $scriptversion (GNU Automake)" 69 | exit $? 70 | ;; 71 | 72 | -*) 73 | echo 1>&2 "$0: unknown '$1' option" 74 | echo 1>&2 "Try '$0 --help' for more information" 75 | exit 1 76 | ;; 77 | 78 | esac 79 | 80 | # Run the given program, remember its exit status. 81 | "$@"; st=$? 82 | 83 | # If it succeeded, we are done. 84 | test $st -eq 0 && exit 0 85 | 86 | # Also exit now if we it failed (or wasn't found), and '--version' was 87 | # passed; such an option is passed most likely to detect whether the 88 | # program is present and works. 89 | case $2 in --version|--help) exit $st;; esac 90 | 91 | # Exit code 63 means version mismatch. This often happens when the user 92 | # tries to use an ancient version of a tool on a file that requires a 93 | # minimum version. 94 | if test $st -eq 63; then 95 | msg="probably too old" 96 | elif test $st -eq 127; then 97 | # Program was missing. 98 | msg="missing on your system" 99 | else 100 | # Program was found and executed, but failed. Give up. 101 | exit $st 102 | fi 103 | 104 | perl_URL=http://www.perl.org/ 105 | flex_URL=http://flex.sourceforge.net/ 106 | gnu_software_URL=http://www.gnu.org/software 107 | 108 | program_details () 109 | { 110 | case $1 in 111 | aclocal|automake) 112 | echo "The '$1' program is part of the GNU Automake package:" 113 | echo "<$gnu_software_URL/automake>" 114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115 | echo "<$gnu_software_URL/autoconf>" 116 | echo "<$gnu_software_URL/m4/>" 117 | echo "<$perl_URL>" 118 | ;; 119 | autoconf|autom4te|autoheader) 120 | echo "The '$1' program is part of the GNU Autoconf package:" 121 | echo "<$gnu_software_URL/autoconf/>" 122 | echo "It also requires GNU m4 and Perl in order to run:" 123 | echo "<$gnu_software_URL/m4/>" 124 | echo "<$perl_URL>" 125 | ;; 126 | esac 127 | } 128 | 129 | give_advice () 130 | { 131 | # Normalize program name to check for. 132 | normalized_program=`echo "$1" | sed ' 133 | s/^gnu-//; t 134 | s/^gnu//; t 135 | s/^g//; t'` 136 | 137 | printf '%s\n' "'$1' is $msg." 138 | 139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140 | case $normalized_program in 141 | autoconf*) 142 | echo "You should only need it if you modified 'configure.ac'," 143 | echo "or m4 files included by it." 144 | program_details 'autoconf' 145 | ;; 146 | autoheader*) 147 | echo "You should only need it if you modified 'acconfig.h' or" 148 | echo "$configure_deps." 149 | program_details 'autoheader' 150 | ;; 151 | automake*) 152 | echo "You should only need it if you modified 'Makefile.am' or" 153 | echo "$configure_deps." 154 | program_details 'automake' 155 | ;; 156 | aclocal*) 157 | echo "You should only need it if you modified 'acinclude.m4' or" 158 | echo "$configure_deps." 159 | program_details 'aclocal' 160 | ;; 161 | autom4te*) 162 | echo "You might have modified some maintainer files that require" 163 | echo "the 'autom4te' program to be rebuilt." 164 | program_details 'autom4te' 165 | ;; 166 | bison*|yacc*) 167 | echo "You should only need it if you modified a '.y' file." 168 | echo "You may want to install the GNU Bison package:" 169 | echo "<$gnu_software_URL/bison/>" 170 | ;; 171 | lex*|flex*) 172 | echo "You should only need it if you modified a '.l' file." 173 | echo "You may want to install the Fast Lexical Analyzer package:" 174 | echo "<$flex_URL>" 175 | ;; 176 | help2man*) 177 | echo "You should only need it if you modified a dependency" \ 178 | "of a man page." 179 | echo "You may want to install the GNU Help2man package:" 180 | echo "<$gnu_software_URL/help2man/>" 181 | ;; 182 | makeinfo*) 183 | echo "You should only need it if you modified a '.texi' file, or" 184 | echo "any other file indirectly affecting the aspect of the manual." 185 | echo "You might want to install the Texinfo package:" 186 | echo "<$gnu_software_URL/texinfo/>" 187 | echo "The spurious makeinfo call might also be the consequence of" 188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189 | echo "want to install GNU make:" 190 | echo "<$gnu_software_URL/make/>" 191 | ;; 192 | *) 193 | echo "You might have modified some files without having the proper" 194 | echo "tools for further handling them. Check the 'README' file, it" 195 | echo "often tells you about the needed prerequisites for installing" 196 | echo "this package. You may also peek at any GNU archive site, in" 197 | echo "case some other package contains this missing '$1' program." 198 | ;; 199 | esac 200 | } 201 | 202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \ 203 | -e '2,$s/^/ /' >&2 204 | 205 | # Propagate the correct exit status (expected to be 127 for a program 206 | # not found, 63 for a program that failed due to version mismatch). 207 | exit $st 208 | 209 | # Local variables: 210 | # eval: (add-hook 'write-file-hooks 'time-stamp) 211 | # time-stamp-start: "scriptversion=" 212 | # time-stamp-format: "%:y-%02m-%02d.%02H" 213 | # time-stamp-time-zone: "UTC" 214 | # time-stamp-end: "; # UTC" 215 | # End: 216 | -------------------------------------------------------------------------------- /modules/alerts.f90: -------------------------------------------------------------------------------- 1 | module alerts 2 | 3 | !============================================================== 4 | ! This code is part of MOLECULAR_TOOLS 5 | !============================================================== 6 | ! Description 7 | ! Subroutine to print out alert messages 8 | ! 9 | ! Dependences 10 | ! 11 | ! Notes 12 | ! 13 | ! History 14 | ! 2012/06/22 Messages output to stderr 15 | !----------------------------------------------------- 16 | 17 | !Global variables 18 | integer, save :: n_notes=0, & 19 | n_errors=0, & 20 | maxwarn 21 | 22 | contains 23 | 24 | subroutine alert_msg(attype,SENTENCE) 25 | 26 | implicit none 27 | 28 | common /ALERT_COUNT/ n_notes, n_errors 29 | 30 | character(len=*),intent(in):: attype, SENTENCE 31 | integer :: n_notes, n_errors 32 | 33 | select case (adjustl(attype)) 34 | case ("note") 35 | write(0,'(/,A,A,/)') "NOTE: ",SENTENCE 36 | n_notes = n_notes + 1 37 | 38 | !The following is deprecated (maintained for backward compatibility) 39 | case ("error") 40 | write(0,'(/,A,A,/)') "WARNING: ",SENTENCE 41 | n_errors = n_errors + 1 42 | 43 | case ("warning") 44 | write(0,'(/,A,A,/)') "WARNING: ",SENTENCE 45 | n_errors = n_errors + 1 46 | 47 | case ("fatal") 48 | write(0,'(/,A,/)') "============================================" 49 | write(0,'(A,A,/)') "FATAL ERROR: ",trim(SENTENCE) 50 | write(0,'(A)') "============================================" 51 | write(0,'(A,/)') "Exiting..." 52 | stop 1 53 | 54 | case default 55 | write(0,'(/,A,A,A,/)') attype," ", SENTENCE 56 | end select 57 | 58 | return 59 | 60 | end subroutine alert_msg 61 | 62 | end module alerts 63 | -------------------------------------------------------------------------------- /modules/io/cp2k_manage.f90: -------------------------------------------------------------------------------- 1 | module cp2k_manage 2 | 3 | !============================================================== 4 | ! This code is part of FCC_TOOLS 5 | !============================================================== 6 | ! Description 7 | ! This MODULE contains subroutines to get molecular information 8 | ! from GAMESS (out) files 9 | ! 10 | ! Notes 11 | ! All subroutines rewind the file after using it 12 | !============================================================== 13 | 14 | !Common declarations: 15 | !=================== 16 | use constants 17 | use line_preprocess 18 | implicit none 19 | 20 | contains 21 | 22 | subroutine read_cp2k_natoms(unt,Nat,error_flag) 23 | 24 | !============================================================== 25 | ! This code is part of FCC_TOOLS 26 | !============================================================== 27 | !Description 28 | ! Reads coordinates and atom names from GAMESS. The coordinates 29 | ! are retuned as a 3Nat vector 30 | 31 | !Description 32 | ! Get geometry and atom names from GAMESS. The number of atoms 33 | ! is also taken 34 | ! 35 | !Arguments 36 | ! unt (inp) int /scalar unit for the file 37 | ! Nat (out) int /scalar Number of atoms 38 | ! io_flag (io ) flag Error flag: 39 | ! 0 : Success 40 | ! -i : Read error on line i 41 | ! 42 | !Note 43 | ! Need to understand better the GAMESS output 44 | !============================================================== 45 | 46 | integer,intent(in) :: unt 47 | integer,intent(out) :: Nat 48 | integer,intent(out),optional :: error_flag 49 | 50 | !Local variables 51 | !============= 52 | character(len=240) :: line="" 53 | character :: cnull 54 | !I/O 55 | integer :: IOstatus 56 | !Counters 57 | integer :: i, ii 58 | 59 | ! Search section 60 | ii = 0 61 | do 62 | ii = ii + 1 63 | read(unt,'(A)',IOSTAT=IOstatus) line 64 | ! Two possible scenarios while reading: 65 | ! 1) End of file 66 | if ( IOstatus < 0 ) then 67 | error_flag = -ii 68 | rewind(unt) 69 | return 70 | endif 71 | ! 2) Found what looked for! 72 | if ( index(line," - Atoms:") /= 0 ) then 73 | exit 74 | endif 75 | enddo 76 | 77 | read(line,*) cnull, cnull, Nat 78 | 79 | rewind(unt) 80 | return 81 | 82 | end subroutine read_cp2k_natoms 83 | 84 | subroutine read_cp2k_geom(unt,Nat,AtName,X,Y,Z,error_flag) 85 | 86 | !============================================================== 87 | ! This code is part of FCC_TOOLS 88 | !============================================================== 89 | !Description 90 | ! Reads coordinates and atom names from GAMESS. The coordinates 91 | ! are retuned as a 3Nat vector 92 | 93 | !Description 94 | ! Get geometry and atom names from GAMESS. The number of atoms 95 | ! is also taken 96 | ! 97 | !Arguments 98 | ! unt (inp) int /scalar unit for the file 99 | ! Nat (inp) int /scalar Number of atoms 100 | ! AtName (out) char/vertor Atom names 101 | ! X,Y,Z (out) real/vectors Coordinate vectors (ANGSTRONG) 102 | ! io_flag (io ) flag Error flag: 103 | ! 0 : Success 104 | ! -i : Read error on line i 105 | ! 106 | !Note 107 | ! Need to understand better the GAMESS output 108 | !============================================================== 109 | 110 | integer,intent(in) :: unt 111 | integer,intent(in) :: Nat 112 | character(len=*), dimension(:), intent(out) :: AtName 113 | real(kind=8), dimension(:), intent(out) :: X,Y,Z 114 | integer,intent(out),optional :: error_flag 115 | 116 | !Local variables 117 | !============= 118 | character(len=240) :: line="" 119 | character :: cnull 120 | !I/O 121 | integer :: IOstatus 122 | !Counters 123 | integer :: i, ii 124 | 125 | 126 | print*, "No method to get geometry from CP2K output. You may use MOLDEN file instead." 127 | error_flag = -99 128 | 129 | rewind(unt) 130 | return 131 | 132 | end subroutine read_cp2k_geom 133 | 134 | subroutine read_cp2k_grad(unt,Nat,Grad,error_flag) 135 | !Description 136 | ! Reads gradient of atoms from CP2K engrad file 137 | !Arguments 138 | ! unt (inp) int /scalar unit for the file 139 | ! Nat (inp) int/scalar Number of atoms 140 | ! Grad (out) real/vector Gradient 141 | ! io_flag (io ) flag Error flag: 142 | ! 0 : Success 143 | ! -i : Read error on line i 144 | ! -1000000-i : Error in header 145 | !============================================================== 146 | integer,intent(in) :: unt 147 | integer,intent(in) :: Nat 148 | real(8),dimension(:),intent(out) :: Grad 149 | integer,intent(out),optional :: error_flag 150 | 151 | character(len=240) :: line="" 152 | integer :: IOstatus 153 | integer :: i, ii 154 | 155 | ii = 0 156 | do 157 | ii = ii + 1 158 | read(unt,'(A)',iostat=IOstatus) line 159 | if (IOStatus < 0) then 160 | error_flag = -ii 161 | rewind(unt) 162 | return 163 | endif 164 | if (adjustl(line) == "Minimum Structure - Energy and Forces:") then 165 | ii = ii + 1 166 | read(unt,*,iostat=IOstatus) line ! energy 167 | read(unt,*,iostat=IOstatus) line ! labels 168 | exit 169 | if (IOStatus < 0) then 170 | error_flag = -ii 171 | rewind(unt) 172 | return 173 | endif 174 | exit 175 | endif 176 | enddo 177 | 178 | read(unt,'(29X,3F17.9)') Grad(1:3*Nat) 179 | 180 | error_flag = 0 181 | rewind(unt) 182 | return 183 | end subroutine read_cp2k_grad 184 | 185 | subroutine read_cp2k_hess(unt,Nat,Hlt,error_flag) 186 | 187 | 188 | !============================================================== 189 | ! This code is part of FCC_TOOLS 190 | !============================================================== 191 | !Description 192 | ! Read Hessian from GAMESS output. Returs the triangular part of the 193 | ! Hessian matrix in AU 194 | ! 195 | !Arguments 196 | ! unt (inp) scalar unit for the file 197 | ! Nat (inp) scalar Number of atoms 198 | ! Hlt (out) vector Lower triangular part of Hessian matrix (AU) 199 | ! error_flag (out) scalar error_flag : 200 | ! 0 : Success 201 | ! -i : Read error on line i 202 | ! 2 : Wrong number of elements for Hlt 203 | ! Notes 204 | ! Using variable format as suggested in: 205 | ! http://stackoverflow.com/questions/9881186/fortran-output-format-dependent-on-a-variable 206 | ! (Answer by eriktous) 207 | !============================================================== 208 | 209 | integer,intent(in) :: unt 210 | integer,intent(in) :: Nat 211 | real(kind=8), dimension(:), intent(out) :: Hlt 212 | integer,intent(out),optional :: error_flag 213 | 214 | !Local stuff 215 | !============= 216 | character(len=240) :: line="" 217 | character(len=2) :: AtName 218 | character :: cnull 219 | integer :: N 220 | !I/O 221 | integer :: IOstatus 222 | character(len=100) :: fmt 223 | !Counters 224 | integer :: i, j, k, ii,jj, imax, imin, jmin, & 225 | ib, nblocks, nitems, icols 226 | !Auxiliar arrays 227 | real(kind=8),dimension(3*Nat,3*Nat) :: H 228 | real(kind=8),dimension(Nat) :: Mass 229 | 230 | 231 | !Use N to store 3*Nat 232 | N = 3*Nat 233 | 234 | ii = 0 235 | do 236 | ii = ii + 1 237 | read(unt,'(A)',iostat=IOstatus) line 238 | if (IOStatus < 0) then 239 | error_flag = -ii 240 | rewind(unt) 241 | return 242 | endif 243 | if (adjustl(line) == "Minimum Structure - Energy and Forces:") then 244 | ii = ii + 1 245 | read(unt,*,iostat=IOstatus) line ! energy 246 | read(unt,*,iostat=IOstatus) line ! labels 247 | exit 248 | if (IOStatus < 0) then 249 | error_flag = -ii 250 | rewind(unt) 251 | return 252 | endif 253 | exit 254 | endif 255 | enddo 256 | 257 | do i=1,Nat 258 | read(unt,*) cnull, AtName, cnull, cnull, cnull 259 | ii = atnum_from_atname(AtName) 260 | Mass(i) = atmass_from_atnum(ii) * AMUtoAU 261 | enddo 262 | rewind(unt) 263 | 264 | ! Search section 265 | ii = 0 266 | error_flag = 0 267 | do 268 | ii = ii + 1 269 | read(unt,'(A)',IOSTAT=IOstatus) line 270 | ! Two possible scenarios while reading: 271 | ! 1) End of file 272 | if ( IOstatus < 0 ) then 273 | error_flag = -ii 274 | rewind(unt) 275 | return 276 | endif 277 | ! 2) Found what looked for! 278 | if ( adjustl(line) == "VIB| Hessian in cartesian coordinates" ) then 279 | exit 280 | endif 281 | enddo 282 | 283 | !Organized in blocks, displaying 5 columns each 284 | nitems = 5 285 | nblocks = N/nitems 286 | if (nitems*nblocks /= N) nblocks=nblocks+1 287 | do ib=1,nblocks 288 | imin = (ib-1)*nitems + 1 289 | imax = ib *nitems 290 | imax=min(imax,N) 291 | icols = 1 + (imax-imin) 292 | write(fmt,'(a,i0,a)') '(12X,',icols,'F13.6)' 293 | !Pass headers 294 | read(unt,'(A)') line !blank 295 | read(unt,'(A)') line !index 296 | !Parse hessian elements 297 | read(unt,fmt) H(imin:imax,1:N) 298 | enddo 299 | 300 | !Unmassweight the Hessian 301 | ! By trial and error, we realized that the data in the file 302 | ! correspond to the Hessian in MWC (not simply Cartesian) 303 | k=0 304 | do i=1,3*Nat 305 | do j=1,i 306 | k=k+1 307 | ii = (i-1)/3+1 308 | jj = (j-1)/3+1 309 | ! Note we need to divide each element by 1e6 (just by trial and error) 310 | H(i,j) = H(i,j)*sqrt(Mass(ii)*Mass(jj)) / 1.d6 311 | H(j,i) = H(i,j) 312 | enddo 313 | enddo 314 | 315 | ! is all there (as for the read procedure) 316 | print*, "Symmetrizing C2PK Hessian" 317 | k = 0 318 | do i=1,N 319 | do j=1,i 320 | k = k + 1 321 | Hlt(k) = 0.5d0 * (H(j,i) + H(i,j)) 322 | enddo 323 | enddo 324 | if (k /= (N*(N+1)/2)) then 325 | error_flag = 2 326 | endif 327 | 328 | rewind(unt) 329 | return 330 | 331 | end subroutine read_cp2k_hess 332 | 333 | 334 | end module cp2k_manage 335 | 336 | -------------------------------------------------------------------------------- /modules/io/fcc_manage.f90: -------------------------------------------------------------------------------- 1 | module fcc_manage 2 | !23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012! 3 | 4 | !============================================================== 5 | ! This code is part of MOLECULAR_TOOLS 6 | !============================================================== 7 | ! Description 8 | ! This MODULE contains subroutines to get information from 9 | ! Gaussian log files. This is a med-low level module that 10 | ! only requires low-level subroutines (i.e. do not use 11 | ! structure_types module) 12 | ! 13 | ! Notes 14 | ! Only low level modules are required: line_preprocess and alerts. 15 | ! 16 | !============================================================== 17 | 18 | !Common declarations: 19 | !=================== 20 | use line_preprocess 21 | use alerts 22 | implicit none 23 | 24 | contains 25 | 26 | subroutine read_fcc_natoms(unt,Nat,error_flag) 27 | 28 | !============================================================== 29 | ! This code is part of FCC_TOOLS 30 | !============================================================== 31 | !Description 32 | ! Get geometry and atom names from xyz. The number of atoms 33 | ! is also taken 34 | ! 35 | !Arguments 36 | ! unt (inp) int /scalar unit for the file 37 | ! Nat (out) int /scalar Number of atoms 38 | ! 39 | !============================================================== 40 | 41 | integer,intent(in) :: unt 42 | integer,intent(out) :: Nat 43 | integer,intent(out),optional :: error_flag 44 | !Local 45 | integer :: IOstatus 46 | character(len=200) :: line 47 | character(len=50) :: section='GEOM', & 48 | section_full 49 | 50 | do 51 | read(unt,'(A)',IOSTAT=IOstatus) line 52 | ! Two possible scenarios while reading: 53 | ! 1) End of file 54 | if ( IOstatus < 0 ) then 55 | call alert_msg("warning","Section '"//trim(adjustl(section))//"' not present in the FCC file.") 56 | if (present(error_flag)) error_flag=1 57 | rewind(unt) 58 | return 59 | endif 60 | ! 2) Found what looked for! 61 | if ( INDEX(line,trim(adjustl(section))) /= 0 ) then 62 | read(line,'(A10)') section_full 63 | if (adjustl(section_full) == adjustl(section)) exit 64 | endif 65 | enddo 66 | 67 | read(unt,*) Nat 68 | 69 | return 70 | 71 | end subroutine read_fcc_natoms 72 | 73 | subroutine read_fcc_geom(unt,Nat,AtName,X,Y,Z,error_flag) 74 | 75 | !============================================================== 76 | ! This code is part of FCC_TOOLS 77 | !============================================================== 78 | !Description 79 | ! Get geometry and atom names from xyz. The number of atoms 80 | ! is also taken 81 | ! 82 | !Arguments 83 | ! unt (inp) int /scalar unit for the file 84 | ! Nat (out) int /scalar Number of atoms 85 | ! 86 | !============================================================== 87 | 88 | integer,intent(in) :: unt 89 | integer,intent(out) :: Nat 90 | real(kind=8),dimension(:),intent(out) :: X,Y,Z 91 | character(len=*),dimension(:),intent(out) :: AtName 92 | integer,intent(out),optional :: error_flag 93 | !Local 94 | integer :: i 95 | integer :: IOstatus 96 | character(len=200) :: line 97 | character(len=50) :: section='GEOM', & 98 | section_full 99 | character :: cnull 100 | 101 | do 102 | read(unt,'(A)',IOSTAT=IOstatus) line 103 | ! Two possible scenarios while reading: 104 | ! 1) End of file 105 | if ( IOstatus < 0 ) then 106 | call alert_msg("warning","Section '"//trim(adjustl(section))//"' not present in the FCC file.") 107 | if (present(error_flag)) error_flag=1 108 | rewind(unt) 109 | return 110 | endif 111 | ! 2) Found what looked for! 112 | if ( INDEX(line,trim(adjustl(section))) /= 0 ) then 113 | read(line,'(A10)') section_full 114 | if (adjustl(section_full) == adjustl(section)) exit 115 | endif 116 | enddo 117 | 118 | read(unt,*) Nat 119 | read(unt,*) cnull 120 | do i=1,Nat 121 | read(unt,*) AtName(i), X(i), Y(i), Z(i) 122 | enddo 123 | 124 | rewind(unt) 125 | 126 | return 127 | 128 | end subroutine read_fcc_geom 129 | 130 | subroutine read_fcc_grad(unt,Nat,Grad,error_flag) 131 | 132 | !============================================================== 133 | ! This code is part of FCC_TOOLS 134 | !============================================================== 135 | !Description 136 | ! Get geometry and atom names from xyz. The number of atoms 137 | ! is also taken 138 | ! 139 | !Arguments 140 | ! unt (inp) int /scalar unit for the file 141 | ! Nat (out) int /scalar Number of atoms 142 | ! 143 | !============================================================== 144 | 145 | integer,intent(in) :: unt 146 | integer,intent(in) :: Nat 147 | real(kind=8),dimension(:),intent(out) :: Grad 148 | integer,intent(out),optional :: error_flag 149 | !Local 150 | integer :: IOstatus 151 | character(len=200) :: line 152 | character(len=50) :: section='GRAD', & 153 | section_full 154 | character :: cnull 155 | 156 | do 157 | read(unt,'(A)',IOSTAT=IOstatus) line 158 | ! Two possible scenarios while reading: 159 | ! 1) End of file 160 | if ( IOstatus < 0 ) then 161 | call alert_msg("warning","Section '"//trim(adjustl(section))//"' not present in the FCC file.") 162 | if (present(error_flag)) error_flag=1 163 | rewind(unt) 164 | return 165 | endif 166 | ! 2) Found what looked for! 167 | if ( INDEX(line,trim(adjustl(section))) /= 0 ) then 168 | read(line,'(A10)') section_full 169 | if (adjustl(section_full) == adjustl(section)) exit 170 | endif 171 | enddo 172 | 173 | read(unt,*) Grad(1:3*Nat) 174 | 175 | rewind(unt) 176 | 177 | return 178 | 179 | end subroutine read_fcc_grad 180 | 181 | subroutine read_fcc_hess(unt,Nat,Hlt,error_flag) 182 | 183 | !============================================================== 184 | ! This code is part of FCC_TOOLS 185 | !============================================================== 186 | !Description 187 | ! Get geometry and atom names from xyz. The number of atoms 188 | ! is also taken 189 | ! 190 | !Arguments 191 | ! unt (inp) int /scalar unit for the file 192 | ! Nat (out) int /scalar Number of atoms 193 | ! 194 | !============================================================== 195 | 196 | integer,intent(in) :: unt 197 | integer,intent(in) :: Nat 198 | real(kind=8),dimension(:),intent(out) :: Hlt 199 | integer,intent(out),optional :: error_flag 200 | !Local 201 | integer :: IOstatus 202 | character(len=200) :: line 203 | character(len=50) :: section='HESS', & 204 | section_full 205 | character :: cnull 206 | 207 | do 208 | read(unt,'(A)',IOSTAT=IOstatus) line 209 | ! Two possible scenarios while reading: 210 | ! 1) End of file 211 | if ( IOstatus < 0 ) then 212 | call alert_msg("warning","Section '"//trim(adjustl(section))//"' not present in the FCC file.") 213 | if (present(error_flag)) error_flag=1 214 | rewind(unt) 215 | return 216 | endif 217 | ! 2) Found what looked for! 218 | if ( INDEX(line,trim(adjustl(section))) /= 0 ) then 219 | read(line,'(A10)') section_full 220 | if (adjustl(section_full) == adjustl(section)) exit 221 | endif 222 | enddo 223 | 224 | read(unt,*) Hlt(1:3*Nat*(3*Nat+1)/2) 225 | 226 | rewind(unt) 227 | 228 | return 229 | 230 | end subroutine read_fcc_hess 231 | 232 | subroutine read_state_geom(unt,Nat,GEO,Nvib,T,G) 233 | 234 | !==================================== 235 | ! Description 236 | ! ----------- 237 | ! Read geometry from the state files. 238 | !==================================== 239 | 240 | integer,intent(in) :: unt 241 | integer,intent(in) :: Nat 242 | real(8),dimension(:),intent(out) :: GEO 243 | integer,intent(in),optional :: Nvib 244 | real(8),dimension(:,:),intent(out),optional :: T 245 | real(8),dimension(:),intent(out),optional :: G 246 | !Local 247 | integer :: i, j, IOstatu 248 | 249 | read(unt,*,iostat=IOstatu) (GEO(i), i=1,3*Nat) 250 | if (IOstatu /= 0) then 251 | write(0,*) "ERROR: reading state file" 252 | stop 253 | endif 254 | 255 | if (present(T) .and. present(G)) then 256 | read(unt,*) ((T(i,j), j=1,Nvib), i=1,3*Nat) 257 | read(unt,*) (G(i), i=1,Nvib) 258 | endif 259 | 260 | return 261 | 262 | end subroutine read_state_geom 263 | 264 | end module fcc_manage -------------------------------------------------------------------------------- /modules/io/gamess_manage.f90: -------------------------------------------------------------------------------- 1 | module gamess_manage 2 | 3 | !============================================================== 4 | ! This code is part of FCC_TOOLS 5 | !============================================================== 6 | ! Description 7 | ! This MODULE contains subroutines to get molecular information 8 | ! from GAMESS (out) files 9 | ! 10 | ! Notes 11 | ! All subroutines rewind the file after using it 12 | !============================================================== 13 | 14 | !Common declarations: 15 | !=================== 16 | use constants 17 | use line_preprocess 18 | implicit none 19 | 20 | contains 21 | 22 | subroutine read_gamess_natoms(unt,Nat,error_flag) 23 | 24 | !============================================================== 25 | ! This code is part of FCC_TOOLS 26 | !============================================================== 27 | !Description 28 | ! Reads coordinates and atom names from GAMESS. The coordinates 29 | ! are retuned as a 3Nat vector 30 | 31 | !Description 32 | ! Get geometry and atom names from GAMESS. The number of atoms 33 | ! is also taken 34 | ! 35 | !Arguments 36 | ! unt (inp) int /scalar unit for the file 37 | ! Nat (out) int /scalar Number of atoms 38 | ! io_flag (io ) flag Error flag: 39 | ! 0 : Success 40 | ! -i : Read error on line i 41 | ! 42 | !Note 43 | ! Need to understand better the GAMESS output 44 | !============================================================== 45 | 46 | integer,intent(in) :: unt 47 | integer,intent(out) :: Nat 48 | integer,intent(out),optional :: error_flag 49 | 50 | !Local variables 51 | !============= 52 | character(len=240) :: line="" 53 | character :: cnull 54 | !I/O 55 | integer :: IOstatus 56 | !Counters 57 | integer :: i, ii 58 | 59 | ! Search section 60 | ii = 0 61 | do 62 | ii = ii + 1 63 | read(unt,'(A)',IOSTAT=IOstatus) line 64 | ! Two possible scenarios while reading: 65 | ! 1) End of file 66 | if ( IOstatus < 0 ) then 67 | error_flag = -ii 68 | rewind(unt) 69 | return 70 | endif 71 | ! 2) Found what looked for! 72 | if ( adjustl(line) == "ATOM ATOMIC COORDINATES (BOHR)" ) then 73 | read(unt,'(A)') line !part of the header 74 | exit 75 | endif 76 | enddo 77 | 78 | i=0 79 | do 80 | ii = ii + 1 81 | read(unt,'(A)',IOSTAT=IOstatus) line 82 | if ( IOstatus < 0 ) then 83 | error_flag = -ii 84 | rewind(unt) 85 | return 86 | endif 87 | !The geometry ends with a blank line 88 | if (len_trim(line) == 0 ) exit 89 | i=i+1 90 | enddo 91 | Nat=i 92 | 93 | rewind(unt) 94 | return 95 | 96 | end subroutine read_gamess_natoms 97 | 98 | subroutine read_gamess_geom(unt,Nat,AtName,X,Y,Z,error_flag) 99 | 100 | !============================================================== 101 | ! This code is part of FCC_TOOLS 102 | !============================================================== 103 | !Description 104 | ! Reads coordinates and atom names from GAMESS. The coordinates 105 | ! are retuned as a 3Nat vector 106 | 107 | !Description 108 | ! Get geometry and atom names from GAMESS. The number of atoms 109 | ! is also taken 110 | ! 111 | !Arguments 112 | ! unt (inp) int /scalar unit for the file 113 | ! Nat (out) int /scalar Number of atoms 114 | ! AtName (out) char/vertor Atom names 115 | ! X,Y,Z (out) real/vectors Coordinate vectors (ANGSTRONG) 116 | ! io_flag (io ) flag Error flag: 117 | ! 0 : Success 118 | ! -i : Read error on line i 119 | ! 120 | !Note 121 | ! Need to understand better the GAMESS output 122 | !============================================================== 123 | 124 | integer,intent(in) :: unt 125 | integer,intent(out) :: Nat 126 | character(len=*), dimension(:), intent(out) :: AtName 127 | real(kind=8), dimension(:), intent(out) :: X,Y,Z 128 | integer,intent(out),optional :: error_flag 129 | 130 | !Local variables 131 | !============= 132 | character(len=240) :: line="" 133 | character :: cnull 134 | !I/O 135 | integer :: IOstatus 136 | !Counters 137 | integer :: i, ii 138 | 139 | 140 | ! Search section 141 | ii = 0 142 | do 143 | ii = ii + 1 144 | read(unt,'(A)',IOSTAT=IOstatus) line 145 | ! Two possible scenarios while reading: 146 | ! 1) End of file 147 | if ( IOstatus < 0 ) then 148 | error_flag = -ii 149 | rewind(unt) 150 | return 151 | endif 152 | ! 2) Found what looked for! 153 | if ( adjustl(line) == "ATOM ATOMIC COORDINATES (BOHR)" ) then 154 | read(unt,'(A)') line !part of the header 155 | exit 156 | endif 157 | enddo 158 | 159 | i=0 160 | do 161 | ii = ii + 1 162 | read(unt,'(A)',IOSTAT=IOstatus) line 163 | if ( IOstatus < 0 ) then 164 | error_flag = -ii 165 | rewind(unt) 166 | return 167 | endif 168 | !The geometry ends with a blank line 169 | if (len_trim(line) == 0 ) exit 170 | i=i+1 171 | read(line,*) AtName(i), cnull, X(i), Y(i), Z(i) 172 | enddo 173 | Nat=i 174 | !Transform to AA 175 | X(1:Nat) = X(1:Nat)*BOHRtoANGS 176 | Y(1:Nat) = Y(1:Nat)*BOHRtoANGS 177 | Z(1:Nat) = Z(1:Nat)*BOHRtoANGS 178 | 179 | rewind(unt) 180 | return 181 | 182 | end subroutine read_gamess_geom 183 | 184 | subroutine read_gamess_hess(unt,Nat,Hlt,error_flag) 185 | 186 | 187 | !============================================================== 188 | ! This code is part of FCC_TOOLS 189 | !============================================================== 190 | !Description 191 | ! Read Hessian from GAMESS output. Returs the triangular part of the 192 | ! Hessian matrix in AU 193 | ! 194 | !Arguments 195 | ! unt (inp) scalar unit for the file 196 | ! Nat (inp) scalar Number of atoms 197 | ! Hlt (out) vector Lower triangular part of Hessian matrix (AU) 198 | ! error_flag (out) scalar error_flag : 199 | ! 0 : Success 200 | ! -i : Read error on line i 201 | ! 2 : Wrong number of elements for Hlt 202 | ! Notes 203 | ! Using variable format as suggested in: 204 | ! http://stackoverflow.com/questions/9881186/fortran-output-format-dependent-on-a-variable 205 | ! (Answer by eriktous) 206 | !============================================================== 207 | 208 | integer,intent(in) :: unt 209 | integer,intent(in) :: Nat 210 | real(kind=8), dimension(:), intent(out) :: Hlt 211 | integer,intent(out),optional :: error_flag 212 | 213 | !Local stuff 214 | !============= 215 | character(len=240) :: line="" 216 | integer :: N 217 | !I/O 218 | integer :: IOstatus 219 | character(len=100) :: fmt 220 | !Counters 221 | integer :: i, j, k, ii, imax, imin, jmin, & 222 | ib, nblocks, icols 223 | !Auxiliar arrays 224 | real(kind=8),dimension(3*Nat,3*Nat) :: Hpart 225 | 226 | 227 | !Use N to store 3*Nat 228 | N = 3*Nat 229 | 230 | ! Search section 231 | ii = 0 232 | error_flag = 0 233 | do 234 | ii = ii + 1 235 | read(unt,'(A)',IOSTAT=IOstatus) line 236 | ! Two possible scenarios while reading: 237 | ! 1) End of file 238 | if ( IOstatus < 0 ) then 239 | error_flag = -ii 240 | rewind(unt) 241 | return 242 | endif 243 | ! 2) Found what looked for! 244 | if ( adjustl(line) == "CARTESIAN FORCE CONSTANT MATRIX" ) then 245 | read(unt,*) line 246 | exit 247 | endif 248 | enddo 249 | 250 | !Organized in blocks, displaying 6 columns each (2atoms) 251 | nblocks = N/6 252 | if (6*nblocks /= N) nblocks=nblocks+1 253 | do ib=1,nblocks 254 | imin = (ib-1)*6 + 1 255 | imax = ib *6 256 | imax=min(imax,N) 257 | icols = 1 + (imax-imin) 258 | write(fmt,'(a,i0,a)') '(20X,',icols,'F9.6)' 259 | !Pass headers 260 | read(unt,'(A)') line !blank 261 | read(unt,'(A)') line !index 262 | read(unt,'(A)') line !atom names 263 | read(unt,'(A)') line !axis labels 264 | !Parse hessian elements 265 | read(unt,fmt) Hpart(imin:imax,imin:N) 266 | enddo 267 | 268 | !Hpart is incomplete, but the upper tringular part 269 | ! is all there (as for the read procedure) 270 | k = 0 271 | do i=1,N 272 | do j=1,i 273 | k = k + 1 274 | Hlt(k) = Hpart(j,i) 275 | enddo 276 | enddo 277 | if (k /= (N*(N+1)/2)) then 278 | error_flag = 2 279 | endif 280 | 281 | rewind(unt) 282 | return 283 | 284 | end subroutine read_gamess_hess 285 | 286 | 287 | end module gamess_manage 288 | 289 | -------------------------------------------------------------------------------- /modules/io/gmx_manage.f90: -------------------------------------------------------------------------------- 1 | module gmx_manage 2 | 3 | !============================================================== 4 | ! This code is part of FCC_TOOLS 5 | !============================================================== 6 | ! Description 7 | ! This MODULE contains subroutines to get molecular information 8 | ! from Psi4 out files 9 | ! 10 | ! Notes 11 | ! All subroutines rewind the file after using it 12 | !============================================================== 13 | 14 | !Common declarations: 15 | !=================== 16 | use constants 17 | use line_preprocess 18 | use alerts 19 | implicit none 20 | 21 | contains 22 | 23 | subroutine read_g96_natoms(unt,Nat) 24 | 25 | !============================================================== 26 | ! This code is part of FCC_TOOLS 27 | !============================================================== 28 | !Description 29 | ! Get geometry and atom names from xyz. The number of atoms 30 | ! is also taken 31 | ! 32 | !Arguments 33 | ! unt (inp) int /scalar unit for the file 34 | ! Nat (out) int /scalar Number of atoms 35 | ! 36 | !============================================================== 37 | 38 | integer,intent(in) :: unt 39 | integer,intent(out) :: Nat 40 | 41 | !local 42 | integer::i, natoms, ii, ios 43 | character(len=260) :: line 44 | !The use of get_structure=.false. fails probably due to 45 | ! memory issues (change without being directly accesed) 46 | logical :: not_get_structure=.true. 47 | 48 | !The file is organized in sections. Each begining with a given name 49 | do 50 | 51 | read(unt,'(A)',iostat=ios) line 52 | if (ios /= 0) exit 53 | 54 | if (adjustl(line) == "POSITION" ) then 55 | not_get_structure=.false. 56 | i=0 57 | do 58 | read(unt,'(A)') line 59 | if (adjustl(line) == "END" ) exit 60 | i = i + 1 61 | enddo 62 | Nat = i 63 | return 64 | elseif (adjustl(line) == "POSITIONRED" ) then 65 | !this section only has info about coordinates (no atom info!) 66 | write(0,*) "NOTE: No Atom Names in g96. Masses will not be assigned." 67 | not_get_structure=.false. 68 | i=0 69 | do 70 | read(unt,'(A)') line 71 | if (adjustl(line) == "END" ) exit 72 | enddo 73 | Nat = i 74 | return 75 | else 76 | cycle 77 | endif 78 | 79 | enddo 80 | 81 | if (not_get_structure) then 82 | write(0,*) "ERROR: No structure read in g96 file" 83 | stop 84 | endif 85 | 86 | return 87 | 88 | end subroutine read_g96_natoms 89 | 90 | 91 | 92 | subroutine read_g96_geom(unt,Nat,AtName,X,Y,Z) 93 | 94 | !============================================================== 95 | ! This code is part of FCC_TOOLS 96 | !============================================================== 97 | !Description 98 | ! Get geometry and atom names from xyz. The number of atoms 99 | ! is also taken 100 | ! 101 | !Arguments 102 | ! unt (inp) int /scalar unit for the file 103 | ! Nat (out) int /scalar Number of atoms 104 | ! AtName (out) char/vertor Atom names 105 | ! X,Y,Z (out) real/vectors Coordinate vectors (ANGSTRONG) 106 | ! 107 | !============================================================== 108 | 109 | integer,intent(in) :: unt 110 | integer,intent(out) :: Nat 111 | character(len=*), dimension(:), intent(out) :: AtName 112 | real(kind=8), dimension(:), intent(out) :: X,Y,Z 113 | !local 114 | integer::i, natoms, ii, ios 115 | character(len=260) :: line 116 | character :: dummy_char 117 | !The use of get_structure=.false. fails probably due to 118 | ! memory issues (change without being directly accesed) 119 | logical :: not_get_structure=.true. 120 | 121 | !The file is organized in sections. Each begining with a given name 122 | do 123 | 124 | read(unt,'(A)',iostat=ios) line 125 | if (ios /= 0) exit 126 | 127 | if (adjustl(line) == "POSITION" ) then 128 | not_get_structure=.false. 129 | i=0 130 | do 131 | read(unt,'(A)') line 132 | if (adjustl(line) == "END" ) exit 133 | i=i+1 134 | read(line,*) ii, & !resseq, & 135 | dummy_char, & !resname,& 136 | AtName(i), & 137 | ii, & !serial 138 | X(i), & 139 | Y(i), & 140 | Z(i) 141 | ! nm to \AA 142 | X(i) = X(i)*10.d0 143 | Y(i) = Y(i)*10.d0 144 | Z(i) = Z(i)*10.d0 145 | enddo 146 | Nat = i 147 | elseif (adjustl(line) == "POSITIONRED" ) then 148 | !this section only has info about coordinates (no atom info!) 149 | write(0,*) "NOTE: No Atom Names in g96. Masses will not be assigned." 150 | not_get_structure=.false. 151 | i=0 152 | do 153 | read(unt,'(A)') line 154 | if (adjustl(line) == "END" ) exit 155 | i=i+1 156 | read(line,*) X(i), & 157 | Y(i), & 158 | Z(i) 159 | ! nm to \AA 160 | X(i) = X(i)*10.d0 161 | Y(i) = Y(i)*10.d0 162 | Z(i) = Z(i)*10.d0 163 | enddo 164 | Nat = i 165 | else 166 | cycle 167 | endif 168 | 169 | enddo 170 | 171 | if (not_get_structure) then 172 | write(0,*) "ERROR: No structure read in g96 file" 173 | stop 174 | endif 175 | 176 | return 177 | 178 | end subroutine read_g96_geom 179 | 180 | 181 | subroutine write_g96_geom(unt,Nat,AtName,X,Y,Z,ResName) 182 | 183 | !============================================================== 184 | ! This code is part of FCC_TOOLS 185 | !============================================================== 186 | !Description 187 | ! Write geometry and atom names in g96. 188 | ! 189 | !Arguments 190 | ! unt (inp) int /scalar unit for the file 191 | ! Nat (inp) int /scalar Number of atoms 192 | ! AtName (inp) char/vertor Atom names 193 | ! ResName (inp) char/vertor Residue names (for each atom) 194 | ! X,Y,Z (inp) real/vectors Coordinate vectors (ANGSTROM) 195 | ! 196 | !============================================================== 197 | 198 | integer,intent(in) :: unt 199 | integer,intent(in) :: Nat 200 | character(len=*), dimension(:), intent(in) :: AtName, ResName 201 | real(kind=8), dimension(:), intent(in) :: X,Y,Z 202 | !local 203 | integer::i 204 | 205 | write(unt,'(A)') "TITLE" 206 | write(unt,'(A)') "Generated with gro_manage module " 207 | write(unt,'(A)') "END" 208 | 209 | write(unt,'(A)') "POSITION" 210 | do i=1,Nat 211 | 212 | write(unt,300) 1, & 213 | ResName(i), & 214 | AtName(i), & 215 | i, & !This is the serial number 216 | X(i)/10.d0, & 217 | Y(i)/10.d0, & 218 | Z(i)/10.d0 219 | 220 | enddo 221 | write(unt,'(A)') "END" 222 | 223 | write(unt,'(A)') "BOX" 224 | write(unt,301) 0., 0., 0. 225 | write(unt,'(A)') "END" 226 | 227 | return 228 | 229 | 300 format(i5,x,2(a5,x),x,i5,3f15.9,3f8.4) 230 | 301 format(3f15.9) 231 | 232 | end subroutine write_g96_geom 233 | 234 | 235 | subroutine read_gmx_grad(unt,Nat,Grad,error_flag) 236 | 237 | !============================================================== 238 | ! This code is part of FCC_TOOLS 239 | !============================================================== 240 | !Description 241 | ! Read Hessian from ascii file generated from an .mtx file (with gmxdump) 242 | ! 243 | ! 244 | !Arguments 245 | ! unt (inp) scalar unit for the file 246 | ! Nat (inp) scalar Number of atoms 247 | ! Hlt (out) vector Lower triangular part of Hessian matrix (AU) 248 | ! error_flag (out) scalar error_flag : 249 | ! 0 : Success 250 | ! 1: not square matrix 251 | ! 252 | !============================================================== 253 | 254 | integer,intent(in) :: unt 255 | integer,intent(in) :: Nat 256 | real(8), dimension(:), intent(out) :: Grad 257 | integer,intent(out) :: error_flag 258 | 259 | !Local stuff 260 | !============= 261 | character :: cnull 262 | !Counter 263 | integer :: N 264 | integer :: i, j 265 | 266 | read(unt,*) N 267 | if (N /= Nat) then 268 | write(0,*) "Incorrect Gradient dimension (gmx)" 269 | error_flag = 2 270 | stop 271 | endif 272 | 273 | !Read gradient 274 | do i=1,3*Nat,3 275 | read(unt,*) Grad(i:i+2) 276 | enddo 277 | 278 | ! UNIT CONVERSION ! GROMACS --> Atomic Units 279 | Grad(1:3*Nat)=Grad(1:3*Nat)/CALtoJ/HtoKCALM*BOHRtoNM ! KJ/mol * nm --> Hartree * bohr 280 | 281 | return 282 | 283 | end subroutine read_gmx_grad 284 | 285 | 286 | subroutine read_gmx_hess(unt,Nat,Hlt,error_flag) 287 | 288 | !============================================================== 289 | ! This code is part of FCC_TOOLS 290 | !============================================================== 291 | !Description 292 | ! Read Hessian from ascii file generated from an .mtx file (with gmxdump) 293 | ! 294 | ! 295 | !Arguments 296 | ! unt (inp) scalar unit for the file 297 | ! Nat (inp) scalar Number of atoms 298 | ! Hlt (out) vector Lower triangular part of Hessian matrix (AU) 299 | ! error_flag (out) scalar error_flag : 300 | ! 0 : Success 301 | ! 1: not square matrix 302 | ! 303 | !============================================================== 304 | 305 | integer,intent(in) :: unt 306 | integer,intent(in) :: Nat 307 | real(8), dimension(:), intent(out) :: Hlt 308 | integer,intent(out) :: error_flag 309 | 310 | !Local stuff 311 | !============= 312 | character :: cnull 313 | !Counter 314 | integer :: N,M 315 | integer :: i, j 316 | 317 | read(unt,'(A)') cnull 318 | read(unt,*) N, M 319 | if (N /= M) then 320 | write(0,*) "Hessian matrix is not square (gmx)" 321 | error_flag = 1 322 | stop 323 | else if (N /= 3*Nat) then 324 | write(0,*) "Incorrect Hessian dimension (gmx)" 325 | error_flag = 2 326 | stop 327 | endif 328 | 329 | !Read in triangular form 330 | j=1 331 | do i=1,3*Nat 332 | read(unt,*) Hlt(j:j+i-1) 333 | j=j+i 334 | enddo 335 | 336 | ! UNIT CONVERSION ! GROMACS --> Atomic Units 337 | Hlt(1:3*Nat*(3*Nat+1)/2)=Hlt(1:3*Nat*(3*Nat+1)/2)/CALtoJ/HtoKCALM*BOHRtoNM**2 ! KJ/mol * nm-2 --> Hartree * bohr-2 338 | 339 | return 340 | 341 | end subroutine read_gmx_hess 342 | 343 | 344 | end module gmx_manage 345 | -------------------------------------------------------------------------------- /modules/io/gro_manage.f90: -------------------------------------------------------------------------------- 1 | module gro_manage 2 | 3 | !============================================================== 4 | ! This code is part of FCC_TOOLS 5 | !============================================================== 6 | ! Description 7 | ! This MODULE contains subroutines to get molecular information 8 | ! from GROMACS files (gro, g96, Hessian mtx-dump) 9 | ! 10 | ! Notes 11 | ! All subroutines rewind the file after using it 12 | !============================================================== 13 | 14 | !Common declarations: 15 | !=================== 16 | use constants 17 | use line_preprocess 18 | implicit none 19 | 20 | contains 21 | 22 | subroutine read_gro_geom(unt,Nat,AtName,X,Y,Z,error_flag) 23 | 24 | !============================================================== 25 | ! This code is part of FCC_TOOLS 26 | !============================================================== 27 | !Description 28 | ! Reads coordinates and atom names from gro files 29 | ! 30 | !Description 31 | ! Get geometry and atom names from grom files. The number of atoms 32 | ! is also taken 33 | ! 34 | !Arguments 35 | ! unt (inp) int /scalar unit for the file 36 | ! Nat (out) int /scalar Number of atoms 37 | ! AtName (out) char/vertor Atom names 38 | ! X,Y,Z (out) real/vectors Coordinate vectors (ANGSTRONG) 39 | ! io_flag (io ) flag Error flag: 40 | ! 0 : Success 41 | ! 1 : Error 42 | ! 43 | !============================================================== 44 | 45 | integer,intent(in) :: unt 46 | integer,intent(out) :: Nat 47 | character(len=*), dimension(:), intent(out) :: AtName 48 | real(kind=8), dimension(:), intent(out) :: X,Y,Z 49 | integer,intent(out),optional :: error_flag 50 | 51 | !Local variables 52 | !============= 53 | character(len=240) :: line="" 54 | character :: cnull 55 | !I/O 56 | integer :: IOstatus 57 | !Counters 58 | integer :: i, ii 59 | 60 | 61 | read(unt,'(A)') cull !title 62 | read(unt,*) Nat 63 | 64 | error_flag=0 65 | 66 | do i=1,Nat 67 | 68 | read(unt,100,iostat=IOstatus) & 69 | ii, & !residue seq number 70 | cnull, & !residue name 71 | AtName(i), & 72 | !serial 73 | X(i), & 74 | Y(i), & 75 | Z(i) 76 | if (IOstatus /= 0) then 77 | error_flag=1 78 | rewind(unt) 79 | return 80 | endif 81 | enddo 82 | X(1:Nat)=X(1:Nat)*10.d0 83 | Y(1:Nat)=Y(1:Nat)*10.d0 84 | Z(1:Nat)=Z(1:Nat)*10.d0 85 | 86 | return 87 | !gro file format 88 | 100 format(i5,2a5,5X,3f8.3,3f8.4) !Serial is not read 89 | 90 | end subroutine read_gro_geom 91 | 92 | subroutine read_g96_geom(unt,Nat,AtName,X,Y,Z,error_flag) 93 | 94 | !============================================================== 95 | ! This code is part of FCC_TOOLS 96 | !============================================================== 97 | !Description 98 | ! Reads coordinates and atom names from gro files 99 | ! 100 | !Description 101 | ! Get geometry and atom names from grom files. The number of atoms 102 | ! is also taken 103 | ! 104 | !Arguments 105 | ! unt (inp) int /scalar unit for the file 106 | ! Nat (out) int /scalar Number of atoms 107 | ! AtName (out) char/vertor Atom names 108 | ! X,Y,Z (out) real/vectors Coordinate vectors (ANGSTRONG) 109 | ! io_flag (io ) flag Error flag: 110 | ! 0 : Success 111 | ! 1 : Success, but only geoms read (no AtNames) 112 | ! -1 : Error 113 | ! 114 | !============================================================== 115 | 116 | integer,intent(in) :: unt 117 | integer,intent(out) :: Nat 118 | character(len=*), dimension(:), intent(out) :: AtName 119 | real(kind=8), dimension(:), intent(out) :: X,Y,Z 120 | integer,intent(out),optional :: error_flag 121 | 122 | !Local variables 123 | !============= 124 | character(len=240) :: line="" 125 | character :: cnull 126 | !I/O 127 | integer :: IOstatus 128 | !Counters 129 | integer :: i, ii 130 | 131 | !The file is organized in sections. Each begining with a given name 132 | error_flag=-1 133 | do 134 | 135 | read(unt,*,iostat=ios) line 136 | if (ios /= 0) exit 137 | 138 | if (adjustl(line) == "POSITION" ) then 139 | error_flag=0 140 | i=0 141 | do 142 | read(unt,'(A)') line 143 | if (adjustl(line) == "END" ) exit 144 | i=i+1 145 | read(line,*) ii, & !resseq 146 | cnull, & !resname 147 | AtName, & 148 | ii, & !serial 149 | X(i), & 150 | Y(i), & 151 | Z(i) 152 | enddo 153 | Nat = i 154 | !Transform to AA 155 | X(1:Nat)=X(1:Nat)*10.d0 156 | X(1:Nat)=X(1:Nat)*10.d0 157 | X(1:Nat)=X(1:Nat)*10.d0 158 | elseif (adjustl(line) == "POSITIONRED" ) then 159 | !this section only has info about coordinates (no AtNames!) 160 | write(0,*) "NOTE: No atomic info in g96!" 161 | error_flag=1 162 | i=0 163 | do 164 | read(unt,'(A)') line 165 | if (adjustl(line) == "END" ) exit 166 | i=i+1 167 | read(line,*) X(i), & 168 | Y(i), & 169 | X(i) 170 | enddo 171 | Nat = i 172 | !Transform to AA 173 | X(1:Nat)=X(1:Nat)*10.d0 174 | X(1:Nat)=X(1:Nat)*10.d0 175 | X(1:Nat)=X(1:Nat)*10.d0 176 | else 177 | cycle 178 | endif 179 | 180 | enddo 181 | 182 | if (error_flag==-1) then 183 | write(0,*) "ERROR: No structure read in g96 file" 184 | stop 185 | endif 186 | 187 | return 188 | 189 | end subroutine read_g96_geom 190 | 191 | 192 | subroutine read_gmx_hess(unt,N,Hess,error) 193 | 194 | !Description 195 | ! Read Hessian from ascii file generated from an .mtx file (with gmxdump) 196 | ! 197 | ! Error codes: 198 | ! 1: not square matrix 199 | 200 | integer,intent(in)::unt 201 | real(8),dimension(:,:),intent(out)::Hess 202 | integer,intent(out)::N 203 | integer,intent(out),optional :: error_flag 204 | 205 | !local 206 | character :: cnull 207 | !Counter 208 | integer::i, j 209 | 210 | read(unt,'(A)') cnull 211 | read(unt,*) N, i 212 | if (N /= i) then 213 | error = 1 214 | return 215 | endif 216 | 217 | !Read in triangular form 218 | j=1 219 | do i=1,N 220 | read(unt,*) Hess(i,1:N) 221 | enddo 222 | 223 | ! UNIT CONVERSION ! GROMACS --> Atomic Units 224 | Hess(1:N,1:N)=Hess(1:N,1:N)/CALtoJ/HtoKCALM*BOHRtoNM**2 ! KJ/mol * nm-2 --> Hartree * bohr-2 225 | 226 | return 227 | 228 | end subroutine read_gmx_hess 229 | 230 | end module gro_manage 231 | -------------------------------------------------------------------------------- /modules/io/molcasgradient.f90: -------------------------------------------------------------------------------- 1 | program molcasgradient 2 | 3 | !============================================================== 4 | ! This code is part of FCC_TOOLS 5 | !============================================================== 6 | !Description 7 | ! Program to transform molcas gradient (including symmetry) 8 | ! into a more general (unsymmetrized) file 9 | ! 10 | !============================================================== 11 | 12 | use constants 13 | use line_preprocess 14 | use fcc_basics 15 | use fcc_io 16 | use vibrational_analysis 17 | 18 | implicit none 19 | 20 | !Molecular info 21 | integer :: Nat, Nvib 22 | real(8),dimension(:),allocatable :: X,Y,Z,Mass 23 | real(8),dimension(:),allocatable :: Hlt, Freq, Grad 24 | real(8),dimension(:,:),allocatable :: L 25 | 26 | ! Harmonic model PES 27 | character(len=3) :: model_PES='AH' 28 | 29 | !Additional info to prepare the input 30 | real(8) :: DE, T 31 | logical :: is_hessian = .true. 32 | 33 | !Auxiliars 34 | character :: cnull 35 | integer :: error 36 | integer,dimension(:),allocatable :: IAux 37 | !Counters 38 | integer :: i, j 39 | 40 | !I/O 41 | character(len=100) :: strfile='input.log', & 42 | hessfile='default',& 43 | gradfile='default',& 44 | massfile='none',& 45 | outfile='default', & 46 | outhess='default', & 47 | outmass='default' 48 | character(len=10) :: fts='guess', & 49 | fth='guess', & 50 | ftg='guess' 51 | integer :: ios 52 | integer :: I_INP = 11, & 53 | I_HES = 12, & 54 | I_GRD = 14, & 55 | I_MAS = 13, & 56 | O_STA = 20, & 57 | O_FCI = 21, & 58 | O_HES = 22, & 59 | O_MAS = 23 60 | 61 | ! Read options 62 | call parse_input(strfile,fts,hessfile,fth,gradfile,ftg,massfile,outfile,outhess,outmass,model_pes) 63 | call set_word_upper_case(model_pes) 64 | 65 | !Open input file 66 | open(I_INP,file=strfile,iostat=ios) 67 | if (ios /= 0) then 68 | print*, "Error opening "//trim(adjustl(strfile)) 69 | stop 70 | endif 71 | 72 | !Guess the file type if not given 73 | if (adjustl(fts) == 'guess') then 74 | call split_line_back(strfile,'.',cnull,fts) 75 | endif 76 | 77 | !Read input data: natoms 78 | call generic_natoms_reader(I_INP,fts,Nat,error) 79 | rewind(I_INP) 80 | 81 | !Allocate input data 82 | allocate(X(1:3*Nat),Y(1:3*Nat),Z(1:3*Nat),Mass(1:3*Nat)) 83 | allocate(Hlt(1:3*Nat*(3*Nat+1)/2)) 84 | if (adjustl(model_pes) == "VH") allocate (Grad(1:3*Nat)) 85 | !Allocate output data 86 | allocate(Freq(1:3*Nat)) 87 | allocate(L(1:3*Nat,1:3*Nat)) 88 | 89 | !Read structure 90 | print*, "Reading structure..." 91 | call generic_structure_reader(I_INP,fts,Nat,X,Y,Z,Mass,error) 92 | if (error /= 0) then 93 | print*, "Error reading the geometry", error 94 | stop 95 | endif 96 | 97 | if (adjustl(massfile) /= "none") then 98 | open(I_MAS,file=massfile) 99 | print*, " but masses read from external massfile: "//trim(adjustl(massfile)) 100 | do i=1,Nat 101 | read(I_MAS,*) Mass(i) 102 | enddo 103 | close(I_MAS) 104 | endif 105 | print*, " and writting masses to file..." 106 | open(O_MAS,file=outmass) 107 | do i=1,Nat 108 | write(O_MAS,*) Mass(i) 109 | enddo 110 | write(O_MAS,*) "" 111 | close(O_MAS) 112 | print'(X,A,/)', "OK" 113 | 114 | close(I_INP) 115 | 116 | ! We now read the allow to read the Hessian from another file 117 | !Guess the file type if not given 118 | if (adjustl(fth) == 'guess') then 119 | call split_line_back(hessfile,'.',cnull,fth) 120 | else if (adjustl(fth) == 'fts') then 121 | fth = fts 122 | endif 123 | if (adjustl(ftg) == 'guess') then 124 | call split_line_back(gradfile,'.',cnull,fth) 125 | else if (adjustl(ftg) == 'fth') then 126 | ftg = fth 127 | endif 128 | 129 | 130 | !Read Gradient for VH (for now assume same file as Hess) 131 | if (adjustl(model_pes) == "VH") then 132 | !Open gradient file 133 | open(I_GRD,file=gradfile,iostat=ios) 134 | if (ios /= 0) then 135 | print*, "Error opening "//trim(adjustl(gradfile)) 136 | stop 137 | endif 138 | print*, "Reading Gradient..." 139 | call generic_gradient_reader(I_HES,fth,Nat,Grad,error) 140 | if (error /= 0) then 141 | print'(X,A,/)', "Error: Gradient not present in the file." 142 | stop 143 | else 144 | print'(X,A,/)', "OK" 145 | endif 146 | endif 147 | 148 | 149 | 150 | 151 | stop 152 | 153 | contains 154 | 155 | subroutine parse_input(inpfile,ft) 156 | 157 | character(len=*),intent(inout) :: inpfile,ft 158 | 159 | ! Local 160 | logical :: argument_retrieved, & 161 | need_help = .false. 162 | integer:: i 163 | character(len=200) :: arg 164 | 165 | argument_retrieved=.false. 166 | do i=1,iargc() 167 | if (argument_retrieved) then 168 | argument_retrieved=.false. 169 | cycle 170 | endif 171 | call getarg(i, arg) 172 | select case (adjustl(arg)) 173 | case ("-i") 174 | call getarg(i+1, inpfile) 175 | argument_retrieved=.true. 176 | case ("-ft") !for backward compatibility 177 | call getarg(i+1, ft) 178 | argument_retrieved=.true. 179 | 180 | case ("-h") 181 | need_help=.true. 182 | 183 | case default 184 | print*, "Unkown command line argument: "//adjustl(arg) 185 | need_help = .true. 186 | end select 187 | enddo 188 | 189 | 190 | !Print options (to stderr) 191 | if (need_help) then 192 | 193 | print*, "No manual (for the moment)" 194 | 195 | stop 196 | endif 197 | 198 | return 199 | end subroutine parse_input 200 | 201 | end program molcasgradient 202 | 203 | -------------------------------------------------------------------------------- /modules/io/molden_manage.f90: -------------------------------------------------------------------------------- 1 | module molden_manage 2 | 3 | !============================================================== 4 | ! This code is part of FCC_TOOLS 5 | !============================================================== 6 | ! Description 7 | ! This MODULE contains subroutines to get molecular information 8 | ! from MOLCAS (out) files 9 | ! 10 | ! Notes 11 | ! All subroutines rewind the file after using it 12 | !============================================================== 13 | 14 | !Common declarations: 15 | !=================== 16 | use constants 17 | use line_preprocess 18 | implicit none 19 | 20 | contains 21 | 22 | subroutine read_molden_natoms(unt,Nat,error_flag) 23 | 24 | !============================================================== 25 | ! This code is part of FCC_TOOLS 26 | !============================================================== 27 | !Description 28 | ! Reads coordinates and atom names from MOLCAS. The coordinates 29 | ! are retuned as a 3Nat vector 30 | 31 | !Description 32 | ! Get geometry and atom names from MOLCAS. The number of atoms 33 | ! is also taken 34 | ! 35 | !Arguments 36 | ! unt (inp) int /scalar unit for the file 37 | ! Nat (out) int /scalar Number of atoms 38 | ! io_flag (io ) flag Error flag: 39 | ! 0 : Success 40 | ! -i : Read error on line i 41 | ! 42 | !Note 43 | ! Need to understand better the MOLCAS output 44 | !============================================================== 45 | 46 | integer,intent(in) :: unt 47 | integer,intent(out) :: Nat 48 | integer,intent(out) :: error_flag 49 | 50 | !Local variables 51 | !============= 52 | character(len=240) :: line="" 53 | character :: cnull 54 | !I/O 55 | integer :: IOstatus 56 | !Counters 57 | integer :: i, ii 58 | 59 | ! Search section 60 | ii = 0 61 | do 62 | ii = ii + 1 63 | read(unt,'(A)',IOSTAT=IOstatus) line 64 | ! Two possible scenarios while reading: 65 | ! 1) End of file 66 | if ( IOstatus < 0 ) then 67 | rewind(unt) 68 | exit 69 | endif 70 | ! 2) Found what looked for! 71 | if ( adjustl(line) == "[N_ATOMS]" ) then 72 | read(unt,*) Nat 73 | rewind(unt) 74 | return 75 | endif 76 | 77 | enddo 78 | 79 | ! If no [N_ATOMS], then search for [ATOMS] 80 | ! Search section 81 | print*, 'Trying again' 82 | ii = 0 83 | do 84 | ii = ii + 1 85 | read(unt,'(A)',IOSTAT=IOstatus) line 86 | call set_word_upper_case(line) 87 | ! Two possible scenarios while reading: 88 | ! 1) End of file 89 | if ( IOstatus < 0 ) then 90 | error_flag = -ii 91 | rewind(unt) 92 | return 93 | endif 94 | ! 2) Found what looked for! 95 | if ( index(line,"[ATOMS]") /= 0 ) then 96 | exit 97 | endif 98 | 99 | enddo 100 | i = 0 101 | do 102 | read(unt,'(A)',IOSTAT=IOstatus) line 103 | if ( IOstatus < 0 ) then 104 | error_flag = -ii 105 | rewind(unt) 106 | return 107 | endif 108 | if ( index(line,'[') /= 0 .or. len(trim(line)) == 0 ) exit 109 | i = i+1 110 | enddo 111 | Nat = i 112 | 113 | rewind(unt) 114 | return 115 | 116 | end subroutine read_molden_natoms 117 | 118 | subroutine read_molden_geom(unt,Nat,AtName,X,Y,Z,error_flag) 119 | 120 | !============================================================== 121 | ! This code is part of FCC_TOOLS 122 | !============================================================== 123 | !Description 124 | ! Reads coordinates and atom names from MOLCAS. The coordinates 125 | ! are retuned as a 3Nat vector 126 | 127 | !Description 128 | ! Get geometry and atom names from MOLCAS. The number of atoms 129 | ! is also taken 130 | ! 131 | !Arguments 132 | ! unt (inp) int /scalar unit for the file 133 | ! Nat (out) int /scalar Number of atoms 134 | ! AtName (out) char/vertor Atom names 135 | ! X,Y,Z (out) real/vectors Coordinate vectors (ANGSTRONG) 136 | ! io_flag (io ) flag Error flag: 137 | ! 0 : Success 138 | ! -i : Read error on line i 139 | ! 140 | !Note 141 | ! Need to understand better the MOLCAS output 142 | !============================================================== 143 | 144 | integer,intent(in) :: unt 145 | integer,intent(inout) :: Nat 146 | character(len=*), dimension(:), intent(out) :: AtName 147 | real(kind=8), dimension(:), intent(out) :: X,Y,Z 148 | integer,intent(out) :: error_flag 149 | 150 | !Local variables 151 | !============= 152 | character(len=10) :: units 153 | character(len=240) :: line="" 154 | character :: cnull 155 | !I/O 156 | integer :: IOstatus 157 | !Counters 158 | integer :: i, ii, AtNum 159 | 160 | 161 | ! Search section 162 | ii = 0 163 | do 164 | ii = ii + 1 165 | read(unt,'(A)',IOSTAT=IOstatus) line 166 | call set_word_upper_case(line) 167 | ! Two possible scenarios while reading: 168 | ! 1) End of file 169 | if ( IOstatus < 0 ) then 170 | error_flag = -ii 171 | rewind(unt) 172 | return 173 | endif 174 | ! 2) Found what looked for! 175 | if ( index(line,"[ATOMS]") /= 0 ) then 176 | read(line,*) cnull, units 177 | exit 178 | endif 179 | 180 | enddo 181 | do i=1,Nat 182 | read(unt,*) AtName(i), cnull, cnull, X(i), Y(i), Z(i) 183 | enddo 184 | if (index(units,'AU') /= 0) then 185 | !Transform to AA 186 | X(1:Nat) = X(1:Nat)*BOHRtoANGS 187 | Y(1:Nat) = Y(1:Nat)*BOHRtoANGS 188 | Z(1:Nat) = Z(1:Nat)*BOHRtoANGS 189 | endif 190 | 191 | rewind(unt) 192 | return 193 | 194 | end subroutine read_molden_geom 195 | 196 | 197 | end module molden_manage 198 | 199 | -------------------------------------------------------------------------------- /modules/io/molpro_manage.f90: -------------------------------------------------------------------------------- 1 | module molpro_manage 2 | 3 | !============================================================== 4 | ! This code is part of FCC_TOOLS 5 | !============================================================== 6 | ! Description 7 | ! This MODULE contains subroutines to get molecular information 8 | ! from molpro out files 9 | ! 10 | ! Notes 11 | ! All subroutines rewind the file after using it 12 | !============================================================== 13 | 14 | !Common declarations: 15 | !=================== 16 | use constants 17 | use line_preprocess 18 | implicit none 19 | 20 | contains 21 | 22 | subroutine read_molpro_natoms(unt,Nat,error_flag) 23 | 24 | !============================================================== 25 | ! This code is part of FCC_TOOLS 26 | !============================================================== 27 | !Description 28 | ! Reads coordinates and atom names from molpro. The coordinates 29 | ! are retuned as a 3Nat vector 30 | 31 | !Description 32 | ! Get geometry and atom names from molpro. The number of atoms 33 | ! is also taken 34 | ! 35 | !Arguments 36 | ! unt (inp) int /scalar unit for the file 37 | ! Nat (out) int /scalar Number of atoms 38 | ! io_flag (io ) flag Error flag: 39 | ! 0 : Success 40 | ! -i : Read error on line i 41 | ! 42 | !Note 43 | ! Need to understand better the molpro output 44 | !============================================================== 45 | 46 | integer,intent(in) :: unt 47 | integer,intent(out) :: Nat 48 | integer,intent(out) :: error_flag 49 | 50 | !Local variables 51 | !============= 52 | character(len=240) :: line="" 53 | character :: cnull 54 | !I/O 55 | integer :: IOstatus 56 | !Counters 57 | integer :: i, ii 58 | 59 | ! Search section 60 | error_flag = 0 61 | ii = 0 62 | do 63 | ii = ii + 1 64 | read(unt,'(A)',IOSTAT=IOstatus) line 65 | ! Two possible scenarios while reading: 66 | ! 1) End of file 67 | if ( IOstatus < 0 ) then 68 | error_flag = -ii 69 | rewind(unt) 70 | return 71 | endif 72 | ! 2) Found what looked for! 73 | if ( adjustl(line) == "Current geometry (xyz format, in Angstrom)" ) then 74 | !One empty line 75 | read(unt,'(A)',IOSTAT=IOstatus) line 76 | exit 77 | endif 78 | enddo 79 | 80 | ! Overpass lines until reaching the target table 81 | !Read Table lines 82 | read(unt,*,IOSTAT=IOstatus) Nat 83 | 84 | rewind(unt) 85 | return 86 | 87 | end subroutine read_molpro_natoms 88 | 89 | 90 | subroutine read_molpro_geom(unt,Nat,AtName,X,Y,Z,error_flag) 91 | 92 | !============================================================== 93 | ! This code is part of FCC_TOOLS 94 | !============================================================== 95 | !Description 96 | ! Reads coordinates and atom names from molpro. The coordinates 97 | ! are retuned as a 3Nat vector 98 | 99 | !Description 100 | ! Get geometry and atom names from molpro. The number of atoms 101 | ! is also taken 102 | ! 103 | !Arguments 104 | ! unt (inp) int /scalar unit for the file 105 | ! Nat (out) int /scalar Number of atoms 106 | ! AtName (out) char/vertor Atom names 107 | ! X,Y,Z (out) real/vectors Coordinate vectors (ANGSTRONG) 108 | ! io_flag (io ) flag Error flag: 109 | ! 0 : Success 110 | ! -i : Read error on line i 111 | ! 112 | !Note 113 | ! Need to understand better the molpro output 114 | !============================================================== 115 | 116 | integer,intent(in) :: unt 117 | integer,intent(out) :: Nat 118 | character(len=*), dimension(:), intent(out) :: AtName 119 | real(kind=8), dimension(:), intent(out) :: X,Y,Z 120 | integer,intent(out) :: error_flag 121 | 122 | !Local variables 123 | !============= 124 | character(len=240) :: line="" 125 | character :: cnull 126 | !I/O 127 | integer :: IOstatus 128 | !Counters 129 | integer :: i, ii 130 | 131 | ! Search section 132 | error_flag = 0 133 | ii = 0 134 | do 135 | ii = ii + 1 136 | read(unt,'(A)',IOSTAT=IOstatus) line 137 | ! Two possible scenarios while reading: 138 | ! 1) End of file 139 | if ( IOstatus < 0 ) then 140 | error_flag = -ii 141 | rewind(unt) 142 | return 143 | endif 144 | ! 2) Found what looked for! 145 | if ( adjustl(line) == "Current geometry (xyz format, in Angstrom)" ) then 146 | !One empty line 147 | read(unt,'(A)',IOSTAT=IOstatus) line 148 | exit 149 | endif 150 | enddo 151 | 152 | ! Overpass lines until reaching the target table 153 | !Read Table lines 154 | read(unt,*,IOSTAT=IOstatus) Nat 155 | !Title 156 | read(unt,'(A)',IOSTAT=IOstatus) line 157 | !Start reading geometry 158 | do i=1,Nat 159 | read(unt,*) AtName(i), & 160 | X(i), & 161 | Y(i), & 162 | Z(i) 163 | if ( IOstatus < 0 ) then 164 | print*, "Unexpected end of file while reading Geometry" 165 | error_flag = 1 166 | rewind(unt) 167 | return 168 | endif 169 | enddo 170 | 171 | rewind(unt) 172 | return 173 | 174 | end subroutine read_molpro_geom 175 | 176 | 177 | subroutine read_molpro_hess(unt,Nat,Hlt,error_flag) 178 | 179 | !============================================================== 180 | ! This code is part of FCC_TOOLS 181 | !============================================================== 182 | !Description 183 | ! Read Hessian from molpro output. Returs the triangular part of the 184 | ! Hessian matrix in AU 185 | ! 186 | !Arguments 187 | ! unt (inp) scalar unit for the file 188 | ! Nat (inp) scalar Number of atoms 189 | ! Hlt (out) vector Lower triangular part of Hessian matrix (AU) 190 | ! error_flag (out) scalar error_flag : 191 | ! 0 : Success 192 | ! -i : Read error on line i 193 | ! 2 : Wrong number of elements for Hlt 194 | ! Notes 195 | !============================================================== 196 | 197 | integer,intent(in) :: unt 198 | integer,intent(in) :: Nat 199 | real(kind=8), dimension(:), intent(out) :: Hlt 200 | integer,intent(out) :: error_flag 201 | 202 | !Local stuff 203 | !============= 204 | character(len=240) :: line="" 205 | character(len=1) :: cnull 206 | integer :: N 207 | !I/O 208 | integer :: IOstatus 209 | !Counters 210 | integer :: i, j, k, ii, jini, jfin, & 211 | iblock, nblocks, icols 212 | !Auxiliar arrays 213 | real(kind=8),dimension(3*Nat,3*Nat) :: Hpart 214 | 215 | 216 | !Use N to store 3*Nat 217 | N = 3*Nat 218 | 219 | ! Search section 220 | ii = 0 221 | error_flag = 0 222 | do 223 | ii = ii + 1 224 | read(unt,'(A)',IOSTAT=IOstatus) line 225 | ! Two possible scenarios while reading: 226 | ! 1) End of file 227 | if ( IOstatus < 0 ) then 228 | error_flag = -ii 229 | rewind(unt) 230 | return 231 | endif 232 | ! 2) Found what looked for! 233 | if ( INDEX(line,"Force Constants (Second Derivatives of the Energy) in [a.u.]") /= 0 ) then 234 | exit 235 | endif 236 | enddo 237 | 238 | !Hessian elements arranged in blocks of 5 columns each 239 | !Only triangular part is shown 240 | nblocks = N/5 241 | if (N /= nblocks*5) nblocks=nblocks+1 242 | do iblock=1,nblocks 243 | !Rirst line is header 244 | read(unt,'(A)') line 245 | jini=(iblock-1)*5+1 246 | do i=jini,N 247 | jfin=min(i,iblock*5) 248 | read(unt,*) cnull, Hpart(i,jini:jfin) 249 | enddo 250 | enddo 251 | 252 | !Get Hlt from the half matrix in Hpart 253 | k = 0 254 | do i=1,N 255 | do j=1,i 256 | k = k + 1 257 | Hlt(k) = Hpart(i,j) 258 | enddo 259 | enddo 260 | if (k /= (N*(N+1)/2)) then 261 | error_flag = 2 262 | endif 263 | 264 | rewind(unt) 265 | return 266 | 267 | end subroutine read_molpro_hess 268 | 269 | 270 | 271 | end module molpro_manage 272 | 273 | -------------------------------------------------------------------------------- /modules/maths/dft.f90: -------------------------------------------------------------------------------- 1 | module fft 2 | 3 | use constants 4 | 5 | contains 6 | 7 | subroutine ft_calc(unt,ndata,t,xi,spec,optrans) 8 | 9 | !============================================================= 10 | !DESCRIPTION: 11 | !------------ 12 | !Subroutine to tool to perform BACKWARD (for absorption) and 13 | !FORWARD (for emission) DFT, using the direct application of 14 | !the definition: 15 | ! 16 | ! g(k+1) = sum_m {x(m+1) * exp(i*2PI*m*k/N)} 17 | ! 18 | !Units: 19 | ! -Correlation Functions: time(fs) vs. chi(atomi units) 20 | ! (chi contains also the terms related with dipole moment) 21 | ! -Spectrun: Energy(eV) vs. lineshape (atomic units) 22 | ! 23 | !NOTES 24 | !----- 25 | !The DFT is turned into an approximation to the continous FT 26 | !when the appropriate phase factor is taken into account, as 27 | !described in this StackOverflow question: 28 | !http://stackoverflow.com/questions/24077913/discretized-continuous-fourier-transform-with-numpy 29 | !But note that the FFT must be done over N-1 points 30 | !============================================================= 31 | 32 | implicit none 33 | 34 | double complex,parameter :: Im=(0.d0,1.d0) 35 | 36 | !Subroutine I/O 37 | integer,intent(in) :: unt 38 | integer,intent(in) :: ndata 39 | real(8),dimension(:),intent(in) :: t 40 | double complex,dimension(:),intent(in) :: xi 41 | character(len=3),intent(in) :: optrans 42 | real(8),dimension(:),intent(out) :: spec 43 | 44 | integer :: i, k, ios 45 | double complex,dimension(1:ndata) :: datos 46 | real(8) :: p,q, df, dt, t0, log2 47 | !FFT interface stuff 48 | integer :: FFT_FORWARD =-1, & 49 | FFT_BACKWARD = 1, & 50 | FT_DIRECTION 51 | 52 | write(unt,'(/,X,A)') "Entering in dft_calc subroutine (not FFT)" 53 | write(unt,'(X,A,I0)') "Ndata", ndata 54 | write(unt,'(X,A,2(F10.3,2X),/)') "tini and tfin", t(1), t(ndata) 55 | 56 | 57 | !Read data (from stdin): three colum array 58 | datos(1:ndata) = xi(1:ndata) 59 | 60 | if (optrans == "EMI") then 61 | FT_DIRECTION=FFT_FORWARD 62 | else 63 | FT_DIRECTION=FFT_BACKWARD 64 | endif 65 | call dft(datos(1:ndata),FT_DIRECTION) 66 | 67 | !Relevant data in the time and freq domains 68 | t0 = t(1) 69 | dt = (t(ndata)-t(1))/float(ndata-1) 70 | !df is (normal) frequency, not angular frequency (w) 71 | df = 1.d0/(dt*float(ndata)) 72 | write(unt,*) "df", df !, df*N/2*fstoev 73 | write(unt,*) "dt", dt !, df*N/2*fstoev 74 | 75 | !To get FT from DFT, we include a phase factor, so that, FT \appox Factor * DFT 76 | ! Factor(k) = exp(-i dw*k * t0)*DFT 77 | !where k=(0,1,...,ndata/2) and dw = 2pi*df (see NOTES) 78 | do k=1,ndata 79 | datos(k) = datos(k) * dt * exp(float(FT_DIRECTION) * Im * 2.d0*pi*df * t0 * real(k-1)) /autofs 80 | end do 81 | 82 | !Write spectrum 83 | do i=1,ndata 84 | spec(i) = real(datos(i)) 85 | enddo 86 | 87 | return 88 | 89 | contains 90 | 91 | subroutine dft(x,isgn) 92 | 93 | !================================================================================= 94 | ! Direct application of DFT definition (very ineficient) 95 | ! 96 | !NOTES: 97 | ! Returns the positive frequencies only (half the points) 98 | !================================================================================= 99 | 100 | implicit none 101 | 102 | double complex,dimension(:),intent(inout) :: x 103 | integer,intent(in) :: isgn 104 | !Local 105 | integer :: N 106 | double complex,dimension(size(x)) :: g 107 | integer :: k,m 108 | double complex,parameter :: Im=(0.d0,1.d0) 109 | real(8),parameter :: pi= 4.d0*datan(1.d0) 110 | 111 | N = size(x) 112 | 113 | do k=0,N-1 114 | g(k+1) = 0.d0 115 | do m=0,N-1 116 | g(k+1) = g(k+1) + x(m+1) * & 117 | exp(Im*2.0d0*pi*dfloat(isgn*m*k)/dfloat(N)) 118 | enddo 119 | enddo 120 | 121 | x(1:N) = g(1:N) 122 | 123 | return 124 | 125 | end subroutine dft 126 | 127 | end subroutine ft_calc 128 | 129 | end module fft 130 | -------------------------------------------------------------------------------- /modules/maths/fft.f90: -------------------------------------------------------------------------------- 1 | module fft 2 | 3 | use constants 4 | 5 | contains 6 | 7 | subroutine ft_calc(ndata,t,xi,spec,optrans) 8 | 9 | !============================================================= 10 | !DESCRIPTION: 11 | !------------ 12 | !Subroutine to tool to perform BACKWARD (for absorption) and 13 | !FORWARD (for emission) FFT using the Cooley-Tukey algorith 14 | !adapted from RosetaCode. Only FFT is done, so it is compulsory 15 | !that the dimension of the array is a power of 2 16 | ! 17 | !Units: 18 | ! -Correlation Functions: time(fs) vs. chi(atomi units) 19 | ! (chi contains also the terms related with dipole moment) 20 | ! -Spectrun: Energy(eV) vs. lineshape (atomic units) 21 | ! 22 | !NOTES 23 | !----- 24 | !The DFT is turned into an approximation to the continous FT 25 | !when the appropriate phase factor is taken into account, as 26 | !described in this StackOverflow question: 27 | !http://stackoverflow.com/questions/24077913/discretized-continuous-fourier-transform-with-numpy 28 | !But note that the FFT must be done over N-1 points 29 | !============================================================= 30 | 31 | implicit none 32 | 33 | integer, parameter :: dp=selected_real_kind(15,300) 34 | 35 | double complex,parameter :: Im=(0.d0,1.d0) 36 | 37 | !Subroutine I/O 38 | integer,intent(in) :: ndata 39 | real(8),dimension(:),intent(in) :: t 40 | double complex,dimension(:),intent(in) :: xi 41 | character(len=*),intent(in) :: optrans 42 | real(8),dimension(:),intent(out) :: spec 43 | 44 | integer :: i, k, ios 45 | double complex,dimension(1:ndata) :: datos 46 | real(8) :: p,q, df, dt, t0, log2 47 | real(8) :: autown,evtown,fstoev,pi 48 | !FFT interface stuff 49 | integer :: FFT_FORWARD =-1, & 50 | FFT_BACKWARD = 1, & 51 | FFT_DIRECTION 52 | 53 | print'(/,X,A)', "Entering in fft_calc subroutine (rosettacode)" 54 | print*, "Num data (total)", ndata 55 | print*, "Num data for DFT", ndata 56 | log2 = log(dfloat(ndata))/log(2.d0) 57 | if ( 2**INT(log2) == ndata ) then 58 | print'(X,A,/)', "Num. data for DFT is a power of 2. Proceeding..." 59 | else 60 | print*, "Data for DFT is not a power of 2, but this routine only performs FFT. Aborting" 61 | stop 62 | endif 63 | 64 | !Read data (from stdin): three colum array 65 | datos(1:ndata) = xi(1:ndata) 66 | 67 | if (optrans == "emi") then 68 | FFT_DIRECTION=FFT_FORWARD 69 | else 70 | FFT_DIRECTION=FFT_BACKWARD 71 | endif 72 | call fft(datos(1:ndata),FFT_DIRECTION) 73 | 74 | !------------------------------------------- 75 | !What is computed (BACKWARD). The DFT as: 76 | ! spec(k) = \sum_{j=0}^{N-1} datos(j)*exp(+Im*2pi*(j-1)*k/N) 77 | !without any frefactor 78 | ! 79 | !How the DFT is stored: 80 | ! spec(1:N/2) : 0 and positive frequencies 81 | ! spec(N/2+1:N) ; negagive frequencies 82 | !------------------------------------------- 83 | 84 | !Relevant data in the time and freq domains 85 | t0 = t(1) 86 | dt = (t(ndata)-t(1))/(ndata-1) 87 | !df is (normal) frequency, not angular frequency (w) 88 | df = 1.d0/(dt*float(ndata)) 89 | write(6,*) "df", df !, df*N/2*fstoev 90 | write(6,*) "dt", dt !, df*N/2*fstoev 91 | 92 | !To get FT from DFT, we include a phase factor, so that, FT \appox Factor * DFT 93 | ! Factor(k) = exp(-i dw*k * t0)*DFT 94 | !where k=(0,1,...,N/2) and dw = 2pi*df (see NOTES) 95 | !Note that since we are interested in the real part, the sign in front of Im does 96 | !not matter (for the imag part it should be fixed with FFT_DIRECTION) 97 | !Since input data have time in fs instead of au, changes dt to au with /autofs 98 | do k=1,ndata/2 99 | datos(k) = datos(k) * dt * exp(-Im * 2.d0*pi*df * t0 * real(k-1)) /autofs 100 | end do 101 | 102 | !Write spectrum 103 | spec(1:ndata/2) = real(datos(1:ndata/2)) 104 | 105 | return 106 | 107 | contains 108 | 109 | recursive subroutine fft(x,isgn) 110 | 111 | !================================================================================= 112 | !In place Cooley-Tukey FFT (adapted from http://rosettacode.org/wiki/FFT#Fortran) 113 | ! 114 | !NOTES: 115 | !The subroutine is not very stable. For instance, if the variable N is named Ndata 116 | !instead (and in main we use N), a segfault arises. Maybe due to a typo but 117 | !anyway, some caution should be taken 118 | !================================================================================= 119 | 120 | implicit none 121 | 122 | complex(8), dimension(:), intent(inout) :: x 123 | integer,intent(in) :: isgn 124 | !Local 125 | real(8) :: sgn 126 | complex(8) :: t 127 | integer :: N 128 | integer :: i 129 | complex(8), dimension(:), allocatable :: even, odd 130 | 131 | N=size(x) 132 | 133 | if(n.le.1) return 134 | 135 | allocate(odd((N+1)/2)) 136 | allocate(even(N/2)) 137 | 138 | ! divide 139 | odd =x(1:N:2) 140 | even=x(2:N:2) 141 | 142 | ! conquer 143 | call fft(odd,isgn) 144 | call fft(even,isgn) 145 | 146 | ! combine 147 | sgn = real(isgn,8) 148 | do i=1,N/2 149 | t=exp(sgn*cmplx(0.0d0,-2.0d0*pi*real(i-1,8)/real(N,8),8))& 150 | *even(i) 151 | x(i) = odd(i) + t 152 | x(i+N/2) = odd(i) - t 153 | end do 154 | 155 | deallocate(odd) 156 | deallocate(even) 157 | 158 | end subroutine fft 159 | 160 | end subroutine ft_calc 161 | 162 | end module fft 163 | -------------------------------------------------------------------------------- /modules/maths/fftw.f90: -------------------------------------------------------------------------------- 1 | module fft 2 | 3 | contains 4 | 5 | subroutine ft_calc(unt,N,t,xi,spec,optrans) 6 | 7 | !============================================================= 8 | !DESCRIPTION: 9 | !------------ 10 | !Subroutine to tool to perform BACKWARD (for absorption) and 11 | !FORWARD (for emission) DFT using FFTW3 library, so as to 12 | !provide the lineshape spectrum. 13 | ! 14 | !Units: 15 | ! -Correlation Functions: time(fs) vs. chi(atomi units) 16 | ! (chi contains also the terms related with dipole moment) 17 | ! -Spectrun: Energy(eV) vs. lineshape (atomic units) 18 | ! 19 | !NOTES 20 | !----- 21 | !The DFT is turned into an approximation to the continous FT 22 | !when the appropriate phase factor is taken into account, as 23 | !described in this StackOverflow question: 24 | !http://stackoverflow.com/questions/24077913/discretized-continuous-fourier-transform-with-numpy 25 | !But note that the FFT must be done over N-1 points 26 | !============================================================= 27 | 28 | use constants 29 | 30 | implicit none 31 | 32 | include "fftw3.f" 33 | 34 | double complex,parameter :: Im=(0.d0,1.d0) 35 | 36 | !Subroutine I/O 37 | integer,intent(in) :: unt 38 | integer,intent(in) :: N 39 | real(8),dimension(:),intent(in) :: t 40 | double complex,dimension(:),intent(in) :: xi 41 | character(len=*),intent(in) :: optrans 42 | real(8),dimension(:),intent(out) :: spec 43 | 44 | integer :: i, k, ios 45 | double complex,dimension(1:N) :: datos, spec_im 46 | real(8) :: df, dt, t0 47 | !FFTW3 interface stuff 48 | integer(8) :: plan, FFTW_DIRECTION 49 | 50 | !Copy data to manipulate them localy 51 | datos(1:N) = xi(1:N) 52 | 53 | write(unt,'(/,X,A)') "Entering in fft_calc subroutine (FFTW)" 54 | write(unt,'(X,A,I0)') "Ndata: ", N 55 | write(unt,'(X,A,2(F10.3,2X),/)') "tini and tfin", t(1), t(N) 56 | 57 | if (optrans == "EMI") then 58 | FFTW_DIRECTION=FFTW_FORWARD 59 | else 60 | FFTW_DIRECTION=FFTW_BACKWARD 61 | endif 62 | !Complex data DFT (from FFTW3) 63 | call dfftw_plan_dft_1d(plan,N,datos,spec_im,FFTW_DIRECTION,FFTW_ESTIMATE) 64 | call dfftw_execute(plan, datos, spec_im) 65 | call dfftw_destroy_plan(plan) 66 | !------------------------------------------- 67 | !What is computed (BACKWARD). The DFT as: 68 | ! spec(k) = \sum_{j=0}^{N-1} datos(j)*exp(+Im*2pi*(j-1)*k/N) 69 | !without any frefactor 70 | ! 71 | !How the DFT is stored: 72 | ! spec(1:N/2) : 0 and positive frequencies 73 | ! spec(N/2+1:N) ; negagive frequencies 74 | !------------------------------------------- 75 | 76 | !Relevant data in the time and freq domains 77 | t0 = t(1) 78 | dt = (t(N)-t(1))/(N-1) 79 | !df is (normal) frequency, not angular frequency (w) 80 | df = 1.d0/dt/dfloat(N) 81 | write(unt,*) "df", df !, df*N/2*fstoev 82 | write(unt,*) "dt", dt !, df*N/2*fstoev 83 | 84 | !To get FT from DFT, we include a phase factor, so that, FT \appox Factor * DFT 85 | ! Factor(k) = exp(-i dw*k * t0)*DFT 86 | !where k=(0,1,...,N/2) and dw = 2pi*df (see NOTES) 87 | !Note that since we are interested in the real part, the sign in front of Im does 88 | !not matter (for the imag part it should be fixed with FFT_DIRECTION) 89 | !Since input data have time in fs instead of au, changes dt to au with /autofs 90 | do k=1,N 91 | spec_im(k) = spec_im(k) * dt * exp(dfloat(FFTW_DIRECTION)*Im * 2.d0*pi*df * t0 * real(k-1)) /autofs 92 | ! This should give the same result: 93 | !spec_im(k) = spec_im(k) * dt * exp(-Im * 2.d0*pi*df * t0 * real(k-1)) /autofs 94 | end do 95 | 96 | !Write spectrum 97 | spec(1:N) = real(spec_im(1:N)) 98 | 99 | return 100 | 101 | end subroutine ft_calc 102 | 103 | end module fft -------------------------------------------------------------------------------- /modules/maths/fftw3.f: -------------------------------------------------------------------------------- 1 | INTEGER FFTW_R2HC 2 | PARAMETER (FFTW_R2HC=0) 3 | INTEGER FFTW_HC2R 4 | PARAMETER (FFTW_HC2R=1) 5 | INTEGER FFTW_DHT 6 | PARAMETER (FFTW_DHT=2) 7 | INTEGER FFTW_REDFT00 8 | PARAMETER (FFTW_REDFT00=3) 9 | INTEGER FFTW_REDFT01 10 | PARAMETER (FFTW_REDFT01=4) 11 | INTEGER FFTW_REDFT10 12 | PARAMETER (FFTW_REDFT10=5) 13 | INTEGER FFTW_REDFT11 14 | PARAMETER (FFTW_REDFT11=6) 15 | INTEGER FFTW_RODFT00 16 | PARAMETER (FFTW_RODFT00=7) 17 | INTEGER FFTW_RODFT01 18 | PARAMETER (FFTW_RODFT01=8) 19 | INTEGER FFTW_RODFT10 20 | PARAMETER (FFTW_RODFT10=9) 21 | INTEGER FFTW_RODFT11 22 | PARAMETER (FFTW_RODFT11=10) 23 | INTEGER FFTW_FORWARD 24 | PARAMETER (FFTW_FORWARD=-1) 25 | INTEGER FFTW_BACKWARD 26 | PARAMETER (FFTW_BACKWARD=+1) 27 | INTEGER FFTW_MEASURE 28 | PARAMETER (FFTW_MEASURE=0) 29 | INTEGER FFTW_DESTROY_INPUT 30 | PARAMETER (FFTW_DESTROY_INPUT=1) 31 | INTEGER FFTW_UNALIGNED 32 | PARAMETER (FFTW_UNALIGNED=2) 33 | INTEGER FFTW_CONSERVE_MEMORY 34 | PARAMETER (FFTW_CONSERVE_MEMORY=4) 35 | INTEGER FFTW_EXHAUSTIVE 36 | PARAMETER (FFTW_EXHAUSTIVE=8) 37 | INTEGER FFTW_PRESERVE_INPUT 38 | PARAMETER (FFTW_PRESERVE_INPUT=16) 39 | INTEGER FFTW_PATIENT 40 | PARAMETER (FFTW_PATIENT=32) 41 | INTEGER FFTW_ESTIMATE 42 | PARAMETER (FFTW_ESTIMATE=64) 43 | INTEGER FFTW_ESTIMATE_PATIENT 44 | PARAMETER (FFTW_ESTIMATE_PATIENT=128) 45 | INTEGER FFTW_BELIEVE_PCOST 46 | PARAMETER (FFTW_BELIEVE_PCOST=256) 47 | INTEGER FFTW_NO_DFT_R2HC 48 | PARAMETER (FFTW_NO_DFT_R2HC=512) 49 | INTEGER FFTW_NO_NONTHREADED 50 | PARAMETER (FFTW_NO_NONTHREADED=1024) 51 | INTEGER FFTW_NO_BUFFERING 52 | PARAMETER (FFTW_NO_BUFFERING=2048) 53 | INTEGER FFTW_NO_INDIRECT_OP 54 | PARAMETER (FFTW_NO_INDIRECT_OP=4096) 55 | INTEGER FFTW_ALLOW_LARGE_GENERIC 56 | PARAMETER (FFTW_ALLOW_LARGE_GENERIC=8192) 57 | INTEGER FFTW_NO_RANK_SPLITS 58 | PARAMETER (FFTW_NO_RANK_SPLITS=16384) 59 | INTEGER FFTW_NO_VRANK_SPLITS 60 | PARAMETER (FFTW_NO_VRANK_SPLITS=32768) 61 | INTEGER FFTW_NO_VRECURSE 62 | PARAMETER (FFTW_NO_VRECURSE=65536) 63 | INTEGER FFTW_NO_SIMD 64 | PARAMETER (FFTW_NO_SIMD=131072) 65 | INTEGER FFTW_NO_SLOW 66 | PARAMETER (FFTW_NO_SLOW=262144) 67 | INTEGER FFTW_NO_FIXED_RADIX_LARGE_N 68 | PARAMETER (FFTW_NO_FIXED_RADIX_LARGE_N=524288) 69 | INTEGER FFTW_ALLOW_PRUNING 70 | PARAMETER (FFTW_ALLOW_PRUNING=1048576) 71 | INTEGER FFTW_WISDOM_ONLY 72 | PARAMETER (FFTW_WISDOM_ONLY=2097152) 73 | -------------------------------------------------------------------------------- /modules/maths/general_math.f90: -------------------------------------------------------------------------------- 1 | module general_math 2 | 3 | contains 4 | 5 | 6 | function fctorial(nn,mm) 7 | !c 8 | !c reports the elapsed cpu time 9 | !c 10 | integer,intent(in) :: nn,mm 11 | real(8) :: fctorial 12 | ! Local 13 | integer :: i 14 | 15 | fctorial=1.d0 16 | do i=1,mm 17 | fctorial=fctorial*dfloat(nn+1-i)/dfloat(i) 18 | !c write(6,*) nn+1-mm,mm,fctorial 19 | enddo 20 | return 21 | end function fctorial 22 | 23 | end module general_math -------------------------------------------------------------------------------- /modules/maths/matrix_print.f90: -------------------------------------------------------------------------------- 1 | module matrix_print 2 | 3 | !============================================================== 4 | ! This code is part of FCclasses2 5 | !============================================================== 6 | ! 7 | ! Despription 8 | ! ----------- 9 | ! Subroutines to perform matrix manipulations: 10 | ! *Matrix printing 11 | ! 12 | !============================================================== 13 | 14 | CONTAINS 15 | 16 | 17 | !========================================= 18 | ! SUBROUTINES FOR PRINTING: 19 | ! Source: old FCclasses code. Uses 20 | ! labels for format and GOTOs 21 | ! and does not follow indentation 22 | !========================================= 23 | 24 | subroutine print_vector(unt,A,N,name) 25 | 26 | !================================== 27 | ! Description 28 | ! ----------- 29 | ! Source: adapted from original FCclasses 30 | ! code for matrix printing (MAT1) 31 | ! Prints a vector A 32 | !================================== 33 | 34 | integer,intent(in) :: unt 35 | real(8),dimension(:),intent(in) :: A 36 | integer,intent(in) :: N 37 | character(len=*),intent(in),optional :: name 38 | !Local 39 | integer :: i 40 | integer :: len_line 41 | character(len=100) :: line 42 | 43 | !Set the table line accoring to its size 44 | len_line = 18 45 | len_line = max(len_line,len_trim(name)+6) 46 | do i=1,len_line 47 | line(i:i) = "-" 48 | enddo 49 | 50 | if (present(name)) then 51 | write(unt,'(/,X,A)') line(1:len_line) 52 | write(unt,'(3X,A)') name 53 | endif 54 | write(unt,'(X,A)') line(1:len_line) 55 | 56 | do i=1,N 57 | write(unt,'(X,I5,F12.5)') i, A(i) 58 | enddo 59 | write(unt,'(X,A,/)') line(1:len_line) 60 | ! C 61 | return 62 | 63 | end subroutine print_vector 64 | 65 | 66 | subroutine MAT0(unt,AA,NR,NC,name) 67 | 68 | !================================== 69 | ! Description 70 | ! ----------- 71 | ! Prints a matrix AA (without 72 | ! any associated vector) 73 | !================================== 74 | 75 | integer,intent(in) :: unt 76 | real(8),dimension(:,:),intent(in) :: AA 77 | integer,intent(in) :: NC, NR 78 | character(len=*),intent(in),optional :: name 79 | !Local 80 | integer :: I, J, N, LA, LB, LC, KA, KB, KC 81 | integer :: len_line 82 | character(len=100) :: line 83 | 84 | !Set the table line accoring to its size 85 | len_line = 9+(min(6,NC)*12) 86 | len_line = max(len_line,len_trim(name)+6) 87 | do i=1,len_line 88 | line(i:i) = "-" 89 | enddo 90 | 91 | if (present(name)) then 92 | write(unt,'(/,X,A)') line(1:len_line) 93 | write(unt,'(3X,A)') name 94 | endif 95 | write(unt,'(X,A)') line(1:len_line) 96 | 97 | KA=1 98 | KC=6 99 | 10 KB=MIN0(KC,NC) 100 | WRITE (unt,50) (I,I=KA,KB) 101 | WRITE (unt,70) 102 | LA=1 103 | LC=40 104 | 20 LB=MIN0(LC,NR) 105 | N=0 106 | DO 30 I=LA,LB 107 | WRITE (unt,80) I,(AA(I,J),J=KA,KB) 108 | N=N+1 109 | IF (N.LT.10) GO TO 30 110 | WRITE (unt,70) 111 | N=0 112 | 30 CONTINUE 113 | IF (LB.EQ.NR) GO TO 40 114 | LA=LC+1 115 | LC=LC+40 116 | WRITE (unt,90) 117 | GO TO 20 118 | 40 IF (KB.EQ.NC) then 119 | write(unt,'(X,A,/)') line(1:len_line) 120 | RETURN 121 | endif 122 | KA=KC+1 123 | KC=KC+6 124 | IF (NR.GT.25) WRITE (unt,90) 125 | GO TO 10 126 | ! C 127 | 50 FORMAT (/9H ,I5,9I12) 128 | 70 FORMAT (2H ) 129 | 80 FORMAT (I5,10F12.5) 130 | 90 FORMAT (1H1) 131 | ! C 132 | return 133 | 134 | end subroutine MAT0 135 | 136 | 137 | subroutine MAT1(unt,AA,B,NR,NC,name) 138 | 139 | !================================== 140 | ! Description 141 | ! ----------- 142 | ! Prints eigenvectors in matrix AA 143 | ! along with eigenvalues in B 144 | !================================== 145 | 146 | integer,intent(in) :: unt 147 | real(8),dimension(:,:),intent(in) :: AA 148 | real(8),dimension(:),intent(in) :: B 149 | integer,intent(in) :: NC, NR 150 | character(len=*),intent(in),optional :: name 151 | !Local 152 | integer :: I, J, N, LA, LB, LC, KA, KB, KC 153 | integer :: len_line 154 | character(len=81) :: line 155 | 156 | !Set the table line accoring to its size 157 | len_line = 9+(min(6,NC)*12) 158 | len_line = max(len_line,len_trim(name)+6) 159 | do i=1,len_line 160 | line(i:i) = "-" 161 | enddo 162 | 163 | if (present(name)) then 164 | write(unt,'(/,X,A)') line(1:len_line) 165 | write(unt,'(3X,A)') name 166 | endif 167 | write(unt,'(X,A)') line(1:len_line) 168 | 169 | KA=1 170 | KC=6 171 | 10 KB=MIN0(KC,NC) 172 | WRITE (unt,50) (I,I=KA,KB) 173 | WRITE (unt,60) (B(I),I=KA,KB) 174 | WRITE (unt,70) 175 | LA=1 176 | LC=40 177 | 20 LB=MIN0(LC,NR) 178 | N=0 179 | DO 30 I=LA,LB 180 | WRITE (unt,80) I,(AA(I,J),J=KA,KB) 181 | N=N+1 182 | IF (N.LT.10) GO TO 30 183 | WRITE (unt,70) 184 | N=0 185 | 30 CONTINUE 186 | IF (LB.EQ.NR) GO TO 40 187 | LA=LC+1 188 | LC=LC+40 189 | WRITE (unt,90) 190 | GO TO 20 191 | 40 IF (KB.EQ.NC) then 192 | write(unt,'(X,A,/)') line(1:len_line) 193 | RETURN 194 | endif 195 | KA=KC+1 196 | KC=KC+6 197 | IF (NR.GT.25) WRITE (unt,90) 198 | GO TO 10 199 | ! C 200 | 50 FORMAT (/9H ROOT NO.,I5,9I12) 201 | 60 FORMAT (/4X,10F12.6) 202 | 70 FORMAT (2H ) 203 | 80 FORMAT (I5,10F12.5) 204 | 90 FORMAT (1H1) 205 | ! C 206 | return 207 | 208 | end subroutine MAT1 209 | 210 | 211 | end module matrix_print 212 | -------------------------------------------------------------------------------- /modules/verbosity.f90: -------------------------------------------------------------------------------- 1 | module verbosity 2 | 3 | !============================================================== 4 | ! This code is part of MOLECULAR_TOOLS 5 | !============================================================== 6 | ! Description 7 | ! This module acts as a COMMON block with a common structure 8 | ! to set verbosity level in all the programs of the distribution 9 | ! 10 | ! Level Behaviour 11 | ! 0 Do not write anything 12 | ! 1 Basic verbose level (default) 13 | ! 2 Debug verbose level 14 | ! 3+ Pedantic verbose level 15 | !----------------------------------------------------- 16 | 17 | integer, save :: verbose = 1 18 | 19 | end module verbosity 20 | -------------------------------------------------------------------------------- /postprocessing/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = subdir-objects 2 | 3 | bin_PROGRAMS = reconvolute_TD reconvolute_TI convolute_RR excitation_RR addconvolution_RR addconvolution 4 | 5 | reconvolute_TD_SOURCES = \ 6 | version.f90 \ 7 | ../modules/line_preprocess.f90 \ 8 | ../modules/alerts.f90 \ 9 | ../modules/constants.f90 10 | 11 | # Now use a conditional to use FFTW of DFT 12 | if FFTW 13 | reconvolute_TD_SOURCES += \ 14 | ../modules/maths/fftw.f90 15 | else 16 | reconvolute_TD_SOURCES += \ 17 | ../modules/maths/dft.f90 18 | endif 19 | 20 | reconvolute_TD_SOURCES += \ 21 | reconvolute_TD.f90 22 | 23 | reconvolute_TD_LDFLAGS = @LIBS@ 24 | 25 | reconvolute_TI_SOURCES = \ 26 | version.f90 \ 27 | ../modules/line_preprocess.f90 \ 28 | ../modules/alerts.f90 \ 29 | ../modules/constants.f90 \ 30 | reconvolute_TI.f90 31 | 32 | reconvolute_TI_LDFLAGS = @LIBS@ 33 | 34 | convolute_RR_SOURCES = \ 35 | version.f90 \ 36 | ../modules/line_preprocess.f90 \ 37 | ../modules/alerts.f90 \ 38 | ../modules/constants.f90 \ 39 | convolute_RR.f90 40 | 41 | convolute_RR_LDFLAGS = @LIBS@ 42 | 43 | excitation_RR_SOURCES = \ 44 | version.f90 \ 45 | ../modules/line_preprocess.f90 \ 46 | ../modules/alerts.f90 \ 47 | ../modules/constants.f90 \ 48 | excitation_RR.f90 49 | 50 | excitation_RR_LDFLAGS = @LIBS@ 51 | 52 | addconvolution_RR_SOURCES = \ 53 | version.f90 \ 54 | ../modules/line_preprocess.f90 \ 55 | ../modules/alerts.f90 \ 56 | ../modules/constants.f90 \ 57 | addconvolution_RR.f90 58 | 59 | addconvolution_SOURCES = \ 60 | version.f90 \ 61 | ../modules/line_preprocess.f90 \ 62 | ../modules/alerts.f90 \ 63 | ../modules/constants.f90 \ 64 | addconvolution.f90 65 | 66 | addconvolution_RR_LDFLAGS = @LIBS@ 67 | 68 | CLEANFILES=*.mod 69 | 70 | .PHONY: ../modules/line_preprocess.f90 ../modules/alerts.f90 ../modules/constants.f90 71 | 72 | # Generate version file only if needed. To that end the 73 | # dependency of version.f90 is a non-file-associated 74 | # instruction that only changes the file if requiered 75 | # This avoids recompiling everything every time 76 | version.f90: get_git_version 77 | get_git_version: 78 | @bash ./get_git_version.sh $(FCFLAGS) $(LIBS) || echo "Reusing version file" 79 | 80 | -------------------------------------------------------------------------------- /postprocessing/addconvolution.f90: -------------------------------------------------------------------------------- 1 | program addconvolution 2 | 3 | use alerts 4 | use constants 5 | use line_preprocess 6 | 7 | implicit none 8 | 9 | real(8),dimension(:),allocatable :: w,spect 10 | integer :: N 11 | character(len=8) :: hwhm_char 12 | real(8) :: hwhm_eV=0.01d0 13 | !Counters 14 | integer :: i, j 15 | 16 | ! Input defaults 17 | character(len=3) :: broadfun='GAU' 18 | ! Cut convolution after ntimes hwhm 19 | real(8) :: ncut_gau = -1.d0, & 20 | ncut_lor = -1.d0 21 | 22 | ! Additional data 23 | real(8) :: wi, specti 24 | 25 | real(8) :: dw 26 | 27 | 28 | !IO 29 | character(len=200) :: input_spc='spec_LS.dat',& 30 | stickfile,output_spc 31 | integer :: I_STCK=10, & 32 | O_SPC =20, & 33 | O_STCK=21 34 | integer :: ioflag 35 | character(len=200) :: line 36 | character :: cnull 37 | 38 | 39 | ! Read command_line_options 40 | call parse_input(input_spc,hwhm_eV,broadfun,ncut_gau,ncut_lor) 41 | 42 | ! Set options upper case 43 | call set_word_upper_case(broadfun) 44 | 45 | write(6,*) 'Reading data from: '//trim(adjustl(input_spc)) 46 | 47 | if (ncut_gau < 0) ncut_gau = 20.0 48 | if (ncut_lor < 0) ncut_lor = 100.0 49 | 50 | ! Write spectrum to files 51 | write(hwhm_char,'(F8.3)') hwhm_eV 52 | output_spc="spec_LS_add-HWHM_"//trim(adjustl(hwhm_char))//".dat" 53 | open(O_SPC,file=output_spc,status="replace") 54 | write(6,*) 'Writing data to : '//trim(adjustl(output_spc)) 55 | 56 | ! Read inout bins (sticks) 57 | open(I_STCK,file=input_spc,iostat=ioflag) 58 | ! Read file as E(eV) LS 59 | N=1 60 | do 61 | read(I_STCK,'(A)',iostat=ioflag) line 62 | if (ioflag/=0) exit 63 | read(line,*) wi, specti 64 | N = N+1 65 | enddo 66 | 67 | ! Allocate arrays 68 | allocate(spect(N),w(N)) 69 | 70 | ! Now, read again all file and convolute each excitation profile 71 | rewind(I_STCK) 72 | i=0 73 | do 74 | read(I_STCK,'(A)',iostat=ioflag) line 75 | if (ioflag/=0) exit 76 | 77 | i = i+1 78 | if (i>N) call alert_msg('fatal','Inconsistency in input file') 79 | 80 | read(line,*) w(i), spect(i) 81 | 82 | enddo 83 | close(I_STCK) 84 | 85 | call add_convolution(w,spect,broadfun,hwhm_eV,ncut_gau,ncut_lor) 86 | ! Return to RR intensity 87 | do i=1,N 88 | write(O_SPC,'(F13.4,X,F15.4,X,E19.5)') w(i), spect(i) 89 | enddo 90 | 91 | write(6,'(X,A,/)') 'Done' 92 | 93 | close(O_SPC) 94 | 95 | ! 96 | 97 | stop 98 | 99 | contains 100 | 101 | subroutine add_convolution(w,spect,broadfun,hwhm_eV,ncut_gau,ncut_lor) 102 | 103 | use constants 104 | 105 | ! Args 106 | real(8),dimension(:),intent(inout) :: w,spect 107 | character(len=*),intent(in) :: broadfun 108 | real(8),intent(in) :: hwhm_eV 109 | real(8),intent(in) :: ncut_gau,ncut_lor 110 | 111 | ! Local 112 | real(8),dimension(:),allocatable :: y 113 | real(8) :: dx, xr, brd, C 114 | integer :: N 115 | 116 | N = size(w) 117 | allocate(y(N)) 118 | 119 | dx = w(2) - w(1) 120 | 121 | ! Make convolution over the grid 122 | do i=1,N 123 | ! Fill x-grid 124 | y(i) = 0.d0 125 | do j=1,N 126 | xr = w(j) - w(i) 127 | ! Skip points beyond 20*HWHM from the center of the gaussian 128 | ! this increases efficiency and avoids IEEE_UNDERFLOW_FLAG IEEE_DENORMAL flags 129 | if (broadfun == 'GAU') then 130 | if (dabs(xr)>hwhm_eV*ncut_gau) cycle 131 | C = dlog(2.d0)/hwhm_eV**2 132 | brd = dsqrt(C/pi) * dexp(-C * xr**2) 133 | else if (broadfun == 'LOR') then 134 | if (dabs(xr)>hwhm_eV*ncut_lor) cycle 135 | C = hwhm_eV/pi !dsqrt(pi) 136 | brd = C/(xr**2 + hwhm_eV**2) 137 | endif 138 | y(i) = y(i) + brd * spect(j) * dx 139 | enddo 140 | enddo 141 | 142 | ! Update output values 143 | spect = y 144 | deallocate(y) 145 | 146 | return 147 | 148 | end subroutine add_convolution 149 | 150 | 151 | subroutine parse_input(input_spc,hwhm_eV,broadfun,ncut_gau,ncut_lor) 152 | 153 | character(len=*),intent(inout) :: input_spc, broadfun 154 | real(8),intent(inout) :: hwhm_eV, ncut_gau, ncut_lor 155 | 156 | ! Local 157 | logical :: argument_retrieved, & 158 | need_help = .false. 159 | integer:: i 160 | character(len=200) :: arg 161 | 162 | argument_retrieved=.false. 163 | do i=1,iargc() 164 | if (argument_retrieved) then 165 | argument_retrieved=.false. 166 | cycle 167 | endif 168 | call getarg(i, arg) 169 | select case (adjustl(arg)) 170 | case ("-f") 171 | call getarg(i+1, input_spc) 172 | argument_retrieved=.true. 173 | 174 | case ("-brd") 175 | call getarg(i+1, broadfun) 176 | argument_retrieved=.true. 177 | 178 | case ("-hwhm") 179 | call getarg(i+1, arg) 180 | read(arg,*) hwhm_eV 181 | argument_retrieved=.true. 182 | 183 | case ("-cut-lor") 184 | call getarg(i+1, arg) 185 | read(arg,*) ncut_lor 186 | argument_retrieved=.true. 187 | 188 | case ("-cut-gau") 189 | call getarg(i+1, arg) 190 | read(arg,*) ncut_gau 191 | argument_retrieved=.true. 192 | 193 | case ("-h") 194 | need_help=.true. 195 | 196 | case default 197 | print*, "Unkown command line argument: "//adjustl(arg) 198 | need_help = .true. 199 | end select 200 | enddo 201 | 202 | !Print options (to stderr) 203 | if (need_help) then 204 | 205 | write(0,'(/,A)') ' addconvolution ' 206 | write(0,'(A)' ) '-----------------' 207 | write(0,'(A)' ) 'Add a convolution to a full LS spectrum' 208 | 209 | call print_version(0) 210 | 211 | write(0,'(/,A)') 'SYNOPSIS' 212 | write(0,'(A)' ) 'addconvolution [-f (input_spc) -brd (broadtype) -hwhm (hwhm) -h]' 213 | 214 | write(0,'(/,A)') 'OPTIONS' 215 | write(0,'(A)' ) 'Flag Description Current Value' 216 | write(0,'(A)' ) ' -f Input spectrum '//trim(adjustl(input_spc)) 217 | write(0,'(A)' ) ' -brd Broad func (GAU|LOR) '//trim(adjustl(broadfun)) 218 | write(0,'(A,F8.3)')' -hwhm HWHM (in eV) ' ,hwhm_eV 219 | write(0,'(A,F8.3)')' -cut-lor Multiple of hwhm when to ' ,ncut_lor 220 | write(0,'(A)' ) ' cut the Lor convolution' 221 | write(0,'(A,F8.3)')' -cut-gau Multiple of hwhm when to ' ,ncut_gau 222 | write(0,'(A)' ) ' cut the Gau convolution' 223 | write(0,'(A)' ) ' -h Print help ' 224 | write(0,*) '' 225 | 226 | stop 227 | endif 228 | 229 | return 230 | end subroutine parse_input 231 | 232 | end program addconvolution 233 | -------------------------------------------------------------------------------- /postprocessing/addconvolution_RR.f90: -------------------------------------------------------------------------------- 1 | program addconvolution_RR 2 | 3 | use alerts 4 | use constants 5 | use line_preprocess 6 | 7 | implicit none 8 | 9 | real(8),dimension(:),allocatable :: w,spect 10 | integer :: N 11 | character(len=8) :: hwhm_char 12 | real(8) :: hwhm_eV=0.01d0 13 | !Counters 14 | integer :: i, j 15 | 16 | ! Input defaults 17 | character(len=3) :: broadfun='GAU' 18 | ! Cut convolution after ntimes hwhm 19 | real(8) :: ncut_gau = -1.d0, & 20 | ncut_lor = -1.d0 21 | 22 | ! Additional data 23 | real(8) :: wi, ws, rr, ws_ 24 | 25 | real(8) :: dw 26 | 27 | 28 | !IO 29 | character(len=200) :: RRdatafile='(default)',& 30 | stickfile,RRoutfile 31 | integer :: I_STCK=10, & 32 | O_SPC =20, & 33 | O_STCK=21 34 | integer :: ioflag 35 | character(len=200) :: line 36 | character :: cnull 37 | 38 | 39 | ! Read command_line_options 40 | call parse_input(RRdatafile,hwhm_eV,broadfun,ncut_gau,ncut_lor) 41 | 42 | ! Set options upper case 43 | call set_word_upper_case(broadfun) 44 | 45 | ! Set dagaults 46 | if (RRdatafile == '(default)') then 47 | RRdatafile = 'RR_Spectrum_2D.dat' 48 | endif 49 | write(6,*) 'Reading data from: '//trim(adjustl(RRdatafile)) 50 | 51 | if (ncut_gau < 0) ncut_gau = 20.0 52 | if (ncut_lor < 0) ncut_lor = 100.0 53 | 54 | ! Write spectrum to files 55 | write(hwhm_char,'(F8.3)') hwhm_eV 56 | RRoutfile="RR_Spectrum_2D_hwhm"//trim(adjustl(hwhm_char))//".dat" 57 | open(O_SPC,file=RRoutfile,status="replace") 58 | write(6,*) 'Writing data to : '//trim(adjustl(RRoutfile)) 59 | 60 | ! Read inout bins (sticks) 61 | open(I_STCK,file=RRdatafile,iostat=ioflag) 62 | ! First get number of wI points inthe grid 63 | ! Skip header line 64 | read(I_STCK,*,iostat=ioflag) line 65 | read(I_STCK,*,iostat=ioflag) line 66 | ws_ = -1.0 67 | N=1 68 | read(I_STCK,'(A)',iostat=ioflag) line 69 | read(line,*) ws_, wi, rr 70 | do 71 | read(I_STCK,'(A)',iostat=ioflag) line 72 | if (ioflag/=0) exit 73 | read(line,*) ws, wi, rr 74 | if (ws /= ws_) exit 75 | N = N+1 76 | enddo 77 | 78 | ! Allocate arrays 79 | allocate(spect(N),w(N)) 80 | 81 | ! Now, read again all file and convolute each excitation profile 82 | rewind(I_STCK) 83 | ! Skip header line 84 | read(I_STCK,'(A)',iostat=ioflag) line 85 | write(O_SPC,'(A)') trim(line) 86 | read(I_STCK,'(A)',iostat=ioflag) line 87 | write(O_SPC,'(A)') trim(line) 88 | ws_ = -1.d0 89 | do 90 | read(I_STCK,'(A)',iostat=ioflag) line 91 | if (ioflag/=0) exit 92 | read(line,*) ws, wi, rr 93 | ! print*, rr 94 | if (ws /= ws_) then 95 | ws_ = ws 96 | i=0 97 | print'(A,F10.4,A)', 'Convoluting ', ws, ' ...' 98 | endif 99 | 100 | i = i+1 101 | if (i>N) call alert_msg('fatal','Inconsistency in input file') 102 | 103 | w(i) = wI 104 | spect(i) = rr 105 | 106 | if (i == N) then 107 | ! Get lineshape 108 | do i=1,N 109 | spect(i) = spect(i) / (w(i)-ws)**4 110 | enddo 111 | call add_convolution(w,spect,broadfun,hwhm_eV,ncut_gau,ncut_lor) 112 | ! Return to RR intensity 113 | do i=1,N 114 | write(O_SPC,'(F13.4,X,F15.4,X,E19.5)') ws, w(i), spect(i) * (w(i)-ws)**4 115 | enddo 116 | endif 117 | 118 | 119 | enddo 120 | 121 | write(6,'(X,A,/)') 'Done' 122 | 123 | ! 124 | 125 | stop 126 | 127 | contains 128 | 129 | subroutine add_convolution(w,spect,broadfun,hwhm_eV,ncut_gau,ncut_lor) 130 | 131 | use constants 132 | 133 | ! Args 134 | real(8),dimension(:),intent(inout) :: w,spect 135 | character(len=*),intent(in) :: broadfun 136 | real(8),intent(in) :: hwhm_eV 137 | real(8),intent(in) :: ncut_gau,ncut_lor 138 | 139 | ! Local 140 | real(8),dimension(:),allocatable :: y 141 | real(8) :: dx, hwhm_cm1, xr, brd, C 142 | integer :: N 143 | 144 | N = size(w) 145 | allocate(y(N)) 146 | 147 | hwhm_cm1 = hwhm_eV * evtown 148 | 149 | dx = w(2) - w(1) 150 | 151 | ! Make convolution over the grid 152 | do i=1,N 153 | ! Fill x-grid 154 | y(i) = 0.d0 155 | do j=1,N 156 | xr = w(j) - w(i) 157 | ! Skip points beyond 20*HWHM from the center of the gaussian 158 | ! this increases efficiency and avoids IEEE_UNDERFLOW_FLAG IEEE_DENORMAL flags 159 | if (broadfun == 'GAU') then 160 | if (dabs(xr)>hwhm_cm1*ncut_gau) cycle 161 | C = dlog(2.d0)/hwhm_cm1**2 162 | brd = dsqrt(C/pi) * dexp(-C * xr**2) 163 | else if (broadfun == 'LOR') then 164 | if (dabs(xr)>hwhm_cm1*ncut_lor) cycle 165 | C = hwhm_cm1/pi !dsqrt(pi) 166 | brd = C/(xr**2 + hwhm_cm1**2) 167 | endif 168 | y(i) = y(i) + brd * spect(j) * dx 169 | enddo 170 | enddo 171 | 172 | ! Update output values 173 | spect = y 174 | deallocate(y) 175 | 176 | return 177 | 178 | end subroutine add_convolution 179 | 180 | 181 | subroutine parse_input(RRdatafile,hwhm_eV,broadfun,ncut_gau,ncut_lor) 182 | 183 | character(len=*),intent(inout) :: RRdatafile, broadfun 184 | real(8),intent(inout) :: hwhm_eV, ncut_gau, ncut_lor 185 | 186 | ! Local 187 | logical :: argument_retrieved, & 188 | need_help = .false. 189 | integer:: i 190 | character(len=200) :: arg 191 | 192 | argument_retrieved=.false. 193 | do i=1,iargc() 194 | if (argument_retrieved) then 195 | argument_retrieved=.false. 196 | cycle 197 | endif 198 | call getarg(i, arg) 199 | select case (adjustl(arg)) 200 | case ("-f") 201 | call getarg(i+1, RRdatafile) 202 | argument_retrieved=.true. 203 | 204 | case ("-brd") 205 | call getarg(i+1, broadfun) 206 | argument_retrieved=.true. 207 | 208 | case ("-hwhm") 209 | call getarg(i+1, arg) 210 | read(arg,*) hwhm_eV 211 | argument_retrieved=.true. 212 | 213 | case ("-cut-lor") 214 | call getarg(i+1, arg) 215 | read(arg,*) ncut_lor 216 | argument_retrieved=.true. 217 | 218 | case ("-cut-gau") 219 | call getarg(i+1, arg) 220 | read(arg,*) ncut_gau 221 | argument_retrieved=.true. 222 | 223 | case ("-h") 224 | need_help=.true. 225 | 226 | case default 227 | print*, "Unkown command line argument: "//adjustl(arg) 228 | need_help = .true. 229 | end select 230 | enddo 231 | 232 | !Print options (to stderr) 233 | if (need_help) then 234 | 235 | write(0,'(/,A)') ' addconvolution_RR ' 236 | write(0,'(A)' ) '-----------------' 237 | write(0,'(A)' ) 'Add a convolution (over wI axis) to the' 238 | write(0,'(A)' ) '2D RR spectra. Requires a fine grid as input' 239 | 240 | call print_version(0) 241 | 242 | write(0,'(/,A)') 'SYNOPSIS' 243 | write(0,'(A)' ) 'addconvolution_RR [-f (RRdatafile) -brd (broadtype) -hwhm (hwhm) -h]' 244 | 245 | write(0,'(/,A)') 'OPTIONS' 246 | write(0,'(A)' ) 'Flag Description Current Value' 247 | write(0,'(A)' ) ' -f Correlation function file '//trim(adjustl(RRdatafile)) 248 | write(0,'(A)' ) ' -brd Broad func (GAU|LOR) '//trim(adjustl(broadfun)) 249 | write(0,'(A,F8.3)')' -hwhm HWHM (in cm-1) ' ,hwhm_eV 250 | write(0,'(A,F8.3)')' -cut-lor Multiple of hwhm when to ' ,ncut_lor 251 | write(0,'(A)' ) ' cut the Lor convolution' 252 | write(0,'(A,F8.3)')' -cut-gau Multiple of hwhm when to ' ,ncut_gau 253 | write(0,'(A)' ) ' cut the Gau convolution' 254 | write(0,'(A)' ) ' -h Print help ' 255 | write(0,*) '' 256 | 257 | stop 258 | endif 259 | 260 | return 261 | end subroutine parse_input 262 | 263 | end program addconvolution_RR 264 | -------------------------------------------------------------------------------- /postprocessing/convolute_RR.f90: -------------------------------------------------------------------------------- 1 | program convolute_RR 2 | 3 | use alerts 4 | use constants 5 | use line_preprocess 6 | 7 | implicit none 8 | 9 | real(8),dimension(:),allocatable :: w,spect 10 | real(8),dimension(:),allocatable :: ystick,xstick 11 | real(8) :: factor, df, dw, & 12 | broad, wau, dgau, dgau2, & 13 | C, brd, x0, xf, dx, xr 14 | integer :: iexp, nbroad, N 15 | character(len=3) :: optrans 16 | character(len=8) :: wI_char 17 | !Counters 18 | integer :: i, j 19 | 20 | ! Input defaults 21 | character(len=3) :: broadfun='LOR' 22 | character(len=2) :: source='1D' 23 | integer :: npoints=1001 24 | real(8) :: resol=-1. 25 | real(8) :: hwhm_cm1=10.d0 26 | real(8) :: wi_req=0.d0 27 | 28 | ! Additional data 29 | real(8) :: wi_sel, dev_wi, & 30 | wi, ws, rr, ws_,& 31 | ws_max, ws_min 32 | integer :: ni 33 | logical :: include_Rayleigh = .false. 34 | 35 | !IO 36 | character(len=200) :: RRdatafile='(default)',& 37 | stickfile,convfile 38 | integer :: I_STCK=10, & 39 | O_SPC =20, & 40 | O_STCK=21 41 | integer :: ioflag 42 | character(len=200) :: line 43 | character :: cnull 44 | 45 | 46 | ! Read command_line_options 47 | call parse_input(RRdatafile,npoints,resol,hwhm_cm1,broadfun,source,wi_req,include_Rayleigh) 48 | 49 | ! Set options upper case 50 | call set_word_upper_case(source) 51 | call set_word_upper_case(broadfun) 52 | 53 | if (RRdatafile == '(default)') then 54 | if (source == '2D') then 55 | RRdatafile = 'RR_Spectrum_2D.dat' 56 | else 57 | RRdatafile = 'RR_Spectrum_VertE.dat' 58 | endif 59 | write(6,*) 'Reading data from: '//trim(adjustl(RRdatafile)) 60 | endif 61 | 62 | ! Read inout bins (sticks) 63 | open(I_STCK,file=RRdatafile,iostat=ioflag) 64 | if (ioflag/=0) call alert_msg('fatal','Cannot open RR datafile: '//trim(adjustl(RRdatafile))) 65 | if (source == '2D') then 66 | ! First get N=ns and select the closest indicident freq 67 | ws = 0.d0 68 | dev_wi = 1.e10 69 | N = 1 70 | ni = 0 71 | ws_max = 0.d0 72 | ! Skip header line 73 | read(I_STCK,*,iostat=ioflag) line 74 | read(I_STCK,*,iostat=ioflag) line 75 | do 76 | ws_ = ws 77 | read(I_STCK,'(A)',iostat=ioflag) line 78 | if (ioflag/=0) exit 79 | read(line,*) ws, wi, rr 80 | if (ws > ws_max) then 81 | ws_max = ws 82 | endif 83 | if (ws_ /= ws ) then 84 | N = N+1 85 | endif 86 | ! This is only done for the first ws value 87 | if (N == 1) then 88 | ni = ni + 1 89 | if (dabs(wi-wi_req) < dev_wi) then 90 | wi_sel = wi 91 | dev_wi = dabs(wi-wi_req) 92 | endif 93 | elseif (N == 2) then 94 | ws_min = ws 95 | endif 96 | enddo 97 | rewind(I_STCK) 98 | else if (source == '1D') then 99 | read(I_STCK,*,iostat=ioflag) line 100 | read(I_STCK,'(A)',iostat=ioflag) line 101 | call split_line(line,'maximum',cnull,line) 102 | read(line,*) wi_sel, cnull 103 | read(I_STCK,*,iostat=ioflag) line 104 | ! Change from eV to cm-1 105 | wi_sel = wi_sel * evtown 106 | i = 0 107 | do 108 | read(I_STCK,'(A)',iostat=ioflag) line 109 | if (ioflag/=0) exit 110 | read(line,*) ws_max 111 | if (i==1) ws_min = ws_max 112 | i = i+1 113 | enddo 114 | N = i 115 | rewind(I_STCK) 116 | else 117 | call alert_msg('fatal','Unkown -type option') 118 | endif 119 | write(6,'(X,A,F10.2,A,/)') 'Incident frequency =', wi_sel, ' cm-1' 120 | 121 | ! Generate grid 122 | if (include_Rayleigh) then 123 | ws_min = 0.d0 124 | else 125 | N = N-1 126 | endif 127 | x0 = ws_min - hwhm_cm1*6.0 128 | xf = ws_max + hwhm_cm1*6.0 129 | if (resol > 0) then 130 | npoints = nint(( xf - x0 )/dx) + 1 131 | xf = x0 + resol*dfloat(npoints-1) 132 | endif 133 | dx = ( xf - x0 )/dfloat(npoints - 1) 134 | 135 | ! Allocate 136 | allocate(xstick(N),ystick(N),spect(npoints),w(npoints)) 137 | 138 | ! Then read data 139 | if (source == '2D') then 140 | i=0 141 | read(I_STCK,*,iostat=ioflag) line 142 | read(I_STCK,*,iostat=ioflag) line 143 | do 144 | read(I_STCK,'(A)',iostat=ioflag) line 145 | if (ioflag/=0) exit 146 | read(line,*) ws, wi, rr 147 | if (.not.include_Rayleigh .and. ws==0.d0) cycle 148 | if (wi == wi_sel) then 149 | i = i+1 150 | xstick(i) = ws 151 | ystick(i) = rr 152 | endif 153 | enddo 154 | if (i /= N) call alert_msg('fatal','reading scattered frequencies from 2D file') 155 | else 156 | read(I_STCK,*,iostat=ioflag) line 157 | read(I_STCK,*,iostat=ioflag) line 158 | read(I_STCK,*,iostat=ioflag) line 159 | if (.not.include_Rayleigh) read(I_STCK,*,iostat=ioflag) line 160 | do i=1,N 161 | read(I_STCK,*,iostat=ioflag) xstick(i), ystick(i) 162 | enddo 163 | endif 164 | 165 | ! Make convolution over the grid 166 | do i=1,npoints 167 | ! Fill x-grid 168 | w(i) = x0 + (i-1)*dx 169 | spect(i) = 0.d0 170 | do j=1,N 171 | xr = xstick(j) - w(i) 172 | ! Skip points beyond 20*HWHM from the center of the gaussian 173 | ! this increases efficiency and avoids IEEE_UNDERFLOW_FLAG IEEE_DENORMAL flags 174 | if (broadfun == 'GAU' .or. broadfun == 'VOI') then 175 | if (dabs(xr)>hwhm_cm1*20.0) cycle 176 | C = dlog(2.d0)/hwhm_cm1**2 177 | brd = dsqrt(C/pi) * dexp(-C * xr**2) 178 | else if (broadfun == 'LOR') then 179 | if (dabs(xr)>hwhm_cm1*100.0) cycle 180 | C = hwhm_cm1/pi !dsqrt(pi) 181 | brd = C/(xr**2 + hwhm_cm1**2) 182 | endif 183 | spect(i) = spect(i) + brd * ystick(j) 184 | enddo 185 | enddo 186 | 187 | ! Write spectrum to files 188 | write(wI_char,'(I0)') int(wi_sel) 189 | convfile="RR_convoluted_wI"//trim(adjustl(wI_char))//".dat" 190 | open(O_SPC,file=convfile,status="replace") 191 | dw = (w(2)-w(1))/autoev !in Au 192 | do i=1,npoints 193 | write(O_SPC,'(F15.5,3X,G18.8E3)') w(i), spect(i) 194 | enddo 195 | close(O_SPC) 196 | ! 197 | 198 | 199 | stop 200 | 201 | contains 202 | 203 | subroutine parse_input(RRdatafile,npoints,resol,hwhm_cm1,broadfun,source,wi_req,include_Rayleigh) 204 | 205 | character(len=*),intent(inout) :: RRdatafile,broadfun,source 206 | real(8),intent(inout) :: hwhm_cm1, wi_req, resol 207 | integer,intent(inout) :: npoints 208 | logical,intent(inout) :: include_Rayleigh 209 | 210 | ! Local 211 | logical :: argument_retrieved, & 212 | need_help = .false. 213 | integer:: i 214 | character(len=200) :: arg 215 | 216 | argument_retrieved=.false. 217 | do i=1,iargc() 218 | if (argument_retrieved) then 219 | argument_retrieved=.false. 220 | cycle 221 | endif 222 | call getarg(i, arg) 223 | select case (adjustl(arg)) 224 | case ("-f") 225 | call getarg(i+1, RRdatafile) 226 | argument_retrieved=.true. 227 | 228 | case ("-npoints") 229 | call getarg(i+1, arg) 230 | read(arg,*) npoints 231 | argument_retrieved=.true. 232 | 233 | case ("-resol") 234 | call getarg(i+1, arg) 235 | read(arg,*) resol 236 | argument_retrieved=.true. 237 | 238 | case ("-hwhm") 239 | call getarg(i+1, arg) 240 | read(arg,*) hwhm_cm1 241 | argument_retrieved=.true. 242 | 243 | case ("-brd") 244 | call getarg(i+1, broadfun) 245 | argument_retrieved=.true. 246 | 247 | case ("-type") 248 | call getarg(i+1, source) 249 | argument_retrieved=.true. 250 | 251 | case ("-wI") 252 | call getarg(i+1, arg) 253 | read(arg,*) wi_req 254 | ! If -wI requested, we need 2D source 255 | source='2D' 256 | argument_retrieved=.true. 257 | 258 | case ("-Rayleigh") 259 | include_Rayleigh=.true. 260 | case ("-noRayleigh") 261 | include_Rayleigh=.false. 262 | 263 | case ("-h") 264 | need_help=.true. 265 | 266 | case default 267 | print*, "Unkown command line argument: "//adjustl(arg) 268 | need_help = .true. 269 | end select 270 | enddo 271 | 272 | !Print options (to stderr) 273 | if (need_help) then 274 | 275 | write(0,'(/,A)') ' convolute_RR ' 276 | write(0,'(A)' ) '-----------------' 277 | write(0,'(A)' ) 'Generates a convolution of a RR' 278 | write(0,'(A)' ) 'spectrum, from 1D or 2D output files' 279 | 280 | call print_version(0) 281 | 282 | write(0,'(/,A)') 'SYNOPSIS' 283 | write(0,'(A)' ) 'convolute_RR [-f (RRdatafile) -type (1D|2D) -brd (broadfun) -hwhm (hwhm_cm1) '//& 284 | '-wI (wI) -h]' 285 | 286 | write(0,'(/,A)') 'OPTIONS' 287 | write(0,'(A)' ) 'Flag Description Current Value' 288 | write(0,'(A)' ) ' -f Correlation function file '//trim(adjustl(RRdatafile)) 289 | write(0,'(A,I8)') ' -npoints Nr points for output plot' ,npoints 290 | write(0,'(A,F8.3)')' -resol resolution (in cm-1) ' ,resol 291 | write(0,'(A)' ) ' (if <0, ignore and use npoints)' 292 | write(0,'(A)' ) ' -brd Broad func (GAU|LOR) '//trim(adjustl(broadfun)) 293 | write(0,'(A,F8.3)')' -hwhm HWHM (in eV) ' ,hwhm_cm1 294 | write(0,'(A)' ) ' -type Type of output file '//trim(adjustl(source)) 295 | write(0,'(A)' ) ' (1D|2D)' 296 | write(0,'(A,F8.3)')' -wI Incident frequency (2D only)' ,wi_req 297 | write(0,'(A)' ) ' (The closest value from the file is used)' 298 | write(0,'(A,L1)' )' -[no]Rayleigh Include Rayleigh band ',include_Rayleigh 299 | write(0,'(A)' ) ' -h Print help ' 300 | write(0,*) '' 301 | 302 | stop 303 | endif 304 | 305 | return 306 | end subroutine parse_input 307 | 308 | end program convolute_RR 309 | -------------------------------------------------------------------------------- /postprocessing/excitation_RR.f90: -------------------------------------------------------------------------------- 1 | program excitation_RR 2 | 3 | use alerts 4 | use constants 5 | use line_preprocess 6 | 7 | implicit none 8 | 9 | real(8),dimension(:),allocatable :: w,spect 10 | integer :: N 11 | character(len=3) :: optrans 12 | character(len=8) :: wS_char 13 | !Counters 14 | integer :: i, j 15 | 16 | ! Input defaults 17 | real(8) :: ws_req=0.d0 18 | 19 | ! Additional data 20 | real(8) :: wi, ws, rr, ws_,& 21 | ws_max, ws_min, & 22 | ws_sel, dev_ws 23 | logical :: read_wi 24 | 25 | 26 | !IO 27 | character(len=200) :: RRdatafile='(default)',& 28 | stickfile,excfile 29 | integer :: I_STCK=10, & 30 | O_SPC =20, & 31 | O_STCK=21 32 | integer :: ioflag 33 | character(len=200) :: line 34 | character :: cnull 35 | 36 | 37 | ! Read command_line_options 38 | call parse_input(RRdatafile,ws_req) 39 | 40 | ! Set dagaults 41 | if (RRdatafile == '(default)') then 42 | RRdatafile = 'RR_Spectrum_2D.dat' 43 | endif 44 | write(6,*) 'Reading data from: '//trim(adjustl(RRdatafile)) 45 | 46 | ! Read inout bins (sticks) 47 | open(I_STCK,file=RRdatafile,iostat=ioflag) 48 | ! First get number of wI points inthe grid 49 | ! Skip header line 50 | read(I_STCK,*,iostat=ioflag) line 51 | read(I_STCK,*,iostat=ioflag) line 52 | ws_ = -1.0 53 | dev_ws = 9999. 54 | N=1 55 | read(I_STCK,'(A)',iostat=ioflag) line 56 | read(line,*) ws_, wi, rr 57 | do 58 | read(I_STCK,'(A)',iostat=ioflag) line 59 | if (ioflag/=0) exit 60 | read(line,*) ws, wi, rr 61 | if (ws /= ws_) exit 62 | N = N+1 63 | enddo 64 | ! Allocate and read the data 65 | allocate(spect(N),w(N)) 66 | rewind(I_STCK) 67 | ! Skip header line 68 | read(I_STCK,*,iostat=ioflag) line 69 | read(I_STCK,*,iostat=ioflag) line 70 | ws_ = -1.0 71 | dev_ws = 9999. 72 | do 73 | read(I_STCK,'(A)',iostat=ioflag) line 74 | if (ioflag/=0) exit 75 | read(line,*) ws, wi, rr 76 | ! print*, rr 77 | if (ws /= ws_) then 78 | ws_ = ws 79 | read_wi = .false. 80 | i=0 81 | ! Check if we are the closest till now 82 | 83 | if (dabs(ws-ws_req) < dev_ws) then 84 | ws_sel = ws 85 | dev_ws = dabs(ws-ws_req) 86 | read_wi = .true. 87 | endif 88 | endif 89 | 90 | if (read_wi) then 91 | i = i+1 92 | w(i) = wI 93 | spect(i) = rr 94 | endif 95 | enddo 96 | write(6,'(X,A,F10.2,A,/)') 'Scattered frequency =', ws_sel, ' cm-1' 97 | 98 | ! Write spectrum to files 99 | write(wS_char,'(I0)') int(ws_sel) 100 | excfile="RR_excitation_wS"//trim(adjustl(wS_char))//".dat" 101 | open(O_SPC,file=excfile,status="replace") 102 | do i=1,N 103 | write(O_SPC,'(F15.5,3X,G18.8E3)') w(i), spect(i) 104 | enddo 105 | close(O_SPC) 106 | ! 107 | 108 | stop 109 | 110 | contains 111 | 112 | subroutine parse_input(RRdatafile,ws_req) 113 | 114 | character(len=*),intent(inout) :: RRdatafile 115 | real(8),intent(inout) :: ws_req 116 | 117 | ! Local 118 | logical :: argument_retrieved, & 119 | need_help = .false. 120 | integer:: i 121 | character(len=200) :: arg 122 | 123 | argument_retrieved=.false. 124 | do i=1,iargc() 125 | if (argument_retrieved) then 126 | argument_retrieved=.false. 127 | cycle 128 | endif 129 | call getarg(i, arg) 130 | select case (adjustl(arg)) 131 | case ("-f") 132 | call getarg(i+1, RRdatafile) 133 | argument_retrieved=.true. 134 | 135 | case ("-wS") 136 | call getarg(i+1, arg) 137 | read(arg,*) ws_req 138 | argument_retrieved=.true. 139 | 140 | case ("-h") 141 | need_help=.true. 142 | 143 | case default 144 | print*, "Unkown command line argument: "//adjustl(arg) 145 | need_help = .true. 146 | end select 147 | enddo 148 | 149 | !Print options (to stderr) 150 | if (need_help) then 151 | 152 | write(0,'(/,A)') ' excitation_RR ' 153 | write(0,'(A)' ) '-----------------' 154 | write(0,'(A)' ) 'Extract excitation profile from' 155 | write(0,'(A)' ) '2D output files' 156 | 157 | call print_version(0) 158 | 159 | write(0,'(/,A)') 'SYNOPSIS' 160 | write(0,'(A)' ) 'excitation_RR [-f (RRdatafile) -wS (wS) -h]' 161 | 162 | write(0,'(/,A)') 'OPTIONS' 163 | write(0,'(A)' ) 'Flag Description Current Value' 164 | write(0,'(A)' ) ' -f 2D RR spectrum file '//trim(adjustl(RRdatafile)) 165 | write(0,'(A,F8.3)')' -wS Scattered frequency(cm-1)' ,ws_req 166 | write(0,'(A)' ) ' (The closest value from the file is used)' 167 | write(0,'(A)' ) ' -h Print help ' 168 | write(0,*) '' 169 | 170 | stop 171 | endif 172 | 173 | return 174 | end subroutine parse_input 175 | 176 | end program excitation_RR 177 | -------------------------------------------------------------------------------- /postprocessing/get_git_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git show -s --format=%ci &>/dev/null 4 | not_git_repo=$? 5 | 6 | if (( $not_git_repo )); then 7 | 8 | if [ -e version.f90 ]; then 9 | echo "" 10 | echo "*************************************************" 11 | echo "Not git and version.f90 exists. Reusing it." 12 | echo "*************************************************" 13 | echo "" 14 | else 15 | cat < version.f90 16 | subroutine print_version(unt) 17 | 18 | integer,intent(in) :: unt 19 | 20 | write(unt,'(/,X,A)') "GIT VERSION INFO -- Not Available" 21 | write(unt,'(X,A,/)') " First config date: $(date)" 22 | 23 | return 24 | end subroutine 25 | EOF 26 | 27 | fi 28 | 29 | else 30 | 31 | git_hash=$(git describe --long --dirty --always) 32 | git_date=$(git show -s --format=%ci) 33 | user=$USER 34 | 35 | if [ -f version.f90 ]; then 36 | old_git_hash=$(grep "Commit id :" version.f90) 37 | old_git_hash=${old_git_hash##*Commit id : } 38 | old_git_hash=${old_git_hash%\"} 39 | else 40 | old_git_hash="" 41 | fi 42 | 43 | 44 | if [ "$old_git_hash" != "$git_hash" ]; then 45 | echo "" 46 | echo "*************************************************" 47 | echo "Git hash changed from previous compilation: " 48 | echo " Old: $old_git_hash" 49 | echo " New: $git_hash" 50 | echo " A new version.f90 file will be generated" 51 | echo "*************************************************" 52 | echo "" 53 | cat < version.f90 54 | subroutine print_version(unt) 55 | 56 | integer,intent(in) :: unt 57 | 58 | write(unt,'(/,X,A)') "GIT VERSION INFO" 59 | write(unt,'(X,A)') " Commit id : $git_hash" 60 | write(unt,'(X,A,/)') " Commit date: $git_date" 61 | 62 | return 63 | end subroutine 64 | EOF 65 | 66 | else 67 | echo "" 68 | echo "*************************************************" 69 | echo "Git hash did not change from previous compilation" 70 | echo "*************************************************" 71 | echo "" 72 | fi 73 | 74 | fi -------------------------------------------------------------------------------- /python/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = subdir-objects 2 | # get *py files to the distribution with "make dist" 3 | EXTRA_DIST = fcc_analyzer_PyQt5.py fcc_version_tag.py fcc_RRinspector_PyQt5.py sum_spectra.py 4 | 5 | fcc_version_tag.py:python-update-version-local 6 | 7 | python-update-version-local: 8 | @echo " " 9 | @echo "Updating version_tag.py..." 10 | @echo "Did you first git-commit your changes?" 11 | @echo " " 12 | @./get_git_version.sh || echo "Reusing version file" 13 | 14 | all-local: python-update-version-local 15 | 16 | install-exec-local: 17 | cp *.py $(bindir) 18 | 19 | -------------------------------------------------------------------------------- /python/get_git_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git_hash=$(git describe --long --dirty --always) 4 | git_date=$(git show -s --format=%ci) 5 | 6 | cat < fcc_version_tag.py 7 | COMMIT = "$git_hash" 8 | DATE = "$git_date" 9 | EOF 10 | 11 | -------------------------------------------------------------------------------- /python/sum_spectra.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import numpy as np 5 | from scipy import interpolate 6 | 7 | try: 8 | import fcc_version_tag as version_tag 9 | except: 10 | class version_tag: 11 | COMMIT="Untracked" 12 | DATE="No date" 13 | 14 | # Defaults 15 | fileout = 'sum.dat' 16 | do_average=False 17 | 18 | filesin=[] 19 | get_out=False 20 | do_help=False 21 | for arg in sys.argv[1:]: 22 | if arg == '-o': 23 | get_out=True 24 | elif get_out: 25 | fileout = arg 26 | get_out = False 27 | elif arg == '-av': 28 | do_average=True 29 | elif arg == '-h': 30 | do_help=True 31 | else: 32 | filesin.append(arg) 33 | 34 | if do_help: 35 | print(""" 36 | 37 | Program to sum spectra with arbitrary x-axis ranges 38 | ---------------------------------------------------------- 39 | 40 | Usage: 41 | %s -o sum.dat [-av] 42 | 43 | Version info: 44 | Git commit: %s 45 | Date: %s 46 | 47 | """%(sys.argv[0]),version_tag.COMMIT,version_tag.DATE) 48 | 49 | sys.exit() 50 | 51 | 52 | xs=[] 53 | ys=[] 54 | xmax=-100. 55 | xmin=9999999. 56 | dx=99999. 57 | nfiles=len(filesin) 58 | for filein in filesin: 59 | print('Input plot: '+filein) 60 | try: 61 | data=np.loadtxt(filein) 62 | except: 63 | raise BaseException('File not found: '+filein) 64 | 65 | xs.append(data[:,0]) 66 | ys.append(data[:,1]) 67 | 68 | xmax=max(xmax,xs[-1].max()) 69 | xmin=min(xmin,xs[-1].min()) 70 | d=(xs[-1][-1]-xs[-1][0])/len(xs[-1]) 71 | dx = min(d,dx) 72 | 73 | print('Range:', xmin,xmax, ' with dx=', dx) 74 | 75 | # Get new common grid (x) 76 | xnew = np.arange(xmin,xmax,dx) 77 | ynew = np.zeros(len(xnew)) 78 | 79 | # Now sum all data over such grid after interpolation 80 | for x,y in zip(xs,ys): 81 | # Interpolate 82 | f = interpolate.interp1d(x,y,fill_value=0.0,bounds_error=False) 83 | ynew += f(xnew) 84 | 85 | # Take the average if requested 86 | if do_average: 87 | ynew /= float(nfiles) 88 | 89 | # Print sum 90 | with open(fileout,'w') as f: 91 | for xi,yi in zip(xnew,ynew): 92 | print(xi, yi, file=f) 93 | 94 | if do_average: 95 | print('Average'+' over '+str(nfiles)+' files'+' written to '+fileout) 96 | else: 97 | print('Sum'+' over '+str(nfiles)+' files'+' written to '+fileout) 98 | 99 | 100 | -------------------------------------------------------------------------------- /run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | 5 | cd tests/ 6 | echo "++++++++++++++++++++++++++++++" 7 | echo " ++++++++++++++++++++++++++++ " 8 | echo " gen_fcc_state " 9 | echo " ++++++++++++++++++++++++++++ " 10 | echo "++++++++++++++++++++++++++++++" 11 | echo " " 12 | echo "****************************" 13 | (( i++ )) 14 | echo "TEST $i: GAMESS" 15 | echo "****************************" 16 | echo "gen_fcc_state -i HQ_gamess.out -ft gms" 17 | ../generators/gen_fcc_state -i HQ_gamess.out -ft gms 18 | echo "" 19 | 20 | echo "****************************" 21 | (( i++ )) 22 | echo "TEST $i: GAUSSIAN (LOG)" 23 | echo "****************************" 24 | echo "gen_fcc_state -i HQ_gaussian.log" 25 | ../generators/gen_fcc_state -i HQ_gaussian.log 26 | echo "" 27 | 28 | echo "****************************" 29 | (( i++ )) 30 | echo "TEST $i: ORCA (HESS)" 31 | echo "****************************" 32 | echo "gen_fcc_state -ft orca -i HQ_orca.out" 33 | ../generators/gen_fcc_state -ft orca -i HQ_orca.hess 34 | echo "" 35 | 36 | echo "****************************" 37 | (( i++ )) 38 | echo "TEST $i: Q-CHEM (OUT)" 39 | echo "****************************" 40 | echo "gen_fcc_state -ft qchem -i naphthol-s1_qchem.out" 41 | ../generators/gen_fcc_state -ft qchem -i naphthol-s1_qchem.out 42 | echo "" 43 | 44 | echo "****************************" 45 | (( i++ )) 46 | echo "TEST $i: PSI4" 47 | echo "****************************" 48 | echo "gen_fcc_state -i h2o_psi4.out -ft psi4" 49 | ../generators/gen_fcc_state -i h2o_psi4.out -ft psi4 50 | echo "" 51 | 52 | echo "****************************" 53 | (( i++ )) 54 | echo "TEST $i: MOLCAS(UnSym)" 55 | echo "****************************" 56 | echo "gen_fcc_state -i s0_mq-GP_edit.UnSym -ft molcas" 57 | ../generators/gen_fcc_state -i s0_mq-GP_edit.UnSym -ft molcasU 58 | echo "" 59 | 60 | echo "****************************" 61 | (( i++ )) 62 | echo "TEST $i: MOLPRO" 63 | echo "****************************" 64 | echo "gen_fcc_state -i h2o_molpro.out -ft molpro" 65 | ../generators/gen_fcc_state -i h2o_molpro.out -ft molpro 66 | echo "" 67 | 68 | echo "****************************" 69 | (( i++ )) 70 | echo "TEST $i: GAUSSIAN (FCHK) -Linear molecule" 71 | echo "****************************" 72 | echo "gen_fcc_state -i diacetylene.fchk" 73 | ../generators/gen_fcc_state -i diacetylene.fchk 74 | echo "" 75 | 76 | echo "****************************" 77 | (( i++ )) 78 | echo "TEST $i: GAUSSIAN (LOG) -Linear molecule" 79 | echo "****************************" 80 | echo "gen_fcc_state -i diacetylene.log" 81 | ../generators/gen_fcc_state -i diacetylene.log 82 | echo "" 83 | echo "" 84 | 85 | echo "++++++++++++++++++++++++++++++" 86 | echo " ++++++++++++++++++++++++++++ " 87 | echo " gen_fcc_dipfile " 88 | echo " ++++++++++++++++++++++++++++ " 89 | echo "++++++++++++++++++++++++++++++" 90 | echo " " 91 | echo "****************************" 92 | (( i++ )) 93 | echo "TEST $i: GAUSSIAN (FCHK) " 94 | echo "****************************" 95 | echo "gen_fcc_dipfile -i azabenz-ccl4-s2-neq-fr.fchk" 96 | ../generators/gen_fcc_dipfile -i azabenz-ccl4-s2-neq-fr.fchk 97 | echo "" 98 | echo "****************************" 99 | (( i++ )) 100 | echo "TEST $i: GAUSSIAN (FCHK) " 101 | echo "****************************" 102 | echo "gen_fcc_dipfile -i azabenz-ccl4-s2-neq-fr.log" 103 | ../generators/gen_fcc_dipfile -i azabenz-ccl4-s2-neq-fr.log 104 | echo "" 105 | echo "****************************" 106 | (( i++ )) 107 | echo "TEST $i: PSI4 " 108 | echo "****************************" 109 | echo "gen_fcc_dipfile -i s-methyloxirane_gs_aug.out -ft psi4 -Si 1 -Sf 2 -noder" 110 | ../generators/gen_fcc_dipfile -i s-methyloxirane_gs_aug.out -ft psi4 -Si 1 -Sf 2 -noder 111 | echo "" 112 | 113 | cd .. 114 | 115 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = subdir-objects 2 | 3 | CLEANFILES=state* magdip* eldip* fcc_template.inp 4 | CLEANFILES+=mass_* hessian_* 5 | 6 | -------------------------------------------------------------------------------- /tests/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.16.5 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994-2021 Free Software Foundation, Inc. 5 | 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | VPATH = @srcdir@ 17 | am__is_gnu_make = { \ 18 | if test -z '$(MAKELEVEL)'; then \ 19 | false; \ 20 | elif test -n '$(MAKE_HOST)'; then \ 21 | true; \ 22 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 23 | true; \ 24 | else \ 25 | false; \ 26 | fi; \ 27 | } 28 | am__make_running_with_option = \ 29 | case $${target_option-} in \ 30 | ?) ;; \ 31 | *) echo "am__make_running_with_option: internal error: invalid" \ 32 | "target option '$${target_option-}' specified" >&2; \ 33 | exit 1;; \ 34 | esac; \ 35 | has_opt=no; \ 36 | sane_makeflags=$$MAKEFLAGS; \ 37 | if $(am__is_gnu_make); then \ 38 | sane_makeflags=$$MFLAGS; \ 39 | else \ 40 | case $$MAKEFLAGS in \ 41 | *\\[\ \ ]*) \ 42 | bs=\\; \ 43 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ 44 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ 45 | esac; \ 46 | fi; \ 47 | skip_next=no; \ 48 | strip_trailopt () \ 49 | { \ 50 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ 51 | }; \ 52 | for flg in $$sane_makeflags; do \ 53 | test $$skip_next = yes && { skip_next=no; continue; }; \ 54 | case $$flg in \ 55 | *=*|--*) continue;; \ 56 | -*I) strip_trailopt 'I'; skip_next=yes;; \ 57 | -*I?*) strip_trailopt 'I';; \ 58 | -*O) strip_trailopt 'O'; skip_next=yes;; \ 59 | -*O?*) strip_trailopt 'O';; \ 60 | -*l) strip_trailopt 'l'; skip_next=yes;; \ 61 | -*l?*) strip_trailopt 'l';; \ 62 | -[dEDm]) skip_next=yes;; \ 63 | -[JT]) skip_next=yes;; \ 64 | esac; \ 65 | case $$flg in \ 66 | *$$target_option*) has_opt=yes; break;; \ 67 | esac; \ 68 | done; \ 69 | test $$has_opt = yes 70 | am__make_dryrun = (target_option=n; $(am__make_running_with_option)) 71 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 72 | pkgdatadir = $(datadir)/@PACKAGE@ 73 | pkgincludedir = $(includedir)/@PACKAGE@ 74 | pkglibdir = $(libdir)/@PACKAGE@ 75 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 76 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 77 | install_sh_DATA = $(install_sh) -c -m 644 78 | install_sh_PROGRAM = $(install_sh) -c 79 | install_sh_SCRIPT = $(install_sh) -c 80 | INSTALL_HEADER = $(INSTALL_DATA) 81 | transform = $(program_transform_name) 82 | NORMAL_INSTALL = : 83 | PRE_INSTALL = : 84 | POST_INSTALL = : 85 | NORMAL_UNINSTALL = : 86 | PRE_UNINSTALL = : 87 | POST_UNINSTALL = : 88 | subdir = tests 89 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 90 | am__aclocal_m4_deps = $(top_srcdir)/configure.ac 91 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 92 | $(ACLOCAL_M4) 93 | DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 94 | mkinstalldirs = $(install_sh) -d 95 | CONFIG_CLEAN_FILES = 96 | CONFIG_CLEAN_VPATH_FILES = 97 | AM_V_P = $(am__v_P_@AM_V@) 98 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) 99 | am__v_P_0 = false 100 | am__v_P_1 = : 101 | AM_V_GEN = $(am__v_GEN_@AM_V@) 102 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) 103 | am__v_GEN_0 = @echo " GEN " $@; 104 | am__v_GEN_1 = 105 | AM_V_at = $(am__v_at_@AM_V@) 106 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) 107 | am__v_at_0 = @ 108 | am__v_at_1 = 109 | SOURCES = 110 | DIST_SOURCES = 111 | am__can_run_installinfo = \ 112 | case $$AM_UPDATE_INFO_DIR in \ 113 | n|no|NO) false;; \ 114 | *) (install-info --version) >/dev/null 2>&1;; \ 115 | esac 116 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) 117 | am__DIST_COMMON = $(srcdir)/Makefile.in 118 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 119 | ACLOCAL = @ACLOCAL@ 120 | AMTAR = @AMTAR@ 121 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 122 | AUTOCONF = @AUTOCONF@ 123 | AUTOHEADER = @AUTOHEADER@ 124 | AUTOMAKE = @AUTOMAKE@ 125 | AWK = @AWK@ 126 | CSCOPE = @CSCOPE@ 127 | CTAGS = @CTAGS@ 128 | CYGPATH_W = @CYGPATH_W@ 129 | DEFS = @DEFS@ 130 | ECHO_C = @ECHO_C@ 131 | ECHO_N = @ECHO_N@ 132 | ECHO_T = @ECHO_T@ 133 | ETAGS = @ETAGS@ 134 | EXEEXT = @EXEEXT@ 135 | F77 = @F77@ 136 | FC = @FC@ 137 | FCFLAGS = @FCFLAGS@ 138 | FFLAGS = @FFLAGS@ 139 | INSTALL = @INSTALL@ 140 | INSTALL_DATA = @INSTALL_DATA@ 141 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 142 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 143 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 144 | LDFLAGS = @LDFLAGS@ 145 | LIBOBJS = @LIBOBJS@ 146 | LIBS = @LIBS@ 147 | LTLIBOBJS = @LTLIBOBJS@ 148 | MAKEINFO = @MAKEINFO@ 149 | MKDIR_P = @MKDIR_P@ 150 | OBJEXT = @OBJEXT@ 151 | PACKAGE = @PACKAGE@ 152 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 153 | PACKAGE_NAME = @PACKAGE_NAME@ 154 | PACKAGE_STRING = @PACKAGE_STRING@ 155 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 156 | PACKAGE_URL = @PACKAGE_URL@ 157 | PACKAGE_VERSION = @PACKAGE_VERSION@ 158 | PATH_SEPARATOR = @PATH_SEPARATOR@ 159 | SET_MAKE = @SET_MAKE@ 160 | SHELL = @SHELL@ 161 | STRIP = @STRIP@ 162 | VERSION = @VERSION@ 163 | abs_builddir = @abs_builddir@ 164 | abs_srcdir = @abs_srcdir@ 165 | abs_top_builddir = @abs_top_builddir@ 166 | abs_top_srcdir = @abs_top_srcdir@ 167 | ac_ct_F77 = @ac_ct_F77@ 168 | ac_ct_FC = @ac_ct_FC@ 169 | am__leading_dot = @am__leading_dot@ 170 | am__tar = @am__tar@ 171 | am__untar = @am__untar@ 172 | bindir = @bindir@ 173 | build_alias = @build_alias@ 174 | builddir = @builddir@ 175 | datadir = @datadir@ 176 | datarootdir = @datarootdir@ 177 | docdir = @docdir@ 178 | dvidir = @dvidir@ 179 | exec_prefix = @exec_prefix@ 180 | host_alias = @host_alias@ 181 | htmldir = @htmldir@ 182 | includedir = @includedir@ 183 | infodir = @infodir@ 184 | install_sh = @install_sh@ 185 | libdir = @libdir@ 186 | libexecdir = @libexecdir@ 187 | localedir = @localedir@ 188 | localstatedir = @localstatedir@ 189 | mandir = @mandir@ 190 | mkdir_p = @mkdir_p@ 191 | oldincludedir = @oldincludedir@ 192 | pdfdir = @pdfdir@ 193 | prefix = @prefix@ 194 | program_transform_name = @program_transform_name@ 195 | psdir = @psdir@ 196 | runstatedir = @runstatedir@ 197 | sbindir = @sbindir@ 198 | sharedstatedir = @sharedstatedir@ 199 | srcdir = @srcdir@ 200 | sysconfdir = @sysconfdir@ 201 | target_alias = @target_alias@ 202 | top_build_prefix = @top_build_prefix@ 203 | top_builddir = @top_builddir@ 204 | top_srcdir = @top_srcdir@ 205 | AUTOMAKE_OPTIONS = subdir-objects 206 | CLEANFILES = state* magdip* eldip* fcc_template.inp mass_* hessian_* 207 | all: all-am 208 | 209 | .SUFFIXES: 210 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 211 | @for dep in $?; do \ 212 | case '$(am__configure_deps)' in \ 213 | *$$dep*) \ 214 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 215 | && { if test -f $@; then exit 0; else break; fi; }; \ 216 | exit 1;; \ 217 | esac; \ 218 | done; \ 219 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ 220 | $(am__cd) $(top_srcdir) && \ 221 | $(AUTOMAKE) --foreign tests/Makefile 222 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 223 | @case '$?' in \ 224 | *config.status*) \ 225 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 226 | *) \ 227 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ 228 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 229 | esac; 230 | 231 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 232 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 233 | 234 | $(top_srcdir)/configure: $(am__configure_deps) 235 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 236 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 237 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 238 | $(am__aclocal_m4_deps): 239 | tags TAGS: 240 | 241 | ctags CTAGS: 242 | 243 | cscope cscopelist: 244 | 245 | distdir: $(BUILT_SOURCES) 246 | $(MAKE) $(AM_MAKEFLAGS) distdir-am 247 | 248 | distdir-am: $(DISTFILES) 249 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 250 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 251 | list='$(DISTFILES)'; \ 252 | dist_files=`for file in $$list; do echo $$file; done | \ 253 | sed -e "s|^$$srcdirstrip/||;t" \ 254 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 255 | case $$dist_files in \ 256 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 257 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 258 | sort -u` ;; \ 259 | esac; \ 260 | for file in $$dist_files; do \ 261 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 262 | if test -d $$d/$$file; then \ 263 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 264 | if test -d "$(distdir)/$$file"; then \ 265 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 266 | fi; \ 267 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 268 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 269 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 270 | fi; \ 271 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 272 | else \ 273 | test -f "$(distdir)/$$file" \ 274 | || cp -p $$d/$$file "$(distdir)/$$file" \ 275 | || exit 1; \ 276 | fi; \ 277 | done 278 | check-am: all-am 279 | check: check-am 280 | all-am: Makefile 281 | installdirs: 282 | install: install-am 283 | install-exec: install-exec-am 284 | install-data: install-data-am 285 | uninstall: uninstall-am 286 | 287 | install-am: all-am 288 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 289 | 290 | installcheck: installcheck-am 291 | install-strip: 292 | if test -z '$(STRIP)'; then \ 293 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 294 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 295 | install; \ 296 | else \ 297 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 298 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 299 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ 300 | fi 301 | mostlyclean-generic: 302 | 303 | clean-generic: 304 | -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 305 | 306 | distclean-generic: 307 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 308 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 309 | 310 | maintainer-clean-generic: 311 | @echo "This command is intended for maintainers to use" 312 | @echo "it deletes files that may require special tools to rebuild." 313 | clean: clean-am 314 | 315 | clean-am: clean-generic mostlyclean-am 316 | 317 | distclean: distclean-am 318 | -rm -f Makefile 319 | distclean-am: clean-am distclean-generic 320 | 321 | dvi: dvi-am 322 | 323 | dvi-am: 324 | 325 | html: html-am 326 | 327 | html-am: 328 | 329 | info: info-am 330 | 331 | info-am: 332 | 333 | install-data-am: 334 | 335 | install-dvi: install-dvi-am 336 | 337 | install-dvi-am: 338 | 339 | install-exec-am: 340 | 341 | install-html: install-html-am 342 | 343 | install-html-am: 344 | 345 | install-info: install-info-am 346 | 347 | install-info-am: 348 | 349 | install-man: 350 | 351 | install-pdf: install-pdf-am 352 | 353 | install-pdf-am: 354 | 355 | install-ps: install-ps-am 356 | 357 | install-ps-am: 358 | 359 | installcheck-am: 360 | 361 | maintainer-clean: maintainer-clean-am 362 | -rm -f Makefile 363 | maintainer-clean-am: distclean-am maintainer-clean-generic 364 | 365 | mostlyclean: mostlyclean-am 366 | 367 | mostlyclean-am: mostlyclean-generic 368 | 369 | pdf: pdf-am 370 | 371 | pdf-am: 372 | 373 | ps: ps-am 374 | 375 | ps-am: 376 | 377 | uninstall-am: 378 | 379 | .MAKE: install-am install-strip 380 | 381 | .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ 382 | ctags-am distclean distclean-generic distdir dvi dvi-am html \ 383 | html-am info info-am install install-am install-data \ 384 | install-data-am install-dvi install-dvi-am install-exec \ 385 | install-exec-am install-html install-html-am install-info \ 386 | install-info-am install-man install-pdf install-pdf-am \ 387 | install-ps install-ps-am install-strip installcheck \ 388 | installcheck-am installdirs maintainer-clean \ 389 | maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ 390 | pdf-am ps ps-am tags-am uninstall uninstall-am 391 | 392 | .PRECIOUS: Makefile 393 | 394 | 395 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 396 | # Otherwise a system limit (for SysV at least) may be exceeded. 397 | .NOEXPORT: 398 | --------------------------------------------------------------------------------