00001 /* ./continuum/libmesh/lennard_jones.h 00002 ********************************** 00003 Copyright INRIA and CEA 00004 00005 author : Guillaume ANCIAUX (anciaux@labri.fr, g.anciaux@laposte.net) 00006 00007 The LibMultiScale is a C++ parallel framework for the multiscale 00008 coupling methods dedicated to material simulations. This framework 00009 provides an API which makes it possible to program coupled simulations 00010 and integration of already existing codes. 00011 00012 This Project is done in a collaboration between INRIA Futurs Bordeaux 00013 within ScAlApplix team and CEA/DPTA Ile de France. 00014 00015 This software is governed by the CeCILL-C license under French law and 00016 abiding by the rules of distribution of free software. You can use, 00017 modify and/ or redistribute the software under the terms of the CeCILL-C 00018 license as circulated by CEA, CNRS and INRIA at the following URL 00019 "http://www.cecill.info". 00020 00021 As a counterpart to the access to the source code and rights to copy, 00022 modify and redistribute granted by the license, users are provided only 00023 with a limited warranty and the software's author, the holder of the 00024 economic rights, and the successive licensors have only limited 00025 liability. 00026 00027 In this respect, the user's attention is drawn to the risks associated 00028 with loading, using, modifying and/or developing or reproducing the 00029 software by the user in light of its specific status of free software, 00030 that may mean that it is complicated to manipulate, and that also 00031 therefore means that it is reserved for developers and experienced 00032 professionals having in-depth computer knowledge. Users are therefore 00033 encouraged to load and test the software's suitability as regards their 00034 requirements in conditions enabling the security of their systems and/or 00035 data to be ensured and, more generally, to use and operate it in the 00036 same conditions as regards security. 00037 00038 The fact that you are presently reading this means that you have had 00039 knowledge of the CeCILL-C license and that you accept its terms. 00040 ***********************************/ 00041 00042 #ifndef LENNARDJONES 00043 #define LENNARDJONES 00044 00049 class LennardJones : public Potential<LennardJones> 00050 { 00051 public: 00052 00053 LennardJones(double _epsilon, double _sigma){ 00054 epsilon = _epsilon; 00055 sigma = _sigma; 00056 00057 DUMP("setting lennard jones parameters : sigma = " << FORMATREAL(sigma) 00058 << " , epsilon = " << FORMATREAL(epsilon),DBG_INFO_STARTUP); 00059 }; 00060 ~LennardJones(){}; 00061 00063 double ComputeForceFoisR(double inv_rr2){ 00064 // double rr2 = r*r; 00065 double rri2 = sigma*sigma * inv_rr2; 00066 double rri6 = rri2 * rri2 * rri2; 00067 DUMP("Computing force for inv_rr2=" << inv_rr2 << " : " << 24*epsilon*rri6*(1. - 2. * rri6),DBG_ALL); 00068 return 24*epsilon*rri6*(1. - 2. * rri6); 00069 } 00070 00072 double ComputeForce(double r){ 00073 double rr2 = r*r; 00074 double rri2 = sigma*sigma / rr2; 00075 double rri6 = rri2 * rri2 * rri2; 00076 DUMP("Computing force for r= " << r << " : " << 24*epsilon*rri6*(1. - 2. * rri6)/r,DBG_ALL); 00077 return 24*epsilon*rri6*(1. - 2. * rri6)/r; 00078 } 00079 00080 00081 private: 00083 double epsilon; 00085 double sigma; 00086 }; 00087 00088 #endif
1.5.2