source: ThirdParty/mpqc_open/src/lib/chemistry/molecule/out.cc@ 7516f6

Action_Thermostats Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChemicalSpaceEvaluator Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Exclude_Hydrogens_annealWithBondGraph Fix_Verbose_Codepatterns ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion Gui_displays_atomic_force_velocity JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters Recreated_GuiChecks StoppableMakroAction TremoloParser_IncreasedPrecision
Last change on this file since 7516f6 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 5.2 KB
Line 
1//
2// out.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/* out.cc -- implementation of the out-of-plane 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
55using namespace sc;
56
57static ClassDesc OutSimpleCo_cd(
58 typeid(OutSimpleCo),"OutSimpleCo",1,"public SimpleCo",
59 create<OutSimpleCo>, create<OutSimpleCo>, create<OutSimpleCo>);
60SimpleCo_IMPL(OutSimpleCo)
61
62OutSimpleCo::OutSimpleCo() : SimpleCo(4) {}
63
64OutSimpleCo::OutSimpleCo(const OutSimpleCo& s)
65 : SimpleCo(4)
66{
67 *this=s;
68}
69
70OutSimpleCo::OutSimpleCo(const char *refr, int a1, int a2, int a3, int a4)
71 : SimpleCo(4,refr)
72{
73 atoms[0]=a1; atoms[1]=a2; atoms[2]=a3; atoms[3]=a4;
74}
75
76OutSimpleCo::OutSimpleCo(const Ref<KeyVal> &kv) :
77 SimpleCo(kv,4)
78{
79}
80
81OutSimpleCo::~OutSimpleCo()
82{
83}
84
85OutSimpleCo&
86OutSimpleCo::operator=(const OutSimpleCo& s)
87{
88 if(label_) delete[] label_;
89 label_=new char[strlen(s.label_)+1];
90 strcpy(label_,s.label_);
91 atoms[0]=s.atoms[0]; atoms[1]=s.atoms[1]; atoms[2]=s.atoms[2];
92 atoms[3]=s.atoms[3];
93 return *this;
94}
95
96double
97OutSimpleCo::calc_intco(Molecule& m, double *bmat, double coeff)
98{
99 int a=atoms[0]-1; int b=atoms[1]-1; int c=atoms[2]-1; int d=atoms[3]-1;
100 SCVector3 u1,u2,u3,z1;
101
102 SCVector3 ra(m.r(a));
103 SCVector3 rb(m.r(b));
104 SCVector3 rc(m.r(c));
105 SCVector3 rd(m.r(d));
106
107 u1 = ra-rb;
108 u1.normalize();
109 u2 = rc-rb;
110 u2.normalize();
111 u3 = rd-rb;
112 u3.normalize();
113
114 z1 = u2.perp_unit(u3);
115 double st=u1.dot(z1);
116 double ct=s2(st);
117
118 value_ = (st<0) ? -acos(ct) : acos(ct);
119
120 if (bmat) {
121 double uu,vv;
122 SCVector3 ww,xx,zz;
123 double cphi1 = u2.dot(u3);
124 double sphi1 = s2(cphi1);
125 double cphi2 = u3.dot(u1);
126 double cphi3 = u2.dot(u1);
127 double den = ct * sphi1*sphi1;
128 double sthta2 = (cphi1*cphi2-cphi3)/
129 (den*rc.dist(rb));
130 double sthta3 = (cphi1*cphi3-cphi2)/
131 (den*rd.dist(rb));
132#if OLD_BMAT
133 sthta2 /= bohr;
134 sthta3 /= bohr;
135#endif
136 int j;
137 for(j=0; j < 3; j++) {
138 ww[j] = z1[j]*sthta2;
139 zz[j] = z1[j]*sthta3;
140 }
141 xx = z1.perp_unit(u1);
142 z1 = u1.perp_unit(xx);
143 double r1i = 1.0/ra.dist(rb);
144#if OLD_BMAT
145 r1i /= bohr;
146#endif
147 for(j=0; j < 3; j++) {
148 uu = z1[j]*r1i;
149 vv = -uu-ww[j]-zz[j];
150 bmat[a*3+j] += coeff*uu;
151 bmat[b*3+j] += coeff*vv;
152 bmat[c*3+j] += coeff*ww[j];
153 bmat[d*3+j] += coeff*zz[j];
154 }
155 }
156
157 return value_;
158}
159
160
161double
162OutSimpleCo::calc_force_con(Molecule& m)
163{
164 int x=atoms[0]-1;
165 int a=atoms[1]-1; int b=atoms[2]-1; int c=atoms[3]-1;
166
167 SCVector3 ra(m.r(a));
168 SCVector3 rx(m.r(x));
169
170 double rad_ab = m.atominfo()->atomic_radius(m.Z(a))
171 + m.atominfo()->atomic_radius(m.Z(b));
172
173 double rad_ac = m.atominfo()->atomic_radius(m.Z(a))
174 + m.atominfo()->atomic_radius(m.Z(c));
175
176 double rad_ax = m.atominfo()->atomic_radius(m.Z(a))
177 + m.atominfo()->atomic_radius(m.Z(x));
178
179 double r_ax = ra.dist(rx);
180
181 calc_intco(m);
182
183 double k = 0.0025 + 0.0061*pow((rad_ab*rad_ac),0.80)*pow(cos(value()),4.0) *
184 exp(-3.0*(r_ax-rad_ax));
185
186#if OLD_BMAT
187 // return force constant in mdyn*ang/rad^2
188 return k*4.359813653;
189#else
190 return k;
191#endif
192}
193
194const char *
195OutSimpleCo::ctype() const
196{
197 return "OUT";
198}
199
200double
201OutSimpleCo::radians() const
202{
203 return value_;
204}
205
206double
207OutSimpleCo::degrees() const
208{
209 return value_*rtd;
210}
211
212double
213OutSimpleCo::preferred_value() const
214{
215 return value_*rtd;
216}
217
218/////////////////////////////////////////////////////////////////////////////
219
220// Local Variables:
221// mode: c++
222// c-file-style: "ETS"
223// End:
Note: See TracBrowser for help on using the repository browser.