diff --git a/doc/CpptrajManual.pdf b/doc/CpptrajManual.pdf index f10dd3fac5..216addd8cb 100644 Binary files a/doc/CpptrajManual.pdf and b/doc/CpptrajManual.pdf differ diff --git a/doc/DocumentChecksums.txt b/doc/DocumentChecksums.txt index 5d21a6dc7e..9ce1b88448 100644 --- a/doc/DocumentChecksums.txt +++ b/doc/DocumentChecksums.txt @@ -1,3 +1,3 @@ b37726e7a841f6fc695ecd7fb040ffbf CpptrajDevelopmentGuide.lyx -5af47ac2cb73a9c7cd83fc82c1d2f421 cpptraj.lyx +70869c8569e7bd44d1669bc9ba6d68d8 cpptraj.lyx 5d9b5b5ed47a3ded57b6464df99b3585 CpptrajManual.lyx diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index d1a7927b82..a7e99c3f9d 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -23524,15 +23524,15 @@ atomicfluct \end_inset - [] [out ] [] [byres [pdbres] | byatom | bymask] + [] [out ] [] [bfactor] [calcadp [adpout ]] \end_layout \begin_layout LyX-Code - [bfactor] [calcadp [adpout ]] + [{byres [pdbres] [resrange ] | byatom | bymask}] \end_layout \begin_layout LyX-Code - [start ] [stop ] [offset ] + [start ] [stop ] [offset ] \begin_inset Separator latexpar \end_inset @@ -23556,23 +23556,6 @@ out [] Calculate fluctuations for atoms in (all if not specified). \end_layout -\begin_layout Description -byres [pdbres] Output the average (mass-weighted) fluctuation by residue. - If 'pdbres' is specified, the original residue numbering will be used. -\end_layout - -\begin_layout Description -bymask Output the average (mass-weighted) fluctuation for all atoms in . -\end_layout - -\begin_layout Description -byatom -\begin_inset space ~ -\end_inset - -(default) Output the fluctuation by atom. -\end_layout - \begin_layout Description [bfactor] Calculate atomic positional fluctuations squared and weight by @@ -23596,6 +23579,39 @@ graphic B-factors. them to . \end_layout +\begin_layout Description +byres [pdbres] Output the average (mass-weighted) fluctuation by residue. +\end_layout + +\begin_deeper +\begin_layout Description +pdbres If specified, the original residue numbering will be used. +\end_layout + +\begin_layout Description +resrange +\begin_inset space ~ +\end_inset + + Calculate fluctuations for residues in the given range argument. + The residues selected by must be a subset of residues specified + with . + Unselected residues will get a fluctuation of 0.0. +\end_layout + +\end_deeper +\begin_layout Description +bymask Output the average (mass-weighted) fluctuation for all atoms in . +\end_layout + +\begin_layout Description +byatom +\begin_inset space ~ +\end_inset + +(default) Output the fluctuation by atom. +\end_layout + \begin_layout Description [] Frame to begin calculation at (default 1). \end_layout diff --git a/src/Action_AtomicFluct.cpp b/src/Action_AtomicFluct.cpp index f15ffd7eb9..08f6e9b110 100644 --- a/src/Action_AtomicFluct.cpp +++ b/src/Action_AtomicFluct.cpp @@ -19,8 +19,8 @@ Action_AtomicFluct::Action_AtomicFluct() : {} void Action_AtomicFluct::Help() const { - mprintf("\t[] [out ] [] [byres [pdbres] | byatom | bymask]\n" - "\t[bfactor] [calcadp [adpout ]]\n" + mprintf("\t[] [out ] [] [bfactor] [calcadp [adpout ]]\n" + "\t[{byres [pdbres] [resrange ] | byatom | bymask}]\n" "\t%s\n" " Calculate atomic fluctuations of atoms in \n", ActionFrameCounter::HelpText); } @@ -41,6 +41,13 @@ Action::RetType Action_AtomicFluct::Init(ArgList& actionArgs, ActionInit& init, if (actionArgs.hasKey("byres")) { outtype_ = BYRES; usePdbRes_ = actionArgs.hasKey("pdbres"); + std::string resrangearg = actionArgs.GetStringKey("resrange"); + if (!resrangearg.empty()) { + if (resRange_.SetRange( resrangearg )) { + mprinterr("Error: Could not set resrange arg %s\n", resrangearg.c_str()); + return Action::ERR; + } + } } else if (actionArgs.hasKey("bymask")) outtype_ = BYMASK; else if (actionArgs.hasKey("byatom") || actionArgs.hasKey("byatm")) @@ -95,6 +102,10 @@ Action::RetType Action_AtomicFluct::Init(ArgList& actionArgs, ActionInit& init, case BYMASK: mprintf(" over entire atom mask.\n"); break; } if (usePdbRes_) mprintf("\tUsing PDB residue numbers if present in topology.\n"); + if (!resRange_.Empty()) { + if (outtype_ == BYRES) + mprintf("\tResidue range arg: %s\n", resRange_.RangeArg()); + } if (outfile != 0) mprintf("\tOutput to file %s\n", outfile->DataFilename().full()); mprintf("\tAtom mask: [%s]\n",Mask_.MaskString()); @@ -141,6 +152,20 @@ Action::RetType Action_AtomicFluct::Setup(ActionSetup& setup) { mprintf("Warning: Topology is changing. Will base output only using topology '%s'.\n", fluctParm_->c_str()); } + // If a residue range is set, ensure every selected residue is a member of the range + if (!resRange_.Empty()) { + if (outtype_ == BYRES) { + std::vector selectedRes = setup.Top().ResnumsSelectedBy( Mask_ ); + for (std::vector::const_iterator ires = selectedRes.begin(); + ires != selectedRes.end(); ires++) + { + if (!resRange_.InRange( *ires + 1 )) { + mprinterr("Error: Selected residue %i is not in specified resrange %s\n", *ires+1, resRange_.RangeArg()); + return Action::ERR; + } + } + } + } return Action::OK; } @@ -187,8 +212,8 @@ int Action_AtomicFluct::SyncAction() { // Action_AtomicFluct::Print() void Action_AtomicFluct::Print() { + if (sets_ < 1) return; mprintf(" ATOMICFLUCT: Calculating fluctuations for %i sets.\n",sets_); - double Nsets = (double)sets_; // SumCoords will hold the average: SumCoords_.Divide(Nsets); @@ -254,33 +279,74 @@ void Action_AtomicFluct::Print() { for (int idx = 0; idx < (int)Results.size(); idx++) dset.AddXY( Mask_[idx]+1, Results[idx] ); } else if (outtype_ == BYRES) { - // By residue output dset.ModifyDim(Dimension::X).SetLabel("Res"); - int lastidx = (int)Results.size() - 1; - double fluct = 0.0; - double xi = 0.0; - for (int idx = 0; idx < (int)Results.size(); idx++) { - int atom = Mask_[idx]; - double mass = (*fluctParm_)[atom].Mass(); - fluct += Results[idx] * mass; - xi += mass; - int currentres = (*fluctParm_)[atom].ResNum(); - int nextres; - if (idx != lastidx) { - int nextatom = Mask_[idx+1]; - nextres = (*fluctParm_)[nextatom].ResNum(); - } else - nextres = -1; - if (nextres != currentres) { + if (resRange_.Empty()) { + // Original By residue output + int lastidx = (int)Results.size() - 1; + double fluct = 0.0; + double xi = 0.0; + for (int idx = 0; idx < (int)Results.size(); idx++) { + int atom = Mask_[idx]; + double mass = (*fluctParm_)[atom].Mass(); + fluct += Results[idx] * mass; + xi += mass; + int currentres = (*fluctParm_)[atom].ResNum(); + int nextres; + if (idx != lastidx) { + int nextatom = Mask_[idx+1]; + nextres = (*fluctParm_)[nextatom].ResNum(); + } else + nextres = -1; + if (nextres != currentres) { + int resnum; + if (usePdbRes_) + resnum = fluctParm_->Res(currentres).OriginalResNum(); + else + resnum = currentres + 1; + dset.AddXY( resnum, fluct / xi ); + xi = 0.0; + fluct = 0.0; + } + } + } else { + // Range was specified + std::vector atomToMaskIdx( fluctParm_->Natom(), -1); + for (AtomMask::const_iterator it = Mask_.begin(); it != Mask_.end(); ++it) + atomToMaskIdx[*it] = it - Mask_.begin(); + std::vector selectedRes = fluctParm_->ResnumsSelectedBy( Mask_ ); + std::vector::const_iterator ires = selectedRes.begin(); + for (Range::const_iterator it = resRange_.begin(); it != resRange_.end(); ++it) + { + int tgtres = *it - 1; int resnum; if (usePdbRes_) - resnum = fluctParm_->Res(currentres).OriginalResNum(); + resnum = fluctParm_->Res(tgtres).OriginalResNum(); else - resnum = currentres + 1; - dset.AddXY( resnum, fluct / xi ); - xi = 0.0; - fluct = 0.0; - } + resnum = *it; + if (ires == selectedRes.end() || tgtres < *ires) { + // Specified res not selected + dset.AddXY( resnum, 0.0 ); + } else if (tgtres == *ires) { + // Specified res selected + double fluct = 0.0; + double xi = 0.0; + for (int at = fluctParm_->Res(*ires).FirstAtom(); at != fluctParm_->Res(*ires).LastAtom(); ++at) + { + int idx = atomToMaskIdx[at]; + if (idx != -1) { + double mass = (*fluctParm_)[at].Mass(); + fluct += Results[idx] * mass; + xi += mass; + } + } + dset.AddXY( resnum, fluct / xi ); + ++ires; + } else { + // Sanity check + mprinterr("Internal Error: Action_AtomicFluct::Print(): resrange print failed; tgtres = %i, ires = %i\n", *it, *ires+1); + return; + } + } // END loop over resnums in range } } else if (outtype_ == BYMASK) { // By mask output diff --git a/src/Action_AtomicFluct.h b/src/Action_AtomicFluct.h index 8541739988..74e418c9da 100644 --- a/src/Action_AtomicFluct.h +++ b/src/Action_AtomicFluct.h @@ -33,5 +33,6 @@ class Action_AtomicFluct : public Action, ActionFrameCounter { outputType outtype_; DataSet* dataout_; DataSet* adpset_; ///< DataSet for holding anisotropic temp. factors + Range resRange_; }; #endif diff --git a/src/DataIO.cpp b/src/DataIO.cpp index 91eda95dd8..c4bef3771e 100644 --- a/src/DataIO.cpp +++ b/src/DataIO.cpp @@ -1,6 +1,9 @@ #include "DataIO.h" +#include "Constants.h" #include "CpptrajStdio.h" +#include "DataSet_1D.h" #include "DataSet_MatrixDbl.h" +#include // std::min // CONSTRUCTOR DataIO::DataIO() : @@ -37,6 +40,8 @@ bool DataIO::CheckValidFor( DataSet const& dataIn ) const { return false; } +/** \return 1 if any set in the given array does not have the given number of dimensions, 0 otherwise. + */ int DataIO::CheckAllDims(DataSetList const& array, unsigned int tgtDim) { for (DataSetList::const_iterator set = array.begin(); set != array.end(); ++set) { @@ -48,24 +53,137 @@ int DataIO::CheckAllDims(DataSetList const& array, unsigned int tgtDim) { } return 0; } +/* +/// \return true if floating point values are equivalent. Used to check X values. +static inline bool FEQ(double v1, double v2) { + double delta = v1 - v2; + if (delta < 0.0) delta = -delta; + return (delta < Constants::SMALL); +} -int DataIO::CheckXDimension(DataSetList const& array) { - if (array.empty()) return 0; // FIXME return error? - int err = 0; - Dimension const& Xdim = static_cast(array[0]->Dim(0)); - for (DataSetList::const_iterator set = array.begin(); set != array.end(); ++set) - { - if ((*set)->Dim(0) != Xdim) { - mprinterr("Error: X Dimension of %s != %s\n", (*set)->legend(), - array[0]->legend()); - mprinterr("Error: %s: Min=%f Step=%f\n", (*set)->legend(), - (*set)->Dim(0).Min(), (*set)->Dim(0).Step()); - mprinterr("Error: %s: Min=%f Step=%f\n", array[0]->legend(), - Xdim.Min(), Xdim.Step()); - ++err; +/// \return true if floating point values are not equivalent. Used to check X values. +static inline bool FNE(double v1, double v2) { + double delta = v1 - v2; + if (delta < 0.0) delta = -delta; + return (delta > Constants::SMALL); +}*/ + +/// \return X coordinate of given set. +static inline double xCoordVal(DataSet const& set, unsigned int idx) { + if (set.Group() == DataSet::SCALAR_1D) { + DataSet_1D const& s1 = static_cast( set ); + return s1.Xcrd(idx); + } else + return set.Dim(0).Coord(idx); +} + +/** Check if X dimension of 2 given sets matches. */ +bool DataIO::xDimMatch(DataSet const& ref, DataSet const& set) { + if (ref.Ndim() < 1 || set.Ndim() < 1) return false; + // First check if the reference set is the index set for incoming set. + if ( set.DimIndexSet(0) != 0 && set.DimIndexSet(0) == (DataSet const*)(&ref) ) { + //mprintf("DEBUG: %s is the X index set for %s\n", ref.legend(), set.legend()); + return true; + } else if (ref.Type() == DataSet::XYMESH || set.Type() == DataSet::XYMESH) { + // Either one of both sets is a mesh. Need to explicitly check X values. + if (ref.Size() == 0 && set.Size() == 0) + // No values in either; automatic match + return true; + // Start from the end since that is most likely to not match + unsigned int endval = std::min(set.Size(), ref.Size()); + if (endval == 0) + // One of the sets is empty; automatic non-match TODO should just match? + return false; + //for (int idx = endval - 1; idx >= 0; idx--) + for (unsigned int idx = 0; idx < endval; idx++) + { + double refXval = xCoordVal(ref, idx); + double setXval = xCoordVal(set, idx); + if (FNE( refXval, setXval )) { + mprintf("Warning: X coordinate of %s (%f) != %s (%f) at index %u\n", + set.legend(), setXval, ref.legend(), refXval, idx); + return false; + } + } + } else if (set.Dim(0) != ref.Dim(0)) { + mprintf("Warning: X Dimension of %s (Min=%f Step=%f) != %s (Min=%f Step=%f)\n", + set.legend(), set.Dim(0).Min(), set.Dim(0).Step(), + ref.legend(), ref.Dim(0).Min(), ref.Dim(0).Step()); + return false; + } + return true; +} + +/** Ensure that the X dimension of each set in the array matches. + * \return An array of DataSetLists where the sets in each + * DataSetList all have matching X dimensions. + */ +DataIO::DSLarray DataIO::CheckXDimension(DataSetList const& array) { + DSLarray OUT; + if (array.empty()) return OUT; // FIXME return error? + //Xmatch.clear(); + //Xmatch.resize( array.size(), -1 ); + std::vector Xmatch(array.size(), -1); + + // Loop over all sets + unsigned int NsetsChecked = 0; +// int err = 0; +// Dimension const& Xdim = static_cast(array[0]->Dim(0)); + while (NsetsChecked < array.size()) { + // Find the first unmatched set + unsigned int currentIndex = 0; + while (currentIndex < array.size() && Xmatch[currentIndex] != -1) ++currentIndex; + if (currentIndex >= array.size()) break; + DataSet const& currentRef = *(array[currentIndex]); +// mprintf("DEBUG: Current ref: %s\n", currentRef.legend()); + Xmatch[currentIndex] = currentIndex; + OUT.push_back( DataSetList() ); + OUT.back().AddCopyOfSet( array[currentIndex] ); + // Loop over remaining sets +// mprintf("DEBUG: Starting at set %u\n", currentIndex+1); + for (unsigned int setIdx = currentIndex+1; setIdx < array.size(); setIdx++) + { + DataSet const& currentSet = *array[setIdx]; + if (Xmatch[setIdx] == -1) { +// mprintf("DEBUG:\t\tChecking %s", currentSet.legend()); + // Check if currentSet Xdim matches the current reference + if (xDimMatch( currentRef, currentSet )) { +// mprintf(" MATCH!"); + Xmatch[setIdx] = (int)currentIndex; + OUT.back().AddCopyOfSet( array[setIdx] ); + NsetsChecked++; + } +// mprintf("\n"); + } + } + } + // DEBUG +/* mprintf("DEBUG: Xdim match indices:\n"); + for (unsigned int idx = 0; idx != array.size(); idx++) + mprintf("DEBUG:\t%20s %i\n", array[idx]->legend(), Xmatch[idx]); + mprintf("DEBUG: Sets grouped by Xdim:\n"); + for (DSLarray::const_iterator it = OUT.begin(); it != OUT.end(); ++it) { + mprintf("\t"); + for (DataSetList::const_iterator jt = it->begin(); jt != it->end(); ++jt) + mprintf(" %s", (*jt)->legend()); + mprintf("\n"); + }*/ + if (OUT.size() > 1) { + mprintf("Warning: Not all sets had matching X dimensions. They will be grouped in the file like so:\n"); + for (DSLarray::const_iterator it = OUT.begin(); it != OUT.end(); ++it) { + mprintf("\t"); + for (DataSetList::const_iterator jt = it->begin(); jt != it->end(); ++jt) + mprintf(" %s", (*jt)->legend()); + mprintf("\n"); } } - return err; +// DataSetList::const_iterator set = array.begin(); +// for (DataSetList::const_iterator set = array.begin(); set != array.end(); ++set) +// { +// Dimension const& currentRefXdim = static_cast( array[currentMatchIndex]->Dim(0) ); +// } +// return err; + return OUT; } size_t DataIO::DetermineMax(DataSetList const& array) { diff --git a/src/DataIO.h b/src/DataIO.h index ada7236eb3..3f36d18b7b 100644 --- a/src/DataIO.h +++ b/src/DataIO.h @@ -36,8 +36,12 @@ class DataIO : public BaseIOtype { void SetValid(DataSet::DataType t) { valid_.push_back( t ); } /// Check that all sets in given list have given dimension. static int CheckAllDims(DataSetList const&, unsigned int); + /// \return True if the X coordinates for both sets match exactly + static bool xDimMatch(DataSet const&, DataSet const&); + /// Typedef for an array of DataSetLists + typedef std::vector DSLarray; /// Check that X dim for all sets in given list match; all must be 1D. - static int CheckXDimension(DataSetList const&); + static DSLarray CheckXDimension(DataSetList const&); /// \return max size of DataSets in given list. static size_t DetermineMax(DataSetList const&); /// Convert flattened matrix array to matrix in DataSetList. diff --git a/src/DataIO_Gnuplot.cpp b/src/DataIO_Gnuplot.cpp index c19ff199dc..c72beb5019 100644 --- a/src/DataIO_Gnuplot.cpp +++ b/src/DataIO_Gnuplot.cpp @@ -451,7 +451,20 @@ int DataIO_Gnuplot::WriteSets1D(DataSetList const& Sets) { // FIXME: Check that dimension of each set matches. if (Sets.empty()) return 1; - CheckXDimension( Sets ); + DataIO::DSLarray SetLists = CheckXDimension( Sets ); + if (Sets.size() > 1) { + mprintf("Warning: Multiple X dimensions detected for sets being written to file '%s'\n", + file_.Filename().full()); + mprintf("Warning: Sets with matching X dimensions will be written to separate plots.\n"); + } + int err = 0; + for (DataIO::DSLarray::const_iterator dslit = SetLists.begin(); dslit != SetLists.end(); ++dslit) + err += writeSets1D_MatchingXdim(*dslit); + return err; +} + +/** Write data sets to file; the X dimension of all sets should be the same */ +int DataIO_Gnuplot::writeSets1D_MatchingXdim(DataSetList const& Sets) { // Determine size of largest DataSet. size_t maxFrames = DetermineMax( Sets ); // Use X dimension of set 0 for all set dimensions. diff --git a/src/DataIO_Gnuplot.h b/src/DataIO_Gnuplot.h index dc966b7152..50ad6f1c7f 100644 --- a/src/DataIO_Gnuplot.h +++ b/src/DataIO_Gnuplot.h @@ -48,5 +48,6 @@ class DataIO_Gnuplot : public DataIO { void JpegOut(size_t,size_t); void WriteDefinedPalette(int); int WriteSets1D(DataSetList const&); + int writeSets1D_MatchingXdim(DataSetList const&); }; #endif diff --git a/src/DataIO_Std.cpp b/src/DataIO_Std.cpp index 8f9fe8695d..8f1054eda5 100644 --- a/src/DataIO_Std.cpp +++ b/src/DataIO_Std.cpp @@ -1291,7 +1291,19 @@ int DataIO_Std::WriteDataNormal(CpptrajFile& file, DataSetList const& Sets) { // For this output to work the X-dimension of all sets needs to match. // The most important things for output are min and step so just check that. // Use X dimension of set 0 for all set dimensions. - CheckXDimension( Sets ); + DataIO::DSLarray SetLists = CheckXDimension( Sets ); + int err = 0; + for (DataIO::DSLarray::const_iterator dslit = SetLists.begin(); dslit != SetLists.end(); ++dslit) + { + if (dslit != SetLists.begin()) + file.Printf("\n"); + err += writeDataNormal_MatchingXdim(file, *dslit); + } + return err; +} + +/** Write data sets in given data set list to file; all X dimensions should be matching. */ +int DataIO_Std::writeDataNormal_MatchingXdim(CpptrajFile& file, DataSetList const& Sets) { // TODO: Check for empty dim. DataSet* Xdata = Sets[0]; Dimension const& Xdim = static_cast( Xdata->Dim(0) ); diff --git a/src/DataIO_Std.h b/src/DataIO_Std.h index bfb6f5d5d9..c02469441b 100644 --- a/src/DataIO_Std.h +++ b/src/DataIO_Std.h @@ -34,6 +34,7 @@ class DataIO_Std : public DataIO { int WriteStringVars(CpptrajFile&, DataSetList const&) const; int WriteCmatrix(CpptrajFile&, DataSetList const&); int WriteDataNormal(CpptrajFile&,DataSetList const&); + int writeDataNormal_MatchingXdim(CpptrajFile&, DataSetList const&); int WriteDataInverted(CpptrajFile&,DataSetList const&); int WriteData2D(CpptrajFile&, DataSetList const&); int WriteData3D(CpptrajFile&, DataSetList const&); diff --git a/src/DataSet.cpp b/src/DataSet.cpp index b9e0d5b797..90e294a8c3 100644 --- a/src/DataSet.cpp +++ b/src/DataSet.cpp @@ -59,6 +59,7 @@ DataSet::DataSet() : dType_(UNKNOWN_DATA), dGroup_(GENERIC) DataSet::DataSet(DataType typeIn, DataGroup groupIn, TextFormat const& fmtIn, int dimIn) : format_(fmtIn), dim_(dimIn, Dimension(1.0, 1.0)), // default min=1.0, step=1.0 + indexSet_(dimIn, 0), dType_(typeIn), dGroup_(groupIn) # ifdef MPI @@ -70,6 +71,7 @@ DataSet::DataSet(DataType typeIn, DataGroup groupIn, TextFormat const& fmtIn, in DataSet::DataSet(const DataSet& rhs) : format_(rhs.format_), dim_(rhs.dim_), + indexSet_(rhs.indexSet_), dType_(rhs.dType_), dGroup_(rhs.dGroup_), meta_(rhs.meta_) @@ -97,6 +99,7 @@ DataSet& DataSet::operator=(const DataSet& rhs) { if (this != &rhs) { format_ = rhs.format_; dim_ = rhs.dim_; + indexSet_ = rhs.indexSet_; dType_ = rhs.dType_; dGroup_ = rhs.dGroup_; meta_ = rhs.meta_; diff --git a/src/DataSet.h b/src/DataSet.h index f619652f4d..2a29a41ed3 100644 --- a/src/DataSet.h +++ b/src/DataSet.h @@ -96,6 +96,9 @@ class DataSet { TextFormat& SetupFormat() { return format_; } /// Set specified DataSet dimension. void SetDim(Dimension::DimIdxType i, Dimension const& d) { dim_[(int)i] = d; } + /// Set dimension and index data set + void SetDim(Dimension::DimIdxType i, Dimension const& d, DataSet const* iset) { dim_[(int)i] = d; indexSet_[(int)i] = iset; } + /// Set specified dimension # void SetDim(int i, Dimension const& d) { dim_[i] = d; } # ifdef MPI void SetNeedsSync(bool b) { needsSync_ = b; } @@ -125,6 +128,8 @@ class DataSet { /// \return specified DataSet dimension. // TODO consolidate Dimension& ModifyDim(Dimension::DimIdxType i) { return dim_[(int)i]; } Dimension const& Dim(int i) const { return dim_[i]; } + /// \return specified dimension index set + DataSet const* DimIndexSet(int i) const { return indexSet_[i]; } /// Comparison for sorting, name/aspect/idx inline bool operator<(const DataSet& rhs) const { return meta_ < rhs.meta_; } @@ -156,6 +161,7 @@ class DataSet { // depending on the set type. For example, dim_ doesnt really work // for non-orthogonal grids. DimArray dim_; ///< Holds info for each dimension in the DataSet. + std::vector indexSet_; ///< Optional index set for each dimension AdataArray associatedData_; ///< Holds any additonal data associated with this DataSet DataType dType_; ///< The DataSet type DataGroup dGroup_; ///< The DataSet group diff --git a/src/Exec_ParseTiming.cpp b/src/Exec_ParseTiming.cpp index 6e94685176..3c3950e36c 100644 --- a/src/Exec_ParseTiming.cpp +++ b/src/Exec_ParseTiming.cpp @@ -285,7 +285,7 @@ const } if (outfile != 0) outfile->AddDataSet( nameSet ); nameSet->Allocate( DataSet::SizeArray(1, Runs.size()) ); - nameSet->SetDim(Dimension::X, Xdim); + nameSet->SetDim(Dimension::X, Xdim, ds); DataSet* dirNameSet = DSL.AddSet(DataSet::STRING, MetaData(dsname, "dir")); if (dirNameSet == 0) { @@ -294,7 +294,7 @@ const } if (outfile != 0) outfile->AddDataSet( dirNameSet ); dirNameSet->Allocate( DataSet::SizeArray(1, Runs.size()) ); - dirNameSet->SetDim(Dimension::X, Xdim); + dirNameSet->SetDim(Dimension::X, Xdim, ds); for (RunArray::const_iterator it = Runs.begin(); it != Runs.end(); ++it) { double X = 0; diff --git a/src/Version.h b/src/Version.h index 02534d7d05..9f326f9264 100644 --- a/src/Version.h +++ b/src/Version.h @@ -12,7 +12,7 @@ * Whenever a number that precedes is incremented, all subsequent * numbers should be reset to 0. */ -#define CPPTRAJ_INTERNAL_VERSION "V6.29.19" +#define CPPTRAJ_INTERNAL_VERSION "V6.30.0" /// PYTRAJ relies on this #define CPPTRAJ_VERSION_STRING CPPTRAJ_INTERNAL_VERSION #endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 59378d10c0..3ad2ce2e06 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -90,7 +90,7 @@ Action_ToroidalDiffusion.o : Action_ToroidalDiffusion.cpp Action.h ActionState.h Action_Translate.o : Action_Translate.cpp Action.h ActionState.h Action_Translate.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Action_Unstrip.o : Action_Unstrip.cpp Action.h ActionState.h Action_Unstrip.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Action_Unwrap.o : Action_Unwrap.cpp Action.h ActionState.h Action_Unwrap.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mat3x3.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h ImageRoutines.h ImageTypes.h Image_List.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h -Action_Vector.o : Action_Vector.cpp Action.h ActionState.h Action_Vector.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h ComplexArray.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.h Dimension.h DispatchObject.h DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.h GridBin.h ImageOption.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h +Action_Vector.o : Action_Vector.cpp Action.h ActionState.h Action_Vector.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharMask.h ComplexArray.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.h Dimension.h DispatchObject.h DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.h GridBin.h ImageOption.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Action_VelocityAutoCorr.o : Action_VelocityAutoCorr.cpp Action.h ActionState.h Action_VelocityAutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h ComplexArray.h Constants.h CoordinateInfo.h Corr.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.h DataSet_double.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h ProgressBar.h PubFFT.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Action_Volmap.o : Action_Volmap.cpp Action.h ActionState.h Action_Volmap.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridDbl.h DataSet_GridFlt.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SplineFxnTable.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Action_Volume.o : Action_Volume.cpp Action.h ActionState.h Action_Volume.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h @@ -211,7 +211,7 @@ CurveFit.o : CurveFit.cpp CurveFit.h DataFile.o : DataFile.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedLine.h Cluster/Cframes.h Cluster/Cmatrix_NC.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.h DataIO_AmberEne.h DataIO_AmberLib.h DataIO_AmberPrep.h DataIO_CCP4.h DataIO_CharmmFastRep.h DataIO_CharmmOutput.h DataIO_CharmmRepLog.h DataIO_CharmmRtfPrm.h DataIO_Cmatrix_Binary.h DataIO_Cmatrix_NC.h DataIO_Cpout.h DataIO_Evecs.h DataIO_Gnuplot.h DataIO_Grace.h DataIO_Mdout.h DataIO_NetCDF.h DataIO_Numpy.h DataIO_OpenDx.h DataIO_Peaks.h DataIO_RemLog.h DataIO_Std.h DataIO_VecTraj.h DataIO_XVG.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TypeNameHolder.h Unit.h Vec3.h DataFileList.o : DataFileList.cpp ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h DataFilter.o : DataFilter.cpp ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataFilter.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_integer.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h -DataIO.o : DataIO.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataSet.h DataSetList.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h +DataIO.o : DataIO.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h DataIO_AmberEne.o : DataIO_AmberEne.cpp ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedLine.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_AmberEne.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h DataIO_AmberLib.o : DataIO_AmberLib.cpp ArgList.h AssociatedData.h AssociatedData_Connect.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedLine.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_AmberLib.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h DataIO_AmberPrep.o : DataIO_AmberPrep.cpp ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h BondSearch.h Box.h BufferedLine.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_AmberPrep.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h StringRoutines.h Structure/InternalCoords.h Structure/StructureEnum.h Structure/Zmatrix.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h diff --git a/test/Test_AtomicFluct/RunTest.sh b/test/Test_AtomicFluct/RunTest.sh index a1efd09830..464902534a 100755 --- a/test/Test_AtomicFluct/RunTest.sh +++ b/test/Test_AtomicFluct/RunTest.sh @@ -4,7 +4,8 @@ CleanFiles atomic.in fluct.*.dat dpdp.fluct.dat dpdp.adp.dat \ fluct.2.pdb occ.2.pdb scale.2.pdb fluct.1.pdb \ - dpdp.adp.pdb myfluct.adp.dat heavy.adp.pdb + dpdp.adp.pdb myfluct.adp.dat heavy.adp.pdb \ + tz2.byres.dat TESTNAME='Atomic fluctuations tests' Requires netcdf @@ -48,7 +49,9 @@ TOP=../tz2.parm7 cat > $INPUT <