[0b990d] | 1 | //
|
---|
| 2 | // orbital.cc
|
---|
| 3 | //
|
---|
| 4 | // Copyright (C) 1997 Limit Point Systems, Inc.
|
---|
| 5 | //
|
---|
| 6 | // Author: Curtis Janssen <cljanss@limitpt.com>
|
---|
| 7 | // Maintainer: LPS
|
---|
| 8 | //
|
---|
| 9 | // This file is part of the SC Toolkit.
|
---|
| 10 | //
|
---|
| 11 | // The SC Toolkit is free software; you can redistribute it and/or modify
|
---|
| 12 | // it under the terms of the GNU Library General Public License as published by
|
---|
| 13 | // the Free Software Foundation; either version 2, or (at your option)
|
---|
| 14 | // any later version.
|
---|
| 15 | //
|
---|
| 16 | // The SC Toolkit 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 Library General Public License for more details.
|
---|
| 20 | //
|
---|
| 21 | // You should have received a copy of the GNU Library General Public License
|
---|
| 22 | // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
|
---|
| 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 24 | //
|
---|
| 25 | // The U.S. Government is granted a limited license as per AL 91-7.
|
---|
| 26 | //
|
---|
| 27 |
|
---|
| 28 | #ifdef __GNUC__
|
---|
| 29 | #pragma implementation
|
---|
| 30 | #endif
|
---|
| 31 |
|
---|
| 32 | #include <math.h>
|
---|
| 33 |
|
---|
| 34 | #include <util/misc/formio.h>
|
---|
| 35 |
|
---|
| 36 | #include <math/scmat/local.h>
|
---|
| 37 | #include <math/scmat/vector3.h>
|
---|
| 38 | #include <chemistry/molecule/molecule.h>
|
---|
| 39 | #include <chemistry/qc/wfn/orbital.h>
|
---|
| 40 |
|
---|
| 41 | using namespace sc;
|
---|
| 42 |
|
---|
| 43 | static ClassDesc Orbital_cd(
|
---|
| 44 | typeid(Orbital),"Orbital",1,"public Volume",
|
---|
| 45 | 0, create<Orbital>, 0);
|
---|
| 46 |
|
---|
| 47 | Orbital::Orbital(const Ref<KeyVal> &keyval):
|
---|
| 48 | Volume(keyval)
|
---|
| 49 | {
|
---|
| 50 | wfn_ << keyval->describedclassvalue("wfn");
|
---|
| 51 | orbital_ = keyval->intvalue("orbital");
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | Orbital::Orbital(const Ref<OneBodyWavefunction>& wfn, int orbital):
|
---|
| 55 | Volume(),
|
---|
| 56 | wfn_(wfn),
|
---|
| 57 | orbital_(orbital)
|
---|
| 58 | {
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | Orbital::~Orbital()
|
---|
| 62 | {
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | void
|
---|
| 66 | Orbital::compute()
|
---|
| 67 | {
|
---|
| 68 | SCVector3 r;
|
---|
| 69 | get_x(r);
|
---|
| 70 | if (value_needed()) {
|
---|
| 71 | set_value(fabs(wfn_->orbital(r, orbital_)));
|
---|
| 72 | set_actual_value_accuracy(desired_value_accuracy());
|
---|
| 73 | }
|
---|
| 74 | if (gradient_needed() || hessian_needed()) {
|
---|
| 75 | ExEnv::err0() << indent
|
---|
| 76 | << "Orbital::compute(): gradient & hessian not implemented\n";
|
---|
| 77 | abort();
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | // make a wild guess about the bounding box
|
---|
| 82 | void
|
---|
| 83 | Orbital::boundingbox(double valuemin,
|
---|
| 84 | double valuemax,
|
---|
| 85 | SCVector3& p1, SCVector3& p2)
|
---|
| 86 | {
|
---|
| 87 | Molecule& mol = *wfn_->molecule();
|
---|
| 88 |
|
---|
| 89 | if (mol.natom() == 0) {
|
---|
| 90 | for (int i=0; i<3; i++) p1[i] = p2[i] = 0.0;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | int i;
|
---|
| 94 | for (i=0; i<3; i++) p1[i] = p2[i] = mol.r(0,i);
|
---|
| 95 | for (i=1; i<mol.natom(); i++) {
|
---|
| 96 | for (int j=0; j<3; j++) {
|
---|
| 97 | if (mol.r(i,j) < p1[i]) p1[i] = mol.r(i,j);
|
---|
| 98 | if (mol.r(i,j) > p2[i]) p2[i] = mol.r(i,j);
|
---|
| 99 | }
|
---|
| 100 | }
|
---|
| 101 | for (i=0; i<3; i++) {
|
---|
| 102 | p1[i] = p1[i] - 3.0;
|
---|
| 103 | p2[i] = p2[i] + 3.0;
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 108 |
|
---|
| 109 | // Local Variables:
|
---|
| 110 | // mode: c++
|
---|
| 111 | // c-file-style: "CLJ"
|
---|
| 112 | // End:
|
---|