Fix potential problem in Messenger related to MPI window
[hoomd-blue.git] / libhoomd / data_structures / Initializers.h
blob512bbdd20681d06dc799f428bfcf909995a66ddd
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: joaander
52 /*! \file Initializers.h
53 \brief Declares a few initializers for setting up ParticleData instances
56 #ifdef NVCC
57 #error This header cannot be compiled by nvcc
58 #endif
60 #include "ParticleData.h"
62 #ifndef __INITIALIZERS_H__
63 #define __INITIALIZERS_H__
65 //! Forward declaration of SnapshotSystemData
66 class SnapshotSystemData;
68 //! Inits a ParticleData with a simple cubic array of particles
69 /*! A number of particles along each axis are specified along with a spacing
70 between particles. This initializer only generates a single particle type.
71 \ingroup data_structs
73 class SimpleCubicInitializer
75 public:
76 //! Set the parameters
77 SimpleCubicInitializer(unsigned int M, Scalar spacing, const std::string &type_name);
78 //! Empty Destructor
79 virtual ~SimpleCubicInitializer() { }
81 //! initializes a snapshot with the particle data
82 virtual boost::shared_ptr<SnapshotSystemData> getSnapshot() const;
84 private:
85 unsigned int m_M; //!< Number of particles wide to make the box
86 Scalar m_spacing; //!< Spacing between particles
87 BoxDim box; //!< Precalculated box
88 std::string m_type_name; //!< Name of the particle type created
91 //! Inits a ParticleData with randomly placed particles in a cube
92 /*! A minimum distance parameter is provided so that particles are never
93 placed too close together. This initializer only generates a single particle
94 type.
96 class RandomInitializer
98 public:
99 //! Set the parameters
100 RandomInitializer(unsigned int N, Scalar phi_p, Scalar min_dist, const std::string &type_name);
101 //! Empty Destructor
102 virtual ~RandomInitializer() { }
104 //! initializes a snapshot with the particle data
105 virtual boost::shared_ptr<SnapshotSystemData> getSnapshot() const;
107 //! Sets the random seed to use in the generation
108 void setSeed(unsigned int seed);
110 protected:
111 unsigned int m_N; //!< Number of particles to generate
112 Scalar m_phi_p; //!< Packing fraction to generate the particles at
113 Scalar m_min_dist; //!< Minimum distance to separate particles by
114 BoxDim m_box; //!< Box to put the particles in
115 std::string m_type_name; //!< Name of the particle type created
119 //! Creates a random particle system with walls defined on all 6 faces of the cube
120 /*! A \a wall_buffer argument is specified in the the call to the constructor which shifts the edge of the
121 simulation box out that distance from the walls.
123 class RandomInitializerWithWalls : public RandomInitializer
125 public:
126 //! Set the parameters
127 RandomInitializerWithWalls(unsigned int N, Scalar phi_p, Scalar min_dist, Scalar wall_buffer, const std::string &type_name);
128 //! Empty Destructor
129 virtual ~RandomInitializerWithWalls() ;
131 //! initializes a snapshot with the particle data
132 virtual boost::shared_ptr<SnapshotSystemData> getSnapshot() const;
134 protected:
135 Scalar m_wall_buffer; //!< Buffer distance between the wall and the edge of the box
136 BoxDim m_real_box; //!< Stores the actual dimensions of the box where the walls are defined
140 //! Exports the SimpleCubicInitializer class to python
141 void export_SimpleCubicInitializer();
142 //! Exports the RandomInitializer class to python
143 void export_RandomInitializer();
144 //! Exports the RandomInitializerWithWalls class to python
145 void export_RandomInitializerWithWalls();
147 #endif