2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2020, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
37 * This implements basic nblib test systems
39 * \author Victor Holanda <victor.holanda@cscs.ch>
40 * \author Joe Jordan <ejjordan@kth.se>
41 * \author Prashanth Kanduri <kanduri@cscs.ch>
42 * \author Sebastian Keller <keller@cscs.ch>
43 * \author Artem Zhmurov <zhmurov@gmail.com>
45 #ifndef NBLIB_TESTSYSTEMS_H
46 #define NBLIB_TESTSYSTEMS_H
50 #include "nblib/box.h"
51 #include "nblib/molecules.h"
52 #include "nblib/particletype.h"
53 #include "nblib/simulationstate.h"
54 #include "nblib/topology.h"
59 //! \internal \brief Parameters from gromos43A1
62 //! Argon Particle Name
63 ParticleName particleName = ParticleName("Ar");
64 //! Argon particle type name
65 ParticleTypeName particleTypeName = ParticleTypeName("Ar");
66 //! Argon molecule name
67 MoleculeName moleculeName = MoleculeName("Ar");
68 //! Argon Particle Mass
69 Mass mass = Mass(39.94800);
70 //! Argon C6 parameter
71 C6 c6{ 0.0062647225 };
72 //! Argon C12 parameter
73 C12 c12{ 9.847044e-06 };
76 //! Lookup table for charges needed for building topologies
77 extern std::unordered_map<std::string, Charge> Charges;
79 //! \internal \brief Make an SPC water molecule with parameters from gromos43A1
80 class WaterMoleculeBuilder
83 // There is no default ctor for a Molecule so it must be initialized
84 WaterMoleculeBuilder();
86 //! Return the initialized water Molecule, with exclusions
87 Molecule waterMolecule();
89 //! Return the initialized water Molecule, without exclusions
90 Molecule waterMoleculeWithoutExclusions();
96 //! Add the exclusions from particle names. Private to prevent multiple calls
97 void addExclusionsFromNames();
100 //! \internal \brief Make a methanol molecule with parameters from gromos43A1
101 class MethanolMoleculeBuilder
104 // There is no default ctor for a Molecule so it must be initialized
105 MethanolMoleculeBuilder();
107 //! Return the initialized water Molecule, with exclusions
108 Molecule methanolMolecule();
115 //! \internal \brief Build topology of water molecules of a specified number
116 class WaterTopologyBuilder
119 //! Return a topology with specified SPC water molecules
120 Topology buildTopology(int numMolecules);
122 //! Return the actual water Molecule used in the topology
126 WaterMoleculeBuilder waterMolecule_;
129 //! \internal \brief Build topology of methanol+water molecules from specified numbers
130 class SpcMethanolTopologyBuilder
133 //! Return a topology with specified methanol molecules
134 Topology buildTopology(int numWater, int numMethanol);
136 //! Return the actual methanol Molecule used in the topology
139 //! Return the actual water Molecule used in the topology
143 MethanolMoleculeBuilder methanolMolecule_;
144 WaterMoleculeBuilder waterMolecule_;
147 //! \internal \brief Build topology of argon molecules of a specified number
148 class ArgonTopologyBuilder
151 //! Build a topology with specified argon molecules
152 ArgonTopologyBuilder(const int& numParticles);
154 //! Get the topology with specified argon molecules
155 Topology argonTopology();
158 TopologyBuilder topologyBuilder_;
161 //! \internal \brief Build simulation state for the argon example
162 class ArgonSimulationStateBuilder
165 ArgonSimulationStateBuilder();
167 //! Set coordinates of particles in the defined system
168 void setCoordinate(int particleNum, int dimension, real value);
170 //! Set particle velocities
171 void setVelocity(int particleNum, int dimension, real value);
173 //! Setup simulation state
174 SimulationState setupSimulationState();
177 const Topology& topology() const;
179 //! Get the box bounding the system
182 //! Get current coordinates
183 std::vector<Vec3>& coordinates();
185 //! Get current velocities
186 std::vector<Vec3>& velocities();
189 std::vector<Vec3> coordinates_;
190 std::vector<Vec3> velocities_;
191 std::vector<Vec3> forces_;
197 //! \internal \brief Build simulation state for the SPC-Methanol example
198 class SpcMethanolSimulationStateBuilder
201 SpcMethanolSimulationStateBuilder();
203 //! Setup simulation state
204 SimulationState setupSimulationState();
206 //! Get current coordinates
207 std::vector<Vec3>& coordinates();
209 //! Get current velocities
210 std::vector<Vec3>& velocities();
213 std::vector<Vec3> coordinates_;
214 std::vector<Vec3> velocities_;
215 std::vector<Vec3> forces_;
222 #endif // NBLIB_TESTSYSTEMS_H