Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
ljgen.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4 * Max-Planck-Institute for Polymer Research, Theory Group
5 *
6 * This file is part of ESPResSo.
7 *
8 * ESPResSo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * ESPResSo 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
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21/** \file
22 *
23 * Implementation of \ref ljgen.hpp
24 */
25#include "ljgen.hpp"
26
27#ifdef LENNARD_JONES_GENERIC
29
30#include <stdexcept>
31
32LJGen_Parameters::LJGen_Parameters(double epsilon, double sigma, double cutoff,
33 double shift, double offset,
34#ifdef LJGEN_SOFTCORE
35 double lam, double delta,
36#endif
37 double e1, double e2, double b1, double b2)
38 : eps{epsilon}, sig{sigma}, cut{cutoff}, shift{shift}, offset{offset},
39#ifdef LJGEN_SOFTCORE
40 lambda{lam}, softrad{delta},
41#endif
42 a1{e1}, a2{e2}, b1{b1}, b2{b2} {
43 if (epsilon < 0.) {
44 throw std::domain_error("Generic LJ parameter 'epsilon' has to be >= 0");
45 }
46 if (sigma < 0.) {
47 throw std::domain_error("Generic LJ parameter 'sigma' has to be >= 0");
48 }
49 if (cutoff < 0.) {
50 throw std::domain_error("Generic LJ parameter 'cutoff' has to be >= 0");
51 }
52#ifdef LJGEN_SOFTCORE
53 if (delta < 0.) {
54 throw std::domain_error("Generic LJ parameter 'delta' has to be >= 0");
55 }
56 if (lam < 0. or lam > 1.) {
57 throw std::domain_error(
58 "Generic LJ parameter 'lam' has to be in the range [0, 1]");
59 }
60#endif // LJGEN_SOFTCORE
61}
62
63#endif // LENNARD_JONES_GENERIC
Routines to calculate the generalized Lennard-Jones potential between particle pairs.
Various procedures concerning interactions between particles.
LJGen_Parameters()=default