Chemical Data Processing Library C++ API - Version 1.4.0
ElasticPotential.hpp
Go to the documentation of this file.
1 /*
2  * ElasticPotential.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the s of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_FORCEFIELD_ELASTICPOTENTIAL_HPP
30 #define CDPL_FORCEFIELD_ELASTICPOTENTIAL_HPP
31 
32 #include <cstddef>
33 
34 
35 namespace CDPL
36 {
37 
38  namespace ForceField
39  {
40 
47  {
48 
49  public:
58  ElasticPotential(std::size_t atom1_idx, std::size_t atom2_idx, double force_const, double ref_length):
59  atom1Idx(atom1_idx), atom2Idx(atom2_idx), forceConst(force_const), refLength(ref_length) {}
60 
65  std::size_t getAtom1Index() const
66  {
67  return atom1Idx;
68  }
69 
74  std::size_t getAtom2Index() const
75  {
76  return atom2Idx;
77  }
78 
83  double getForceConstant() const
84  {
85  return forceConst;
86  }
87 
92  double getReferenceLength() const
93  {
94  return refLength;
95  }
96 
102  {
103  refLength = length;
104  }
105 
106  private:
107  std::size_t atom1Idx;
108  std::size_t atom2Idx;
109  double forceConst;
110  double refLength;
111  };
112  } // namespace ForceField
113 } // namespace CDPL
114 
115 #endif // CDPL_FORCEFIELD_ELASTICPOTENTIAL_HPP
Stores parameters for an elastic potential (harmonic distance restraint) between a pair of atoms.
Definition: ElasticPotential.hpp:47
ElasticPotential(std::size_t atom1_idx, std::size_t atom2_idx, double force_const, double ref_length)
Constructs the elastic potential between atoms atom1_idx and atom2_idx with the specified force const...
Definition: ElasticPotential.hpp:58
std::size_t getAtom2Index() const
Returns the zero-based index of the second atom.
Definition: ElasticPotential.hpp:74
std::size_t getAtom1Index() const
Returns the zero-based index of the first atom.
Definition: ElasticPotential.hpp:65
double getForceConstant() const
Returns the force constant of the potential.
Definition: ElasticPotential.hpp:83
double getReferenceLength() const
Returns the reference length of the potential.
Definition: ElasticPotential.hpp:92
void setReferenceLength(double length)
Sets the reference length of the potential.
Definition: ElasticPotential.hpp:101
VectorNorm2< E >::ResultType length(const VectorExpression< E > &e)
Returns the length (L2 norm) of the vector expression e (alias of norm2()).
Definition: VectorExpression.hpp:979
The namespace of the Chemical Data Processing Library.