1 | //
|
---|
2 | // stre.cc
|
---|
3 | //
|
---|
4 | // Modifications are
|
---|
5 | // Copyright (C) 1996 Limit Point Systems, Inc.
|
---|
6 | //
|
---|
7 | // Author: Edward Seidl <seidl@janed.com>
|
---|
8 | // Maintainer: LPS
|
---|
9 | //
|
---|
10 | // This file is part of the SC Toolkit.
|
---|
11 | //
|
---|
12 | // The SC Toolkit is free software; you can redistribute it and/or modify
|
---|
13 | // it under the terms of the GNU Library General Public License as published by
|
---|
14 | // the Free Software Foundation; either version 2, or (at your option)
|
---|
15 | // any later version.
|
---|
16 | //
|
---|
17 | // The SC Toolkit 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 Library General Public License for more details.
|
---|
21 | //
|
---|
22 | // You should have received a copy of the GNU Library General Public License
|
---|
23 | // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
|
---|
24 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
25 | //
|
---|
26 | // The U.S. Government is granted a limited license as per AL 91-7.
|
---|
27 | //
|
---|
28 |
|
---|
29 | /* stre.cc -- implementation of the stretch internal coordinate class
|
---|
30 | *
|
---|
31 | * THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
|
---|
32 | * "UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE
|
---|
33 | * AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT
|
---|
34 | * CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE
|
---|
35 | * PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
|
---|
36 | * RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
|
---|
37 | *
|
---|
38 | * Author:
|
---|
39 | * E. T. Seidl
|
---|
40 | * Bldg. 12A, Rm. 2033
|
---|
41 | * Computer Systems Laboratory
|
---|
42 | * Division of Computer Research and Technology
|
---|
43 | * National Institutes of Health
|
---|
44 | * Bethesda, Maryland 20892
|
---|
45 | * Internet: seidl@alw.nih.gov
|
---|
46 | * February, 1993
|
---|
47 | */
|
---|
48 |
|
---|
49 | #include <string.h>
|
---|
50 | #include <math.h>
|
---|
51 |
|
---|
52 | #include <chemistry/molecule/simple.h>
|
---|
53 | #include <chemistry/molecule/localdef.h>
|
---|
54 |
|
---|
55 | using namespace sc;
|
---|
56 |
|
---|
57 | static ClassDesc StreSimpleCo_cd(
|
---|
58 | typeid(StreSimpleCo),"StreSimpleCo",1,"public SimpleCo",
|
---|
59 | create<StreSimpleCo>, create<StreSimpleCo>, create<StreSimpleCo>);
|
---|
60 | SimpleCo_IMPL(StreSimpleCo);
|
---|
61 |
|
---|
62 | StreSimpleCo::StreSimpleCo() : SimpleCo(2) {}
|
---|
63 |
|
---|
64 | StreSimpleCo::StreSimpleCo(const StreSimpleCo& s)
|
---|
65 | : SimpleCo(2)
|
---|
66 | {
|
---|
67 | *this=s;
|
---|
68 | }
|
---|
69 |
|
---|
70 | StreSimpleCo::StreSimpleCo(const char *re, int a1, int a2)
|
---|
71 | : SimpleCo(2,re)
|
---|
72 | {
|
---|
73 | atoms[0]=a1; atoms[1]=a2;
|
---|
74 | }
|
---|
75 |
|
---|
76 | StreSimpleCo::StreSimpleCo(const Ref<KeyVal> &kv)
|
---|
77 | : SimpleCo(kv,2)
|
---|
78 | {
|
---|
79 | }
|
---|
80 |
|
---|
81 | StreSimpleCo::~StreSimpleCo()
|
---|
82 | {
|
---|
83 | }
|
---|
84 |
|
---|
85 | StreSimpleCo&
|
---|
86 | StreSimpleCo::operator=(const StreSimpleCo& s)
|
---|
87 | {
|
---|
88 | if(label_) delete[] label_;
|
---|
89 | label_=new char[strlen(s.label_)+1]; strcpy(label_,s.label_);
|
---|
90 | atoms[0]=s.atoms[0]; atoms[1]=s.atoms[1];
|
---|
91 |
|
---|
92 | return *this;
|
---|
93 | }
|
---|
94 |
|
---|
95 | double
|
---|
96 | StreSimpleCo::calc_force_con(Molecule& m)
|
---|
97 | {
|
---|
98 | int a=atoms[0]-1; int b=atoms[1]-1;
|
---|
99 | double rad_ab = m.atominfo()->atomic_radius(m.Z(a))
|
---|
100 | + m.atominfo()->atomic_radius(m.Z(b));
|
---|
101 |
|
---|
102 | calc_intco(m);
|
---|
103 |
|
---|
104 | double k = 0.3601 * exp(-1.944*(value()-rad_ab));
|
---|
105 |
|
---|
106 | #if OLD_BMAT
|
---|
107 | // return force constant in mdyn/ang
|
---|
108 | return k*4.359813653/(0.52917706*0.52917706);
|
---|
109 | #else
|
---|
110 | return k;
|
---|
111 | #endif
|
---|
112 | }
|
---|
113 |
|
---|
114 | double
|
---|
115 | StreSimpleCo::calc_intco(Molecule& m, double *bmat, double coeff)
|
---|
116 | {
|
---|
117 | int a=atoms[0]-1; int b=atoms[1]-1;
|
---|
118 | SCVector3 ra(m.r(a)), rb(m.r(b));
|
---|
119 | value_ = ra.dist(rb);
|
---|
120 | if(bmat) {
|
---|
121 | SCVector3 uu = ra - rb;
|
---|
122 | uu.normalize();
|
---|
123 | bmat[a*3] += coeff*uu[0]; bmat[b*3] -= coeff*uu[0];
|
---|
124 | bmat[a*3+1] += coeff*uu[1]; bmat[b*3+1] -= coeff*uu[1];
|
---|
125 | bmat[a*3+2] += coeff*uu[2]; bmat[b*3+2] -= coeff*uu[2];
|
---|
126 | }
|
---|
127 |
|
---|
128 | return angstrom();
|
---|
129 | }
|
---|
130 |
|
---|
131 |
|
---|
132 | const char *
|
---|
133 | StreSimpleCo::ctype() const
|
---|
134 | {
|
---|
135 | return "STRE";
|
---|
136 | }
|
---|
137 |
|
---|
138 | double
|
---|
139 | StreSimpleCo::bohr() const
|
---|
140 | {
|
---|
141 | return value_;
|
---|
142 | }
|
---|
143 |
|
---|
144 | double
|
---|
145 | StreSimpleCo::angstrom() const
|
---|
146 | {
|
---|
147 | return value_*0.52917706;
|
---|
148 | }
|
---|
149 |
|
---|
150 | double
|
---|
151 | StreSimpleCo::preferred_value() const
|
---|
152 | {
|
---|
153 | return value_*0.52917706;
|
---|
154 | }
|
---|
155 |
|
---|
156 | /////////////////////////////////////////////////////////////////////////////
|
---|
157 |
|
---|
158 | // Local Variables:
|
---|
159 | // mode: c++
|
---|
160 | // c-file-style: "ETS"
|
---|
161 | // End:
|
---|