1 //
2 // BAGEL - Brilliantly Advanced General Electronic Structure Library
3 // Filename: hyperfine.cc
4 // Copyright (C) 2016 Toru Shiozaki
5 //
6 // Author: Toru Shiozaki <shiozaki@northwestern.edu>
7 // Maintainer: Shiozaki group
8 //
9 // This file is part of the BAGEL package.
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 //
24 
25 
26 #include <src/prop/hyperfine.h>
27 #include <src/mat1e/fermicontact.h>
28 #include <src/mat1e/spindipole.h>
29 #include <src/util/atommap.h>
30 
31 using namespace std;
32 using namespace bagel;
33 
34 const static AtomMap atommap;
35 
HyperFine(shared_ptr<const Geometry> geom,shared_ptr<const Matrix> den,const int s,const string jobname,vector<int> select)36 HyperFine::HyperFine(shared_ptr<const Geometry> geom, shared_ptr<const Matrix> den, const int s, const string jobname, vector<int> select)
37  : geom_(geom), den_(den), jobname_(jobname), select_(select), s_(s) {
38 
39 }
40 
41 
compute() const42 void HyperFine::compute() const {
43   const string indent = "      ";
44   cout << "    * Hyperfine coupling constants (" << jobname_ << ")" << endl;
45 
46   vector<shared_ptr<const Atom>> atoms = geom_->atoms();
47   int cnt = 0;
48   for (auto& i : atoms) {
49     if (!select_.empty() && find(select_.begin(), select_.end(), cnt) == select_.end()) continue;
50 
51     if (atommap.hfcc_exists(i->name())) {
52       cout << indent << "Atom: " << setw(4) << cnt << endl;
53       cout << indent << "  Spin dipole" << setprecision(10) << endl;
54       SpinDipole mat(geom_, i, s_);
55       for (int j = 0; j != 6; ++j)
56         cout << setw(22) << mat.data(j)->dot_product(den_) << endl;
57 
58       cout << indent << "  Fermi contact" << endl;
59       FermiContact mat2(geom_, i, s_);
60       cout << setw(22) << mat2.dot_product(den_) << endl << endl;
61     }
62 
63     ++cnt;
64   }
65 }
66