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
57 #include "gromacs/trajectoryanalysis/modules/sasa.h"
59 #include <gtest/gtest.h>
61 #include "testutils/cmdlinetest.h"
62 #include "testutils/testasserts.h"
64 #include "moduletest.h"
69 using gmx::test::CommandLine;
71 /********************************************************************
72 * Tests for gmx::analysismodules::Sas.
75 //! Test fixture for the select analysis module.
76 typedef gmx::test::TrajectoryAnalysisModuleTestFixture<gmx::analysismodules::SasaInfo>
79 TEST_F(SasaModuleTest, BasicTest)
81 const char *const cmdline[] = {
84 "-output", "name N CA C O H"
86 setTopology("lysozyme.gro");
87 setOutputFileNoTest("-o", "xvg");
88 setOutputFileNoTest("-or", "xvg");
89 setOutputFileNoTest("-oa", "xvg");
90 setOutputFileNoTest("-tv", "xvg");
91 excludeDataset("dgsolv");
92 setDatasetTolerance("area", gmx::test::ulpTolerance(8));
93 setDatasetTolerance("volume", gmx::test::ulpTolerance(8));
94 runTest(CommandLine(cmdline));
97 TEST_F(SasaModuleTest, WritesConnollySurfaceWithSolute)
99 const char *const cmdline[] = {
101 "-surface", "atomnr 1"
103 setTopology("lysozyme.gro");
104 setOutputFileNoTest("-o", "xvg");
105 setOutputFile("-q", "connolly.pdb");
106 includeDataset("area");
107 runTest(CommandLine(cmdline));
110 // The CONECT records written to the output make this very difficult to test
111 // without parsing the output file, since by construction, there are a lot of
112 // dot pairs that are at exactly the same distance from each other in exact
113 // arithmetic, and depending on rounding etc., different pairs get picked into
114 // the output for single and double precision.
116 TEST_F(SasaModuleTest, WritesConnollySurfaceWithoutSolute)
118 const char *const cmdline[] = {
120 "-surface", "atomnr 1",
123 setTopology("lysozyme.gro");
124 setOutputFileNoTest("-o", "xvg");
125 setOutputFile("-q", "connolly.pdb");
126 includeDataset("area");
127 runTest(CommandLine(cmdline));
131 TEST_F(SasaModuleTest, HandlesDynamicOutputGroup)
133 const char *const cmdline[] = {
138 setTopology("lysozyme.gro");
139 setOutputFileNoTest("-o", "xvg");
140 setOutputFileNoTest("-or", "xvg");
141 setOutputFileNoTest("-oa", "xvg");
142 excludeDataset("volume");
143 excludeDataset("dgsolv");
144 setDatasetTolerance("area", gmx::test::ulpTolerance(8));
145 runTest(CommandLine(cmdline));
148 TEST_F(SasaModuleTest, HandlesDynamicCalculationGroup)
150 const char *const cmdline[] = {
152 "-surface", "y > 1.5",
153 "-output", "y > 1.5 and z > 0"
155 setTopology("lysozyme.gro");
156 setOutputFileNoTest("-o", "xvg");
157 setOutputFileNoTest("-or", "xvg");
158 setOutputFileNoTest("-oa", "xvg");
159 excludeDataset("volume");
160 excludeDataset("dgsolv");
161 setDatasetTolerance("area", gmx::test::ulpTolerance(8));
162 runTest(CommandLine(cmdline));