/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_trajectoryanalysis
*/
-#include <gtest/gtest.h>
+#include "gmxpre.h"
#include "gromacs/trajectoryanalysis/modules/angle.h"
+#include <gtest/gtest.h>
+
#include "testutils/cmdlinetest.h"
#include "moduletest.h"
*/
//! Test fixture for the angle analysis module.
-typedef gmx::test::TrajectoryAnalysisModuleTestFixture<gmx::analysismodules::Angle>
+typedef gmx::test::TrajectoryAnalysisModuleTestFixture<gmx::analysismodules::AngleInfo>
AngleModuleTest;
TEST_F(AngleModuleTest, ComputesSimpleAngles)
{
const char *const cmdline[] = {
"angle",
- "-g1", "angle", "-group1", "resname RA1 RA2 and name A1 A2 A3"
+ "-g1", "angle", "-group1", "resname RA1 RA2 and name A1 A2 A3",
+ "-binw", "60"
};
setTopology("angle.gro");
- runTest(CommandLine::create(cmdline));
+ runTest(CommandLine(cmdline));
}
TEST_F(AngleModuleTest, ComputesDihedrals)
{
const char *const cmdline[] = {
"angle",
- "-g1", "dihedral", "-group1", "resname RD1 RD2 RD3 and name A1 A2 A3 A4"
+ "-g1", "dihedral", "-group1", "resname RD1 RD2 RD3 and name A1 A2 A3 A4",
+ "-binw", "120"
};
setTopology("angle.gro");
- runTest(CommandLine::create(cmdline));
+ runTest(CommandLine(cmdline));
}
TEST_F(AngleModuleTest, ComputesVectorPairAngles)
const char *const cmdline[] = {
"angle",
"-g1", "vector", "-group1", "resname RV1 RV2 and name A1 A2",
- "-g2", "vector", "-group2", "resname RV3 RV4 and name A1 A2"
+ "-g2", "vector", "-group2", "resname RV3 RV4 and name A1 A2",
+ "-binw", "60"
};
setTopology("angle.gro");
- runTest(CommandLine::create(cmdline));
+ runTest(CommandLine(cmdline));
}
TEST_F(AngleModuleTest, ComputesVectorPlanePairAngles)
const char *const cmdline[] = {
"angle",
"-g1", "vector", "-group1", "resname RV1 RV2 and name A1 A2",
- "-g2", "plane", "-group2", "resname RP1 RP2 and name A1 A2 A3"
+ "-g2", "plane", "-group2", "resname RP1 RP2 and name A1 A2 A3",
+ "-binw", "60"
};
setTopology("angle.gro");
- runTest(CommandLine::create(cmdline));
+ runTest(CommandLine(cmdline));
}
TEST_F(AngleModuleTest, ComputesPlaneZAxisAngles)
const char *const cmdline[] = {
"angle",
"-g1", "plane", "-group1", "resname RP1 RP2 and name A1 A2 A3",
- "-g2", "z"
+ "-g2", "z",
+ "-binw", "60"
};
setTopology("angle.gro");
- runTest(CommandLine::create(cmdline));
+ runTest(CommandLine(cmdline));
}
TEST_F(AngleModuleTest, ComputesVectorSphereNormalZAxisAngles)
const char *const cmdline[] = {
"angle",
"-g1", "vector", "-group1", "resname RV1 RV2 and name A1 A2",
- "-g2", "sphnorm", "-group2", "cog of resname RS"
+ "-g2", "sphnorm", "-group2", "cog of resname RS",
+ "-binw", "60"
};
setTopology("angle.gro");
- runTest(CommandLine::create(cmdline));
+ runTest(CommandLine(cmdline));
}
TEST_F(AngleModuleTest, ComputesVectorTimeZeroAngles)
const char *const cmdline[] = {
"angle",
"-g1", "vector", "-group1", "resname RV1 RV2 RV3 RV4 and name A1 A2",
- "-g2", "t0"
+ "-g2", "t0",
+ "-binw", "60"
};
setTopology("angle.gro");
setTrajectory("angle.gro");
- runTest(CommandLine::create(cmdline));
+ runTest(CommandLine(cmdline));
+}
+
+TEST_F(AngleModuleTest, ComputesMultipleAngles)
+{
+ const char *const cmdline[] = {
+ "angle",
+ "-g1", "vector",
+ "-group1",
+ "resname RV1 RV2 and name A1 A2",
+ "resname RV3 RV4 and name A1 A2",
+ "-g2", "plane",
+ "-group2",
+ "resname RP1 RP2 and name A1 A2 A3",
+ "resname RP1 RP2 and name A1 A2 A3",
+ "-binw", "60"
+ };
+ setTopology("angle.gro");
+ runTest(CommandLine(cmdline));
+}
+
+TEST_F(AngleModuleTest, HandlesDynamicSelections)
+{
+ const char *const cmdline[] = {
+ "angle",
+ "-g1", "angle", "-group1", "resname RA1 RA2 and name A1 A2 A3 and z < 0.5",
+ "-binw", "60"
+ };
+ setTopology("angle.gro");
+ runTest(CommandLine(cmdline));
+}
+
+TEST_F(AngleModuleTest, HandlesOneVsMultipleVectorAngles)
+{
+ const char *const cmdline[] = {
+ "angle",
+ "-g1", "vector", "-group1", "resname RV1 RV2 and name A1 A2",
+ "-g2", "vector", "-group2", "resname RV3 and name A1 A2",
+ "-binw", "60"
+ };
+ setTopology("angle.gro");
+ runTest(CommandLine(cmdline));
+}
+
+TEST_F(AngleModuleTest, HandlesOneVsMultipleVectorGroupsAngles)
+{
+ const char *const cmdline[] = {
+ "angle",
+ "-g1", "vector",
+ "-group1",
+ "resname RV1 and name A1 A2",
+ "resname RV3 RV4 and name A1 A2",
+ "-g2", "plane",
+ "-group2",
+ "resname RP1 RP2 and name A1 A2 A3",
+ "-binw", "60"
+ };
+ setTopology("angle.gro");
+ runTest(CommandLine(cmdline));
}
} // namespace