Psi4
findif.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _findif_h_
30 #define _findif_h_
31 
32 #include <sstream>
33 #include <vector>
34 
35 #include "psi4/psi4-dec.h"
36 #include "psi4/libciomr/libciomr.h"
37 #include "psi4/libqt/qt.h"
38 
39 namespace psi {
40 class Molecule;
41 class CdSalcList;
42 
43 namespace findif {
44 
45 // functions to generate displacements
46 std::vector< SharedMatrix > fd_geoms_1_0(std::shared_ptr<Molecule> mol, Options &options);
47 // std::vector< SharedMatrix > fd_geoms_2_0(Options &options);
48 std::vector< SharedMatrix > fd_geoms_freq_0(std::shared_ptr<Molecule> mol, Options &options, int irrep=-1);
49 std::vector< SharedMatrix > fd_geoms_freq_1(std::shared_ptr<Molecule> mol, Options &options, int irrep=-1);
50 std::vector< SharedMatrix > atomic_displacements(std::shared_ptr<Molecule> mol, Options &options);
51 
52 // functions to carry out finite-differences
53 SharedMatrix fd_1_0(std::shared_ptr<Molecule> mol, Options &options, const py::list& energies);
54 //PsiReturnType fd_2_0(std::shared_ptr<Molecule> mol, Options &options, const py::list& energies);
55 SharedMatrix fd_freq_0(std::shared_ptr<Molecule> mol, Options &options,
56  const py::list& energies, int irrep=-1);
57 SharedMatrix fd_freq_1(std::shared_ptr<Molecule> mol, Options &options,
58  const py::list& E_list, int irrep=-1);
59 
60 // class to accumulate and print vibrations
61 class VIBRATION {
62  int irrep; // irrep
63  double km; // force constant
64  double *lx; // normal mode in mass-weighted cartesians
65  double cm; // harmonic frequency in wavenumbers
66 
67  public:
68  friend PsiReturnType fd_freq_0(Options &options, const py::list& energies, int irrep);
69  friend PsiReturnType fd_freq_1(Options &options, const py::list& gradients, int irrep);
70  friend bool ascending(const VIBRATION *, const VIBRATION *);
71  friend void print_vibrations(std::shared_ptr<Molecule> mol, std::vector<VIBRATION *> modes);
72 
73  double get_km() {return km;}
74  double get_cm() {return cm;}
75  double get_lx(int i) {return lx[i];}
76 
77  VIBRATION(int irrep_in, double km_in, double *lx_in) { irrep = irrep_in; km = km_in; lx = lx_in; }
78  ~VIBRATION() { free(lx); }
79 };
80 
81 // function to print vibrations
82 void print_vibrations(std::shared_ptr<Molecule> mol, std::vector<VIBRATION *> modes);
83 
84 // to order vibrations
85 bool ascending(const VIBRATION *vib1, const VIBRATION *vib2);
86 
87 // for displacing along a salc
88 void displace_cart(std::shared_ptr<Molecule> mol, SharedMatrix geom, const CdSalcList & salclist,
89  int salc_i, int disp_factor, double disp_size);
90 
91 void displace_cart(std::shared_ptr<Molecule> mol, SharedMatrix geom, const CdSalcList & salclist,
92  int salc_i, int salc_j, int disp_factor_i, int disp_factor_j, double disp_size);
93 
94 // to massweight columns of a shared matrix
96 
97 // displace an atomic coordinate
98 void displace_atom(SharedMatrix geom, const int atom, const int coord,
99  const int sign, const double disp_size);
100 
101 // save gemetry and normal modes to files
102 void save_normal_modes(std::shared_ptr<Molecule> mol,
103  std::vector<VIBRATION *> modes);
104 
105 
106 template <class T>
107 inline std::string to_string (const T& t)
108 {
109 std::stringstream ss;
110 ss << t;
111 return ss.str();
112 }
113 
114 }}
115 
116 #endif
double get_cm()
Definition: findif.h:74
void displace_cart(std::shared_ptr< Molecule > mol, SharedMatrix geom, const CdSalcList &salclist, int salc_i, int disp_factor, double disp_size)
Definition: fd_misc.cc:203
bool ascending(const VIBRATION *vib1, const VIBRATION *vib2)
Definition: fd_misc.cc:51
void mass_weight_columns_plus_one_half(std::shared_ptr< Molecule > mol, SharedMatrix B)
Definition: fd_misc.cc:253
Definition: cdsalclist.h:124
double cm
Definition: findif.h:65
void print_vibrations(std::shared_ptr< Molecule > mol, std::vector< VIBRATION * > modes)
Definition: fd_misc.cc:59
PsiReturnType
Definition: psi4-dec.h:49
SharedMatrix fd_freq_0(std::shared_ptr< Molecule >, Options &, const py::list &, int irrep=-1)
Definition: fd_freq_0.cc:63
Definition: pointgrp.h:106
SharedMatrix fd_freq_1(std::shared_ptr< Molecule >, Options &, const py::list &, int irrep=-1)
Definition: fd_freq_1.cc:50
double get_lx(int i)
Definition: findif.h:75
Definition: findif.h:61
void save_normal_modes(std::shared_ptr< Molecule > mol, std::vector< VIBRATION * > modes)
Definition: fd_misc.cc:157
double km
Definition: findif.h:63
double * lx
Definition: findif.h:64
VIBRATION(int irrep_in, double km_in, double *lx_in)
Definition: findif.h:77
SharedMatrix displace_atom(SharedMatrix geom, const int atom, const int coord, const int sign, const double disp_size)
Definition: fd_misc.cc:263
std::string to_string(const T &t)
Definition: findif.h:107
~VIBRATION()
Definition: findif.h:78
friend PsiReturnType fd_freq_1(Options &options, const py::list &gradients, int irrep)
double get_km()
Definition: findif.h:73
Definition: liboptions.h:360
Header file for the Quantum Trio LibraryDavid Sherrill 1994.
std::vector< SharedMatrix > fd_geoms_freq_1(std::shared_ptr< Molecule >, Options &, int irrep=-1)
Definition: fd_geoms_freq_1.cc:44
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
std::vector< SharedMatrix > fd_geoms_1_0(std::shared_ptr< Molecule >, Options &)
Definition: fd_geoms_1_0.cc:44
friend PsiReturnType fd_freq_0(Options &options, const py::list &energies, int irrep)
friend bool ascending(const VIBRATION *, const VIBRATION *)
Definition: fd_misc.cc:51
friend void print_vibrations(std::shared_ptr< Molecule > mol, std::vector< VIBRATION * > modes)
Definition: fd_misc.cc:59
SharedMatrix fd_1_0(std::shared_ptr< Molecule >, Options &, const py::list &)
Definition: fd_1_0.cc:47
Definition: PsiFileImpl.h:40
std::vector< SharedMatrix > fd_geoms_freq_0(std::shared_ptr< Molecule >, Options &, int irrep=-1)
Definition: fd_geoms_freq_0.cc:60
std::vector< SharedMatrix > atomic_displacements(std::shared_ptr< Molecule >, Options &)
Definition: fd_misc.cc:270
int irrep
Definition: findif.h:62