1 //-----------------------------------------------------------------------bl- 2 //-------------------------------------------------------------------------- 3 // 4 // Antioch - A Gas Dynamics Thermochemistry Library 5 // 6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk, 7 // Sylvain Plessis, Roy H. Stonger 8 // 9 // Copyright (C) 2013 The PECOS Development Team 10 // 11 // This library is free software; you can redistribute it and/or 12 // modify it under the terms of the Version 2.1 GNU Lesser General 13 // Public License as published by the Free Software Foundation. 14 // 15 // This library is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 // Lesser General Public License for more details. 19 // 20 // You should have received a copy of the GNU Lesser General Public 21 // License along with this library; if not, write to the Free Software 22 // Foundation, Inc. 51 Franklin Street, Fifth Floor, 23 // Boston, MA 02110-1301 USA 24 // 25 //-----------------------------------------------------------------------el- 26 27 #ifndef ANTIOCH_LENNARD_JONES_POTENTIAL_H 28 #define ANTIOCH_LENNARD_JONES_POTENTIAL_H 29 30 //Antioch 31 32 //C++ 33 34 namespace Antioch{ 35 36 /** 37 * The Lennard-Jones potential, for the moment, simply 38 * a storage faiclity, easily expandable to a full 39 * analysis object 40 * \f[ 41 * LJ(r_{ij}) = 4\epsilon_{ij} \left[\left(\frac{\sigma_{ij}}{r}\right)^{12} - \left(\frac{\sigma_{ij}}{r}\right)^6\right] 42 * \f] 43 * with \f$\epsilon\f$ the well depth and \f$\sigma\f$ the collision diameter. 44 * The pair values are related to species values by the relations 45 * \f[ 46 * \epsilon_{ij} = \sqrt{\epsilon_i \epsilon_j} 47 * \f] 48 * and 49 * \f[ 50 * \sigma_{ij} = \frac{\sigma_i + \sigma_j}{2} 51 * \f] 52 * 53 */ 54 template <typename CoeffType> 55 class LennardJonesPotential 56 { 57 public: 58 59 LennardJonesPotential(const CoeffType & depth = 0., const CoeffType & diameter = 0.); 60 ~LennardJonesPotential(); 61 62 template <typename StateType> 63 void set_diameter(const StateType & diameter); 64 65 template <typename StateType> 66 void set_depth(const StateType & depth); 67 68 template <typename StateType> 69 void reset_coeffs(const StateType & depth, const StateType & diameter); 70 71 CoeffType diameter() const; 72 73 CoeffType depth() const; 74 75 private: 76 77 78 CoeffType _depth; 79 CoeffType _diameter; 80 81 }; 82 83 template <typename CoeffType> 84 inline LennardJonesPotential(const CoeffType & depth,const CoeffType & diameter)85 LennardJonesPotential<CoeffType>::LennardJonesPotential(const CoeffType & depth, const CoeffType & diameter): 86 _depth(depth), 87 _diameter(diameter) 88 { 89 return; 90 } 91 92 template <typename CoeffType> 93 inline ~LennardJonesPotential()94 LennardJonesPotential<CoeffType>::~LennardJonesPotential() 95 { 96 return; 97 } 98 99 template <typename CoeffType> 100 inline depth()101 CoeffType LennardJonesPotential<CoeffType>::depth() const 102 { 103 return _depth; 104 } 105 106 template <typename CoeffType> 107 inline diameter()108 CoeffType LennardJonesPotential<CoeffType>::diameter() const 109 { 110 return _diameter; 111 } 112 113 template <typename CoeffType> 114 template <typename StateType> 115 inline set_diameter(const StateType & diameter)116 void LennardJonesPotential<CoeffType>::set_diameter(const StateType & diameter) 117 { 118 _diameter = diameter; 119 } 120 121 template <typename CoeffType> 122 template <typename StateType> 123 inline set_depth(const StateType & depth)124 void LennardJonesPotential<CoeffType>::set_depth(const StateType & depth) 125 { 126 _depth = depth; 127 } 128 129 template <typename CoeffType> 130 template <typename StateType> 131 inline reset_coeffs(const StateType & depth,const StateType & diameter)132 void LennardJonesPotential<CoeffType>::reset_coeffs(const StateType & depth, const StateType & diameter) 133 { 134 this->set_depth(depth); 135 this->set_diameter(diameter); 136 } 137 138 139 } //end namespace Antioch 140 141 #endif 142