Enable parallel tests.
[hoomd-blue.git] / libhoomd / computes_gpu / HarmonicImproperForceComputeGPU.h
blob24cc7ebf38f1fc9654349421315c7fae56f5e235
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.
50 // Maintainer: dnlebard
52 #ifdef WIN32
53 #pragma warning( push )
54 #pragma warning( disable : 4103 )
55 #endif
57 #include "HarmonicImproperForceCompute.h"
58 #include "HarmonicImproperForceGPU.cuh"
59 #include "Autotuner.h"
61 #include <boost/shared_ptr.hpp>
62 #include <boost/signals2.hpp>
64 /*! \file HarmonicImproperForceComputeGPU.h
65 \brief Declares the HarmonicImproperForceGPU class
68 #ifdef NVCC
69 #error This header cannot be compiled by nvcc
70 #endif
72 #ifndef __HARMONICIMPROPERFORCECOMPUTEGPU_H__
73 #define __HARMONICIMPROPERFORCECOMPUTEGPU_H__
75 //! Implements the harmonic improper force calculation on the GPU
76 /*! HarmonicImproperForceComputeGPU implements the same calculations as HarmonicImproperForceCompute,
77 but executing on the GPU.
79 Per-type parameters are stored in a simple global memory area pointed to by
80 \a m_gpu_params. They are stored as Scalar2's with the \a x component being K and the
81 \a y component being t_0.
83 The GPU kernel can be found in improperforce_kernel.cu.
85 \ingroup computes
87 class HarmonicImproperForceComputeGPU : public HarmonicImproperForceCompute
89 public:
90 //! Constructs the compute
91 HarmonicImproperForceComputeGPU(boost::shared_ptr<SystemDefinition> sysdef);
92 //! Destructor
93 ~HarmonicImproperForceComputeGPU();
95 //! Set autotuner parameters
96 /*! \param enable Enable/disable autotuning
97 \param period period (approximate) in time steps when returning occurs
99 virtual void setAutotunerParams(bool enable, unsigned int period)
101 HarmonicImproperForceCompute::setAutotunerParams(enable, period);
102 m_tuner->setPeriod(period);
103 m_tuner->setEnabled(enable);
106 //! Set the parameters
107 virtual void setParams(unsigned int type, Scalar K, Scalar chi);
109 protected:
110 boost::scoped_ptr<Autotuner> m_tuner; //!< Autotuner for block size
111 GPUArray<Scalar2> m_params; //!< Parameters stored on the GPU (k,chi)
113 //! Actually compute the forces
114 virtual void computeForces(unsigned int timestep);
117 //! Export the ImproperForceComputeGPU class to python
118 void export_HarmonicImproperForceComputeGPU();
120 #endif
122 #ifdef WIN32
123 #pragma warning( pop )
124 #endif