1 //
2 // BAGEL - Brilliantly Advanced General Electronic Structure Library
3 // Filename: zcasnoopt.cc
4 // Copyright (C) 2017 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 #include <set>
26 #include <src/multi/zcasscf/zcasnoopt.h>
27 #include <src/prop/pseudospin/pseudospin.h>
28 #include <src/mat1e/rel/reloverlap.h>
29 #include <src/mat1e/rel/relhcore.h>
30 
31 using namespace std;
32 using namespace bagel;
33 
34 
ZCASNoopt(shared_ptr<const PTree> idat,shared_ptr<const Geometry> geom,shared_ptr<const Reference> ref)35 ZCASNoopt::ZCASNoopt(shared_ptr<const PTree> idat, shared_ptr<const Geometry> geom, shared_ptr<const Reference> ref)
36  : ZCASNoopt_base(idat, geom, ref) {
37   init();
38   cout << "    * No orbital optimization will be performed!" << endl << endl;
39 }
40 
41 
ZCASNoopt_London(shared_ptr<const PTree> idat,shared_ptr<const Geometry> geom,shared_ptr<const Reference> ref)42 ZCASNoopt_London::ZCASNoopt_London(shared_ptr<const PTree> idat, shared_ptr<const Geometry> geom, shared_ptr<const Reference> ref)
43  : ZCASNoopt_base(idat, geom, ref) {
44   init();
45   cout << "    * No orbital optimization will be performed!" << endl << endl;
46 }
47 
48 
init_coeff()49 void ZCASNoopt::init_coeff() {
50   auto relref = dynamic_pointer_cast<const RelReference>(ref_);
51   auto scoeff = make_shared<const ZCoeff_Striped>(*relref->relcoeff_full(), nclosed_, nact_, nvirtnr_, nneg_);
52   if (!relref->kramers()) {
53     auto overlap = make_shared<RelOverlap>(geom_);
54     auto hcore = make_shared<RelHcore>(geom_);
55     scoeff = scoeff->init_kramers_coeff(geom_, overlap, hcore, 2*ref_->nclosed() + ref_->nact(), gaunt_, breit_);
56   }
57   coeff_ = scoeff->block_format();
58 }
59 
60 
init_coeff()61 void ZCASNoopt_London::init_coeff() {
62   auto relref = dynamic_pointer_cast<const RelReference>(ref_);
63   auto scoeff = make_shared<const ZCoeff_Striped>(*relref->relcoeff_full(), nclosed_, nact_, nvirtnr_, nneg_);
64   coeff_ = scoeff->block_format();
65 }
66 
67 
compute()68 void ZCASNoopt_base::compute() {
69   if (external_rdm_.empty()) {
70     cout << "    * Computing RDMs from FCI calculation " << endl;
71     fci_->compute();
72     fci_->compute_rdm12();
73   } else {
74     fci_->read_external_rdm12_av(external_rdm_);
75   }
76   energy_ = fci_->energy();
77 
78   if (canonical_)
79     coeff_ = semi_canonical_orb(kramers());
80 
81   // TODO When the Property class is implemented, this should be one
82   shared_ptr<const PTree> aniso_data = idata_->get_child_optional("aniso");
83   if (aniso_data) {
84     if (geom_->magnetism()) {
85       cout << "  ** Magnetic anisotropy analysis is currently only available for zero-field calculations; sorry." << endl;
86     } else {
87       const int nspin = aniso_data->get<int>("nspin", (idata_->get_vector<int>("state", 0)).size()-1);
88       Pseudospin ps(nspin, geom_, fci_->conv_to_ciwfn(), aniso_data);
89       ps.compute(energy_, coeff_->active_part());
90     }
91   }
92 }
93