1 /* -*- c++ -*- ----------------------------------------------------------
2    LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
3    https://www.lammps.org/, Sandia National Laboratories
4    Steve Plimpton, sjplimp@sandia.gov
5 
6    Copyright (2003) Sandia Corporation.  Under the terms of Contract
7    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
8    certain rights in this software.  This software is distributed under
9    the GNU General Public License.
10 
11    See the README file in the top-level LAMMPS directory.
12    -----------------------------------------------------------------------
13 
14    This file is a part of the MANIFOLD package.
15 
16    This package allows LAMMPS to perform MD simulations of particles
17    constrained on a manifold (i.e., a 2D subspace of the 3D simulation
18    box). It achieves this using the RATTLE constraint algorithm applied
19    to single-particle constraint functions g(xi,yi,zi) = 0 and their
20    derivative (i.e. the normal of the manifold) n = grad(g).
21 
22    It is very easy to add your own manifolds to the current zoo
23    (we now have sphere, a dendritic spine approximation, a 2D plane (for
24    testing purposes) and a wave-y plane.
25    See the README file for more info.
26 
27    Stefan Paquay, spaquay@brandeis.edu
28    Brandeis University, Waltham, MA, USA.
29 
30    This package was mainly developed at
31    Applied Physics/Theory of Polymers and Soft Matter,
32    Eindhoven University of Technology (TU/e), The Netherlands
33 
34    Thanks to Remy Kusters at TU/e for testing.
35 
36    This software is distributed under the GNU General Public License.
37 
38 ------------------------------------------------------------------------- */
39 
40 #ifndef LMP_MANIFOLD_GAUSSIAN_BUMP_H
41 #define LMP_MANIFOLD_GAUSSIAN_BUMP_H
42 
43 #include "manifold.h"
44 
45 namespace LAMMPS_NS {
46 
47 namespace user_manifold {
48 
49   // A Gaussian bump with a smoothed decay to flat 2D.
50   class manifold_gaussian_bump : public manifold {
51    public:
52     enum { NPARAMS = 4 };
53     manifold_gaussian_bump(class LAMMPS *, int, char **);
54     virtual ~manifold_gaussian_bump();
55 
56     virtual double g(const double *);
57     virtual void n(const double *, double *);
58 
59     // Variant of g that computes n at the same time.
60     virtual double g_and_n(const double *x, double *nn);
61 
type()62     static const char *type() { return "gaussian_bump"; }
id()63     virtual const char *id() { return type(); }
64 
nparams()65     virtual int nparams() { return NPARAMS; }
66     virtual void post_param_init();
67 
68    private:
69     // Some private constants:
70     double AA, ll, ll2, f_at_rc, fp_at_rc;
71     double rc1, rc2, rc12, rc22, dr, inv_dr;
72 
73     // Stuff for the look-up table:
74     double lut_x0, lut_x1;
75     int lut_Nbins;
76     double lut_dx;
77     double *lut_z;
78     double *lut_zp;
79 
80     double gaussian_bump(double) const;
81     double gaussian_bump_x2(double) const;
82     double gaussian_bump_der(double) const;
83 
84     void make_lut();
85     double lut_get_z(double rr) const;
86     double lut_get_zp(double rr) const;
87     void lut_get_z_and_zp(double rr, double &zz, double &zzp) const;
88 
89     void test_lut();
90 
91     double taper(double);
92     double taper_der(double);
93   };
94 }    // namespace user_manifold
95 
96 }    // namespace LAMMPS_NS
97 
98 #endif    // LMP_MANIFOLD_GAUSSIAN_BUMP_H
99