Enable parallel tests.
[hoomd-blue.git] / libhoomd / analyzers / HOOMDDumpWriter.h
blob1c8fa17e9f0e62b9c33aacaa3c9ced9400e54b48
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 HOOMDDumpWriter.h
53 \brief Declares the HOOMDDumpWriter class
56 #ifdef NVCC
57 #error This header cannot be compiled by nvcc
58 #endif
60 #include <string>
62 #include <boost/shared_ptr.hpp>
64 #include "Analyzer.h"
66 #ifndef __HOOMD_DUMP_WRITER_H__
67 #define __HOOMD_DUMP_WRITER_H__
69 //! Analyzer for writing out HOOMD dump files
70 /*! HOOMDDumpWriter can be used to write out xml files containing various levels of information
71 of the current time step of the simulation. At a minimum, the current time step and box
72 dimensions are output. Optionally, particle positions, velocities and types can be included
73 in the file.
75 Usage:<br>
76 Construct a HOOMDDumpWriter, attaching it to a ParticleData and specifying a base file name.
77 Call analyze(timestep) to output a dump file with the state of the current time step
78 of the simulation. It will create base_file.timestep.xml where timestep is a 0-padded
79 10 digit number. The 0 padding is so files sorted "alphabetically" will be read in
80 numberical order.
82 To include positions, velocities and types, see: setOutputPosition() setOutputVelocity()
83 and setOutputType(). Similarly, walls and bonds can be included with setOutputWall() and
84 setOutputBond().
86 Future versions will include the ability to dump forces on each particle to the file also.
88 For information on the structure of the xml file format: see \ref page_dev_info
89 Although, HOOMD's user guide probably has a more up to date documentation on the format.
90 \ingroup analyzers
92 class HOOMDDumpWriter : public Analyzer
94 public:
95 //! Construct the writer
96 HOOMDDumpWriter(boost::shared_ptr<SystemDefinition> sysdef, std::string base_fname);
98 //! Destructor
99 ~HOOMDDumpWriter();
101 //! Write out the data for the current timestep
102 void analyze(unsigned int timestep);
103 //! Enables/disables the writing of the particle positions
104 void setOutputPosition(bool enable);
105 //! Enables/disables the writing of particle images
106 void setOutputImage(bool enable);
107 //! Enables/disables the writing of particle velocities
108 void setOutputVelocity(bool enable);
109 //! Enables/disables the writing of particle masses
110 void setOutputMass(bool enable);
111 //! Enables/disables the writing of particle diameters
112 void setOutputDiameter(bool enable);
113 //! Enables/disables the writing of particle types
114 void setOutputType(bool enable);
115 //! Enables/disables the writing of bonds
116 void setOutputBond(bool enable);
117 //! Enables/disables the writing of angles
118 void setOutputAngle(bool enable);
119 //! Enables/disables the writing of dihedrals
120 void setOutputDihedral(bool enable);
121 //! Enables/disables the writing of impropers
122 void setOutputImproper(bool enable);
123 //! Enables/disables the writing of walls
124 void setOutputWall(bool enable);
125 //! Enables/disables the writing of acceleration
126 void setOutputAccel(bool enable);
127 //! Enables/disables the writing of body
128 void setOutputBody(bool enable);
129 //! Enables/disables the writing of charge
130 void setOutputCharge(bool enable);
131 //! Enables/disables the writing of orientation
132 void setOutputOrientation(bool enable);
133 //! Enables/disables the writing of moment_inertia
134 void setOutputMomentInertia(bool enable);
135 //! Sets the vizsigma value to write
136 void setVizSigma(Scalar vizsigma)
138 m_vizsigma = vizsigma;
139 m_vizsigma_set = true;
142 //! Writes a file at the current time step
143 void writeFile(std::string fname, unsigned int timestep);
144 private:
145 std::string m_base_fname; //!< String used to store the file name of the XML file
146 bool m_output_position; //!< true if the particle positions should be written
147 bool m_output_image; //!< true if the particle positions should be written
148 bool m_output_velocity; //!< true if the particle velocities should be written
149 bool m_output_mass; //!< true if the particle masses should be written
150 bool m_output_diameter; //!< true if the particle diameters should be written
151 bool m_output_type; //!< true if the particle types should be written
152 bool m_output_bond; //!< true if the bonds should be written
153 bool m_output_angle; //!< true if the angles should be written
154 bool m_output_wall; //!< true if the walls should be written
155 bool m_output_dihedral; //!< true if dihedrals should be written
156 bool m_output_improper; //!< true if impropers should be written
157 bool m_output_accel; //!< true if acceleration should be written
158 bool m_output_body; //!< true if body should be written
159 bool m_output_charge; //!< true if body should be written
160 bool m_output_orientation; //!< true if orientation should be written
161 bool m_output_moment_inertia; //!< true if moment_inertia should be written
162 Scalar m_vizsigma; //!< vizsigma value to write out to xml files
163 bool m_vizsigma_set; //!< true if vizsigma has been set
166 //! Exports the HOOMDDumpWriter class to python
167 void export_HOOMDDumpWriter();
169 #endif