Merge branch 'maint'
[hoomd-blue.git] / libhoomd / computes / EAMForceCompute.h
blob342848bd6af9b0a2a2023dca41a29ac585bf2a1c
1 /*
2 Highly Optimized Object-oriented Many-particle Dynamics -- Blue Edition
3 (HOOMD-blue) Open Source Software License Copyright 2009-2014 The Regents of
4 the University of Michigan All rights reserved.
6 HOOMD-blue may contain modifications ("Contributions") provided, and to which
7 copyright is held, by various Contributors who have granted The Regents of the
8 University of Michigan the right to modify and/or distribute such Contributions.
10 You may redistribute, use, and create derivate works of HOOMD-blue, in source
11 and binary forms, provided you abide by the following conditions:
13 * Redistributions of source code must retain the above copyright notice, this
14 list of conditions, and the following disclaimer both in the code and
15 prominently in any materials provided with the distribution.
17 * Redistributions in binary form must reproduce the above copyright notice, this
18 list of conditions, and the following disclaimer in the documentation and/or
19 other materials provided with the distribution.
21 * All publications and presentations based on HOOMD-blue, including any reports
22 or published results obtained, in whole or in part, with HOOMD-blue, will
23 acknowledge its use according to the terms posted at the time of submission on:
24 http://codeblue.umich.edu/hoomd-blue/citations.html
26 * Any electronic documents citing HOOMD-Blue will link to the HOOMD-Blue website:
27 http://codeblue.umich.edu/hoomd-blue/
29 * Apart from the above required attributions, neither the name of the copyright
30 holder nor the names of HOOMD-blue's contributors may be used to endorse or
31 promote products derived from this software without specific prior written
32 permission.
34 Disclaimer
36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND
37 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
38 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR ANY
39 WARRANTIES THAT THIS SOFTWARE IS FREE OF INFRINGEMENT ARE DISCLAIMED.
41 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
42 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
43 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
44 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
45 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
46 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
47 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 // Maintainer: morozov
53 #include <boost/shared_ptr.hpp>
55 #include "ForceCompute.h"
56 #include "NeighborList.h"
58 /*! \file EAMForceCompute.h
59 \brief Declares the EAMForceCompute class
62 #ifdef NVCC
63 #error This header cannot be compiled by nvcc
64 #endif
66 #ifndef __EAMFORCECOMPUTE_H__
67 #define __EAMFORCECOMPUTE_H__
69 //! Computes Lennard-Jones forces on each particle
70 /*! The total pair force is summed for each particle when compute() is called. Forces are only summed between
71 neighboring particles with a separation distance less than \c r_cut. A NeighborList must be provided
72 to identify these neighbors. Calling compute() in this class will in turn result in a call to the
73 NeighborList's compute() to make sure that the neighbor list is up to date.
75 Usage: Construct a EAMForceCompute, providing it an already constructed ParticleData and NeighborList.
76 Then set parameters for all possible pairs of types by calling setParams.
78 Forces can be computed directly by calling compute() and then retrieved with a call to acquire(), but
79 a more typical usage will be to add the force compute to NVEUpdater or NVTUpdater.
81 \ingroup computes
83 class EAMForceCompute : public ForceCompute
85 public:
86 //! Constructs the compute
87 EAMForceCompute(boost::shared_ptr<SystemDefinition> sysdef, char *filename, int type_of_file);
89 //! Destructor
90 virtual ~EAMForceCompute();
92 //! Sets the neighbor list to be used for the EAM force
93 virtual void set_neighbor_list(boost::shared_ptr<NeighborList> nlist);
95 //! Get the r cut value read from the EAM potential file
96 virtual Scalar get_r_cut();
98 //! Returns a list of log quantities this compute calculates
99 virtual std::vector< std::string > getProvidedLogQuantities();
101 //! Calculates the requested log value and returns it
102 virtual Scalar getLogValue(const std::string& quantity, unsigned int timestep);
104 //! Shifting modes that can be applied to the energy
105 virtual void loadFile(char *filename, int type_of_file);
108 protected:
109 boost::shared_ptr<NeighborList> m_nlist; //!< The neighborlist to use for the computation
110 Scalar m_r_cut; //!< Cuttoff radius beyond which the force is set to 0
111 unsigned int m_ntypes; //!< Store the width and height of lj1 and lj2 here
113 Scalar drho; //!< Undocumented parameter
114 Scalar dr; //!< Undocumented parameter
115 Scalar rdrho; //!< Undocumented parameter
116 Scalar rdr; //!< Undocumented parameter
117 vector<Scalar> mass; //!< Undocumented parameter
118 vector<int> types; //!< Undocumented parameter
119 vector<string> names; //!< Undocumented parameter
120 unsigned int nr; //!< Undocumented parameter
121 unsigned int nrho; //!< Undocumented parameter
124 vector<Scalar> electronDensity; //!< array rho(r)
125 vector<Scalar2> pairPotential; //!< array Z(r)
126 vector<Scalar> embeddingFunction; //!< array F(rho)
128 vector<Scalar> derivativeElectronDensity; //!< array rho'(r)
129 vector<Scalar> derivativePairPotential; //!< array Z'(r)
130 vector<Scalar> derivativeEmbeddingFunction; //!< array F'(rho)
132 //! Actually compute the forces
133 virtual void computeForces(unsigned int timestep);
136 //! Exports the EAMForceCompute class to python
137 void export_EAMForceCompute();
139 #endif