2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2014, 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 * Tests for functionality of the "sasa" trajectory analysis module.
39 * These tests test the basic functionality of the tool itself, but currently
40 * the following are missing:
41 * - Tests related to -odg output. This would require a full tpr file, and
42 * some investigation on what kind of tpr it should be to produce reasonable
44 * - Tests for the X axes in the area per atom/residue plots. These could be
45 * added once better X axes are implemented.
46 * - Tests for XVG labels. This is a limitation of the current testing
49 * The actual surface area algorithm should be tested separately with a more
50 * extensive set of data, but those fit better as a separate set of unit tests.
52 * \author Teemu Murtola <teemu.murtola@gmail.com>
53 * \ingroup module_trajectoryanalysis
55 #include <gtest/gtest.h>
57 #include "gromacs/trajectoryanalysis/modules/sasa.h"
59 #include "testutils/cmdlinetest.h"
60 #include "testutils/testasserts.h"
62 #include "moduletest.h"
67 using gmx::test::CommandLine;
69 /********************************************************************
70 * Tests for gmx::analysismodules::Sas.
73 //! Test fixture for the select analysis module.
74 typedef gmx::test::TrajectoryAnalysisModuleTestFixture<gmx::analysismodules::SasaInfo>
77 TEST_F(SasaModuleTest, BasicTest)
79 const char *const cmdline[] = {
82 "-output", "name N CA C O H"
84 setTopology("lysozyme.gro");
85 setOutputFileNoTest("-o", "xvg");
86 setOutputFileNoTest("-or", "xvg");
87 setOutputFileNoTest("-oa", "xvg");
88 setOutputFileNoTest("-tv", "xvg");
89 excludeDataset("dgsolv");
90 setDatasetTolerance("area", gmx::test::ulpTolerance(8));
91 setDatasetTolerance("volume", gmx::test::ulpTolerance(8));
92 runTest(CommandLine(cmdline));
95 TEST_F(SasaModuleTest, WritesConnollySurfaceWithSolute)
97 const char *const cmdline[] = {
99 "-surface", "atomnr 1"
101 setTopology("lysozyme.gro");
102 setOutputFileNoTest("-o", "xvg");
103 setOutputFile("-q", "connolly.pdb");
104 includeDataset("area");
105 runTest(CommandLine(cmdline));
108 // The CONECT records written to the output make this very difficult to test
109 // without parsing the output file, since by construction, there are a lot of
110 // dot pairs that are at exactly the same distance from each other in exact
111 // arithmetic, and depending on rounding etc., different pairs get picked into
112 // the output for single and double precision.
114 TEST_F(SasaModuleTest, WritesConnollySurfaceWithoutSolute)
116 const char *const cmdline[] = {
118 "-surface", "atomnr 1",
121 setTopology("lysozyme.gro");
122 setOutputFileNoTest("-o", "xvg");
123 setOutputFile("-q", "connolly.pdb");
124 includeDataset("area");
125 runTest(CommandLine(cmdline));
129 TEST_F(SasaModuleTest, HandlesDynamicOutputGroup)
131 const char *const cmdline[] = {
136 setTopology("lysozyme.gro");
137 setOutputFileNoTest("-o", "xvg");
138 setOutputFileNoTest("-or", "xvg");
139 setOutputFileNoTest("-oa", "xvg");
140 excludeDataset("volume");
141 excludeDataset("dgsolv");
142 setDatasetTolerance("area", gmx::test::ulpTolerance(8));
143 runTest(CommandLine(cmdline));
146 TEST_F(SasaModuleTest, HandlesDynamicCalculationGroup)
148 const char *const cmdline[] = {
150 "-surface", "y > 1.5",
151 "-output", "y > 1.5 and z > 0"
153 setTopology("lysozyme.gro");
154 setOutputFileNoTest("-o", "xvg");
155 setOutputFileNoTest("-or", "xvg");
156 setOutputFileNoTest("-oa", "xvg");
157 excludeDataset("volume");
158 excludeDataset("dgsolv");
159 setDatasetTolerance("area", gmx::test::ulpTolerance(8));
160 runTest(CommandLine(cmdline));