source: ThirdParty/mpqc_open/src/lib/chemistry/molecule/stre.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: 3.8 KB
Line 
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
55using namespace sc;
56
57static ClassDesc StreSimpleCo_cd(
58 typeid(StreSimpleCo),"StreSimpleCo",1,"public SimpleCo",
59 create<StreSimpleCo>, create<StreSimpleCo>, create<StreSimpleCo>);
60SimpleCo_IMPL(StreSimpleCo);
61
62StreSimpleCo::StreSimpleCo() : SimpleCo(2) {}
63
64StreSimpleCo::StreSimpleCo(const StreSimpleCo& s)
65 : SimpleCo(2)
66{
67 *this=s;
68}
69
70StreSimpleCo::StreSimpleCo(const char *re, int a1, int a2)
71 : SimpleCo(2,re)
72{
73 atoms[0]=a1; atoms[1]=a2;
74}
75
76StreSimpleCo::StreSimpleCo(const Ref<KeyVal> &kv)
77 : SimpleCo(kv,2)
78{
79}
80
81StreSimpleCo::~StreSimpleCo()
82{
83}
84
85StreSimpleCo&
86StreSimpleCo::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
95double
96StreSimpleCo::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
114double
115StreSimpleCo::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
132const char *
133StreSimpleCo::ctype() const
134{
135 return "STRE";
136}
137
138double
139StreSimpleCo::bohr() const
140{
141 return value_;
142}
143
144double
145StreSimpleCo::angstrom() const
146{
147 return value_*0.52917706;
148}
149
150double
151StreSimpleCo::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:
Note: See TracBrowser for help on using the repository browser.