message(STATUS "Detecting best SIMD instructions for this CPU")
# Get CPU SIMD properties information
- set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUINFO_STANDALONE ${GMX_STDLIB_CXX_FLAGS}")
if(GMX_TARGET_X86)
- set(_compile_definitions "${_compile_definitions} -DGMX_TARGET_X86")
+ set(GMX_TARGET_X86_VALUE 1)
+ else()
+ set(GMX_TARGET_X86_VALUE 0)
endif()
+ set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUINFO_STANDALONE ${GMX_STDLIB_CXX_FLAGS} -DGMX_TARGET_X86=${GMX_TARGET_X86_VALUE}")
# Prepare a default suggestion
set(OUTPUT_SIMD "None")
if(NOT CMAKE_CROSSCOMPILING)
# Get CPU information, e.g. for deciding what SIMD support probably exists
- set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUINFO_STANDALONE ${GMX_STDLIB_CXX_FLAGS}")
if(GMX_TARGET_X86)
- set(_compile_definitions "${_compile_definitions} -DGMX_TARGET_X86")
+ set(GMX_TARGET_X86_VALUE 1)
+ else()
+ set(GMX_TARGET_X86_VALUE 0)
endif()
+ set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUINFO_STANDALONE ${GMX_STDLIB_CXX_FLAGS} -DGMX_TARGET_X86=${GMX_TARGET_X86_VALUE}")
set(GMX_BUILDINFORMATION_BINARY "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/GmxBuildInformation${CMAKE_EXECUTABLE_SUFFIX}")
set(LINK_LIBRARIES "${GMX_STDLIB_LIBRARIES}")
* be reallocated if it is not NULL. */
}
- fr->step = static_cast<int>(frameNumber);
+ fr->step = frameNumber;
fr->bStep = TRUE;
// Convert the time to ps
fr->time = frameTime / PICO;
{
gmx_file("Cannot read next frame of TNG file");
}
- snew(*values, sizeof(real) * *nValuesPerFrame * *nAtoms);
+ srenew(*values, sizeof(real) * *nValuesPerFrame * *nAtoms);
convert_array_to_real_array(data,
*values,
getDistanceScaleFactor(input),
FILE *out = NULL;
t_trxstatus *trxout = NULL;
t_trxstatus *trxin;
- int ftp, ftpin = 0, file_nr;
+ int file_nr;
t_trxframe fr, frout;
int flags;
rvec *xmem = NULL, *vmem = NULL, *fmem = NULL;
/* Determine output type */
out_file = opt2fn("-o", NFILE, fnm);
- ftp = fn2ftp(out_file);
+ int ftp = fn2ftp(out_file);
fprintf(stderr, "Will write %s: %s\n", ftp2ext(ftp), ftp2desc(ftp));
bNeedPrec = (ftp == efXTC || ftp == efGRO);
+ int ftpin = fn2ftp(in_file);
if (bVels)
{
/* check if velocities are possible in input and output files */
- ftpin = fn2ftp(in_file);
bVels = (ftp == efTRR || ftp == efGRO ||
ftp == efG96 || ftp == efTNG)
&& (ftpin == efTRR || ftpin == efGRO ||
dt = (time[nfr-1] - time[0])/(nfr - 1);
/* Some ugly rounding to get nice nice times in the output */
- dt = static_cast<int>((10000.0*dt + 0.5)/10000.0);
+ dt = std::round(10000.0*dt)/10000.0;
invbin = 1.0/rbin;
EXPECT_GT(c.supportLevel(), gmx::CpuInfo::SupportLevel::None)
<< "No CPU information at all could be detected. " << commonMsg << std::endl;
-#ifdef GMX_TARGET_X86
+#if GMX_TARGET_X86
EXPECT_GE(c.supportLevel(), gmx::CpuInfo::SupportLevel::Features)
<< "No CPU features could be detected. " << commonMsg << std::endl;
#endif
if (sel->v.type == POS_VALUE)
{
alloc_selection_pos_data(sel);
+ gmx_ana_pos_copy(sel->v.u.p, sel->child->v.u.p, true);
}
else
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, 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.
" positions used in selecting atoms by coordinates.",
"",
"See the \"positions\" subtopic for more information on these options.",
+ "",
+ "Tools that take selections apply them to a structure/topology and/or",
+ "a trajectory file. If the tool takes both (typically as [TT]-s[tt]",
+ "for structure/topology and [TT]-f[tt] for trajectory), then the",
+ "trajectory file is only used for coordinate information, and all other",
+ "information, such as atom names and residue information, is read from",
+ "the structure/topology file. If the tool only takes a structure file,",
+ "or if only that input parameter is provided, then also the coordinates",
+ "are taken from that file.",
+ "For example, to select atoms from a [TT].pdb[tt]/[TT].gro[tt] file in",
+ "a tool that provides both options, pass it as [TT]-s[tt] (only).",
+ "There is no warning if the trajectory file specifies, e.g., different",
+ "atom names than the structure file. Only the number of atoms is checked.",
+ "Many selection-enabled tools also provide an [TT]-fgroup[tt] option",
+ "to specify the atom indices that are present in the trajectory for cases",
+ "where the trajectory only has a subset of atoms from the",
+ "topology/structure file."
};
struct EvaluationHelpText
"keywords."
};
+//! Help title for residue index selection keywords.
+static const char helptitle_resindex[] = "Selecting atoms by residue number";
+//! Help text for residue index selection keywords.
+static const char *const help_resindex[] = {
+ "::",
+ "",
+ " resnr",
+ " resid",
+ " resindex",
+ " residue",
+ "",
+ "[TT]resnr[tt] selects atoms using the residue numbering in the input",
+ "file. [TT]resid[tt] is synonym for this keyword for VMD compatibility.",
+ "",
+ "[TT]resindex N[tt] selects the [TT]N[tt]th residue starting from the",
+ "beginning of the input file. This is useful for uniquely identifying",
+ "residues if there are duplicate numbers in the input file (e.g., in",
+ "multiple chains).",
+ "[TT]residue[tt] is a synonym for [TT]resindex[tt]. This allows",
+ "[TT]same residue as[tt] to work as expected."
+};
+
/** Selection method data for \p all selection keyword. */
gmx_ana_selmethod_t sm_all = {
"all", GROUP_VALUE, 0,
NULL,
&evaluate_resnr,
NULL,
+ {NULL, helptitle_resindex, asize(help_resindex), help_resindex}
};
/** Selection method data for \p resindex selection keyword. */
NULL,
&evaluate_resindex,
NULL,
+ {NULL, helptitle_resindex, asize(help_resindex), help_resindex}
};
/** Selection method data for \p molindex selection keyword. */
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <ParsedSelections Name="Parsed">
+ <ParsedVariable Name="Variable1">
+ <String Name="Input">foo = cog of resnr 1</String>
+ </ParsedVariable>
+ <ParsedSelection Name="Selection1">
+ <String Name="Input">cog of resnr 2 plus foo</String>
+ <String Name="Text">cog of resnr 2 plus foo</String>
+ <Bool Name="Dynamic">false</Bool>
+ </ParsedSelection>
+ <ParsedSelection Name="Selection2">
+ <String Name="Input">cog of resnr 3 plus foo</String>
+ <String Name="Text">cog of resnr 3 plus foo</String>
+ <Bool Name="Dynamic">false</Bool>
+ </ParsedSelection>
+ </ParsedSelections>
+ <CompiledSelections Name="Compiled">
+ <Selection Name="Selection1">
+ <Sequence Name="Atoms">
+ <Int Name="Length">6</Int>
+ <Int>3</Int>
+ <Int>4</Int>
+ <Int>5</Int>
+ <Int>0</Int>
+ <Int>1</Int>
+ <Int>2</Int>
+ </Sequence>
+ </Selection>
+ <Selection Name="Selection2">
+ <Sequence Name="Atoms">
+ <Int Name="Length">6</Int>
+ <Int>6</Int>
+ <Int>7</Int>
+ <Int>8</Int>
+ <Int>0</Int>
+ <Int>1</Int>
+ <Int>2</Int>
+ </Sequence>
+ </Selection>
+ </CompiledSelections>
+ <EvaluatedSelections Name="Frame1">
+ <Selection Name="Selection1">
+ <Sequence Name="Atoms">
+ <Int Name="Length">6</Int>
+ <Int>3</Int>
+ <Int>4</Int>
+ <Int>5</Int>
+ <Int>0</Int>
+ <Int>1</Int>
+ <Int>2</Int>
+ </Sequence>
+ <Sequence Name="Positions">
+ <Int Name="Length">2</Int>
+ <Position>
+ <Vector Name="Coordinates">
+ <Real Name="X">1.6666666666666665</Real>
+ <Real Name="Y">2.333333333333333</Real>
+ <Real Name="Z">0</Real>
+ </Vector>
+ </Position>
+ <Position>
+ <Vector Name="Coordinates">
+ <Real Name="X">1</Real>
+ <Real Name="Y">2</Real>
+ <Real Name="Z">0</Real>
+ </Vector>
+ </Position>
+ </Sequence>
+ </Selection>
+ <Selection Name="Selection2">
+ <Sequence Name="Atoms">
+ <Int Name="Length">6</Int>
+ <Int>6</Int>
+ <Int>7</Int>
+ <Int>8</Int>
+ <Int>0</Int>
+ <Int>1</Int>
+ <Int>2</Int>
+ </Sequence>
+ <Sequence Name="Positions">
+ <Int Name="Length">2</Int>
+ <Position>
+ <Vector Name="Coordinates">
+ <Real Name="X">2.333333333333333</Real>
+ <Real Name="Y">2.6666666666666665</Real>
+ <Real Name="Z">0</Real>
+ </Vector>
+ </Position>
+ <Position>
+ <Vector Name="Coordinates">
+ <Real Name="X">1</Real>
+ <Real Name="Y">2</Real>
+ <Real Name="Z">0</Real>
+ </Vector>
+ </Position>
+ </Sequence>
+ </Selection>
+ </EvaluatedSelections>
+</ReferenceData>
}
+TEST_F(SelectionCollectionDataTest, HandlesPositionVariableInModifier)
+{
+ static const char * const selections[] = {
+ "foo = cog of resnr 1",
+ "cog of resnr 2 plus foo",
+ "cog of resnr 3 plus foo"
+ };
+ setFlags(TestFlags() | efTestEvaluation | efTestPositionCoordinates);
+ runTest("simple.gro", selections);
+}
+
+
TEST_F(SelectionCollectionDataTest, HandlesConstantPositionInVariable)
{
static const char * const selections[] = {
gmx_int64_t nframe = 0;
gmx_int64_t i, *block_ids = NULL, step, ndatablocks;
gmx_bool bOK;
+ real *values = NULL;
gmx_tng_open(fn, 'r', &tng);
gmx_print_tng_molecule_system(tng, stdout);
for (i = 0; i < ndatablocks; i++)
{
double frame_time;
- real prec, *values = NULL;
+ real prec;
gmx_int64_t n_values_per_frame, n_atoms;
char block_name[STRLEN];
{
sfree(block_ids);
}
-
+ sfree(values);
gmx_tng_close(&tng);
#endif
}
if (xy_fac < min_xy_init)
{
warn++;
- fprintf(stderr, "\nWarning %d:\nThe initial size of %s is probably too smal.\n\n", warn, ins);
+ fprintf(stderr, "\nWarning %d:\nThe initial size of %s is probably too small.\n\n", warn, ins);
}
if (it_xy < min_it_xy)