2 # Highly Optimized Object-oriented Many-particle Dynamics -- Blue Edition
3 # (HOOMD-blue) Open Source Software License Copyright 2008-2011 Ames Laboratory
4 # Iowa State University and The Regents of the University of Michigan All rights
7 # HOOMD-blue may contain modifications ("Contributions") provided, and to which
8 # copyright is held, by various Contributors who have granted The Regents of the
9 # University of Michigan the right to modify and/or distribute such Contributions.
11 # You may redistribute, use, and create derivate works of HOOMD-blue, in source
12 # and binary forms, provided you abide by the following conditions:
14 # * Redistributions of source code must retain the above copyright notice, this
15 # list of conditions, and the following disclaimer both in the code and
16 # prominently in any materials provided with the distribution.
18 # * Redistributions in binary form must reproduce the above copyright notice, this
19 # list of conditions, and the following disclaimer in the documentation and/or
20 # other materials provided with the distribution.
22 # * All publications and presentations based on HOOMD-blue, including any reports
23 # or published results obtained, in whole or in part, with HOOMD-blue, will
24 # acknowledge its use according to the terms posted at the time of submission on:
25 # http://codeblue.umich.edu/hoomd-blue/citations.html
27 # * Any electronic documents citing HOOMD-Blue will link to the HOOMD-Blue website:
28 # http://codeblue.umich.edu/hoomd-blue/
30 # * Apart from the above required attributions, neither the name of the copyright
31 # holder nor the names of HOOMD-blue's contributors may be used to endorse or
32 # promote products derived from this software without specific prior written
37 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND
38 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
39 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR ANY
40 # WARRANTIES THAT THIS SOFTWARE IS FREE OF INFRINGEMENT ARE DISCLAIMED.
42 # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
43 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
44 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
46 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
47 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
48 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 # this simple python interface just actiavates the c++ ExampleUpdater from cppmodule
52 # Check out any of the python code in lib/hoomd-python-module/hoomd_script for moreexamples
54 # First, we need to import the C++ module. It has the same name as this module (plugin_template) but with an underscore
56 import _plugin_template
58 # Next, since we are extending an updater, we need to bring in the base class updater and some other parts from
60 from hoomd_script
.update
import _updater
61 from hoomd_script
import util
62 from hoomd_script
import globals
65 ## Zeroes all particle velocities
67 # Every \a period time steps, particle velocities are modified so that they are all zero
69 class example(_updater
):
70 ## Initialize the velocity zeroer
72 # \param period Velocities will be zeroed every \a period time steps
76 # plugin_template.update.example()
77 # zeroer = plugin_template.update.example(period=10)
80 # \a period can be a function: see \ref variable_period_docs for details
81 def __init__(self
, period
=1):
82 util
.print_status_line();
84 # initialize base class
85 _updater
.__init
__(self
);
87 # initialize the reflected c++ class
88 if not globals.exec_conf
.isCUDAEnabled():
89 self
.cpp_updater
= _plugin_template
.ExampleUpdater(globals.system_definition
);
91 self
.cpp_updater
= _plugin_template
.ExampleUpdaterGPU(globals.system_definition
);
93 self
.setupUpdater(period
);