From a73519cd3a5e3bb984e4a3f282cef280d76b10d2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 2 Jan 2019 16:04:02 -0500 Subject: [PATCH 001/417] DRR - Cpptraj: Allow findDepend to deal with relative paths --- src/FindDepend.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/FindDepend.cpp b/src/FindDepend.cpp index f2cef3e494..2e9a9c3994 100644 --- a/src/FindDepend.cpp +++ b/src/FindDepend.cpp @@ -51,10 +51,21 @@ bool IgnoreHeader(const char* headername) { void GetDependencies(string const& filename) { char buffer[BUFFERSIZE+1]; char headername[BUFFERSIZE+1]; + // Determine path + string baseName, dirPrefix; + size_t found = filename.find_last_of("/"); + if (found == std::string::npos) { + baseName = filename; + //dirPrefix_.clear(); + } else { + baseName = filename.substr(found+1); + dirPrefix = filename.substr(0, found+1); + } + printf("DEBUG: Dir='%s' Base='%s'\n", dirPrefix.c_str(), baseName.c_str()); // Determine type FileType type; string ext; - size_t found = filename.find_last_of("."); + found = filename.find_last_of("."); if (found != string::npos) ext = filename.substr(found); @@ -106,7 +117,7 @@ void GetDependencies(string const& filename) { size_t pos = strlen(headername); if (headername[pos-1]=='"') headername[pos-1]='\0'; if (!IgnoreHeader(headername)) - depends.insert( string(headername) ); + depends.insert( dirPrefix + string(headername) ); } //else //printf("\tSkipping system header line: %s", buffer); } From 414f7c71679830c2e9f47e29973a8e295a2f11f4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 2 Jan 2019 16:04:53 -0500 Subject: [PATCH 002/417] DRR - Cpptraj: Initial files for cluster revamp. Test putting source files in subdirectories. --- src/Cluster/Centroid.h | 25 ++++++++++++++++++++++ src/Cluster/Centroid_Coord.cpp | 24 +++++++++++++++++++++ src/Cluster/Centroid_Coord.h | 26 +++++++++++++++++++++++ src/Cluster/Makefile | 34 ++++++++++++++++++++++++++++++ src/Cluster/Metric.h | 38 ++++++++++++++++++++++++++++++++++ src/Cluster/clusterdepend | 1 + 6 files changed, 148 insertions(+) create mode 100644 src/Cluster/Centroid.h create mode 100644 src/Cluster/Centroid_Coord.cpp create mode 100644 src/Cluster/Centroid_Coord.h create mode 100644 src/Cluster/Makefile create mode 100644 src/Cluster/Metric.h create mode 100644 src/Cluster/clusterdepend diff --git a/src/Cluster/Centroid.h b/src/Cluster/Centroid.h new file mode 100644 index 0000000000..a5b46207b2 --- /dev/null +++ b/src/Cluster/Centroid.h @@ -0,0 +1,25 @@ +#ifndef INC_CLUSTER_CENTROID_H +#define INC_CLUSTER_CENTROID_H +#include +namespace Cpptraj { +namespace Cluster { + +/// Abstract Base Class for Cluster centroid. +/** This class is a container for the cluster centroid type appropriate for + * the data being clustered. For COORDS DataSets this is a frame, for other + * DataSets this is just a number. Centroid classes must implement a Copy() + * function. + */ +class Centroid { + public: + virtual ~Centroid() {} + virtual Centroid* Copy() = 0; + // TODO: Should centroids remember number of frames that went into them? + // This would make it so FrameOpCentroid wouldnt require extra arg. + virtual void Print(std::string const&) const {} +}; + + +} // END namespace Cluster +} // END namepsace Cpptraj +#endif diff --git a/src/Cluster/Centroid_Coord.cpp b/src/Cluster/Centroid_Coord.cpp new file mode 100644 index 0000000000..eed141add4 --- /dev/null +++ b/src/Cluster/Centroid_Coord.cpp @@ -0,0 +1,24 @@ +#ifndef INC_CENTROID_COORD_H +#define INC_CENTROID_COORD_H +#include "Centroid_Coord.h" +#include "../CpptrajFile.h" + +void Cpptraj::Cluster::Centroid_Coord::Print(std::string const& fnameIn) const { + // Write Amber coordinate format + CpptrajFile cOut; + FileName fname(fnameIn); + if (cOut.OpenWrite(fname)) return; + cOut.Printf("%-80s\n", fname.base()); + int col = 0; + for (int ic = 0; ic != cframe_.size(); ic++) { + cOut.Printf("%8.3f", cframe_[ic]); + ++col; + if (col == 10) { + cOut.Printf("\n"); + col = 0; + } + } + if (col > 0) cOut.Printf("\n"); +} + +#endif diff --git a/src/Cluster/Centroid_Coord.h b/src/Cluster/Centroid_Coord.h new file mode 100644 index 0000000000..2a89e40e49 --- /dev/null +++ b/src/Cluster/Centroid_Coord.h @@ -0,0 +1,26 @@ +#ifndef INC_CLUSTER_CENTROID_COORD_H +#define INC_CLUSTER_CENTROID_COORD_H +#include "../Frame.h" +#include "Centroid.h" +namespace Cpptraj { +namespace Cluster { + +/// Cluster Centroid for Coords DataSet. +class Centroid_Coord : public Centroid { + public: + Centroid_Coord() {} + Centroid_Coord(Frame const& frame) : cframe_(frame) {} + Centroid_Coord(int natom) : cframe_(natom) {} + Centroid* Copy() { return (Centroid*)new Centroid_Coord(cframe_); } + void Print(std::string const&) const; + //friend class ClusterDist_DME; + //friend class ClusterDist_RMS; + //friend class ClusterDist_SRMSD; + private: + Frame cframe_; +}; + + +} +} +#endif diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile new file mode 100644 index 0000000000..7485f9deeb --- /dev/null +++ b/src/Cluster/Makefile @@ -0,0 +1,34 @@ +# Cpptraj Cluster Makefile +include ../../config.h + +# Source files to be compiled +SOURCES= \ + Centroid_Coord.cpp + +# Objects +OBJECTS=$(SOURCES:.cpp=.o) + +# Default target +all: $(OBJECTS) + +# Install all targets +install: all + +# Dependency targets +../findDepend: ../FindDepend.o + $(CXX) -o ../findDepend ../FindDepend.o + +depend: ../findDepend + ../findDepend $(SOURCES) > clusterdepend + +#dependclean: +# /bin/rm -f ../FindDepend.o ../findDepend + +# Clean/uninstall targets +clean: + /bin/rm -f $(OBJECTS) + +uninstall: clean + +# Header dependencies +include clusterdepend diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h new file mode 100644 index 0000000000..9bf7562772 --- /dev/null +++ b/src/Cluster/Metric.h @@ -0,0 +1,38 @@ +#ifndef INC_CLUSTER_METRIC_H +#define INC_CLUSTER_METRIC_H +#include "Centroid.h" +namespace Cpptraj { +namespace Cluster { + +/// Abstract base class for calculating distance between points or determining centroid. +class Metric { + public: + enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; + /// Used to pass in absolute frame numbers for centroid calculations. + typedef std::vector Cframes; + typedef Cframes::const_iterator Cframes_it; + typedef std::vector DsArray; // TODO should this be here? + virtual ~ClusterDist() {} + /// \return distance between given frames. + virtual double FrameDist(int, int) = 0; + /// \return distance between given centroids. + virtual double CentroidDist( Centroid*, Centroid* ) = 0; + /// \return distance between given frame and centroid. + virtual double FrameCentroidDist(int, Centroid* ) = 0; + /// Calculate centroid from given frames. + virtual void CalculateCentroid(Centroid*, Cframes const&) = 0; + /// \return new centroid from given frames. + virtual Centroid* NewCentroid(Cframes const&) = 0; + /// \return copy of this ClusterDist + virtual ClusterDist* Copy() = 0; + /// Update centroid by performing given operation between given frame and centroid. + virtual void FrameOpCentroid(int, Centroid*, double, CentOpType) = 0; + /// \return string containing description of the distance metric + virtual std::string Description() const = 0; + protected: + typedef double (*DistCalc)(double,double); +}; + +} // END namespace Cluster +} // END namepsace Cpptraj +#endif diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend new file mode 100644 index 0000000000..e843d1782f --- /dev/null +++ b/src/Cluster/clusterdepend @@ -0,0 +1 @@ +Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h From 9a59a80e5d7063cb389ec97d4e14583d39744790 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 2 Jan 2019 16:18:45 -0500 Subject: [PATCH 003/417] DRR - Cpptraj: Hide debug info. --- src/FindDepend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FindDepend.cpp b/src/FindDepend.cpp index 2e9a9c3994..13f6e797d1 100644 --- a/src/FindDepend.cpp +++ b/src/FindDepend.cpp @@ -61,7 +61,7 @@ void GetDependencies(string const& filename) { baseName = filename.substr(found+1); dirPrefix = filename.substr(0, found+1); } - printf("DEBUG: Dir='%s' Base='%s'\n", dirPrefix.c_str(), baseName.c_str()); + //printf("DEBUG: Dir='%s' Base='%s'\n", dirPrefix.c_str(), baseName.c_str()); // Determine type FileType type; string ext; From ffc38a8e5611130d4dd65eaeebdf5e6390a142bc Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 2 Jan 2019 16:19:22 -0500 Subject: [PATCH 004/417] DRR - Cpptraj: Add RMS metric. --- src/Cluster/Centroid_Coord.h | 5 +- src/Cluster/Makefile | 3 +- src/Cluster/Metric.h | 8 ++- src/Cluster/Metric_RMS.cpp | 106 +++++++++++++++++++++++++++++++++++ src/Cluster/Metric_RMS.h | 33 +++++++++++ src/Cluster/clusterdepend | 1 + 6 files changed, 149 insertions(+), 7 deletions(-) create mode 100644 src/Cluster/Metric_RMS.cpp create mode 100644 src/Cluster/Metric_RMS.h diff --git a/src/Cluster/Centroid_Coord.h b/src/Cluster/Centroid_Coord.h index 2a89e40e49..c0d9baf74d 100644 --- a/src/Cluster/Centroid_Coord.h +++ b/src/Cluster/Centroid_Coord.h @@ -13,9 +13,8 @@ class Centroid_Coord : public Centroid { Centroid_Coord(int natom) : cframe_(natom) {} Centroid* Copy() { return (Centroid*)new Centroid_Coord(cframe_); } void Print(std::string const&) const; - //friend class ClusterDist_DME; - //friend class ClusterDist_RMS; - //friend class ClusterDist_SRMSD; + Frame const& Cframe() const { return cframe_; } + Frame& Cframe() { return cframe_; } private: Frame cframe_; }; diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile index 7485f9deeb..7dc965ed5b 100644 --- a/src/Cluster/Makefile +++ b/src/Cluster/Makefile @@ -3,7 +3,8 @@ include ../../config.h # Source files to be compiled SOURCES= \ - Centroid_Coord.cpp + Centroid_Coord.cpp \ + Metric_RMS.cpp # Objects OBJECTS=$(SOURCES:.cpp=.o) diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 9bf7562772..c6fb3584ac 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -1,5 +1,7 @@ #ifndef INC_CLUSTER_METRIC_H #define INC_CLUSTER_METRIC_H +#include +#include "../DataSet.h" #include "Centroid.h" namespace Cpptraj { namespace Cluster { @@ -12,7 +14,7 @@ class Metric { typedef std::vector Cframes; typedef Cframes::const_iterator Cframes_it; typedef std::vector DsArray; // TODO should this be here? - virtual ~ClusterDist() {} + virtual ~Metric() {} /// \return distance between given frames. virtual double FrameDist(int, int) = 0; /// \return distance between given centroids. @@ -23,8 +25,8 @@ class Metric { virtual void CalculateCentroid(Centroid*, Cframes const&) = 0; /// \return new centroid from given frames. virtual Centroid* NewCentroid(Cframes const&) = 0; - /// \return copy of this ClusterDist - virtual ClusterDist* Copy() = 0; + /// \return copy of this Metric + virtual Metric* Copy() = 0; /// Update centroid by performing given operation between given frame and centroid. virtual void FrameOpCentroid(int, Centroid*, double, CentOpType) = 0; /// \return string containing description of the distance metric diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp new file mode 100644 index 0000000000..79f3a2fd6b --- /dev/null +++ b/src/Cluster/Metric_RMS.cpp @@ -0,0 +1,106 @@ +#include "Metric_RMS.h" +#include "Centroid_Coord.h" + +Cpptraj::Cluster::Metric_RMS::Metric_RMS(DataSet_Coords* dIn, AtomMask const& maskIn, + bool nofit, bool useMass) : + coords_(dIn), + mask_(maskIn), + nofit_(nofit), + useMass_(useMass) +{ + frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms()); + frm2_ = frm1_; +} + +double Cpptraj::Cluster::Metric_RMS::FrameDist(int f1, int f2) { + coords_->GetFrame( f1, frm1_, mask_ ); + coords_->GetFrame( f2, frm2_, mask_ ); + if (nofit_) + return frm1_.RMSD_NoFit( frm2_, useMass_ ); + else + return frm1_.RMSD( frm2_, useMass_ ); +} + +double Cpptraj::Cluster::Metric_RMS::CentroidDist(Centroid* c1, Centroid* c2) { + if (nofit_) + return ((Centroid_Coord*)c1)->Cframe().RMSD_NoFit( ((Centroid_Coord*)c2)->Cframe(), useMass_ ); + else // Centroid is already at origin. + return ((Centroid_Coord*)c1)->Cframe().RMSD_CenteredRef( ((Centroid_Coord*)c2)->Cframe(), + useMass_ ); +} + +double Cpptraj::Cluster::Metric_RMS::FrameCentroidDist(int f1, Centroid* c1) { + coords_->GetFrame( f1, frm1_, mask_ ); + if (nofit_) + return frm1_.RMSD_NoFit( ((Centroid_Coord*)c1)->Cframe(), useMass_ ); + else // Centroid is already at origin. + return frm1_.RMSD_CenteredRef( ((Centroid_Coord*)c1)->Cframe(), useMass_ ); +} + +/** Compute the centroid (avg) coords for each atom from all frames in this + * cluster. If fitting, RMS fit to centroid as it is being built. + */ +void Cpptraj::Cluster::Metric_RMS::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { + Matrix_3x3 Rot; + Vec3 Trans; + Centroid_Coord* cent = (Centroid_Coord*)centIn; + // Reset atom count for centroid. + cent->Cframe().ClearAtoms(); + for (Cframes_it frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) + { + coords_->GetFrame( *frm, frm1_, mask_ ); + if (cent->Cframe().empty()) { + cent->Cframe() = frm1_; + if (!nofit_) + cent->Cframe().CenterOnOrigin(useMass_); + } else { + if (!nofit_) { + frm1_.RMSD_CenteredRef( cent->Cframe(), Rot, Trans, useMass_ ); + frm1_.Rotate( Rot ); + } + cent->Cframe() += frm1_; + } + } + cent->Cframe().Divide( (double)cframesIn.size() ); + //mprintf("\t\tFirst 3 centroid coords (of %i): %f %f %f\n", cent->Cframe().Natom(), + // cent->cent->Cframe()[0], cent->Cframe()[1],cent->Cframe()[2]); +} + +Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_RMS::NewCentroid( Cframes const& cframesIn ) { + // TODO: Incorporate mass? + Centroid_Coord* cent = new Centroid_Coord( mask_.Nselected() ); + CalculateCentroid( cent, cframesIn ); + return cent; +} + +// Subtract Notes +// FIXME: Handle single frame +// FIXME: Check if frame is in cluster? +void Cpptraj::Cluster::Metric_RMS::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, + CentOpType OP) +{ + Matrix_3x3 Rot; + Vec3 Trans; + Centroid_Coord* cent = (Centroid_Coord*)centIn; + coords_->GetFrame( frame, frm1_, mask_ ); + if (!nofit_) { + frm1_.RMSD_CenteredRef( cent->Cframe(), Rot, Trans, useMass_ ); + frm1_.Rotate( Rot ); + } + cent->Cframe().Multiply( oldSize ); + if (OP == ADDFRAME) { + cent->Cframe() += frm1_; + cent->Cframe().Divide( oldSize + 1 ); + } else { // SUBTRACTFRAME + cent->Cframe() -= frm1_; + cent->Cframe().Divide( oldSize - 1 ); + } +} + +std::string Cpptraj::Cluster::Metric_RMS::Description() const { + std::string description("rms " + mask_.MaskExpression()); + if (nofit_) description.append(" nofit"); + if (useMass_) description.append(" mass"); + return description; +} + diff --git a/src/Cluster/Metric_RMS.h b/src/Cluster/Metric_RMS.h new file mode 100644 index 0000000000..6bfc820e36 --- /dev/null +++ b/src/Cluster/Metric_RMS.h @@ -0,0 +1,33 @@ +#ifndef INC_CLUSTER_METRIC_RMS_H +#define INC_CLUSTER_METRIC_RMS_H +#include "../AtomMask.h" +#include "../DataSet_Coords.h" +#include "Metric.h" +namespace Cpptraj { +namespace Cluster { + +/// RMS cluster distance calc for Coords DataSet +class Metric_RMS : public Metric { + public: + Metric_RMS() : coords_(0), nofit_(false), useMass_(false) {} + Metric_RMS(DataSet_Coords*,AtomMask const&,bool,bool); + double FrameDist(int, int); + double CentroidDist( Centroid*, Centroid* ); + double FrameCentroidDist(int, Centroid*); + void CalculateCentroid(Centroid*, Cframes const&); + void FrameOpCentroid(int, Centroid*, double, CentOpType); + Centroid* NewCentroid(Cframes const&); + Metric* Copy() { return new Metric_RMS( *this ); } + std::string Description() const; + private: + DataSet_Coords* coords_; + AtomMask mask_; + bool nofit_; + bool useMass_; + Frame frm1_; + Frame frm2_; +}; + +} +} +#endif diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index e843d1782f..c69d4628a7 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1 +1,2 @@ Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h +Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h From 6fba401d840b107b0b0f7a43ed0978048ddd791e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 2 Jan 2019 16:23:34 -0500 Subject: [PATCH 005/417] DRR - Cpptraj: Add code docs. --- src/Cluster/Metric_RMS.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index 79f3a2fd6b..d5e6310f40 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -1,6 +1,7 @@ #include "Metric_RMS.h" #include "Centroid_Coord.h" +/// CONSTRUCTOR Cpptraj::Cluster::Metric_RMS::Metric_RMS(DataSet_Coords* dIn, AtomMask const& maskIn, bool nofit, bool useMass) : coords_(dIn), @@ -12,6 +13,7 @@ Cpptraj::Cluster::Metric_RMS::Metric_RMS(DataSet_Coords* dIn, AtomMask const& ma frm2_ = frm1_; } +/** \return RMSD between two given frames. */ double Cpptraj::Cluster::Metric_RMS::FrameDist(int f1, int f2) { coords_->GetFrame( f1, frm1_, mask_ ); coords_->GetFrame( f2, frm2_, mask_ ); @@ -21,6 +23,7 @@ double Cpptraj::Cluster::Metric_RMS::FrameDist(int f1, int f2) { return frm1_.RMSD( frm2_, useMass_ ); } +/** \return RMSD between two given centroids. */ double Cpptraj::Cluster::Metric_RMS::CentroidDist(Centroid* c1, Centroid* c2) { if (nofit_) return ((Centroid_Coord*)c1)->Cframe().RMSD_NoFit( ((Centroid_Coord*)c2)->Cframe(), useMass_ ); @@ -29,6 +32,7 @@ double Cpptraj::Cluster::Metric_RMS::CentroidDist(Centroid* c1, Centroid* c2) { useMass_ ); } +/** \return RMSD between given frame and centroid. */ double Cpptraj::Cluster::Metric_RMS::FrameCentroidDist(int f1, Centroid* c1) { coords_->GetFrame( f1, frm1_, mask_ ); if (nofit_) @@ -66,6 +70,7 @@ void Cpptraj::Cluster::Metric_RMS::CalculateCentroid(Centroid* centIn, Cframes // cent->cent->Cframe()[0], cent->Cframe()[1],cent->Cframe()[2]); } +/** \return Average structure of given frames. */ Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_RMS::NewCentroid( Cframes const& cframesIn ) { // TODO: Incorporate mass? Centroid_Coord* cent = new Centroid_Coord( mask_.Nselected() ); @@ -97,10 +102,10 @@ void Cpptraj::Cluster::Metric_RMS::FrameOpCentroid(int frame, Centroid* centIn, } } +/** \return Description of RMS calc. */ std::string Cpptraj::Cluster::Metric_RMS::Description() const { std::string description("rms " + mask_.MaskExpression()); if (nofit_) description.append(" nofit"); if (useMass_) description.append(" mass"); return description; } - From cf72487141012e256c6927ca93033a49c4a8ae3c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 11:22:52 -0500 Subject: [PATCH 006/417] DRR - Cpptraj: Move Cframes definition to outside the Metric class. --- src/Cluster/Metric.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index c6fb3584ac..e9c6fbb422 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -6,13 +6,15 @@ namespace Cpptraj { namespace Cluster { +/// This will hold cluster frame numbers. +typedef std::vector Cframes; +/// Iterator for Cframes +typedef Cframes::const_iterator Cframes_it; + /// Abstract base class for calculating distance between points or determining centroid. class Metric { public: enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; - /// Used to pass in absolute frame numbers for centroid calculations. - typedef std::vector Cframes; - typedef Cframes::const_iterator Cframes_it; typedef std::vector DsArray; // TODO should this be here? virtual ~Metric() {} /// \return distance between given frames. From 5be903a37b38c267d574a0406168a7c5f022f0cd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 11:23:17 -0500 Subject: [PATCH 007/417] DRR - Cpptraj: Start abstract base class for housing Metric --- src/Cluster/PairwiseMatrix.cpp | 40 ++++++++++++++++++++++++++++++++++ src/Cluster/PairwiseMatrix.h | 34 +++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/Cluster/PairwiseMatrix.cpp create mode 100644 src/Cluster/PairwiseMatrix.h diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp new file mode 100644 index 0000000000..31e4b1d544 --- /dev/null +++ b/src/Cluster/PairwiseMatrix.cpp @@ -0,0 +1,40 @@ +#include "PairwiseMatrix.h" +#ifdef _OPENMP +#include +#endif +#include "../ProgressBar.h" + +int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) +{ + int f2end = (int)framesToCache.size(); + int f1end = f2end - 1; + ParallelProgress progress(f1end); + int f1, f2; + // For OMP, every other thread will need its own Cdist. + Metric* MyMetric = metric_; +# ifdef _OPENMP +# pragma omp parallel private(MyMetric, f1, f2) firstprivate(progress) + { + int mythread = omp_get_thread_num(); + progress.SetThread( mythread ); + if (mythread == 0) { + mprintf("\tParallelizing pairwise distance calc with %i threads\n", omp_get_num_threads()); + MyMetric = metric_; + } else + MyMetric = metric_->Copy(); +# pragma omp for schedule(dynamic) +# endif + for (f1 = 0; f1 < f1end; f1++) { + progress.Update(f1); + for (f2 = f1 + 1; f2 < f2end; f2++) + SetElement( f1, f2, MyMetric->FrameDist(framesToCache[f1], framesToCache[f2]) ); + } +# ifdef _OPENMP + if (mythread > 0) + delete MyCdist; + } // END omp parallel +# endif + progress.Finish(); + return 0; +} + diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h new file mode 100644 index 0000000000..81f30ab0e7 --- /dev/null +++ b/src/Cluster/PairwiseMatrix.h @@ -0,0 +1,34 @@ +#ifndef INC_CLUSTER_PAIRWISE_MATRIX_H +#define INC_CLUSTER_PAIRWISE_MATRIX_H +#include "Metric.h" +namespace Cpptraj { +namespace Cluster { + +/// Interface for calculating/caching pairwise distances according to a given metric. +class PairwiseMatrix { + public: + PairwiseMatrix() : metric_(0) {} + virtual ~PairwiseMatrix() {} + // ------------------------------------------- + /// \return distance between given frames. + virtual double GetFdist(int, int) const = 0; + /// Request that distances for the specified frames be cached. + virtual int CacheDistances(Cframes const&) = 0; + // ------------------------------------------- + /// \return internal metric, const. + Metric const& DistMetric() const { return *metric_; } + /// \return internal metric. + Metric& DistMetric() { return *metric_; } + protected: + /// Used to cache distances; expect internal indices, not absolute cluster frames. + virtual void SetElement(int, int, double) = 0; + // ------------------------------------------- + /// Internal routine used to cache pairwise distances. + int CalcFrameDistances(Cframes const&); + private: + Metric* metric_; ///< The current distance metric. +}; + +} /* END namespace Cluster */ +} /* END namespace Cpptraj */ +#endif From d73a21b7f56eba909e69f79c65f0d3b710f18375 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 11:44:22 -0500 Subject: [PATCH 008/417] DRR - Cpptraj: Initial incarnation of class for caching pairwise distances in memory. --- src/Cluster/Makefile | 4 +++- src/Cluster/PairwiseMatrix.h | 6 +++++- src/Cluster/PairwiseMatrix_MEM.cpp | 13 +++++++++++++ src/Cluster/PairwiseMatrix_MEM.h | 25 +++++++++++++++++++++++++ src/Cluster/clusterdepend | 2 ++ 5 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 src/Cluster/PairwiseMatrix_MEM.cpp create mode 100644 src/Cluster/PairwiseMatrix_MEM.h diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile index 7dc965ed5b..03839c9f44 100644 --- a/src/Cluster/Makefile +++ b/src/Cluster/Makefile @@ -4,7 +4,9 @@ include ../../config.h # Source files to be compiled SOURCES= \ Centroid_Coord.cpp \ - Metric_RMS.cpp + Metric_RMS.cpp \ + PairwiseMatrix.cpp \ + PairwiseMatrix_MEM.cpp # Objects OBJECTS=$(SOURCES:.cpp=.o) diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 81f30ab0e7..9cccafaaf7 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -10,8 +10,10 @@ class PairwiseMatrix { PairwiseMatrix() : metric_(0) {} virtual ~PairwiseMatrix() {} // ------------------------------------------- - /// \return distance between given frames. + /// \return distance between given cached frames. virtual double GetFdist(int, int) const = 0; + /// \return distance between given frames. + virtual double Frame_Distance(int, int) const = 0; /// Request that distances for the specified frames be cached. virtual int CacheDistances(Cframes const&) = 0; // ------------------------------------------- @@ -25,6 +27,8 @@ class PairwiseMatrix { // ------------------------------------------- /// Internal routine used to cache pairwise distances. int CalcFrameDistances(Cframes const&); + /// \return Pointer to distance metric + Metric* distMetric() const { return metric_; } private: Metric* metric_; ///< The current distance metric. }; diff --git a/src/Cluster/PairwiseMatrix_MEM.cpp b/src/Cluster/PairwiseMatrix_MEM.cpp new file mode 100644 index 0000000000..6c82b8db73 --- /dev/null +++ b/src/Cluster/PairwiseMatrix_MEM.cpp @@ -0,0 +1,13 @@ +#include "PairwiseMatrix_MEM.h" + +double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) const { + int idx1 = frameToMat_[f1]; + if (idx1 != -1) { + int idx2 = frameToMat_[f2]; + if (idx2 != -1) { + return Mat_.element(idx1, idx2); + } + } + // If here, distance was not cached. + return distMetric()->FrameDist(f1, f2); +} diff --git a/src/Cluster/PairwiseMatrix_MEM.h b/src/Cluster/PairwiseMatrix_MEM.h new file mode 100644 index 0000000000..39e533b93f --- /dev/null +++ b/src/Cluster/PairwiseMatrix_MEM.h @@ -0,0 +1,25 @@ +#ifndef INC_CLUSTER_PAIRWISE_MATRIX_MEM_H +#define INC_CLUSTER_PAIRWISE_MATRIX_MEM_H +#include "PairwiseMatrix.h" +#include "../Matrix.h" +namespace Cpptraj { +namespace Cluster { + +class PairwiseMatrix_MEM : public PairwiseMatrix { + public: + PairwiseMatrix_MEM() {} + // ------------------------------------------- + double GetFdist(int f1, int f2) const { return Mat_.element(frameToMat_[f1], frameToMat_[f2]); } + double Frame_Distance(int, int) const; + int CacheDistances(Cframes const&); + // ------------------------------------------- + protected: + void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } + private: + Matrix Mat_; ///< Hold cached distances + Cframes frameToMat_; ///< Hold indices into Mat_ for all cached frames, -1 for non-cached. +}; + +} /* END namespace Cluster */ +} /* END namespace Cpptraj */ +#endif diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index c69d4628a7..4c62e84f22 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,2 +1,4 @@ Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h +PairwiseMatrix.o : PairwiseMatrix.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h +PairwiseMatrix_MEM.o : PairwiseMatrix_MEM.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h PairwiseMatrix_MEM.h From 994289e0ca964d3e60c9aa9caed5ae36f5c9493e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 11:54:22 -0500 Subject: [PATCH 009/417] DRR - Cpptraj: Implement CacheDistances for pairwise memory cache. --- src/Cluster/Metric.h | 2 ++ src/Cluster/Metric_RMS.h | 1 + src/Cluster/PairwiseMatrix_MEM.cpp | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index e9c6fbb422..54ec451415 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -33,6 +33,8 @@ class Metric { virtual void FrameOpCentroid(int, Centroid*, double, CentOpType) = 0; /// \return string containing description of the distance metric virtual std::string Description() const = 0; + /// \return total number of frames. + virtual unsigned int Ntotal() const = 0; protected: typedef double (*DistCalc)(double,double); }; diff --git a/src/Cluster/Metric_RMS.h b/src/Cluster/Metric_RMS.h index 6bfc820e36..524d4478a0 100644 --- a/src/Cluster/Metric_RMS.h +++ b/src/Cluster/Metric_RMS.h @@ -19,6 +19,7 @@ class Metric_RMS : public Metric { Centroid* NewCentroid(Cframes const&); Metric* Copy() { return new Metric_RMS( *this ); } std::string Description() const; + unsigned int Ntotal() const { return (unsigned int)coords_->Size(); } private: DataSet_Coords* coords_; AtomMask mask_; diff --git a/src/Cluster/PairwiseMatrix_MEM.cpp b/src/Cluster/PairwiseMatrix_MEM.cpp index 6c82b8db73..59f1fb6bef 100644 --- a/src/Cluster/PairwiseMatrix_MEM.cpp +++ b/src/Cluster/PairwiseMatrix_MEM.cpp @@ -1,5 +1,6 @@ #include "PairwiseMatrix_MEM.h" +/** \return distance between frames (cached or uncached). */ double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) const { int idx1 = frameToMat_[f1]; if (idx1 != -1) { @@ -11,3 +12,13 @@ double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) cons // If here, distance was not cached. return distMetric()->FrameDist(f1, f2); } + +/** Requests that distances between given frames be cached in memory. */ +int Cpptraj::Cluster::PairwiseMatrix_MEM::CacheDistances(Cframes const& framesToCache) { + Mat_.resize(0, framesToCache.size()); + frameToMat_.assign(DistMetric().Ntotal(), -1); + int idx = 0; + for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) + frameToMat_[*it] = idx++; + return CalcFrameDistances( framesToCache ); +} From 94b98537a12b343b383f1d6df243d4e29530f31f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 13:21:57 -0500 Subject: [PATCH 010/417] DRR - Cpptraj: Initial incarnation of the new cluster Node class, pretty much the same as ClusterNode --- src/Cluster/Makefile | 1 + src/Cluster/Node.cpp | 152 ++++++++++++++++++++++++++++++++++++++ src/Cluster/Node.h | 103 ++++++++++++++++++++++++++ src/Cluster/clusterdepend | 1 + 4 files changed, 257 insertions(+) create mode 100644 src/Cluster/Node.cpp create mode 100644 src/Cluster/Node.h diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile index 03839c9f44..0dcafeb263 100644 --- a/src/Cluster/Makefile +++ b/src/Cluster/Makefile @@ -5,6 +5,7 @@ include ../../config.h SOURCES= \ Centroid_Coord.cpp \ Metric_RMS.cpp \ + Node.cpp \ PairwiseMatrix.cpp \ PairwiseMatrix_MEM.cpp diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp new file mode 100644 index 0000000000..cdd0aad167 --- /dev/null +++ b/src/Cluster/Node.cpp @@ -0,0 +1,152 @@ +#include // DBL_MAX +#include // sort +#include "Node.h" + +// CONSTRUCTOR +Cpptraj::Cluster::Node::Node() : + centroid_(0), + eccentricity_(0), + num_(-1), + needsUpdate_(true) +{} + +// DESTRUCTOR +Cpptraj::Cluster::Node::~Node() { + if (centroid_ != 0) delete centroid_; +} + +/** Create new cluster with given number containing given frames. Calculate + * initial centroid and set initial best rep frame to front, even though + * that will probably be wrong when number of frames in the list > 1. + */ +Cpptraj::Cluster::Node::Node(Metric* Cdist, Cframes const& frameListIn, int numIn) : + frameList_(frameListIn), + centroid_(Cdist->NewCentroid(frameList_)), + bestReps_(1, RepPair(frameListIn.front(), 0.0)), + eccentricity_(0.0), + num_(numIn), + needsUpdate_(true) +{} + +// COPY CONSTRUCTOR +Cpptraj::Cluster::Node::Node(const Node& rhs) : + frameList_( rhs.frameList_ ), + centroid_(0), + bestReps_( rhs.bestReps_ ), + eccentricity_( rhs.eccentricity_ ), + num_( rhs.num_ ), + needsUpdate_( rhs.needsUpdate_ ) +{ + if (rhs.centroid_ != 0) + centroid_ = rhs.centroid_->Copy(); +} + +// ASSIGNMENT +Cpptraj::Cluster::Node& Cpptraj::Cluster::Node::operator=(const Node& rhs) { + if (&rhs == this) return *this; + eccentricity_ = rhs.eccentricity_; + num_ = rhs.num_; + bestReps_ = rhs.bestReps_; + frameList_ = rhs.frameList_; + if (centroid_ != 0) delete centroid_; + if (rhs.centroid_ != 0) + centroid_ = rhs.centroid_->Copy(); + else + centroid_ = 0; + needsUpdate_ = rhs.needsUpdate_; + return *this; +} + +/** Find the frame in the given cluster that is the best representative via + * having the lowest cumulative distance to every other point in the cluster. + * Should NOT be used if cluster contains sieved frames. + * \return best representative frame number, or -1 on error. + */ +/* +int Cpptraj::Cluster::Node::SetBestRep_CumulativeDist(DataSet_Cmatrix const& FrameDistancesIn) { + double mindist = DBL_MAX; + int minframe = -1; + for (frame_iterator frm1 = frameList_.begin(); frm1 != frameList_.end(); ++frm1) + { + double cdist = 0.0; + for (frame_iterator frm2 = frameList_.begin(); frm2 != frameList_.end(); ++frm2) + { + if (frm1 != frm2) + cdist += FrameDistancesIn.GetFdist(*frm1, *frm2); + } + if (cdist < mindist) { + mindist = cdist; + minframe = *frm1; + } + } + if (minframe == -1) + return -1; + repFrame_ = minframe; + return minframe; +}*/ + +/** Calculate the eccentricity of this cluster (i.e. the largest distance + * between any two points in the cluster). + */ +void Cpptraj::Cluster::Node::CalcEccentricity(PairwiseMatrix const& FrameDistancesIn) { + double maxdist = 0.0; + frame_iterator frame1_end = frameList_.end(); + --frame1_end; + for (frame_iterator frm1 = frameList_.begin(); frm1 != frameList_.end(); ++frm1) + { + frame_iterator frm2 = frm1; + ++frm2; + for (; frm2 != frameList_.end(); ++frm2) { + double fdist = FrameDistancesIn.Frame_Distance(*frm1, *frm2); + if (fdist > maxdist) + maxdist = fdist; + } + } + eccentricity_ = maxdist; +} + +/** Calculate average distance between all members in cluster and + * the centroid. + */ +double Cpptraj::Cluster::Node::CalcAvgToCentroid( Metric* Cdist ) const +{ + double avgdist = 0.0; + //int idx = 0; // DEBUG + //mprintf("AVG DISTANCES FOR CLUSTER %d:\n", Num()); // DEBUG + for (frame_iterator frm = frameList_.begin(); frm != frameList_.end(); ++frm) + { + double dist = Cdist->FrameCentroidDist( *frm, centroid_ ); + //mprintf("\tDist to %i is %f\n", idx++, dist); // DEBUG + avgdist += dist; + } + return ( avgdist / (double)frameList_.size() ); +} + +void Cpptraj::Cluster::Node::SortFrameList() { + std::sort(frameList_.begin(), frameList_.end()); +} + +// Cpptraj::Cluster::Node::HasFrame() +bool Cpptraj::Cluster::Node::HasFrame(int frame) const { + Cframes::const_iterator it = std::find(frameList_.begin(), frameList_.end(), frame); + return !(it == frameList_.end()); +} + +// Cpptraj::Cluster::Node::RemoveFrameFromCluster() +void Cpptraj::Cluster::Node::RemoveFrameFromCluster(int frame) { + Cframes::iterator pend = std::remove( frameList_.begin(), frameList_.end(), frame); + size_t newsize = pend - frameList_.begin(); + frameList_.resize( newsize ); +} + +void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(Metric* Cdist, int frame) { + Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), + Metric::SUBTRACTFRAME); + RemoveFrameFromCluster( frame ); +} + +void Cpptraj::Cluster::Node::AddFrameUpdateCentroid(Metric* Cdist, int frame) { + Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), + Metric::ADDFRAME); + AddFrameToCluster( frame ); +} diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h new file mode 100644 index 0000000000..8d208f86ad --- /dev/null +++ b/src/Cluster/Node.h @@ -0,0 +1,103 @@ +#ifndef INC_CLUSTER_NODE_H +#define INC_CLUSTER_NODE_H +#include "PairwiseMatrix.h" +namespace Cpptraj { +namespace Cluster { + +/// Hold frame indices for a given cluster. +class Node { + public: + Node(); + ~Node(); + Node(Metric*, Cframes const&, int); + Node(const Node&); + Node& operator=(const Node&); + /// Used to pair a representative frame number with a score. + typedef std::pair RepPair; + /// Used to hold a list of representative frames/scores + typedef std::vector RepPairArray; + /// Used to sort clusters by # of frames in cluster + inline bool operator<(const Node&) const; + /// Merge frames from another cluster to this cluster + inline void MergeFrames(Node const&); + /// Find and set frame in the cluster that has lowest distance to all other frames. +// int SetBestRep_CumulativeDist(DataSet_Cmatrix const&); + /// Calculate eccentricity for frames in this cluster. + void CalcEccentricity(PairwiseMatrix const&); + /// Calculate centroid of members of this cluster. + void CalculateCentroid(Metric* Cdist) { + // FIXME: Could potentially get rid of this branch. + if (centroid_ == 0) + centroid_ = Cdist->NewCentroid( frameList_ ); + else + Cdist->CalculateCentroid( centroid_, frameList_ ); + } + /// Calculate average distance of all members to centroid + double CalcAvgToCentroid( Metric*) const; + // Iterator over frame numbers + typedef Cframes::const_iterator frame_iterator; + frame_iterator beginframe() const { return frameList_.begin(); } + frame_iterator endframe() const { return frameList_.end(); } + /// \return Frame number at given index. + int ClusterFrame(int idx) const { return frameList_[idx]; } + /// \return cluster eccentricity + double Eccentricity() const { return eccentricity_; } + /// \return internal cluster number + int Num() const { return num_; } + /// \return number of frames in cluster. + int Nframes() const { return (int)frameList_.size(); } + /// \return best representative frame number, or -1 if no best rep set. + int BestRepFrame() const { + if (bestReps_.empty()) + return -1; + else + return bestReps_.front().first; + } + Centroid* Cent() const { return centroid_; } + std::string const& Cname() const { return name_; } + double RefRms() const { return refRms_; } + // Set internal variables + void AddFrameToCluster(int fnum) { frameList_.push_back( fnum ); } + void SetNum(int numIn) { num_ = numIn; } + /// Access representative frame list + RepPairArray const& BestReps() const { return bestReps_; } + RepPairArray& BestReps() { return bestReps_; } + inline void SetNameAndRms(std::string const&, double); + /// Sort internal frame list + void SortFrameList(); + /// \return true if given frame is in this cluster. + bool HasFrame(int) const; + /// Remove specified frame from cluster if present. + void RemoveFrameFromCluster(int); + /// Remove specified frame from cluster and update centroid. + void RemoveFrameUpdateCentroid(Metric*, int); + /// Add specified frame to cluster and update centroid. + void AddFrameUpdateCentroid(Metric*, int); + private: + Cframes frameList_; ///< List of frames belonging to this cluster. + Centroid* centroid_; ///< Centroid of all frames in this cluster. + std::string name_; ///< Cluster name assigned from reference. + RepPairArray bestReps_; + double eccentricity_; ///< Maximum distance between any 2 frames. + double refRms_; ///< Cluster rms to reference (if assigned). + int num_; ///< Cluster number, used for bookkeeping. + bool needsUpdate_; ///< True if internal metrics need updating (e.g. after frames added). +}; +// ----- INLINE FUNCTIONS ------------------------------------------------------ +/** Use > since we give higher priority to larger clusters. */ +bool Node::operator<(const Node& rhs) const { + return ( frameList_.size() > rhs.frameList_.size() ); +} +/** Frames from rhs go to this cluster. */ +void Node::MergeFrames( Node const& rhs) { + frameList_.insert(frameList_.end(), rhs.frameList_.begin(), rhs.frameList_.end()); +} +/** Set reference name and RMS. */ +void Node::SetNameAndRms(std::string const& nameIn, double rmsIn) { + name_ = nameIn; + refRms_ = rmsIn; +} + +} /* END namespace Cluster */ +} /* END namespace Cpptraj */ +#endif diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 4c62e84f22..925d90f8be 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,4 +1,5 @@ Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h +Node.o : Node.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h Node.h PairwiseMatrix.h PairwiseMatrix.o : PairwiseMatrix.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h PairwiseMatrix_MEM.o : PairwiseMatrix_MEM.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h PairwiseMatrix_MEM.h From 1abb185bd85bfac8d194898eadcff6c78f1de28f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 15:14:27 -0500 Subject: [PATCH 011/417] DRR - Cpptraj: Add constant for noise point --- src/Cluster/Metric.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 54ec451415..57be2da2d5 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -10,6 +10,8 @@ namespace Cluster { typedef std::vector Cframes; /// Iterator for Cframes typedef Cframes::const_iterator Cframes_it; +/// Definition of a noise point. +const int NOISE = -1; /// Abstract base class for calculating distance between points or determining centroid. class Metric { From 746bd7485cb3f4d83e0ed1d7f5f342e2d428180b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 15:14:59 -0500 Subject: [PATCH 012/417] DRR - Cpptraj: Start adding the hierarchical agglomerative algorithm. --- src/Cluster/Algorithm.h | 27 ++++++++++++++ src/Cluster/Algorithm_HierAgglo.cpp | 57 +++++++++++++++++++++++++++++ src/Cluster/Algorithm_HierAgglo.h | 43 ++++++++++++++++++++++ src/Cluster/List.h | 32 ++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 src/Cluster/Algorithm.h create mode 100644 src/Cluster/Algorithm_HierAgglo.cpp create mode 100644 src/Cluster/Algorithm_HierAgglo.h create mode 100644 src/Cluster/List.h diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h new file mode 100644 index 0000000000..5f5c52e13b --- /dev/null +++ b/src/Cluster/Algorithm.h @@ -0,0 +1,27 @@ +#ifndef INC_CLUSTER_ALGORITHM_H +#define INC_CLUSTER_ALGORITHM_H +#include "PairwiseMatrix.h" +#include "List.h" +namespace Cpptraj { +namespace Cluster { + +/// Abstract base class for implementing clustering algorithms. +class Algorithm { + public: + Algorithm() {} + virtual ~Algorithm() {} + /// Set up clustering algorithm + virtual int Setup(ArgList&) = 0; + /// Report details on algorithm setup. + virtual void Info() const = 0; + /// Report details on algorithm setup as a string. + virtual void Results(std::string&) const = 0; + /// Perform clustering on specified frames using given distance matrix. + virtual int DoClustering(List&, Cframes const&, PairwiseMatrix const&) = 0; + /// Report any timing data + virtual void Timing(double) const = 0; +}; + +} /* END namespace Cluster */ +} /* END namespace Cpptraj */ +#endif diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp new file mode 100644 index 0000000000..22b16ac8cf --- /dev/null +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -0,0 +1,57 @@ +#include "Algorithm_HierAgglo.h" +#include "../CpptrajStdio.h" + +Cpptraj::Cluster::Algorithm_HierAgglo::Algorithm_HierAgglo() : + nclusters_(-1), + epsilon_(-1.0), + linkage_(AVERAGELINK)//, +// includeSievedFrames_(false) +{} + +void Cpptraj::Cluster::Algorithm_HierAgglo::Help() { + mprintf("\t[hieragglo [epsilon ] [clusters ] [linkage|averagelinkage|complete]\n" + "\t [epsilonplot ] [includesieved_cdist]]\n"); +} + +static const char* LinkageString[] = { + "single-linkage", "average-linkage", "complete-linkage" +}; + +int Cpptraj::Cluster::Algorithm_HierAgglo::Setup(ArgList& analyzeArgs) { + nclusters_ = analyzeArgs.getKeyInt("clusters", -1); + epsilon_ = analyzeArgs.getKeyDouble("epsilon", -1.0); + if (analyzeArgs.hasKey("linkage")) linkage_ = SINGLELINK; + else if (analyzeArgs.hasKey("averagelinkage")) linkage_ = AVERAGELINK; + else if (analyzeArgs.hasKey("complete")) linkage_ = COMPLETELINK; + else linkage_ = AVERAGELINK; // DEFAULT linkage +// includeSievedFrames_ = analyzeArgs.hasKey("includesieved_cdist"); + std::string epsilonPlot = analyzeArgs.GetStringKey("epsilonplot"); + if (!epsilonPlot.empty()) { + if (eps_v_n_.OpenWrite( epsilonPlot )) return 1; + eps_v_n_.Printf("%-12s %12s\n", "#Epsilon", "Nclusters"); + } + // Determine finish criteria. If nothing specified default to 10 clusters. + if (nclusters_==-1 && epsilon_==-1.0) { + mprintf("Warning: cluster: Neither target # of clusters nor epsilon given.\n"); + nclusters_ = 10; + mprintf("Warning: cluster: Defaulting to %i clusters.\n", nclusters_); + } + return 0; +} + +void Cpptraj::Cluster::Algorithm_HierAgglo::Info() const { + mprintf("\tHierarchical Agglomerative:"); + if (nclusters_ != -1) + mprintf(" %i clusters,",nclusters_); + if (epsilon_ != -1.0) + mprintf(" epsilon %.3f,",epsilon_); + mprintf(" %s.\n", LinkageString[linkage_]); + if (eps_v_n_.IsOpen()) + mprintf("\tWriting epsilon vs # clusters to '%s'\n", eps_v_n_.Filename().full()); + /*if (includeSievedFrames_) + mprintf("\tSieved frames will be included in final cluster distance calculation.\n" + "Warning: 'includesieved_cdist' may be very slow.\n"); + else + mprintf("\tSieved frames will not be included in final cluster distance calculation.\n");*/ +} + diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h new file mode 100644 index 0000000000..465ef46769 --- /dev/null +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -0,0 +1,43 @@ +#ifndef INC_CLUSTER_ALGORITHM_HIERAGGLO_H +#define INC_CLUSTER_ALGORITHM_HIERAGGLO_H +#include "Algorithm.h" +#include "../Timer.h" +#include "../ClusterMatrix.h" +#include "../CpptrajFile.h" +namespace Cpptraj { +namespace Cluster { + +/// Implement hierarchical agglomerative clustering +class Algorithm_HierAgglo : public Algorithm { + public: + Algorithm_HierAgglo(); + static void Help(); + int Setup(ArgList&); + void Info() const; + void Results(std::string&) const; + int DoClustering(List&, Cframes const&, PairwiseMatrix const&); + void Timing(double) const; + private: + void InitializeClusterDistances(); + int MergeClosest(); + void calcMinDist(List::cluster_it&); + void calcMaxDist(List::cluster_it&); + void calcAvgDist(List::cluster_it&); + + /// Type of distance calculation between clusters. + enum LINKAGETYPE { SINGLELINK = 0, AVERAGELINK, COMPLETELINK }; + int nclusters_; ///< Target # of clusters. + double epsilon_; ///< Once the min distance between clusters is > epsilon, stop. + LINKAGETYPE linkage_; ///< Cluster Linkage type. + CpptrajFile eps_v_n_; ///< Write epsilon vs # clusters. + ClusterMatrix ClusterDistances_; +# ifdef TIMER + Timer time_findMin_; + Timer time_mergeFrames_; + Timer time_calcLinkage_; +# endif +}; + +} /* END namespace Cluster */ +} /* END namespace Cpptraj */ +#endif diff --git a/src/Cluster/List.h b/src/Cluster/List.h new file mode 100644 index 0000000000..24d6c4d754 --- /dev/null +++ b/src/Cluster/List.h @@ -0,0 +1,32 @@ +#ifndef INC_CLUSTER_LIST_H +#define INC_CLUSTER_LIST_H +#include +#include "Node.h" +namespace Cpptraj { +namespace Cluster { + +/// Hold all individual clusters. +/** Currently implemented as an STL list since sorting and erasing are more + * efficient. + */ +class List { + public: + List() {} + /// Iterator over clusters + typedef std::list::iterator cluster_it; + cluster_it begin() { return clusters_.begin(); } + cluster_it end() { return clusters_.end(); } + /// Const Iterator over clusters + typedef std::list::const_iterator cluster_iterator; + const cluster_iterator begincluster() const { return clusters_.begin(); } + const cluster_iterator endcluster() const { return clusters_.end(); } + private: + typedef std::list Narray; + Narray clusters_; ///< Hold all clusters. + Node noise_; ///< Hold any frames classified as noise. +}; + +} /* END namespace Cluster */ +} /* END namespace Cpptraj */ + +#endif From 90d6e562fc6b1471ffd6d620773f745b33b40c7a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 15:44:28 -0500 Subject: [PATCH 013/417] DRR - Cpptraj: More functions for List class --- src/Cluster/List.cpp | 16 ++++++++++++++++ src/Cluster/List.h | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/Cluster/List.cpp diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp new file mode 100644 index 0000000000..763dacc039 --- /dev/null +++ b/src/Cluster/List.cpp @@ -0,0 +1,16 @@ +#include "List.h" +#include "../CpptrajStdio.h" + +void Cpptraj::Cluster::List::PrintClusters() const { + //mprintf("CLUSTER: %u clusters, %u frames.\n", clusters_.size(), + // FrameDistances().OriginalNframes() ); + mprintf("CLUSTER: %u clusters.\n", clusters_.size()); + for (cluster_iterator C = begincluster(); C != endcluster(); C++) { + mprintf("\t%8i : ",C->Num()); + for (Node::frame_iterator fnum = C->beginframe(); + fnum != C->endframe(); ++fnum) + mprintf("%i,",(*fnum)+1); + mprintf("\n"); + } +} + diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 24d6c4d754..186f9b8e60 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -14,16 +14,28 @@ class List { List() {} /// Iterator over clusters typedef std::list::iterator cluster_it; + /// Iterator to beginning cluster_it begin() { return clusters_.begin(); } + /// Iterator to end cluster_it end() { return clusters_.end(); } - /// Const Iterator over clusters + /// Const iterator over clusters typedef std::list::const_iterator cluster_iterator; + /// Const iterator to beginning const cluster_iterator begincluster() const { return clusters_.begin(); } + /// Const iterator to end const cluster_iterator endcluster() const { return clusters_.end(); } + /// \return current number of clusters. + int Nclusters() const { return (int)clusters_.size(); } + /// \return Array containing noise points + Cframes const& Noise() const { return noise_; } + /// Add new cluster + void AddCluster( Node const& n ) { clusters_.push_back( n ); } + /// Print clusters to stdout + void PrintClusters() const; private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. - Node noise_; ///< Hold any frames classified as noise. + Cframes noise_; ///< Hold any frames classified as noise. }; } /* END namespace Cluster */ From 7f0cb176b7a775088816452e00cb7f0daa472075 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 17 Jan 2019 15:58:37 -0500 Subject: [PATCH 014/417] DRR - Cpptraj: continue implementing hierarchical clustering. --- src/Cluster/Algorithm.h | 10 +- src/Cluster/Algorithm_HierAgglo.cpp | 153 ++++++++++++++++++++++++++++ src/Cluster/Algorithm_HierAgglo.h | 6 +- src/Cluster/List.h | 2 + src/Cluster/Makefile | 2 + src/Cluster/Node.cpp | 16 +-- src/Cluster/Node.h | 14 +-- src/Cluster/clusterdepend | 2 + 8 files changed, 185 insertions(+), 20 deletions(-) diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index 5f5c52e13b..3333c51c61 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -2,6 +2,7 @@ #define INC_CLUSTER_ALGORITHM_H #include "PairwiseMatrix.h" #include "List.h" +#include "../CpptrajFile.h" namespace Cpptraj { namespace Cluster { @@ -14,12 +15,17 @@ class Algorithm { virtual int Setup(ArgList&) = 0; /// Report details on algorithm setup. virtual void Info() const = 0; - /// Report details on algorithm setup as a string. - virtual void Results(std::string&) const = 0; + /// Report brief details on algorithm setup to a file. + virtual void Results(CpptrajFile&) const = 0; /// Perform clustering on specified frames using given distance matrix. virtual int DoClustering(List&, Cframes const&, PairwiseMatrix const&) = 0; /// Report any timing data virtual void Timing(double) const = 0; + // ------------------------------------------- + /// Set debug level for algorithm + void SetDebug(int d) { debug_ = d; } + protected: + int debug_; }; } /* END namespace Cluster */ diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 22b16ac8cf..134d56b18d 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -1,5 +1,7 @@ +#include // double max #include "Algorithm_HierAgglo.h" #include "../CpptrajStdio.h" +#include "../ProgressBar.h" Cpptraj::Cluster::Algorithm_HierAgglo::Algorithm_HierAgglo() : nclusters_(-1), @@ -55,3 +57,154 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::Info() const { mprintf("\tSieved frames will not be included in final cluster distance calculation.\n");*/ } +void Cpptraj::Cluster::Algorithm_HierAgglo::Results(CpptrajFile& outfile) const { + outfile.Printf("#Algorithm: HierAgglo linkage %s nclusters %i epsilon %g\n", + LinkageString[linkage_], nclusters_, epsilon_); +} + +void Cpptraj::Cluster::Algorithm_HierAgglo::Timing(double total) const { +# ifdef TIMER + time_findMin_.WriteTiming(2, "Find min distance", total); + time_mergeFrames_.WriteTiming(2, "Merge cluster frames", total); + time_calcLinkage_.WriteTiming(2, "Calculate new linkage", total); +# endif +} + +/** Default: put all frames in their own starting cluster. */ +void Cpptraj::Cluster::Algorithm_HierAgglo::buildInitialClusters(List& clusters, + Cframes const& framesToCluster, + Metric& metric) +{ + int num = 0; + for (Cframes_it frm = framesToCluster.begin(); frm != framesToCluster.end(); ++frm) + { + Cframes oneframe(1, *frm); + clusters.AddCluster( Node(metric, oneframe, num++) ); + } +} + +/** Cluster using a hierarchical agglomerative (bottom-up) approach. All frames + * start in their own cluster. The closest two clusters are merged, and + * distances between the newly merged cluster and all remaining clusters are + * recalculated according to one of the following metrics: + * - single-linkage : The minimum distance between frames in clusters are used. + * - average-linkage : The average distance between frames in clusters are used. + * - complete-linkage: The maximum distance between frames in clusters are used. + */ +int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, + Cframes const& framesToCluster, + PairwiseMatrix const& pmatrix) +{ + // If epsilon not given make it huge + if (epsilon_ == -1.0) epsilon_ = std::numeric_limits::max(); + // If target clusters not given make it 1 + if (nclusters_ == -1) nclusters_ = 1; + mprintf("\tStarting Hierarchical Agglomerative Clustering:\n"); + ProgressBar cluster_progress(-10); + // Build initial clusters. + if (clusters.empty()) + buildInitialClusters(clusters, framesToCluster, pmatrix.DistMetric()); + mprintf("\t%i initial clusters.\n", clusters.Nclusters()); + // Build initial cluster distance matrix. + InitializeClusterDistances(); + // DEBUG - print initial clusters + if (debug_ > 1) + PrintClusters(); + bool clusteringComplete = false; + int iterations = 0; + while (!clusteringComplete) { + // Merge 2 closest clusters. Clustering complete if closest dist > epsilon. + if (MergeClosest()) break; + // If the target number of clusters is reached we are done + if (Nclusters() <= nclusters_) { + mprintf("\n\tTarget # of clusters (%i) met (%u), clustering complete.\n", nclusters_, + Nclusters()); + break; + } + if (Nclusters() == 1) clusteringComplete = true; // Sanity check + cluster_progress.Update( iterations++ ); + } + mprintf("\tCompleted after %i iterations, %u clusters.\n",iterations, + Nclusters()); + return 0; +} + +/** Find and merge the two closest clusters. + * \return 1 if clustering is complete, 0 otherwise. + */ +int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters) { + int C1, C2; + // Find the minimum distance between clusters. C1 will be lower than C2. +# ifdef TIMER + time_findMin_.Start(); +# endif + double min = ClusterDistances_.FindMin(C1, C2); +# ifdef TIMER + time_findMin_.Stop(); +# endif + if (eps_v_n_.IsOpen()) + eps_v_n_.Printf("%12g %12i\n", min, clusters.Nclusters()); + if (debug_>0) + mprintf("\tMinimum found between clusters %i and %i (%f)\n",C1,C2,min); + // If the minimum distance is greater than epsilon we are done + if (min > epsilon_) { + mprintf("\n\tMinimum distance (%f) is greater than epsilon (%f), clustering complete.\n", + min, epsilon_); + return 1; + } + + // Find C1, the number of the cluster to be merged into. + cluster_it C1_it = clusters.begin(); + for (; C1_it != clusters.end(); ++C1_it) + { + if ( C1_it->Num() == C1 ) break; + } + if (C1_it == clusters.end()) { + mprinterr("Error: MergeClosest: C1 (%i) not found.\n",C1); + return 1; + } + // Find C2 - start from C1 since C1 < C2 + cluster_it C2_it = C1_it; + for (; C2_it != clusters.end(); ++C2_it) { + if ( C2_it->Num() == C2 ) break; + } + if (C2_it == clusters.end()) { + mprinterr("Error: MergeClosest: C2 (%i) not found.\n",C2); + return 1; + } + + // Merge the closest clusters, C2 -> C1, remove C2 +# ifdef TIMER + time_mergeFrames_.Start(); +# endif + C1_it->MergeFrames( *C2_it ); + clusters.erase( C2_it ); +# ifdef TIMER + time_mergeFrames_.Stop(); +# endif + // DEBUG + if (debug_>1) { + mprintf("\nAFTER MERGE of %i and %i:\n",C1,C2); + PrintClusters(); + } + // Remove all distances having to do with C2 + ClusterDistances_.Ignore(C2); +# ifdef TIMER + time_calcLinkage_.Start(); +# endif + switch (linkage_) { + case AVERAGELINK : calcAvgDist(C1_it); break; + case SINGLELINK : calcMinDist(C1_it); break; + case COMPLETELINK: calcMaxDist(C1_it); break; + } +# ifdef TIMER + time_calcLinkage_.Stop(); +# endif + if (debug_>2) { + mprintf("NEW CLUSTER DISTANCES:\n"); + ClusterDistances_.PrintElements(); + } + + return 0; +} + diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index 465ef46769..61e2153637 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -3,7 +3,6 @@ #include "Algorithm.h" #include "../Timer.h" #include "../ClusterMatrix.h" -#include "../CpptrajFile.h" namespace Cpptraj { namespace Cluster { @@ -14,12 +13,13 @@ class Algorithm_HierAgglo : public Algorithm { static void Help(); int Setup(ArgList&); void Info() const; - void Results(std::string&) const; + void Results(CpptrajFile&) const; int DoClustering(List&, Cframes const&, PairwiseMatrix const&); void Timing(double) const; private: + void buildInitialClusters(List&, Cframes const&, Metric&); void InitializeClusterDistances(); - int MergeClosest(); + int MergeClosest(List&); void calcMinDist(List::cluster_it&); void calcMaxDist(List::cluster_it&); void calcAvgDist(List::cluster_it&); diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 186f9b8e60..4ab85cae69 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -26,6 +26,8 @@ class List { const cluster_iterator endcluster() const { return clusters_.end(); } /// \return current number of clusters. int Nclusters() const { return (int)clusters_.size(); } + /// \return true if no clusters + bool empty() const { return clusters_.empty(); } /// \return Array containing noise points Cframes const& Noise() const { return noise_; } /// Add new cluster diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile index 0dcafeb263..09d334ffcd 100644 --- a/src/Cluster/Makefile +++ b/src/Cluster/Makefile @@ -3,7 +3,9 @@ include ../../config.h # Source files to be compiled SOURCES= \ + Algorithm_HierAgglo.cpp \ Centroid_Coord.cpp \ + List.cpp \ Metric_RMS.cpp \ Node.cpp \ PairwiseMatrix.cpp \ diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index cdd0aad167..50577f6509 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -19,9 +19,9 @@ Cpptraj::Cluster::Node::~Node() { * initial centroid and set initial best rep frame to front, even though * that will probably be wrong when number of frames in the list > 1. */ -Cpptraj::Cluster::Node::Node(Metric* Cdist, Cframes const& frameListIn, int numIn) : +Cpptraj::Cluster::Node::Node(Metric& Cdist, Cframes const& frameListIn, int numIn) : frameList_(frameListIn), - centroid_(Cdist->NewCentroid(frameList_)), + centroid_(Cdist.NewCentroid(frameList_)), bestReps_(1, RepPair(frameListIn.front(), 0.0)), eccentricity_(0.0), num_(numIn), @@ -108,14 +108,14 @@ void Cpptraj::Cluster::Node::CalcEccentricity(PairwiseMatrix const& FrameDistanc /** Calculate average distance between all members in cluster and * the centroid. */ -double Cpptraj::Cluster::Node::CalcAvgToCentroid( Metric* Cdist ) const +double Cpptraj::Cluster::Node::CalcAvgToCentroid( Metric& Cdist ) const { double avgdist = 0.0; //int idx = 0; // DEBUG //mprintf("AVG DISTANCES FOR CLUSTER %d:\n", Num()); // DEBUG for (frame_iterator frm = frameList_.begin(); frm != frameList_.end(); ++frm) { - double dist = Cdist->FrameCentroidDist( *frm, centroid_ ); + double dist = Cdist.FrameCentroidDist( *frm, centroid_ ); //mprintf("\tDist to %i is %f\n", idx++, dist); // DEBUG avgdist += dist; } @@ -139,14 +139,14 @@ void Cpptraj::Cluster::Node::RemoveFrameFromCluster(int frame) { frameList_.resize( newsize ); } -void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(Metric* Cdist, int frame) { - Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), +void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(Metric& Cdist, int frame) { + Cdist.FrameOpCentroid(frame, centroid_, (double)frameList_.size(), Metric::SUBTRACTFRAME); RemoveFrameFromCluster( frame ); } -void Cpptraj::Cluster::Node::AddFrameUpdateCentroid(Metric* Cdist, int frame) { - Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), +void Cpptraj::Cluster::Node::AddFrameUpdateCentroid(Metric& Cdist, int frame) { + Cdist.FrameOpCentroid(frame, centroid_, (double)frameList_.size(), Metric::ADDFRAME); AddFrameToCluster( frame ); } diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 8d208f86ad..9899f20216 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -9,7 +9,7 @@ class Node { public: Node(); ~Node(); - Node(Metric*, Cframes const&, int); + Node(Metric&, Cframes const&, int); Node(const Node&); Node& operator=(const Node&); /// Used to pair a representative frame number with a score. @@ -25,15 +25,15 @@ class Node { /// Calculate eccentricity for frames in this cluster. void CalcEccentricity(PairwiseMatrix const&); /// Calculate centroid of members of this cluster. - void CalculateCentroid(Metric* Cdist) { + void CalculateCentroid(Metric& Cdist) { // FIXME: Could potentially get rid of this branch. if (centroid_ == 0) - centroid_ = Cdist->NewCentroid( frameList_ ); + centroid_ = Cdist.NewCentroid( frameList_ ); else - Cdist->CalculateCentroid( centroid_, frameList_ ); + Cdist.CalculateCentroid( centroid_, frameList_ ); } /// Calculate average distance of all members to centroid - double CalcAvgToCentroid( Metric*) const; + double CalcAvgToCentroid( Metric&) const; // Iterator over frame numbers typedef Cframes::const_iterator frame_iterator; frame_iterator beginframe() const { return frameList_.begin(); } @@ -70,9 +70,9 @@ class Node { /// Remove specified frame from cluster if present. void RemoveFrameFromCluster(int); /// Remove specified frame from cluster and update centroid. - void RemoveFrameUpdateCentroid(Metric*, int); + void RemoveFrameUpdateCentroid(Metric&, int); /// Add specified frame to cluster and update centroid. - void AddFrameUpdateCentroid(Metric*, int); + void AddFrameUpdateCentroid(Metric&, int); private: Cframes frameList_; ///< List of frames belonging to this cluster. Centroid* centroid_; ///< Centroid of all frames in this cluster. diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 925d90f8be..9a1c537dd1 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,4 +1,6 @@ +Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../ClusterMatrix.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h +List.o : List.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h Node.o : Node.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h Node.h PairwiseMatrix.h PairwiseMatrix.o : PairwiseMatrix.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h From e3ecd0f59d6ee760b147510fbea4a8df92852c33 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 09:51:11 -0500 Subject: [PATCH 015/417] DRR - Cpptraj: More progress made adapting the hierarchical agglo. clustering. --- src/Cluster/Algorithm_HierAgglo.cpp | 24 ++++++++++++------------ src/Cluster/Algorithm_HierAgglo.h | 2 +- src/Cluster/List.h | 6 ++++-- src/Cluster/Node.cpp | 16 ++++++++-------- src/Cluster/Node.h | 19 ++++++++++++------- src/Cluster/PairwiseMatrix.h | 6 +++--- src/Cluster/PairwiseMatrix_MEM.cpp | 2 +- 7 files changed, 41 insertions(+), 34 deletions(-) diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 134d56b18d..1e1b140fb2 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -73,7 +73,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::Timing(double total) const { /** Default: put all frames in their own starting cluster. */ void Cpptraj::Cluster::Algorithm_HierAgglo::buildInitialClusters(List& clusters, Cframes const& framesToCluster, - Metric& metric) + Metric* metric) { int num = 0; for (Cframes_it frm = framesToCluster.begin(); frm != framesToCluster.end(); ++frm) @@ -103,29 +103,29 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, ProgressBar cluster_progress(-10); // Build initial clusters. if (clusters.empty()) - buildInitialClusters(clusters, framesToCluster, pmatrix.DistMetric()); + buildInitialClusters(clusters, framesToCluster, pmatrix.MetricPtr()); mprintf("\t%i initial clusters.\n", clusters.Nclusters()); // Build initial cluster distance matrix. InitializeClusterDistances(); // DEBUG - print initial clusters if (debug_ > 1) - PrintClusters(); + clusters.PrintClusters(); bool clusteringComplete = false; int iterations = 0; while (!clusteringComplete) { // Merge 2 closest clusters. Clustering complete if closest dist > epsilon. - if (MergeClosest()) break; + if (MergeClosest(clusters)) break; // If the target number of clusters is reached we are done - if (Nclusters() <= nclusters_) { + if (clusters.Nclusters() <= nclusters_) { mprintf("\n\tTarget # of clusters (%i) met (%u), clustering complete.\n", nclusters_, - Nclusters()); + clusters.Nclusters()); break; } - if (Nclusters() == 1) clusteringComplete = true; // Sanity check + if (clusters.Nclusters() == 1) clusteringComplete = true; // Sanity check cluster_progress.Update( iterations++ ); } mprintf("\tCompleted after %i iterations, %u clusters.\n",iterations, - Nclusters()); + clusters.Nclusters()); return 0; } @@ -154,7 +154,7 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters) { } // Find C1, the number of the cluster to be merged into. - cluster_it C1_it = clusters.begin(); + List::cluster_it C1_it = clusters.begin(); for (; C1_it != clusters.end(); ++C1_it) { if ( C1_it->Num() == C1 ) break; @@ -164,7 +164,7 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters) { return 1; } // Find C2 - start from C1 since C1 < C2 - cluster_it C2_it = C1_it; + List::cluster_it C2_it = C1_it; for (; C2_it != clusters.end(); ++C2_it) { if ( C2_it->Num() == C2 ) break; } @@ -178,14 +178,14 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters) { time_mergeFrames_.Start(); # endif C1_it->MergeFrames( *C2_it ); - clusters.erase( C2_it ); + clusters.RemoveCluster( C2_it ); # ifdef TIMER time_mergeFrames_.Stop(); # endif // DEBUG if (debug_>1) { mprintf("\nAFTER MERGE of %i and %i:\n",C1,C2); - PrintClusters(); + clusters.PrintClusters(); } // Remove all distances having to do with C2 ClusterDistances_.Ignore(C2); diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index 61e2153637..b250cbbd6c 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -17,7 +17,7 @@ class Algorithm_HierAgglo : public Algorithm { int DoClustering(List&, Cframes const&, PairwiseMatrix const&); void Timing(double) const; private: - void buildInitialClusters(List&, Cframes const&, Metric&); + void buildInitialClusters(List&, Cframes const&, Metric*); void InitializeClusterDistances(); int MergeClosest(List&); void calcMinDist(List::cluster_it&); diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 4ab85cae69..b7e113e897 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -30,10 +30,12 @@ class List { bool empty() const { return clusters_.empty(); } /// \return Array containing noise points Cframes const& Noise() const { return noise_; } - /// Add new cluster - void AddCluster( Node const& n ) { clusters_.push_back( n ); } /// Print clusters to stdout void PrintClusters() const; + /// Add new cluster + void AddCluster( Node const& n ) { clusters_.push_back( n ); } + /// Remove existing cluster via iterator + void RemoveCluster( cluster_it& it ) { clusters_.erase( it ); } private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index 50577f6509..cdd0aad167 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -19,9 +19,9 @@ Cpptraj::Cluster::Node::~Node() { * initial centroid and set initial best rep frame to front, even though * that will probably be wrong when number of frames in the list > 1. */ -Cpptraj::Cluster::Node::Node(Metric& Cdist, Cframes const& frameListIn, int numIn) : +Cpptraj::Cluster::Node::Node(Metric* Cdist, Cframes const& frameListIn, int numIn) : frameList_(frameListIn), - centroid_(Cdist.NewCentroid(frameList_)), + centroid_(Cdist->NewCentroid(frameList_)), bestReps_(1, RepPair(frameListIn.front(), 0.0)), eccentricity_(0.0), num_(numIn), @@ -108,14 +108,14 @@ void Cpptraj::Cluster::Node::CalcEccentricity(PairwiseMatrix const& FrameDistanc /** Calculate average distance between all members in cluster and * the centroid. */ -double Cpptraj::Cluster::Node::CalcAvgToCentroid( Metric& Cdist ) const +double Cpptraj::Cluster::Node::CalcAvgToCentroid( Metric* Cdist ) const { double avgdist = 0.0; //int idx = 0; // DEBUG //mprintf("AVG DISTANCES FOR CLUSTER %d:\n", Num()); // DEBUG for (frame_iterator frm = frameList_.begin(); frm != frameList_.end(); ++frm) { - double dist = Cdist.FrameCentroidDist( *frm, centroid_ ); + double dist = Cdist->FrameCentroidDist( *frm, centroid_ ); //mprintf("\tDist to %i is %f\n", idx++, dist); // DEBUG avgdist += dist; } @@ -139,14 +139,14 @@ void Cpptraj::Cluster::Node::RemoveFrameFromCluster(int frame) { frameList_.resize( newsize ); } -void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(Metric& Cdist, int frame) { - Cdist.FrameOpCentroid(frame, centroid_, (double)frameList_.size(), +void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(Metric* Cdist, int frame) { + Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), Metric::SUBTRACTFRAME); RemoveFrameFromCluster( frame ); } -void Cpptraj::Cluster::Node::AddFrameUpdateCentroid(Metric& Cdist, int frame) { - Cdist.FrameOpCentroid(frame, centroid_, (double)frameList_.size(), +void Cpptraj::Cluster::Node::AddFrameUpdateCentroid(Metric* Cdist, int frame) { + Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), Metric::ADDFRAME); AddFrameToCluster( frame ); } diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 9899f20216..450fab0acf 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -9,7 +9,12 @@ class Node { public: Node(); ~Node(); - Node(Metric&, Cframes const&, int); + // NOTE: Taking a pointer to Metric here instead of a reference allows + // PairwiseMatrix to be passed in as const to routines while still + // allowing Metric to be used. Metric needs to be non-const because + // things like calculating RMSD modify Metric itself to avoid + // always reallocating Frames. + Node(Metric*, Cframes const&, int); Node(const Node&); Node& operator=(const Node&); /// Used to pair a representative frame number with a score. @@ -25,15 +30,15 @@ class Node { /// Calculate eccentricity for frames in this cluster. void CalcEccentricity(PairwiseMatrix const&); /// Calculate centroid of members of this cluster. - void CalculateCentroid(Metric& Cdist) { + void CalculateCentroid(Metric* Cdist) { // FIXME: Could potentially get rid of this branch. if (centroid_ == 0) - centroid_ = Cdist.NewCentroid( frameList_ ); + centroid_ = Cdist->NewCentroid( frameList_ ); else - Cdist.CalculateCentroid( centroid_, frameList_ ); + Cdist->CalculateCentroid( centroid_, frameList_ ); } /// Calculate average distance of all members to centroid - double CalcAvgToCentroid( Metric&) const; + double CalcAvgToCentroid( Metric*) const; // Iterator over frame numbers typedef Cframes::const_iterator frame_iterator; frame_iterator beginframe() const { return frameList_.begin(); } @@ -70,9 +75,9 @@ class Node { /// Remove specified frame from cluster if present. void RemoveFrameFromCluster(int); /// Remove specified frame from cluster and update centroid. - void RemoveFrameUpdateCentroid(Metric&, int); + void RemoveFrameUpdateCentroid(Metric*, int); /// Add specified frame to cluster and update centroid. - void AddFrameUpdateCentroid(Metric&, int); + void AddFrameUpdateCentroid(Metric*, int); private: Cframes frameList_; ///< List of frames belonging to this cluster. Centroid* centroid_; ///< Centroid of all frames in this cluster. diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 9cccafaaf7..dbee9fb390 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -20,15 +20,15 @@ class PairwiseMatrix { /// \return internal metric, const. Metric const& DistMetric() const { return *metric_; } /// \return internal metric. - Metric& DistMetric() { return *metric_; } +// Metric& DistMetric() { return *metric_; } + /// \return Pointer to distance metric + Metric* MetricPtr() const { return metric_; } protected: /// Used to cache distances; expect internal indices, not absolute cluster frames. virtual void SetElement(int, int, double) = 0; // ------------------------------------------- /// Internal routine used to cache pairwise distances. int CalcFrameDistances(Cframes const&); - /// \return Pointer to distance metric - Metric* distMetric() const { return metric_; } private: Metric* metric_; ///< The current distance metric. }; diff --git a/src/Cluster/PairwiseMatrix_MEM.cpp b/src/Cluster/PairwiseMatrix_MEM.cpp index 59f1fb6bef..c102b5b1f6 100644 --- a/src/Cluster/PairwiseMatrix_MEM.cpp +++ b/src/Cluster/PairwiseMatrix_MEM.cpp @@ -10,7 +10,7 @@ double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) cons } } // If here, distance was not cached. - return distMetric()->FrameDist(f1, f2); + return MetricPtr()->FrameDist(f1, f2); } /** Requests that distances between given frames be cached in memory. */ From 0ecd537b1e54d0089bbd05eed12c51cbdf537932 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 10:04:32 -0500 Subject: [PATCH 016/417] DRR - Cpptraj: Finish initial incarnation of revamped hier. agglo. --- src/Cluster/Algorithm_HierAgglo.cpp | 107 ++++++++++++++++++++++++++-- src/Cluster/Algorithm_HierAgglo.h | 8 +-- 2 files changed, 106 insertions(+), 9 deletions(-) diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 1e1b140fb2..6f624918ce 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -114,7 +114,7 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, int iterations = 0; while (!clusteringComplete) { // Merge 2 closest clusters. Clustering complete if closest dist > epsilon. - if (MergeClosest(clusters)) break; + if (MergeClosest(clusters, pmatrix)) break; // If the target number of clusters is reached we are done if (clusters.Nclusters() <= nclusters_) { mprintf("\n\tTarget # of clusters (%i) met (%u), clustering complete.\n", nclusters_, @@ -132,7 +132,8 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, /** Find and merge the two closest clusters. * \return 1 if clustering is complete, 0 otherwise. */ -int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters) { +int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters, PairwiseMatrix const& pmatrix) +{ int C1, C2; // Find the minimum distance between clusters. C1 will be lower than C2. # ifdef TIMER @@ -193,9 +194,9 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters) { time_calcLinkage_.Start(); # endif switch (linkage_) { - case AVERAGELINK : calcAvgDist(C1_it); break; - case SINGLELINK : calcMinDist(C1_it); break; - case COMPLETELINK: calcMaxDist(C1_it); break; + case AVERAGELINK : calcAvgDist(C1_it, clusters, pmatrix); break; + case SINGLELINK : calcMinDist(C1_it, clusters, pmatrix); break; + case COMPLETELINK: calcMaxDist(C1_it, clusters, pmatrix); break; } # ifdef TIMER time_calcLinkage_.Stop(); @@ -208,3 +209,99 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters) { return 0; } +/** Calculate the minimum distance between frames in cluster specified by + * iterator C1 and frames in all other clusters. + */ +void Cpptraj::Cluster::Algorithm_HierAgglo::calcMinDist(List::cluster_it& C1_it, List& clusters, + PairwiseMatrix const& pmatrix) +{ + // All cluster distances to C1 must be recalcd. + for (List::cluster_it C2_it = clusters.begin(); + C2_it != clusters.end(); ++C2_it) + { + if (C2_it == C1_it) continue; + //mprintf("\t\tRecalc distance between %i and %i:\n",C1,newc2); + // Pick the minimum distance between newc2 and C1 + double min = std::numeric_limits::max(); + for (Node::frame_iterator c1frames = C1_it->beginframe(); + c1frames != C1_it->endframe(); + ++c1frames) + { + for (Node::frame_iterator c2frames = C2_it->beginframe(); + c2frames != C2_it->endframe(); + ++c2frames) + { + double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); + if ( Dist < min ) min = Dist; + } + } + //mprintf("\t\tMin distance between %i and %i: %f\n",C1,newc2,min); + ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), min ); + } +} + +/** Calculate the maximum distance between frames in cluster specified by + * iterator C1 and frames in all other clusters. + */ +void Cpptraj::Cluster::Algorithm_HierAgglo::calcMaxDist(List::cluster_it& C1_it, List& clusters, + PairwiseMatrix const& pmatrix) +{ + // All cluster distances to C1 must be recalcd. + for (List::cluster_it C2_it = clusters.begin(); + C2_it != clusters.end(); ++C2_it) + { + if (C2_it == C1_it) continue; + //mprintf("\t\tRecalc distance between %i and %i:\n",C1,newc2); + // Pick the maximum distance between newc2 and C1 + double max = -1.0; + for (Node::frame_iterator c1frames = C1_it->beginframe(); + c1frames != C1_it->endframe(); + ++c1frames) + { + for (Node::frame_iterator c2frames = C2_it->beginframe(); + c2frames != C2_it->endframe(); + ++c2frames) + { + double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); + if ( Dist > max ) max = Dist; + } + } + //mprintf("\t\tMax distance between %i and %i: %f\n",C1,newc2,max); + ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), max ); + } +} + +/** Calculate the average distance between frames in cluster specified by + * iterator C1 and frames in all other clusters. + */ +void Cpptraj::Cluster::Algorithm_HierAgglo::calcAvgDist(List::cluster_it& C1_it, List& clusters, + PairwiseMatrix const& pmatrix) +{ + // All cluster distances to C1 must be recalcd. + for (List::cluster_it C2_it = clusters.begin(); + C2_it != clusters.end(); ++C2_it) + { + if (C2_it == C1_it) continue; + //mprintf("\t\tRecalc distance between %i and %i:\n",(*C1_it).Num(),(*C2_it).Num()); + // Pick the minimum distance between newc2 and C1 + double sumDist = 0; + for (Node::frame_iterator c1frames = C1_it->beginframe(); + c1frames != C1_it->endframe(); + ++c1frames) + { + for (Node::frame_iterator c2frames = C2_it->beginframe(); + c2frames != C2_it->endframe(); + ++c2frames) + { + double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); + sumDist += Dist; + } + } + double Dist = sumDist / (double)(C1_it->Nframes() * C2_it->Nframes()); + //mprintf("\t\tAvg distance between %i and %i: %f\n",(*C1_it).Num(),(*C2_it).Num(),Dist); + ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), Dist ); + } +} diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index b250cbbd6c..0a60718c22 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -19,10 +19,10 @@ class Algorithm_HierAgglo : public Algorithm { private: void buildInitialClusters(List&, Cframes const&, Metric*); void InitializeClusterDistances(); - int MergeClosest(List&); - void calcMinDist(List::cluster_it&); - void calcMaxDist(List::cluster_it&); - void calcAvgDist(List::cluster_it&); + int MergeClosest(List&, PairwiseMatrix const&); + void calcMinDist(List::cluster_it&, List&, PairwiseMatrix const&); + void calcMaxDist(List::cluster_it&, List&, PairwiseMatrix const&); + void calcAvgDist(List::cluster_it&, List&, PairwiseMatrix const&); /// Type of distance calculation between clusters. enum LINKAGETYPE { SINGLELINK = 0, AVERAGELINK, COMPLETELINK }; From 4316d8bbd27e95d1adf3bc8c83dcbf5ba2cccabe Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 10:13:14 -0500 Subject: [PATCH 017/417] DRR - Cpptraj: Improve code docs. --- src/Cluster/Node.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 450fab0acf..189a392d0a 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -4,6 +4,8 @@ namespace Cpptraj { namespace Cluster { +// TODO implement needsUpdate_ + /// Hold frame indices for a given cluster. class Node { public: @@ -14,8 +16,11 @@ class Node { // allowing Metric to be used. Metric needs to be non-const because // things like calculating RMSD modify Metric itself to avoid // always reallocating Frames. + /// CONSTRUCTOR - Take Metric for calculating centroid, frames, and cluster index. Node(Metric*, Cframes const&, int); + /// COPY CONSTRUCTOR Node(const Node&); + /// ASSIGNMENT Node& operator=(const Node&); /// Used to pair a representative frame number with a score. typedef std::pair RepPair; @@ -39,9 +44,11 @@ class Node { } /// Calculate average distance of all members to centroid double CalcAvgToCentroid( Metric*) const; - // Iterator over frame numbers + /// Const iterator over frame numbers typedef Cframes::const_iterator frame_iterator; + /// Const iterator to beginning of frames frame_iterator beginframe() const { return frameList_.begin(); } + /// Const iteratir to end of frames. frame_iterator endframe() const { return frameList_.end(); } /// \return Frame number at given index. int ClusterFrame(int idx) const { return frameList_[idx]; } @@ -67,6 +74,7 @@ class Node { /// Access representative frame list RepPairArray const& BestReps() const { return bestReps_; } RepPairArray& BestReps() { return bestReps_; } + /// Set cluster name and RMS to reference inline void SetNameAndRms(std::string const&, double); /// Sort internal frame list void SortFrameList(); @@ -82,7 +90,7 @@ class Node { Cframes frameList_; ///< List of frames belonging to this cluster. Centroid* centroid_; ///< Centroid of all frames in this cluster. std::string name_; ///< Cluster name assigned from reference. - RepPairArray bestReps_; + RepPairArray bestReps_; ///< Hold best representative frames and their score. double eccentricity_; ///< Maximum distance between any 2 frames. double refRms_; ///< Cluster rms to reference (if assigned). int num_; ///< Cluster number, used for bookkeeping. From d9bd74ef203763432c04ddb2313ba56074011e8e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 10:54:16 -0500 Subject: [PATCH 018/417] DRR - Cpptraj: Start adding a Control class which can be used to quarterback clustering --- src/Cluster/Control.cpp | 25 +++++++++++++++++++++++++ src/Cluster/Control.h | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/Cluster/Control.cpp create mode 100644 src/Cluster/Control.h diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp new file mode 100644 index 0000000000..b0804fa912 --- /dev/null +++ b/src/Cluster/Control.cpp @@ -0,0 +1,25 @@ +#include "Control.h" +#include "../CpptrajStdio.h" +#include "../DataSet_Coords.h" + +void Cpptraj::Cluster::Control::Help() { + mprintf("[crdset ]\n"); +} + +int Cpptraj::Cluster::Control::SetupForDataSets(DataSetList const& DSL, ArgList& analyzeArgs, + int verbose) +{ + // Attempt to get coords dataset from datasetlist + std::string setname = analyzeArgs.GetStringKey("crdset"); + if (!setname.empty()) { + DataSet_Coords* coords = (DataSet_Coords*)DSL.FindCoordsSet( setname ); + if (coords == 0) { + mprinterr("Error: Could not locate COORDS set corresponding to %s\n", + setname.c_str()); + return Analysis::ERR; + } + } + + + return 0; +} diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h new file mode 100644 index 0000000000..a98a687a33 --- /dev/null +++ b/src/Cluster/Control.h @@ -0,0 +1,26 @@ +#ifndef INC_CLUSTER_CONTROL_H +#define INC_CLUSTER_CONTROL_H +#include "List.h" +#include "PairwiseMatrix.h" +#include "Algorithm.h" +#include "../DataSet_Coords.h" +namespace Cpptraj { +namespace Cluster { + +/// Hold clusters, algorithm, and pairwise matrix. +class Control { + public: + Control() : pmatrix_(0), algorithm_(0) {} + + static void Help(); + + int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, int); + private: + List clusters_; + PairwiseMatrix* pmatrix_; + Algorithm* algorithm_; +}; + +} /** END namespace Cluster. */ +} /** END namespace Cpptraj. */ +#endif From e4f73b68546aacbeebf05f4574053f0c209fc05f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 10:54:35 -0500 Subject: [PATCH 019/417] DRR - Cpptraj: Slight reorganization of Metric and Pairwise. Add types for each. --- src/Cluster/Makefile | 1 + src/Cluster/Metric.h | 7 +++++++ src/Cluster/Metric_RMS.cpp | 1 + src/Cluster/Metric_RMS.h | 2 +- src/Cluster/PairwiseMatrix.cpp | 19 +++++++++++++++++++ src/Cluster/PairwiseMatrix.h | 8 +++++++- src/Cluster/PairwiseMatrix_MEM.h | 2 +- src/Cluster/clusterdepend | 3 ++- 8 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile index 09d334ffcd..2585b86a2e 100644 --- a/src/Cluster/Makefile +++ b/src/Cluster/Makefile @@ -5,6 +5,7 @@ include ../../config.h SOURCES= \ Algorithm_HierAgglo.cpp \ Centroid_Coord.cpp \ + Control.cpp \ List.cpp \ Metric_RMS.cpp \ Node.cpp \ diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 57be2da2d5..1b92ed7c6b 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -16,8 +16,13 @@ const int NOISE = -1; /// Abstract base class for calculating distance between points or determining centroid. class Metric { public: + enum Type { RMS=0, DME, SRMSD, DATA, DATA_EUCLID }; enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; typedef std::vector DsArray; // TODO should this be here? + + /// CONSTRUCTOR + Metric(Type t) { type_ = t; } + /// DESTRUCTOR virtual ~Metric() {} /// \return distance between given frames. virtual double FrameDist(int, int) = 0; @@ -39,6 +44,8 @@ class Metric { virtual unsigned int Ntotal() const = 0; protected: typedef double (*DistCalc)(double,double); + private: + Type type_; }; } // END namespace Cluster diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index d5e6310f40..1b67deb1e5 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -4,6 +4,7 @@ /// CONSTRUCTOR Cpptraj::Cluster::Metric_RMS::Metric_RMS(DataSet_Coords* dIn, AtomMask const& maskIn, bool nofit, bool useMass) : + Metric(RMS), coords_(dIn), mask_(maskIn), nofit_(nofit), diff --git a/src/Cluster/Metric_RMS.h b/src/Cluster/Metric_RMS.h index 524d4478a0..2cea8c522d 100644 --- a/src/Cluster/Metric_RMS.h +++ b/src/Cluster/Metric_RMS.h @@ -9,7 +9,7 @@ namespace Cluster { /// RMS cluster distance calc for Coords DataSet class Metric_RMS : public Metric { public: - Metric_RMS() : coords_(0), nofit_(false), useMass_(false) {} + Metric_RMS() : Metric(RMS), coords_(0), nofit_(false), useMass_(false) {} Metric_RMS(DataSet_Coords*,AtomMask const&,bool,bool); double FrameDist(int, int); double CentroidDist( Centroid*, Centroid* ); diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 31e4b1d544..e176ad4b21 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -3,6 +3,25 @@ #include #endif #include "../ProgressBar.h" +#include "../CpptrajStdio.h" +// Distance Metric classes +#include "Metric_RMS.h" + +Cpptraj::Cluster::PairwiseMatrix::PairwiseMatrix(Type t, Metric::Type mtype) : + type_(t) +{ + metric_ = AllocateMetric( mtype ); +} + +Cpptraj::Cluster::Metric* Cpptraj::Cluster::PairwiseMatrix::AllocateMetric(Metric::Type mtype) +{ + Metric* met = 0; + switch (mtype) { + case Metric::RMS : met = new Metric_RMS(); break; + default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); + } + return met; +} int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) { diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index dbee9fb390..a640474de1 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -7,7 +7,10 @@ namespace Cluster { /// Interface for calculating/caching pairwise distances according to a given metric. class PairwiseMatrix { public: - PairwiseMatrix() : metric_(0) {} + enum Type { MEM = 0, DISK, NOCACHE }; + + //PairwiseMatrix() : metric_(0) {} + PairwiseMatrix(Type, Metric::Type); virtual ~PairwiseMatrix() {} // ------------------------------------------- /// \return distance between given cached frames. @@ -30,6 +33,9 @@ class PairwiseMatrix { /// Internal routine used to cache pairwise distances. int CalcFrameDistances(Cframes const&); private: + static Metric* AllocateMetric(Metric::Type); + + Type type_; ///< The current pairwise type. Metric* metric_; ///< The current distance metric. }; diff --git a/src/Cluster/PairwiseMatrix_MEM.h b/src/Cluster/PairwiseMatrix_MEM.h index 39e533b93f..7fc918c8df 100644 --- a/src/Cluster/PairwiseMatrix_MEM.h +++ b/src/Cluster/PairwiseMatrix_MEM.h @@ -7,7 +7,7 @@ namespace Cluster { class PairwiseMatrix_MEM : public PairwiseMatrix { public: - PairwiseMatrix_MEM() {} + PairwiseMatrix_MEM(Metric::Type t) : PairwiseMatrix(MEM, t) {} // ------------------------------------------- double GetFdist(int f1, int f2) const { return Mat_.element(frameToMat_[f1], frameToMat_[f2]); } double Frame_Distance(int, int) const; diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 9a1c537dd1..c321ec1b18 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,7 +1,8 @@ Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../ClusterMatrix.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h +Control.o : Control.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Algorithm.h Centroid.h Control.h List.h Metric.h Node.h PairwiseMatrix.h List.o : List.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h Node.o : Node.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h Node.h PairwiseMatrix.h -PairwiseMatrix.o : PairwiseMatrix.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h +PairwiseMatrix.o : PairwiseMatrix.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../ProgressBar.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Metric.h Metric_RMS.h PairwiseMatrix.h PairwiseMatrix_MEM.o : PairwiseMatrix_MEM.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h PairwiseMatrix_MEM.h From ab2787f139a66bf4807f33e11fd2fec9ffed7da3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 13:15:48 -0500 Subject: [PATCH 020/417] DRR - Cpptraj: Start adding setup for COORDS DataSet --- src/Cluster/Control.cpp | 52 +++++++++++++++++++++++++++++++-------- src/Cluster/Control.h | 2 ++ src/Cluster/clusterdepend | 2 +- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index b0804fa912..c68c674fa0 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -1,25 +1,57 @@ #include "Control.h" #include "../CpptrajStdio.h" #include "../DataSet_Coords.h" +// PairwiseMatrix classes +#include "PairwiseMatrix_MEM.h" void Cpptraj::Cluster::Control::Help() { mprintf("[crdset ]\n"); } -int Cpptraj::Cluster::Control::SetupForDataSets(DataSetList const& DSL, ArgList& analyzeArgs, - int verbose) +int Cpptraj::Cluster::Control::allocatePairwise(ArgList& analyzeArgs, Metric::Type mtype) { - // Attempt to get coords dataset from datasetlist - std::string setname = analyzeArgs.GetStringKey("crdset"); - if (!setname.empty()) { - DataSet_Coords* coords = (DataSet_Coords*)DSL.FindCoordsSet( setname ); - if (coords == 0) { - mprinterr("Error: Could not locate COORDS set corresponding to %s\n", - setname.c_str()); - return Analysis::ERR; + PairwiseMatrix::Type pw_type = PairwiseMatrix::MEM; + std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); + if (!pw_typeString.empty()) { + if (pw_typeString == "mem") + pw_type = PairwiseMatrix::MEM; + else if (pw_typeString == "disk") + pw_type = PairwiseMatrix::DISK; + else if (pw_typeString == "none") + pw_type = PairwiseMatrix::NOCACHE; + else { + mprinterr("Error: Unrecognized option for 'pairwisecache' ('%s')\n", pw_typeString.c_str()); + return 1; } } + if (pmatrix_ != 0) delete pmatrix_; + pmatrix_ = 0; + switch (pw_type) { + case PairwiseMatrix::MEM : pmatrix_ = new PairwiseMatrix_MEM(mtype); break; + default: mprinterr("Error: Unhandled pairwise type.\n"); + } + if (pmatrix_ == 0) return 1; + return 0; +} +int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, ArgList& analyzeArgs, + int verbose) +{ + // Determine metric. Valid ones for COORDS are RMS, DMR, SRMSD + + int usedme = (int)analyzeArgs.hasKey("dme"); + int userms = (int)analyzeArgs.hasKey("rms"); + int usesrms = (int)analyzeArgs.hasKey("srmsd"); + if (usedme + userms + usesrms > 1) { + mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); + return 1; + } + Metric::Type mtype = Metric::RMS; // Default + if (usedme) mtype = Metric::DME; + else if (userms) mtype = Metric::RMS; + else if (usesrms) mtype = Metric::SRMSD; + if (allocatePairwise( analyzeArgs, mtype )) return 1; + return 0; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index a98a687a33..d5da8a9c1f 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -16,6 +16,8 @@ class Control { int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, int); private: + int allocatePairwise(ArgList&, Metric::Type); + List clusters_; PairwiseMatrix* pmatrix_; Algorithm* algorithm_; diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index c321ec1b18..519bf4c06b 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,6 +1,6 @@ Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../ClusterMatrix.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h -Control.o : Control.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Algorithm.h Centroid.h Control.h List.h Metric.h Node.h PairwiseMatrix.h +Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Algorithm.h Centroid.h Control.h List.h Metric.h Node.h PairwiseMatrix.h PairwiseMatrix_MEM.h List.o : List.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h Node.o : Node.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h Node.h PairwiseMatrix.h From 32eeb6eedd8eae7434815a29951049c2c318785f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 13:55:03 -0500 Subject: [PATCH 021/417] DRR - Cpptraj: Make Metric exist in Control instead of in PairwiseMatrix. --- src/Cluster/Control.cpp | 46 +++++++++++++++++++++++++------- src/Cluster/Control.h | 8 ++++-- src/Cluster/PairwiseMatrix.cpp | 19 +++---------- src/Cluster/PairwiseMatrix.h | 4 +-- src/Cluster/PairwiseMatrix_MEM.h | 2 +- 5 files changed, 49 insertions(+), 30 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index c68c674fa0..9f32895d40 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -3,13 +3,30 @@ #include "../DataSet_Coords.h" // PairwiseMatrix classes #include "PairwiseMatrix_MEM.h" +// Metric classes +#include "Metric_RMS.h" void Cpptraj::Cluster::Control::Help() { mprintf("[crdset ]\n"); } -int Cpptraj::Cluster::Control::allocatePairwise(ArgList& analyzeArgs, Metric::Type mtype) +/** \return pointer to PairwiseMatrix of specified type. */ +Cpptraj::Cluster::PairwiseMatrix* + Cpptraj::Cluster::Control::AllocatePairwise(PairwiseMatrix::Type ptype, Metric* metric) { + PairwiseMatrix* pmatrix = 0; + // TODO check for null metric + switch (ptype) { + case PairwiseMatrix::MEM : pmatrix = new PairwiseMatrix_MEM(metric); break; + default: mprinterr("Error: Unhandled PairwiseMatrix in AllocatePairwise.\n"); + } + return pmatrix; +} + +/** Set up PairwiseMatrix from arguments. */ +int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, Metric* metricIn) +{ + if (metricIn == 0) return 1; PairwiseMatrix::Type pw_type = PairwiseMatrix::MEM; std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); if (!pw_typeString.empty()) { @@ -25,21 +42,27 @@ int Cpptraj::Cluster::Control::allocatePairwise(ArgList& analyzeArgs, Metric::Ty } } if (pmatrix_ != 0) delete pmatrix_; - pmatrix_ = 0; - switch (pw_type) { - case PairwiseMatrix::MEM : pmatrix_ = new PairwiseMatrix_MEM(mtype); break; - default: mprinterr("Error: Unhandled pairwise type.\n"); - } + pmatrix_ = AllocatePairwise( pw_type, metricIn ); if (pmatrix_ == 0) return 1; return 0; } +/** /return Pointer to Metric of given type. */ +Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type mtype) +{ + Metric* met = 0; + switch (mtype) { + case Metric::RMS : met = new Metric_RMS(); break; + default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); + } + return met; +} +/** Set up clustering for a COORDS DataSet.*/ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, ArgList& analyzeArgs, int verbose) { - // Determine metric. Valid ones for COORDS are RMS, DMR, SRMSD - + // Determine metric. Valid ones for COORDS are RMS, DME, SRMSD int usedme = (int)analyzeArgs.hasKey("dme"); int userms = (int)analyzeArgs.hasKey("rms"); int usesrms = (int)analyzeArgs.hasKey("srmsd"); @@ -51,7 +74,12 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, ArgList if (usedme) mtype = Metric::DME; else if (userms) mtype = Metric::RMS; else if (usesrms) mtype = Metric::SRMSD; - if (allocatePairwise( analyzeArgs, mtype )) return 1; + if (metric_ != 0) delete metric_; + metric_ = 0; + metric_ = AllocateMetric( mtype ); + if (metric_ == 0) return 1; + + if (AllocatePairwise( analyzeArgs, metric_ )) return 1; return 0; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index d5da8a9c1f..74852c2d93 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -3,6 +3,7 @@ #include "List.h" #include "PairwiseMatrix.h" #include "Algorithm.h" +#include "Metric.h" #include "../DataSet_Coords.h" namespace Cpptraj { namespace Cluster { @@ -10,15 +11,18 @@ namespace Cluster { /// Hold clusters, algorithm, and pairwise matrix. class Control { public: - Control() : pmatrix_(0), algorithm_(0) {} + Control() : metric_(0), pmatrix_(0), algorithm_(0) {} static void Help(); int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, int); private: - int allocatePairwise(ArgList&, Metric::Type); + static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); + int AllocatePairwise(ArgList&, Metric*); + static Metric* AllocateMetric(Metric::Type); List clusters_; + Metric* metric_; PairwiseMatrix* pmatrix_; Algorithm* algorithm_; }; diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index e176ad4b21..03ff56ba76 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -7,21 +7,10 @@ // Distance Metric classes #include "Metric_RMS.h" -Cpptraj::Cluster::PairwiseMatrix::PairwiseMatrix(Type t, Metric::Type mtype) : - type_(t) -{ - metric_ = AllocateMetric( mtype ); -} - -Cpptraj::Cluster::Metric* Cpptraj::Cluster::PairwiseMatrix::AllocateMetric(Metric::Type mtype) -{ - Metric* met = 0; - switch (mtype) { - case Metric::RMS : met = new Metric_RMS(); break; - default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); - } - return met; -} +Cpptraj::Cluster::PairwiseMatrix::PairwiseMatrix(Type t, Metric* metric) : + type_(t), + metric_(metric) +{} int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) { diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index a640474de1..112c716d3d 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -10,7 +10,7 @@ class PairwiseMatrix { enum Type { MEM = 0, DISK, NOCACHE }; //PairwiseMatrix() : metric_(0) {} - PairwiseMatrix(Type, Metric::Type); + PairwiseMatrix(Type, Metric*); virtual ~PairwiseMatrix() {} // ------------------------------------------- /// \return distance between given cached frames. @@ -33,8 +33,6 @@ class PairwiseMatrix { /// Internal routine used to cache pairwise distances. int CalcFrameDistances(Cframes const&); private: - static Metric* AllocateMetric(Metric::Type); - Type type_; ///< The current pairwise type. Metric* metric_; ///< The current distance metric. }; diff --git a/src/Cluster/PairwiseMatrix_MEM.h b/src/Cluster/PairwiseMatrix_MEM.h index 7fc918c8df..e951e396cc 100644 --- a/src/Cluster/PairwiseMatrix_MEM.h +++ b/src/Cluster/PairwiseMatrix_MEM.h @@ -7,7 +7,7 @@ namespace Cluster { class PairwiseMatrix_MEM : public PairwiseMatrix { public: - PairwiseMatrix_MEM(Metric::Type t) : PairwiseMatrix(MEM, t) {} + PairwiseMatrix_MEM(Metric* m) : PairwiseMatrix(MEM, m) {} // ------------------------------------------- double GetFdist(int f1, int f2) const { return Mat_.element(frameToMat_[f1], frameToMat_[f2]); } double Frame_Distance(int, int) const; From 26984dfce258354ecfd7c530b96203fa3f7a83c9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 14:32:50 -0500 Subject: [PATCH 022/417] DRR - Cpptraj: Make Metric setup separate from allocation --- src/Cluster/Control.cpp | 24 ++++++++++++++++++++++-- src/Cluster/Control.h | 2 +- src/Cluster/Metric_RMS.cpp | 21 ++++++++++++--------- src/Cluster/Metric_RMS.h | 5 +++-- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 9f32895d40..883b33c5d7 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -59,10 +59,16 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type } /** Set up clustering for a COORDS DataSet.*/ -int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, ArgList& analyzeArgs, +int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, + std::string const& maskExpr, + ArgList& analyzeArgs, int verbose) { - // Determine metric. Valid ones for COORDS are RMS, DME, SRMSD + if (ds == 0) { + mprinterr("Internal Error: Control::SetupForCoordsDataSet() called with null DataSet.\n"); + return 1; + } + // Determine Metric. Valid ones for COORDS are RMS, DME, SRMSD int usedme = (int)analyzeArgs.hasKey("dme"); int userms = (int)analyzeArgs.hasKey("rms"); int usesrms = (int)analyzeArgs.hasKey("srmsd"); @@ -78,7 +84,21 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, ArgList metric_ = 0; metric_ = AllocateMetric( mtype ); if (metric_ == 0) return 1; + // Metric setup. + bool useMass = analyzeArgs.hasKey("mass"); + bool nofit = analyzeArgs.hasKey("nofit"); + + int err = 0; + switch (mtype) { + case Metric::RMS : + err = ((Metric_RMS*)metric_)->Setup(ds, AtomMask(maskExpr), nofit, useMass); break; + default: + mprinterr("Error: Unhandled Metric setup.\n"); + err = 1; + } + if (err != 0) return 1; + // Allocate PairwiseMatrix. if (AllocatePairwise( analyzeArgs, metric_ )) return 1; return 0; diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 74852c2d93..9203a1b674 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -15,7 +15,7 @@ class Control { static void Help(); - int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, int); + int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); private: static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); int AllocatePairwise(ArgList&, Metric*); diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index 1b67deb1e5..84f18e0381 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -1,17 +1,20 @@ #include "Metric_RMS.h" #include "Centroid_Coord.h" -/// CONSTRUCTOR -Cpptraj::Cluster::Metric_RMS::Metric_RMS(DataSet_Coords* dIn, AtomMask const& maskIn, - bool nofit, bool useMass) : - Metric(RMS), - coords_(dIn), - mask_(maskIn), - nofit_(nofit), - useMass_(useMass) +/** Set up the metric. */ +int Cpptraj::Cluster::Metric_RMS::Setup(DataSet_Coords* dIn, AtomMask const& maskIn, + bool nofit, bool useMass) { - frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms()); + // TODO better error handles + if (dIn == 0) return 1; + coords_ = dIn; + mask_ = maskIn; + nofit_ = nofit; + useMass_ = useMass; + + if (frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms())) return 1; frm2_ = frm1_; + return 0; } /** \return RMSD between two given frames. */ diff --git a/src/Cluster/Metric_RMS.h b/src/Cluster/Metric_RMS.h index 2cea8c522d..09f6276ee9 100644 --- a/src/Cluster/Metric_RMS.h +++ b/src/Cluster/Metric_RMS.h @@ -10,16 +10,17 @@ namespace Cluster { class Metric_RMS : public Metric { public: Metric_RMS() : Metric(RMS), coords_(0), nofit_(false), useMass_(false) {} - Metric_RMS(DataSet_Coords*,AtomMask const&,bool,bool); double FrameDist(int, int); double CentroidDist( Centroid*, Centroid* ); double FrameCentroidDist(int, Centroid*); void CalculateCentroid(Centroid*, Cframes const&); - void FrameOpCentroid(int, Centroid*, double, CentOpType); Centroid* NewCentroid(Cframes const&); Metric* Copy() { return new Metric_RMS( *this ); } + void FrameOpCentroid(int, Centroid*, double, CentOpType); std::string Description() const; unsigned int Ntotal() const { return (unsigned int)coords_->Size(); } + // ------------------------------------------- + int Setup(DataSet_Coords*, AtomMask const&, bool, bool); private: DataSet_Coords* coords_; AtomMask mask_; From e6bdf0fb4adf8296b48dfcb42725bdb8907eb32d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 14:44:42 -0500 Subject: [PATCH 023/417] DRR - Cpptraj: Handle algorithm allocation --- src/Cluster/Algorithm.h | 6 ++++- src/Cluster/Algorithm_HierAgglo.cpp | 1 + src/Cluster/Control.cpp | 40 +++++++++++++++++++++++++++-- src/Cluster/Control.h | 4 +++ 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index 3333c51c61..bc99ad1735 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -9,7 +9,9 @@ namespace Cluster { /// Abstract base class for implementing clustering algorithms. class Algorithm { public: - Algorithm() {} + enum Type { HIERAGGLO = 0, DBSCAN, DPEAKS, KMEANS }; + + Algorithm(Type t) : type_(t) {} virtual ~Algorithm() {} /// Set up clustering algorithm virtual int Setup(ArgList&) = 0; @@ -26,6 +28,8 @@ class Algorithm { void SetDebug(int d) { debug_ = d; } protected: int debug_; + private: + Type type_; }; } /* END namespace Cluster */ diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 6f624918ce..293708ff3f 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -4,6 +4,7 @@ #include "../ProgressBar.h" Cpptraj::Cluster::Algorithm_HierAgglo::Algorithm_HierAgglo() : + Algorithm(HIERAGGLO), nclusters_(-1), epsilon_(-1.0), linkage_(AVERAGELINK)//, diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 883b33c5d7..db9471ac40 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -5,6 +5,8 @@ #include "PairwiseMatrix_MEM.h" // Metric classes #include "Metric_RMS.h" +// Algorithms +#include "Algorithm_HierAgglo.h" void Cpptraj::Cluster::Control::Help() { mprintf("[crdset ]\n"); @@ -58,6 +60,34 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type return met; } +/** \return Pointer to Algorithm of given type. */ +Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algorithm::Type atype) +{ + Algorithm* alg = 0; + switch (atype) { + case Algorithm::HIERAGGLO : alg = new Algorithm_HierAgglo(); break; + default : mprinterr("Error: Unhandled Algorithm in AllocateAlgorithm.\n"); + } + return alg; +} + +/** Set up Algorithm from keyword. */ +int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { + Algorithm::Type atype; + if (analyzeArgs.hasKey("hieragglo")) atype = Algorithm::HIERAGGLO; + else if (analyzeArgs.hasKey("dbscan" )) atype = Algorithm::DBSCAN; + else if (analyzeArgs.hasKey("kmeans") || + analyzeArgs.hasKey("means") ) atype = Algorithm::KMEANS; + else { + mprintf("Warning: No clustering algorithm specified; defaulting to 'hieragglo'\n"); + atype = Algorithm::HIERAGGLO; + } + if (algorithm_ != 0) delete algorithm_; + algorithm_ = AllocateAlgorithm( atype ); + if (algorithm_ == 0) return 1; + return 0; +} + /** Set up clustering for a COORDS DataSet.*/ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, std::string const& maskExpr, @@ -96,10 +126,16 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, mprinterr("Error: Unhandled Metric setup.\n"); err = 1; } - if (err != 0) return 1; + if (err != 0) { + mprinterr("Error: Metric setup failed.\n"); + return 1; + } // Allocate PairwiseMatrix. - if (AllocatePairwise( analyzeArgs, metric_ )) return 1; + if (AllocatePairwise( analyzeArgs, metric_ )) { + mprinterr("Error: PairwiseMatrix setup failed.\n"); + return 1; + } return 0; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 9203a1b674..8bfb255af4 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -19,8 +19,12 @@ class Control { private: static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); int AllocatePairwise(ArgList&, Metric*); + static Metric* AllocateMetric(Metric::Type); + static Algorithm* AllocateAlgorithm(Algorithm::Type); + int AllocateAlgorithm(ArgList&); + List clusters_; Metric* metric_; PairwiseMatrix* pmatrix_; From ffdcd372aeac422ff9c04794d8ddb3b25df0c2b4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 15:01:23 -0500 Subject: [PATCH 024/417] DRR - Cpptraj: Add info to Metric --- src/Cluster/Control.cpp | 33 +++++++++++++++++++++------------ src/Cluster/Metric.h | 2 ++ src/Cluster/Metric_RMS.cpp | 15 +++++++++++++++ src/Cluster/Metric_RMS.h | 1 + src/Cluster/clusterdepend | 4 ++-- 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index db9471ac40..e081eaed67 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -49,17 +49,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, Metric* me return 0; } -/** /return Pointer to Metric of given type. */ -Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type mtype) -{ - Metric* met = 0; - switch (mtype) { - case Metric::RMS : met = new Metric_RMS(); break; - default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); - } - return met; -} - +// ----------------------------------------------------------------------------- /** \return Pointer to Algorithm of given type. */ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algorithm::Type atype) { @@ -71,7 +61,7 @@ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algori return alg; } -/** Set up Algorithm from keyword. */ +/** Set up Algorithm from keyword + arguments. */ int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { Algorithm::Type atype; if (analyzeArgs.hasKey("hieragglo")) atype = Algorithm::HIERAGGLO; @@ -85,9 +75,22 @@ int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { if (algorithm_ != 0) delete algorithm_; algorithm_ = AllocateAlgorithm( atype ); if (algorithm_ == 0) return 1; + if (algorithm_->Setup( analyzeArgs )) return 1; return 0; } +// ----------------------------------------------------------------------------- +/** /return Pointer to Metric of given type. */ +Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type mtype) +{ + Metric* met = 0; + switch (mtype) { + case Metric::RMS : met = new Metric_RMS(); break; + default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); + } + return met; +} + /** Set up clustering for a COORDS DataSet.*/ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, std::string const& maskExpr, @@ -137,5 +140,11 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, return 1; } + // Allocate algorithm + if (AllocateAlgorithm( analyzeArgs )) { + mprinterr("Error: Algorithm setup failed.\n"); + return 1; + } + return 0; } diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 1b92ed7c6b..e1e935f54a 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -40,6 +40,8 @@ class Metric { virtual void FrameOpCentroid(int, Centroid*, double, CentOpType) = 0; /// \return string containing description of the distance metric virtual std::string Description() const = 0; + /// Print Metric info to stdout. + virtual void Info() const = 0; /// \return total number of frames. virtual unsigned int Ntotal() const = 0; protected: diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index 84f18e0381..b7e453077c 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -1,5 +1,6 @@ #include "Metric_RMS.h" #include "Centroid_Coord.h" +#include "../CpptrajStdio.h" /** Set up the metric. */ int Cpptraj::Cluster::Metric_RMS::Setup(DataSet_Coords* dIn, AtomMask const& maskIn, @@ -113,3 +114,17 @@ std::string Cpptraj::Cluster::Metric_RMS::Description() const { if (useMass_) description.append(" mass"); return description; } + +void Cpptraj::Cluster::Metric_RMS::Info() const { + mprintf(" RMSD"); + if (mask_.MaskExpression() == "*") + mprintf(" (all atoms)"); + else + mprintf(" (mask '%s')", mask_.MaskString()); + if (useMass_) + mprintf(", mass-weighted"); + if (nofit_) + mprintf(", no fitting"); + else + mprintf(" best-fit"); +} diff --git a/src/Cluster/Metric_RMS.h b/src/Cluster/Metric_RMS.h index 09f6276ee9..88082da062 100644 --- a/src/Cluster/Metric_RMS.h +++ b/src/Cluster/Metric_RMS.h @@ -18,6 +18,7 @@ class Metric_RMS : public Metric { Metric* Copy() { return new Metric_RMS( *this ); } void FrameOpCentroid(int, Centroid*, double, CentOpType); std::string Description() const; + void Info() const; unsigned int Ntotal() const { return (unsigned int)coords_->Size(); } // ------------------------------------------- int Setup(DataSet_Coords*, AtomMask const&, bool, bool); diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 519bf4c06b..56a99ca364 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,8 +1,8 @@ Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../ClusterMatrix.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h -Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Algorithm.h Centroid.h Control.h List.h Metric.h Node.h PairwiseMatrix.h PairwiseMatrix_MEM.h +Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../ClusterMatrix.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../Vec3.h Algorithm.h Algorithm_HierAgglo.h Centroid.h Control.h List.h Metric.h Metric_RMS.h Node.h PairwiseMatrix.h PairwiseMatrix_MEM.h List.o : List.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h -Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h +Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h Node.o : Node.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h Node.h PairwiseMatrix.h PairwiseMatrix.o : PairwiseMatrix.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../ProgressBar.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Metric.h Metric_RMS.h PairwiseMatrix.h PairwiseMatrix_MEM.o : PairwiseMatrix_MEM.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h PairwiseMatrix_MEM.h From 0a2f9d7dea6271e5396db9e5a1a23a406521cf6a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 15:06:41 -0500 Subject: [PATCH 025/417] DRR - Cpptraj: Revise help. Not yet in final form. --- src/Cluster/Control.cpp | 12 ++++++++---- src/Cluster/Control.h | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index e081eaed67..7e07683c6c 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -8,10 +8,7 @@ // Algorithms #include "Algorithm_HierAgglo.h" -void Cpptraj::Cluster::Control::Help() { - mprintf("[crdset ]\n"); -} - +// ----------------------------------------------------------------------------- /** \return pointer to PairwiseMatrix of specified type. */ Cpptraj::Cluster::PairwiseMatrix* Cpptraj::Cluster::Control::AllocatePairwise(PairwiseMatrix::Type ptype, Metric* metric) @@ -25,6 +22,9 @@ Cpptraj::Cluster::PairwiseMatrix* return pmatrix; } +const char* Cpptraj::Cluster::Control::PairwiseArgs = + "pairwisecache {mem|disk|none}"; + /** Set up PairwiseMatrix from arguments. */ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, Metric* metricIn) { @@ -61,6 +61,9 @@ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algori return alg; } +const char* Cpptraj::Cluster::Control::AlgorithmArgs = + "{hieragglo|dbscan|kmeans|dpeaks"; + /** Set up Algorithm from keyword + arguments. */ int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { Algorithm::Type atype; @@ -68,6 +71,7 @@ int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { else if (analyzeArgs.hasKey("dbscan" )) atype = Algorithm::DBSCAN; else if (analyzeArgs.hasKey("kmeans") || analyzeArgs.hasKey("means") ) atype = Algorithm::KMEANS; + else if (analyzeArgs.hasKey("dpeaks" )) atype = Algorithm::DPEAKS; else { mprintf("Warning: No clustering algorithm specified; defaulting to 'hieragglo'\n"); atype = Algorithm::HIERAGGLO; diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 8bfb255af4..f5b29a7fb8 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -13,7 +13,8 @@ class Control { public: Control() : metric_(0), pmatrix_(0), algorithm_(0) {} - static void Help(); + static const char* PairwiseArgs; + static const char* AlgorithmArgs; int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); private: From 798fb0a06f5a431e3dbd0b34c6c9c38624332571 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 15:17:23 -0500 Subject: [PATCH 026/417] DRR - Cpptraj: Cluster Control Info. Create library target. --- src/Cluster/Control.cpp | 6 ++++++ src/Cluster/Control.h | 2 ++ src/Cluster/Makefile | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 7e07683c6c..ce14162f6e 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -152,3 +152,9 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, return 0; } + +// ----------------------------------------------------------------------------- +void Cpptraj::Cluster::Control::Info() const { + if (metric_ != 0) metric_->Info(); + if (algorithm_ != 0) algorithm_->Info(); +} diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index f5b29a7fb8..2672b8fdc1 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -17,6 +17,8 @@ class Control { static const char* AlgorithmArgs; int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); + + void Info() const; private: static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); int AllocatePairwise(ArgList&, Metric*); diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile index 2585b86a2e..db96e19e45 100644 --- a/src/Cluster/Makefile +++ b/src/Cluster/Makefile @@ -1,6 +1,11 @@ # Cpptraj Cluster Makefile include ../../config.h +# Variables +AR = ar cqs +DEL_FILE = /bin/rm -f +TARGET = libcpptraj_cluster.a + # Source files to be compiled SOURCES= \ Algorithm_HierAgglo.cpp \ @@ -16,7 +21,12 @@ SOURCES= \ OBJECTS=$(SOURCES:.cpp=.o) # Default target -all: $(OBJECTS) +all: $(TARGET) + +# Library target +$(TARGET): $(OBJECTS) + -$(DEL_FILE) $(TARGET) + $(AR) $(TARGET) $(OBJECTS) # Install all targets install: all @@ -33,7 +43,7 @@ depend: ../findDepend # Clean/uninstall targets clean: - /bin/rm -f $(OBJECTS) + $(DEL_FILE) $(OBJECTS) uninstall: clean From 800e05279b78b717e29bcfa03395fdb84fdf525b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 15:23:50 -0500 Subject: [PATCH 027/417] DRR - Cpptraj: Add cluster library. Still not sure this is the way I want to go since it's not really a standalone library - more a convenient way to keep things in a separate source directory. We'll see how it goes. --- src/Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index d7623f33d4..439dba8e5b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -11,6 +11,8 @@ AMBPDB_OBJECTS=$(AMBPDBSOURCES:.cpp=.o) CUDA_SOURCES=cuda_kernels/core_kernels.cu cuda_kernels/kernel_wrappers.cu +CLUSTER_TARGET=Cluster/libcpptraj_cluster.a + # Default target: cpptraj only all: cpptraj$(SFX)$(EXE) @@ -21,8 +23,8 @@ install: $(INSTALL_TARGETS) install_cpptraj: cpptraj$(SFX)$(EXE) mv cpptraj$(SFX)$(EXE) $(CPPTRAJBIN) -cpptraj$(SFX)$(EXE): $(OBJECTS) $(FFT_TARGET) $(READLINE_TARGET) $(CUDA_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) - $(CXX) -o cpptraj$(SFX)$(EXE) $(OBJECTS) $(CUDA_TARGET) $(FFT_TARGET) $(READLINE_LIB) $(CPPTRAJ_LIB) $(LDFLAGS) +cpptraj$(SFX)$(EXE): $(OBJECTS) $(FFT_TARGET) $(READLINE_TARGET) $(CUDA_TARGET) $(CLUSTER_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) + $(CXX) -o cpptraj$(SFX)$(EXE) $(OBJECTS) $(CUDA_TARGET) $(CLUSTER_TARGET) $(FFT_TARGET) $(READLINE_LIB) $(CPPTRAJ_LIB) $(LDFLAGS) # AmbPDB ------------------------------- install_ambpdb: ambpdb$(EXE) @@ -38,8 +40,8 @@ ambpdb$(EXE): $(AMBPDB_OBJECTS) $(XDRFILE_TARGET) libcpptraj: $(LIBCPPTRAJ_TARGET) -$(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX): $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) - $(CXX) -shared -o $(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX) $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(CPPTRAJ_LIB) $(LDFLAGS) +$(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX): $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) $(CLUSTER_TARGET) + $(CXX) -shared -o $(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX) $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(CPPTRAJ_LIB) $(CLUSTER_TARGET) $(LDFLAGS) nolibcpptraj: @echo "" @@ -82,6 +84,9 @@ noarpack: cuda_kernels/libcpptraj_cuda.a: $(CUDA_SOURCES) cd cuda_kernels && $(MAKE) all +Cluster/libcpptraj_cluster.a: + cd Cluster && $(MAKE) all + # Dependency targets findDepend: FindDepend.o $(CXX) -o findDepend FindDepend.o From 2e0b590a8fecef2cb1720e92ceab62a427a69ac5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 16:06:25 -0500 Subject: [PATCH 028/417] DRR - Cpptraj: Calculate initial cluster distances. --- src/Cluster/Algorithm_HierAgglo.cpp | 81 ++++++++++++++++++++++++++++- src/Cluster/Algorithm_HierAgglo.h | 5 +- 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 293708ff3f..e6b892d5c5 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -107,7 +107,23 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, buildInitialClusters(clusters, framesToCluster, pmatrix.MetricPtr()); mprintf("\t%i initial clusters.\n", clusters.Nclusters()); // Build initial cluster distance matrix. - InitializeClusterDistances(); + ClusterDistances_.SetupMatrix( clusters.Nclusters() ); + double dval = -1.0; + for (List::cluster_it C1_it = clusters.begin(); C1_it != clusters.end(); C1_it++) + { + List::cluster_it C2_it = C1_it; + C2_it++; + for(; C2_it != clusters.end(); C2_it++) + { + switch (linkage_) { + case SINGLELINK : dval = minDist(*C1_it, *C2_it, pmatrix); break; + case COMPLETELINK : dval = maxDist(*C1_it, *C2_it, pmatrix); break; + case AVERAGELINK : dval = avgDist(*C1_it, *C2_it, pmatrix); break; + } + ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), dval ); + } + } + //InitializeClusterDistances(); // DEBUG - print initial clusters if (debug_ > 1) clusters.PrintClusters(); @@ -210,6 +226,60 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters, Pairwise return 0; } +/** \return The shortest distance between any two points in C1 and C2. */ +double Cpptraj::Cluster::Algorithm_HierAgglo::minDist(Node const& C1, + Node const& C2, + PairwiseMatrix const& pmatrix) +{ + double min = std::numeric_limits::max(); + for (Node::frame_iterator c1frames = C1.beginframe(); c1frames != C1.endframe(); ++c1frames) + { + for (Node::frame_iterator c2frames = C2.beginframe(); c2frames != C2.endframe(); ++c2frames) + { + double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); + if ( Dist < min ) min = Dist; + } + } + return min; +} + +/** \return The longest distance between any two points in C1 and C2. */ +double Cpptraj::Cluster::Algorithm_HierAgglo::maxDist(Node const& C1, + Node const& C2, + PairwiseMatrix const& pmatrix) +{ + double max = -1.0; + for (Node::frame_iterator c1frames = C1.beginframe(); c1frames != C1.endframe(); ++c1frames) + { + for (Node::frame_iterator c2frames = C2.beginframe(); c2frames != C2.endframe(); ++c2frames) + { + double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); + if ( Dist > max ) max = Dist; + } + } + return max; +} + +/** \return The average distance between points in C1 and C2. */ +double Cpptraj::Cluster::Algorithm_HierAgglo::avgDist(Node const& C1, + Node const& C2, + PairwiseMatrix const& pmatrix) +{ + double sum = 0.0; + for (Node::frame_iterator c1frames = C1.beginframe(); c1frames != C1.endframe(); ++c1frames) + { + for (Node::frame_iterator c2frames = C2.beginframe(); c2frames != C2.endframe(); ++c2frames) + { + double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); + sum += Dist; + } + } + return sum / (double)(C1.Nframes() * C2.Nframes()); +} + /** Calculate the minimum distance between frames in cluster specified by * iterator C1 and frames in all other clusters. */ @@ -221,6 +291,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMinDist(List::cluster_it& C1_it, C2_it != clusters.end(); ++C2_it) { if (C2_it == C1_it) continue; +/* //mprintf("\t\tRecalc distance between %i and %i:\n",C1,newc2); // Pick the minimum distance between newc2 and C1 double min = std::numeric_limits::max(); @@ -237,6 +308,8 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMinDist(List::cluster_it& C1_it, if ( Dist < min ) min = Dist; } } +*/ + double min = minDist(*C1_it, *C2_it, pmatrix); //mprintf("\t\tMin distance between %i and %i: %f\n",C1,newc2,min); ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), min ); } @@ -253,6 +326,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMaxDist(List::cluster_it& C1_it, C2_it != clusters.end(); ++C2_it) { if (C2_it == C1_it) continue; +/* //mprintf("\t\tRecalc distance between %i and %i:\n",C1,newc2); // Pick the maximum distance between newc2 and C1 double max = -1.0; @@ -269,6 +343,8 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMaxDist(List::cluster_it& C1_it, if ( Dist > max ) max = Dist; } } +*/ + double max = maxDist( *C1_it, *C2_it, pmatrix ); //mprintf("\t\tMax distance between %i and %i: %f\n",C1,newc2,max); ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), max ); } @@ -285,6 +361,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcAvgDist(List::cluster_it& C1_it, C2_it != clusters.end(); ++C2_it) { if (C2_it == C1_it) continue; +/* //mprintf("\t\tRecalc distance between %i and %i:\n",(*C1_it).Num(),(*C2_it).Num()); // Pick the minimum distance between newc2 and C1 double sumDist = 0; @@ -302,6 +379,8 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcAvgDist(List::cluster_it& C1_it, } } double Dist = sumDist / (double)(C1_it->Nframes() * C2_it->Nframes()); +*/ + double Dist = avgDist( *C1_it, *C2_it, pmatrix ); //mprintf("\t\tAvg distance between %i and %i: %f\n",(*C1_it).Num(),(*C2_it).Num(),Dist); ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), Dist ); } diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index 0a60718c22..ed64f28209 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -18,8 +18,11 @@ class Algorithm_HierAgglo : public Algorithm { void Timing(double) const; private: void buildInitialClusters(List&, Cframes const&, Metric*); - void InitializeClusterDistances(); + //void InitializeClusterDistances(); int MergeClosest(List&, PairwiseMatrix const&); + static inline double minDist(Node const&, Node const&, PairwiseMatrix const&); + static inline double maxDist(Node const&, Node const&, PairwiseMatrix const&); + static inline double avgDist(Node const&, Node const&, PairwiseMatrix const&); void calcMinDist(List::cluster_it&, List&, PairwiseMatrix const&); void calcMaxDist(List::cluster_it&, List&, PairwiseMatrix const&); void calcAvgDist(List::cluster_it&, List&, PairwiseMatrix const&); From f04343bf15d1097711a67addfbb82c8755227cb7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 18 Jan 2019 16:07:13 -0500 Subject: [PATCH 029/417] DRR - Cpptraj: Test cluster command, cluster2 --- src/Analysis_Cluster.cpp | 44 ++++++++++++++++++++++++++++++++++++++++ src/Analysis_Cluster.h | 22 ++++++++++++++++++++ src/Command.cpp | 2 ++ src/cpptrajdepend | 3 ++- src/cpptrajfiles | 1 + 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 src/Analysis_Cluster.cpp create mode 100644 src/Analysis_Cluster.h diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp new file mode 100644 index 0000000000..71721216e2 --- /dev/null +++ b/src/Analysis_Cluster.cpp @@ -0,0 +1,44 @@ +#include "Analysis_Cluster.h" +#include "CpptrajStdio.h" + +using namespace Cpptraj::Cluster; + +// Analysis_Cluster::Help() +void Analysis_Cluster::Help() const { + +} + +// Analysis_Cluster::Setup() +Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& setup, int debugIn) +{ + // Attempt to get coords dataset from datasetlist + std::string setname = analyzeArgs.GetStringKey("crdset"); + coords_ = (DataSet_Coords*)setup.DSL().FindCoordsSet( setname ); + if (coords_ == 0) { + mprinterr("Error: Could not locate COORDS set corresponding to %s\n", + setname.c_str()); + return Analysis::ERR; + } + + // Get the mask string + std::string maskexpr = analyzeArgs.GetMaskNext(); + /*if (!refs_.empty() && refmaskexpr_.empty()) { + refmaskexpr_ = maskexpr_; + if (refmaskexpr_.empty()) { + refmaskexpr_.assign("!@H="); + mprintf("Warning: 'assignrefs' specified but no 'refmask' given.\n" + "Warning: Using default mask expression: '%s'\n", refmaskexpr_.c_str()); + } + }*/ + + + control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, debugIn); + + return Analysis::OK; + +} + +// Analysis_Cluster::Analyze() +Analysis::RetType Analysis_Cluster::Analyze() { + return Analysis::ERR; +} diff --git a/src/Analysis_Cluster.h b/src/Analysis_Cluster.h new file mode 100644 index 0000000000..8e66ce8e62 --- /dev/null +++ b/src/Analysis_Cluster.h @@ -0,0 +1,22 @@ +#ifndef INC_ANALYSIS_CLUSTER_H +#define INC_ANALYSIS_CLUSTER_H +#include "Analysis.h" +#include "Cluster/Control.h" +#include "DataSet_Coords.h" +/// +class Analysis_Cluster : public Analysis { + public: + Analysis_Cluster() : Analysis(HIDDEN) {} + DispatchObject* Alloc() const { return (DispatchObject*)new Analysis_Cluster(); } + void Help() const; + + Analysis::RetType Setup(ArgList&, AnalysisSetup&, int); + Analysis::RetType Analyze(); + private: + Cpptraj::Cluster::Control control_; + + DataSet_Coords* coords_; + + +}; +#endif diff --git a/src/Command.cpp b/src/Command.cpp index f71b5693aa..2f2bed0581 100644 --- a/src/Command.cpp +++ b/src/Command.cpp @@ -174,6 +174,7 @@ #include "Analysis_Multicurve.h" #include "Analysis_TI.h" #include "Analysis_ConstantPHStats.h" +#include "Analysis_Cluster.h" CmdList Command::commands_ = CmdList(); @@ -354,6 +355,7 @@ void Command::Init() { Command::AddCmd( new Analysis_AutoCorr(), Cmd::ANA, 1, "autocorr" ); Command::AddCmd( new Analysis_Average(), Cmd::ANA, 1, "avg" ); Command::AddCmd( new Analysis_State(), Cmd::ANA, 1, "calcstate" ); + Command::AddCmd( new Analysis_Cluster(), Cmd::ANA, 1, "cluster2" ); // HIDDEN Command::AddCmd( new Analysis_Clustering(), Cmd::ANA, 1, "cluster" ); Command::AddCmd( new Analysis_Corr(), Cmd::ANA, 2, "corr", "correlationcoe" ); Command::AddCmd( new Analysis_ConstantPHStats,Cmd::ANA,1, "cphstats" ); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index da9e8ee14b..49771c3934 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,6 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Clustering.o : Analysis_Clustering.cpp ActionFrameCounter.h ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h Cluster_DPeaks.h Cluster_HierAgglo.h Cluster_Kmeans.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -153,7 +154,7 @@ Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedDa Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index c595430641..336c3465e6 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -89,6 +89,7 @@ COMMON_SOURCES=ActionFrameCounter.cpp \ Analysis_AutoCorr.cpp \ Analysis_Average.cpp \ Analysis_Clustering.cpp \ + Analysis_Cluster.cpp \ Analysis_Corr.cpp \ Analysis_ConstantPHStats.cpp \ Analysis_CrankShaft.cpp \ From 066ec8731d6791483ef6103d1815c79fe6e9864b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 19 Jan 2019 21:50:13 -0500 Subject: [PATCH 030/417] DRR - Cpptraj: Don't use separate library --- src/Makefile | 16 ++++++++-------- src/cpptrajdepend | 8 ++++++++ src/cpptrajfiles | 14 +++++++++++++- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/Makefile b/src/Makefile index 439dba8e5b..712db94237 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,7 +3,7 @@ include ../config.h include cpptrajfiles -OBJECTS=$(SOURCES:.cpp=.o) $(CSOURCES:.c=.o) +OBJECTS=$(SOURCES:.cpp=.o) $(CSOURCES:.c=.o) include ambpdbfiles @@ -11,7 +11,7 @@ AMBPDB_OBJECTS=$(AMBPDBSOURCES:.cpp=.o) CUDA_SOURCES=cuda_kernels/core_kernels.cu cuda_kernels/kernel_wrappers.cu -CLUSTER_TARGET=Cluster/libcpptraj_cluster.a +#CLUSTER_TARGET=Cluster/libcpptraj_cluster.a # Default target: cpptraj only all: cpptraj$(SFX)$(EXE) @@ -23,8 +23,8 @@ install: $(INSTALL_TARGETS) install_cpptraj: cpptraj$(SFX)$(EXE) mv cpptraj$(SFX)$(EXE) $(CPPTRAJBIN) -cpptraj$(SFX)$(EXE): $(OBJECTS) $(FFT_TARGET) $(READLINE_TARGET) $(CUDA_TARGET) $(CLUSTER_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) - $(CXX) -o cpptraj$(SFX)$(EXE) $(OBJECTS) $(CUDA_TARGET) $(CLUSTER_TARGET) $(FFT_TARGET) $(READLINE_LIB) $(CPPTRAJ_LIB) $(LDFLAGS) +cpptraj$(SFX)$(EXE): $(OBJECTS) $(FFT_TARGET) $(READLINE_TARGET) $(CUDA_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) + $(CXX) -o cpptraj$(SFX)$(EXE) $(OBJECTS) $(CUDA_TARGET) $(FFT_TARGET) $(READLINE_LIB) $(CPPTRAJ_LIB) $(LDFLAGS) # AmbPDB ------------------------------- install_ambpdb: ambpdb$(EXE) @@ -40,8 +40,8 @@ ambpdb$(EXE): $(AMBPDB_OBJECTS) $(XDRFILE_TARGET) libcpptraj: $(LIBCPPTRAJ_TARGET) -$(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX): $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) $(CLUSTER_TARGET) - $(CXX) -shared -o $(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX) $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(CPPTRAJ_LIB) $(CLUSTER_TARGET) $(LDFLAGS) +$(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX): $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) + $(CXX) -shared -o $(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX) $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(CPPTRAJ_LIB) $(LDFLAGS) nolibcpptraj: @echo "" @@ -84,8 +84,8 @@ noarpack: cuda_kernels/libcpptraj_cuda.a: $(CUDA_SOURCES) cd cuda_kernels && $(MAKE) all -Cluster/libcpptraj_cluster.a: - cd Cluster && $(MAKE) all +#Cluster/libcpptraj_cluster.a: +# cd Cluster && $(MAKE) all # Dependency targets findDepend: FindDepend.o diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 49771c3934..b3c2fb980e 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -140,6 +140,14 @@ BufferedLine.o : BufferedLine.cpp BufferedLine.h CpptrajFile.h CpptrajStdio.h Fi ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Metric.h Cluster/Metric_RMS.h +Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h +Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterList.o : ClusterList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 336c3465e6..13c2da1c73 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -1,6 +1,18 @@ +# Files related to new clustering code +CLUSTER_SOURCES= \ + Cluster/Algorithm_HierAgglo.cpp \ + Cluster/Centroid_Coord.cpp \ + Cluster/Control.cpp \ + Cluster/List.cpp \ + Cluster/Metric_RMS.cpp \ + Cluster/Node.cpp \ + Cluster/PairwiseMatrix.cpp \ + Cluster/PairwiseMatrix_MEM.cpp + # These files are common to cpptraj/libcpptraj. Files that need to be built # differently for each will go into SOURCES/LIBCPPTRAJ_OBJECTS respectively. -COMMON_SOURCES=ActionFrameCounter.cpp \ +COMMON_SOURCES= $(CLUSTER_SOURCES) \ + ActionFrameCounter.cpp \ ActionList.cpp \ Action_Align.cpp \ Action_Angle.cpp \ From 75dee31c91bb9ac2ace1cc1f172b36a299b64986 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 19 Jan 2019 22:26:55 -0500 Subject: [PATCH 031/417] DRR - Cpptraj: Fix info print --- src/Cluster/Control.cpp | 2 ++ src/Cluster/Metric_RMS.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index ce14162f6e..cd65efc0bb 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -150,6 +150,8 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, return 1; } + Info(); + return 0; } diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index b7e453077c..adf0f88da9 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -116,7 +116,7 @@ std::string Cpptraj::Cluster::Metric_RMS::Description() const { } void Cpptraj::Cluster::Metric_RMS::Info() const { - mprintf(" RMSD"); + mprintf("\tMetric: RMSD"); if (mask_.MaskExpression() == "*") mprintf(" (all atoms)"); else @@ -127,4 +127,5 @@ void Cpptraj::Cluster::Metric_RMS::Info() const { mprintf(", no fitting"); else mprintf(" best-fit"); + mprintf("\n"); } From 57492399be557ef1313acd7f13844a2e16852530 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 19 Jan 2019 23:27:19 -0500 Subject: [PATCH 032/417] DRR - CPptraj: Try to run --- src/Analysis_Cluster.cpp | 5 ++++- src/Cluster/Control.cpp | 15 +++++++++++++++ src/Cluster/Control.h | 1 + src/Cluster/Metric_RMS.cpp | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 71721216e2..0ad83fc90d 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -40,5 +40,8 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s // Analysis_Cluster::Analyze() Analysis::RetType Analysis_Cluster::Analyze() { - return Analysis::ERR; + int err = control_.Run(); + if (err != 0) + return Analysis::ERR; + return Analysis::OK; } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index cd65efc0bb..790bc9d46f 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -160,3 +160,18 @@ void Cpptraj::Cluster::Control::Info() const { if (metric_ != 0) metric_->Info(); if (algorithm_ != 0) algorithm_->Info(); } + +int Cpptraj::Cluster::Control::Run() { + // Figure out which frames to cluster TODO sieve + Cframes framesToCluster; + for (unsigned int i = 0; i < metric_->Ntotal(); i++) + framesToCluster.push_back( i ); + + // Cache distances if necessary + pmatrix_->CacheDistances( framesToCluster ); + + // Cluster + int err = algorithm_->DoClustering(clusters_, framesToCluster, *pmatrix_); + + return err; +} diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 2672b8fdc1..b8c7cabf0d 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -19,6 +19,7 @@ class Control { int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); void Info() const; + int Run(); private: static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); int AllocatePairwise(ArgList&, Metric*); diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index adf0f88da9..3fc21d94ae 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -15,6 +15,7 @@ int Cpptraj::Cluster::Metric_RMS::Setup(DataSet_Coords* dIn, AtomMask const& mas if (frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms())) return 1; frm2_ = frm1_; + mprintf("DEBUG: Setup\n"); return 0; } From 7504a610c4c02f315e5fc660d2fee25caa0b1be9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 21 Jan 2019 19:23:30 -0500 Subject: [PATCH 033/417] DRR - Cpptraj: Add debug info. Split metric setup into Init/Setup --- src/Cluster/Control.cpp | 9 ++++++++- src/Cluster/Metric.h | 2 ++ src/Cluster/Metric_RMS.cpp | 28 +++++++++++++++++++++++----- src/Cluster/Metric_RMS.h | 3 ++- src/Cluster/PairwiseMatrix.cpp | 1 + src/Cluster/PairwiseMatrix_MEM.cpp | 7 +++++++ src/Matrix.h | 2 ++ 7 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 790bc9d46f..dea0643e31 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -128,7 +128,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, int err = 0; switch (mtype) { case Metric::RMS : - err = ((Metric_RMS*)metric_)->Setup(ds, AtomMask(maskExpr), nofit, useMass); break; + err = ((Metric_RMS*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass); break; default: mprinterr("Error: Unhandled Metric setup.\n"); err = 1; @@ -137,6 +137,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, mprinterr("Error: Metric setup failed.\n"); return 1; } + mprintf("DEBUG: metric memory: %x\n", metric_); // Allocate PairwiseMatrix. if (AllocatePairwise( analyzeArgs, metric_ )) { @@ -162,6 +163,12 @@ void Cpptraj::Cluster::Control::Info() const { } int Cpptraj::Cluster::Control::Run() { + // Set up the Metric + if (metric_->Setup()) { + mprinterr("Error: Metric setup failed.\n"); + return 1; + } + // Figure out which frames to cluster TODO sieve Cframes framesToCluster; for (unsigned int i = 0; i < metric_->Ntotal(); i++) diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index e1e935f54a..92ee5c079a 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -24,6 +24,8 @@ class Metric { Metric(Type t) { type_ = t; } /// DESTRUCTOR virtual ~Metric() {} + /// Set up the Metric prior to clustering. + virtual int Setup() = 0; /// \return distance between given frames. virtual double FrameDist(int, int) = 0; /// \return distance between given centroids. diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index 3fc21d94ae..033352870d 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -3,30 +3,48 @@ #include "../CpptrajStdio.h" /** Set up the metric. */ -int Cpptraj::Cluster::Metric_RMS::Setup(DataSet_Coords* dIn, AtomMask const& maskIn, +int Cpptraj::Cluster::Metric_RMS::Init(DataSet_Coords* dIn, AtomMask const& maskIn, bool nofit, bool useMass) { // TODO better error handles - if (dIn == 0) return 1; + if (dIn == 0) { + mprinterr("Internal Error: Metric_RMS::Init() called with null data set.\n"); + return 1; + } + mprintf("DEBUG: Init RMS metric for '%s', mask '%s', nofit=%i, usemass=%i\n", + dIn->legend(), maskIn.MaskString(), (int)nofit, (int)useMass); coords_ = dIn; mask_ = maskIn; nofit_ = nofit; useMass_ = useMass; + return 0; +} + +int Cpptraj::Cluster::Metric_RMS::Setup() { if (frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms())) return 1; frm2_ = frm1_; - mprintf("DEBUG: Setup\n"); + mprintf("DEBUG: Setup RMS metric for %i atoms, %zu frames.\n", frm1_.Natom(), coords_->Size()); return 0; } /** \return RMSD between two given frames. */ double Cpptraj::Cluster::Metric_RMS::FrameDist(int f1, int f2) { coords_->GetFrame( f1, frm1_, mask_ ); + frm1_.printAtomCoord(0); coords_->GetFrame( f2, frm2_, mask_ ); + frm2_.printAtomCoord(0); + //if (nofit_) + // return frm1_.RMSD_NoFit( frm2_, useMass_ ); + //else + // return frm1_.RMSD( frm2_, useMass_ ); + double rms; if (nofit_) - return frm1_.RMSD_NoFit( frm2_, useMass_ ); + rms = frm1_.RMSD_NoFit( frm2_, useMass_ ); else - return frm1_.RMSD( frm2_, useMass_ ); + rms = frm1_.RMSD( frm2_, useMass_ ); + mprintf("\tMetric_RMS::FrameDist(%i, %i)= %g\n", f1, f2, rms); + return rms; } /** \return RMSD between two given centroids. */ diff --git a/src/Cluster/Metric_RMS.h b/src/Cluster/Metric_RMS.h index 88082da062..da2f9bb096 100644 --- a/src/Cluster/Metric_RMS.h +++ b/src/Cluster/Metric_RMS.h @@ -10,6 +10,7 @@ namespace Cluster { class Metric_RMS : public Metric { public: Metric_RMS() : Metric(RMS), coords_(0), nofit_(false), useMass_(false) {} + int Setup(); double FrameDist(int, int); double CentroidDist( Centroid*, Centroid* ); double FrameCentroidDist(int, Centroid*); @@ -21,7 +22,7 @@ class Metric_RMS : public Metric { void Info() const; unsigned int Ntotal() const { return (unsigned int)coords_->Size(); } // ------------------------------------------- - int Setup(DataSet_Coords*, AtomMask const&, bool, bool); + int Init(DataSet_Coords*, AtomMask const&, bool, bool); private: DataSet_Coords* coords_; AtomMask mask_; diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 03ff56ba76..c984b5f45f 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -20,6 +20,7 @@ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesTo int f1, f2; // For OMP, every other thread will need its own Cdist. Metric* MyMetric = metric_; + mprintf("DEBUG: PairwiseMatrix::CalcFrameDistances(): MyMetric= %x\n", MyMetric); # ifdef _OPENMP # pragma omp parallel private(MyMetric, f1, f2) firstprivate(progress) { diff --git a/src/Cluster/PairwiseMatrix_MEM.cpp b/src/Cluster/PairwiseMatrix_MEM.cpp index c102b5b1f6..5774e9619a 100644 --- a/src/Cluster/PairwiseMatrix_MEM.cpp +++ b/src/Cluster/PairwiseMatrix_MEM.cpp @@ -1,4 +1,5 @@ #include "PairwiseMatrix_MEM.h" +#include "../CpptrajStdio.h" // DEBUG /** \return distance between frames (cached or uncached). */ double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) const { @@ -16,9 +17,15 @@ double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) cons /** Requests that distances between given frames be cached in memory. */ int Cpptraj::Cluster::PairwiseMatrix_MEM::CacheDistances(Cframes const& framesToCache) { Mat_.resize(0, framesToCache.size()); + mprintf("DEBUG: PairwiseMatrix_MEM set up for %i rows, size= %zu bytes.\n", + Mat_.Nrows(), Mat_.sizeInBytes()); frameToMat_.assign(DistMetric().Ntotal(), -1); int idx = 0; for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) frameToMat_[*it] = idx++; + // DEBUG + mprintf("DEBUG: frameToMat\n"); + for (Cframes_it it = frameToMat_.begin(); it != frameToMat_.end(); ++it) + mprintf("\tframeToMat_[%u] = %i\n", it - frameToMat_.begin(), *it); return CalcFrameDistances( framesToCache ); } diff --git a/src/Matrix.h b/src/Matrix.h index 2443e88402..ec9f3974bd 100644 --- a/src/Matrix.h +++ b/src/Matrix.h @@ -27,6 +27,8 @@ template class Matrix { //MType Type() const { return type_; } /// \return estimated size in bytes. static size_t sizeInBytes(size_t,size_t); + /// \return current size in bytes. + size_t sizeInBytes() const { return sizeInBytes(Ncols(), Nrows()); } /// Set up matrix for given number of cols and rows. int resize(size_t,size_t); /// \return element at specified col and row. From 5480276c625b5866187e65951292c20470a39454 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 21 Jan 2019 19:34:28 -0500 Subject: [PATCH 034/417] DRR - Cpptraj: Add mask setup --- src/Cluster/Metric_RMS.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index 033352870d..d32687e42d 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -2,7 +2,7 @@ #include "Centroid_Coord.h" #include "../CpptrajStdio.h" -/** Set up the metric. */ +/** Initialize the metric. */ int Cpptraj::Cluster::Metric_RMS::Init(DataSet_Coords* dIn, AtomMask const& maskIn, bool nofit, bool useMass) { @@ -21,7 +21,11 @@ int Cpptraj::Cluster::Metric_RMS::Init(DataSet_Coords* dIn, AtomMask const& mask return 0; } +/** Set up the metric. */ int Cpptraj::Cluster::Metric_RMS::Setup() { + if (coords_->Top().SetupIntegerMask( mask_ )) return 1; + mprintf("DEBUG: RMS metric topology: %s %s %i\n", coords_->legend(), + coords_->Top().c_str(), coords_->Top().Natom()); if (frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms())) return 1; frm2_ = frm1_; mprintf("DEBUG: Setup RMS metric for %i atoms, %zu frames.\n", frm1_.Natom(), coords_->Size()); From 6bcff135807ee745f171206d7f6e1d4115a01003 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 21 Jan 2019 19:40:25 -0500 Subject: [PATCH 035/417] DRR - Cpptraj: Hide some debug info behind ifdef --- src/Cluster/Metric_RMS.cpp | 15 +++++++++------ src/Cluster/PairwiseMatrix_MEM.cpp | 6 ++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index d32687e42d..683b026423 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -35,20 +35,23 @@ int Cpptraj::Cluster::Metric_RMS::Setup() { /** \return RMSD between two given frames. */ double Cpptraj::Cluster::Metric_RMS::FrameDist(int f1, int f2) { coords_->GetFrame( f1, frm1_, mask_ ); - frm1_.printAtomCoord(0); coords_->GetFrame( f2, frm2_, mask_ ); - frm2_.printAtomCoord(0); - //if (nofit_) - // return frm1_.RMSD_NoFit( frm2_, useMass_ ); - //else - // return frm1_.RMSD( frm2_, useMass_ ); +# ifdef DEBUG_CLUSTER double rms; + frm1_.printAtomCoord(0); + frm2_.printAtomCoord(0); if (nofit_) rms = frm1_.RMSD_NoFit( frm2_, useMass_ ); else rms = frm1_.RMSD( frm2_, useMass_ ); mprintf("\tMetric_RMS::FrameDist(%i, %i)= %g\n", f1, f2, rms); return rms; +# else + if (nofit_) + return frm1_.RMSD_NoFit( frm2_, useMass_ ); + else + return frm1_.RMSD( frm2_, useMass_ ); +# endif } /** \return RMSD between two given centroids. */ diff --git a/src/Cluster/PairwiseMatrix_MEM.cpp b/src/Cluster/PairwiseMatrix_MEM.cpp index 5774e9619a..ca314b848b 100644 --- a/src/Cluster/PairwiseMatrix_MEM.cpp +++ b/src/Cluster/PairwiseMatrix_MEM.cpp @@ -1,5 +1,7 @@ #include "PairwiseMatrix_MEM.h" +#ifdef DEBUG_CLUSTER #include "../CpptrajStdio.h" // DEBUG +#endif /** \return distance between frames (cached or uncached). */ double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) const { @@ -17,15 +19,19 @@ double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) cons /** Requests that distances between given frames be cached in memory. */ int Cpptraj::Cluster::PairwiseMatrix_MEM::CacheDistances(Cframes const& framesToCache) { Mat_.resize(0, framesToCache.size()); +# ifdef DEBUG_CLUSTER mprintf("DEBUG: PairwiseMatrix_MEM set up for %i rows, size= %zu bytes.\n", Mat_.Nrows(), Mat_.sizeInBytes()); +# endif frameToMat_.assign(DistMetric().Ntotal(), -1); int idx = 0; for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) frameToMat_[*it] = idx++; +# ifdef DEBUG_CLUSTER // DEBUG mprintf("DEBUG: frameToMat\n"); for (Cframes_it it = frameToMat_.begin(); it != frameToMat_.end(); ++it) mprintf("\tframeToMat_[%u] = %i\n", it - frameToMat_.begin(), *it); +# endif return CalcFrameDistances( framesToCache ); } From b1007bee5bd55eae46baf9f2e0081c1ea2a310fd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 08:54:20 -0500 Subject: [PATCH 036/417] DRR - Cpptraj: Init Algorithm debug var. Update dependencies. --- src/Cluster/Algorithm.h | 2 +- src/cpptrajdepend | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index bc99ad1735..9f2ae064a5 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -11,7 +11,7 @@ class Algorithm { public: enum Type { HIERAGGLO = 0, DBSCAN, DPEAKS, KMEANS }; - Algorithm(Type t) : type_(t) {} + Algorithm(Type t) : debug_(0), type_(t) {} virtual ~Algorithm() {} /// Set up clustering algorithm virtual int Setup(ArgList&) = 0; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index b3c2fb980e..256d4dd859 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -147,7 +147,7 @@ Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterList.o : ClusterList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h From 955e9cb5b693266e3d6224fea4ad533cb0c85d35 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 10:31:32 -0500 Subject: [PATCH 037/417] DRR - Cpptraj: Add creation of cluster num vs time set and more debug info. --- src/Analysis_Cluster.cpp | 21 ++++++++++++++++++++- src/Analysis_Cluster.h | 2 +- src/Cluster/Control.cpp | 5 ++++- src/Cluster/Control.h | 6 +++++- src/Cluster/List.cpp | 28 ++++++++++++++++++++++++++++ src/Cluster/List.h | 3 +++ src/Cluster/PairwiseMatrix.h | 2 ++ src/Cluster/PairwiseMatrix_MEM.cpp | 19 ++++++++++++++++--- src/Cluster/PairwiseMatrix_MEM.h | 1 + src/cpptrajdepend | 10 +++++----- 10 files changed, 85 insertions(+), 12 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 0ad83fc90d..7a71a90bf1 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -34,6 +34,14 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, debugIn); + // Output files + DataFile* cnumvtimefile = setup.DFL().AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); + + // Dataset to store cluster number v time + cnumvtime_ = setup.DSL().AddSet(DataSet::INTEGER, analyzeArgs.GetStringNext(), "Cnum"); + if (cnumvtime_==0) return Analysis::ERR; + if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); + return Analysis::OK; } @@ -41,7 +49,18 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s // Analysis_Cluster::Analyze() Analysis::RetType Analysis_Cluster::Analyze() { int err = control_.Run(); - if (err != 0) + if (err != 0) { + mprinterr("Error: Clustering failed.\n"); return Analysis::ERR; + } + // Cluster number vs time + if (cnumvtime_ != 0) { + if (control_.Clusters().CreateCnumVsTime( (DataSet_integer*)cnumvtime_, + control_.DistMetric().Ntotal() )) + { + mprinterr("Error: Creation of cluster num vs time data set failed.\n"); + return Analysis::ERR; + } + } return Analysis::OK; } diff --git a/src/Analysis_Cluster.h b/src/Analysis_Cluster.h index 8e66ce8e62..492291d61b 100644 --- a/src/Analysis_Cluster.h +++ b/src/Analysis_Cluster.h @@ -16,7 +16,7 @@ class Analysis_Cluster : public Analysis { Cpptraj::Cluster::Control control_; DataSet_Coords* coords_; - + DataSet* cnumvtime_; }; #endif diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index dea0643e31..ef7d1d0955 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -99,8 +99,9 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, std::string const& maskExpr, ArgList& analyzeArgs, - int verbose) + int verboseIn) { + verbose_ = verboseIn; if (ds == 0) { mprinterr("Internal Error: Control::SetupForCoordsDataSet() called with null DataSet.\n"); return 1; @@ -150,6 +151,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, mprinterr("Error: Algorithm setup failed.\n"); return 1; } + algorithm_->SetDebug( verbose_ ); Info(); @@ -176,6 +178,7 @@ int Cpptraj::Cluster::Control::Run() { // Cache distances if necessary pmatrix_->CacheDistances( framesToCluster ); + if (verbose_ > 1) pmatrix_->PrintCached(); // Cluster int err = algorithm_->DoClustering(clusters_, framesToCluster, *pmatrix_); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index b8c7cabf0d..626b20000d 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -11,7 +11,7 @@ namespace Cluster { /// Hold clusters, algorithm, and pairwise matrix. class Control { public: - Control() : metric_(0), pmatrix_(0), algorithm_(0) {} + Control() : metric_(0), pmatrix_(0), algorithm_(0), verbose_(0) {} static const char* PairwiseArgs; static const char* AlgorithmArgs; @@ -20,6 +20,9 @@ class Control { void Info() const; int Run(); + + List const& Clusters() const { return clusters_; } + Metric const& DistMetric() const { return *metric_; } private: static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); int AllocatePairwise(ArgList&, Metric*); @@ -33,6 +36,7 @@ class Control { Metric* metric_; PairwiseMatrix* pmatrix_; Algorithm* algorithm_; + int verbose_; }; } /** END namespace Cluster. */ diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 763dacc039..433939ba1a 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -14,3 +14,31 @@ void Cpptraj::Cluster::List::PrintClusters() const { } } +int Cpptraj::Cluster::List::CreateCnumVsTime(DataSet_integer* ds, unsigned int maxFrames) +const +{ + if (ds == 0) { + mprinterr("Internal Error: CreateCnumVsTime() called with null data set\n"); + return 1; + } + DataSet_integer& cnum_temp = static_cast( *ds ); + cnum_temp.Resize( maxFrames ); + // Make all clusters start at -1. This way cluster algorithms that + // have noise points (i.e. no cluster assigned) will be distinguished. + std::fill(cnum_temp.begin(), cnum_temp.end(), -1); + + for (cluster_iterator C = begincluster(); C != endcluster(); C++) + { + //mprinterr("Cluster %i:\n",CList->CurrentNum()); + int cnum = C->Num(); + // Loop over all frames in the cluster + for (Node::frame_iterator frame = C->beginframe(); frame != C->endframe(); frame++) + { + //mprinterr("%i,",*frame); + cnum_temp[ *frame ] = cnum; + } + //mprinterr("\n"); + //break; + } + return 0; +} diff --git a/src/Cluster/List.h b/src/Cluster/List.h index b7e113e897..b5e38d38ad 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -2,6 +2,7 @@ #define INC_CLUSTER_LIST_H #include #include "Node.h" +#include "../DataSet_integer.h" namespace Cpptraj { namespace Cluster { @@ -36,6 +37,8 @@ class List { void AddCluster( Node const& n ) { clusters_.push_back( n ); } /// Remove existing cluster via iterator void RemoveCluster( cluster_it& it ) { clusters_.erase( it ); } + /// Generate cluster number vs time data set + int CreateCnumVsTime(DataSet_integer*, unsigned int) const; private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 112c716d3d..1c04fd62cc 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -19,6 +19,8 @@ class PairwiseMatrix { virtual double Frame_Distance(int, int) const = 0; /// Request that distances for the specified frames be cached. virtual int CacheDistances(Cframes const&) = 0; + /// Print only cached distances. + virtual void PrintCached() const = 0; // ------------------------------------------- /// \return internal metric, const. Metric const& DistMetric() const { return *metric_; } diff --git a/src/Cluster/PairwiseMatrix_MEM.cpp b/src/Cluster/PairwiseMatrix_MEM.cpp index ca314b848b..ec9d69e554 100644 --- a/src/Cluster/PairwiseMatrix_MEM.cpp +++ b/src/Cluster/PairwiseMatrix_MEM.cpp @@ -1,7 +1,5 @@ #include "PairwiseMatrix_MEM.h" -#ifdef DEBUG_CLUSTER -#include "../CpptrajStdio.h" // DEBUG -#endif +#include "../CpptrajStdio.h" /** \return distance between frames (cached or uncached). */ double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) const { @@ -35,3 +33,18 @@ int Cpptraj::Cluster::PairwiseMatrix_MEM::CacheDistances(Cframes const& framesTo # endif return CalcFrameDistances( framesToCache ); } + +/** Print cached distances to stdout. */ +void Cpptraj::Cluster::PairwiseMatrix_MEM::PrintCached() const { + for (Cframes::const_iterator it1 = frameToMat_.begin(); it1 != frameToMat_.end(); ++it1) + { + if (*it1 != -1) { + for (Cframes::const_iterator it2 = it1 + 1; it2 != frameToMat_.end(); ++it2) + { + if (*it2 != -1) + mprintf("\t%i %i %f\n", *it1+1, *it2+1, Mat_.element(*it1, *it2)); + } + } + } +} + diff --git a/src/Cluster/PairwiseMatrix_MEM.h b/src/Cluster/PairwiseMatrix_MEM.h index e951e396cc..5fb32dad29 100644 --- a/src/Cluster/PairwiseMatrix_MEM.h +++ b/src/Cluster/PairwiseMatrix_MEM.h @@ -12,6 +12,7 @@ class PairwiseMatrix_MEM : public PairwiseMatrix { double GetFdist(int f1, int f2) const { return Mat_.element(frameToMat_[f1], frameToMat_[f2]); } double Frame_Distance(int, int) const; int CacheDistances(Cframes const&); + void PrintCached() const; // ------------------------------------------- protected: void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 256d4dd859..0ce38a596b 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Clustering.o : Analysis_Clustering.cpp ActionFrameCounter.h ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h Cluster_DPeaks.h Cluster_HierAgglo.h Cluster_Kmeans.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -140,10 +140,10 @@ BufferedLine.o : BufferedLine.cpp BufferedLine.h CpptrajFile.h CpptrajStdio.h Fi ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h -Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h @@ -162,7 +162,7 @@ Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedDa Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h From 7a18cab08a33768e34d097b16f2099cfa2c7001f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 10:39:46 -0500 Subject: [PATCH 038/417] DRR - Cpptraj: Add cluster sort/renumber. --- src/Cluster/Control.cpp | 3 +++ src/Cluster/List.cpp | 10 ++++++++++ src/Cluster/List.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index ef7d1d0955..645b90b3b9 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -183,5 +183,8 @@ int Cpptraj::Cluster::Control::Run() { // Cluster int err = algorithm_->DoClustering(clusters_, framesToCluster, *pmatrix_); + // Sort by population and renumber + clusters_.Sort(); + return err; } diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 433939ba1a..db51f530e4 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -14,6 +14,7 @@ void Cpptraj::Cluster::List::PrintClusters() const { } } +/** Create cluster number vs time data set. */ int Cpptraj::Cluster::List::CreateCnumVsTime(DataSet_integer* ds, unsigned int maxFrames) const { @@ -42,3 +43,12 @@ const } return 0; } + +/** Sort clusters by population and renumber. */ +int Cpptraj::Cluster::List::Sort() { + clusters_.sort(); + int newNum = 0; + for (cluster_it it = clusters_.begin(); it != clusters_.end(); ++it) + it->SetNum( newNum++ ); + return 0; +} diff --git a/src/Cluster/List.h b/src/Cluster/List.h index b5e38d38ad..dc8fd47250 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -39,6 +39,8 @@ class List { void RemoveCluster( cluster_it& it ) { clusters_.erase( it ); } /// Generate cluster number vs time data set int CreateCnumVsTime(DataSet_integer*, unsigned int) const; + /// Sort clusters by population and renumber. + int Sort(); private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. From 1d2c8cffea242f7d0a55592ad2e86265a7279a73 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 11:34:38 -0500 Subject: [PATCH 039/417] DRR - Cpptraj: Add DBscan algorithm --- src/Cluster/Algorithm_DBscan.cpp | 440 +++++++++++++++++++++++++++++++ src/Cluster/Algorithm_DBscan.h | 41 +++ 2 files changed, 481 insertions(+) create mode 100644 src/Cluster/Algorithm_DBscan.cpp create mode 100644 src/Cluster/Algorithm_DBscan.h diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp new file mode 100644 index 0000000000..331dfa1a55 --- /dev/null +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -0,0 +1,440 @@ +#include // double max +#include // sort +#include "Algorithm_DBscan.h" +#include "../CpptrajStdio.h" +#include "../ProgressBar.h" +#include "../StringRoutines.h" // integerToString +#ifdef _OPENMP +# include +#endif +#include "../DataSet_MatrixDbl.h" // DEBUG +#include "../DataFile.h" // DEBUG + +// CONSTRUCTOR +Cpptraj::Cluster::Algorithm_DBscan::Algorithm_DBscan() : + Algorithm(DBSCAN), + minPoints_(-1), + epsilon_(-1.0), + sieveToCentroid_(true) +{} + +// Algorithm_DBscan::Help() +void Cpptraj::Cluster::Algorithm_DBscan::Help() { + mprintf("\t[dbscan minpoints epsilon [sievetoframe] [kdist [kfile ]]]\n"); +} + +// Cluster_DBSCAN::SetupCluster() +int Cpptraj::Cluster::Algorithm_DBscan::Setup(ArgList& analyzeArgs) { + kdist_.SetRange(analyzeArgs.GetStringKey("kdist")); + if (kdist_.Empty()) { + minPoints_ = analyzeArgs.getKeyInt("minpoints", -1); + if (minPoints_ < 1) { + mprinterr("Error: DBSCAN requires minimum # of points to be set and >= 1\n" + "Error: Use 'minpoints '\n"); + return 1; + } + epsilon_ = analyzeArgs.getKeyDouble("epsilon", -1.0); + if (epsilon_ <= 0.0) { + mprinterr("Error: DBSCAN requires epsilon to be set and > 0.0\n" + "Error: Use 'epsilon '\n"); + return 1; + } + sieveToCentroid_ = !analyzeArgs.hasKey("sievetoframe"); + } else { + k_prefix_ = analyzeArgs.GetStringKey("kfile"); + if (!k_prefix_.empty() && k_prefix_.at(k_prefix_.size()-1) != '/') + k_prefix_ += '/'; + } + return 0; +} + +// Cluster_DBSCAN::ClusteringInfo() +void Cpptraj::Cluster::Algorithm_DBscan::Info() const { + mprintf("\tDBSCAN:\n"); + if (!kdist_.Empty()) { + mprintf("\t\tOnly calculating Kdist graph for K=%s\n", kdist_.RangeArg()); + if (!k_prefix_.empty()) mprintf("\t\tKdist file prefix: %s\n", k_prefix_.c_str()); + } else { + mprintf("\t\tMinimum pts to form cluster= %i\n", minPoints_); + mprintf("\t\tCluster distance criterion= %.3f\n", epsilon_); + if (sieveToCentroid_) + mprintf("\t\tSieved frames will be added back solely based on their\n" + "\t\t closeness to cluster centroids.\n" + "\t\t (This option is less accurate but faster.)\n"); + else + mprintf("\t\tSieved frames will only be added back if they are within\n" + "\t\t %.3f of a frame in an existing cluster.\n" + "\t\t (This option is more accurate and will identify sieved\n" + "\t\t frames as noise but is slower.)\n", epsilon_); + } +} + +// Cluster_DBSCAN::Cluster() +int Cpptraj::Cluster::Algorithm_DBscan::DoClustering(List& clusters, + Cframes const& framesToCluster, + PairwiseMatrix const& pmatrix) +{ + // Check if only need to calculate Kdist function(s) + if (!kdist_.Empty()) { + if (kdist_.Size() == 1) + ComputeKdist( kdist_.Front(), framesToCluster, pmatrix ); + else + ComputeKdistMap( kdist_, framesToCluster, pmatrix ); + return 0; + } + // Actual clustering + unsigned int nPtsToCluster = framesToCluster.size(); + // FIXME handle case where clusters is not empty + if (!clusters.empty()) { + mprinterr("Internal Error: DBSCAN not yet set up for reclustering.\n"); + return 1; + } + // SetOfPoints is UNCLASSIFIED + Status_.assign( nPtsToCluster, UNCLASSIFIED ); + int ClusterId = 0; + ProgressBar progress( nPtsToCluster ); + for (unsigned int idx = 0; idx != nPtsToCluster; idx++) + { + progress.Update(idx); + //Point := SetOfPoints.get(i); + //IF Point.ClId = UNCLASSIFIED THEN + if ( Status_[idx] == UNCLASSIFIED ) + { + //IF ExpandCluster(SetOfPoints, Point, ClusterId, Eps, MinPts) THEN + if (ExpandCluster(framesToCluster, pmatrix, idx, ClusterId)) + //ClusterId := nextId(ClusterId) + ClusterId++; + } + } + // Create clusters based on point statuses + if (ClusterId > 0) { + std::vector C0( ClusterId ); + // Make sure to store actual frame #s + for (unsigned int idx = 0; idx != Status_.size(); idx++) + { + int cnum = Status_[idx]; + if (cnum == UNCLASSIFIED) + mprintf("Warning: point %u was unclassified.\n", idx); + else if (cnum == NOISE) + clusters.AddNoise( framesToCluster[idx] ); + else + C0[ cnum ].push_back( framesToCluster[idx] ); + } + // Add clusters. + for (unsigned int cnum = 0; cnum != C0.size(); cnum++) + clusters.AddCluster( Node(pmatrix.MetricPtr(), C0[cnum], cnum) ); + } + return 0; +} + +// Cluster_DBSCAN::ExpandCluster() +bool Cpptraj::Cluster::Algorithm_DBscan::ExpandCluster(Cframes const& framesToCluster, + PairwiseMatrix const& pmatrix, + unsigned int point, int ClusterId) +{ + //seeds:=SetOfPoints.regionQuery(Point,Eps); + RegionQuery(seeds_, framesToCluster, pmatrix, point); + + //IF seeds.size Empty DO + unsigned int endIdx = seeds_.size(); + for (unsigned int idx = 0; idx < endIdx; idx++) + { + //currentP := seeds.first(); + int otherpoint = seeds_[idx]; + //result := SetOfPoints.regionQuery(currentP, Eps); + RegionQuery(result_, framesToCluster, pmatrix, otherpoint); + //IF result.size >= MinPts THEN + if ( (int)result_.size() >= minPoints_ ) + { + //FOR i FROM 1 TO result.size DO + // resultP := result.get(i); + // IF resultP.ClId IN {UNCLASSIFIED, NOISE} THEN + // IF resultP.ClId = UNCLASSIFIED THEN + // seeds.append(resultP); + // END IF; + // SetOfPoints.changeClId(resultP,ClId); + // END IF; // UNCLASSIFIED or NOISE + //END FOR; + for (Iarray::const_iterator rt = result_.begin(); rt != result_.end(); ++rt) + { + if (Status_[*rt] == UNCLASSIFIED || Status_[*rt] == NOISE) + { + if (Status_[*rt] == UNCLASSIFIED) + { + seeds_.push_back( *rt ); + endIdx = seeds_.size(); + } + Status_[*rt] = ClusterId; + } + } + } + //END IF; // result.size >= MinPts + //seeds.delete(currentP); + } + //END WHILE; // seeds <> Empty + return true; + } +} + +// Cluster_DBSCAN::RegionQuery() +void Cpptraj::Cluster::Algorithm_DBscan::RegionQuery(Iarray& NeighborPts, + Cframes const& framesToCluster, + PairwiseMatrix const& pmatrix, + int point) const +{ + NeighborPts.clear(); + // point and otherpoint are indices, not frame #s + int f1 = framesToCluster[ point ]; + for (int otherpoint = 0; otherpoint < (int)Status_.size(); ++otherpoint) + { + if (point != otherpoint) { + int f2 = framesToCluster[ otherpoint ]; + if ( pmatrix.GetFdist(f1, f2) < epsilon_ ) + NeighborPts.push_back( otherpoint ); + } + } +} + +// Cluster_DBSCAN::ClusterResults() +void Cpptraj::Cluster::Algorithm_DBscan::Results(CpptrajFile& outfile) const { + outfile.Printf("#Algorithm: DBSCAN minpoints %i epsilon %g sieveToCentroid %i\n", + minPoints_, epsilon_, (int)sieveToCentroid_); +/* TODO implement elsewhere + // List the number of noise points. + outfile.Printf("#NOISE_FRAMES:"); + unsigned int numNoise = 0; + for (unsigned int idx = 0; idx != Status_.size(); ++idx) + { + if ( Status_[idx] == NOISE ) { + outfile.Printf(" %u", FrameDistances().FramesToCluster()[idx]+1); + ++numNoise; + } + } + outfile.Printf("\n"); + outfile.Printf("#Number_of_noise_frames: %u\n", numNoise); +*/ +} + +/* +// Cluster_DBSCAN::AddSievedFrames() +void Cpptraj::Cluster::Algorithm_DBscan::AddSievedFrames() { + // NOTE: All cluster centroids must be up to date! + if (sieveToCentroid_) + mprintf("\tRestoring sieved frames if within %.3f of cluster centroid.\n", epsilon_); + else + mprintf("\tRestoring sieved frames if within %.3f of frame in nearest cluster.\n", + epsilon_); + // Vars allocated here in case of OpenMP + int n_sieved_noise = 0; + int Nsieved = 0; + int frame; + int nframes = (int)FrameDistances().OriginalNframes(); + ParallelProgress progress( nframes ); + // Need a temporary array to hold which frame belongs to which cluster. + // Otherwise we could be comparoing sieved frames to other sieved frames. + std::vector frameToCluster( nframes, clusters_.end() ); + // For OMP, every other thread will need its own Cdist. + ClusterDist* MyCdist = Cdist_; +# ifdef _OPENMP +# pragma omp parallel private(MyCdist, frame) firstprivate(progress) reduction(+ : Nsieved, n_sieved_noise) + { + int mythread = omp_get_thread_num(); + progress.SetThread( mythread ); + if (mythread == 0) { + mprintf("\tParallelizing calculation with %i threads\n", omp_get_num_threads()); + MyCdist = Cdist_; + } else + MyCdist = Cdist_->Copy(); +# pragma omp for schedule(dynamic) +# endif + for (frame = 0; frame < nframes; ++frame) { + progress.Update( frame ); + if (FrameDistances().FrameWasSieved(frame)) { + // Which clusters centroid is closest to this frame? + double mindist = std::numeric_limits::max(); + cluster_it minNode = clusters_.end(); + for (cluster_it Cnode = clusters_.begin(); Cnode != clusters_.end(); ++Cnode) { + double dist = MyCdist->FrameCentroidDist(frame, Cnode->Cent()); + if (dist < mindist) { + mindist = dist; + minNode = Cnode; + } + } + bool goodFrame = false; + if ( mindist < epsilon_ ) + // Frame is already within epsilon, accept. + goodFrame = true; + else if ( !sieveToCentroid_ ) { + // Check if any frames in the cluster are closer than epsilon to sieved frame. + for (int cidx=0; cidx < minNode->Nframes(); cidx++) + { + if ( MyCdist->FrameDist(frame, minNode->ClusterFrame(cidx)) < epsilon_ ) + { + goodFrame = true; + break; + } + } + } + // Add sieved frame to the closest cluster if closest distance is + // less than epsilon. + ++Nsieved; + if ( goodFrame ) + frameToCluster[frame] = minNode; + else + n_sieved_noise++; + } + } // END loop over frames +# ifdef _OPENMP + if (mythread > 0) + delete MyCdist; + } // END pragma omp parallel +# endif + progress.Finish(); + // Now actually add sieved frames to their appropriate clusters + for (frame = 0; frame < nframes; frame++) + if (frameToCluster[frame] != clusters_.end()) + frameToCluster[frame]->AddFrameToCluster( frame ); + mprintf("\t%i of %i sieved frames were discarded as noise.\n", + n_sieved_noise, Nsieved); +} +*/ + +/** For each point p, calculate function Kdist(p) which is the distance of + * the Kth nearest point to p. + */ +void Cpptraj::Cluster::Algorithm_DBscan::ComputeKdist( int Kval, + Cframes const& FramesToCluster, + PairwiseMatrix const& pmatrix ) +const +{ + std::vector dists; + std::vector Kdist; + dists.reserve( FramesToCluster.size() ); + Kdist.reserve( FramesToCluster.size() ); + std::string outfilename = k_prefix_ + "Kdist." + integerToString(Kval) + ".dat"; + mprintf("\tDBSCAN: Calculating Kdist(%i), output to %s\n", Kval, outfilename.c_str()); + for (std::vector::const_iterator point = FramesToCluster.begin(); + point != FramesToCluster.end(); + ++point) + { + // Store distances from this point + dists.clear(); + for (std::vector::const_iterator otherpoint = FramesToCluster.begin(); + otherpoint != FramesToCluster.end(); + ++otherpoint) + dists.push_back( pmatrix.GetFdist(*point, *otherpoint) ); + // Sort distances - first dist should always be 0 + std::sort(dists.begin(), dists.end()); + Kdist.push_back( dists[Kval] ); + } + std::sort( Kdist.begin(), Kdist.end() ); + CpptrajFile Outfile; + Outfile.OpenWrite(outfilename); + Outfile.Printf("%-8s %1i%-11s\n", "#Point", Kval,"-dist"); + // Write out largest to smallest + unsigned int ik = 0; + for (std::vector::reverse_iterator k = Kdist.rbegin(); + k != Kdist.rend(); ++k, ++ik) + Outfile.Printf("%8u %12.4f\n", ik, *k); + Outfile.CloseFile(); +} + +// Cluster_DBSCAN::ComputeKdistMap() +void Cpptraj::Cluster::Algorithm_DBscan::ComputeKdistMap( Range const& Kvals, + Cframes const& FramesToCluster, + PairwiseMatrix const& pmatrix ) +const +{ + int pt1_idx, pt2_idx, d_idx, point; + mprintf("\tCalculating Kdist map for %s\n", Kvals.RangeArg()); + double* kdist_array; // Store distance of pt1 to every other point. + int nframes = (int)FramesToCluster.size(); + // Ensure all Kdist points are within proper range + Range::const_iterator kval; + for (kval = Kvals.begin(); kval != Kvals.end(); ++kval) + if (*kval < 1 || *kval >= nframes) { + mprinterr("Error: Kdist value %i is out of range (1 <= Kdist < %i)\n", + *kval, nframes); + return; + } + int nvals = (int)Kvals.Size(); + double** KMAP; // KMAP[i] has the ith nearest point for each point. + KMAP = new double*[ nvals ]; + for (int i = 0; i != nvals; i++) + KMAP[i] = new double[ nframes ]; + ParallelProgress progress( nframes ); +# ifdef _OPENMP +# pragma omp parallel private(pt1_idx, pt2_idx, d_idx, kval, point, kdist_array) firstprivate(progress) + { + progress.SetThread( omp_get_thread_num() ); +#endif + kdist_array = new double[ nframes ]; +# ifdef _OPENMP +# pragma omp for +# endif + for (pt1_idx = 0; pt1_idx < nframes; pt1_idx++) // X + { + progress.Update( pt1_idx ); + point = FramesToCluster[pt1_idx]; + d_idx = 0; + // Store distances from pt1 to pt2 + for (pt2_idx = 0; pt2_idx != nframes; pt2_idx++) + kdist_array[d_idx++] = pmatrix.GetFdist(point, FramesToCluster[pt2_idx]); + // Sort distances; will be smallest to largest + std::sort( kdist_array, kdist_array + nframes ); + // Save the distance of specified nearest neighbors to this point. + d_idx = 0; + for (kval = Kvals.begin(); kval != Kvals.end(); ++kval) // Y + KMAP[d_idx++][pt1_idx] = kdist_array[ *kval ]; + } + delete[] kdist_array; +# ifdef _OPENMP + } // END omp parallel +# endif + progress.Finish(); + // Sort all of the individual kdist plots, smallest to largest. + for (int i = 0; i != nvals; i++) + std::sort(KMAP[i], KMAP[i] + nframes); + // Save in matrix, largest to smallest. + DataSet_MatrixDbl kmatrix; + kmatrix.Allocate2D( FramesToCluster.size(), Kvals.Size() ); + for (int y = 0; y != nvals; y++) { + for (int x = nframes - 1; x != -1; x--) + kmatrix.AddElement( KMAP[y][x] ); + delete[] KMAP[y]; + } + delete[] KMAP; + // Write matrix to file + DataFile outfile; + ArgList outargs("usemap"); + outfile.SetupDatafile(k_prefix_ + "Kmatrix.gnu", outargs, debug_); + outfile.AddDataSet( (DataSet*)&kmatrix ); + outfile.WriteDataOut(); + // Write out the largest and smallest values for each K. + // This means for each value of K the point with the furthest Kth-nearest + // neighbor etc. + CpptrajFile maxfile; + if (maxfile.OpenWrite(k_prefix_ + "Kmatrix.max.dat")) return; + maxfile.Printf("%-12s %12s %12s\n", "#Kval", "MaxD", "MinD"); + d_idx = 0; + for (kval = Kvals.begin(); kval != Kvals.end(); ++kval, d_idx++) + maxfile.Printf("%12i %12g %12g\n", *kval, kmatrix.GetElement(0, d_idx), + kmatrix.GetElement(nframes-1, d_idx)); + maxfile.CloseFile(); +} diff --git a/src/Cluster/Algorithm_DBscan.h b/src/Cluster/Algorithm_DBscan.h new file mode 100644 index 0000000000..13c9280737 --- /dev/null +++ b/src/Cluster/Algorithm_DBscan.h @@ -0,0 +1,41 @@ +#ifndef INC_CLUSTER_ALGORITHM_DBSCAN_H +#define INC_CLUSTER_ALGORITHM_DBSCAN_H +#include "Algorithm.h" +namespace Cpptraj { +namespace Cluster { + +/** Ester, Kriegel, Sander, Xu; Proceedings of 2nd International Conference + * on Knowledge Discovery and Data Mining (KDD-96); pp 226-231. + */ +class Algorithm_DBscan : public Algorithm { + public: + Algorithm_DBscan(); + static void Help(); + int Setup(ArgList&); + void Info() const; + void Results(CpptrajFile&) const; + int DoClustering(List&, Cframes const&, PairwiseMatrix const&); + void Timing(double) const {} + + //void AddSievedFrames(); // TODO fix this + private: + typedef std::vector Iarray; + + bool ExpandCluster(Cframes const&, PairwiseMatrix const&, unsigned int, int); + void RegionQuery(Iarray&, Cframes const&, PairwiseMatrix const&, int) const; + void ComputeKdist( int, Cframes const&, PairwiseMatrix const&) const ; + void ComputeKdistMap( Range const&, Cframes const&, PairwiseMatrix const& ) const ; + + Iarray Status_; ///< Status of each point: unclassified, noise, or in cluster + Iarray seeds_; ///< Results from first RegionQuery + Iarray result_; ///< Results from seed RegionQueries + int minPoints_; ///< Min # of points needed to make a cluster. + double epsilon_; ///< Distance criterion for cluster formation. + Range kdist_; + std::string k_prefix_; ///< Kdist output file prefix. + bool sieveToCentroid_; ///< If true sieve only based on closeness to centroid. +}; + +} /* END namespace Cluster */ +} /* END namespace Cpptraj */ +#endif From 3b0096d010f6d15bfc456b48c1f5817e21fc22f2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 11:45:14 -0500 Subject: [PATCH 040/417] DRR - Cpptraj: Enable DBscan. Handle case where incoming clusters are not empty. --- src/Cluster/Algorithm_DBscan.cpp | 23 ++++++++++++++++++----- src/Cluster/Control.cpp | 2 ++ src/Cluster/List.h | 2 ++ src/Cluster/Metric.h | 2 ++ src/cpptrajdepend | 3 ++- src/cpptrajfiles | 1 + 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index 331dfa1a55..8c5b372353 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -84,14 +84,27 @@ int Cpptraj::Cluster::Algorithm_DBscan::DoClustering(List& clusters, } // Actual clustering unsigned int nPtsToCluster = framesToCluster.size(); - // FIXME handle case where clusters is not empty - if (!clusters.empty()) { - mprinterr("Internal Error: DBSCAN not yet set up for reclustering.\n"); - return 1; - } // SetOfPoints is UNCLASSIFIED Status_.assign( nPtsToCluster, UNCLASSIFIED ); int ClusterId = 0; + // If incoming clusters are not empty, set status of frames as appropriate. + if (!clusters.empty()) { + // Find highest cluster num + for (List::cluster_iterator node = clusters.begincluster(); + node != clusters.endcluster(); ++node) + if (node->Num() > ClusterId) ClusterId = node->Num(); + ClusterId++; + // See if any frames to be clustered are already in clusters. + for (Cframes::const_iterator it = framesToCluster.begin(); it != framesToCluster.end(); ++it) + { + for (List::cluster_iterator node = clusters.begincluster(); + node != clusters.endcluster(); ++node) + { + if (node->HasFrame( *it )) + Status_[it-framesToCluster.begin()] = node->Num(); + } + } + } ProgressBar progress( nPtsToCluster ); for (unsigned int idx = 0; idx != nPtsToCluster; idx++) { diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 645b90b3b9..cd84d66979 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -7,6 +7,7 @@ #include "Metric_RMS.h" // Algorithms #include "Algorithm_HierAgglo.h" +#include "Algorithm_DBscan.h" // ----------------------------------------------------------------------------- /** \return pointer to PairwiseMatrix of specified type. */ @@ -56,6 +57,7 @@ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algori Algorithm* alg = 0; switch (atype) { case Algorithm::HIERAGGLO : alg = new Algorithm_HierAgglo(); break; + case Algorithm::DBSCAN : alg = new Algorithm_DBscan(); break; default : mprinterr("Error: Unhandled Algorithm in AllocateAlgorithm.\n"); } return alg; diff --git a/src/Cluster/List.h b/src/Cluster/List.h index dc8fd47250..186941494f 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -41,6 +41,8 @@ class List { int CreateCnumVsTime(DataSet_integer*, unsigned int) const; /// Sort clusters by population and renumber. int Sort(); + /// Add given frame as noise. + void AddNoise(int f) { noise_.push_back( f ); } private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 92ee5c079a..9d65fdab5b 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -12,6 +12,8 @@ typedef std::vector Cframes; typedef Cframes::const_iterator Cframes_it; /// Definition of a noise point. const int NOISE = -1; +/// Definition of an unclassified point. +const int UNCLASSIFIED = -2; /// Abstract base class for calculating distance between points or determining centroid. class Metric { diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 0ce38a596b..a8ca7c5313 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -140,9 +140,10 @@ BufferedLine.o : BufferedLine.cpp BufferedLine.h CpptrajFile.h CpptrajStdio.h Fi ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h +Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 13c2da1c73..21836c1fa7 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -1,5 +1,6 @@ # Files related to new clustering code CLUSTER_SOURCES= \ + Cluster/Algorithm_DBscan.cpp \ Cluster/Algorithm_HierAgglo.cpp \ Cluster/Centroid_Coord.cpp \ Cluster/Control.cpp \ From 4fd7d00c916570296d8b0174b70b28f19b4cc842 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 12:17:32 -0500 Subject: [PATCH 041/417] DRR - Cpptraj: Create but not yet enable matrix metric --- src/Cluster/Metric.h | 2 +- src/Cluster/Metric_Matrix2D.cpp | 26 ++++++++++++++++++++++++++ src/Cluster/Metric_Matrix2D.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/Cluster/Metric_Matrix2D.cpp create mode 100644 src/Cluster/Metric_Matrix2D.h diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 9d65fdab5b..196aaf2617 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -18,7 +18,7 @@ const int UNCLASSIFIED = -2; /// Abstract base class for calculating distance between points or determining centroid. class Metric { public: - enum Type { RMS=0, DME, SRMSD, DATA, DATA_EUCLID }; + enum Type { RMS=0, DME, SRMSD, DATA, DATA_EUCLID, MATRIX2D }; enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; typedef std::vector DsArray; // TODO should this be here? diff --git a/src/Cluster/Metric_Matrix2D.cpp b/src/Cluster/Metric_Matrix2D.cpp new file mode 100644 index 0000000000..6a339b8a4d --- /dev/null +++ b/src/Cluster/Metric_Matrix2D.cpp @@ -0,0 +1,26 @@ +#include "Metric_Matrix2D.h" + +static inline void idxToColRow(int idx, int Ncols, int& col, int& row) +{ + row = idx / Ncols; + col = idx - (row * Ncols); +} + + +double Cpptraj::Cluster::Metric_Matrix2D::FrameDist(int f1, int f2) +{ + //int col, row; + //idxToColRow( f1, matrix_->Ncols(), col, row ); + double val1 = matrix_->GetElement( f1 ); + double val2 = matrix_->GetElement( f2 ); + int col1, row1; + idxToColRow( f1, matrix_->Ncols(), col1, row1 ); + int col2, row2; + idxToColRow( f2, matrix_->Ncols(), col2, row2 ); + + double dv = val1 - val2; + double dr = (double)(row1 - row2); + double dc = (double)(col1 - col2); + double dist2 = dv*dv + dr*dr + dc*dc; + return dist2; +} diff --git a/src/Cluster/Metric_Matrix2D.h b/src/Cluster/Metric_Matrix2D.h new file mode 100644 index 0000000000..f95692fe19 --- /dev/null +++ b/src/Cluster/Metric_Matrix2D.h @@ -0,0 +1,31 @@ +#ifndef INC_CLUSTER_METRIC_MATRIX2D_H +#define INC_CLUSTER_METRIC_MATRIX2D_H +#include "Metric.h" +#include "../DataSet_2D.h" +namespace Cpptraj { +namespace Cluster { + +/// Metric for distance between two points in a matrix +class Metric_Matrix2D : public Metric { + public: + Metric_Matrix2D() : Metric(MATRIX2D), matrix_(0) {} + int Setup(); + double FrameDist(int, int); + double CentroidDist( Centroid*, Centroid* ); + double FrameCentroidDist(int, Centroid*); + void CalculateCentroid(Centroid*, Cframes const&); + Centroid* NewCentroid(Cframes const&); + Metric* Copy() { return new Metric_Matrix2D( *this ); } + void FrameOpCentroid(int, Centroid*, double, CentOpType); + std::string Description() const; + void Info() const; + unsigned int Ntotal() const { return (unsigned int)matrix_->Size(); } + // ------------------------------------------- + int Init(DataSet_2D*); + private: + DataSet_2D* matrix_; +}; + +} +} +#endif From 01d0440dd9a6ba9f64e455ff117f67332c8f5090 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 12:57:32 -0500 Subject: [PATCH 042/417] DRR - Cpptraj: Make Cframes an actual class --- src/Cluster/Cframes.cpp | 17 +++++++++++++++++ src/Cluster/Cframes.h | 38 ++++++++++++++++++++++++++++++++++++++ src/Cluster/Metric.h | 5 +---- src/Cluster/Node.cpp | 16 +++++++++------- src/Cluster/Node.h | 3 ++- src/cpptrajdepend | 21 +++++++++++---------- src/cpptrajfiles | 1 + 7 files changed, 79 insertions(+), 22 deletions(-) create mode 100644 src/Cluster/Cframes.cpp create mode 100644 src/Cluster/Cframes.h diff --git a/src/Cluster/Cframes.cpp b/src/Cluster/Cframes.cpp new file mode 100644 index 0000000000..560772ba07 --- /dev/null +++ b/src/Cluster/Cframes.cpp @@ -0,0 +1,17 @@ +#include +#include "Cframes.h" + +bool Cpptraj::Cluster::Cframes::HasFrame(int frame) const { + Iarray::const_iterator it = std::find(frames_.begin(), frames_.end(), frame); + return !(it == frames_.end()); +} + +void Cpptraj::Cluster::Cframes::Remove(int frame) { + Iarray::iterator pend = std::remove( frames_.begin(), frames_.end(), frame); + size_t newsize = pend - frames_.begin(); + frames_.resize( newsize ); +} + +void Cpptraj::Cluster::Cframes::Sort() { + std::sort(frames_.begin(), frames_.end()); +} diff --git a/src/Cluster/Cframes.h b/src/Cluster/Cframes.h new file mode 100644 index 0000000000..f564ecdc49 --- /dev/null +++ b/src/Cluster/Cframes.h @@ -0,0 +1,38 @@ +#ifndef INC_CLUSTER_CFRAMES_H +#define INC_CLUSTER_CFRAMES_H +#include +namespace Cpptraj { +namespace Cluster { + +/// Used to hold frames to cluster (may not be all frames). +class Cframes { + typedef std::vector Iarray; + public: + Cframes() {} + Cframes(size_t n, int i) : frames_(n, i) {} + size_t size() const { return frames_.size(); } + typedef Iarray::const_iterator const_iterator; + const_iterator begin() const { return frames_.begin(); } + const_iterator end() const { return frames_.end(); } +/* typedef Iarray::iterator iterator; + iterator begin() { return frames_.begin(); } + iteratir end() */ + int front() const { return frames_.front(); } + int operator[](unsigned int idx) const { return frames_[idx]; } + int& operator[](unsigned int idx) { return frames_[idx]; } + void push_back(int i) { frames_.push_back( i ); } + void assign(size_t n, int i) { frames_.assign(n, i); } + + bool HasFrame(int) const; + void Insert(Cframes const& rhs) { frames_.insert(frames_.end(), rhs.begin(), rhs.end()); } + void Remove(int); + void Sort(); + private: + Iarray frames_; +}; + +typedef Cframes::const_iterator Cframes_it; + +} +} +#endif diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 196aaf2617..7a7456b23c 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -2,14 +2,11 @@ #define INC_CLUSTER_METRIC_H #include #include "../DataSet.h" +#include "Cframes.h" #include "Centroid.h" namespace Cpptraj { namespace Cluster { -/// This will hold cluster frame numbers. -typedef std::vector Cframes; -/// Iterator for Cframes -typedef Cframes::const_iterator Cframes_it; /// Definition of a noise point. const int NOISE = -1; /// Definition of an unclassified point. diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index cdd0aad167..cdeecf50c0 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -1,5 +1,4 @@ -#include // DBL_MAX -#include // sort +//#include // DBL_MAX #include "Node.h" // CONSTRUCTOR @@ -123,20 +122,23 @@ double Cpptraj::Cluster::Node::CalcAvgToCentroid( Metric* Cdist ) const } void Cpptraj::Cluster::Node::SortFrameList() { - std::sort(frameList_.begin(), frameList_.end()); + //std::sort(frameList_.begin(), frameList_.end()); + frameList_.Sort(); } // Cpptraj::Cluster::Node::HasFrame() bool Cpptraj::Cluster::Node::HasFrame(int frame) const { - Cframes::const_iterator it = std::find(frameList_.begin(), frameList_.end(), frame); - return !(it == frameList_.end()); + //Cframes::const_iterator it = std::find(frameList_.begin(), frameList_.end(), frame); + //return !(it == frameList_.end()); + return frameList_.HasFrame( frame ); } // Cpptraj::Cluster::Node::RemoveFrameFromCluster() void Cpptraj::Cluster::Node::RemoveFrameFromCluster(int frame) { - Cframes::iterator pend = std::remove( frameList_.begin(), frameList_.end(), frame); + frameList_.Remove( frame ); +/* Cframes::iterator pend = std::remove( frameList_.begin(), frameList_.end(), frame); size_t newsize = pend - frameList_.begin(); - frameList_.resize( newsize ); + frameList_.resize( newsize );*/ } void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(Metric* Cdist, int frame) { diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 189a392d0a..9ec71d51fe 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -103,7 +103,8 @@ bool Node::operator<(const Node& rhs) const { } /** Frames from rhs go to this cluster. */ void Node::MergeFrames( Node const& rhs) { - frameList_.insert(frameList_.end(), rhs.frameList_.begin(), rhs.frameList_.end()); + frameList_.Insert( rhs.frameList_ ); + //frameList_.insert(frameList_.end(), rhs.frameList_.begin(), rhs.frameList_.end()); } /** Set reference name and RMS. */ void Node::SetNameAndRms(std::string const& nameIn, double rmsIn) { diff --git a/src/cpptrajdepend b/src/cpptrajdepend index a8ca7c5313..a444641c03 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Clustering.o : Analysis_Clustering.cpp ActionFrameCounter.h ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h Cluster_DPeaks.h Cluster_HierAgglo.h Cluster_Kmeans.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -140,15 +140,16 @@ BufferedLine.o : BufferedLine.cpp BufferedLine.h CpptrajFile.h CpptrajStdio.h Fi ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h -Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h -Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Metric.h Cluster/Metric_RMS.h -Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h +Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h +Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterList.o : ClusterList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h @@ -163,7 +164,7 @@ Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedDa Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 21836c1fa7..85ac097525 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -3,6 +3,7 @@ CLUSTER_SOURCES= \ Cluster/Algorithm_DBscan.cpp \ Cluster/Algorithm_HierAgglo.cpp \ Cluster/Centroid_Coord.cpp \ + Cluster/Cframes.cpp \ Cluster/Control.cpp \ Cluster/List.cpp \ Cluster/Metric_RMS.cpp \ From 93fe594b807df8831a48187b792e3e64ab67edcf Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 13:24:31 -0500 Subject: [PATCH 043/417] DRR - Cpptraj: Add sieve functionality to Cframes --- src/Cluster/Cframes.cpp | 72 +++++++++++++++++++++++++++++++++++++++++ src/Cluster/Cframes.h | 13 ++++++-- src/Cluster/Control.cpp | 22 ++++++++++--- src/Cluster/Control.h | 9 +++++- src/cpptrajdepend | 2 +- 5 files changed, 110 insertions(+), 8 deletions(-) diff --git a/src/Cluster/Cframes.cpp b/src/Cluster/Cframes.cpp index 560772ba07..9c1f8616c3 100644 --- a/src/Cluster/Cframes.cpp +++ b/src/Cluster/Cframes.cpp @@ -1,5 +1,6 @@ #include #include "Cframes.h" +#include "../Random.h" bool Cpptraj::Cluster::Cframes::HasFrame(int frame) const { Iarray::const_iterator it = std::find(frames_.begin(), frames_.end(), frame); @@ -15,3 +16,74 @@ void Cpptraj::Cluster::Cframes::Remove(int frame) { void Cpptraj::Cluster::Cframes::Sort() { std::sort(frames_.begin(), frames_.end()); } + +void Cpptraj::Cluster::Cframes::DetermineTypeFromSieve( int sieveIn ) { + sieve_ = sieveIn; + // Determine sieve type from sieve value. + if (sieve_ < -1) + type_ = RANDOM; + else if (sieve_ < 2) { + type_ = NONE; + sieve_ = 1; + } else + type_ = REGULAR; +} + +/** Setup which frames should be clustered.*/ +int Cpptraj::Cluster::Cframes::SetFramesToCluster(int sieveIn, size_t maxFrames, int iseed) +{ + if (maxFrames < 1) return 1; + DetermineTypeFromSieve( sieveIn ); +// frameToIdx_.clear(); + // --------------------------------------------- + if (type_ == NONE) + { // No sieving; frame == index + frames_.reserve( maxFrames ); + for (unsigned int i = 0; i < maxFrames; i++) + frames_.push_back( i ); + //actualNframes_ = (int)maxFrames; + } + // --------------------------------------------- + else if (type_ == REGULAR) + { // Regular sieveing; index = frame / sieve + //frames_.assign( maxFrames, -1 ); + frames_.reserve( maxFrames / sieve_ + 1 ); + //int idx = 0; + for (unsigned int i = 0; i < maxFrames; i += sieve_) + frames_.push_back( i ); + //frameToIdx_[i] = idx++; + //actualNframes_ = idx; + } + // --------------------------------------------- + else if (type_ == RANDOM) + { // Random sieving; maxframes / sieve random indices + Iarray frameToIdx( maxFrames, -1 ); + frames_.reserve( maxFrames / sieve_ + 1 ); + double dmax = (double)maxFrames; + Random_Number random; + random.rn_set( iseed ); + for (unsigned int i = 0; i < maxFrames; i -= sieve_) + { + bool frame_generated = false; + // Pick until we pick a frame that has not yet been selected. + while (!frame_generated) { + double dframe = dmax * random.rn_gen(); + int iframe = (int)dframe; + if (frameToIdx[iframe] == -1) { + frameToIdx[iframe] = 1; + frame_generated = true; + } + } + } + // Put indices in order + //int idx = 0; + for (unsigned int i = 0; i < maxFrames; i++) + if (frameToIdx[i] == 1) + frames_.push_back( i ); + //actualNframes_ = idx; + } + // --------------------------------------------- +// MakeIdxToFrame(); + return 0; +} + diff --git a/src/Cluster/Cframes.h b/src/Cluster/Cframes.h index f564ecdc49..81d9ba9580 100644 --- a/src/Cluster/Cframes.h +++ b/src/Cluster/Cframes.h @@ -8,8 +8,11 @@ namespace Cluster { class Cframes { typedef std::vector Iarray; public: - Cframes() {} - Cframes(size_t n, int i) : frames_(n, i) {} + enum SieveType { NONE=0, REGULAR, RANDOM }; + + Cframes() : type_(NONE), sieve_(1) {} + Cframes(size_t n, int i) : frames_(n, i), type_(NONE), sieve_(1) {} + size_t size() const { return frames_.size(); } typedef Iarray::const_iterator const_iterator; const_iterator begin() const { return frames_.begin(); } @@ -27,8 +30,14 @@ class Cframes { void Insert(Cframes const& rhs) { frames_.insert(frames_.end(), rhs.begin(), rhs.end()); } void Remove(int); void Sort(); + + int SetFramesToCluster(int, size_t, int); private: + void DetermineTypeFromSieve(int); + Iarray frames_; + SieveType type_; + int sieve_; }; typedef Cframes::const_iterator Cframes_it; diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index cd84d66979..a6d1ba54ee 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -142,6 +142,11 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, } mprintf("DEBUG: metric memory: %x\n", metric_); + return Common(analyzeArgs); +} + +/** Common setup. */ +int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { // Allocate PairwiseMatrix. if (AllocatePairwise( analyzeArgs, metric_ )) { mprinterr("Error: PairwiseMatrix setup failed.\n"); @@ -155,8 +160,18 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, } algorithm_->SetDebug( verbose_ ); - Info(); + // Sieve options + sieveSeed_ = analyzeArgs.getKeyInt("sieveseed", -1); + sieve_ = analyzeArgs.getKeyInt("sieve", 1); + if (sieve_ < 1) { + mprinterr("Error: 'sieve <#>' must be >= 1 (%i)\n", sieve_); + return 1; + } + if (analyzeArgs.hasKey("random") && sieve_ > 1) + sieve_ = -sieve_; // negative # indicates random sieve + + Info(); return 0; } @@ -173,10 +188,9 @@ int Cpptraj::Cluster::Control::Run() { return 1; } - // Figure out which frames to cluster TODO sieve + // Figure out which frames to cluster Cframes framesToCluster; - for (unsigned int i = 0; i < metric_->Ntotal(); i++) - framesToCluster.push_back( i ); + framesToCluster.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); // Cache distances if necessary pmatrix_->CacheDistances( framesToCluster ); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 626b20000d..33a7cabb73 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -11,7 +11,9 @@ namespace Cluster { /// Hold clusters, algorithm, and pairwise matrix. class Control { public: - Control() : metric_(0), pmatrix_(0), algorithm_(0), verbose_(0) {} + Control() : metric_(0), pmatrix_(0), algorithm_(0), verbose_(0), + sieve_(1), sieveSeed_(-1) + {} static const char* PairwiseArgs; static const char* AlgorithmArgs; @@ -32,11 +34,16 @@ class Control { static Algorithm* AllocateAlgorithm(Algorithm::Type); int AllocateAlgorithm(ArgList&); + int Common(ArgList&); + List clusters_; Metric* metric_; PairwiseMatrix* pmatrix_; Algorithm* algorithm_; int verbose_; + + int sieve_; ///< Sieve value + int sieveSeed_; ///< Seed if doing random sieve }; } /** END namespace Cluster. */ diff --git a/src/cpptrajdepend b/src/cpptrajdepend index a444641c03..779725ad02 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -143,7 +143,7 @@ CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule. Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h -Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h +Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h From 7f9fd0d7d604ecd1df7929a30315a65e2e2d91b7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 13:43:28 -0500 Subject: [PATCH 044/417] DRR - Cpptraj: Keep track of frames that have been sieved out. --- src/Cluster/Cframes.cpp | 34 +++++++++++++++++++++------------- src/Cluster/Cframes.h | 7 ++++--- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/Cluster/Cframes.cpp b/src/Cluster/Cframes.cpp index 9c1f8616c3..57c49e7680 100644 --- a/src/Cluster/Cframes.cpp +++ b/src/Cluster/Cframes.cpp @@ -34,31 +34,39 @@ int Cpptraj::Cluster::Cframes::SetFramesToCluster(int sieveIn, size_t maxFrames, { if (maxFrames < 1) return 1; DetermineTypeFromSieve( sieveIn ); -// frameToIdx_.clear(); + frames_.clear(); + sievedOut_.clear(); // --------------------------------------------- if (type_ == NONE) - { // No sieving; frame == index + { + // No sieving; frame == index frames_.reserve( maxFrames ); for (unsigned int i = 0; i < maxFrames; i++) frames_.push_back( i ); - //actualNframes_ = (int)maxFrames; } // --------------------------------------------- else if (type_ == REGULAR) - { // Regular sieveing; index = frame / sieve - //frames_.assign( maxFrames, -1 ); + { + // Regular sieveing; index = frame / sieve frames_.reserve( maxFrames / sieve_ + 1 ); - //int idx = 0; - for (unsigned int i = 0; i < maxFrames; i += sieve_) - frames_.push_back( i ); - //frameToIdx_[i] = idx++; - //actualNframes_ = idx; + sievedOut_.reserve( maxFrames - (maxFrames / sieve_) ); + unsigned int tgt = 0; + for (unsigned int i = 0; i < maxFrames; i++) + { + if (i == tgt) { + frames_.push_back( i ); + tgt += sieve_; + } else + sievedOut_.push_back( i ); + } } // --------------------------------------------- else if (type_ == RANDOM) - { // Random sieving; maxframes / sieve random indices + { + // Random sieving; maxframes / sieve random indices Iarray frameToIdx( maxFrames, -1 ); frames_.reserve( maxFrames / sieve_ + 1 ); + sievedOut_.reserve( maxFrames - (maxFrames / sieve_) ); double dmax = (double)maxFrames; Random_Number random; random.rn_set( iseed ); @@ -76,11 +84,11 @@ int Cpptraj::Cluster::Cframes::SetFramesToCluster(int sieveIn, size_t maxFrames, } } // Put indices in order - //int idx = 0; for (unsigned int i = 0; i < maxFrames; i++) if (frameToIdx[i] == 1) frames_.push_back( i ); - //actualNframes_ = idx; + else + sievedOut_.push_back( i ); } // --------------------------------------------- // MakeIdxToFrame(); diff --git a/src/Cluster/Cframes.h b/src/Cluster/Cframes.h index 81d9ba9580..5270a4c192 100644 --- a/src/Cluster/Cframes.h +++ b/src/Cluster/Cframes.h @@ -35,9 +35,10 @@ class Cframes { private: void DetermineTypeFromSieve(int); - Iarray frames_; - SieveType type_; - int sieve_; + Iarray frames_; ///< Frames to cluster. + Iarray sievedOut_; ///< Frames that will not be clustered. + SieveType type_; ///< Sieving type. + int sieve_; ///< Sieving value. }; typedef Cframes::const_iterator Cframes_it; From 0a8e1d1ae20114bb780cb5aa64756009f86d1ac2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 14:34:15 -0500 Subject: [PATCH 045/417] DRR - Cpptraj: Start adding different sieve restore types. --- src/Cluster/Algorithm.h | 8 +++++--- src/Cluster/Control.cpp | 28 ++++++++++++++++++++++++++-- src/Cluster/Control.h | 13 +++++++------ 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index 9f2ae064a5..dc576ec1ce 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -9,9 +9,9 @@ namespace Cluster { /// Abstract base class for implementing clustering algorithms. class Algorithm { public: - enum Type { HIERAGGLO = 0, DBSCAN, DPEAKS, KMEANS }; + enum AType { HIERAGGLO = 0, DBSCAN, DPEAKS, KMEANS }; - Algorithm(Type t) : debug_(0), type_(t) {} + Algorithm(AType t) : debug_(0), type_(t) {} virtual ~Algorithm() {} /// Set up clustering algorithm virtual int Setup(ArgList&) = 0; @@ -26,10 +26,12 @@ class Algorithm { // ------------------------------------------- /// Set debug level for algorithm void SetDebug(int d) { debug_ = d; } + /// \return Algorithm type + AType Type() const { return type_; } protected: int debug_; private: - Type type_; + AType type_; }; } /* END namespace Cluster */ diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index a6d1ba54ee..09ab7c6021 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -9,6 +9,16 @@ #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" +Cpptraj::Cluster::Control::Control() : + metric_(0), + pmatrix_(0), + algorithm_(0), + verbose_(0), + sieve_(1), + sieveSeed_(-1), + sieveRestore_(NO_RESTORE) +{} + // ----------------------------------------------------------------------------- /** \return pointer to PairwiseMatrix of specified type. */ Cpptraj::Cluster::PairwiseMatrix* @@ -52,7 +62,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, Metric* me // ----------------------------------------------------------------------------- /** \return Pointer to Algorithm of given type. */ -Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algorithm::Type atype) +Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algorithm::AType atype) { Algorithm* alg = 0; switch (atype) { @@ -68,7 +78,7 @@ const char* Cpptraj::Cluster::Control::AlgorithmArgs = /** Set up Algorithm from keyword + arguments. */ int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { - Algorithm::Type atype; + Algorithm::AType atype; if (analyzeArgs.hasKey("hieragglo")) atype = Algorithm::HIERAGGLO; else if (analyzeArgs.hasKey("dbscan" )) atype = Algorithm::DBSCAN; else if (analyzeArgs.hasKey("kmeans") || @@ -169,6 +179,16 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { } if (analyzeArgs.hasKey("random") && sieve_ > 1) sieve_ = -sieve_; // negative # indicates random sieve + // Choose sieve restore option based on algorithm. + if (sieve_ != 1) { + sieveRestore_ = CLOSEST_CENTROID; + if (algorithm_->Type() == Algorithm::DBSCAN) { + if (!analyzeArgs.hasKey("sievetoframe")) + sieveRestore_ = EPSILON_CENTROID; + else + sieveRestore_ = EPSILON_FRAME; + } + } Info(); @@ -182,6 +202,10 @@ void Cpptraj::Cluster::Control::Info() const { } int Cpptraj::Cluster::Control::Run() { + if (metric_ == 0 || pmatrix_ == 0 || algorithm_ == 0) { + mprinterr("Internal Error: Cluster::Control is not set up.\n"); + return 1; + } // Set up the Metric if (metric_->Setup()) { mprinterr("Error: Metric setup failed.\n"); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 33a7cabb73..90288596e9 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -11,13 +11,13 @@ namespace Cluster { /// Hold clusters, algorithm, and pairwise matrix. class Control { public: - Control() : metric_(0), pmatrix_(0), algorithm_(0), verbose_(0), - sieve_(1), sieveSeed_(-1) - {} + Control(); static const char* PairwiseArgs; static const char* AlgorithmArgs; + enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; + int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); void Info() const; @@ -31,7 +31,7 @@ class Control { static Metric* AllocateMetric(Metric::Type); - static Algorithm* AllocateAlgorithm(Algorithm::Type); + static Algorithm* AllocateAlgorithm(Algorithm::AType); int AllocateAlgorithm(ArgList&); int Common(ArgList&); @@ -42,8 +42,9 @@ class Control { Algorithm* algorithm_; int verbose_; - int sieve_; ///< Sieve value - int sieveSeed_; ///< Seed if doing random sieve + int sieve_; ///< Sieve value + int sieveSeed_; ///< Seed if doing random sieve + SieveRestoreType sieveRestore_; ///< Specify if/how sieved frames should be restored. }; } /** END namespace Cluster. */ From 16a537c4f514545e8e5590493ea92f41e66ff3ad Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 15:34:22 -0500 Subject: [PATCH 046/417] DRR - Cpptraj: Put sieving stuff in a different class. --- src/Cluster/Sieve.cpp | 80 +++++++++++++++++++++++++++++++++++++++++++ src/Cluster/Sieve.h | 29 ++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 src/Cluster/Sieve.cpp create mode 100644 src/Cluster/Sieve.h diff --git a/src/Cluster/Sieve.cpp b/src/Cluster/Sieve.cpp new file mode 100644 index 0000000000..f4688f0c1e --- /dev/null +++ b/src/Cluster/Sieve.cpp @@ -0,0 +1,80 @@ +#include "Sieve.h" +#include "../Random.h" + +void Cpptraj::Cluster::Sieve::DetermineTypeFromSieve( int sieveIn ) { + sieve_ = sieveIn; + // Determine sieve type from sieve value. + if (sieve_ < -1) + type_ = RANDOM; + else if (sieve_ < 2) { + type_ = NONE; + sieve_ = 1; + } else + type_ = REGULAR; +} + +/** Setup which frames should be clustered.*/ +int Cpptraj::Cluster::Sieve::SetFramesToCluster(int sieveIn, size_t maxFrames, int iseed) +{ + if (maxFrames < 1) return 1; + DetermineTypeFromSieve( sieveIn ); + framesToCluster_.clear(); + sievedOut_.clear(); + // --------------------------------------------- + if (type_ == NONE) + { + // No sieving; frame == index + framesToCluster_.reserve( maxFrames ); + for (unsigned int i = 0; i < maxFrames; i++) + framesToCluster_.push_back( i ); + } + // --------------------------------------------- + else if (type_ == REGULAR) + { + // Regular sieveing; index = frame / sieve + framesToCluster_.reserve( maxFrames / sieve_ + 1 ); + sievedOut_.reserve( maxFrames - (maxFrames / sieve_) ); + unsigned int tgt = 0; + for (unsigned int i = 0; i < maxFrames; i++) + { + if (i == tgt) { + framesToCluster_.push_back( i ); + tgt += sieve_; + } else + sievedOut_.push_back( i ); + } + } + // --------------------------------------------- + else if (type_ == RANDOM) + { + // Random sieving; maxframes / sieve random indices + Cframes frameToIdx( maxFrames, -1 ); + framesToCluster_.reserve( maxFrames / sieve_ + 1 ); + sievedOut_.reserve( maxFrames - (maxFrames / sieve_) ); + double dmax = (double)maxFrames; + Random_Number random; + random.rn_set( iseed ); + for (unsigned int i = 0; i < maxFrames; i -= sieve_) + { + bool frame_generated = false; + // Pick until we pick a frame that has not yet been selected. + while (!frame_generated) { + double dframe = dmax * random.rn_gen(); + int iframe = (int)dframe; + if (frameToIdx[iframe] == -1) { + frameToIdx[iframe] = 1; + frame_generated = true; + } + } + } + // Put indices in order + for (unsigned int i = 0; i < maxFrames; i++) + if (frameToIdx[i] == 1) + framesToCluster_.push_back( i ); + else + sievedOut_.push_back( i ); + } + // --------------------------------------------- +// MakeIdxToFrame(); + return 0; +} diff --git a/src/Cluster/Sieve.h b/src/Cluster/Sieve.h new file mode 100644 index 0000000000..7f783f8e90 --- /dev/null +++ b/src/Cluster/Sieve.h @@ -0,0 +1,29 @@ +#ifndef INC_CLUSTER_SIEVE_H +#define INC_CLUSTER_SIEVE_H +#include "Cframes.h" +namespace Cpptraj { +namespace Cluster { + +/// Hold frames to be clustered and frames to be sieved out. +class Sieve { + public: + enum SieveType { NONE=0, REGULAR, RANDOM }; + + Sieve() : type_(NONE), sieve_(1) {} + + int SetFramesToCluster(int, size_t, int); + + Cframes const& FramesToCluster() const { return framesToCluster_; } + Cframes const& SievedOut() const { return sievedOut_; } + private: + void DetermineTypeFromSieve(int); + + Cframes framesToCluster_; ///< Frames to cluster. + Cframes sievedOut_; ///< Frames that will not be clustered (i.e. sieved out). + SieveType type_; ///< Sieveing type. + int sieve_; ///< Sieving value. +}; + +} +} +#endif From 95901ba26d71c8a317fab273d08eae0e90c90b4c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 15:35:29 -0500 Subject: [PATCH 047/417] DRR - Cpptraj: Add basic sieve restore. --- src/Cluster/Cframes.cpp | 80 ----------------------------------------- src/Cluster/Cframes.h | 15 +++----- src/Cluster/Control.cpp | 21 +++++++++-- src/Cluster/Control.h | 3 ++ src/Cluster/List.cpp | 67 ++++++++++++++++++++++++++++++++++ src/Cluster/List.h | 4 +++ src/cpptrajdepend | 7 ++-- src/cpptrajfiles | 3 +- 8 files changed, 103 insertions(+), 97 deletions(-) diff --git a/src/Cluster/Cframes.cpp b/src/Cluster/Cframes.cpp index 57c49e7680..560772ba07 100644 --- a/src/Cluster/Cframes.cpp +++ b/src/Cluster/Cframes.cpp @@ -1,6 +1,5 @@ #include #include "Cframes.h" -#include "../Random.h" bool Cpptraj::Cluster::Cframes::HasFrame(int frame) const { Iarray::const_iterator it = std::find(frames_.begin(), frames_.end(), frame); @@ -16,82 +15,3 @@ void Cpptraj::Cluster::Cframes::Remove(int frame) { void Cpptraj::Cluster::Cframes::Sort() { std::sort(frames_.begin(), frames_.end()); } - -void Cpptraj::Cluster::Cframes::DetermineTypeFromSieve( int sieveIn ) { - sieve_ = sieveIn; - // Determine sieve type from sieve value. - if (sieve_ < -1) - type_ = RANDOM; - else if (sieve_ < 2) { - type_ = NONE; - sieve_ = 1; - } else - type_ = REGULAR; -} - -/** Setup which frames should be clustered.*/ -int Cpptraj::Cluster::Cframes::SetFramesToCluster(int sieveIn, size_t maxFrames, int iseed) -{ - if (maxFrames < 1) return 1; - DetermineTypeFromSieve( sieveIn ); - frames_.clear(); - sievedOut_.clear(); - // --------------------------------------------- - if (type_ == NONE) - { - // No sieving; frame == index - frames_.reserve( maxFrames ); - for (unsigned int i = 0; i < maxFrames; i++) - frames_.push_back( i ); - } - // --------------------------------------------- - else if (type_ == REGULAR) - { - // Regular sieveing; index = frame / sieve - frames_.reserve( maxFrames / sieve_ + 1 ); - sievedOut_.reserve( maxFrames - (maxFrames / sieve_) ); - unsigned int tgt = 0; - for (unsigned int i = 0; i < maxFrames; i++) - { - if (i == tgt) { - frames_.push_back( i ); - tgt += sieve_; - } else - sievedOut_.push_back( i ); - } - } - // --------------------------------------------- - else if (type_ == RANDOM) - { - // Random sieving; maxframes / sieve random indices - Iarray frameToIdx( maxFrames, -1 ); - frames_.reserve( maxFrames / sieve_ + 1 ); - sievedOut_.reserve( maxFrames - (maxFrames / sieve_) ); - double dmax = (double)maxFrames; - Random_Number random; - random.rn_set( iseed ); - for (unsigned int i = 0; i < maxFrames; i -= sieve_) - { - bool frame_generated = false; - // Pick until we pick a frame that has not yet been selected. - while (!frame_generated) { - double dframe = dmax * random.rn_gen(); - int iframe = (int)dframe; - if (frameToIdx[iframe] == -1) { - frameToIdx[iframe] = 1; - frame_generated = true; - } - } - } - // Put indices in order - for (unsigned int i = 0; i < maxFrames; i++) - if (frameToIdx[i] == 1) - frames_.push_back( i ); - else - sievedOut_.push_back( i ); - } - // --------------------------------------------- -// MakeIdxToFrame(); - return 0; -} - diff --git a/src/Cluster/Cframes.h b/src/Cluster/Cframes.h index 5270a4c192..34a42abd80 100644 --- a/src/Cluster/Cframes.h +++ b/src/Cluster/Cframes.h @@ -8,10 +8,8 @@ namespace Cluster { class Cframes { typedef std::vector Iarray; public: - enum SieveType { NONE=0, REGULAR, RANDOM }; - - Cframes() : type_(NONE), sieve_(1) {} - Cframes(size_t n, int i) : frames_(n, i), type_(NONE), sieve_(1) {} + Cframes() {} + Cframes(size_t n, int i) : frames_(n, i) {} size_t size() const { return frames_.size(); } typedef Iarray::const_iterator const_iterator; @@ -25,20 +23,15 @@ class Cframes { int& operator[](unsigned int idx) { return frames_[idx]; } void push_back(int i) { frames_.push_back( i ); } void assign(size_t n, int i) { frames_.assign(n, i); } + void clear() { frames_.clear(); } + void reserve(size_t n) { frames_.reserve(n); } bool HasFrame(int) const; void Insert(Cframes const& rhs) { frames_.insert(frames_.end(), rhs.begin(), rhs.end()); } void Remove(int); void Sort(); - - int SetFramesToCluster(int, size_t, int); private: - void DetermineTypeFromSieve(int); - Iarray frames_; ///< Frames to cluster. - Iarray sievedOut_; ///< Frames that will not be clustered. - SieveType type_; ///< Sieving type. - int sieve_; ///< Sieving value. }; typedef Cframes::const_iterator Cframes_it; diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 09ab7c6021..fab81ded20 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -1,6 +1,7 @@ #include "Control.h" #include "../CpptrajStdio.h" #include "../DataSet_Coords.h" +#include "Sieve.h" // PairwiseMatrix classes #include "PairwiseMatrix_MEM.h" // Metric classes @@ -213,8 +214,9 @@ int Cpptraj::Cluster::Control::Run() { } // Figure out which frames to cluster - Cframes framesToCluster; - framesToCluster.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); + Sieve frameSieve; + frameSieve.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); + Cframes const& framesToCluster = frameSieve.FramesToCluster(); // Cache distances if necessary pmatrix_->CacheDistances( framesToCluster ); @@ -223,6 +225,21 @@ int Cpptraj::Cluster::Control::Run() { // Cluster int err = algorithm_->DoClustering(clusters_, framesToCluster, *pmatrix_); + if ( sieveRestore_ != NO_RESTORE ) { + // Update cluster centroids in case they need to be used to restore sieved frames + clusters_.UpdateCentroids( metric_ ); + // Restore sieved frames + mprintf("\tRestoring sieved frames.\n"); + switch (sieveRestore_) { + case CLOSEST_CENTROID : + clusters_.AddFramesByCentroid( frameSieve.SievedOut(), metric_ ); + break; + default: + mprinterr("Internal Error: Unhandled sieve restore type.\n"); + return 1; + } + } + // Sort by population and renumber clusters_.Sort(); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 90288596e9..fd1d120410 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -17,6 +17,9 @@ class Control { static const char* AlgorithmArgs; enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; + enum SieveType { NONE=0, REGULAR, RANDOM }; + + static int SetFramesToCluster(Cframes&, Cframes&, int, size_t, int); int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index db51f530e4..9dead212d4 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -1,5 +1,7 @@ +#include #include "List.h" #include "../CpptrajStdio.h" +#include "../ProgressBar.h" void Cpptraj::Cluster::List::PrintClusters() const { //mprintf("CLUSTER: %u clusters, %u frames.\n", clusters_.size(), @@ -52,3 +54,68 @@ int Cpptraj::Cluster::List::Sort() { it->SetNum( newNum++ ); return 0; } + +/** Update centroids. */ +void Cpptraj::Cluster::List::UpdateCentroids( Metric* metric ) { + for (cluster_it node = clusters_.begin(); node != clusters_.end(); ++node) { + node->SortFrameList(); + node->CalculateCentroid( metric ); + } +} + +// ----------------------------------------------------------------------------- +void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric* metricIn) +{ + // NOTE: All cluster centroids must be up to date. + int idx; + int nframes = (int)framesIn.size(); + double mindist, dist; + cluster_it minNode, Cnode; + ParallelProgress progress( nframes ); + // For OMP, every other thread will need its own Cdist. + Metric* MyCdist = metricIn; +# ifdef _OPENMP + // For OMP need a temp. array to hold which frame goes to which cluster to avoid clashes + std::vector idxToCluster( nframes, clusters_.end() ); +# pragma omp parallel private(MyCdist, idx, dist, mindist, minNode, Cnode) firstprivate(progress) + { + int mythread = omp_get_thread_num(); + progress.SetThread( mythread ); + if (mythread == 0) { + mprintf("\tParallelizing sieve restore calc with %i threads\n", omp_get_num_threads()); + MyCdist = metricIn; + } else + MyCdist = metricIn->Copy(); +# pragma omp for schedule(dynamic) +# endif + for (idx = 0; idx < nframes; ++idx) { + progress.Update( idx ); + int frame = framesIn[idx]; + // Which clusters centroid is closest to this frame? + mindist = std::numeric_limits::max(); + minNode = clusters_.end(); + for (Cnode = clusters_.begin(); Cnode != clusters_.end(); ++Cnode) { + dist = MyCdist->FrameCentroidDist(frame, Cnode->Cent()); + if (dist < mindist) { + mindist = dist; + minNode = Cnode; + } + } + // Add sieved frame to the closest cluster. +# ifdef _OPENMP + idxToCluster[idx] = minNode; +# else + minNode->AddFrameToCluster( frame ); +# endif + } // END loop over frames +# ifdef _OPENMP + if (mythread > 0) + delete MyCdist; + } // END pragma omp parallel + // Now actually add sieved frames to their appropriate clusters + for (idx = 0; idx < nframes; idx++) + idxToCluster[idx]->AddFrameToCluster( framesIn[idx] ); +# endif + progress.Finish(); +} + diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 186941494f..6f572fe5f7 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -43,6 +43,10 @@ class List { int Sort(); /// Add given frame as noise. void AddNoise(int f) { noise_.push_back( f ); } + /// Update centroids TODO check if they need updating + void UpdateCentroids(Metric*); + /// Add given frames to clusters based on distance to centroid. + void AddFramesByCentroid(Cframes const&, Metric*); private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 779725ad02..0535d8bd64 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -143,13 +143,14 @@ CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule. Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h -Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/../Random.h Cluster/Cframes.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h -Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.h +Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterList.o : ClusterList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 85ac097525..8bf52fefa1 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -9,7 +9,8 @@ CLUSTER_SOURCES= \ Cluster/Metric_RMS.cpp \ Cluster/Node.cpp \ Cluster/PairwiseMatrix.cpp \ - Cluster/PairwiseMatrix_MEM.cpp + Cluster/PairwiseMatrix_MEM.cpp \ + Cluster/Sieve.cpp # These files are common to cpptraj/libcpptraj. Files that need to be built # differently for each will go into SOURCES/LIBCPPTRAJ_OBJECTS respectively. From 3f2630f2e95d73f5d142668aba2d9f639af488e6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 15:46:10 -0500 Subject: [PATCH 048/417] DRR - Cpptraj: Add alternative sieve restore routine. --- src/Cluster/List.cpp | 83 +++++++++++++++++++++++++++++++++++++++++++- src/Cluster/List.h | 2 ++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 9dead212d4..0b01b18c0b 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -86,7 +86,7 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric MyCdist = metricIn; } else MyCdist = metricIn->Copy(); -# pragma omp for schedule(dynamic) +# pragma omp for # endif for (idx = 0; idx < nframes; ++idx) { progress.Update( idx ); @@ -119,3 +119,84 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric progress.Finish(); } + +void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric* metricIn, + bool sieveToCentroid, double epsilon) +{ + // NOTE: All cluster centroids must be up to date! + if (sieveToCentroid) + mprintf("\tRestoring sieved frames if within %.3f of cluster centroid.\n", epsilon); + else + mprintf("\tRestoring sieved frames if within %.3f of frame in nearest cluster.\n", + epsilon); + // Vars allocated here in case of OpenMP + int n_sieved_noise = 0; + int Nsieved = 0; + int idx; + int nframes = (int)framesIn.size(); + ParallelProgress progress( nframes ); + // Need a temporary array to hold which frame belongs to which cluster. + // Otherwise we could be comparoing sieved frames to other sieved frames. + std::vector idxToCluster( nframes, clusters_.end() ); + // For OMP, every other thread will need its own Cdist. + Metric* MyCdist = metricIn; +# ifdef _OPENMP +# pragma omp parallel private(MyCdist, idx) firstprivate(progress) reduction(+ : Nsieved, n_sieved_noise) + { + int mythread = omp_get_thread_num(); + progress.SetThread( mythread ); + if (mythread == 0) { + mprintf("\tParallelizing calculation with %i threads\n", omp_get_num_threads()); + MyCdist = Cdist_; + } else + MyCdist = Cdist_->Copy(); +# pragma omp for +# endif + for (idx = 0; idx < nframes; ++idx) { + progress.Update( idx ); + int frame = framesIn[idx]; + // Which clusters centroid is closest to this frame? + double mindist = std::numeric_limits::max(); + cluster_it minNode = clusters_.end(); + for (cluster_it Cnode = clusters_.begin(); Cnode != clusters_.end(); ++Cnode) { + double dist = MyCdist->FrameCentroidDist(frame, Cnode->Cent()); + if (dist < mindist) { + mindist = dist; + minNode = Cnode; + } + } + bool goodFrame = false; + if ( mindist < epsilon ) + // Frame is already within epsilon, accept. + goodFrame = true; + else if ( !sieveToCentroid ) { + // Check if any frames in the cluster are closer than epsilon to sieved frame. + for (int cidx=0; cidx < minNode->Nframes(); cidx++) + { + if ( MyCdist->FrameDist(frame, minNode->ClusterFrame(cidx)) < epsilon ) + { + goodFrame = true; + break; + } + } + } + // Add sieved frame to the closest cluster if closest distance is + // less than epsilon. + ++Nsieved; + if ( goodFrame ) + idxToCluster[idx] = minNode; + else + n_sieved_noise++; + } // END loop over frames +# ifdef _OPENMP + if (mythread > 0) + delete MyCdist; + } // END pragma omp parallel +# endif + progress.Finish(); + // Now actually add sieved frames to their appropriate clusters + for (idx = 0; idx < nframes; idx++) + idxToCluster[idx]->AddFrameToCluster( framesIn[idx] ); + mprintf("\t%i of %i sieved frames were discarded as noise.\n", + n_sieved_noise, Nsieved); +} diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 6f572fe5f7..93c0453673 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -47,6 +47,8 @@ class List { void UpdateCentroids(Metric*); /// Add given frames to clusters based on distance to centroid. void AddFramesByCentroid(Cframes const&, Metric*); + /// Add given frames to clusters based on distance to centroid and cutoff. + void AddFramesByCentroid(Cframes const&, Metric*, bool, double); private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. From f80aade9bef9cb583e26b14c55569a0a0547e032 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 22 Jan 2019 19:15:00 -0500 Subject: [PATCH 049/417] DRR - Cpptraj: size_t -> std::size_t --- src/Cluster/Cframes.cpp | 2 +- src/Cluster/Cframes.h | 9 +++++---- src/Cluster/Control.h | 2 +- src/Cluster/Sieve.cpp | 2 +- src/Cluster/Sieve.h | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Cluster/Cframes.cpp b/src/Cluster/Cframes.cpp index 560772ba07..1f37b85b0d 100644 --- a/src/Cluster/Cframes.cpp +++ b/src/Cluster/Cframes.cpp @@ -8,7 +8,7 @@ bool Cpptraj::Cluster::Cframes::HasFrame(int frame) const { void Cpptraj::Cluster::Cframes::Remove(int frame) { Iarray::iterator pend = std::remove( frames_.begin(), frames_.end(), frame); - size_t newsize = pend - frames_.begin(); + std::size_t newsize = pend - frames_.begin(); frames_.resize( newsize ); } diff --git a/src/Cluster/Cframes.h b/src/Cluster/Cframes.h index 34a42abd80..af11804da7 100644 --- a/src/Cluster/Cframes.h +++ b/src/Cluster/Cframes.h @@ -1,6 +1,7 @@ #ifndef INC_CLUSTER_CFRAMES_H #define INC_CLUSTER_CFRAMES_H #include +#include // size_t namespace Cpptraj { namespace Cluster { @@ -9,9 +10,9 @@ class Cframes { typedef std::vector Iarray; public: Cframes() {} - Cframes(size_t n, int i) : frames_(n, i) {} + Cframes(std::size_t n, int i) : frames_(n, i) {} - size_t size() const { return frames_.size(); } + std::size_t size() const { return frames_.size(); } typedef Iarray::const_iterator const_iterator; const_iterator begin() const { return frames_.begin(); } const_iterator end() const { return frames_.end(); } @@ -22,9 +23,9 @@ class Cframes { int operator[](unsigned int idx) const { return frames_[idx]; } int& operator[](unsigned int idx) { return frames_[idx]; } void push_back(int i) { frames_.push_back( i ); } - void assign(size_t n, int i) { frames_.assign(n, i); } + void assign(std::size_t n, int i) { frames_.assign(n, i); } void clear() { frames_.clear(); } - void reserve(size_t n) { frames_.reserve(n); } + void reserve(std::size_t n) { frames_.reserve(n); } bool HasFrame(int) const; void Insert(Cframes const& rhs) { frames_.insert(frames_.end(), rhs.begin(), rhs.end()); } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index fd1d120410..21f42da01e 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -19,7 +19,7 @@ class Control { enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; enum SieveType { NONE=0, REGULAR, RANDOM }; - static int SetFramesToCluster(Cframes&, Cframes&, int, size_t, int); + static int SetFramesToCluster(Cframes&, Cframes&, int, std::size_t, int); int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); diff --git a/src/Cluster/Sieve.cpp b/src/Cluster/Sieve.cpp index f4688f0c1e..05f746ed85 100644 --- a/src/Cluster/Sieve.cpp +++ b/src/Cluster/Sieve.cpp @@ -14,7 +14,7 @@ void Cpptraj::Cluster::Sieve::DetermineTypeFromSieve( int sieveIn ) { } /** Setup which frames should be clustered.*/ -int Cpptraj::Cluster::Sieve::SetFramesToCluster(int sieveIn, size_t maxFrames, int iseed) +int Cpptraj::Cluster::Sieve::SetFramesToCluster(int sieveIn, std::size_t maxFrames, int iseed) { if (maxFrames < 1) return 1; DetermineTypeFromSieve( sieveIn ); diff --git a/src/Cluster/Sieve.h b/src/Cluster/Sieve.h index 7f783f8e90..08061f716f 100644 --- a/src/Cluster/Sieve.h +++ b/src/Cluster/Sieve.h @@ -11,7 +11,7 @@ class Sieve { Sieve() : type_(NONE), sieve_(1) {} - int SetFramesToCluster(int, size_t, int); + int SetFramesToCluster(int, std::size_t, int); Cframes const& FramesToCluster() const { return framesToCluster_; } Cframes const& SievedOut() const { return sievedOut_; } From 8a1a5d9d817df958435e851cbf25f563c5994c1d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 11:12:45 -0500 Subject: [PATCH 050/417] DRR - Cpptraj: Start adding code for determining best representative frames. --- src/Cluster/BestReps.cpp | 32 ++++++++++++++++++++++++++++++++ src/Cluster/BestReps.h | 34 ++++++++++++++++++++++++++++++++++ src/cpptrajdepend | 1 + src/cpptrajfiles | 1 + 4 files changed, 68 insertions(+) create mode 100644 src/Cluster/BestReps.cpp create mode 100644 src/Cluster/BestReps.h diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp new file mode 100644 index 0000000000..923198ab7d --- /dev/null +++ b/src/Cluster/BestReps.cpp @@ -0,0 +1,32 @@ +#include "BestReps.h" + +/// Save up to maxSize of the best (lowest) representative scores/frames. +void Cpptraj::Cluster::BestReps::SaveBestRep(RepMap& reps, RepPair const& Dist_Num, + unsigned int maxSize) +{ + if (reps.size() < maxSize) + reps.insert( Dist_Num ); + else { + RepMap::reverse_iterator end = reps.rbegin(); + if (Dist_Num.first < end->first) { + reps.insert( Dist_Num ); + if (reps.size() > maxSize) { + RepMap::iterator it = reps.end(); + --it; + reps.erase( it ); + } + } + } +} + +/// Set given cluster node with best representative frames/scores in reps +void Cpptraj::Cluster::BestReps::SetBestRepFrame(Node& node, RepMap const& reps) +{ + if (!reps.empty()) { + node.BestReps().clear(); + for (RepMap::const_iterator it = reps.begin(); it != reps.end(); ++it) { + node.BestReps().push_back( Node::RepPair(it->second, (float)it->first) ); + } + } +} + diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h new file mode 100644 index 0000000000..9ad3cb5df8 --- /dev/null +++ b/src/Cluster/BestReps.h @@ -0,0 +1,34 @@ +#ifndef INC_CLUSTER_BESTREPS_H +#define INC_CLUSTER_BESTREPS_H +#include +#include "Node.h" +#include "List.h" +#include "PairwiseMatrix.h" +namespace Cpptraj { +namespace Cluster { + +/// Used to find best representative structures for a cluster. +class BestReps { + public: + enum RepMethodType { CUMULATIVE = 0, CENTROID }; + + static int FindBestRepFrames(RepMethodType, int, List&, PairwiseMatrix const&); + private: + /// Used to pair representative score with frame number. + typedef std::pair RepPair; + /// Used to hold pairs of representative scores to frames. + typedef std::multimap RepMap; + + /// Save up to maxSize of the best (lowest) representative scores/frames. + static void SaveBestRep(RepMap&, RepPair const&, unsigned int); + /// Set given cluster node with best representative frames/scores in reps + static void SetBestRepFrame(Node& node, RepMap const&); + /// Find best representative frames by shortest distance to all other frames. + static int FindBestRepFrames_CumulativeDist(int, List&, PairwiseMatrix const&); + /// Find best representative frames by shortest distance to centroid. + static int FindBestRepFrames_Centroid(int, List&, PairwiseMatrix const&); +}; + +} +} +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 0535d8bd64..19a01ae8f0 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -142,6 +142,7 @@ CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStd CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 8bf52fefa1..89038bb076 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -2,6 +2,7 @@ CLUSTER_SOURCES= \ Cluster/Algorithm_DBscan.cpp \ Cluster/Algorithm_HierAgglo.cpp \ + Cluster/BestReps.cpp \ Cluster/Centroid_Coord.cpp \ Cluster/Cframes.cpp \ Cluster/Control.cpp \ From 1c3948c68aa661cd8f3580052d218704f041d48f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 11:23:50 -0500 Subject: [PATCH 051/417] DRR - Cpptraj: Add find best representative frames by cumulative distance. --- src/Cluster/BestReps.cpp | 64 ++++++++++++++++++++++++++++++++++++++++ src/Cluster/BestReps.h | 2 +- src/cpptrajdepend | 2 +- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 923198ab7d..aa7bf4e49d 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -1,4 +1,5 @@ #include "BestReps.h" +#include "../CpptrajStdio.h" /// Save up to maxSize of the best (lowest) representative scores/frames. void Cpptraj::Cluster::BestReps::SaveBestRep(RepMap& reps, RepPair const& Dist_Num, @@ -30,3 +31,66 @@ void Cpptraj::Cluster::BestReps::SetBestRepFrame(Node& node, RepMap const& reps) } } +/** Find best representative frames for each cluster. */ +int Cpptraj::Cluster::BestReps::FindBestRepFrames(RepMethodType type, int nToSave, + List& clusters, PairwiseMatrix const& pmatrix, + int debug) +{ + int err = 0; + switch (type) { + case CUMULATIVE: + err = FindBestRepFrames_CumulativeDist(nToSave, clusters, pmatrix); break; + default: + mprinterr("Internal Error: BestReps::FindBestRepFrames: Unhandled type.\n"); + err = 1; + } + + // DEBUG + if (debug > 0) { + for (List::cluster_iterator node = clusters.begin(); node != clusters.end(); ++node) + { + mprintf("DEBUG: Cluster %i best reps:\n", node->Num()); + for (Node::RepPairArray::const_iterator it = node->BestReps().begin(); + it != node->BestReps().end(); ++it) + mprintf("\t%i (%g)\n", it->second, it->first); + } + } + + return err; +} + +// ClusterList::FindBestRepFrames_CumulativeDist() +/** Find the frame in each cluster that is the best representative by + * having the lowest cumulative distance to every other point in the cluster. + */ +int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(int nToSave, List& clusters, + PairwiseMatrix const& pmatrix) +{ + int err = 0; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { + //node->Cent()->Print("centroid." + integerToString(node->Num())); // DEBUG + //CpptrajFile tmp; // DEBUG + //tmp.OpenWrite("c"+integerToString(node->Num())+".bestRep.dat"); // DEBUG + RepMap bestReps; + for (Node::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) + { + double cdist = 0.0; + for (Node::frame_iterator f2 = node->beginframe(); f2 != node->endframe(); ++f2) + { + if (f1 != f2) + cdist += pmatrix.Frame_Distance(*f1, *f2); + } + SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave); + //tmp.Printf("%i %g %g\n", *f1+1, cdist, Cdist_->FrameCentroidDist(*f1, node->Cent())); + } + //tmp.CloseFile(); + if (bestReps.empty()) { + mprinterr("Error: Could not determine represenative frame for cluster %i\n", + node->Num()); + err++; + } + SetBestRepFrame( *node, bestReps ); + } + return err; +} + diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index 9ad3cb5df8..82094a12dd 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -12,7 +12,7 @@ class BestReps { public: enum RepMethodType { CUMULATIVE = 0, CENTROID }; - static int FindBestRepFrames(RepMethodType, int, List&, PairwiseMatrix const&); + static int FindBestRepFrames(RepMethodType, int, List&, PairwiseMatrix const&, int); private: /// Used to pair representative score with frame number. typedef std::pair RepPair; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 19a01ae8f0..9997466915 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -142,7 +142,7 @@ CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStd CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.h From cf94c08caaf8074e739003aecc5553b0fc80d91a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 11:29:59 -0500 Subject: [PATCH 052/417] DRR - Cpptraj: Add find best reps by centroid. --- src/Cluster/BestReps.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index aa7bf4e49d..6c7e153d07 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -40,6 +40,8 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames(RepMethodType type, int nToSav switch (type) { case CUMULATIVE: err = FindBestRepFrames_CumulativeDist(nToSave, clusters, pmatrix); break; + case CENTROID: + err = FindBestRepFrames_Centroid(nToSave, clusters, pmatrix); break; default: mprinterr("Internal Error: BestReps::FindBestRepFrames: Unhandled type.\n"); err = 1; @@ -94,3 +96,29 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(int nToSave, Li return err; } +/** Find the frame in the cluster that is the best representative by + * having the lowest distance to the cluster centroid. + */ +int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(int nToSave, List& clusters, + PairwiseMatrix const& pmatrix) +{ + int err = 0; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { + //mprintf("DEBUG: FindBestRepFrames_Centroid: Cluster %i\n", node->Num()); + RepMap bestReps; + //node->Cent()->Print("centroid." + integerToString(node->Num())); // DEBUG + for (Node::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) + { + double dist = pmatrix.MetricPtr()->FrameCentroidDist(*f1, node->Cent()); + //mprintf("\t%8i %10.4g %10.4g %i\n", *f1+1, dist, mindist, minframe+1); + SaveBestRep(bestReps, RepPair(dist, *f1), nToSave); + } + if (bestReps.empty()) { + mprinterr("Error: Could not determine represenative frame for cluster %i\n", + node->Num()); + err++; + } + SetBestRepFrame( *node, bestReps ); + } + return err; +} From c280e8cc2bc74c32425e1a569199f9185775931a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 11:41:51 -0500 Subject: [PATCH 053/417] DRR - Cpptraj: Add best rep options. --- src/Cluster/BestReps.cpp | 2 ++ src/Cluster/BestReps.h | 2 +- src/Cluster/Control.cpp | 45 +++++++++++++++++++++++++++++++++++++--- src/Cluster/Control.h | 4 ++++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 6c7e153d07..7afa834b75 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -42,6 +42,8 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames(RepMethodType type, int nToSav err = FindBestRepFrames_CumulativeDist(nToSave, clusters, pmatrix); break; case CENTROID: err = FindBestRepFrames_Centroid(nToSave, clusters, pmatrix); break; + case NO_REPS: + mprintf("Warning: Skipping best representative frame calc.\n"); break; default: mprinterr("Internal Error: BestReps::FindBestRepFrames: Unhandled type.\n"); err = 1; diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index 82094a12dd..953f43d152 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -10,7 +10,7 @@ namespace Cluster { /// Used to find best representative structures for a cluster. class BestReps { public: - enum RepMethodType { CUMULATIVE = 0, CENTROID }; + enum RepMethodType { NO_REPS = 0, CUMULATIVE, CENTROID }; static int FindBestRepFrames(RepMethodType, int, List&, PairwiseMatrix const&, int); private: diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index fab81ded20..9802b2cafd 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -17,7 +17,9 @@ Cpptraj::Cluster::Control::Control() : verbose_(0), sieve_(1), sieveSeed_(-1), - sieveRestore_(NO_RESTORE) + sieveRestore_(NO_RESTORE), + bestRep_(BestReps::NO_REPS), + nRepsToSave_(1) {} // ----------------------------------------------------------------------------- @@ -191,6 +193,32 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { } } + // Best rep options + std::string bestRepStr = analyzeArgs.GetStringKey("bestrep"); + if (bestRepStr.empty()) { + // For sieving, cumulative can get very expensive. Default to centroid. + if (sieve_ != 1) + bestRep_ = BestReps::CENTROID; + else + bestRep_ = BestReps::CUMULATIVE; + } else { + if (bestRepStr == "cumulative") + bestRep_ = BestReps::CUMULATIVE; + else if (bestRepStr == "centroid") + bestRep_ = BestReps::CENTROID; + //else if (bestRepStr == "cumulative_nosieve") + // bestRep_ = CUMULATIVE_NOSIEVE; + else { + mprinterr("Error: Invalid 'bestRep' option (%s)\n", bestRepStr.c_str()); + return 1; + } + } + nRepsToSave_ = analyzeArgs.getKeyInt("savenreps", 1); + if (nRepsToSave_ < 1) { + mprinterr("Error: 'savenreps' must be > 0\n"); + return 1; + } + Info(); return 0; @@ -223,8 +251,12 @@ int Cpptraj::Cluster::Control::Run() { if (verbose_ > 1) pmatrix_->PrintCached(); // Cluster - int err = algorithm_->DoClustering(clusters_, framesToCluster, *pmatrix_); + if (algorithm_->DoClustering(clusters_, framesToCluster, *pmatrix_) != 0) { + mprinterr("Error: Clustering failed.\n"); + return 1; + } + // Add sieved frames to existing clusters. if ( sieveRestore_ != NO_RESTORE ) { // Update cluster centroids in case they need to be used to restore sieved frames clusters_.UpdateCentroids( metric_ ); @@ -243,5 +275,12 @@ int Cpptraj::Cluster::Control::Run() { // Sort by population and renumber clusters_.Sort(); - return err; + // Find best representative frames for each cluster. + if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, *pmatrix_, verbose_)) + { + mprinterr("Error: Finding best representative frames for clusters failed.\n"); + return 1; + } + + return 0; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 21f42da01e..c23900dc8a 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -4,6 +4,7 @@ #include "PairwiseMatrix.h" #include "Algorithm.h" #include "Metric.h" +#include "BestReps.h" #include "../DataSet_Coords.h" namespace Cpptraj { namespace Cluster { @@ -48,6 +49,9 @@ class Control { int sieve_; ///< Sieve value int sieveSeed_; ///< Seed if doing random sieve SieveRestoreType sieveRestore_; ///< Specify if/how sieved frames should be restored. + + BestReps::RepMethodType bestRep_; ///< How to determine best rep frames. + int nRepsToSave_; ///< How many rep frames to save. }; } /** END namespace Cluster. */ From 92bf47fadf5428c3b0121e4b5ec054f7a5837223 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 11:59:16 -0500 Subject: [PATCH 054/417] DRR - Cpptraj: Enable restore by epsilon (for dbscan). Ensure centroids are recalculated after restore. --- src/Cluster/Algorithm_DBscan.h | 1 + src/Cluster/Control.cpp | 13 +++++++++++-- src/Cluster/Control.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Algorithm_DBscan.h b/src/Cluster/Algorithm_DBscan.h index 13c9280737..ead9cc8168 100644 --- a/src/Cluster/Algorithm_DBscan.h +++ b/src/Cluster/Algorithm_DBscan.h @@ -18,6 +18,7 @@ class Algorithm_DBscan : public Algorithm { void Timing(double) const {} //void AddSievedFrames(); // TODO fix this + double Epsilon() const { return epsilon_; } private: typedef std::vector Iarray; diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 9802b2cafd..3736ed4e51 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -18,6 +18,7 @@ Cpptraj::Cluster::Control::Control() : sieve_(1), sieveSeed_(-1), sieveRestore_(NO_RESTORE), + restoreEpsilon_(0.0), bestRep_(BestReps::NO_REPS), nRepsToSave_(1) {} @@ -190,6 +191,7 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { sieveRestore_ = EPSILON_CENTROID; else sieveRestore_ = EPSILON_FRAME; + restoreEpsilon_ = ((Algorithm_DBscan*)algorithm_)->Epsilon(); } } @@ -264,18 +266,25 @@ int Cpptraj::Cluster::Control::Run() { mprintf("\tRestoring sieved frames.\n"); switch (sieveRestore_) { case CLOSEST_CENTROID : - clusters_.AddFramesByCentroid( frameSieve.SievedOut(), metric_ ); + clusters_.AddFramesByCentroid( frameSieve.SievedOut(), metric_ ); break; + case EPSILON_CENTROID : + case EPSILON_FRAME : + clusters_.AddFramesByCentroid( frameSieve.SievedOut(), metric_, + (sieveRestore_ == EPSILON_CENTROID), + restoreEpsilon_ ); break; default: mprinterr("Internal Error: Unhandled sieve restore type.\n"); return 1; } + // Re-calculate the cluster centroids + clusters_.UpdateCentroids( metric_ ); } // Sort by population and renumber clusters_.Sort(); - // Find best representative frames for each cluster. + // Find best representative frames for each cluster. TODO option to ignore sieved? if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, *pmatrix_, verbose_)) { mprinterr("Error: Finding best representative frames for clusters failed.\n"); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index c23900dc8a..6f410fb291 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -49,6 +49,7 @@ class Control { int sieve_; ///< Sieve value int sieveSeed_; ///< Seed if doing random sieve SieveRestoreType sieveRestore_; ///< Specify if/how sieved frames should be restored. + double restoreEpsilon_; ///< Cutoff to use if restoring by epsilon to centroids. BestReps::RepMethodType bestRep_; ///< How to determine best rep frames. int nRepsToSave_; ///< How many rep frames to save. From 112b154b612709cb112ec3b00d55a49929e89d83 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 12:06:29 -0500 Subject: [PATCH 055/417] DRR - Cpptraj: Ensure centroids are updated at least once. Add debug output of clusters. --- src/Cluster/Control.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 3736ed4e51..d1af2d943e 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -258,10 +258,13 @@ int Cpptraj::Cluster::Control::Run() { return 1; } + // --------------------------------------------- + // Update cluster centroids here in case they need to be used to + // restore sieved frames + clusters_.UpdateCentroids( metric_ ); + // Add sieved frames to existing clusters. if ( sieveRestore_ != NO_RESTORE ) { - // Update cluster centroids in case they need to be used to restore sieved frames - clusters_.UpdateCentroids( metric_ ); // Restore sieved frames mprintf("\tRestoring sieved frames.\n"); switch (sieveRestore_) { @@ -291,5 +294,11 @@ int Cpptraj::Cluster::Control::Run() { return 1; } + // DEBUG - print clusters to stdout + if (verbose_ > 0) { + mprintf("\nFINAL CLUSTERS:\n"); + clusters_.PrintClusters(); + } + return 0; } From 9e2a42a18fb76820d3739ad4ca121e285314bbba Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 12:13:50 -0500 Subject: [PATCH 056/417] DRR - Cpptraj: Add DBI function --- src/Cluster/Control.cpp | 4 ++++ src/Cluster/List.cpp | 45 ++++++++++++++++++++++++++++++++++++++++- src/Cluster/List.h | 3 +++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index d1af2d943e..b55eb28b1b 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -300,5 +300,9 @@ int Cpptraj::Cluster::Control::Run() { clusters_.PrintClusters(); } + // TODO assign reference names + + + return 0; } diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 0b01b18c0b..20cb2f7e24 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -119,7 +119,9 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric progress.Finish(); } - +/** Add frames to clusters that are within epsilon of a cluster centroid (if + * sieveToCentroid) or epsilon of any frame in a cluster otherwise. + */ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric* metricIn, bool sieveToCentroid, double epsilon) { @@ -200,3 +202,44 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric mprintf("\t%i of %i sieved frames were discarded as noise.\n", n_sieved_noise, Nsieved); } + +// ----------------------------------------------------------------------------- +/** The Davies-Bouldin Index (DBI) measures the average similarity between each + * cluster and its most similar one; the smaller the DBI, the better. The DBI + * is defined as the average, for all clusters X, of fred, where fred(X) = max, + * across other clusters Y, of (Cx + Cy)/dXY. Here Cx is the average distance + * from points in X to the centroid, similarly Cy, and dXY is the distance + * between cluster centroids. + * NOTE: To use this, cluster centroids should be fully up-to-date. + */ +double Cpptraj::Cluster::List::ComputeDBI(CpptrajFile& outfile, Metric* metricIn) const +{ + std::vector averageDist; + averageDist.reserve( clusters_.size() ); + for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) { + // Calculate average distance to centroid for this cluster + averageDist.push_back( C1->CalcAvgToCentroid( metricIn ) ); + if (outfile.IsOpen()) + outfile.Printf("#Cluster %i has average-distance-to-centroid %f\n", + C1->Num(), averageDist.back()); + } + double DBITotal = 0.0; + unsigned int nc1 = 0; + for (cluster_iterator c1 = begincluster(); c1 != endcluster(); ++c1, ++nc1) { + double MaxFred = 0; + unsigned int nc2 = 0; + for (cluster_iterator c2 = begincluster(); c2 != endcluster(); ++c2, ++nc2) { + if (c1 != c2) { + double Fred = averageDist[nc1] + averageDist[nc2]; + Fred /= metricIn->CentroidDist( c1->Cent(), c2->Cent() ); + if (Fred > MaxFred) + MaxFred = Fred; + } + } + DBITotal += MaxFred; + } + DBITotal /= (double)clusters_.size(); + if (outfile.IsOpen()) outfile.Printf("#DBI: %f\n", DBITotal); + return DBITotal; +} + diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 93c0453673..b903c7aec6 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -3,6 +3,7 @@ #include #include "Node.h" #include "../DataSet_integer.h" +#include "../CpptrajFile.h" namespace Cpptraj { namespace Cluster { @@ -49,6 +50,8 @@ class List { void AddFramesByCentroid(Cframes const&, Metric*); /// Add given frames to clusters based on distance to centroid and cutoff. void AddFramesByCentroid(Cframes const&, Metric*, bool, double); + /// Calculate the Davies-Bouldin index. + double ComputeDBI(CpptrajFile&, Metric*) const; private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. From e513267160e3fc05b96e5848138b4b6cd31f0f64 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 12:20:32 -0500 Subject: [PATCH 057/417] DRR - Cpptraj: Add pseudo-F calc and cluster debug level. --- src/Cluster/Control.cpp | 2 ++ src/Cluster/List.cpp | 75 +++++++++++++++++++++++++++++++++++++++++ src/Cluster/List.h | 5 +++ 3 files changed, 82 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index b55eb28b1b..9c6b7e1aa2 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -161,6 +161,8 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, /** Common setup. */ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { + clusters_.SetDebug( verbose_ ); + // Allocate PairwiseMatrix. if (AllocatePairwise( analyzeArgs, metric_ )) { mprinterr("Error: PairwiseMatrix setup failed.\n"); diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 20cb2f7e24..e60de3ea43 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -2,6 +2,7 @@ #include "List.h" #include "../CpptrajStdio.h" #include "../ProgressBar.h" +#include "../Constants.h" // SMALL void Cpptraj::Cluster::List::PrintClusters() const { //mprintf("CLUSTER: %u clusters, %u frames.\n", clusters_.size(), @@ -243,3 +244,77 @@ double Cpptraj::Cluster::List::ComputeDBI(CpptrajFile& outfile, Metric* metricIn return DBITotal; } +/** The pseudo-F statistic is another measure of clustering goodness. It is + * intended to capture the 'tightness' of clusters, and is in essence a ratio + * of the mean sum of squares between groups to the mean sum of squares within + * group (Lattin et al., 2003: 291) High values are good. Generally, one + * selects a cluster-count that gives a peak in the pseudo-f statistic (or + * pSF, for short). + * Formula: A/B, where A = (T - P)/(G-1), and B = P / (n-G). Here n is the + * number of points, G is the number of clusters, T is the total distance from + * the all-data centroid, and P is the sum (for all clusters) of the distances + * from the cluster centroid. + * NOTE: To use this, cluster centroids should be fully up-to-date. + * NOTE: This calc differs slightly from PTRAJ in that real centroids are used + * instead of representative structures. + */ +double Cpptraj::Cluster::List::ComputePseudoF(CpptrajFile& outfile, Metric* metricIn) const +{ + // Calculation makes no sense with fewer than 2 clusters. + if (Nclusters() < 2) { + mprintf("Warning: Fewer than 2 clusters. Not calculating pseudo-F.\n"); + return 0.0; + } + + // Form a cluster with all points to get a centroid. Use only frames that + // are in clusters, i.e. ignore noise. Assumes all cluster centroids are + // up to date. + Node c_all; + for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) + { + for (Node::frame_iterator f1 = C1->beginframe(); f1 != C1->endframe(); ++f1) + c_all.AddFrameToCluster( *f1 ); + } + // Pseudo-F makes no sense if # clusters == # frames + if (Nclusters() == c_all.Nframes()) { + mprintf("Warning: Each frame is in a separate cluster. Not calculating pseudo-F.\n"); + return 0.0; + } + c_all.SortFrameList(); + c_all.CalculateCentroid( metricIn ); + + // Loop over all clusters + double gss = 0.0; // between-group sum of squares + double wss = 0.0; // within-group sum of squares + for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) + { + for (Node::frame_iterator f1 = C1->beginframe(); f1 != C1->endframe(); ++f1) + { + double dist = metricIn->FrameCentroidDist(*f1, c_all.Cent()); + gss += (dist * dist); + dist = metricIn->FrameCentroidDist(*f1, C1->Cent()); + wss += (dist * dist); + } + } + double d_nclusters = (double)Nclusters(); + double d_ntotal = (double)c_all.Nframes(); + double num = (gss - wss) / (d_nclusters - 1.0); + double den = wss / (d_ntotal - d_nclusters); + if (den < Constants::SMALL) + den = Constants::SMALL; + double pseudof = num / den; + if (debug_ > 0) + mprintf("Pseudo-f: Total distance to centroid is %.4f\n" + "Pseudo-f: Cluster distance to centroid is %.4f\n" + "Pseudo-f: Numerator %.4f over denominator %.4f gives %.4f\n", + gss, wss, num, den, pseudof); + if (outfile.IsOpen()) { + outfile.Printf("#pSF: %f\n", pseudof); + // This calculation taken directly from ptraj + double SSRSST = pseudof*(d_nclusters-1)/(d_ntotal-d_nclusters+pseudof*(d_nclusters-1)); + outfile.Printf("#SSR/SST: %f\n", SSRSST); + } + + return pseudof; +} + diff --git a/src/Cluster/List.h b/src/Cluster/List.h index b903c7aec6..61cb8e385b 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -14,6 +14,8 @@ namespace Cluster { class List { public: List() {} + /// Set debug level + void SetDebug(int d) { debug_ = d; } /// Iterator over clusters typedef std::list::iterator cluster_it; /// Iterator to beginning @@ -52,10 +54,13 @@ class List { void AddFramesByCentroid(Cframes const&, Metric*, bool, double); /// Calculate the Davies-Bouldin index. double ComputeDBI(CpptrajFile&, Metric*) const; + /// Calculate pseudo-F + double ComputePseudoF(CpptrajFile&, Metric*) const; private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. Cframes noise_; ///< Hold any frames classified as noise. + int debug_; }; } /* END namespace Cluster */ From d0f78d445fb9bcbb3ef9afc891b07c615cd196d4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 12:33:39 -0500 Subject: [PATCH 058/417] DRR - Cpptraj: Add best rep calc with shortest distance ignoring sieved frames. --- src/Cluster/BestReps.cpp | 50 ++++++++++++++++++++++++++++++++++++---- src/Cluster/BestReps.h | 8 +++++-- src/Cluster/Control.cpp | 9 ++++---- src/cpptrajdepend | 8 +++---- 4 files changed, 61 insertions(+), 14 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 7afa834b75..bfa4cc84cd 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -34,16 +34,22 @@ void Cpptraj::Cluster::BestReps::SetBestRepFrame(Node& node, RepMap const& reps) /** Find best representative frames for each cluster. */ int Cpptraj::Cluster::BestReps::FindBestRepFrames(RepMethodType type, int nToSave, List& clusters, PairwiseMatrix const& pmatrix, - int debug) + Cframes const& sievedFrames, int debug) { int err = 0; switch (type) { case CUMULATIVE: - err = FindBestRepFrames_CumulativeDist(nToSave, clusters, pmatrix); break; + err = FindBestRepFrames_CumulativeDist(nToSave, clusters, pmatrix); + break; case CENTROID: - err = FindBestRepFrames_Centroid(nToSave, clusters, pmatrix); break; + err = FindBestRepFrames_Centroid(nToSave, clusters, pmatrix); + break; + case CUMULATIVE_NOSIEVE: + err = FindBestRepFrames_NoSieve_CumulativeDist(nToSave, clusters, pmatrix, sievedFrames); + break; case NO_REPS: - mprintf("Warning: Skipping best representative frame calc.\n"); break; + mprintf("Warning: Skipping best representative frame calc.\n"); + break; default: mprinterr("Internal Error: BestReps::FindBestRepFrames: Unhandled type.\n"); err = 1; @@ -98,6 +104,42 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(int nToSave, Li return err; } +/** Find the frame in each cluster that is the best representative by + * having the lowest cumulative distance to every other point in the cluster, + * ignoring sieved frames. + */ +int Cpptraj::Cluster::BestReps:: + FindBestRepFrames_NoSieve_CumulativeDist(int nToSave, List& clusters, + PairwiseMatrix const& pmatrix, + Cframes const& sievedFrames) +{ + if (sievedFrames.size() > 0) + mprintf("Warning: Ignoring sieved frames while looking for best representative.\n"); + int err = 0; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { + RepMap bestReps; + for (Node::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) + { + if (!sievedFrames.HasFrame( *f1 )) { + double cdist = 0.0; + for (Node::frame_iterator f2 = node->beginframe(); f2 != node->endframe(); ++f2) + { + if (f1 != f2 && !sievedFrames.HasFrame( *f2 )) + cdist += pmatrix.GetFdist(*f1, *f2); + } + SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave); + } + } + if (bestReps.empty()) { + mprinterr("Error: Could not determine represenative frame for cluster %i\n", + node->Num()); + err++; + } + SetBestRepFrame( *node, bestReps ); + } + return err; +} + /** Find the frame in the cluster that is the best representative by * having the lowest distance to the cluster centroid. */ diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index 953f43d152..a27da137c2 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -10,9 +10,10 @@ namespace Cluster { /// Used to find best representative structures for a cluster. class BestReps { public: - enum RepMethodType { NO_REPS = 0, CUMULATIVE, CENTROID }; + enum RepMethodType { NO_REPS = 0, CUMULATIVE, CENTROID, CUMULATIVE_NOSIEVE }; - static int FindBestRepFrames(RepMethodType, int, List&, PairwiseMatrix const&, int); + static int FindBestRepFrames(RepMethodType, int, List&, PairwiseMatrix const&, + Cframes const&, int); private: /// Used to pair representative score with frame number. typedef std::pair RepPair; @@ -25,6 +26,9 @@ class BestReps { static void SetBestRepFrame(Node& node, RepMap const&); /// Find best representative frames by shortest distance to all other frames. static int FindBestRepFrames_CumulativeDist(int, List&, PairwiseMatrix const&); + /// Find best representative frames by shortest distance, ignoring sieved frames. + static int FindBestRepFrames_NoSieve_CumulativeDist(int, List&, PairwiseMatrix const&, + Cframes const&); /// Find best representative frames by shortest distance to centroid. static int FindBestRepFrames_Centroid(int, List&, PairwiseMatrix const&); }; diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 9c6b7e1aa2..7edf79ef74 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -210,8 +210,8 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { bestRep_ = BestReps::CUMULATIVE; else if (bestRepStr == "centroid") bestRep_ = BestReps::CENTROID; - //else if (bestRepStr == "cumulative_nosieve") - // bestRep_ = CUMULATIVE_NOSIEVE; + else if (bestRepStr == "cumulative_nosieve") + bestRep_ = BestReps::CUMULATIVE_NOSIEVE; else { mprinterr("Error: Invalid 'bestRep' option (%s)\n", bestRepStr.c_str()); return 1; @@ -289,8 +289,9 @@ int Cpptraj::Cluster::Control::Run() { // Sort by population and renumber clusters_.Sort(); - // Find best representative frames for each cluster. TODO option to ignore sieved? - if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, *pmatrix_, verbose_)) + // Find best representative frames for each cluster. + if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, *pmatrix_, + frameSieve.SievedOut(), verbose_)) { mprinterr("Error: Finding best representative frames for clusters failed.\n"); return 1; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 9997466915..4032651a68 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Clustering.o : Analysis_Clustering.cpp ActionFrameCounter.h ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h Cluster_DPeaks.h Cluster_HierAgglo.h Cluster_Kmeans.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -145,8 +145,8 @@ Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgLi Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.h -Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.h +Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h @@ -166,7 +166,7 @@ Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedDa Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h From 0e865ac2593f39fe65743d42148b58561c5861d0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 12:44:58 -0500 Subject: [PATCH 059/417] DRR - Cpptraj: Do not have DBI and pseudo F functions write directly to files. --- src/Cluster/List.cpp | 25 +++++++++++++------------ src/Cluster/List.h | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index e60de3ea43..c8cdf42f06 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -213,16 +213,17 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric * between cluster centroids. * NOTE: To use this, cluster centroids should be fully up-to-date. */ -double Cpptraj::Cluster::List::ComputeDBI(CpptrajFile& outfile, Metric* metricIn) const +double Cpptraj::Cluster::List::ComputeDBI(std::vector& averageDist, Metric* metricIn) +const { - std::vector averageDist; + averageDist.clear(); averageDist.reserve( clusters_.size() ); for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) { // Calculate average distance to centroid for this cluster averageDist.push_back( C1->CalcAvgToCentroid( metricIn ) ); - if (outfile.IsOpen()) - outfile.Printf("#Cluster %i has average-distance-to-centroid %f\n", - C1->Num(), averageDist.back()); + //if (outfile.IsOpen()) + // outfile.Printf("#Cluster %i has average-distance-to-centroid %f\n", + // C1->Num(), averageDist.back()); } double DBITotal = 0.0; unsigned int nc1 = 0; @@ -240,7 +241,7 @@ double Cpptraj::Cluster::List::ComputeDBI(CpptrajFile& outfile, Metric* metricIn DBITotal += MaxFred; } DBITotal /= (double)clusters_.size(); - if (outfile.IsOpen()) outfile.Printf("#DBI: %f\n", DBITotal); + //if (outfile.IsOpen()) outfile.Printf("#DBI: %f\n", DBITotal); return DBITotal; } @@ -258,7 +259,7 @@ double Cpptraj::Cluster::List::ComputeDBI(CpptrajFile& outfile, Metric* metricIn * NOTE: This calc differs slightly from PTRAJ in that real centroids are used * instead of representative structures. */ -double Cpptraj::Cluster::List::ComputePseudoF(CpptrajFile& outfile, Metric* metricIn) const +double Cpptraj::Cluster::List::ComputePseudoF(double& SSRSST, Metric* metricIn) const { // Calculation makes no sense with fewer than 2 clusters. if (Nclusters() < 2) { @@ -308,12 +309,12 @@ double Cpptraj::Cluster::List::ComputePseudoF(CpptrajFile& outfile, Metric* metr "Pseudo-f: Cluster distance to centroid is %.4f\n" "Pseudo-f: Numerator %.4f over denominator %.4f gives %.4f\n", gss, wss, num, den, pseudof); - if (outfile.IsOpen()) { - outfile.Printf("#pSF: %f\n", pseudof); + //if (outfile.IsOpen()) { + // outfile.Printf("#pSF: %f\n", pseudof); // This calculation taken directly from ptraj - double SSRSST = pseudof*(d_nclusters-1)/(d_ntotal-d_nclusters+pseudof*(d_nclusters-1)); - outfile.Printf("#SSR/SST: %f\n", SSRSST); - } + SSRSST = pseudof*(d_nclusters-1)/(d_ntotal-d_nclusters+pseudof*(d_nclusters-1)); + // outfile.Printf("#SSR/SST: %f\n", SSRSST); + //} return pseudof; } diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 61cb8e385b..e01ba6555e 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -53,9 +53,9 @@ class List { /// Add given frames to clusters based on distance to centroid and cutoff. void AddFramesByCentroid(Cframes const&, Metric*, bool, double); /// Calculate the Davies-Bouldin index. - double ComputeDBI(CpptrajFile&, Metric*) const; + double ComputeDBI(std::vector&, Metric*) const; /// Calculate pseudo-F - double ComputePseudoF(CpptrajFile&, Metric*) const; + double ComputePseudoF(double&, Metric*) const; private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. From 0a07e3b61c767366c382431c4931d15b62c4da4b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 13:26:30 -0500 Subject: [PATCH 060/417] DRR - Cpptraj: Add separate output class for clustering. --- src/Cluster/Output.cpp | 94 ++++++++++++++++++++++++++++++++++++++++++ src/Cluster/Output.h | 21 ++++++++++ 2 files changed, 115 insertions(+) create mode 100644 src/Cluster/Output.cpp create mode 100644 src/Cluster/Output.h diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp new file mode 100644 index 0000000000..1d39ea9af6 --- /dev/null +++ b/src/Cluster/Output.cpp @@ -0,0 +1,94 @@ +#include "Output.h" +// ----------------------------------------------------------------------------- +// ClusterList::PrintClustersToFile() +/** Print list of clusters in a style similar to ptraj; each cluster is + * given a line maxframes characters long, with X for each frame that is + * in the clusters and . for all other frames. Also print out the + * representative frame numbers. + */ +void Cpptraj::Cluster::Output::PrintClustersToFile(CpptrajFile& outfile, + List const& clusters, +//std::string const& filename, + Algorithm const& algorithmIn, + Metric* metricIn, int sieve, + Cframes const& sievedFrames) +{ + //CpptrajFile outfile; + std::string buffer; + + /*if ( outfile.OpenWrite(filename) ) { + mprinterr("Error: PrintClustersToFile: Could not set up file %s\n", + filename.c_str()); + return; + }*/ + outfile.Printf("#Clustering: %i clusters %i frames\n", + clusters.Nclusters(), metricIn->Ntotal()); + // DBI + std::vector averageDist; + double DBITotal = clusters.ComputeDBI( averageDist, metricIn ); + std::vector::const_iterator avgd = averageDist.begin(); + for (List::cluster_iterator C = clusters.begincluster(); + C != clusters.endcluster(); + ++C, ++avgd) + outfile.Printf("#Cluster %i has average-distance-to-centroid %f\n", C->Num(), *avgd); + outfile.Printf("#DBI: %f\n", DBITotal); + // Pseudo-F + double SSRSST = 0.0; + double pseudof = clusters.ComputePseudoF( SSRSST, metricIn ); + outfile.Printf("#pSF: %f\n", pseudof); + outfile.Printf("#SSR/SST: %f\n", SSRSST); + + // Call internal info routine. + algorithmIn.Results( outfile ); + // Print noise frames. + if (clusters.Noise().size() > 0) { + outfile.Printf("#NOISE_FRAMES:"); + unsigned int numNoise = 0; + for (Cframes::const_iterator frm = clusters.Noise().begin(); + frm != clusters.Noise().end(); ++frm) + { + outfile.Printf(" %i", *frm+1); + ++numNoise; + } + outfile.Printf("\n"); + outfile.Printf("#Number_of_noise_frames: %u\n", numNoise); + } + // Do not print trajectory stuff if no filename given (i.e. STDOUT output) + if (!outfile.IsStream()) { + for (List::cluster_iterator C1 = clusters.begincluster(); C1 != clusters.endcluster(); ++C1) + { + buffer.clear(); + buffer.resize(metricIn->Ntotal(), '.'); + for (Node::frame_iterator f1 = C1->beginframe(); f1 != C1->endframe(); ++f1) + buffer[ *f1 ] = 'X'; + buffer += '\n'; + outfile.Write((void*)buffer.c_str(), buffer.size()); + } + } + // Print representative frame numbers + outfile.Printf("#Representative frames:"); + for (List::cluster_iterator C1 = clusters.begincluster(); C1 != clusters.endcluster(); ++C1) + if (C1->BestReps().size() < 2) + outfile.Printf(" %i", C1->BestRepFrame()+1); + else { + outfile.Printf(" {"); + for (Node::RepPairArray::const_iterator rep = C1->BestReps().begin(); + rep != C1->BestReps().end(); ++rep) + outfile.Printf(" %i %g", rep->first+1, rep->second); + outfile.Printf(" }"); + } + outfile.Printf("\n"); + // Print sieve info if present + if (sieve != 1) { + if (sieve < -1) { + outfile.Printf("#Sieve value: %i (random)\n#Sieved frames:", -sieve); + for (Cframes::const_iterator sfrm = sievedFrames.begin(); + sfrm != sievedFrames.end(); ++sfrm) + outfile.Printf(" %i", *sfrm + 1); + outfile.Printf("\n"); + } else + outfile.Printf("#Sieve value: %i\n", sieve); + } + outfile.CloseFile(); +} + diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h new file mode 100644 index 0000000000..c9615d4e07 --- /dev/null +++ b/src/Cluster/Output.h @@ -0,0 +1,21 @@ +#ifndef INC_CLUSTER_OUTPUT_H +#define INC_CLUSTER_OUTPUT_H +#include "../CpptrajFile.h" +#include "List.h" +#include "Algorithm.h" +#include "Metric.h" +#include "Cframes.h" + +namespace Cpptraj { +namespace Cluster { + +/// Cluster output routines. +class Output { + public: + static void PrintClustersToFile(CpptrajFile&, List const&, Algorithm const&, Metric*, + int, Cframes const&); +}; + +} +} +#endif From 76f5d1ffd5204ab31a610bd0a91f8394f86c366f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 14:21:48 -0500 Subject: [PATCH 061/417] DRR - Cpptraj: Add cluster info output. --- src/Cluster/Control.cpp | 48 ++++++++++++++++++++++++++++++++++++++++- src/Cluster/Control.h | 3 +++ src/Cluster/List.h | 1 - src/Cluster/Sieve.h | 1 + src/cpptrajdepend | 3 ++- src/cpptrajfiles | 1 + 6 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 7edf79ef74..97d1dca4ad 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -2,6 +2,7 @@ #include "../CpptrajStdio.h" #include "../DataSet_Coords.h" #include "Sieve.h" +#include "Output.h" // PairwiseMatrix classes #include "PairwiseMatrix_MEM.h" // Metric classes @@ -20,7 +21,8 @@ Cpptraj::Cluster::Control::Control() : sieveRestore_(NO_RESTORE), restoreEpsilon_(0.0), bestRep_(BestReps::NO_REPS), - nRepsToSave_(1) + nRepsToSave_(1), + suppressInfo_(false) {} // ----------------------------------------------------------------------------- @@ -223,6 +225,10 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { return 1; } + // Output options + suppressInfo_ = analyzeArgs.hasKey("noinfo"); + if (!suppressInfo_) + clusterinfo_ = analyzeArgs.GetStringKey("info"); Info(); return 0; @@ -239,28 +245,52 @@ int Cpptraj::Cluster::Control::Run() { mprinterr("Internal Error: Cluster::Control is not set up.\n"); return 1; } + // Timers + // Set up the Metric if (metric_->Setup()) { mprinterr("Error: Metric setup failed.\n"); return 1; } + Timer cluster_setup; + Timer cluster_pairwise; + Timer cluster_cluster; + Timer cluster_post; + Timer cluster_total; + cluster_total.Start(); + cluster_setup.Start(); // Figure out which frames to cluster Sieve frameSieve; frameSieve.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); Cframes const& framesToCluster = frameSieve.FramesToCluster(); + cluster_setup.Stop(); + cluster_pairwise.Start(); + // Cache distances if necessary pmatrix_->CacheDistances( framesToCluster ); if (verbose_ > 1) pmatrix_->PrintCached(); + cluster_pairwise.Stop(); + cluster_cluster.Start(); + // Cluster if (algorithm_->DoClustering(clusters_, framesToCluster, *pmatrix_) != 0) { mprinterr("Error: Clustering failed.\n"); return 1; } + cluster_cluster.Stop(); + // --------------------------------------------- + cluster_post.Start(); + Timer cluster_post_renumber; + Timer cluster_post_bestrep; + Timer cluster_post_info; + //Timer cluster_post_summary; + //Timer cluster_post_coords; + cluster_post_renumber.Start(); // Update cluster centroids here in case they need to be used to // restore sieved frames clusters_.UpdateCentroids( metric_ ); @@ -289,6 +319,9 @@ int Cpptraj::Cluster::Control::Run() { // Sort by population and renumber clusters_.Sort(); + cluster_post_renumber.Stop(); + cluster_post_bestrep.Start(); + // Find best representative frames for each cluster. if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, *pmatrix_, frameSieve.SievedOut(), verbose_)) @@ -297,6 +330,8 @@ int Cpptraj::Cluster::Control::Run() { return 1; } + cluster_post_bestrep.Stop(); + // DEBUG - print clusters to stdout if (verbose_ > 0) { mprintf("\nFINAL CLUSTERS:\n"); @@ -305,6 +340,17 @@ int Cpptraj::Cluster::Control::Run() { // TODO assign reference names + // Info + if (!suppressInfo_) { + CpptrajFile outfile; + if (outfile.OpenWrite( clusterinfo_ )) return 1; + cluster_post_info.Start(); + Output::PrintClustersToFile(outfile, clusters_, *algorithm_, metric_, + frameSieve.SieveValue(), frameSieve.SievedOut()); + cluster_post_info.Stop(); + outfile.CloseFile(); + } + return 0; diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 6f410fb291..a4673d99af 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -53,6 +53,9 @@ class Control { BestReps::RepMethodType bestRep_; ///< How to determine best rep frames. int nRepsToSave_; ///< How many rep frames to save. + + bool suppressInfo_; ///< If true do not write cluster info + std::string clusterinfo_; ///< Cluster info file name. }; } /** END namespace Cluster. */ diff --git a/src/Cluster/List.h b/src/Cluster/List.h index e01ba6555e..483fa4374b 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -3,7 +3,6 @@ #include #include "Node.h" #include "../DataSet_integer.h" -#include "../CpptrajFile.h" namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Sieve.h b/src/Cluster/Sieve.h index 08061f716f..e120654692 100644 --- a/src/Cluster/Sieve.h +++ b/src/Cluster/Sieve.h @@ -15,6 +15,7 @@ class Sieve { Cframes const& FramesToCluster() const { return framesToCluster_; } Cframes const& SievedOut() const { return sievedOut_; } + int SieveValue() const { return sieve_; } private: void DetermineTypeFromSieve(int); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 4032651a68..30d04f8b84 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -145,10 +145,11 @@ Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgLi Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 89038bb076..d846d25baa 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -9,6 +9,7 @@ CLUSTER_SOURCES= \ Cluster/List.cpp \ Cluster/Metric_RMS.cpp \ Cluster/Node.cpp \ + Cluster/Output.cpp \ Cluster/PairwiseMatrix.cpp \ Cluster/PairwiseMatrix_MEM.cpp \ Cluster/Sieve.cpp From 7feb6fe3449718235b97cb45950f7454dcc13b1e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 15:14:29 -0500 Subject: [PATCH 062/417] DRR - Cpptraj: Cluster info test save --- test/Test_Cluster/cinfo.dat.save | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/Test_Cluster/cinfo.dat.save diff --git a/test/Test_Cluster/cinfo.dat.save b/test/Test_Cluster/cinfo.dat.save new file mode 100644 index 0000000000..a8eb063f6a --- /dev/null +++ b/test/Test_Cluster/cinfo.dat.save @@ -0,0 +1,24 @@ +#Clustering: 9 clusters 101 frames +#Cluster 0 has average-distance-to-centroid 2.284048 +#Cluster 1 has average-distance-to-centroid 1.838211 +#Cluster 2 has average-distance-to-centroid 2.410153 +#Cluster 3 has average-distance-to-centroid 2.141722 +#Cluster 4 has average-distance-to-centroid 1.945242 +#Cluster 5 has average-distance-to-centroid 1.826420 +#Cluster 6 has average-distance-to-centroid 1.760532 +#Cluster 7 has average-distance-to-centroid 0.939041 +#Cluster 8 has average-distance-to-centroid 0.000000 +#DBI: 1.054155 +#pSF: 31.603363 +#SSR/SST: 0.733199 +#Algorithm: HierAgglo linkage average-linkage nclusters 3 epsilon 4 +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................................ +.............................................................................XXXXXXXXXXXXXXXXXXXXXXXX +.................................................................XXXXXXXXXXXX........................ +.....XXXXXX.......................................................................................... +...XX......XXX....................................................................................... +.XX.................................................................................................. +.............................................................XX...................................... +...............................................................XX.................................... +X.................................................................................................... +#Representative frames: 32 91 76 10 13 2 62 64 1 From 9641b439e9a2f5b0df8662a6815ef990dddc9b4e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 16:02:35 -0500 Subject: [PATCH 063/417] DRR - Cpptraj: Add destructor for Control --- src/Cluster/Control.cpp | 6 ++++++ src/Cluster/Control.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 97d1dca4ad..298a5242e6 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -25,6 +25,12 @@ Cpptraj::Cluster::Control::Control() : suppressInfo_(false) {} +Cpptraj::Cluster::Control::~Control() { + if (algorithm_ != 0) delete algorithm_; + if (pmatrix_ != 0 ) delete pmatrix_; + if (metric_ != 0 ) delete metric_; +} + // ----------------------------------------------------------------------------- /** \return pointer to PairwiseMatrix of specified type. */ Cpptraj::Cluster::PairwiseMatrix* diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index a4673d99af..9fea453db4 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -13,6 +13,7 @@ namespace Cluster { class Control { public: Control(); + ~Control(); static const char* PairwiseArgs; static const char* AlgorithmArgs; @@ -56,6 +57,7 @@ class Control { bool suppressInfo_; ///< If true do not write cluster info std::string clusterinfo_; ///< Cluster info file name. + }; } /** END namespace Cluster. */ From 4bd1975ad7f07452e5c940136d9388095e022496 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 23 Jan 2019 16:10:20 -0500 Subject: [PATCH 064/417] DRR - Cpptraj: Start adding silhouette calc. --- src/Cluster/List.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index c8cdf42f06..89bc159813 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -319,3 +319,13 @@ double Cpptraj::Cluster::List::ComputePseudoF(double& SSRSST, Metric* metricIn) return pseudof; } +/** The cluster silhouette is a measure of how well each point fits within + * a cluster. Values of 1 indicate the point is very similar to other points + * in the cluster, i.e. it is well-clustered. Values of -1 indicate the point + * is dissimilar and may fit better in a neighboring cluster. Values of 0 + * indicate the point is on a border between two clusters. + * \param SiVals For each cluster, the silhouette value for each individual frame. + */ +//void Cpptraj::Cluster::List::CalcSilhouette(std::vector< std::vector >& SiVals, +// std::vector& AvgSi, + From 6721e1f5884739e17aa04d4c0ec651e0c7df9d44 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 24 Jan 2019 13:01:53 -0500 Subject: [PATCH 065/417] DRR - Cpptraj: Add info comparison to test. --- test/Test_Cluster/RunTest.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Test_Cluster/RunTest.sh b/test/Test_Cluster/RunTest.sh index 27025e5e31..359a92bacf 100755 --- a/test/Test_Cluster/RunTest.sh +++ b/test/Test_Cluster/RunTest.sh @@ -6,7 +6,8 @@ # NOTE: CpptrajPairDist name defined in Action_Clustering.cpp CleanFiles cluster.in cnumvtime.dat avg.summary.dat summary.dat CpptrajPairDist \ cpop.agr summary2.dat Cmatrix.nccmatrix Cmatrix.cmatrix summary3.dat \ - normpop.agr normframe.agr cascii.dat.save cascii.dat pw.out + normpop.agr normframe.agr cascii.dat.save cascii.dat pw.out \ + cinfo.dat TESTNAME='Hierarchical agglomerative clustering tests' Requires netcdf @@ -16,11 +17,12 @@ cat > cluster.in < Date: Thu, 24 Jan 2019 14:14:05 -0500 Subject: [PATCH 066/417] DRR - Cpptraj: Add cluster silhouette calc. --- src/Cluster/List.cpp | 108 +++++++++++++++++++++++++++++++++++++++++-- src/Cluster/List.h | 3 ++ 2 files changed, 106 insertions(+), 5 deletions(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 89bc159813..6a9a01899b 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -1,8 +1,9 @@ -#include +#include // std::max +#include // double max #include "List.h" #include "../CpptrajStdio.h" #include "../ProgressBar.h" -#include "../Constants.h" // SMALL +#include "../Constants.h" // SMALL TODO use limits? void Cpptraj::Cluster::List::PrintClusters() const { //mprintf("CLUSTER: %u clusters, %u frames.\n", clusters_.size(), @@ -324,8 +325,105 @@ double Cpptraj::Cluster::List::ComputePseudoF(double& SSRSST, Metric* metricIn) * in the cluster, i.e. it is well-clustered. Values of -1 indicate the point * is dissimilar and may fit better in a neighboring cluster. Values of 0 * indicate the point is on a border between two clusters. - * \param SiVals For each cluster, the silhouette value for each individual frame. + * \param SiFrames For each cluster, the silhouette value for each individual frame. + * \param AvgSi For each cluster, the average silhouette value. */ -//void Cpptraj::Cluster::List::CalcSilhouette(std::vector< std::vector >& SiVals, -// std::vector& AvgSi, +void Cpptraj::Cluster::List::CalcSilhouette(std::vector< std::vector >& SiFrames, + std::vector& AvgSi, + PairwiseMatrix const& pmatrix, + Cframes const& sievedFrames, + bool includeSieved) +const +{ + SiFrames.clear(); + SiFrames.reserve( Nclusters() ); + AvgSi.clear(); + AvgSi.reserve( Nclusters() ); + unsigned int idx = 0; + for (cluster_iterator Ci = begincluster(); Ci != endcluster(); ++Ci) + { + //Ffile.Printf("#C%-6i %10s\n", Ci->Num(), "Silhouette"); + double avg_si = 0.0; + int ci_frames = 0; + SiFrames.push_back( std::vector() ); + std::vector& SiVals = SiFrames.back(); + for (Node::frame_iterator f1 = Ci->beginframe(); f1 != Ci->endframe(); ++f1) + { + if (includeSieved || !sievedFrames.HasFrame( *f1 )) { + // Calculate the average dissimilarity of this frame with all other + // points in this frames cluster. + double ai = 0.0; + int self_frames = 0; + if (includeSieved) { + for (Node::frame_iterator f2 = Ci->beginframe(); f2 != Ci->endframe(); ++f2) + { + if (f1 != f2) { + ai += pmatrix.Frame_Distance(*f1, *f2); + ++self_frames; + } + } + } else { + for (Node::frame_iterator f2 = Ci->beginframe(); f2 != Ci->endframe(); ++f2) + { + if (f1 != f2 && !sievedFrames.HasFrame(*f2)) { + ai += pmatrix.GetFdist(*f1, *f2); // TODO any benefit from GetFdist vs Frame_Distance + ++self_frames; + } + } + } + if (self_frames > 0) + ai /= (double)self_frames; + //mprintf("\t\tFrame %i cluster %i ai = %g\n", *f1+1, Ci->Num(), ai); + // Determine lowest average dissimilarity of this frame with all + // other clusters. + double min_bi = std::numeric_limits::max(); + for (cluster_iterator Cj = begincluster(); Cj != endcluster(); ++Cj) + { + if (Ci != Cj) + { + double bi = 0.0; + // NOTE: ASSUMING NO EMPTY CLUSTERS + if (includeSieved) { + for (Node::frame_iterator f2 = Cj->beginframe(); f2 != Cj->endframe(); ++f2) + bi += pmatrix.Frame_Distance(*f1, *f2); + bi /= (double)Cj->Nframes(); + } else { + int cj_frames = 0; + for (Node::frame_iterator f2 = Cj->beginframe(); f2 != Cj->endframe(); ++f2) + { + if (sievedFrames.HasFrame(*f2)) { + bi += pmatrix.GetFdist(*f1, *f2); + ++cj_frames; + } + } + bi /= (double)cj_frames; + } + //mprintf("\t\tFrame %i to cluster %i bi = %g\n", *f1 + 1, Cj->Num(), bi); + if (bi < min_bi) + min_bi = bi; + } + } + double max_ai_bi = std::max( ai, min_bi ); + if (max_ai_bi == 0.0) + mprinterr("Error: Divide by zero in silhouette calculation for frame %i\n", *f1 + 1); + else { + double si = (min_bi - ai) / max_ai_bi; + SiVals.push_back( si ); + //Ffile.Printf("%8i %10.4f\n", *f1 + 1, si); + avg_si += si; + ++ci_frames; + } + } + } // END loop over cluster frames + std::sort( SiVals.begin(), SiVals.end() ); + //for (std::vector::const_iterator it = SiVals.begin(); it != SiVals.end(); ++it, ++idx) + // Ffile.Printf("%8i %g\n", idx, *it); + //Ffile.Printf("\n"); + ++idx; + if (ci_frames > 0) + avg_si /= (double)ci_frames; + //Cfile.Printf("%8i %g\n", Ci->Num(), avg_si); + AvgSi.push_back( avg_si ); + } // END outer loop over clusters +} diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 483fa4374b..6a305c95e6 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -55,6 +55,9 @@ class List { double ComputeDBI(std::vector&, Metric*) const; /// Calculate pseudo-F double ComputePseudoF(double&, Metric*) const; + /// Calculate cluster silhouettes + void CalcSilhouette(std::vector< std::vector >&, std::vector&, + PairwiseMatrix const&, Cframes const&, bool) const; private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. From 2a677a112ea002b115e044f8972d753ccf1415c0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 24 Jan 2019 14:40:31 -0500 Subject: [PATCH 067/417] DRR - Cpptraj: Make functions to output silhouette stuff. Not sure if this is the best way to store the data but using it for now. --- src/Cluster/Output.cpp | 23 +++++++++++++++++++++++ src/Cluster/Output.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index 1d39ea9af6..09e178f452 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -92,3 +92,26 @@ void Cpptraj::Cluster::Output::PrintClustersToFile(CpptrajFile& outfile, outfile.CloseFile(); } +int Cpptraj::Cluster::Output::PrintSilhouetteFrames(CpptrajFile& Ffile, + std::vector< std::vector > const& SiFrames) +{ + unsigned int idx = 0; + for (std::vector< std::vector >::const_iterator cs = SiFrames.begin(); + cs != SiFrames.end(); ++cs, ++idx) + { + for (std::vector::const_iterator fs = cs->begin(); fs != cs->end(); ++fs, ++idx) + Ffile.Printf("%8u %g\n", idx, *fs); + Ffile.Printf("\n"); + } + return 0; +} + +int Cpptraj::Cluster::Output::PrintSilhouettes(CpptrajFile& Cfile, + std::vector const& SiAvg) +{ + // TODO is it ok to assume clusters are in order? + unsigned int idx = 0; + for (std::vector::const_iterator si = SiAvg.begin(); si != SiAvg.end(); ++si, ++idx) + Cfile.Printf("%8u %g\n", idx, *si); + return 0; +} diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h index c9615d4e07..fe7c6aecbe 100644 --- a/src/Cluster/Output.h +++ b/src/Cluster/Output.h @@ -14,6 +14,8 @@ class Output { public: static void PrintClustersToFile(CpptrajFile&, List const&, Algorithm const&, Metric*, int, Cframes const&); + static int PrintSilhouetteFrames(CpptrajFile&, std::vector< std::vector > const&); + static int PrintSilhouettes(CpptrajFile&, std::vector const&); }; } From 8bb66819ab7fb4ac3c2f07b6702e78642d8f20bc Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 24 Jan 2019 14:59:32 -0500 Subject: [PATCH 068/417] DRR - Cpptraj: Add silhouette print and timing. --- src/Cluster/Control.cpp | 41 ++++++++++++++++++++++++++++++++++++++++- src/Cluster/Control.h | 2 ++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 298a5242e6..c4d5143e03 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -20,6 +20,7 @@ Cpptraj::Cluster::Control::Control() : sieveSeed_(-1), sieveRestore_(NO_RESTORE), restoreEpsilon_(0.0), + includeSieveInCalc_(false), bestRep_(BestReps::NO_REPS), nRepsToSave_(1), suppressInfo_(false) @@ -204,6 +205,10 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { restoreEpsilon_ = ((Algorithm_DBscan*)algorithm_)->Epsilon(); } } + // TODO incorporate with cumulative_nosieve? Or keep granular? + includeSieveInCalc_ = analyzeArgs.hasKey("includesieveincalc"); + if (includeSieveInCalc_) + mprintf("Warning: 'includesieveincalc' may be very slow.\n"); // Best rep options std::string bestRepStr = analyzeArgs.GetStringKey("bestrep"); @@ -235,6 +240,8 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { suppressInfo_ = analyzeArgs.hasKey("noinfo"); if (!suppressInfo_) clusterinfo_ = analyzeArgs.GetStringKey("info"); + sil_file_ = analyzeArgs.GetStringKey("sil"); + Info(); return 0; @@ -357,7 +364,39 @@ int Cpptraj::Cluster::Control::Run() { outfile.CloseFile(); } - + // Silhouette + if (!sil_file_.empty()) { + if (frameSieve.SieveValue() != 1 && !includeSieveInCalc_) + mprintf("Warning: Silhouettes do not include sieved frames.\n"); + std::vector< std::vector > SiFrames; + std::vector SiAvg; + clusters_.CalcSilhouette(SiFrames, SiAvg, *pmatrix_, frameSieve.SievedOut(), + includeSieveInCalc_); + CpptrajFile Ffile, Cfile; + if (Ffile.OpenWrite(sil_file_ + ".frame.dat")) return 1; + Output::PrintSilhouetteFrames(Ffile, SiFrames); + Ffile.CloseFile(); + if (Cfile.OpenWrite(sil_file_ + ".cluster.dat")) return 1; + Output::PrintSilhouettes(Cfile, SiAvg); + Cfile.CloseFile(); + } + + cluster_post.Stop(); + cluster_total.Stop(); + + // Timing data + mprintf("\tCluster timing data:\n"); + cluster_setup.WriteTiming(1, " Cluster Init. :", cluster_total.Total()); + cluster_pairwise.WriteTiming(1, " Pairwise Calc.:", cluster_total.Total()); + cluster_cluster.WriteTiming(1, " Clustering :", cluster_total.Total()); + algorithm_->Timing( cluster_cluster.Total() ); + cluster_post.WriteTiming(1, " Cluster Post. :", cluster_total.Total()); + cluster_post_renumber.WriteTiming(2, "Cluster renumbering/sieve restore", cluster_post.Total()); + cluster_post_bestrep.WriteTiming(2, "Find best rep.", cluster_post.Total()); + cluster_post_info.WriteTiming(2, "Info calc", cluster_post.Total()); + //cluster_post_summary.WriteTiming(2, "Summary calc", cluster_post.Total()); + //cluster_post_coords.WriteTiming(2, "Coordinate writes", cluster_post.Total()); + cluster_total.WriteTiming(1, "Total:"); return 0; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 9fea453db4..65c6f49a94 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -51,12 +51,14 @@ class Control { int sieveSeed_; ///< Seed if doing random sieve SieveRestoreType sieveRestore_; ///< Specify if/how sieved frames should be restored. double restoreEpsilon_; ///< Cutoff to use if restoring by epsilon to centroids. + bool includeSieveInCalc_; ///< If true include sieved frames in later calculations. BestReps::RepMethodType bestRep_; ///< How to determine best rep frames. int nRepsToSave_; ///< How many rep frames to save. bool suppressInfo_; ///< If true do not write cluster info std::string clusterinfo_; ///< Cluster info file name. + std::string sil_file_; ///< File prefix for writing silhouette data }; From 097c1e5e7a7e08b4e4ee3d1c9b6f6fb639936c32 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 24 Jan 2019 15:03:10 -0500 Subject: [PATCH 069/417] DRR - Cpptraj: Add silhouette output saves --- test/Test_Cluster/mysil.cluster.dat.save | 10 ++ test/Test_Cluster/mysil.frame.dat.save | 119 +++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 test/Test_Cluster/mysil.cluster.dat.save create mode 100644 test/Test_Cluster/mysil.frame.dat.save diff --git a/test/Test_Cluster/mysil.cluster.dat.save b/test/Test_Cluster/mysil.cluster.dat.save new file mode 100644 index 0000000000..e41dcc53db --- /dev/null +++ b/test/Test_Cluster/mysil.cluster.dat.save @@ -0,0 +1,10 @@ +#Cluster + 0 0.195931 + 1 0.449004 + 2 0.208799 + 3 0.250219 + 4 0.23464 + 5 0.148413 + 6 0.131294 + 7 0.58599 + 8 1 diff --git a/test/Test_Cluster/mysil.frame.dat.save b/test/Test_Cluster/mysil.frame.dat.save new file mode 100644 index 0000000000..e40f666188 --- /dev/null +++ b/test/Test_Cluster/mysil.frame.dat.save @@ -0,0 +1,119 @@ +#C0 Silhouette + 0 -0.135988 + 1 -0.0266746 + 2 -0.0167628 + 3 0.0609673 + 4 0.0649603 + 5 0.0835595 + 6 0.0853858 + 7 0.0877827 + 8 0.0945669 + 9 0.0981459 + 10 0.10935 + 11 0.11516 + 12 0.118742 + 13 0.139884 + 14 0.152028 + 15 0.152095 + 16 0.155938 + 17 0.16327 + 18 0.177433 + 19 0.185396 + 20 0.20837 + 21 0.210512 + 22 0.214755 + 23 0.223949 + 24 0.227854 + 25 0.242904 + 26 0.244027 + 27 0.244217 + 28 0.253302 + 29 0.261434 + 30 0.265653 + 31 0.266742 + 32 0.269781 + 33 0.274618 + 34 0.275536 + 35 0.281617 + 36 0.287468 + 37 0.291597 + 38 0.292651 + 39 0.298959 + 40 0.305413 + 41 0.307236 + 42 0.311688 + 43 0.314331 + 44 0.318642 + 45 0.320001 + 46 0.330269 + +#C1 Silhouette + 48 0.319039 + 49 0.319785 + 50 0.348833 + 51 0.358286 + 52 0.384205 + 53 0.397178 + 54 0.428314 + 55 0.441785 + 56 0.44628 + 57 0.446432 + 58 0.44892 + 59 0.465936 + 60 0.472731 + 61 0.473003 + 62 0.48261 + 63 0.486779 + 64 0.491815 + 65 0.493443 + 66 0.49616 + 67 0.496202 + 68 0.506839 + 69 0.523232 + 70 0.523974 + 71 0.524305 + +#C2 Silhouette + 73 -0.0273079 + 74 0.143221 + 75 0.143939 + 76 0.179135 + 77 0.198277 + 78 0.217643 + 79 0.240545 + 80 0.25015 + 81 0.253356 + 82 0.28631 + 83 0.291313 + 84 0.329007 + +#C3 Silhouette + 86 0.181779 + 87 0.183371 + 88 0.259752 + 89 0.264702 + 90 0.287487 + 91 0.32422 + +#C4 Silhouette + 93 0.0272266 + 94 0.176844 + 95 0.208565 + 96 0.353716 + 97 0.40685 + +#C5 Silhouette + 99 0.101416 + 100 0.195411 + +#C6 Silhouette + 102 0.100473 + 103 0.162116 + +#C7 Silhouette + 105 0.582066 + 106 0.589914 + +#C8 Silhouette + 108 1 + From 4592268046ab280fb5c10d024786f1286fb8be56 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 24 Jan 2019 15:15:10 -0500 Subject: [PATCH 070/417] DRR - Cpptraj: Fix silhouette calc. Add file headers. --- src/Cluster/List.cpp | 5 ++--- src/Cluster/Output.cpp | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 6a9a01899b..32711719d9 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -391,7 +391,7 @@ const int cj_frames = 0; for (Node::frame_iterator f2 = Cj->beginframe(); f2 != Cj->endframe(); ++f2) { - if (sievedFrames.HasFrame(*f2)) { + if (!sievedFrames.HasFrame(*f2)) { bi += pmatrix.GetFdist(*f1, *f2); ++cj_frames; } @@ -422,8 +422,7 @@ const ++idx; if (ci_frames > 0) avg_si /= (double)ci_frames; - //Cfile.Printf("%8i %g\n", Ci->Num(), avg_si); + //mprintf("DEBUG: Cluster silhouette: %8i %g\n", Ci->Num(), avg_si); AvgSi.push_back( avg_si ); } // END outer loop over clusters } - diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index 09e178f452..52bbf495ae 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -99,6 +99,7 @@ int Cpptraj::Cluster::Output::PrintSilhouetteFrames(CpptrajFile& Ffile, for (std::vector< std::vector >::const_iterator cs = SiFrames.begin(); cs != SiFrames.end(); ++cs, ++idx) { + Ffile.Printf("#C%-6u %10s\n", cs - SiFrames.begin(), "Silhouette"); for (std::vector::const_iterator fs = cs->begin(); fs != cs->end(); ++fs, ++idx) Ffile.Printf("%8u %g\n", idx, *fs); Ffile.Printf("\n"); @@ -110,6 +111,7 @@ int Cpptraj::Cluster::Output::PrintSilhouettes(CpptrajFile& Cfile, std::vector const& SiAvg) { // TODO is it ok to assume clusters are in order? + Cfile.Printf("%-8s %10s\n", "#Cluster", ""); unsigned int idx = 0; for (std::vector::const_iterator si = SiAvg.begin(); si != SiAvg.end(); ++si, ++idx) Cfile.Printf("%8u %g\n", idx, *si); From 20fba1241e09bb2204429f1ba9371f37ff39be9e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 24 Jan 2019 15:36:40 -0500 Subject: [PATCH 071/417] DRR - Cpptraj: Add a reminder note --- src/Cluster/List.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 32711719d9..8220af996e 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -176,7 +176,7 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric else if ( !sieveToCentroid ) { // Check if any frames in the cluster are closer than epsilon to sieved frame. for (int cidx=0; cidx < minNode->Nframes(); cidx++) - { + { //TODO just use PairwiseMatrix::Frame_Distance here? if ( MyCdist->FrameDist(frame, minNode->ClusterFrame(cidx)) < epsilon ) { goodFrame = true; From 8bfc980c69c72adea0857a41f5e8a8e90627dd1e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 24 Jan 2019 16:02:21 -0500 Subject: [PATCH 072/417] DRR - Cpptraj: Remove some unnecessary code. --- src/Cluster/Algorithm_HierAgglo.cpp | 76 +++++------------------------ 1 file changed, 12 insertions(+), 64 deletions(-) diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index e6b892d5c5..c75460c720 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -290,28 +290,11 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMinDist(List::cluster_it& C1_it, for (List::cluster_it C2_it = clusters.begin(); C2_it != clusters.end(); ++C2_it) { - if (C2_it == C1_it) continue; -/* - //mprintf("\t\tRecalc distance between %i and %i:\n",C1,newc2); - // Pick the minimum distance between newc2 and C1 - double min = std::numeric_limits::max(); - for (Node::frame_iterator c1frames = C1_it->beginframe(); - c1frames != C1_it->endframe(); - ++c1frames) - { - for (Node::frame_iterator c2frames = C2_it->beginframe(); - c2frames != C2_it->endframe(); - ++c2frames) - { - double Dist = pmatrix.GetFdist(*c1frames, *c2frames); - //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); - if ( Dist < min ) min = Dist; - } + if (C2_it != C1_it) { + double min = minDist(*C1_it, *C2_it, pmatrix); + //mprintf("\t\tMin distance between %i and %i: %f\n",C1,newc2,min); + ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), min ); } -*/ - double min = minDist(*C1_it, *C2_it, pmatrix); - //mprintf("\t\tMin distance between %i and %i: %f\n",C1,newc2,min); - ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), min ); } } @@ -325,28 +308,11 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMaxDist(List::cluster_it& C1_it, for (List::cluster_it C2_it = clusters.begin(); C2_it != clusters.end(); ++C2_it) { - if (C2_it == C1_it) continue; -/* - //mprintf("\t\tRecalc distance between %i and %i:\n",C1,newc2); - // Pick the maximum distance between newc2 and C1 - double max = -1.0; - for (Node::frame_iterator c1frames = C1_it->beginframe(); - c1frames != C1_it->endframe(); - ++c1frames) - { - for (Node::frame_iterator c2frames = C2_it->beginframe(); - c2frames != C2_it->endframe(); - ++c2frames) - { - double Dist = pmatrix.GetFdist(*c1frames, *c2frames); - //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); - if ( Dist > max ) max = Dist; - } + if (C2_it != C1_it) { + double max = maxDist( *C1_it, *C2_it, pmatrix ); + //mprintf("\t\tMax distance between %i and %i: %f\n",C1,newc2,max); + ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), max ); } -*/ - double max = maxDist( *C1_it, *C2_it, pmatrix ); - //mprintf("\t\tMax distance between %i and %i: %f\n",C1,newc2,max); - ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), max ); } } @@ -360,28 +326,10 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcAvgDist(List::cluster_it& C1_it, for (List::cluster_it C2_it = clusters.begin(); C2_it != clusters.end(); ++C2_it) { - if (C2_it == C1_it) continue; -/* - //mprintf("\t\tRecalc distance between %i and %i:\n",(*C1_it).Num(),(*C2_it).Num()); - // Pick the minimum distance between newc2 and C1 - double sumDist = 0; - for (Node::frame_iterator c1frames = C1_it->beginframe(); - c1frames != C1_it->endframe(); - ++c1frames) - { - for (Node::frame_iterator c2frames = C2_it->beginframe(); - c2frames != C2_it->endframe(); - ++c2frames) - { - double Dist = pmatrix.GetFdist(*c1frames, *c2frames); - //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); - sumDist += Dist; - } + if (C2_it != C1_it) { + double Dist = avgDist( *C1_it, *C2_it, pmatrix ); + //mprintf("\t\tAvg distance between %i and %i: %f\n",(*C1_it).Num(),(*C2_it).Num(),Dist); + ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), Dist ); } - double Dist = sumDist / (double)(C1_it->Nframes() * C2_it->Nframes()); -*/ - double Dist = avgDist( *C1_it, *C2_it, pmatrix ); - //mprintf("\t\tAvg distance between %i and %i: %f\n",(*C1_it).Num(),(*C2_it).Num(),Dist); - ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), Dist ); } } From e72ce01cb3571d64b58693e13b271e3f67c74a6a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 25 Jan 2019 10:09:27 -0500 Subject: [PATCH 073/417] DRR - Cpptraj: Slight reorganization. Add variables for storing silhouette data in nodes. --- src/Cluster/Node.cpp | 22 ++---------- src/Cluster/Node.h | 82 ++++++++++++++++++++++++++------------------ 2 files changed, 50 insertions(+), 54 deletions(-) diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index cdeecf50c0..b16a369e93 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -4,7 +4,9 @@ // CONSTRUCTOR Cpptraj::Cluster::Node::Node() : centroid_(0), + avgSil_(0), eccentricity_(0), + refRms_(0), num_(-1), needsUpdate_(true) {} @@ -121,26 +123,6 @@ double Cpptraj::Cluster::Node::CalcAvgToCentroid( Metric* Cdist ) const return ( avgdist / (double)frameList_.size() ); } -void Cpptraj::Cluster::Node::SortFrameList() { - //std::sort(frameList_.begin(), frameList_.end()); - frameList_.Sort(); -} - -// Cpptraj::Cluster::Node::HasFrame() -bool Cpptraj::Cluster::Node::HasFrame(int frame) const { - //Cframes::const_iterator it = std::find(frameList_.begin(), frameList_.end(), frame); - //return !(it == frameList_.end()); - return frameList_.HasFrame( frame ); -} - -// Cpptraj::Cluster::Node::RemoveFrameFromCluster() -void Cpptraj::Cluster::Node::RemoveFrameFromCluster(int frame) { - frameList_.Remove( frame ); -/* Cframes::iterator pend = std::remove( frameList_.begin(), frameList_.end(), frame); - size_t newsize = pend - frameList_.begin(); - frameList_.resize( newsize );*/ -} - void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(Metric* Cdist, int frame) { Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), Metric::SUBTRACTFRAME); diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 9ec71d51fe..e7b66e84fb 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -22,66 +22,78 @@ class Node { Node(const Node&); /// ASSIGNMENT Node& operator=(const Node&); + /// Used to pair a representative frame number with a score. typedef std::pair RepPair; /// Used to hold a list of representative frames/scores typedef std::vector RepPairArray; + /// Used to pair frame numbers with silhouette values. + typedef std::pair SilPair; + /// Used to hold list of frame numbers/silhouette values. + typedef std::vector SilPairArray; + /// Used to sort clusters by # of frames in cluster inline bool operator<(const Node&) const; - /// Merge frames from another cluster to this cluster - inline void MergeFrames(Node const&); /// Find and set frame in the cluster that has lowest distance to all other frames. // int SetBestRep_CumulativeDist(DataSet_Cmatrix const&); - /// Calculate eccentricity for frames in this cluster. - void CalcEccentricity(PairwiseMatrix const&); - /// Calculate centroid of members of this cluster. - void CalculateCentroid(Metric* Cdist) { - // FIXME: Could potentially get rid of this branch. - if (centroid_ == 0) - centroid_ = Cdist->NewCentroid( frameList_ ); - else - Cdist->CalculateCentroid( centroid_, frameList_ ); - } /// Calculate average distance of all members to centroid double CalcAvgToCentroid( Metric*) const; /// Const iterator over frame numbers typedef Cframes::const_iterator frame_iterator; /// Const iterator to beginning of frames - frame_iterator beginframe() const { return frameList_.begin(); } + frame_iterator beginframe() const { return frameList_.begin(); } /// Const iteratir to end of frames. - frame_iterator endframe() const { return frameList_.end(); } + frame_iterator endframe() const { return frameList_.end(); } /// \return Frame number at given index. - int ClusterFrame(int idx) const { return frameList_[idx]; } + int ClusterFrame(int idx) const { return frameList_[idx]; } /// \return cluster eccentricity - double Eccentricity() const { return eccentricity_; } + double Eccentricity() const { return eccentricity_; } /// \return internal cluster number - int Num() const { return num_; } + int Num() const { return num_; } /// \return number of frames in cluster. - int Nframes() const { return (int)frameList_.size(); } + int Nframes() const { return (int)frameList_.size(); } /// \return best representative frame number, or -1 if no best rep set. - int BestRepFrame() const { + int BestRepFrame() const { if (bestReps_.empty()) return -1; else return bestReps_.front().first; } - Centroid* Cent() const { return centroid_; } - std::string const& Cname() const { return name_; } - double RefRms() const { return refRms_; } - // Set internal variables - void AddFrameToCluster(int fnum) { frameList_.push_back( fnum ); } - void SetNum(int numIn) { num_ = numIn; } + /// \return Cluster centroid. + Centroid* Cent() const { return centroid_; } + /// \return name assigned via reference + std::string const& Cname() const { return name_; } + /// \return RMS to reference + double RefRms() const { return refRms_; } + /// \return true if given frame is in this cluster. + bool HasFrame(int f) const { return frameList_.HasFrame(f); } + /// Access representative frame list, const + RepPairArray const& BestReps() const { return bestReps_; } + + /// Calculate centroid of members of this cluster. + void CalculateCentroid(Metric* Cdist) { + // FIXME: Could potentially get rid of this branch. + if (centroid_ == 0) + centroid_ = Cdist->NewCentroid( frameList_ ); + else + Cdist->CalculateCentroid( centroid_, frameList_ ); + } + /// Add frame to cluster + void AddFrameToCluster(int fnum) { frameList_.push_back( fnum ); } + /// Set cluster number (for bookkeeping). + void SetNum(int numIn) { num_ = numIn; } /// Access representative frame list - RepPairArray const& BestReps() const { return bestReps_; } - RepPairArray& BestReps() { return bestReps_; } - /// Set cluster name and RMS to reference - inline void SetNameAndRms(std::string const&, double); + RepPairArray& BestReps() { return bestReps_; } /// Sort internal frame list - void SortFrameList(); - /// \return true if given frame is in this cluster. - bool HasFrame(int) const; + void SortFrameList() { frameList_.Sort(); } /// Remove specified frame from cluster if present. - void RemoveFrameFromCluster(int); + void RemoveFrameFromCluster(int f) { frameList_.Remove(f); } + /// Merge frames from another cluster to this cluster + inline void MergeFrames(Node const&); + /// Set cluster name and RMS to reference + inline void SetNameAndRms(std::string const&, double); + /// Calculate eccentricity for frames in this cluster. + void CalcEccentricity(PairwiseMatrix const&); /// Remove specified frame from cluster and update centroid. void RemoveFrameUpdateCentroid(Metric*, int); /// Add specified frame to cluster and update centroid. @@ -90,7 +102,9 @@ class Node { Cframes frameList_; ///< List of frames belonging to this cluster. Centroid* centroid_; ///< Centroid of all frames in this cluster. std::string name_; ///< Cluster name assigned from reference. - RepPairArray bestReps_; ///< Hold best representative frames and their score. + RepPairArray bestReps_; ///< Hold best representative frames and their score. + SilPairArray frameSil_; ///< Frame silhouette values. + double avgSil_; ///< Average silhouette value for cluster TODO s.d. as well? double eccentricity_; ///< Maximum distance between any 2 frames. double refRms_; ///< Cluster rms to reference (if assigned). int num_; ///< Cluster number, used for bookkeeping. From da7cc5a8f4c717316b9214a7055bef2b43ca158b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 25 Jan 2019 11:08:24 -0500 Subject: [PATCH 074/417] DRR - Cpptraj: Store cluster silhouette values in Node. --- src/Cluster/Control.cpp | 9 +++------ src/Cluster/List.cpp | 39 +++++++++++++++------------------------ src/Cluster/List.h | 5 ++--- src/Cluster/Node.h | 8 ++++++++ src/Cluster/Output.cpp | 41 +++++++++++++++++++++++++++++------------ src/Cluster/Output.h | 4 ++-- 6 files changed, 59 insertions(+), 47 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index c4d5143e03..5a51f20ad9 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -368,16 +368,13 @@ int Cpptraj::Cluster::Control::Run() { if (!sil_file_.empty()) { if (frameSieve.SieveValue() != 1 && !includeSieveInCalc_) mprintf("Warning: Silhouettes do not include sieved frames.\n"); - std::vector< std::vector > SiFrames; - std::vector SiAvg; - clusters_.CalcSilhouette(SiFrames, SiAvg, *pmatrix_, frameSieve.SievedOut(), - includeSieveInCalc_); + clusters_.CalcSilhouette(*pmatrix_, frameSieve.SievedOut(), includeSieveInCalc_); CpptrajFile Ffile, Cfile; if (Ffile.OpenWrite(sil_file_ + ".frame.dat")) return 1; - Output::PrintSilhouetteFrames(Ffile, SiFrames); + Output::PrintSilhouetteFrames(Ffile, clusters_); Ffile.CloseFile(); if (Cfile.OpenWrite(sil_file_ + ".cluster.dat")) return 1; - Output::PrintSilhouettes(Cfile, SiAvg); + Output::PrintSilhouettes(Cfile, clusters_); Cfile.CloseFile(); } diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 8220af996e..f4f8026a50 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -325,28 +325,18 @@ double Cpptraj::Cluster::List::ComputePseudoF(double& SSRSST, Metric* metricIn) * in the cluster, i.e. it is well-clustered. Values of -1 indicate the point * is dissimilar and may fit better in a neighboring cluster. Values of 0 * indicate the point is on a border between two clusters. - * \param SiFrames For each cluster, the silhouette value for each individual frame. - * \param AvgSi For each cluster, the average silhouette value. */ -void Cpptraj::Cluster::List::CalcSilhouette(std::vector< std::vector >& SiFrames, - std::vector& AvgSi, - PairwiseMatrix const& pmatrix, +int Cpptraj::Cluster::List::CalcSilhouette(PairwiseMatrix const& pmatrix, Cframes const& sievedFrames, bool includeSieved) -const { - SiFrames.clear(); - SiFrames.reserve( Nclusters() ); - AvgSi.clear(); - AvgSi.reserve( Nclusters() ); - unsigned int idx = 0; - for (cluster_iterator Ci = begincluster(); Ci != endcluster(); ++Ci) + for (cluster_it Ci = begin(); Ci != end(); ++Ci) { - //Ffile.Printf("#C%-6i %10s\n", Ci->Num(), "Silhouette"); + Node::SilPairArray& SiVals = Ci->FrameSilhouettes(); + SiVals.clear(); + SiVals.reserve( Ci->Nframes() ); double avg_si = 0.0; int ci_frames = 0; - SiFrames.push_back( std::vector() ); - std::vector& SiVals = SiFrames.back(); for (Node::frame_iterator f1 = Ci->beginframe(); f1 != Ci->endframe(); ++f1) { if (includeSieved || !sievedFrames.HasFrame( *f1 )) { @@ -408,21 +398,22 @@ const mprinterr("Error: Divide by zero in silhouette calculation for frame %i\n", *f1 + 1); else { double si = (min_bi - ai) / max_ai_bi; - SiVals.push_back( si ); - //Ffile.Printf("%8i %10.4f\n", *f1 + 1, si); + SiVals.push_back( Node::SilPair(*f1, si) ); avg_si += si; ++ci_frames; } - } + } // END if frame should be calcd } // END loop over cluster frames - std::sort( SiVals.begin(), SiVals.end() ); - //for (std::vector::const_iterator it = SiVals.begin(); it != SiVals.end(); ++it, ++idx) - // Ffile.Printf("%8i %g\n", idx, *it); - //Ffile.Printf("\n"); - ++idx; + //std::sort( SiVals.begin(), SiVals.end() ); + // DEBUG + mprintf("DEBUG: Cluster frame silhouette values for cluster %i\n", Ci->Num()); + for (Node::SilPairArray::const_iterator it = Ci->FrameSilhouettes().begin(); + it != Ci->FrameSilhouettes().end(); ++it) + mprintf("\t%8i %g\n", it->first+1, it->second); if (ci_frames > 0) avg_si /= (double)ci_frames; //mprintf("DEBUG: Cluster silhouette: %8i %g\n", Ci->Num(), avg_si); - AvgSi.push_back( avg_si ); + Ci->SetSilhouette( avg_si ); } // END outer loop over clusters + return 0; } diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 6a305c95e6..10a3057a1d 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -55,9 +55,8 @@ class List { double ComputeDBI(std::vector&, Metric*) const; /// Calculate pseudo-F double ComputePseudoF(double&, Metric*) const; - /// Calculate cluster silhouettes - void CalcSilhouette(std::vector< std::vector >&, std::vector&, - PairwiseMatrix const&, Cframes const&, bool) const; + /// Calculate cluster and cluster frame silhouettes + int CalcSilhouette(PairwiseMatrix const&, Cframes const&, bool); private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index e7b66e84fb..012a5cdd1b 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -69,6 +69,10 @@ class Node { bool HasFrame(int f) const { return frameList_.HasFrame(f); } /// Access representative frame list, const RepPairArray const& BestReps() const { return bestReps_; } + /// Access frame silhouette list + SilPairArray const& FrameSilhouettes() const { return frameSil_; } + /// \return cluster silhoueete vaule + double Silhouette() const { return avgSil_; } /// Calculate centroid of members of this cluster. void CalculateCentroid(Metric* Cdist) { @@ -84,6 +88,10 @@ class Node { void SetNum(int numIn) { num_ = numIn; } /// Access representative frame list RepPairArray& BestReps() { return bestReps_; } + /// Access frame silhouette list + SilPairArray& FrameSilhouettes() { return frameSil_; } + /// Set cluster silhouette value + void SetSilhouette(double s) { avgSil_ = s; } /// Sort internal frame list void SortFrameList() { frameList_.Sort(); } /// Remove specified frame from cluster if present. diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index 52bbf495ae..b87dab0960 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -1,3 +1,4 @@ +#include // sort #include "Output.h" // ----------------------------------------------------------------------------- // ClusterList::PrintClustersToFile() @@ -92,28 +93,44 @@ void Cpptraj::Cluster::Output::PrintClustersToFile(CpptrajFile& outfile, outfile.CloseFile(); } -int Cpptraj::Cluster::Output::PrintSilhouetteFrames(CpptrajFile& Ffile, - std::vector< std::vector > const& SiFrames) +/// For sorting cluster frame silhouettes by silhouette value. +struct sort_by_sil_val { + typedef Cpptraj::Cluster::Node::SilPair Bpair; + inline bool operator()(Bpair const& p0, Bpair const& p1) + { + if (p0.second == p1.second) + return (p0.first < p1.first); + else + return (p0.second < p1.second); + } +}; + +/** Print cluster silhouette frame values, sorted by silhouette. */ +int Cpptraj::Cluster::Output::PrintSilhouetteFrames(CpptrajFile& Ffile, List const& clusters) { + // TODO different ways of writing out cluster frame silhouettes unsigned int idx = 0; - for (std::vector< std::vector >::const_iterator cs = SiFrames.begin(); - cs != SiFrames.end(); ++cs, ++idx) + for (List::cluster_iterator Ci = clusters.begincluster(); + Ci != clusters.endcluster(); ++Ci, ++idx) { - Ffile.Printf("#C%-6u %10s\n", cs - SiFrames.begin(), "Silhouette"); - for (std::vector::const_iterator fs = cs->begin(); fs != cs->end(); ++fs, ++idx) - Ffile.Printf("%8u %g\n", idx, *fs); + Ffile.Printf("#C%-6i %10s\n", Ci->Num(), "Silhouette"); + Node::SilPairArray spaTemp = Ci->FrameSilhouettes(); + std::sort( spaTemp.begin(), spaTemp.end(), sort_by_sil_val() ); + for (Node::SilPairArray::const_iterator it = spaTemp.begin(); + it != spaTemp.end(); ++it, ++idx) + Ffile.Printf("%8u %g\n", idx, it->second); Ffile.Printf("\n"); } return 0; } -int Cpptraj::Cluster::Output::PrintSilhouettes(CpptrajFile& Cfile, - std::vector const& SiAvg) +/** Print average cluster silhouette values. */ +int Cpptraj::Cluster::Output::PrintSilhouettes(CpptrajFile& Cfile, List const& clusters) { // TODO is it ok to assume clusters are in order? Cfile.Printf("%-8s %10s\n", "#Cluster", ""); - unsigned int idx = 0; - for (std::vector::const_iterator si = SiAvg.begin(); si != SiAvg.end(); ++si, ++idx) - Cfile.Printf("%8u %g\n", idx, *si); + for (List::cluster_iterator Ci = clusters.begincluster(); + Ci != clusters.endcluster(); ++Ci) + Cfile.Printf("%8i %g\n", Ci->Num(), Ci->Silhouette()); return 0; } diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h index fe7c6aecbe..abd6cdaddc 100644 --- a/src/Cluster/Output.h +++ b/src/Cluster/Output.h @@ -14,8 +14,8 @@ class Output { public: static void PrintClustersToFile(CpptrajFile&, List const&, Algorithm const&, Metric*, int, Cframes const&); - static int PrintSilhouetteFrames(CpptrajFile&, std::vector< std::vector > const&); - static int PrintSilhouettes(CpptrajFile&, std::vector const&); + static int PrintSilhouetteFrames(CpptrajFile&, List const&); + static int PrintSilhouettes(CpptrajFile&, List const&); }; } From 1e0dff02f6489f9fd2d654d58bf2bac1db011e38 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 25 Jan 2019 14:34:54 -0500 Subject: [PATCH 075/417] DRR - Cpptraj: Add cluster distance calc. --- src/Cluster/Algorithm.cpp | 14 ++++++++ src/Cluster/Algorithm.h | 3 ++ src/Cluster/Algorithm_HierAgglo.cpp | 55 +++++++++++++++++++++++++++++ src/Cluster/Algorithm_HierAgglo.h | 2 ++ 4 files changed, 74 insertions(+) create mode 100644 src/Cluster/Algorithm.cpp diff --git a/src/Cluster/Algorithm.cpp b/src/Cluster/Algorithm.cpp new file mode 100644 index 0000000000..9e32b31478 --- /dev/null +++ b/src/Cluster/Algorithm.cpp @@ -0,0 +1,14 @@ +#include "Algorithm.h" +#include "../CpptrajStdio.h" + +double Cpptraj::Cluster::Algorithm::ClusterDistance(Node const& C1, Node const& C2, + PairwiseMatrix const& pmatrix, + bool includeSieved, + Cframes const& sievedOut) const +{ + if (C1.Cent() == 0 || C2.Cent() == 0) { + mprinterr("Internal Error: One or both centroids are null in ClusterDistance().\n"); + return -1.0; + } + return pmatrix.MetricPtr()->CentroidDist( C1.Cent(), C2.Cent() ); +} diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index dc576ec1ce..0262f96875 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -23,6 +23,9 @@ class Algorithm { virtual int DoClustering(List&, Cframes const&, PairwiseMatrix const&) = 0; /// Report any timing data virtual void Timing(double) const = 0; + /// /return Algorithm-specific between-cluster distance. Default to centroid distance. + virtual double ClusterDistance(Node const&, Node const&, PairwiseMatrix const&, + bool, Cframes const&) const; // ------------------------------------------- /// Set debug level for algorithm void SetDebug(int d) { debug_ = d; } diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index c75460c720..2047f07520 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -333,3 +333,58 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcAvgDist(List::cluster_it& C1_it, } } } + +double Cpptraj::Cluster::Algorithm_HierAgglo::ClusterDistance(Node const& C1, Node const& C2, + PairwiseMatrix const& pmatrix, + bool includeSieved, + Cframes const& sievedOut) +const +{ + double dval = -1.0; + switch (linkage_) { + case SINGLELINK : dval = std::numeric_limits::max(); break; + case COMPLETELINK : dval = -1.0; break; + case AVERAGELINK : dval = 0.0; break; + } + unsigned int nvals = 0; + + if (includeSieved) { + // Include sieved frames + for (Node::frame_iterator f1 = C1.beginframe(); f1 != C1.endframe(); ++f1) + { + for (Node::frame_iterator f2 = C2.beginframe(); f2 != C2.endframe(); ++f2) + { + double Dist = pmatrix.Frame_Distance(*f1, *f2); + //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); + switch (linkage_) { + case SINGLELINK : if ( Dist < dval ) dval = Dist; break; + case COMPLETELINK : if ( Dist > dval ) dval = Dist; break; + case AVERAGELINK : dval += Dist; nvals++; break; + } + } + } + } else { + // No sieved frames included. + for (Node::frame_iterator f1 = C1.beginframe(); f1 != C1.endframe(); ++f1) + { + if (!sievedOut.HasFrame(*f1)) { + for (Node::frame_iterator f2 = C2.beginframe(); f2 != C2.endframe(); ++f2) + { + if (!sievedOut.HasFrame(*f2)) { + double Dist = pmatrix.GetFdist(*f1, *f2); + //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); + switch (linkage_) { + case SINGLELINK : if ( Dist < dval ) dval = Dist; break; + case COMPLETELINK : if ( Dist > dval ) dval = Dist; break; + case AVERAGELINK : dval += Dist; nvals++; break; + } + } + } + } + } + } + if (linkage_ == AVERAGELINK) + dval /= (double)nvals; + + return dval; +} diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index ed64f28209..9eccf9213a 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -16,6 +16,8 @@ class Algorithm_HierAgglo : public Algorithm { void Results(CpptrajFile&) const; int DoClustering(List&, Cframes const&, PairwiseMatrix const&); void Timing(double) const; + double ClusterDistance(Node const&, Node const&, PairwiseMatrix const&, + bool, Cframes const&) const; private: void buildInitialClusters(List&, Cframes const&, Metric*); //void InitializeClusterDistances(); From 135ce0a3ef8ce9278b31f5de727a3cff4dc9da9c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 25 Jan 2019 14:40:45 -0500 Subject: [PATCH 076/417] DRR - Cpptraj: Add cluster summary --- src/Cluster/Control.cpp | 18 +++++- src/Cluster/Control.h | 1 + src/Cluster/List.h | 2 + src/Cluster/Output.cpp | 134 +++++++++++++++++++++++++++++++++++++++- src/Cluster/Output.h | 5 ++ src/cpptrajdepend | 3 +- src/cpptrajfiles | 1 + 7 files changed, 160 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 5a51f20ad9..71228a52fc 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -240,6 +240,7 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { suppressInfo_ = analyzeArgs.hasKey("noinfo"); if (!suppressInfo_) clusterinfo_ = analyzeArgs.GetStringKey("info"); + summaryfile_ = analyzeArgs.GetStringKey("summary"); sil_file_ = analyzeArgs.GetStringKey("sil"); @@ -301,7 +302,7 @@ int Cpptraj::Cluster::Control::Run() { Timer cluster_post_renumber; Timer cluster_post_bestrep; Timer cluster_post_info; - //Timer cluster_post_summary; + Timer cluster_post_summary; //Timer cluster_post_coords; cluster_post_renumber.Start(); // Update cluster centroids here in case they need to be used to @@ -378,6 +379,19 @@ int Cpptraj::Cluster::Control::Run() { Cfile.CloseFile(); } + // Print a summary of clusters + if (!summaryfile_.empty()) { + cluster_post_summary.Start(); + CpptrajFile outfile; + if (outfile.OpenWrite(summaryfile_)) { + mprinterr("Error: Could not set up cluster summary file.\n"); + return 1; + } + Output::Summary(outfile, clusters_, *algorithm_, *pmatrix_, includeSieveInCalc_, + frameSieve.SievedOut()); + cluster_post_summary.Stop(); + } + cluster_post.Stop(); cluster_total.Stop(); @@ -391,7 +405,7 @@ int Cpptraj::Cluster::Control::Run() { cluster_post_renumber.WriteTiming(2, "Cluster renumbering/sieve restore", cluster_post.Total()); cluster_post_bestrep.WriteTiming(2, "Find best rep.", cluster_post.Total()); cluster_post_info.WriteTiming(2, "Info calc", cluster_post.Total()); - //cluster_post_summary.WriteTiming(2, "Summary calc", cluster_post.Total()); + cluster_post_summary.WriteTiming(2, "Summary calc", cluster_post.Total()); //cluster_post_coords.WriteTiming(2, "Coordinate writes", cluster_post.Total()); cluster_total.WriteTiming(1, "Total:"); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 65c6f49a94..716399278e 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -58,6 +58,7 @@ class Control { bool suppressInfo_; ///< If true do not write cluster info std::string clusterinfo_; ///< Cluster info file name. + std::string summaryfile_; ///< Cluster summary file name. std::string sil_file_; ///< File prefix for writing silhouette data }; diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 10a3057a1d..737a5b1f51 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -27,6 +27,8 @@ class List { const cluster_iterator begincluster() const { return clusters_.begin(); } /// Const iterator to end const cluster_iterator endcluster() const { return clusters_.end(); } + /// \return first cluster + Node const& front() const { return clusters_.front(); } /// \return current number of clusters. int Nclusters() const { return (int)clusters_.size(); } /// \return true if no clusters diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index b87dab0960..b10f0837cf 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -1,5 +1,6 @@ -#include // sort +#include // sort, max #include "Output.h" +#include "../Matrix.h" // ----------------------------------------------------------------------------- // ClusterList::PrintClustersToFile() /** Print list of clusters in a style similar to ptraj; each cluster is @@ -134,3 +135,134 @@ int Cpptraj::Cluster::Output::PrintSilhouettes(CpptrajFile& Cfile, List const& c Cfile.Printf("%8i %g\n", Ci->Num(), Ci->Silhouette()); return 0; } + +/** Quick pass through clusters to determine max width of cluster names. */ +unsigned int Cpptraj::Cluster::Output::DetermineNameWidth(List const& clusters) +{ + unsigned int nWidth = 0; + for (List::cluster_iterator node = clusters.begincluster(); + node != clusters.endcluster(); ++node) + nWidth = std::max(nWidth, (unsigned int)node->Cname().size()); + return nWidth; +} + +/** Print a summary of clusters. */ +int Cpptraj::Cluster::Output::Summary(CpptrajFile& outfile, List const& clusters, + Algorithm const& algorithm, + PairwiseMatrix const& pmatrix, bool includeSieved, + Cframes const& sievedOut) +{ + double fmax = (double)pmatrix.DistMetric().Ntotal(); + //if (FrameDistances().SieveValue() != 1 && !includeSieveInAvg) + // mprintf("Warning: Within cluster average distance (AvgDist) does not include sieved frames.\n"); + outfile.Printf("%-8s %8s %8s %8s %8s","#Cluster","Frames","Frac", "AvgDist","Stdev"); + if (!clusters.empty() && clusters.front().BestReps().size() > 1) { + int nBestReps = clusters.front().BestReps().size(); + for (int i = 0; i != nBestReps; i++) + outfile.Printf(" %8s %8s", "Rep", "RepScore"); + } else + outfile.Printf(" %8s", "Centroid"); + outfile.Printf(" %8s", "AvgCDist"); + unsigned int nWidth = DetermineNameWidth(clusters); + if (nWidth > 0) { + if (nWidth < 8) nWidth = 8; + outfile.Printf(" %*s %8s", nWidth, "Name", "RMS"); + } + outfile.Printf("\n"); + //Timer t_fdist; // DEBUG + //Timer t_cdist; // DEBUG + //t_cdist.Start(); + // Calculate distances between clusters. + Matrix cluster_distances; + cluster_distances.resize( 0, clusters.Nclusters() ); + for (List::cluster_iterator c1 = clusters.begincluster(); c1 != clusters.endcluster(); ++c1) + for (List::cluster_iterator c2 = c1; c2 != clusters.endcluster(); ++c2) + if (c2 != c1) + cluster_distances.addElement( algorithm.ClusterDistance( *c1, *c2, pmatrix, + includeSieved, sievedOut ) ); + //t_cdist.Stop(); + + unsigned int idx1 = 0; + for (List::cluster_iterator node = clusters.begincluster(); + node != clusters.endcluster(); ++node, ++idx1) + { + // Calculate the average distance of this cluster to every other cluster. + //t_cdist.Start(); + double avgclusterdist = 0.0; + if (clusters.Nclusters() > 1) { + unsigned int idx2 = 0; + for (List::cluster_iterator node2 = clusters.begincluster(); + node2 != clusters.endcluster(); ++node2, ++idx2) + { + if (node != node2) + avgclusterdist += cluster_distances.element(idx1, idx2); + } + avgclusterdist /= (double)(clusters.Nclusters() - 1); + //mprintf("CLUSTER %i avgclusterdist= %g\n", node->Num(), avgclusterdist); + } + //t_cdist.Stop(); + // Since there may be a lot of frames do not calculate SD from the + // mean (which requires either storing distances or two double loops), + // instead use SD = sqrt( (SUM[x^2] - ((SUM[x])^2)/N)/N ) + //t_fdist.Start(); + double internalAvg = 0.0; + double internalSD = 0.0; + unsigned int Nelements = 0; + if (node->Nframes() > 1) { + // Calculate average distance between all frames in this cluster. + if (includeSieved) { + for (Node::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) { + for (Node::frame_iterator f2 = f1 + 1; f2 != node->endframe(); ++f2) { + double dist = pmatrix.Frame_Distance(*f1, *f2); + internalAvg += dist; + internalSD += (dist * dist); + ++Nelements; + } + } + } else { + for (Node::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) { + if (!sievedOut.HasFrame( *f1 )) { + for (Node::frame_iterator f2 = f1 + 1; f2 != node->endframe(); ++f2) { + if (!sievedOut.HasFrame( *f2 )) { + double dist = pmatrix.GetFdist(*f1, *f2); + internalAvg += dist; + internalSD += (dist * dist); + ++Nelements; + } + } + } + } + } + if (Nelements > 0) { + double norm = 1.0 / ((double)Nelements); + internalAvg *= norm; + internalSD *= norm; + internalSD -= (internalAvg * internalAvg); + if (internalSD > 0.0) + internalSD = sqrt( internalSD ); + else + internalSD = 0.0; + } + //t_fdist.Stop(); + } + // OUTPUT - TODO handle case when clusters dont have same number best reps + outfile.Printf("%8i %8i %8.3f %8.3f %8.3f", + node->Num(), node->Nframes(), (double)node->Nframes()/fmax, + internalAvg, internalSD); + if (node->BestReps().size() < 2) + outfile.Printf(" %8i", node->BestRepFrame()+1); + else { + for (Node::RepPairArray::const_iterator rep = node->BestReps().begin(); + rep != node->BestReps().end(); ++rep) + outfile.Printf(" %8i %8.3f", rep->first+1, rep->second); + } + outfile.Printf(" %8.3f", avgclusterdist); + if (nWidth > 0) + outfile.Printf(" %*s %8.3f", nWidth, node->Cname().c_str(), node->RefRms()); + outfile.Printf("\n"); + } // END loop over clusters + //t_cdist.WriteTiming(1, "Between-cluster distance calc."); + //t_fdist.WriteTiming(1, "Within-cluster distance calc."); + return 0; +} + diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h index abd6cdaddc..84c8cafd9a 100644 --- a/src/Cluster/Output.h +++ b/src/Cluster/Output.h @@ -5,6 +5,7 @@ #include "Algorithm.h" #include "Metric.h" #include "Cframes.h" +#include "PairwiseMatrix.h" // TODO anything that needs this calcd outside here? namespace Cpptraj { namespace Cluster { @@ -16,6 +17,10 @@ class Output { int, Cframes const&); static int PrintSilhouetteFrames(CpptrajFile&, List const&); static int PrintSilhouettes(CpptrajFile&, List const&); + static int Summary(CpptrajFile&, List const&, Algorithm const&, PairwiseMatrix const&, + bool, Cframes const&); + private: + static unsigned int DetermineNameWidth(List const&); }; } diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 30d04f8b84..394fd8ddac 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -140,6 +140,7 @@ BufferedLine.o : BufferedLine.cpp BufferedLine.h CpptrajFile.h CpptrajStdio.h Fi ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h +Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h @@ -149,7 +150,7 @@ Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIte Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h +Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index d846d25baa..f09d9849b7 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -1,5 +1,6 @@ # Files related to new clustering code CLUSTER_SOURCES= \ + Cluster/Algorithm.cpp \ Cluster/Algorithm_DBscan.cpp \ Cluster/Algorithm_HierAgglo.cpp \ Cluster/BestReps.cpp \ From bb24baf28aa976837f8f01fbc70b154a1684116f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 27 Jan 2019 19:12:47 -0500 Subject: [PATCH 077/417] DRR - Cpptraj: Add missing include --- src/Cluster/Output.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index b10f0837cf..e27222e789 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -1,3 +1,4 @@ +#include // sqrt #include // sort, max #include "Output.h" #include "../Matrix.h" From 27c99f068507ce28039ed249c84d90faa9713f13 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 28 Jan 2019 15:56:17 -0500 Subject: [PATCH 078/417] DRR - Cpptraj: Start converting to data set --- src/Cluster/Control.cpp | 12 ++++++------ src/Cluster/PairwiseMatrix.h | 8 +++++--- src/Cluster/PairwiseMatrix_MEM.h | 1 + src/DataSet.h | 2 +- src/DataSetList.cpp | 2 ++ src/DataSet_Pmatrix_MEM.h | 23 +++++++++++++++++++++++ src/cpptrajdepend | 2 +- 7 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 src/DataSet_Pmatrix_MEM.h diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 71228a52fc..239cf78ca8 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -259,13 +259,8 @@ int Cpptraj::Cluster::Control::Run() { mprinterr("Internal Error: Cluster::Control is not set up.\n"); return 1; } + // Timers - - // Set up the Metric - if (metric_->Setup()) { - mprinterr("Error: Metric setup failed.\n"); - return 1; - } Timer cluster_setup; Timer cluster_pairwise; Timer cluster_cluster; @@ -273,6 +268,11 @@ int Cpptraj::Cluster::Control::Run() { Timer cluster_total; cluster_total.Start(); cluster_setup.Start(); + // Set up the Metric + if (metric_->Setup()) { + mprinterr("Error: Metric setup failed.\n"); + return 1; + } // Figure out which frames to cluster Sieve frameSieve; diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 1c04fd62cc..53f48a05ce 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -8,8 +8,9 @@ namespace Cluster { class PairwiseMatrix { public: enum Type { MEM = 0, DISK, NOCACHE }; - - //PairwiseMatrix() : metric_(0) {} + /// CONSTRUCTOR - No metric + PairwiseMatrix(Type t) : type_(t), metric_(0) {} + /// CONSTRUCTOR - with metric PairwiseMatrix(Type, Metric*); virtual ~PairwiseMatrix() {} // ------------------------------------------- @@ -22,8 +23,9 @@ class PairwiseMatrix { /// Print only cached distances. virtual void PrintCached() const = 0; // ------------------------------------------- + bool HasMetric() const { return (metric_ != 0); } /// \return internal metric, const. - Metric const& DistMetric() const { return *metric_; } + Metric const& DistMetric() const { return *metric_; } /// \return internal metric. // Metric& DistMetric() { return *metric_; } /// \return Pointer to distance metric diff --git a/src/Cluster/PairwiseMatrix_MEM.h b/src/Cluster/PairwiseMatrix_MEM.h index 5fb32dad29..84e94a90ed 100644 --- a/src/Cluster/PairwiseMatrix_MEM.h +++ b/src/Cluster/PairwiseMatrix_MEM.h @@ -7,6 +7,7 @@ namespace Cluster { class PairwiseMatrix_MEM : public PairwiseMatrix { public: + PairwiseMatrix_MEM() : PairwiseMatrix(MEM) {} PairwiseMatrix_MEM(Metric* m) : PairwiseMatrix(MEM, m) {} // ------------------------------------------- double GetFdist(int f1, int f2) const { return Mat_.element(frameToMat_[f1], frameToMat_[f2]); } diff --git a/src/DataSet.h b/src/DataSet.h index fc3c971e26..c6f6263d52 100644 --- a/src/DataSet.h +++ b/src/DataSet.h @@ -27,7 +27,7 @@ class DataSet { UNKNOWN_DATA=0, DOUBLE, FLOAT, INTEGER, STRING, MATRIX_DBL, MATRIX_FLT, COORDS, VECTOR, MODES, GRID_FLT, GRID_DBL, REMLOG, XYMESH, TRAJ, REF_FRAME, MAT3X3, TOPOLOGY, CMATRIX, CMATRIX_NOMEM, CMATRIX_DISK, PH, PH_EXPL, PH_IMPL, - PARAMETERS + PARAMETERS, PMATRIX_MEM }; /// Group DataSet belongs to. enum DataGroup { diff --git a/src/DataSetList.cpp b/src/DataSetList.cpp index 17181532da..09cc9478db 100644 --- a/src/DataSetList.cpp +++ b/src/DataSetList.cpp @@ -27,6 +27,7 @@ #include "DataSet_PHREMD_Explicit.h" #include "DataSet_PHREMD_Implicit.h" #include "DataSet_Parameters.h" +#include "DataSet_Pmatrix_MEM.h" // IMPORTANT: THIS ARRAY MUST CORRESPOND TO DataSet::DataType const DataSetList::DataToken DataSetList::DataArray[] = { @@ -55,6 +56,7 @@ const DataSetList::DataToken DataSetList::DataArray[] = { { "pH REMD (explicit)",DataSet_PHREMD_Explicit::Alloc}, // PH_EXPL { "pH REMD (implicit)",DataSet_PHREMD_Implicit::Alloc}, // PH_IMPL { "parameters", DataSet_Parameters::Alloc }, // PARAMETERS + { "pairwise matrix (mem)",DataSet_Pmatrix_MEM::Alloc}, // PMATRIX_MEM { 0, 0 } }; diff --git a/src/DataSet_Pmatrix_MEM.h b/src/DataSet_Pmatrix_MEM.h new file mode 100644 index 0000000000..d05394fbec --- /dev/null +++ b/src/DataSet_Pmatrix_MEM.h @@ -0,0 +1,23 @@ +#ifndef INC_DATASET_PMATRIX_MEM_H +#define INC_DATASET_PMATRIX_MEM_H +#include "DataSet.h" +#include "Cluster/PairwiseMatrix_MEM.h" +/// Cluster pairwise matrix, distances stored in memory. +class DataSet_Pmatrix_MEM : public DataSet, Cpptraj::Cluster::PairwiseMatrix_MEM { + public: + DataSet_Pmatrix_MEM() : DataSet(PMATRIX_MEM, CLUSTERMATRIX, + TextFormat(TextFormat::DOUBLE, 12, 4), 2) {} + static DataSet* Alloc() { return (DataSet*)new DataSet_Pmatrix_MEM(); } + // ----- DataSet functions ------------------- + size_t Size() const { return 0; } // TODO + void Info() const { return; } + void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } // TODO + int Allocate(SizeArray const&) { return 1; } // TODO + void Add(size_t, const void*) {} + int Append(DataSet*) { return 1; } +# ifdef MPI + int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } +# endif + // ------------------------------------------- +}; +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 394fd8ddac..efa93d53e9 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -202,7 +202,7 @@ DataIO_VecTraj.o : DataIO_VecTraj.cpp ActionFrameCounter.h ArgList.h ArrayIterat DataIO_XVG.o : DataIO_XVG.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_XVG.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Xplor.o : DataIO_Xplor.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataSet.o : DataSet.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h -DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h ClusterDist.h ClusterSieve.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Cmatrix_MEM.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_Parameters.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h Hungarian.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h +DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h ClusterDist.h ClusterSieve.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Cmatrix_MEM.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_Parameters.h DataSet_Pmatrix_MEM.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h Hungarian.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h DataSet_1D.o : DataSet_1D.cpp ArgList.h ArrayIterator.h AssociatedData.h ComplexArray.h Constants.h Corr.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h PubFFT.h Range.h TextFormat.h DataSet_3D.o : DataSet_3D.cpp ArgList.h AssociatedData.h Box.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_3D.h Dimension.h FileIO.h FileName.h GridBin.h Matrix_3x3.h MetaData.h Parallel.h Range.h TextFormat.h Vec3.h DataSet_Cmatrix.o : DataSet_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h From 57cd491de648f917e7177f1c99a7a7aedf48d5dd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 29 Jan 2019 09:10:59 -0500 Subject: [PATCH 079/417] DRR - Cpptraj: Remove some debug info. --- src/Cluster/Control.cpp | 1 - src/Cluster/Control.h | 3 --- src/Cluster/PairwiseMatrix.cpp | 1 - 3 files changed, 5 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 239cf78ca8..395a7f79e1 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -163,7 +163,6 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, mprinterr("Error: Metric setup failed.\n"); return 1; } - mprintf("DEBUG: metric memory: %x\n", metric_); return Common(analyzeArgs); } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 716399278e..b1ddd354b8 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -19,9 +19,6 @@ class Control { static const char* AlgorithmArgs; enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; - enum SieveType { NONE=0, REGULAR, RANDOM }; - - static int SetFramesToCluster(Cframes&, Cframes&, int, std::size_t, int); int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index c984b5f45f..03ff56ba76 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -20,7 +20,6 @@ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesTo int f1, f2; // For OMP, every other thread will need its own Cdist. Metric* MyMetric = metric_; - mprintf("DEBUG: PairwiseMatrix::CalcFrameDistances(): MyMetric= %x\n", MyMetric); # ifdef _OPENMP # pragma omp parallel private(MyMetric, f1, f2) firstprivate(progress) { From 9516e0e7276d1e2932a4234755a980bd6d745bc6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 29 Jan 2019 10:27:16 -0500 Subject: [PATCH 080/417] DRR - Cpptraj: Move framesToMat_ to PairwiseMatrix so it can be used by any PairwiseMatrix that can cache. --- src/Cluster/PairwiseMatrix.cpp | 21 +++++++++++++++++++++ src/Cluster/PairwiseMatrix.h | 6 +++++- src/Cluster/PairwiseMatrix_MEM.cpp | 12 ++---------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 03ff56ba76..639a51c981 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -12,6 +12,27 @@ Cpptraj::Cluster::PairwiseMatrix::PairwiseMatrix(Type t, Metric* metric) : metric_(metric) {} +/** Set up frame number to matrix index for caching. */ +int Cpptraj::Cluster::PairwiseMatrix::setupFrameToMat(Cframes const& framesToCache) +{ + if (metric_ == 0) { + mprinterr("Internal Error: PairwiseMatrix::setupFrameToMat(): null metric.\n"); + return 1; + } + frameToMat_.assign(metric_->Ntotal(), -1); + int idx = 0; + for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) + frameToMat_[*it] = idx++; +# ifdef DEBUG_CLUSTER + // DEBUG + mprintf("DEBUG: frameToMat\n"); + for (Cframes_it it = frameToMat_.begin(); it != frameToMat_.end(); ++it) + mprintf("\tframeToMat_[%u] = %i\n", it - frameToMat_.begin(), *it); +# endif + return 0; +} + +/** Cache distances between given frames using SetElement(). */ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) { int f2end = (int)framesToCache.size(); diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 53f48a05ce..03b54fccb2 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -7,7 +7,7 @@ namespace Cluster { /// Interface for calculating/caching pairwise distances according to a given metric. class PairwiseMatrix { public: - enum Type { MEM = 0, DISK, NOCACHE }; + enum Type { MEM = 0, NC, NOCACHE }; /// CONSTRUCTOR - No metric PairwiseMatrix(Type t) : type_(t), metric_(0) {} /// CONSTRUCTOR - with metric @@ -34,8 +34,12 @@ class PairwiseMatrix { /// Used to cache distances; expect internal indices, not absolute cluster frames. virtual void SetElement(int, int, double) = 0; // ------------------------------------------- + /// Internal routine used to setup frameToMat_ array. + int setupFrameToMat(Cframes const&); /// Internal routine used to cache pairwise distances. int CalcFrameDistances(Cframes const&); + + Cframes frameToMat_; ///< Hold indices for all cached frames, -1 for non-cached. private: Type type_; ///< The current pairwise type. Metric* metric_; ///< The current distance metric. diff --git a/src/Cluster/PairwiseMatrix_MEM.cpp b/src/Cluster/PairwiseMatrix_MEM.cpp index ec9d69e554..80f9bfb083 100644 --- a/src/Cluster/PairwiseMatrix_MEM.cpp +++ b/src/Cluster/PairwiseMatrix_MEM.cpp @@ -21,16 +21,8 @@ int Cpptraj::Cluster::PairwiseMatrix_MEM::CacheDistances(Cframes const& framesTo mprintf("DEBUG: PairwiseMatrix_MEM set up for %i rows, size= %zu bytes.\n", Mat_.Nrows(), Mat_.sizeInBytes()); # endif - frameToMat_.assign(DistMetric().Ntotal(), -1); - int idx = 0; - for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) - frameToMat_[*it] = idx++; -# ifdef DEBUG_CLUSTER - // DEBUG - mprintf("DEBUG: frameToMat\n"); - for (Cframes_it it = frameToMat_.begin(); it != frameToMat_.end(); ++it) - mprintf("\tframeToMat_[%u] = %i\n", it - frameToMat_.begin(), *it); -# endif + if (setupFrameToMat( framesToCache )) return 1; + return CalcFrameDistances( framesToCache ); } From df3c37a300f5e196162d7c04bb44ef724e976e91 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 29 Jan 2019 10:27:54 -0500 Subject: [PATCH 081/417] DRR - Cpptraj: Add pairwise matrix netcdf --- src/Cluster/PairwiseMatrix_NC.cpp | 42 +++++++++++++++++++++++++++++++ src/Cluster/PairwiseMatrix_NC.h | 34 +++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/Cluster/PairwiseMatrix_NC.cpp create mode 100644 src/Cluster/PairwiseMatrix_NC.h diff --git a/src/Cluster/PairwiseMatrix_NC.cpp b/src/Cluster/PairwiseMatrix_NC.cpp new file mode 100644 index 0000000000..e6e2bf374d --- /dev/null +++ b/src/Cluster/PairwiseMatrix_NC.cpp @@ -0,0 +1,42 @@ +#include "PairwiseMatrix_NC.h" +#include "../CpptrajStdio.h" +#include "../StringRoutines.h" // ByteString + +/** \return distance between frames (cached or uncached). */ +double Cpptraj::Cluster::PairwiseMatrix_NC::Frame_Distance(int f1, int f2) const { + int idx1 = frameToMat_[f1]; + if (idx1 != -1) { + int idx2 = frameToMat_[f2]; + if (idx2 != -1) { + return file_.GetCmatrixElement( idx1, idx2 ); + } + } + // If here, distance was not cached. + return MetricPtr()->FrameDist(f1, f2); +} + +/** Requests that distances between given frames be cached in memory. */ +int Cpptraj::Cluster::PairwiseMatrix_NC::CacheDistances(Cframes const& framesToCache) { + if (fname_.empty()) { + mprinterr("Internal Error: PairwiseMatrix_NC::CacheDistances(): File name not set.\n"); + return 1; + } + size_t sizeIn = framesToCache.size(); + mprintf("\tPairwise cache file: '%s'\n", fname_.full()); + mprintf("\tEstimated pair-wise matrix disk usage: > %s\n", + ByteString( ((sizeIn*(sizeIn-1))/2)*sizeof(float), BYTE_DECIMAL).c_str()); + if (file_.CreateCmatrix(fname_, DistMetric().Ntotal(), sizeIn, // TODO sieve value + 1, DistMetric().Description())) + return 1; + // Write actual frames array if necessary // TODO enable + //if (sievedFrames_.Type() != ClusterSieve::NONE) { + // if (file_.WriteFramesArray( framesToCache )) + // return 1; + //} + // Reopen in SHARE mode for random access + if (file_.ReopenSharedWrite( fname_ )) return 1; + + if (setupFrameToMat( framesToCache )) return 1; + + return CalcFrameDistances( framesToCache ); +} diff --git a/src/Cluster/PairwiseMatrix_NC.h b/src/Cluster/PairwiseMatrix_NC.h new file mode 100644 index 0000000000..e98a7469a5 --- /dev/null +++ b/src/Cluster/PairwiseMatrix_NC.h @@ -0,0 +1,34 @@ +#ifndef INC_CLUSTER_PAIRWISE_MATRIX_NC_H +#define INC_CLUSTER_PAIRWISE_MATRIX_NC_H +#include "PairwiseMatrix.h" +#include "../NC_Cmatrix.h" +namespace Cpptraj { +namespace Cluster { + +/// Cache pairwise distances on disk via NetCDF +class PairwiseMatrix_NC : public PairwiseMatrix { + public: + PairwiseMatrix_NC() : PairwiseMatrix(NC) {} + PairwiseMatrix_NC(Metric* m) : PairwiseMatrix(NC, m) {} + // ------------------------------------------- + inline double GetFdist(int f1, int f2) const; + double Frame_Distance(int, int) const; + int CacheDistances(Cframes const&); + void PrintCached() const; + // ------------------------------------------- + void SetFilename(FileName const& f) { fname_ = f; } + protected: + void SetElement(int x, int y, double val) { file_.WriteCmatrixElement(x, y, val); } + private: + NC_Cmatrix file_; + FileName fname_; // TODO should this be part of NC_Cmatrix? +}; + +double PairwiseMatrix_NC::GetFdist(int x, int y) const { + return file_.GetCmatrixElement( frameToMat_[x], frameToMat_[y] ); +} + + +} +} +#endif From 9e6b40b6028724e370f189a0c64d62bd98afcc15 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 29 Jan 2019 10:28:19 -0500 Subject: [PATCH 082/417] DRR - Cpptraj: Pass in DataSetList to Control. Add netcdf pairwise matrix. --- src/Analysis_Cluster.cpp | 2 +- src/Cluster/Control.cpp | 19 ++++++++++++++++--- src/Cluster/Control.h | 5 +++-- src/cpptrajdepend | 7 ++++--- src/cpptrajfiles | 1 + 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 7a71a90bf1..3ae36c232d 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -32,7 +32,7 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s }*/ - control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, debugIn); + control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, setup.DSL(), debugIn); // Output files DataFile* cnumvtimefile = setup.DFL().AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 395a7f79e1..6b1328e759 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -5,6 +5,7 @@ #include "Output.h" // PairwiseMatrix classes #include "PairwiseMatrix_MEM.h" +#include "PairwiseMatrix_NC.h" // Metric classes #include "Metric_RMS.h" // Algorithms @@ -41,6 +42,7 @@ Cpptraj::Cluster::PairwiseMatrix* // TODO check for null metric switch (ptype) { case PairwiseMatrix::MEM : pmatrix = new PairwiseMatrix_MEM(metric); break; + case PairwiseMatrix::NC : pmatrix = new PairwiseMatrix_NC(metric); break; default: mprinterr("Error: Unhandled PairwiseMatrix in AllocatePairwise.\n"); } return pmatrix; @@ -53,13 +55,21 @@ const char* Cpptraj::Cluster::Control::PairwiseArgs = int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, Metric* metricIn) { if (metricIn == 0) return 1; + + // Determine if we are saving/loading pairwise distances + std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); + DataFile::DataFormatType pairdisttype = DataFile::UNKNOWN_DATA; + bool load_pair = analyzeArgs.hasKey("loadpairdist"); + bool save_pair = analyzeArgs.hasKey("savepairdist"); + + // Process DataSet type arguments PairwiseMatrix::Type pw_type = PairwiseMatrix::MEM; std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); if (!pw_typeString.empty()) { if (pw_typeString == "mem") pw_type = PairwiseMatrix::MEM; else if (pw_typeString == "disk") - pw_type = PairwiseMatrix::DISK; + pw_type = PairwiseMatrix::NC; else if (pw_typeString == "none") pw_type = PairwiseMatrix::NOCACHE; else { @@ -67,6 +77,8 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, Metric* me return 1; } } + + // Allocate pairwise matrix if (pmatrix_ != 0) delete pmatrix_; pmatrix_ = AllocatePairwise( pw_type, metricIn ); if (pmatrix_ == 0) return 1; @@ -124,6 +136,7 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, std::string const& maskExpr, ArgList& analyzeArgs, + DataSetList& DSL, int verboseIn) { verbose_ = verboseIn; @@ -164,11 +177,11 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, return 1; } - return Common(analyzeArgs); + return Common(analyzeArgs, DSL); } /** Common setup. */ -int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs) { +int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL) { clusters_.SetDebug( verbose_ ); // Allocate PairwiseMatrix. diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index b1ddd354b8..bfba3ac909 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -5,6 +5,7 @@ #include "Algorithm.h" #include "Metric.h" #include "BestReps.h" +#include "../DataSetList.h" #include "../DataSet_Coords.h" namespace Cpptraj { namespace Cluster { @@ -20,7 +21,7 @@ class Control { enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; - int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, int); + int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, DataSetList&,int); void Info() const; int Run(); @@ -36,7 +37,7 @@ class Control { static Algorithm* AllocateAlgorithm(Algorithm::AType); int AllocateAlgorithm(ArgList&); - int Common(ArgList&); + int Common(ArgList&, DataSetList&); List clusters_; Metric* metric_; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index efa93d53e9..f9943df78f 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Clustering.o : Analysis_Clustering.cpp ActionFrameCounter.h ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h Cluster_DPeaks.h Cluster_HierAgglo.h Cluster_Kmeans.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -146,13 +146,14 @@ Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgLi Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NC_Cmatrix.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/PairwiseMatrix_NC.h Cluster/Sieve.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/PairwiseMatrix_NC.o : Cluster/PairwiseMatrix_NC.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../NC_Cmatrix.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../StringRoutines.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_NC.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterList.o : ClusterList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h @@ -168,7 +169,7 @@ Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedDa Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index f09d9849b7..95ddf245ad 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -13,6 +13,7 @@ CLUSTER_SOURCES= \ Cluster/Output.cpp \ Cluster/PairwiseMatrix.cpp \ Cluster/PairwiseMatrix_MEM.cpp \ + Cluster/PairwiseMatrix_NC.cpp \ Cluster/Sieve.cpp # These files are common to cpptraj/libcpptraj. Files that need to be built From bc33b695c8f3f4b92e7f1fea515d411f33fa5a73 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 30 Jan 2019 15:44:07 -0500 Subject: [PATCH 083/417] DRR - Cpptraj: DataSet_PairwiseCache. Distillation of Pairwise_Matrix. --- src/DataSet_PairwiseCache.cpp | 22 ++++++++++++++++++++ src/DataSet_PairwiseCache.h | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/DataSet_PairwiseCache.cpp create mode 100644 src/DataSet_PairwiseCache.h diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp new file mode 100644 index 0000000000..246c4f9b5d --- /dev/null +++ b/src/DataSet_PairwiseCache.cpp @@ -0,0 +1,22 @@ +#include "DataSet_PairwiseCache.h" +#include "CpptrajStdio.h" + +using namespace Cpptraj; +using namespace Cluster; + +/** Set up frame number to matrix index for caching. */ +int DataSet_PairwiseCache::setupFrameToMat(Cframes const& framesToCache, unsigned int Ntotal) +{ + frameToMat_.assign(Ntotal, -1); + int idx = 0; + for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) + frameToMat_[*it] = idx++; +# ifdef DEBUG_CLUSTER + // DEBUG + mprintf("DEBUG: frameToMat\n"); + for (Cframes_it it = frameToMat_.begin(); it != frameToMat_.end(); ++it) + mprintf("\tframeToMat_[%u] = %i\n", it - frameToMat_.begin(), *it); +# endif + return 0; +} + diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h new file mode 100644 index 0000000000..df97c86b01 --- /dev/null +++ b/src/DataSet_PairwiseCache.h @@ -0,0 +1,38 @@ +#ifndef INC_DATASET_PAIRWISECACHE_H +#define INC_DATASET_PAIRWISECACHE_H +#include "DataSet.h" +#include "Cluster/Cframes.h" +/// Used to cache distances in a potentially sparse square matrix +class DataSet_PairwiseCache : public DataSet { + public: + DataSet_PairwiseCache() {} + DataSet_PairwiseCache(DataType t) : DataSet(t, CLUSTERMATRIX, + TextFormat(TextFormat::DOUBLE, 12, 4), 2) {} + virtual ~DataSet_PairwiseCache() {} + + typedef Cpptraj::Cluster::Cframes Cframes; + //static DataSet* Alloc() { return (DataSet*)new DataSet_PairwiseCache(); } + // ----- DataSet functions ------------------- + size_t Size() const { return 0; } + void Info() const { return; } + int Allocate(SizeArray const&) { return 1; } + void Add(size_t, const void*) { return; } + void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } + int Append(DataSet*) { return 1; } +# ifdef MPI + int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } +# endif + // ------------------------------------------- + /// \return distance between given cached frames (absolute frame numbers). + virtual double GetFdist(int, int) const = 0; + /// Print only cached distances. + virtual void PrintCached() const = 0; + /// Used to cache distances; expect internal indices, not absolute cluster frames. + virtual void SetElement(int, int, double) = 0; + private: + /// Set which frames will be cached; sets up the frameToMat_ array. + int setupFrameToMat(Cframes const&, unsigned int); + + Cframes frameToMat_; ///< Hold indices for all cached frames, -1 for non-cached. +}; +#endif From f5da0c4fdde8f5a5e502a2ceea138ac980ce99fe Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 30 Jan 2019 15:52:34 -0500 Subject: [PATCH 084/417] DRR - Cpptraj: Adapt PairwiseMatrix_MEM to DataSet_PairwiseCache_MEM. --- src/DataSet_PairwiseCache.h | 12 +++++++----- src/DataSet_PairwiseCache_MEM.cpp | 16 ++++++++++++++++ src/DataSet_PairwiseCache_MEM.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 src/DataSet_PairwiseCache_MEM.cpp create mode 100644 src/DataSet_PairwiseCache_MEM.h diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index df97c86b01..7a1dd1ddc2 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -13,11 +13,11 @@ class DataSet_PairwiseCache : public DataSet { typedef Cpptraj::Cluster::Cframes Cframes; //static DataSet* Alloc() { return (DataSet*)new DataSet_PairwiseCache(); } // ----- DataSet functions ------------------- - size_t Size() const { return 0; } - void Info() const { return; } - int Allocate(SizeArray const&) { return 1; } - void Add(size_t, const void*) { return; } - void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } + //size_t Size() const { return 0; } + //void Info() const { return; } + //int Allocate(SizeArray const&) { return 1; } + //void Add(size_t, const void*) { return; } + //void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } int Append(DataSet*) { return 1; } # ifdef MPI int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } @@ -29,6 +29,8 @@ class DataSet_PairwiseCache : public DataSet { virtual void PrintCached() const = 0; /// Used to cache distances; expect internal indices, not absolute cluster frames. virtual void SetElement(int, int, double) = 0; + + Cframes const& FrameToMat() const { return frameToMat_; } private: /// Set which frames will be cached; sets up the frameToMat_ array. int setupFrameToMat(Cframes const&, unsigned int); diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp new file mode 100644 index 0000000000..c6389f89c2 --- /dev/null +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -0,0 +1,16 @@ +#include "DataSet_PairwiseCache_MEM.h" +#include "CpptrajStdio.h" + +/** Print cached distances to stdout. */ +void DataSet_PairwiseCache_MEM::PrintCached() const { + for (Cframes::const_iterator it1 = FrameToMat().begin(); it1 != FrameToMat().end(); ++it1) + { + if (*it1 != -1) { + for (Cframes::const_iterator it2 = it1 + 1; it2 != FrameToMat().end(); ++it2) + { + if (*it2 != -1) + mprintf("\t%i %i %f\n", *it1+1, *it2+1, Mat_.element(*it1, *it2)); + } + } + } +} diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h new file mode 100644 index 0000000000..4eb2c0fb13 --- /dev/null +++ b/src/DataSet_PairwiseCache_MEM.h @@ -0,0 +1,29 @@ +#ifndef INC_DATASET_PAIRWISECACHE_MEM_H +#define INC_DATASET_PAIRWISECACHE_MEM_H +#include "DataSet_PairwiseCache.h" +#include "Matrix.h" +/// +class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { + public: + DataSet_PairwiseCache_MEM() : DataSet_PairwiseCache(PMATRIX_MEM) {} + static DataSet* Alloc() { return (DataSet*)new DataSet_PairwiseCache_MEM(); } + // ----- DataSet functions ------------------- + size_t Size() const { return 0; } + void Info() const { return; } + int Allocate(SizeArray const&) { return 1; } + void Add(size_t, const void*) { return; } + void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } +// int Append(DataSet*) { return 1; } +//# ifdef MPI +// int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } +//# endif + // ------------------------------------------- + double GetFdist(int f1, int f2) const { return Mat_.element(FrameToMat()[f1], FrameToMat()[f2]); } + //double Frame_Distance(int, int) const; + //int CacheDistances(Cframes const&); + void PrintCached() const; + void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } + private: + Matrix Mat_; ///< Hold cached distances +}; +#endif From 50db65d8c11c3d5279fb25ac3d6aa0b529cf94b3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 30 Jan 2019 16:03:32 -0500 Subject: [PATCH 085/417] DRR - Cpptraj: Start refactoring PairwiseMatrix. --- src/Cluster/PairwiseMatrix.cpp | 22 +++++++++++++++++---- src/Cluster/PairwiseMatrix.h | 35 ++++++++++++---------------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 639a51c981..e40bc71e9a 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -4,15 +4,15 @@ #endif #include "../ProgressBar.h" #include "../CpptrajStdio.h" -// Distance Metric classes -#include "Metric_RMS.h" +/* Cpptraj::Cluster::PairwiseMatrix::PairwiseMatrix(Type t, Metric* metric) : type_(t), metric_(metric) -{} +{}*/ /** Set up frame number to matrix index for caching. */ +/* int Cpptraj::Cluster::PairwiseMatrix::setupFrameToMat(Cframes const& framesToCache) { if (metric_ == 0) { @@ -31,6 +31,20 @@ int Cpptraj::Cluster::PairwiseMatrix::setupFrameToMat(Cframes const& framesToCac # endif return 0; } +*/ + +int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCache) { + if (framesToCache.size() < 1) return 0; + if (cache_ == 0) { + mprinterr("Internal Error: PairwiseMatrix::CacheDistances(): Cache set is null.\n"); + return 1; + } + if (metric_ == 0) { + mprinterr("Internal Error: PairwiseMatrix::CacheDistances(): Metric is null.\n"); + return 1; + } + return CalcFrameDistances(framesToCache); +} /** Cache distances between given frames using SetElement(). */ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) @@ -56,7 +70,7 @@ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesTo for (f1 = 0; f1 < f1end; f1++) { progress.Update(f1); for (f2 = f1 + 1; f2 < f2end; f2++) - SetElement( f1, f2, MyMetric->FrameDist(framesToCache[f1], framesToCache[f2]) ); + cache_->SetElement( f1, f2, MyMetric->FrameDist(framesToCache[f1], framesToCache[f2]) ); } # ifdef _OPENMP if (mythread > 0) diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 03b54fccb2..5a7493492b 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -1,5 +1,6 @@ #ifndef INC_CLUSTER_PAIRWISE_MATRIX_H #define INC_CLUSTER_PAIRWISE_MATRIX_H +#include "../DataSet_PairwiseCache.h" #include "Metric.h" namespace Cpptraj { namespace Cluster { @@ -7,21 +8,16 @@ namespace Cluster { /// Interface for calculating/caching pairwise distances according to a given metric. class PairwiseMatrix { public: - enum Type { MEM = 0, NC, NOCACHE }; - /// CONSTRUCTOR - No metric - PairwiseMatrix(Type t) : type_(t), metric_(0) {} - /// CONSTRUCTOR - with metric - PairwiseMatrix(Type, Metric*); - virtual ~PairwiseMatrix() {} + PairwiseMatrix() : cache_(0), metric_(0) {} + /// CONSTRUCTOR - with cache and metric + PairwiseMatrix(DataSet_PairwiseCache*, Metric*); // ------------------------------------------- - /// \return distance between given cached frames. - virtual double GetFdist(int, int) const = 0; - /// \return distance between given frames. - virtual double Frame_Distance(int, int) const = 0; + /// \return distance between given frames.TODO const? + double Frame_Distance(int, int); /// Request that distances for the specified frames be cached. - virtual int CacheDistances(Cframes const&) = 0; - /// Print only cached distances. - virtual void PrintCached() const = 0; + int CacheDistances(Cframes const&); + /// Print only cached distances. TODO const? + //virtual void PrintCached() const = 0; // ------------------------------------------- bool HasMetric() const { return (metric_ != 0); } /// \return internal metric, const. @@ -30,19 +26,12 @@ class PairwiseMatrix { // Metric& DistMetric() { return *metric_; } /// \return Pointer to distance metric Metric* MetricPtr() const { return metric_; } - protected: - /// Used to cache distances; expect internal indices, not absolute cluster frames. - virtual void SetElement(int, int, double) = 0; - // ------------------------------------------- - /// Internal routine used to setup frameToMat_ array. - int setupFrameToMat(Cframes const&); + private: /// Internal routine used to cache pairwise distances. int CalcFrameDistances(Cframes const&); - Cframes frameToMat_; ///< Hold indices for all cached frames, -1 for non-cached. - private: - Type type_; ///< The current pairwise type. - Metric* metric_; ///< The current distance metric. + DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. + Metric* metric_; ///< The current distance metric. }; } /* END namespace Cluster */ From 56413b0b6b107b706e829e66f515874adb16c6e3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 31 Jan 2019 08:10:31 -0500 Subject: [PATCH 086/417] DRR - Cpptraj: Pass in DataSetList --- src/Cluster/Control.cpp | 6 +++++- src/Cluster/Control.h | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 6b1328e759..caae2954b4 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -35,6 +35,7 @@ Cpptraj::Cluster::Control::~Control() { // ----------------------------------------------------------------------------- /** \return pointer to PairwiseMatrix of specified type. */ +/* Cpptraj::Cluster::PairwiseMatrix* Cpptraj::Cluster::Control::AllocatePairwise(PairwiseMatrix::Type ptype, Metric* metric) { @@ -47,12 +48,14 @@ Cpptraj::Cluster::PairwiseMatrix* } return pmatrix; } +*/ const char* Cpptraj::Cluster::Control::PairwiseArgs = "pairwisecache {mem|disk|none}"; /** Set up PairwiseMatrix from arguments. */ -int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, Metric* metricIn) +int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetList& DSL, + Metric* metricIn) { if (metricIn == 0) return 1; @@ -180,6 +183,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, return Common(analyzeArgs, DSL); } +// ----------------------------------------------------------------------------- /** Common setup. */ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL) { clusters_.SetDebug( verbose_ ); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index bfba3ac909..9035b04748 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -29,8 +29,8 @@ class Control { List const& Clusters() const { return clusters_; } Metric const& DistMetric() const { return *metric_; } private: - static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); - int AllocatePairwise(ArgList&, Metric*); + //static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); + int AllocatePairwise(ArgList&, DataSetList&, Metric*); static Metric* AllocateMetric(Metric::Type); From 203ae305063a1b7f7b1108d62722500617b7cf1f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 31 Jan 2019 09:16:36 -0500 Subject: [PATCH 087/417] DRR - Cpptraj: Implement the CachedDistance routine. Make it so that Frame_Distance will be the primary interface for calculating between-frame distances. --- src/Cluster/Control.h | 10 ++++++---- src/Cluster/PairwiseMatrix.cpp | 15 +++++++++++++++ src/Cluster/PairwiseMatrix.h | 6 ++++-- src/DataSet_PairwiseCache.h | 4 +++- src/DataSet_PairwiseCache_MEM.h | 3 ++- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 9035b04748..1f76767c14 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -7,6 +7,7 @@ #include "BestReps.h" #include "../DataSetList.h" #include "../DataSet_Coords.h" +#include "../DataSet_PairwiseCache.h" namespace Cpptraj { namespace Cluster { @@ -39,10 +40,11 @@ class Control { int Common(ArgList&, DataSetList&); - List clusters_; - Metric* metric_; - PairwiseMatrix* pmatrix_; - Algorithm* algorithm_; + List clusters_; ///< Hold cluster results. + Metric* metric_; ///< Hold the distance metric. + DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. + PairwiseMatrix* pmatrix_; ///< Encapsulates the metric and any cached distances. + Algorithm* algorithm_; ///< Hold the clustering algorithm. int verbose_; int sieve_; ///< Sieve value diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index e40bc71e9a..8db36a737c 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -33,6 +33,21 @@ int Cpptraj::Cluster::PairwiseMatrix::setupFrameToMat(Cframes const& framesToCac } */ +/** \return distance between frames (cached or uncached). */ // TODO inline? +double Cpptraj::Cluster::PairwiseMatrix::Frame_Distance(int f1, int f2) const { + if (cache_ != 0) + { + int idx1 = cache_->FrameToMat()[f1]; + if (idx1 != -1) { + int idx2 = cache_->FrameToMat()[f2]; + if (idx2 != -1) + return cache_->CachedDistance(idx1, idx2); + } + } + // If here, distance was not cached or no cache. + return metric_->FrameDist(f1, f2); +} + int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCache) { if (framesToCache.size() < 1) return 0; if (cache_ == 0) { diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 5a7493492b..d90a42f5fc 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -5,19 +5,21 @@ namespace Cpptraj { namespace Cluster { -/// Interface for calculating/caching pairwise distances according to a given metric. +/// Used to calculate/caching pairwise distances according to a given metric. class PairwiseMatrix { public: PairwiseMatrix() : cache_(0), metric_(0) {} /// CONSTRUCTOR - with cache and metric PairwiseMatrix(DataSet_PairwiseCache*, Metric*); + // ------------------------------------------- /// \return distance between given frames.TODO const? - double Frame_Distance(int, int); + double Frame_Distance(int, int) const; /// Request that distances for the specified frames be cached. int CacheDistances(Cframes const&); /// Print only cached distances. TODO const? //virtual void PrintCached() const = 0; + // ------------------------------------------- bool HasMetric() const { return (metric_ != 0); } /// \return internal metric, const. diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index 7a1dd1ddc2..68abd826c7 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -24,7 +24,9 @@ class DataSet_PairwiseCache : public DataSet { # endif // ------------------------------------------- /// \return distance between given cached frames (absolute frame numbers). - virtual double GetFdist(int, int) const = 0; + //virtual double GetFdist(int, int) const = 0; + /// \return distance between cached frames (internal indices). + virtual double CachedDistance(unsigned int, unsigned int) const; /// Print only cached distances. virtual void PrintCached() const = 0; /// Used to cache distances; expect internal indices, not absolute cluster frames. diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index 4eb2c0fb13..a0c151c61e 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -18,8 +18,9 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { // int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } //# endif // ------------------------------------------- - double GetFdist(int f1, int f2) const { return Mat_.element(FrameToMat()[f1], FrameToMat()[f2]); } + //double GetFdist(int f1, int f2) const { return Mat_.element(FrameToMat()[f1], FrameToMat()[f2]); } //double Frame_Distance(int, int) const; + double CachedDistance(unsigned int i1, unsigned int i2) const { return Mat_.element(i1, i2); } //int CacheDistances(Cframes const&); void PrintCached() const; void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } From 4da59458b0c68b7b40e80d072c7a4d052b6e0e44 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 31 Jan 2019 09:43:50 -0500 Subject: [PATCH 088/417] DRR - Cpptraj: Get rid of DataSet_Pmatrix in favor of DataSet_PairwiseCache --- src/DataSet.h | 7 ++++--- src/DataSetList.cpp | 4 ++-- src/DataSet_Pmatrix_MEM.h | 23 ----------------------- src/cpptrajdepend | 28 ++++++++++++++-------------- 4 files changed, 20 insertions(+), 42 deletions(-) delete mode 100644 src/DataSet_Pmatrix_MEM.h diff --git a/src/DataSet.h b/src/DataSet.h index c6f6263d52..09a456d656 100644 --- a/src/DataSet.h +++ b/src/DataSet.h @@ -27,11 +27,12 @@ class DataSet { UNKNOWN_DATA=0, DOUBLE, FLOAT, INTEGER, STRING, MATRIX_DBL, MATRIX_FLT, COORDS, VECTOR, MODES, GRID_FLT, GRID_DBL, REMLOG, XYMESH, TRAJ, REF_FRAME, MAT3X3, TOPOLOGY, CMATRIX, CMATRIX_NOMEM, CMATRIX_DISK, PH, PH_EXPL, PH_IMPL, - PARAMETERS, PMATRIX_MEM + PARAMETERS, PMATRIX_MEM, PMATRIX_NC // TODO remove CMATRIX }; - /// Group DataSet belongs to. + /// Group DataSet belongs to. TODO remove CLUSTERMATRIX enum DataGroup { - GENERIC=0, SCALAR_1D, MATRIX_2D, GRID_3D, COORDINATES, CLUSTERMATRIX, PHREMD + GENERIC=0, SCALAR_1D, MATRIX_2D, GRID_3D, COORDINATES, CLUSTERMATRIX, + PHREMD, PWCACHE }; DataSet(); diff --git a/src/DataSetList.cpp b/src/DataSetList.cpp index 09cc9478db..158ccb17c2 100644 --- a/src/DataSetList.cpp +++ b/src/DataSetList.cpp @@ -27,7 +27,7 @@ #include "DataSet_PHREMD_Explicit.h" #include "DataSet_PHREMD_Implicit.h" #include "DataSet_Parameters.h" -#include "DataSet_Pmatrix_MEM.h" +#include "DataSet_PairwiseCache_MEM.h" // IMPORTANT: THIS ARRAY MUST CORRESPOND TO DataSet::DataType const DataSetList::DataToken DataSetList::DataArray[] = { @@ -56,7 +56,7 @@ const DataSetList::DataToken DataSetList::DataArray[] = { { "pH REMD (explicit)",DataSet_PHREMD_Explicit::Alloc}, // PH_EXPL { "pH REMD (implicit)",DataSet_PHREMD_Implicit::Alloc}, // PH_IMPL { "parameters", DataSet_Parameters::Alloc }, // PARAMETERS - { "pairwise matrix (mem)",DataSet_Pmatrix_MEM::Alloc}, // PMATRIX_MEM + { "pairwise matrix (mem)",DataSet_PairwiseCache_MEM::Alloc}, // PMATRIX_MEM { 0, 0 } }; diff --git a/src/DataSet_Pmatrix_MEM.h b/src/DataSet_Pmatrix_MEM.h deleted file mode 100644 index d05394fbec..0000000000 --- a/src/DataSet_Pmatrix_MEM.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef INC_DATASET_PMATRIX_MEM_H -#define INC_DATASET_PMATRIX_MEM_H -#include "DataSet.h" -#include "Cluster/PairwiseMatrix_MEM.h" -/// Cluster pairwise matrix, distances stored in memory. -class DataSet_Pmatrix_MEM : public DataSet, Cpptraj::Cluster::PairwiseMatrix_MEM { - public: - DataSet_Pmatrix_MEM() : DataSet(PMATRIX_MEM, CLUSTERMATRIX, - TextFormat(TextFormat::DOUBLE, 12, 4), 2) {} - static DataSet* Alloc() { return (DataSet*)new DataSet_Pmatrix_MEM(); } - // ----- DataSet functions ------------------- - size_t Size() const { return 0; } // TODO - void Info() const { return; } - void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } // TODO - int Allocate(SizeArray const&) { return 1; } // TODO - void Add(size_t, const void*) {} - int Append(DataSet*) { return 1; } -# ifdef MPI - int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } -# endif - // ------------------------------------------- -}; -#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index f9943df78f..da75e9ec60 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Clustering.o : Analysis_Clustering.cpp ActionFrameCounter.h ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h Cluster_DPeaks.h Cluster_HierAgglo.h Cluster_Kmeans.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -140,20 +140,20 @@ BufferedLine.o : BufferedLine.cpp BufferedLine.h CpptrajFile.h CpptrajStdio.h Fi ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h -Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NC_Cmatrix.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/PairwiseMatrix_NC.h Cluster/Sieve.h -Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NC_Cmatrix.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/PairwiseMatrix_NC.h Cluster/Sieve.h +Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h -Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h -Cluster/PairwiseMatrix_NC.o : Cluster/PairwiseMatrix_NC.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../NC_Cmatrix.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../StringRoutines.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_NC.h +Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h +Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h +Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h +Cluster/PairwiseMatrix_NC.o : Cluster/PairwiseMatrix_NC.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../NC_Cmatrix.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../StringRoutines.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_NC.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterList.o : ClusterList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h @@ -169,7 +169,7 @@ Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedDa Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h @@ -203,7 +203,7 @@ DataIO_VecTraj.o : DataIO_VecTraj.cpp ActionFrameCounter.h ArgList.h ArrayIterat DataIO_XVG.o : DataIO_XVG.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_XVG.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Xplor.o : DataIO_Xplor.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataSet.o : DataSet.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h -DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h ClusterDist.h ClusterSieve.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Cmatrix_MEM.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_Parameters.h DataSet_Pmatrix_MEM.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h Hungarian.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h +DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Cmatrix_MEM.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_Parameters.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h Hungarian.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h DataSet_1D.o : DataSet_1D.cpp ArgList.h ArrayIterator.h AssociatedData.h ComplexArray.h Constants.h Corr.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h PubFFT.h Range.h TextFormat.h DataSet_3D.o : DataSet_3D.cpp ArgList.h AssociatedData.h Box.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_3D.h Dimension.h FileIO.h FileName.h GridBin.h Matrix_3x3.h MetaData.h Parallel.h Range.h TextFormat.h Vec3.h DataSet_Cmatrix.o : DataSet_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h From d3d7fd40615d08cefa8c1d6fa9abbf6bb704da9b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 31 Jan 2019 10:03:38 -0500 Subject: [PATCH 089/417] DRR - Cpptraj: FrameToIdx is more generally descriptive. --- src/DataSet_PairwiseCache.cpp | 10 +++++----- src/DataSet_PairwiseCache.h | 13 ++++++++----- src/DataSet_PairwiseCache_MEM.cpp | 4 ++-- src/cpptrajdepend | 2 ++ src/cpptrajfiles | 2 ++ 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index 246c4f9b5d..3355c7eaa1 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -5,17 +5,17 @@ using namespace Cpptraj; using namespace Cluster; /** Set up frame number to matrix index for caching. */ -int DataSet_PairwiseCache::setupFrameToMat(Cframes const& framesToCache, unsigned int Ntotal) +int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigned int Ntotal) { - frameToMat_.assign(Ntotal, -1); + frameToIdx_.assign(Ntotal, -1); int idx = 0; for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) - frameToMat_[*it] = idx++; + frameToIdx_[*it] = idx++; # ifdef DEBUG_CLUSTER // DEBUG mprintf("DEBUG: frameToMat\n"); - for (Cframes_it it = frameToMat_.begin(); it != frameToMat_.end(); ++it) - mprintf("\tframeToMat_[%u] = %i\n", it - frameToMat_.begin(), *it); + for (Cframes_it it = frameToIdx_.begin(); it != frameToIdx_.end(); ++it) + mprintf("\tframeToIdx_[%u] = %i\n", it - frameToIdx_.begin(), *it); # endif return 0; } diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index 68abd826c7..46dbaa0719 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -32,11 +32,14 @@ class DataSet_PairwiseCache : public DataSet { /// Used to cache distances; expect internal indices, not absolute cluster frames. virtual void SetElement(int, int, double) = 0; - Cframes const& FrameToMat() const { return frameToMat_; } - private: - /// Set which frames will be cached; sets up the frameToMat_ array. - int setupFrameToMat(Cframes const&, unsigned int); + // ------------------------------------------- - Cframes frameToMat_; ///< Hold indices for all cached frames, -1 for non-cached. + /// \return The array for converting frame numbers to internal cache indices. + Cframes const& FrameToIdx() const { return frameToIdx_; } + + /// Set up frame to internal index array using given frames and total frames. + int SetupFrameToIdx(Cframes const&, unsigned int); + private: + Cframes frameToIdx_; ///< Hold indices for all cached frames, -1 for non-cached. }; #endif diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp index c6389f89c2..2e62ad4308 100644 --- a/src/DataSet_PairwiseCache_MEM.cpp +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -3,10 +3,10 @@ /** Print cached distances to stdout. */ void DataSet_PairwiseCache_MEM::PrintCached() const { - for (Cframes::const_iterator it1 = FrameToMat().begin(); it1 != FrameToMat().end(); ++it1) + for (Cframes::const_iterator it1 = FrameToIdx().begin(); it1 != FrameToIdx().end(); ++it1) { if (*it1 != -1) { - for (Cframes::const_iterator it2 = it1 + 1; it2 != FrameToMat().end(); ++it2) + for (Cframes::const_iterator it2 = it1 + 1; it2 != FrameToIdx().end(); ++it2) { if (*it2 != -1) mprintf("\t%i %i %f\n", *it1+1, *it2+1, Mat_.element(*it1, *it2)); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index da75e9ec60..a403846000 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -223,6 +223,8 @@ DataSet_Mesh.o : DataSet_Mesh.cpp ArgList.h AssociatedData.h Constants.h Cpptraj DataSet_Modes.o : DataSet_Modes.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h DataSet_MatrixDbl.h DataSet_Modes.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Vec3.h DataSet_PHREMD_Explicit.o : DataSet_PHREMD_Explicit.cpp ArgList.h AssociatedData.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h Range.h TextFormat.h DataSet_PHREMD_Implicit.o : DataSet_PHREMD_Implicit.cpp ArgList.h AssociatedData.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PHREMD.h DataSet_PHREMD_Implicit.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h Range.h TextFormat.h +DataSet_PairwiseCache.o : DataSet_PairwiseCache.cpp ArgList.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h +DataSet_PairwiseCache_MEM.o : DataSet_PairwiseCache_MEM.cpp ArgList.h ArrayIterator.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Matrix.h MetaData.h Parallel.h Range.h TextFormat.h DataSet_Parameters.o : DataSet_Parameters.cpp ArgList.h AssociatedData.h AtomType.h AtomTypeArray.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h TextFormat.h DataSet_RemLog.o : DataSet_RemLog.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h ReplicaDimArray.h TextFormat.h DataSet_Topology.o : DataSet_Topology.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h BondSearch.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Topology.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ParmFile.h ParmIO.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Topology.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 95ddf245ad..e700674366 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -223,6 +223,8 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ DataSet_MatrixFlt.cpp \ DataSet_Mesh.cpp \ DataSet_Modes.cpp \ + DataSet_PairwiseCache.cpp \ + DataSet_PairwiseCache_MEM.cpp \ DataSet_Parameters.cpp \ DataSet_pH.cpp \ DataSet_PHREMD_Explicit.cpp \ From 276031d6f8ef064f65b9513d1e5f7cbf3afd1fc3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 31 Jan 2019 10:30:44 -0500 Subject: [PATCH 090/417] DRR - Cpptraj: New PairwiseMatrix set up. Correct some variable names. --- src/Cluster/PairwiseMatrix.cpp | 17 ++++++++++------- src/Cluster/PairwiseMatrix.h | 7 ++++--- src/DataSet_PairwiseCache_MEM.h | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 8db36a737c..02e81d2bc6 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -5,11 +5,14 @@ #include "../ProgressBar.h" #include "../CpptrajStdio.h" -/* -Cpptraj::Cluster::PairwiseMatrix::PairwiseMatrix(Type t, Metric* metric) : - type_(t), - metric_(metric) -{}*/ +/** Set up PairwiseMatrix with Metric and optional cache. */ +int Cpptraj::Cluster::PairwiseMatrix::Setup(Metric* metric, DataSet_PairwiseCache* cache) +{ + if (metric == 0) return 1; + metric_ = metric; + cache_ = cache; + return 0; +} /** Set up frame number to matrix index for caching. */ /* @@ -37,9 +40,9 @@ int Cpptraj::Cluster::PairwiseMatrix::setupFrameToMat(Cframes const& framesToCac double Cpptraj::Cluster::PairwiseMatrix::Frame_Distance(int f1, int f2) const { if (cache_ != 0) { - int idx1 = cache_->FrameToMat()[f1]; + int idx1 = cache_->FrameToIdx()[f1]; if (idx1 != -1) { - int idx2 = cache_->FrameToMat()[f2]; + int idx2 = cache_->FrameToIdx()[f2]; if (idx2 != -1) return cache_->CachedDistance(idx1, idx2); } diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index d90a42f5fc..4e3742163d 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -9,8 +9,9 @@ namespace Cluster { class PairwiseMatrix { public: PairwiseMatrix() : cache_(0), metric_(0) {} - /// CONSTRUCTOR - with cache and metric - PairwiseMatrix(DataSet_PairwiseCache*, Metric*); + + /// Set up with given metric and optional cache. + int Setup(Metric*, DataSet_PairwiseCache*); // ------------------------------------------- /// \return distance between given frames.TODO const? @@ -21,7 +22,7 @@ class PairwiseMatrix { //virtual void PrintCached() const = 0; // ------------------------------------------- - bool HasMetric() const { return (metric_ != 0); } + //bool HasMetric() const { return (metric_ != 0); } /// \return internal metric, const. Metric const& DistMetric() const { return *metric_; } /// \return internal metric. diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index a0c151c61e..8de8a5a6be 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -8,7 +8,7 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { DataSet_PairwiseCache_MEM() : DataSet_PairwiseCache(PMATRIX_MEM) {} static DataSet* Alloc() { return (DataSet*)new DataSet_PairwiseCache_MEM(); } // ----- DataSet functions ------------------- - size_t Size() const { return 0; } + size_t Size() const { return Mat_.size(); } void Info() const { return; } int Allocate(SizeArray const&) { return 1; } void Add(size_t, const void*) { return; } From 7ac48655c3303f3ac730a7cb694f67ea436073ff Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 31 Jan 2019 10:38:25 -0500 Subject: [PATCH 091/417] DRR - Cpptraj: Start using new pairwise cache --- src/Cluster/Control.cpp | 121 ++++++++++++++++++++--------------- src/Cluster/Control.h | 5 +- src/Cluster/PairwiseMatrix.h | 5 ++ src/cpptrajdepend | 2 +- 4 files changed, 79 insertions(+), 54 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index caae2954b4..1d15b6efa1 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -3,9 +3,7 @@ #include "../DataSet_Coords.h" #include "Sieve.h" #include "Output.h" -// PairwiseMatrix classes -#include "PairwiseMatrix_MEM.h" -#include "PairwiseMatrix_NC.h" +#include "../DataFile.h" // For loading pairwise cache // Metric classes #include "Metric_RMS.h" // Algorithms @@ -14,7 +12,6 @@ Cpptraj::Cluster::Control::Control() : metric_(0), - pmatrix_(0), algorithm_(0), verbose_(0), sieve_(1), @@ -29,35 +26,20 @@ Cpptraj::Cluster::Control::Control() : Cpptraj::Cluster::Control::~Control() { if (algorithm_ != 0) delete algorithm_; - if (pmatrix_ != 0 ) delete pmatrix_; if (metric_ != 0 ) delete metric_; } // ----------------------------------------------------------------------------- -/** \return pointer to PairwiseMatrix of specified type. */ -/* -Cpptraj::Cluster::PairwiseMatrix* - Cpptraj::Cluster::Control::AllocatePairwise(PairwiseMatrix::Type ptype, Metric* metric) -{ - PairwiseMatrix* pmatrix = 0; - // TODO check for null metric - switch (ptype) { - case PairwiseMatrix::MEM : pmatrix = new PairwiseMatrix_MEM(metric); break; - case PairwiseMatrix::NC : pmatrix = new PairwiseMatrix_NC(metric); break; - default: mprinterr("Error: Unhandled PairwiseMatrix in AllocatePairwise.\n"); - } - return pmatrix; -} -*/ - const char* Cpptraj::Cluster::Control::PairwiseArgs = "pairwisecache {mem|disk|none}"; /** Set up PairwiseMatrix from arguments. */ -int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetList& DSL, - Metric* metricIn) +int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetList& DSL) { - if (metricIn == 0) return 1; + if (metric_ == 0) { + mprinterr("Internal Error: AllocatePairwise(): Metric is null.\n"); + return 1; + } // Determine if we are saving/loading pairwise distances std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); @@ -65,26 +47,64 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis bool load_pair = analyzeArgs.hasKey("loadpairdist"); bool save_pair = analyzeArgs.hasKey("savepairdist"); - // Process DataSet type arguments - PairwiseMatrix::Type pw_type = PairwiseMatrix::MEM; - std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); - if (!pw_typeString.empty()) { - if (pw_typeString == "mem") - pw_type = PairwiseMatrix::MEM; - else if (pw_typeString == "disk") - pw_type = PairwiseMatrix::NC; - else if (pw_typeString == "none") - pw_type = PairwiseMatrix::NOCACHE; - else { - mprinterr("Error: Unrecognized option for 'pairwisecache' ('%s')\n", pw_typeString.c_str()); - return 1; + cache_ = 0; + if (load_pair) { + // Check if the pairdistname refers to a DataSet + DataSetList selected = DSL.SelectGroupSets( pairdistname, DataSet::PWCACHE ); + if (selected.empty()) { + // No DataSet; check if we can load from a file. + if (File::Exists( pairdistname )) { + DataFile dfIn; + if (dfIn.ReadDataIn( pairdistname, ArgList(), DSL )) return 1; + DataSet* ds = DSL.GetDataSet( pairdistname ); + if (ds == 0) return 1; + if (ds->Group() != DataSet::PWCACHE) { + mprinterr("Internal Error: AllocatePairwise(): Set is not a pairwise cache.\n"); + return 1; + } + cache_ = (DataSet_PairwiseCache*)ds; + } + } else { + if (selected.size() > 1) + mprintf("Warning: '%s' matches multiple sets; only using '%s'\n", + pairdistname.c_str(), selected[0]->legend()); + cache_ = (DataSet_PairwiseCache*)selected[0]; + } + if (cache_ == 0) { + mprintf("Warning: 'loadpairdist' specified but '%s' not found.\n", + pairdistname.c_str()); + } + } // END if load_pair + + if (cache_ == 0) { + // Process DataSet type arguments + DataSet::DataType pw_type = DataSet::UNKNOWN_DATA; + std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); + if (!pw_typeString.empty()) { + if (pw_typeString == "mem") + pw_type = DataSet::PMATRIX_MEM; + else if (pw_typeString == "disk") + pw_type = DataSet::PMATRIX_NC; + else if (pw_typeString == "none") + pw_type = DataSet::UNKNOWN_DATA; + else { + mprinterr("Error: Unrecognized option for 'pairwisecache' ('%s')\n", pw_typeString.c_str()); + return 1; + } + } + // Allocate cache if necessary + if (pw_type != DataSet::UNKNOWN_DATA) { + cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, pairdistname ); + if (cache_ == 0) { + mprinterr("Error: Could not allocate pairwise cache.\n"); + return 1; + } } } - // Allocate pairwise matrix - if (pmatrix_ != 0) delete pmatrix_; - pmatrix_ = AllocatePairwise( pw_type, metricIn ); - if (pmatrix_ == 0) return 1; + // Setup pairwise matrix + if (pmatrix_.Setup(metric_, cache_)) return 1; + return 0; } @@ -188,8 +208,8 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL) { clusters_.SetDebug( verbose_ ); - // Allocate PairwiseMatrix. - if (AllocatePairwise( analyzeArgs, metric_ )) { + // Allocate PairwiseMatrix. Metric must already be set up. + if (AllocatePairwise( analyzeArgs, DSL )) { mprinterr("Error: PairwiseMatrix setup failed.\n"); return 1; } @@ -271,7 +291,7 @@ void Cpptraj::Cluster::Control::Info() const { } int Cpptraj::Cluster::Control::Run() { - if (metric_ == 0 || pmatrix_ == 0 || algorithm_ == 0) { + if (metric_ == 0 || algorithm_ == 0) { // TODO check pmatrix_? mprinterr("Internal Error: Cluster::Control is not set up.\n"); return 1; } @@ -299,14 +319,15 @@ int Cpptraj::Cluster::Control::Run() { cluster_pairwise.Start(); // Cache distances if necessary - pmatrix_->CacheDistances( framesToCluster ); - if (verbose_ > 1) pmatrix_->PrintCached(); + pmatrix_.CacheDistances( framesToCluster ); + if (pmatrix_.HasCache() && verbose_ > 1) + pmatrix_.Cache().PrintCached(); cluster_pairwise.Stop(); cluster_cluster.Start(); // Cluster - if (algorithm_->DoClustering(clusters_, framesToCluster, *pmatrix_) != 0) { + if (algorithm_->DoClustering(clusters_, framesToCluster, pmatrix_) != 0) { mprinterr("Error: Clustering failed.\n"); return 1; } @@ -353,7 +374,7 @@ int Cpptraj::Cluster::Control::Run() { cluster_post_bestrep.Start(); // Find best representative frames for each cluster. - if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, *pmatrix_, + if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, pmatrix_, frameSieve.SievedOut(), verbose_)) { mprinterr("Error: Finding best representative frames for clusters failed.\n"); @@ -385,7 +406,7 @@ int Cpptraj::Cluster::Control::Run() { if (!sil_file_.empty()) { if (frameSieve.SieveValue() != 1 && !includeSieveInCalc_) mprintf("Warning: Silhouettes do not include sieved frames.\n"); - clusters_.CalcSilhouette(*pmatrix_, frameSieve.SievedOut(), includeSieveInCalc_); + clusters_.CalcSilhouette(pmatrix_, frameSieve.SievedOut(), includeSieveInCalc_); CpptrajFile Ffile, Cfile; if (Ffile.OpenWrite(sil_file_ + ".frame.dat")) return 1; Output::PrintSilhouetteFrames(Ffile, clusters_); @@ -403,7 +424,7 @@ int Cpptraj::Cluster::Control::Run() { mprinterr("Error: Could not set up cluster summary file.\n"); return 1; } - Output::Summary(outfile, clusters_, *algorithm_, *pmatrix_, includeSieveInCalc_, + Output::Summary(outfile, clusters_, *algorithm_, pmatrix_, includeSieveInCalc_, frameSieve.SievedOut()); cluster_post_summary.Stop(); } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 1f76767c14..304d0eb5fb 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -30,8 +30,7 @@ class Control { List const& Clusters() const { return clusters_; } Metric const& DistMetric() const { return *metric_; } private: - //static PairwiseMatrix* AllocatePairwise(PairwiseMatrix::Type, Metric*); - int AllocatePairwise(ArgList&, DataSetList&, Metric*); + int AllocatePairwise(ArgList&, DataSetList&); static Metric* AllocateMetric(Metric::Type); @@ -43,7 +42,7 @@ class Control { List clusters_; ///< Hold cluster results. Metric* metric_; ///< Hold the distance metric. DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. - PairwiseMatrix* pmatrix_; ///< Encapsulates the metric and any cached distances. + PairwiseMatrix pmatrix_; ///< Encapsulates the metric and any cached distances. Algorithm* algorithm_; ///< Hold the clustering algorithm. int verbose_; diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 4e3742163d..6fa8281c23 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -29,6 +29,11 @@ class PairwiseMatrix { // Metric& DistMetric() { return *metric_; } /// \return Pointer to distance metric Metric* MetricPtr() const { return metric_; } + + /// \return true if PairwiseMatrix contains a cache. + bool HasCache() const { return (cache_ != 0); } + /// \return internal cache, const. + DataSet_PairwiseCache const& Cache() const { return *cache_; } private: /// Internal routine used to cache pairwise distances. int CalcFrameDistances(Cframes const&); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index a403846000..c83ef73d7f 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -146,7 +146,7 @@ Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgLi Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NC_Cmatrix.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/PairwiseMatrix_NC.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h From fae4ebd9cb638aefdc4855644bfbdc0564b2bc5d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 31 Jan 2019 11:53:25 -0500 Subject: [PATCH 092/417] DRR - Cpptraj: Enable caching. Remove unneeded PairwiseMatrix_MEM class. --- src/Cluster/PairwiseMatrix.cpp | 28 ++++++++++++++------ src/Cluster/PairwiseMatrix_MEM.cpp | 42 ------------------------------ src/Cluster/PairwiseMatrix_MEM.h | 27 ------------------- src/DataSet_PairwiseCache.cpp | 4 +-- src/DataSet_PairwiseCache_MEM.cpp | 19 ++++++++++++++ src/DataSet_PairwiseCache_MEM.h | 2 +- src/cpptrajdepend | 1 - src/cpptrajfiles | 1 - 8 files changed, 42 insertions(+), 82 deletions(-) delete mode 100644 src/Cluster/PairwiseMatrix_MEM.cpp delete mode 100644 src/Cluster/PairwiseMatrix_MEM.h diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 02e81d2bc6..ca586b1701 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -53,20 +53,32 @@ double Cpptraj::Cluster::PairwiseMatrix::Frame_Distance(int f1, int f2) const { int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCache) { if (framesToCache.size() < 1) return 0; - if (cache_ == 0) { - mprinterr("Internal Error: PairwiseMatrix::CacheDistances(): Cache set is null.\n"); - return 1; - } - if (metric_ == 0) { - mprinterr("Internal Error: PairwiseMatrix::CacheDistances(): Metric is null.\n"); - return 1; + // If no cache we can leave. + if (cache_ == 0) return 0; + + int err = 0; + if (cache_->Size() > 0) { + // If cache is already populated, check that it is valid. + + } else { + // Sanity check + if (metric_ == 0) { + mprinterr("Internal Error: PairwiseMatrix::CacheDistances(): Metric is null.\n"); + return 1; + } + err = CalcFrameDistances(framesToCache); } - return CalcFrameDistances(framesToCache); + return err; } /** Cache distances between given frames using SetElement(). */ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) { + if (cache_->SetupFrameToIdx( framesToCache, metric_->Ntotal() )) { + mprinterr("Error: Unable to set up frame to index array for pairwise cache.\n"); + return 1; + } + int f2end = (int)framesToCache.size(); int f1end = f2end - 1; ParallelProgress progress(f1end); diff --git a/src/Cluster/PairwiseMatrix_MEM.cpp b/src/Cluster/PairwiseMatrix_MEM.cpp deleted file mode 100644 index 80f9bfb083..0000000000 --- a/src/Cluster/PairwiseMatrix_MEM.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "PairwiseMatrix_MEM.h" -#include "../CpptrajStdio.h" - -/** \return distance between frames (cached or uncached). */ -double Cpptraj::Cluster::PairwiseMatrix_MEM::Frame_Distance(int f1, int f2) const { - int idx1 = frameToMat_[f1]; - if (idx1 != -1) { - int idx2 = frameToMat_[f2]; - if (idx2 != -1) { - return Mat_.element(idx1, idx2); - } - } - // If here, distance was not cached. - return MetricPtr()->FrameDist(f1, f2); -} - -/** Requests that distances between given frames be cached in memory. */ -int Cpptraj::Cluster::PairwiseMatrix_MEM::CacheDistances(Cframes const& framesToCache) { - Mat_.resize(0, framesToCache.size()); -# ifdef DEBUG_CLUSTER - mprintf("DEBUG: PairwiseMatrix_MEM set up for %i rows, size= %zu bytes.\n", - Mat_.Nrows(), Mat_.sizeInBytes()); -# endif - if (setupFrameToMat( framesToCache )) return 1; - - return CalcFrameDistances( framesToCache ); -} - -/** Print cached distances to stdout. */ -void Cpptraj::Cluster::PairwiseMatrix_MEM::PrintCached() const { - for (Cframes::const_iterator it1 = frameToMat_.begin(); it1 != frameToMat_.end(); ++it1) - { - if (*it1 != -1) { - for (Cframes::const_iterator it2 = it1 + 1; it2 != frameToMat_.end(); ++it2) - { - if (*it2 != -1) - mprintf("\t%i %i %f\n", *it1+1, *it2+1, Mat_.element(*it1, *it2)); - } - } - } -} - diff --git a/src/Cluster/PairwiseMatrix_MEM.h b/src/Cluster/PairwiseMatrix_MEM.h deleted file mode 100644 index 84e94a90ed..0000000000 --- a/src/Cluster/PairwiseMatrix_MEM.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef INC_CLUSTER_PAIRWISE_MATRIX_MEM_H -#define INC_CLUSTER_PAIRWISE_MATRIX_MEM_H -#include "PairwiseMatrix.h" -#include "../Matrix.h" -namespace Cpptraj { -namespace Cluster { - -class PairwiseMatrix_MEM : public PairwiseMatrix { - public: - PairwiseMatrix_MEM() : PairwiseMatrix(MEM) {} - PairwiseMatrix_MEM(Metric* m) : PairwiseMatrix(MEM, m) {} - // ------------------------------------------- - double GetFdist(int f1, int f2) const { return Mat_.element(frameToMat_[f1], frameToMat_[f2]); } - double Frame_Distance(int, int) const; - int CacheDistances(Cframes const&); - void PrintCached() const; - // ------------------------------------------- - protected: - void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } - private: - Matrix Mat_; ///< Hold cached distances - Cframes frameToMat_; ///< Hold indices into Mat_ for all cached frames, -1 for non-cached. -}; - -} /* END namespace Cluster */ -} /* END namespace Cpptraj */ -#endif diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index 3355c7eaa1..999f266791 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -4,7 +4,7 @@ using namespace Cpptraj; using namespace Cluster; -/** Set up frame number to matrix index for caching. */ +/** Set up frame number to matrix index for caching. Also allocate cache. */ int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigned int Ntotal) { frameToIdx_.assign(Ntotal, -1); @@ -17,6 +17,6 @@ int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigne for (Cframes_it it = frameToIdx_.begin(); it != frameToIdx_.end(); ++it) mprintf("\tframeToIdx_[%u] = %i\n", it - frameToIdx_.begin(), *it); # endif - return 0; + return Allocate(SizeArray(1, framesToCache.size())); } diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp index 2e62ad4308..470bb7d7dd 100644 --- a/src/DataSet_PairwiseCache_MEM.cpp +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -1,6 +1,25 @@ #include "DataSet_PairwiseCache_MEM.h" #include "CpptrajStdio.h" +int DataSet_PairwiseCache_MEM::Allocate(SizeArray const& sizeIn) { + int err = 0; + if (!sizeIn.empty()) { + // Sanity check. + if (sizeIn.size() > 1 && sizeIn[1] != sizeIn[0]) + mprintf("Warning: DataSet_PairwiseCache_MEM dimensions must be equal (%zu != %zu)\n" + "Warning: Matrix will be %zu x %zu upper triangle\n", + sizeIn[0], sizeIn[1], sizeIn[0], sizeIn[0]); + err = Mat_.resize(0, sizeIn[0]); // Upper triangle +# ifdef DEBUG_CLUSTER + mprintf("DEBUG: PairwiseMatrix_MEM set up for %i rows, size= %zu bytes.\n", + Mat_.Nrows(), Mat_.sizeInBytes()); +# endif + } else + Mat_.clear(); + return err; +} + + /** Print cached distances to stdout. */ void DataSet_PairwiseCache_MEM::PrintCached() const { for (Cframes::const_iterator it1 = FrameToIdx().begin(); it1 != FrameToIdx().end(); ++it1) diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index 8de8a5a6be..1006b899ba 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -10,7 +10,7 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { // ----- DataSet functions ------------------- size_t Size() const { return Mat_.size(); } void Info() const { return; } - int Allocate(SizeArray const&) { return 1; } + int Allocate(SizeArray const&); void Add(size_t, const void*) { return; } void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } // int Append(DataSet*) { return 1; } diff --git a/src/cpptrajdepend b/src/cpptrajdepend index c83ef73d7f..54d3a9b291 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -152,7 +152,6 @@ Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../As Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix_MEM.o : Cluster/PairwiseMatrix_MEM.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_MEM.h Cluster/PairwiseMatrix_NC.o : Cluster/PairwiseMatrix_NC.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../NC_Cmatrix.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../StringRoutines.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_NC.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index e700674366..4a70206c13 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -12,7 +12,6 @@ CLUSTER_SOURCES= \ Cluster/Node.cpp \ Cluster/Output.cpp \ Cluster/PairwiseMatrix.cpp \ - Cluster/PairwiseMatrix_MEM.cpp \ Cluster/PairwiseMatrix_NC.cpp \ Cluster/Sieve.cpp From fb5d5b34ba25e0abe91b318c362a67201ffecde4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 31 Jan 2019 15:28:09 -0500 Subject: [PATCH 093/417] DRR - Cpptraj: Use the pairwise distance cache and ensure that its properly allocated. --- src/Cluster/Algorithm_DBscan.cpp | 6 +++--- src/Cluster/Algorithm_HierAgglo.cpp | 8 ++++---- src/Cluster/BestReps.cpp | 3 ++- src/Cluster/Control.cpp | 8 ++++++-- src/Cluster/Control.h | 2 ++ src/Cluster/List.cpp | 4 ++-- src/Cluster/Output.cpp | 2 +- src/Cluster/PairwiseMatrix.cpp | 9 ++++++++- src/DataSet_PairwiseCache.cpp | 13 +++++++++++++ src/DataSet_PairwiseCache.h | 8 +++++--- src/cpptrajdepend | 1 - src/cpptrajfiles | 1 - 12 files changed, 46 insertions(+), 19 deletions(-) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index 8c5b372353..d8dc9626af 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -218,7 +218,7 @@ void Cpptraj::Cluster::Algorithm_DBscan::RegionQuery(Iarray& NeighborPts, { if (point != otherpoint) { int f2 = framesToCluster[ otherpoint ]; - if ( pmatrix.GetFdist(f1, f2) < epsilon_ ) + if ( pmatrix.Frame_Distance(f1, f2) < epsilon_ ) NeighborPts.push_back( otherpoint ); } } @@ -351,7 +351,7 @@ const for (std::vector::const_iterator otherpoint = FramesToCluster.begin(); otherpoint != FramesToCluster.end(); ++otherpoint) - dists.push_back( pmatrix.GetFdist(*point, *otherpoint) ); + dists.push_back( pmatrix.Frame_Distance(*point, *otherpoint) ); // Sort distances - first dist should always be 0 std::sort(dists.begin(), dists.end()); Kdist.push_back( dists[Kval] ); @@ -408,7 +408,7 @@ const d_idx = 0; // Store distances from pt1 to pt2 for (pt2_idx = 0; pt2_idx != nframes; pt2_idx++) - kdist_array[d_idx++] = pmatrix.GetFdist(point, FramesToCluster[pt2_idx]); + kdist_array[d_idx++] = pmatrix.Frame_Distance(point, FramesToCluster[pt2_idx]); // Sort distances; will be smallest to largest std::sort( kdist_array, kdist_array + nframes ); // Save the distance of specified nearest neighbors to this point. diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 2047f07520..688eaf8d7f 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -236,7 +236,7 @@ double Cpptraj::Cluster::Algorithm_HierAgglo::minDist(Node const& C1, { for (Node::frame_iterator c2frames = C2.beginframe(); c2frames != C2.endframe(); ++c2frames) { - double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + double Dist = pmatrix.Frame_Distance(*c1frames, *c2frames); //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); if ( Dist < min ) min = Dist; } @@ -254,7 +254,7 @@ double Cpptraj::Cluster::Algorithm_HierAgglo::maxDist(Node const& C1, { for (Node::frame_iterator c2frames = C2.beginframe(); c2frames != C2.endframe(); ++c2frames) { - double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + double Dist = pmatrix.Frame_Distance(*c1frames, *c2frames); //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); if ( Dist > max ) max = Dist; } @@ -272,7 +272,7 @@ double Cpptraj::Cluster::Algorithm_HierAgglo::avgDist(Node const& C1, { for (Node::frame_iterator c2frames = C2.beginframe(); c2frames != C2.endframe(); ++c2frames) { - double Dist = pmatrix.GetFdist(*c1frames, *c2frames); + double Dist = pmatrix.Frame_Distance(*c1frames, *c2frames); //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); sum += Dist; } @@ -371,7 +371,7 @@ const for (Node::frame_iterator f2 = C2.beginframe(); f2 != C2.endframe(); ++f2) { if (!sievedOut.HasFrame(*f2)) { - double Dist = pmatrix.GetFdist(*f1, *f2); + double Dist = pmatrix.Frame_Distance(*f1, *f2); //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); switch (linkage_) { case SINGLELINK : if ( Dist < dval ) dval = Dist; break; diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index bfa4cc84cd..00a539b2ed 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -125,7 +125,8 @@ int Cpptraj::Cluster::BestReps:: for (Node::frame_iterator f2 = node->beginframe(); f2 != node->endframe(); ++f2) { if (f1 != f2 && !sievedFrames.HasFrame( *f2 )) - cdist += pmatrix.GetFdist(*f1, *f2); + //cdist += pmatrix.Cache().CachedDistance(*f1, *f2); // TODO benchmark the two ways + cdist += pmatrix.Frame_Distance(*f1, *f2); } SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave); } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 1d15b6efa1..42f893b7de 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -29,6 +29,8 @@ Cpptraj::Cluster::Control::~Control() { if (metric_ != 0 ) delete metric_; } +const char* Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_NAME_ = "CpptrajPairDist"; + // ----------------------------------------------------------------------------- const char* Cpptraj::Cluster::Control::PairwiseArgs = "pairwisecache {mem|disk|none}"; @@ -42,7 +44,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis } // Determine if we are saving/loading pairwise distances - std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); + std::string pairdistname = analyzeArgs.GetStringKey("pairdist", DEFAULT_PAIRDIST_NAME_); DataFile::DataFormatType pairdisttype = DataFile::UNKNOWN_DATA; bool load_pair = analyzeArgs.hasKey("loadpairdist"); bool save_pair = analyzeArgs.hasKey("savepairdist"); @@ -63,6 +65,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis return 1; } cache_ = (DataSet_PairwiseCache*)ds; + mprintf("DEBUG: Loaded cache from file: %s\n", cache_->legend()); } } else { if (selected.size() > 1) @@ -78,7 +81,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis if (cache_ == 0) { // Process DataSet type arguments - DataSet::DataType pw_type = DataSet::UNKNOWN_DATA; + DataSet::DataType pw_type = DataSet::PMATRIX_MEM; std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); if (!pw_typeString.empty()) { if (pw_typeString == "mem") @@ -99,6 +102,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis mprinterr("Error: Could not allocate pairwise cache.\n"); return 1; } + mprintf("DEBUG: Allocated pairwise distance cache: %s\n", cache_->legend()); } } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 304d0eb5fb..7919455782 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -39,6 +39,8 @@ class Control { int Common(ArgList&, DataSetList&); + static const char* DEFAULT_PAIRDIST_NAME_; + List clusters_; ///< Hold cluster results. Metric* metric_; ///< Hold the distance metric. DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index f4f8026a50..ae4133a272 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -356,7 +356,7 @@ int Cpptraj::Cluster::List::CalcSilhouette(PairwiseMatrix const& pmatrix, for (Node::frame_iterator f2 = Ci->beginframe(); f2 != Ci->endframe(); ++f2) { if (f1 != f2 && !sievedFrames.HasFrame(*f2)) { - ai += pmatrix.GetFdist(*f1, *f2); // TODO any benefit from GetFdist vs Frame_Distance + ai += pmatrix.Frame_Distance(*f1, *f2); // TODO any benefit from GetFdist vs Frame_Distance ++self_frames; } } @@ -382,7 +382,7 @@ int Cpptraj::Cluster::List::CalcSilhouette(PairwiseMatrix const& pmatrix, for (Node::frame_iterator f2 = Cj->beginframe(); f2 != Cj->endframe(); ++f2) { if (!sievedFrames.HasFrame(*f2)) { - bi += pmatrix.GetFdist(*f1, *f2); + bi += pmatrix.Frame_Distance(*f1, *f2); ++cj_frames; } } diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index e27222e789..f65753a1ef 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -225,7 +225,7 @@ int Cpptraj::Cluster::Output::Summary(CpptrajFile& outfile, List const& clusters if (!sievedOut.HasFrame( *f1 )) { for (Node::frame_iterator f2 = f1 + 1; f2 != node->endframe(); ++f2) { if (!sievedOut.HasFrame( *f2 )) { - double dist = pmatrix.GetFdist(*f1, *f2); + double dist = pmatrix.Frame_Distance(*f1, *f2); internalAvg += dist; internalSD += (dist * dist); ++Nelements; diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index ca586b1701..fdc1d3221d 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -58,8 +58,14 @@ int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCach int err = 0; if (cache_->Size() > 0) { + mprintf("DEBUG: Using existing cache '%s'\n", cache_->legend()); // If cache is already populated, check that it is valid. - + // The frames to cache must match cached frames. + if (!cache_->CachedFramesMatch( framesToCache )) { + mprinterr("Error: Frames to cache do not match those in existing cache.\n"); + return 1; + } + // TODO Check metric? Total frames? } else { // Sanity check if (metric_ == 0) { @@ -74,6 +80,7 @@ int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCach /** Cache distances between given frames using SetElement(). */ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) { + mprintf("DEBUG: Caching distances for %zu frames.\n", framesToCache.size()); if (cache_->SetupFrameToIdx( framesToCache, metric_->Ntotal() )) { mprinterr("Error: Unable to set up frame to index array for pairwise cache.\n"); return 1; diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index 999f266791..e36b59d1f5 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -20,3 +20,16 @@ int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigne return Allocate(SizeArray(1, framesToCache.size())); } +/** Check that the given frames match the already-cached frames. */ +bool DataSet_PairwiseCache::CachedFramesMatch(Cframes const& frames) const +{ + Cframes_it it0 = frames.begin(); + for (Cframes_it it1 = frameToIdx_.begin(); it0 != frameToIdx_.end(); ++it1) + { + if (*it1 != -1) { + if (it0 == frames.end() || *it1 != *it0) return false; + ++it0; + } + } + return true; +} diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index 46dbaa0719..5a5805b7d4 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -6,7 +6,7 @@ class DataSet_PairwiseCache : public DataSet { public: DataSet_PairwiseCache() {} - DataSet_PairwiseCache(DataType t) : DataSet(t, CLUSTERMATRIX, + DataSet_PairwiseCache(DataType t) : DataSet(t, PWCACHE, TextFormat(TextFormat::DOUBLE, 12, 4), 2) {} virtual ~DataSet_PairwiseCache() {} @@ -26,7 +26,7 @@ class DataSet_PairwiseCache : public DataSet { /// \return distance between given cached frames (absolute frame numbers). //virtual double GetFdist(int, int) const = 0; /// \return distance between cached frames (internal indices). - virtual double CachedDistance(unsigned int, unsigned int) const; + virtual double CachedDistance(unsigned int, unsigned int) const = 0; /// Print only cached distances. virtual void PrintCached() const = 0; /// Used to cache distances; expect internal indices, not absolute cluster frames. @@ -35,7 +35,9 @@ class DataSet_PairwiseCache : public DataSet { // ------------------------------------------- /// \return The array for converting frame numbers to internal cache indices. - Cframes const& FrameToIdx() const { return frameToIdx_; } + Cframes const& FrameToIdx() const { return frameToIdx_; } + /// \return True if given frames array matches cached frames. + bool CachedFramesMatch(Cframes const&) const; /// Set up frame to internal index array using given frames and total frames. int SetupFrameToIdx(Cframes const&, unsigned int); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 54d3a9b291..b7622a948a 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -152,7 +152,6 @@ Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../As Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix_NC.o : Cluster/PairwiseMatrix_NC.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../NC_Cmatrix.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../StringRoutines.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix_NC.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterList.o : ClusterList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 4a70206c13..43b473cab2 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -12,7 +12,6 @@ CLUSTER_SOURCES= \ Cluster/Node.cpp \ Cluster/Output.cpp \ Cluster/PairwiseMatrix.cpp \ - Cluster/PairwiseMatrix_NC.cpp \ Cluster/Sieve.cpp # These files are common to cpptraj/libcpptraj. Files that need to be built From 27524e82cbf9f8a9cb5c7cf669c6a11d423b2a03 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 1 Feb 2019 15:37:47 -0500 Subject: [PATCH 094/417] DRR - Cpptraj: Add some notes --- src/Cluster/List.h | 2 +- src/DataSet_PairwiseCache_MEM.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 737a5b1f51..ce7e4d68b2 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -49,7 +49,7 @@ class List { void AddNoise(int f) { noise_.push_back( f ); } /// Update centroids TODO check if they need updating void UpdateCentroids(Metric*); - /// Add given frames to clusters based on distance to centroid. + /// Add given frames to clusters based on distance to centroid. TODO save original frames void AddFramesByCentroid(Cframes const&, Metric*); /// Add given frames to clusters based on distance to centroid and cutoff. void AddFramesByCentroid(Cframes const&, Metric*, bool, double); diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index 1006b899ba..e7d9739c33 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -10,7 +10,7 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { // ----- DataSet functions ------------------- size_t Size() const { return Mat_.size(); } void Info() const { return; } - int Allocate(SizeArray const&); + int Allocate(SizeArray const&); // TODO use SetupCache instead void Add(size_t, const void*) { return; } void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } // int Append(DataSet*) { return 1; } From 10dbcf1d1f306d7f6218ed3153382c5d9477d7f0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 1 Feb 2019 15:39:29 -0500 Subject: [PATCH 095/417] DRR - Cpptraj: Add netcdf pairwise cache. --- src/Cluster/Cframes.h | 1 + src/DataSet_PairwiseCache_NC.cpp | 42 ++++++++++++++++++++++++++++++++ src/DataSet_PairwiseCache_NC.h | 30 +++++++++++++++++++++++ src/NC_Cmatrix.cpp | 5 ++++ src/NC_Cmatrix.h | 2 ++ src/cpptrajdepend | 9 ++++--- src/cpptrajfiles | 1 + 7 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 src/DataSet_PairwiseCache_NC.cpp create mode 100644 src/DataSet_PairwiseCache_NC.h diff --git a/src/Cluster/Cframes.h b/src/Cluster/Cframes.h index af11804da7..dac4ecfbe9 100644 --- a/src/Cluster/Cframes.h +++ b/src/Cluster/Cframes.h @@ -26,6 +26,7 @@ class Cframes { void assign(std::size_t n, int i) { frames_.assign(n, i); } void clear() { frames_.clear(); } void reserve(std::size_t n) { frames_.reserve(n); } + Iarray const& Data() const { return frames_; } bool HasFrame(int) const; void Insert(Cframes const& rhs) { frames_.insert(frames_.end(), rhs.begin(), rhs.end()); } diff --git a/src/DataSet_PairwiseCache_NC.cpp b/src/DataSet_PairwiseCache_NC.cpp new file mode 100644 index 0000000000..ce337beb67 --- /dev/null +++ b/src/DataSet_PairwiseCache_NC.cpp @@ -0,0 +1,42 @@ +#include "DataSet_PairwiseCache_NC.h" +#include "CpptrajStdio.h" +#include "StringRoutines.h" // ByteString + +int DataSet_PairwiseCache_NC::SetupCache(unsigned int Ntotal, Cframes const& framesToCache, + int sieve, std::string const& metricDescription) +{ + if (Meta().Fname().empty()) { + mprinterr("Internal Error: NetCDF pairwise cache file name not set.\n"); + return 1; + } + unsigned int sizeIn = framesToCache.size(); + mprintf("\tPairwise cache file: '%s'\n", Meta().Fname().full()); + mprintf("\tEstimated pair-wise matrix disk usage: > %s\n", + ByteString( ((sizeIn*(sizeIn-1))/2)*sizeof(float), BYTE_DECIMAL).c_str()); + if (file_.CreateCmatrix(Meta().Fname(), Ntotal, sizeIn, sieve, metricDescription)) + return 1; + // Write actual frames array if necessary + if (sieve != 1) { + if (file_.WriteFramesArray( framesToCache )) + return 1; + } + // Reopen in SHARE mode for random access + if (file_.ReopenSharedWrite( Meta().Fname() )) return 1; + + return 0; +} + + +/** Print cached distances to stdout. */ +void DataSet_PairwiseCache_NC::PrintCached() const { + for (Cframes::const_iterator it1 = FrameToIdx().begin(); it1 != FrameToIdx().end(); ++it1) + { + if (*it1 != -1) { + for (Cframes::const_iterator it2 = it1 + 1; it2 != FrameToIdx().end(); ++it2) + { + if (*it2 != -1) + mprintf("\t%i %i %f\n", *it1+1, *it2+1, file_.GetCmatrixElement(*it1, *it2)); + } + } + } +} diff --git a/src/DataSet_PairwiseCache_NC.h b/src/DataSet_PairwiseCache_NC.h new file mode 100644 index 0000000000..7534ead994 --- /dev/null +++ b/src/DataSet_PairwiseCache_NC.h @@ -0,0 +1,30 @@ +#ifndef INC_DATASET_PAIRWISECACHE_NC_H +#define INC_DATASET_PAIRWISECACHE_NC_H +#include "DataSet_PairwiseCache.h" +#include "../NC_Cmatrix.h" +/// Cache pairwise distances in NetCDF file. +class DataSet_PairwiseCache_NC : public DataSet_PairwiseCache { + public: + DataSet_PairwiseCache_NC() : DataSet_PairwiseCache(PMATRIX_NC) {} + static DataSet* Alloc() { return (DataSet*)new DataSet_PairwiseCache_NC(); } + // ----- DataSet functions ------------------- + size_t Size() const { return file_.MatrixSize(); } + void Info() const { return; } + int Allocate(SizeArray const&) { return 0; } + void Add(size_t, const void*) { return; } + void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } +// int Append(DataSet*) { return 1; } +//# ifdef MPI +// int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } +//# endif + // ------------------------------------------- + int SetupCache(unsigned int, Cframes const&, int, std::string const&); + double CachedDistance(unsigned int i1, unsigned int i2) const { + return file_.GetCmatrixElement(i1, i2); + } + void PrintCached() const; + void SetElement(int x, int y, double val) { file_.WriteCmatrixElement(x, y, val); } + private: + NC_Cmatrix file_; ///< Hold cached distances on disk +}; +#endif diff --git a/src/NC_Cmatrix.cpp b/src/NC_Cmatrix.cpp index 0c471c1a62..2f20f823cc 100644 --- a/src/NC_Cmatrix.cpp +++ b/src/NC_Cmatrix.cpp @@ -294,6 +294,11 @@ int NC_Cmatrix::WriteFramesArray(std::vector const& actualFrames) const { return 0; } +int NC_Cmatrix::WriteFramesArray(Cpptraj::Cluster::Cframes const& actualFrames) const { + // TODO have Cframes return a pointer? + return WriteFramesArray(actualFrames.Data()); +} + // NC_Cmatrix::WriteCmatrixElement() int NC_Cmatrix::WriteCmatrixElement(unsigned int xIn, unsigned int yIn, double dval) const { diff --git a/src/NC_Cmatrix.h b/src/NC_Cmatrix.h index 284a130e32..3d79bade41 100644 --- a/src/NC_Cmatrix.h +++ b/src/NC_Cmatrix.h @@ -1,6 +1,7 @@ #ifndef INC_NC_CMATRIX_H #define INC_NC_CMATRIX_H #include "FileName.h" +#include "Cluster/Cframes.h" /// NetCDF cluster matrix file. class NC_Cmatrix { public: @@ -27,6 +28,7 @@ class NC_Cmatrix { int ReopenSharedWrite(FileName const&); /// Write non-sieved frames array. int WriteFramesArray(std::vector const&) const; + int WriteFramesArray(Cpptraj::Cluster::Cframes const&) const; /// Write cluster matrix element (col, row) int WriteCmatrixElement(unsigned int, unsigned int, double) const; /// Write cluster matrix using given pointer diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 8224b8164d..82c5490773 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -180,7 +180,7 @@ CpptrajFile.o : CpptrajFile.cpp CpptrajFile.h CpptrajStdio.h FileIO.h FileIO_Bzi CpptrajState.o : CpptrajState.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_CreateCrd.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_Topology.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleNavigator.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h Vec3.h CpptrajStdio.o : CpptrajStdio.cpp Parallel.h CurveFit.o : CurveFit.cpp CurveFit.h -DataFile.o : DataFile.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.h DataIO_CCP4.h DataIO_CharmmFastRep.h DataIO_CharmmOutput.h DataIO_CharmmRepLog.h DataIO_CharmmRtfPrm.h DataIO_Cmatrix.h DataIO_Cpout.h DataIO_Evecs.h DataIO_Gnuplot.h DataIO_Grace.h DataIO_Mdout.h DataIO_NC_Cmatrix.h DataIO_OpenDx.h DataIO_RemLog.h DataIO_Std.h DataIO_VecTraj.h DataIO_XVG.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Vec3.h +DataFile.o : DataFile.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.h DataIO_CCP4.h DataIO_CharmmFastRep.h DataIO_CharmmOutput.h DataIO_CharmmRepLog.h DataIO_CharmmRtfPrm.h DataIO_Cmatrix.h DataIO_Cpout.h DataIO_Evecs.h DataIO_Gnuplot.h DataIO_Grace.h DataIO_Mdout.h DataIO_NC_Cmatrix.h DataIO_OpenDx.h DataIO_RemLog.h DataIO_Std.h DataIO_VecTraj.h DataIO_XVG.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Vec3.h DataFileList.o : DataFileList.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO.o : DataIO.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CCP4.o : DataIO_CCP4.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h ByteRoutines.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CCP4.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -194,7 +194,7 @@ DataIO_Evecs.o : DataIO_Evecs.cpp ArgList.h ArrayIterator.h AssociatedData.h Ato DataIO_Gnuplot.o : DataIO_Gnuplot.cpp ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Gnuplot.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Grace.o : DataIO_Grace.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Grace.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Mdout.o : DataIO_Mdout.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Mdout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -DataIO_NC_Cmatrix.o : DataIO_NC_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_NC_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h +DataIO_NC_Cmatrix.o : DataIO_NC_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_NC_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_OpenDx.o : DataIO_OpenDx.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_OpenDx.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_RemLog.o : DataIO_RemLog.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_RemLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Std.o : DataIO_Std.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h ClusterDist.h ClusterSieve.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Std.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mat3x3.h DataSet_Vector.h DataSet_double.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h GridBin.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h @@ -206,7 +206,7 @@ DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom. DataSet_1D.o : DataSet_1D.cpp ArgList.h ArrayIterator.h AssociatedData.h ComplexArray.h Constants.h Corr.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h PubFFT.h Range.h TextFormat.h DataSet_3D.o : DataSet_3D.cpp ArgList.h AssociatedData.h Box.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_3D.h Dimension.h FileIO.h FileName.h GridBin.h Matrix_3x3.h MetaData.h Parallel.h Range.h TextFormat.h Vec3.h DataSet_Cmatrix.o : DataSet_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h -DataSet_Cmatrix_DISK.o : DataSet_Cmatrix_DISK.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h +DataSet_Cmatrix_DISK.o : DataSet_Cmatrix_DISK.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h DataSet_Cmatrix_MEM.o : DataSet_Cmatrix_MEM.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h DataSet_Cmatrix_NOMEM.o : DataSet_Cmatrix_NOMEM.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h DataSet_Coords.o : DataSet_Coords.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Topology.h Vec3.h @@ -224,6 +224,7 @@ DataSet_PHREMD_Explicit.o : DataSet_PHREMD_Explicit.cpp ArgList.h AssociatedData DataSet_PHREMD_Implicit.o : DataSet_PHREMD_Implicit.cpp ArgList.h AssociatedData.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PHREMD.h DataSet_PHREMD_Implicit.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache.o : DataSet_PairwiseCache.cpp ArgList.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache_MEM.o : DataSet_PairwiseCache_MEM.cpp ArgList.h ArrayIterator.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Matrix.h MetaData.h Parallel.h Range.h TextFormat.h +DataSet_PairwiseCache_NC.o : DataSet_PairwiseCache_NC.cpp ../NC_Cmatrix.h ArgList.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_NC.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h StringRoutines.h TextFormat.h DataSet_Parameters.o : DataSet_Parameters.cpp ArgList.h AssociatedData.h AtomType.h AtomTypeArray.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h TextFormat.h DataSet_RemLog.o : DataSet_RemLog.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h ReplicaDimArray.h TextFormat.h DataSet_Topology.o : DataSet_Topology.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h BondSearch.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Topology.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ParmFile.h ParmIO.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Topology.h Vec3.h @@ -308,7 +309,7 @@ Matrix_3x3.o : Matrix_3x3.cpp Constants.h CpptrajStdio.h Matrix_3x3.h Vec3.h MetaData.o : MetaData.cpp CpptrajStdio.h FileName.h MetaData.h Range.h StringRoutines.h Mol.o : Mol.cpp Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Mol.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Mol2File.o : Mol2File.cpp Atom.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h Mol2File.h NameType.h Parallel.h Residue.h StringRoutines.h SymbolExporting.h -NC_Cmatrix.o : NC_Cmatrix.cpp CpptrajStdio.h FileName.h NC_Cmatrix.h NC_Routines.h +NC_Cmatrix.o : NC_Cmatrix.cpp Cluster/Cframes.h CpptrajStdio.h FileName.h NC_Cmatrix.h NC_Routines.h NC_Routines.o : NC_Routines.cpp CpptrajStdio.h NC_Routines.h NameType.o : NameType.cpp NameType.h NetcdfFile.o : NetcdfFile.cpp Atom.h AtomMask.h Box.h Constants.h CoordinateInfo.h CpptrajStdio.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NC_Routines.h NameType.h NetcdfFile.h Parallel.h ParallelNetcdf.h ReplicaDimArray.h Residue.h SymbolExporting.h Vec3.h Version.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 4bf6e159a3..a2660a5a3f 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -224,6 +224,7 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ DataSet_Modes.cpp \ DataSet_PairwiseCache.cpp \ DataSet_PairwiseCache_MEM.cpp \ + DataSet_PairwiseCache_NC.cpp \ DataSet_Parameters.cpp \ DataSet_pH.cpp \ DataSet_PHREMD_Explicit.cpp \ From 31efd66d59b41aafbcd3862c87fe81a19ecdd629 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 1 Feb 2019 15:41:34 -0500 Subject: [PATCH 096/417] DRR - Cpptraj: Remove old pairwise netcdf cache. Fix includes for new pairwise cache netcdf set. --- src/Cluster/PairwiseMatrix_NC.cpp | 42 ------------------------------- src/Cluster/PairwiseMatrix_NC.h | 34 ------------------------- src/DataSet_PairwiseCache_NC.h | 2 +- src/cpptrajdepend | 2 +- 4 files changed, 2 insertions(+), 78 deletions(-) delete mode 100644 src/Cluster/PairwiseMatrix_NC.cpp delete mode 100644 src/Cluster/PairwiseMatrix_NC.h diff --git a/src/Cluster/PairwiseMatrix_NC.cpp b/src/Cluster/PairwiseMatrix_NC.cpp deleted file mode 100644 index e6e2bf374d..0000000000 --- a/src/Cluster/PairwiseMatrix_NC.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "PairwiseMatrix_NC.h" -#include "../CpptrajStdio.h" -#include "../StringRoutines.h" // ByteString - -/** \return distance between frames (cached or uncached). */ -double Cpptraj::Cluster::PairwiseMatrix_NC::Frame_Distance(int f1, int f2) const { - int idx1 = frameToMat_[f1]; - if (idx1 != -1) { - int idx2 = frameToMat_[f2]; - if (idx2 != -1) { - return file_.GetCmatrixElement( idx1, idx2 ); - } - } - // If here, distance was not cached. - return MetricPtr()->FrameDist(f1, f2); -} - -/** Requests that distances between given frames be cached in memory. */ -int Cpptraj::Cluster::PairwiseMatrix_NC::CacheDistances(Cframes const& framesToCache) { - if (fname_.empty()) { - mprinterr("Internal Error: PairwiseMatrix_NC::CacheDistances(): File name not set.\n"); - return 1; - } - size_t sizeIn = framesToCache.size(); - mprintf("\tPairwise cache file: '%s'\n", fname_.full()); - mprintf("\tEstimated pair-wise matrix disk usage: > %s\n", - ByteString( ((sizeIn*(sizeIn-1))/2)*sizeof(float), BYTE_DECIMAL).c_str()); - if (file_.CreateCmatrix(fname_, DistMetric().Ntotal(), sizeIn, // TODO sieve value - 1, DistMetric().Description())) - return 1; - // Write actual frames array if necessary // TODO enable - //if (sievedFrames_.Type() != ClusterSieve::NONE) { - // if (file_.WriteFramesArray( framesToCache )) - // return 1; - //} - // Reopen in SHARE mode for random access - if (file_.ReopenSharedWrite( fname_ )) return 1; - - if (setupFrameToMat( framesToCache )) return 1; - - return CalcFrameDistances( framesToCache ); -} diff --git a/src/Cluster/PairwiseMatrix_NC.h b/src/Cluster/PairwiseMatrix_NC.h deleted file mode 100644 index e98a7469a5..0000000000 --- a/src/Cluster/PairwiseMatrix_NC.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef INC_CLUSTER_PAIRWISE_MATRIX_NC_H -#define INC_CLUSTER_PAIRWISE_MATRIX_NC_H -#include "PairwiseMatrix.h" -#include "../NC_Cmatrix.h" -namespace Cpptraj { -namespace Cluster { - -/// Cache pairwise distances on disk via NetCDF -class PairwiseMatrix_NC : public PairwiseMatrix { - public: - PairwiseMatrix_NC() : PairwiseMatrix(NC) {} - PairwiseMatrix_NC(Metric* m) : PairwiseMatrix(NC, m) {} - // ------------------------------------------- - inline double GetFdist(int f1, int f2) const; - double Frame_Distance(int, int) const; - int CacheDistances(Cframes const&); - void PrintCached() const; - // ------------------------------------------- - void SetFilename(FileName const& f) { fname_ = f; } - protected: - void SetElement(int x, int y, double val) { file_.WriteCmatrixElement(x, y, val); } - private: - NC_Cmatrix file_; - FileName fname_; // TODO should this be part of NC_Cmatrix? -}; - -double PairwiseMatrix_NC::GetFdist(int x, int y) const { - return file_.GetCmatrixElement( frameToMat_[x], frameToMat_[y] ); -} - - -} -} -#endif diff --git a/src/DataSet_PairwiseCache_NC.h b/src/DataSet_PairwiseCache_NC.h index 7534ead994..cff0ae6b4b 100644 --- a/src/DataSet_PairwiseCache_NC.h +++ b/src/DataSet_PairwiseCache_NC.h @@ -1,7 +1,7 @@ #ifndef INC_DATASET_PAIRWISECACHE_NC_H #define INC_DATASET_PAIRWISECACHE_NC_H #include "DataSet_PairwiseCache.h" -#include "../NC_Cmatrix.h" +#include "NC_Cmatrix.h" /// Cache pairwise distances in NetCDF file. class DataSet_PairwiseCache_NC : public DataSet_PairwiseCache { public: diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 82c5490773..24b5056ba3 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -224,7 +224,7 @@ DataSet_PHREMD_Explicit.o : DataSet_PHREMD_Explicit.cpp ArgList.h AssociatedData DataSet_PHREMD_Implicit.o : DataSet_PHREMD_Implicit.cpp ArgList.h AssociatedData.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PHREMD.h DataSet_PHREMD_Implicit.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache.o : DataSet_PairwiseCache.cpp ArgList.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache_MEM.o : DataSet_PairwiseCache_MEM.cpp ArgList.h ArrayIterator.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Matrix.h MetaData.h Parallel.h Range.h TextFormat.h -DataSet_PairwiseCache_NC.o : DataSet_PairwiseCache_NC.cpp ../NC_Cmatrix.h ArgList.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_NC.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h StringRoutines.h TextFormat.h +DataSet_PairwiseCache_NC.o : DataSet_PairwiseCache_NC.cpp ArgList.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_NC.h Dimension.h FileIO.h FileName.h MetaData.h NC_Cmatrix.h Parallel.h Range.h StringRoutines.h TextFormat.h DataSet_Parameters.o : DataSet_Parameters.cpp ArgList.h AssociatedData.h AtomType.h AtomTypeArray.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h TextFormat.h DataSet_RemLog.o : DataSet_RemLog.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h ReplicaDimArray.h TextFormat.h DataSet_Topology.o : DataSet_Topology.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h BondSearch.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Topology.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ParmFile.h ParmIO.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Topology.h Vec3.h From 96a6f31696e9a6151e4e8a7b505f1da8d1a4a468 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 1 Feb 2019 15:44:39 -0500 Subject: [PATCH 097/417] DRR - Cpptraj: Ensure disk cache filename metadata is set. --- src/Cluster/Control.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 42f893b7de..ef4d114d47 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -97,7 +97,11 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis } // Allocate cache if necessary if (pw_type != DataSet::UNKNOWN_DATA) { - cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, pairdistname ); + MetaData meta( pairdistname ); + // Cache-specific setup. + if (pw_type == DataSet::PMATRIX_NC) + meta.SetFileName( pairdistname ); + cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, meta ); if (cache_ == 0) { mprinterr("Error: Could not allocate pairwise cache.\n"); return 1; From 6877b62d3d6c67a3ea05248267c0ce653cbd41d0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 4 Feb 2019 13:45:52 -0500 Subject: [PATCH 098/417] DRR - Cpptraj: Ensure that when pairwise cache is set up it has all info necessary for a potential file write (metric, sieve). --- src/Cluster/Control.cpp | 2 +- src/Cluster/PairwiseMatrix.cpp | 22 ++++++++++++++-------- src/Cluster/PairwiseMatrix.h | 2 +- src/DataSet_PairwiseCache.cpp | 6 ++++-- src/DataSet_PairwiseCache.h | 5 +++-- src/DataSet_PairwiseCache_MEM.cpp | 18 ++++++++---------- src/DataSet_PairwiseCache_MEM.h | 3 ++- src/DataSet_PairwiseCache_NC.cpp | 2 +- 8 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index ef4d114d47..fbccdb72cd 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -327,7 +327,7 @@ int Cpptraj::Cluster::Control::Run() { cluster_pairwise.Start(); // Cache distances if necessary - pmatrix_.CacheDistances( framesToCluster ); + pmatrix_.CacheDistances( framesToCluster, sieve_ ); if (pmatrix_.HasCache() && verbose_ > 1) pmatrix_.Cache().PrintCached(); diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index fdc1d3221d..e3dedef2ba 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -51,12 +51,17 @@ double Cpptraj::Cluster::PairwiseMatrix::Frame_Distance(int f1, int f2) const { return metric_->FrameDist(f1, f2); } -int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCache) { +/** Request that distances for frames in given array be cached. + * \param framesToCache the frames to cache. + * \param sieveIn Sieve value (if any) used to generate framesToCache. This is + * purely for bookkeeping inside DataSet_PairwiseCache. + */ +int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCache, int sieveIn) +{ if (framesToCache.size() < 1) return 0; // If no cache we can leave. if (cache_ == 0) return 0; - int err = 0; if (cache_->Size() > 0) { mprintf("DEBUG: Using existing cache '%s'\n", cache_->legend()); // If cache is already populated, check that it is valid. @@ -72,19 +77,20 @@ int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCach mprinterr("Internal Error: PairwiseMatrix::CacheDistances(): Metric is null.\n"); return 1; } - err = CalcFrameDistances(framesToCache); + // Cache setup + if (cache_->SetupCache( metric_->Ntotal(), framesToCache, sieveIn, metric_->Description() )) + return 1; + // Fill cache + if (CalcFrameDistances(framesToCache)) + return 1; } - return err; + return 0; } /** Cache distances between given frames using SetElement(). */ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) { mprintf("DEBUG: Caching distances for %zu frames.\n", framesToCache.size()); - if (cache_->SetupFrameToIdx( framesToCache, metric_->Ntotal() )) { - mprinterr("Error: Unable to set up frame to index array for pairwise cache.\n"); - return 1; - } int f2end = (int)framesToCache.size(); int f1end = f2end - 1; diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 6fa8281c23..bc7cae9737 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -17,7 +17,7 @@ class PairwiseMatrix { /// \return distance between given frames.TODO const? double Frame_Distance(int, int) const; /// Request that distances for the specified frames be cached. - int CacheDistances(Cframes const&); + int CacheDistances(Cframes const&, int); /// Print only cached distances. TODO const? //virtual void PrintCached() const = 0; diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index e36b59d1f5..934422a23e 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -4,7 +4,9 @@ using namespace Cpptraj; using namespace Cluster; -/** Set up frame number to matrix index for caching. Also allocate cache. */ +/** Set up frame number to matrix index for caching. This should be called + * by each inheriting DataSet_PairwiseCache's SetupCache routine. + */ int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigned int Ntotal) { frameToIdx_.assign(Ntotal, -1); @@ -17,7 +19,7 @@ int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigne for (Cframes_it it = frameToIdx_.begin(); it != frameToIdx_.end(); ++it) mprintf("\tframeToIdx_[%u] = %i\n", it - frameToIdx_.begin(), *it); # endif - return Allocate(SizeArray(1, framesToCache.size())); + return 0; } /** Check that the given frames match the already-cached frames. */ diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index 5a5805b7d4..9fa8e004e8 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -31,14 +31,15 @@ class DataSet_PairwiseCache : public DataSet { virtual void PrintCached() const = 0; /// Used to cache distances; expect internal indices, not absolute cluster frames. virtual void SetElement(int, int, double) = 0; - + /// Used to set up and allocate cache + virtual int SetupCache(unsigned int, Cframes const&, int, std::string const&) = 0; // ------------------------------------------- /// \return The array for converting frame numbers to internal cache indices. Cframes const& FrameToIdx() const { return frameToIdx_; } /// \return True if given frames array matches cached frames. bool CachedFramesMatch(Cframes const&) const; - + protected: /// Set up frame to internal index array using given frames and total frames. int SetupFrameToIdx(Cframes const&, unsigned int); private: diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp index 470bb7d7dd..1ffac92811 100644 --- a/src/DataSet_PairwiseCache_MEM.cpp +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -1,22 +1,20 @@ #include "DataSet_PairwiseCache_MEM.h" #include "CpptrajStdio.h" -int DataSet_PairwiseCache_MEM::Allocate(SizeArray const& sizeIn) { - int err = 0; - if (!sizeIn.empty()) { - // Sanity check. - if (sizeIn.size() > 1 && sizeIn[1] != sizeIn[0]) - mprintf("Warning: DataSet_PairwiseCache_MEM dimensions must be equal (%zu != %zu)\n" - "Warning: Matrix will be %zu x %zu upper triangle\n", - sizeIn[0], sizeIn[1], sizeIn[0], sizeIn[0]); - err = Mat_.resize(0, sizeIn[0]); // Upper triangle +int DataSet_PairwiseCache_MEM::SetupCache(unsigned int Ntotal, Cframes const& framesToCache, + int sieve, std::string const& metricDescription) +{ + unsigned int sizeIn = framesToCache.size(); + if (sizeIn > 0) { + if (Mat_.resize(0, sizeIn)) return 1; // Upper triangle # ifdef DEBUG_CLUSTER mprintf("DEBUG: PairwiseMatrix_MEM set up for %i rows, size= %zu bytes.\n", Mat_.Nrows(), Mat_.sizeInBytes()); # endif + // TODO probably need to save metricDescription and sieve here for potential file write. } else Mat_.clear(); - return err; + return SetupFrameToIdx(framesToCache, Ntotal); } diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index e7d9739c33..c06cf5597d 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -10,7 +10,7 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { // ----- DataSet functions ------------------- size_t Size() const { return Mat_.size(); } void Info() const { return; } - int Allocate(SizeArray const&); // TODO use SetupCache instead + int Allocate(SizeArray const&) { return 0; } void Add(size_t, const void*) { return; } void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } // int Append(DataSet*) { return 1; } @@ -20,6 +20,7 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { // ------------------------------------------- //double GetFdist(int f1, int f2) const { return Mat_.element(FrameToMat()[f1], FrameToMat()[f2]); } //double Frame_Distance(int, int) const; + int SetupCache(unsigned int, Cframes const&, int, std::string const&); double CachedDistance(unsigned int i1, unsigned int i2) const { return Mat_.element(i1, i2); } //int CacheDistances(Cframes const&); void PrintCached() const; diff --git a/src/DataSet_PairwiseCache_NC.cpp b/src/DataSet_PairwiseCache_NC.cpp index ce337beb67..023dd83285 100644 --- a/src/DataSet_PairwiseCache_NC.cpp +++ b/src/DataSet_PairwiseCache_NC.cpp @@ -23,7 +23,7 @@ int DataSet_PairwiseCache_NC::SetupCache(unsigned int Ntotal, Cframes const& fra // Reopen in SHARE mode for random access if (file_.ReopenSharedWrite( Meta().Fname() )) return 1; - return 0; + return SetupFrameToIdx(framesToCache, Ntotal); } From 2cfaf5e0ab9781e76ae0738ab05cd1faca32bece Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 4 Feb 2019 13:48:15 -0500 Subject: [PATCH 099/417] DRR - Cpptraj: Enable netcdf disk cache --- src/DataSetList.cpp | 2 ++ src/cpptrajdepend | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DataSetList.cpp b/src/DataSetList.cpp index 158ccb17c2..9d66bbbd6c 100644 --- a/src/DataSetList.cpp +++ b/src/DataSetList.cpp @@ -28,6 +28,7 @@ #include "DataSet_PHREMD_Implicit.h" #include "DataSet_Parameters.h" #include "DataSet_PairwiseCache_MEM.h" +#include "DataSet_PairwiseCache_NC.h" // IMPORTANT: THIS ARRAY MUST CORRESPOND TO DataSet::DataType const DataSetList::DataToken DataSetList::DataArray[] = { @@ -57,6 +58,7 @@ const DataSetList::DataToken DataSetList::DataArray[] = { { "pH REMD (implicit)",DataSet_PHREMD_Implicit::Alloc}, // PH_IMPL { "parameters", DataSet_Parameters::Alloc }, // PARAMETERS { "pairwise matrix (mem)",DataSet_PairwiseCache_MEM::Alloc}, // PMATRIX_MEM + { "pairwise matrix (NetCDF)",DataSet_PairwiseCache_NC::Alloc}, // PMATRIX_NC { 0, 0 } }; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 24b5056ba3..dc8bd98da4 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -202,7 +202,7 @@ DataIO_VecTraj.o : DataIO_VecTraj.cpp ActionFrameCounter.h ArgList.h ArrayIterat DataIO_XVG.o : DataIO_XVG.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_XVG.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Xplor.o : DataIO_Xplor.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataSet.o : DataSet.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h -DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Cmatrix_MEM.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_Parameters.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h Hungarian.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h +DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Cmatrix_MEM.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_PairwiseCache_NC.h DataSet_Parameters.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h Hungarian.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h DataSet_1D.o : DataSet_1D.cpp ArgList.h ArrayIterator.h AssociatedData.h ComplexArray.h Constants.h Corr.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h PubFFT.h Range.h TextFormat.h DataSet_3D.o : DataSet_3D.cpp ArgList.h AssociatedData.h Box.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_3D.h Dimension.h FileIO.h FileName.h GridBin.h Matrix_3x3.h MetaData.h Parallel.h Range.h TextFormat.h Vec3.h DataSet_Cmatrix.o : DataSet_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h From 809864248498bdd02bdb6dea135be124fdfbc3b6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 08:19:47 -0500 Subject: [PATCH 100/417] DRR - Cpptraj: Fix up default pairwise cache set naming logic to avoid clashes with multiple cluster commands. --- src/Cluster/Control.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index fbccdb72cd..c3fc03570a 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -44,28 +44,37 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis } // Determine if we are saving/loading pairwise distances - std::string pairdistname = analyzeArgs.GetStringKey("pairdist", DEFAULT_PAIRDIST_NAME_); + std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); DataFile::DataFormatType pairdisttype = DataFile::UNKNOWN_DATA; bool load_pair = analyzeArgs.hasKey("loadpairdist"); bool save_pair = analyzeArgs.hasKey("savepairdist"); + // Check if we need to set a default file name + std::string fname; + if (pairdistname.empty()) + fname = DEFAULT_PAIRDIST_NAME_; + else + fname = pairdistname; cache_ = 0; if (load_pair) { - // Check if the pairdistname refers to a DataSet - DataSetList selected = DSL.SelectGroupSets( pairdistname, DataSet::PWCACHE ); + DataSetList selected; + // If specified, check if the pairdistname refers to a DataSet + if (!pairdistname.empty()) + selected = DSL.SelectGroupSets( pairdistname, DataSet::PWCACHE ); if (selected.empty()) { // No DataSet; check if we can load from a file. - if (File::Exists( pairdistname )) { + if (File::Exists( fname )) { DataFile dfIn; - if (dfIn.ReadDataIn( pairdistname, ArgList(), DSL )) return 1; - DataSet* ds = DSL.GetDataSet( pairdistname ); + if (dfIn.ReadDataIn( fname, ArgList(), DSL )) return 1; + DataSet* ds = DSL.GetDataSet( fname ); if (ds == 0) return 1; if (ds->Group() != DataSet::PWCACHE) { mprinterr("Internal Error: AllocatePairwise(): Set is not a pairwise cache.\n"); return 1; } cache_ = (DataSet_PairwiseCache*)ds; - mprintf("DEBUG: Loaded cache from file: %s\n", cache_->legend()); + mprintf("DEBUG: Loaded cache set '%s' from file: %s\n", + cache_->legend(), dfIn.DataFilename().full()); } } else { if (selected.size() > 1) @@ -73,10 +82,8 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis pairdistname.c_str(), selected[0]->legend()); cache_ = (DataSet_PairwiseCache*)selected[0]; } - if (cache_ == 0) { - mprintf("Warning: 'loadpairdist' specified but '%s' not found.\n", - pairdistname.c_str()); - } + if (cache_ == 0) + mprintf("Warning: 'loadpairdist' specified but cache set/file not found.\n"); } // END if load_pair if (cache_ == 0) { @@ -100,8 +107,8 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis MetaData meta( pairdistname ); // Cache-specific setup. if (pw_type == DataSet::PMATRIX_NC) - meta.SetFileName( pairdistname ); - cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, meta ); + meta.SetFileName( fname ); + cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, meta, "CMATRIX" ); if (cache_ == 0) { mprinterr("Error: Could not allocate pairwise cache.\n"); return 1; From 659d12e790c90982bf08e8fe59852ead2a3a2768 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 12:16:37 -0500 Subject: [PATCH 101/417] DRR - Cpptraj: Start setting up mechanism for saving pairwise distance cache. --- src/Analysis_Cluster.cpp | 2 +- src/Cluster/Control.cpp | 44 ++++++++++++++++++++++++++++++++++------ src/Cluster/Control.h | 10 ++++++--- src/cpptrajdepend | 6 +++--- 4 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 3ae36c232d..72d877c002 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -32,7 +32,7 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s }*/ - control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, setup.DSL(), debugIn); + control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, setup.DSL(), setup.DFL(), debugIn); // Output files DataFile* cnumvtimefile = setup.DFL().AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index c3fc03570a..5cc584714c 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -29,14 +29,24 @@ Cpptraj::Cluster::Control::~Control() { if (metric_ != 0 ) delete metric_; } +// ----------------------------------------------------------------------------- +/** The default pairwise cache file name. */ const char* Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_NAME_ = "CpptrajPairDist"; -// ----------------------------------------------------------------------------- +/** The default pairwise distance file type. */ +DataFile::DataFormatType Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_TYPE_ = +# ifdef BINTRAJ + DataFile::NCCMATRIX; +# else + DataFile::CMATRIX; +# endif + const char* Cpptraj::Cluster::Control::PairwiseArgs = "pairwisecache {mem|disk|none}"; /** Set up PairwiseMatrix from arguments. */ -int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetList& DSL) +int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetList& DSL, + DataFileList& DFL) { if (metric_ == 0) { mprinterr("Internal Error: AllocatePairwise(): Metric is null.\n"); @@ -45,7 +55,6 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis // Determine if we are saving/loading pairwise distances std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); - DataFile::DataFormatType pairdisttype = DataFile::UNKNOWN_DATA; bool load_pair = analyzeArgs.hasKey("loadpairdist"); bool save_pair = analyzeArgs.hasKey("savepairdist"); // Check if we need to set a default file name @@ -75,6 +84,12 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis cache_ = (DataSet_PairwiseCache*)ds; mprintf("DEBUG: Loaded cache set '%s' from file: %s\n", cache_->legend(), dfIn.DataFilename().full()); + // No need to save pw cache if we just loaded one. + if (save_pair) { + mprintf("Warning: 'savepairdist' specified but pairwise cache loaded from file.\n" + "Warning: Disabling 'savepairdist'.\n"); + save_pair = false; + } } } else { if (selected.size() > 1) @@ -120,6 +135,21 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis // Setup pairwise matrix if (pmatrix_.Setup(metric_, cache_)) return 1; + if (save_pair) { + if (cache_ == 0) { + mprintf("Warning: Not caching distances; ignoring 'savepairdist'\n"); + } else { + DataFile::DataFormatType pw_file_type = DataFile::UNKNOWN_DATA; + if (pairdistname.empty()) + pw_file_type = DEFAULT_PAIRDIST_TYPE_; + DataFile* pwd_file = DFL.AddDataFile( fname, pw_file_type, ArgList() ); + if (pwd_file == 0) return 1; + pwd_file->AddDataSet( cache_ ); + mprintf("DEBUG: Saving pw distance cache '%s' to file '%s'\n", cache_->legend(), + pwd_file->DataFilename().full()); + } + } + return 0; } @@ -175,6 +205,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, std::string const& maskExpr, ArgList& analyzeArgs, DataSetList& DSL, + DataFileList& DFL, int verboseIn) { verbose_ = verboseIn; @@ -215,16 +246,17 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, return 1; } - return Common(analyzeArgs, DSL); + return Common(analyzeArgs, DSL, DFL); } // ----------------------------------------------------------------------------- /** Common setup. */ -int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL) { +int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) +{ clusters_.SetDebug( verbose_ ); // Allocate PairwiseMatrix. Metric must already be set up. - if (AllocatePairwise( analyzeArgs, DSL )) { + if (AllocatePairwise( analyzeArgs, DSL, DFL )) { mprinterr("Error: PairwiseMatrix setup failed.\n"); return 1; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 7919455782..d406f97a6b 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -6,6 +6,7 @@ #include "Metric.h" #include "BestReps.h" #include "../DataSetList.h" +#include "../DataFileList.h" #include "../DataSet_Coords.h" #include "../DataSet_PairwiseCache.h" namespace Cpptraj { @@ -22,7 +23,8 @@ class Control { enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; - int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, DataSetList&,int); + int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, DataSetList&, + DataFileList&, int); void Info() const; int Run(); @@ -30,17 +32,19 @@ class Control { List const& Clusters() const { return clusters_; } Metric const& DistMetric() const { return *metric_; } private: - int AllocatePairwise(ArgList&, DataSetList&); + int AllocatePairwise(ArgList&, DataSetList&, DataFileList&); static Metric* AllocateMetric(Metric::Type); static Algorithm* AllocateAlgorithm(Algorithm::AType); int AllocateAlgorithm(ArgList&); - int Common(ArgList&, DataSetList&); + int Common(ArgList&, DataSetList&, DataFileList&); static const char* DEFAULT_PAIRDIST_NAME_; + static DataFile::DataFormatType DEFAULT_PAIRDIST_TYPE_; + List clusters_; ///< Hold cluster results. Metric* metric_; ///< Hold the distance metric. DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. diff --git a/src/cpptrajdepend b/src/cpptrajdepend index dc8bd98da4..6a823c3e85 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Clustering.o : Analysis_Clustering.cpp ActionFrameCounter.h ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h Cluster_DPeaks.h Cluster_HierAgglo.h Cluster_Kmeans.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -147,7 +147,7 @@ Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgLi Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h @@ -168,7 +168,7 @@ Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedDa Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h From 2a59f27887517f14b75d884d60ed7f27af8495c8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 13:57:57 -0500 Subject: [PATCH 102/417] DRR - Cpptraj: Start binary cluster matrix file IO class. --- src/Cluster/Binary_Cmatrix.cpp | 84 ++++++++++++++++++++++++++++++++++ src/Cluster/Binary_Cmatrix.h | 46 +++++++++++++++++++ src/cpptrajdepend | 1 + src/cpptrajfiles | 1 + 4 files changed, 132 insertions(+) create mode 100644 src/Cluster/Binary_Cmatrix.cpp create mode 100644 src/Cluster/Binary_Cmatrix.h diff --git a/src/Cluster/Binary_Cmatrix.cpp b/src/Cluster/Binary_Cmatrix.cpp new file mode 100644 index 0000000000..c09baad12f --- /dev/null +++ b/src/Cluster/Binary_Cmatrix.cpp @@ -0,0 +1,84 @@ +#include "Binary_Cmatrix.h" +#include "../CpptrajStdio.h" + +Cpptraj::Cluster::Binary_Cmatrix::Binary_Cmatrix() +{} + +// NOTES: +// Version 1: Add write of ignore array when reduced. Write nrows and +// and nelements as 8 byte integers. +// Version 2: Instead of nrows and nelements, write original nrows +// and actual nrows to easily determine if this is a reduced +// matrix. Also write sieve value. +// Version 2 Update: Read/write sieve value as signed, negative +// value is random sieve. Variable is same # +// of bytes so should be backwards-compatible. +const unsigned char Cpptraj::Cluster::Binary_Cmatrix::Magic_[4] = {'C', 'T', 'M', 2}; + + +bool Cpptraj::Cluster::Binary_Cmatrix::ID_Cmatrix(FileName const& fname) +{ + unsigned char magic[4]; + + CpptrajFile infile; + if (infile.OpenRead(fname)) return false; + infile.Read( magic, 4 ); + infile.CloseFile(); + return (magic[0]==Magic_[0] && magic[1]==Magic_[1] && magic[2]==Magic_[2]); +} + +int Cpptraj::Cluster::Binary_Cmatrix::OpenCmatrixRead(FileName const& fname) +{ + unsigned char magic[4]; + uint_8 ROWS, ELTS; + sint_8 SIEVE; + sieve_ = 1; + actual_nrows_ = 0; + + // Open file for reading + if (file_.OpenRead(fname)) { + mprinterr("Error: Could not open '%s' for read.\n", fname.full()); + return 1; + } + // SANITY CHECK: Read and check magic byte + file_.Read( magic, 4 ); + if ( magic[0]!=Magic_[0] || magic[1]!=Magic_[1] || magic[2]!=Magic_[2] ) { + mprinterr("Error: File '%s' is not a Cpptraj Cluster Matrix file.\n", fname.full()); + return 1; + } + // Check version, read in nrows and nelements. + if (magic[3] == 0) { + int Ntemp = 0; + file_.Read( &Ntemp, sizeof(int) ); + ROWS = (uint_8)Ntemp; + actual_nrows_ = (size_t)ROWS; + file_.Read( &Ntemp, sizeof(int) ); + ELTS = (uint_8)Ntemp; + } else if (magic[3] == 1) { + file_.Read( &ROWS, sizeof(uint_8) ); + actual_nrows_ = (size_t)ROWS; + file_.Read( &ELTS, sizeof(uint_8) ); + } else if (magic[3] == 2) { + file_.Read( &ROWS, sizeof(uint_8) ); // V2: Original Nrows + file_.Read( &ELTS, sizeof(uint_8) ); // V2: Actual Nrows + actual_nrows_ = (size_t)ELTS; + file_.Read( &SIEVE, sizeof(sint_8) ); // V2: Sieve + sieve_ = (int)SIEVE; + } else { + mprinterr("Error: ClusterMatrix version %u is not recognized.\n", (unsigned int)magic[3]); + return 1; + } + if (magic[3] == 0 || magic[3] == 1) { + // Version 0/1: Actual # of rows is not known yet. Check that the # elements + // in the file match the original # elements (i.e. matrix is not sieved). + // If it is sieved this is not supported. + uint_8 original_nelements = ( ROWS * (ROWS - 1UL) ) / 2UL; + if ( original_nelements != ELTS ) { + mprinterr("Error: Sieved data in ClusterMatrix file %s (version %u) not supported.\n", + fname.full(), (unsigned int)magic[3]); + return 1; + } + sieve_ = 1; + } + return 0; +} diff --git a/src/Cluster/Binary_Cmatrix.h b/src/Cluster/Binary_Cmatrix.h new file mode 100644 index 0000000000..c6a7088a74 --- /dev/null +++ b/src/Cluster/Binary_Cmatrix.h @@ -0,0 +1,46 @@ +#ifndef INC_CLUSTER_BINARY_CMATRIX_H +#define INC_CLUSTER_BINARY_CMATRIX_H +#include // size_t +#include "../CpptrajFile.h" +#include "../FileName.h" +#include "Cframes.h" + +namespace Cpptraj { +namespace Cluster { + +/// Used to read pairwise distance cache files in cpptraj binary format. +class Binary_Cmatrix { + public: + Binary_Cmatrix(); + + /// \return true if file is binary cpptraj cluster matrix file. + static bool ID_Cmatrix(FileName const&); + + /// \return Sieve value. + int Sieve() const { return sieve_; } + /// \return Actual number of rows in matrix. + size_t ActualNrows() const { return actual_nrows_; } + + /// Open cluster matrix file for reading. Set sieve and actual # rows. + int OpenCmatrixRead(FileName const&); + /// Get cluster matrix element (col, row) + double GetCmatrixElement(unsigned int, unsigned int) const; + /// Get cluster matrix element (raw index) + double GetCmatrixElement(unsigned int) const; + /// Read cmatrix into given pointer + int GetCmatrix(float*) const; + private: + static const unsigned char Magic_[]; + /// For reading/writing 8 byte unsigned integers + typedef unsigned long long int uint_8; + /// For reading/writing 8 byte signed integers + typedef long long int sint_8; + + CpptrajFile file_; + int sieve_; + size_t actual_nrows_; +}; + +} +} +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 6a823c3e85..51ddda6478 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -145,6 +145,7 @@ Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../Asso Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Binary_Cmatrix.o : Cluster/Binary_Cmatrix.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Binary_Cmatrix.h Cluster/Cframes.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index a2660a5a3f..b4f9507ff3 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -4,6 +4,7 @@ CLUSTER_SOURCES= \ Cluster/Algorithm_DBscan.cpp \ Cluster/Algorithm_HierAgglo.cpp \ Cluster/BestReps.cpp \ + Cluster/Binary_Cmatrix.cpp \ Cluster/Centroid_Coord.cpp \ Cluster/Cframes.cpp \ Cluster/Control.cpp \ From e5b8fde7ec32a99dc5098a7e44ff8c766fc451ca Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 14:10:45 -0500 Subject: [PATCH 103/417] DRR - Cpptraj: Add header offset and get element --- src/Cluster/Binary_Cmatrix.cpp | 33 ++++++++++++++++++++++++++++++++- src/Cluster/Binary_Cmatrix.h | 3 ++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Binary_Cmatrix.cpp b/src/Cluster/Binary_Cmatrix.cpp index c09baad12f..642b8337d7 100644 --- a/src/Cluster/Binary_Cmatrix.cpp +++ b/src/Cluster/Binary_Cmatrix.cpp @@ -1,7 +1,10 @@ #include "Binary_Cmatrix.h" #include "../CpptrajStdio.h" -Cpptraj::Cluster::Binary_Cmatrix::Binary_Cmatrix() +Cpptraj::Cluster::Binary_Cmatrix::Binary_Cmatrix() : + sieve_(0), + actual_nrows_(0), + headerOffset_(0) {} // NOTES: @@ -68,6 +71,9 @@ int Cpptraj::Cluster::Binary_Cmatrix::OpenCmatrixRead(FileName const& fname) mprinterr("Error: ClusterMatrix version %u is not recognized.\n", (unsigned int)magic[3]); return 1; } + // Save current header position + headerOffset_ = file_.Tell(); + // Checks if (magic[3] == 0 || magic[3] == 1) { // Version 0/1: Actual # of rows is not known yet. Check that the # elements // in the file match the original # elements (i.e. matrix is not sieved). @@ -82,3 +88,28 @@ int Cpptraj::Cluster::Binary_Cmatrix::OpenCmatrixRead(FileName const& fname) } return 0; } + +static long int calcTriIndex(size_t nX, size_t xIn, size_t yIn) { + size_t i, j; + if (yIn > xIn) { + i = xIn; + j = yIn; + } else if (xIn > yIn) { + i = yIn; + j = xIn; + } else // iIn == jIn, triangle matrix diagonal is indicated by -1 + return -1L; + size_t i1 = i + 1UL; + return (long int)(( (nX * i) - ((i1 * i) / 2UL) ) + j - i1); +} + +double Cpptraj::Cluster::Binary_Cmatrix::GetCmatrixElement(unsigned int col, unsigned int row) +{ + // Determine absolute index + long int idx = calcTriIndex(actual_nrows_, col, row); + file_.Seek( headerOffset_ + idx * sizeof(float) ); + float fvar; + file_.Read( &fvar, sizeof(float) ); + return (double)fvar; +} + diff --git a/src/Cluster/Binary_Cmatrix.h b/src/Cluster/Binary_Cmatrix.h index c6a7088a74..4f368d7aef 100644 --- a/src/Cluster/Binary_Cmatrix.h +++ b/src/Cluster/Binary_Cmatrix.h @@ -24,7 +24,7 @@ class Binary_Cmatrix { /// Open cluster matrix file for reading. Set sieve and actual # rows. int OpenCmatrixRead(FileName const&); /// Get cluster matrix element (col, row) - double GetCmatrixElement(unsigned int, unsigned int) const; + double GetCmatrixElement(unsigned int, unsigned int); /// Get cluster matrix element (raw index) double GetCmatrixElement(unsigned int) const; /// Read cmatrix into given pointer @@ -39,6 +39,7 @@ class Binary_Cmatrix { CpptrajFile file_; int sieve_; size_t actual_nrows_; + off_t headerOffset_; }; } From 3bb0881aeb2cfd5c1afaf163e7b50c46230e827c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 14:19:17 -0500 Subject: [PATCH 104/417] DRR - Cpptraj: More routines to get matrix data. --- src/Cluster/Binary_Cmatrix.cpp | 12 ++++++++++++ src/Cluster/Binary_Cmatrix.h | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Binary_Cmatrix.cpp b/src/Cluster/Binary_Cmatrix.cpp index 642b8337d7..0830b17a2d 100644 --- a/src/Cluster/Binary_Cmatrix.cpp +++ b/src/Cluster/Binary_Cmatrix.cpp @@ -113,3 +113,15 @@ double Cpptraj::Cluster::Binary_Cmatrix::GetCmatrixElement(unsigned int col, uns return (double)fvar; } +double Cpptraj::Cluster::Binary_Cmatrix::GetCmatrixElement(unsigned int idx) +{ + file_.Seek( headerOffset_ + idx * sizeof(float) ); + float fvar; + file_.Read( &fvar, sizeof(float) ); + return (double)fvar; +} + +int Cpptraj::Cluster::Binary_Cmatrix::GetCmatrix(float* ptr) { + size_t nelements = ( actual_nrows_ * (actual_nrows_ - 1UL) ) / 2UL; + return file_.Read( ptr, nelements * sizeof(float) ); +} diff --git a/src/Cluster/Binary_Cmatrix.h b/src/Cluster/Binary_Cmatrix.h index 4f368d7aef..f96f41d86f 100644 --- a/src/Cluster/Binary_Cmatrix.h +++ b/src/Cluster/Binary_Cmatrix.h @@ -26,9 +26,9 @@ class Binary_Cmatrix { /// Get cluster matrix element (col, row) double GetCmatrixElement(unsigned int, unsigned int); /// Get cluster matrix element (raw index) - double GetCmatrixElement(unsigned int) const; + double GetCmatrixElement(unsigned int); /// Read cmatrix into given pointer - int GetCmatrix(float*) const; + int GetCmatrix(float*); private: static const unsigned char Magic_[]; /// For reading/writing 8 byte unsigned integers From 0a7bb18035355ae66c6e7cbdbc8cec8c6c9fe5fc Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 14:32:29 -0500 Subject: [PATCH 105/417] DRR - Cpptraj: Add a static write routine --- src/Cluster/Binary_Cmatrix.cpp | 49 +++++++++++++++++++++++++++++++++- src/Cluster/Binary_Cmatrix.h | 3 +++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Binary_Cmatrix.cpp b/src/Cluster/Binary_Cmatrix.cpp index 0830b17a2d..b2bf0d586c 100644 --- a/src/Cluster/Binary_Cmatrix.cpp +++ b/src/Cluster/Binary_Cmatrix.cpp @@ -121,7 +121,54 @@ double Cpptraj::Cluster::Binary_Cmatrix::GetCmatrixElement(unsigned int idx) return (double)fvar; } +static inline size_t Nelements(size_t nrows) { + return ( nrows * (nrows - 1UL) ) / 2UL; +} + int Cpptraj::Cluster::Binary_Cmatrix::GetCmatrix(float* ptr) { - size_t nelements = ( actual_nrows_ * (actual_nrows_ - 1UL) ) / 2UL; + size_t nelements = Nelements( actual_nrows_ ); return file_.Read( ptr, nelements * sizeof(float) ); } + +int Cpptraj::Cluster::Binary_Cmatrix::WriteCmatrix(FileName const& fname, + const float* ptr, + size_t OriginalNframes, + size_t Nrows, + int sieveValue, + Cframes const& actualFrames) +{ + CpptrajFile outfile; + uint_8 ntemp; + // No stdout write allowed. + if (fname.empty()) { + mprinterr("Internal Error: DataIO_Cmatrix::WriteData() called with no filename.\n"); + return 1; + } + if (outfile.OpenWrite(fname)) { + mprinterr("Error: Could not open %s for write.\n", fname.full()); + return 1; + } + // Write magic byte + outfile.Write( Magic_, 4 ); + // Write original number of frames. + ntemp = (uint_8)OriginalNframes; + outfile.Write( &ntemp, sizeof(uint_8) ); + // Write actual nrows + ntemp = (uint_8)Nrows; + outfile.Write( &ntemp, sizeof(uint_8) ); + // Write out sieve value + sint_8 stemp = (sint_8)sieveValue; + outfile.Write( &stemp, sizeof(sint_8) ); + // Write matrix elements + size_t nelements = Nelements( Nrows ); + outfile.Write( ptr, nelements*sizeof(float) ); + // If this is a reduced matrix, write whether each frame was sieved (T) or not (F). + if (sieveValue != 1) { + std::vector sieveStatus( OriginalNframes, 'F' ); + for (unsigned int idx = 0; idx != OriginalNframes; idx++) + if (actualFrames.HasFrame(idx)) + sieveStatus[idx] = 'T'; + outfile.Write( &sieveStatus[0], OriginalNframes*sizeof(char) ); + } + return 0; +} diff --git a/src/Cluster/Binary_Cmatrix.h b/src/Cluster/Binary_Cmatrix.h index f96f41d86f..36def37302 100644 --- a/src/Cluster/Binary_Cmatrix.h +++ b/src/Cluster/Binary_Cmatrix.h @@ -29,6 +29,9 @@ class Binary_Cmatrix { double GetCmatrixElement(unsigned int); /// Read cmatrix into given pointer int GetCmatrix(float*); + + /// Write cluster matrix TODO add a setup routine + static int WriteCmatrix(FileName const&, const float*, size_t, size_t, int, Cframes const&); private: static const unsigned char Magic_[]; /// For reading/writing 8 byte unsigned integers From 6718c02fb5eaf951912719bfdb7b6c7c91d29f22 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 15:13:06 -0500 Subject: [PATCH 106/417] DRR - Cpptraj: Save original number of frames when setting up for read. Fix code doc --- src/Cluster/Binary_Cmatrix.cpp | 9 +++++---- src/Cluster/Binary_Cmatrix.h | 3 ++- src/DataSet_PairwiseCache.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Binary_Cmatrix.cpp b/src/Cluster/Binary_Cmatrix.cpp index b2bf0d586c..9c6bc6db02 100644 --- a/src/Cluster/Binary_Cmatrix.cpp +++ b/src/Cluster/Binary_Cmatrix.cpp @@ -4,6 +4,7 @@ Cpptraj::Cluster::Binary_Cmatrix::Binary_Cmatrix() : sieve_(0), actual_nrows_(0), + ntotal_(0), headerOffset_(0) {} @@ -18,13 +19,12 @@ Cpptraj::Cluster::Binary_Cmatrix::Binary_Cmatrix() : // of bytes so should be backwards-compatible. const unsigned char Cpptraj::Cluster::Binary_Cmatrix::Magic_[4] = {'C', 'T', 'M', 2}; - -bool Cpptraj::Cluster::Binary_Cmatrix::ID_Cmatrix(FileName const& fname) +/** File must be set up read. */ +bool Cpptraj::Cluster::Binary_Cmatrix::ID_Cmatrix(CpptrajFile& infile) { unsigned char magic[4]; - CpptrajFile infile; - if (infile.OpenRead(fname)) return false; + if (infile.OpenFile()) return false; infile.Read( magic, 4 ); infile.CloseFile(); return (magic[0]==Magic_[0] && magic[1]==Magic_[1] && magic[2]==Magic_[2]); @@ -86,6 +86,7 @@ int Cpptraj::Cluster::Binary_Cmatrix::OpenCmatrixRead(FileName const& fname) } sieve_ = 1; } + ntotal_ = (size_t)ROWS; return 0; } diff --git a/src/Cluster/Binary_Cmatrix.h b/src/Cluster/Binary_Cmatrix.h index 36def37302..0ce09061b9 100644 --- a/src/Cluster/Binary_Cmatrix.h +++ b/src/Cluster/Binary_Cmatrix.h @@ -14,7 +14,7 @@ class Binary_Cmatrix { Binary_Cmatrix(); /// \return true if file is binary cpptraj cluster matrix file. - static bool ID_Cmatrix(FileName const&); + static bool ID_Cmatrix(CpptrajFile&); /// \return Sieve value. int Sieve() const { return sieve_; } @@ -42,6 +42,7 @@ class Binary_Cmatrix { CpptrajFile file_; int sieve_; size_t actual_nrows_; + size_t ntotal_; ///< Total number of frames in original data. off_t headerOffset_; }; diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index 9fa8e004e8..a06a581167 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -31,7 +31,7 @@ class DataSet_PairwiseCache : public DataSet { virtual void PrintCached() const = 0; /// Used to cache distances; expect internal indices, not absolute cluster frames. virtual void SetElement(int, int, double) = 0; - /// Used to set up and allocate cache + /// Used to set up and allocate cache for total, frames to cache, sieve, and metric descrip. virtual int SetupCache(unsigned int, Cframes const&, int, std::string const&) = 0; // ------------------------------------------- From ab9b3df31df0a513836ca4e7578bd84ed6beda20 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 15:27:57 -0500 Subject: [PATCH 107/417] DRR - Cpptraj: Add read of sieve status, update dependencies. --- src/Cluster/Binary_Cmatrix.cpp | 10 ++++++++-- src/Cluster/Binary_Cmatrix.h | 4 +++- src/DataSet_PairwiseCache_MEM.h | 2 ++ src/cpptrajdepend | 1 + src/cpptrajfiles | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Cluster/Binary_Cmatrix.cpp b/src/Cluster/Binary_Cmatrix.cpp index 9c6bc6db02..05cab06e42 100644 --- a/src/Cluster/Binary_Cmatrix.cpp +++ b/src/Cluster/Binary_Cmatrix.cpp @@ -126,9 +126,15 @@ static inline size_t Nelements(size_t nrows) { return ( nrows * (nrows - 1UL) ) / 2UL; } -int Cpptraj::Cluster::Binary_Cmatrix::GetCmatrix(float* ptr) { +int Cpptraj::Cluster::Binary_Cmatrix::GetCmatrix(float* ptr, char* sieveStatus) { + file_.Seek( headerOffset_ ); size_t nelements = Nelements( actual_nrows_ ); - return file_.Read( ptr, nelements * sizeof(float) ); + if (file_.Read( ptr, nelements * sizeof(float) ) < 1) return 1; + // Read sieve if needed + if (sieveStatus != 0) { + if (file_.Read( sieveStatus, ntotal_ * sizeof(char) ) < 1) return 1; + } + return 0; } int Cpptraj::Cluster::Binary_Cmatrix::WriteCmatrix(FileName const& fname, diff --git a/src/Cluster/Binary_Cmatrix.h b/src/Cluster/Binary_Cmatrix.h index 0ce09061b9..10d8b6519b 100644 --- a/src/Cluster/Binary_Cmatrix.h +++ b/src/Cluster/Binary_Cmatrix.h @@ -20,6 +20,8 @@ class Binary_Cmatrix { int Sieve() const { return sieve_; } /// \return Actual number of rows in matrix. size_t ActualNrows() const { return actual_nrows_; } + /// \return Number of total frames originally. + size_t Ntotal() const { return ntotal_;} /// Open cluster matrix file for reading. Set sieve and actual # rows. int OpenCmatrixRead(FileName const&); @@ -28,7 +30,7 @@ class Binary_Cmatrix { /// Get cluster matrix element (raw index) double GetCmatrixElement(unsigned int); /// Read cmatrix into given pointer - int GetCmatrix(float*); + int GetCmatrix(float*, char*); /// Write cluster matrix TODO add a setup routine static int WriteCmatrix(FileName const&, const float*, size_t, size_t, int, Cframes const&); diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index c06cf5597d..6788b2d22a 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -25,6 +25,8 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { //int CacheDistances(Cframes const&); void PrintCached() const; void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } + // ------------------------------------------- + float* Ptr() { return Mat_.Ptr(); } private: Matrix Mat_; ///< Hold cached distances }; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 51ddda6478..477d64c65a 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -190,6 +190,7 @@ DataIO_CharmmOutput.o : DataIO_CharmmOutput.cpp ArgList.h AssociatedData.h Atom. DataIO_CharmmRepLog.o : DataIO_CharmmRepLog.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRepLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CharmmRtfPrm.o : DataIO_CharmmRtfPrm.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h AtomTypeArray.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRtfPrm.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cmatrix.o : DataIO_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h +DataIO_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Binary_Cmatrix.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cpout.o : DataIO_Cpout.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cpout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_pH.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Evecs.o : DataIO_Evecs.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedFrame.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Evecs.h DataSet.h DataSetList.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h DataSet_Modes.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Gnuplot.o : DataIO_Gnuplot.cpp ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Gnuplot.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index b4f9507ff3..fac788f49d 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -192,6 +192,7 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ DataIO_CharmmRepLog.cpp \ DataIO_CharmmRtfPrm.cpp \ DataIO_Cmatrix.cpp \ + DataIO_Cmatrix_Binary.cpp \ DataIO_Cpout.cpp \ DataIO_Evecs.cpp \ DataIO_Gnuplot.cpp \ From 56813d780f9f0ec62cc46e5384b2eb4d6a5e828e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 5 Feb 2019 15:28:29 -0500 Subject: [PATCH 108/417] DRR - Cpptraj: DataIO_Cmatrix_Binary class, read routines. --- src/DataIO_Cmatrix_Binary.cpp | 127 ++++++++++++++++++++++++++++++++++ src/DataIO_Cmatrix_Binary.h | 22 ++++++ 2 files changed, 149 insertions(+) create mode 100644 src/DataIO_Cmatrix_Binary.cpp create mode 100644 src/DataIO_Cmatrix_Binary.h diff --git a/src/DataIO_Cmatrix_Binary.cpp b/src/DataIO_Cmatrix_Binary.cpp new file mode 100644 index 0000000000..023552854b --- /dev/null +++ b/src/DataIO_Cmatrix_Binary.cpp @@ -0,0 +1,127 @@ +#include "DataIO_Cmatrix_Binary.h" +#include "CpptrajStdio.h" +#include "Cluster/Binary_Cmatrix.h" + +using namespace Cpptraj; +using namespace Cluster; + +// CONSTRUCTOR +DataIO_Cmatrix_Binary::DataIO_Cmatrix_Binary() +{ + SetValid( DataSet::PMATRIX_MEM ); +} + +bool DataIO_Cmatrix_Binary::ID_DataFormat(CpptrajFile& infile) { + return Binary_Cmatrix::ID_Cmatrix( infile ); +} + +// ----------------------------------------------------------------------------- +// DataIO_Cmatrix_Binary::ReadHelp() +void DataIO_Cmatrix_Binary::ReadHelp() { + +} + +// DataIO_Cmatrix_Binary::processReadArgs() +int DataIO_Cmatrix_Binary::processReadArgs(ArgList& argIn) { + + return 0; +} + +// DataIO_Cmatrix_Binary::ReadData() +int DataIO_Cmatrix_Binary::ReadData(FileName const& fname, + DataSetList& dsl, std::string const& dsname) +{ + // Allocate data set + MetaData md( dsname, MetaData::M_MATRIX ); + DataSet* ds = dsl.AddSet(DataSet::PMATRIX_MEM, md, "Cmatrix"); + if (ds == 0) return 1; + DataSet_PairwiseCache_MEM& Mat = static_cast( *ds ); + return ReadCmatrix(fname, Mat); +} + +// DataIO_Cmatrix_Binary::ReadCmatrix() +int DataIO_Cmatrix_Binary::ReadCmatrix(FileName const& fname, DataSet_PairwiseCache_MEM& Mat) { + Binary_Cmatrix infile; + + if (infile.OpenCmatrixRead( fname )) return 1; + + // Setup underlying TriangleMatrix for actual # of rows + if ( Mat.Allocate( DataSet::SizeArray(1, infile.ActualNrows()) ) ) return 1; + // Allocate sieve status array if needed + char* sieveStatus = 0; + std::vector ssArray; // TODO just pass in char array? + if (infile.Sieve() != 1) { + ssArray.resize( infile.Ntotal() ); + sieveStatus = &ssArray[0]; + } + // Read in matrix elements + if (infile.GetCmatrix( Mat.Ptr(), sieveStatus )) return 1; + + // Set sieve status. +// if (Mat.SetSieveFromArray(sieveStatus, sieve)) return 1; + + return 0; +} + +// ----------------------------------------------------------------------------- +/* +// DataIO_Cmatrix::WriteHelp() +void DataIO_Cmatrix::WriteHelp() { + +} + +// DataIO_Cmatrix::processWriteArgs() +int DataIO_Cmatrix::processWriteArgs(ArgList &argIn) { + + return 0; +} + +// DataIO_Cmatrix::WriteData() +int DataIO_Cmatrix::WriteData(FileName const& fname, DataSetList const& SetList) +{ + if (SetList.empty()) return 1; + if (SetList.size() > 1) + mprintf("Warning: Multiple sets not yet supported for cluster matrix write.\n"); + DataSet_Cmatrix_MEM const& Mat = static_cast( *(*(SetList.begin())) ); + return WriteCmatrix( fname, Mat ); +} + +// DataIO_Cmatrix::WriteCmatrix() +int DataIO_Cmatrix::WriteCmatrix(FileName const& fname, DataSet_Cmatrix_MEM const& Mat) { + CpptrajFile outfile; + uint_8 ntemp; + // No stdout write allowed. + if (fname.empty()) { + mprinterr("Internal Error: DataIO_Cmatrix::WriteData() called with no filename.\n"); + return 1; + } + if (outfile.OpenWrite(fname)) { + mprinterr("Error: Could not open %s for write.\n", fname.full()); + return 1; + } + // Write magic byte + outfile.Write( Magic_, 4 ); + // Write original number of frames. + ntemp = (uint_8)Mat.OriginalNframes(); + outfile.Write( &ntemp, sizeof(uint_8) ); + // Write actual nrows + ntemp = (uint_8)Mat.Nrows(); + outfile.Write( &ntemp, sizeof(uint_8) ); + // Write out sieve value + sint_8 stemp = (sint_8)Mat.SieveValue(); + outfile.Write( &stemp, sizeof(sint_8) ); + // Write matrix elements + outfile.Write( Mat.Ptr(), Mat.Size()*sizeof(float) ); + // If this is a reduced matrix, write whether each frame was sieved (T) or not (F). + if (Mat.SieveType() != ClusterSieve::NONE) { + std::vector sieveStatus( Mat.OriginalNframes() ); + for (int idx = 0; idx != Mat.OriginalNframes(); idx++) + if (Mat.FrameWasSieved(idx)) + sieveStatus[idx] = 'T'; + else + sieveStatus[idx] = 'F'; + outfile.Write( &sieveStatus[0], Mat.OriginalNframes()*sizeof(char) ); + } + return 0; +} +*/ diff --git a/src/DataIO_Cmatrix_Binary.h b/src/DataIO_Cmatrix_Binary.h new file mode 100644 index 0000000000..0aff45fcc5 --- /dev/null +++ b/src/DataIO_Cmatrix_Binary.h @@ -0,0 +1,22 @@ +#ifndef INC_DATAIO_CMATRIX_BINARY_H +#define INC_DATAIO_CMATRIX_BINARY_H +#include "DataIO.h" +#include "DataSet_PairwiseCache_MEM.h" // TODO just pairwisecache +/// Read/write cpptraj-format binary cluster pairwise distance matrix files. +class DataIO_Cmatrix_Binary : public DataIO { + public: + DataIO_Cmatrix_Binary(); + static BaseIOtype* Alloc() { return (BaseIOtype*)new DataIO_Cmatrix_Binary(); } + static void ReadHelp(); + static void WriteHelp(); + int processReadArgs(ArgList&); + int ReadData(FileName const&,DataSetList&,std::string const&); + int processWriteArgs(ArgList&); + int WriteData(FileName const&,DataSetList const&); + bool ID_DataFormat(CpptrajFile&); + // ------------------------------------------- + int ReadCmatrix(FileName const&, DataSet_PairwiseCache_MEM&); + int WriteCmatrix(FileName const&, DataSet_PairwiseCache const&); + private: +}; +#endif From 4f0e70e346cb67efe0c455636fd368493a8af80b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 6 Feb 2019 08:05:38 -0500 Subject: [PATCH 109/417] DRR - Cpptraj: Fix so install completes for testing. --- src/DataIO_Cmatrix_Binary.h | 4 ++-- src/cpptrajdepend | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DataIO_Cmatrix_Binary.h b/src/DataIO_Cmatrix_Binary.h index 0aff45fcc5..d401e5a7f2 100644 --- a/src/DataIO_Cmatrix_Binary.h +++ b/src/DataIO_Cmatrix_Binary.h @@ -11,8 +11,8 @@ class DataIO_Cmatrix_Binary : public DataIO { static void WriteHelp(); int processReadArgs(ArgList&); int ReadData(FileName const&,DataSetList&,std::string const&); - int processWriteArgs(ArgList&); - int WriteData(FileName const&,DataSetList const&); + int processWriteArgs(ArgList&) { return 0; } // TODO + int WriteData(FileName const&,DataSetList const&) { return 1; } // TODO bool ID_DataFormat(CpptrajFile&); // ------------------------------------------- int ReadCmatrix(FileName const&, DataSet_PairwiseCache_MEM&); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 477d64c65a..c360612c5d 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -190,7 +190,7 @@ DataIO_CharmmOutput.o : DataIO_CharmmOutput.cpp ArgList.h AssociatedData.h Atom. DataIO_CharmmRepLog.o : DataIO_CharmmRepLog.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRepLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CharmmRtfPrm.o : DataIO_CharmmRtfPrm.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h AtomTypeArray.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRtfPrm.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cmatrix.o : DataIO_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h -DataIO_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Binary_Cmatrix.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h +DataIO_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Binary_Cmatrix.h Cluster/Cframes.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_Binary.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cpout.o : DataIO_Cpout.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cpout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_pH.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Evecs.o : DataIO_Evecs.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedFrame.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Evecs.h DataSet.h DataSetList.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h DataSet_Modes.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Gnuplot.o : DataIO_Gnuplot.cpp ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Gnuplot.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h From 188bb4183ae3ca00b1bbd62502a71b7700a874d4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 08:22:38 -0500 Subject: [PATCH 110/417] DRR - Cpptraj: Rename for consistency --- src/Cluster/{Binary_Cmatrix.cpp => Cmatrix_Binary.cpp} | 0 src/Cluster/{Binary_Cmatrix.h => Cmatrix_Binary.h} | 0 src/cpptrajfiles | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename src/Cluster/{Binary_Cmatrix.cpp => Cmatrix_Binary.cpp} (100%) rename src/Cluster/{Binary_Cmatrix.h => Cmatrix_Binary.h} (100%) diff --git a/src/Cluster/Binary_Cmatrix.cpp b/src/Cluster/Cmatrix_Binary.cpp similarity index 100% rename from src/Cluster/Binary_Cmatrix.cpp rename to src/Cluster/Cmatrix_Binary.cpp diff --git a/src/Cluster/Binary_Cmatrix.h b/src/Cluster/Cmatrix_Binary.h similarity index 100% rename from src/Cluster/Binary_Cmatrix.h rename to src/Cluster/Cmatrix_Binary.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index fac788f49d..7f61b5c469 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -4,9 +4,9 @@ CLUSTER_SOURCES= \ Cluster/Algorithm_DBscan.cpp \ Cluster/Algorithm_HierAgglo.cpp \ Cluster/BestReps.cpp \ - Cluster/Binary_Cmatrix.cpp \ Cluster/Centroid_Coord.cpp \ Cluster/Cframes.cpp \ + Cluster/Cmatrix_Binary.cpp \ Cluster/Control.cpp \ Cluster/List.cpp \ Cluster/Metric_RMS.cpp \ From e2ee1efc214880181b88c0d10ca5d27f44e50467 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 08:24:30 -0500 Subject: [PATCH 111/417] DRR - Cpptraj: Finish renaming. --- src/Cluster/Cmatrix_Binary.cpp | 18 +++++++++--------- src/Cluster/Cmatrix_Binary.h | 8 ++++---- src/DataIO_Cmatrix_Binary.cpp | 2 +- src/cpptrajdepend | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Cluster/Cmatrix_Binary.cpp b/src/Cluster/Cmatrix_Binary.cpp index 05cab06e42..d63d470fca 100644 --- a/src/Cluster/Cmatrix_Binary.cpp +++ b/src/Cluster/Cmatrix_Binary.cpp @@ -1,7 +1,7 @@ -#include "Binary_Cmatrix.h" +#include "Cmatrix_Binary.h" #include "../CpptrajStdio.h" -Cpptraj::Cluster::Binary_Cmatrix::Binary_Cmatrix() : +Cpptraj::Cluster::Cmatrix_Binary::Cmatrix_Binary() : sieve_(0), actual_nrows_(0), ntotal_(0), @@ -17,10 +17,10 @@ Cpptraj::Cluster::Binary_Cmatrix::Binary_Cmatrix() : // Version 2 Update: Read/write sieve value as signed, negative // value is random sieve. Variable is same # // of bytes so should be backwards-compatible. -const unsigned char Cpptraj::Cluster::Binary_Cmatrix::Magic_[4] = {'C', 'T', 'M', 2}; +const unsigned char Cpptraj::Cluster::Cmatrix_Binary::Magic_[4] = {'C', 'T', 'M', 2}; /** File must be set up read. */ -bool Cpptraj::Cluster::Binary_Cmatrix::ID_Cmatrix(CpptrajFile& infile) +bool Cpptraj::Cluster::Cmatrix_Binary::ID_Cmatrix(CpptrajFile& infile) { unsigned char magic[4]; @@ -30,7 +30,7 @@ bool Cpptraj::Cluster::Binary_Cmatrix::ID_Cmatrix(CpptrajFile& infile) return (magic[0]==Magic_[0] && magic[1]==Magic_[1] && magic[2]==Magic_[2]); } -int Cpptraj::Cluster::Binary_Cmatrix::OpenCmatrixRead(FileName const& fname) +int Cpptraj::Cluster::Cmatrix_Binary::OpenCmatrixRead(FileName const& fname) { unsigned char magic[4]; uint_8 ROWS, ELTS; @@ -104,7 +104,7 @@ static long int calcTriIndex(size_t nX, size_t xIn, size_t yIn) { return (long int)(( (nX * i) - ((i1 * i) / 2UL) ) + j - i1); } -double Cpptraj::Cluster::Binary_Cmatrix::GetCmatrixElement(unsigned int col, unsigned int row) +double Cpptraj::Cluster::Cmatrix_Binary::GetCmatrixElement(unsigned int col, unsigned int row) { // Determine absolute index long int idx = calcTriIndex(actual_nrows_, col, row); @@ -114,7 +114,7 @@ double Cpptraj::Cluster::Binary_Cmatrix::GetCmatrixElement(unsigned int col, uns return (double)fvar; } -double Cpptraj::Cluster::Binary_Cmatrix::GetCmatrixElement(unsigned int idx) +double Cpptraj::Cluster::Cmatrix_Binary::GetCmatrixElement(unsigned int idx) { file_.Seek( headerOffset_ + idx * sizeof(float) ); float fvar; @@ -126,7 +126,7 @@ static inline size_t Nelements(size_t nrows) { return ( nrows * (nrows - 1UL) ) / 2UL; } -int Cpptraj::Cluster::Binary_Cmatrix::GetCmatrix(float* ptr, char* sieveStatus) { +int Cpptraj::Cluster::Cmatrix_Binary::GetCmatrix(float* ptr, char* sieveStatus) { file_.Seek( headerOffset_ ); size_t nelements = Nelements( actual_nrows_ ); if (file_.Read( ptr, nelements * sizeof(float) ) < 1) return 1; @@ -137,7 +137,7 @@ int Cpptraj::Cluster::Binary_Cmatrix::GetCmatrix(float* ptr, char* sieveStatus) return 0; } -int Cpptraj::Cluster::Binary_Cmatrix::WriteCmatrix(FileName const& fname, +int Cpptraj::Cluster::Cmatrix_Binary::WriteCmatrix(FileName const& fname, const float* ptr, size_t OriginalNframes, size_t Nrows, diff --git a/src/Cluster/Cmatrix_Binary.h b/src/Cluster/Cmatrix_Binary.h index 10d8b6519b..61d07dd24f 100644 --- a/src/Cluster/Cmatrix_Binary.h +++ b/src/Cluster/Cmatrix_Binary.h @@ -1,5 +1,5 @@ -#ifndef INC_CLUSTER_BINARY_CMATRIX_H -#define INC_CLUSTER_BINARY_CMATRIX_H +#ifndef INC_CLUSTER_CMATRIX_BINARY_H +#define INC_CLUSTER_CMATRIX_BINARY_H #include // size_t #include "../CpptrajFile.h" #include "../FileName.h" @@ -9,9 +9,9 @@ namespace Cpptraj { namespace Cluster { /// Used to read pairwise distance cache files in cpptraj binary format. -class Binary_Cmatrix { +class Cmatrix_Binary { public: - Binary_Cmatrix(); + Cmatrix_Binary(); /// \return true if file is binary cpptraj cluster matrix file. static bool ID_Cmatrix(CpptrajFile&); diff --git a/src/DataIO_Cmatrix_Binary.cpp b/src/DataIO_Cmatrix_Binary.cpp index 023552854b..ff3d09c41b 100644 --- a/src/DataIO_Cmatrix_Binary.cpp +++ b/src/DataIO_Cmatrix_Binary.cpp @@ -1,6 +1,6 @@ #include "DataIO_Cmatrix_Binary.h" #include "CpptrajStdio.h" -#include "Cluster/Binary_Cmatrix.h" +#include "Cluster/Cmatrix_Binary.h" using namespace Cpptraj; using namespace Cluster; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index c360612c5d..c0374b3c5f 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -145,9 +145,9 @@ Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../Asso Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Binary_Cmatrix.o : Cluster/Binary_Cmatrix.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Binary_Cmatrix.h Cluster/Cframes.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h +Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h @@ -190,7 +190,7 @@ DataIO_CharmmOutput.o : DataIO_CharmmOutput.cpp ArgList.h AssociatedData.h Atom. DataIO_CharmmRepLog.o : DataIO_CharmmRepLog.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRepLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CharmmRtfPrm.o : DataIO_CharmmRtfPrm.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h AtomTypeArray.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRtfPrm.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cmatrix.o : DataIO_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h -DataIO_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Binary_Cmatrix.h Cluster/Cframes.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_Binary.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +DataIO_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_Binary.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cpout.o : DataIO_Cpout.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cpout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_pH.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Evecs.o : DataIO_Evecs.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedFrame.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Evecs.h DataSet.h DataSetList.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h DataSet_Modes.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Gnuplot.o : DataIO_Gnuplot.cpp ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Gnuplot.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h From 772db5b62d1fdb452d315e5a3d2b291edd9a2f1c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 08:44:34 -0500 Subject: [PATCH 112/417] DRR - Cpptraj: Code to set up pairwise cache frame indices from a status array. --- src/Cluster/Cmatrix_Binary.h | 2 +- src/DataIO_Cmatrix_Binary.cpp | 8 ++++---- src/DataSet_PairwiseCache.cpp | 26 ++++++++++++++++++++++++++ src/DataSet_PairwiseCache.h | 20 ++++++++++++++++---- src/DataSet_PairwiseCache_MEM.cpp | 15 +++++++++++++++ src/DataSet_PairwiseCache_MEM.h | 2 +- 6 files changed, 63 insertions(+), 10 deletions(-) diff --git a/src/Cluster/Cmatrix_Binary.h b/src/Cluster/Cmatrix_Binary.h index 61d07dd24f..b099fac496 100644 --- a/src/Cluster/Cmatrix_Binary.h +++ b/src/Cluster/Cmatrix_Binary.h @@ -29,7 +29,7 @@ class Cmatrix_Binary { double GetCmatrixElement(unsigned int, unsigned int); /// Get cluster matrix element (raw index) double GetCmatrixElement(unsigned int); - /// Read cmatrix into given pointer + /// Read cmatrix into given pointer TODO should this take Matrix/StatusArray? int GetCmatrix(float*, char*); /// Write cluster matrix TODO add a setup routine diff --git a/src/DataIO_Cmatrix_Binary.cpp b/src/DataIO_Cmatrix_Binary.cpp index ff3d09c41b..5873920a5e 100644 --- a/src/DataIO_Cmatrix_Binary.cpp +++ b/src/DataIO_Cmatrix_Binary.cpp @@ -12,7 +12,7 @@ DataIO_Cmatrix_Binary::DataIO_Cmatrix_Binary() } bool DataIO_Cmatrix_Binary::ID_DataFormat(CpptrajFile& infile) { - return Binary_Cmatrix::ID_Cmatrix( infile ); + return Cmatrix_Binary::ID_Cmatrix( infile ); } // ----------------------------------------------------------------------------- @@ -41,7 +41,7 @@ int DataIO_Cmatrix_Binary::ReadData(FileName const& fname, // DataIO_Cmatrix_Binary::ReadCmatrix() int DataIO_Cmatrix_Binary::ReadCmatrix(FileName const& fname, DataSet_PairwiseCache_MEM& Mat) { - Binary_Cmatrix infile; + Cmatrix_Binary infile; if (infile.OpenCmatrixRead( fname )) return 1; @@ -49,7 +49,7 @@ int DataIO_Cmatrix_Binary::ReadCmatrix(FileName const& fname, DataSet_PairwiseCa if ( Mat.Allocate( DataSet::SizeArray(1, infile.ActualNrows()) ) ) return 1; // Allocate sieve status array if needed char* sieveStatus = 0; - std::vector ssArray; // TODO just pass in char array? + DataSet_PairwiseCache::StatusArray ssArray; // TODO just pass in char array instead of ptr? if (infile.Sieve() != 1) { ssArray.resize( infile.Ntotal() ); sieveStatus = &ssArray[0]; @@ -58,7 +58,7 @@ int DataIO_Cmatrix_Binary::ReadCmatrix(FileName const& fname, DataSet_PairwiseCa if (infile.GetCmatrix( Mat.Ptr(), sieveStatus )) return 1; // Set sieve status. -// if (Mat.SetSieveFromArray(sieveStatus, sieve)) return 1; + if (Mat.SetupFromStatus(ssArray, infile.Sieve())) return 1; return 0; } diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index 934422a23e..28e93e3aa9 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -4,6 +4,16 @@ using namespace Cpptraj; using namespace Cluster; +DataSet_PairwiseCache::DataSet_PairwiseCache() : + sieve_(0) +{} + +DataSet_PairwiseCache::DataSet_PairwiseCache(DataType t) : + DataSet(t, PWCACHE, TextFormat(TextFormat::DOUBLE, 12, 4), 2), + sieve_(0) +{} + + /** Set up frame number to matrix index for caching. This should be called * by each inheriting DataSet_PairwiseCache's SetupCache routine. */ @@ -35,3 +45,19 @@ bool DataSet_PairwiseCache::CachedFramesMatch(Cframes const& frames) const } return true; } + +/** In given StatusArray, T means frame is present, F means not present. */ +int DataSet_PairwiseCache::SetupFromStatus(StatusArray const& frameIsPresent, int sieveIn) +{ + frameToIdx_.clear(); + frameToIdx_.reserve( frameIsPresent.size() ); + int idx = 0; + for (StatusArray::const_iterator it = frameIsPresent.begin(); + it != frameIsPresent.end(); ++it) + if (*it == 'T') + frameToIdx_.push_back( idx++ ); + else + frameToIdx_.push_back( -1 ); + sieve_ = sieveIn; + return 0; +} diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index a06a581167..db9594bdf5 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -2,15 +2,23 @@ #define INC_DATASET_PAIRWISECACHE_H #include "DataSet.h" #include "Cluster/Cframes.h" -/// Used to cache distances in a potentially sparse square matrix +/// Used to cache distances in a potentially sparse square symmetric matrix. +/** This is an abstract base class for storing pairwise distances + * for cluster analysis. The frameToIdx_ array maps the matrix indices to + * internal indices; indices for which there is no data are assigned -1. + */ class DataSet_PairwiseCache : public DataSet { public: - DataSet_PairwiseCache() {} - DataSet_PairwiseCache(DataType t) : DataSet(t, PWCACHE, - TextFormat(TextFormat::DOUBLE, 12, 4), 2) {} + DataSet_PairwiseCache(); + /// This constructor should be used by child classes. + DataSet_PairwiseCache(DataType); virtual ~DataSet_PairwiseCache() {} + /// Class used to hold frame indices typedef Cpptraj::Cluster::Cframes Cframes; + /// Class used to hold frame statuses (T = present) + typedef std::vector StatusArray; + //static DataSet* Alloc() { return (DataSet*)new DataSet_PairwiseCache(); } // ----- DataSet functions ------------------- //size_t Size() const { return 0; } @@ -39,10 +47,14 @@ class DataSet_PairwiseCache : public DataSet { Cframes const& FrameToIdx() const { return frameToIdx_; } /// \return True if given frames array matches cached frames. bool CachedFramesMatch(Cframes const&) const; + /// Used to set up frame indices from given status array. Record sieve value. + int SetupFromStatus(StatusArray const&, int); protected: /// Set up frame to internal index array using given frames and total frames. int SetupFrameToIdx(Cframes const&, unsigned int); private: Cframes frameToIdx_; ///< Hold indices for all cached frames, -1 for non-cached. + std::string metricDescription_; ///< Optional description of metric used to gen matrix. + int sieve_; ///< Optional sieve value used to select frames. }; #endif diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp index 1ffac92811..df81ff2379 100644 --- a/src/DataSet_PairwiseCache_MEM.cpp +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -1,6 +1,21 @@ #include "DataSet_PairwiseCache_MEM.h" #include "CpptrajStdio.h" +int DataSet_PairwiseCache_MEM::Allocate(SizeArray const& sizeIn) { + int err = 0; + if (!sizeIn.empty()) { + // Sanity check. + if (sizeIn.size() > 1 && sizeIn[1] != sizeIn[0]) + mprintf("Warning: DataSet_PairwiseCache dimensions must be equal (%zu != %zu)\n" + "Warning: Matrix will be %zu x %zu upper triangle\n", + sizeIn[0], sizeIn[1], sizeIn[0], sizeIn[0]); + err = Mat_.resize(0, sizeIn[0]); // Upper triangle + } else + Mat_.clear(); + return err; +} + + int DataSet_PairwiseCache_MEM::SetupCache(unsigned int Ntotal, Cframes const& framesToCache, int sieve, std::string const& metricDescription) { diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index 6788b2d22a..bad4534fcf 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -10,7 +10,7 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { // ----- DataSet functions ------------------- size_t Size() const { return Mat_.size(); } void Info() const { return; } - int Allocate(SizeArray const&) { return 0; } + int Allocate(SizeArray const&); void Add(size_t, const void*) { return; } void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } // int Append(DataSet*) { return 1; } From 4f9df1bd4940b9c66dc6a14204ee54a4fb031bb3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 09:12:02 -0500 Subject: [PATCH 113/417] DRR - Cpptraj: Modify write routine to take frameToIdx array. --- src/Cluster/Cmatrix_Binary.cpp | 27 ++++++++++++++++----------- src/Cluster/Cmatrix_Binary.h | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Cluster/Cmatrix_Binary.cpp b/src/Cluster/Cmatrix_Binary.cpp index d63d470fca..e6cb076e43 100644 --- a/src/Cluster/Cmatrix_Binary.cpp +++ b/src/Cluster/Cmatrix_Binary.cpp @@ -126,23 +126,22 @@ static inline size_t Nelements(size_t nrows) { return ( nrows * (nrows - 1UL) ) / 2UL; } -int Cpptraj::Cluster::Cmatrix_Binary::GetCmatrix(float* ptr, char* sieveStatus) { +int Cpptraj::Cluster::Cmatrix_Binary::GetCmatrix(float* ptr, char* frameIsPresent) { file_.Seek( headerOffset_ ); size_t nelements = Nelements( actual_nrows_ ); if (file_.Read( ptr, nelements * sizeof(float) ) < 1) return 1; // Read sieve if needed - if (sieveStatus != 0) { - if (file_.Read( sieveStatus, ntotal_ * sizeof(char) ) < 1) return 1; + if (frameIsPresent != 0) { + if (file_.Read( frameIsPresent, ntotal_ * sizeof(char) ) < 1) return 1; } return 0; } int Cpptraj::Cluster::Cmatrix_Binary::WriteCmatrix(FileName const& fname, const float* ptr, - size_t OriginalNframes, + Cframes const& frameToIdx, size_t Nrows, - int sieveValue, - Cframes const& actualFrames) + int sieveValue) { CpptrajFile outfile; uint_8 ntemp; @@ -155,6 +154,7 @@ int Cpptraj::Cluster::Cmatrix_Binary::WriteCmatrix(FileName const& fname, mprinterr("Error: Could not open %s for write.\n", fname.full()); return 1; } + size_t OriginalNframes = frameToIdx.size(); // Write magic byte outfile.Write( Magic_, 4 ); // Write original number of frames. @@ -171,11 +171,16 @@ int Cpptraj::Cluster::Cmatrix_Binary::WriteCmatrix(FileName const& fname, outfile.Write( ptr, nelements*sizeof(float) ); // If this is a reduced matrix, write whether each frame was sieved (T) or not (F). if (sieveValue != 1) { - std::vector sieveStatus( OriginalNframes, 'F' ); - for (unsigned int idx = 0; idx != OriginalNframes; idx++) - if (actualFrames.HasFrame(idx)) - sieveStatus[idx] = 'T'; - outfile.Write( &sieveStatus[0], OriginalNframes*sizeof(char) ); + //DataSet_PairwiseMatrix::StatusArray frameIsPresent; + std::vector frameIsPresent; + frameIsPresent.reserve( OriginalNframes ); + for (Cframes::const_iterator it = frameToIdx.begin(); + it != frameToIdx.end(); ++it) + if (*it == -1) + frameIsPresent.push_back( 'F' ); + else + frameIsPresent.push_back( 'T' ); + outfile.Write( &frameIsPresent[0], OriginalNframes*sizeof(char) ); } return 0; } diff --git a/src/Cluster/Cmatrix_Binary.h b/src/Cluster/Cmatrix_Binary.h index b099fac496..7b5e7de479 100644 --- a/src/Cluster/Cmatrix_Binary.h +++ b/src/Cluster/Cmatrix_Binary.h @@ -33,7 +33,7 @@ class Cmatrix_Binary { int GetCmatrix(float*, char*); /// Write cluster matrix TODO add a setup routine - static int WriteCmatrix(FileName const&, const float*, size_t, size_t, int, Cframes const&); + static int WriteCmatrix(FileName const&, const float*, Cframes const&, size_t, int); private: static const unsigned char Magic_[]; /// For reading/writing 8 byte unsigned integers From c23a58e500b5ceb18987da455b41dab81b90fda8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 09:12:58 -0500 Subject: [PATCH 114/417] DRR - Cpptraj: Add the write routine for cluster binary matrix --- src/DataIO_Cmatrix_Binary.cpp | 61 +++++++++-------------------------- src/DataIO_Cmatrix_Binary.h | 6 ++-- 2 files changed, 18 insertions(+), 49 deletions(-) diff --git a/src/DataIO_Cmatrix_Binary.cpp b/src/DataIO_Cmatrix_Binary.cpp index 5873920a5e..fa53a16d71 100644 --- a/src/DataIO_Cmatrix_Binary.cpp +++ b/src/DataIO_Cmatrix_Binary.cpp @@ -64,64 +64,33 @@ int DataIO_Cmatrix_Binary::ReadCmatrix(FileName const& fname, DataSet_PairwiseCa } // ----------------------------------------------------------------------------- -/* -// DataIO_Cmatrix::WriteHelp() -void DataIO_Cmatrix::WriteHelp() { +// DataIO_Cmatrix_Binary::WriteHelp() +void DataIO_Cmatrix_Binary::WriteHelp() { } -// DataIO_Cmatrix::processWriteArgs() -int DataIO_Cmatrix::processWriteArgs(ArgList &argIn) { +// DataIO_Cmatrix_Binary::processWriteArgs() +int DataIO_Cmatrix_Binary::processWriteArgs(ArgList &argIn) { return 0; } -// DataIO_Cmatrix::WriteData() -int DataIO_Cmatrix::WriteData(FileName const& fname, DataSetList const& SetList) +// DataIO_Cmatrix_Binary::WriteData() +int DataIO_Cmatrix_Binary::WriteData(FileName const& fname, DataSetList const& SetList) { if (SetList.empty()) return 1; if (SetList.size() > 1) mprintf("Warning: Multiple sets not yet supported for cluster matrix write.\n"); - DataSet_Cmatrix_MEM const& Mat = static_cast( *(*(SetList.begin())) ); + DataSet_PairwiseCache_MEM const& Mat = + static_cast( *(*(SetList.begin())) ); return WriteCmatrix( fname, Mat ); } -// DataIO_Cmatrix::WriteCmatrix() -int DataIO_Cmatrix::WriteCmatrix(FileName const& fname, DataSet_Cmatrix_MEM const& Mat) { - CpptrajFile outfile; - uint_8 ntemp; - // No stdout write allowed. - if (fname.empty()) { - mprinterr("Internal Error: DataIO_Cmatrix::WriteData() called with no filename.\n"); - return 1; - } - if (outfile.OpenWrite(fname)) { - mprinterr("Error: Could not open %s for write.\n", fname.full()); - return 1; - } - // Write magic byte - outfile.Write( Magic_, 4 ); - // Write original number of frames. - ntemp = (uint_8)Mat.OriginalNframes(); - outfile.Write( &ntemp, sizeof(uint_8) ); - // Write actual nrows - ntemp = (uint_8)Mat.Nrows(); - outfile.Write( &ntemp, sizeof(uint_8) ); - // Write out sieve value - sint_8 stemp = (sint_8)Mat.SieveValue(); - outfile.Write( &stemp, sizeof(sint_8) ); - // Write matrix elements - outfile.Write( Mat.Ptr(), Mat.Size()*sizeof(float) ); - // If this is a reduced matrix, write whether each frame was sieved (T) or not (F). - if (Mat.SieveType() != ClusterSieve::NONE) { - std::vector sieveStatus( Mat.OriginalNframes() ); - for (int idx = 0; idx != Mat.OriginalNframes(); idx++) - if (Mat.FrameWasSieved(idx)) - sieveStatus[idx] = 'T'; - else - sieveStatus[idx] = 'F'; - outfile.Write( &sieveStatus[0], Mat.OriginalNframes()*sizeof(char) ); - } - return 0; +// DataIO_Cmatrix_Binary::WriteCmatrix() +int DataIO_Cmatrix_Binary::WriteCmatrix(FileName const& fname, + DataSet_PairwiseCache_MEM const& Mat) +{ + int err = Cmatrix_Binary::WriteCmatrix( fname, Mat.Ptr(), Mat.FrameToIdx(), + Mat.Nrows(), Mat.SieveVal() ); + return err; } -*/ diff --git a/src/DataIO_Cmatrix_Binary.h b/src/DataIO_Cmatrix_Binary.h index d401e5a7f2..0b3dbfafe6 100644 --- a/src/DataIO_Cmatrix_Binary.h +++ b/src/DataIO_Cmatrix_Binary.h @@ -11,12 +11,12 @@ class DataIO_Cmatrix_Binary : public DataIO { static void WriteHelp(); int processReadArgs(ArgList&); int ReadData(FileName const&,DataSetList&,std::string const&); - int processWriteArgs(ArgList&) { return 0; } // TODO - int WriteData(FileName const&,DataSetList const&) { return 1; } // TODO + int processWriteArgs(ArgList&); + int WriteData(FileName const&,DataSetList const&); bool ID_DataFormat(CpptrajFile&); // ------------------------------------------- int ReadCmatrix(FileName const&, DataSet_PairwiseCache_MEM&); - int WriteCmatrix(FileName const&, DataSet_PairwiseCache const&); + int WriteCmatrix(FileName const&, DataSet_PairwiseCache_MEM const&); private: }; #endif From a096b0d7c800808abed420f3cafda31a75f8c58b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 09:13:32 -0500 Subject: [PATCH 115/417] DRR - Cpptraj: Store sieve value and metric description in DataSet_PairwiseCache class for bookkeeping. --- src/DataSet_PairwiseCache.h | 9 +++++++++ src/DataSet_PairwiseCache_MEM.cpp | 2 ++ src/DataSet_PairwiseCache_MEM.h | 5 ++++- src/DataSet_PairwiseCache_NC.cpp | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index db9594bdf5..c4509281d0 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -47,11 +47,20 @@ class DataSet_PairwiseCache : public DataSet { Cframes const& FrameToIdx() const { return frameToIdx_; } /// \return True if given frames array matches cached frames. bool CachedFramesMatch(Cframes const&) const; + /// \return Internal sieve value for bookkeeping + int SieveVal() const { return sieve_; } + /// \return Internal metric description for bookkeeping + std::string const& MetricDescrip() const { return metricDescription_; } + /// Used to set up frame indices from given status array. Record sieve value. int SetupFromStatus(StatusArray const&, int); protected: /// Set up frame to internal index array using given frames and total frames. int SetupFrameToIdx(Cframes const&, unsigned int); + /// Set internal sieve value for bookkeeping (should call from SetupCache). + void SetSieveVal(int s) { sieve_ = s; } + /// Set internal metric description for bookkeeping (should call from SetupCache). + void SetMetricDescrip(std::string const& m) { metricDescription_ = m; } private: Cframes frameToIdx_; ///< Hold indices for all cached frames, -1 for non-cached. std::string metricDescription_; ///< Optional description of metric used to gen matrix. diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp index df81ff2379..85d496b470 100644 --- a/src/DataSet_PairwiseCache_MEM.cpp +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -29,6 +29,8 @@ int DataSet_PairwiseCache_MEM::SetupCache(unsigned int Ntotal, Cframes const& fr // TODO probably need to save metricDescription and sieve here for potential file write. } else Mat_.clear(); + SetSieveVal( sieve ); + SetMetricDescrip( metricDescription ); return SetupFrameToIdx(framesToCache, Ntotal); } diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index bad4534fcf..97a8707176 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -17,6 +17,8 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { //# ifdef MPI // int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } //# endif + // ------------------------------------------- + size_t Nrows() const { return Mat_.Nrows(); } // ------------------------------------------- //double GetFdist(int f1, int f2) const { return Mat_.element(FrameToMat()[f1], FrameToMat()[f2]); } //double Frame_Distance(int, int) const; @@ -26,7 +28,8 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { void PrintCached() const; void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } // ------------------------------------------- - float* Ptr() { return Mat_.Ptr(); } + float* Ptr() { return Mat_.Ptr(); } + float const* Ptr() const { return Mat_.Ptr(); } private: Matrix Mat_; ///< Hold cached distances }; diff --git a/src/DataSet_PairwiseCache_NC.cpp b/src/DataSet_PairwiseCache_NC.cpp index 023dd83285..e33473d451 100644 --- a/src/DataSet_PairwiseCache_NC.cpp +++ b/src/DataSet_PairwiseCache_NC.cpp @@ -22,6 +22,9 @@ int DataSet_PairwiseCache_NC::SetupCache(unsigned int Ntotal, Cframes const& fra } // Reopen in SHARE mode for random access if (file_.ReopenSharedWrite( Meta().Fname() )) return 1; + // TODO - these are saved in the NetCDF file as well - remove redundancy? + SetSieveVal( sieve ); + SetMetricDescrip( metricDescription ); return SetupFrameToIdx(framesToCache, Ntotal); } From 7966ec1621dbcea1c48c9c602bca089f727023ae Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 10:50:34 -0500 Subject: [PATCH 116/417] DRR - Cpptraj: Rework ClusterMatrix into DynamicMatrix --- src/Cluster/Algorithm_HierAgglo.h | 4 +- src/Cluster/DynamicMatrix.cpp | 99 +++++++++++++++++++++++++++++++ src/Cluster/DynamicMatrix.h | 46 ++++++++++++++ src/cpptrajfiles | 1 + 4 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 src/Cluster/DynamicMatrix.cpp create mode 100644 src/Cluster/DynamicMatrix.h diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index 9eccf9213a..b540176c9c 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -1,8 +1,8 @@ #ifndef INC_CLUSTER_ALGORITHM_HIERAGGLO_H #define INC_CLUSTER_ALGORITHM_HIERAGGLO_H #include "Algorithm.h" +#include "DynamicMatrix.h" #include "../Timer.h" -#include "../ClusterMatrix.h" namespace Cpptraj { namespace Cluster { @@ -35,7 +35,7 @@ class Algorithm_HierAgglo : public Algorithm { double epsilon_; ///< Once the min distance between clusters is > epsilon, stop. LINKAGETYPE linkage_; ///< Cluster Linkage type. CpptrajFile eps_v_n_; ///< Write epsilon vs # clusters. - ClusterMatrix ClusterDistances_; + DynamicMatrix ClusterDistances_; # ifdef TIMER Timer time_findMin_; Timer time_mergeFrames_; diff --git a/src/Cluster/DynamicMatrix.cpp b/src/Cluster/DynamicMatrix.cpp new file mode 100644 index 0000000000..7d006dbf05 --- /dev/null +++ b/src/Cluster/DynamicMatrix.cpp @@ -0,0 +1,99 @@ +#include // float max +#ifdef _OPENMP +#include +#endif +#include "DynamicMatrix.h" +#include "../CpptrajStdio.h" + +// DynamicMatrix::FindMin() +/** Find the minimum not being ignored; set corresponding row and column. */ +#ifdef _OPENMP +double Cpptraj::Cluster::DynamicMatrix::FindMin(int& iOut, int& jOut) { + int row, mythread; + int nrows = (int)Mat_.Nrows(); +# pragma omp parallel private(row, mythread) + { + mythread = omp_get_thread_num(); + + minVal_[mythread] = std::numeric_limits::max(); +# pragma omp for schedule(dynamic) + for (row = 0; row < nrows; row++) { + if (!ignore_[row]) { + int col = row + 1; + unsigned int idx = Mat_.CalcIndex(col, row); /// idx is start of this row + for (; col != nrows; col++, idx++) { + if (!ignore_[col]) { + if (Mat_[idx] < minVal_[mythread]) { + minVal_[mythread] = Mat_[idx]; + minRow_[mythread] = row; + minCol_[mythread] = col; + } + } + } + } + } + } /* END pragma omp parallel */ + float min = minVal_[0]; + iOut = minRow_[0]; + jOut = minCol_[0]; + for (unsigned int idx = 1; idx != minVal_.size(); idx++) { + if (minVal_[idx] < min) { + min = minVal_[idx]; + iOut = minRow_[idx]; + jOut = minCol_[idx]; + } + } + return (double)min; +} +#else +double Cpptraj::Cluster::DynamicMatrix::FindMin(int& iOut, int& jOut) const { + float min = std::numeric_limits::max(); + for (unsigned int row = 0; row != Mat_.Nrows(); row++) { + if (!ignore_[row]) { + unsigned int col = row + 1; + unsigned int idx = Mat_.CalcIndex(col, row); // idx is start of this row + for (; col != Mat_.Ncols(); col++, idx++) { + if (!ignore_[col] && Mat_[idx] < min) { + min = Mat_[idx]; + iOut = (int)row; + jOut = (int)col; + } + } + } + } + return (double)min; +} +#endif + +void Cpptraj::Cluster::DynamicMatrix::PrintElements() const { + unsigned int iVal = 0; + unsigned int jVal = 1; + for (size_t idx = 0UL; idx < Mat_.size(); ++idx) { + if (!ignore_[iVal] && !ignore_[jVal]) + mprintf("\t%u %u %f\n",iVal,jVal,Mat_[idx]); + // Increment indices + jVal++; + if (jVal >= ignore_.size()) { + iVal++; + jVal = iVal + 1; + } + } +} + +// DynamicMatrix::SetupMatrix() +int Cpptraj::Cluster::DynamicMatrix::SetupMatrix(size_t sizeIn) { + if (Mat_.resize( 0L, sizeIn )) return 1; + ignore_.assign( sizeIn, false ); +# ifdef _OPENMP + int n_threads = 0; +# pragma omp parallel + { + if (omp_get_thread_num() == 0) + n_threads = omp_get_num_threads(); + } + minRow_.resize( n_threads ); + minCol_.resize( n_threads ); + minVal_.resize( n_threads ); +# endif + return 0; +} diff --git a/src/Cluster/DynamicMatrix.h b/src/Cluster/DynamicMatrix.h new file mode 100644 index 0000000000..bcfee8be0c --- /dev/null +++ b/src/Cluster/DynamicMatrix.h @@ -0,0 +1,46 @@ +#ifndef INC_CLUSTER_DYNAMICMATRIX_H +#define INC_CLUSTER_DYNAMICMATRIX_H +#include +#include "../Matrix.h" +namespace Cpptraj { +namespace Cluster { + +/// Hold between-cluster distances and whether cluster is still present. +class DynamicMatrix { + public: + DynamicMatrix() {} + /// Indicate given row/col should be ignored. + void Ignore(int row) { ignore_[row] = true; } + /// \return true if given row/col has been ignored. + bool IgnoringRow(int row) const { return ignore_[row]; } + /// \return Original number of rows in matrix + size_t Nrows() const { return Mat_.Nrows(); } + /// Set the row and column of the smallest element not being ignored. +# ifdef _OPENMP + double FindMin(int&, int&); +# else + double FindMin(int&, int&) const; +# endif + /// \return an element. + inline double GetCdist(int c, int r) const { return Mat_.element(c,r); } + /// Print all matrix elements to STDOUT + void PrintElements() const; + /// Add given element to matrix. + int AddCdist(double d) { return Mat_.addElement((float)d); } + /// Set element at column/row to given value + void SetCdist(int col, int row, double val) { Mat_.setElement(col, row, val); } + /// Set up matrix for given number of rows + int SetupMatrix(size_t); + private: + Matrix Mat_; ///< Upper-triangle matrix holding cluster distances. + std::vector ignore_; ///< If true, ignore the row/col when printing/searching etc. +# ifdef _OPENMP + std::vector minRow_; + std::vector minCol_; + std::vector minVal_; +# endif +}; + +} +} +#endif diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 7f61b5c469..412b03bd98 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -8,6 +8,7 @@ CLUSTER_SOURCES= \ Cluster/Cframes.cpp \ Cluster/Cmatrix_Binary.cpp \ Cluster/Control.cpp \ + Cluster/DynamicMatrix.cpp \ Cluster/List.cpp \ Cluster/Metric_RMS.cpp \ Cluster/Node.cpp \ From 0dbe3d179ab2ca57eea91278b066a401c3cad095 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 11:04:36 -0500 Subject: [PATCH 117/417] DRR - Cpptraj: Rip out the old clustering routines. Have reached a point where the overlap was becoming a problem. From now on will compare to a separately compiled master binary. --- src/Analysis_Clustering.cpp | 1170 --------------------------------- src/Analysis_Clustering.h | 84 --- src/Cluster/Control.cpp | 10 +- src/ClusterDist.cpp | 534 --------------- src/ClusterDist.h | 185 ------ src/ClusterList.cpp | 1089 ------------------------------ src/ClusterList.h | 103 --- src/ClusterMatrix.cpp | 98 --- src/ClusterMatrix.h | 40 -- src/ClusterNode.cpp | 148 ----- src/ClusterNode.h | 97 --- src/ClusterSieve.cpp | 108 --- src/ClusterSieve.h | 41 -- src/Cluster_DBSCAN.cpp | 417 ------------ src/Cluster_DBSCAN.h | 36 - src/Cluster_DPeaks.cpp | 859 ------------------------ src/Cluster_DPeaks.h | 112 ---- src/Cluster_HierAgglo.cpp | 367 ----------- src/Cluster_HierAgglo.h | 43 -- src/Cluster_Kmeans.cpp | 286 -------- src/Cluster_Kmeans.h | 32 - src/Cluster_ReadInfo.cpp | 80 --- src/Cluster_ReadInfo.h | 21 - src/Command.cpp | 4 +- src/DataFile.cpp | 18 +- src/DataFile.h | 4 +- src/DataIO_Cmatrix.cpp | 192 ------ src/DataIO_Cmatrix.h | 27 - src/DataIO_NC_Cmatrix.cpp | 52 -- src/DataIO_NC_Cmatrix.h | 21 - src/DataIO_Std.cpp | 10 +- src/DataSet.h | 4 +- src/DataSetList.cpp | 6 - src/DataSet_Cmatrix.cpp | 52 -- src/DataSet_Cmatrix.h | 73 -- src/DataSet_Cmatrix_DISK.cpp | 24 - src/DataSet_Cmatrix_DISK.h | 45 -- src/DataSet_Cmatrix_MEM.cpp | 47 -- src/DataSet_Cmatrix_MEM.h | 50 -- src/DataSet_Cmatrix_NOMEM.cpp | 23 - src/DataSet_Cmatrix_NOMEM.h | 51 -- src/cpptrajdepend | 30 +- src/cpptrajfiles | 17 - 43 files changed, 32 insertions(+), 6678 deletions(-) delete mode 100644 src/Analysis_Clustering.cpp delete mode 100644 src/Analysis_Clustering.h delete mode 100644 src/ClusterDist.cpp delete mode 100644 src/ClusterDist.h delete mode 100644 src/ClusterList.cpp delete mode 100644 src/ClusterList.h delete mode 100644 src/ClusterMatrix.cpp delete mode 100644 src/ClusterMatrix.h delete mode 100644 src/ClusterNode.cpp delete mode 100644 src/ClusterNode.h delete mode 100644 src/ClusterSieve.cpp delete mode 100644 src/ClusterSieve.h delete mode 100644 src/Cluster_DBSCAN.cpp delete mode 100644 src/Cluster_DBSCAN.h delete mode 100644 src/Cluster_DPeaks.cpp delete mode 100644 src/Cluster_DPeaks.h delete mode 100644 src/Cluster_HierAgglo.cpp delete mode 100644 src/Cluster_HierAgglo.h delete mode 100644 src/Cluster_Kmeans.cpp delete mode 100644 src/Cluster_Kmeans.h delete mode 100644 src/Cluster_ReadInfo.cpp delete mode 100644 src/Cluster_ReadInfo.h delete mode 100644 src/DataIO_Cmatrix.cpp delete mode 100644 src/DataIO_Cmatrix.h delete mode 100644 src/DataIO_NC_Cmatrix.cpp delete mode 100644 src/DataIO_NC_Cmatrix.h delete mode 100644 src/DataSet_Cmatrix.cpp delete mode 100644 src/DataSet_Cmatrix.h delete mode 100644 src/DataSet_Cmatrix_DISK.cpp delete mode 100644 src/DataSet_Cmatrix_DISK.h delete mode 100644 src/DataSet_Cmatrix_MEM.cpp delete mode 100644 src/DataSet_Cmatrix_MEM.h delete mode 100644 src/DataSet_Cmatrix_NOMEM.cpp delete mode 100644 src/DataSet_Cmatrix_NOMEM.h diff --git a/src/Analysis_Clustering.cpp b/src/Analysis_Clustering.cpp deleted file mode 100644 index 98a4db46c5..0000000000 --- a/src/Analysis_Clustering.cpp +++ /dev/null @@ -1,1170 +0,0 @@ -// Analysis_Clustering -#include "Analysis_Clustering.h" -#include "CpptrajStdio.h" -#include "StringRoutines.h" // fileExists, integerToString -#include "DataSet_integer.h" // For converting cnumvtime -#include "DataSet_float.h" -#include "Trajout_Single.h" -#include "Timer.h" -// Clustering Algorithms -#include "Cluster_HierAgglo.h" -#include "Cluster_DBSCAN.h" -#include "Cluster_Kmeans.h" -#include "Cluster_ReadInfo.h" -#include "Cluster_DPeaks.h" - -// CONSTRUCTOR -Analysis_Clustering::Analysis_Clustering() : - masterDSL_(0), - coords_(0), - CList_(0), - sieve_(1), - sieveSeed_(-1), - windowSize_(0), - drawGraph_(0), - draw_maxit_(0), - nRepsToSave_(1), - draw_tol_(0.0), - refCut_(1.0), - cnumvtime_(0), - clustersVtime_(0), - pw_dist_(0), - cpopvtimefile_(0), - pwd_file_(0), - nofitrms_(false), - metric_(ClusterList::RMS), - useMass_(false), - grace_color_(false), - norm_pop_(NONE), - bestRep_(CUMULATIVE), - calc_lifetimes_(false), - writeRepFrameNum_(false), - includeSieveInCalc_(false), - suppressInfo_(false), - pw_mismatch_fatal_(true), - clusterfmt_(TrajectoryFile::UNKNOWN_TRAJ), - singlerepfmt_(TrajectoryFile::UNKNOWN_TRAJ), - reptrajfmt_(TrajectoryFile::UNKNOWN_TRAJ), - avgfmt_(TrajectoryFile::UNKNOWN_TRAJ), - debug_(0) -{ } - -/** The default output trajectory format. */ -const TrajectoryFile::TrajFormatType Analysis_Clustering::DEF_TRAJ_FMT_ = TrajectoryFile::AMBERTRAJ; - -/** The default pairwise distance file name. */ -const char* Analysis_Clustering::PAIRDISTFILE_ = "CpptrajPairDist"; - -/** The default pairwise distance file type. */ -DataFile::DataFormatType Analysis_Clustering::PAIRDISTTYPE_ = -# ifdef BINTRAJ - DataFile::NCCMATRIX; -# else - DataFile::CMATRIX; -# endif - -// DESTRUCTOR -Analysis_Clustering::~Analysis_Clustering() { - if (CList_ != 0) delete CList_; -} - -void Analysis_Clustering::Help() const { - mprintf("\t[crdset | nocoords]\n"); - mprintf(" Algorithms:\n"); - Cluster_HierAgglo::Help(); - Cluster_DBSCAN::Help(); - Cluster_DPeaks::Help(); - Cluster_Kmeans::Help(); - Cluster_ReadInfo::Help(); - mprintf(" Distance metric options: {rms | srmsd | dme | data}\n" - "\t{ [[rms | srmsd] [] [mass] [nofit]] | [dme []] |\n" - "\t [data [,,...]] }\n" - "\t[sieve <#> [random [sieveseed <#>]]] [loadpairdist] [savepairdist] [pairdist ]\n" - "\t[pairwisecache {mem | disk | none}] [includesieveincalc] [pwrecalc]\n" - " Output options:\n" - "\t[out ] [gracecolor] [summary ] [info ]\n" - "\t[summarysplit ] [splitframe ]\n" - "\t[bestrep {cumulative|centroid|cumulative_nosieve}] [savenreps <#>]\n" - "\t[clustersvtime cvtwindow ]\n" - "\t[cpopvtime [normpop | normframe]] [lifetime]\n" - "\t[sil ] [assignrefs [refcut ] [refmask ]]\n" - " Coordinate output options:\n" - "\t[ clusterout [clusterfmt ] ]\n" - "\t[ singlerepout [singlerepfmt ] ]\n" - "\t[ repout [repfmt ] [repframe] ]\n" - "\t[ avgout [avgfmt ] ]\n" - " Experimental options:\n" - "\t[[drawgraph | drawgraph3d] [draw_tol ] [draw_maxit can be created with the 'createcrd' command.\n"); - /// pytraj can turn off cluster info by specifying 'noinfo' keyword -} - -// Analysis_Clustering::GetClusterTrajArgs() -void Analysis_Clustering::GetClusterTrajArgs(ArgList& argIn, - const char* trajKey, const char* fmtKey, - std::string& trajName, - TrajectoryFile::TrajFormatType& fmt) const -{ - trajName = argIn.GetStringKey( trajKey ); - fmt = TrajectoryFile::WriteFormatFromString( argIn.GetStringKey(fmtKey), fmt ); - // If file name specified but not format, try to guess from name - if (!trajName.empty() && fmt == TrajectoryFile::UNKNOWN_TRAJ) - fmt = TrajectoryFile::WriteFormatFromFname( trajName, DEF_TRAJ_FMT_ ); -} - -// Analysis_Clustering::Setup() -Analysis::RetType Analysis_Clustering::Setup(ArgList& analyzeArgs, AnalysisSetup& setup, int debugIn) -{ - debug_ = debugIn; - if (analyzeArgs.hasKey("nocoords")) - coords_ = 0; - else { - // Attempt to get coords dataset from datasetlist - std::string setname = analyzeArgs.GetStringKey("crdset"); - coords_ = (DataSet_Coords*)setup.DSL().FindCoordsSet( setname ); - if (coords_ == 0) { - mprinterr("Error: Could not locate COORDS set corresponding to %s\n", - setname.c_str()); - return Analysis::ERR; - } - } - // Check for DataSet(s) to cluster on, otherwise coords will be used - cluster_dataset_.clear(); - std::string dataSetname = analyzeArgs.GetStringKey("data"); - metric_ = ClusterList::RMS; - if (!dataSetname.empty()) { - ArgList dsnames(dataSetname, ","); - DataSetList inputDsets; - for (ArgList::const_iterator name = dsnames.begin(); name != dsnames.end(); ++name) { - DataSetList tempDSL = setup.DSL().GetMultipleSets( *name ); - if (tempDSL.empty()) { - mprinterr("Error: %s did not correspond to any data sets.\n", dataSetname.c_str()); - return Analysis::ERR; - } - inputDsets += tempDSL; - } - for (DataSetList::const_iterator ds = inputDsets.begin(); ds != inputDsets.end(); ++ds) { - // Clustering only allowed on 1D data sets. - if ( (*ds)->Ndim() != 1 ) { - mprinterr("Error: Clustering only allowed on 1D data sets, %s is %zuD.\n", - (*ds)->legend(), (*ds)->Ndim()); - return Analysis::ERR; - } - cluster_dataset_.push_back( *ds ); - } - metric_ = ClusterList::DATA; - } else { - int usedme = (int)analyzeArgs.hasKey("dme"); - int userms = (int)analyzeArgs.hasKey("rms"); - int usesrms = (int)analyzeArgs.hasKey("srmsd"); - if (usedme + userms + usesrms > 1) { - mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); - return Analysis::ERR; - } - if (usedme) metric_ = ClusterList::DME; - else if (userms) metric_ = ClusterList::RMS; - else if (usesrms) metric_ = ClusterList::SRMSD; - } - // Get all loaded reference structures - if (analyzeArgs.hasKey("assignrefs")) { - refs_ = setup.DSL().GetSetsOfType("*", DataSet::REF_FRAME); - if (refs_.empty()) { - mprinterr("Error: 'assignrefs' specified but no references loaded.\n"); - return Analysis::ERR; - } - refCut_ = analyzeArgs.getKeyDouble("refcut", 1.0); - refmaskexpr_ = analyzeArgs.GetStringKey("refmask"); - } - // Get clustering algorithm - if (CList_ != 0) delete CList_; - CList_ = 0; - if (analyzeArgs.hasKey("hieragglo")) CList_ = new Cluster_HierAgglo(); - else if (analyzeArgs.hasKey("dbscan")) CList_ = new Cluster_DBSCAN(); - else if (analyzeArgs.hasKey("dpeaks")) CList_ = new Cluster_DPeaks(); - else if (analyzeArgs.hasKey("kmeans") || - analyzeArgs.hasKey("means" )) CList_ = new Cluster_Kmeans(); - else if (analyzeArgs.hasKey("readinfo") || - analyzeArgs.hasKey("readtxt")) CList_ = new Cluster_ReadInfo(); - else { - mprintf("Warning: No clustering algorithm specified; defaulting to 'hieragglo'\n"); - CList_ = new Cluster_HierAgglo(); - } - if (CList_ == 0) return Analysis::ERR; - CList_->SetDebug(debug_); - // Get algorithm-specific keywords - if (CList_->SetupCluster( analyzeArgs )) return Analysis::ERR; - // --------------------------------------------- - // Options for loading/saving pairwise distance file - DataSet::DataType pw_type = DataSet::CMATRIX; - std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); - if (!pw_typeString.empty()) { - if (pw_typeString == "mem") - pw_type = DataSet::CMATRIX; - else if (pw_typeString == "disk") - pw_type = DataSet::CMATRIX_DISK; - else if (pw_typeString == "none") - pw_type = DataSet::CMATRIX_NOMEM; - else { - mprinterr("Error: Unrecognized option for 'pairwisecache' ('%s')\n", pw_typeString.c_str()); - return Analysis::ERR; - } - } - std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); - DataFile::DataFormatType pairdisttype = DataFile::UNKNOWN_DATA; - bool load_pair = analyzeArgs.hasKey("loadpairdist"); - bool save_pair = analyzeArgs.hasKey("savepairdist"); - pw_dist_ = 0; - if (load_pair) { - // If 'loadpairdist' specified, assume we want to load from file. - if (pairdistname.empty()) { - pairdistname = PAIRDISTFILE_; - pairdisttype = PAIRDISTTYPE_; - } - if (File::Exists( pairdistname )) { - DataFile dfIn; - if (dfIn.ReadDataIn( pairdistname, ArgList(), setup.DSL() )) return Analysis::ERR; - pw_dist_ = setup.DSL().GetDataSet( pairdistname ); - if (pw_dist_ == 0) return Analysis::ERR; - } else - pairdisttype = PAIRDISTTYPE_; - } - if (pw_dist_ == 0 && !pairdistname.empty()) { - // Just 'pairdist' specified or loadpairdist specified and file not found. - // Look for Cmatrix data set. - pw_dist_ = setup.DSL().FindSetOfType( pairdistname, DataSet::CMATRIX ); - //if (pw_dist_ == 0) { // TODO: Convert general matrix to cluster matrix - // mprinterr("Error: Cluster matrix with name '%s' not found.\n"); - // return Analysis::ERR; - //} - if (pw_dist_ == 0 && load_pair) { - // If the file (or dataset) does not yet exist we will assume we want to save. - mprintf("Warning: 'loadpairdist' specified but '%s' not found; will save distances.\n", - pairdistname.c_str()); - save_pair = true; - } - } - // Create file for saving pairwise distances - pwd_file_ = 0; - if (save_pair) { - if (pairdistname.empty()) { - pairdistname = PAIRDISTFILE_; - pairdisttype = PAIRDISTTYPE_; - } - pwd_file_ = setup.DFL().AddDataFile( pairdistname, pairdisttype, ArgList() ); - } - // --------------------------------------------- - // Get keywords - useMass_ = analyzeArgs.hasKey("mass"); - includeSieveInCalc_ = analyzeArgs.hasKey("includesieveincalc"); - if (includeSieveInCalc_) - mprintf("Warning: 'includesieveincalc' may be very slow.\n"); - sieveSeed_ = analyzeArgs.getKeyInt("sieveseed", -1); - sieve_ = analyzeArgs.getKeyInt("sieve", 1); - if (sieve_ < 1) { - mprinterr("Error: 'sieve <#>' must be >= 1 (%i)\n", sieve_); - return Analysis::ERR; - } - if (analyzeArgs.hasKey("random") && sieve_ > 1) - sieve_ = -sieve_; // negative # indicates random sieve - // Override sieve value - if (pw_dist_ != 0) { - if (sieve_ == 1) { - mprintf("Warning: Using sieve options from specified pairwise distance set '%s'\n", - pw_dist_->legend()); - sieve_ = ((DataSet_Cmatrix*)pw_dist_)->SieveValue(); - } else if (sieve_ != ((DataSet_Cmatrix*)pw_dist_)->SieveValue()) { - mprintf("Warning: Specified sieve options do not match pairwise distance set '%s'\n", - pw_dist_->legend()); - } - } - if (analyzeArgs.hasKey("pwrecalc")) - pw_mismatch_fatal_ = false; - halffile_ = analyzeArgs.GetStringKey("summarysplit"); - if (halffile_.empty()) // For backwards compat. - halffile_ = analyzeArgs.GetStringKey("summaryhalf"); - if (!halffile_.empty()) { - ArgList splits( analyzeArgs.GetStringKey("splitframe"), "," ); - if (!splits.empty()) { - splitFrames_.clear(); - int sf = splits.getNextInteger(-1); // User frame #s start at 1 - while (sf > 0) { - splitFrames_.push_back( sf ); - sf = splits.getNextInteger(-1); - } - if ((int)splitFrames_.size() < splits.Nargs()) { - mprinterr("Error: Invalid split frame arguments.\n"); - splits.CheckForMoreArgs(); - return Analysis::ERR; - } - } - } - std::string bestRepStr = analyzeArgs.GetStringKey("bestrep"); - if (bestRepStr.empty()) { - // For sieving, cumulative can get very expensive. Default to centroid. - if (sieve_ != 1) - bestRep_ = CENTROID; - else - bestRep_ = CUMULATIVE; - } else { - if (bestRepStr == "cumulative") - bestRep_ = CUMULATIVE; - else if (bestRepStr == "centroid") - bestRep_ = CENTROID; - else if (bestRepStr == "cumulative_nosieve") - bestRep_ = CUMULATIVE_NOSIEVE; - else { - mprinterr("Error: Invalid 'bestRep' option (%s)\n", bestRepStr.c_str()); - return Analysis::ERR; - } - } - nRepsToSave_ = analyzeArgs.getKeyInt("savenreps", 1); - if (nRepsToSave_ < 1) { - mprinterr("Error: 'savenreps' must be > 0\n"); - return Analysis::ERR; - } - if (analyzeArgs.hasKey("drawgraph")) - drawGraph_ = 1; - else if (analyzeArgs.hasKey("drawgraph3d")) - drawGraph_ = 2; - else - drawGraph_ = 0; - draw_maxit_ = analyzeArgs.getKeyInt("draw_maxit", 1000); - draw_tol_ = analyzeArgs.getKeyDouble("draw_tol", 1.0E-5); - - DataFile* cnumvtimefile = setup.DFL().AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); - DataFile* clustersvtimefile = setup.DFL().AddDataFile(analyzeArgs.GetStringKey("clustersvtime"), - analyzeArgs); - windowSize_ = analyzeArgs.getKeyInt("cvtwindow", 0); - cpopvtimefile_ = setup.DFL().AddDataFile(analyzeArgs.GetStringKey("cpopvtime"), analyzeArgs); - clusterinfo_ = analyzeArgs.GetStringKey("info"); - summaryfile_ = analyzeArgs.GetStringKey("summary"); - nofitrms_ = analyzeArgs.hasKey("nofit"); - grace_color_ = analyzeArgs.hasKey("gracecolor"); - calc_lifetimes_ = analyzeArgs.hasKey("lifetime"); - if (cpopvtimefile_ != 0) { - if (analyzeArgs.hasKey("normpop")) - norm_pop_ = CLUSTERPOP; - else if (analyzeArgs.hasKey("normframe")) - norm_pop_ = FRAME; - else - norm_pop_ = NONE; - } - sil_file_ = analyzeArgs.GetStringKey("sil"); - - // Output trajectory stuff - writeRepFrameNum_ = analyzeArgs.hasKey("repframe"); - GetClusterTrajArgs(analyzeArgs, "clusterout", "clusterfmt", clusterfile_, clusterfmt_); - GetClusterTrajArgs(analyzeArgs, "singlerepout", "singlerepfmt", singlerepfile_, singlerepfmt_); - GetClusterTrajArgs(analyzeArgs, "repout", "repfmt", reptrajfile_, reptrajfmt_); - GetClusterTrajArgs(analyzeArgs, "avgout", "avgfmt", avgfile_, avgfmt_); - - // Get the mask string - maskexpr_ = analyzeArgs.GetMaskNext(); - if (!refs_.empty() && refmaskexpr_.empty()) { - refmaskexpr_ = maskexpr_; - if (refmaskexpr_.empty()) { - refmaskexpr_.assign("!@H="); - mprintf("Warning: 'assignrefs' specified but no 'refmask' given.\n" - "Warning: Using default mask expression: '%s'\n", refmaskexpr_.c_str()); - } - } - - // Output option for cluster info - suppressInfo_ = analyzeArgs.hasKey("noinfo"); - - // Dataset to store cluster number v time - cnumvtime_ = setup.DSL().AddSet(DataSet::INTEGER, analyzeArgs.GetStringNext(), "Cnum"); - if (cnumvtime_==0) return Analysis::ERR; - if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); - // If no pairwise distance matrix yet, allocate one - if (pw_dist_ == 0) { - MetaData md; - if (pairdistname.empty()) - md = MetaData( cnumvtime_->Meta().Name(), "PWD" ); - else - md = MetaData( pairdistname ); - if (pw_type == DataSet::CMATRIX_DISK) - md.SetFileName("CpptrajPairwiseCache"); - pw_dist_ = setup.DSL().AddSet(pw_type, md); - if (pw_dist_ == 0) return Analysis::ERR; - } - - // DataSet for # clusters seen v time - if (clustersvtimefile != 0) { - if (windowSize_ < 2) { - mprinterr("Error: For # clusters seen vs time, cvtwindow must be specified and > 1\n"); - return Analysis::ERR; - } - clustersVtime_ = setup.DSL().AddSet(DataSet::INTEGER, - MetaData(cnumvtime_->Meta().Name(), "NCVT")); - if (clustersVtime_ == 0) return Analysis::ERR; - clustersvtimefile->AddDataSet( clustersVtime_ ); - } - // Save master DSL for Cpopvtime - masterDSL_ = setup.DslPtr(); - - mprintf(" CLUSTER:"); - if (coords_ != 0) mprintf(" Using coords dataset %s,", coords_->legend()); - mprintf(" clustering using"); - if ( metric_ != ClusterList::DATA ) { - mprintf(" %s", ClusterList::MetricString( metric_ )); - if (!maskexpr_.empty()) - mprintf(" (mask [%s])",maskexpr_.c_str()); - else - mprintf(" (all atoms)"); - if (useMass_) - mprintf(", mass-weighted"); - if (nofitrms_) - mprintf(", no fitting"); - else - mprintf(" best-fit"); - } else { - if (cluster_dataset_.size() == 1) - mprintf(" dataset %s", cluster_dataset_[0]->legend()); - else - mprintf(" %u datasets.", cluster_dataset_.size()); - } - mprintf("\n"); - CList_->ClusteringInfo(); - if (sieve_ > 1) - mprintf("\tInitial clustering sieve value is %i frames.\n", sieve_); - else if (sieve_ < -1) { - mprintf("\tInitial clustering will be randomly sieved (with value %i)", -sieve_); - if (sieveSeed_ > 0) mprintf(" using random seed %i", sieveSeed_); - mprintf(".\n"); - } - if (sieve_ != 1) { - if (includeSieveInCalc_) - mprintf("\tAll frames (including sieved) will be used to calc within-cluster average.\n"); - else - mprintf("\tOnly non-sieved frames will be used to calc within-cluster average.\n"); - } - if (cnumvtimefile != 0) - mprintf("\tCluster # vs time will be written to %s\n", cnumvtimefile->DataFilename().base()); - if (clustersvtimefile != 0) - mprintf("\t# clusters seen vs time will be written to %s\n", - clustersvtimefile->DataFilename().base()); - if (cpopvtimefile_ != 0) { - mprintf("\tCluster pop vs time will be written to %s", cpopvtimefile_->DataFilename().base()); - if (norm_pop_==CLUSTERPOP) mprintf(" (normalized by cluster size)"); - else if (norm_pop_==FRAME) mprintf(" (normalized by frame)"); - mprintf("\n"); - } - if (grace_color_) - mprintf("\tGrace color instead of cluster number (1-15) will be saved.\n"); - if (calc_lifetimes_) - mprintf("\tCluster lifetime data sets will be calculated.\n"); - mprintf("\tPairwise distance data set is '%s'\n", pw_dist_->legend()); - if (pw_dist_->Type() == DataSet::CMATRIX_NOMEM) - mprintf("\tPairwise distances will not be cached (will slow clustering calcs)\n"); - else if (pw_dist_->Type() == DataSet::CMATRIX_DISK) - mprintf("\tPairwise distances will be cached to disk (will slow clustering calcs)\n"); - if (pw_dist_->Size() > 0) { - if (pw_mismatch_fatal_) - mprintf("\tCalculation will be halted if # frames does not match '%s'\n", - pw_dist_->legend()); - else - mprintf("\tPairwise distances will be recalculated if # frames does not match '%'s\n", - pw_dist_->legend()); - } - if (pwd_file_ != 0) - mprintf("\tSaving pair-wise distances to '%s'\n", pwd_file_->DataFilename().full()); - if (!clusterinfo_.empty()) - mprintf("\tCluster information will be written to %s\n",clusterinfo_.c_str()); - if (!summaryfile_.empty()) - mprintf("\tSummary of cluster results will be written to %s\n",summaryfile_.c_str()); - if (!sil_file_.empty()) { - mprintf("\tFrame silhouettes will be written to %s.frame.dat, cluster silhouettes\n" - "\t will be written to %s.cluster.dat\n", sil_file_.c_str(), sil_file_.c_str()); - if (sieve_ != 1) { - if (includeSieveInCalc_) - mprintf("\tSilhouette calculation will use all frames.\n"); - else - mprintf("\tSilhouette calculation will use non-sieved frames ONLY.\n"); - } - } - if (!halffile_.empty()) { - mprintf("\tSummary comparing parts of trajectory data for clusters will be written to %s\n", - halffile_.c_str()); - if (!splitFrames_.empty()) { - mprintf("\t\tFrames will be split at:"); - for (std::vector::const_iterator f = splitFrames_.begin(); f != splitFrames_.end(); ++f) - mprintf(" %i", *f); - mprintf("\n"); - } else - mprintf("\t\tFrames will be split at the halfway point.\n"); - } - mprintf("\tRepresentative frames will be chosen by"); - switch (bestRep_) { - case CUMULATIVE: mprintf(" lowest cumulative distance to all other frames.\n"); break; - case CENTROID : mprintf(" closest distance to cluster centroid.\n"); break; - case CUMULATIVE_NOSIEVE: - mprintf(" lowest cumulative distance to all other frames (ignore sieved frames).\n"); - break; - } - if (nRepsToSave_ > 1) - mprintf("\tThe top %i representative frames will be determined.\n", nRepsToSave_); - if (!clusterfile_.empty()) - mprintf("\tCluster trajectories will be written to %s, format %s\n", - clusterfile_.c_str(), TrajectoryFile::FormatString(clusterfmt_)); - if (!singlerepfile_.empty()) - mprintf("\tCluster representatives will be written to 1 traj (%s), format %s\n", - singlerepfile_.c_str(), TrajectoryFile::FormatString(singlerepfmt_)); - if (!reptrajfile_.empty()) { - mprintf("\tCluster representatives will be written to separate trajectories,\n"); - mprintf("\t\tprefix (%s), format %s",reptrajfile_.c_str(), - TrajectoryFile::FormatString(reptrajfmt_)); - if (writeRepFrameNum_) mprintf(", with frame #s"); - mprintf("\n"); - } - if (!avgfile_.empty()) - mprintf("\tAverage structures for clusters will be written to %s, format %s\n", - avgfile_.c_str(), TrajectoryFile::FormatString(avgfmt_)); - if (!refs_.empty()) - mprintf("\tClusters will be identified with loaded reference structures if RMSD\n" - "\t (mask '%s') to representative frame is < %g Ang.\n", refmaskexpr_.c_str(),refCut_); - if (drawGraph_ > 0) - mprintf("\tEXPERIMENTAL: Force-directed graph will be drawn from pairwise distances.\n" - "\t Max iterations= %i, min tolerance= %g\n", - draw_maxit_, draw_tol_); - - return Analysis::OK; -} - -/** This is where the clustering is actually performed. First the distances - * between each frame are calculated. Then the clustering routine is called. - */ -// TODO: Need to update save to indicate distance type -// NOTE: Should distances be saved only if load_pair? -Analysis::RetType Analysis_Clustering::Analyze() { - Timer cluster_setup; - Timer cluster_pairwise; - Timer cluster_cluster; - Timer cluster_post; - Timer cluster_total; - cluster_total.Start(); - mprintf("\tStarting clustering.\n"); - cluster_setup.Start(); - // If no dataset specified, use COORDS - if (cluster_dataset_.empty()) { - if (coords_ == 0) { - mprinterr("Error: No data to cluster on.\n"); - return Analysis::ERR; - } - cluster_dataset_.push_back( (DataSet*)coords_ ); - } - // Test that cluster data set contains data - unsigned int clusterDataSetSize = cluster_dataset_[0]->Size(); - if (clusterDataSetSize < 1) { - mprinterr("Error: cluster data set %s does not contain data.\n", - cluster_dataset_[0]->legend()); - return Analysis::ERR; - } - // If more than one data set, make sure they are all the same size. - for (ClusterDist::DsArray::iterator ds = cluster_dataset_.begin(); - ds != cluster_dataset_.end(); ++ds) - { - if ((*ds)->Size() != clusterDataSetSize) { - mprinterr("Error: data set '%s' size (%zu) != first data set '%s' size (%u)\n", - (*ds)->legend(), (*ds)->Size(), - cluster_dataset_[0]->legend(), clusterDataSetSize); - return Analysis::ERR; - } - } - // If no coordinates were specified, disable coordinate output types - bool has_coords = true; - if (coords_ == 0 || coords_->Size() < 1) { - mprintf("Warning: No coordinates or associated coordinate data set is empty.\n" - "Warning: Disabling coordinate output.\n"); - has_coords = false; - } - cluster_setup.Stop(); - - // Set up cluster distance calculation - if (CList_->SetupCdist( cluster_dataset_, metric_, nofitrms_, useMass_, maskexpr_ )) - return Analysis::ERR; - - // Check or calculate pairwise distances between frames - cluster_pairwise.Start(); - // Do some sanity checking first - if (pw_dist_ == 0) { - mprinterr("Internal Error: Empty cluster matrix.\n"); - return Analysis::ERR; - } - if (pw_dist_->Group() != DataSet::CLUSTERMATRIX) { - mprinterr("Internal Error: Wrong cluster matrix type.\n"); - return Analysis::ERR; - } - if (pw_dist_->Size() > 0) { - // Check if existing pw dist matrix matches expected size. If not, need to - // allocate a new data set and recalculate. - int sval = sieve_; - if (sval < 0) sval = -sval; - unsigned int expected_nrows = cluster_dataset_[0]->Size() / (unsigned int)sval; - if ( (cluster_dataset_[0]->Size() % (unsigned int)sval) != 0 ) - expected_nrows++; - if ( ((DataSet_Cmatrix*)pw_dist_)->Nrows() != expected_nrows ) { - if (sval == 1) { - // No sieve value specified by user. - if ( ((DataSet_Cmatrix*)pw_dist_)->SieveValue() != 1 ) { - // Cluster matrix is sieved. - mprintf("Warning: Sieved ClusterMatrix has %zu rows, expected %u; did you forget\n" - "Warning: to specify 'sieve <#>'?\n", - ((DataSet_Cmatrix*)pw_dist_)->Nrows(), expected_nrows); - } else { - // Cluster matrix is not sieved. - mprintf("Warning: ClusterMatrix has %zu rows, expected %u.\n", - ((DataSet_Cmatrix*)pw_dist_)->Nrows(), expected_nrows); - } - } else { - // Sieve value specified by user. - if ( ((DataSet_Cmatrix*)pw_dist_)->SieveValue() != 1 ) { - // Cluster matrix is sieved. - mprintf("Warning: Sieved ClusterMatrix has %zu rows, expected %u based on\n" - "Warning: specified sieve value (%i)\n", - ((DataSet_Cmatrix*)pw_dist_)->Nrows(), expected_nrows, sval); - } else { - // Cluster matrix is not sieved. - mprintf("Warning: ClusterMatrix has %zu rows, expected %u based on\n" - "Warning: specified sieve value (%i).\n", - ((DataSet_Cmatrix*)pw_dist_)->Nrows(), expected_nrows, sval); - } - } - if (pw_mismatch_fatal_) { - mprinterr("Error: Input pairwise matrix '%s' size (%zu) does not match expected size (%u)\n" - "Error: Check that input number of frames and sieve value are consistent.\n", - pw_dist_->legend(), - ((DataSet_Cmatrix*)pw_dist_)->Nrows(), expected_nrows); - mprinterr("Error: Check warnings in cpptraj output for more details.\n"); - return Analysis::ERR; - } - mprintf("Warning: Recalculating matrix.\n"); - pw_dist_ = masterDSL_->AddSet(DataSet::CMATRIX, "", "CMATRIX"); - if (pw_dist_ == 0) return Analysis::ERR; - } - } - if (CList_->CalcFrameDistances( pw_dist_, cluster_dataset_, sieve_, sieveSeed_ )) - return Analysis::ERR; - // If we want to save the pairwise distances add to file now - if (pwd_file_ != 0) - pwd_file_->AddDataSet( pw_dist_ ); - cluster_pairwise.Stop(); - - // Cluster - cluster_cluster.Start(); - CList_->Cluster(); - cluster_cluster.Stop(); - cluster_post.Start(); - Timer cluster_post_renumber; - Timer cluster_post_bestrep; - Timer cluster_post_info; - Timer cluster_post_summary; - Timer cluster_post_coords; - if (CList_->Nclusters() > 0) { - // Sort clusters and renumber; also finds centroids. If sieving, - // add remaining frames. - cluster_post_renumber.Start(); - CList_->Renumber( (sieve_ != 1) ); - cluster_post_renumber.Stop(); - // Find best representative frames for each cluster. - cluster_post_bestrep.Start(); - switch (bestRep_) { - case CUMULATIVE: CList_->FindBestRepFrames_CumulativeDist(nRepsToSave_); break; - case CENTROID : CList_->FindBestRepFrames_Centroid(nRepsToSave_); break; - case CUMULATIVE_NOSIEVE: CList_->FindBestRepFrames_NoSieve_CumulativeDist(nRepsToSave_); break; - } - cluster_post_bestrep.Stop(); - // DEBUG - if (debug_ > 0) { - mprintf("\nFINAL CLUSTERS:\n"); - CList_->PrintClusters(); - } - // Attempt to assign reference names to clusters if any specified. - if (!refs_.empty()) { - if (has_coords) - AssignRefsToClusters( *CList_ ); - else - mprintf("Warning: References were specified but no COORDS. Cannot assign ref names.\n"); - } - - // Print ptraj-like cluster info. - // If no filename is written and no noinfo, some info will still be written to STDOUT - if (!suppressInfo_) { - cluster_post_info.Start(); - CList_->PrintClustersToFile(clusterinfo_); - cluster_post_info.Stop(); - } - - // Calculate cluster silhouette - if (!sil_file_.empty()) - CList_->CalcSilhouette( sil_file_, includeSieveInCalc_ ); - - // Print a summary of clusters - if (!summaryfile_.empty()) { - cluster_post_summary.Start(); - CList_->Summary(summaryfile_, includeSieveInCalc_); - cluster_post_summary.Stop(); - } - - // Print a summary comparing first half to second half of data for clusters - if (!halffile_.empty()) { - // If no split frames were specified, use halfway point. - if (splitFrames_.empty()) - splitFrames_.push_back( clusterDataSetSize / 2 ); - // Check that none of the split values are invalid. - std::vector actualSplitFrames; - for (std::vector::const_iterator f = splitFrames_.begin(); - f != splitFrames_.end(); ++f) - if ( *f < 1 || *f >= (int)clusterDataSetSize ) - mprintf("Warning: split frame %i is out of bounds; ignoring.\n", *f); - else - actualSplitFrames.push_back( *f ); - CList_->Summary_Part(halffile_, actualSplitFrames); - } - - // Create cluster v time data from clusters. - CreateCnumvtime( *CList_, clusterDataSetSize ); - - // TEST: Draw graph based on point distances - if (drawGraph_ > 0) - CList_->DrawGraph( drawGraph_ == 2, cnumvtime_, draw_tol_, draw_maxit_ ); - - // Create # clusters seen v time data. - if (clustersVtime_ != 0) - NclustersObserved( *CList_, clusterDataSetSize ); - - // Create cluster pop v time plots - if (cpopvtimefile_ != 0) - CreateCpopvtime( *CList_, clusterDataSetSize ); - - // Create cluster lifetime DataSets - if (calc_lifetimes_) - ClusterLifetimes( *CList_, clusterDataSetSize ); - - // Change cluster num v time to grace-compatible colors if specified. - if (grace_color_) { - DataSet_integer& cnum_temp = static_cast( *cnumvtime_ ); - for (DataSet_integer::iterator ival = cnum_temp.begin(); - ival != cnum_temp.end(); ++ival) - { - *ival += 1; - if (*ival > 15) *ival = 15; - } - } - // Coordinate output. - if (has_coords) { - cluster_post_coords.Start(); - // Write clusters to trajectories - if (!clusterfile_.empty()) - WriteClusterTraj( *CList_ ); - // Write all representative frames to a single traj - if (!singlerepfile_.empty()) - WriteSingleRepTraj( *CList_ ); - // Write all representative frames to separate trajs - if (!reptrajfile_.empty()) - WriteRepTraj( *CList_ ); - // Write average structures for each cluster to separate files. - if (!avgfile_.empty()) - WriteAvgStruct( *CList_ ); - cluster_post_coords.Stop(); - } - } else - mprintf("\tNo clusters found.\n"); - cluster_post.Stop(); - cluster_total.Stop(); - // Timing data - mprintf("\tCluster timing data:\n"); - cluster_setup.WriteTiming(1, " Cluster Init. :", cluster_total.Total()); - cluster_pairwise.WriteTiming(1, " Pairwise Calc.:", cluster_total.Total()); - cluster_cluster.WriteTiming(1, " Clustering :", cluster_total.Total()); -# ifdef TIMER - CList_->Timing( cluster_cluster.Total() ); -# endif - cluster_post.WriteTiming(1, " Cluster Post. :", cluster_total.Total()); - cluster_post_renumber.WriteTiming(2, "Cluster renumbering/sieve restore", cluster_post.Total()); - cluster_post_bestrep.WriteTiming(2, "Find best rep.", cluster_post.Total()); - cluster_post_info.WriteTiming(2, "Info calc", cluster_post.Total()); - cluster_post_summary.WriteTiming(2, "Summary calc", cluster_post.Total()); - cluster_post_coords.WriteTiming(2, "Coordinate writes", cluster_post.Total()); - cluster_total.WriteTiming(1, "Total:"); - return Analysis::OK; -} - -// ----------------------------------------------------------------------------- -void Analysis_Clustering::AssignRefsToClusters( ClusterList& CList ) const { - // Pre-center all reference coords at the origin. No need to store trans vectors. - std::vector refFrames; - refFrames.reserve( refs_.size() ); - for (unsigned int idx = 0; idx != refs_.size(); idx++) { - AtomMask rMask( refmaskexpr_ ); - DataSet_Coords_REF* REF_ds = (DataSet_Coords_REF*)refs_[idx]; - if ( REF_ds->Top().SetupIntegerMask( rMask, REF_ds->RefFrame() ) ) { - mprintf("Warning: Could not set up mask for reference '%s'\n", REF_ds->legend()); - continue; - } - refFrames.push_back( Frame(REF_ds->RefFrame(), rMask) ); - refFrames.back().CenterOnOrigin( useMass_ ); - } - // For each cluster, assign the reference name with the lowest RMSD - // to the representative frame that is below the cutoff. - AtomMask tMask( refmaskexpr_ ); - if (coords_->Top().SetupIntegerMask( tMask )) { - mprinterr("Error: Could not set up mask for assigning references.\n"); - return; - } - Frame TGT( coords_->AllocateFrame(), tMask ); - unsigned int cidx = 0; - for (ClusterList::cluster_it cluster = CList.begin(); - cluster != CList.end(); ++cluster, ++cidx) - { - coords_->GetFrame( cluster->BestRepFrame(), TGT, tMask ); - double minRms = TGT.RMSD_CenteredRef( refFrames[0], useMass_ ); - unsigned int minIdx = 0; - for (unsigned int idx = 1; idx < refs_.size(); idx++) { - double rms = TGT.RMSD_CenteredRef( refFrames[idx], useMass_ ); - if (rms < minRms) { - minRms = rms; - minIdx = idx; - } - } - if (minRms < refCut_) { - //mprintf("DEBUG: Assigned cluster %i to reference \"%s\" (%g)\n", cidx, - // refs_[minIdx]->Meta().Name().c_str(), minRms); - cluster->SetNameAndRms( refs_[minIdx]->Meta().Name(), minRms ); - } else { - //mprintf("DEBUG: Cluster %i was closest to reference \"(%s)\" (%g)\n", cidx, - // refs_[minIdx]->Meta().Name().c_str(), minRms); - cluster->SetNameAndRms( "(" + refs_[minIdx]->Meta().Name() + ")", minRms ); - } - } -} - -// ----------------------------------------------------------------------------- -// Analysis_Clustering::CreateCnumvtime() -/** Put cluster number vs frame into dataset. */ -void Analysis_Clustering::CreateCnumvtime( ClusterList const& CList, unsigned int maxFrames ) { - // FIXME: - // Cast generic DataSet for cnumvtime back to integer dataset to - // access specific integer dataset functions for resizing and [] - // operator. Should this eventually be generic to all atomic DataSets? - DataSet_integer& cnum_temp = static_cast( *cnumvtime_ ); - cnum_temp.Resize( maxFrames ); - // Make all clusters start at -1. This way cluster algorithms that - // have noise points (i.e. no cluster assigned) will be distinguished. - std::fill(cnum_temp.begin(), cnum_temp.end(), -1); - - for (ClusterList::cluster_iterator C = CList.begincluster(); - C != CList.endcluster(); C++) - { - //mprinterr("Cluster %i:\n",CList->CurrentNum()); - int cnum = (*C).Num(); - // Loop over all frames in the cluster - for (ClusterNode::frame_iterator frame = (*C).beginframe(); - frame != (*C).endframe(); frame++) - { - //mprinterr("%i,",*frame); - cnum_temp[ *frame ] = cnum; - } - //mprinterr("\n"); - //break; - } -} - -// Analysis_Clustering::CreateCpopvtime() -// NOTE: Should not be called if cpopvtimefile is NULL -void Analysis_Clustering::CreateCpopvtime( ClusterList const& CList, unsigned int maxFrames ) { - mprintf("\tCalculating cluster population vs time for each cluster.\n"); - // Set up output data sets - std::vector Cpop; - MetaData md(cnumvtime_->Meta().Name(), "Pop"); - DataSet::SizeArray dsize(1, maxFrames); - for (int cnum = 0; cnum < CList.Nclusters(); ++cnum) { - md.SetIdx( cnum ); - DataSet_float* ds = (DataSet_float*)masterDSL_->AddSet( DataSet::FLOAT, md ); - if (ds == 0) { - mprinterr("Error: Could not allocate cluster pop v time DataSet.\n"); - return; - } - ds->Allocate( dsize ); - Cpop.push_back( ds ); - // SANITY CHECK - if (cpopvtimefile_ != 0) - cpopvtimefile_->AddDataSet( ds ); - } - int cnum = 0; - // Loop over all clusters - for (ClusterList::cluster_iterator C = CList.begincluster(); C != CList.endcluster(); ++C, ++cnum) - { - DataSet_float& pvt = static_cast( *(Cpop[cnum]) ); - float pop = 0.0; - // Loop over all frames in cluster - for (ClusterNode::frame_iterator f = C->beginframe(); f != C->endframe(); ++f) - { - if (*f > (int)pvt.Size()) - pvt.Resize( *f, pop ); - pop = pop + 1.0; - pvt[*f] = pop; - } - // Ensure pop v time set is maxFrames long - if (pvt.Size() < maxFrames) - pvt.Resize( maxFrames, pop ); - // Normalization - if (norm_pop_ == CLUSTERPOP) { - float norm = 1.0 / (float)C->Nframes(); - for (unsigned int frm = 0; frm < maxFrames; ++frm) - pvt[frm] = pvt[frm] * norm; - } else if (norm_pop_ == FRAME) { - float norm = 1.0; - for (unsigned int frm = 0; frm < maxFrames; ++frm) - { - pvt[frm] = pvt[frm] / norm; - norm = norm + 1.0; - } - } - } -} - -// Analysis_Clustering::ClusterLifetimes() -void Analysis_Clustering::ClusterLifetimes( ClusterList const& CList, unsigned int maxFrames ) { - // Set up output data sets. TODO: use ChildDSL - std::vector DSL; - MetaData md(cnumvtime_->Meta().Name(), "Lifetime"); - for (int cnum = 0; cnum < CList.Nclusters(); ++cnum) { - md.SetIdx( cnum ); - DSL.push_back((DataSet_integer*) masterDSL_->AddSet( DataSet::INTEGER, md)); - if (DSL.back() == 0) { - mprinterr("Error: Could not allocate cluster lifetime DataSet.\n"); - return; - } - DSL.back()->Resize( maxFrames ); - } - // For each frame, assign cluster frame belongs to 1. - DataSet_integer const& cnum_temp = static_cast(*cnumvtime_); - for (unsigned int frame = 0; frame < maxFrames; ++frame) { - int cluster_num = cnum_temp[frame]; - // Noise points are -1 - if (cluster_num > -1) - (*DSL[ cluster_num ])[ frame ] = 1; - } -} - -/** Determine how many different clusters are observed within a given time - * window. - */ -void Analysis_Clustering::NclustersObserved( ClusterList const& CList, unsigned int maxFrames ) { - DataSet_integer const& CVT = static_cast( *cnumvtime_ ); - if (CVT.Size() < 1 || CList.Nclusters() < 1) return; - int dataIdx = 0; - // True if cluster was observed during window - std::vector observed( CList.Nclusters(), false ); - for (unsigned int frame = 0; frame < maxFrames; frame++) { - if (CVT[frame] != -1) - observed[ CVT[frame] ] = true; - if ( ((frame+1) % windowSize_) == 0 ) { - // Count # observed clusters - int nClustersObserved = 0; - for (std::vector::iterator ob = observed.begin(); ob != observed.end(); ++ob) - if ( *ob ) { - ++nClustersObserved; - *ob = false; - } - //mprintf("DEBUG: WINDOW at frame %i; %i clusters observed\n", frame+1, nClustersObserved); - clustersVtime_->Add( dataIdx++, &nClustersObserved ); - } - } -/* - int currentCluster = CVT[0]; - int nClustersObserved = 1; - for (int frame = 1; frame < maxFrames; frame++) { - // Do not count noise as a cluster. - if (CVT[frame] != currentCluster && CVT[frame] != -1) { - ++nClustersObserved; - currentCluster = CVT[frame]; - } - mprintf("DEBUG: %i %i\n", frame+1, nClustersObserved); - if ( ((frame+1) % windowSize_) == 0 ) { - mprintf("DEBUG: WINDOW\n"); - clustersVtime_->Add( dataIdx++, &nClustersObserved ); - nClustersObserved = 1; - } - } -*/ - clustersVtime_->SetDim(Dimension::X, Dimension(windowSize_, windowSize_, "Frame")); -} - -// ---------- Cluster Coordinate Output Routines ------------------------------- -// Analysis_Clustering::WriteClusterTraj() -/** Write frames in each cluster to a trajectory file. */ -void Analysis_Clustering::WriteClusterTraj( ClusterList const& CList ) { - Topology* clusterparm = coords_->TopPtr(); - // Loop over all clusters - for (ClusterList::cluster_iterator C = CList.begincluster(); - C != CList.endcluster(); ++C) - { - // Create filename based on cluster number. - int cnum = C->Num(); - std::string cfilename = clusterfile_ + ".c" + integerToString( cnum ); - // Set up trajectory file - Trajout_Single clusterout; - if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, - coords_->CoordsInfo(), C->Nframes(), - clusterfmt_)) - { - mprinterr("Error: Could not set up cluster trajectory %s for write.\n", - cfilename.c_str()); - return; - } - // Loop over all frames in cluster - int set = 0; - Frame clusterframe = coords_->AllocateFrame(); - for (ClusterNode::frame_iterator fnum = C->beginframe(); - fnum != C->endframe(); ++fnum) - { - coords_->GetFrame( *fnum, clusterframe ); - clusterout.WriteSingle(set++, clusterframe); - } - // Close traj - clusterout.EndTraj(); - } -} - -// Analysis_Clustering::WriteAvgStruct() -void Analysis_Clustering::WriteAvgStruct( ClusterList const& CList ) { - Topology avgparm = coords_->Top(); - // Get extension for representative frame format - std::string tmpExt = TrajectoryFile::WriteFormatExtension(avgfmt_); - // Loop over all clusters - for (ClusterList::cluster_iterator C = CList.begincluster(); - C != CList.endcluster(); ++C) - { - // Create filename based on cluster number. - int cnum = C->Num(); - std::string cfilename = avgfile_ + ".c" + integerToString( cnum ) + tmpExt; - // Set up trajectory file - Trajout_Single clusterout; // FIXME CoordinateInfo OK for just coords? - if (clusterout.PrepareTrajWrite(cfilename, ArgList(), &avgparm, - CoordinateInfo(), 1, avgfmt_)) - { - mprinterr("Error: Could not set up cluster average file %s for write.\n", - cfilename.c_str()); - return; - } - // Get rep frame for rms fitting. - Frame repframe = coords_->AllocateFrame(); - coords_->GetFrame( C->BestRepFrame(), repframe ); - Vec3 reftrans = repframe.CenterOnOrigin(false); - // Loop over all frames in cluster - Frame clusterframe = coords_->AllocateFrame(); - Frame avgframe = clusterframe; - avgframe.ZeroCoords(); - for (ClusterNode::frame_iterator fnum = C->beginframe(); - fnum != C->endframe(); ++fnum) - { - coords_->GetFrame( *fnum, clusterframe ); - clusterframe.RMSD_FitToRef( repframe, reftrans ); - avgframe += clusterframe; - } - avgframe.Divide( (double)C->Nframes() ); - clusterout.WriteSingle(0, avgframe); - clusterout.EndTraj(); - } -} - -// Analysis_Clustering::WriteSingleRepTraj() -/** Write representative frame of each cluster to a trajectory file. */ -void Analysis_Clustering::WriteSingleRepTraj( ClusterList const& CList ) { - Trajout_Single clusterout; - // Set up trajectory file. Use parm from COORDS DataSet. - Topology *clusterparm = coords_->TopPtr(); - if (clusterout.PrepareTrajWrite(singlerepfile_, ArgList(), clusterparm, - coords_->CoordsInfo(), CList.Nclusters() * nRepsToSave_, - singlerepfmt_)) - { - mprinterr("Error: Could not set up single trajectory for represenatatives %s for write.\n", - singlerepfile_.c_str()); - return; - } - // Set up frame to hold cluster rep coords. - Frame clusterframe = coords_->AllocateFrame(); - int framecounter = 0; - // Write rep frames from all clusters. - for (ClusterList::cluster_iterator cluster = CList.begincluster(); - cluster != CList.endcluster(); ++cluster) - { - for (ClusterNode::RepPairArray::const_iterator rep = cluster->BestReps().begin(); - rep != cluster->BestReps().end(); ++rep) - { - coords_->GetFrame( rep->first, clusterframe ); - clusterout.WriteSingle(framecounter++, clusterframe); - } - } - // Close traj - clusterout.EndTraj(); -} - -// Analysis_Clustering::WriteRepTraj() -/** Write representative frame of each cluster to a separate trajectory file, - * repfile.REPNUM.FMT - */ -void Analysis_Clustering::WriteRepTraj( ClusterList const& CList ) { - // Get extension for representative frame format - std::string tmpExt = TrajectoryFile::WriteFormatExtension(reptrajfmt_); - // Use Topology from COORDS DataSet to set up input frame - Topology* clusterparm = coords_->TopPtr(); - Frame clusterframe = coords_->AllocateFrame(); - // Loop over all clusters - for (ClusterList::cluster_iterator C = CList.begincluster(); - C != CList.endcluster(); ++C) - { - if (writeRepFrameNum_) { - // Each rep from cluster to separate file. - for (ClusterNode::RepPairArray::const_iterator rep = C->BestReps().begin(); - rep != C->BestReps().end(); ++rep) - { - Trajout_Single clusterout; - // Get best rep frame # - int framenum = rep->first; - // Create filename based on cluster number and frame # - std::string cfilename = reptrajfile_ + ".c" + integerToString(C->Num()) + - ("." + integerToString(framenum+1)) + tmpExt; - // Set up trajectory file. - if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, - coords_->CoordsInfo(), 1, reptrajfmt_)) - { - mprinterr("Error: Could not set up representative trajectory file %s for write.\n", - cfilename.c_str()); - return; - } - // Write cluster rep frame - coords_->GetFrame( framenum, clusterframe ); - clusterout.WriteSingle(framenum, clusterframe); - // Close traj - clusterout.EndTraj(); - } - } else { - // Each rep from cluster to single file. - Trajout_Single clusterout; - // Create filename based on cluster number - std::string cfilename = reptrajfile_ + ".c" + integerToString(C->Num()) + tmpExt; - // Set up trajectory file. - if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, - coords_->CoordsInfo(), nRepsToSave_, reptrajfmt_)) - { - mprinterr("Error: Could not set up representative trajectory file %s for write.\n", - cfilename.c_str()); - return; - } - int framecounter = 0; - for (ClusterNode::RepPairArray::const_iterator rep = C->BestReps().begin(); - rep != C->BestReps().end(); ++rep) - { - // Write cluster rep frame - coords_->GetFrame( rep->first, clusterframe ); - clusterout.WriteSingle( framecounter++, clusterframe ); - } - // Close traj - clusterout.EndTraj(); - } - } -} diff --git a/src/Analysis_Clustering.h b/src/Analysis_Clustering.h deleted file mode 100644 index 979cb69b6d..0000000000 --- a/src/Analysis_Clustering.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef INC_ANALYSIS_CLUSTERING_H -#define INC_ANALYSIS_CLUSTERING_H -#include "Analysis.h" -#include "ClusterList.h" -#include "TrajectoryFile.h" -#include "DataSet_Coords.h" -// Class: Analysis_Clustering -/// Used to perform clustering of frames, currently by RMSD only. -class Analysis_Clustering: public Analysis { - public: - Analysis_Clustering(); - ~Analysis_Clustering(); - - DispatchObject* Alloc() const { return (DispatchObject*)new Analysis_Clustering(); } - void Help() const; - Analysis::RetType Setup(ArgList&, AnalysisSetup&, int); - Analysis::RetType Analyze(); - private: - inline void GetClusterTrajArgs(ArgList&, const char*, const char*, std::string&, - TrajectoryFile::TrajFormatType&) const; - void AssignRefsToClusters(ClusterList&) const; - void CreateCnumvtime( ClusterList const&, unsigned int ); - void CreateCpopvtime( ClusterList const&, unsigned int ); - void ClusterLifetimes( ClusterList const&, unsigned int ); - void NclustersObserved(ClusterList const&, unsigned int); - void WriteClusterTraj( ClusterList const& ); - void WriteAvgStruct( ClusterList const& ); - void WriteSingleRepTraj( ClusterList const& ); - void WriteRepTraj( ClusterList const& ); - - DataSetList* masterDSL_; ///< For Cluster pop v time DataSets. - DataSetList refs_; ///< Hold references for cluster name assignment. - DataSet_Coords* coords_; ///< Hold coordinates of frames being clustered. - ClusterList* CList_; ///< Hold specified clustering algorithm. - std::string maskexpr_; ///< If RMSD, Atoms to cluster on - std::string refmaskexpr_; ///< If assigning refs, atoms to calc RMSD to. - int sieve_; ///< If > 1, frames to skip on initial clustering pass. - int sieveSeed_; ///< Used to seed random number gen for sieve - int windowSize_; ///< Window size for # clusters seen vs time. - int drawGraph_; - int draw_maxit_; - int nRepsToSave_; ///< Number of best representative structures to save - double draw_tol_; - double refCut_; ///< RMSD cutoff for assigning reference names to clusters. - std::vector splitFrames_; ///< Frames to split at when comparing parts. - DataSet* cnumvtime_; ///< Cluster vs time dataset. - DataSet* clustersVtime_; ///< # clusters seen vs time dataset. - DataSet* pw_dist_; ///< Cluster pairwise distance matrix dataset - DataFile* cpopvtimefile_; ///< Cluster pop v time file. - DataFile* pwd_file_; ///< Data file to write pairwise distance matrix to. - // TODO use FileName - std::string summaryfile_; ///< Summary file name - std::string halffile_; ///< 1st/2nd half summary file name - std::string clusterfile_; ///< Cluster trajectory base filename. - std::string singlerepfile_; ///< Cluster all rep single trajectory filename. - std::string reptrajfile_; ///< Cluster rep to separate trajectory filename. - std::string avgfile_; ///< Cluster traj average structure filename. - std::string clusterinfo_; ///< Name for Ptraj-like cluster output file. - std::string sil_file_; ///< Prefix name of file for cluster silhouette. - bool nofitrms_; ///< If true do not best-fit when calc RMSD. - ClusterList::DistMetricType metric_; - bool useMass_; - bool grace_color_; ///< If true print grace colors instead of cluster number - enum normPopType { NONE=0, CLUSTERPOP, FRAME }; - normPopType norm_pop_; ///< If set cluster pops v time will be normalized - enum BestRepType { CUMULATIVE = 0, CENTROID, CUMULATIVE_NOSIEVE }; - BestRepType bestRep_; - bool calc_lifetimes_; ///< If true calculate DataSets for use in lifetime analysis. - bool writeRepFrameNum_; ///< If true frame #s will be in rep file names. - bool includeSieveInCalc_; ///< If true use sieved frames in certain calculations. - bool suppressInfo_; ///< If true, do not print cluster info to STDOUT - bool pw_mismatch_fatal_; ///< If true, existing PW matrix size must match expected size. - ClusterDist::DsArray cluster_dataset_; ///< DataSet(s) to use for clustering. - TrajectoryFile::TrajFormatType clusterfmt_; ///< Cluster trajectory format. - TrajectoryFile::TrajFormatType singlerepfmt_; ///< Cluster all rep single trajectory format. - TrajectoryFile::TrajFormatType reptrajfmt_; ///< Cluster rep to separate trajectory format. - TrajectoryFile::TrajFormatType avgfmt_; ///< Cluster traj average structure file format. - int debug_; - - static const TrajectoryFile::TrajFormatType DEF_TRAJ_FMT_; - static const char* PAIRDISTFILE_; ///< Default pairwise dist file name. - static DataFile::DataFormatType PAIRDISTTYPE_; ///< Default pairwise dist file type. -}; -#endif diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 5cc584714c..33dd916970 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -35,11 +35,11 @@ const char* Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_NAME_ = "CpptrajPairDist /** The default pairwise distance file type. */ DataFile::DataFormatType Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_TYPE_ = -# ifdef BINTRAJ - DataFile::NCCMATRIX; -# else - DataFile::CMATRIX; -# endif +//# ifdef BINTRAJ +// DataFile::NCCMATRIX; +//# else + DataFile::CMATRIX_BINARY; +//# endif const char* Cpptraj::Cluster::Control::PairwiseArgs = "pairwisecache {mem|disk|none}"; diff --git a/src/ClusterDist.cpp b/src/ClusterDist.cpp deleted file mode 100644 index 79d3683f90..0000000000 --- a/src/ClusterDist.cpp +++ /dev/null @@ -1,534 +0,0 @@ -#include -#include "ClusterDist.h" -#include "Constants.h" // RADDEG, DEGRAD -// TODO: All DataSet stuff const& - -void Centroid_Coord::Print(std::string const& fnameIn) const { - // Write Amber coordinate format - CpptrajFile cOut; - FileName fname(fnameIn); - if (cOut.OpenWrite(fname)) return; - cOut.Printf("%-80s\n", fname.base()); - int col = 0; - for (int ic = 0; ic != cframe_.size(); ic++) { - cOut.Printf("%8.3f", cframe_[ic]); - ++col; - if (col == 10) { - cOut.Printf("\n"); - col = 0; - } - } - if (col > 0) cOut.Printf("\n"); -} - -// ============================================================================= -/// Calculate smallest difference between two angles (in degrees). -static double DistCalc_Dih(double d1, double d2) { - double diff = fabs(d1 - d2); - if (diff > 180.0) - return (360.0 - diff); - else - return diff; -} - -/// Calculate basic difference. -static double DistCalc_Std(double d1, double d2) { - return fabs(d1 - d2); -} - -/* Update centroid value for adding/removing a frame. - * \param fval value of frame being added/removed. - * \param cval current centroid value. - * \param isTorsion data is periodic. - * \param oldSize Previous size of the centroid. - * \param OP Operation being performed. - */ -static double DistCalc_FrameCentroid(double fval, double cval, bool isTorsion, - double oldSize, ClusterDist::CentOpType OP, - double& sumx, double& sumy) -{ - double newcval; - if (isTorsion) { - double ftheta = fval * Constants::DEGRAD; - if (OP == ClusterDist::ADDFRAME) { - sumy += sin( ftheta ); - sumx += cos( ftheta ); - } else { // SUBTRACTFRAME - sumy -= sin( ftheta ); - sumx -= cos( ftheta ); - } - newcval = atan2(sumy, sumx) * Constants::RADDEG; - } else { - newcval = cval * oldSize; - if (OP == ClusterDist::ADDFRAME) { - newcval += fval; - newcval /= ( oldSize + 1 ); - } else { // SUBTRACTFRAME - newcval -= fval; - newcval /= ( oldSize - 1 ); - } - } - return newcval; -} - -// ----------------------------------------------------------------------------- -/** Calculate unambiguous average dihedral angle (in degrees) by converting to - * cartesian coords using x = cos(theta), y = sin(theta), and: - * tan(avgtheta) = avgy / avgx = SUM[sin(theta)] / SUM[cos(theta)] - * See Eq. 2 from Altis et al., J. Chem. Phys., 126 p. 244111 (2007). - */ -static double AvgCalc_Dih( DataSet_1D const& dsIn, ClusterDist::Cframes const& cframesIn, - double& sumx, double& sumy ) { - sumy = 0.0; - sumx = 0.0; - // TODO: Convert angles to radians prior to this call? - for (ClusterDist::Cframes_it frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) { - double theta = dsIn.Dval( *frm ) * Constants::DEGRAD; - sumy += sin( theta ); - sumx += cos( theta ); - } - return atan2(sumy, sumx) * Constants::RADDEG; -} - -static double AvgCalc_Std( DataSet_1D const& dsIn, ClusterDist::Cframes const& cframesIn ) { - double val = 0.0; - for (ClusterDist::Cframes_it frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) - val += dsIn.Dval( *frm ); - return (val / (double)cframesIn.size()); -} - -// ---------- Distance calc routines for single DataSet ------------------------ -ClusterDist_Num::ClusterDist_Num( DataSet* dsIn ) : - data_((DataSet_1D*)dsIn) -{ - if ( data_->Meta().IsTorsionArray() ) - dcalc_ = DistCalc_Dih; - else - dcalc_ = DistCalc_Std; -} - -double ClusterDist_Num::FrameDist(int f1, int f2) { - return dcalc_(data_->Dval(f1), data_->Dval(f2)); -} - -double ClusterDist_Num::CentroidDist(Centroid* c1, Centroid* c2) { - return dcalc_(((Centroid_Num*)c1)->cval_, ((Centroid_Num*)c2)->cval_); -} - -double ClusterDist_Num::FrameCentroidDist(int f1, Centroid* c1) { - return dcalc_(data_->Dval(f1), ((Centroid_Num*)c1)->cval_); -} - -/** Calculate avg value of given frames. */ -void ClusterDist_Num::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { - Centroid_Num* cent = (Centroid_Num*)centIn; - if (data_->Meta().IsTorsionArray()) - cent->cval_ = AvgCalc_Dih(*data_, cframesIn, cent->sumx_, cent->sumy_); - else - cent->cval_ = AvgCalc_Std(*data_, cframesIn); -} - -/** \return A new centroid of the given frames. */ -Centroid* ClusterDist_Num::NewCentroid( Cframes const& cframesIn ) { - Centroid_Num* cent = new Centroid_Num(); - CalculateCentroid( cent, cframesIn ); - return cent; -} - -void ClusterDist_Num::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, - CentOpType OP) -{ - Centroid_Num* cent = (Centroid_Num*)centIn; - cent->cval_ = DistCalc_FrameCentroid(data_->Dval(frame), cent->cval_, - data_->Meta().IsTorsionArray(), oldSize, OP, - cent->sumx_, cent->sumy_); -} - -std::string ClusterDist_Num::Description() const { - return "data " + data_->Meta().PrintName(); -} - -// ---------- Distance calc routines for multiple DataSets (Euclid) ------------ -ClusterDist_Euclid::ClusterDist_Euclid(DsArray const& dsIn) -{ - for (DsArray::const_iterator ds = dsIn.begin(); ds != dsIn.end(); ++ds) { - dsets_.push_back( (DataSet_1D*)*ds ); - if ( dsets_.back()->Meta().IsTorsionArray() ) - dcalcs_.push_back( DistCalc_Dih ); - else - dcalcs_.push_back( DistCalc_Std ); - } -} - -double ClusterDist_Euclid::FrameDist(int f1, int f2) { - double dist = 0.0; - DcArray::iterator dcalc = dcalcs_.begin(); - for (D1Array::iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds, ++dcalc) { - double diff = (*dcalc)((*ds)->Dval(f1), (*ds)->Dval(f2)); - dist += (diff * diff); - } - return sqrt(dist); -} - -double ClusterDist_Euclid::CentroidDist(Centroid* c1, Centroid* c2) { - double dist = 0.0; - std::vector::iterator c2val = ((Centroid_Multi*)c2)->cvals_.begin(); - DcArray::iterator dcalc = dcalcs_.begin(); - for (std::vector::iterator c1val = ((Centroid_Multi*)c1)->cvals_.begin(); - c1val != ((Centroid_Multi*)c1)->cvals_.end(); - ++c1val, ++dcalc) - { - double diff = (*dcalc)(*c1val, *(c2val++)); - dist += (diff * diff); - } - return sqrt(dist); -} - -double ClusterDist_Euclid::FrameCentroidDist(int f1, Centroid* c1) { - double dist = 0.0; - std::vector::iterator c1val = ((Centroid_Multi*)c1)->cvals_.begin(); - DcArray::iterator dcalc = dcalcs_.begin(); - for (D1Array::iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) { - double diff = (*dcalc)((*ds)->Dval(f1), *(c1val++)); - dist += (diff * diff); - } - return sqrt(dist); -} - -void ClusterDist_Euclid::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { - Centroid_Multi* cent = (Centroid_Multi*)centIn; - cent->cvals_.resize( dsets_.size(), 0.0 ); - cent->Sumx_.resize( dsets_.size(), 0.0 ); - cent->Sumy_.resize( dsets_.size(), 0.0 ); - for (unsigned int idx = 0; idx != dsets_.size(); ++idx) { - if (dsets_[idx]->Meta().IsTorsionArray()) - cent->cvals_[idx] = AvgCalc_Dih(*dsets_[idx], cframesIn, cent->Sumx_[idx], cent->Sumy_[idx]); - else - cent->cvals_[idx] = AvgCalc_Std(*dsets_[idx], cframesIn); - } -// mprintf("DEBUG: Centroids:"); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" %f (sumy=%f sumx=%f)", cent->cvals_[i], cent->Sumy_[i], cent->Sumx_[i]); -// mprintf("\n"); -} - -Centroid* ClusterDist_Euclid::NewCentroid(Cframes const& cframesIn) { - Centroid_Multi* cent = new Centroid_Multi(); - CalculateCentroid(cent, cframesIn); - return cent; -} - -//static const char* OPSTRING[] = {"ADD", "SUBTRACT"}; // DEBUG - -void ClusterDist_Euclid::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, - CentOpType OP) -{ - Centroid_Multi* cent = (Centroid_Multi*)centIn; -// mprintf("DEBUG: Old Centroids:"); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" sumy=%f sumx=%f", cent->Sumy_[i], cent->Sumx_[i]); -// //mprintf(" %f", cent->cvals_[i]); -// mprintf("\n"); - for (unsigned int i = 0; i != dsets_.size(); ++i) - cent->cvals_[i] = DistCalc_FrameCentroid(dsets_[i]->Dval(frame), - cent->cvals_[i], dsets_[i]->Meta().IsTorsionArray(), oldSize, OP, - cent->Sumx_[i], cent->Sumy_[i]); -// mprintf("DEBUG: New Centroids after %s frame %i:", OPSTRING[OP], frame); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" %f", cent->cvals_[i]); -// mprintf("\n"); -} - -std::string ClusterDist_Euclid::Description() const { - std::string description("data "); - for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) - if (ds == dsets_.begin()) - description.append( (*ds)->Meta().PrintName() ); - else - description.append( "," + (*ds)->Meta().PrintName() ); - return description; -} - -// ---------- Distance calc routines for COORDS DataSet using DME -------------- -ClusterDist_DME::ClusterDist_DME(DataSet* dIn, AtomMask const& maskIn) : - coords_((DataSet_Coords*)dIn), - mask_(maskIn) -{ - frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms()); - frm2_ = frm1_; -} - -double ClusterDist_DME::FrameDist(int f1, int f2) { - coords_->GetFrame( f1, frm1_, mask_ ); - coords_->GetFrame( f2, frm2_, mask_ ); - return frm1_.DISTRMSD( frm2_ ); -} - -double ClusterDist_DME::CentroidDist(Centroid* c1, Centroid* c2) { - return ((Centroid_Coord*)c1)->cframe_.DISTRMSD( ((Centroid_Coord*)c2)->cframe_ ); -} - -double ClusterDist_DME::FrameCentroidDist(int f1, Centroid* c1) { - coords_->GetFrame( f1, frm1_, mask_ ); - return frm1_.DISTRMSD( ((Centroid_Coord*)c1)->cframe_ ); -} - -/** Compute the centroid (avg) coords for each atom from all frames in this - * cluster. NOTE: For DME the centroid should probably be calculated via - * internal coordinates; use RMS best-fit as a cheat. - */ -void ClusterDist_DME::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { - Matrix_3x3 Rot; - Vec3 Trans; - Centroid_Coord* cent = (Centroid_Coord*)centIn; - // Reset atom count for centroid. - cent->cframe_.ClearAtoms(); - for (Cframes_it frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) - { - coords_->GetFrame( *frm, frm1_, mask_ ); - if (cent->cframe_.empty()) { - cent->cframe_ = frm1_; - cent->cframe_.CenterOnOrigin(false); - } else { - frm1_.RMSD_CenteredRef( cent->cframe_, Rot, Trans, false ); - frm1_.Rotate( Rot ); - cent->cframe_ += frm1_; - } - } - cent->cframe_.Divide( (double)cframesIn.size() ); - //mprintf("\t\tFirst 3 centroid coords (of %i): %f %f %f\n", cent->cframe_.Natom(), - // cent->cent->cframe_[0], cent->cframe_[1],cent->cframe_[2]); -} - -Centroid* ClusterDist_DME::NewCentroid( Cframes const& cframesIn ) { - // TODO: Incorporate mass? - Centroid_Coord* cent = new Centroid_Coord( mask_.Nselected() ); - CalculateCentroid( cent, cframesIn ); - return cent; -} - -void ClusterDist_DME::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, - CentOpType OP) -{ - Matrix_3x3 Rot; - Vec3 Trans; - Centroid_Coord* cent = (Centroid_Coord*)centIn; - coords_->GetFrame( frame, frm1_, mask_ ); - frm1_.RMSD_CenteredRef( cent->cframe_, Rot, Trans, false ); - frm1_.Rotate( Rot ); - cent->cframe_.Multiply( oldSize ); - if (OP == ADDFRAME) { - cent->cframe_ += frm1_; - cent->cframe_.Divide( oldSize + 1 ); - } else { // SUBTRACTFRAME - cent->cframe_ -= frm1_; - cent->cframe_.Divide( oldSize - 1 ); - } -} - -std::string ClusterDist_DME::Description() const { - return "dme " + mask_.MaskExpression(); -} - -// ---------- Distance calc routines for COORDS DataSets using RMSD ------------ -ClusterDist_RMS::ClusterDist_RMS(DataSet* dIn, AtomMask const& maskIn, - bool nofit, bool useMass) : - coords_((DataSet_Coords*)dIn), - mask_(maskIn), - nofit_(nofit), - useMass_(useMass) -{ - frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms()); - frm2_ = frm1_; -} - -double ClusterDist_RMS::FrameDist(int f1, int f2) { - coords_->GetFrame( f1, frm1_, mask_ ); - coords_->GetFrame( f2, frm2_, mask_ ); - if (nofit_) - return frm1_.RMSD_NoFit( frm2_, useMass_ ); - else - return frm1_.RMSD( frm2_, useMass_ ); -} - -double ClusterDist_RMS::CentroidDist(Centroid* c1, Centroid* c2) { - if (nofit_) - return ((Centroid_Coord*)c1)->cframe_.RMSD_NoFit( ((Centroid_Coord*)c2)->cframe_, useMass_ ); - else // Centroid is already at origin. - return ((Centroid_Coord*)c1)->cframe_.RMSD_CenteredRef( ((Centroid_Coord*)c2)->cframe_, - useMass_ ); -} - -double ClusterDist_RMS::FrameCentroidDist(int f1, Centroid* c1) { - coords_->GetFrame( f1, frm1_, mask_ ); - if (nofit_) - return frm1_.RMSD_NoFit( ((Centroid_Coord*)c1)->cframe_, useMass_ ); - else // Centroid is already at origin. - return frm1_.RMSD_CenteredRef( ((Centroid_Coord*)c1)->cframe_, useMass_ ); -} - -/** Compute the centroid (avg) coords for each atom from all frames in this - * cluster. If fitting, RMS fit to centroid as it is being built. - */ -void ClusterDist_RMS::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { - Matrix_3x3 Rot; - Vec3 Trans; - Centroid_Coord* cent = (Centroid_Coord*)centIn; - // Reset atom count for centroid. - cent->cframe_.ClearAtoms(); - for (Cframes_it frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) - { - coords_->GetFrame( *frm, frm1_, mask_ ); - if (cent->cframe_.empty()) { - cent->cframe_ = frm1_; - if (!nofit_) - cent->cframe_.CenterOnOrigin(useMass_); - } else { - if (!nofit_) { - frm1_.RMSD_CenteredRef( cent->cframe_, Rot, Trans, useMass_ ); - frm1_.Rotate( Rot ); - } - cent->cframe_ += frm1_; - } - } - cent->cframe_.Divide( (double)cframesIn.size() ); - //mprintf("\t\tFirst 3 centroid coords (of %i): %f %f %f\n", cent->cframe_.Natom(), - // cent->cent->cframe_[0], cent->cframe_[1],cent->cframe_[2]); -} - -Centroid* ClusterDist_RMS::NewCentroid( Cframes const& cframesIn ) { - // TODO: Incorporate mass? - Centroid_Coord* cent = new Centroid_Coord( mask_.Nselected() ); - CalculateCentroid( cent, cframesIn ); - return cent; -} - -// Subtract Notes -// FIXME: Handle single frame -// FIXME: Check if frame is in cluster? -void ClusterDist_RMS::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, - CentOpType OP) -{ - Matrix_3x3 Rot; - Vec3 Trans; - Centroid_Coord* cent = (Centroid_Coord*)centIn; - coords_->GetFrame( frame, frm1_, mask_ ); - if (!nofit_) { - frm1_.RMSD_CenteredRef( cent->cframe_, Rot, Trans, useMass_ ); - frm1_.Rotate( Rot ); - } - cent->cframe_.Multiply( oldSize ); - if (OP == ADDFRAME) { - cent->cframe_ += frm1_; - cent->cframe_.Divide( oldSize + 1 ); - } else { // SUBTRACTFRAME - cent->cframe_ -= frm1_; - cent->cframe_.Divide( oldSize - 1 ); - } -} - -std::string ClusterDist_RMS::Description() const { - std::string description("rms " + mask_.MaskExpression()); - if (nofit_) description.append(" nofit"); - if (useMass_) description.append(" mass"); - return description; -} - -// ---------- Distance calc routines for COORDS DataSets using SRMSD ----------- -ClusterDist_SRMSD::ClusterDist_SRMSD(DataSet* dIn, AtomMask const& maskIn, - bool nofit, bool useMass, int debugIn) : - coords_((DataSet_Coords*)dIn), - mask_(maskIn), - SRMSD_(mask_, !nofit, useMass, coords_->Top(), debugIn) -{ - frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms()); - frm2_ = frm1_; -} - -double ClusterDist_SRMSD::FrameDist(int f1, int f2) { - coords_->GetFrame( f1, frm1_, mask_ ); - coords_->GetFrame( f2, frm2_, mask_ ); - return SRMSD_.SymmRMSD(frm1_, frm2_); -} - -double ClusterDist_SRMSD::CentroidDist(Centroid* c1, Centroid* c2) { - // Centroid is already at origin. - return SRMSD_.SymmRMSD_CenteredRef( ((Centroid_Coord*)c1)->cframe_, - ((Centroid_Coord*)c2)->cframe_ ); -} - -double ClusterDist_SRMSD::FrameCentroidDist(int f1, Centroid* c1) { - coords_->GetFrame( f1, frm1_, mask_ ); - // Centroid is already at origin. - return SRMSD_.SymmRMSD_CenteredRef( frm1_, ((Centroid_Coord*)c1)->cframe_ ); -} - -/** Compute the centroid (avg) coords for each atom from all frames in this - * cluster. If fitting, RMS fit to centroid as it is being built. - */ -void ClusterDist_SRMSD::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { - Matrix_3x3 Rot; - Vec3 Trans; - Centroid_Coord* cent = (Centroid_Coord*)centIn; - // Reset atom count for centroid. - cent->cframe_.ClearAtoms(); - for (Cframes_it frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) - { - coords_->GetFrame( *frm, frm1_, mask_ ); - if (cent->cframe_.empty()) { - cent->cframe_ = frm1_; - if (SRMSD_.Fit()) - cent->cframe_.CenterOnOrigin(SRMSD_.UseMass()); - } else { - SRMSD_.SymmRMSD_CenteredRef( frm1_, cent->cframe_ ); - // Remap atoms - frm2_.SetCoordinatesByMap( frm1_, SRMSD_.AMap() ); - if (SRMSD_.Fit()) { - frm2_.Translate( SRMSD_.TgtTrans() ); - frm2_.Rotate( SRMSD_.RotMatrix() ); - } - cent->cframe_ += frm2_; - } - } - cent->cframe_.Divide( (double)cframesIn.size() ); - //mprintf("\t\tFirst 3 centroid coords (of %i): %f %f %f\n", cent->cframe_.Natom(), - // cent->cent->cframe_[0], cent->cframe_[1],cent->cframe_[2]); -} - -Centroid* ClusterDist_SRMSD::NewCentroid( Cframes const& cframesIn ) { - // TODO: Incorporate mass? - Centroid_Coord* cent = new Centroid_Coord( mask_.Nselected() ); - CalculateCentroid( cent, cframesIn ); - return cent; -} - -void ClusterDist_SRMSD::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, - CentOpType OP) -{ - Matrix_3x3 Rot; - Vec3 Trans; - Centroid_Coord* cent = (Centroid_Coord*)centIn; - coords_->GetFrame( frame, frm1_, mask_ ); - SRMSD_.SymmRMSD_CenteredRef( frm1_, cent->cframe_ ); - // Remap atoms - frm2_.SetCoordinatesByMap( frm1_, SRMSD_.AMap() ); - if (SRMSD_.Fit()) { - frm2_.Translate( SRMSD_.TgtTrans() ); - frm2_.Rotate( SRMSD_.RotMatrix() ); - } - cent->cframe_.Multiply( oldSize ); - if (OP == ADDFRAME) { - cent->cframe_ += frm2_; - cent->cframe_.Divide( oldSize + 1 ); - } else { // SUBTRACTFRAME - cent->cframe_ -= frm2_; - cent->cframe_.Divide( oldSize - 1 ); - } -} - -std::string ClusterDist_SRMSD::Description() const { - std::string description("srmsd " + mask_.MaskExpression()); - if (!SRMSD_.Fit()) description.append(" nofit"); - if (SRMSD_.UseMass()) description.append(" mass"); - return description; -} diff --git a/src/ClusterDist.h b/src/ClusterDist.h deleted file mode 100644 index 5f98311b0c..0000000000 --- a/src/ClusterDist.h +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef INC_CLUSTERDIST_H -#define INC_CLUSTERDIST_H -#include "SymmetricRmsdCalc.h" -#include "DataSet_Coords.h" -#include "DataSet_1D.h" -/// Abstract Base Class for Cluster centroid. -/** This class is a container for the cluster centroid type appropriate for - * the data being clustered. For COORDS DataSets this is a frame, for other - * DataSets this is just a number. Centroid classes must implement a Copy() - * function. - */ -class Centroid { - public: - virtual ~Centroid() {} - virtual Centroid* Copy() = 0; - // TODO: Should centroids remember number of frames that went into them? - // This would make it so FrameOpCentroid wouldnt require extra arg. - virtual void Print(std::string const&) const {} -}; -/// Cluster centroid for generic DataSet. -class Centroid_Num : public Centroid { - public: - Centroid_Num() : cval_(0.0), sumx_(0.0), sumy_(0.0) {} - Centroid_Num(double val, double x, double y) : cval_(val), sumx_(x), sumy_(y) {} - Centroid* Copy() { return (Centroid*)new Centroid_Num(cval_, sumx_, sumy_); } - friend class ClusterDist_Num; - private: - double cval_; - double sumx_; // For storing periodic average - double sumy_; // For storing periodic average -}; -/// Cluster centroid for multiple DataSets -class Centroid_Multi : public Centroid { - public: - typedef std::vector Darray; - Centroid_Multi() {} - Centroid_Multi(Darray const& val, Darray const& x, Darray const& y) : - cvals_(val), Sumx_(x), Sumy_(y) {} - Centroid* Copy() { return (Centroid*)new Centroid_Multi(cvals_, Sumx_, Sumy_); } - friend class ClusterDist_Euclid; - private: - Darray cvals_; - Darray Sumx_; // For storing periodic average - Darray Sumy_; // For storing periodic average -}; -/// Cluster Centroid for Coords DataSet. -class Centroid_Coord : public Centroid { - public: - Centroid_Coord() {} - Centroid_Coord(Frame const& frame) : cframe_(frame) {} - Centroid_Coord(int natom) : cframe_(natom) {} - Centroid* Copy() { return (Centroid*)new Centroid_Coord(cframe_); } - void Print(std::string const&) const; - friend class ClusterDist_DME; - friend class ClusterDist_RMS; - friend class ClusterDist_SRMSD; - private: - Frame cframe_; -}; -// ----------------------------------------------------------------------------- -/// Abstract Base Class for Cluster distance calc. -class ClusterDist { - public: - enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; - /// Used to pass in absolute frame numbers for centroid calculations. - typedef std::vector Cframes; - typedef Cframes::const_iterator Cframes_it; - typedef std::vector DsArray; - virtual ~ClusterDist() {} - /// \return distance between given frames. - virtual double FrameDist(int, int) = 0; - /// \return distance between given centroids. - virtual double CentroidDist( Centroid*, Centroid* ) = 0; - /// \return distance between given frame and centroid. - virtual double FrameCentroidDist(int, Centroid* ) = 0; - /// Calculate centroid from given frames. - virtual void CalculateCentroid(Centroid*, Cframes const&) = 0; - /// \return new centroid from given frames. - virtual Centroid* NewCentroid(Cframes const&) = 0; - /// \return copy of this ClusterDist - virtual ClusterDist* Copy() = 0; - /// Update centroid by performing given operation between given frame and centroid. - virtual void FrameOpCentroid(int, Centroid*, double, CentOpType) = 0; - /// \return string containing description of the distance metric - virtual std::string Description() const = 0; - protected: - typedef double (*DistCalc)(double,double); -}; -/// Cluster distance calc for generic DataSet -class ClusterDist_Num : public ClusterDist { - public: - ClusterDist_Num() : data_(0), dcalc_(0) {} - ClusterDist_Num(DataSet*); - double FrameDist(int, int); - double CentroidDist( Centroid*, Centroid* ); - double FrameCentroidDist(int, Centroid*); - void CalculateCentroid(Centroid*, Cframes const&); - Centroid* NewCentroid(Cframes const&); - void FrameOpCentroid(int, Centroid*, double, CentOpType); - ClusterDist* Copy() { return new ClusterDist_Num( *this ); } - std::string Description() const; - private: - DataSet_1D* data_; - DistCalc dcalc_; -}; -/// Cluster distance calc using Euclid distance -class ClusterDist_Euclid : public ClusterDist { - public: - ClusterDist_Euclid() {} - ClusterDist_Euclid(DsArray const&); - double FrameDist(int, int); - double CentroidDist( Centroid*, Centroid* ); - double FrameCentroidDist(int, Centroid*); - void CalculateCentroid(Centroid*, Cframes const&); - Centroid* NewCentroid(Cframes const&); - void FrameOpCentroid(int, Centroid*, double, CentOpType); - ClusterDist* Copy() { return new ClusterDist_Euclid( *this ); } - std::string Description() const; - private: - typedef std::vector D1Array; - D1Array dsets_; - typedef std::vector DcArray; - DcArray dcalcs_; -}; -/// DME cluster distance calc for Coords DataSet. -class ClusterDist_DME: public ClusterDist { - public: - ClusterDist_DME() : coords_(0) {} - ClusterDist_DME(DataSet*,AtomMask const&); - double FrameDist(int, int); - double CentroidDist( Centroid*, Centroid* ); - double FrameCentroidDist(int, Centroid*); - void CalculateCentroid(Centroid*, Cframes const&); - Centroid* NewCentroid(Cframes const&); - void FrameOpCentroid(int, Centroid*, double, CentOpType); - ClusterDist* Copy() { return new ClusterDist_DME( *this ); } - std::string Description() const; - private: - DataSet_Coords* coords_; - AtomMask mask_; - Frame frm1_; ///< Temporary storage for frames from coords - Frame frm2_; ///< Temporary storage for frames from coords -}; -/// RMS cluster distance calc for Coords DataSet. -class ClusterDist_RMS : public ClusterDist { - public: - ClusterDist_RMS() : coords_(0), nofit_(false), useMass_(false) {} - ClusterDist_RMS(DataSet*,AtomMask const&,bool,bool); - double FrameDist(int, int); - double CentroidDist( Centroid*, Centroid* ); - double FrameCentroidDist(int, Centroid*); - void CalculateCentroid(Centroid*, Cframes const&); - void FrameOpCentroid(int, Centroid*, double, CentOpType); - Centroid* NewCentroid(Cframes const&); - ClusterDist* Copy() { return new ClusterDist_RMS( *this ); } - std::string Description() const; - private: - DataSet_Coords* coords_; - AtomMask mask_; - bool nofit_; - bool useMass_; - Frame frm1_; - Frame frm2_; -}; -/// Symmetry-corrected RMS distance calc for Coords DataSet. -class ClusterDist_SRMSD : public ClusterDist { - public: - ClusterDist_SRMSD() {} - ClusterDist_SRMSD(DataSet*,AtomMask const&,bool,bool,int); - double FrameDist(int, int); - double CentroidDist( Centroid*, Centroid* ); - double FrameCentroidDist(int, Centroid*); - void CalculateCentroid(Centroid*, Cframes const&); - Centroid* NewCentroid(Cframes const&); - void FrameOpCentroid(int, Centroid*, double, CentOpType); - ClusterDist* Copy() { return new ClusterDist_SRMSD( * this ); } - std::string Description() const; - private: - DataSet_Coords* coords_; - AtomMask mask_; - SymmetricRmsdCalc SRMSD_; - Frame frm1_; - Frame frm2_; -}; -#endif diff --git a/src/ClusterList.cpp b/src/ClusterList.cpp deleted file mode 100644 index 0496377642..0000000000 --- a/src/ClusterList.cpp +++ /dev/null @@ -1,1089 +0,0 @@ -#include // DBL_MAX -#include // sqrt -#include -#include // sort -#include // Find best reps -#include "ClusterList.h" -#include "CpptrajStdio.h" -#include "Constants.h" // Pseudo-F -#include "ProgressBar.h" -#include "StringRoutines.h" -#ifdef _OPENMP -# include -#endif -#include "PDBfile.h" // For writing out pseudo-graph - -// XMGRACE colors -const char* ClusterList::XMGRACE_COLOR[] = { - "white", "black", "red", "green", "blue", "yellow", "brown", "grey", "violet", - "cyan", "magenta", "orange", "indigo", "maroon", "turquoise", "darkgreen" -}; - -static const char* MetricStringArray[] = { - "RMSD", "DME", "Symmetry-corrected RMSD", "Data Set(s)" -}; - -const char* ClusterList::MetricString(DistMetricType dm) { - return MetricStringArray[dm]; -} - -// CONSTRUCTOR -ClusterList::ClusterList() : debug_(0), Cdist_(0), frameDistances_(0) {} - -// DESTRUCTOR -ClusterList::~ClusterList() { - if (Cdist_ != 0) delete Cdist_; -} - -// ClusterList::SetDebug() -/** Set the debug level */ -void ClusterList::SetDebug(int debugIn) { - debug_ = debugIn; - if (debug_>0) mprintf("ClusterList debug set to %i\n",debug_); -} - -/** Calculate the distance between the given clusters based on centroids. - * Centroids MUST be up to date. - */ -double ClusterList::ClusterDistance(ClusterNode const& C1, ClusterNode const& C2) const { - if (C1.Cent() == 0 || C2.Cent() == 0) { - mprinterr("Internal Error: One or both centroids are null in ClusterDistance()\n"); - return 0.0; - } - return Cdist_->CentroidDist( C1.Cent(), C2.Cent() ); -} - -// ClusterList::Renumber() -/** Sort clusters by size and renumber starting from 0, where cluster 0 - * is the largest. Also updates cluster centroids and adds back sieved - * frames if necessary. Ensures cluster node frame lists are sorted. - */ -void ClusterList::Renumber(bool addSievedFrames) { - // Update cluster centroids in case they need to be used to restore sieved frames. - for (cluster_it node = clusters_.begin(); node != clusters_.end(); ++node) { - node->SortFrameList(); - node->CalculateCentroid( Cdist_ ); - } - // Add back sieved frames - if (addSievedFrames) { - mprintf("\tRestoring sieved frames.\n"); - AddSievedFrames(); - // Re-sort cluster frame lists and re-calculate centroids including sieved frames. - for (cluster_it node = clusters_.begin(); node != clusters_.end(); ++node) { - node->SortFrameList(); - node->CalculateCentroid( Cdist_ ); - } - } - // Sort clusters by population and renumber. - clusters_.sort( ); - int newNum = 0; - for (cluster_it node = clusters_.begin(); node != clusters_.end(); ++node) - node->SetNum( newNum++ ); -} - -// ----------------------------------------------------------------------------- -/// Used to pair representative score with frame number. -typedef std::pair RepPair; -/// Used to hold pairs of representative scores to frames. -typedef std::multimap RepMap; -/// Save up to maxSize of the best (lowest) representative scores/frames. -void SaveBestRep(RepMap& reps, RepPair const& Dist_Num, unsigned int maxSize) -{ - if (reps.size() < maxSize) - reps.insert( Dist_Num ); - else { - RepMap::reverse_iterator end = reps.rbegin(); - if (Dist_Num.first < end->first) { - reps.insert( Dist_Num ); - if (reps.size() > maxSize) { - RepMap::iterator it = reps.end(); - --it; - reps.erase( it ); - } - } - } -} - -/// Set given cluster node with best representative frames/scores in reps -void SetBestRepFrame(ClusterNode& node, RepMap const& reps) { - if (!reps.empty()) { - node.BestReps().clear(); - for (RepMap::const_iterator it = reps.begin(); it != reps.end(); ++it) { - node.BestReps().push_back( ClusterNode::RepPair(it->second, (float)it->first) ); - } - } -} - -// ClusterList::FindBestRepFrames_CumulativeDist() -/** Find the frame in each cluster that is the best representative by - * having the lowest cumulative distance to every other point in the cluster. - */ -int ClusterList::FindBestRepFrames_CumulativeDist(int nToSave) { - int err = 0; - for (cluster_it node = clusters_.begin(); node != clusters_.end(); ++node) { - //node->Cent()->Print("centroid." + integerToString(node->Num())); // DEBUG - //CpptrajFile tmp; // DEBUG - //tmp.OpenWrite("c"+integerToString(node->Num())+".bestRep.dat"); // DEBUG - RepMap bestReps; - for (ClusterNode::frame_iterator f1 = node->beginframe(); - f1 != node->endframe(); ++f1) - { - double cdist = 0.0; - for (ClusterNode::frame_iterator f2 = node->beginframe(); f2 != node->endframe(); ++f2) - { - if (f1 != f2) - cdist += Frame_Distance(*f1, *f2); - } - SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave); - //tmp.Printf("%i %g %g\n", *f1+1, cdist, Cdist_->FrameCentroidDist(*f1, node->Cent())); - } - //tmp.CloseFile(); - if (bestReps.empty()) { - mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node->Num()); - err++; - } - SetBestRepFrame( *node, bestReps ); - // DEBUG - if (debug_ > 0) { - mprintf("DEBUG: Best reps:\n"); - for (RepMap::const_iterator it = bestReps.begin(); it != bestReps.end(); ++it) - mprintf("\t%i (%g)\n", it->second, it->first); - } - } - return err; -} - -/** Find the frame in each cluster that is the best representative by - * having the lowest cumulative distance to every other point in the cluster, - * ignoring sieved frames. - */ -int ClusterList::FindBestRepFrames_NoSieve_CumulativeDist(int nToSave) { - if (FrameDistances().SieveValue() != 1) - mprintf("Warning: Ignoring sieved frames while looking for best representative.\n"); - int err = 0; - for (cluster_it node = clusters_.begin(); node != clusters_.end(); ++node) { - RepMap bestReps; - for (ClusterNode::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) - { - if (!FrameDistances().FrameWasSieved( *f1 )) { - double cdist = 0.0; - for (ClusterNode::frame_iterator f2 = node->beginframe(); f2 != node->endframe(); ++f2) - { - if (f1 != f2 && !FrameDistances().FrameWasSieved( *f2 )) - cdist += FrameDistances().GetFdist(*f1, *f2); - } - SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave); - } - } - if (bestReps.empty()) { - mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node->Num()); - err++; - } - SetBestRepFrame( *node, bestReps ); - } - return err; -} - -/** Find the frame in the cluster that is the best representative by - * having the lowest distance to the cluster centroid. - */ -int ClusterList::FindBestRepFrames_Centroid(int nToSave) { - int err = 0; - for (cluster_it node = clusters_.begin(); node != clusters_.end(); ++node) { - //mprintf("DEBUG: FindBestRepFrames_Centroid: Cluster %i\n", node->Num()); - RepMap bestReps; - //node->Cent()->Print("centroid." + integerToString(node->Num())); // DEBUG - for (ClusterNode::frame_iterator f1 = node->beginframe(); - f1 != node->endframe(); ++f1) - { - double dist = Cdist_->FrameCentroidDist(*f1, node->Cent()); - //mprintf("\t%8i %10.4g %10.4g %i\n", *f1+1, dist, mindist, minframe+1); - SaveBestRep(bestReps, RepPair(dist, *f1), nToSave); - } - if (bestReps.empty()) { - mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node->Num()); - err++; - } - SetBestRepFrame( *node, bestReps ); - } - return err; -} - -// ----------------------------------------------------------------------------- -// ClusterList::DetermineNameWidth() -unsigned int ClusterList::DetermineNameWidth() const { - // Quick pass through clusters to determine width of cluster names - unsigned int nWidth = 0; - for (cluster_iterator node = begincluster(); node != endcluster(); ++node) - nWidth = std::max(nWidth, (unsigned int)node->Cname().size()); - return nWidth; -} - -// ClusterList::Summary() -/** Print a summary of clusters. */ -void ClusterList::Summary(std::string const& summaryfile, bool includeSieveInAvg) const -{ - CpptrajFile outfile; - double fmax = (double)FrameDistances().OriginalNframes(); - if (outfile.OpenWrite(summaryfile)) { - mprinterr("Error: ClusterList::Summary: Could not set up file.\n"); - return; - } - if (FrameDistances().SieveValue() != 1 && !includeSieveInAvg) - mprintf("Warning: Within cluster average distance (AvgDist) does not include sieved frames.\n"); - outfile.Printf("%-8s %8s %8s %8s %8s","#Cluster","Frames","Frac", - "AvgDist","Stdev"); - if (!clusters_.empty() && clusters_.front().BestReps().size() > 1) { - int nBestReps = clusters_.front().BestReps().size(); - for (int i = 0; i != nBestReps; i++) - outfile.Printf(" %8s %8s", "Rep", "RepScore"); - } else - outfile.Printf(" %8s", "Centroid"); - outfile.Printf(" %8s", "AvgCDist"); - unsigned int nWidth = DetermineNameWidth(); - if (nWidth > 0) { - if (nWidth < 8) nWidth = 8; - outfile.Printf(" %*s %8s", nWidth, "Name", "RMS"); - } - outfile.Printf("\n"); - //Timer t_fdist; // DEBUG - //Timer t_cdist; // DEBUG - //t_cdist.Start(); - // Calculate distances between clusters. - Matrix cluster_distances; - cluster_distances.resize( 0, clusters_.size() ); - for (cluster_iterator c1 = begincluster(); c1 != endcluster(); ++c1) - for (cluster_iterator c2 = c1; c2 != endcluster(); ++c2) - if (c2 != c1) - cluster_distances.addElement( ClusterDistance( *c1, *c2 ) ); - //t_cdist.Stop(); - - unsigned int idx1 = 0; - for (cluster_iterator node = begincluster(); node != endcluster(); ++node, ++idx1) - { - // Calculate the average distance of this cluster to every other cluster. - //t_cdist.Start(); - double avgclusterdist = 0.0; - if (clusters_.size() > 1) { - unsigned int idx2 = 0; - for (cluster_iterator node2 = begincluster(); node2 != endcluster(); ++node2, ++idx2) - { - if (node != node2) - avgclusterdist += cluster_distances.element(idx1, idx2); - } - avgclusterdist /= (double)(clusters_.size() - 1); - //mprintf("CLUSTER %i avgclusterdist= %g\n", node->Num(), avgclusterdist); - } - //t_cdist.Stop(); - // Since there may be a lot of frames do not calculate SD from the - // mean (which requires either storing distances or two double loops), - // instead use SD = sqrt( (SUM[x^2] - ((SUM[x])^2)/N)/N ) - //t_fdist.Start(); - double internalAvg = 0.0; - double internalSD = 0.0; - unsigned int Nelements = 0; - if (node->Nframes() > 1) { - // Calculate average distance between all frames in this cluster. - if (includeSieveInAvg) { - for (ClusterNode::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) { - for (ClusterNode::frame_iterator f2 = f1 + 1; f2 != node->endframe(); ++f2) { - double dist = Frame_Distance(*f1, *f2); - internalAvg += dist; - internalSD += (dist * dist); - ++Nelements; - } - } - } else { - for (ClusterNode::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) { - if (!FrameDistances().FrameWasSieved( *f1 )) { - for (ClusterNode::frame_iterator f2 = f1 + 1; f2 != node->endframe(); ++f2) { - if (!FrameDistances().FrameWasSieved( *f2 )) { - double dist = FrameDistances().GetFdist(*f1, *f2); - internalAvg += dist; - internalSD += (dist * dist); - ++Nelements; - } - } - } - } - } - if (Nelements > 0) { - double norm = 1.0 / ((double)Nelements); - internalAvg *= norm; - internalSD *= norm; - internalSD -= (internalAvg * internalAvg); - if (internalSD > 0.0) - internalSD = sqrt( internalSD ); - else - internalSD = 0.0; - } - //t_fdist.Stop(); - } - // OUTPUT - TODO handle case when clusters dont have same number best reps - outfile.Printf("%8i %8i %8.3f %8.3f %8.3f", - node->Num(), node->Nframes(), (double)node->Nframes()/fmax, - internalAvg, internalSD); - if (node->BestReps().size() < 2) - outfile.Printf(" %8i", node->BestRepFrame()+1); - else { - for (ClusterNode::RepPairArray::const_iterator rep = node->BestReps().begin(); - rep != node->BestReps().end(); ++rep) - outfile.Printf(" %8i %8.3f", rep->first+1, rep->second); - } - outfile.Printf(" %8.3f", avgclusterdist); - if (nWidth > 0) - outfile.Printf(" %*s %8.3f", nWidth, node->Cname().c_str(), node->RefRms()); - outfile.Printf("\n"); - } // END loop over clusters - //t_cdist.WriteTiming(1, "Between-cluster distance calc."); - //t_fdist.WriteTiming(1, "Within-cluster distance calc."); - outfile.CloseFile(); -} - -// ClusterList::Summary_Part -/** Print a summary of clustering for specified portions of the overall traj. - */ -void ClusterList::Summary_Part(std::string const& summaryfile, - std::vector const& splitFrames) const -{ - const char* nExt[] = {"st", "nd", "rd", "th"}; - if (splitFrames.empty()) return; // Sanity check. - CpptrajFile outfile; - double fmax = (double)FrameDistances().OriginalNframes(); - if (outfile.OpenWrite(summaryfile)) { - mprinterr("Error: Could not open file '%s'.\n", summaryfile.c_str()); - return; - } - - // Determine number of frames and traj offset for each part. - outfile.Printf("# 1st"); - std::vector partMax; - partMax.reserve( splitFrames.size() + 1 ); - std::vector trajOffset; - trajOffset.reserve( splitFrames.size() + 1); - trajOffset.push_back( 0 ); - int lastMax = 0; - unsigned int eidx = 1; - for (unsigned int sf = 0; sf < splitFrames.size(); sf++) - { - partMax.push_back( (double)(splitFrames[sf] - lastMax) ); - lastMax = splitFrames[sf]; - trajOffset.push_back( lastMax ); - outfile.Printf(" <= %i < %u%s", trajOffset.back(), sf+2, nExt[eidx]); - if (eidx < 3) ++eidx; - } - partMax.push_back( (double)(FrameDistances().OriginalNframes() - lastMax) ); - outfile.Printf("\n# "); - // Print # of frames in each section - eidx=0; - for (std::vector::const_iterator pm = partMax.begin(); pm != partMax.end(); ++pm) { - if (pm != partMax.begin()) outfile.Printf(" "); - outfile.Printf("%u%s= %.0f", pm - partMax.begin() + 1, nExt[eidx], *pm); - if (eidx < 3) ++eidx; - } - outfile.Printf("\n"); - // DEBUG - //mprintf("DEBUG: # Frames (offset):"); - //std::vector::const_iterator of = trajOffset.begin(); - //for (std::vector::const_iterator it = partMax.begin(); - // it != partMax.end(); ++it, ++of) - // mprintf(" %.0f (%i)", *it, *of); - //mprintf("\n"); - // Set up bins - std::vector numInPart( splitFrames.size() + 1, 0 ); - std::vector firstFrame( splitFrames.size() + 1, -1); - - // Header - outfile.Printf("#%-7s %8s %8s %2s %10s", "Cluster", "Total", "Frac", "C#", "Color"); - eidx = 0; - for (unsigned int pm = 1; pm <= partMax.size(); ++pm) { - outfile.Printf(" %5s%u%2s", "NumIn", pm, nExt[eidx]); - if (eidx < 3) ++eidx; - } - for (unsigned int pm = 1; pm <= partMax.size(); ++pm) - outfile.Printf(" %7s%u", "Frac", pm); - for (unsigned int pm = 1; pm <= partMax.size(); ++pm) - outfile.Printf(" %7s%u", "First", pm); - // Determine if cluster names will be output. - unsigned int nWidth = DetermineNameWidth(); - if (nWidth > 0) { - if (nWidth < 8) nWidth = 8; - outfile.Printf(" %*s %6s", nWidth, "Name", "RMS"); - } - outfile.Printf("\n"); - // LOOP OVER CLUSTERS - int color = 1; // xmgrace color, 1-15 - for (cluster_iterator node = begincluster(); node != endcluster(); ++node) - { - // Calculate size and fraction of total size of this cluster - int numframes = node->Nframes(); - double frac = (double)numframes / fmax; - std::fill( numInPart.begin(), numInPart.end(), 0 ); - std::fill( firstFrame.begin(), firstFrame.end(), -1 ); - // DEBUG - //mprintf("\tCluster %i\n",node->num); - // Count how many frames are in each part. - for (ClusterNode::frame_iterator frame1 = node->beginframe(); - frame1 != node->endframe(); - frame1++) - { - unsigned int bin = splitFrames.size(); - for (unsigned int sf = 0; sf < splitFrames.size(); ++sf) { - if ( *frame1 < splitFrames[sf] ) { - bin = sf; - break; - } - } - if (numInPart[ bin ] == 0) - firstFrame[ bin ] = *frame1 - trajOffset[ bin ] + 1; - ++numInPart[ bin ]; - } - outfile.Printf("%-8i %8i %8.4f %2i %10s", node->Num(), numframes, frac, - color, XMGRACE_COLOR[color]); - for (std::vector::const_iterator np = numInPart.begin(); - np != numInPart.end(); ++np) - outfile.Printf(" %8i", *np); - for (unsigned int pm = 0; pm < partMax.size(); ++pm) - outfile.Printf(" %8.4f", ((double)numInPart[pm]) / partMax[pm]); - for (std::vector::const_iterator ff = firstFrame.begin(); - ff != firstFrame.end(); ++ff) - outfile.Printf(" %8i", *ff); - if (nWidth > 0) - outfile.Printf(" %*s %6.2f", nWidth, node->Cname().c_str(), node->RefRms()); - outfile.Printf("\n"); - if (color<15) ++color; - } - outfile.CloseFile(); -} - -// ClusterList::PrintClustersToFile() -/** Print list of clusters in a style similar to ptraj; each cluster is - * given a line maxframes characters long, with X for each frame that is - * in the clusters and . for all other frames. Also print out the - * representative frame numbers. - */ -void ClusterList::PrintClustersToFile(std::string const& filename) const { - CpptrajFile outfile; - std::string buffer; - - if ( outfile.OpenWrite(filename) ) { - mprinterr("Error: PrintClustersToFile: Could not set up file %s\n", - filename.c_str()); - return; - } - outfile.Printf("#Clustering: %u clusters %i frames\n", - clusters_.size(), FrameDistances().OriginalNframes()); - ComputeDBI( outfile ); - ComputePseudoF( outfile ); - // Call internal info routine. - ClusterResults( outfile ); - // Do not print trajectory stuff if no filename given (i.e. STDOUT output) - if (!filename.empty()) { - for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) - { - buffer.clear(); - buffer.resize(FrameDistances().OriginalNframes(), '.'); - for (ClusterNode::frame_iterator f1 = C1->beginframe(); f1 != C1->endframe(); ++f1) - buffer[ *f1 ] = 'X'; - buffer += '\n'; - outfile.Write((void*)buffer.c_str(), buffer.size()); - } - } - // Print representative frame numbers - outfile.Printf("#Representative frames:"); - for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) - if (C1->BestReps().size() < 2) - outfile.Printf(" %i", C1->BestRepFrame()+1); - else { - outfile.Printf(" {"); - for (ClusterNode::RepPairArray::const_iterator rep = C1->BestReps().begin(); - rep != C1->BestReps().end(); ++rep) - outfile.Printf(" %i %g", rep->first+1, rep->second); - outfile.Printf(" }"); - } - outfile.Printf("\n"); - // Print sieve info if present - if (FrameDistances().SieveValue() != 1) { - if (FrameDistances().SieveValue() < -1) { - outfile.Printf("#Sieve value: %i (random)\n#Sieved frames:", -FrameDistances().SieveValue()); - ClusterSieve::SievedFrames const& sFrames = FrameDistances().FramesToCluster(); - for (ClusterSieve::SievedFrames::const_iterator sfrm = sFrames.begin(); - sfrm != sFrames.end(); ++sfrm) - outfile.Printf(" %i", *sfrm + 1); - outfile.Printf("\n"); - } else - outfile.Printf("#Sieve value: %i\n", FrameDistances().SieveValue()); - } - outfile.CloseFile(); -} - -// ClusterList::PrintClusters() -/** Print list of clusters and frame numbers belonging to each cluster. - */ -void ClusterList::PrintClusters() const { - mprintf("CLUSTER: %u clusters, %u frames.\n", clusters_.size(), - FrameDistances().OriginalNframes() ); - for (cluster_iterator C = begincluster(); C != endcluster(); C++) { - mprintf("\t%8i : ",C->Num()); - for (ClusterNode::frame_iterator fnum = C->beginframe(); - fnum != C->endframe(); ++fnum) - mprintf("%i,",(*fnum)+1); - mprintf("\n"); - } -} - -// ----------------------------------------------------------------------------- -// ClusterList::AddCluster() -/** Add a cluster made up of frames specified by the given list of frames to - * the cluster list. Cluster # is current cluster list size. - */ -int ClusterList::AddCluster( ClusterDist::Cframes const& framelistIn ) { - clusters_.push_back( ClusterNode( Cdist_, framelistIn, clusters_.size() ) ); - return 0; -} - -/** Set up the cluster distance calculation for the given input data sets - * and distance metric type. - */ -int ClusterList::SetupCdist( ClusterDist::DsArray const& dataSets, - DistMetricType metric, bool nofit, bool useMass, - std::string const& maskexpr ) -{ - if (dataSets.empty()) { // SANITY CHECK - mprinterr("Internal Error: SetupCdist: No DataSets given.\n"); - return 1; - } - // Base everything off of the first DataSet - DataSet* dsIn = dataSets[0]; - // Set up internal cluster disance calculation - if (metric != DATA) { - if (dsIn->Group() != DataSet::COORDINATES ) { - mprinterr("Internal Error: Metric is COORDS base but data set is not.\n"); - return 1; - } - // Test that the mask expression is valid - AtomMask testMask( maskexpr ); - Topology const& dsTop = ((DataSet_Coords*)dsIn)->Top(); - if ( dsTop.SetupIntegerMask( testMask ) ) { - mprinterr("Error: Could not set up mask '%s' for topology %s\n", - maskexpr.c_str(), dsTop.c_str()); - return 1; - } - testMask.MaskInfo(); - if (testMask.None()) { - mprinterr("Error: No atoms elected for mask '%s'\n", testMask.MaskString()); - return 1; - } - switch (metric) { - case DME: Cdist_ = new ClusterDist_DME(dsIn, testMask); break; - case RMS: Cdist_ = new ClusterDist_RMS(dsIn, testMask, nofit, useMass); break; - case SRMSD: Cdist_ = new ClusterDist_SRMSD(dsIn, testMask, nofit, useMass, debug_); break; - default: return 1; // Sanity check - } - } else { // Metric is DATA - if (dataSets.size() == 1) - Cdist_ = new ClusterDist_Num(dsIn); - else // TODO: More than just euclid - Cdist_ = new ClusterDist_Euclid(dataSets); - } - if (debug_ > 0) mprintf("DEBUG: ClusterDist= %s\n", Cdist_->Description().c_str()); - return 0; -} - -// ClusterList::CalcFrameDistances() -/** Set the frame pairwise distance matrix from the given data set and - * calculate it if need be. - */ -int ClusterList::CalcFrameDistances(DataSet* pwDistMatrixIn, - ClusterDist::DsArray const& dataSets, - int sieve, int sieveSeed) -{ - if (dataSets.empty()) { // SANITY CHECK - mprinterr("Internal Error: CalcFrameDistances: No DataSets given.\n"); - return 1; - } - if (Cdist_ == 0) { // SANITY CHECK - mprinterr("Internal Error: ClusterDist for given metric not yet allocated.\n"); - return 1; - } - frameDistances_ = (DataSet_Cmatrix*)pwDistMatrixIn; - if ( FrameDistances().NeedsSetup() ) { - // Set up cluster matrix with sieving info. Base total number - // of frames on first DataSet size. - if (frameDistances_->SetupWithSieve( Cdist_, dataSets[0]->Size(), sieve, sieveSeed )) - return 1; - // If cluster matrix needs calculation (i.e. not NOMEM), perform it. - if (FrameDistances().NeedsCalc()) { - mprintf("\tCalculating pair-wise distances.\n"); - ClusterSieve::SievedFrames const& frames = FrameDistances().FramesToCluster(); - int f2end = (int)frames.size(); - int f1end = f2end - 1; - ParallelProgress progress(f1end); - int f1, f2; - // For OMP, every other thread will need its own Cdist. - ClusterDist* MyCdist = Cdist_; -# ifdef _OPENMP -# pragma omp parallel private(MyCdist, f1, f2) firstprivate(progress) - { - int mythread = omp_get_thread_num(); - progress.SetThread( mythread ); - if (mythread == 0) { - mprintf("\tParallelizing pairwise distance calc with %i threads\n", omp_get_num_threads()); - MyCdist = Cdist_; - } else - MyCdist = Cdist_->Copy(); -# pragma omp for schedule(dynamic) -# endif - for (f1 = 0; f1 < f1end; f1++) { - progress.Update(f1); - for (f2 = f1 + 1; f2 < f2end; f2++) - frameDistances_->SetElement( f1, f2, MyCdist->FrameDist(frames[f1], frames[f2]) ); - } -# ifdef _OPENMP - if (mythread > 0) - delete MyCdist; - } // END omp parallel -# endif - progress.Finish(); - } - // Currently this is only for DataSet_Cmatrix_DISK - frameDistances_->Complete(); - } else - // Pairwise distance matrix already set up - mprintf("\tUsing existing pairwise distances from '%s'\n", FrameDistances().legend()); - mprintf("\tMemory used by pair-wise matrix and other cluster data: %s\n", - ByteString(FrameDistances().DataSize(), BYTE_DECIMAL).c_str()); - // DEBUG - Print Frame distances - if (debug_ > 1) { - mprintf("INITIAL FRAME DISTANCES:\n"); - FrameDistances().PrintElements(); - } - return 0; -} - -// ClusterList::RemoveEmptyClusters() -void ClusterList::RemoveEmptyClusters() { - cluster_it cnode = clusters_.begin(); - while (cnode != clusters_.end()) { - if (cnode->Nframes() == 0) - cnode = clusters_.erase( cnode ); - else - ++cnode; - } -} - -// ----------------------------------------------------------------------------- -void ClusterList::AddSievedFramesByCentroid() { - // NOTE: All cluster centroids must be up to date. - int frame; - int nframes = (int)FrameDistances().OriginalNframes(); - double mindist, dist; - cluster_it minNode, Cnode; - ParallelProgress progress( nframes ); - // For OMP, every other thread will need its own Cdist. - ClusterDist* MyCdist = Cdist_; -# ifdef _OPENMP - // For OMP need a temp. array to hold which frame goes to which cluster to avoid clashes - std::vector frameToCluster( nframes, clusters_.end() ); -# pragma omp parallel private(MyCdist, frame, dist, mindist, minNode, Cnode) firstprivate(progress) - { - int mythread = omp_get_thread_num(); - progress.SetThread( mythread ); - if (mythread == 0) { - mprintf("\tParallelizing sieve restore calc with %i threads\n", omp_get_num_threads()); - MyCdist = Cdist_; - } else - MyCdist = Cdist_->Copy(); -# pragma omp for schedule(dynamic) -# endif - for (frame = 0; frame < nframes; ++frame) { - progress.Update( frame ); - if (FrameDistances().FrameWasSieved(frame)) { - // Which clusters centroid is closest to this frame? - mindist = DBL_MAX; - minNode = clusters_.end(); - for (Cnode = clusters_.begin(); Cnode != clusters_.end(); ++Cnode) { - dist = MyCdist->FrameCentroidDist(frame, Cnode->Cent()); - if (dist < mindist) { - mindist = dist; - minNode = Cnode; - } - } - // Add sieved frame to the closest cluster. -# ifdef _OPENMP - frameToCluster[frame] = minNode; -# else - minNode->AddFrameToCluster( frame ); -# endif - } - } // END loop over frames -# ifdef _OPENMP - if (mythread > 0) - delete MyCdist; - } // END pragma omp parallel - // Now actually add sieved frames to their appropriate clusters - for (frame = 0; frame < nframes; frame++) - if (frameToCluster[frame] != clusters_.end()) - (*frameToCluster[frame]).AddFrameToCluster( frame ); -# endif - progress.Finish(); -} - -// ----------------------------------------------------------------------------- -/** The Davies-Bouldin Index (DBI) measures the average similarity between each - * cluster and its most similar one; the smaller the DBI, the better. The DBI - * is defined as the average, for all clusters X, of fred, where fred(X) = max, - * across other clusters Y, of (Cx + Cy)/dXY. Here Cx is the average distance - * from points in X to the centroid, similarly Cy, and dXY is the distance - * between cluster centroids. - * NOTE: To use this, cluster centroids should be fully up-to-date. - */ -double ClusterList::ComputeDBI(CpptrajFile& outfile) const { - std::vector averageDist; - averageDist.reserve( clusters_.size() ); - for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) { - // Calculate average distance to centroid for this cluster - averageDist.push_back( C1->CalcAvgToCentroid( Cdist_ ) ); - if (outfile.IsOpen()) - outfile.Printf("#Cluster %i has average-distance-to-centroid %f\n", - C1->Num(), averageDist.back()); - } - double DBITotal = 0.0; - unsigned int nc1 = 0; - for (cluster_iterator c1 = begincluster(); c1 != endcluster(); ++c1, ++nc1) { - double MaxFred = 0; - unsigned int nc2 = 0; - for (cluster_iterator c2 = begincluster(); c2 != endcluster(); ++c2, ++nc2) { - if (c1 != c2) { - double Fred = averageDist[nc1] + averageDist[nc2]; - Fred /= Cdist_->CentroidDist( c1->Cent(), c2->Cent() ); - if (Fred > MaxFred) - MaxFred = Fred; - } - } - DBITotal += MaxFred; - } - DBITotal /= (double)clusters_.size(); - if (outfile.IsOpen()) outfile.Printf("#DBI: %f\n", DBITotal); - return DBITotal; -} - -/** The pseudo-F statistic is another measure of clustering goodness. It is - * intended to capture the 'tightness' of clusters, and is in essence a ratio - * of the mean sum of squares between groups to the mean sum of squares within - * group (Lattin et al., 2003: 291) High values are good. Generally, one - * selects a cluster-count that gives a peak in the pseudo-f statistic (or - * pSF, for short). - * Formula: A/B, where A = (T - P)/(G-1), and B = P / (n-G). Here n is the - * number of points, G is the number of clusters, T is the total distance from - * the all-data centroid, and P is the sum (for all clusters) of the distances - * from the cluster centroid. - * NOTE: To use this, cluster centroids should be fully up-to-date. - * NOTE: This calc differs slightly from PTRAJ in that real centroids are used - * instead of representative structures. - */ -double ClusterList::ComputePseudoF(CpptrajFile& outfile) const { - // Calculation makes no sense with fewer than 2 clusters. - if (Nclusters() < 2) { - mprintf("Warning: Fewer than 2 clusters. Not calculating pseudo-F.\n"); - return 0.0; - } - - // Form a cluster with all points to get a centroid. Use only frames that - // are in clusters, i.e. ignore noise. Assumes all cluster centroids are - // up to date. - ClusterNode c_all; - for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) - { - for (ClusterNode::frame_iterator f1 = C1->beginframe(); f1 != C1->endframe(); ++f1) - c_all.AddFrameToCluster( *f1 ); - } - // Pseudo-F makes no sense if # clusters == # frames - if (Nclusters() == c_all.Nframes()) { - mprintf("Warning: Each frame is in a separate cluster. Not calculating pseudo-F.\n"); - return 0.0; - } - c_all.SortFrameList(); - c_all.CalculateCentroid( Cdist_ ); - - // Loop over all clusters - double gss = 0.0; // between-group sum of squares - double wss = 0.0; // within-group sum of squares - for (cluster_iterator C1 = begincluster(); C1 != endcluster(); ++C1) - { - for (ClusterNode::frame_iterator f1 = C1->beginframe(); f1 != C1->endframe(); ++f1) - { - double dist = Cdist_->FrameCentroidDist(*f1, c_all.Cent()); - gss += (dist * dist); - dist = Cdist_->FrameCentroidDist(*f1, C1->Cent()); - wss += (dist * dist); - } - } - double d_nclusters = (double)Nclusters(); - double d_ntotal = (double)c_all.Nframes(); - double num = (gss - wss) / (d_nclusters - 1.0); - double den = wss / (d_ntotal - d_nclusters); - if (den < Constants::SMALL) - den = Constants::SMALL; - double pseudof = num / den; - if (debug_ > 0) - mprintf("Pseudo-f: Total distance to centroid is %.4f\n" - "Pseudo-f: Cluster distance to centroid is %.4f\n" - "Pseudo-f: Numerator %.4f over denominator %.4f gives %.4f\n", - gss, wss, num, den, pseudof); - if (outfile.IsOpen()) { - outfile.Printf("#pSF: %f\n", pseudof); - // This calculation taken directly from ptraj - double SSRSST = pseudof*(d_nclusters-1)/(d_ntotal-d_nclusters+pseudof*(d_nclusters-1)); - outfile.Printf("#SSR/SST: %f\n", SSRSST); - } - - return pseudof; -} - -/** The cluster silhouette is a measure of how well each point fits within - * a cluster. Values of 1 indicate the point is very similar to other points - * in the cluster, i.e. it is well-clustered. Values of -1 indicate the point - * is dissimilar and may fit better in a neighboring cluster. Values of 0 - * indicate the point is on a border between two clusters. - */ -void ClusterList::CalcSilhouette(std::string const& prefix, bool includeSieved) const { - mprintf("\tCalculating cluster/frame silhouette.\n"); - if (FrameDistances().SieveValue() != 1 && !includeSieved) - mprintf("Warning: Silhouettes do not include sieved frames.\n"); - CpptrajFile Ffile, Cfile; - if (Ffile.OpenWrite(prefix + ".frame.dat")) return; - if (Cfile.OpenWrite(prefix + ".cluster.dat")) return; - Cfile.Printf("%-8s %10s\n", "#Cluster", ""); - unsigned int idx = 0; - for (cluster_iterator Ci = begincluster(); Ci != endcluster(); ++Ci) - { - Ffile.Printf("#C%-6i %10s\n", Ci->Num(), "Silhouette"); - double avg_si = 0.0; - int ci_frames = 0; - std::vector SiVals; - for (ClusterNode::frame_iterator f1 = Ci->beginframe(); f1 != Ci->endframe(); ++f1) - { - if (includeSieved || !FrameDistances().FrameWasSieved( *f1 )) { - // Calculate the average dissimilarity of this frame with all other - // points in this frames cluster. - double ai = 0.0; - int self_frames = 0; - if (includeSieved) { - for (ClusterNode::frame_iterator f2 = Ci->beginframe(); f2 != Ci->endframe(); ++f2) - { - if (f1 != f2) { - ai += Frame_Distance(*f1, *f2); - ++self_frames; - } - } - } else { - for (ClusterNode::frame_iterator f2 = Ci->beginframe(); f2 != Ci->endframe(); ++f2) - { - if (f1 != f2 && !FrameDistances().FrameWasSieved(*f2)) { - ai += FrameDistances().GetFdist(*f1, *f2); - ++self_frames; - } - } - } - if (self_frames > 0) - ai /= (double)self_frames; - //mprintf("\t\tFrame %i cluster %i ai = %g\n", *f1+1, Ci->Num(), ai); - // Determine lowest average dissimilarity of this frame with all - // other clusters. - double min_bi = DBL_MAX; - for (cluster_iterator Cj = begincluster(); Cj != endcluster(); ++Cj) - { - if (Ci != Cj) - { - double bi = 0.0; - // NOTE: ASSUMING NO EMPTY CLUSTERS - if (includeSieved) { - for (ClusterNode::frame_iterator f2 = Cj->beginframe(); f2 != Cj->endframe(); ++f2) - bi += Frame_Distance(*f1, *f2); - bi /= (double)Cj->Nframes(); - } else { - int cj_frames = 0; - for (ClusterNode::frame_iterator f2 = Cj->beginframe(); f2 != Cj->endframe(); ++f2) - { - if (!FrameDistances().FrameWasSieved(*f2)) { - bi += FrameDistances().GetFdist(*f1, *f2); - ++cj_frames; - } - } - bi /= (double)cj_frames; - } - //mprintf("\t\tFrame %i to cluster %i bi = %g\n", *f1 + 1, Cj->Num(), bi); - if (bi < min_bi) - min_bi = bi; - } - } - double max_ai_bi = std::max( ai, min_bi ); - if (max_ai_bi == 0.0) - mprinterr("Error: Divide by zero in silhouette calculation for frame %i\n", *f1 + 1); - else { - double si = (min_bi - ai) / max_ai_bi; - SiVals.push_back( si ); - //Ffile.Printf("%8i %10.4f\n", *f1 + 1, si); - avg_si += si; - ++ci_frames; - } - } - } // END loop over cluster frames - std::sort( SiVals.begin(), SiVals.end() ); - for (std::vector::const_iterator it = SiVals.begin(); it != SiVals.end(); ++it, ++idx) - Ffile.Printf("%8i %g\n", idx, *it); - Ffile.Printf("\n"); - ++idx; - if (ci_frames > 0) - avg_si /= (double)ci_frames; - Cfile.Printf("%8i %g\n", Ci->Num(), avg_si); - } -} - -// ----------------------------------------------------------------------------- -void ClusterList::DrawGraph(bool use_z, DataSet* cnumvtime, - double min_tol, int max_iteration) const -{ - if (use_z) - mprintf("\tCreating PDB of graph points based on pairwise distances. B-factor = cluster #.\n"); - else - mprintf("\tAttempting to draw graph based on pairwise distances.\n"); - unsigned int nframes = FrameDistances().Nrows(); - std::vector Xarray; // Coords - std::vector Farray; // Forces - Xarray.reserve( nframes ); - Farray.assign( nframes, Vec3(0.0) ); - // Initialize coordinates. X and Y only. - double zcoord = 0.0; - double theta_deg = 0.0; - double delta = 360.0 / (double)nframes; - for (unsigned int n = 0; n != nframes; n++, theta_deg += delta) { - double theta_rad = Constants::DEGRAD * theta_deg; - if (use_z) - zcoord = cos(theta_rad / 2.0); - Xarray.push_back( Vec3(cos(theta_rad), sin(theta_rad), zcoord) ); - } - // Write out initial graph - if (debug_ > 0 && !use_z) { - CpptrajFile graph0; - if (graph0.OpenWrite("InitialGraph.dat")) return; - for (std::vector::const_iterator XV = Xarray.begin(); - XV != Xarray.end(); ++XV) - graph0.Printf("%g %g %u\n", (*XV)[0], (*XV)[1], XV - Xarray.begin() + 1); - graph0.CloseFile(); - } - // Degrees of freedom. If Z ever initialized needs to be 3N - double deg_of_freedom = 2.0 * (double)nframes; - if (use_z) deg_of_freedom += (double)nframes; - double fnq = sqrt( deg_of_freedom ); - // Main loop for steepest descent - const double Rk = 1.0; - const double dxstm = 1.0E-5; - const double crits = 1.0E-6; - double rms = 1.0; - double dxst = 0.1; - double last_e = 0.0; - int iteration = 0; - mprintf(" \t%8s %12s %12s\n", " ", "ENE", "RMS"); - while (rms > min_tol && iteration < max_iteration) { - double e_total = 0.0; - unsigned int idx = 0; // Index into FrameDistances - for (unsigned int f1 = 0; f1 != nframes; f1++) - { - for (unsigned int f2 = f1 + 1; f2 != nframes; f2++) - { - //double Req = FrameDistances().GetCdist(f1, f2); - Vec3 V1_2 = Xarray[f1] - Xarray[f2]; - double r2 = V1_2.Magnitude2(); - double s = sqrt(r2); - double r = 2.0 / s; - double db = s - FrameDistances().GetElement(idx++); - double df = Rk * db; - double e = df * db; - e_total += e; - df *= r; - // Apply force - V1_2 *= df; - Farray[f1] -= V1_2; - Farray[f2] += V1_2; - } - } - // Calculate the magnitude of the force vector. - double sum = 0.0; - for (std::vector::const_iterator FV = Farray.begin(); FV != Farray.end(); ++FV) - sum += FV->Magnitude2(); - rms = sqrt( sum ) / fnq; - // Adjust search step size - if (dxst < crits) dxst = dxstm; - dxst = dxst / 2.0; - if (e_total < last_e) dxst = dxst * 2.4; - double dxsth = dxst / sqrt( sum ); - last_e = e_total; - // Update positions and reset force array. - std::vector::iterator FV = Farray.begin(); - for (std::vector::iterator XV = Xarray.begin(); - XV != Xarray.end(); ++XV, ++FV) - { - *XV += (*FV * dxsth); - *FV = 0.0; - } - // Write out current E. - mprintf("Iteration:\t%8i %12.4E %12.4E\n", iteration, e_total, rms); - iteration++; - } - // RMS error - unsigned int idx = 0; // Index into FrameDistances - double sumdiff2 = 0.0; - for (unsigned int f1 = 0; f1 != nframes; f1++) - { - for (unsigned int f2 = f1 + 1; f2 != nframes; f2++) - { - Vec3 V1_2 = Xarray[f1] - Xarray[f2]; - double r1_2 = sqrt( V1_2.Magnitude2() ); - double Req = FrameDistances().GetElement(idx); - double diff = r1_2 - Req; - sumdiff2 += (diff * diff); - if (debug_ > 0) - mprintf("\t\t%u to %u: D= %g Eq= %g Delta= %g\n", - f1+1, f2+1, r1_2, Req, fabs(diff)); - ++idx; - } - } - double rms_err = sqrt( sumdiff2 / (double)FrameDistances().Nelements() ); - mprintf("\tRMS error of final graph positions: %g\n", rms_err); - // Write out final graph with cluster numbers. - std::vector Nums; - Nums.reserve( nframes ); - if (cnumvtime != 0) { - ClusterSieve::SievedFrames const& sievedFrames = FrameDistances().FramesToCluster(); - DataSet_1D const& CVT = static_cast( *cnumvtime ); - for (unsigned int n = 0; n != nframes; n++) - Nums.push_back( (int)CVT.Dval(sievedFrames[n]) ); - } else - for (int n = 1; n <= (int)nframes; n++) - Nums.push_back( n ); - if (!use_z) { - CpptrajFile graph; - if (graph.OpenWrite("DrawGraph.dat")) return; - for (std::vector::const_iterator XV = Xarray.begin(); - XV != Xarray.end(); ++XV) - graph.Printf("%g %g %i \"%u\"\n", (*XV)[0], (*XV)[1], - Nums[XV - Xarray.begin()], XV - Xarray.begin() + 1); - graph.CloseFile(); - } else { - // Write out PDB with B-factors - PDBfile pdbout; - if (pdbout.OpenWrite("DrawGraph.pdb")) return; - pdbout.WriteTITLE("Cluster points."); - for (std::vector::const_iterator XV = Xarray.begin(); - XV != Xarray.end(); ++XV) - pdbout.WriteCoord(PDBfile::HETATM, XV - Xarray.begin() + 1, "HE", "HE", - XV - Xarray.begin() + 1, (*XV)[0], (*XV)[1], (*XV)[2], - 1.0, Nums[XV - Xarray.begin()], "HE", 0); - pdbout.CloseFile(); - } -} diff --git a/src/ClusterList.h b/src/ClusterList.h deleted file mode 100644 index 3e136a4eb2..0000000000 --- a/src/ClusterList.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef INC_CLUSTERLIST_H -#define INC_CLUSTERLIST_H -#include -#include "ArgList.h" -#include "ClusterNode.h" -// Class: ClusterList -/** This base class holds all the individual clusters, as well as routines - * that can be used to obtain information on clusters after clustering. - */ -// TODO Create ClusterFrameDistance class to hold combined DataSet_Cmatrix and ClusterDist -class ClusterList { - public: - enum DistMetricType { RMS = 0, DME, SRMSD, DATA }; - static const char* MetricString( DistMetricType ); - ClusterList(); - virtual ~ClusterList(); - int Nclusters() const { return (int)clusters_.size(); } - - void SetDebug(int); - /// Add back sieved frames, update centroids, sort by cluster population. - void Renumber(bool); - /// Determine which frame in each cluster is best representative using cumulative distance. - int FindBestRepFrames_CumulativeDist(int); - /// Determine which frame (ignoring sieved) in each cluster is best representative. - int FindBestRepFrames_NoSieve_CumulativeDist(int); - /// Determine which frame in each cluster is best representative by distance to centroid. - int FindBestRepFrames_Centroid(int); - /// Print overall summary of clusters. - void Summary(std::string const&,bool) const; - /// Print summary of clusters separated by parts. - void Summary_Part(std::string const&,std::vector const&) const; - /// Print cluster info. - void PrintClustersToFile(std::string const&) const; - /// DEBUG: Print clusters to STDOUT - void PrintClusters() const; - /// Set up appropriate cluster distance calculation - int SetupCdist( ClusterDist::DsArray const&, DistMetricType, bool, bool, std::string const&); - /// Calculate distances between frames if necessary. - int CalcFrameDistances(DataSet*, ClusterDist::DsArray const&, int, int); - // ----- Inherited by individual clustering methods ---- - /// Process algorithm-specific keywords - virtual int SetupCluster(ArgList&) = 0; - /// Print summary of clustering to be performed - virtual void ClusteringInfo() const = 0; - /// Perform clustering. - virtual int Cluster() = 0; - /// \return distance between given clusters. Default is distance between centroids. - virtual double ClusterDistance(ClusterNode const&, ClusterNode const&) const; -# ifdef TIMER - virtual void Timing(double) const = 0; -# endif - /// Iterator over clusters - typedef std::list::iterator cluster_it; - cluster_it begin() { return clusters_.begin(); } - cluster_it end() { return clusters_.end(); } - /// Const Iterator over clusters - typedef std::list::const_iterator cluster_iterator; - const cluster_iterator begincluster() const { return clusters_.begin(); } - const cluster_iterator endcluster() const { return clusters_.end(); } - /// Remove clusters with no members. - void RemoveEmptyClusters(); - /// Calculate cluster silhouettes - void CalcSilhouette(std::string const&, bool) const; - - void DrawGraph(bool,DataSet*,double,int) const; - protected: - /// Restore sieved frames to clusters - virtual void AddSievedFrames() = 0; - virtual void ClusterResults(CpptrajFile&) const = 0; - - /// \return Distance between specified frames. Use FrameDistances if frames were not sieved. - inline double Frame_Distance(int,int) const; - /// Add each sieved frame to the nearest cluster based on frame to centroid distance. - void AddSievedFramesByCentroid(); - DataSet_Cmatrix const& FrameDistances() const { return *frameDistances_; } - int debug_; - /// Store individual cluster info; frame numbers, centroid, etc. - std::list clusters_; - /// Used to calculate distances between frames and/or centroids. - ClusterDist* Cdist_; - /// Add specified frames to a new cluster. - int AddCluster(ClusterDist::Cframes const&); - private: - static const char* XMGRACE_COLOR[]; - /// Determine max name width - unsigned int DetermineNameWidth() const; - /// Calculate the Davies-Bouldin index of clusters. Centroids must be up-to-date. - double ComputeDBI(CpptrajFile&) const; - /// Calculate pseudo-F statistic. - double ComputePseudoF(CpptrajFile&) const; - - /// Hold pointer to matrix containing distances between each frame. - DataSet_Cmatrix* frameDistances_; -}; -// ----- INLINE FUNCTIONS ------------------------------------------------------ -double ClusterList::Frame_Distance(int f1, int f2) const { - if (FrameDistances().FrameWasSieved(f1) || - FrameDistances().FrameWasSieved(f2)) - return Cdist_->FrameDist(f1, f2); - else - return FrameDistances().GetFdist(f1, f2); -} -#endif diff --git a/src/ClusterMatrix.cpp b/src/ClusterMatrix.cpp deleted file mode 100644 index ccd3258122..0000000000 --- a/src/ClusterMatrix.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include // FLT_MAX -#include "ClusterMatrix.h" -#include "CpptrajStdio.h" // PrintElements -#ifdef _OPENMP -# include -#endif - -// ClusterMatrix::FindMin() -/** Find the minimum not being ignored; set corresponding row and column. */ -#ifdef _OPENMP -double ClusterMatrix::FindMin(int& iOut, int& jOut) { - int row, mythread; - int nrows = (int)Mat_.Nrows(); -# pragma omp parallel private(row, mythread) - { - mythread = omp_get_thread_num(); - minVal_[mythread] = FLT_MAX; -# pragma omp for schedule(dynamic) - for (row = 0; row < nrows; row++) { - if (!ignore_[row]) { - int col = row + 1; - unsigned int idx = Mat_.CalcIndex(col, row); /// idx is start of this row - for (; col != nrows; col++, idx++) { - if (!ignore_[col]) { - if (Mat_[idx] < minVal_[mythread]) { - minVal_[mythread] = Mat_[idx]; - minRow_[mythread] = row; - minCol_[mythread] = col; - } - } - } - } - } - } /* END pragma omp parallel */ - float min = minVal_[0]; - iOut = minRow_[0]; - jOut = minCol_[0]; - for (unsigned int idx = 1; idx != minVal_.size(); idx++) { - if (minVal_[idx] < min) { - min = minVal_[idx]; - iOut = minRow_[idx]; - jOut = minCol_[idx]; - } - } - return (double)min; -} -#else -double ClusterMatrix::FindMin(int& iOut, int& jOut) const { - float min = FLT_MAX; - for (unsigned int row = 0; row != Mat_.Nrows(); row++) { - if (!ignore_[row]) { - unsigned int col = row + 1; - unsigned int idx = Mat_.CalcIndex(col, row); // idx is start of this row - for (; col != Mat_.Ncols(); col++, idx++) { - if (!ignore_[col] && Mat_[idx] < min) { - min = Mat_[idx]; - iOut = (int)row; - jOut = (int)col; - } - } - } - } - return (double)min; -} -#endif - -void ClusterMatrix::PrintElements() const { - unsigned int iVal = 0; - unsigned int jVal = 1; - for (size_t idx = 0UL; idx < Mat_.size(); ++idx) { - if (!ignore_[iVal] && !ignore_[jVal]) - mprintf("\t%u %u %f\n",iVal,jVal,Mat_[idx]); - // Increment indices - jVal++; - if (jVal >= ignore_.size()) { - iVal++; - jVal = iVal + 1; - } - } -} - -// ClusterMatrix::SetupMatrix() -int ClusterMatrix::SetupMatrix(size_t sizeIn) { - if (Mat_.resize( 0L, sizeIn )) return 1; - ignore_.assign( sizeIn, false ); -# ifdef _OPENMP - int n_threads = 0; -# pragma omp parallel - { - if (omp_get_thread_num() == 0) - n_threads = omp_get_num_threads(); - } - minRow_.resize( n_threads ); - minCol_.resize( n_threads ); - minVal_.resize( n_threads ); -# endif - return 0; -} diff --git a/src/ClusterMatrix.h b/src/ClusterMatrix.h deleted file mode 100644 index cf5b3f2f2a..0000000000 --- a/src/ClusterMatrix.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef INC_CLUSTERMATRIX_H -#define INC_CLUSTERMATRIX_H -#include -#include "Matrix.h" -/// Used to hold distances between clusters. -class ClusterMatrix { - public: - ClusterMatrix() {} - /// Indicate given row/col should be ignored. - void Ignore(int row) { ignore_[row] = true; } - /// \return true if given row/col has been ignored. - bool IgnoringRow(int row) const { return ignore_[row]; } - /// \return Original number of rows in matrix - size_t Nrows() const { return Mat_.Nrows(); } - /// Set the row and column of the smallest element not being ignored. -# ifdef _OPENMP - double FindMin(int&, int&); -# else - double FindMin(int&, int&) const; -# endif - /// \return an element. - inline double GetCdist(int c, int r) const { return Mat_.element(c,r); } - /// Print all matrix elements to STDOUT - void PrintElements() const; - /// Add given element to matrix. - int AddCdist(double d) { return Mat_.addElement((float)d); } - /// Set element at column/row to given value - void SetCdist(int col, int row, double val) { Mat_.setElement(col, row, val); } - /// Set up matrix for given number of rows - int SetupMatrix(size_t); - private: - Matrix Mat_; ///< Upper-triangle matrix holding cluster distances. - std::vector ignore_; ///< If true, ignore the row/col when printing/searching etc. -# ifdef _OPENMP - std::vector minRow_; - std::vector minCol_; - std::vector minVal_; -# endif -}; -#endif diff --git a/src/ClusterNode.cpp b/src/ClusterNode.cpp deleted file mode 100644 index ead9b16ddc..0000000000 --- a/src/ClusterNode.cpp +++ /dev/null @@ -1,148 +0,0 @@ -#include // DBL_MAX -#include // sort -#include "ClusterNode.h" - -// CONSTRUCTOR -ClusterNode::ClusterNode() : - eccentricity_(0), - num_(0), - centroid_(0) -{} - -// DESTRUCTOR -ClusterNode::~ClusterNode() { - if (centroid_ != 0) delete centroid_; -} - -/** Create new cluster with given number containing given frames. Calculate - * initial centroid and set initial best rep frame to front, even though - * that will probably be wrong when number of frames in the list > 1. - */ -ClusterNode::ClusterNode(ClusterDist* Cdist, ClusterDist::Cframes const& frameListIn, int numIn) : - eccentricity_(0.0), - num_(numIn), - bestReps_(1, RepPair(frameListIn.front(), 0.0)), - frameList_(frameListIn), - centroid_(Cdist->NewCentroid(frameList_)) -{} - -// COPY CONSTRUCTOR -ClusterNode::ClusterNode(const ClusterNode& rhs) : - eccentricity_( rhs.eccentricity_ ), - num_( rhs.num_ ), - bestReps_( rhs.bestReps_ ), - frameList_( rhs.frameList_ ), - centroid_(0) -{ - if (rhs.centroid_ != 0) - centroid_ = rhs.centroid_->Copy(); -} - -// ASSIGNMENT -ClusterNode& ClusterNode::operator=(const ClusterNode& rhs) { - if (&rhs == this) return *this; - eccentricity_ = rhs.eccentricity_; - num_ = rhs.num_; - bestReps_ = rhs.bestReps_; - frameList_ = rhs.frameList_; - if (centroid_ != 0) delete centroid_; - if (rhs.centroid_ != 0) - centroid_ = rhs.centroid_->Copy(); - else - centroid_ = 0; - return *this; -} - -/** Find the frame in the given cluster that is the best representative via - * having the lowest cumulative distance to every other point in the cluster. - * Should NOT be used if cluster contains sieved frames. - * \return best representative frame number, or -1 on error. - */ -/* -int ClusterNode::SetBestRep_CumulativeDist(DataSet_Cmatrix const& FrameDistancesIn) { - double mindist = DBL_MAX; - int minframe = -1; - for (frame_iterator frm1 = frameList_.begin(); frm1 != frameList_.end(); ++frm1) - { - double cdist = 0.0; - for (frame_iterator frm2 = frameList_.begin(); frm2 != frameList_.end(); ++frm2) - { - if (frm1 != frm2) - cdist += FrameDistancesIn.GetFdist(*frm1, *frm2); - } - if (cdist < mindist) { - mindist = cdist; - minframe = *frm1; - } - } - if (minframe == -1) - return -1; - repFrame_ = minframe; - return minframe; -}*/ - -/** Calculate the eccentricity of this cluster (i.e. the largest distance - * between any two points in the cluster). - */ -void ClusterNode::CalcEccentricity(DataSet_Cmatrix const& FrameDistancesIn) { - double maxdist = 0.0; - frame_iterator frame1_end = frameList_.end(); - --frame1_end; - for (frame_iterator frm1 = frameList_.begin(); frm1 != frameList_.end(); ++frm1) - { - frame_iterator frm2 = frm1; - ++frm2; - for (; frm2 != frameList_.end(); ++frm2) { - double fdist = FrameDistancesIn.GetFdist(*frm1, *frm2); - if (fdist > maxdist) - maxdist = fdist; - } - } - eccentricity_ = maxdist; -} - -/** Calculate average distance between all members in cluster and - * the centroid. - */ -double ClusterNode::CalcAvgToCentroid( ClusterDist* Cdist ) const -{ - double avgdist = 0.0; - //int idx = 0; // DEBUG - //mprintf("AVG DISTANCES FOR CLUSTER %d:\n", Num()); // DEBUG - for (frame_iterator frm = frameList_.begin(); frm != frameList_.end(); ++frm) - { - double dist = Cdist->FrameCentroidDist( *frm, centroid_ ); - //mprintf("\tDist to %i is %f\n", idx++, dist); // DEBUG - avgdist += dist; - } - return ( avgdist / (double)frameList_.size() ); -} - -void ClusterNode::SortFrameList() { - std::sort(frameList_.begin(), frameList_.end()); -} - -// ClusterNode::HasFrame() -bool ClusterNode::HasFrame(int frame) const { - ClusterDist::Cframes::const_iterator it = std::find(frameList_.begin(), frameList_.end(), frame); - return !(it == frameList_.end()); -} - -// ClusterNode::RemoveFrameFromCluster() -void ClusterNode::RemoveFrameFromCluster(int frame) { - ClusterDist::Cframes::iterator pend = std::remove( frameList_.begin(), frameList_.end(), frame); - size_t newsize = pend - frameList_.begin(); - frameList_.resize( newsize ); -} - -void ClusterNode::RemoveFrameUpdateCentroid(ClusterDist* Cdist, int frame) { - Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), - ClusterDist::SUBTRACTFRAME); - RemoveFrameFromCluster( frame ); -} - -void ClusterNode::AddFrameUpdateCentroid(ClusterDist* Cdist, int frame) { - Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), - ClusterDist::ADDFRAME); - AddFrameToCluster( frame ); -} diff --git a/src/ClusterNode.h b/src/ClusterNode.h deleted file mode 100644 index 0cf4ff2f69..0000000000 --- a/src/ClusterNode.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef INC_CLUSTERNODE_H -#define INC_CLUSTERNODE_H -#include "ClusterDist.h" -#include "DataSet_Cmatrix.h" -/// Hold information for a cluster in a ClusterList -class ClusterNode { - public: - ClusterNode(); - ~ClusterNode(); - ClusterNode(ClusterDist*,ClusterDist::Cframes const&, int); - ClusterNode(const ClusterNode&); - ClusterNode& operator=(const ClusterNode&); - /// Used to pair a representative frame number with a score. - typedef std::pair RepPair; - /// Used to hold a list of representative frames/scores - typedef std::vector RepPairArray; - /// Used to sort clusters by # of frames in cluster - inline bool operator<(const ClusterNode&) const; - /// Merge frames from another cluster to this cluster - inline void MergeFrames(ClusterNode const&); - /// Find and set frame in the cluster that has lowest distance to all other frames. -// int SetBestRep_CumulativeDist(DataSet_Cmatrix const&); - /// Calculate eccentricity for frames in this cluster. - void CalcEccentricity(DataSet_Cmatrix const&); - /// Calculate centroid of members of this cluster. - void CalculateCentroid(ClusterDist* Cdist) { - // FIXME: Could potentially get rid of this branch. - if (centroid_ == 0) - centroid_ = Cdist->NewCentroid( frameList_ ); - else - Cdist->CalculateCentroid( centroid_, frameList_ ); - } - /// Calculate average distance of all members to centroid - double CalcAvgToCentroid( ClusterDist*) const; - // Iterator over frame numbers - typedef ClusterDist::Cframes::const_iterator frame_iterator; - frame_iterator beginframe() const { return frameList_.begin(); } - frame_iterator endframe() const { return frameList_.end(); } - /// \return Frame number at given index. - int ClusterFrame(int idx) const { return frameList_[idx]; } - /// \return cluster eccentricity - double Eccentricity() const { return eccentricity_; } - /// \return internal cluster number - int Num() const { return num_; } - /// \return number of frames in cluster. - int Nframes() const { return (int)frameList_.size(); } - /// \return best representative frame number, or -1 if no best rep set. - int BestRepFrame() const { - if (bestReps_.empty()) - return -1; - else - return bestReps_.front().first; - } - Centroid* Cent() const { return centroid_; } - std::string const& Cname() const { return name_; } - double RefRms() const { return refRms_; } - // Set internal variables - void AddFrameToCluster(int fnum) { frameList_.push_back( fnum ); } - void SetNum(int numIn) { num_ = numIn; } - /// Access representative frame list - RepPairArray const& BestReps() const { return bestReps_; } - RepPairArray& BestReps() { return bestReps_; } - inline void SetNameAndRms(std::string const&, double); - /// Sort internal frame list - void SortFrameList(); - /// \return true if given frame is in this cluster. - bool HasFrame(int) const; - /// Remove specified frame from cluster if present. - void RemoveFrameFromCluster(int); - /// Remove specified frame from cluster and update centroid. - void RemoveFrameUpdateCentroid(ClusterDist*, int); - /// Add specified frame to cluster and update centroid. - void AddFrameUpdateCentroid(ClusterDist*, int); - private: - double eccentricity_; ///< Maximum distance between any 2 frames. - double refRms_; ///< Cluster rms to reference (if assigned) - int num_; ///< Cluster number. - RepPairArray bestReps_; ///< List of best representative frames with scores. - ClusterDist::Cframes frameList_; ///< List of frames belonging to this cluster. - Centroid* centroid_; ///< Centroid of all frames in this cluster. - std::string name_; ///< Cluster name assigned from reference. -}; -// ----- INLINE FUNCTIONS ------------------------------------------------------ -/** Use > since we give higher priority to larger clusters. */ -bool ClusterNode::operator<(const ClusterNode& rhs) const { - return ( frameList_.size() > rhs.frameList_.size() ); -} -/** Frames from rhs go to this cluster. */ -void ClusterNode::MergeFrames( ClusterNode const& rhs) { - frameList_.insert(frameList_.end(), rhs.frameList_.begin(), rhs.frameList_.end()); -} - -void ClusterNode::SetNameAndRms(std::string const& nameIn, double rmsIn) { - name_ = nameIn; - refRms_ = rmsIn; -} -#endif diff --git a/src/ClusterSieve.cpp b/src/ClusterSieve.cpp deleted file mode 100644 index d046b15189..0000000000 --- a/src/ClusterSieve.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "ClusterSieve.h" -#include "Random.h" - -// CONSTRUCTOR -ClusterSieve::ClusterSieve() : type_(NONE), sieve_(1), actualNframes_(0) {} - -void ClusterSieve::Clear() { - frameToIdx_.clear(); - type_ = NONE; - sieve_ = 1; - actualNframes_ = 0; -} - -inline void ClusterSieve::DetermineTypeFromSieve( int sieveIn ) { - sieve_ = sieveIn; - // Determine sieve type from sieve value. - if (sieve_ < -1) - type_ = RANDOM; - else if (sieve_ < 2) { - type_ = NONE; - sieve_ = 1; - } else - type_ = REGULAR; -} - -// ClusterSieve::SetSieve() -int ClusterSieve::SetSieve(int sieveIn, size_t maxFrames, int iseed) { - if (maxFrames < 1) return 1; - DetermineTypeFromSieve( sieveIn ); - frameToIdx_.clear(); - if (type_ == NONE) - { // No sieving; frame == index - frameToIdx_.reserve( maxFrames ); - for (unsigned int i = 0; i < maxFrames; i++) - frameToIdx_.push_back( i ); - actualNframes_ = (int)maxFrames; - } - else if (type_ == REGULAR) - { // Regular sieveing; index = frame / sieve - frameToIdx_.assign( maxFrames, -1 ); - int idx = 0; - for (unsigned int i = 0; i < maxFrames; i += sieve_) - frameToIdx_[i] = idx++; - actualNframes_ = idx; - } - else if (type_ == RANDOM) - { // Random sieving; maxframes / sieve random indices - frameToIdx_.assign( maxFrames, -1 ); - double dmax = (double)maxFrames; - Random_Number random; - random.rn_set( iseed ); - for (unsigned int i = 0; i < maxFrames; i -= sieve_) - { - bool frame_generated = false; - // Pick until we pick a frame that has not yet been selected. - while (!frame_generated) { - double dframe = dmax * random.rn_gen(); - int iframe = (int)dframe; - if (frameToIdx_[iframe] == -1) { - frameToIdx_[iframe] = 1; - frame_generated = true; - } - } - } - // Put indices in order - int idx = 0; - for (unsigned int i = 0; i < maxFrames; i++) - if (frameToIdx_[i] == 1) - frameToIdx_[i] = idx++; - actualNframes_ = idx; - } - MakeIdxToFrame(); - return 0; -} - -// ClusterSieve::SetSieve() -int ClusterSieve::SetSieve(int sieveIn, std::vector const& sieveStatus) { - DetermineTypeFromSieve( sieveIn ); - if (sieveStatus.empty()) return 1; - frameToIdx_.clear(); - frameToIdx_.assign( sieveStatus.size(), -1 ); - unsigned int idx = 0; - for (unsigned int frame = 0; frame < sieveStatus.size(); ++frame) - { - if ( sieveStatus[frame] == 'F' ) - frameToIdx_[frame] = idx++; - } - actualNframes_ = (int)idx; - MakeIdxToFrame(); - return 0; -} - -// ClusterSieve::MakeIdxToFrame() -void ClusterSieve::MakeIdxToFrame() { - idxToFrame_.clear(); - idxToFrame_.reserve( actualNframes_ ); - for (unsigned int frame = 0; frame != frameToIdx_.size(); frame++) - { - if (frameToIdx_[frame] != -1) - idxToFrame_.push_back( frame ); - } -} - -size_t ClusterSieve::DataSize() const { - return ( sizeof(type_) + sizeof(int) + - (frameToIdx_.capacity()*sizeof(int) + sizeof(frameToIdx_)) + - (idxToFrame_.capacity()*sizeof(int) + sizeof(idxToFrame_)) ); -} diff --git a/src/ClusterSieve.h b/src/ClusterSieve.h deleted file mode 100644 index 11c42e8277..0000000000 --- a/src/ClusterSieve.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef INC_CLUSTERSIEVE_H -#define INC_CLUSTERSIEVE_H -#include -#include -/// Used to map actual frame numbers to ClusterMatrix internal indices. -class ClusterSieve { - public: - enum SieveType { NONE=0, REGULAR, RANDOM }; - typedef std::vector SievedFrames; - ClusterSieve(); - void Clear(); - /// Setup no sieve, regular sieve, or random sieve. - int SetSieve(int, size_t, int); - /// Setup sieve from array: 'T'=sieved, 'F'=not sieved. - int SetSieve(int, std::vector const&); - /// \return array of frames that will actually be clustered. - SievedFrames const& Frames() const { return idxToFrame_; } - /// \return size of data in bytes - size_t DataSize() const; - /// \return an array index corresponding to a sieved frame. - inline int FrameToIdx(int frame) const { return frameToIdx_[frame]; } - /// \return frame number correspnding to array index. - inline int IdxToFrame(int idx) const { return idxToFrame_[idx]; } - /// \return Original max number of frames. - inline size_t MaxFrames() const { return frameToIdx_.size(); } - /// \return Actual number of frames after sieving. - inline int ActualNframes() const { return actualNframes_; } - /// \return Sieve value. - inline int Sieve() const { return sieve_; } - /// \return Sieve type. - inline SieveType Type() const { return type_; } - private: - inline void DetermineTypeFromSieve(int); - void MakeIdxToFrame(); - SieveType type_; ///< Sieve type. - int sieve_; ///< Sieve value; > 1 is regular, < -1 is random. - int actualNframes_; ///< Actual number of frames after sieving. - std::vector frameToIdx_; ///< Frame number to matrix index; -1 if frame was sieved out. - std::vector idxToFrame_; ///< Matrix index to frame number (size: actualNframes_). -}; -#endif diff --git a/src/Cluster_DBSCAN.cpp b/src/Cluster_DBSCAN.cpp deleted file mode 100644 index 7cc1ae3dd1..0000000000 --- a/src/Cluster_DBSCAN.cpp +++ /dev/null @@ -1,417 +0,0 @@ -#include // DBL_MAX -#include // sort -#include "Cluster_DBSCAN.h" -#include "CpptrajStdio.h" -#include "ProgressBar.h" -#include "StringRoutines.h" // integerToString -#ifdef _OPENMP -# include -#endif -#include "DataSet_MatrixDbl.h" // DEBUG -#include "DataFile.h" // DEBUG - -// CONSTRUCTOR -Cluster_DBSCAN::Cluster_DBSCAN() : - minPoints_(-1), - epsilon_(-1.0), - sieveToCentroid_(true) -{} - -// Cluster_DBSCAN::Help() -void Cluster_DBSCAN::Help() { - mprintf("\t[dbscan minpoints epsilon [sievetoframe] [kdist [kfile ]]]\n"); -} - -// Cluster_DBSCAN::SetupCluster() -int Cluster_DBSCAN::SetupCluster(ArgList& analyzeArgs) { - kdist_.SetRange(analyzeArgs.GetStringKey("kdist")); - if (kdist_.Empty()) { - minPoints_ = analyzeArgs.getKeyInt("minpoints", -1); - if (minPoints_ < 1) { - mprinterr("Error: DBSCAN requires minimum # of points to be set and >= 1\n" - "Error: Use 'minpoints '\n"); - return 1; - } - epsilon_ = analyzeArgs.getKeyDouble("epsilon", -1.0); - if (epsilon_ <= 0.0) { - mprinterr("Error: DBSCAN requires epsilon to be set and > 0.0\n" - "Error: Use 'epsilon '\n"); - return 1; - } - sieveToCentroid_ = !analyzeArgs.hasKey("sievetoframe"); - } else { - k_prefix_ = analyzeArgs.GetStringKey("kfile"); - if (!k_prefix_.empty() && k_prefix_.at(k_prefix_.size()-1) != '/') - k_prefix_ += '/'; - } - return 0; -} - -// Cluster_DBSCAN::ClusteringInfo() -void Cluster_DBSCAN::ClusteringInfo() const { - mprintf("\tDBSCAN:\n"); - if (!kdist_.Empty()) { - mprintf("\t\tOnly calculating Kdist graph for K=%s\n", kdist_.RangeArg()); - if (!k_prefix_.empty()) mprintf("\t\tKdist file prefix: %s\n", k_prefix_.c_str()); - } else { - mprintf("\t\tMinimum pts to form cluster= %i\n", minPoints_); - mprintf("\t\tCluster distance criterion= %.3f\n", epsilon_); - if (sieveToCentroid_) - mprintf("\t\tSieved frames will be added back solely based on their\n" - "\t\t closeness to cluster centroids.\n" - "\t\t (This option is less accurate but faster.)\n"); - else - mprintf("\t\tSieved frames will only be added back if they are within\n" - "\t\t %.3f of a frame in an existing cluster.\n" - "\t\t (This option is more accurate and will identify sieved\n" - "\t\t frames as noise but is slower.)\n", epsilon_); - } -} - -// Potential statuses if not in cluster -#define UNCLASSIFIED -2 -#define NOISE -1 - -// Cluster_DBSCAN::Cluster() -int Cluster_DBSCAN::Cluster() { - // Check if only need to calculate Kdist function(s) - if (!kdist_.Empty()) { - if (kdist_.Size() == 1) - ComputeKdist( kdist_.Front(), FrameDistances().FramesToCluster() ); - else - ComputeKdistMap( kdist_, FrameDistances().FramesToCluster() ); - return 0; - } - // Actual clustering - unsigned int nPtsToCluster = FrameDistances().FramesToCluster().size(); - // SetOfPoints is UNCLASSIFIED - Status_.assign( nPtsToCluster, UNCLASSIFIED ); - int ClusterId = 0; - ProgressBar progress( nPtsToCluster ); - for (unsigned int idx = 0; idx != nPtsToCluster; idx++) - { - progress.Update(idx); - //Point := SetOfPoints.get(i); - //IF Point.ClId = UNCLASSIFIED THEN - if ( Status_[idx] == UNCLASSIFIED ) - { - //IF ExpandCluster(SetOfPoints, Point, ClusterId, Eps, MinPts) THEN - if (ExpandCluster(idx, ClusterId)) - //ClusterId := nextId(ClusterId) - ClusterId++; - } - } - // Create clusters based on point statuses - if (ClusterId > 0) { - std::vector C0( ClusterId ); - for (unsigned int idx = 0; idx != Status_.size(); idx++) - { - int cnum = Status_[idx]; - if (cnum == UNCLASSIFIED) - mprintf("Warning: point %u was unclassified.\n", idx); - else if (cnum != NOISE) // Make sure to store actual frame #s - C0[ cnum ].push_back( FrameDistances().FramesToCluster()[idx] ); - } - // Add clusters. - for (unsigned int cnum = 0; cnum != C0.size(); cnum++) - AddCluster( C0[cnum] ); - } - return 0; -} - -// Cluster_DBSCAN::ExpandCluster() -bool Cluster_DBSCAN::ExpandCluster(unsigned int point, int ClusterId) -{ - //seeds:=SetOfPoints.regionQuery(Point,Eps); - RegionQuery(seeds_, point); - - //IF seeds.size Empty DO - unsigned int endIdx = seeds_.size(); - for (unsigned int idx = 0; idx < endIdx; idx++) - { - //currentP := seeds.first(); - int otherpoint = seeds_[idx]; - //result := SetOfPoints.regionQuery(currentP, Eps); - RegionQuery(result_, otherpoint); - //IF result.size >= MinPts THEN - if ( (int)result_.size() >= minPoints_ ) - { - //FOR i FROM 1 TO result.size DO - // resultP := result.get(i); - // IF resultP.ClId IN {UNCLASSIFIED, NOISE} THEN - // IF resultP.ClId = UNCLASSIFIED THEN - // seeds.append(resultP); - // END IF; - // SetOfPoints.changeClId(resultP,ClId); - // END IF; // UNCLASSIFIED or NOISE - //END FOR; - for (Iarray::const_iterator rt = result_.begin(); rt != result_.end(); ++rt) - { - if (Status_[*rt] == UNCLASSIFIED || Status_[*rt] == NOISE) - { - if (Status_[*rt] == UNCLASSIFIED) - { - seeds_.push_back( *rt ); - endIdx = seeds_.size(); - } - Status_[*rt] = ClusterId; - } - } - } - //END IF; // result.size >= MinPts - //seeds.delete(currentP); - } - //END WHILE; // seeds <> Empty - return true; - } -} - -// Cluster_DBSCAN::RegionQuery() -void Cluster_DBSCAN::RegionQuery(Iarray& NeighborPts, int point) const -{ - NeighborPts.clear(); - // point and otherpoint are indices, not frame #s - int f1 = FrameDistances().FramesToCluster()[ point ]; - for (int otherpoint = 0; otherpoint < (int)Status_.size(); ++otherpoint) - { - if (point != otherpoint) { - int f2 = FrameDistances().FramesToCluster()[ otherpoint ]; - if ( FrameDistances().GetFdist(f1, f2) < epsilon_ ) - NeighborPts.push_back( otherpoint ); - } - } -} - -// Cluster_DBSCAN::ClusterResults() -void Cluster_DBSCAN::ClusterResults(CpptrajFile& outfile) const { - outfile.Printf("#Algorithm: DBSCAN minpoints %i epsilon %g sieveToCentroid %i\n", - minPoints_, epsilon_, (int)sieveToCentroid_); - // List the number of noise points. - outfile.Printf("#NOISE_FRAMES:"); - unsigned int numNoise = 0; - for (unsigned int idx = 0; idx != Status_.size(); ++idx) - { - if ( Status_[idx] == NOISE ) { - outfile.Printf(" %u", FrameDistances().FramesToCluster()[idx]+1); - ++numNoise; - } - } - outfile.Printf("\n"); - outfile.Printf("#Number_of_noise_frames: %u\n", numNoise); -} - -// Cluster_DBSCAN::AddSievedFrames() -void Cluster_DBSCAN::AddSievedFrames() { - // NOTE: All cluster centroids must be up to date! - if (sieveToCentroid_) - mprintf("\tRestoring sieved frames if within %.3f of cluster centroid.\n", epsilon_); - else - mprintf("\tRestoring sieved frames if within %.3f of frame in nearest cluster.\n", - epsilon_); - // Vars allocated here in case of OpenMP - int n_sieved_noise = 0; - int Nsieved = 0; - int frame; - int nframes = (int)FrameDistances().OriginalNframes(); - ParallelProgress progress( nframes ); - // Need a temporary array to hold which frame belongs to which cluster. - // Otherwise we could be comparoing sieved frames to other sieved frames. - std::vector frameToCluster( nframes, clusters_.end() ); - // For OMP, every other thread will need its own Cdist. - ClusterDist* MyCdist = Cdist_; -# ifdef _OPENMP -# pragma omp parallel private(MyCdist, frame) firstprivate(progress) reduction(+ : Nsieved, n_sieved_noise) - { - int mythread = omp_get_thread_num(); - progress.SetThread( mythread ); - if (mythread == 0) { - mprintf("\tParallelizing calculation with %i threads\n", omp_get_num_threads()); - MyCdist = Cdist_; - } else - MyCdist = Cdist_->Copy(); -# pragma omp for schedule(dynamic) -# endif - for (frame = 0; frame < nframes; ++frame) { - progress.Update( frame ); - if (FrameDistances().FrameWasSieved(frame)) { - // Which clusters centroid is closest to this frame? - double mindist = DBL_MAX; - cluster_it minNode = clusters_.end(); - for (cluster_it Cnode = clusters_.begin(); Cnode != clusters_.end(); ++Cnode) { - double dist = MyCdist->FrameCentroidDist(frame, Cnode->Cent()); - if (dist < mindist) { - mindist = dist; - minNode = Cnode; - } - } - bool goodFrame = false; - if ( mindist < epsilon_ ) - // Frame is already within epsilon, accept. - goodFrame = true; - else if ( !sieveToCentroid_ ) { - // Check if any frames in the cluster are closer than epsilon to sieved frame. - for (int cidx=0; cidx < minNode->Nframes(); cidx++) - { - if ( MyCdist->FrameDist(frame, minNode->ClusterFrame(cidx)) < epsilon_ ) - { - goodFrame = true; - break; - } - } - } - // Add sieved frame to the closest cluster if closest distance is - // less than epsilon. - ++Nsieved; - if ( goodFrame ) - frameToCluster[frame] = minNode; - else - n_sieved_noise++; - } - } // END loop over frames -# ifdef _OPENMP - if (mythread > 0) - delete MyCdist; - } // END pragma omp parallel -# endif - progress.Finish(); - // Now actually add sieved frames to their appropriate clusters - for (frame = 0; frame < nframes; frame++) - if (frameToCluster[frame] != clusters_.end()) - frameToCluster[frame]->AddFrameToCluster( frame ); - mprintf("\t%i of %i sieved frames were discarded as noise.\n", - n_sieved_noise, Nsieved); -} - -/** For each point p, calculate function Kdist(p) which is the distance of - * the Kth nearest point to p. - */ -void Cluster_DBSCAN::ComputeKdist( int Kval, std::vector const& FramesToCluster ) const { - std::vector dists; - std::vector Kdist; - dists.reserve( FramesToCluster.size() ); - Kdist.reserve( FramesToCluster.size() ); - std::string outfilename = k_prefix_ + "Kdist." + integerToString(Kval) + ".dat"; - mprintf("\tDBSCAN: Calculating Kdist(%i), output to %s\n", Kval, outfilename.c_str()); - for (std::vector::const_iterator point = FramesToCluster.begin(); - point != FramesToCluster.end(); - ++point) - { - // Store distances from this point - dists.clear(); - for (std::vector::const_iterator otherpoint = FramesToCluster.begin(); - otherpoint != FramesToCluster.end(); - ++otherpoint) - dists.push_back( FrameDistances().GetFdist(*point, *otherpoint) ); - // Sort distances - first dist should always be 0 - std::sort(dists.begin(), dists.end()); - Kdist.push_back( dists[Kval] ); - } - std::sort( Kdist.begin(), Kdist.end() ); - CpptrajFile Outfile; - Outfile.OpenWrite(outfilename); - Outfile.Printf("%-8s %1i%-11s\n", "#Point", Kval,"-dist"); - // Write out largest to smallest - unsigned int ik = 0; - for (std::vector::reverse_iterator k = Kdist.rbegin(); - k != Kdist.rend(); ++k, ++ik) - Outfile.Printf("%8u %12.4f\n", ik, *k); - Outfile.CloseFile(); -} - -// Cluster_DBSCAN::ComputeKdistMap() -void Cluster_DBSCAN::ComputeKdistMap( Range const& Kvals, - std::vector const& FramesToCluster ) const -{ - int pt1_idx, pt2_idx, d_idx, point; - mprintf("\tCalculating Kdist map for %s\n", Kvals.RangeArg()); - double* kdist_array; // Store distance of pt1 to every other point. - int nframes = (int)FramesToCluster.size(); - // Ensure all Kdist points are within proper range - Range::const_iterator kval; - for (kval = Kvals.begin(); kval != Kvals.end(); ++kval) - if (*kval < 1 || *kval >= nframes) { - mprinterr("Error: Kdist value %i is out of range (1 <= Kdist < %i)\n", - *kval, nframes); - return; - } - int nvals = (int)Kvals.Size(); - double** KMAP; // KMAP[i] has the ith nearest point for each point. - KMAP = new double*[ nvals ]; - for (int i = 0; i != nvals; i++) - KMAP[i] = new double[ nframes ]; - ParallelProgress progress( nframes ); -# ifdef _OPENMP -# pragma omp parallel private(pt1_idx, pt2_idx, d_idx, kval, point, kdist_array) firstprivate(progress) - { - progress.SetThread( omp_get_thread_num() ); -#endif - kdist_array = new double[ nframes ]; -# ifdef _OPENMP -# pragma omp for -# endif - for (pt1_idx = 0; pt1_idx < nframes; pt1_idx++) // X - { - progress.Update( pt1_idx ); - point = FramesToCluster[pt1_idx]; - d_idx = 0; - // Store distances from pt1 to pt2 - for (pt2_idx = 0; pt2_idx != nframes; pt2_idx++) - kdist_array[d_idx++] = FrameDistances().GetFdist(point, FramesToCluster[pt2_idx]); - // Sort distances; will be smallest to largest - std::sort( kdist_array, kdist_array + nframes ); - // Save the distance of specified nearest neighbors to this point. - d_idx = 0; - for (kval = Kvals.begin(); kval != Kvals.end(); ++kval) // Y - KMAP[d_idx++][pt1_idx] = kdist_array[ *kval ]; - } - delete[] kdist_array; -# ifdef _OPENMP - } // END omp parallel -# endif - progress.Finish(); - // Sort all of the individual kdist plots, smallest to largest. - for (int i = 0; i != nvals; i++) - std::sort(KMAP[i], KMAP[i] + nframes); - // Save in matrix, largest to smallest. - DataSet_MatrixDbl kmatrix; - kmatrix.Allocate2D( FramesToCluster.size(), Kvals.Size() ); - for (int y = 0; y != nvals; y++) { - for (int x = nframes - 1; x != -1; x--) - kmatrix.AddElement( KMAP[y][x] ); - delete[] KMAP[y]; - } - delete[] KMAP; - // Write matrix to file - DataFile outfile; - ArgList outargs("usemap"); - outfile.SetupDatafile(k_prefix_ + "Kmatrix.gnu", outargs, debug_); - outfile.AddDataSet( (DataSet*)&kmatrix ); - outfile.WriteDataOut(); - // Write out the largest and smallest values for each K. - // This means for each value of K the point with the furthest Kth-nearest - // neighbor etc. - CpptrajFile maxfile; - if (maxfile.OpenWrite(k_prefix_ + "Kmatrix.max.dat")) return; - maxfile.Printf("%-12s %12s %12s\n", "#Kval", "MaxD", "MinD"); - d_idx = 0; - for (kval = Kvals.begin(); kval != Kvals.end(); ++kval, d_idx++) - maxfile.Printf("%12i %12g %12g\n", *kval, kmatrix.GetElement(0, d_idx), - kmatrix.GetElement(nframes-1, d_idx)); - maxfile.CloseFile(); -} diff --git a/src/Cluster_DBSCAN.h b/src/Cluster_DBSCAN.h deleted file mode 100644 index 6cd9194853..0000000000 --- a/src/Cluster_DBSCAN.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef INC_CLUSTER_DBSCAN_H -#define INC_CLUSTER_DBSCAN_H -#include "ClusterList.h" -/** Ester, Kriegel, Sander, Xu; Proceedings of 2nd International Conference - * on Knowledge Discovery and Data Mining (KDD-96); pp 226-231. - */ -class Cluster_DBSCAN : public ClusterList { - public: - Cluster_DBSCAN(); - static void Help(); - int SetupCluster(ArgList&); - void ClusteringInfo() const; - int Cluster(); -# ifdef TIMER - void Timing(double) const {} -# endif - void AddSievedFrames(); - void ClusterResults(CpptrajFile&) const; - private: - typedef std::vector Iarray; - - bool ExpandCluster(unsigned int, int); - void RegionQuery(Iarray&, int) const; - void ComputeKdist( int, std::vector const& ) const ; - void ComputeKdistMap( Range const&, std::vector const& ) const ; - - Iarray Status_; ///< Status of each point: unclassified, noise, or in cluster - Iarray seeds_; ///< Results from first RegionQuery - Iarray result_; ///< Results from seed RegionQueries - int minPoints_; ///< Min # of points needed to make a cluster. - double epsilon_; ///< Distance criterion for cluster formation. - Range kdist_; - std::string k_prefix_; ///< Kdist output file prefix. - bool sieveToCentroid_; ///< If true sieve only based on closeness to centroid. -}; -#endif diff --git a/src/Cluster_DPeaks.cpp b/src/Cluster_DPeaks.cpp deleted file mode 100644 index 626c4bd540..0000000000 --- a/src/Cluster_DPeaks.cpp +++ /dev/null @@ -1,859 +0,0 @@ -#include // fabs -#include // sort -#include "Cluster_DPeaks.h" -#include "CpptrajStdio.h" -#include "DataSet_Mesh.h" -#include "ProgressBar.h" - -Cluster_DPeaks::Cluster_DPeaks() : - densityCut_(-1.0), - distanceCut_(-1.0), - epsilon_(-1.0), - choosePoints_(PLOT_ONLY), - calc_noise_(false), - useGaussianKernel_(false) {} - -void Cluster_DPeaks::Help() { - mprintf("\t[dpeaks epsilon [noise] [dvdfile ]\n" - "\t [choosepoints {manual | auto}]\n" - "\t [distancecut ] [densitycut ]\n" - "\t [runavg ] [deltafile ] [gauss]]\n"); -} - -int Cluster_DPeaks::SetupCluster(ArgList& analyzeArgs) { - epsilon_ = analyzeArgs.getKeyDouble("epsilon", -1.0); - if (epsilon_ <= 0.0) { - mprinterr("Error: DPeaks requires epsilon to be set and > 0.0\n" - "Error: Use 'epsilon '\n"); - return 1; - } - densityCut_ = analyzeArgs.getKeyDouble("densitycut", -1.0); - distanceCut_ = analyzeArgs.getKeyDouble("distancecut", -1.0); - calc_noise_ = analyzeArgs.hasKey("noise"); - dvdfile_ = analyzeArgs.GetStringKey("dvdfile"); - rafile_ = analyzeArgs.GetStringKey("runavg"); - radelta_ = analyzeArgs.GetStringKey("deltafile"); - avg_factor_ = analyzeArgs.getKeyInt("avgfactor", -1); - if (avg_factor_ != -1 && avg_factor_ < 1) { - mprinterr("Error: avgfactor must be >= 1.\n"); - return 1; - } - useGaussianKernel_ = analyzeArgs.hasKey("gauss"); - // Determine how peaks will be chosen. Default is not to choose peaks, - // just print out density versus distance for manual choice. - choosePoints_ = PLOT_ONLY; - std::string choose_keyword = analyzeArgs.GetStringKey("choosepoints"); - if (!choose_keyword.empty()) { - if (choose_keyword == "manual") choosePoints_ = MANUAL; - else if (choose_keyword == "auto" ) choosePoints_ = AUTOMATIC; - else { - mprinterr("Error: Unrecognized choosepoints keyword: %s\n", choose_keyword.c_str()); - return 1; - } - } - if (choosePoints_ == PLOT_ONLY && dvdfile_.empty()) - dvdfile_.assign("DensityVsDistance.dat"); - else if ( choosePoints_ == MANUAL && - (distanceCut_ < 0.0 || densityCut_ < 0.0) ) - { - mprinterr("Error: For choosepoints manual must specify distancecut and densitycut.\n"); - return 1; - } - return 0; -} - -void Cluster_DPeaks::ClusteringInfo() const { - mprintf("---------------------------------------------------------------------------\n" - "Warning: The dpeaks algorithm is still under development. USE WITH CAUTION!\n" - "---------------------------------------------------------------------------\n"); - mprintf("\tDPeaks: Cutoff (epsilon) for determining local density is %g\n", epsilon_); - if (useGaussianKernel_) - mprintf("\t\tDensity will be determined with Gaussian kernels.\n"); - else - mprintf("\t\tDiscrete density calculation.\n"); - if (calc_noise_) - mprintf("\t\tCalculating noise as all points within epsilon of another cluster.\n"); - if (!dvdfile_.empty()) - mprintf("\t\tDensity vs min distance to point with next highest density written to %s\n", - dvdfile_.c_str()); - if (choosePoints_ == AUTOMATIC) { - mprintf("\t\tAttempting to choose density peaks automatically.\n"); - if (!rafile_.empty()) - mprintf("\t\tRunning avg of delta vs distance written to %s\n", rafile_.c_str()); - if (avg_factor_ != -1) - mprintf("\t\tRunning avg window size will be # clustered frames / %i\n", avg_factor_); - if (!radelta_.empty()) - mprintf("\t\tDelta of distance minus running avg written to %s\n", radelta_.c_str()); - } else if (choosePoints_ == MANUAL) { - mprintf("\t\tCutoffs for choosing initial clusters from peaks: Distance= %g, density= %g\n", - distanceCut_, densityCut_); - } else - mprintf("\t\tNo clustering, only writing density versus distance file.\n"); -} - -int Cluster_DPeaks::Cluster() { - int err = 0; - // Calculate local densities - if ( useGaussianKernel_ ) - err = Cluster_GaussianKernel(); - else - err = Cluster_DiscreteDensity(); - if (err != 0) return 1; - // Choose points for which the min distance to point with higher density is - // anomalously high. - int nclusters = 0; - if (choosePoints_ == PLOT_ONLY) { - mprintf("Info: Cutoffs for choosing points can be determined visually from the\n" - "Info: density versus min distance to cluster with next highest density file,\n" - "Info: '%s'. Re-run the algorithm with appropriate distancecut and densitycut.\n", - dvdfile_.c_str()); - return 0; - } else if (choosePoints_ == MANUAL) - nclusters = ChoosePointsManually(); - else - nclusters = ChoosePointsAutomatically(); - - mprintf("\tIdentified %i cluster centers from density vs distance peaks.\n", nclusters); - // Each remaining point is assigned to the same cluster as its nearest - // neighbor of higher density. Do this recursively until a cluster - // center is found. - int cnum = -1; - for (unsigned int idx = 0; idx != Points_.size(); idx++) { - if (Points_[idx].Cnum() == -1) {// Point is unassigned. - AssignClusterNum(idx, cnum); - //mprintf("Finished recursion for index %i\n\n", idx); - } - } - // Sort by cluster number. NOTE: This invalidates NearestIdx - std::sort( Points_.begin(), Points_.end(), Cpoint::cnum_sort() ); - // Determine where each cluster starts and stops in Points array - typedef std::vector Parray; - Parray C_start_stop; - C_start_stop.reserve( nclusters * 2 ); - cnum = -1; - for (Carray::const_iterator point = Points_.begin(); point != Points_.end(); ++point) - { - if (point->Cnum() != cnum) { - if (!C_start_stop.empty()) C_start_stop.push_back(point - Points_.begin()); // end of cluster - C_start_stop.push_back(point - Points_.begin()); // beginning of cluster - cnum = point->Cnum(); - } - } - C_start_stop.push_back( Points_.size() ); // end of last cluster - // Noise calculation. - if (calc_noise_) { - mprintf("\tDetermining noise frames from cluster borders.\n"); - // For each cluster find a border region, defined as the set of points - // assigned to that cluster which are within epsilon of any other - // cluster. - // NOTE: Could use a set here to prevent duplicate frames. - typedef std::vector Barray; - Barray borderIndices( nclusters ); // Hold indices of border points for each cluster. - for (Parray::const_iterator idx0 = C_start_stop.begin(); - idx0 != C_start_stop.end(); idx0 += 2) - { - int c0 = Points_[*idx0].Cnum(); - //mprintf("Cluster %i\n", c0); - // Check each frame in this cluster. - for (unsigned int i0 = *idx0; i0 != *(idx0+1); ++i0) - { - Cpoint const& point = Points_[i0]; - // Look at each other cluster - for (Parray::const_iterator idx1 = idx0 + 2; - idx1 != C_start_stop.end(); idx1 += 2) - { - int c1 = Points_[*idx1].Cnum(); - // Check each frame in other cluster - for (unsigned int i1 = *idx1; i1 != *(idx1+1); i1++) - { - Cpoint const& other_point = Points_[i1]; - if (FrameDistances().GetFdist(point.Fnum(), other_point.Fnum()) < epsilon_) { - //mprintf("\tBorder frame: %i (to cluster %i frame %i)\n", - // point.Fnum() + 1, c1, other_point.Fnum() + 1); - borderIndices[c0].push_back( i0 ); - borderIndices[c1].push_back( i1 ); - } - } - } - } - } - if (debug_ > 0) - mprintf("Warning: Cluster numbers here may not match final cluster numbers.\n" - "\tBorder Frames:\n"); - for (Parray::const_iterator idx = C_start_stop.begin(); - idx != C_start_stop.end(); idx += 2) - { - int c0 = Points_[*idx].Cnum(); - if (debug_ > 0) - mprintf("\tCluster %u: %u frames: %u border frames:", c0, *(idx+1) - *idx, - borderIndices[c0].size()); - if (borderIndices[c0].empty()) { - if (debug_ > 0) mprintf(" No border points.\n"); - } else { - int highestDensity = -1; - // Find highest density in border region. - for (Parray::const_iterator bidx = borderIndices[c0].begin(); - bidx != borderIndices[c0].end(); ++bidx) - { - if (highestDensity == -1) - highestDensity = Points_[*bidx].PointsWithinEps(); - else - highestDensity = std::max(highestDensity, Points_[*bidx].PointsWithinEps()); - if (debug_ > 0) mprintf(" %i", Points_[*bidx].Fnum()+1); - } - if (debug_ > 0) mprintf(". Highest density in border= %i\n", highestDensity); - // Mark any point with density <= highest border density as noise. - for (unsigned int i = *idx; i != *(idx+1); i++) - { - Cpoint& point = Points_[i]; - if (point.PointsWithinEps() <= highestDensity) { - point.SetCluster( -1 ); - if (debug_ > 1) - mprintf("\t\tMarking frame %i as noise (density %i)\n", - point.Fnum()+1, point.PointsWithinEps()); - } - } - } - } - } - // Add the clusters. - for (Parray::const_iterator idx = C_start_stop.begin(); - idx != C_start_stop.end(); idx += 2) - { - ClusterDist::Cframes frames; - for (unsigned int i = *idx; i != *(idx+1); i++) { - if (Points_[i].Cnum() != -1) - frames.push_back( Points_[i].Fnum() ); - } - if (!frames.empty()) - AddCluster( frames ); - } - return 0; -} - -// ----------------------------------------------------------------------------- -int Cluster_DPeaks::Cluster_GaussianKernel() { - mprintf("\tStarting DPeaks clustering. Using Gaussian kernel to calculate density.\n"); - // First determine which frames are being clustered. - Points_.clear(); - int oidx = 0; - for (int frame = 0; frame < (int)FrameDistances().OriginalNframes(); ++frame) - if (!FrameDistances().FrameWasSieved( frame )) - Points_.push_back( Cpoint(frame, oidx++) ); - // Sanity check. - if (Points_.size() < 2) { - mprinterr("Error: Only 1 frame in initial clustering.\n"); - return 1; - } - - // Sort distances - std::vector Distances; - Distances.reserve( FrameDistances().Nelements() ); - for (unsigned int idx = 0; idx != FrameDistances().Nelements(); idx++) - Distances.push_back( FrameDistances().GetElement(idx) ); - std::sort( Distances.begin(), Distances.end() ); - unsigned int idx = (unsigned int)((double)Distances.size() * 0.02); - double bandwidth = (double)Distances[idx]; - mprintf("idx= %u, bandwidth= %g\n", idx, bandwidth); - - // Density via Gaussian kernel - double maxDist = -1.0; - for (unsigned int i = 0; i != Points_.size(); i++) { - for (unsigned int j = i+1; j != Points_.size(); j++) { - double dist = FrameDistances().GetFdist(Points_[i].Fnum(), Points_[j].Fnum()); - maxDist = std::max( maxDist, dist ); - dist /= bandwidth; - double gk = exp(-(dist *dist)); - Points_[i].AddDensity( gk ); - Points_[j].AddDensity( gk ); - } - } - mprintf("Max dist= %g\n", maxDist); - CpptrajFile rhoOut; - rhoOut.OpenWrite("rho.dat"); - for (unsigned int i = 0; i != Points_.size(); i++) - rhoOut.Printf("%u %g\n", i+1, Points_[i].Density()); - rhoOut.CloseFile(); - - // Sort by density, descending - std::stable_sort( Points_.begin(), Points_.end(), Cpoint::density_sort_descend() ); - CpptrajFile ordrhoOut; - ordrhoOut.OpenWrite("ordrho.dat"); - for (unsigned int i = 0; i != Points_.size(); i++) - ordrhoOut.Printf("%u %g %i %i\n", i+1, Points_[i].Density(), Points_[i].Fnum()+1, - Points_[i].Oidx()+1); - ordrhoOut.CloseFile(); - - // Determine minimum distances - int first_idx = Points_[0].Oidx(); - Points_[first_idx].SetDist( -1.0 ); - Points_[first_idx].SetNearestIdx(-1); - for (unsigned int ii = 1; ii != Points_.size(); ii++) { - int ord_i = Points_[ii].Oidx(); - Points_[ord_i].SetDist( maxDist ); - for (unsigned int jj = 0; jj != ii; jj++) { - int ord_j = Points_[jj].Oidx(); - double dist = FrameDistances().GetFdist(Points_[ord_i].Fnum(), Points_[ord_j].Fnum()); - if (dist < Points_[ord_i].Dist()) { - Points_[ord_i].SetDist( dist ); - Points_[ord_j].SetNearestIdx( ord_j ); - } - } - } - if (!dvdfile_.empty()) { - CpptrajFile output; - if (output.OpenWrite(dvdfile_)) return 1; - for (Carray::const_iterator point = Points_.begin(); point != Points_.end(); ++point) - output.Printf("%g %g %i\n", point->Density(), point->Dist(), point->NearestIdx()+1); - output.CloseFile(); - } - - return 0; -} - -// ----------------------------------------------------------------------------- -int Cluster_DPeaks::Cluster_DiscreteDensity() { - mprintf("\tStarting DPeaks clustering, discrete density calculation.\n"); - Points_.clear(); - // First determine which frames are being clustered. - for (int frame = 0; frame < (int)FrameDistances().OriginalNframes(); ++frame) - if (!FrameDistances().FrameWasSieved( frame )) - Points_.push_back( Cpoint(frame) ); - // Sanity check. - if (Points_.size() < 2) { - mprinterr("Error: Only 1 frame in initial clustering.\n"); - return 1; - } - // For each point, determine how many others are within epsilon. Also - // determine maximum distance between any two points. - mprintf("\tDetermining local density of each point.\n"); - ProgressBar cluster_progress( Points_.size() ); - double maxDist = -1.0; - for (Carray::iterator point0 = Points_.begin(); - point0 != Points_.end(); ++point0) - { - cluster_progress.Update(point0 - Points_.begin()); - int density = 0; - for (Carray::const_iterator point1 = Points_.begin(); - point1 != Points_.end(); ++point1) - { - if (point0 != point1) { - double dist = FrameDistances().GetFdist(point0->Fnum(), point1->Fnum()); - maxDist = std::max(maxDist, dist); - if ( dist < epsilon_ ) - density++; - } - } - point0->SetPointsWithinEps( density ); - } - if (debug_ > 0) { - mprintf("DBG: Max dist= %g\n", maxDist); - // DEBUG: Frame/Density - CpptrajFile fdout; - fdout.OpenWrite("fd.dat"); - for (Carray::const_iterator point = Points_.begin(); point != Points_.end(); ++point) - fdout.Printf("%i %i\n", point->Fnum()+1, point->PointsWithinEps()); - fdout.CloseFile(); - } - // Sort by density here. Otherwise array indices will be invalid later. - std::sort( Points_.begin(), Points_.end(), Cpoint::pointsWithinEps_sort() ); - // For each point, find the closest point that has higher density. Since - // array is now sorted by density the last point has the highest density. - Points_.back().SetDist( maxDist ); - mprintf("\tFinding closest neighbor point with higher density for each point.\n"); - unsigned int lastidx = Points_.size() - 1; - cluster_progress.SetupProgress( lastidx ); - for (unsigned int idx0 = 0; idx0 != lastidx; idx0++) - { - cluster_progress.Update( idx0 ); - double min_dist = maxDist; - int nearestIdx = -1; // Index of nearest neighbor with higher density - Cpoint& point0 = Points_[idx0]; - //mprintf("\nDBG:\tSearching for nearest neighbor to idx %u with higher density than %i.\n", - // idx0, point0.PointsWithinEps()); - // Since array is sorted by density we can start at the next point. - for (unsigned int idx1 = idx0+1; idx1 != Points_.size(); idx1++) - { - Cpoint const& point1 = Points_[idx1]; - double dist1_2 = FrameDistances().GetFdist(point0.Fnum(), point1.Fnum()); - if (point1.PointsWithinEps() > point0.PointsWithinEps()) - { - if (dist1_2 < min_dist) { - min_dist = dist1_2; - nearestIdx = (int)idx1; - //mprintf("DBG:\t\tNeighbor idx %i is closer (density %i, distance %g)\n", - // nearestIdx, point1.PointsWithinEps(), min_dist); - } - } - } - point0.SetDist( min_dist ); - //mprintf("DBG:\tClosest point to %u with higher density is %i (distance %g)\n", - // idx0, nearestIdx, min_dist); - point0.SetNearestIdx( nearestIdx ); - } - // Plot density vs distance for each point. - if (!dvdfile_.empty()) { - CpptrajFile output; - if (output.OpenWrite(dvdfile_)) - mprinterr("Error: Could not open density vs distance plot '%s' for write.\n", - dvdfile_.c_str()); // TODO: Make fatal? - else { - output.Printf("%-10s %10s %s %10s %10s\n", "#Density", "Distance", - "Frame", "Idx", "Neighbor"); - for (Carray::const_iterator point = Points_.begin(); - point != Points_.end(); ++point) - output.Printf("%-10i %10g \"%i\" %10u %10i\n", point->PointsWithinEps(), point->Dist(), - point->Fnum()+1, point-Points_.begin(), point->NearestIdx()); - output.CloseFile(); - } - } - - return 0; -} - -int Cluster_DPeaks::ChoosePointsManually() { - int cnum = 0; - for (Carray::iterator point = Points_.begin(); point != Points_.end(); ++point) { - double density; - if (useGaussianKernel_) - density = point->Density(); - else - density = (double)point->PointsWithinEps(); - if ( density >= densityCut_ && point->Dist() >= distanceCut_ ) { - point->SetCluster( cnum++ ); - mprintf("\tPoint %u (frame %i, density %g) selected as candidate for cluster %i\n", - point - Points_.begin(), point->Fnum() + 1, density, cnum - 1); - } - } - return cnum; -} - -int Cluster_DPeaks::ChoosePointsAutomatically() { - // Right now all density values are discrete. Try to choose outliers at each - // value for which there is density.; -/* - // For each point, calculate average distance (X,Y) to points in next and - // previous density values. - const double dens_cut = 3.0 * 3.0; - const double dist_cut = 1.32 * 1.32; - for (Carray::const_iterator point0 = Points_.begin(); point0 != Points_.end(); ++point0) - { - int Npts = 0; - for (Carray::const_iterator point1 = Points_.begin(); point1 != Points_.end(); ++point1) - { - if (point0 != point1) { - // Only do this for close densities - double dX = (double)(point0->PointsWithinEps() - point1->PointsWithinEps()); - double dX2 = dX * dX; - double dY = (point0->Dist() - point1->Dist()); - double dY2 = dY * dY; - if (dX2 < dens_cut && dY2 < dist_cut) { - Npts++; - } - } - } - mprintf("%i %i %i\n", point0->PointsWithinEps(), point0->Fnum()+1, Npts); - } -*/ - -/* - CpptrajFile tempOut; - tempOut.OpenWrite("temp.dat"); - int currentDensity = -1; - double distAv = 0.0; - double distSD = 0.0; - double sumWts = 0.0; - int nValues = 0; - Carray::const_iterator lastPoint = Points_.end() + 1; - for (Carray::const_iterator point = Points_.begin(); point != lastPoint; ++point) - { - if (point == Points_.end() || point->PointsWithinEps() != currentDensity) { - if (nValues > 0) { - distAv = distAv / sumWts; //(double)nValues; - distSD = (distSD / sumWts) - (distAv * distAv); - if (distSD > 0.0) - distSD = sqrt(distSD); - else - distSD = 0.0; - //mprintf("Density %i: %i values Avg= %g SD= %g SumWts= %g\n", currentDensity, - // nValues, distAv, distSD, sumWts); - tempOut.Printf("%i %g\n", currentDensity, distAv); - } - if (point == Points_.end()) break; - currentDensity = point->PointsWithinEps(); - distAv = 0.0; - distSD = 0.0; - sumWts = 0.0; - nValues = 0; - } - double wt = exp(point->Dist()); - double dval = point->Dist() * wt; - sumWts += wt; - distAv += dval; - distSD += (dval * dval); - nValues++; - } - tempOut.CloseFile(); -*/ - - // BEGIN CALCULATING WEIGHTED DISTANCE AVERAGE - CpptrajFile tempOut; - tempOut.OpenWrite("temp.dat"); - DataSet_Mesh weightedAverage; - Carray::const_iterator cp = Points_.begin(); - // Skip local density of 0. - //while (cp->PointsWithinEps() == 0 && cp != Points_.end()) ++cp; - while (cp != Points_.end()) - { - int densityVal = cp->PointsWithinEps(); - Carray densityArray; - // Add all points of current density. - while (cp->PointsWithinEps() == densityVal && cp != Points_.end()) - densityArray.push_back( *(cp++) ); - mprintf("Density value %i has %zu points.\n", densityVal, densityArray.size()); - // Sort array by distance - std::sort(densityArray.begin(), densityArray.end(), Cpoint::dist_sort()); - // Take the average of the points weighted by their position. - double wtDistAv = 0.0; - double sumWts = 0.0; - //std::vector weights; - //weights.reserve( densityArray.size() ); - int maxPt = (int)densityArray.size() - 1; - for (int ip = 0; ip != (int)densityArray.size(); ++ip) - { - double wt = exp( (double)(ip - maxPt) ); - //mprintf("\t%10i %10u %10u %10g\n", densityVal, ip, maxPt, wt); - wtDistAv += (densityArray[ip].Dist() * wt); - sumWts += wt; - //weights.push_back( wt ); - } - wtDistAv /= sumWts; - // Calculate the weighted sample variance - //double distSD = 0.0; - //for (unsigned int ip = 0; ip != densityArray.size(); ++ip) { - // double diff = densityArray[ip].Dist() - wtDistAv; - // distSD += weights[ip] * (diff * diff); - //} - //distSD /= sumWts; - weightedAverage.AddXY(densityVal, wtDistAv); - //tempOut.Printf("%i %g %g %g\n", densityVal, wtDistAv, sqrt(distSD), sumWts); - tempOut.Printf("%i %g %g\n", densityVal, wtDistAv, sumWts); -/* - // Find the median. - double median, Q1, Q3; - if (densityArray.size() == 1) { - median = densityArray[0].Dist(); - Q1 = median; - Q3 = median; - } else { - unsigned int q3_beg; - unsigned int med_idx = densityArray.size() / 2; // Always 0 <= Q1 < med_idx - if ((densityArray.size() % 2) == 0) { - median = (densityArray[med_idx].Dist() + densityArray[med_idx-1].Dist()) / 2.0; - q3_beg = med_idx; - } else { - median = densityArray[med_idx].Dist(); - q3_beg = med_idx + 1; - } - if (densityArray.size() == 2) { - Q1 = densityArray[0].Dist(); - Q3 = densityArray[1].Dist(); - } else { - // Find lower quartile - unsigned int q1_idx = med_idx / 2; - if ((med_idx % 2) == 0) - Q1 = (densityArray[q1_idx].Dist() + densityArray[q1_idx-1].Dist()) / 2.0; - else - Q1 = densityArray[q1_idx].Dist(); - // Find upper quartile - unsigned int q3_size = densityArray.size() - q3_beg; - unsigned int q3_idx = (q3_size / 2) + q3_beg; - if ((q3_size %2) == 0) - Q3 = (densityArray[q3_idx].Dist() + densityArray[q3_idx-1].Dist()) / 2.0; - else - Q3 = densityArray[q3_idx].Dist(); - } - } - mprintf("\tMedian dist value is %g. Q1= %g Q3= %g\n", median, Q1, Q3); -*/ - } - tempOut.CloseFile(); - // END CALCULATING WEIGHTED DISTANCE AVERAGE - -/* - // TEST - tempOut.OpenWrite("temp2.dat"); - std::vector Hist( Points_.back().PointsWithinEps()+1, 0.0 ); - int gWidth = 3; - double cval = 3.0; - double two_c_squared = 2.0 * cval * cval; - mprintf("DBG: cval= %g, Gaussian denominator is %g\n", cval, two_c_squared); - for (int wtIdx = 0; wtIdx != (int)weightedAverage.Size(); wtIdx++) - { - int bval = weightedAverage.X(wtIdx); - for (int xval = std::max(bval - gWidth, 0); - xval != std::min(bval + gWidth + 1, (int)Hist.size()); xval++) - { - // a: height (weighted average) - // b: center (density value) - // c: width - // x: density value in histogram - //int xval = weightedAverage.X(idx); - //double bval = weightedAverage.X(wtIdx); - //double bval = (double)wtIdx; - double diff = (double)(xval - bval); - //Hist[xval] += (weightedAverage.Y(wtIdx) * exp( -( (diff * diff) / two_c_squared ) )); - Hist[xval] = std::max(Hist[xval], - weightedAverage.Y(wtIdx) * exp( -( (diff * diff) / two_c_squared ) )); - } - } - for (unsigned int idx = 0; idx != Hist.size(); idx++) - tempOut.Printf("%u %g\n", idx, Hist[idx]); - tempOut.CloseFile(); - // END TEST -*/ -/* - // TEST - // Construct best-fit line segments - tempOut.OpenWrite("temp2.dat"); - double slope, intercept, correl; - int segment_length = 3; - DataSet_Mesh Segment; - Segment.Allocate1D( segment_length ); - for (int wtIdx = 0; wtIdx != (int)weightedAverage.Size(); wtIdx++) - { - Segment.Clear(); - for (int idx = std::max(wtIdx - 1, 0); // TODO: use segment_length - idx != std::min(wtIdx + 2, (int)weightedAverage.Size()); idx++) - Segment.AddXY(weightedAverage.X(idx), weightedAverage.Y(idx)); - Segment.LinearRegression(slope, intercept, correl, true); - for (int idx = std::max(wtIdx - 1, 0); // TODO: use segment_length - idx != std::min(wtIdx + 2, (int)weightedAverage.Size()); idx++) - { - double x = weightedAverage.X(idx); - double y = slope * x + intercept; - tempOut.Printf("%g %g %i\n", x, y, weightedAverage.X(wtIdx)); - } - } - tempOut.CloseFile(); - // END TEST -*/ - - // BEGIN WEIGHTED RUNNING AVG/SD OF DISTANCES - // For each point, determine if it is greater than the average of the - // weighted average distances of the previous, current, and next densities. - int width = 2; - int currentDensity = 0; - int wtIdx = 0; - double currentAvg = 0.0; - double deltaSD = 0.0; - double deltaAv = 0.0; - int Ndelta = 0; - CpptrajFile raOut; - if (!rafile_.empty()) raOut.OpenWrite(rafile_); - CpptrajFile raDelta; - if (!radelta_.empty()) raDelta.OpenWrite(radelta_); - std::vector candidateIdxs; - std::vector candidateDeltas; - cp = Points_.begin(); - // Skip over points with zero density - while (cp != Points_.end() && cp->PointsWithinEps() == 0) ++cp; - while (weightedAverage.X(wtIdx) != cp->PointsWithinEps() && wtIdx < (int)Points_.size()) - ++wtIdx; - for (Carray::const_iterator point = cp; point != Points_.end(); ++point) - { - if (point->PointsWithinEps() != currentDensity) { - //currentAvg = weightedAverage.Y(wtIdx); - // New density value. Determine average. - currentAvg = 0.0; - // unsigned int Npt = 0; - double currentWt = 0.0; - for (int idx = std::max(wtIdx - width, 0); - idx != std::min(wtIdx + width + 1, (int)weightedAverage.Size()); idx++) - { - //currentAvg += weightedAverage.Y(idx); - //Npt++; - double wt = weightedAverage.Y(idx); - currentAvg += (weightedAverage.Y(idx) * wt); - currentWt += wt; - } - //currentAvg /= (double)Npt; - currentAvg /= currentWt; - //smoothAv += currentAvg; - //smoothSD += (currentAvg * currentAvg); - //Nsmooth++; - currentDensity = point->PointsWithinEps(); - if (raOut.IsOpen()) - raOut.Printf("%i %g %g\n", currentDensity, currentAvg, weightedAverage.Y(wtIdx)); - wtIdx++; - } - double delta = (point->Dist() - currentAvg); - if (delta > 0.0) { - //delta *= log((double)currentDensity); - if (raDelta.IsOpen()) - raDelta.Printf("%8i %8.3f %8i %8.3f %8.3f\n", - currentDensity, delta, point->Fnum()+1, point->Dist(), currentAvg); - candidateIdxs.push_back( point - Points_.begin() ); - candidateDeltas.push_back( delta ); - deltaAv += delta; - deltaSD += (delta * delta); - Ndelta++; - } - } - raOut.CloseFile(); - deltaAv /= (double)Ndelta; - deltaSD = (deltaSD / (double)Ndelta) - (deltaAv * deltaAv); - if (deltaSD > 0.0) - deltaSD = sqrt(deltaSD); - else - deltaSD = 0.0; - if (raDelta.IsOpen()) - raDelta.Printf("#DeltaAvg= %g DeltaSD= %g\n", deltaAv, deltaSD); - raDelta.CloseFile(); - int cnum = 0; - for (unsigned int i = 0; i != candidateIdxs.size(); i++) { - if (candidateDeltas[i] > (deltaSD)) { - Points_[candidateIdxs[i]].SetCluster( cnum++ ); - mprintf("\tPoint %u (frame %i, density %i) selected as candidate for cluster %i\n", - candidateIdxs[i], Points_[candidateIdxs[i]].Fnum()+1, - Points_[candidateIdxs[i]].PointsWithinEps(), cnum-1); - } - } - // END WEIGHTED AVG/SD OF DISTANCES - -/* - // Currently doing this by calculating the running average of density vs - // distance, then choosing points with distance > twice the SD of the - // running average. - // NOTE: Store in a mesh data set for now in case we want to spline etc later. - if (avg_factor_ < 1) avg_factor_ = 10; - unsigned int window_size = Points_.size() / (unsigned int)avg_factor_; - mprintf("\tRunning avg window size is %u\n", window_size); - // FIXME: Handle case where window_size < frames - DataSet_Mesh runavg; - unsigned int ra_size = Points_.size() - window_size + 1; - runavg.Allocate1D( ra_size ); - double dwindow = (double)window_size; - double sumx = 0.0; - double sumy = 0.0; - for (unsigned int i = 0; i < window_size; i++) { - sumx += (double)Points_[i].PointsWithinEps(); - sumy += Points_[i].Dist(); - } - runavg.AddXY( sumx / dwindow, sumy / dwindow ); - for (unsigned int i = 1; i < ra_size; i++) { - unsigned int nextwin = i + window_size - 1; - unsigned int prevwin = i - 1; - sumx = (double)Points_[nextwin].PointsWithinEps() - - (double)Points_[prevwin].PointsWithinEps() + sumx; - sumy = Points_[nextwin].Dist() - - Points_[prevwin].Dist() + sumy; - runavg.AddXY( sumx / dwindow, sumy / dwindow ); - } - // Write running average - if (!rafile_.empty()) { - CpptrajFile raOut; - if (raOut.OpenWrite(rafile_)) - mprinterr("Error: Could not open running avg file '%s' for write.\n", rafile_.c_str()); - else { - for (unsigned int i = 0; i != runavg.Size(); i++) - raOut.Printf("%g %g\n", runavg.X(i), runavg.Y(i)); - raOut.CloseFile(); - } - } - double ra_sd; - double ra_avg = runavg.Avg( ra_sd ); - // Double stdev to use as cutoff for findning anomalously high peaks. - ra_sd *= 2.0; - mprintf("\tAvg of running avg set is %g, SD*2.0 (delta cutoff) is %g\n", ra_avg, ra_sd); - // For each point in density vs distance plot, determine which running - // average point is closest. If the difference between the point and the - // running average point is > 2.0 the SD of the running average data, - // consider it a 'peak'. - CpptrajFile raDelta; - if (!radelta_.empty()) - raDelta.OpenWrite("radelta.dat"); - if (raDelta.IsOpen()) - raDelta.Printf("%-10s %10s %10s\n", "#Frame", "RnAvgPos", "Delta"); - unsigned int ra_position = 0; // Position in the runavg DataSet - unsigned int ra_end = runavg.Size() - 1; - int cnum = 0; - for (Carray::iterator point = Points_.begin(); - point != Points_.end(); ++point) - { - if (ra_position != ra_end) { - // Is the next running avgd point closer to this point? - while (ra_position != ra_end) { - double dens = (double)point->PointsWithinEps(); - double diff0 = fabs( dens - runavg.X(ra_position ) ); - double diff1 = fabs( dens - runavg.X(ra_position+1) ); - if (diff1 < diff0) - ++ra_position; // Next running avg position is closer for this point. - else - break; // This position is closer. - } - } - double delta = point->Dist() - runavg.Y(ra_position); - if (raDelta.IsOpen()) - raDelta.Printf("%-10i %10u %10g", point->Fnum()+1, ra_position, delta); - if (delta > ra_sd) { - if (raDelta.IsOpen()) - raDelta.Printf(" POTENTIAL CLUSTER %i", cnum); - point->SetCluster(cnum++); - } - if (raDelta.IsOpen()) raDelta.Printf("\n"); - } - raDelta.CloseFile(); -*/ - return cnum; -} - -// ----------------------------------------------------------------------------- -/** This should never be called for the point with highest density - * which by definition should be a cluster center. - */ -void Cluster_DPeaks::AssignClusterNum(int idx, int& cnum) { - // Who is the nearest neighbor with higher density. - int neighbor_idx = Points_[idx].NearestIdx(); - //mprintf("Index %i nearest neighbor index %i\n", idx, neighbor_idx); - // SANITY CHECK - if (neighbor_idx == -1) { - mprinterr("Internal Error: In Cluster_DPeaks::AssignClusterNum nearest neighbor is -1.\n"); - return; - } - if (Points_[neighbor_idx].Cnum() != -1) { - // Nearest neighbor has a cluster num assigned. - cnum = Points_[neighbor_idx].Cnum(); - //mprintf("Neighbor index %i is cluster %i\n", neighbor_idx, cnum); - } else - // Ask neighbor to find cluster num. - AssignClusterNum(neighbor_idx, cnum); - //mprintf("Index %i cnum %i\n", idx, cnum); - // At this point cnum should be set. One more sanity check. - if (cnum == -1) { - mprinterr("Internal Error: In Cluster_DPeaks::AssignClusterNum could not get" - " cluster num for index %u.\n", idx); - return; - } - Points_[idx].SetCluster( cnum ); -} - -void Cluster_DPeaks::ClusterResults(CpptrajFile& outfile) const { - outfile.Printf("#Algorithm: DPeaks epsilon %g\n", epsilon_); - if (calc_noise_) { - outfile.Printf("#NOISE_FRAMES:"); - std::vector noiseFrames; - for (Carray::const_iterator point = Points_.begin(); - point != Points_.end(); ++point) - if (point->Cnum() == -1) noiseFrames.push_back( point->Fnum()+1 ); - std::sort( noiseFrames.begin(), noiseFrames.end() ); - for (std::vector::const_iterator f = noiseFrames.begin(); f != noiseFrames.end(); ++f) - outfile.Printf(" %i", *f); - outfile.Printf("\n"); - outfile.Printf("#Number_of_noise_frames: %zu\n", noiseFrames.size()); - } -} - -void Cluster_DPeaks::AddSievedFrames() { - mprintf("FIXME: Adding sieved frames not yet supported.\n"); -} diff --git a/src/Cluster_DPeaks.h b/src/Cluster_DPeaks.h deleted file mode 100644 index e711af3dcc..0000000000 --- a/src/Cluster_DPeaks.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef INC_CLUSTER_DPEAKS_H -#define INC_CLUSTER_DPEAKS_H -#include "ClusterList.h" -class Cluster_DPeaks : public ClusterList { - public: - Cluster_DPeaks(); - static void Help(); - int SetupCluster(ArgList&); - void ClusteringInfo() const; - int Cluster(); -# ifdef TIMER - void Timing(double) const {} -# endif - void AddSievedFrames(); - void ClusterResults(CpptrajFile&) const; - private: - void AssignClusterNum(int, int&); - int Cluster_GaussianKernel(); - int Cluster_DiscreteDensity(); - int ChoosePointsAutomatically(); - int ChoosePointsManually(); - - enum ChooseType {PLOT_ONLY = 0, MANUAL, AUTOMATIC}; - std::string dvdfile_; - std::string rafile_; - std::string radelta_; - double densityCut_; - double distanceCut_; - double epsilon_; - ChooseType choosePoints_; - int avg_factor_; - bool calc_noise_; - bool useGaussianKernel_; - class Cpoint { - public: - Cpoint() : - dist_(-1.0), density_(0.0), pointsWithinEps_(0), fnum_(-1), - nidx_(-1), oidx_(-1), cnum_(-1) {} - Cpoint(int f, int o) : - dist_(-1.0), density_(0.0), pointsWithinEps_(0), fnum_(f), - nidx_(-1), oidx_(o), cnum_(-1) {} - Cpoint(int f) : - dist_(-1.0), density_(0.0), pointsWithinEps_(0), fnum_(f), - nidx_(-1), oidx_(-1), cnum_(-1) {} - Cpoint(Cpoint const& rhs) : - dist_(rhs.dist_), density_(rhs.density_), - pointsWithinEps_(rhs.pointsWithinEps_), fnum_(rhs.fnum_), - nidx_(rhs.nidx_), oidx_(rhs.oidx_), cnum_(rhs.cnum_) {} - Cpoint& operator=(Cpoint const& rhs) { - if (&rhs != this) { - dist_ = rhs.dist_; density_ = rhs.density_; - pointsWithinEps_ = rhs.pointsWithinEps_; fnum_ = rhs.fnum_; - nidx_ = rhs.nidx_; oidx_ = rhs.oidx_; cnum_ = rhs.cnum_; - } - return *this; - } - /// Used to sort Carray by pointsWithinEpsilon, ascending - //bool operator<(Cpoint const& second) const - struct pointsWithinEps_sort { - inline bool operator()(Cpoint const& first, Cpoint const& second) const { - if (first.pointsWithinEps_ == second.pointsWithinEps_) - return (first.fnum_ < second.fnum_); - else - return (first.pointsWithinEps_ < second.pointsWithinEps_); - } - }; - /// Sort by density, descending - struct density_sort_descend { - inline bool operator()(Cpoint const& first, Cpoint const& second) const { - return (first.density_ > second.density_); - } - }; - /// Used to sort Carray by cluster number - struct cnum_sort { - inline bool operator()(Cpoint const& first, Cpoint const& second) const { - if (first.cnum_ == second.cnum_) - return (first.fnum_ < second.fnum_); - else - return (first.cnum_ < second.cnum_); - } - }; - /// Used to sort Carray by distance - struct dist_sort { - inline bool operator()(Cpoint const& first, Cpoint const& second) const { - return (first.dist_ < second.dist_); - } - }; - double Dist() const { return dist_; } - int PointsWithinEps() const { return pointsWithinEps_; } - double Density() const { return density_; } - int Fnum() const { return fnum_; } - int NearestIdx() const { return nidx_; } - int Oidx() const { return oidx_; } - int Cnum() const { return cnum_; } - void SetPointsWithinEps(int d) { pointsWithinEps_ = d; } - void SetDist(double d) { dist_ = d; } - void SetNearestIdx(int n) { nidx_ = n; } - void SetCluster(int c) { cnum_ = c; } - void AddDensity(double d) { density_ += d; } - private: - double dist_; ///< minimum distance to point with higher density - double density_; ///< Density from Gaussian kernel. - int pointsWithinEps_; ///< # other points within epsilon - int fnum_; ///< Frame number. - int nidx_; ///< Index in Carray of nearest neighbor with higher density. - int oidx_; ///< Original index in Carray before sorting. - int cnum_; ///< Cluster number. -1 is no cluster. - }; - typedef std::vector Carray; - Carray Points_; ///< Hold info for each point to be clustered. -}; -#endif diff --git a/src/Cluster_HierAgglo.cpp b/src/Cluster_HierAgglo.cpp deleted file mode 100644 index b727395d31..0000000000 --- a/src/Cluster_HierAgglo.cpp +++ /dev/null @@ -1,367 +0,0 @@ -#include // std::min, std::max -#include // DBL_MAX -#include "Cluster_HierAgglo.h" -#include "CpptrajStdio.h" -#include "ProgressBar.h" - -Cluster_HierAgglo::Cluster_HierAgglo() : - nclusters_(-1), - epsilon_(-1.0), - linkage_(AVERAGELINK), - includeSievedFrames_(false) -{} - -void Cluster_HierAgglo::Help() { - mprintf("\t[hieragglo [epsilon ] [clusters ] [linkage|averagelinkage|complete]\n" - "\t [epsilonplot ] [includesieved_cdist]]\n"); -} - -static const char* LinkageString[] = { - "single-linkage", "average-linkage", "complete-linkage" -}; - -int Cluster_HierAgglo::SetupCluster(ArgList& analyzeArgs) { - nclusters_ = analyzeArgs.getKeyInt("clusters", -1); - epsilon_ = analyzeArgs.getKeyDouble("epsilon", -1.0); - if (analyzeArgs.hasKey("linkage")) linkage_ = SINGLELINK; - else if (analyzeArgs.hasKey("averagelinkage")) linkage_ = AVERAGELINK; - else if (analyzeArgs.hasKey("complete")) linkage_ = COMPLETELINK; - else linkage_ = AVERAGELINK; // DEFAULT linkage - includeSievedFrames_ = analyzeArgs.hasKey("includesieved_cdist"); - std::string epsilonPlot = analyzeArgs.GetStringKey("epsilonplot"); - if (!epsilonPlot.empty()) { - if (eps_v_n_.OpenWrite( epsilonPlot )) return 1; - eps_v_n_.Printf("%-12s %12s\n", "#Epsilon", "Nclusters"); - } - // Determine finish criteria. If nothing specified default to 10 clusters. - if (nclusters_==-1 && epsilon_==-1.0) { - mprintf("Warning: cluster: Neither target # of clusters nor epsilon given.\n"); - nclusters_ = 10; - mprintf("Warning: cluster: Defaulting to %i clusters.\n", nclusters_); - } - return 0; -} - -void Cluster_HierAgglo::ClusteringInfo() const { - mprintf("\tHierarchical Agglomerative:"); - if (nclusters_ != -1) - mprintf(" %i clusters,",nclusters_); - if (epsilon_ != -1.0) - mprintf(" epsilon %.3f,",epsilon_); - mprintf(" %s.\n", LinkageString[linkage_]); - if (eps_v_n_.IsOpen()) - mprintf("\tWriting epsilon vs # clusters to '%s'\n", eps_v_n_.Filename().full()); - if (includeSievedFrames_) - mprintf("\tSieved frames will be included in final cluster distance calculation.\n" - "Warning: 'includesieved_cdist' may be very slow.\n"); - else - mprintf("\tSieved frames will not be included in final cluster distance calculation.\n"); -} - -/** Set up the initial distances between clusters. Should be called before - * any clustering is performed. - */ -void Cluster_HierAgglo::InitializeClusterDistances() { - // Sets up matrix and ignore array - ClusterDistances_.SetupMatrix( clusters_.size() ); - // Build initial cluster distances. Take advantage of the fact that - // the initial cluster layout is the same as the pairwise array. - unsigned int total_frames = FrameDistances().FramesToCluster().size(); - for (unsigned int idx1 = 0; idx1 != total_frames; idx1++) { - int f1 = FrameDistances().FramesToCluster()[ idx1 ]; - for (unsigned int idx2 = idx1 + 1; idx2 != total_frames; idx2++) { - int f2 = FrameDistances().FramesToCluster()[ idx2 ]; - ClusterDistances_.SetCdist( idx1, idx2, FrameDistances().GetFdist(f1, f2) ); - } - } - if (debug_ > 1) { - mprintf("CLUSTER: INITIAL CLUSTER DISTANCES:\n"); - ClusterDistances_.PrintElements(); - } -} - -/** Cluster using a hierarchical agglomerative (bottom-up) approach. All frames - * start in their own cluster. The closest two clusters are merged, and - * distances between the newly merged cluster and all remaining clusters are - * recalculated according to one of the following metrics: - * - single-linkage : The minimum distance between frames in clusters are used. - * - average-linkage : The average distance between frames in clusters are used. - * - complete-linkage: The maximum distance between frames in clusters are used. - */ -int Cluster_HierAgglo::Cluster() { - // If epsilon not given make it huge - if (epsilon_ == -1.0) epsilon_ = DBL_MAX; - // If target clusters not given make it 1 - if (nclusters_ == -1) nclusters_ = 1; - mprintf("\tStarting Hierarchical Agglomerative Clustering:\n"); - ProgressBar cluster_progress(-10); - // Build initial clusters. - for (int frame = 0; frame < (int)FrameDistances().OriginalNframes(); frame++) { - if (!FrameDistances().FrameWasSieved( frame )) - AddCluster( ClusterDist::Cframes(1, frame) ); - } - mprintf("\t%i initial clusters.\n", Nclusters()); - // Build initial cluster distance matrix. - InitializeClusterDistances(); - // DEBUG - print initial clusters - if (debug_ > 1) - PrintClusters(); - bool clusteringComplete = false; - int iterations = 0; - while (!clusteringComplete) { - // Merge 2 closest clusters. Clustering complete if closest dist > epsilon. - if (MergeClosest()) break; - // If the target number of clusters is reached we are done - if (Nclusters() <= nclusters_) { - mprintf("\n\tTarget # of clusters (%i) met (%u), clustering complete.\n", nclusters_, - Nclusters()); - break; - } - if (Nclusters() == 1) clusteringComplete = true; // Sanity check - cluster_progress.Update( iterations++ ); - } - mprintf("\tCompleted after %i iterations, %u clusters.\n",iterations, - Nclusters()); - return 0; -} - -void Cluster_HierAgglo::ClusterResults(CpptrajFile& outfile) const { - outfile.Printf("#Algorithm: HierAgglo linkage %s nclusters %i epsilon %g\n", - LinkageString[linkage_], nclusters_, epsilon_); -} - -#ifdef TIMER -void Cluster_HierAgglo::Timing(double total) const { - time_findMin_.WriteTiming(2, "Find min distance", total); - time_mergeFrames_.WriteTiming(2, "Merge cluster frames", total); - time_calcLinkage_.WriteTiming(2, "Calculate new linkage", total); -} -#endif - -/** Find and merge the two closest clusters. */ -int Cluster_HierAgglo::MergeClosest() { - int C1, C2; - // Find the minimum distance between clusters. C1 will be lower than C2. -# ifdef TIMER - time_findMin_.Start(); -# endif - double min = ClusterDistances_.FindMin(C1, C2); -# ifdef TIMER - time_findMin_.Stop(); -# endif - if (eps_v_n_.IsOpen()) - eps_v_n_.Printf("%12g %12i\n", min, Nclusters()); - if (debug_>0) - mprintf("\tMinimum found between clusters %i and %i (%f)\n",C1,C2,min); - // If the minimum distance is greater than epsilon we are done - if (min > epsilon_) { - mprintf("\n\tMinimum distance (%f) is greater than epsilon (%f), clustering complete.\n", - min, epsilon_); - return 1; - } - - // Find C1, the number of the cluster to be merged into. - cluster_it C1_it = clusters_.begin(); - for (; C1_it != clusters_.end(); ++C1_it) - { - if ( C1_it->Num() == C1 ) break; - } - if (C1_it == clusters_.end()) { - mprinterr("Error: MergeClosest: C1 (%i) not found.\n",C1); - return 1; - } - // Find C2 - start from C1 since C1 < C2 - cluster_it C2_it = C1_it; - for (; C2_it != clusters_.end(); ++C2_it) { - if ( C2_it->Num() == C2 ) break; - } - if (C2_it == clusters_.end()) { - mprinterr("Error: MergeClosest: C2 (%i) not found.\n",C2); - return 1; - } - - // Merge the closest clusters, C2 -> C1, remove C2 -# ifdef TIMER - time_mergeFrames_.Start(); -# endif - C1_it->MergeFrames( *C2_it ); - clusters_.erase( C2_it ); -# ifdef TIMER - time_mergeFrames_.Stop(); -# endif - // DEBUG - if (debug_>1) { - mprintf("\nAFTER MERGE of %i and %i:\n",C1,C2); - PrintClusters(); - } - // Remove all distances having to do with C2 - ClusterDistances_.Ignore(C2); -# ifdef TIMER - time_calcLinkage_.Start(); -# endif - switch (linkage_) { - case AVERAGELINK : calcAvgDist(C1_it); break; - case SINGLELINK : calcMinDist(C1_it); break; - case COMPLETELINK: calcMaxDist(C1_it); break; - } -# ifdef TIMER - time_calcLinkage_.Stop(); -# endif - if (debug_>2) { - mprintf("NEW CLUSTER DISTANCES:\n"); - ClusterDistances_.PrintElements(); - } - - return 0; -} - -// Cluster_HierAgglo::ClusterDistance() -double Cluster_HierAgglo::ClusterDistance(ClusterNode const& C1, ClusterNode const& C2) const { - double dist = 0.0; - if (includeSievedFrames_) { - if (linkage_ == AVERAGELINK) { - for (ClusterNode::frame_iterator f1 = C1.beginframe(); f1 != C1.endframe(); ++f1) - { - for (ClusterNode::frame_iterator f2 = C2.beginframe(); f2 != C2.endframe(); ++f2) - dist += Frame_Distance(*f1, *f2); - } - dist /= (double)(C1.Nframes() * C2.Nframes()); - } else if (linkage_ == SINGLELINK) { // min - dist = DBL_MAX; - for (ClusterNode::frame_iterator f1 = C1.beginframe(); f1 != C1.endframe(); ++f1) - { - for (ClusterNode::frame_iterator f2 = C2.beginframe(); f2 != C2.endframe(); ++f2) - dist = std::min( Frame_Distance(*f1, *f2), dist ); - } - } else if (linkage_ == COMPLETELINK) { // max - dist = -1.0; - for (ClusterNode::frame_iterator f1 = C1.beginframe(); f1 != C1.endframe(); ++f1) - { - for (ClusterNode::frame_iterator f2 = C2.beginframe(); f2 != C2.endframe(); ++f2) - dist = std::max( Frame_Distance(*f1, *f2), dist ); - } - } - } else { - // Ignore sieved frames. - switch (linkage_) { - case AVERAGELINK : dist = 0.0; break; - case SINGLELINK : dist = DBL_MAX; break; - case COMPLETELINK: dist = -1.0; break; - } - unsigned int Nelements = 0; - for (ClusterNode::frame_iterator f1 = C1.beginframe(); f1 != C1.endframe(); ++f1) - { - if (!FrameDistances().FrameWasSieved( *f1 )) { - for (ClusterNode::frame_iterator f2 = C2.beginframe(); f2 != C2.endframe(); ++f2) - { - if (!FrameDistances().FrameWasSieved( *f2 )) { - switch (linkage_) { - case AVERAGELINK : dist += Frame_Distance(*f1, *f2); ++Nelements; break; - case SINGLELINK : dist = std::min( Frame_Distance(*f1, *f2), dist ); break; - case COMPLETELINK: dist = std::max( Frame_Distance(*f1, *f2), dist ); break; - } - } - } - } - } - if (linkage_ == AVERAGELINK) dist /= (double)Nelements; - } - if (debug_ > 0) - mprintf("DEBUG: Calc dist between clusters %i (%i frames) and %i (%i frames), %g\n", - C1.Num(), C1.Nframes(), C2.Num(), C2.Nframes(), dist); - return dist; -} - -/** Calculate the minimum distance between frames in cluster specified by - * iterator C1 and frames in all other clusters. - */ -void Cluster_HierAgglo::calcMinDist(cluster_it& C1_it) -{ - // All cluster distances to C1 must be recalcd. - for (cluster_it C2_it = clusters_.begin(); - C2_it != clusters_.end(); ++C2_it) - { - if (C2_it == C1_it) continue; - //mprintf("\t\tRecalc distance between %i and %i:\n",C1,newc2); - // Pick the minimum distance between newc2 and C1 - double min = DBL_MAX; - for (ClusterNode::frame_iterator c1frames = C1_it->beginframe(); - c1frames != C1_it->endframe(); - ++c1frames) - { - for (ClusterNode::frame_iterator c2frames = C2_it->beginframe(); - c2frames != C2_it->endframe(); - ++c2frames) - { - double Dist = FrameDistances().GetFdist(*c1frames, *c2frames); - //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); - if ( Dist < min ) min = Dist; - } - } - //mprintf("\t\tMin distance between %i and %i: %f\n",C1,newc2,min); - ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), min ); - } -} - -/** Calculate the maximum distance between frames in cluster specified by - * iterator C1 and frames in all other clusters. - */ -void Cluster_HierAgglo::calcMaxDist(cluster_it& C1_it) -{ - // All cluster distances to C1 must be recalcd. - for (cluster_it C2_it = clusters_.begin(); - C2_it != clusters_.end(); ++C2_it) - { - if (C2_it == C1_it) continue; - //mprintf("\t\tRecalc distance between %i and %i:\n",C1,newc2); - // Pick the maximum distance between newc2 and C1 - double max = -1.0; - for (ClusterNode::frame_iterator c1frames = C1_it->beginframe(); - c1frames != C1_it->endframe(); - ++c1frames) - { - for (ClusterNode::frame_iterator c2frames = C2_it->beginframe(); - c2frames != C2_it->endframe(); - ++c2frames) - { - double Dist = FrameDistances().GetFdist(*c1frames, *c2frames); - //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); - if ( Dist > max ) max = Dist; - } - } - //mprintf("\t\tMax distance between %i and %i: %f\n",C1,newc2,max); - ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), max ); - } -} - -/** Calculate the average distance between frames in cluster specified by - * iterator C1 and frames in all other clusters. - */ -void Cluster_HierAgglo::calcAvgDist(cluster_it& C1_it) -{ - // All cluster distances to C1 must be recalcd. - for (cluster_it C2_it = clusters_.begin(); - C2_it != clusters_.end(); ++C2_it) - { - if (C2_it == C1_it) continue; - //mprintf("\t\tRecalc distance between %i and %i:\n",(*C1_it).Num(),(*C2_it).Num()); - // Pick the minimum distance between newc2 and C1 - double sumDist = 0; - for (ClusterNode::frame_iterator c1frames = C1_it->beginframe(); - c1frames != C1_it->endframe(); - ++c1frames) - { - for (ClusterNode::frame_iterator c2frames = C2_it->beginframe(); - c2frames != C2_it->endframe(); - ++c2frames) - { - double Dist = FrameDistances().GetFdist(*c1frames, *c2frames); - //mprintf("\t\t\tFrame %i to frame %i = %f\n",*c1frames,*c2frames,Dist); - sumDist += Dist; - } - } - double Dist = sumDist / (double)(C1_it->Nframes() * C2_it->Nframes()); - //mprintf("\t\tAvg distance between %i and %i: %f\n",(*C1_it).Num(),(*C2_it).Num(),Dist); - ClusterDistances_.SetCdist( C1_it->Num(), C2_it->Num(), Dist ); - } -} diff --git a/src/Cluster_HierAgglo.h b/src/Cluster_HierAgglo.h deleted file mode 100644 index 02829add47..0000000000 --- a/src/Cluster_HierAgglo.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef INC_CLUSTER_HIERAGGLO_H -#define INC_CLUSTER_HIERAGGLO_H -#include "ClusterList.h" -#include "ClusterMatrix.h" -#ifdef TIMER -# include "Timer.h" -#endif -class Cluster_HierAgglo : public ClusterList { - public: - Cluster_HierAgglo(); - static void Help(); - int SetupCluster(ArgList&); - void ClusteringInfo() const; - int Cluster(); - /// \return Distance between given clusters based on current linkage - double ClusterDistance(ClusterNode const&, ClusterNode const&) const; -# ifdef TIMER - void Timing(double) const; -# endif - void AddSievedFrames() { AddSievedFramesByCentroid(); } - void ClusterResults(CpptrajFile&) const; - private: - void InitializeClusterDistances(); - int MergeClosest(); - void calcMinDist(cluster_it&); - void calcMaxDist(cluster_it&); - void calcAvgDist(cluster_it&); - - /// Type of distance calculation between clusters. - enum LINKAGETYPE { SINGLELINK = 0, AVERAGELINK, COMPLETELINK }; - int nclusters_; ///< Target # of clusters. - double epsilon_; ///< Once the min distance between clusters is > epsilon, stop. - LINKAGETYPE linkage_; ///< Cluster Linkage type. - bool includeSievedFrames_; ///< If true include sieved frames in ClusterDistance() calc. - CpptrajFile eps_v_n_; ///< Write epsilon vs # clusters. - ClusterMatrix ClusterDistances_; -# ifdef TIMER - Timer time_findMin_; - Timer time_mergeFrames_; - Timer time_calcLinkage_; -# endif -}; -#endif diff --git a/src/Cluster_Kmeans.cpp b/src/Cluster_Kmeans.cpp deleted file mode 100644 index 44faa70468..0000000000 --- a/src/Cluster_Kmeans.cpp +++ /dev/null @@ -1,286 +0,0 @@ -#include "Cluster_Kmeans.h" -#include "CpptrajStdio.h" -#include "ProgressBar.h" - -Cluster_Kmeans::Cluster_Kmeans() : - nclusters_(0), - kseed_(-1), - maxIt_(100), - mode_(SEQUENTIAL), - clusterToClusterCentroid_(false) -{} - -void Cluster_Kmeans::Help() { - mprintf("\t[kmeans clusters [randompoint [kseed ]] [maxit ]\n"); -} - -// Cluster_Kmeans::SetupCluster() -int Cluster_Kmeans::SetupCluster(ArgList& analyzeArgs) { - nclusters_ = analyzeArgs.getKeyInt("clusters", -1); - if (nclusters_ < 2) { - mprinterr("Error: Specify number of clusters > 1 for K-means algorithm.\n"); - return 1; - } - if (analyzeArgs.hasKey("randompoint")) - mode_ = RANDOM; - else - mode_ = SEQUENTIAL; - kseed_ = analyzeArgs.getKeyInt("kseed", -1); - maxIt_ = analyzeArgs.getKeyInt("maxit", 100); - return 0; -} - -// Cluster_Kmeans::ClusteringInfo() -void Cluster_Kmeans::ClusteringInfo() const { - mprintf("\tK-MEANS: Looking for %i clusters.\n", nclusters_); - if (mode_ == SEQUENTIAL) - mprintf("\t\tSequentially modify each point.\n"); - else - mprintf("\t\tRandomly pick points for modification.\n"); - if (kseed_ != -1 && mode_ == RANDOM) - mprintf("\t\tSeed for random number generator: %i\n", kseed_); - mprintf("\tCluster to cluster distance will be based on"); - if (clusterToClusterCentroid_) - mprintf(" best representative from cluster.\n"); - else - mprintf(" cluster centroids.\n"); -} - -// Cluster_Kmeans::ClusterResults() -void Cluster_Kmeans::ClusterResults(CpptrajFile& outfile) const { - outfile.Printf("#Algorithm: Kmeans nclusters %i maxit %i\n", nclusters_, maxIt_); -} - -// Cluster_Kmeans::Cluster() -int Cluster_Kmeans::Cluster() { - // First determine which frames are being clustered. - Iarray const& FramesToCluster = FrameDistances().FramesToCluster(); - - // Determine seeds - FindKmeansSeeds( FramesToCluster ); - - if (mode_ == RANDOM) - RN_.rn_set( kseed_ ); - - int pointCount = (int)FramesToCluster.size(); - - // This array will hold the indices of the points to process each iteration. - // If sequential this is just 0 -> pointCount. If random this will be - // reassigned each iteration. - Iarray PointIndices; - PointIndices.reserve( pointCount ); - for (int processIdx = 0; processIdx != pointCount; processIdx++) - PointIndices.push_back( processIdx ); - - // Add the seed clusters - for (Iarray::const_iterator seedIdx = SeedIndices_.begin(); - seedIdx != SeedIndices_.end(); ++seedIdx) - { - int seedFrame = FramesToCluster[ *seedIdx ]; - // A centroid is created for new clusters. - AddCluster( ClusterDist::Cframes(1, seedFrame) ); - // NOTE: No need to calc best rep frame, only 1 frame. - if (debug_ > 0) - mprintf("Put frame %i in cluster %i (seed index=%i).\n", - seedFrame, clusters_.back().Num(), *seedIdx); - } - // Assign points in 3 passes. If a point looked like it belonged to cluster A - // at first, but then we added many other points and altered our cluster - // shapes, its possible that we will want to reassign it to cluster B. - for (int iteration = 0; iteration != maxIt_; iteration++) - { - if (mode_ == RANDOM) - ShufflePoints( PointIndices ); - // Add each point to an existing cluster, and recompute centroid - mprintf("\tRound %i: ", iteration); - ProgressBar progress( PointIndices.size() ); - int Nchanged = 0; - int prog = 0; - for (Iarray::const_iterator pointIdx = PointIndices.begin(); - pointIdx != PointIndices.end(); ++pointIdx, ++prog) - { - if (debug_ < 1) progress.Update( prog ); - int oldClusterIdx = -1; -// if ( iteration != 0 || mode_ != SEQUENTIAL) // FIXME: Should this really happen for RANDOM -// { - int pointFrame = FramesToCluster[ *pointIdx ]; - if (debug_ > 0) - mprintf("DEBUG: Processing frame %i (index %i)\n", pointFrame, *pointIdx); - bool pointWasYanked = true; - if (iteration > 0) { - // Yank this point out of its cluster, recompute the centroid - for (cluster_it C1 = clusters_.begin(); C1 != clusters_.end(); ++C1) - { - if (C1->HasFrame( pointFrame )) - { - // If this point is alone in its cluster its in the right place - if (C1->Nframes() == 1) { - pointWasYanked = false; - continue; // FIXME: should this be a break? - } - //oldBestRep = C1->BestRepFrame(); - oldClusterIdx = C1->Num(); - C1->RemoveFrameUpdateCentroid( Cdist_, pointFrame ); // TEST -// C1->RemoveFrameFromCluster( pointFrame ); - //newBestRep = C1->FindBestRepFrame(); -// C1->CalculateCentroid( Cdist_ ); - if (debug_ > 0) - mprintf("Remove Frame %i from cluster %i\n", pointFrame, C1->Num()); - //if (clusterToClusterCentroid_) { - // if (oldBestRep != NewBestRep) - // C1->AlignToBestRep( Cdist_ ); // FIXME: Only relevant for COORDS dist? - // C1->CalculateCentroid( Cdist_ ); // FIXME: Seems unnessecary to align prior - //} - } - } - } else { - // First iteration. If this point is already in a cluster it is a seed. - for (cluster_it C1 = clusters_.begin(); C1 != clusters_.end(); ++C1) - { - if (C1->HasFrame( pointFrame )) { - pointWasYanked = false; - if (debug_ > 0) - mprintf("Frame %i was already used to seed cluster %i\n", - pointFrame, C1->Num()); - continue; // FIXME break? - } - } - } - if (pointWasYanked) { - // Find out what cluster this point is now closest to. - double closestDist = -1.0; - cluster_it closestCluster = clusters_.begin(); - for (cluster_it C1 = clusters_.begin(); C1 != clusters_.end(); ++C1) - { - double dist = Cdist_->FrameCentroidDist(pointFrame, C1->Cent()); - if (closestDist < 0.0 || dist < closestDist) - { - closestDist = dist; - closestCluster = C1; - } - } - //oldBestRep = closestCluster->BestRepFrame(); - closestCluster->AddFrameUpdateCentroid( Cdist_, pointFrame ); // TEST -// closestCluster->AddFrameToCluster( pointFrame ); - //newBestRep = closestCluster->FindBestFrameFrame(); -// closestCluster->CalculateCentroid( Cdist_ ); - if (closestCluster->Num() != oldClusterIdx) - { - Nchanged++; - if (debug_ > 0) - mprintf("Remove Frame %i from cluster %i, but add to cluster %i (dist= %f).\n", - pointFrame, oldClusterIdx, closestCluster->Num(), closestDist); - } else { - if (debug_ > 0) - mprintf("Frame %i staying in cluster %i\n", pointFrame, closestCluster->Num()); - } - if (clusterToClusterCentroid_) { - //if (oldBestRep != NewBestRep) { - // C1->AlignToBestRep( Cdist_ ); // FIXME: Only relevant for COORDS dist? - // C1->CalculateCentroid( Cdist_ ); // FIXME: Seems unnessecary to align prior - //} - } - } -// } - } // END loop over points to cluster - if (Nchanged == 0) { - mprintf("\tK-means round %i: No change. Skipping the rest of the iterations.\n", iteration); - break; - } else - mprintf("\tK-means round %i: %i points changed cluster assignment.\n", iteration, Nchanged); - } // END k-means iterations - // Remove any empty clusters - // FIXME: Will there ever be empty clusters? - RemoveEmptyClusters(); - // NOTE in PTRAJ here align all frames to best rep - return 0; -} - -// Cluster_Kmeans::FindKmeansSeeds() -/** Find some seed-points for K-means clustering. Take the first point as an - * arbitrary first choice. Then, at each iteration, add the point whose total - * distance from our set of seeds is as large as possible. - */ -int Cluster_Kmeans::FindKmeansSeeds(Iarray const& FramesToCluster) { - // SeedIndices will hold indices into FramesToCluster - SeedIndices_.resize( nclusters_, 1 ); // 1 used to be consistent with ptraj - - double bestDistance = 0.0; - int frameCount = (int)FramesToCluster.size(); - for (int frameIdx = 0; frameIdx != frameCount; frameIdx++) - { - int seedFrame = FramesToCluster[ frameIdx ]; - for (int candidateIdx = frameIdx; candidateIdx < frameCount; candidateIdx++) - { - int candidateFrame = FramesToCluster[ candidateIdx ]; - double dist = FrameDistances().GetFdist( seedFrame, candidateFrame ); - if (dist > bestDistance) - { - bestDistance = dist; - SeedIndices_[0] = frameIdx; - SeedIndices_[1] = candidateIdx; - } - } - } - - for (int seedIdx = 2; seedIdx != nclusters_; seedIdx++) - { - bestDistance = 0.0; - int bestIdx = 0; - for (int candidateIdx = 0; candidateIdx < frameCount; candidateIdx++) - { - // Make sure this candidate isnt already a seed - bool skipCandidate = false; - for (int checkIdx = 0; checkIdx != seedIdx; checkIdx++) - { - if (SeedIndices_[checkIdx] == candidateIdx) { - skipCandidate = true; - break; - } - } - if (!skipCandidate) { - // Get the closest distance from this candidate to a current seed - int candidateFrame = FramesToCluster[ candidateIdx ]; - double nearestDist = -1.0; - for (int checkIdx = 0; checkIdx != seedIdx; checkIdx++) - { - int seedFrame = FramesToCluster[ SeedIndices_[checkIdx] ]; - double dist = FrameDistances().GetFdist( candidateFrame, seedFrame ); - if (dist < nearestDist || nearestDist < 0.0) - nearestDist = dist; - } - // Is this the best so far? - if (nearestDist > bestDistance) - { - bestDistance = nearestDist; - bestIdx = candidateIdx; - } - } - } - SeedIndices_[seedIdx] = bestIdx; - } - if (debug_ > 0) - for (unsigned int si = 0; si != SeedIndices_.size(); si++) - mprintf("DEBUG:\t\tSeedIndices[%u]= %i\n", si, SeedIndices_[si]); - return 0; -} - -/** Use modern version of the Fisher-Yates shuffle to randomly reorder the - * given points. - */ -void Cluster_Kmeans::ShufflePoints( Iarray& PointIndices ) { - for (unsigned int i = PointIndices.size() - 1; i != 1; i--) - { // 0 <= j <= i - unsigned int j = (unsigned int)(RN_.rn_gen() * (double)i); - int temp = PointIndices[j]; - PointIndices[j] = PointIndices[i]; - PointIndices[i] = temp; - } - if (debug_ > 0) { - mprintf("DEBUG: Shuffled points:"); - for (Iarray::const_iterator it = PointIndices.begin(); - it != PointIndices.end(); ++it) - mprintf(" %i", *it); - mprintf("\n"); - } -} diff --git a/src/Cluster_Kmeans.h b/src/Cluster_Kmeans.h deleted file mode 100644 index 3882eff5e9..0000000000 --- a/src/Cluster_Kmeans.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef INC_CLUSTER_KMEANS_H -#define INC_CLUSTER_KMEANS_H -#include "ClusterList.h" -#include "Random.h" -class Cluster_Kmeans : public ClusterList { - public: - Cluster_Kmeans(); - static void Help(); - int SetupCluster(ArgList&); - void ClusteringInfo() const; - int Cluster(); -# ifdef TIMER - void Timing(double) const {} -# endif - void AddSievedFrames() { AddSievedFramesByCentroid(); } - void ClusterResults(CpptrajFile&) const; - private: - typedef std::vector Iarray; - enum KmeansModeType { SEQUENTIAL, RANDOM }; - - int FindKmeansSeeds(Iarray const&); - void ShufflePoints(Iarray&); - - Random_Number RN_; - int nclusters_; ///< Target number of clusters. - int kseed_; - int maxIt_; - Iarray SeedIndices_; - KmeansModeType mode_; - bool clusterToClusterCentroid_; -}; -#endif diff --git a/src/Cluster_ReadInfo.cpp b/src/Cluster_ReadInfo.cpp deleted file mode 100644 index b61368495e..0000000000 --- a/src/Cluster_ReadInfo.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "Cluster_ReadInfo.h" -#include "CpptrajStdio.h" -#include "BufferedLine.h" - -Cluster_ReadInfo::Cluster_ReadInfo() {} - -void Cluster_ReadInfo::Help() { - mprintf("\t[{readtxt|readinfo} infofile ]\n"); -} - -int Cluster_ReadInfo::SetupCluster(ArgList& analyzeArgs) { - filename_ = analyzeArgs.GetStringKey("infofile"); - if (filename_.empty()) { - mprinterr("Error: No cluster info filename given.\n"); - return 1; - } - return 0; -} - -void Cluster_ReadInfo::ClusteringInfo() const { - mprintf("\tREADINFO: Reading cluster information from previous run, file %s.\n", - filename_.c_str()); -} - -static int Err(int code) { - switch (code) { - case 0: mprinterr("Error: Could not open info file.\n"); break; - case 1: mprinterr("Error: Unexpected end of info file.\n"); break; - case 2: mprinterr("Error: Invalid number of clusters in info file.\n"); break; - case 3: mprinterr("Error: Invalid number of frames in info file.\n"); break; - } - return 1; -} - -int Cluster_ReadInfo::Cluster() { - BufferedLine infile; - if (infile.OpenFileRead( filename_ )) return Err(0); - const char* ptr = infile.Line(); - if (ptr == 0) return Err(1); - ArgList infoLine( ptr, " " ); - int nclusters = infoLine.getKeyInt("#Clustering:", -1); - if (nclusters == -1) return Err(2); - int nframes = infoLine.getKeyInt("clusters", -1); - if (nframes == -1) return Err(3); - if (nframes != (int)FrameDistances().OriginalNframes()) { - mprinterr("Error: # frames in cluster info file (%i) does not match" - " current # frames (%zu)\n", nframes, FrameDistances().OriginalNframes()); - return 1; - } - // Scan down to clusters - while (ptr[0] == '#') { - ptr = infile.Line(); - if (ptr == 0) return Err(1); - // Save previous clustering info. Includes newline. - if (ptr[1] == 'A' && ptr[2] == 'l' && ptr[3] == 'g') - algorithm_.assign( ptr + 12 ); // Right past '#Algorithm: ' - } - // Read clusters - ClusterDist::Cframes frames; - for (int cnum = 0; cnum != nclusters; cnum++) { - if (ptr == 0) return Err(1); - frames.clear(); - // TODO: Check for busted lines? - for (int fidx = 0; fidx != nframes; fidx++) { - if (ptr[fidx] == 'X') - frames.push_back( fidx ); - } - AddCluster( frames ); - mprintf("\tRead cluster %i, %zu frames.\n", cnum, frames.size()); - ptr = infile.Line(); - } - infile.CloseFile(); - return 0; -} - -void Cluster_ReadInfo::ClusterResults(CpptrajFile& outfile) const { - outfile.Printf("#Algorithm: Read from file '%s'\n", filename_.c_str()); - if (!algorithm_.empty()) - outfile.Printf("#Original algorithm: %s\n", algorithm_.c_str()); -} diff --git a/src/Cluster_ReadInfo.h b/src/Cluster_ReadInfo.h deleted file mode 100644 index 89e3414b5c..0000000000 --- a/src/Cluster_ReadInfo.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef INC_CLUSTER_READINFO_H -#define INC_CLUSTER_READINFO_H -#include "ClusterList.h" -/// Read in previous cluster run -class Cluster_ReadInfo : public ClusterList { - public: - Cluster_ReadInfo(); - static void Help(); - int SetupCluster(ArgList&); - void ClusteringInfo() const; - int Cluster(); -# ifdef TIMER - void Timing(double) const {} -# endif - void AddSievedFrames() { } - void ClusterResults(CpptrajFile&) const; - private: - std::string filename_; - std::string algorithm_; -}; -#endif diff --git a/src/Command.cpp b/src/Command.cpp index fde12649b8..b331bc4e1a 100644 --- a/src/Command.cpp +++ b/src/Command.cpp @@ -152,7 +152,6 @@ #include "Analysis_CrdFluct.h" #include "Analysis_RmsAvgCorr.h" #include "Analysis_Rms2d.h" -#include "Analysis_Clustering.h" #include "Analysis_RunningAvg.h" #include "Analysis_MeltCurve.h" #include "Analysis_Overlap.h" @@ -358,8 +357,7 @@ void Command::Init() { Command::AddCmd( new Analysis_AutoCorr(), Cmd::ANA, 1, "autocorr" ); Command::AddCmd( new Analysis_Average(), Cmd::ANA, 1, "avg" ); Command::AddCmd( new Analysis_State(), Cmd::ANA, 1, "calcstate" ); - Command::AddCmd( new Analysis_Cluster(), Cmd::ANA, 1, "cluster2" ); // HIDDEN - Command::AddCmd( new Analysis_Clustering(), Cmd::ANA, 1, "cluster" ); + Command::AddCmd( new Analysis_Cluster(), Cmd::ANA, 1, "cluster" ); // HIDDEN Command::AddCmd( new Analysis_Corr(), Cmd::ANA, 2, "corr", "correlationcoe" ); Command::AddCmd( new Analysis_ConstantPHStats,Cmd::ANA,1, "cphstats" ); Command::AddCmd( new Analysis_CrankShaft(), Cmd::ANA, 2, "crank", "crankshaft" ); diff --git a/src/DataFile.cpp b/src/DataFile.cpp index a82ee21035..463bbb2367 100644 --- a/src/DataFile.cpp +++ b/src/DataFile.cpp @@ -20,13 +20,12 @@ #include "DataIO_VecTraj.h" #include "DataIO_XVG.h" #include "DataIO_CCP4.h" -#include "DataIO_Cmatrix.h" -#include "DataIO_NC_Cmatrix.h" #include "DataIO_CharmmRepLog.h" #include "DataIO_CharmmFastRep.h" #include "DataIO_CharmmOutput.h" #include "DataIO_Cpout.h" #include "DataIO_CharmmRtfPrm.h" +#include "DataIO_Cmatrix_Binary.h" // CONSTRUCTOR DataFile::DataFile() : @@ -61,17 +60,12 @@ const FileTypes::AllocToken DataFile::DF_AllocArray[] = { { "Vector pseudo-traj", 0, DataIO_VecTraj::WriteHelp,DataIO_VecTraj::Alloc}, { "XVG file", 0, 0, DataIO_XVG::Alloc }, { "CCP4 file", 0, DataIO_CCP4::WriteHelp, DataIO_CCP4::Alloc }, - { "Cluster matrix file",0, 0, DataIO_Cmatrix::Alloc}, -# ifdef BINTRAJ - { "NetCDF Cluster matrix file", 0, 0, DataIO_NC_Cmatrix::Alloc}, -# else - { "NetCDF Cluster matrix file", 0, 0, 0 }, -# endif { "CHARMM REM log", DataIO_CharmmRepLog::ReadHelp, 0, DataIO_CharmmRepLog::Alloc}, { "CHARMM Fast REM log",0, 0, DataIO_CharmmFastRep::Alloc}, { "CHARMM Output", 0, 0, DataIO_CharmmOutput::Alloc}, { "Amber CPOUT", DataIO_Cpout::ReadHelp, DataIO_Cpout::WriteHelp, DataIO_Cpout::Alloc}, { "CHARMM RTF/PRM", 0, 0, DataIO_CharmmRtfPrm::Alloc }, + { "Pairwise Cache (binary)", 0, 0, DataIO_Cmatrix_Binary::Alloc }, { "Unknown Data file", 0, 0, 0 } }; @@ -88,11 +82,11 @@ const FileTypes::KeyToken DataFile::DF_KeyArray[] = { { EVECS, "evecs", ".evecs" }, { XVG, "xvg", ".xvg" }, { CCP4, "ccp4", ".ccp4" }, - { CMATRIX, "cmatrix",".cmatrix" }, - { NCCMATRIX, "nccmatrix", ".nccmatrix" }, +// { NCCMATRIX, "nccmatrix", ".nccmatrix" }, { CHARMMREPD, "charmmrepd",".exch" }, { CHARMMOUT, "charmmout", ".charmmout"}, { CHARMMRTFPRM, "charmmrtfprm", ".rtfprm"}, + { CMATRIX_BINARY,"cmatrix",".cmatrix" }, { UNKNOWN_DATA, 0, 0 } }; @@ -108,9 +102,9 @@ const FileTypes::KeyToken DataFile::DF_WriteKeyArray[] = { { EVECS, "evecs", ".evecs" }, { VECTRAJ, "vectraj",".vectraj" }, { CCP4, "ccp4", ".ccp4" }, - { CMATRIX, "cmatrix",".cmatrix" }, - { NCCMATRIX, "nccmatrix", ".nccmatrix" }, +// { NCCMATRIX, "nccmatrix", ".nccmatrix" }, { CPOUT, "cpout", ".cpout" }, + { CMATRIX_BINARY, "cmatrix",".cmatrix" }, { UNKNOWN_DATA, 0, 0 } }; diff --git a/src/DataFile.h b/src/DataFile.h index 368842a462..4aa636ca8a 100644 --- a/src/DataFile.h +++ b/src/DataFile.h @@ -14,8 +14,8 @@ class DataFile { /// Known data file formats. enum DataFormatType { DATAFILE=0, XMGRACE, GNUPLOT, XPLOR, OPENDX, REMLOG, MDOUT, EVECS, - VECTRAJ, XVG, CCP4, CMATRIX, NCCMATRIX, CHARMMREPD, CHARMMFASTREP, - CHARMMOUT, CPOUT, CHARMMRTFPRM, UNKNOWN_DATA + VECTRAJ, XVG, CCP4, CHARMMREPD, CHARMMFASTREP, + CHARMMOUT, CPOUT, CHARMMRTFPRM, CMATRIX_BINARY, UNKNOWN_DATA }; DataFile(); ~DataFile(); diff --git a/src/DataIO_Cmatrix.cpp b/src/DataIO_Cmatrix.cpp deleted file mode 100644 index 8f4ab96ad4..0000000000 --- a/src/DataIO_Cmatrix.cpp +++ /dev/null @@ -1,192 +0,0 @@ -#include "DataIO_Cmatrix.h" -#include "CpptrajStdio.h" - -// NOTES: -// Version 1: Add write of ignore array when reduced. Write nrows and -// and nelements as 8 byte integers. -// Version 2: Instead of nrows and nelements, write original nrows -// and actual nrows to easily determine if this is a reduced -// matrix. Also write sieve value. -// Version 2 Update: Read/write sieve value as signed, negative -// value is random sieve. Variable is same # -// of bytes so should be backwards-compatible. -const unsigned char DataIO_Cmatrix::Magic_[4] = {'C', 'T', 'M', 2}; - -// CONSTRUCTOR -DataIO_Cmatrix::DataIO_Cmatrix() -{ - SetValid( DataSet::CMATRIX ); -} - -bool DataIO_Cmatrix::ID_DataFormat(CpptrajFile& infile) { - unsigned char magic[4]; - if (infile.OpenFile()) return false; - infile.Read( magic, 4 ); - infile.CloseFile(); - return (magic[0]==Magic_[0] && magic[1]==Magic_[1] && magic[2]==Magic_[2]); -} - -// ----------------------------------------------------------------------------- -// DataIO_Cmatrix::ReadHelp() -void DataIO_Cmatrix::ReadHelp() { - -} - -// DataIO_Cmatrix::processReadArgs() -int DataIO_Cmatrix::processReadArgs(ArgList& argIn) { - - return 0; -} - -// DataIO_Cmatrix::ReadData() -int DataIO_Cmatrix::ReadData(FileName const& fname, - DataSetList& dsl, std::string const& dsname) -{ - // Allocate data set - MetaData md( dsname, MetaData::M_MATRIX ); - DataSet* ds = dsl.AddSet(DataSet::CMATRIX, md, "Cmatrix"); - if (ds == 0) return 1; - DataSet_Cmatrix_MEM& Mat = static_cast( *ds ); - return ReadCmatrix(fname, Mat); -} - -// DataIO_Cmatrix::ReadCmatrix() -int DataIO_Cmatrix::ReadCmatrix(FileName const& fname, DataSet_Cmatrix_MEM& Mat) { - unsigned char magic[4]; - CpptrajFile infile; - uint_8 ROWS, ELTS; - sint_8 SIEVE; - int sieve = 1; - size_t actual_nrows = 0; - // Open file for reading - if (infile.OpenRead(fname)) { - mprinterr("Error: Could not open '%s' for read.\n", fname.full()); - return 1; - } - // SANITY CHECK: Read and check magic byte - infile.Read( magic, 4 ); - if ( magic[0]!=Magic_[0] || magic[1]!=Magic_[1] || magic[2]!=Magic_[2] ) { - mprinterr("Error: File '%s' is not a Cpptraj Cluster Matrix file.\n", fname.full()); - return 1; - } - // Check version, read in nrows and nelements. - if (magic[3] == 0) { - int Ntemp = 0; - infile.Read( &Ntemp, sizeof(int) ); - ROWS = (uint_8)Ntemp; - actual_nrows = (size_t)ROWS; - infile.Read( &Ntemp, sizeof(int) ); - ELTS = (uint_8)Ntemp; - } else if (magic[3] == 1) { - infile.Read( &ROWS, sizeof(uint_8) ); - actual_nrows = (size_t)ROWS; - infile.Read( &ELTS, sizeof(uint_8) ); - } else if (magic[3] == 2) { - infile.Read( &ROWS, sizeof(uint_8) ); // V2: Original Nrows - infile.Read( &ELTS, sizeof(uint_8) ); // V2: Actual Nrows - actual_nrows = (size_t)ELTS; - infile.Read( &SIEVE, sizeof(sint_8) ); // V2: Sieve - sieve = (int)SIEVE; - } else { - mprinterr("Error: ClusterMatrix version %u is not recognized.\n", (unsigned int)magic[3]); - return 1; - } - // If number of rows is not what was expected, abort TODO reimplement somewhere else -/* - if (ROWS != (uint_8)sizeIn) { - mprinterr("Error: ClusterMatrix file %s has %lu rows, expected %i.\n", - fname.full(), ROWS, sizeIn); - return 1; - } -*/ - if (magic[3] == 0 || magic[3] == 1) { - // Version 0/1: Actual # of rows is not known yet. Check that the # elements - // in the file match the original # elements (i.e. matrix is not sieved). - // If it is sieved this is not supported. - uint_8 original_nelements = ( ROWS * (ROWS - 1UL) ) / 2UL; - if ( original_nelements != ELTS ) { - mprinterr("Error: Sieved data in ClusterMatrix file %s (version %u) not supported.\n", - fname.full(), (unsigned int)magic[3]); - return 1; - } - sieve = 1; - } - // Setup underlying TriangleMatrix for actual # of rows - if ( Mat.Allocate( DataSet::SizeArray(1,actual_nrows) ) ) return 1; - // Read in matrix elements - infile.Read( Mat.Ptr(), Mat.Size()*sizeof(float) ); - // If sieved, read in the sieve status array. 'T'=sieved, 'F'=not sieved - std::vector sieveStatus; - if (sieve != 1) { - mprintf("Warning: ClusterMatrix %s contains sieved data.\n", fname.full()); - sieveStatus.resize( ROWS ); // Original nrows - infile.Read( &sieveStatus[0], ROWS*sizeof(char) ); - } else - // No sieved frames. - sieveStatus.assign( ROWS, 'F' ); - // Set sieve status. - if (Mat.SetSieveFromArray(sieveStatus, sieve)) return 1; - - return 0; -} - -// ----------------------------------------------------------------------------- -// DataIO_Cmatrix::WriteHelp() -void DataIO_Cmatrix::WriteHelp() { - -} - -// DataIO_Cmatrix::processWriteArgs() -int DataIO_Cmatrix::processWriteArgs(ArgList &argIn) { - - return 0; -} - -// DataIO_Cmatrix::WriteData() -int DataIO_Cmatrix::WriteData(FileName const& fname, DataSetList const& SetList) -{ - if (SetList.empty()) return 1; - if (SetList.size() > 1) - mprintf("Warning: Multiple sets not yet supported for cluster matrix write.\n"); - DataSet_Cmatrix_MEM const& Mat = static_cast( *(*(SetList.begin())) ); - return WriteCmatrix( fname, Mat ); -} - -// DataIO_Cmatrix::WriteCmatrix() -int DataIO_Cmatrix::WriteCmatrix(FileName const& fname, DataSet_Cmatrix_MEM const& Mat) { - CpptrajFile outfile; - uint_8 ntemp; - // No stdout write allowed. - if (fname.empty()) { - mprinterr("Internal Error: DataIO_Cmatrix::WriteData() called with no filename.\n"); - return 1; - } - if (outfile.OpenWrite(fname)) { - mprinterr("Error: Could not open %s for write.\n", fname.full()); - return 1; - } - // Write magic byte - outfile.Write( Magic_, 4 ); - // Write original number of frames. - ntemp = (uint_8)Mat.OriginalNframes(); - outfile.Write( &ntemp, sizeof(uint_8) ); - // Write actual nrows - ntemp = (uint_8)Mat.Nrows(); - outfile.Write( &ntemp, sizeof(uint_8) ); - // Write out sieve value - sint_8 stemp = (sint_8)Mat.SieveValue(); - outfile.Write( &stemp, sizeof(sint_8) ); - // Write matrix elements - outfile.Write( Mat.Ptr(), Mat.Size()*sizeof(float) ); - // If this is a reduced matrix, write whether each frame was sieved (T) or not (F). - if (Mat.SieveType() != ClusterSieve::NONE) { - std::vector sieveStatus( Mat.OriginalNframes() ); - for (int idx = 0; idx != Mat.OriginalNframes(); idx++) - if (Mat.FrameWasSieved(idx)) - sieveStatus[idx] = 'T'; - else - sieveStatus[idx] = 'F'; - outfile.Write( &sieveStatus[0], Mat.OriginalNframes()*sizeof(char) ); - } - return 0; -} diff --git a/src/DataIO_Cmatrix.h b/src/DataIO_Cmatrix.h deleted file mode 100644 index c1b832a151..0000000000 --- a/src/DataIO_Cmatrix.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef INC_DATAIO_CMATRIX_H -#define INC_DATAIO_CMATRIX_H -#include "DataIO.h" -#include "DataSet_Cmatrix_MEM.h" -/// Read/write cpptraj-format binary cluster pairwise distance matrix files. -class DataIO_Cmatrix : public DataIO { - public: - DataIO_Cmatrix(); - static BaseIOtype* Alloc() { return (BaseIOtype*)new DataIO_Cmatrix(); } - static void ReadHelp(); - static void WriteHelp(); - int processReadArgs(ArgList&); - int ReadData(FileName const&,DataSetList&,std::string const&); - int processWriteArgs(ArgList&); - int WriteData(FileName const&,DataSetList const&); - bool ID_DataFormat(CpptrajFile&); - // ------------------------------------------- - int ReadCmatrix(FileName const&, DataSet_Cmatrix_MEM&); - int WriteCmatrix(FileName const&, DataSet_Cmatrix_MEM const&); - private: - static const unsigned char Magic_[]; - /// For reading/writing 8 byte unsigned integers - typedef unsigned long long int uint_8; - /// For reading/writing 8 byte signed integers - typedef long long int sint_8; -}; -#endif diff --git a/src/DataIO_NC_Cmatrix.cpp b/src/DataIO_NC_Cmatrix.cpp deleted file mode 100644 index d93f1b36ea..0000000000 --- a/src/DataIO_NC_Cmatrix.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "DataIO_NC_Cmatrix.h" -#include "DataSet_Cmatrix_MEM.h" -#include "CpptrajStdio.h" - -/// CONSTRUCTOR -DataIO_NC_Cmatrix::DataIO_NC_Cmatrix() { - SetValid( DataSet::CMATRIX ); -} - -// DataIO_NC_Cmatrix::ReadData() -int DataIO_NC_Cmatrix::ReadData(FileName const& fname, - DataSetList& dsl, std::string const& dsname) -{ - int sieve; - if (file_.OpenCmatrixRead(fname, sieve)) return 1; - - MetaData md( dsname ); - md.SetFileName( fname ); - DataSet* ds = dsl.AddSet( DataSet::CMATRIX, md ); - if (ds == 0) return 1; - DataSet_Cmatrix_MEM& cmatrix = static_cast( *ds ); - // Allocate matrix for actual number of rows - if (cmatrix.Allocate( DataSet::SizeArray(1, file_.MatrixRows()) )) return 1; - // Get the sieve status array. - if (cmatrix.SetSieveFromArray( file_.GetSieveStatus(), sieve )) return 1; - // Get the matrix - if (file_.GetCmatrix( cmatrix.Ptr() )) return 1; - file_.CloseCmatrix(); - - return 0; -} - -int DataIO_NC_Cmatrix::WriteData(FileName const& fname, DataSetList const& SetList) -{ - if (SetList.empty()) return 1; - if (SetList.size() > 1) - mprintf("Warning: Multiple sets not yet supported for cluster matrix write.\n"); - DataSet_Cmatrix_MEM const& Mat = static_cast( *(*(SetList.begin())) ); - // Create the file - if (file_.CreateCmatrix( fname, Mat.OriginalNframes(), Mat.Nrows(), Mat.SieveValue(), - Mat.MetricDescription() )) - return 1; - // Write the matrix - if (file_.WriteCmatrix( Mat.Ptr() )) return 1; - // Write sieved frames - if (Mat.SieveType() != ClusterSieve::NONE) { - if (file_.WriteFramesArray( Mat.FramesToCluster() )) return 1; - } - - file_.CloseCmatrix(); - return 0; -} diff --git a/src/DataIO_NC_Cmatrix.h b/src/DataIO_NC_Cmatrix.h deleted file mode 100644 index de5e31e038..0000000000 --- a/src/DataIO_NC_Cmatrix.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef INC_DATAIO_NC_CMATRIX_H -#define INC_DATAIO_NC_CMATRIX_H -#include "DataIO.h" -#include "NC_Cmatrix.h" -/// Read/write NetCDF pairwise matrix files. -class DataIO_NC_Cmatrix : public DataIO { - public: - DataIO_NC_Cmatrix(); - ~DataIO_NC_Cmatrix() { file_.CloseCmatrix(); } - static BaseIOtype* Alloc() { return (BaseIOtype*)new DataIO_NC_Cmatrix(); } - static void ReadHelp() {} - static void WriteHelp() {} - int processReadArgs(ArgList&) { return 0; } - int ReadData(FileName const&,DataSetList&,std::string const&); - int processWriteArgs(ArgList&) { return 0; } - int WriteData(FileName const&,DataSetList const&); - bool ID_DataFormat(CpptrajFile& f) { return NC_Cmatrix::ID_Cmatrix(f.Filename()); } - private: - NC_Cmatrix file_; -}; -#endif diff --git a/src/DataIO_Std.cpp b/src/DataIO_Std.cpp index 72a61ccd21..4c5e554543 100644 --- a/src/DataIO_Std.cpp +++ b/src/DataIO_Std.cpp @@ -15,7 +15,6 @@ #include "DataSet_Mat3x3.h" // For reading TODO remove dependency? #include "DataSet_2D.h" #include "DataSet_3D.h" -#include "DataSet_Cmatrix_MEM.h" // CONSTRUCTOR DataIO_Std::DataIO_Std() : @@ -303,6 +302,10 @@ int DataIO_Std::Read_1D(std::string const& fname, int DataIO_Std::ReadCmatrix(FileName const& fname, DataSetList& datasetlist, std::string const& dsname) { + mprinterr("Internal Error: ReadCmatrix() must be reimplemented!\n"); + // TODO re-implement + return 1; +/* // Allocate output data set DataSet* ds = datasetlist.AddSet( DataSet::CMATRIX, dsname ); if (ds == 0) return 1; @@ -399,6 +402,7 @@ int DataIO_Std::ReadCmatrix(FileName const& fname, Mat.SetSieveFromArray(sieveStatus, sieveDelta); return 0; +*/ } // DataIO_Std::Read_2D() @@ -896,6 +900,9 @@ int DataIO_Std::WriteData(FileName const& fname, DataSetList const& SetList) // DataIO_Std::WriteCmatrix() int DataIO_Std::WriteCmatrix(CpptrajFile& file, DataSetList const& Sets) { + mprinterr("Internal Error: WriteCmatrix() must be reimplemented!\n"); + return 1; // TODO re-implement +/* for (DataSetList::const_iterator ds = Sets.begin(); ds != Sets.end(); ++ds) { if ( (*ds)->Group() != DataSet::CLUSTERMATRIX) { @@ -930,6 +937,7 @@ int DataIO_Std::WriteCmatrix(CpptrajFile& file, DataSetList const& Sets) { } } return 0; +*/ } // DataIO_Std::WriteDataNormal() diff --git a/src/DataSet.h b/src/DataSet.h index d1426ddb57..27a8a8ee84 100644 --- a/src/DataSet.h +++ b/src/DataSet.h @@ -26,8 +26,8 @@ class DataSet { enum DataType { UNKNOWN_DATA=0, DOUBLE, FLOAT, INTEGER, STRING, MATRIX_DBL, MATRIX_FLT, COORDS, VECTOR, MODES, GRID_FLT, GRID_DBL, REMLOG, XYMESH, TRAJ, REF_FRAME, - MAT3X3, TOPOLOGY, CMATRIX, CMATRIX_NOMEM, CMATRIX_DISK, PH, PH_EXPL, PH_IMPL, - PARAMETERS, PMATRIX_MEM, PMATRIX_NC // TODO remove CMATRIX + MAT3X3, TOPOLOGY, PH, PH_EXPL, PH_IMPL, + PARAMETERS, PMATRIX_MEM, PMATRIX_NC }; /// Group DataSet belongs to. TODO remove CLUSTERMATRIX enum DataGroup { diff --git a/src/DataSetList.cpp b/src/DataSetList.cpp index 9d66bbbd6c..1b89cb0564 100644 --- a/src/DataSetList.cpp +++ b/src/DataSetList.cpp @@ -20,9 +20,6 @@ #include "DataSet_Mat3x3.h" #include "DataSet_Topology.h" #include "DataSet_GridDbl.h" -#include "DataSet_Cmatrix_MEM.h" -#include "DataSet_Cmatrix_NOMEM.h" -#include "DataSet_Cmatrix_DISK.h" #include "DataSet_pH.h" #include "DataSet_PHREMD_Explicit.h" #include "DataSet_PHREMD_Implicit.h" @@ -50,9 +47,6 @@ const DataSetList::DataToken DataSetList::DataArray[] = { { "reference", DataSet_Coords_REF::Alloc }, // REF_FRAME { "3x3 matrices", DataSet_Mat3x3::Alloc }, // MAT3X3 { "topology", DataSet_Topology::Alloc }, // TOPOLOGY - { "cluster matrix",DataSet_Cmatrix_MEM::Alloc}, // CMATRIX - { "cluster matrix (no memory)",DataSet_Cmatrix_NOMEM::Alloc}, // CMATRIX_NOMEM - { "cluster matrix (disk)", DataSet_Cmatrix_DISK::Alloc}, // CMATRIX_DISK { "pH", DataSet_pH::Alloc }, // PH { "pH REMD (explicit)",DataSet_PHREMD_Explicit::Alloc}, // PH_EXPL { "pH REMD (implicit)",DataSet_PHREMD_Implicit::Alloc}, // PH_IMPL diff --git a/src/DataSet_Cmatrix.cpp b/src/DataSet_Cmatrix.cpp deleted file mode 100644 index 13054c73a0..0000000000 --- a/src/DataSet_Cmatrix.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "DataSet_Cmatrix.h" -#include "CpptrajStdio.h" - -void DataSet_Cmatrix::PrintElements() const { - // NOTE: Matrix is square upper triangle, Nrows == Ncols - for (unsigned int row = 0; row != Nrows(); row++) - for (unsigned int col = row + 1; col != Nrows(); col++) - mprintf("\t%u %u %f\n", row+1, col+1, GetFdist(col, row)); -} - -/** Set up sieving info as necessary and set up cluster based on actual - * number of frames to be clustered. - */ -int DataSet_Cmatrix::SetupWithSieve(ClusterDist* CdistIn, size_t sizeIn, int sieveIn, int iseed) -{ - if (CdistIn == 0) { - mprinterr("Internal Error: DataSet_Cmatrix::SetupWithSieve called with empty ClusterDist.\n"); - return 1; - } - metricDescription_.assign( CdistIn->Description() ); - if (sievedFrames_.SetSieve( sieveIn, sizeIn, iseed )) return 1; - if (AllocateCmatrix( sievedFrames_.ActualNframes() )) return 1; - if (SetCdist(CdistIn)) return 1; - if (sievedFrames_.Type() != ClusterSieve::NONE) - mprintf("\tPair-wise matrix set up with sieve, %zu frames, %i sieved frames.\n", - sievedFrames_.MaxFrames(), sievedFrames_.ActualNframes()); - else - mprintf("\tPair-wise matrix set up, %zu frames\n", sizeIn); - return 0; -} - -/** Set up sieve info from an array that contains 'T' if the frame was sieved - * out and 'F' otherwise. - */ -int DataSet_Cmatrix::SetSieveFromArray(std::vector const& sieveStatus, int sieveIn) -{ - if (sieveStatus.empty()) return 1; - // Setup sieve class - if (sievedFrames_.SetSieve( sieveIn, sieveStatus )) { - mprinterr("Error: Could not set sieve from cluster matrix file.\n"); - return 1; - } - mprintf("\tSet up %s: %u original frames, %u actual frames, %u elements", - legend(), sievedFrames_.MaxFrames(), sievedFrames_.ActualNframes(), Nelements()); - if (sievedFrames_.Type() == ClusterSieve::REGULAR) - mprintf(", sieve= %i.\n", sievedFrames_.Sieve()); - else if (sievedFrames_.Type() == ClusterSieve::RANDOM) - mprintf(", random sieve.\n"); - else - mprintf(".\n"); - return 0; -} diff --git a/src/DataSet_Cmatrix.h b/src/DataSet_Cmatrix.h deleted file mode 100644 index fe17833df7..0000000000 --- a/src/DataSet_Cmatrix.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef INC_DATASET_CMATRIX_H -#define INC_DATASET_CMATRIX_H -#include "DataSet.h" -#include "ClusterSieve.h" -#include "ClusterDist.h" -/// Base class for pairwise distance matrices for clustering. -/** This matrix allows for sieving, i.e. it may hold less actual data than - * the original size would warrant. For example, if there were originally - * 10 rows of data the matrix would contain (10*9)/2 = 45 elements. However, - * if every other frame is sieved (i.e. sieve 2) we really only need info - * for (5*4)/2 = 10 elements; in this case we need to map original indices - * to actual indices, which is what the ClusterSieve class is for. - */ -class DataSet_Cmatrix : public DataSet { - public: - DataSet_Cmatrix() {} - DataSet_Cmatrix(DataType t) : DataSet(t, CLUSTERMATRIX, - TextFormat(TextFormat::DOUBLE, 12, 4), 2) {} - virtual ~DataSet_Cmatrix() {} - // ----- DataSet functions ------------------- - // NOTE: Disabled for all DataSet_Cmatrix sets - void Add(size_t, const void*) {} - int Append(DataSet*) { return 1; } -# ifdef MPI - int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } -# endif - // ----- Cmatrix functions ------------------- - /// \return Distance between given frames (indexed by sievedFrames). - virtual double GetFdist(int, int) const = 0; - /// Set element at column/row to given value - virtual void SetElement(int, int, double) = 0; - /// \return Actual number of elements in matrix - virtual size_t Nelements() const = 0; - /// \return size used by matrix in bytes - virtual size_t DataSize() const = 0; - /// \return Actual number of rows in the matrix. - virtual size_t Nrows() const = 0; - /// \return Element at given index. - virtual double GetElement(unsigned int) const = 0; - /// \return true if matrix needs setup - virtual bool NeedsSetup() const = 0; - /// \return true if matrix needs calculation - virtual bool NeedsCalc() const = 0; - /// Indicate that no more distances will be added to matrix. - virtual void Complete() = 0; - // ----- Sieved frames functions ------------- - /// \return An array containing frame numbers that have not been sieved out. - ClusterSieve::SievedFrames const& FramesToCluster() const { return sievedFrames_.Frames(); } - /// \return Sieve value - int SieveValue() const { return sievedFrames_.Sieve(); } - /// \return Sieve type - ClusterSieve::SieveType SieveType() const { return sievedFrames_.Type(); } - /// \return Original number of frames before sieving. - int OriginalNframes() const { return sievedFrames_.MaxFrames(); } - /// \return true if frame was sieved out. - bool FrameWasSieved(int f) const { return (sievedFrames_.FrameToIdx(f) == -1); } - // ------------------------------------------- - /// Allocate matrix and sieve info for given size and sieve - int SetupWithSieve(ClusterDist*, size_t, int, int); - /// Allocate sieve info from given array. - int SetSieveFromArray(std::vector const&, int); - /// Print matrix elements to STDOUT - void PrintElements() const; - /// \return Description of distance metric used to calc matrix - std::string const& MetricDescription() const { return metricDescription_; } - protected: - virtual int AllocateCmatrix(size_t) = 0; - virtual int SetCdist(ClusterDist*) = 0; - ClusterSieve sievedFrames_; ///< Hold info on frames actually being processed. TODO make private - private: - std::string metricDescription_; ///< Hold description of distance metric used to calc matrix -}; -#endif diff --git a/src/DataSet_Cmatrix_DISK.cpp b/src/DataSet_Cmatrix_DISK.cpp deleted file mode 100644 index a9cbf50c8b..0000000000 --- a/src/DataSet_Cmatrix_DISK.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "DataSet_Cmatrix_DISK.h" -#include "CpptrajStdio.h" -#include "StringRoutines.h" // ByteString - -int DataSet_Cmatrix_DISK::AllocateCmatrix(size_t sizeIn) { - if (Meta().Fname().empty()) { - mprinterr("Internal Error: Cluster matrix file name not set.\n"); - return 1; - } - mprintf("\tPairwise cache file: '%s'\n", Meta().Fname().full()); - mprintf("\tEstimated pair-wise matrix disk usage: > %s\n", - ByteString( ((sizeIn*(sizeIn-1))/2)*sizeof(float), BYTE_DECIMAL).c_str()); - if (file_.CreateCmatrix(Meta().Fname(), sievedFrames_.MaxFrames(), sizeIn, - sievedFrames_.Sieve(), MetricDescription())) - return 1; - // Write actual frames array if necessary - if (sievedFrames_.Type() != ClusterSieve::NONE) { - if (file_.WriteFramesArray( sievedFrames_.Frames() )) - return 1; - } - // Reopen in SHARE mode for random access - if (file_.ReopenSharedWrite( Meta().Fname() )) return 1; - return 0; -} diff --git a/src/DataSet_Cmatrix_DISK.h b/src/DataSet_Cmatrix_DISK.h deleted file mode 100644 index 1472ae7fed..0000000000 --- a/src/DataSet_Cmatrix_DISK.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_DATASET_CMATRIX_DISK_H -#define INC_DATASET_CMATRIX_DISK_H -#include "DataSet_Cmatrix.h" -#include "NC_Cmatrix.h" -/// Used to hold pairwise distance matrix for clustering on disk. -class DataSet_Cmatrix_DISK : public DataSet_Cmatrix { - public: - DataSet_Cmatrix_DISK() : DataSet_Cmatrix(CMATRIX_DISK) {} - static DataSet* Alloc() { return (DataSet*)new DataSet_Cmatrix_DISK(); } - // ----- DataSet functions ------------------- - size_t Size() const { return file_.MatrixSize(); } - void Info() const { return; } - void WriteBuffer(CpptrajFile&, SizeArray const&) const {} - int Allocate(SizeArray const&) { return 0; } - // ----- Cmatrix functions ------------------- - /// \return an element indexed by sievedFrames. - inline double GetFdist(int, int) const; - /// Set element at column/row to given value - void SetElement(int x, int y, double val) { file_.WriteCmatrixElement(x, y, val); } - /// \return Actual number of elements in matrix - size_t Nelements() const { return file_.MatrixSize(); } - /// \return size used by matrix in bytes - size_t DataSize() const { return sievedFrames_.DataSize(); } - /// \return Actual number of rows in the matrix - size_t Nrows() const { return file_.MatrixRows(); } - /// \return Element at given index. - double GetElement(unsigned int idx) const { return file_.GetCmatrixElement(idx); } - /// \return true if matrix needs setup - bool NeedsSetup() const { return (file_.MatrixSize() < 1); } - /// \return true if matrix needs calculation - bool NeedsCalc() const { return true; } - /// No more distances will be added; flush to disk - void Complete() { file_.Sync(); } - protected: - int AllocateCmatrix(size_t); - int SetCdist(ClusterDist*) { return 0; } - private: - NC_Cmatrix file_; -}; -// ----- Inline functions ------------------------------------------------------ -double DataSet_Cmatrix_DISK::GetFdist(int x, int y) const { - return file_.GetCmatrixElement( sievedFrames_.FrameToIdx(x), - sievedFrames_.FrameToIdx(y) ); -} -#endif diff --git a/src/DataSet_Cmatrix_MEM.cpp b/src/DataSet_Cmatrix_MEM.cpp deleted file mode 100644 index 9c69053308..0000000000 --- a/src/DataSet_Cmatrix_MEM.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "DataSet_Cmatrix_MEM.h" -#include "CpptrajStdio.h" -#include "StringRoutines.h" // ByteString - -void DataSet_Cmatrix_MEM::WriteBuffer(CpptrajFile& outfile, SizeArray const& pIn) const { - size_t x = (size_t)pIn[0]; - size_t y = (size_t)pIn[1]; - if ( x >= Mat_.Ncols() || y >= Mat_.Nrows() ) - outfile.Printf(format_.fmt(), 0.0); - else - outfile.Printf(format_.fmt(), Mat_.element(x,y)); -} - -int DataSet_Cmatrix_MEM::Allocate(SizeArray const& sizeIn) { - int err = 0; - if (!sizeIn.empty()) { - // Sanity check. - if (sizeIn.size() > 1 && sizeIn[1] != sizeIn[0]) - mprintf("Warning: DataSet_Cmatrix dimensions must be equal (%zu != %zu)\n" - "Warning: Matrix will be %zu x %zu upper triangle\n", - sizeIn[0], sizeIn[1], sizeIn[0], sizeIn[0]); - err = Mat_.resize(0, sizeIn[0]); // Upper triangle - } else - Mat_.clear(); - return err; -} - -// ----------------------------------------------------------------------------- -// DataSet_Cmatrix_MEM::AllocateCmatrix() -int DataSet_Cmatrix_MEM::AllocateCmatrix(size_t sizeIn) -{ - // Set up underlying TriangleMatrix for given number of frames. - mprintf("\tEstimated pair-wise matrix memory usage: > %s\n", - ByteString(Mat_.sizeInBytes( 0L, sizeIn ), BYTE_DECIMAL).c_str()); - try { Mat_.resize( 0L, sizeIn ); } - catch (const std::bad_alloc&) { - mprinterr("Error: Not enough memory to allocate pair-wise matrix.\n" - "Error: Consider using the 'sieve' keyword to reduce memory usage.\n"); - return 1; - } - return 0; -} - -// DataSet_Cmatrix_MEM::DataSize() -size_t DataSet_Cmatrix_MEM::DataSize() const { - return ( Mat_.DataSize() + sievedFrames_.DataSize() ); -} diff --git a/src/DataSet_Cmatrix_MEM.h b/src/DataSet_Cmatrix_MEM.h deleted file mode 100644 index b0c4c3ec99..0000000000 --- a/src/DataSet_Cmatrix_MEM.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef INC_DATASET_CMATRIX_MEM_H -#define INC_DATASET_CMATRIX_MEM_H -#include "DataSet_Cmatrix.h" -#include "Matrix.h" -/// Used to hold pairwise distance matrix for clustering in memory. -class DataSet_Cmatrix_MEM : public DataSet_Cmatrix { - public: - DataSet_Cmatrix_MEM() : DataSet_Cmatrix(CMATRIX) {} - static DataSet* Alloc() { return (DataSet*)new DataSet_Cmatrix_MEM(); } - /// Access internal matrix pointer to interface with file IO - float* Ptr() { return Mat_.Ptr(); } - float const* Ptr() const { return Mat_.Ptr(); } - // ----- DataSet functions ------------------- - size_t Size() const { return Mat_.size(); } - void Info() const { return; } - void WriteBuffer(CpptrajFile&, SizeArray const&) const; - int Allocate(SizeArray const&); - // ----- Cmatrix functions ------------------- - /// \return an element indexed by sievedFrames. - inline double GetFdist(int, int) const; - /// Set element at column/row to given value - void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } - /// \return Actual number of elements in matrix - size_t Nelements() const { return Mat_.size(); } - /// \return size used by matrix in bytes - size_t DataSize() const; - /// \return Actual number of rows in the matrix - size_t Nrows() const { return Mat_.Nrows(); } - /// \return Element at given index. - double GetElement(unsigned int idx) const { return Mat_[idx]; } - /// \return true if matrix needs setup - bool NeedsSetup() const { return (Mat_.size() < 1); } - /// \return true if matrix needs calculation - bool NeedsCalc() const { return true; } - /// Indicate that no more distances will be added to matrix. - void Complete() {} - protected: - int AllocateCmatrix(size_t); - int SetCdist(ClusterDist*) { return 0; } - private: - Matrix Mat_; -}; -// ----- Inline functions ------------------------------------------------------ -double DataSet_Cmatrix_MEM::GetFdist(int col, int row) const { - // row and col are based on original; convert to reduced - // FIXME: This assumes GetFdist will never be called for a sieved frame. - return Mat_.element(sievedFrames_.FrameToIdx(col), - sievedFrames_.FrameToIdx(row)); -} -#endif diff --git a/src/DataSet_Cmatrix_NOMEM.cpp b/src/DataSet_Cmatrix_NOMEM.cpp deleted file mode 100644 index e88846854e..0000000000 --- a/src/DataSet_Cmatrix_NOMEM.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include // std::min, std::max -#include "DataSet_Cmatrix_NOMEM.h" - -DataSet_Cmatrix_NOMEM::~DataSet_Cmatrix_NOMEM() { - if (cdist_ != 0) delete cdist_; -} - -void DataSet_Cmatrix_NOMEM::WriteBuffer(CpptrajFile& outfile, SizeArray const& pIn) const { - int xidx = (int)std::min(pIn[0], pIn[1]); - int yidx = (int)std::max(pIn[0], pIn[1]); - if ( xidx >= sievedFrames_.ActualNframes() || yidx >= sievedFrames_.ActualNframes() ) - outfile.Printf(format_.fmt(), 0.0); - else - outfile.Printf(format_.fmt(), cdist_->FrameDist( sievedFrames_.IdxToFrame(yidx), - sievedFrames_.IdxToFrame(xidx) )); -} - -int DataSet_Cmatrix_NOMEM::SetCdist(ClusterDist* cdistIn) -{ - if (cdistIn == 0) return 1; - cdist_ = cdistIn->Copy(); - return 0; -} diff --git a/src/DataSet_Cmatrix_NOMEM.h b/src/DataSet_Cmatrix_NOMEM.h deleted file mode 100644 index 235b143692..0000000000 --- a/src/DataSet_Cmatrix_NOMEM.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef INC_DATASET_CMATRIX_NOMEM_H -#define INC_DATASET_CMATRIX_NOMEM_H -#include "DataSet_Cmatrix.h" -/// Used when no pairwise distance matrix is to be stored; all calcs done on the fly. -class DataSet_Cmatrix_NOMEM : public DataSet_Cmatrix { - public: - DataSet_Cmatrix_NOMEM() : DataSet_Cmatrix(CMATRIX_NOMEM), cdist_(0) {} - ~DataSet_Cmatrix_NOMEM(); - static DataSet* Alloc() { return (DataSet*)new DataSet_Cmatrix_NOMEM(); } - // ----- DataSet functions ------------------- - size_t Size() const { return 0; } - void Info() const { return; } - void WriteBuffer(CpptrajFile&, SizeArray const&) const; - int Allocate(SizeArray const&) { return 0; } - // ----- Cmatrix functions ------------------- - /// \return an element indexed by sievedFrames. - inline double GetFdist(int f1, int f2) const { return cdist_->FrameDist(f1, f2); } - /// Set element at column/row to given value - void SetElement(int, int, double) {} - /// \return Actual number of elements in matrix //TODO put in Cmatrix - inline size_t Nelements() const; - /// \return size used by matrix in bytes - size_t DataSize() const { return sievedFrames_.DataSize(); } - /// \return Actual number of rows in the matrix // TODO put in Cmatrix - size_t Nrows() const { return sievedFrames_.ActualNframes(); } - /// \return Element at given index. - inline double GetElement(unsigned int) const; - /// \return true if matrix needs setup - bool NeedsSetup() const { return (cdist_ == 0); } - /// \return true if matrix needs calculation - bool NeedsCalc() const { return false; } - /// Indicate that no more distances will be added to matrix. - void Complete() {} - protected: - int AllocateCmatrix(size_t) { return 0; } - int SetCdist(ClusterDist*); - private: - ClusterDist* cdist_; -}; -// ----- Inline functions ------------------------------------------------------ - -size_t DataSet_Cmatrix_NOMEM::Nelements() const { - return (sievedFrames_.ActualNframes()*(sievedFrames_.ActualNframes()-1)) / 2; -} - -double DataSet_Cmatrix_NOMEM::GetElement(unsigned int idxIn) const { - int iidx = (int)idxIn; - return cdist_->FrameDist( sievedFrames_.IdxToFrame( iidx / sievedFrames_.ActualNframes() ), - sievedFrames_.IdxToFrame( iidx % sievedFrames_.ActualNframes() ) ); -} -#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index c0374b3c5f..e1d911b76a 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -89,7 +89,6 @@ Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Clustering.o : Analysis_Clustering.cpp ActionFrameCounter.h ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h Cluster_DPeaks.h Cluster_HierAgglo.h Cluster_Kmeans.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h DataSet_string.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -143,33 +142,24 @@ CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStd CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../ClusterMatrix.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h +Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h -ClusterDist.o : ClusterDist.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h Constants.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h -ClusterList.o : ClusterList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PDBfile.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h -ClusterMatrix.o : ClusterMatrix.cpp ArrayIterator.h ClusterMatrix.h CpptrajStdio.h Matrix.h -ClusterNode.o : ClusterNode.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterNode.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h -ClusterSieve.o : ClusterSieve.cpp ClusterSieve.h Random.h -Cluster_DBSCAN.o : Cluster_DBSCAN.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Cluster_DBSCAN.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h -Cluster_DPeaks.o : Cluster_DPeaks.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Cluster_DPeaks.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Mesh.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h Spline.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h -Cluster_HierAgglo.o : Cluster_HierAgglo.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterMatrix.h ClusterNode.h ClusterSieve.h Cluster_HierAgglo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h -Cluster_Kmeans.o : Cluster_Kmeans.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Cluster_Kmeans.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Random.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h -Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h BufferedLine.h CharMask.h ClusterDist.h ClusterList.h ClusterNode.h ClusterSieve.h Cluster_ReadInfo.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h @@ -181,7 +171,7 @@ CpptrajFile.o : CpptrajFile.cpp CpptrajFile.h CpptrajStdio.h FileIO.h FileIO_Bzi CpptrajState.o : CpptrajState.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_CreateCrd.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_Topology.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleNavigator.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h Vec3.h CpptrajStdio.o : CpptrajStdio.cpp Parallel.h CurveFit.o : CurveFit.cpp CurveFit.h -DataFile.o : DataFile.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.h DataIO_CCP4.h DataIO_CharmmFastRep.h DataIO_CharmmOutput.h DataIO_CharmmRepLog.h DataIO_CharmmRtfPrm.h DataIO_Cmatrix.h DataIO_Cpout.h DataIO_Evecs.h DataIO_Gnuplot.h DataIO_Grace.h DataIO_Mdout.h DataIO_NC_Cmatrix.h DataIO_OpenDx.h DataIO_RemLog.h DataIO_Std.h DataIO_VecTraj.h DataIO_XVG.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Vec3.h +DataFile.o : DataFile.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/Cframes.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.h DataIO_CCP4.h DataIO_CharmmFastRep.h DataIO_CharmmOutput.h DataIO_CharmmRepLog.h DataIO_CharmmRtfPrm.h DataIO_Cmatrix_Binary.h DataIO_Cpout.h DataIO_Evecs.h DataIO_Gnuplot.h DataIO_Grace.h DataIO_Mdout.h DataIO_OpenDx.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 FrameArray.h FramePtrArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Vec3.h DataFileList.o : DataFileList.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO.o : DataIO.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CCP4.o : DataIO_CCP4.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h ByteRoutines.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CCP4.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -189,28 +179,22 @@ DataIO_CharmmFastRep.o : DataIO_CharmmFastRep.cpp ArgList.h AssociatedData.h Ato DataIO_CharmmOutput.o : DataIO_CharmmOutput.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmOutput.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CharmmRepLog.o : DataIO_CharmmRepLog.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRepLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CharmmRtfPrm.o : DataIO_CharmmRtfPrm.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h AtomTypeArray.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRtfPrm.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -DataIO_Cmatrix.o : DataIO_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_Binary.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cpout.o : DataIO_Cpout.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cpout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_pH.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Evecs.o : DataIO_Evecs.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedFrame.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Evecs.h DataSet.h DataSetList.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h DataSet_Modes.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Gnuplot.o : DataIO_Gnuplot.cpp ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Gnuplot.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Grace.o : DataIO_Grace.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Grace.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Mdout.o : DataIO_Mdout.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Mdout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -DataIO_NC_Cmatrix.o : DataIO_NC_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_NC_Cmatrix.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_OpenDx.o : DataIO_OpenDx.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_OpenDx.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_RemLog.o : DataIO_RemLog.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_RemLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -DataIO_Std.o : DataIO_Std.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h ClusterDist.h ClusterSieve.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Std.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mat3x3.h DataSet_Vector.h DataSet_double.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h GridBin.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h Vec3.h +DataIO_Std.o : DataIO_Std.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Std.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mat3x3.h DataSet_Vector.h DataSet_double.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_VecTraj.o : DataIO_VecTraj.cpp ActionFrameCounter.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h BondSearch.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_VecTraj.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h ParmFile.h ParmIO.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h DataIO_XVG.o : DataIO_XVG.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_XVG.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Xplor.o : DataIO_Xplor.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataSet.o : DataSet.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h -DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Cmatrix_MEM.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_PairwiseCache_NC.h DataSet_Parameters.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h Hungarian.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h +DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/Cframes.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_PairwiseCache_NC.h DataSet_Parameters.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h InputTrajCommon.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h DataSet_1D.o : DataSet_1D.cpp ArgList.h ArrayIterator.h AssociatedData.h ComplexArray.h Constants.h Corr.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h PubFFT.h Range.h TextFormat.h DataSet_3D.o : DataSet_3D.cpp ArgList.h AssociatedData.h Box.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_3D.h Dimension.h FileIO.h FileName.h GridBin.h Matrix_3x3.h MetaData.h Parallel.h Range.h TextFormat.h Vec3.h -DataSet_Cmatrix.o : DataSet_Cmatrix.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h -DataSet_Cmatrix_DISK.o : DataSet_Cmatrix_DISK.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h Cluster/Cframes.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_DISK.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h -DataSet_Cmatrix_MEM.o : DataSet_Cmatrix_MEM.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_MEM.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h -DataSet_Cmatrix_NOMEM.o : DataSet_Cmatrix_NOMEM.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h Box.h CharMask.h ClusterDist.h ClusterSieve.h CoordinateInfo.h CpptrajFile.h DataSet.h DataSet_1D.h DataSet_Cmatrix.h DataSet_Cmatrix_NOMEM.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h Hungarian.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Topology.h Vec3.h DataSet_Coords.o : DataSet_Coords.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Topology.h Vec3.h DataSet_Coords_CRD.o : DataSet_Coords_CRD.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Coords.h DataSet_Coords_CRD.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Topology.h Vec3.h DataSet_Coords_REF.o : DataSet_Coords_REF.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h FileIO.h FileName.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Topology.h TrajFrameCounter.h TrajectoryIO.h Trajin.h Trajin_Single.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 412b03bd98..26030b744f 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -107,7 +107,6 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ Analysis_AmdBias.cpp \ Analysis_AutoCorr.cpp \ Analysis_Average.cpp \ - Analysis_Clustering.cpp \ Analysis_Cluster.cpp \ Analysis_Corr.cpp \ Analysis_ConstantPHStats.cpp \ @@ -160,17 +159,7 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ ByteRoutines.cpp \ CharMask.cpp \ CIFfile.cpp \ - ClusterDist.cpp \ - ClusterList.cpp \ ClusterMap.cpp \ - ClusterMatrix.cpp \ - ClusterNode.cpp \ - ClusterSieve.cpp \ - Cluster_DBSCAN.cpp \ - Cluster_DPeaks.cpp \ - Cluster_HierAgglo.cpp \ - Cluster_Kmeans.cpp \ - Cluster_ReadInfo.cpp \ Cmd.cpp \ CmdInput.cpp \ CmdList.cpp \ @@ -192,7 +181,6 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ DataIO_CharmmOutput.cpp \ DataIO_CharmmRepLog.cpp \ DataIO_CharmmRtfPrm.cpp \ - DataIO_Cmatrix.cpp \ DataIO_Cmatrix_Binary.cpp \ DataIO_Cpout.cpp \ DataIO_Evecs.cpp \ @@ -200,7 +188,6 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ DataIO_Grace.cpp \ DataIO_OpenDx.cpp \ DataIO_Mdout.cpp \ - DataIO_NC_Cmatrix.cpp \ DataIO_RemLog.cpp \ DataIO_Std.cpp \ DataIO_VecTraj.cpp \ @@ -210,10 +197,6 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ DataSetList.cpp \ DataSet_1D.cpp \ DataSet_3D.cpp \ - DataSet_Cmatrix.cpp \ - DataSet_Cmatrix_DISK.cpp \ - DataSet_Cmatrix_MEM.cpp \ - DataSet_Cmatrix_NOMEM.cpp \ DataSet_Coords.cpp \ DataSet_Coords_CRD.cpp \ DataSet_Coords_REF.cpp \ From 193aa8a7a0d490f75a49f8088c551c61e674d002 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 11:14:20 -0500 Subject: [PATCH 118/417] DRR - Cpptraj: Rename netcdf pairwise cache class; should be in the cluster namespace --- .../Cmatrix_NC.cpp} | 76 ++++++++++--------- src/{NC_Cmatrix.h => Cluster/Cmatrix_NC.h} | 24 +++--- src/DataSet_PairwiseCache_NC.h | 4 +- src/cpptrajdepend | 6 +- src/cpptrajfiles | 2 +- 5 files changed, 61 insertions(+), 51 deletions(-) rename src/{NC_Cmatrix.cpp => Cluster/Cmatrix_NC.cpp} (76%) rename src/{NC_Cmatrix.h => Cluster/Cmatrix_NC.h} (88%) diff --git a/src/NC_Cmatrix.cpp b/src/Cluster/Cmatrix_NC.cpp similarity index 76% rename from src/NC_Cmatrix.cpp rename to src/Cluster/Cmatrix_NC.cpp index 2f20f823cc..60dbc28e83 100644 --- a/src/NC_Cmatrix.cpp +++ b/src/Cluster/Cmatrix_NC.cpp @@ -1,13 +1,13 @@ #ifdef BINTRAJ # include -# include "NC_Routines.h" +# include "../NC_Routines.h" #endif -#include "NC_Cmatrix.h" -#include "CpptrajStdio.h" +#include "Cmatrix_NC.h" +#include "../CpptrajStdio.h" #ifdef BINTRAJ /// CONSTRUCTOR -NC_Cmatrix::NC_Cmatrix() : +Cpptraj::Cluster::Cmatrix_NC::Cmatrix_NC() : ncid_(-1), n_original_frames_DID_(-1), n_rows_DID_(-1), @@ -20,17 +20,17 @@ NC_Cmatrix::NC_Cmatrix() : mode_(READ) {} -NC_Cmatrix::~NC_Cmatrix() { +Cpptraj::Cluster::Cmatrix_NC::~Cmatrix_NC() { CloseCmatrix(); } -bool NC_Cmatrix::IsCpptrajCmatrix(int NCID) { +bool Cpptraj::Cluster::Cmatrix_NC::IsCpptrajCmatrix(int NCID) { return (NC::GetAttrText(NCID, "Conventions") == "CPPTRAJ_CMATRIX"); } #endif // NC_Cmatrix::ID_Cmatrix() -bool NC_Cmatrix::ID_Cmatrix(FileName const& fname) { +bool Cpptraj::Cluster::Cmatrix_NC::ID_Cmatrix(FileName const& fname) { # ifdef BINTRAJ int NCID; if ( nc_open( fname.full(), NC_NOWRITE, &NCID ) != NC_NOERR ) @@ -54,7 +54,7 @@ bool NC_Cmatrix::ID_Cmatrix(FileName const& fname) { #define NC_CMATRIX_FRAMES "actual_frames" // NC_Cmatrix::OpenCmatrixRead() -int NC_Cmatrix::OpenCmatrixRead(FileName const& fname, int& sieve) { +int Cpptraj::Cluster::Cmatrix_NC::OpenCmatrixRead(FileName const& fname, int& sieve) { if (ncid_ != -1) CloseCmatrix(); if (fname.empty()) return 1; if (NC::CheckErr( nc_open( fname.full(), NC_NOWRITE, &ncid_ ) )) @@ -114,7 +114,7 @@ int NC_Cmatrix::OpenCmatrixRead(FileName const& fname, int& sieve) { // NC_Cmatrix::CalcIndex() // TODO Consolidate code in Matrix.h? -long int NC_Cmatrix::CalcIndex(unsigned int xIn, unsigned int yIn) const { +long int Cpptraj::Cluster::Cmatrix_NC::CalcIndex(unsigned int xIn, unsigned int yIn) const { // Calculate upper-triangle matrix index unsigned int i, j; if (yIn > xIn) { @@ -132,7 +132,7 @@ long int NC_Cmatrix::CalcIndex(unsigned int xIn, unsigned int yIn) const { } // NC_Cmatrix::GetCmatrixElement() -double NC_Cmatrix::GetCmatrixElement(unsigned int xIn, unsigned int yIn) const { +double Cpptraj::Cluster::Cmatrix_NC::GetCmatrixElement(unsigned int xIn, unsigned int yIn) const { float fval; size_t index[1]; long int idx = CalcIndex(xIn, yIn); @@ -144,7 +144,7 @@ double NC_Cmatrix::GetCmatrixElement(unsigned int xIn, unsigned int yIn) const { } // NC_Cmatrix::GetCmatrixElement() -double NC_Cmatrix::GetCmatrixElement(unsigned int idxIn) const { +double Cpptraj::Cluster::Cmatrix_NC::GetCmatrixElement(unsigned int idxIn) const { float fval; size_t index[1] = { idxIn }; if (NC::CheckErr( nc_get_var1_float(ncid_, cmatrix_VID_, index, &fval) )) @@ -153,7 +153,7 @@ double NC_Cmatrix::GetCmatrixElement(unsigned int idxIn) const { } // NC_Cmatrix::GetSieveStatus() -std::vector NC_Cmatrix::GetSieveStatus() const { +std::vector Cpptraj::Cluster::Cmatrix_NC::GetSieveStatus() const { if (nFrames_ < 1) return std::vector(); if (actualFrames_VID_ == -1) // No frames array. All frames present, none sieved. @@ -175,7 +175,7 @@ std::vector NC_Cmatrix::GetSieveStatus() const { } // NC_Cmatrix::GetCmatrix() -int NC_Cmatrix::GetCmatrix(float* ptr) const { +int Cpptraj::Cluster::Cmatrix_NC::GetCmatrix(float* ptr) const { if (cmatrix_VID_ == -1) return 1; size_t start[1] = { 0 }; size_t count[1] = { mSize_ }; @@ -183,8 +183,9 @@ int NC_Cmatrix::GetCmatrix(float* ptr) const { } // NC_Cmatrix::CreateCmatrix() -int NC_Cmatrix::CreateCmatrix(FileName const& fname, unsigned int nFramesIn, unsigned int nRowsIn, - int sieve, std::string const& metricDescripIn) +int Cpptraj::Cluster::Cmatrix_NC::CreateCmatrix(FileName const& fname, unsigned int nFramesIn, + unsigned int nRowsIn, + int sieve, std::string const& metricDescripIn) { //mprinterr("DEBUG: Cmatrix file '%s', nFrames %u, nRows %u, sieve %i\n", // fname.full(), nFrames, nRowsIn, sieve); @@ -262,12 +263,12 @@ int NC_Cmatrix::CreateCmatrix(FileName const& fname, unsigned int nFramesIn, uns } // NC_Cmatrix::Sync() -void NC_Cmatrix::Sync() const { +void Cpptraj::Cluster::Cmatrix_NC::Sync() const { if (ncid_ != -1) NC::CheckErr( nc_sync(ncid_) ); } -int NC_Cmatrix::ReopenSharedWrite(FileName const& fname) { +int Cpptraj::Cluster::Cmatrix_NC::ReopenSharedWrite(FileName const& fname) { if (ncid_ == -1) return 1; // Close and re-open shared nc_close( ncid_ ); @@ -276,7 +277,7 @@ int NC_Cmatrix::ReopenSharedWrite(FileName const& fname) { } // NC_Cmatrix::WriteFramesArray() -int NC_Cmatrix::WriteFramesArray(std::vector const& actualFrames) const { +int Cpptraj::Cluster::Cmatrix_NC::WriteFramesArray(std::vector const& actualFrames) const { if (ncid_ == -1) return 1; // Sanity check if (actualFrames_VID_ == -1) { mprinterr("Error: No cluster frames variable ID defined.\n"); @@ -294,13 +295,16 @@ int NC_Cmatrix::WriteFramesArray(std::vector const& actualFrames) const { return 0; } -int NC_Cmatrix::WriteFramesArray(Cpptraj::Cluster::Cframes const& actualFrames) const { +int Cpptraj::Cluster::Cmatrix_NC::WriteFramesArray(Cpptraj::Cluster::Cframes const& actualFrames) +const +{ // TODO have Cframes return a pointer? return WriteFramesArray(actualFrames.Data()); } // NC_Cmatrix::WriteCmatrixElement() -int NC_Cmatrix::WriteCmatrixElement(unsigned int xIn, unsigned int yIn, double dval) const +int Cpptraj::Cluster::Cmatrix_NC::WriteCmatrixElement(unsigned int xIn, unsigned int yIn, + double dval) const { int err = 0; # ifdef _OPENMP @@ -326,7 +330,7 @@ int NC_Cmatrix::WriteCmatrixElement(unsigned int xIn, unsigned int yIn, double d } // NC_Cmatrix::WriteCmatrix() -int NC_Cmatrix::WriteCmatrix(const float* ptr) const { +int Cpptraj::Cluster::Cmatrix_NC::WriteCmatrix(const float* ptr) const { if (cmatrix_VID_ == -1) return 1; size_t start[1] = { 0 }; size_t count[1] = { mSize_ }; @@ -334,7 +338,7 @@ int NC_Cmatrix::WriteCmatrix(const float* ptr) const { } // NC_Cmatrix::CloseCmatrix() -void NC_Cmatrix::CloseCmatrix() { +void Cpptraj::Cluster::Cmatrix_NC::CloseCmatrix() { if (ncid_ != -1) { nc_close( ncid_ ); ncid_ = -1; @@ -342,22 +346,22 @@ void NC_Cmatrix::CloseCmatrix() { } } #else -NC_Cmatrix::NC_Cmatrix() {} -NC_Cmatrix::~NC_Cmatrix() {} -int NC_Cmatrix::OpenCmatrixRead(FileName const&, int&) { return 1; } -double NC_Cmatrix::GetCmatrixElement(unsigned int, unsigned int) const { return 0.0; } -double NC_Cmatrix::GetCmatrixElement(unsigned int) const { return 0.0; } -std::vector NC_Cmatrix::GetSieveStatus() const { return std::vector(); } -int NC_Cmatrix::GetCmatrix(float*) const { return 1; } -int NC_Cmatrix::CreateCmatrix(FileName const&, unsigned int, unsigned int, int, std::string const&) +Cpptraj::Cluster::Cmatrix_NC::NC_Cmatrix() {} +Cpptraj::Cluster::Cmatrix_NC::~NC_Cmatrix() {} +int Cpptraj::Cluster::Cmatrix_NC::OpenCmatrixRead(FileName const&, int&) { return 1; } +double Cpptraj::Cluster::Cmatrix_NC::GetCmatrixElement(unsigned int, unsigned int) const { return 0.0; } +double Cpptraj::Cluster::Cmatrix_NC::GetCmatrixElement(unsigned int) const { return 0.0; } +std::vector Cpptraj::Cluster::Cmatrix_NC::GetSieveStatus() const { return std::vector(); } +int Cpptraj::Cluster::Cmatrix_NC::GetCmatrix(float*) const { return 1; } +int Cpptraj::Cluster::Cmatrix_NC::CreateCmatrix(FileName const&, unsigned int, unsigned int, int, std::string const&) { mprinterr("Error: Cpptraj was compiled without NetCDF. Cannot create NetCDF matrix file.\n"); return 1; } -int NC_Cmatrix::WriteFramesArray(std::vector const&) const { return 1; } -int NC_Cmatrix::WriteCmatrixElement(unsigned int, unsigned int, double) const { return 1; } -int NC_Cmatrix::WriteCmatrix(const float*) const { return 1; } -void NC_Cmatrix::CloseCmatrix() {} -void NC_Cmatrix::Sync() const {} -int NC_Cmatrix::ReopenSharedWrite(FileName const&) { return 1; } +int Cpptraj::Cluster::Cmatrix_NC::WriteFramesArray(std::vector const&) const { return 1; } +int Cpptraj::Cluster::Cmatrix_NC::WriteCmatrixElement(unsigned int, unsigned int, double) const { return 1; } +int Cpptraj::Cluster::Cmatrix_NC::WriteCmatrix(const float*) const { return 1; } +void Cpptraj::Cluster::Cmatrix_NC::CloseCmatrix() {} +void Cpptraj::Cluster::Cmatrix_NC::Sync() const {} +int Cpptraj::Cluster::Cmatrix_NC::ReopenSharedWrite(FileName const&) { return 1; } #endif diff --git a/src/NC_Cmatrix.h b/src/Cluster/Cmatrix_NC.h similarity index 88% rename from src/NC_Cmatrix.h rename to src/Cluster/Cmatrix_NC.h index 3d79bade41..331adf5765 100644 --- a/src/NC_Cmatrix.h +++ b/src/Cluster/Cmatrix_NC.h @@ -1,13 +1,16 @@ -#ifndef INC_NC_CMATRIX_H -#define INC_NC_CMATRIX_H -#include "FileName.h" -#include "Cluster/Cframes.h" +#ifndef INC_CLUSTER_CMATRIX_NC_H +#define INC_CLUSTER_CMATRIX_NC_H +#include "../FileName.h" +#include "Cframes.h" +namespace Cpptraj { +namespace Cluster { + /// NetCDF cluster matrix file. -class NC_Cmatrix { +class Cmatrix_NC { public: enum ModeType { READ=0, WRITE }; - NC_Cmatrix(); - ~NC_Cmatrix(); + Cmatrix_NC(); + ~Cmatrix_NC(); /// \return true if file is NetCDF cluster matrix file. static bool ID_Cmatrix(FileName const&); /// Open cluster matrix file for reading. Set sieve ID. @@ -27,8 +30,8 @@ class NC_Cmatrix { /// Reopen in shared write mode for random access int ReopenSharedWrite(FileName const&); /// Write non-sieved frames array. - int WriteFramesArray(std::vector const&) const; - int WriteFramesArray(Cpptraj::Cluster::Cframes const&) const; + int WriteFramesArray(std::vector const&) const; // TODO deprecate + int WriteFramesArray(Cframes const&) const; /// Write cluster matrix element (col, row) int WriteCmatrixElement(unsigned int, unsigned int, double) const; /// Write cluster matrix using given pointer @@ -64,4 +67,7 @@ class NC_Cmatrix { ModeType mode_; ///< Access mode. # endif }; + +} +} #endif diff --git a/src/DataSet_PairwiseCache_NC.h b/src/DataSet_PairwiseCache_NC.h index cff0ae6b4b..9afa46ad28 100644 --- a/src/DataSet_PairwiseCache_NC.h +++ b/src/DataSet_PairwiseCache_NC.h @@ -1,7 +1,7 @@ #ifndef INC_DATASET_PAIRWISECACHE_NC_H #define INC_DATASET_PAIRWISECACHE_NC_H #include "DataSet_PairwiseCache.h" -#include "NC_Cmatrix.h" +#include "Cluster/Cmatrix_NC.h" /// Cache pairwise distances in NetCDF file. class DataSet_PairwiseCache_NC : public DataSet_PairwiseCache { public: @@ -25,6 +25,6 @@ class DataSet_PairwiseCache_NC : public DataSet_PairwiseCache { void PrintCached() const; void SetElement(int x, int y, double val) { file_.WriteCmatrixElement(x, y, val); } private: - NC_Cmatrix file_; ///< Hold cached distances on disk + Cpptraj::Cluster::Cmatrix_NC file_; ///< Hold cached distances on disk }; #endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index e1d911b76a..5be0a4ff7f 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -147,6 +147,7 @@ Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../Associ Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h +Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h @@ -192,7 +193,7 @@ DataIO_VecTraj.o : DataIO_VecTraj.cpp ActionFrameCounter.h ArgList.h ArrayIterat DataIO_XVG.o : DataIO_XVG.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_XVG.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Xplor.o : DataIO_Xplor.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataSet.o : DataSet.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h -DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/Cframes.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_PairwiseCache_NC.h DataSet_Parameters.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h InputTrajCommon.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NC_Cmatrix.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h +DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h AtomTypeArray.h Box.h CharMask.h Cluster/../FileName.h Cluster/Cframes.h Cluster/Cmatrix_NC.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_PairwiseCache_NC.h DataSet_Parameters.h DataSet_RemLog.h DataSet_Topology.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h InputTrajCommon.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h Vec3.h DataSet_1D.o : DataSet_1D.cpp ArgList.h ArrayIterator.h AssociatedData.h ComplexArray.h Constants.h Corr.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h PubFFT.h Range.h TextFormat.h DataSet_3D.o : DataSet_3D.cpp ArgList.h AssociatedData.h Box.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_3D.h Dimension.h FileIO.h FileName.h GridBin.h Matrix_3x3.h MetaData.h Parallel.h Range.h TextFormat.h Vec3.h DataSet_Coords.o : DataSet_Coords.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Coords.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Topology.h Vec3.h @@ -210,7 +211,7 @@ DataSet_PHREMD_Explicit.o : DataSet_PHREMD_Explicit.cpp ArgList.h AssociatedData DataSet_PHREMD_Implicit.o : DataSet_PHREMD_Implicit.cpp ArgList.h AssociatedData.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PHREMD.h DataSet_PHREMD_Implicit.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache.o : DataSet_PairwiseCache.cpp ArgList.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache_MEM.o : DataSet_PairwiseCache_MEM.cpp ArgList.h ArrayIterator.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Matrix.h MetaData.h Parallel.h Range.h TextFormat.h -DataSet_PairwiseCache_NC.o : DataSet_PairwiseCache_NC.cpp ArgList.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_NC.h Dimension.h FileIO.h FileName.h MetaData.h NC_Cmatrix.h Parallel.h Range.h StringRoutines.h TextFormat.h +DataSet_PairwiseCache_NC.o : DataSet_PairwiseCache_NC.cpp ArgList.h AssociatedData.h Cluster/../FileName.h Cluster/Cframes.h Cluster/Cmatrix_NC.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_NC.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h StringRoutines.h TextFormat.h DataSet_Parameters.o : DataSet_Parameters.cpp ArgList.h AssociatedData.h AtomType.h AtomTypeArray.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h TextFormat.h DataSet_RemLog.o : DataSet_RemLog.cpp ArgList.h AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h ReplicaDimArray.h TextFormat.h DataSet_Topology.o : DataSet_Topology.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h BondSearch.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Topology.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ParmFile.h ParmIO.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Topology.h Vec3.h @@ -295,7 +296,6 @@ Matrix_3x3.o : Matrix_3x3.cpp Constants.h CpptrajStdio.h Matrix_3x3.h Vec3.h MetaData.o : MetaData.cpp CpptrajStdio.h FileName.h MetaData.h Range.h StringRoutines.h Mol.o : Mol.cpp Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Mol.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Mol2File.o : Mol2File.cpp Atom.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h Mol2File.h NameType.h Parallel.h Residue.h StringRoutines.h SymbolExporting.h -NC_Cmatrix.o : NC_Cmatrix.cpp Cluster/Cframes.h CpptrajStdio.h FileName.h NC_Cmatrix.h NC_Routines.h NC_Routines.o : NC_Routines.cpp CpptrajStdio.h NC_Routines.h NameType.o : NameType.cpp NameType.h NetcdfFile.o : NetcdfFile.cpp Atom.h AtomMask.h Box.h Constants.h CoordinateInfo.h CpptrajStdio.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NC_Routines.h NameType.h NetcdfFile.h Parallel.h ParallelNetcdf.h ReplicaDimArray.h Residue.h SymbolExporting.h Vec3.h Version.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 26030b744f..77cfe543bc 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -7,6 +7,7 @@ CLUSTER_SOURCES= \ Cluster/Centroid_Coord.cpp \ Cluster/Cframes.cpp \ Cluster/Cmatrix_Binary.cpp \ + Cluster/Cmatrix_NC.cpp \ Cluster/Control.cpp \ Cluster/DynamicMatrix.cpp \ Cluster/List.cpp \ @@ -297,7 +298,6 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ Mol.cpp \ Mol2File.cpp \ NameType.cpp \ - NC_Cmatrix.cpp \ NC_Routines.cpp \ NetcdfFile.cpp \ OutputTrajCommon.cpp \ From 83bebb4eef7b6828f4955b014a2696f37dc172d2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 11:58:59 -0500 Subject: [PATCH 119/417] DRR - Cpptraj: Add DataIO for netcdf pairwise matrix. --- src/Cluster/Control.cpp | 8 ++--- src/DataFile.cpp | 8 +++-- src/DataFile.h | 2 +- src/DataIO_Cmatrix_Binary.cpp | 2 +- src/DataIO_Cmatrix_NC.cpp | 59 +++++++++++++++++++++++++++++++++++ src/DataIO_Cmatrix_NC.h | 23 ++++++++++++++ src/cpptrajdepend | 3 +- src/cpptrajfiles | 1 + 8 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 src/DataIO_Cmatrix_NC.cpp create mode 100644 src/DataIO_Cmatrix_NC.h diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 33dd916970..98e293df9a 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -35,11 +35,11 @@ const char* Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_NAME_ = "CpptrajPairDist /** The default pairwise distance file type. */ DataFile::DataFormatType Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_TYPE_ = -//# ifdef BINTRAJ -// DataFile::NCCMATRIX; -//# else +# ifdef BINTRAJ + DataFile::CMATRIX_NETCDF; +# else DataFile::CMATRIX_BINARY; -//# endif +# endif const char* Cpptraj::Cluster::Control::PairwiseArgs = "pairwisecache {mem|disk|none}"; diff --git a/src/DataFile.cpp b/src/DataFile.cpp index 463bbb2367..04460bd63a 100644 --- a/src/DataFile.cpp +++ b/src/DataFile.cpp @@ -26,6 +26,7 @@ #include "DataIO_Cpout.h" #include "DataIO_CharmmRtfPrm.h" #include "DataIO_Cmatrix_Binary.h" +#include "DataIO_Cmatrix_NC.h" // CONSTRUCTOR DataFile::DataFile() : @@ -66,6 +67,7 @@ const FileTypes::AllocToken DataFile::DF_AllocArray[] = { { "Amber CPOUT", DataIO_Cpout::ReadHelp, DataIO_Cpout::WriteHelp, DataIO_Cpout::Alloc}, { "CHARMM RTF/PRM", 0, 0, DataIO_CharmmRtfPrm::Alloc }, { "Pairwise Cache (binary)", 0, 0, DataIO_Cmatrix_Binary::Alloc }, + { "Pairwise Cache (NetCDF)", 0, 0, DataIO_Cmatrix_NC::Alloc }, { "Unknown Data file", 0, 0, 0 } }; @@ -82,11 +84,11 @@ const FileTypes::KeyToken DataFile::DF_KeyArray[] = { { EVECS, "evecs", ".evecs" }, { XVG, "xvg", ".xvg" }, { CCP4, "ccp4", ".ccp4" }, -// { NCCMATRIX, "nccmatrix", ".nccmatrix" }, { CHARMMREPD, "charmmrepd",".exch" }, { CHARMMOUT, "charmmout", ".charmmout"}, { CHARMMRTFPRM, "charmmrtfprm", ".rtfprm"}, { CMATRIX_BINARY,"cmatrix",".cmatrix" }, + { CMATRIX_NETCDF,"nccmatrix", ".nccmatrix" }, { UNKNOWN_DATA, 0, 0 } }; @@ -102,9 +104,9 @@ const FileTypes::KeyToken DataFile::DF_WriteKeyArray[] = { { EVECS, "evecs", ".evecs" }, { VECTRAJ, "vectraj",".vectraj" }, { CCP4, "ccp4", ".ccp4" }, -// { NCCMATRIX, "nccmatrix", ".nccmatrix" }, { CPOUT, "cpout", ".cpout" }, - { CMATRIX_BINARY, "cmatrix",".cmatrix" }, + { CMATRIX_BINARY,"cmatrix",".cmatrix" }, + { CMATRIX_NETCDF,"nccmatrix", ".nccmatrix" }, { UNKNOWN_DATA, 0, 0 } }; diff --git a/src/DataFile.h b/src/DataFile.h index 4aa636ca8a..01896d04fa 100644 --- a/src/DataFile.h +++ b/src/DataFile.h @@ -15,7 +15,7 @@ class DataFile { enum DataFormatType { DATAFILE=0, XMGRACE, GNUPLOT, XPLOR, OPENDX, REMLOG, MDOUT, EVECS, VECTRAJ, XVG, CCP4, CHARMMREPD, CHARMMFASTREP, - CHARMMOUT, CPOUT, CHARMMRTFPRM, CMATRIX_BINARY, UNKNOWN_DATA + CHARMMOUT, CPOUT, CHARMMRTFPRM, CMATRIX_BINARY, CMATRIX_NETCDF, UNKNOWN_DATA }; DataFile(); ~DataFile(); diff --git a/src/DataIO_Cmatrix_Binary.cpp b/src/DataIO_Cmatrix_Binary.cpp index fa53a16d71..47be7d7638 100644 --- a/src/DataIO_Cmatrix_Binary.cpp +++ b/src/DataIO_Cmatrix_Binary.cpp @@ -33,7 +33,7 @@ int DataIO_Cmatrix_Binary::ReadData(FileName const& fname, { // Allocate data set MetaData md( dsname, MetaData::M_MATRIX ); - DataSet* ds = dsl.AddSet(DataSet::PMATRIX_MEM, md, "Cmatrix"); + DataSet* ds = dsl.AddSet(DataSet::PMATRIX_MEM, md ); if (ds == 0) return 1; DataSet_PairwiseCache_MEM& Mat = static_cast( *ds ); return ReadCmatrix(fname, Mat); diff --git a/src/DataIO_Cmatrix_NC.cpp b/src/DataIO_Cmatrix_NC.cpp new file mode 100644 index 0000000000..03fc85c8f3 --- /dev/null +++ b/src/DataIO_Cmatrix_NC.cpp @@ -0,0 +1,59 @@ +#include "DataIO_Cmatrix_NC.h" +#include "DataSet_PairwiseCache_MEM.h" // TODO just pairwisecache +#include "CpptrajStdio.h" + +/// CONSTRUCTOR +DataIO_Cmatrix_NC::DataIO_Cmatrix_NC() { + SetValid( DataSet::PMATRIX_MEM ); +} + +// DataIO_Cmatrix_NC::ReadData() +int DataIO_Cmatrix_NC::ReadData(FileName const& fname, + DataSetList& dsl, std::string const& dsname) +{ + int sieve; + if (file_.OpenCmatrixRead(fname, sieve)) return 1; + + MetaData md( dsname ); + md.SetFileName( fname ); + DataSet* ds = dsl.AddSet( DataSet::PMATRIX_MEM, md ); + if (ds == 0) return 1; + DataSet_PairwiseCache_MEM& cmatrix = static_cast( *ds ); + // Allocate matrix for actual number of rows + if (cmatrix.Allocate( DataSet::SizeArray(1, file_.MatrixRows()) )) return 1; + // Get the sieve status array. + if (cmatrix.SetupFromStatus( file_.GetSieveStatus(), sieve )) return 1; + // Get the matrix + if (file_.GetCmatrix( cmatrix.Ptr() )) return 1; + file_.CloseCmatrix(); + + return 0; +} + +int DataIO_Cmatrix_NC::WriteData(FileName const& fname, DataSetList const& SetList) +{ + if (SetList.empty()) return 1; + if (SetList.size() > 1) + mprintf("Warning: Multiple sets not yet supported for cluster matrix write.\n"); + DataSet_PairwiseCache_MEM const& Mat = + static_cast( *(*(SetList.begin())) ); + // Create the file + if (file_.CreateCmatrix( fname, Mat.FrameToIdx().size(), Mat.Nrows(), Mat.SieveVal(), + Mat.MetricDescrip() )) + return 1; + // Write the matrix + if (file_.WriteCmatrix( Mat.Ptr() )) return 1; + // Write present frames + if (Mat.SieveVal() != 1) { + Cpptraj::Cluster::Cframes presentFrames; + presentFrames.reserve( Mat.Nrows() ); + for (Cpptraj::Cluster::Cframes::const_iterator it = Mat.FrameToIdx().begin(); + it != Mat.FrameToIdx().end(); ++it) + if (*it != -1) + presentFrames.push_back( *it ); + if (file_.WriteFramesArray( presentFrames )) return 1; + } + + file_.CloseCmatrix(); + return 0; +} diff --git a/src/DataIO_Cmatrix_NC.h b/src/DataIO_Cmatrix_NC.h new file mode 100644 index 0000000000..c5025ef76d --- /dev/null +++ b/src/DataIO_Cmatrix_NC.h @@ -0,0 +1,23 @@ +#ifndef INC_DATAIO_CMATRIX_NC_H +#define INC_DATAIO_CMATRIX_NC_H +#include "DataIO.h" +#include "Cluster/Cmatrix_NC.h" +/// Read/write NetCDF pairwise matrix files. +class DataIO_Cmatrix_NC : public DataIO { + public: + DataIO_Cmatrix_NC(); + ~DataIO_Cmatrix_NC() { file_.CloseCmatrix(); } + static BaseIOtype* Alloc() { return (BaseIOtype*)new DataIO_Cmatrix_NC(); } + static void ReadHelp() {} + static void WriteHelp() {} + int processReadArgs(ArgList&) { return 0; } + int ReadData(FileName const&,DataSetList&,std::string const&); + int processWriteArgs(ArgList&) { return 0; } + int WriteData(FileName const&,DataSetList const&); + bool ID_DataFormat(CpptrajFile& f) { + return Cpptraj::Cluster::Cmatrix_NC::ID_Cmatrix(f.Filename()); + } + private: + Cpptraj::Cluster::Cmatrix_NC file_; +}; +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 5be0a4ff7f..0875147235 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -172,7 +172,7 @@ CpptrajFile.o : CpptrajFile.cpp CpptrajFile.h CpptrajStdio.h FileIO.h FileIO_Bzi CpptrajState.o : CpptrajState.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_CreateCrd.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_Topology.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleNavigator.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h Vec3.h CpptrajStdio.o : CpptrajStdio.cpp Parallel.h CurveFit.o : CurveFit.cpp CurveFit.h -DataFile.o : DataFile.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/Cframes.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.h DataIO_CCP4.h DataIO_CharmmFastRep.h DataIO_CharmmOutput.h DataIO_CharmmRepLog.h DataIO_CharmmRtfPrm.h DataIO_Cmatrix_Binary.h DataIO_Cpout.h DataIO_Evecs.h DataIO_Gnuplot.h DataIO_Grace.h DataIO_Mdout.h DataIO_OpenDx.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 FrameArray.h FramePtrArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Vec3.h +DataFile.o : DataFile.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../FileName.h Cluster/Cframes.h Cluster/Cmatrix_NC.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.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_OpenDx.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 FrameArray.h FramePtrArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Vec3.h DataFileList.o : DataFileList.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO.o : DataIO.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CCP4.o : DataIO_CCP4.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h ByteRoutines.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CCP4.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -181,6 +181,7 @@ DataIO_CharmmOutput.o : DataIO_CharmmOutput.cpp ArgList.h AssociatedData.h Atom. DataIO_CharmmRepLog.o : DataIO_CharmmRepLog.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRepLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_CharmmRtfPrm.o : DataIO_CharmmRtfPrm.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h AtomTypeArray.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRtfPrm.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_Binary.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +DataIO_Cmatrix_NC.o : DataIO_Cmatrix_NC.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../FileName.h Cluster/Cframes.h Cluster/Cmatrix_NC.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_NC.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Cpout.o : DataIO_Cpout.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cpout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_pH.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Evecs.o : DataIO_Evecs.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedFrame.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Evecs.h DataSet.h DataSetList.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h DataSet_Modes.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Gnuplot.o : DataIO_Gnuplot.cpp ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Gnuplot.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 77cfe543bc..538c56985a 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -183,6 +183,7 @@ COMMON_SOURCES= $(CLUSTER_SOURCES) \ DataIO_CharmmRepLog.cpp \ DataIO_CharmmRtfPrm.cpp \ DataIO_Cmatrix_Binary.cpp \ + DataIO_Cmatrix_NC.cpp \ DataIO_Cpout.cpp \ DataIO_Evecs.cpp \ DataIO_Gnuplot.cpp \ From 3a7c1ff29c83b7d07eb447d8e0d11b50ba0a893b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 12:15:59 -0500 Subject: [PATCH 120/417] DRR - Cpptraj: Add cluster population vs time calc. --- src/Cluster/List.h | 3 ++- src/Cluster/Node.cpp | 33 +++++++++++++++++++++++++++++++++ src/Cluster/Node.h | 7 +++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/Cluster/List.h b/src/Cluster/List.h index ce7e4d68b2..0b7d9b8d44 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -53,11 +53,12 @@ class List { void AddFramesByCentroid(Cframes const&, Metric*); /// Add given frames to clusters based on distance to centroid and cutoff. void AddFramesByCentroid(Cframes const&, Metric*, bool, double); + /// Calculate the Davies-Bouldin index. double ComputeDBI(std::vector&, Metric*) const; /// Calculate pseudo-F double ComputePseudoF(double&, Metric*) const; - /// Calculate cluster and cluster frame silhouettes + /// Calculate cluster and cluster frame silhouettes TODO data sets int CalcSilhouette(PairwiseMatrix const&, Cframes const&, bool); private: typedef std::list Narray; diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index b16a369e93..704b52175b 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -134,3 +134,36 @@ void Cpptraj::Cluster::Node::AddFrameUpdateCentroid(Metric* Cdist, int frame) { Metric::ADDFRAME); AddFrameToCluster( frame ); } + +/** Calculate cluster population vs time. */ +void Cpptraj::Cluster::Node::CalcCpopVsTime(DataSet_float& pvt, unsigned int maxFrames, + CnormType normType) +const +{ + // TODO clear pvt array? + float pop = 0.0; + // Loop over all frames in cluster + for (frame_iterator f = beginframe(); f != endframe(); ++f) + { + if (*f > (int)pvt.Size()) + pvt.Resize( *f, pop ); + pop = pop + 1.0; + pvt[*f] = pop; + } + // Ensure pop v time set is maxFrames long + if (pvt.Size() < maxFrames) + pvt.Resize( maxFrames, pop ); + // Normalization + if (normType == CLUSTERPOP) { + float norm = 1.0 / (float)Nframes(); + for (unsigned int frm = 0; frm < maxFrames; ++frm) + pvt[frm] = pvt[frm] * norm; + } else if (normType == FRAME) { + float norm = 1.0; + for (unsigned int frm = 0; frm < maxFrames; ++frm) + { + pvt[frm] = pvt[frm] / norm; + norm = norm + 1.0; + } + } +} diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 012a5cdd1b..e0efca22d4 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -1,6 +1,7 @@ #ifndef INC_CLUSTER_NODE_H #define INC_CLUSTER_NODE_H #include "PairwiseMatrix.h" +#include "../DataSet_float.h" namespace Cpptraj { namespace Cluster { @@ -23,6 +24,9 @@ class Node { /// ASSIGNMENT Node& operator=(const Node&); + /// Types of normalization for cluster pop v time. + enum CnormType { CLUSTERPOP = 0, FRAME }; + /// Used to pair a representative frame number with a score. typedef std::pair RepPair; /// Used to hold a list of representative frames/scores @@ -106,6 +110,9 @@ class Node { void RemoveFrameUpdateCentroid(Metric*, int); /// Add specified frame to cluster and update centroid. void AddFrameUpdateCentroid(Metric*, int); + + /// Calculate cluster population vs time. + void CalcCpopVsTime(DataSet_float&, unsigned int, CnormType) const; private: Cframes frameList_; ///< List of frames belonging to this cluster. Centroid* centroid_; ///< Centroid of all frames in this cluster. From 4a9bce2b97ac87f734f5ea0cde04d58f2f95d4ac Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 12:48:23 -0500 Subject: [PATCH 121/417] DRR - Cpptraj: Slight reorganization of Timer classes. Place timing output in a separate routine. --- src/Analysis_Cluster.cpp | 4 ++ src/Cluster/Control.cpp | 80 ++++++++++++++++++++-------------------- src/Cluster/Control.h | 19 +++++++++- 3 files changed, 61 insertions(+), 42 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 72d877c002..5e4bc36703 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -48,6 +48,8 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s // Analysis_Cluster::Analyze() Analysis::RetType Analysis_Cluster::Analyze() { + Timer t_total; + t_total.Start(); int err = control_.Run(); if (err != 0) { mprinterr("Error: Clustering failed.\n"); @@ -62,5 +64,7 @@ Analysis::RetType Analysis_Cluster::Analyze() { return Analysis::ERR; } } + t_total.Stop(); + control_.Timing(t_total.Total()); return Analysis::OK; } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 98e293df9a..5ac4247fe1 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -344,13 +344,8 @@ int Cpptraj::Cluster::Control::Run() { } // Timers - Timer cluster_setup; - Timer cluster_pairwise; - Timer cluster_cluster; - Timer cluster_post; - Timer cluster_total; - cluster_total.Start(); - cluster_setup.Start(); + timer_run_.Start(); + timer_setup_.Start(); // Set up the Metric if (metric_->Setup()) { mprinterr("Error: Metric setup failed.\n"); @@ -362,16 +357,16 @@ int Cpptraj::Cluster::Control::Run() { frameSieve.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); Cframes const& framesToCluster = frameSieve.FramesToCluster(); - cluster_setup.Stop(); - cluster_pairwise.Start(); + timer_setup_.Stop(); + timer_pairwise_.Start(); // Cache distances if necessary pmatrix_.CacheDistances( framesToCluster, sieve_ ); if (pmatrix_.HasCache() && verbose_ > 1) pmatrix_.Cache().PrintCached(); - cluster_pairwise.Stop(); - cluster_cluster.Start(); + timer_pairwise_.Stop(); + timer_cluster_.Start(); // Cluster if (algorithm_->DoClustering(clusters_, framesToCluster, pmatrix_) != 0) { @@ -379,16 +374,12 @@ int Cpptraj::Cluster::Control::Run() { return 1; } - cluster_cluster.Stop(); + timer_cluster_.Stop(); // --------------------------------------------- - cluster_post.Start(); - Timer cluster_post_renumber; - Timer cluster_post_bestrep; - Timer cluster_post_info; - Timer cluster_post_summary; + timer_post_.Start(); //Timer cluster_post_coords; - cluster_post_renumber.Start(); + timer_post_renumber_.Start(); // Update cluster centroids here in case they need to be used to // restore sieved frames clusters_.UpdateCentroids( metric_ ); @@ -417,8 +408,8 @@ int Cpptraj::Cluster::Control::Run() { // Sort by population and renumber clusters_.Sort(); - cluster_post_renumber.Stop(); - cluster_post_bestrep.Start(); + timer_post_renumber_.Stop(); + timer_post_bestrep_.Start(); // Find best representative frames for each cluster. if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, pmatrix_, @@ -428,7 +419,7 @@ int Cpptraj::Cluster::Control::Run() { return 1; } - cluster_post_bestrep.Stop(); + timer_post_bestrep_.Stop(); // DEBUG - print clusters to stdout if (verbose_ > 0) { @@ -437,15 +428,20 @@ int Cpptraj::Cluster::Control::Run() { } // TODO assign reference names - + timer_run_.Stop(); +// return 0; +//} +// +//int Cpptraj::Cluster::Control::Output() { + timer_output_.Start(); // Info if (!suppressInfo_) { CpptrajFile outfile; if (outfile.OpenWrite( clusterinfo_ )) return 1; - cluster_post_info.Start(); + timer_output_info_.Start(); Output::PrintClustersToFile(outfile, clusters_, *algorithm_, metric_, frameSieve.SieveValue(), frameSieve.SievedOut()); - cluster_post_info.Stop(); + timer_output_info_.Stop(); outfile.CloseFile(); } @@ -465,7 +461,7 @@ int Cpptraj::Cluster::Control::Run() { // Print a summary of clusters if (!summaryfile_.empty()) { - cluster_post_summary.Start(); + timer_output_summary_.Start(); CpptrajFile outfile; if (outfile.OpenWrite(summaryfile_)) { mprinterr("Error: Could not set up cluster summary file.\n"); @@ -473,25 +469,27 @@ int Cpptraj::Cluster::Control::Run() { } Output::Summary(outfile, clusters_, *algorithm_, pmatrix_, includeSieveInCalc_, frameSieve.SievedOut()); - cluster_post_summary.Stop(); + timer_output_summary_.Stop(); } - cluster_post.Stop(); - cluster_total.Stop(); + timer_output_.Stop(); + return 0; +} - // Timing data +void Cpptraj::Cluster::Control::Timing(double ttotal) const { mprintf("\tCluster timing data:\n"); - cluster_setup.WriteTiming(1, " Cluster Init. :", cluster_total.Total()); - cluster_pairwise.WriteTiming(1, " Pairwise Calc.:", cluster_total.Total()); - cluster_cluster.WriteTiming(1, " Clustering :", cluster_total.Total()); - algorithm_->Timing( cluster_cluster.Total() ); - cluster_post.WriteTiming(1, " Cluster Post. :", cluster_total.Total()); - cluster_post_renumber.WriteTiming(2, "Cluster renumbering/sieve restore", cluster_post.Total()); - cluster_post_bestrep.WriteTiming(2, "Find best rep.", cluster_post.Total()); - cluster_post_info.WriteTiming(2, "Info calc", cluster_post.Total()); - cluster_post_summary.WriteTiming(2, "Summary calc", cluster_post.Total()); + // Run Timing data + timer_setup_.WriteTiming( 2, "Cluster Init. :", timer_run_.Total()); + timer_pairwise_.WriteTiming( 2, "Pairwise Calc. :", timer_run_.Total()); + timer_cluster_.WriteTiming( 2, "Clustering :", timer_run_.Total()); + algorithm_->Timing( timer_cluster_.Total() ); + timer_post_.WriteTiming( 2, "Cluster Post. :", timer_run_.Total()); + timer_post_renumber_.WriteTiming( 3, "Cluster renumbering/sieve restore :", timer_post_.Total()); + timer_post_bestrep_.WriteTiming( 3, "Find best rep. :", timer_post_.Total()); + timer_run_.WriteTiming( 1, "Run Total :", ttotal); + // Output Timing data + timer_output_info_.WriteTiming( 2, "Info calc :", timer_output_.Total()); + timer_output_summary_.WriteTiming(2, "Summary calc :", timer_output_.Total()); //cluster_post_coords.WriteTiming(2, "Coordinate writes", cluster_post.Total()); - cluster_total.WriteTiming(1, "Total:"); - - return 0; + timer_output_.WriteTiming(1, "Output Total :", ttotal); } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index d406f97a6b..b736b2008c 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -5,6 +5,7 @@ #include "Algorithm.h" #include "Metric.h" #include "BestReps.h" +#include "../Timer.h" #include "../DataSetList.h" #include "../DataFileList.h" #include "../DataSet_Coords.h" @@ -25,9 +26,14 @@ class Control { int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, DataSetList&, DataFileList&, int); - + /// Provide information on how clustering calculation is currently set up. void Info() const; + /// Perform clustering. int Run(); + /// Do any clustering output. TODO + //int Output(); + /// Print timing data + void Timing(double) const; List const& Clusters() const { return clusters_; } Metric const& DistMetric() const { return *metric_; } @@ -66,6 +72,17 @@ class Control { std::string summaryfile_; ///< Cluster summary file name. std::string sil_file_; ///< File prefix for writing silhouette data + // Timers + Timer timer_setup_; ///< Run - metric, frames to cluster setup + Timer timer_pairwise_; ///< Run - pairwise caching + Timer timer_cluster_; ///< Run - clustering + Timer timer_post_; ///< Run - post-clustering calcs (rep frames etc) + Timer timer_post_renumber_; ///< Run Post - cluster sort/renumber + Timer timer_post_bestrep_; ///< Run Post - best rep frame calc + Timer timer_run_; ///< Total Run time + Timer timer_output_info_; ///< Output - info file write + Timer timer_output_summary_; ///< Output - summary write + Timer timer_output_; ///< Total output time }; } /** END namespace Cluster. */ From 34059726992780087fa3714ff7c835680d40447d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 12:48:54 -0500 Subject: [PATCH 122/417] DRR - Cpptraj: Update dependencies. --- src/cpptrajdepend | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 0875147235..2b1988bd9b 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h DataSet_string.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -140,27 +140,27 @@ BufferedLine.o : BufferedLine.cpp BufferedLine.h CpptrajFile.h CpptrajStdio.h Fi ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h -Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h -Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h -Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h +Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../Random.h Cluster/Cframes.h Cluster/Sieve.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h From d5e5ce61018b306b53c7b599b84a7c311760e337 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 13:03:14 -0500 Subject: [PATCH 123/417] DRR - Cpptraj: Start adding cluster pop vs time options. --- src/Cluster/Control.cpp | 14 +++++++++++++- src/Cluster/Control.h | 3 +++ src/Cluster/Node.h | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 5ac4247fe1..e7560c73a5 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -21,7 +21,9 @@ Cpptraj::Cluster::Control::Control() : includeSieveInCalc_(false), bestRep_(BestReps::NO_REPS), nRepsToSave_(1), - suppressInfo_(false) + suppressInfo_(false), + cpopvtimefile_(0), + norm_pop_(Node::NONE) {} Cpptraj::Cluster::Control::~Control() { @@ -325,6 +327,16 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da clusterinfo_ = analyzeArgs.GetStringKey("info"); summaryfile_ = analyzeArgs.GetStringKey("summary"); sil_file_ = analyzeArgs.GetStringKey("sil"); + cpopvtimefile_ = DFL.AddDataFile(analyzeArgs.GetStringKey("cpopvtime"), analyzeArgs); + if (cpopvtimefile_ != 0) { + if (analyzeArgs.hasKey("normpop")) + norm_pop_ = Node::CLUSTERPOP; + else if (analyzeArgs.hasKey("normframe")) + norm_pop_ = Node::FRAME; + else + norm_pop_ = Node::NONE; + } + Info(); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index b736b2008c..804f602b47 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -72,6 +72,9 @@ class Control { std::string summaryfile_; ///< Cluster summary file name. std::string sil_file_; ///< File prefix for writing silhouette data + DataFile* cpopvtimefile_; + Node::CnormType norm_pop_; + // Timers Timer timer_setup_; ///< Run - metric, frames to cluster setup Timer timer_pairwise_; ///< Run - pairwise caching diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index e0efca22d4..851814d8f6 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -25,7 +25,7 @@ class Node { Node& operator=(const Node&); /// Types of normalization for cluster pop v time. - enum CnormType { CLUSTERPOP = 0, FRAME }; + enum CnormType { NONE = 0, CLUSTERPOP, FRAME }; /// Used to pair a representative frame number with a score. typedef std::pair RepPair; From c5d9a4ecd6734ae42182d4d2f3cd4904b6fa0aa1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 13:37:01 -0500 Subject: [PATCH 124/417] DRR - Cpptraj: Move cluster num v time set to Control --- src/Analysis_Cluster.cpp | 27 ++++++----------- src/Analysis_Cluster.h | 2 -- src/Cluster/Control.cpp | 62 ++++++++++++++++++++++++++++------------ src/Cluster/Control.h | 12 +++++--- src/Cluster/Sieve.h | 1 + src/cpptrajdepend | 4 +-- 6 files changed, 64 insertions(+), 44 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 5e4bc36703..20af7f5412 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -32,15 +32,11 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s }*/ - control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, setup.DSL(), setup.DFL(), debugIn); - - // Output files - DataFile* cnumvtimefile = setup.DFL().AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); + if (control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, + setup.DSL(), setup.DFL(), debugIn)) + return Analysis::ERR; - // Dataset to store cluster number v time - cnumvtime_ = setup.DSL().AddSet(DataSet::INTEGER, analyzeArgs.GetStringNext(), "Cnum"); - if (cnumvtime_==0) return Analysis::ERR; - if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); + control_.Info(); return Analysis::OK; @@ -50,19 +46,14 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s Analysis::RetType Analysis_Cluster::Analyze() { Timer t_total; t_total.Start(); - int err = control_.Run(); - if (err != 0) { + if (control_.Run() != 0) { mprinterr("Error: Clustering failed.\n"); return Analysis::ERR; } - // Cluster number vs time - if (cnumvtime_ != 0) { - if (control_.Clusters().CreateCnumVsTime( (DataSet_integer*)cnumvtime_, - control_.DistMetric().Ntotal() )) - { - mprinterr("Error: Creation of cluster num vs time data set failed.\n"); - return Analysis::ERR; - } + // Output + if (control_.Output() != 0) { + mprinterr("Error: Cluster output failed.\n"); + return Analysis::ERR; } t_total.Stop(); control_.Timing(t_total.Total()); diff --git a/src/Analysis_Cluster.h b/src/Analysis_Cluster.h index 492291d61b..22d7779da4 100644 --- a/src/Analysis_Cluster.h +++ b/src/Analysis_Cluster.h @@ -16,7 +16,5 @@ class Analysis_Cluster : public Analysis { Cpptraj::Cluster::Control control_; DataSet_Coords* coords_; - DataSet* cnumvtime_; - }; #endif diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index e7560c73a5..05ac2a1c59 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -1,7 +1,6 @@ #include "Control.h" #include "../CpptrajStdio.h" #include "../DataSet_Coords.h" -#include "Sieve.h" #include "Output.h" #include "../DataFile.h" // For loading pairwise cache // Metric classes @@ -22,6 +21,7 @@ Cpptraj::Cluster::Control::Control() : bestRep_(BestReps::NO_REPS), nRepsToSave_(1), suppressInfo_(false), + cnumvtime_(0), cpopvtimefile_(0), norm_pop_(Node::NONE) {} @@ -321,12 +321,18 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da return 1; } - // Output options + // Cluster info output suppressInfo_ = analyzeArgs.hasKey("noinfo"); if (!suppressInfo_) clusterinfo_ = analyzeArgs.GetStringKey("info"); + + // Cluster summary output summaryfile_ = analyzeArgs.GetStringKey("summary"); + + // Cluster silhouette output sil_file_ = analyzeArgs.GetStringKey("sil"); + + // Cluster pop v time output cpopvtimefile_ = DFL.AddDataFile(analyzeArgs.GetStringKey("cpopvtime"), analyzeArgs); if (cpopvtimefile_ != 0) { if (analyzeArgs.hasKey("normpop")) @@ -337,9 +343,12 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da norm_pop_ = Node::NONE; } + // Cluster number vs time + DataFile* cnumvtimefile = DFL.AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); + cnumvtime_ = DSL.AddSet(DataSet::INTEGER, analyzeArgs.GetStringNext(), "Cnum"); + if (cnumvtime_ == 0) return 1; + if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); - - Info(); return 0; } @@ -365,9 +374,16 @@ int Cpptraj::Cluster::Control::Run() { } // Figure out which frames to cluster - Sieve frameSieve; - frameSieve.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); - Cframes const& framesToCluster = frameSieve.FramesToCluster(); + frameSieve_.Clear(); + frameSieve_.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); + if (verbose_ >= 0) { + if (frameSieve_.FramesToCluster().size() < metric_->Ntotal()) + mprintf("\tClustering %zu of %u points.\n", frameSieve_.FramesToCluster().size(), + metric_->Ntotal()); + else + mprintf("\tClustering %u points.\n", metric_->Ntotal()); + } + Cframes const& framesToCluster = frameSieve_.FramesToCluster(); timer_setup_.Stop(); timer_pairwise_.Start(); @@ -402,10 +418,10 @@ int Cpptraj::Cluster::Control::Run() { mprintf("\tRestoring sieved frames.\n"); switch (sieveRestore_) { case CLOSEST_CENTROID : - clusters_.AddFramesByCentroid( frameSieve.SievedOut(), metric_ ); break; + clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metric_ ); break; case EPSILON_CENTROID : case EPSILON_FRAME : - clusters_.AddFramesByCentroid( frameSieve.SievedOut(), metric_, + clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metric_, (sieveRestore_ == EPSILON_CENTROID), restoreEpsilon_ ); break; @@ -425,7 +441,7 @@ int Cpptraj::Cluster::Control::Run() { // Find best representative frames for each cluster. if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, pmatrix_, - frameSieve.SievedOut(), verbose_)) + frameSieve_.SievedOut(), verbose_)) { mprinterr("Error: Finding best representative frames for clusters failed.\n"); return 1; @@ -441,10 +457,10 @@ int Cpptraj::Cluster::Control::Run() { // TODO assign reference names timer_run_.Stop(); -// return 0; -//} -// -//int Cpptraj::Cluster::Control::Output() { + return 0; +} + +int Cpptraj::Cluster::Control::Output() { timer_output_.Start(); // Info if (!suppressInfo_) { @@ -452,16 +468,16 @@ int Cpptraj::Cluster::Control::Run() { if (outfile.OpenWrite( clusterinfo_ )) return 1; timer_output_info_.Start(); Output::PrintClustersToFile(outfile, clusters_, *algorithm_, metric_, - frameSieve.SieveValue(), frameSieve.SievedOut()); + frameSieve_.SieveValue(), frameSieve_.SievedOut()); timer_output_info_.Stop(); outfile.CloseFile(); } // Silhouette if (!sil_file_.empty()) { - if (frameSieve.SieveValue() != 1 && !includeSieveInCalc_) + if (frameSieve_.SieveValue() != 1 && !includeSieveInCalc_) mprintf("Warning: Silhouettes do not include sieved frames.\n"); - clusters_.CalcSilhouette(pmatrix_, frameSieve.SievedOut(), includeSieveInCalc_); + clusters_.CalcSilhouette(pmatrix_, frameSieve_.SievedOut(), includeSieveInCalc_); CpptrajFile Ffile, Cfile; if (Ffile.OpenWrite(sil_file_ + ".frame.dat")) return 1; Output::PrintSilhouetteFrames(Ffile, clusters_); @@ -480,10 +496,20 @@ int Cpptraj::Cluster::Control::Run() { return 1; } Output::Summary(outfile, clusters_, *algorithm_, pmatrix_, includeSieveInCalc_, - frameSieve.SievedOut()); + frameSieve_.SievedOut()); timer_output_summary_.Stop(); } + // Cluster number vs time + if (cnumvtime_ != 0) { + if (clusters_.CreateCnumVsTime( (DataSet_integer*)cnumvtime_, metric_->Ntotal() )) + { + mprinterr("Error: Creation of cluster num vs time data set failed.\n"); + return 1; + } + } + + timer_output_.Stop(); return 0; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 804f602b47..3231e43cd3 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -1,6 +1,7 @@ #ifndef INC_CLUSTER_CONTROL_H #define INC_CLUSTER_CONTROL_H #include "List.h" +#include "Sieve.h" #include "PairwiseMatrix.h" #include "Algorithm.h" #include "Metric.h" @@ -30,8 +31,8 @@ class Control { void Info() const; /// Perform clustering. int Run(); - /// Do any clustering output. TODO - //int Output(); + /// Do any clustering output. + int Output(); /// Print timing data void Timing(double) const; @@ -52,6 +53,7 @@ class Control { static DataFile::DataFormatType DEFAULT_PAIRDIST_TYPE_; List clusters_; ///< Hold cluster results. + Sieve frameSieve_; ///< Hold frames to cluster, frames to "sieve" out. Metric* metric_; ///< Hold the distance metric. DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. PairwiseMatrix pmatrix_; ///< Encapsulates the metric and any cached distances. @@ -72,8 +74,10 @@ class Control { std::string summaryfile_; ///< Cluster summary file name. std::string sil_file_; ///< File prefix for writing silhouette data - DataFile* cpopvtimefile_; - Node::CnormType norm_pop_; + DataSet* cnumvtime_; ///< Cluster number vs time data set. + + DataFile* cpopvtimefile_; ///< Cluster population vs time file. + Node::CnormType norm_pop_; ///< Cluster pop vs time normalization type // Timers Timer timer_setup_; ///< Run - metric, frames to cluster setup diff --git a/src/Cluster/Sieve.h b/src/Cluster/Sieve.h index e120654692..185d73a2fc 100644 --- a/src/Cluster/Sieve.h +++ b/src/Cluster/Sieve.h @@ -12,6 +12,7 @@ class Sieve { Sieve() : type_(NONE), sieve_(1) {} int SetFramesToCluster(int, std::size_t, int); + void Clear() { framesToCluster_.clear(); sievedOut_.clear(); type_ = NONE; sieve_ = 1; } Cframes const& FramesToCluster() const { return framesToCluster_; } Cframes const& SievedOut() const { return sievedOut_; } diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 2b1988bd9b..5456a15bac 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h DataSet_string.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -160,7 +160,7 @@ ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants. Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h From b9957106d58e70c78a433899b07bf8aa3609c917 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 7 Feb 2019 13:50:19 -0500 Subject: [PATCH 125/417] DRR - Cpptraj: Finish cluster population vs time output --- src/Analysis_Cluster.cpp | 4 +++- src/Analysis_Cluster.h | 3 ++- src/Cluster/Control.cpp | 26 +++++++++++++++++++++++--- src/Cluster/Control.h | 5 +++-- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 20af7f5412..76ccc69a5b 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -38,6 +38,8 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s control_.Info(); + masterDSL_ = setup.DslPtr(); + return Analysis::OK; } @@ -51,7 +53,7 @@ Analysis::RetType Analysis_Cluster::Analyze() { return Analysis::ERR; } // Output - if (control_.Output() != 0) { + if (control_.Output(*masterDSL_) != 0) { mprinterr("Error: Cluster output failed.\n"); return Analysis::ERR; } diff --git a/src/Analysis_Cluster.h b/src/Analysis_Cluster.h index 22d7779da4..d2b1425699 100644 --- a/src/Analysis_Cluster.h +++ b/src/Analysis_Cluster.h @@ -6,7 +6,7 @@ /// class Analysis_Cluster : public Analysis { public: - Analysis_Cluster() : Analysis(HIDDEN) {} + Analysis_Cluster() : Analysis(HIDDEN), coords_(0), masterDSL_(0) {} DispatchObject* Alloc() const { return (DispatchObject*)new Analysis_Cluster(); } void Help() const; @@ -16,5 +16,6 @@ class Analysis_Cluster : public Analysis { Cpptraj::Cluster::Control control_; DataSet_Coords* coords_; + DataSetList* masterDSL_; }; #endif diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 05ac2a1c59..5e69249ddb 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -345,7 +345,9 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da // Cluster number vs time DataFile* cnumvtimefile = DFL.AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); - cnumvtime_ = DSL.AddSet(DataSet::INTEGER, analyzeArgs.GetStringNext(), "Cnum"); + // NOTE overall set name extracted here. This should be the last thing done. + dsname_ = analyzeArgs.GetStringNext(); + cnumvtime_ = DSL.AddSet(DataSet::INTEGER, dsname_, "Cnum"); if (cnumvtime_ == 0) return 1; if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); @@ -460,7 +462,7 @@ int Cpptraj::Cluster::Control::Run() { return 0; } -int Cpptraj::Cluster::Control::Output() { +int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { timer_output_.Start(); // Info if (!suppressInfo_) { @@ -508,7 +510,25 @@ int Cpptraj::Cluster::Control::Output() { return 1; } } - + + // Cluster population vs time + if (cpopvtimefile_ != 0) { + MetaData md( dsname_, "Pop" ); + DataSet::SizeArray setsize(1, metric_->Ntotal()); + for (List::cluster_iterator node = clusters_.begin(); + node != clusters_.end(); ++node) + { + md.SetIdx( node->Num() ); + DataSet_float* ds = (DataSet_float*)DSL.AddSet( DataSet::FLOAT, md ); + if (ds == 0) { + mprinterr("Error: Could not allocate cluster pop vs time DataSet\n"); + return 1; + } + ds->Allocate( setsize ); + if (cpopvtimefile_ != 0) cpopvtimefile_->AddDataSet( ds ); + node->CalcCpopVsTime( *ds, metric_->Ntotal(), norm_pop_ ); + } + } timer_output_.Stop(); return 0; diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 3231e43cd3..7720f837e6 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -31,8 +31,8 @@ class Control { void Info() const; /// Perform clustering. int Run(); - /// Do any clustering output. - int Output(); + /// Do any clustering output. TODO make const? + int Output(DataSetList&); /// Print timing data void Timing(double) const; @@ -58,6 +58,7 @@ class Control { DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. PairwiseMatrix pmatrix_; ///< Encapsulates the metric and any cached distances. Algorithm* algorithm_; ///< Hold the clustering algorithm. + std::string dsname_; ///< Name for output data sets. int verbose_; int sieve_; ///< Sieve value From f1963c6056868f0867012caceb74249ca6fc7424 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 8 Feb 2019 09:54:12 -0500 Subject: [PATCH 126/417] DRR - Cpptraj: Fix cache check --- src/Cluster/Control.cpp | 2 +- src/DataSet_PairwiseCache.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 5e69249ddb..6293d2c97d 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -391,7 +391,7 @@ int Cpptraj::Cluster::Control::Run() { timer_pairwise_.Start(); // Cache distances if necessary - pmatrix_.CacheDistances( framesToCluster, sieve_ ); + if (pmatrix_.CacheDistances( framesToCluster, sieve_ )) return 1; if (pmatrix_.HasCache() && verbose_ > 1) pmatrix_.Cache().PrintCached(); diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index 28e93e3aa9..f664b5fa05 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -33,14 +33,14 @@ int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigne } /** Check that the given frames match the already-cached frames. */ -bool DataSet_PairwiseCache::CachedFramesMatch(Cframes const& frames) const +bool DataSet_PairwiseCache::CachedFramesMatch(Cframes const& framesIn) const { - Cframes_it it0 = frames.begin(); - for (Cframes_it it1 = frameToIdx_.begin(); it0 != frameToIdx_.end(); ++it1) + Cframes_it frm0 = framesIn.begin(); + for (int frm1 = 0; frm1 != (int)frameToIdx_.size(); frm1++) { - if (*it1 != -1) { - if (it0 == frames.end() || *it1 != *it0) return false; - ++it0; + if (frameToIdx_[frm1] != -1) { + if (frm0 == framesIn.end() || *frm0 != frm1) return false; + ++frm0; } } return true; From 523e1ee600df2efc483bf2a20c7dc4a95c32e76f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 8 Feb 2019 13:29:30 -0500 Subject: [PATCH 127/417] DRR - Cpptraj: 'savepairdist' only applies to in-memory cache for now. --- src/Cluster/Control.cpp | 14 +++++++++----- src/Cluster/PairwiseMatrix.cpp | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 6293d2c97d..8efe9b639b 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -144,11 +144,15 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis DataFile::DataFormatType pw_file_type = DataFile::UNKNOWN_DATA; if (pairdistname.empty()) pw_file_type = DEFAULT_PAIRDIST_TYPE_; - DataFile* pwd_file = DFL.AddDataFile( fname, pw_file_type, ArgList() ); - if (pwd_file == 0) return 1; - pwd_file->AddDataSet( cache_ ); - mprintf("DEBUG: Saving pw distance cache '%s' to file '%s'\n", cache_->legend(), - pwd_file->DataFilename().full()); + // TODO enable saving for other set types? + if (cache_->Type() == DataSet::PMATRIX_MEM) { + DataFile* pwd_file = DFL.AddDataFile( fname, pw_file_type, ArgList() ); + if (pwd_file == 0) return 1; + pwd_file->AddDataSet( cache_ ); + mprintf("DEBUG: Saving pw distance cache '%s' to file '%s'\n", cache_->legend(), + pwd_file->DataFilename().full()); + } else + mprintf("Warning: Can only save pairwise distance cache for in-memory caches.\n"); } } diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index e3dedef2ba..2cc5d299ef 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -63,7 +63,7 @@ int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCach if (cache_ == 0) return 0; if (cache_->Size() > 0) { - mprintf("DEBUG: Using existing cache '%s'\n", cache_->legend()); + mprintf("\tUsing existing cache '%s'\n", cache_->legend()); // If cache is already populated, check that it is valid. // The frames to cache must match cached frames. if (!cache_->CachedFramesMatch( framesToCache )) { @@ -90,7 +90,7 @@ int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCach /** Cache distances between given frames using SetElement(). */ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) { - mprintf("DEBUG: Caching distances for %zu frames.\n", framesToCache.size()); + mprintf("\tCaching distances for %zu frames.\n", framesToCache.size()); int f2end = (int)framesToCache.size(); int f1end = f2end - 1; From db7ee2e5b135140affe06c3022cf807e7150f894 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 8 Feb 2019 13:34:16 -0500 Subject: [PATCH 128/417] DRR - Cpptraj: Protect for non-netcdf case --- src/DataFile.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/DataFile.cpp b/src/DataFile.cpp index 04460bd63a..1e699671ab 100644 --- a/src/DataFile.cpp +++ b/src/DataFile.cpp @@ -67,7 +67,11 @@ const FileTypes::AllocToken DataFile::DF_AllocArray[] = { { "Amber CPOUT", DataIO_Cpout::ReadHelp, DataIO_Cpout::WriteHelp, DataIO_Cpout::Alloc}, { "CHARMM RTF/PRM", 0, 0, DataIO_CharmmRtfPrm::Alloc }, { "Pairwise Cache (binary)", 0, 0, DataIO_Cmatrix_Binary::Alloc }, +# ifdef BINTRAJ { "Pairwise Cache (NetCDF)", 0, 0, DataIO_Cmatrix_NC::Alloc }, +# else + { "Pairwise Cache (NetCDF)", 0, 0, 0 }, +# endif { "Unknown Data file", 0, 0, 0 } }; From 658d8f241c5abf6b7639adb5bfc9777f61a86f98 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 8 Feb 2019 15:03:02 -0500 Subject: [PATCH 129/417] DRR - Cpptraj: No longer hidden --- src/Analysis_Cluster.h | 2 +- src/Command.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Analysis_Cluster.h b/src/Analysis_Cluster.h index d2b1425699..352fb3ebb7 100644 --- a/src/Analysis_Cluster.h +++ b/src/Analysis_Cluster.h @@ -6,7 +6,7 @@ /// class Analysis_Cluster : public Analysis { public: - Analysis_Cluster() : Analysis(HIDDEN), coords_(0), masterDSL_(0) {} + Analysis_Cluster() : coords_(0), masterDSL_(0) {} DispatchObject* Alloc() const { return (DispatchObject*)new Analysis_Cluster(); } void Help() const; diff --git a/src/Command.cpp b/src/Command.cpp index b331bc4e1a..b6f128a440 100644 --- a/src/Command.cpp +++ b/src/Command.cpp @@ -357,7 +357,7 @@ void Command::Init() { Command::AddCmd( new Analysis_AutoCorr(), Cmd::ANA, 1, "autocorr" ); Command::AddCmd( new Analysis_Average(), Cmd::ANA, 1, "avg" ); Command::AddCmd( new Analysis_State(), Cmd::ANA, 1, "calcstate" ); - Command::AddCmd( new Analysis_Cluster(), Cmd::ANA, 1, "cluster" ); // HIDDEN + Command::AddCmd( new Analysis_Cluster(), Cmd::ANA, 1, "cluster" ); Command::AddCmd( new Analysis_Corr(), Cmd::ANA, 2, "corr", "correlationcoe" ); Command::AddCmd( new Analysis_ConstantPHStats,Cmd::ANA,1, "cphstats" ); Command::AddCmd( new Analysis_CrankShaft(), Cmd::ANA, 2, "crank", "crankshaft" ); From 99cc2f37af5d60dd5c85df0b5c30dcea094987e8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 8 Feb 2019 15:03:29 -0500 Subject: [PATCH 130/417] DRR - Cpptraj: Be consistent with meaning of 'T' and 'F' in sieve status array. Ensure sieve status gets allocated. Make 'pairdist' with nothing else specified imply 'loadpairdist'. --- src/Cluster/Cmatrix_Binary.cpp | 7 ++++--- src/Cluster/Control.cpp | 10 +++++++++- src/DataIO_Cmatrix_Binary.cpp | 3 +++ src/DataSet_PairwiseCache.cpp | 5 ++++- src/DataSet_PairwiseCache.h | 5 +++++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Cmatrix_Binary.cpp b/src/Cluster/Cmatrix_Binary.cpp index e6cb076e43..4cb4546b0f 100644 --- a/src/Cluster/Cmatrix_Binary.cpp +++ b/src/Cluster/Cmatrix_Binary.cpp @@ -169,7 +169,8 @@ int Cpptraj::Cluster::Cmatrix_Binary::WriteCmatrix(FileName const& fname, // Write matrix elements size_t nelements = Nelements( Nrows ); outfile.Write( ptr, nelements*sizeof(float) ); - // If this is a reduced matrix, write whether each frame was sieved (T) or not (F). + // If this is a reduced matrix, write whether each frame was sieved (T) or not (F). + // NOTE: definitions are in DataSet_PairwiseCache.h if (sieveValue != 1) { //DataSet_PairwiseMatrix::StatusArray frameIsPresent; std::vector frameIsPresent; @@ -177,9 +178,9 @@ int Cpptraj::Cluster::Cmatrix_Binary::WriteCmatrix(FileName const& fname, for (Cframes::const_iterator it = frameToIdx.begin(); it != frameToIdx.end(); ++it) if (*it == -1) - frameIsPresent.push_back( 'F' ); - else frameIsPresent.push_back( 'T' ); + else + frameIsPresent.push_back( 'F' ); outfile.Write( &frameIsPresent[0], OriginalNframes*sizeof(char) ); } return 0; diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 8efe9b639b..be810be1a7 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -63,8 +63,16 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis std::string fname; if (pairdistname.empty()) fname = DEFAULT_PAIRDIST_NAME_; - else + else { fname = pairdistname; + // To remain backwards compatible, assume we want to load if + // a pairdist name was specified. + if (!load_pair && !save_pair) { + mprintf("Warning: 'pairdist' specified but 'loadpairdist'/'savepairdist' not specified." + "Warning: Assuming 'loadpairdist'.\n"); + load_pair = true; + } + } cache_ = 0; if (load_pair) { diff --git a/src/DataIO_Cmatrix_Binary.cpp b/src/DataIO_Cmatrix_Binary.cpp index 47be7d7638..9f4a211a72 100644 --- a/src/DataIO_Cmatrix_Binary.cpp +++ b/src/DataIO_Cmatrix_Binary.cpp @@ -53,6 +53,9 @@ int DataIO_Cmatrix_Binary::ReadCmatrix(FileName const& fname, DataSet_PairwiseCa if (infile.Sieve() != 1) { ssArray.resize( infile.Ntotal() ); sieveStatus = &ssArray[0]; + } else { + // All present + ssArray.assign( infile.Ntotal(), DataSet_PairwiseCache::PRESENT_ ); } // Read in matrix elements if (infile.GetCmatrix( Mat.Ptr(), sieveStatus )) return 1; diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index f664b5fa05..f2f57964d5 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -13,6 +13,9 @@ DataSet_PairwiseCache::DataSet_PairwiseCache(DataType t) : sieve_(0) {} +const char DataSet_PairwiseCache::PRESENT_ = 'F'; + +const char DataSet_PairwiseCache::ABSENT_ = 'T'; /** Set up frame number to matrix index for caching. This should be called * by each inheriting DataSet_PairwiseCache's SetupCache routine. @@ -54,7 +57,7 @@ int DataSet_PairwiseCache::SetupFromStatus(StatusArray const& frameIsPresent, in int idx = 0; for (StatusArray::const_iterator it = frameIsPresent.begin(); it != frameIsPresent.end(); ++it) - if (*it == 'T') + if (*it == PRESENT_) frameToIdx_.push_back( idx++ ); else frameToIdx_.push_back( -1 ); diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index c4509281d0..ab649a8d1d 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -19,6 +19,11 @@ class DataSet_PairwiseCache : public DataSet { /// Class used to hold frame statuses (T = present) typedef std::vector StatusArray; + /// Character that means frame "present"; 'F' meaning frame was not sieve. + static const char PRESENT_; + /// Character that means frame "absent" - 'T' meaning frame was sieved. + static const char ABSENT_; + //static DataSet* Alloc() { return (DataSet*)new DataSet_PairwiseCache(); } // ----- DataSet functions ------------------- //size_t Size() const { return 0; } From 328e59c27a6696455752420ce729c08aaf4d97a8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 11 Feb 2019 18:42:19 -0500 Subject: [PATCH 131/417] DRR - Cpptraj: Add remaining old centroids. --- src/Cluster/Centroid_Coord.h | 2 ++ src/Cluster/Centroid_Multi.h | 25 +++++++++++++++++++++++++ src/Cluster/Centroid_Num.h | 21 +++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 src/Cluster/Centroid_Multi.h create mode 100644 src/Cluster/Centroid_Num.h diff --git a/src/Cluster/Centroid_Coord.h b/src/Cluster/Centroid_Coord.h index c0d9baf74d..f185b8e8a9 100644 --- a/src/Cluster/Centroid_Coord.h +++ b/src/Cluster/Centroid_Coord.h @@ -11,8 +11,10 @@ class Centroid_Coord : public Centroid { Centroid_Coord() {} Centroid_Coord(Frame const& frame) : cframe_(frame) {} Centroid_Coord(int natom) : cframe_(natom) {} + Centroid* Copy() { return (Centroid*)new Centroid_Coord(cframe_); } void Print(std::string const&) const; + Frame const& Cframe() const { return cframe_; } Frame& Cframe() { return cframe_; } private: diff --git a/src/Cluster/Centroid_Multi.h b/src/Cluster/Centroid_Multi.h new file mode 100644 index 0000000000..e2bbdf19d2 --- /dev/null +++ b/src/Cluster/Centroid_Multi.h @@ -0,0 +1,25 @@ +#ifndef INC_CLUSTER_CENTROID_MULTI_H +#define INC_CLUSTER_CENTROID_MULTI_H +#include +namespace Cpptraj { +namespace Cluster { + +/// Cluster centroid for multiple DataSets +class Centroid_Multi : public Centroid { + public: + typedef std::vector Darray; + Centroid_Multi() {} + Centroid_Multi(Darray const& val, Darray const& x, Darray const& y) : + cvals_(val), Sumx_(x), Sumy_(y) {} + + Centroid* Copy() { return (Centroid*)new Centroid_Multi(cvals_, Sumx_, Sumy_); } + private: + Darray cvals_; + Darray Sumx_; // For storing periodic average + Darray Sumy_; // For storing periodic average +}; + + +} +} +#endif diff --git a/src/Cluster/Centroid_Num.h b/src/Cluster/Centroid_Num.h new file mode 100644 index 0000000000..eb02a1a818 --- /dev/null +++ b/src/Cluster/Centroid_Num.h @@ -0,0 +1,21 @@ +#ifndef INC_CLUSTER_CENTROID_NUM_H +#define INC_CLUSTER_CENTROID_NUM_H +namespace Cpptraj { +namespace Cluster { + +/// Cluster centroid for generic DataSet +class Centroid_Num : public Centroid { + public: + Centroid_Num() : cval_(0.0), sumx_(0.0), sumy_(0.0) {} + Centroid_Num(double val, double x, double y) : cval_(val), sumx_(x), sumy_(y) {} + + Centroid* Copy() { return (Centroid*)new Centroid_Num(cval_, sumx_, sumy_); } + private: + double cval_; + double sumx_; // For storing periodic average + double sumy_; // For storing periodic average +}; + +} +} +#endif From f729562a089b884f01954ce331d73e24d4ad1144 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 12 Feb 2019 13:58:56 -0500 Subject: [PATCH 132/417] DRR - Cpptraj: Enable some of the new tests. --- test/Test_Cluster/RunTest.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/Test_Cluster/RunTest.sh b/test/Test_Cluster/RunTest.sh index 359a92bacf..f51954e2ef 100755 --- a/test/Test_Cluster/RunTest.sh +++ b/test/Test_Cluster/RunTest.sh @@ -7,7 +7,7 @@ CleanFiles cluster.in cnumvtime.dat avg.summary.dat summary.dat CpptrajPairDist \ cpop.agr summary2.dat Cmatrix.nccmatrix Cmatrix.cmatrix summary3.dat \ normpop.agr normframe.agr cascii.dat.save cascii.dat pw.out \ - cinfo.dat + cinfo.dat mysil.cluster.dat mysil.frame.dat TESTNAME='Hierarchical agglomerative clustering tests' Requires netcdf @@ -17,15 +17,18 @@ cat > cluster.in < cluster.in < cluster.in < cluster.in < Date: Tue, 12 Feb 2019 14:08:12 -0500 Subject: [PATCH 133/417] DRR - Cpptraj: Fix reading and writing of ascii pairwise cache --- src/DataIO_Cmatrix_NC.cpp | 8 +---- src/DataIO_Std.cpp | 52 +++++++++++++------------------ src/DataSet.h | 5 ++- src/DataSet_PairwiseCache.cpp | 30 ++++++++++++++++-- src/DataSet_PairwiseCache.h | 8 +++-- src/DataSet_PairwiseCache_MEM.cpp | 15 --------- src/DataSet_PairwiseCache_MEM.h | 7 ++--- src/DataSet_PairwiseCache_NC.cpp | 15 --------- src/DataSet_PairwiseCache_NC.h | 7 +++-- src/cpptrajdepend | 2 +- 10 files changed, 67 insertions(+), 82 deletions(-) diff --git a/src/DataIO_Cmatrix_NC.cpp b/src/DataIO_Cmatrix_NC.cpp index 03fc85c8f3..ee86205d5c 100644 --- a/src/DataIO_Cmatrix_NC.cpp +++ b/src/DataIO_Cmatrix_NC.cpp @@ -45,13 +45,7 @@ int DataIO_Cmatrix_NC::WriteData(FileName const& fname, DataSetList const& SetLi if (file_.WriteCmatrix( Mat.Ptr() )) return 1; // Write present frames if (Mat.SieveVal() != 1) { - Cpptraj::Cluster::Cframes presentFrames; - presentFrames.reserve( Mat.Nrows() ); - for (Cpptraj::Cluster::Cframes::const_iterator it = Mat.FrameToIdx().begin(); - it != Mat.FrameToIdx().end(); ++it) - if (*it != -1) - presentFrames.push_back( *it ); - if (file_.WriteFramesArray( presentFrames )) return 1; + if (file_.WriteFramesArray( Mat.PresentFrames() )) return 1; } file_.CloseCmatrix(); diff --git a/src/DataIO_Std.cpp b/src/DataIO_Std.cpp index 4c5e554543..c4bcdaa15d 100644 --- a/src/DataIO_Std.cpp +++ b/src/DataIO_Std.cpp @@ -13,6 +13,7 @@ #include "DataSet_string.h" // For reading TODO remove dependency? #include "DataSet_Vector.h" // For reading TODO remove dependency? #include "DataSet_Mat3x3.h" // For reading TODO remove dependency? +#include "DataSet_PairwiseCache_MEM.h" // For reading #include "DataSet_2D.h" #include "DataSet_3D.h" @@ -302,14 +303,10 @@ int DataIO_Std::Read_1D(std::string const& fname, int DataIO_Std::ReadCmatrix(FileName const& fname, DataSetList& datasetlist, std::string const& dsname) { - mprinterr("Internal Error: ReadCmatrix() must be reimplemented!\n"); - // TODO re-implement - return 1; -/* // Allocate output data set - DataSet* ds = datasetlist.AddSet( DataSet::CMATRIX, dsname ); + DataSet* ds = datasetlist.AddSet( DataSet::PMATRIX_MEM, dsname ); if (ds == 0) return 1; - DataSet_Cmatrix_MEM& Mat = static_cast( *ds ); + DataSet_PairwiseCache_MEM& Mat = static_cast( *ds ); // Buffer file BufferedLine buffer; if (buffer.OpenFileRead( fname )) return 1; @@ -319,9 +316,9 @@ int DataIO_Std::ReadCmatrix(FileName const& fname, header.SetList(ptr+1, SEPARATORS ); int nframes = header.getKeyInt("nframes", -1); // Need to keep track of frame indices so we can check for sieving. - std::vector sieveStatus; + DataSet_PairwiseCache::StatusArray sieveStatus; if (nframes > 0) - sieveStatus.assign(nframes, 'T'); + sieveStatus.assign(nframes, DataSet_PairwiseCache::ABSENT_); // Keep track of matrix values. std::vector Vals; // Read file @@ -333,16 +330,16 @@ int DataIO_Std::ReadCmatrix(FileName const& fname, if (checkSieve) { sscanf(ptr, "%i %i %f", &f1, &f2, &val); if (f2 > (int)sieveStatus.size()) - sieveStatus.resize(f2, 'T'); + sieveStatus.resize(f2, DataSet_PairwiseCache::ABSENT_); if (firstf1 == -1) { // First values. - sieveStatus[f1-1] = 'F'; - sieveStatus[f2-1] = 'F'; + sieveStatus[f1-1] = DataSet_PairwiseCache::PRESENT_; + sieveStatus[f2-1] = DataSet_PairwiseCache::PRESENT_; firstf1 = f1; } else if (f1 > firstf1) { checkSieve = false; } else { - sieveStatus[f2-1] = 'F'; + sieveStatus[f2-1] = DataSet_PairwiseCache::PRESENT_; } } else { sscanf(ptr, "%*i %*i %f", &val); @@ -350,16 +347,16 @@ int DataIO_Std::ReadCmatrix(FileName const& fname, Vals.push_back( val ); } // DEBUG - //mprintf("Sieved array:\n"); - //for (unsigned int i = 0; i < sieveStatus.size(); i++) - // mprintf("\t%6u %c\n", i+1, sieveStatus[i]); + mprintf("Sieved array:\n"); + for (unsigned int i = 0; i < sieveStatus.size(); i++) + mprintf("\t%6u %c\n", i+1, sieveStatus[i]); // Try to determine if sieve is random or not. int sieveDelta = 1; f1 = -1; f2 = -1; int actual_nrows = 0; for (int i = 0; i < (int)sieveStatus.size(); i++) { - if (sieveStatus[i] == 'F') { + if (sieveStatus[i] == DataSet_PairwiseCache::PRESENT_) { actual_nrows++; if (sieveDelta != -2) { if (f1 == -1) { @@ -399,10 +396,9 @@ int DataIO_Std::ReadCmatrix(FileName const& fname, // Save cluster matrix if (Mat.Allocate( DataSet::SizeArray(1, actual_nrows) )) return 1; std::copy( Vals.begin(), Vals.end(), Mat.Ptr() ); - Mat.SetSieveFromArray(sieveStatus, sieveDelta); + Mat.SetupFromStatus(sieveStatus, sieveDelta); return 0; -*/ } // DataIO_Std::Read_2D() @@ -878,7 +874,7 @@ int DataIO_Std::WriteData(FileName const& fname, DataSetList const& SetList) CpptrajFile file; if (file.OpenWrite( fname )) return 1; // Base write type off first data set dimension FIXME - if (SetList[0]->Group() == DataSet::CLUSTERMATRIX) { + if (SetList[0]->Group() == DataSet::PWCACHE) { // Special case of 2D - may have sieved frames. err = WriteCmatrix(file, SetList); } else if (SetList[0]->Ndim() == 1) { @@ -900,25 +896,22 @@ int DataIO_Std::WriteData(FileName const& fname, DataSetList const& SetList) // DataIO_Std::WriteCmatrix() int DataIO_Std::WriteCmatrix(CpptrajFile& file, DataSetList const& Sets) { - mprinterr("Internal Error: WriteCmatrix() must be reimplemented!\n"); - return 1; // TODO re-implement -/* for (DataSetList::const_iterator ds = Sets.begin(); ds != Sets.end(); ++ds) { - if ( (*ds)->Group() != DataSet::CLUSTERMATRIX) { + if ( (*ds)->Group() != DataSet::PWCACHE) { mprinterr("Error: Write of cluster matrix and other sets to same file not supported.\n" "Error: Skipping '%s'\n", (*ds)->legend()); continue; } - DataSet_Cmatrix const& cm = static_cast( *(*ds) ); - int nrows = cm.OriginalNframes(); + DataSet_PairwiseCache const& cm = static_cast( *(*ds) ); + int nrows = cm.Nrows(); int col_width = std::max(3, DigitWidth( nrows ) + 1); int dat_width = std::max(cm.Format().Width(), (int)cm.Meta().Legend().size()) + 1; WriteNameToBuffer(file, "F1", col_width, true); WriteNameToBuffer(file, "F2", col_width, false); WriteNameToBuffer(file, cm.Meta().Legend(), dat_width, false); - if (cm.SieveType() != ClusterSieve::NONE) - file.Printf(" nframes %i", cm.OriginalNframes()); + if (cm.SieveVal() != 1) + file.Printf(" nframes %i", nrows); file.Printf("\n"); TextFormat col_fmt(TextFormat::INTEGER, col_width); TextFormat dat_fmt = cm.Format(); @@ -926,18 +919,17 @@ int DataIO_Std::WriteCmatrix(CpptrajFile& file, DataSetList const& Sets) { dat_fmt.SetFormatWidth( dat_width ); std::string total_fmt = col_fmt.Fmt() + col_fmt.Fmt() + dat_fmt.Fmt() + "\n"; //mprintf("DEBUG: format '%s'\n", total_fmt.c_str()); - ClusterSieve::SievedFrames const& frames = cm.FramesToCluster(); + DataSet_PairwiseCache::Cframes frames = cm.PresentFrames(); int ntotal = (int)frames.size(); for (int idx1 = 0; idx1 != ntotal; idx1++) { int row = frames[idx1]; for (int idx2 = idx1 + 1; idx2 != ntotal; idx2++) { int col = frames[idx2]; - file.Printf(total_fmt.c_str(), row+1, col+1, cm.GetFdist(col, row)); + file.Printf(total_fmt.c_str(), row+1, col+1, cm.CachedDistance(idx1, idx2)); } } } return 0; -*/ } // DataIO_Std::WriteDataNormal() diff --git a/src/DataSet.h b/src/DataSet.h index 27a8a8ee84..8a09bbadc1 100644 --- a/src/DataSet.h +++ b/src/DataSet.h @@ -29,10 +29,9 @@ class DataSet { MAT3X3, TOPOLOGY, PH, PH_EXPL, PH_IMPL, PARAMETERS, PMATRIX_MEM, PMATRIX_NC }; - /// Group DataSet belongs to. TODO remove CLUSTERMATRIX + /// Group DataSet belongs to. enum DataGroup { - GENERIC=0, SCALAR_1D, MATRIX_2D, GRID_3D, COORDINATES, CLUSTERMATRIX, - PHREMD, PWCACHE + GENERIC=0, SCALAR_1D, MATRIX_2D, GRID_3D, COORDINATES, PHREMD, PWCACHE }; DataSet(); diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index f2f57964d5..f310856101 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -26,12 +26,12 @@ int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigne int idx = 0; for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) frameToIdx_[*it] = idx++; -# ifdef DEBUG_CLUSTER +//# ifdef DEBUG_CLUSTER // DEBUG mprintf("DEBUG: frameToMat\n"); for (Cframes_it it = frameToIdx_.begin(); it != frameToIdx_.end(); ++it) mprintf("\tframeToIdx_[%u] = %i\n", it - frameToIdx_.begin(), *it); -# endif +//# endif return 0; } @@ -64,3 +64,29 @@ int DataSet_PairwiseCache::SetupFromStatus(StatusArray const& frameIsPresent, in sieve_ = sieveIn; return 0; } + +/** \return Array containing frames present in the pairwise cache. */ +DataSet_PairwiseCache::Cframes DataSet_PairwiseCache::PresentFrames() const { + Cframes presentFrames; + presentFrames.reserve( Nrows() ); + int frm = 0; + for (frm = 0; frm != (int)frameToIdx_.size(); ++frm) + if (frameToIdx_[frm] != -1) + presentFrames.push_back( frm ); + return presentFrames; +} + +/** Print cached distances to stdout. */ +void DataSet_PairwiseCache::PrintCached() const { + for (Cframes::const_iterator it1 = FrameToIdx().begin(); it1 != FrameToIdx().end(); ++it1) + { + if (*it1 != -1) { + for (Cframes::const_iterator it2 = it1 + 1; it2 != FrameToIdx().end(); ++it2) + { + if (*it2 != -1) + mprintf("\t%zu %i %f\n", it1-FrameToIdx().begin()+1, it2-FrameToIdx().begin()+1, + CachedDistance(*it1, *it2)); + } + } + } +} diff --git a/src/DataSet_PairwiseCache.h b/src/DataSet_PairwiseCache.h index ab649a8d1d..71826b2a72 100644 --- a/src/DataSet_PairwiseCache.h +++ b/src/DataSet_PairwiseCache.h @@ -40,8 +40,8 @@ class DataSet_PairwiseCache : public DataSet { //virtual double GetFdist(int, int) const = 0; /// \return distance between cached frames (internal indices). virtual double CachedDistance(unsigned int, unsigned int) const = 0; - /// Print only cached distances. - virtual void PrintCached() const = 0; + /// \return Number of rows (i.e. number of frames cached) in pairwise cache. TODO DataSet_2D + virtual size_t Nrows() const = 0; /// Used to cache distances; expect internal indices, not absolute cluster frames. virtual void SetElement(int, int, double) = 0; /// Used to set up and allocate cache for total, frames to cache, sieve, and metric descrip. @@ -56,6 +56,10 @@ class DataSet_PairwiseCache : public DataSet { int SieveVal() const { return sieve_; } /// \return Internal metric description for bookkeeping std::string const& MetricDescrip() const { return metricDescription_; } + /// \return Array of frames present in the cache. + Cframes PresentFrames() const; + /// Print only cached distances. + void PrintCached() const; /// Used to set up frame indices from given status array. Record sieve value. int SetupFromStatus(StatusArray const&, int); diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp index 85d496b470..fa6c7c7f31 100644 --- a/src/DataSet_PairwiseCache_MEM.cpp +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -33,18 +33,3 @@ int DataSet_PairwiseCache_MEM::SetupCache(unsigned int Ntotal, Cframes const& fr SetMetricDescrip( metricDescription ); return SetupFrameToIdx(framesToCache, Ntotal); } - - -/** Print cached distances to stdout. */ -void DataSet_PairwiseCache_MEM::PrintCached() const { - for (Cframes::const_iterator it1 = FrameToIdx().begin(); it1 != FrameToIdx().end(); ++it1) - { - if (*it1 != -1) { - for (Cframes::const_iterator it2 = it1 + 1; it2 != FrameToIdx().end(); ++it2) - { - if (*it2 != -1) - mprintf("\t%i %i %f\n", *it1+1, *it2+1, Mat_.element(*it1, *it2)); - } - } - } -} diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index 97a8707176..febe6aa779 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -17,16 +17,15 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { //# ifdef MPI // int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } //# endif - // ------------------------------------------- - size_t Nrows() const { return Mat_.Nrows(); } // ------------------------------------------- //double GetFdist(int f1, int f2) const { return Mat_.element(FrameToMat()[f1], FrameToMat()[f2]); } //double Frame_Distance(int, int) const; - int SetupCache(unsigned int, Cframes const&, int, std::string const&); + // ----- PairwiseCache functions ------------- double CachedDistance(unsigned int i1, unsigned int i2) const { return Mat_.element(i1, i2); } //int CacheDistances(Cframes const&); - void PrintCached() const; + size_t Nrows() const { return Mat_.Nrows(); } void SetElement(int col, int row, double val) { Mat_.setElement(col, row, val); } + int SetupCache(unsigned int, Cframes const&, int, std::string const&); // ------------------------------------------- float* Ptr() { return Mat_.Ptr(); } float const* Ptr() const { return Mat_.Ptr(); } diff --git a/src/DataSet_PairwiseCache_NC.cpp b/src/DataSet_PairwiseCache_NC.cpp index e33473d451..fdbfc9a550 100644 --- a/src/DataSet_PairwiseCache_NC.cpp +++ b/src/DataSet_PairwiseCache_NC.cpp @@ -28,18 +28,3 @@ int DataSet_PairwiseCache_NC::SetupCache(unsigned int Ntotal, Cframes const& fra return SetupFrameToIdx(framesToCache, Ntotal); } - - -/** Print cached distances to stdout. */ -void DataSet_PairwiseCache_NC::PrintCached() const { - for (Cframes::const_iterator it1 = FrameToIdx().begin(); it1 != FrameToIdx().end(); ++it1) - { - if (*it1 != -1) { - for (Cframes::const_iterator it2 = it1 + 1; it2 != FrameToIdx().end(); ++it2) - { - if (*it2 != -1) - mprintf("\t%i %i %f\n", *it1+1, *it2+1, file_.GetCmatrixElement(*it1, *it2)); - } - } - } -} diff --git a/src/DataSet_PairwiseCache_NC.h b/src/DataSet_PairwiseCache_NC.h index 9afa46ad28..77f5687429 100644 --- a/src/DataSet_PairwiseCache_NC.h +++ b/src/DataSet_PairwiseCache_NC.h @@ -17,13 +17,14 @@ class DataSet_PairwiseCache_NC : public DataSet_PairwiseCache { //# ifdef MPI // int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } //# endif - // ------------------------------------------- - int SetupCache(unsigned int, Cframes const&, int, std::string const&); + // ----- PairwiseCache functions ------------- double CachedDistance(unsigned int i1, unsigned int i2) const { return file_.GetCmatrixElement(i1, i2); } - void PrintCached() const; + size_t Nrows() const { return file_.MatrixRows(); } void SetElement(int x, int y, double val) { file_.WriteCmatrixElement(x, y, val); } + int SetupCache(unsigned int, Cframes const&, int, std::string const&); + // ------------------------------------------- private: Cpptraj::Cluster::Cmatrix_NC file_; ///< Hold cached distances on disk }; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 5456a15bac..be1d81ebca 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -189,7 +189,7 @@ DataIO_Grace.o : DataIO_Grace.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h DataIO_Mdout.o : DataIO_Mdout.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Mdout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_OpenDx.o : DataIO_OpenDx.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_OpenDx.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_RemLog.o : DataIO_RemLog.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_RemLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -DataIO_Std.o : DataIO_Std.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Std.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mat3x3.h DataSet_Vector.h DataSet_double.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +DataIO_Std.o : DataIO_Std.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/Cframes.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Std.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mat3x3.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_Vector.h DataSet_double.h DataSet_string.h Dimension.h FileIO.h FileName.h Frame.h GridBin.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_VecTraj.o : DataIO_VecTraj.cpp ActionFrameCounter.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h BondSearch.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_VecTraj.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.h Dimension.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h ParmFile.h ParmIO.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajectoryFile.h TrajectoryIO.h Trajout_Single.h Vec3.h DataIO_XVG.o : DataIO_XVG.cpp ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_XVG.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.h Dimension.h FileIO.h FileName.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h DataIO_Xplor.o : DataIO_Xplor.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h BufferedLine.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Xplor.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterTypes.h ProgressBar.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h From 55cba1a15ad659a907ce260a2563edec663fbdfd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 12 Feb 2019 15:29:27 -0500 Subject: [PATCH 134/417] DRR - Cpptraj: Add code to use frames to cluster from an existing pairwise cache if not otherwise specified. --- src/Cluster/Control.cpp | 33 +++++++++++++++++++++++++++++++-- src/Cluster/Control.h | 14 +++++++++----- src/Cluster/Sieve.cpp | 19 +++++++++++++++++++ src/Cluster/Sieve.h | 2 ++ src/DataIO_Std.cpp | 1 + 5 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index be810be1a7..b96c3c9926 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -13,6 +13,7 @@ Cpptraj::Cluster::Control::Control() : metric_(0), algorithm_(0), verbose_(0), + frameSelect_(UNSPECIFIED), sieve_(1), sieveSeed_(-1), sieveRestore_(NO_RESTORE), @@ -372,6 +373,10 @@ void Cpptraj::Cluster::Control::Info() const { if (algorithm_ != 0) algorithm_->Info(); } +/** Figure out which frames to cluster, cache distances if necessary, then + * perform clustering. Afterwards sieved frames will be added in if necessary + * and representative frames will be determined. + */ int Cpptraj::Cluster::Control::Run() { if (metric_ == 0 || algorithm_ == 0) { // TODO check pmatrix_? mprinterr("Internal Error: Cluster::Control is not set up.\n"); @@ -389,7 +394,31 @@ int Cpptraj::Cluster::Control::Run() { // Figure out which frames to cluster frameSieve_.Clear(); - frameSieve_.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); + if (frameSelect_ == UNSPECIFIED) { + if (sieve_ != 1) + frameSelect_ = SIEVE; + else if (pmatrix_.HasCache() && pmatrix_.Cache().Size() > 0) + frameSelect_ = FROM_CACHE; + else + frameSelect_ = ALL; + } + int frameSelectErr = 1; + switch ( frameSelect_ ) { + case ALL : + case SIEVE : + frameSelectErr = frameSieve_.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); + break; + case FROM_CACHE : + mprintf("\tClustering frames present in pairwise cache '%s'\n", pmatrix_.Cache().legend()); + frameSelectErr = frameSieve_.SetupFromCache( pmatrix_.Cache() ); + break; + default : + mprinterr("Internal Error: Cluster::Control::Run(): Unhandled frame selection type.\n"); + } + if (frameSelectErr != 0) { + mprinterr("Error: Cluster frame selection failed.\n"); + return 1; + } if (verbose_ >= 0) { if (frameSieve_.FramesToCluster().size() < metric_->Ntotal()) mprintf("\tClustering %zu of %u points.\n", frameSieve_.FramesToCluster().size(), @@ -482,7 +511,7 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { if (outfile.OpenWrite( clusterinfo_ )) return 1; timer_output_info_.Start(); Output::PrintClustersToFile(outfile, clusters_, *algorithm_, metric_, - frameSieve_.SieveValue(), frameSieve_.SievedOut()); + frameSieve_.SieveValue(), frameSieve_.FramesToCluster()); timer_output_info_.Stop(); outfile.CloseFile(); } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 7720f837e6..04793689b4 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -23,7 +23,10 @@ class Control { static const char* PairwiseArgs; static const char* AlgorithmArgs; + /// For determining how any sieved frames should be restored. enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; + /// For determining how frames to cluster will be determined. + enum FrameSelectType { UNSPECIFIED = 0, ALL, SIEVE, FROM_CACHE }; int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, DataSetList&, DataFileList&, int); @@ -61,11 +64,12 @@ class Control { std::string dsname_; ///< Name for output data sets. int verbose_; - int sieve_; ///< Sieve value - int sieveSeed_; ///< Seed if doing random sieve - SieveRestoreType sieveRestore_; ///< Specify if/how sieved frames should be restored. - double restoreEpsilon_; ///< Cutoff to use if restoring by epsilon to centroids. - bool includeSieveInCalc_; ///< If true include sieved frames in later calculations. + FrameSelectType frameSelect_; ///< How frames to cluster should be determined. + int sieve_; ///< Sieve value + int sieveSeed_; ///< Seed if doing random sieve + SieveRestoreType sieveRestore_; ///< Specify if/how sieved frames should be restored. + double restoreEpsilon_; ///< Cutoff to use if restoring by epsilon to centroids. + bool includeSieveInCalc_; ///< If true include sieved frames in later calculations. BestReps::RepMethodType bestRep_; ///< How to determine best rep frames. int nRepsToSave_; ///< How many rep frames to save. diff --git a/src/Cluster/Sieve.cpp b/src/Cluster/Sieve.cpp index 05f746ed85..557e694f6e 100644 --- a/src/Cluster/Sieve.cpp +++ b/src/Cluster/Sieve.cpp @@ -78,3 +78,22 @@ int Cpptraj::Cluster::Sieve::SetFramesToCluster(int sieveIn, std::size_t maxFram // MakeIdxToFrame(); return 0; } + +/** Set frames to cluster and sieved out frames from pairwise cache. */ +int Cpptraj::Cluster::Sieve::SetupFromCache(DataSet_PairwiseCache const& cache) { + if (cache.Size() < 1) { + //mprinterr("Error: Cannot setup frames to cluster from empty cache.\n"); + return 1; + } + framesToCluster_.clear(); + sievedOut_.clear(); + DetermineTypeFromSieve( cache.SieveVal() ); + for (int frm = 0; frm != (int)cache.FrameToIdx().size(); frm++) + { + if (cache.FrameToIdx()[frm] == -1) + sievedOut_.push_back( frm ); + else + framesToCluster_.push_back( frm ); + } + return 0; +} diff --git a/src/Cluster/Sieve.h b/src/Cluster/Sieve.h index 185d73a2fc..6b91b89f61 100644 --- a/src/Cluster/Sieve.h +++ b/src/Cluster/Sieve.h @@ -1,6 +1,7 @@ #ifndef INC_CLUSTER_SIEVE_H #define INC_CLUSTER_SIEVE_H #include "Cframes.h" +#include "../DataSet_PairwiseCache.h" namespace Cpptraj { namespace Cluster { @@ -12,6 +13,7 @@ class Sieve { Sieve() : type_(NONE), sieve_(1) {} int SetFramesToCluster(int, std::size_t, int); + int SetupFromCache( DataSet_PairwiseCache const& ); void Clear() { framesToCluster_.clear(); sievedOut_.clear(); type_ = NONE; sieve_ = 1; } Cframes const& FramesToCluster() const { return framesToCluster_; } diff --git a/src/DataIO_Std.cpp b/src/DataIO_Std.cpp index c4bcdaa15d..c95905ba94 100644 --- a/src/DataIO_Std.cpp +++ b/src/DataIO_Std.cpp @@ -396,6 +396,7 @@ int DataIO_Std::ReadCmatrix(FileName const& fname, // Save cluster matrix if (Mat.Allocate( DataSet::SizeArray(1, actual_nrows) )) return 1; std::copy( Vals.begin(), Vals.end(), Mat.Ptr() ); + // TODO may need to pass in actual sieve here Mat.SetupFromStatus(sieveStatus, sieveDelta); return 0; From fcb55f5c407195164ca53e646ebb3fa5e68b88cb Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 13 Feb 2019 11:41:26 -0500 Subject: [PATCH 135/417] DRR - Cpptraj: Need to know total # of frames when setting up from cache. --- src/Cluster/Sieve.cpp | 10 ++++++++-- src/Cluster/Sieve.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Cluster/Sieve.cpp b/src/Cluster/Sieve.cpp index 557e694f6e..4263907ce9 100644 --- a/src/Cluster/Sieve.cpp +++ b/src/Cluster/Sieve.cpp @@ -80,7 +80,9 @@ int Cpptraj::Cluster::Sieve::SetFramesToCluster(int sieveIn, std::size_t maxFram } /** Set frames to cluster and sieved out frames from pairwise cache. */ -int Cpptraj::Cluster::Sieve::SetupFromCache(DataSet_PairwiseCache const& cache) { +int Cpptraj::Cluster::Sieve::SetupFromCache(DataSet_PairwiseCache const& cache, + std::size_t maxFrames) +{ if (cache.Size() < 1) { //mprinterr("Error: Cannot setup frames to cluster from empty cache.\n"); return 1; @@ -88,12 +90,16 @@ int Cpptraj::Cluster::Sieve::SetupFromCache(DataSet_PairwiseCache const& cache) framesToCluster_.clear(); sievedOut_.clear(); DetermineTypeFromSieve( cache.SieveVal() ); - for (int frm = 0; frm != (int)cache.FrameToIdx().size(); frm++) + unsigned int frm = 0; + for (; frm != cache.FrameToIdx().size(); frm++) { if (cache.FrameToIdx()[frm] == -1) sievedOut_.push_back( frm ); else framesToCluster_.push_back( frm ); } + // Anything left is consiedered sieved out. + for (; frm < maxFrames; frm++) + sievedOut_.push_back( frm ); return 0; } diff --git a/src/Cluster/Sieve.h b/src/Cluster/Sieve.h index 6b91b89f61..fb98fb3aab 100644 --- a/src/Cluster/Sieve.h +++ b/src/Cluster/Sieve.h @@ -13,7 +13,7 @@ class Sieve { Sieve() : type_(NONE), sieve_(1) {} int SetFramesToCluster(int, std::size_t, int); - int SetupFromCache( DataSet_PairwiseCache const& ); + int SetupFromCache( DataSet_PairwiseCache const&, std::size_t ); void Clear() { framesToCluster_.clear(); sievedOut_.clear(); type_ = NONE; sieve_ = 1; } Cframes const& FramesToCluster() const { return framesToCluster_; } From 51788f03147d9f2e57ab4d750a3bcfb99b519f3a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 13 Feb 2019 11:41:54 -0500 Subject: [PATCH 136/417] DRR - Cpptraj: Add code TODO --- src/Cluster/PairwiseMatrix.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 2cc5d299ef..a37d3a4e53 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -40,6 +40,7 @@ int Cpptraj::Cluster::PairwiseMatrix::setupFrameToMat(Cframes const& framesToCac double Cpptraj::Cluster::PairwiseMatrix::Frame_Distance(int f1, int f2) const { if (cache_ != 0) { + // TODO protect against f1/f2 out of bounds. int idx1 = cache_->FrameToIdx()[f1]; if (idx1 != -1) { int idx2 = cache_->FrameToIdx()[f2]; From 7dce141adbf9db319657b46bf205d881d3fedf05 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 13 Feb 2019 20:57:54 -0500 Subject: [PATCH 137/417] DRR - Cpptraj: Write info files --- test/Test_Cluster/RunTest.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/Test_Cluster/RunTest.sh b/test/Test_Cluster/RunTest.sh index f51954e2ef..46ecc1ae9d 100755 --- a/test/Test_Cluster/RunTest.sh +++ b/test/Test_Cluster/RunTest.sh @@ -7,7 +7,7 @@ CleanFiles cluster.in cnumvtime.dat avg.summary.dat summary.dat CpptrajPairDist \ cpop.agr summary2.dat Cmatrix.nccmatrix Cmatrix.cmatrix summary3.dat \ normpop.agr normframe.agr cascii.dat.save cascii.dat pw.out \ - cinfo.dat mysil.cluster.dat mysil.frame.dat + cinfo.dat mysil.cluster.dat mysil.frame.dat cascii?.info TESTNAME='Hierarchical agglomerative clustering tests' Requires netcdf @@ -62,13 +62,14 @@ cat > cluster.in < cluster.in < Date: Wed, 13 Feb 2019 20:58:17 -0500 Subject: [PATCH 138/417] DRR - Cpptraj: Fix behavior of sieve restore when using existing pairwise cache. --- src/Cluster/Control.cpp | 46 ++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index b96c3c9926..ef30656b21 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -270,7 +270,7 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da { clusters_.SetDebug( verbose_ ); - // Allocate PairwiseMatrix. Metric must already be set up. + // Allocate PairwiseMatrix (and optionally a cache). Metric must already be set up. if (AllocatePairwise( analyzeArgs, DSL, DFL )) { mprinterr("Error: PairwiseMatrix setup failed.\n"); return 1; @@ -292,8 +292,32 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da } if (analyzeArgs.hasKey("random") && sieve_ > 1) sieve_ = -sieve_; // negative # indicates random sieve - // Choose sieve restore option based on algorithm. - if (sieve_ != 1) { + + // TODO incorporate with cumulative_nosieve? Or keep granular? + includeSieveInCalc_ = analyzeArgs.hasKey("includesieveincalc"); + if (includeSieveInCalc_) + mprintf("Warning: 'includesieveincalc' may be very slow.\n"); + + // Determine how frames to cluster will be chosen + if (frameSelect_ == UNSPECIFIED) { + if (sieve_ != 1) + frameSelect_ = SIEVE; + else if (pmatrix_.HasCache() && pmatrix_.Cache().Size() > 0) + frameSelect_ = FROM_CACHE; + else + frameSelect_ = ALL; + } + + bool allFramesCached; + if (sieve_ != 1 || (frameSelect_ == FROM_CACHE && pmatrix_.Cache().SieveVal() != 1)) + allFramesCached = false; + else + allFramesCached = true; + // TODO just determine if # frames to cluster == total frames? + + // Choose sieve restore option based on algorithm and frames to cluster. + if (!allFramesCached) + { sieveRestore_ = CLOSEST_CENTROID; if (algorithm_->Type() == Algorithm::DBSCAN) { if (!analyzeArgs.hasKey("sievetoframe")) @@ -303,16 +327,12 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da restoreEpsilon_ = ((Algorithm_DBscan*)algorithm_)->Epsilon(); } } - // TODO incorporate with cumulative_nosieve? Or keep granular? - includeSieveInCalc_ = analyzeArgs.hasKey("includesieveincalc"); - if (includeSieveInCalc_) - mprintf("Warning: 'includesieveincalc' may be very slow.\n"); // Best rep options std::string bestRepStr = analyzeArgs.GetStringKey("bestrep"); if (bestRepStr.empty()) { // For sieving, cumulative can get very expensive. Default to centroid. - if (sieve_ != 1) + if (!allFramesCached) bestRep_ = BestReps::CENTROID; else bestRep_ = BestReps::CUMULATIVE; @@ -394,14 +414,6 @@ int Cpptraj::Cluster::Control::Run() { // Figure out which frames to cluster frameSieve_.Clear(); - if (frameSelect_ == UNSPECIFIED) { - if (sieve_ != 1) - frameSelect_ = SIEVE; - else if (pmatrix_.HasCache() && pmatrix_.Cache().Size() > 0) - frameSelect_ = FROM_CACHE; - else - frameSelect_ = ALL; - } int frameSelectErr = 1; switch ( frameSelect_ ) { case ALL : @@ -410,7 +422,7 @@ int Cpptraj::Cluster::Control::Run() { break; case FROM_CACHE : mprintf("\tClustering frames present in pairwise cache '%s'\n", pmatrix_.Cache().legend()); - frameSelectErr = frameSieve_.SetupFromCache( pmatrix_.Cache() ); + frameSelectErr = frameSieve_.SetupFromCache( pmatrix_.Cache(), metric_->Ntotal() ); break; default : mprinterr("Internal Error: Cluster::Control::Run(): Unhandled frame selection type.\n"); From 883b3c1b2f953e389c80b4a4d48ca20726c11864 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 13:43:48 -0500 Subject: [PATCH 139/417] DRR - Cpptraj: Simplify frame selection cases --- src/Cluster/Control.cpp | 15 ++++++++------- src/Cluster/Control.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index ef30656b21..6f690fca28 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -300,19 +300,21 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da // Determine how frames to cluster will be chosen if (frameSelect_ == UNSPECIFIED) { - if (sieve_ != 1) - frameSelect_ = SIEVE; - else if (pmatrix_.HasCache() && pmatrix_.Cache().Size() > 0) + // If no other frame selection option like sieve provided and an already + // set up cache is present, use the cached frames. + if (sieve_ == 1 && pmatrix_.HasCache() && pmatrix_.Cache().Size() > 0) frameSelect_ = FROM_CACHE; - else - frameSelect_ = ALL; } + // Determine if all frames will be cached or not. If not, certain + // calculations get very expensive - we may only want to do them + // on cached frames. bool allFramesCached; if (sieve_ != 1 || (frameSelect_ == FROM_CACHE && pmatrix_.Cache().SieveVal() != 1)) allFramesCached = false; else allFramesCached = true; + // TODO handle no-cache situation // TODO just determine if # frames to cluster == total frames? // Choose sieve restore option based on algorithm and frames to cluster. @@ -416,8 +418,7 @@ int Cpptraj::Cluster::Control::Run() { frameSieve_.Clear(); int frameSelectErr = 1; switch ( frameSelect_ ) { - case ALL : - case SIEVE : + case UNSPECIFIED: frameSelectErr = frameSieve_.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); break; case FROM_CACHE : diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 04793689b4..eb54ad3c9f 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -26,7 +26,7 @@ class Control { /// For determining how any sieved frames should be restored. enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; /// For determining how frames to cluster will be determined. - enum FrameSelectType { UNSPECIFIED = 0, ALL, SIEVE, FROM_CACHE }; + enum FrameSelectType { UNSPECIFIED = 0, FROM_CACHE }; int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, DataSetList&, DataFileList&, int); From ab9746e730c974d8bcdb7d240de87408bae6da7c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:00:03 -0500 Subject: [PATCH 140/417] DRR - Cpptraj: Simplify choices based on sieve value --- src/Cluster/Control.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 6f690fca28..b0c7aa4d35 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -303,22 +303,18 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da // If no other frame selection option like sieve provided and an already // set up cache is present, use the cached frames. if (sieve_ == 1 && pmatrix_.HasCache() && pmatrix_.Cache().Size() > 0) + { frameSelect_ = FROM_CACHE; + if (pmatrix_.Cache().SieveVal() != 1) { + sieve_ = pmatrix_.Cache().SieveVal(); + mprintf("Warning: No sieve specified; using sieve value from cache '%s': %i\n", + pmatrix_.Cache().legend(), sieve_); + } + } } - // Determine if all frames will be cached or not. If not, certain - // calculations get very expensive - we may only want to do them - // on cached frames. - bool allFramesCached; - if (sieve_ != 1 || (frameSelect_ == FROM_CACHE && pmatrix_.Cache().SieveVal() != 1)) - allFramesCached = false; - else - allFramesCached = true; - // TODO handle no-cache situation - // TODO just determine if # frames to cluster == total frames? - // Choose sieve restore option based on algorithm and frames to cluster. - if (!allFramesCached) + if (sieve_ != 1) { sieveRestore_ = CLOSEST_CENTROID; if (algorithm_->Type() == Algorithm::DBSCAN) { @@ -334,7 +330,7 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da std::string bestRepStr = analyzeArgs.GetStringKey("bestrep"); if (bestRepStr.empty()) { // For sieving, cumulative can get very expensive. Default to centroid. - if (!allFramesCached) + if (sieve_ != 1) bestRep_ = BestReps::CENTROID; else bestRep_ = BestReps::CUMULATIVE; From 86a0456a22be7c0bc18006485f4fcc1d1b036cdb Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:02:04 -0500 Subject: [PATCH 141/417] DRR - Cpptraj: Compare info files as well. --- test/Test_Cluster/RunTest.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Test_Cluster/RunTest.sh b/test/Test_Cluster/RunTest.sh index 46ecc1ae9d..3a24991369 100755 --- a/test/Test_Cluster/RunTest.sh +++ b/test/Test_Cluster/RunTest.sh @@ -73,6 +73,7 @@ cluster C1 :2-10 clusters 3 epsilon 4.0 out cascii.dat nofit loadpairdist pairdi EOF RunCpptraj "Cluster command test, read ASCII pairwise distances." DoTest cascii.dat.save cascii.dat +DoTest cascii1.info cascii2.info EndTest From 32ca557120a53b72b7c8dd04275ed42cb757316a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:13:55 -0500 Subject: [PATCH 142/417] DRR - Cpptraj: Add some help text --- src/Cluster/Control.cpp | 18 ++++++++++++++---- src/Cluster/Control.h | 6 ++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index b0c7aa4d35..02cc554f97 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -44,8 +44,8 @@ DataFile::DataFormatType Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_TYPE_ = DataFile::CMATRIX_BINARY; # endif -const char* Cpptraj::Cluster::Control::PairwiseArgs = - "pairwisecache {mem|disk|none}"; +const char* Cpptraj::Cluster::Control::PairwiseArgs_ = + "[pairdist ] [loadpairdist] [savepairdist] [pairwisecache {mem|disk|none}]"; /** Set up PairwiseMatrix from arguments. */ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetList& DSL, @@ -181,8 +181,8 @@ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algori return alg; } -const char* Cpptraj::Cluster::Control::AlgorithmArgs = - "{hieragglo|dbscan|kmeans|dpeaks"; +const char* Cpptraj::Cluster::Control::AlgorithmArgs_ = + "{hieragglo|dbscan|kmeans|dpeaks}"; /** Set up Algorithm from keyword + arguments. */ int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { @@ -215,6 +215,9 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type return met; } +const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = + "{dme|rms|srmsd} [mass] [nofit]"; + /** Set up clustering for a COORDS DataSet.*/ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, std::string const& maskExpr, @@ -265,6 +268,13 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, } // ----------------------------------------------------------------------------- +const char* Cpptraj::Cluster::Control::CommonArgs_ = + "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [sievetoframe]] " + "[bestrep {cumulative|centroid|cumulative_nosieve} [savenreps <#>]] " + "[noinfo|info ] [summary ] [sil ] " + "[cpopvtime [{normpop|normframe}]] " + "[out ] [] "; + /** Common setup. */ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) { diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index eb54ad3c9f..204705c165 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -20,8 +20,10 @@ class Control { Control(); ~Control(); - static const char* PairwiseArgs; - static const char* AlgorithmArgs; + static const char* PairwiseArgs_; + static const char* AlgorithmArgs_; + static const char* CoordsDataSetArgs_; + static const char* CommonArgs_; /// For determining how any sieved frames should be restored. enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; From 9c646fb177d0c4451edd5babf50e49dc61a545fd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:21:11 -0500 Subject: [PATCH 143/417] DRR - Cpptraj: Get mask string inside Control --- src/Analysis_Cluster.cpp | 15 +-------------- src/Cluster/Control.cpp | 13 +++++++++++-- src/Cluster/Control.h | 3 +-- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 76ccc69a5b..d3e3eb7816 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -20,20 +20,7 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s return Analysis::ERR; } - // Get the mask string - std::string maskexpr = analyzeArgs.GetMaskNext(); - /*if (!refs_.empty() && refmaskexpr_.empty()) { - refmaskexpr_ = maskexpr_; - if (refmaskexpr_.empty()) { - refmaskexpr_.assign("!@H="); - mprintf("Warning: 'assignrefs' specified but no 'refmask' given.\n" - "Warning: Using default mask expression: '%s'\n", refmaskexpr_.c_str()); - } - }*/ - - - if (control_.SetupForCoordsDataSet(coords_, maskexpr, analyzeArgs, - setup.DSL(), setup.DFL(), debugIn)) + if (control_.SetupForCoordsDataSet(coords_, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) return Analysis::ERR; control_.Info(); diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 02cc554f97..57eabc95bd 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -216,11 +216,10 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type } const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = - "{dme|rms|srmsd} [mass] [nofit]"; + "{dme|rms|srmsd} [mass] [nofit] []"; /** Set up clustering for a COORDS DataSet.*/ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, - std::string const& maskExpr, ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL, @@ -250,6 +249,16 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, // Metric setup. bool useMass = analyzeArgs.hasKey("mass"); bool nofit = analyzeArgs.hasKey("nofit"); + // Get the mask string + std::string maskExpr = analyzeArgs.GetMaskNext(); + /*if (!refs_.empty() && refmaskexpr_.empty()) { TODO enable + refmaskexpr_ = maskexpr_; + if (refmaskexpr_.empty()) { + refmaskexpr_.assign("!@H="); + mprintf("Warning: 'assignrefs' specified but no 'refmask' given.\n" + "Warning: Using default mask expression: '%s'\n", refmaskexpr_.c_str()); + } + }*/ int err = 0; switch (mtype) { diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 204705c165..f03440a460 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -30,8 +30,7 @@ class Control { /// For determining how frames to cluster will be determined. enum FrameSelectType { UNSPECIFIED = 0, FROM_CACHE }; - int SetupForCoordsDataSet(DataSet_Coords*, std::string const&, ArgList&, DataSetList&, - DataFileList&, int); + int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); /// Provide information on how clustering calculation is currently set up. void Info() const; /// Perform clustering. From 5fabda9e1e5646f913c56c1b8203f41b5d0f85f7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:37:13 -0500 Subject: [PATCH 144/417] DRR - Cpptraj: Start adding class for handling output specific to the type of data being clustered. --- src/Cluster/Results.h | 23 +++++++++++++++++++++++ src/Cluster/Results_Coords.cpp | 19 +++++++++++++++++++ src/Cluster/Results_Coords.h | 24 ++++++++++++++++++++++++ src/cpptrajdepend | 1 + src/cpptrajfiles | 1 + 5 files changed, 68 insertions(+) create mode 100644 src/Cluster/Results.h create mode 100644 src/Cluster/Results_Coords.cpp create mode 100644 src/Cluster/Results_Coords.h diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h new file mode 100644 index 0000000000..d2328dddf6 --- /dev/null +++ b/src/Cluster/Results.h @@ -0,0 +1,23 @@ +#ifndef INC_CLUSTER_RESULTS_H +#define INC_CLUSTER_RESULTS_H +#include "../ArgList.h" +namespace Cpptraj { +namespace Cluster { + +/// Abstract base class for handling results specific to input data type. +class Results { + public: + enum Type { COORDS = 0 }; + + Results(Type t) : type_(t) {} + virtual ~Results() {} + + virtual int GetOptions(ArgList&) = 0; + virtual int DoOutput() const = 0; + private: + Type type_; +}; + +} +} +#endif diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp new file mode 100644 index 0000000000..107fed6d3d --- /dev/null +++ b/src/Cluster/Results_Coords.cpp @@ -0,0 +1,19 @@ +#include "Results_Coords.h" + +/** The default output trajectory format. */ +const TrajectoryFile::TrajFormatType Cpptraj::Cluster::Results_Coords::DEF_TRAJ_FMT_ = + TrajectoryFile::AMBERTRAJ; + + +void Cpptraj::Cluster::Results_Coords::GetClusterTrajArgs(ArgList& argIn, + const char* trajKey, const char* fmtKey, + std::string& trajName, + TrajectoryFile::TrajFormatType& fmt) const +{ + trajName = argIn.GetStringKey( trajKey ); + fmt = TrajectoryFile::WriteFormatFromString( argIn.GetStringKey(fmtKey), fmt ); + // If file name specified but not format, try to guess from name + if (!trajName.empty() && fmt == TrajectoryFile::UNKNOWN_TRAJ) + fmt = TrajectoryFile::WriteFormatFromFname( trajName, DEF_TRAJ_FMT_ ); +} + diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h new file mode 100644 index 0000000000..78eef55213 --- /dev/null +++ b/src/Cluster/Results_Coords.h @@ -0,0 +1,24 @@ +#ifndef INC_CLUSTER_RESULTS_COORDS_H +#define INC_CLUSTER_RESULTS_COORDS_H +#include "Results.h" +#include "../TrajectoryFile.h" +namespace Cpptraj { +namespace Cluster { + +/// Class for handling cluster results specific to COORDS input data. +class Results_Coords : public Results { + public: + Results_Coords() : Results(COORDS) {} + // ----- Results functions ------------------- + int GetOptions(ArgList&); + int DoOutput() const; + private: + void GetClusterTrajArgs(ArgList&, const char*, const char*, std::string&, + TrajectoryFile::TrajFormatType&) const; + + static const TrajectoryFile::TrajFormatType DEF_TRAJ_FMT_; +}; + +} +} +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 658d5586fe..bcd0de656e 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -155,6 +155,7 @@ Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../As Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h +Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ArgList.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/Sieve.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index d6af0426fa..9b63814313 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -15,6 +15,7 @@ CLUSTER_SOURCES= \ Cluster/Node.cpp \ Cluster/Output.cpp \ Cluster/PairwiseMatrix.cpp \ + Cluster/Results_Coords.cpp \ Cluster/Sieve.cpp # These files are common to cpptraj/libcpptraj. Files that need to be built From 6de35c07fa5be18e95c52260bd842f525d7e9b63 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:39:40 -0500 Subject: [PATCH 145/417] DRR - Cpptraj: Process trajectory specific options. --- src/Cluster/Results_Coords.cpp | 9 +++++++++ src/Cluster/Results_Coords.h | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 107fed6d3d..cf6d27ac1a 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -17,3 +17,12 @@ void Cpptraj::Cluster::Results_Coords::GetClusterTrajArgs(ArgList& argIn, fmt = TrajectoryFile::WriteFormatFromFname( trajName, DEF_TRAJ_FMT_ ); } +int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs) { + writeRepFrameNum_ = analyzeArgs.hasKey("repframe"); + GetClusterTrajArgs(analyzeArgs, "clusterout", "clusterfmt", clusterfile_, clusterfmt_); + GetClusterTrajArgs(analyzeArgs, "singlerepout", "singlerepfmt", singlerepfile_, singlerepfmt_); + GetClusterTrajArgs(analyzeArgs, "repout", "repfmt", reptrajfile_, reptrajfmt_); + GetClusterTrajArgs(analyzeArgs, "avgout", "avgfmt", avgfile_, avgfmt_); + + return 0; +} diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index 78eef55213..f1cd25c263 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -17,6 +17,17 @@ class Results_Coords : public Results { TrajectoryFile::TrajFormatType&) const; static const TrajectoryFile::TrajFormatType DEF_TRAJ_FMT_; + + bool writeRepFrameNum_; ///< If true frame #s will be in rep file names. + TrajectoryFile::TrajFormatType clusterfmt_; ///< Cluster trajectory format. + TrajectoryFile::TrajFormatType singlerepfmt_; ///< Cluster all rep single trajectory format. + TrajectoryFile::TrajFormatType reptrajfmt_; ///< Cluster rep to separate trajectory format. + TrajectoryFile::TrajFormatType avgfmt_; ///< Cluster traj average structure file format. + std::string clusterfile_; ///< Cluster trajectory base filename. + std::string singlerepfile_; ///< Cluster all rep single trajectory filename. + std::string reptrajfile_; ///< Cluster rep to separate trajectory filename. + std::string avgfile_; ///< Cluster traj average structure filename. + }; } From 1b584bb1d9425609981a3827e613af8bd4a6a78c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:41:31 -0500 Subject: [PATCH 146/417] DRR - Cpptraj: Add results info. --- src/Cluster/Results.h | 1 + src/Cluster/Results_Coords.cpp | 20 ++++++++++++++++++++ src/Cluster/Results_Coords.h | 1 + src/cpptrajdepend | 2 +- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h index d2328dddf6..110d905a93 100644 --- a/src/Cluster/Results.h +++ b/src/Cluster/Results.h @@ -13,6 +13,7 @@ class Results { virtual ~Results() {} virtual int GetOptions(ArgList&) = 0; + virtual void Info() const = 0; virtual int DoOutput() const = 0; private: Type type_; diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index cf6d27ac1a..0b1c5a09e9 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -1,4 +1,5 @@ #include "Results_Coords.h" +#include "../CpptrajStdio.h" /** The default output trajectory format. */ const TrajectoryFile::TrajFormatType Cpptraj::Cluster::Results_Coords::DEF_TRAJ_FMT_ = @@ -26,3 +27,22 @@ int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs) { return 0; } + +void Cpptraj::Cluster::Results_Coords::Info() const { + if (!clusterfile_.empty()) + mprintf("\tCluster trajectories will be written to %s, format %s\n", + clusterfile_.c_str(), TrajectoryFile::FormatString(clusterfmt_)); + if (!singlerepfile_.empty()) + mprintf("\tCluster representatives will be written to 1 traj (%s), format %s\n", + singlerepfile_.c_str(), TrajectoryFile::FormatString(singlerepfmt_)); + if (!reptrajfile_.empty()) { + mprintf("\tCluster representatives will be written to separate trajectories,\n"); + mprintf("\t\tprefix (%s), format %s",reptrajfile_.c_str(), + TrajectoryFile::FormatString(reptrajfmt_)); + if (writeRepFrameNum_) mprintf(", with frame #s"); + mprintf("\n"); + } + if (!avgfile_.empty()) + mprintf("\tAverage structures for clusters will be written to %s, format %s\n", + avgfile_.c_str(), TrajectoryFile::FormatString(avgfmt_)); +} diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index f1cd25c263..77688d8e70 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -11,6 +11,7 @@ class Results_Coords : public Results { Results_Coords() : Results(COORDS) {} // ----- Results functions ------------------- int GetOptions(ArgList&); + void Info() const; int DoOutput() const; private: void GetClusterTrajArgs(ArgList&, const char*, const char*, std::string&, diff --git a/src/cpptrajdepend b/src/cpptrajdepend index bcd0de656e..ae9773e23b 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -155,7 +155,7 @@ Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../As Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h -Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ArgList.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Results.h Cluster/Results_Coords.h +Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ArgList.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/Sieve.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h From acaa15aae50ca2fd82cd10d80e65ed53e93b2757 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:49:20 -0500 Subject: [PATCH 147/417] DRR - Cpptraj: Add more to Info --- src/Cluster/Control.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 57eabc95bd..5d8b1a4f57 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -408,6 +408,43 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da void Cpptraj::Cluster::Control::Info() const { if (metric_ != 0) metric_->Info(); if (algorithm_ != 0) algorithm_->Info(); + + // TODO frameSelect + if (sieve_ > 1) + mprintf("\tInitial clustering sieve value is %i frames.\n", sieve_); + else if (sieve_ < -1) { + mprintf("\tInitial clustering will be randomly sieved (with value %i)", -sieve_); + if (sieveSeed_ > 0) mprintf(" using random seed %i", sieveSeed_); + mprintf(".\n"); + } + if (sieve_ != 1) { + if (includeSieveInCalc_) + mprintf("\tAll frames (including sieved) will be used to calc within-cluster average.\n"); + else + mprintf("\tOnly non-sieved frames will be used to calc within-cluster average.\n"); + } + if (sieveRestore_ != NO_RESTORE) { + mprintf("\tRestoring sieved frames"); + if (sieveRestore_ == CLOSEST_CENTROID) + mprintf(" by closest distance to centroid.\n"); + else if (sieveRestore_ == EPSILON_CENTROID) + mprintf(" if within epsilon %f of a centroid.\n", restoreEpsilon_); + else if (sieveRestore_ == EPSILON_FRAME) + mprintf(" if within epsilon %f of a frame.\n", restoreEpsilon_); + } + + mprintf("\tRepresentative frames will be chosen by"); + switch (bestRep_) { + case BestReps::CUMULATIVE: mprintf(" lowest cumulative distance to all other frames.\n"); break; + case BestReps::CENTROID : mprintf(" closest distance to cluster centroid.\n"); break; + case BestReps::CUMULATIVE_NOSIEVE: + mprintf(" lowest cumulative distance to all other frames (ignore sieved frames).\n"); + break; + default: // sanity check + mprintf("\n"); + } + if (nRepsToSave_ > 1) + mprintf("\tThe top %i representative frames will be determined.\n", nRepsToSave_); } /** Figure out which frames to cluster, cache distances if necessary, then From e83a79bf245f202cb563361ed1d1807af212ff39 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 14:50:52 -0500 Subject: [PATCH 148/417] DRR - Cpptraj: More info --- src/Cluster/Control.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 5d8b1a4f57..ab50c65627 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -445,6 +445,15 @@ void Cpptraj::Cluster::Control::Info() const { } if (nRepsToSave_ > 1) mprintf("\tThe top %i representative frames will be determined.\n", nRepsToSave_); + + if (!clusterinfo_.empty()) + mprintf("\tCluster information will be written to %s\n",clusterinfo_.c_str()); + if (!summaryfile_.empty()) + mprintf("\tSummary of cluster results will be written to %s\n",summaryfile_.c_str()); + if (!sil_file_.empty()) { + mprintf("\tFrame silhouettes will be written to %s.frame.dat, cluster silhouettes\n" + "\t will be written to %s.cluster.dat\n", sil_file_.c_str(), sil_file_.c_str()); + } /** Figure out which frames to cluster, cache distances if necessary, then From 79fcca030066069eae8a730adb60bfde85793ff6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 15:22:25 -0500 Subject: [PATCH 149/417] DRR - Cpptraj: Finish the cluster coords output --- src/Cluster/Control.cpp | 8 ++ src/Cluster/Results.h | 5 +- src/Cluster/Results_Coords.cpp | 192 +++++++++++++++++++++++++++++++++ src/Cluster/Results_Coords.h | 12 ++- src/cpptrajdepend | 2 +- 5 files changed, 214 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index ab50c65627..d2216756d0 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -453,6 +453,14 @@ void Cpptraj::Cluster::Control::Info() const { if (!sil_file_.empty()) { mprintf("\tFrame silhouettes will be written to %s.frame.dat, cluster silhouettes\n" "\t will be written to %s.cluster.dat\n", sil_file_.c_str(), sil_file_.c_str()); + if (sieve_ != 1) { + if (includeSieveInCalc_) + mprintf("\tSilhouette calculation will use all frames.\n"); + else + mprintf("\tSilhouette calculation will use non-sieved frames ONLY.\n"); + } + } + } diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h index 110d905a93..753d593ddf 100644 --- a/src/Cluster/Results.h +++ b/src/Cluster/Results.h @@ -1,9 +1,12 @@ #ifndef INC_CLUSTER_RESULTS_H #define INC_CLUSTER_RESULTS_H #include "../ArgList.h" +#include "List.h" namespace Cpptraj { namespace Cluster { +//FIXME Should this be allocated and kept inside the Metric? + /// Abstract base class for handling results specific to input data type. class Results { public: @@ -14,7 +17,7 @@ class Results { virtual int GetOptions(ArgList&) = 0; virtual void Info() const = 0; - virtual int DoOutput() const = 0; + virtual int DoOutput(List const&) const = 0; private: Type type_; }; diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 0b1c5a09e9..5c6bfb7104 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -1,5 +1,7 @@ #include "Results_Coords.h" #include "../CpptrajStdio.h" +#include "../StringRoutines.h" +#include "../Trajout_Single.h" /** The default output trajectory format. */ const TrajectoryFile::TrajFormatType Cpptraj::Cluster::Results_Coords::DEF_TRAJ_FMT_ = @@ -46,3 +48,193 @@ void Cpptraj::Cluster::Results_Coords::Info() const { mprintf("\tAverage structures for clusters will be written to %s, format %s\n", avgfile_.c_str(), TrajectoryFile::FormatString(avgfmt_)); } + +int Cpptraj::Cluster::Results_Coords::DoOutput(List const& CList) const { + // Write clusters to trajectories + if (!clusterfile_.empty()) + WriteClusterTraj( CList ); + // Write all representative frames to a single traj + if (!singlerepfile_.empty()) + WriteSingleRepTraj( CList ); + // Write all representative frames to separate trajs + if (!reptrajfile_.empty()) + WriteRepTraj( CList ); + // Write average structures for each cluster to separate files. + if (!avgfile_.empty()) + WriteAvgStruct( CList ); + return 0; +} + +/** Write frames in each cluster to a trajectory file. */ +void Cpptraj::Cluster::Results_Coords::WriteClusterTraj( List const& CList ) const { + Topology* clusterparm = coords_->TopPtr(); + // Loop over all clusters + for (List::cluster_iterator C = CList.begincluster(); + C != CList.endcluster(); ++C) + { + // Create filename based on cluster number. + int cnum = C->Num(); + std::string cfilename = clusterfile_ + ".c" + integerToString( cnum ); + // Set up trajectory file + Trajout_Single clusterout; + if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, + coords_->CoordsInfo(), C->Nframes(), + clusterfmt_)) + { + mprinterr("Error: Could not set up cluster trajectory %s for write.\n", + cfilename.c_str()); + return; + } + // Loop over all frames in cluster + int set = 0; + Frame clusterframe = coords_->AllocateFrame(); + for (Node::frame_iterator fnum = C->beginframe(); + fnum != C->endframe(); ++fnum) + { + coords_->GetFrame( *fnum, clusterframe ); + clusterout.WriteSingle(set++, clusterframe); + } + // Close traj + clusterout.EndTraj(); + } +} + +/** Write average of clusters to files. */ +void Cpptraj::Cluster::Results_Coords::WriteAvgStruct( List const& CList ) const { + Topology avgparm = coords_->Top(); + // Get extension for representative frame format + std::string tmpExt = TrajectoryFile::WriteFormatExtension(avgfmt_); + // Loop over all clusters + for (List::cluster_iterator C = CList.begincluster(); + C != CList.endcluster(); ++C) + { + // Create filename based on cluster number. + int cnum = C->Num(); + std::string cfilename = avgfile_ + ".c" + integerToString( cnum ) + tmpExt; + // Set up trajectory file + Trajout_Single clusterout; // FIXME CoordinateInfo OK for just coords? + if (clusterout.PrepareTrajWrite(cfilename, ArgList(), &avgparm, + CoordinateInfo(), 1, avgfmt_)) + { + mprinterr("Error: Could not set up cluster average file %s for write.\n", + cfilename.c_str()); + return; + } + // Get rep frame for rms fitting. + Frame repframe = coords_->AllocateFrame(); + coords_->GetFrame( C->BestRepFrame(), repframe ); + Vec3 reftrans = repframe.CenterOnOrigin(false); + // Loop over all frames in cluster + Frame clusterframe = coords_->AllocateFrame(); + Frame avgframe = clusterframe; + avgframe.ZeroCoords(); + for (Node::frame_iterator fnum = C->beginframe(); + fnum != C->endframe(); ++fnum) + { + coords_->GetFrame( *fnum, clusterframe ); + clusterframe.RMSD_FitToRef( repframe, reftrans ); + avgframe += clusterframe; + } + avgframe.Divide( (double)C->Nframes() ); + clusterout.WriteSingle(0, avgframe); + clusterout.EndTraj(); + } +} + +/** Write representative frame of each cluster to a trajectory file. */ +void Cpptraj::Cluster::Results_Coords::WriteSingleRepTraj( List const& CList ) const { + Trajout_Single clusterout; + // Set up trajectory file. Use parm from COORDS DataSet. + Topology *clusterparm = coords_->TopPtr(); + int nRepsToSave = CList.front().BestReps().size(); + if (clusterout.PrepareTrajWrite(singlerepfile_, ArgList(), clusterparm, + coords_->CoordsInfo(), CList.Nclusters() * nRepsToSave, + singlerepfmt_)) + { + mprinterr("Error: Could not set up single trajectory for represenatatives %s for write.\n", + singlerepfile_.c_str()); + return; + } + // Set up frame to hold cluster rep coords. + Frame clusterframe = coords_->AllocateFrame(); + int framecounter = 0; + // Write rep frames from all clusters. + for (List::cluster_iterator cluster = CList.begincluster(); + cluster != CList.endcluster(); ++cluster) + { + for (Node::RepPairArray::const_iterator rep = cluster->BestReps().begin(); + rep != cluster->BestReps().end(); ++rep) + { + coords_->GetFrame( rep->first, clusterframe ); + clusterout.WriteSingle(framecounter++, clusterframe); + } + } + // Close traj + clusterout.EndTraj(); +} + +/** Write representative frame of each cluster to a separate trajectory file, + * repfile.REPNUM.FMT + */ +void Cpptraj::Cluster::Results_Coords::WriteRepTraj( List const& CList ) const { + // Get extension for representative frame format + std::string tmpExt = TrajectoryFile::WriteFormatExtension(reptrajfmt_); + // Use Topology from COORDS DataSet to set up input frame + Topology* clusterparm = coords_->TopPtr(); + Frame clusterframe = coords_->AllocateFrame(); + // Loop over all clusters + for (List::cluster_iterator C = CList.begincluster(); + C != CList.endcluster(); ++C) + { + if (writeRepFrameNum_) { + // Each rep from cluster to separate file. + for (Node::RepPairArray::const_iterator rep = C->BestReps().begin(); + rep != C->BestReps().end(); ++rep) + { + Trajout_Single clusterout; + // Get best rep frame # + int framenum = rep->first; + // Create filename based on cluster number and frame # + std::string cfilename = reptrajfile_ + ".c" + integerToString(C->Num()) + + ("." + integerToString(framenum+1)) + tmpExt; + // Set up trajectory file. + if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, + coords_->CoordsInfo(), 1, reptrajfmt_)) + { + mprinterr("Error: Could not set up representative trajectory file %s for write.\n", + cfilename.c_str()); + return; + } + // Write cluster rep frame + coords_->GetFrame( framenum, clusterframe ); + clusterout.WriteSingle(framenum, clusterframe); + // Close traj + clusterout.EndTraj(); + } + } else { + // Each rep from cluster to single file. + Trajout_Single clusterout; + // Create filename based on cluster number + std::string cfilename = reptrajfile_ + ".c" + integerToString(C->Num()) + tmpExt; + // Set up trajectory file. + int nRepsToSave = C->BestReps().size(); + if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, + coords_->CoordsInfo(), nRepsToSave, reptrajfmt_)) + { + mprinterr("Error: Could not set up representative trajectory file %s for write.\n", + cfilename.c_str()); + return; + } + int framecounter = 0; + for (Node::RepPairArray::const_iterator rep = C->BestReps().begin(); + rep != C->BestReps().end(); ++rep) + { + // Write cluster rep frame + coords_->GetFrame( rep->first, clusterframe ); + clusterout.WriteSingle( framecounter++, clusterframe ); + } + // Close traj + clusterout.EndTraj(); + } + } +} diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index 77688d8e70..a82f9c679c 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -2,24 +2,30 @@ #define INC_CLUSTER_RESULTS_COORDS_H #include "Results.h" #include "../TrajectoryFile.h" +#include "../DataSet_Coords.h" namespace Cpptraj { namespace Cluster { /// Class for handling cluster results specific to COORDS input data. class Results_Coords : public Results { public: - Results_Coords() : Results(COORDS) {} + Results_Coords(DataSet_Coords* ds) : Results(COORDS), coords_(ds) {} // ----- Results functions ------------------- int GetOptions(ArgList&); void Info() const; - int DoOutput() const; + int DoOutput(List const&) const; private: void GetClusterTrajArgs(ArgList&, const char*, const char*, std::string&, TrajectoryFile::TrajFormatType&) const; + void WriteClusterTraj( List const& ) const; + void WriteAvgStruct( List const& ) const; + void WriteSingleRepTraj( List const& ) const; + void WriteRepTraj( List const& ) const; static const TrajectoryFile::TrajFormatType DEF_TRAJ_FMT_; - bool writeRepFrameNum_; ///< If true frame #s will be in rep file names. + DataSet_Coords* coords_; ///< The COORDS data set + bool writeRepFrameNum_; ///< If true frame #s will be in rep file names. TrajectoryFile::TrajFormatType clusterfmt_; ///< Cluster trajectory format. TrajectoryFile::TrajFormatType singlerepfmt_; ///< Cluster all rep single trajectory format. TrajectoryFile::TrajFormatType reptrajfmt_; ///< Cluster rep to separate trajectory format. diff --git a/src/cpptrajdepend b/src/cpptrajdepend index ae9773e23b..2351cf94bc 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -155,7 +155,7 @@ Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../As Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h -Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ArgList.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Results.h Cluster/Results_Coords.h +Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Trajout_Single.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/Sieve.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h From c097e2fe69959cae61a73913537d6cbb927a1553 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 15:32:03 -0500 Subject: [PATCH 150/417] DRR - Cpptraj: Enable results output. --- src/Cluster/Control.cpp | 21 ++++++++++++++++++++- src/Cluster/Control.h | 3 +++ src/cpptrajdepend | 6 +++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index d2216756d0..ae343ba5bf 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -8,10 +8,13 @@ // Algorithms #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" +// Results +#include "Results_Coords.h" Cpptraj::Cluster::Control::Control() : metric_(0), algorithm_(0), + results_(0), verbose_(0), frameSelect_(UNSPECIFIED), sieve_(1), @@ -30,6 +33,7 @@ Cpptraj::Cluster::Control::Control() : Cpptraj::Cluster::Control::~Control() { if (algorithm_ != 0) delete algorithm_; if (metric_ != 0 ) delete metric_; + if (results_ != 0 ) delete results_; } // ----------------------------------------------------------------------------- @@ -273,6 +277,10 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, return 1; } + // Set up results for COORDS DataSet + results_ = (Results*)new Results_Coords( ds ); + if (results_ == 0) return 1; + return Common(analyzeArgs, DSL, DFL); } @@ -289,6 +297,10 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da { clusters_.SetDebug( verbose_ ); + if (results_ != 0) { + if (results_->GetOptions(analyzeArgs)) return 1; + } + // Allocate PairwiseMatrix (and optionally a cache). Metric must already be set up. if (AllocatePairwise( analyzeArgs, DSL, DFL )) { mprinterr("Error: PairwiseMatrix setup failed.\n"); @@ -408,6 +420,7 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da void Cpptraj::Cluster::Control::Info() const { if (metric_ != 0) metric_->Info(); if (algorithm_ != 0) algorithm_->Info(); + if (results_ != 0) results_->Info(); // TODO frameSelect if (sieve_ > 1) @@ -653,6 +666,12 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { } } + if (results_ != 0) { + timer_output_results_.Start(); + results_->DoOutput( clusters_ ); + timer_output_results_.Stop(); + } + timer_output_.Stop(); return 0; } @@ -671,6 +690,6 @@ void Cpptraj::Cluster::Control::Timing(double ttotal) const { // Output Timing data timer_output_info_.WriteTiming( 2, "Info calc :", timer_output_.Total()); timer_output_summary_.WriteTiming(2, "Summary calc :", timer_output_.Total()); - //cluster_post_coords.WriteTiming(2, "Coordinate writes", cluster_post.Total()); + timer_output_results_.WriteTiming(2, "Results Output :", timer_output_.Total()); timer_output_.WriteTiming(1, "Output Total :", ttotal); } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index f03440a460..c9824971a2 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -5,6 +5,7 @@ #include "PairwiseMatrix.h" #include "Algorithm.h" #include "Metric.h" +#include "Results.h" #include "BestReps.h" #include "../Timer.h" #include "../DataSetList.h" @@ -62,6 +63,7 @@ class Control { DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. PairwiseMatrix pmatrix_; ///< Encapsulates the metric and any cached distances. Algorithm* algorithm_; ///< Hold the clustering algorithm. + Results* results_; ///< Hold output routines specific to data being clustered. std::string dsname_; ///< Name for output data sets. int verbose_; @@ -95,6 +97,7 @@ class Control { Timer timer_run_; ///< Total Run time Timer timer_output_info_; ///< Output - info file write Timer timer_output_summary_; ///< Output - summary write + Timer timer_output_results_; ///< Output - results (e.g. coords writes). Timer timer_output_; ///< Total output time }; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 2351cf94bc..6fb566def0 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Sieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h DataSet_string.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -148,7 +148,7 @@ Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/ Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h @@ -161,7 +161,7 @@ ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants. Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h From d1c08ca4c998db20ac0d26ce28fa0ade21766790 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 15 Feb 2019 15:37:59 -0500 Subject: [PATCH 151/417] DRR - Cpptraj: Start adding cluster split analysis --- src/Cluster/Control.cpp | 34 ++++++++++++++++++++++++++++++++++ src/Cluster/Control.h | 3 +++ 2 files changed, 37 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index ae343ba5bf..74cca0799f 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -413,6 +413,28 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da if (cnumvtime_ == 0) return 1; if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); + // Cluster split analysis + splitfile_ = analyzeArgs.GetStringKey("summarysplit"); + if (splitfile_.empty()) // For backwards compat. + splitfile_ = analyzeArgs.GetStringKey("summaryhalf"); + if (!splitfile_.empty()) { + ArgList splits( analyzeArgs.GetStringKey("splitframe"), "," ); + if (!splits.empty()) { + splitFrames_.clear(); + int sf = splits.getNextInteger(-1); // User frame #s start at 1 + while (sf > 0) { + splitFrames_.push_back( sf ); + sf = splits.getNextInteger(-1); + } + if ((int)splitFrames_.size() < splits.Nargs()) { + mprinterr("Error: Invalid split frame arguments.\n"); + splits.CheckForMoreArgs(); + return 1; + } + } + } + + return 0; } @@ -474,6 +496,18 @@ void Cpptraj::Cluster::Control::Info() const { } } + if (!splitfile_.empty()) { + mprintf("\tSummary comparing parts of trajectory data for clusters will be written to %s\n", + splitfile_.c_str()); + if (!splitFrames_.empty()) { + mprintf("\t\tFrames will be split at:"); + for (std::vector::const_iterator f = splitFrames_.begin(); f != splitFrames_.end(); ++f) + mprintf(" %i", *f); + mprintf("\n"); + } else + mprintf("\t\tFrames will be split at the halfway point.\n"); + } + } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index c9824971a2..1fcc242f38 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -87,6 +87,9 @@ class Control { DataFile* cpopvtimefile_; ///< Cluster population vs time file. Node::CnormType norm_pop_; ///< Cluster pop vs time normalization type + std::string splitfile_; ///< Output file for splitting cluster results + Cframes splitFrames_; ///< Frames at which to split + // Timers Timer timer_setup_; ///< Run - metric, frames to cluster setup Timer timer_pairwise_; ///< Run - pairwise caching From 117f381f69b92c2a9dd68796f5b3a6a614fb71d2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 16 Feb 2019 19:13:41 -0500 Subject: [PATCH 152/417] DRR - Cpptraj: Add summary by parts. --- src/Cluster/Cframes.h | 1 + src/Cluster/Control.cpp | 10 +++ src/Cluster/Output.cpp | 133 ++++++++++++++++++++++++++++++++++++++++ src/Cluster/Output.h | 1 + 4 files changed, 145 insertions(+) diff --git a/src/Cluster/Cframes.h b/src/Cluster/Cframes.h index dac4ecfbe9..a1c8091c19 100644 --- a/src/Cluster/Cframes.h +++ b/src/Cluster/Cframes.h @@ -27,6 +27,7 @@ class Cframes { void clear() { frames_.clear(); } void reserve(std::size_t n) { frames_.reserve(n); } Iarray const& Data() const { return frames_; } + bool empty() const { return frames_.empty(); } bool HasFrame(int) const; void Insert(Cframes const& rhs) { frames_.insert(frames_.end(), rhs.begin(), rhs.end()); } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 74cca0799f..03d0c5db99 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -672,6 +672,16 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { timer_output_summary_.Stop(); } + // Summary by parts + if (!splitfile_.empty()) { + CpptrajFile outfile; + if (outfile.OpenWrite(splitfile_)) { + mprinterr("Error: Could not set up summary split file.\n"); + return 1; + } + Output::Summary_Part(outfile, metric_->Ntotal(), splitFrames_, clusters_); + } + // Cluster number vs time if (cnumvtime_ != 0) { if (clusters_.CreateCnumVsTime( (DataSet_integer*)cnumvtime_, metric_->Ntotal() )) diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index f65753a1ef..750602d010 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -2,6 +2,14 @@ #include // sort, max #include "Output.h" #include "../Matrix.h" +#include "../CpptrajStdio.h" + +// XMGRACE colors +const char* XMGRACE_COLOR[] = { + "white", "black", "red", "green", "blue", "yellow", "brown", "grey", "violet", + "cyan", "magenta", "orange", "indigo", "maroon", "turquoise", "darkgreen" +}; + // ----------------------------------------------------------------------------- // ClusterList::PrintClustersToFile() /** Print list of clusters in a style similar to ptraj; each cluster is @@ -267,3 +275,128 @@ int Cpptraj::Cluster::Output::Summary(CpptrajFile& outfile, List const& clusters return 0; } +/** Cluster summary by parts. */ +void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, + unsigned int clusterDataSetSize, + Cframes const& splitFrames, + List const& clusters) +{ + // If no split frames were specified, use halfway point. + Cframes actualSplitFrames; + if (splitFrames.empty()) + actualSplitFrames.push_back( clusterDataSetSize / 2 ); + else { + // Check that none of the split values are invalid. + for (Cframes::const_iterator f = splitFrames.begin(); + f != splitFrames.end(); ++f) + if ( *f < 1 || *f >= (int)clusterDataSetSize ) + mprintf("Warning: split frame %i is out of bounds; ignoring.\n", *f); + else + actualSplitFrames.push_back( *f ); + } + + const char* nExt[] = {"st", "nd", "rd", "th"}; + if (actualSplitFrames.empty()) return; // Sanity check. + double fmax = (double)clusterDataSetSize; + + // Determine number of frames and traj offset for each part. + outfile.Printf("# 1st"); + std::vector partMax; + partMax.reserve( actualSplitFrames.size() + 1 ); + std::vector trajOffset; + trajOffset.reserve( actualSplitFrames.size() + 1); + trajOffset.push_back( 0 ); + int lastMax = 0; + unsigned int eidx = 1; + for (unsigned int sf = 0; sf < actualSplitFrames.size(); sf++) + { + partMax.push_back( (double)(actualSplitFrames[sf] - lastMax) ); + lastMax = actualSplitFrames[sf]; + trajOffset.push_back( lastMax ); + outfile.Printf(" <= %i < %u%s", trajOffset.back(), sf+2, nExt[eidx]); + if (eidx < 3) ++eidx; + } + partMax.push_back( (double)(clusterDataSetSize - lastMax) ); + outfile.Printf("\n# "); + // Print # of frames in each section + eidx=0; + for (std::vector::const_iterator pm = partMax.begin(); pm != partMax.end(); ++pm) { + if (pm != partMax.begin()) outfile.Printf(" "); + outfile.Printf("%u%s= %.0f", pm - partMax.begin() + 1, nExt[eidx], *pm); + if (eidx < 3) ++eidx; + } + outfile.Printf("\n"); + // DEBUG + //mprintf("DEBUG: # Frames (offset):"); + //std::vector::const_iterator of = trajOffset.begin(); + //for (std::vector::const_iterator it = partMax.begin(); + // it != partMax.end(); ++it, ++of) + // mprintf(" %.0f (%i)", *it, *of); + //mprintf("\n"); + // Set up bins + std::vector numInPart( actualSplitFrames.size() + 1, 0 ); + std::vector firstFrame( actualSplitFrames.size() + 1, -1); + + // Header + outfile.Printf("#%-7s %8s %8s %2s %10s", "Cluster", "Total", "Frac", "C#", "Color"); + eidx = 0; + for (unsigned int pm = 1; pm <= partMax.size(); ++pm) { + outfile.Printf(" %5s%u%2s", "NumIn", pm, nExt[eidx]); + if (eidx < 3) ++eidx; + } + for (unsigned int pm = 1; pm <= partMax.size(); ++pm) + outfile.Printf(" %7s%u", "Frac", pm); + for (unsigned int pm = 1; pm <= partMax.size(); ++pm) + outfile.Printf(" %7s%u", "First", pm); + // Determine if cluster names will be output. + unsigned int nWidth = DetermineNameWidth(clusters); + if (nWidth > 0) { + if (nWidth < 8) nWidth = 8; + outfile.Printf(" %*s %6s", nWidth, "Name", "RMS"); + } + outfile.Printf("\n"); + // LOOP OVER CLUSTERS + int color = 1; // xmgrace color, 1-15 + for (List::cluster_iterator node = clusters.begincluster(); + node != clusters.endcluster(); ++node) + { + // Calculate size and fraction of total size of this cluster + int numframes = node->Nframes(); + double frac = (double)numframes / fmax; + std::fill( numInPart.begin(), numInPart.end(), 0 ); + std::fill( firstFrame.begin(), firstFrame.end(), -1 ); + // DEBUG + //mprintf("\tCluster %i\n",node->num); + // Count how many frames are in each part. + for (Node::frame_iterator frame1 = node->beginframe(); + frame1 != node->endframe(); + frame1++) + { + unsigned int bin = actualSplitFrames.size(); + for (unsigned int sf = 0; sf < actualSplitFrames.size(); ++sf) { + if ( *frame1 < actualSplitFrames[sf] ) { + bin = sf; + break; + } + } + if (numInPart[ bin ] == 0) + firstFrame[ bin ] = *frame1 - trajOffset[ bin ] + 1; + ++numInPart[ bin ]; + } + outfile.Printf("%-8i %8i %8.4f %2i %10s", node->Num(), numframes, frac, + color, XMGRACE_COLOR[color]); + for (std::vector::const_iterator np = numInPart.begin(); + np != numInPart.end(); ++np) + outfile.Printf(" %8i", *np); + for (unsigned int pm = 0; pm < partMax.size(); ++pm) + outfile.Printf(" %8.4f", ((double)numInPart[pm]) / partMax[pm]); + for (std::vector::const_iterator ff = firstFrame.begin(); + ff != firstFrame.end(); ++ff) + outfile.Printf(" %8i", *ff); + if (nWidth > 0) + outfile.Printf(" %*s %6.2f", nWidth, node->Cname().c_str(), node->RefRms()); + outfile.Printf("\n"); + if (color<15) ++color; + } + outfile.CloseFile(); +} diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h index 84c8cafd9a..23811410cc 100644 --- a/src/Cluster/Output.h +++ b/src/Cluster/Output.h @@ -19,6 +19,7 @@ class Output { static int PrintSilhouettes(CpptrajFile&, List const&); static int Summary(CpptrajFile&, List const&, Algorithm const&, PairwiseMatrix const&, bool, Cframes const&); + static void Summary_Part(CpptrajFile&, unsigned int, Cframes const&, List const&); private: static unsigned int DetermineNameWidth(List const&); }; From 138d5cb841e9828a3140c577f6c7b2bb35f00810 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 17 Feb 2019 14:21:12 -0500 Subject: [PATCH 153/417] DRR - Cpptraj: Add DME metric. --- src/Cluster/Control.cpp | 4 ++ src/Cluster/Metric_DME.cpp | 118 +++++++++++++++++++++++++++++++++++++ src/Cluster/Metric_DME.h | 35 +++++++++++ src/cpptrajdepend | 5 +- src/cpptrajfiles | 1 + 5 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 src/Cluster/Metric_DME.cpp create mode 100644 src/Cluster/Metric_DME.h diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 03d0c5db99..e4ddb72250 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -5,6 +5,7 @@ #include "../DataFile.h" // For loading pairwise cache // Metric classes #include "Metric_RMS.h" +#include "Metric_DME.h" // Algorithms #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" @@ -214,6 +215,7 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type Metric* met = 0; switch (mtype) { case Metric::RMS : met = new Metric_RMS(); break; + case Metric::DME : met = new Metric_DME(); break; default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); } return met; @@ -268,6 +270,8 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, switch (mtype) { case Metric::RMS : err = ((Metric_RMS*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass); break; + case Metric::DME : + err = ((Metric_DME*)metric_)->Init(ds, AtomMask(maskExpr)); break; default: mprinterr("Error: Unhandled Metric setup.\n"); err = 1; diff --git a/src/Cluster/Metric_DME.cpp b/src/Cluster/Metric_DME.cpp new file mode 100644 index 0000000000..2f7db4e0fb --- /dev/null +++ b/src/Cluster/Metric_DME.cpp @@ -0,0 +1,118 @@ +#include "Metric_DME.h" +#include "Centroid_Coord.h" +#include "../CpptrajStdio.h" + +/** Initialize the metric. */ +int Cpptraj::Cluster::Metric_DME::Init(DataSet_Coords* dIn, AtomMask const& maskIn) +{ + // TODO better error handles + if (dIn == 0) { + mprinterr("Internal Error: Metric_DME::Init() called with null data set.\n"); + return 1; + } + mprintf("DEBUG: Init DME metric for '%s', mask '%s'\n", + dIn->legend(), maskIn.MaskString()); + coords_ = dIn; + mask_ = maskIn; + + return 0; +} + +/** Set up the metric. */ +int Cpptraj::Cluster::Metric_DME::Setup() { + if (coords_->Top().SetupIntegerMask( mask_ )) return 1; + mprintf("DEBUG: DME metric topology: %s %s %i\n", coords_->legend(), + coords_->Top().c_str(), coords_->Top().Natom()); + if (frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms())) return 1; + frm2_ = frm1_; + mprintf("DEBUG: Setup DME metric for %i atoms, %zu frames.\n", frm1_.Natom(), coords_->Size()); + return 0; +} + +/** \return DME between two given frames. */ +double Cpptraj::Cluster::Metric_DME::FrameDist(int f1, int f2) { + coords_->GetFrame( f1, frm1_, mask_ ); + coords_->GetFrame( f2, frm2_, mask_ ); + return frm1_.DISTRMSD( frm2_ ); +} + +/** \return DME between two given centroids. */ +double Cpptraj::Cluster::Metric_DME::CentroidDist(Centroid* c1, Centroid* c2) { + return ((Centroid_Coord*)c1)->Cframe().DISTRMSD( ((Centroid_Coord*)c2)->Cframe() ); +} + +/** \return RMSD between given frame and centroid. */ +double Cpptraj::Cluster::Metric_DME::FrameCentroidDist(int f1, Centroid* c1) { + coords_->GetFrame( f1, frm1_, mask_ ); + return frm1_.DISTRMSD( ((Centroid_Coord*)c1)->Cframe() ); +} + +/** Compute the centroid (avg) coords for each atom from all frames in this + * cluster. NOTE: For DME the centroid should probably be calculated via + * internal coordinates; use RMS best-fit as a cheat. + */ +void Cpptraj::Cluster::Metric_DME::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { + Matrix_3x3 Rot; + Vec3 Trans; + Centroid_Coord* cent = (Centroid_Coord*)centIn; + // Reset atom count for centroid. + cent->Cframe().ClearAtoms(); + for (Cframes_it frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) + { + coords_->GetFrame( *frm, frm1_, mask_ ); + if (cent->Cframe().empty()) { + cent->Cframe() = frm1_; + cent->Cframe().CenterOnOrigin(false); + } else { + frm1_.RMSD_CenteredRef( cent->Cframe(), Rot, Trans, false ); + frm1_.Rotate( Rot ); + cent->Cframe() += frm1_; + } + } + cent->Cframe().Divide( (double)cframesIn.size() ); + //mprintf("\t\tFirst 3 centroid coords (of %i): %f %f %f\n", cent->Cframe().Natom(), + // cent->cent->Cframe()[0], cent->Cframe()[1],cent->Cframe()[2]); +} + +/** \return Average structure of given frames. */ +Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_DME::NewCentroid( Cframes const& cframesIn ) { + // TODO: Incorporate mass? + Centroid_Coord* cent = new Centroid_Coord( mask_.Nselected() ); + CalculateCentroid( cent, cframesIn ); + return cent; +} + +// Subtract Notes +// FIXME: Handle single frame +// FIXME: Check if frame is in cluster? +void Cpptraj::Cluster::Metric_DME::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, + CentOpType OP) +{ + Matrix_3x3 Rot; + Vec3 Trans; + Centroid_Coord* cent = (Centroid_Coord*)centIn; + coords_->GetFrame( frame, frm1_, mask_ ); + frm1_.RMSD_CenteredRef( cent->Cframe(), Rot, Trans, false ); + frm1_.Rotate( Rot ); + cent->Cframe().Multiply( oldSize ); + if (OP == ADDFRAME) { + cent->Cframe() += frm1_; + cent->Cframe().Divide( oldSize + 1 ); + } else { // SUBTRACTFRAME + cent->Cframe() -= frm1_; + cent->Cframe().Divide( oldSize - 1 ); + } +} + +/** \return Description of RMS calc. */ +std::string Cpptraj::Cluster::Metric_DME::Description() const { + return "dme " + mask_.MaskExpression(); +} + +void Cpptraj::Cluster::Metric_DME::Info() const { + mprintf("\tMetric: DME"); + if (mask_.MaskExpression() == "*") + mprintf(" (all atoms)\n"); + else + mprintf(" (mask '%s')\n", mask_.MaskString()); +} diff --git a/src/Cluster/Metric_DME.h b/src/Cluster/Metric_DME.h new file mode 100644 index 0000000000..aafda6c63d --- /dev/null +++ b/src/Cluster/Metric_DME.h @@ -0,0 +1,35 @@ +#ifndef INC_CLUSTER_METRIC_DME_H +#define INC_CLUSTER_METRIC_DME_H +#include "../AtomMask.h" +#include "../DataSet_Coords.h" +#include "Metric.h" +namespace Cpptraj { +namespace Cluster { + +/// DME cluster distance calc for Coords DataSet +class Metric_DME : public Metric { + public: + Metric_DME() : Metric(DME), coords_(0) {} + int Setup(); + double FrameDist(int, int); + double CentroidDist( Centroid*, Centroid* ); + double FrameCentroidDist(int, Centroid*); + void CalculateCentroid(Centroid*, Cframes const&); + Centroid* NewCentroid(Cframes const&); + Metric* Copy() { return new Metric_DME( *this ); } + void FrameOpCentroid(int, Centroid*, double, CentOpType); + std::string Description() const; + void Info() const; + unsigned int Ntotal() const { return (unsigned int)coords_->Size(); } + // ------------------------------------------- + int Init(DataSet_Coords*, AtomMask const&); + private: + DataSet_Coords* coords_; + AtomMask mask_; + Frame frm1_; + Frame frm2_; +}; + +} +} +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 6fb566def0..7f5ca5d580 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -148,12 +148,13 @@ Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/ Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h +Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Trajout_Single.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/Sieve.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 9b63814313..94beaa42d5 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -11,6 +11,7 @@ CLUSTER_SOURCES= \ Cluster/Control.cpp \ Cluster/DynamicMatrix.cpp \ Cluster/List.cpp \ + Cluster/Metric_DME.cpp \ Cluster/Metric_RMS.cpp \ Cluster/Node.cpp \ Cluster/Output.cpp \ From 189b06d34f82e7209f48202fb7c2d0a0e700a016 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 13:29:53 -0500 Subject: [PATCH 154/417] DRR - Cpptraj: Metric for calculating Euclidean distance from scalar data sets --- src/Cluster/Centroid_Multi.h | 6 ++ src/Cluster/Metric.h | 5 +- src/Cluster/Metric_Data.cpp | 82 ++++++++++++++++++++++ src/Cluster/Metric_Data.h | 29 ++++++++ src/Cluster/Metric_Data_Euclid.cpp | 105 +++++++++++++++++++++++++++++ src/Cluster/Metric_Data_Euclid.h | 34 ++++++++++ src/cpptrajdepend | 2 + src/cpptrajfiles | 2 + 8 files changed, 261 insertions(+), 4 deletions(-) create mode 100644 src/Cluster/Metric_Data.cpp create mode 100644 src/Cluster/Metric_Data.h create mode 100644 src/Cluster/Metric_Data_Euclid.cpp create mode 100644 src/Cluster/Metric_Data_Euclid.h diff --git a/src/Cluster/Centroid_Multi.h b/src/Cluster/Centroid_Multi.h index e2bbdf19d2..73bf18875c 100644 --- a/src/Cluster/Centroid_Multi.h +++ b/src/Cluster/Centroid_Multi.h @@ -13,6 +13,12 @@ class Centroid_Multi : public Centroid { cvals_(val), Sumx_(x), Sumy_(y) {} Centroid* Copy() { return (Centroid*)new Centroid_Multi(cvals_, Sumx_, Sumy_); } + + Darray const& Cvals() const { return cvals_; } + + Darray& Cvals() { return cvals_; } + Darray& SumX() { return Sumx_; } + Darray& SumY() { return Sumy_; } private: Darray cvals_; Darray Sumx_; // For storing periodic average diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 7a7456b23c..b318418ed2 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -15,9 +15,8 @@ const int UNCLASSIFIED = -2; /// Abstract base class for calculating distance between points or determining centroid. class Metric { public: - enum Type { RMS=0, DME, SRMSD, DATA, DATA_EUCLID, MATRIX2D }; + enum Type { RMS=0, DME, SRMSD, EUCLID, MATRIX2D }; enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; - typedef std::vector DsArray; // TODO should this be here? /// CONSTRUCTOR Metric(Type t) { type_ = t; } @@ -45,8 +44,6 @@ class Metric { virtual void Info() const = 0; /// \return total number of frames. virtual unsigned int Ntotal() const = 0; - protected: - typedef double (*DistCalc)(double,double); private: Type type_; }; diff --git a/src/Cluster/Metric_Data.cpp b/src/Cluster/Metric_Data.cpp new file mode 100644 index 0000000000..e8fe22d46e --- /dev/null +++ b/src/Cluster/Metric_Data.cpp @@ -0,0 +1,82 @@ +#include // fabs, atan2, sin, cos +#include "Metric_Data.h" +#include "../Constants.h" // RADDEG, DEGRAD + +/// Calculate smallest difference between two angles (in degrees). +double Cpptraj::Cluster::Metric_Data::DistCalc_Dih(double d1, double d2) { + double diff = fabs(d1 - d2); + if (diff > 180.0) + return (360.0 - diff); + else + return diff; +} + +/// Calculate basic difference. +double Cpptraj::Cluster::Metric_Data::DistCalc_Std(double d1, double d2) { + return fabs(d1 - d2); +} + +/** Calculate unambiguous average dihedral angle (in degrees) by converting to + * cartesian coords using x = cos(theta), y = sin(theta), and: + * tan(avgtheta) = avgy / avgx = SUM[sin(theta)] / SUM[cos(theta)] + * See Eq. 2 from Altis et al., J. Chem. Phys., 126 p. 244111 (2007). + */ +double Cpptraj::Cluster::Metric_Data::AvgCalc_Dih(DataSet_1D const& dsIn, + Cframes const& cframesIn, + double& sumx, double& sumy) +{ + sumy = 0.0; + sumx = 0.0; + // TODO: Convert angles to radians prior to this call? + for (Cframes::const_iterator frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) { + double theta = dsIn.Dval( *frm ) * Constants::DEGRAD; + sumy += sin( theta ); + sumx += cos( theta ); + } + return atan2(sumy, sumx) * Constants::RADDEG; +} + +double Cpptraj::Cluster::Metric_Data::AvgCalc_Std(DataSet_1D const& dsIn, + Cframes const& cframesIn) +{ + double val = 0.0; + for (Cframes::const_iterator frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) + val += dsIn.Dval( *frm ); + return (val / (double)cframesIn.size()); +} + +/* Update centroid value for adding/removing a frame. + * \param fval value of frame being added/removed. + * \param cval current centroid value. + * \param isTorsion data is periodic. + * \param oldSize Previous size of the centroid. + * \param OP Operation being performed. + */ +double Cpptraj::Cluster::Metric_Data::DistCalc_FrameCentroid(double fval, double cval, + bool isTorsion, + double oldSize, CentOpType OP, + double& sumx, double& sumy) +{ + double newcval; + if (isTorsion) { + double ftheta = fval * Constants::DEGRAD; + if (OP == ADDFRAME) { + sumy += sin( ftheta ); + sumx += cos( ftheta ); + } else { // SUBTRACTFRAME + sumy -= sin( ftheta ); + sumx -= cos( ftheta ); + } + newcval = atan2(sumy, sumx) * Constants::RADDEG; + } else { + newcval = cval * oldSize; + if (OP == ADDFRAME) { + newcval += fval; + newcval /= ( oldSize + 1 ); + } else { // SUBTRACTFRAME + newcval -= fval; + newcval /= ( oldSize - 1 ); + } + } + return newcval; +} diff --git a/src/Cluster/Metric_Data.h b/src/Cluster/Metric_Data.h new file mode 100644 index 0000000000..6d705e147d --- /dev/null +++ b/src/Cluster/Metric_Data.h @@ -0,0 +1,29 @@ +#ifndef INC_CLUSTER_METRIC_DATA_H +#define INC_CLUSTER_METRIC_DATA_H +#include +#include "Metric.h" +#include "../DataSet_1D.h" +namespace Cpptraj { +namespace Cluster { + +/// Abstract base class for Metrics that use scalar DataSets +class Metric_Data : public Metric { + public: + Metric_Data(Type t) : Metric(t) {} + virtual ~Metric_Data() {} + + /// Input to Metric_Data + typedef std::vector DsArray; + protected: + typedef double (*DistCalc)(double,double); + + static double DistCalc_Dih(double,double); + static double DistCalc_Std(double,double); + static double AvgCalc_Dih(DataSet_1D const&, Cframes const&, double&, double&); + static double AvgCalc_Std(DataSet_1D const&, Cframes const&); + static double DistCalc_FrameCentroid(double, double, bool, double, CentOpType, double&, double&); +}; + +} +} +#endif diff --git a/src/Cluster/Metric_Data_Euclid.cpp b/src/Cluster/Metric_Data_Euclid.cpp new file mode 100644 index 0000000000..d9cfe6f98d --- /dev/null +++ b/src/Cluster/Metric_Data_Euclid.cpp @@ -0,0 +1,105 @@ +#include // sqrt +#include "Metric_Data_Euclid.h" +#include "Centroid_Multi.h" + +int Cpptraj::Cluster::Metric_Data_Euclid::Init(DsArray const& dsIn) +{ + for (DsArray::const_iterator ds = dsIn.begin(); ds != dsIn.end(); ++ds) { + dsets_.push_back( (DataSet_1D*)*ds ); + if ( dsets_.back()->Meta().IsTorsionArray() ) + dcalcs_.push_back( DistCalc_Dih ); + else + dcalcs_.push_back( DistCalc_Std ); + } + return 0; +} + +double Cpptraj::Cluster::Metric_Data_Euclid::FrameDist(int f1, int f2) { + double dist = 0.0; + DcArray::const_iterator dcalc = dcalcs_.begin(); + for (D1Array::iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds, ++dcalc) { + double diff = (*dcalc)((*ds)->Dval(f1), (*ds)->Dval(f2)); + dist += (diff * diff); + } + return sqrt(dist); +} + +double Cpptraj::Cluster::Metric_Data_Euclid::CentroidDist(Centroid* c1, Centroid* c2) { + double dist = 0.0; + Centroid_Multi::Darray::const_iterator c2val = ((Centroid_Multi*)c2)->Cvals().begin(); + DcArray::const_iterator dcalc = dcalcs_.begin(); + for (Centroid_Multi::Darray::const_iterator c1val = ((Centroid_Multi*)c1)->Cvals().begin(); + c1val != ((Centroid_Multi*)c1)->Cvals().end(); + ++c1val, ++dcalc) + { + double diff = (*dcalc)(*c1val, *(c2val++)); + dist += (diff * diff); + } + return sqrt(dist); +} + +double Cpptraj::Cluster::Metric_Data_Euclid::FrameCentroidDist(int f1, Centroid* c1) { + double dist = 0.0; + Centroid_Multi::Darray::const_iterator c1val = ((Centroid_Multi*)c1)->Cvals().begin(); + DcArray::const_iterator dcalc = dcalcs_.begin(); + for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) { + double diff = (*dcalc)((*ds)->Dval(f1), *(c1val++)); + dist += (diff * diff); + } + return sqrt(dist); +} + +void Cpptraj::Cluster::Metric_Data_Euclid::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { + Centroid_Multi* cent = (Centroid_Multi*)centIn; + cent->Cvals().resize( dsets_.size(), 0.0 ); + cent->SumX().resize( dsets_.size(), 0.0 ); + cent->SumY().resize( dsets_.size(), 0.0 ); + for (unsigned int idx = 0; idx != dsets_.size(); ++idx) { + if (dsets_[idx]->Meta().IsTorsionArray()) + cent->Cvals()[idx] = AvgCalc_Dih(*dsets_[idx], cframesIn, + cent->SumX()[idx], cent->SumY()[idx]); + else + cent->Cvals()[idx] = AvgCalc_Std(*dsets_[idx], cframesIn); + } +// mprintf("DEBUG: Centroids:"); +// for (unsigned int i = 0; i != cent->cvals_.size(); i++) +// mprintf(" %f (sumy=%f sumx=%f)", cent->cvals_[i], cent->Sumy_[i], cent->Sumx_[i]); +// mprintf("\n"); +} + +Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_Data_Euclid::NewCentroid(Cframes const& cframesIn) { + Centroid_Multi* cent = new Centroid_Multi(); + CalculateCentroid(cent, cframesIn); + return cent; +} + +//static const char* OPSTRING[] = {"ADD", "SUBTRACT"}; // DEBUG + +void Cpptraj::Cluster::Metric_Data_Euclid::FrameOpCentroid(int frame, Centroid* centIn, + double oldSize, CentOpType OP) +{ + Centroid_Multi* cent = (Centroid_Multi*)centIn; +// mprintf("DEBUG: Old Centroids:"); +// for (unsigned int i = 0; i != cent->cvals_.size(); i++) +// mprintf(" sumy=%f sumx=%f", cent->Sumy_[i], cent->Sumx_[i]); +// //mprintf(" %f", cent->cvals_[i]); +// mprintf("\n"); + for (unsigned int i = 0; i != dsets_.size(); ++i) + cent->Cvals()[i] = DistCalc_FrameCentroid(dsets_[i]->Dval(frame), + cent->Cvals()[i], dsets_[i]->Meta().IsTorsionArray(), oldSize, OP, + cent->SumX()[i], cent->SumY()[i]); +// mprintf("DEBUG: New Centroids after %s frame %i:", OPSTRING[OP], frame); +// for (unsigned int i = 0; i != cent->cvals_.size(); i++) +// mprintf(" %f", cent->cvals_[i]); +// mprintf("\n"); +} + +std::string Cpptraj::Cluster::Metric_Data_Euclid::Description() const { + std::string description("data "); + for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) + if (ds == dsets_.begin()) + description.append( (*ds)->Meta().PrintName() ); + else + description.append( "," + (*ds)->Meta().PrintName() ); + return description; +} diff --git a/src/Cluster/Metric_Data_Euclid.h b/src/Cluster/Metric_Data_Euclid.h new file mode 100644 index 0000000000..0ec620ef91 --- /dev/null +++ b/src/Cluster/Metric_Data_Euclid.h @@ -0,0 +1,34 @@ +#ifndef INC_CLUSTER_METRIC_DATA_EUCLID +#define INC_CLUSTER_METRIC_DATA_EUCLID +#include "Metric_Data.h" +namespace Cpptraj { +namespace Cluster { + +/// Metric for scalar DataSet(s), Euclidean distance. +class Metric_Data_Euclid : public Metric_Data { + public: + Metric_Data_Euclid() : Metric_Data(EUCLID) {} + // ----- Metric ------------------------------ + int Setup(); + double FrameDist(int, int); + double CentroidDist( Centroid*, Centroid* ); + double FrameCentroidDist(int, Centroid*); + void CalculateCentroid(Centroid*, Cframes const&); + Centroid* NewCentroid(Cframes const&); + Metric* Copy() { return new Metric_Data_Euclid( *this ); } + void FrameOpCentroid(int, Centroid*, double, CentOpType); + std::string Description() const; + void Info() const; + unsigned int Ntotal() const; + // ------------------------------------------- + int Init(DsArray const&); + private: + typedef std::vector D1Array; + D1Array dsets_; + typedef std::vector DcArray; + DcArray dcalcs_; +}; + +} +} +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 7f5ca5d580..65bdba2e78 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -152,6 +152,8 @@ Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIte Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h +Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h +Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 94beaa42d5..8688740e7b 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -11,6 +11,8 @@ CLUSTER_SOURCES= \ Cluster/Control.cpp \ Cluster/DynamicMatrix.cpp \ Cluster/List.cpp \ + Cluster/Metric_Data.cpp \ + Cluster/Metric_Data_Euclid.cpp \ Cluster/Metric_DME.cpp \ Cluster/Metric_RMS.cpp \ Cluster/Node.cpp \ From 1b2bf96e7ee44878f74f25c7485ec618d128e285 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 13:31:23 -0500 Subject: [PATCH 155/417] DRR - Cpptraj: Enable Euclid distance metric --- src/Cluster/Control.cpp | 6 ++++-- src/cpptrajdepend | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index e4ddb72250..a4dd1cac3f 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -6,6 +6,7 @@ // Metric classes #include "Metric_RMS.h" #include "Metric_DME.h" +#include "Metric_Data_Euclid.h" // Algorithms #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" @@ -214,8 +215,9 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type { Metric* met = 0; switch (mtype) { - case Metric::RMS : met = new Metric_RMS(); break; - case Metric::DME : met = new Metric_DME(); break; + case Metric::RMS : met = new Metric_RMS(); break; + case Metric::DME : met = new Metric_DME(); break; + case Metric::EUCLID : met = new Metric_Data_Euclid(); break; default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); } return met; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 65bdba2e78..df9db35c40 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -148,7 +148,7 @@ Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/ Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h From 4c2f9a10faf24909deea18659b5c590f4dad5a8a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 13:42:26 -0500 Subject: [PATCH 156/417] DRR - Cpptraj: Put all non-Euclidean functionality into Metric_Data --- src/Cluster/Metric_Data.cpp | 68 ++++++++++++++++++++++++++++++ src/Cluster/Metric_Data.h | 12 ++++++ src/Cluster/Metric_Data_Euclid.cpp | 65 +--------------------------- src/Cluster/Metric_Data_Euclid.h | 7 --- src/cpptrajdepend | 2 +- 5 files changed, 82 insertions(+), 72 deletions(-) diff --git a/src/Cluster/Metric_Data.cpp b/src/Cluster/Metric_Data.cpp index e8fe22d46e..580e944264 100644 --- a/src/Cluster/Metric_Data.cpp +++ b/src/Cluster/Metric_Data.cpp @@ -1,7 +1,20 @@ #include // fabs, atan2, sin, cos #include "Metric_Data.h" +#include "Centroid_Multi.h" #include "../Constants.h" // RADDEG, DEGRAD +int Cpptraj::Cluster::Metric_Data::Init(DsArray const& dsIn) +{ + for (DsArray::const_iterator ds = dsIn.begin(); ds != dsIn.end(); ++ds) { + dsets_.push_back( (DataSet_1D*)*ds ); + if ( dsets_.back()->Meta().IsTorsionArray() ) + dcalcs_.push_back( DistCalc_Dih ); + else + dcalcs_.push_back( DistCalc_Std ); + } + return 0; +} + /// Calculate smallest difference between two angles (in degrees). double Cpptraj::Cluster::Metric_Data::DistCalc_Dih(double d1, double d2) { double diff = fabs(d1 - d2); @@ -80,3 +93,58 @@ double Cpptraj::Cluster::Metric_Data::DistCalc_FrameCentroid(double fval, double } return newcval; } + +void Cpptraj::Cluster::Metric_Data::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { + Centroid_Multi* cent = (Centroid_Multi*)centIn; + cent->Cvals().resize( dsets_.size(), 0.0 ); + cent->SumX().resize( dsets_.size(), 0.0 ); + cent->SumY().resize( dsets_.size(), 0.0 ); + for (unsigned int idx = 0; idx != dsets_.size(); ++idx) { + if (dsets_[idx]->Meta().IsTorsionArray()) + cent->Cvals()[idx] = AvgCalc_Dih(*dsets_[idx], cframesIn, + cent->SumX()[idx], cent->SumY()[idx]); + else + cent->Cvals()[idx] = AvgCalc_Std(*dsets_[idx], cframesIn); + } +// mprintf("DEBUG: Centroids:"); +// for (unsigned int i = 0; i != cent->cvals_.size(); i++) +// mprintf(" %f (sumy=%f sumx=%f)", cent->cvals_[i], cent->Sumy_[i], cent->Sumx_[i]); +// mprintf("\n"); +} + +Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_Data::NewCentroid(Cframes const& cframesIn) { + Centroid_Multi* cent = new Centroid_Multi(); + CalculateCentroid(cent, cframesIn); + return cent; +} + +//static const char* OPSTRING[] = {"ADD", "SUBTRACT"}; // DEBUG + +void Cpptraj::Cluster::Metric_Data::FrameOpCentroid(int frame, Centroid* centIn, + double oldSize, CentOpType OP) +{ + Centroid_Multi* cent = (Centroid_Multi*)centIn; +// mprintf("DEBUG: Old Centroids:"); +// for (unsigned int i = 0; i != cent->cvals_.size(); i++) +// mprintf(" sumy=%f sumx=%f", cent->Sumy_[i], cent->Sumx_[i]); +// //mprintf(" %f", cent->cvals_[i]); +// mprintf("\n"); + for (unsigned int i = 0; i != dsets_.size(); ++i) + cent->Cvals()[i] = DistCalc_FrameCentroid(dsets_[i]->Dval(frame), + cent->Cvals()[i], dsets_[i]->Meta().IsTorsionArray(), oldSize, OP, + cent->SumX()[i], cent->SumY()[i]); +// mprintf("DEBUG: New Centroids after %s frame %i:", OPSTRING[OP], frame); +// for (unsigned int i = 0; i != cent->cvals_.size(); i++) +// mprintf(" %f", cent->cvals_[i]); +// mprintf("\n"); +} + +std::string Cpptraj::Cluster::Metric_Data::SetNames(std::string const& descrip) const { + std::string description(descrip); + for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) + if (ds == dsets_.begin()) + description.append( (*ds)->Meta().PrintName() ); + else + description.append( "," + (*ds)->Meta().PrintName() ); + return description; +} diff --git a/src/Cluster/Metric_Data.h b/src/Cluster/Metric_Data.h index 6d705e147d..123f3d5d16 100644 --- a/src/Cluster/Metric_Data.h +++ b/src/Cluster/Metric_Data.h @@ -14,14 +14,26 @@ class Metric_Data : public Metric { /// Input to Metric_Data typedef std::vector DsArray; + // ----- Metric ------------------------------ + void CalculateCentroid(Centroid*, Cframes const&); + Centroid* NewCentroid(Cframes const&); + void FrameOpCentroid(int, Centroid*, double, CentOpType); + // ------------------------------------------- + int Init(DsArray const&); protected: typedef double (*DistCalc)(double,double); + typedef std::vector D1Array; + typedef std::vector DcArray; static double DistCalc_Dih(double,double); static double DistCalc_Std(double,double); static double AvgCalc_Dih(DataSet_1D const&, Cframes const&, double&, double&); static double AvgCalc_Std(DataSet_1D const&, Cframes const&); static double DistCalc_FrameCentroid(double, double, bool, double, CentOpType, double&, double&); + std::string SetNames(std::string const&) const; + // TODO private + D1Array dsets_; ///< The input data sets + DcArray dcalcs_; ///< Distance calc for each set }; } diff --git a/src/Cluster/Metric_Data_Euclid.cpp b/src/Cluster/Metric_Data_Euclid.cpp index d9cfe6f98d..5449f4f99a 100644 --- a/src/Cluster/Metric_Data_Euclid.cpp +++ b/src/Cluster/Metric_Data_Euclid.cpp @@ -2,18 +2,6 @@ #include "Metric_Data_Euclid.h" #include "Centroid_Multi.h" -int Cpptraj::Cluster::Metric_Data_Euclid::Init(DsArray const& dsIn) -{ - for (DsArray::const_iterator ds = dsIn.begin(); ds != dsIn.end(); ++ds) { - dsets_.push_back( (DataSet_1D*)*ds ); - if ( dsets_.back()->Meta().IsTorsionArray() ) - dcalcs_.push_back( DistCalc_Dih ); - else - dcalcs_.push_back( DistCalc_Std ); - } - return 0; -} - double Cpptraj::Cluster::Metric_Data_Euclid::FrameDist(int f1, int f2) { double dist = 0.0; DcArray::const_iterator dcalc = dcalcs_.begin(); @@ -49,57 +37,6 @@ double Cpptraj::Cluster::Metric_Data_Euclid::FrameCentroidDist(int f1, Centroid* return sqrt(dist); } -void Cpptraj::Cluster::Metric_Data_Euclid::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { - Centroid_Multi* cent = (Centroid_Multi*)centIn; - cent->Cvals().resize( dsets_.size(), 0.0 ); - cent->SumX().resize( dsets_.size(), 0.0 ); - cent->SumY().resize( dsets_.size(), 0.0 ); - for (unsigned int idx = 0; idx != dsets_.size(); ++idx) { - if (dsets_[idx]->Meta().IsTorsionArray()) - cent->Cvals()[idx] = AvgCalc_Dih(*dsets_[idx], cframesIn, - cent->SumX()[idx], cent->SumY()[idx]); - else - cent->Cvals()[idx] = AvgCalc_Std(*dsets_[idx], cframesIn); - } -// mprintf("DEBUG: Centroids:"); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" %f (sumy=%f sumx=%f)", cent->cvals_[i], cent->Sumy_[i], cent->Sumx_[i]); -// mprintf("\n"); -} - -Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_Data_Euclid::NewCentroid(Cframes const& cframesIn) { - Centroid_Multi* cent = new Centroid_Multi(); - CalculateCentroid(cent, cframesIn); - return cent; -} - -//static const char* OPSTRING[] = {"ADD", "SUBTRACT"}; // DEBUG - -void Cpptraj::Cluster::Metric_Data_Euclid::FrameOpCentroid(int frame, Centroid* centIn, - double oldSize, CentOpType OP) -{ - Centroid_Multi* cent = (Centroid_Multi*)centIn; -// mprintf("DEBUG: Old Centroids:"); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" sumy=%f sumx=%f", cent->Sumy_[i], cent->Sumx_[i]); -// //mprintf(" %f", cent->cvals_[i]); -// mprintf("\n"); - for (unsigned int i = 0; i != dsets_.size(); ++i) - cent->Cvals()[i] = DistCalc_FrameCentroid(dsets_[i]->Dval(frame), - cent->Cvals()[i], dsets_[i]->Meta().IsTorsionArray(), oldSize, OP, - cent->SumX()[i], cent->SumY()[i]); -// mprintf("DEBUG: New Centroids after %s frame %i:", OPSTRING[OP], frame); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" %f", cent->cvals_[i]); -// mprintf("\n"); -} - std::string Cpptraj::Cluster::Metric_Data_Euclid::Description() const { - std::string description("data "); - for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) - if (ds == dsets_.begin()) - description.append( (*ds)->Meta().PrintName() ); - else - description.append( "," + (*ds)->Meta().PrintName() ); - return description; + return SetNames("data (Euclidean) "); } diff --git a/src/Cluster/Metric_Data_Euclid.h b/src/Cluster/Metric_Data_Euclid.h index 0ec620ef91..7e23b230e4 100644 --- a/src/Cluster/Metric_Data_Euclid.h +++ b/src/Cluster/Metric_Data_Euclid.h @@ -20,13 +20,6 @@ class Metric_Data_Euclid : public Metric_Data { std::string Description() const; void Info() const; unsigned int Ntotal() const; - // ------------------------------------------- - int Init(DsArray const&); - private: - typedef std::vector D1Array; - D1Array dsets_; - typedef std::vector DcArray; - DcArray dcalcs_; }; } diff --git a/src/cpptrajdepend b/src/cpptrajdepend index df9db35c40..05a048f11a 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -152,7 +152,7 @@ Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIte Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h -Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h +Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h From 6bf893ecc0ccd8fcfa5da95381955ad38552ee81 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 14:03:10 -0500 Subject: [PATCH 157/417] DRR - Cpptraj: Add Manhattan distance metric --- src/Cluster/Metric.h | 2 +- src/Cluster/Metric_Data.cpp | 25 +++++++++++++++ src/Cluster/Metric_Data.h | 5 ++- src/Cluster/Metric_Data_Euclid.cpp | 5 +++ src/Cluster/Metric_Data_Euclid.h | 5 --- src/Cluster/Metric_Data_Manhattan.cpp | 44 +++++++++++++++++++++++++++ src/Cluster/Metric_Data_Manhattan.h | 23 ++++++++++++++ src/cpptrajdepend | 5 +-- src/cpptrajfiles | 1 + 9 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 src/Cluster/Metric_Data_Manhattan.cpp create mode 100644 src/Cluster/Metric_Data_Manhattan.h diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index b318418ed2..8bf3b98407 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -15,7 +15,7 @@ const int UNCLASSIFIED = -2; /// Abstract base class for calculating distance between points or determining centroid. class Metric { public: - enum Type { RMS=0, DME, SRMSD, EUCLID, MATRIX2D }; + enum Type { RMS=0, DME, SRMSD, EUCLID, MANHATTAN, MATRIX2D }; enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; /// CONSTRUCTOR diff --git a/src/Cluster/Metric_Data.cpp b/src/Cluster/Metric_Data.cpp index 580e944264..6111a378fb 100644 --- a/src/Cluster/Metric_Data.cpp +++ b/src/Cluster/Metric_Data.cpp @@ -2,10 +2,17 @@ #include "Metric_Data.h" #include "Centroid_Multi.h" #include "../Constants.h" // RADDEG, DEGRAD +#include "../CpptrajStdio.h" int Cpptraj::Cluster::Metric_Data::Init(DsArray const& dsIn) { + ntotal_ = 0; for (DsArray::const_iterator ds = dsIn.begin(); ds != dsIn.end(); ++ds) { + if ( (*ds)->Group() != DataSet::SCALAR_1D) { + mprinterr("Error: Set '%s' is not 1D scalar - cannot use for clustering.\n", + (*ds)->legend()); + return 1; + } dsets_.push_back( (DataSet_1D*)*ds ); if ( dsets_.back()->Meta().IsTorsionArray() ) dcalcs_.push_back( DistCalc_Dih ); @@ -15,6 +22,24 @@ int Cpptraj::Cluster::Metric_Data::Init(DsArray const& dsIn) return 0; } +/** Total number of points is number in smallest set. */ +int Cpptraj::Cluster::Metric_Data::Setup() { + ntotal_ = 0; + for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) + { + if (ntotal_ == 0) + ntotal_ = (*ds)->Size(); + else { + if ( (*ds)->Size() < ntotal_ ) { + mprintf("Warning: Set '%s' size %zu is smaller than current size %u.\n", + (*ds)->legend(), (*ds)->Size(), ntotal_); + ntotal_ = (*ds)->Size(); + } + } + } + return 0; +} + /// Calculate smallest difference between two angles (in degrees). double Cpptraj::Cluster::Metric_Data::DistCalc_Dih(double d1, double d2) { double diff = fabs(d1 - d2); diff --git a/src/Cluster/Metric_Data.h b/src/Cluster/Metric_Data.h index 123f3d5d16..a399958391 100644 --- a/src/Cluster/Metric_Data.h +++ b/src/Cluster/Metric_Data.h @@ -9,15 +9,17 @@ namespace Cluster { /// Abstract base class for Metrics that use scalar DataSets class Metric_Data : public Metric { public: - Metric_Data(Type t) : Metric(t) {} + Metric_Data(Type t) : Metric(t), ntotal_(0) {} virtual ~Metric_Data() {} /// Input to Metric_Data typedef std::vector DsArray; // ----- Metric ------------------------------ + int Setup(); void CalculateCentroid(Centroid*, Cframes const&); Centroid* NewCentroid(Cframes const&); void FrameOpCentroid(int, Centroid*, double, CentOpType); + unsigned int Ntotal() const { return ntotal_; } // ------------------------------------------- int Init(DsArray const&); protected: @@ -34,6 +36,7 @@ class Metric_Data : public Metric { // TODO private D1Array dsets_; ///< The input data sets DcArray dcalcs_; ///< Distance calc for each set + unsigned int ntotal_; ///< Total number of data points in the smallest set }; } diff --git a/src/Cluster/Metric_Data_Euclid.cpp b/src/Cluster/Metric_Data_Euclid.cpp index 5449f4f99a..e6d5a1f916 100644 --- a/src/Cluster/Metric_Data_Euclid.cpp +++ b/src/Cluster/Metric_Data_Euclid.cpp @@ -1,6 +1,7 @@ #include // sqrt #include "Metric_Data_Euclid.h" #include "Centroid_Multi.h" +#include "../CpptrajStdio.h" double Cpptraj::Cluster::Metric_Data_Euclid::FrameDist(int f1, int f2) { double dist = 0.0; @@ -40,3 +41,7 @@ double Cpptraj::Cluster::Metric_Data_Euclid::FrameCentroidDist(int f1, Centroid* std::string Cpptraj::Cluster::Metric_Data_Euclid::Description() const { return SetNames("data (Euclidean) "); } + +void Cpptraj::Cluster::Metric_Data_Euclid::Info() const { + mprintf("\tMetric: Euclidean distance (%zu sets)\n", dsets_.size()); +} diff --git a/src/Cluster/Metric_Data_Euclid.h b/src/Cluster/Metric_Data_Euclid.h index 7e23b230e4..b9bbb38eba 100644 --- a/src/Cluster/Metric_Data_Euclid.h +++ b/src/Cluster/Metric_Data_Euclid.h @@ -9,17 +9,12 @@ class Metric_Data_Euclid : public Metric_Data { public: Metric_Data_Euclid() : Metric_Data(EUCLID) {} // ----- Metric ------------------------------ - int Setup(); double FrameDist(int, int); double CentroidDist( Centroid*, Centroid* ); double FrameCentroidDist(int, Centroid*); - void CalculateCentroid(Centroid*, Cframes const&); - Centroid* NewCentroid(Cframes const&); Metric* Copy() { return new Metric_Data_Euclid( *this ); } - void FrameOpCentroid(int, Centroid*, double, CentOpType); std::string Description() const; void Info() const; - unsigned int Ntotal() const; }; } diff --git a/src/Cluster/Metric_Data_Manhattan.cpp b/src/Cluster/Metric_Data_Manhattan.cpp new file mode 100644 index 0000000000..62fb25d33d --- /dev/null +++ b/src/Cluster/Metric_Data_Manhattan.cpp @@ -0,0 +1,44 @@ +#include // fabs +#include "Metric_Data_Manhattan.h" +#include "Centroid_Multi.h" +#include "../CpptrajStdio.h" + +double Cpptraj::Cluster::Metric_Data_Manhattan::FrameDist(int f1, int f2) { + double dist = 0.0; + DcArray::const_iterator dcalc = dcalcs_.begin(); + for (D1Array::iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds, ++dcalc) { + dist += fabs( (*dcalc)((*ds)->Dval(f1), (*ds)->Dval(f2)) ); + } + return dist; +} + +double Cpptraj::Cluster::Metric_Data_Manhattan::CentroidDist(Centroid* c1, Centroid* c2) { + double dist = 0.0; + Centroid_Multi::Darray::const_iterator c2val = ((Centroid_Multi*)c2)->Cvals().begin(); + DcArray::const_iterator dcalc = dcalcs_.begin(); + for (Centroid_Multi::Darray::const_iterator c1val = ((Centroid_Multi*)c1)->Cvals().begin(); + c1val != ((Centroid_Multi*)c1)->Cvals().end(); + ++c1val, ++dcalc) + { + dist += fabs( (*dcalc)(*c1val, *(c2val++)) ); + } + return dist; +} + +double Cpptraj::Cluster::Metric_Data_Manhattan::FrameCentroidDist(int f1, Centroid* c1) { + double dist = 0.0; + Centroid_Multi::Darray::const_iterator c1val = ((Centroid_Multi*)c1)->Cvals().begin(); + DcArray::const_iterator dcalc = dcalcs_.begin(); + for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) { + dist += fabs( (*dcalc)((*ds)->Dval(f1), *(c1val++)) ); + } + return dist; +} + +std::string Cpptraj::Cluster::Metric_Data_Manhattan::Description() const { + return SetNames("data (Manhattan) "); +} + +void Cpptraj::Cluster::Metric_Data_Manhattan::Info() const { + mprintf("\tMetric: Manhattan distance (%zu sets)\n", dsets_.size()); +} diff --git a/src/Cluster/Metric_Data_Manhattan.h b/src/Cluster/Metric_Data_Manhattan.h new file mode 100644 index 0000000000..e7dcecccab --- /dev/null +++ b/src/Cluster/Metric_Data_Manhattan.h @@ -0,0 +1,23 @@ +#ifndef INC_CLUSTER_METRIC_DATA_MANHATTAN +#define INC_CLUSTER_METRIC_DATA_MANHATTAN +#include "Metric_Data.h" +namespace Cpptraj { +namespace Cluster { + +/// Metric for scalar DataSet(s), Manhattan distance. +class Metric_Data_Manhattan : public Metric_Data { + public: + Metric_Data_Manhattan() : Metric_Data(MANHATTAN) {} + // ----- Metric ------------------------------ + double FrameDist(int, int); + double CentroidDist( Centroid*, Centroid* ); + double FrameCentroidDist(int, Centroid*); + Centroid* NewCentroid(Cframes const&); + Metric* Copy() { return new Metric_Data_Manhattan( *this ); } + std::string Description() const; + void Info() const; +}; + +} +} +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 05a048f11a..c5c6dbcbc7 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -152,8 +152,9 @@ Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIte Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h -Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h -Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h +Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h +Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h +Cluster/Metric_Data_Manhattan.o : Cluster/Metric_Data_Manhattan.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 8688740e7b..a68370a4c8 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -13,6 +13,7 @@ CLUSTER_SOURCES= \ Cluster/List.cpp \ Cluster/Metric_Data.cpp \ Cluster/Metric_Data_Euclid.cpp \ + Cluster/Metric_Data_Manhattan.cpp \ Cluster/Metric_DME.cpp \ Cluster/Metric_RMS.cpp \ Cluster/Node.cpp \ From f50a61fd2a4df740fd6694797172d411afc2aab3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 14:05:15 -0500 Subject: [PATCH 158/417] DRR - Cpptraj: Enable Manhattan metric --- src/Cluster/Control.cpp | 8 +++++--- src/Cluster/Metric_Data_Manhattan.h | 1 - src/cpptrajdepend | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index a4dd1cac3f..d2f075d534 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -7,6 +7,7 @@ #include "Metric_RMS.h" #include "Metric_DME.h" #include "Metric_Data_Euclid.h" +#include "Metric_Data_Manhattan.h" // Algorithms #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" @@ -215,9 +216,10 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type { Metric* met = 0; switch (mtype) { - case Metric::RMS : met = new Metric_RMS(); break; - case Metric::DME : met = new Metric_DME(); break; - case Metric::EUCLID : met = new Metric_Data_Euclid(); break; + case Metric::RMS : met = new Metric_RMS(); break; + case Metric::DME : met = new Metric_DME(); break; + case Metric::EUCLID : met = new Metric_Data_Euclid(); break; + case Metric::MANHATTAN : met = new Metric_Data_Manhattan(); break; default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); } return met; diff --git a/src/Cluster/Metric_Data_Manhattan.h b/src/Cluster/Metric_Data_Manhattan.h index e7dcecccab..c465ad1d0b 100644 --- a/src/Cluster/Metric_Data_Manhattan.h +++ b/src/Cluster/Metric_Data_Manhattan.h @@ -12,7 +12,6 @@ class Metric_Data_Manhattan : public Metric_Data { double FrameDist(int, int); double CentroidDist( Centroid*, Centroid* ); double FrameCentroidDist(int, Centroid*); - Centroid* NewCentroid(Cframes const&); Metric* Copy() { return new Metric_Data_Manhattan( *this ); } std::string Description() const; void Info() const; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index c5c6dbcbc7..406c01e939 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -148,7 +148,7 @@ Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/ Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h From 54554b9c5f5e1a7f316c4594dafd6727f29bfa9d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 14:25:22 -0500 Subject: [PATCH 159/417] DRR - Cpptraj: Symmetric RMSD metric --- src/Cluster/Metric_SRMSD.cpp | 130 +++++++++++++++++++++++++++++++++++ src/Cluster/Metric_SRMSD.h | 37 ++++++++++ src/cpptrajdepend | 1 + src/cpptrajfiles | 1 + 4 files changed, 169 insertions(+) create mode 100644 src/Cluster/Metric_SRMSD.cpp create mode 100644 src/Cluster/Metric_SRMSD.h diff --git a/src/Cluster/Metric_SRMSD.cpp b/src/Cluster/Metric_SRMSD.cpp new file mode 100644 index 0000000000..8565f4d908 --- /dev/null +++ b/src/Cluster/Metric_SRMSD.cpp @@ -0,0 +1,130 @@ +#include "Metric_SRMSD.h" +#include "Centroid_Coord.h" +#include "../CpptrajStdio.h" + +int Cpptraj::Cluster::Metric_SRMSD::Init(DataSet_Coords* dIn, AtomMask const& maskIn, + bool nofit, bool useMass, int debugIn) +{ + // TODO better error handles + if (dIn == 0) { + mprinterr("Internal Error: Metric_SRMSD::Init() called with null data set.\n"); + return 1; + } + coords_ = dIn; + mask_ = maskIn; + SRMSD_ = SymmetricRmsdCalc(mask_, !nofit, useMass, coords_->Top(), debugIn); + return 0; +} + +int Cpptraj::Cluster::Metric_SRMSD::Setup() { + if (coords_->Top().SetupIntegerMask( mask_ )) return 1; + mprintf("DEBUG: SRMSD metric topology: %s %s %i\n", coords_->legend(), + coords_->Top().c_str(), coords_->Top().Natom()); + frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms()); + frm2_ = frm1_; + return 0; +} + +double Cpptraj::Cluster::Metric_SRMSD::FrameDist(int f1, int f2) { + coords_->GetFrame( f1, frm1_, mask_ ); + coords_->GetFrame( f2, frm2_, mask_ ); + return SRMSD_.SymmRMSD(frm1_, frm2_); +} + +double Cpptraj::Cluster::Metric_SRMSD::CentroidDist(Centroid* c1, Centroid* c2) { + // Centroid is already at origin. + return SRMSD_.SymmRMSD_CenteredRef( ((Centroid_Coord*)c1)->Cframe(), + ((Centroid_Coord*)c2)->Cframe() ); +} + +double Cpptraj::Cluster::Metric_SRMSD::FrameCentroidDist(int f1, Centroid* c1) { + coords_->GetFrame( f1, frm1_, mask_ ); + // Centroid is already at origin. + return SRMSD_.SymmRMSD_CenteredRef( frm1_, ((Centroid_Coord*)c1)->Cframe() ); +} + +/** Compute the centroid (avg) coords for each atom from all frames in this + * cluster. If fitting, RMS fit to centroid as it is being built. + */ +void Cpptraj::Cluster::Metric_SRMSD::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { + Matrix_3x3 Rot; + Vec3 Trans; + Centroid_Coord* cent = (Centroid_Coord*)centIn; + // Reset atom count for centroid. + cent->Cframe().ClearAtoms(); + for (Cframes_it frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) + { + coords_->GetFrame( *frm, frm1_, mask_ ); + if (cent->Cframe().empty()) { + cent->Cframe() = frm1_; + if (SRMSD_.Fit()) + cent->Cframe().CenterOnOrigin(SRMSD_.UseMass()); + } else { + SRMSD_.SymmRMSD_CenteredRef( frm1_, cent->Cframe() ); + // Remap atoms + frm2_.SetCoordinatesByMap( frm1_, SRMSD_.AMap() ); + if (SRMSD_.Fit()) { + frm2_.Translate( SRMSD_.TgtTrans() ); + frm2_.Rotate( SRMSD_.RotMatrix() ); + } + cent->Cframe() += frm2_; + } + } + cent->Cframe().Divide( (double)cframesIn.size() ); + //mprintf("\t\tFirst 3 centroid coords (of %i): %f %f %f\n", cent->cframe_.Natom(), + // cent->cent->cframe_[0], cent->cframe_[1],cent->cframe_[2]); +} + +Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_SRMSD::NewCentroid( Cframes const& cframesIn ) { + // TODO: Incorporate mass? + Centroid_Coord* cent = new Centroid_Coord( mask_.Nselected() ); + CalculateCentroid( cent, cframesIn ); + return cent; +} + +void Cpptraj::Cluster::Metric_SRMSD::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, + CentOpType OP) +{ + Matrix_3x3 Rot; + Vec3 Trans; + Centroid_Coord* cent = (Centroid_Coord*)centIn; + coords_->GetFrame( frame, frm1_, mask_ ); + SRMSD_.SymmRMSD_CenteredRef( frm1_, cent->Cframe() ); + // Remap atoms + frm2_.SetCoordinatesByMap( frm1_, SRMSD_.AMap() ); + if (SRMSD_.Fit()) { + frm2_.Translate( SRMSD_.TgtTrans() ); + frm2_.Rotate( SRMSD_.RotMatrix() ); + } + cent->Cframe().Multiply( oldSize ); + if (OP == ADDFRAME) { + cent->Cframe() += frm2_; + cent->Cframe().Divide( oldSize + 1 ); + } else { // SUBTRACTFRAME + cent->Cframe() -= frm2_; + cent->Cframe().Divide( oldSize - 1 ); + } +} + +/** \return Description of symmetric RMS calc. */ +std::string Cpptraj::Cluster::Metric_SRMSD::Description() const { + std::string description("srmsd " + mask_.MaskExpression()); + if (!SRMSD_.Fit()) description.append(" nofit"); + if (SRMSD_.UseMass()) description.append(" mass"); + return description; +} + +void Cpptraj::Cluster::Metric_SRMSD::Info() const { + mprintf("\tMetric: Symmetric RMSD"); + if (mask_.MaskExpression() == "*") + mprintf(" (all atoms)"); + else + mprintf(" (mask '%s')", mask_.MaskString()); + if (SRMSD_.UseMass()) + mprintf(", mass-weighted"); + if (!SRMSD_.Fit()) + mprintf(", no fitting"); + else + mprintf(" best-fit"); + mprintf("\n"); +} diff --git a/src/Cluster/Metric_SRMSD.h b/src/Cluster/Metric_SRMSD.h new file mode 100644 index 0000000000..9e847e94dc --- /dev/null +++ b/src/Cluster/Metric_SRMSD.h @@ -0,0 +1,37 @@ +#ifndef INC_CLUSTER_METRIC_SRMSD_H +#define INC_CLUSTER_METRIC_SRMSD_H +#include "Metric.h" +#include "../AtomMask.h" +#include "../DataSet_Coords.h" +#include "../SymmetricRmsdCalc.h" +namespace Cpptraj { +namespace Cluster { + +/// Symmetry-corrected RMS distance calc for Coords DataSet. +class Metric_SRMSD : public Metric { + public: + Metric_SRMSD() : Metric(SRMSD) {} + int Init(DataSet_Coords*,AtomMask const&,bool,bool,int); + // ----- Metric ------------------------------ + int Setup(); + double FrameDist(int, int); + double CentroidDist( Centroid*, Centroid* ); + double FrameCentroidDist(int, Centroid*); + void CalculateCentroid(Centroid*, Cframes const&); + Centroid* NewCentroid(Cframes const&); + void FrameOpCentroid(int, Centroid*, double, CentOpType); + Metric* Copy() { return new Metric_SRMSD( * this ); } + std::string Description() const; + void Info() const; + unsigned int Ntotal() const { return (unsigned int)coords_->Size(); } + private: + DataSet_Coords* coords_; + AtomMask mask_; + SymmetricRmsdCalc SRMSD_; + Frame frm1_; + Frame frm2_; +}; + +} +} +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 406c01e939..e5d5d24fe8 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -156,6 +156,7 @@ Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../ArgList.h Cluster/../ Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.o : Cluster/Metric_Data_Manhattan.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h +Cluster/Metric_SRMSD.o : Cluster/Metric_SRMSD.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_SRMSD.h Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index a68370a4c8..588d7588fa 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -16,6 +16,7 @@ CLUSTER_SOURCES= \ Cluster/Metric_Data_Manhattan.cpp \ Cluster/Metric_DME.cpp \ Cluster/Metric_RMS.cpp \ + Cluster/Metric_SRMSD.cpp \ Cluster/Node.cpp \ Cluster/Output.cpp \ Cluster/PairwiseMatrix.cpp \ From a172006eb67bcca853eec5655241c5b44dc750a1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 14:26:18 -0500 Subject: [PATCH 160/417] DRR - Cpptraj: Enable symmetric rmsd metric --- src/Cluster/Control.cpp | 2 ++ src/cpptrajdepend | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index d2f075d534..6dded3b543 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -8,6 +8,7 @@ #include "Metric_DME.h" #include "Metric_Data_Euclid.h" #include "Metric_Data_Manhattan.h" +#include "Metric_SRMSD.h" // Algorithms #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" @@ -218,6 +219,7 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type switch (mtype) { case Metric::RMS : met = new Metric_RMS(); break; case Metric::DME : met = new Metric_DME(); break; + case Metric::SRMSD : met = new Metric_SRMSD(); break; case Metric::EUCLID : met = new Metric_Data_Euclid(); break; case Metric::MANHATTAN : met = new Metric_Data_Manhattan(); break; default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index e5d5d24fe8..c3bf38ea50 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -148,7 +148,7 @@ Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/ Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h From fbe93ec3c26d81f0d3c6a397a6df95e22fb99f07 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 14:29:25 -0500 Subject: [PATCH 161/417] DRR - Cpptraj: Add srmsd metric init --- src/Cluster/Control.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 6dded3b543..f7ac298585 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -278,6 +278,9 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, err = ((Metric_RMS*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass); break; case Metric::DME : err = ((Metric_DME*)metric_)->Init(ds, AtomMask(maskExpr)); break; + case Metric::SRMSD : + err = ((Metric_SRMSD*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass, verbose_); + break; default: mprinterr("Error: Unhandled Metric setup.\n"); err = 1; From 0b3dbfcb3f7fd896c67cbcc2b2127cbdc73919af Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 18 Feb 2019 14:44:44 -0500 Subject: [PATCH 162/417] DRR - Cpptraj: Add setup for data sets --- src/Analysis_Cluster.cpp | 51 ++++++++++++++++++++++++++++++++-------- src/Analysis_Cluster.h | 4 +--- src/Cluster/Control.cpp | 35 ++++++++++++++++++++++++++- src/Cluster/Control.h | 3 +++ src/cpptrajdepend | 4 ++-- 5 files changed, 81 insertions(+), 16 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index d3e3eb7816..c53d9aa7b7 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -1,5 +1,7 @@ #include "Analysis_Cluster.h" #include "CpptrajStdio.h" +#include "DataSet_Coords.h" +#include "Cluster/Metric_Data.h" using namespace Cpptraj::Cluster; @@ -11,17 +13,46 @@ void Analysis_Cluster::Help() const { // Analysis_Cluster::Setup() Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& setup, int debugIn) { - // Attempt to get coords dataset from datasetlist - std::string setname = analyzeArgs.GetStringKey("crdset"); - coords_ = (DataSet_Coords*)setup.DSL().FindCoordsSet( setname ); - if (coords_ == 0) { - mprinterr("Error: Could not locate COORDS set corresponding to %s\n", - setname.c_str()); - return Analysis::ERR; - } + Cpptraj::Cluster::Metric_Data::DsArray cluster_dataset; + DataSet_Coords* coords = 0; + // First check for data + std::string dataSetname = analyzeArgs.GetStringKey("data"); + if (!dataSetname.empty()) { + ArgList dsnames(dataSetname, ","); + DataSetList inputDsets; + for (ArgList::const_iterator name = dsnames.begin(); name != dsnames.end(); ++name) { + DataSetList tempDSL = setup.DSL().GetMultipleSets( *name ); + if (tempDSL.empty()) { + mprinterr("Error: %s did not correspond to any data sets.\n", dataSetname.c_str()); + return Analysis::ERR; + } + inputDsets += tempDSL; + } + for (DataSetList::const_iterator ds = inputDsets.begin(); ds != inputDsets.end(); ++ds) { + // Clustering only allowed on 1D data sets. + if ( (*ds)->Group() != DataSet::SCALAR_1D ) { + mprinterr("Error: Clustering only allowed on 1D scalar data sets, %s is %zuD.\n", + (*ds)->legend(), (*ds)->Ndim()); + return Analysis::ERR; + } + cluster_dataset.push_back( *ds ); + } - if (control_.SetupForCoordsDataSet(coords_, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) - return Analysis::ERR; + if (control_.SetupForDataSets(cluster_dataset, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) + return Analysis::ERR; + } else { + // Attempt to get coords dataset from datasetlist + std::string setname = analyzeArgs.GetStringKey("crdset"); + coords = (DataSet_Coords*)setup.DSL().FindCoordsSet( setname ); + if (coords == 0) { + mprinterr("Error: Could not locate COORDS set corresponding to %s\n", + setname.c_str()); + return Analysis::ERR; + } + + if (control_.SetupForCoordsDataSet(coords, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) + return Analysis::ERR; + } control_.Info(); diff --git a/src/Analysis_Cluster.h b/src/Analysis_Cluster.h index 352fb3ebb7..74b0a75a16 100644 --- a/src/Analysis_Cluster.h +++ b/src/Analysis_Cluster.h @@ -2,11 +2,10 @@ #define INC_ANALYSIS_CLUSTER_H #include "Analysis.h" #include "Cluster/Control.h" -#include "DataSet_Coords.h" /// class Analysis_Cluster : public Analysis { public: - Analysis_Cluster() : coords_(0), masterDSL_(0) {} + Analysis_Cluster() : masterDSL_(0) {} DispatchObject* Alloc() const { return (DispatchObject*)new Analysis_Cluster(); } void Help() const; @@ -15,7 +14,6 @@ class Analysis_Cluster : public Analysis { private: Cpptraj::Cluster::Control control_; - DataSet_Coords* coords_; DataSetList* masterDSL_; }; #endif diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index f7ac298585..809c71188f 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -230,6 +230,38 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = "{dme|rms|srmsd} [mass] [nofit] []"; +/** Set up clustering for 1D scalar sets. */ +int Cpptraj::Cluster::Control::SetupForDataSets(Metric_Data::DsArray const& inputSets, + ArgList& analyzeArgs, + DataSetList& DSL, + DataFileList& DFL, + int verboseIn) +{ + verbose_ = verboseIn; + if (inputSets.empty()) { + mprinterr("Internal Error: Control::SetupForDataSets() called with no DataSets.\n"); + return 1; + } + Metric::Type mtype = Metric::EUCLID; // Default + if (analyzeArgs.hasKey("euclid")) + mtype = Metric::EUCLID; + else if (analyzeArgs.hasKey("manhattan")) + mtype = Metric::MANHATTAN; + if (metric_ != 0) delete metric_; + metric_ = 0; + metric_ = AllocateMetric( mtype ); + if (metric_ == 0) return 1; + // Metric init. + int err = ((Metric_Data*)metric_)->Init( inputSets ); + if (err != 0) return 1; + + // No results for data sets yet + if (results_ != 0) delete results_; + results_ = 0; + + return Common(analyzeArgs, DSL, DFL); +} + /** Set up clustering for a COORDS DataSet.*/ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, ArgList& analyzeArgs, @@ -258,7 +290,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, metric_ = 0; metric_ = AllocateMetric( mtype ); if (metric_ == 0) return 1; - // Metric setup. + // Metric init. bool useMass = analyzeArgs.hasKey("mass"); bool nofit = analyzeArgs.hasKey("nofit"); // Get the mask string @@ -291,6 +323,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, } // Set up results for COORDS DataSet + if (results_ != 0) delete results_; results_ = (Results*)new Results_Coords( ds ); if (results_ == 0) return 1; diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 1fcc242f38..cf46c393c8 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -7,6 +7,7 @@ #include "Metric.h" #include "Results.h" #include "BestReps.h" +#include "Metric_Data.h" #include "../Timer.h" #include "../DataSetList.h" #include "../DataFileList.h" @@ -31,6 +32,8 @@ class Control { /// For determining how frames to cluster will be determined. enum FrameSelectType { UNSPECIFIED = 0, FROM_CACHE }; + int SetupForDataSets(Metric_Data::DsArray const&, ArgList&, DataSetList&, DataFileList&, int); + int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); /// Provide information on how clustering calculation is currently set up. void Info() const; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index c3bf38ea50..052bd0397b 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -88,7 +88,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Sieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Sieve.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.h ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h ComplexArray.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_float.h DataSet_integer.h DataSet_string.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 ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h Vec3.h @@ -166,7 +166,7 @@ ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants. Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constraints.h Control.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h Ewald.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h Vec3.h Control.o : Control.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h BaseIOtype.h Box.h CharMask.h Control.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataIO.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOut.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h Parallel.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h TrajectoryIO.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h VariableArray.h Vec3.h From a0fa96566a2ba97a91df20e45b1cdc24db353fcf Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 09:02:28 -0500 Subject: [PATCH 163/417] DRR - Cpptraj: Add Kmeans algorithm --- src/Cluster/Algorithm_Kmeans.cpp | 295 +++++++++++++++++++++++++++++++ src/Cluster/Algorithm_Kmeans.h | 36 ++++ 2 files changed, 331 insertions(+) create mode 100644 src/Cluster/Algorithm_Kmeans.cpp create mode 100644 src/Cluster/Algorithm_Kmeans.h diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp new file mode 100644 index 0000000000..ec18856ebf --- /dev/null +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -0,0 +1,295 @@ +#include "Algorithm_Kmeans.h" +#include "../CpptrajStdio.h" +#include "../ProgressBar.h" + +Cpptraj::Cluster::Algorithm_Kmeans::Algorithm_Kmeans() : + Algorithm(KMEANS), + nclusters_(0), + kseed_(-1), + maxIt_(100), + mode_(SEQUENTIAL), + clusterToClusterCentroid_(false) +{} + +void Cpptraj::Cluster::Algorithm_Kmeans::Help() { + mprintf("\t[kmeans clusters [randompoint [kseed ]] [maxit ]\n"); +} + +// SetupCluster() +int Cpptraj::Cluster::Algorithm_Kmeans::Setup(ArgList& analyzeArgs) { + nclusters_ = analyzeArgs.getKeyInt("clusters", -1); + if (nclusters_ < 2) { + mprinterr("Error: Specify number of clusters > 1 for K-means algorithm.\n"); + return 1; + } + if (analyzeArgs.hasKey("randompoint")) + mode_ = RANDOM; + else + mode_ = SEQUENTIAL; + kseed_ = analyzeArgs.getKeyInt("kseed", -1); + maxIt_ = analyzeArgs.getKeyInt("maxit", 100); + return 0; +} + +// ClusteringInfo() +void Cpptraj::Cluster::Algorithm_Kmeans::Info() const { + mprintf("\tK-MEANS: Looking for %i clusters.\n", nclusters_); + if (mode_ == SEQUENTIAL) + mprintf("\t\tSequentially modify each point.\n"); + else + mprintf("\t\tRandomly pick points for modification.\n"); + if (kseed_ != -1 && mode_ == RANDOM) + mprintf("\t\tSeed for random number generator: %i\n", kseed_); + mprintf("\tCluster to cluster distance will be based on"); + if (clusterToClusterCentroid_) + mprintf(" best representative from cluster.\n"); + else + mprintf(" cluster centroids.\n"); +} + +// ClusterResults() +void Cpptraj::Cluster::Algorithm_Kmeans::Results(CpptrajFile& outfile) const { + outfile.Printf("#Algorithm: Kmeans nclusters %i maxit %i\n", nclusters_, maxIt_); +} + +// Cpptraj::Cluster::Algorithm_Kmeans::Cluster() +int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, + Cframes const& framesToCluster, + PairwiseMatrix const& pmatrix) +{ + // TODO handle case where there are existing clusters. + if (!clusters.empty()) { + mprinterr("Internal Error: Kmeans not set up for existing clusters yet.\n"); + return 1; + } + + // Determine seeds + FindKmeansSeeds( framesToCluster, pmatrix ); + + if (mode_ == RANDOM) + RN_.rn_set( kseed_ ); + + int pointCount = (int)framesToCluster.size(); + + // This array will hold the indices of the points to process each iteration. + // If sequential this is just 0 -> pointCount. If random this will be + // reassigned each iteration. + Iarray PointIndices; + PointIndices.reserve( pointCount ); + for (int processIdx = 0; processIdx != pointCount; processIdx++) + PointIndices.push_back( processIdx ); + + // Add the seed clusters + for (Iarray::const_iterator seedIdx = SeedIndices_.begin(); + seedIdx != SeedIndices_.end(); ++seedIdx) + { + int seedFrame = framesToCluster[ *seedIdx ]; + // A centroid is created for new clusters. + clusters.AddCluster( Node(pmatrix.MetricPtr(), Cframes(1, seedFrame), clusters.Nclusters()) ); + // NOTE: No need to calc best rep frame, only 1 frame. + if (debug_ > 0) + mprintf("Put frame %i in cluster %i (seed index=%i).\n", + seedFrame, clusters.back().Num(), *seedIdx); + } + // Assign points in 3 passes. If a point looked like it belonged to cluster A + // at first, but then we added many other points and altered our cluster + // shapes, its possible that we will want to reassign it to cluster B. + for (int iteration = 0; iteration != maxIt_; iteration++) + { + if (mode_ == RANDOM) + ShufflePoints( PointIndices ); + // Add each point to an existing cluster, and recompute centroid + mprintf("\tRound %i: ", iteration); + ProgressBar progress( PointIndices.size() ); + int Nchanged = 0; + int prog = 0; + for (Iarray::const_iterator pointIdx = PointIndices.begin(); + pointIdx != PointIndices.end(); ++pointIdx, ++prog) + { + if (debug_ < 1) progress.Update( prog ); + int oldClusterIdx = -1; +// if ( iteration != 0 || mode_ != SEQUENTIAL) // FIXME: Should this really happen for RANDOM +// { + int pointFrame = framesToCluster[ *pointIdx ]; + if (debug_ > 0) + mprintf("DEBUG: Processing frame %i (index %i)\n", pointFrame, *pointIdx); + bool pointWasYanked = true; + if (iteration > 0) { + // Yank this point out of its cluster, recompute the centroid + for (List::cluster_it C1 = clusters.begin(); C1 != clusters.end(); ++C1) + { + if (C1->HasFrame( pointFrame )) + { + // If this point is alone in its cluster its in the right place + if (C1->Nframes() == 1) { + pointWasYanked = false; + continue; // FIXME: should this be a break? + } + //oldBestRep = C1->BestRepFrame(); + oldClusterIdx = C1->Num(); + C1->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), pointFrame ); // TEST +// C1->RemoveFrameFromCluster( pointFrame ); + //newBestRep = C1->FindBestRepFrame(); +// C1->CalculateCentroid( pmatrix.MetricPtr() ); + if (debug_ > 0) + mprintf("Remove Frame %i from cluster %i\n", pointFrame, C1->Num()); + //if (clusterToClusterCentroid_) { + // if (oldBestRep != NewBestRep) + // C1->AlignToBestRep( pmatrix.MetricPtr() ); // FIXME: Only relevant for COORDS dist? + // C1->CalculateCentroid( pmatrix.MetricPtr() ); // FIXME: Seems unnessecary to align prior + //} + } + } + } else { + // First iteration. If this point is already in a cluster it is a seed. + for (List::cluster_it C1 = clusters.begin(); C1 != clusters.end(); ++C1) + { + if (C1->HasFrame( pointFrame )) { + pointWasYanked = false; + if (debug_ > 0) + mprintf("Frame %i was already used to seed cluster %i\n", + pointFrame, C1->Num()); + continue; // FIXME break? + } + } + } + if (pointWasYanked) { + // Find out what cluster this point is now closest to. + double closestDist = -1.0; + List::cluster_it closestCluster = clusters.begin(); + for (List::cluster_it C1 = clusters.begin(); C1 != clusters.end(); ++C1) + { + double dist = pmatrix.MetricPtr()->FrameCentroidDist(pointFrame, C1->Cent()); + if (closestDist < 0.0 || dist < closestDist) + { + closestDist = dist; + closestCluster = C1; + } + } + //oldBestRep = closestCluster->BestRepFrame(); + closestCluster->AddFrameUpdateCentroid( pmatrix.MetricPtr(), pointFrame ); // TEST +// closestCluster->AddFrameToCluster( pointFrame ); + //newBestRep = closestCluster->FindBestFrameFrame(); +// closestCluster->CalculateCentroid( pmatrix.MetricPtr() ); + if (closestCluster->Num() != oldClusterIdx) + { + Nchanged++; + if (debug_ > 0) + mprintf("Remove Frame %i from cluster %i, but add to cluster %i (dist= %f).\n", + pointFrame, oldClusterIdx, closestCluster->Num(), closestDist); + } else { + if (debug_ > 0) + mprintf("Frame %i staying in cluster %i\n", pointFrame, closestCluster->Num()); + } + if (clusterToClusterCentroid_) { + //if (oldBestRep != NewBestRep) { + // C1->AlignToBestRep( pmatrix.MetricPtr() ); // FIXME: Only relevant for COORDS dist? + // C1->CalculateCentroid( pmatrix.MetricPtr() ); // FIXME: Seems unnessecary to align prior + //} + } + } +// } + } // END loop over points to cluster + if (Nchanged == 0) { + mprintf("\tK-means round %i: No change. Skipping the rest of the iterations.\n", iteration); + break; + } else + mprintf("\tK-means round %i: %i points changed cluster assignment.\n", iteration, Nchanged); + } // END k-means iterations + // Remove any empty clusters + // FIXME: Will there ever be empty clusters? + clusters.RemoveEmptyClusters(); + // NOTE in PTRAJ here align all frames to best rep + return 0; +} + +// FindKmeansSeeds() +/** Find some seed-points for K-means clustering. Take the first point as an + * arbitrary first choice. Then, at each iteration, add the point whose total + * distance from our set of seeds is as large as possible. + */ +int Cpptraj::Cluster::Algorithm_Kmeans::FindKmeansSeeds(Cframes const& FramesToCluster, + PairwiseMatrix const& pmatrix) +{ + // SeedIndices will hold indices into FramesToCluster + SeedIndices_.resize( nclusters_, 1 ); // 1 used to be consistent with ptraj + + double bestDistance = 0.0; + int frameCount = (int)FramesToCluster.size(); + for (int frameIdx = 0; frameIdx != frameCount; frameIdx++) + { + int seedFrame = FramesToCluster[ frameIdx ]; + for (int candidateIdx = frameIdx; candidateIdx < frameCount; candidateIdx++) + { + int candidateFrame = FramesToCluster[ candidateIdx ]; + double dist = pmatrix.Frame_Distance( seedFrame, candidateFrame ); + if (dist > bestDistance) + { + bestDistance = dist; + SeedIndices_[0] = frameIdx; + SeedIndices_[1] = candidateIdx; + } + } + } + + for (int seedIdx = 2; seedIdx != nclusters_; seedIdx++) + { + bestDistance = 0.0; + int bestIdx = 0; + for (int candidateIdx = 0; candidateIdx < frameCount; candidateIdx++) + { + // Make sure this candidate isnt already a seed + bool skipCandidate = false; + for (int checkIdx = 0; checkIdx != seedIdx; checkIdx++) + { + if (SeedIndices_[checkIdx] == candidateIdx) { + skipCandidate = true; + break; + } + } + if (!skipCandidate) { + // Get the closest distance from this candidate to a current seed + int candidateFrame = FramesToCluster[ candidateIdx ]; + double nearestDist = -1.0; + for (int checkIdx = 0; checkIdx != seedIdx; checkIdx++) + { + int seedFrame = FramesToCluster[ SeedIndices_[checkIdx] ]; + double dist = pmatrix.Frame_Distance( candidateFrame, seedFrame ); + if (dist < nearestDist || nearestDist < 0.0) + nearestDist = dist; + } + // Is this the best so far? + if (nearestDist > bestDistance) + { + bestDistance = nearestDist; + bestIdx = candidateIdx; + } + } + } + SeedIndices_[seedIdx] = bestIdx; + } + if (debug_ > 0) + for (unsigned int si = 0; si != SeedIndices_.size(); si++) + mprintf("DEBUG:\t\tSeedIndices[%u]= %i\n", si, SeedIndices_[si]); + return 0; +} + +/** Use modern version of the Fisher-Yates shuffle to randomly reorder the + * given points. + */ +void Cpptraj::Cluster::Algorithm_Kmeans::ShufflePoints( Iarray& PointIndices ) { + for (unsigned int i = PointIndices.size() - 1; i != 1; i--) + { // 0 <= j <= i + unsigned int j = (unsigned int)(RN_.rn_gen() * (double)i); + int temp = PointIndices[j]; + PointIndices[j] = PointIndices[i]; + PointIndices[i] = temp; + } + if (debug_ > 0) { + mprintf("DEBUG: Shuffled points:"); + for (Iarray::const_iterator it = PointIndices.begin(); + it != PointIndices.end(); ++it) + mprintf(" %i", *it); + mprintf("\n"); + } +} diff --git a/src/Cluster/Algorithm_Kmeans.h b/src/Cluster/Algorithm_Kmeans.h new file mode 100644 index 0000000000..91ac1612e8 --- /dev/null +++ b/src/Cluster/Algorithm_Kmeans.h @@ -0,0 +1,36 @@ +#ifndef INC_CLUSTER_ALGORITHM_KMEANS_H +#define INC_CLUSTER_ALGORITHM_KMEANS_H +#include "Algorithm.h" +#include "../Random.h" +namespace Cpptraj { +namespace Cluster { + +/// Implement K-means clustering +class Algorithm_Kmeans : public Algorithm { + public: + Algorithm_Kmeans(); + static void Help(); + int Setup(ArgList&); + void Info() const; + void Results(CpptrajFile&) const; + int DoClustering(List&, Cframes const&, PairwiseMatrix const&); + void Timing(double) const {} + private: + typedef std::vector Iarray; + enum KmeansModeType { SEQUENTIAL, RANDOM }; + + int FindKmeansSeeds(Cframes const&, PairwiseMatrix const&); + void ShufflePoints(Iarray&); + + Random_Number RN_; + int nclusters_; ///< Target number of clusters. + int kseed_; + int maxIt_; + Iarray SeedIndices_; + KmeansModeType mode_; + bool clusterToClusterCentroid_; +}; + +} +} +#endif From 5b5bbf80e8e0a56715957036524d29628a50994c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 09:05:11 -0500 Subject: [PATCH 164/417] DRR - Cpptraj: Enable Kmeans --- src/Cluster/Control.cpp | 2 ++ src/Cluster/List.cpp | 11 +++++++++++ src/Cluster/List.h | 4 ++++ src/cpptrajdepend | 3 ++- src/cpptrajfiles | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 809c71188f..18f58d6f59 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -12,6 +12,7 @@ // Algorithms #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" +#include "Algorithm_Kmeans.h" // Results #include "Results_Coords.h" @@ -184,6 +185,7 @@ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algori switch (atype) { case Algorithm::HIERAGGLO : alg = new Algorithm_HierAgglo(); break; case Algorithm::DBSCAN : alg = new Algorithm_DBscan(); break; + case Algorithm::KMEANS : alg = new Algorithm_Kmeans(); break; default : mprinterr("Error: Unhandled Algorithm in AllocateAlgorithm.\n"); } return alg; diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index ae4133a272..7bc1bb9a60 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -65,6 +65,17 @@ void Cpptraj::Cluster::List::UpdateCentroids( Metric* metric ) { } } +/** Remove clusters with no population. */ +void Cpptraj::Cluster::List::RemoveEmptyClusters() { + cluster_it cnode = clusters_.begin(); + while (cnode != clusters_.end()) { + if (cnode->Nframes() == 0) + cnode = clusters_.erase( cnode ); + else + ++cnode; + } +} + // ----------------------------------------------------------------------------- void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric* metricIn) { diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 0b7d9b8d44..9f4d6cc257 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -29,6 +29,8 @@ class List { const cluster_iterator endcluster() const { return clusters_.end(); } /// \return first cluster Node const& front() const { return clusters_.front(); } + /// \return last cluster + Node const& back() const { return clusters_.back(); } /// \return current number of clusters. int Nclusters() const { return (int)clusters_.size(); } /// \return true if no clusters @@ -41,6 +43,8 @@ class List { void AddCluster( Node const& n ) { clusters_.push_back( n ); } /// Remove existing cluster via iterator void RemoveCluster( cluster_it& it ) { clusters_.erase( it ); } + /// Remove clusters with no population + void RemoveEmptyClusters(); /// Generate cluster number vs time data set int CreateCnumVsTime(DataSet_integer*, unsigned int) const; /// Sort clusters by population and renumber. diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 052bd0397b..2e34911fec 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -143,12 +143,13 @@ CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule. Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 588d7588fa..639c3d6fa3 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -3,6 +3,7 @@ CLUSTER_SOURCES= \ Cluster/Algorithm.cpp \ Cluster/Algorithm_DBscan.cpp \ Cluster/Algorithm_HierAgglo.cpp \ + Cluster/Algorithm_Kmeans.cpp \ Cluster/BestReps.cpp \ Cluster/Centroid_Coord.cpp \ Cluster/Cframes.cpp \ From 99de583c0de51c97b615ff3b4e74a60a7d6553dd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 09:31:58 -0500 Subject: [PATCH 165/417] DRR - Cpptraj: Add density peaks algorithm --- src/Cluster/Algorithm_DPeaks.cpp | 865 +++++++++++++++++++++++++++++++ src/Cluster/Algorithm_DPeaks.h | 118 +++++ 2 files changed, 983 insertions(+) create mode 100644 src/Cluster/Algorithm_DPeaks.cpp create mode 100644 src/Cluster/Algorithm_DPeaks.h diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp new file mode 100644 index 0000000000..7b31cda8c8 --- /dev/null +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -0,0 +1,865 @@ +#include // fabs +#include // sort +#include "Algorithm_DPeaks.h" +#include "../CpptrajStdio.h" +#include "../DataSet_Mesh.h" +#include "../ProgressBar.h" + +Cpptraj::Cluster::Algorithm_DPeaks::Algorithm_DPeaks() : + Algorithm(DPEAKS), + densityCut_(-1.0), + distanceCut_(-1.0), + epsilon_(-1.0), + choosePoints_(PLOT_ONLY), + calc_noise_(false), + useGaussianKernel_(false) {} + +void Cpptraj::Cluster::Algorithm_DPeaks::Help() { + mprintf("\t[dpeaks epsilon [noise] [dvdfile ]\n" + "\t [choosepoints {manual | auto}]\n" + "\t [distancecut ] [densitycut ]\n" + "\t [runavg ] [deltafile ] [gauss]]\n"); +} + +int Cpptraj::Cluster::Algorithm_DPeaks::Setup(ArgList& analyzeArgs) { + epsilon_ = analyzeArgs.getKeyDouble("epsilon", -1.0); + if (epsilon_ <= 0.0) { + mprinterr("Error: DPeaks requires epsilon to be set and > 0.0\n" + "Error: Use 'epsilon '\n"); + return 1; + } + densityCut_ = analyzeArgs.getKeyDouble("densitycut", -1.0); + distanceCut_ = analyzeArgs.getKeyDouble("distancecut", -1.0); + calc_noise_ = analyzeArgs.hasKey("noise"); + dvdfile_ = analyzeArgs.GetStringKey("dvdfile"); + rafile_ = analyzeArgs.GetStringKey("runavg"); + radelta_ = analyzeArgs.GetStringKey("deltafile"); + avg_factor_ = analyzeArgs.getKeyInt("avgfactor", -1); + if (avg_factor_ != -1 && avg_factor_ < 1) { + mprinterr("Error: avgfactor must be >= 1.\n"); + return 1; + } + useGaussianKernel_ = analyzeArgs.hasKey("gauss"); + // Determine how peaks will be chosen. Default is not to choose peaks, + // just print out density versus distance for manual choice. + choosePoints_ = PLOT_ONLY; + std::string choose_keyword = analyzeArgs.GetStringKey("choosepoints"); + if (!choose_keyword.empty()) { + if (choose_keyword == "manual") choosePoints_ = MANUAL; + else if (choose_keyword == "auto" ) choosePoints_ = AUTOMATIC; + else { + mprinterr("Error: Unrecognized choosepoints keyword: %s\n", choose_keyword.c_str()); + return 1; + } + } + if (choosePoints_ == PLOT_ONLY && dvdfile_.empty()) + dvdfile_.assign("DensityVsDistance.dat"); + else if ( choosePoints_ == MANUAL && + (distanceCut_ < 0.0 || densityCut_ < 0.0) ) + { + mprinterr("Error: For choosepoints manual must specify distancecut and densitycut.\n"); + return 1; + } + return 0; +} + +void Cpptraj::Cluster::Algorithm_DPeaks::Info() const { + mprintf("---------------------------------------------------------------------------\n" + "Warning: The dpeaks algorithm is still under development. USE WITH CAUTION!\n" + "---------------------------------------------------------------------------\n"); + mprintf("\tDPeaks: Cutoff (epsilon) for determining local density is %g\n", epsilon_); + if (useGaussianKernel_) + mprintf("\t\tDensity will be determined with Gaussian kernels.\n"); + else + mprintf("\t\tDiscrete density calculation.\n"); + if (calc_noise_) + mprintf("\t\tCalculating noise as all points within epsilon of another cluster.\n"); + if (!dvdfile_.empty()) + mprintf("\t\tDensity vs min distance to point with next highest density written to %s\n", + dvdfile_.c_str()); + if (choosePoints_ == AUTOMATIC) { + mprintf("\t\tAttempting to choose density peaks automatically.\n"); + if (!rafile_.empty()) + mprintf("\t\tRunning avg of delta vs distance written to %s\n", rafile_.c_str()); + if (avg_factor_ != -1) + mprintf("\t\tRunning avg window size will be # clustered frames / %i\n", avg_factor_); + if (!radelta_.empty()) + mprintf("\t\tDelta of distance minus running avg written to %s\n", radelta_.c_str()); + } else if (choosePoints_ == MANUAL) { + mprintf("\t\tCutoffs for choosing initial clusters from peaks: Distance= %g, density= %g\n", + distanceCut_, densityCut_); + } else + mprintf("\t\tNo clustering, only writing density versus distance file.\n"); +} + +int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, + Cframes const& framesToCluster, + PairwiseMatrix const& pmatrix) +{ + int err = 0; + // Calculate local densities + if ( useGaussianKernel_ ) + err = Cluster_GaussianKernel(framesToCluster, pmatrix); + else + err = Cluster_DiscreteDensity(framesToCluster, pmatrix); + if (err != 0) return 1; + // Choose points for which the min distance to point with higher density is + // anomalously high. + int nclusters = 0; + if (choosePoints_ == PLOT_ONLY) { + mprintf("Info: Cutoffs for choosing points can be determined visually from the\n" + "Info: density versus min distance to cluster with next highest density file,\n" + "Info: '%s'. Re-run the algorithm with appropriate distancecut and densitycut.\n", + dvdfile_.c_str()); + return 0; + } else if (choosePoints_ == MANUAL) + nclusters = ChoosePointsManually(); + else + nclusters = ChoosePointsAutomatically(); + + mprintf("\tIdentified %i cluster centers from density vs distance peaks.\n", nclusters); + // Each remaining point is assigned to the same cluster as its nearest + // neighbor of higher density. Do this recursively until a cluster + // center is found. + int cnum = -1; + for (unsigned int idx = 0; idx != Points_.size(); idx++) { + if (Points_[idx].Cnum() == -1) {// Point is unassigned. + AssignClusterNum(idx, cnum); + //mprintf("Finished recursion for index %i\n\n", idx); + } + } + // Sort by cluster number. NOTE: This invalidates NearestIdx + std::sort( Points_.begin(), Points_.end(), Cpoint::cnum_sort() ); + // Determine where each cluster starts and stops in Points array + typedef std::vector Parray; + Parray C_start_stop; + C_start_stop.reserve( nclusters * 2 ); + cnum = -1; + for (Carray::const_iterator point = Points_.begin(); point != Points_.end(); ++point) + { + if (point->Cnum() != cnum) { + if (!C_start_stop.empty()) C_start_stop.push_back(point - Points_.begin()); // end of cluster + C_start_stop.push_back(point - Points_.begin()); // beginning of cluster + cnum = point->Cnum(); + } + } + C_start_stop.push_back( Points_.size() ); // end of last cluster + // Noise calculation. + if (calc_noise_) { + mprintf("\tDetermining noise frames from cluster borders.\n"); + // For each cluster find a border region, defined as the set of points + // assigned to that cluster which are within epsilon of any other + // cluster. + // NOTE: Could use a set here to prevent duplicate frames. + typedef std::vector Barray; + Barray borderIndices( nclusters ); // Hold indices of border points for each cluster. + for (Parray::const_iterator idx0 = C_start_stop.begin(); + idx0 != C_start_stop.end(); idx0 += 2) + { + int c0 = Points_[*idx0].Cnum(); + //mprintf("Cluster %i\n", c0); + // Check each frame in this cluster. + for (unsigned int i0 = *idx0; i0 != *(idx0+1); ++i0) + { + Cpoint const& point = Points_[i0]; + // Look at each other cluster + for (Parray::const_iterator idx1 = idx0 + 2; + idx1 != C_start_stop.end(); idx1 += 2) + { + int c1 = Points_[*idx1].Cnum(); + // Check each frame in other cluster + for (unsigned int i1 = *idx1; i1 != *(idx1+1); i1++) + { + Cpoint const& other_point = Points_[i1]; + if (pmatrix.Frame_Distance(point.Fnum(), other_point.Fnum()) < epsilon_) { + //mprintf("\tBorder frame: %i (to cluster %i frame %i)\n", + // point.Fnum() + 1, c1, other_point.Fnum() + 1); + borderIndices[c0].push_back( i0 ); + borderIndices[c1].push_back( i1 ); + } + } + } + } + } + if (debug_ > 0) + mprintf("Warning: Cluster numbers here may not match final cluster numbers.\n" + "\tBorder Frames:\n"); + for (Parray::const_iterator idx = C_start_stop.begin(); + idx != C_start_stop.end(); idx += 2) + { + int c0 = Points_[*idx].Cnum(); + if (debug_ > 0) + mprintf("\tCluster %u: %u frames: %u border frames:", c0, *(idx+1) - *idx, + borderIndices[c0].size()); + if (borderIndices[c0].empty()) { + if (debug_ > 0) mprintf(" No border points.\n"); + } else { + int highestDensity = -1; + // Find highest density in border region. + for (Parray::const_iterator bidx = borderIndices[c0].begin(); + bidx != borderIndices[c0].end(); ++bidx) + { + if (highestDensity == -1) + highestDensity = Points_[*bidx].PointsWithinEps(); + else + highestDensity = std::max(highestDensity, Points_[*bidx].PointsWithinEps()); + if (debug_ > 0) mprintf(" %i", Points_[*bidx].Fnum()+1); + } + if (debug_ > 0) mprintf(". Highest density in border= %i\n", highestDensity); + // Mark any point with density <= highest border density as noise. + for (unsigned int i = *idx; i != *(idx+1); i++) + { + Cpoint& point = Points_[i]; + if (point.PointsWithinEps() <= highestDensity) { + point.SetCluster( -1 ); + if (debug_ > 1) + mprintf("\t\tMarking frame %i as noise (density %i)\n", + point.Fnum()+1, point.PointsWithinEps()); + } + } + } + } + } + // Add the clusters. + for (Parray::const_iterator idx = C_start_stop.begin(); + idx != C_start_stop.end(); idx += 2) + { + Cframes frames; + for (unsigned int i = *idx; i != *(idx+1); i++) { + if (Points_[i].Cnum() != -1) + frames.push_back( Points_[i].Fnum() ); + } + if (!frames.empty()) + clusters.AddCluster( Node(pmatrix.MetricPtr(), frames, clusters.Nclusters()) ); + } + return 0; +} + +// ----------------------------------------------------------------------------- +int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_GaussianKernel(Cframes const& framesToCluster, + PairwiseMatrix const& pmatrix) +{ + mprintf("\tStarting DPeaks clustering. Using Gaussian kernel to calculate density.\n"); + // First determine which frames are being clustered. + Points_.clear(); + int oidx = 0; + for (Cframes::const_iterator frame = framesToCluster.begin(); + frame != framesToCluster.end(); ++frame) + Points_.push_back( Cpoint(*frame, oidx++) ); + // Sanity check. + if (Points_.size() < 2) { + mprinterr("Error: Only 1 frame in initial clustering.\n"); + return 1; + } + + // Sort distances + std::vector Distances; + unsigned int n_distances = (framesToCluster.size() * (framesToCluster.size()-1)) / 2; + Distances.reserve( n_distances ); + for (Cframes::const_iterator f1 = framesToCluster.begin(); f1 != framesToCluster.end(); ++f1) + for (Cframes::const_iterator f2 = f1 + 1; f2 != framesToCluster.end(); ++f2) + Distances.push_back( pmatrix.Frame_Distance( *f1, *f2 ) ); + std::sort( Distances.begin(), Distances.end() ); + unsigned int idx = (unsigned int)((double)Distances.size() * 0.02); + double bandwidth = (double)Distances[idx]; + mprintf("idx= %u, bandwidth= %g\n", idx, bandwidth); + + // Density via Gaussian kernel + double maxDist = -1.0; + for (unsigned int i = 0; i != Points_.size(); i++) { + for (unsigned int j = i+1; j != Points_.size(); j++) { + double dist = pmatrix.Frame_Distance(Points_[i].Fnum(), Points_[j].Fnum()); + maxDist = std::max( maxDist, dist ); + dist /= bandwidth; + double gk = exp(-(dist *dist)); + Points_[i].AddDensity( gk ); + Points_[j].AddDensity( gk ); + } + } + mprintf("Max dist= %g\n", maxDist); + CpptrajFile rhoOut; + rhoOut.OpenWrite("rho.dat"); + for (unsigned int i = 0; i != Points_.size(); i++) + rhoOut.Printf("%u %g\n", i+1, Points_[i].Density()); + rhoOut.CloseFile(); + + // Sort by density, descending + std::stable_sort( Points_.begin(), Points_.end(), Cpoint::density_sort_descend() ); + CpptrajFile ordrhoOut; + ordrhoOut.OpenWrite("ordrho.dat"); + for (unsigned int i = 0; i != Points_.size(); i++) + ordrhoOut.Printf("%u %g %i %i\n", i+1, Points_[i].Density(), Points_[i].Fnum()+1, + Points_[i].Oidx()+1); + ordrhoOut.CloseFile(); + + // Determine minimum distances + int first_idx = Points_[0].Oidx(); + Points_[first_idx].SetDist( -1.0 ); + Points_[first_idx].SetNearestIdx(-1); + for (unsigned int ii = 1; ii != Points_.size(); ii++) { + int ord_i = Points_[ii].Oidx(); + Points_[ord_i].SetDist( maxDist ); + for (unsigned int jj = 0; jj != ii; jj++) { + int ord_j = Points_[jj].Oidx(); + double dist = pmatrix.Frame_Distance(Points_[ord_i].Fnum(), Points_[ord_j].Fnum()); + if (dist < Points_[ord_i].Dist()) { + Points_[ord_i].SetDist( dist ); + Points_[ord_j].SetNearestIdx( ord_j ); + } + } + } + if (!dvdfile_.empty()) { + CpptrajFile output; + if (output.OpenWrite(dvdfile_)) return 1; + for (Carray::const_iterator point = Points_.begin(); point != Points_.end(); ++point) + output.Printf("%g %g %i\n", point->Density(), point->Dist(), point->NearestIdx()+1); + output.CloseFile(); + } + + return 0; +} + +// ----------------------------------------------------------------------------- +int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_DiscreteDensity(Cframes const& framesToCluster, + PairwiseMatrix const& pmatrix) +{ + mprintf("\tStarting DPeaks clustering, discrete density calculation.\n"); + Points_.clear(); + // First determine which frames are being clustered. + for (Cframes::const_iterator frame = framesToCluster.begin(); + frame != framesToCluster.end(); ++frame) + Points_.push_back( Cpoint(*frame) ); + // Sanity check. + if (Points_.size() < 2) { + mprinterr("Error: Only 1 frame in initial clustering.\n"); + return 1; + } + // For each point, determine how many others are within epsilon. Also + // determine maximum distance between any two points. + mprintf("\tDetermining local density of each point.\n"); + ProgressBar cluster_progress( Points_.size() ); + double maxDist = -1.0; + for (Carray::iterator point0 = Points_.begin(); + point0 != Points_.end(); ++point0) + { + cluster_progress.Update(point0 - Points_.begin()); + int density = 0; + for (Carray::const_iterator point1 = Points_.begin(); + point1 != Points_.end(); ++point1) + { + if (point0 != point1) { + double dist = pmatrix.Frame_Distance(point0->Fnum(), point1->Fnum()); + maxDist = std::max(maxDist, dist); + if ( dist < epsilon_ ) + density++; + } + } + point0->SetPointsWithinEps( density ); + } + if (debug_ > 0) { + mprintf("DBG: Max dist= %g\n", maxDist); + // DEBUG: Frame/Density + CpptrajFile fdout; + fdout.OpenWrite("fd.dat"); + for (Carray::const_iterator point = Points_.begin(); point != Points_.end(); ++point) + fdout.Printf("%i %i\n", point->Fnum()+1, point->PointsWithinEps()); + fdout.CloseFile(); + } + // Sort by density here. Otherwise array indices will be invalid later. + std::sort( Points_.begin(), Points_.end(), Cpoint::pointsWithinEps_sort() ); + // For each point, find the closest point that has higher density. Since + // array is now sorted by density the last point has the highest density. + Points_.back().SetDist( maxDist ); + mprintf("\tFinding closest neighbor point with higher density for each point.\n"); + unsigned int lastidx = Points_.size() - 1; + cluster_progress.SetupProgress( lastidx ); + for (unsigned int idx0 = 0; idx0 != lastidx; idx0++) + { + cluster_progress.Update( idx0 ); + double min_dist = maxDist; + int nearestIdx = -1; // Index of nearest neighbor with higher density + Cpoint& point0 = Points_[idx0]; + //mprintf("\nDBG:\tSearching for nearest neighbor to idx %u with higher density than %i.\n", + // idx0, point0.PointsWithinEps()); + // Since array is sorted by density we can start at the next point. + for (unsigned int idx1 = idx0+1; idx1 != Points_.size(); idx1++) + { + Cpoint const& point1 = Points_[idx1]; + double dist1_2 = pmatrix.Frame_Distance(point0.Fnum(), point1.Fnum()); + if (point1.PointsWithinEps() > point0.PointsWithinEps()) + { + if (dist1_2 < min_dist) { + min_dist = dist1_2; + nearestIdx = (int)idx1; + //mprintf("DBG:\t\tNeighbor idx %i is closer (density %i, distance %g)\n", + // nearestIdx, point1.PointsWithinEps(), min_dist); + } + } + } + point0.SetDist( min_dist ); + //mprintf("DBG:\tClosest point to %u with higher density is %i (distance %g)\n", + // idx0, nearestIdx, min_dist); + point0.SetNearestIdx( nearestIdx ); + } + // Plot density vs distance for each point. + if (!dvdfile_.empty()) { + CpptrajFile output; + if (output.OpenWrite(dvdfile_)) + mprinterr("Error: Could not open density vs distance plot '%s' for write.\n", + dvdfile_.c_str()); // TODO: Make fatal? + else { + output.Printf("%-10s %10s %s %10s %10s\n", "#Density", "Distance", + "Frame", "Idx", "Neighbor"); + for (Carray::const_iterator point = Points_.begin(); + point != Points_.end(); ++point) + output.Printf("%-10i %10g \"%i\" %10u %10i\n", point->PointsWithinEps(), point->Dist(), + point->Fnum()+1, point-Points_.begin(), point->NearestIdx()); + output.CloseFile(); + } + } + + return 0; +} + +int Cpptraj::Cluster::Algorithm_DPeaks::ChoosePointsManually() { + int cnum = 0; + for (Carray::iterator point = Points_.begin(); point != Points_.end(); ++point) { + double density; + if (useGaussianKernel_) + density = point->Density(); + else + density = (double)point->PointsWithinEps(); + if ( density >= densityCut_ && point->Dist() >= distanceCut_ ) { + point->SetCluster( cnum++ ); + mprintf("\tPoint %u (frame %i, density %g) selected as candidate for cluster %i\n", + point - Points_.begin(), point->Fnum() + 1, density, cnum - 1); + } + } + return cnum; +} + +int Cpptraj::Cluster::Algorithm_DPeaks::ChoosePointsAutomatically() { + // Right now all density values are discrete. Try to choose outliers at each + // value for which there is density.; +/* + // For each point, calculate average distance (X,Y) to points in next and + // previous density values. + const double dens_cut = 3.0 * 3.0; + const double dist_cut = 1.32 * 1.32; + for (Carray::const_iterator point0 = Points_.begin(); point0 != Points_.end(); ++point0) + { + int Npts = 0; + for (Carray::const_iterator point1 = Points_.begin(); point1 != Points_.end(); ++point1) + { + if (point0 != point1) { + // Only do this for close densities + double dX = (double)(point0->PointsWithinEps() - point1->PointsWithinEps()); + double dX2 = dX * dX; + double dY = (point0->Dist() - point1->Dist()); + double dY2 = dY * dY; + if (dX2 < dens_cut && dY2 < dist_cut) { + Npts++; + } + } + } + mprintf("%i %i %i\n", point0->PointsWithinEps(), point0->Fnum()+1, Npts); + } +*/ + +/* + CpptrajFile tempOut; + tempOut.OpenWrite("temp.dat"); + int currentDensity = -1; + double distAv = 0.0; + double distSD = 0.0; + double sumWts = 0.0; + int nValues = 0; + Carray::const_iterator lastPoint = Points_.end() + 1; + for (Carray::const_iterator point = Points_.begin(); point != lastPoint; ++point) + { + if (point == Points_.end() || point->PointsWithinEps() != currentDensity) { + if (nValues > 0) { + distAv = distAv / sumWts; //(double)nValues; + distSD = (distSD / sumWts) - (distAv * distAv); + if (distSD > 0.0) + distSD = sqrt(distSD); + else + distSD = 0.0; + //mprintf("Density %i: %i values Avg= %g SD= %g SumWts= %g\n", currentDensity, + // nValues, distAv, distSD, sumWts); + tempOut.Printf("%i %g\n", currentDensity, distAv); + } + if (point == Points_.end()) break; + currentDensity = point->PointsWithinEps(); + distAv = 0.0; + distSD = 0.0; + sumWts = 0.0; + nValues = 0; + } + double wt = exp(point->Dist()); + double dval = point->Dist() * wt; + sumWts += wt; + distAv += dval; + distSD += (dval * dval); + nValues++; + } + tempOut.CloseFile(); +*/ + + // BEGIN CALCULATING WEIGHTED DISTANCE AVERAGE + CpptrajFile tempOut; + tempOut.OpenWrite("temp.dat"); + DataSet_Mesh weightedAverage; + Carray::const_iterator cp = Points_.begin(); + // Skip local density of 0. + //while (cp->PointsWithinEps() == 0 && cp != Points_.end()) ++cp; + while (cp != Points_.end()) + { + int densityVal = cp->PointsWithinEps(); + Carray densityArray; + // Add all points of current density. + while (cp->PointsWithinEps() == densityVal && cp != Points_.end()) + densityArray.push_back( *(cp++) ); + mprintf("Density value %i has %zu points.\n", densityVal, densityArray.size()); + // Sort array by distance + std::sort(densityArray.begin(), densityArray.end(), Cpoint::dist_sort()); + // Take the average of the points weighted by their position. + double wtDistAv = 0.0; + double sumWts = 0.0; + //std::vector weights; + //weights.reserve( densityArray.size() ); + int maxPt = (int)densityArray.size() - 1; + for (int ip = 0; ip != (int)densityArray.size(); ++ip) + { + double wt = exp( (double)(ip - maxPt) ); + //mprintf("\t%10i %10u %10u %10g\n", densityVal, ip, maxPt, wt); + wtDistAv += (densityArray[ip].Dist() * wt); + sumWts += wt; + //weights.push_back( wt ); + } + wtDistAv /= sumWts; + // Calculate the weighted sample variance + //double distSD = 0.0; + //for (unsigned int ip = 0; ip != densityArray.size(); ++ip) { + // double diff = densityArray[ip].Dist() - wtDistAv; + // distSD += weights[ip] * (diff * diff); + //} + //distSD /= sumWts; + weightedAverage.AddXY(densityVal, wtDistAv); + //tempOut.Printf("%i %g %g %g\n", densityVal, wtDistAv, sqrt(distSD), sumWts); + tempOut.Printf("%i %g %g\n", densityVal, wtDistAv, sumWts); +/* + // Find the median. + double median, Q1, Q3; + if (densityArray.size() == 1) { + median = densityArray[0].Dist(); + Q1 = median; + Q3 = median; + } else { + unsigned int q3_beg; + unsigned int med_idx = densityArray.size() / 2; // Always 0 <= Q1 < med_idx + if ((densityArray.size() % 2) == 0) { + median = (densityArray[med_idx].Dist() + densityArray[med_idx-1].Dist()) / 2.0; + q3_beg = med_idx; + } else { + median = densityArray[med_idx].Dist(); + q3_beg = med_idx + 1; + } + if (densityArray.size() == 2) { + Q1 = densityArray[0].Dist(); + Q3 = densityArray[1].Dist(); + } else { + // Find lower quartile + unsigned int q1_idx = med_idx / 2; + if ((med_idx % 2) == 0) + Q1 = (densityArray[q1_idx].Dist() + densityArray[q1_idx-1].Dist()) / 2.0; + else + Q1 = densityArray[q1_idx].Dist(); + // Find upper quartile + unsigned int q3_size = densityArray.size() - q3_beg; + unsigned int q3_idx = (q3_size / 2) + q3_beg; + if ((q3_size %2) == 0) + Q3 = (densityArray[q3_idx].Dist() + densityArray[q3_idx-1].Dist()) / 2.0; + else + Q3 = densityArray[q3_idx].Dist(); + } + } + mprintf("\tMedian dist value is %g. Q1= %g Q3= %g\n", median, Q1, Q3); +*/ + } + tempOut.CloseFile(); + // END CALCULATING WEIGHTED DISTANCE AVERAGE + +/* + // TEST + tempOut.OpenWrite("temp2.dat"); + std::vector Hist( Points_.back().PointsWithinEps()+1, 0.0 ); + int gWidth = 3; + double cval = 3.0; + double two_c_squared = 2.0 * cval * cval; + mprintf("DBG: cval= %g, Gaussian denominator is %g\n", cval, two_c_squared); + for (int wtIdx = 0; wtIdx != (int)weightedAverage.Size(); wtIdx++) + { + int bval = weightedAverage.X(wtIdx); + for (int xval = std::max(bval - gWidth, 0); + xval != std::min(bval + gWidth + 1, (int)Hist.size()); xval++) + { + // a: height (weighted average) + // b: center (density value) + // c: width + // x: density value in histogram + //int xval = weightedAverage.X(idx); + //double bval = weightedAverage.X(wtIdx); + //double bval = (double)wtIdx; + double diff = (double)(xval - bval); + //Hist[xval] += (weightedAverage.Y(wtIdx) * exp( -( (diff * diff) / two_c_squared ) )); + Hist[xval] = std::max(Hist[xval], + weightedAverage.Y(wtIdx) * exp( -( (diff * diff) / two_c_squared ) )); + } + } + for (unsigned int idx = 0; idx != Hist.size(); idx++) + tempOut.Printf("%u %g\n", idx, Hist[idx]); + tempOut.CloseFile(); + // END TEST +*/ +/* + // TEST + // Construct best-fit line segments + tempOut.OpenWrite("temp2.dat"); + double slope, intercept, correl; + int segment_length = 3; + DataSet_Mesh Segment; + Segment.Allocate1D( segment_length ); + for (int wtIdx = 0; wtIdx != (int)weightedAverage.Size(); wtIdx++) + { + Segment.Clear(); + for (int idx = std::max(wtIdx - 1, 0); // TODO: use segment_length + idx != std::min(wtIdx + 2, (int)weightedAverage.Size()); idx++) + Segment.AddXY(weightedAverage.X(idx), weightedAverage.Y(idx)); + Segment.LinearRegression(slope, intercept, correl, true); + for (int idx = std::max(wtIdx - 1, 0); // TODO: use segment_length + idx != std::min(wtIdx + 2, (int)weightedAverage.Size()); idx++) + { + double x = weightedAverage.X(idx); + double y = slope * x + intercept; + tempOut.Printf("%g %g %i\n", x, y, weightedAverage.X(wtIdx)); + } + } + tempOut.CloseFile(); + // END TEST +*/ + + // BEGIN WEIGHTED RUNNING AVG/SD OF DISTANCES + // For each point, determine if it is greater than the average of the + // weighted average distances of the previous, current, and next densities. + int width = 2; + int currentDensity = 0; + int wtIdx = 0; + double currentAvg = 0.0; + double deltaSD = 0.0; + double deltaAv = 0.0; + int Ndelta = 0; + CpptrajFile raOut; + if (!rafile_.empty()) raOut.OpenWrite(rafile_); + CpptrajFile raDelta; + if (!radelta_.empty()) raDelta.OpenWrite(radelta_); + std::vector candidateIdxs; + std::vector candidateDeltas; + cp = Points_.begin(); + // Skip over points with zero density + while (cp != Points_.end() && cp->PointsWithinEps() == 0) ++cp; + while (weightedAverage.X(wtIdx) != cp->PointsWithinEps() && wtIdx < (int)Points_.size()) + ++wtIdx; + for (Carray::const_iterator point = cp; point != Points_.end(); ++point) + { + if (point->PointsWithinEps() != currentDensity) { + //currentAvg = weightedAverage.Y(wtIdx); + // New density value. Determine average. + currentAvg = 0.0; + // unsigned int Npt = 0; + double currentWt = 0.0; + for (int idx = std::max(wtIdx - width, 0); + idx != std::min(wtIdx + width + 1, (int)weightedAverage.Size()); idx++) + { + //currentAvg += weightedAverage.Y(idx); + //Npt++; + double wt = weightedAverage.Y(idx); + currentAvg += (weightedAverage.Y(idx) * wt); + currentWt += wt; + } + //currentAvg /= (double)Npt; + currentAvg /= currentWt; + //smoothAv += currentAvg; + //smoothSD += (currentAvg * currentAvg); + //Nsmooth++; + currentDensity = point->PointsWithinEps(); + if (raOut.IsOpen()) + raOut.Printf("%i %g %g\n", currentDensity, currentAvg, weightedAverage.Y(wtIdx)); + wtIdx++; + } + double delta = (point->Dist() - currentAvg); + if (delta > 0.0) { + //delta *= log((double)currentDensity); + if (raDelta.IsOpen()) + raDelta.Printf("%8i %8.3f %8i %8.3f %8.3f\n", + currentDensity, delta, point->Fnum()+1, point->Dist(), currentAvg); + candidateIdxs.push_back( point - Points_.begin() ); + candidateDeltas.push_back( delta ); + deltaAv += delta; + deltaSD += (delta * delta); + Ndelta++; + } + } + raOut.CloseFile(); + deltaAv /= (double)Ndelta; + deltaSD = (deltaSD / (double)Ndelta) - (deltaAv * deltaAv); + if (deltaSD > 0.0) + deltaSD = sqrt(deltaSD); + else + deltaSD = 0.0; + if (raDelta.IsOpen()) + raDelta.Printf("#DeltaAvg= %g DeltaSD= %g\n", deltaAv, deltaSD); + raDelta.CloseFile(); + int cnum = 0; + for (unsigned int i = 0; i != candidateIdxs.size(); i++) { + if (candidateDeltas[i] > (deltaSD)) { + Points_[candidateIdxs[i]].SetCluster( cnum++ ); + mprintf("\tPoint %u (frame %i, density %i) selected as candidate for cluster %i\n", + candidateIdxs[i], Points_[candidateIdxs[i]].Fnum()+1, + Points_[candidateIdxs[i]].PointsWithinEps(), cnum-1); + } + } + // END WEIGHTED AVG/SD OF DISTANCES + +/* + // Currently doing this by calculating the running average of density vs + // distance, then choosing points with distance > twice the SD of the + // running average. + // NOTE: Store in a mesh data set for now in case we want to spline etc later. + if (avg_factor_ < 1) avg_factor_ = 10; + unsigned int window_size = Points_.size() / (unsigned int)avg_factor_; + mprintf("\tRunning avg window size is %u\n", window_size); + // FIXME: Handle case where window_size < frames + DataSet_Mesh runavg; + unsigned int ra_size = Points_.size() - window_size + 1; + runavg.Allocate1D( ra_size ); + double dwindow = (double)window_size; + double sumx = 0.0; + double sumy = 0.0; + for (unsigned int i = 0; i < window_size; i++) { + sumx += (double)Points_[i].PointsWithinEps(); + sumy += Points_[i].Dist(); + } + runavg.AddXY( sumx / dwindow, sumy / dwindow ); + for (unsigned int i = 1; i < ra_size; i++) { + unsigned int nextwin = i + window_size - 1; + unsigned int prevwin = i - 1; + sumx = (double)Points_[nextwin].PointsWithinEps() - + (double)Points_[prevwin].PointsWithinEps() + sumx; + sumy = Points_[nextwin].Dist() - + Points_[prevwin].Dist() + sumy; + runavg.AddXY( sumx / dwindow, sumy / dwindow ); + } + // Write running average + if (!rafile_.empty()) { + CpptrajFile raOut; + if (raOut.OpenWrite(rafile_)) + mprinterr("Error: Could not open running avg file '%s' for write.\n", rafile_.c_str()); + else { + for (unsigned int i = 0; i != runavg.Size(); i++) + raOut.Printf("%g %g\n", runavg.X(i), runavg.Y(i)); + raOut.CloseFile(); + } + } + double ra_sd; + double ra_avg = runavg.Avg( ra_sd ); + // Double stdev to use as cutoff for findning anomalously high peaks. + ra_sd *= 2.0; + mprintf("\tAvg of running avg set is %g, SD*2.0 (delta cutoff) is %g\n", ra_avg, ra_sd); + // For each point in density vs distance plot, determine which running + // average point is closest. If the difference between the point and the + // running average point is > 2.0 the SD of the running average data, + // consider it a 'peak'. + CpptrajFile raDelta; + if (!radelta_.empty()) + raDelta.OpenWrite("radelta.dat"); + if (raDelta.IsOpen()) + raDelta.Printf("%-10s %10s %10s\n", "#Frame", "RnAvgPos", "Delta"); + unsigned int ra_position = 0; // Position in the runavg DataSet + unsigned int ra_end = runavg.Size() - 1; + int cnum = 0; + for (Carray::iterator point = Points_.begin(); + point != Points_.end(); ++point) + { + if (ra_position != ra_end) { + // Is the next running avgd point closer to this point? + while (ra_position != ra_end) { + double dens = (double)point->PointsWithinEps(); + double diff0 = fabs( dens - runavg.X(ra_position ) ); + double diff1 = fabs( dens - runavg.X(ra_position+1) ); + if (diff1 < diff0) + ++ra_position; // Next running avg position is closer for this point. + else + break; // This position is closer. + } + } + double delta = point->Dist() - runavg.Y(ra_position); + if (raDelta.IsOpen()) + raDelta.Printf("%-10i %10u %10g", point->Fnum()+1, ra_position, delta); + if (delta > ra_sd) { + if (raDelta.IsOpen()) + raDelta.Printf(" POTENTIAL CLUSTER %i", cnum); + point->SetCluster(cnum++); + } + if (raDelta.IsOpen()) raDelta.Printf("\n"); + } + raDelta.CloseFile(); +*/ + return cnum; +} + +// ----------------------------------------------------------------------------- +/** This should never be called for the point with highest density + * which by definition should be a cluster center. + */ +void Cpptraj::Cluster::Algorithm_DPeaks::AssignClusterNum(int idx, int& cnum) { + // Who is the nearest neighbor with higher density. + int neighbor_idx = Points_[idx].NearestIdx(); + //mprintf("Index %i nearest neighbor index %i\n", idx, neighbor_idx); + // SANITY CHECK + if (neighbor_idx == -1) { + mprinterr("Internal Error: In Algorithm_DPeaks::AssignClusterNum nearest neighbor is -1.\n"); + return; + } + if (Points_[neighbor_idx].Cnum() != -1) { + // Nearest neighbor has a cluster num assigned. + cnum = Points_[neighbor_idx].Cnum(); + //mprintf("Neighbor index %i is cluster %i\n", neighbor_idx, cnum); + } else + // Ask neighbor to find cluster num. + AssignClusterNum(neighbor_idx, cnum); + //mprintf("Index %i cnum %i\n", idx, cnum); + // At this point cnum should be set. One more sanity check. + if (cnum == -1) { + mprinterr("Internal Error: In Algorithm_DPeaks::AssignClusterNum could not get" + " cluster num for index %u.\n", idx); + return; + } + Points_[idx].SetCluster( cnum ); +} + +void Cpptraj::Cluster::Algorithm_DPeaks::Results(CpptrajFile& outfile) const { + outfile.Printf("#Algorithm: DPeaks epsilon %g\n", epsilon_); + if (calc_noise_) { + outfile.Printf("#NOISE_FRAMES:"); + std::vector noiseFrames; + for (Carray::const_iterator point = Points_.begin(); + point != Points_.end(); ++point) + if (point->Cnum() == -1) noiseFrames.push_back( point->Fnum()+1 ); + std::sort( noiseFrames.begin(), noiseFrames.end() ); + for (std::vector::const_iterator f = noiseFrames.begin(); f != noiseFrames.end(); ++f) + outfile.Printf(" %i", *f); + outfile.Printf("\n"); + outfile.Printf("#Number_of_noise_frames: %zu\n", noiseFrames.size()); + } +} diff --git a/src/Cluster/Algorithm_DPeaks.h b/src/Cluster/Algorithm_DPeaks.h new file mode 100644 index 0000000000..aaab3f613d --- /dev/null +++ b/src/Cluster/Algorithm_DPeaks.h @@ -0,0 +1,118 @@ +#ifndef INC_CLUSTER_ALGORITHM_DPEAKS_H +#define INC_CLUSTER_ALGORITHM_DPEAKS_H +#include "Algorithm.h" +namespace Cpptraj { +namespace Cluster { + +/// Implement density peaks clustering algorithm +class Algorithm_DPeaks : public Algorithm { + public: + Algorithm_DPeaks(); + static void Help(); + int Setup(ArgList&); + void Info() const; + void Results(CpptrajFile&) const; + int DoClustering(List&, Cframes const&, PairwiseMatrix const&); + void Timing(double) const {} + private: + void AssignClusterNum(int, int&); + int Cluster_GaussianKernel(Cframes const&, PairwiseMatrix const&); + int Cluster_DiscreteDensity(Cframes const&, PairwiseMatrix const&); + int ChoosePointsAutomatically(); + int ChoosePointsManually(); + + enum ChooseType {PLOT_ONLY = 0, MANUAL, AUTOMATIC}; + std::string dvdfile_; + std::string rafile_; + std::string radelta_; + double densityCut_; + double distanceCut_; + double epsilon_; + ChooseType choosePoints_; + int avg_factor_; + bool calc_noise_; + bool useGaussianKernel_; + // ------------------------------------------- + class Cpoint { + public: + Cpoint() : + dist_(-1.0), density_(0.0), pointsWithinEps_(0), fnum_(-1), + nidx_(-1), oidx_(-1), cnum_(-1) {} + Cpoint(int f, int o) : + dist_(-1.0), density_(0.0), pointsWithinEps_(0), fnum_(f), + nidx_(-1), oidx_(o), cnum_(-1) {} + Cpoint(int f) : + dist_(-1.0), density_(0.0), pointsWithinEps_(0), fnum_(f), + nidx_(-1), oidx_(-1), cnum_(-1) {} + Cpoint(Cpoint const& rhs) : + dist_(rhs.dist_), density_(rhs.density_), + pointsWithinEps_(rhs.pointsWithinEps_), fnum_(rhs.fnum_), + nidx_(rhs.nidx_), oidx_(rhs.oidx_), cnum_(rhs.cnum_) {} + Cpoint& operator=(Cpoint const& rhs) { + if (&rhs != this) { + dist_ = rhs.dist_; density_ = rhs.density_; + pointsWithinEps_ = rhs.pointsWithinEps_; fnum_ = rhs.fnum_; + nidx_ = rhs.nidx_; oidx_ = rhs.oidx_; cnum_ = rhs.cnum_; + } + return *this; + } + /// Used to sort Carray by pointsWithinEpsilon, ascending + //bool operator<(Cpoint const& second) const + struct pointsWithinEps_sort { + inline bool operator()(Cpoint const& first, Cpoint const& second) const { + if (first.pointsWithinEps_ == second.pointsWithinEps_) + return (first.fnum_ < second.fnum_); + else + return (first.pointsWithinEps_ < second.pointsWithinEps_); + } + }; + /// Sort by density, descending + struct density_sort_descend { + inline bool operator()(Cpoint const& first, Cpoint const& second) const { + return (first.density_ > second.density_); + } + }; + /// Used to sort Carray by cluster number + struct cnum_sort { + inline bool operator()(Cpoint const& first, Cpoint const& second) const { + if (first.cnum_ == second.cnum_) + return (first.fnum_ < second.fnum_); + else + return (first.cnum_ < second.cnum_); + } + }; + /// Used to sort Carray by distance + struct dist_sort { + inline bool operator()(Cpoint const& first, Cpoint const& second) const { + return (first.dist_ < second.dist_); + } + }; + double Dist() const { return dist_; } + int PointsWithinEps() const { return pointsWithinEps_; } + double Density() const { return density_; } + int Fnum() const { return fnum_; } + int NearestIdx() const { return nidx_; } + int Oidx() const { return oidx_; } + int Cnum() const { return cnum_; } + void SetPointsWithinEps(int d) { pointsWithinEps_ = d; } + void SetDist(double d) { dist_ = d; } + void SetNearestIdx(int n) { nidx_ = n; } + void SetCluster(int c) { cnum_ = c; } + void AddDensity(double d) { density_ += d; } + private: + double dist_; ///< minimum distance to point with higher density + double density_; ///< Density from Gaussian kernel. + int pointsWithinEps_; ///< # other points within epsilon + int fnum_; ///< Frame number. + int nidx_; ///< Index in Carray of nearest neighbor with higher density. + int oidx_; ///< Original index in Carray before sorting. + int cnum_; ///< Cluster number. -1 is no cluster. + }; + // ------------------------------------------- + typedef std::vector Carray; + Carray Points_; ///< Hold info for each point to be clustered. +}; + +} +} +#endif From a2c1f1f9ad59d5c97ef0454128b7a5bbc5f75cc1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 09:50:29 -0500 Subject: [PATCH 166/417] DRR - Cpptraj: Enable density peaks --- src/Cluster/Control.cpp | 2 ++ src/cpptrajdepend | 3 ++- src/cpptrajfiles | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 18f58d6f59..7913c9bb53 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -13,6 +13,7 @@ #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" #include "Algorithm_Kmeans.h" +#include "Algorithm_DPeaks.h" // Results #include "Results_Coords.h" @@ -186,6 +187,7 @@ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algori case Algorithm::HIERAGGLO : alg = new Algorithm_HierAgglo(); break; case Algorithm::DBSCAN : alg = new Algorithm_DBscan(); break; case Algorithm::KMEANS : alg = new Algorithm_Kmeans(); break; + case Algorithm::DPEAKS : alg = new Algorithm_DPeaks(); break; default : mprinterr("Error: Unhandled Algorithm in AllocateAlgorithm.\n"); } return alg; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 2e34911fec..01c687171a 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -142,6 +142,7 @@ CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStd CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DPeaks.o : Cluster/Algorithm_DPeaks.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Mesh.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../Spline.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_DPeaks.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h @@ -149,7 +150,7 @@ Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/ Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_DPeaks.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 639c3d6fa3..53206a2bf5 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -2,6 +2,7 @@ CLUSTER_SOURCES= \ Cluster/Algorithm.cpp \ Cluster/Algorithm_DBscan.cpp \ + Cluster/Algorithm_DPeaks.cpp \ Cluster/Algorithm_HierAgglo.cpp \ Cluster/Algorithm_Kmeans.cpp \ Cluster/BestReps.cpp \ From 7f369f6b69748d0ff1d18e8bdcccbc485063b589 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 09:55:30 -0500 Subject: [PATCH 167/417] DRR - Cpptraj: Allow specification of COORDS dataset for dataset clustering results --- src/Analysis_Cluster.cpp | 15 ++++++++++----- src/Cluster/Control.cpp | 6 ++++++ src/Cluster/Control.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index c53d9aa7b7..96f4777055 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -38,18 +38,23 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s cluster_dataset.push_back( *ds ); } - if (control_.SetupForDataSets(cluster_dataset, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) - return Analysis::ERR; - } else { - // Attempt to get coords dataset from datasetlist - std::string setname = analyzeArgs.GetStringKey("crdset"); + } + // Attempt to get coords DataSet from datasetlist. Do this + // if crdset is specified or no other DataSets specified. + std::string setname = analyzeArgs.GetStringKey("crdset"); + if (!setname.empty() || cluster_dataset.empty()) { coords = (DataSet_Coords*)setup.DSL().FindCoordsSet( setname ); if (coords == 0) { mprinterr("Error: Could not locate COORDS set corresponding to %s\n", setname.c_str()); return Analysis::ERR; } + } + if (!cluster_dataset.empty()) { + if (control_.SetupForDataSets(cluster_dataset, coords, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) + return Analysis::ERR; + } else { if (control_.SetupForCoordsDataSet(coords, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) return Analysis::ERR; } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 7913c9bb53..281332842b 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -236,6 +236,7 @@ const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = /** Set up clustering for 1D scalar sets. */ int Cpptraj::Cluster::Control::SetupForDataSets(Metric_Data::DsArray const& inputSets, + DataSet_Coords* ds, ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL, @@ -262,6 +263,11 @@ int Cpptraj::Cluster::Control::SetupForDataSets(Metric_Data::DsArray const& inpu // No results for data sets yet if (results_ != 0) delete results_; results_ = 0; + // Set up results for COORDS DataSet + if (ds != 0) { + results_ = (Results*)new Results_Coords( ds ); + if (results_ == 0) return 1; + } return Common(analyzeArgs, DSL, DFL); } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index cf46c393c8..b6e71d563f 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -32,7 +32,7 @@ class Control { /// For determining how frames to cluster will be determined. enum FrameSelectType { UNSPECIFIED = 0, FROM_CACHE }; - int SetupForDataSets(Metric_Data::DsArray const&, ArgList&, DataSetList&, DataFileList&, int); + int SetupForDataSets(Metric_Data::DsArray const&, DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); /// Provide information on how clustering calculation is currently set up. From 40b38efe4e745e23eea95ca0dc6336800dd41f34 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 10:04:30 -0500 Subject: [PATCH 168/417] DRR - Cpptraj: Add gracecolor option --- src/Cluster/Control.cpp | 14 ++++++++++---- src/Cluster/Control.h | 1 + src/Cluster/List.cpp | 42 +++++++++++++++++++++++++++++------------ src/Cluster/List.h | 2 +- 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 281332842b..271042d90e 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -32,6 +32,7 @@ Cpptraj::Cluster::Control::Control() : nRepsToSave_(1), suppressInfo_(false), cnumvtime_(0), + grace_color_(false), cpopvtimefile_(0), norm_pop_(Node::NONE) {} @@ -346,7 +347,7 @@ const char* Cpptraj::Cluster::Control::CommonArgs_ = "[bestrep {cumulative|centroid|cumulative_nosieve} [savenreps <#>]] " "[noinfo|info ] [summary ] [sil ] " "[cpopvtime [{normpop|normframe}]] " - "[out ] [] "; + "[out [gracecolor]] [] "; /** Common setup. */ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) @@ -461,7 +462,8 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da norm_pop_ = Node::NONE; } - // Cluster number vs time + // Cluster number vs time + grace_color_ = analyzeArgs.hasKey("gracecolor"); DataFile* cnumvtimefile = DFL.AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); // NOTE overall set name extracted here. This should be the last thing done. dsname_ = analyzeArgs.GetStringNext(); @@ -740,8 +742,12 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { // Cluster number vs time if (cnumvtime_ != 0) { - if (clusters_.CreateCnumVsTime( (DataSet_integer*)cnumvtime_, metric_->Ntotal() )) - { + int err = 0; + if (grace_color_) + err = clusters_.CreateCnumVsTime((DataSet_integer*)cnumvtime_, metric_->Ntotal(), 1, 15); + else + err = clusters_.CreateCnumVsTime((DataSet_integer*)cnumvtime_, metric_->Ntotal(), 0, -1); + if (err != 0) { mprinterr("Error: Creation of cluster num vs time data set failed.\n"); return 1; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index b6e71d563f..924d90e60f 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -86,6 +86,7 @@ class Control { std::string sil_file_; ///< File prefix for writing silhouette data DataSet* cnumvtime_; ///< Cluster number vs time data set. + bool grace_color_; ///< If true change cluster number to grace color DataFile* cpopvtimefile_; ///< Cluster population vs time file. Node::CnormType norm_pop_; ///< Cluster pop vs time normalization type diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 7bc1bb9a60..b0e3dfc708 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -18,8 +18,14 @@ void Cpptraj::Cluster::List::PrintClusters() const { } } -/** Create cluster number vs time data set. */ -int Cpptraj::Cluster::List::CreateCnumVsTime(DataSet_integer* ds, unsigned int maxFrames) +/** Create cluster number vs time data set. + * \param ds The output integer DataSet + * \param maxFrames The maximum number of frames. + * \param offset If specified, add offset to cluster numbers. + * \param maxCluster If specified, number clusters beyond maxCluster equal to maxCluster + */ +int Cpptraj::Cluster::List::CreateCnumVsTime(DataSet_integer* ds, unsigned int maxFrames, + int offset, int maxCluster) const { if (ds == 0) { @@ -32,18 +38,30 @@ const // have noise points (i.e. no cluster assigned) will be distinguished. std::fill(cnum_temp.begin(), cnum_temp.end(), -1); - for (cluster_iterator C = begincluster(); C != endcluster(); C++) - { - //mprinterr("Cluster %i:\n",CList->CurrentNum()); - int cnum = C->Num(); - // Loop over all frames in the cluster - for (Node::frame_iterator frame = C->beginframe(); frame != C->endframe(); frame++) + if (offset == 0 && maxCluster < 0) { + for (cluster_iterator C = begincluster(); C != endcluster(); C++) + { + //mprinterr("Cluster %i:\n",CList->CurrentNum()); + int cnum = C->Num(); + // Loop over all frames in the cluster + for (Node::frame_iterator frame = C->beginframe(); frame != C->endframe(); frame++) + { + //mprinterr("%i,",*frame); + cnum_temp[ *frame ] = cnum; + } + //mprinterr("\n"); + //break; + } + } else { + for (cluster_iterator C = begincluster(); C != endcluster(); C++) { - //mprinterr("%i,",*frame); - cnum_temp[ *frame ] = cnum; + int cnum = C->Num() + offset; + if (cnum > maxCluster) + cnum = maxCluster; + // Loop over all frames in the cluster + for (Node::frame_iterator frame = C->beginframe(); frame != C->endframe(); frame++) + cnum_temp[ *frame ] = cnum; } - //mprinterr("\n"); - //break; } return 0; } diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 9f4d6cc257..2d820f7776 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -46,7 +46,7 @@ class List { /// Remove clusters with no population void RemoveEmptyClusters(); /// Generate cluster number vs time data set - int CreateCnumVsTime(DataSet_integer*, unsigned int) const; + int CreateCnumVsTime(DataSet_integer*, unsigned int, int, int) const; /// Sort clusters by population and renumber. int Sort(); /// Add given frame as noise. From 78e20cb8952fd63f7cc43eed84060850e484a405 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 11:01:20 -0500 Subject: [PATCH 169/417] DRR - Cpptraj: Enable unique clusters vs time calc --- src/Cluster/Control.cpp | 39 ++++++++++++++++++++++++--- src/Cluster/Control.h | 3 +++ src/Cluster/List.cpp | 59 ++++++++++++++++++++++++++++++++++++----- src/Cluster/List.h | 4 ++- 4 files changed, 95 insertions(+), 10 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 271042d90e..df1a617bc0 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -33,6 +33,8 @@ Cpptraj::Cluster::Control::Control() : suppressInfo_(false), cnumvtime_(0), grace_color_(false), + clustersVtime_(0), + windowSize_(0), cpopvtimefile_(0), norm_pop_(Node::NONE) {} @@ -347,7 +349,8 @@ const char* Cpptraj::Cluster::Control::CommonArgs_ = "[bestrep {cumulative|centroid|cumulative_nosieve} [savenreps <#>]] " "[noinfo|info ] [summary ] [sil ] " "[cpopvtime [{normpop|normframe}]] " - "[out [gracecolor]] [] "; + "[out [gracecolor]] [] " + "[clustersvtime cvtwindow <#> "; /** Common setup. */ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) @@ -462,15 +465,33 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da norm_pop_ = Node::NONE; } + // Number of unique clusters vs time + DataFile* clustersvtimefile = DFL.AddDataFile(analyzeArgs.GetStringKey("clustersvtime"), + analyzeArgs); + windowSize_ = analyzeArgs.getKeyInt("cvtwindow", 0); // Cluster number vs time grace_color_ = analyzeArgs.hasKey("gracecolor"); DataFile* cnumvtimefile = DFL.AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); // NOTE overall set name extracted here. This should be the last thing done. dsname_ = analyzeArgs.GetStringNext(); + // --------------------------------------------- + + // Cluster number vs time data set cnumvtime_ = DSL.AddSet(DataSet::INTEGER, dsname_, "Cnum"); if (cnumvtime_ == 0) return 1; if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); + // Set up number of unique clusters vs time DataSet + if (clustersvtimefile != 0) { + if (windowSize_ < 2) { + mprinterr("Error: For # clusters seen vs time, cvtwindow must be specified and > 1\n"); + return 1; + } + clustersVtime_ = DSL.AddSet(DataSet::INTEGER, MetaData(cnumvtime_->Meta().Name(), "NCVT")); + if (clustersVtime_ == 0) return 1; + clustersvtimefile->AddDataSet( clustersVtime_ ); + } + // Cluster split analysis splitfile_ = analyzeArgs.GetStringKey("summarysplit"); if (splitfile_.empty()) // For backwards compat. @@ -744,15 +765,27 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { if (cnumvtime_ != 0) { int err = 0; if (grace_color_) - err = clusters_.CreateCnumVsTime((DataSet_integer*)cnumvtime_, metric_->Ntotal(), 1, 15); + err = clusters_.CreateCnumVsTime(*((DataSet_integer*)cnumvtime_), metric_->Ntotal(), 1, 15); else - err = clusters_.CreateCnumVsTime((DataSet_integer*)cnumvtime_, metric_->Ntotal(), 0, -1); + err = clusters_.CreateCnumVsTime(*((DataSet_integer*)cnumvtime_), metric_->Ntotal(), 0, -1); if (err != 0) { mprinterr("Error: Creation of cluster num vs time data set failed.\n"); return 1; } } + // TODO DrawGraph + + // # unique clusters vs time + if (clustersVtime_ != 0) { + if (clusters_.NclustersObserved(*((DataSet_integer*)clustersVtime_), metric_->Ntotal(), + windowSize_)) + { + mprinterr("Error: Creation of # unique clusters vs time data set failed.\n"); + return 1; + } + } + // Cluster population vs time if (cpopvtimefile_ != 0) { MetaData md( dsname_, "Pop" ); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 924d90e60f..49fc35b126 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -88,6 +88,9 @@ class Control { DataSet* cnumvtime_; ///< Cluster number vs time data set. bool grace_color_; ///< If true change cluster number to grace color + DataSet* clustersVtime_; ///< Number of unique clusters vs time + int windowSize_; ///< Window size for determining number unique clusters v time + DataFile* cpopvtimefile_; ///< Cluster population vs time file. Node::CnormType norm_pop_; ///< Cluster pop vs time normalization type diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index b0e3dfc708..de39fd9871 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -24,15 +24,10 @@ void Cpptraj::Cluster::List::PrintClusters() const { * \param offset If specified, add offset to cluster numbers. * \param maxCluster If specified, number clusters beyond maxCluster equal to maxCluster */ -int Cpptraj::Cluster::List::CreateCnumVsTime(DataSet_integer* ds, unsigned int maxFrames, +int Cpptraj::Cluster::List::CreateCnumVsTime(DataSet_integer& cnum_temp, unsigned int maxFrames, int offset, int maxCluster) const { - if (ds == 0) { - mprinterr("Internal Error: CreateCnumVsTime() called with null data set\n"); - return 1; - } - DataSet_integer& cnum_temp = static_cast( *ds ); cnum_temp.Resize( maxFrames ); // Make all clusters start at -1. This way cluster algorithms that // have noise points (i.e. no cluster assigned) will be distinguished. @@ -66,6 +61,58 @@ const return 0; } +/** Determine how many different clusters are observed within a given time + * window. + */ +int Cpptraj::Cluster::List::NclustersObserved(DataSet_integer& clustersVtime, + unsigned int maxFrames, + int windowSize) +const +{ + if (windowSize < 1) { + mprinterr("Error: Invalid window size for number clusters observed vs time.\n"); + return 1; + } + // Determine number of windows + int nwindows = (int)maxFrames / windowSize; + if (((int)maxFrames % windowSize) != 0) nwindows++; + mprintf("DEBUG: %u frames, %i windows, window size %i.\n", maxFrames, nwindows, windowSize); + + // Create a bool array for each window that will record if cluster is present + // during that window. + typedef std::vector Barray; + typedef std::vector Warray; + Warray Windows; + Windows.reserve( nwindows ); + for (int cnum = 0; cnum != Nclusters(); cnum++) + Windows.push_back( Barray(Nclusters(), false) ); + + // Loop over clusters + for (cluster_iterator C = begincluster(); C != endcluster(); C++) + { + // Loop over cluster frames + for (Node::frame_iterator frame = C->beginframe(); frame != C->endframe(); frame++) + { + int wndw = *frame / windowSize; + Windows[wndw][C->Num()] = true; + } + } + + // Count number of unique clusters in each window + clustersVtime.Allocate( DataSet::SizeArray(1, nwindows) ); + int wndw = 0; + for (Warray::const_iterator window = Windows.begin(); window != Windows.end(); ++window, ++wndw) + { + int nunique = 0; + for (Barray::const_iterator cpresent = window->begin(); cpresent != window->end(); ++cpresent) + if (*cpresent) ++nunique; + clustersVtime.Add(wndw, &nunique); + } + + clustersVtime.SetDim(Dimension::X, Dimension(windowSize, windowSize, "Frame")); + return 0; +} + /** Sort clusters by population and renumber. */ int Cpptraj::Cluster::List::Sort() { clusters_.sort(); diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 2d820f7776..19739fcaac 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -46,7 +46,9 @@ class List { /// Remove clusters with no population void RemoveEmptyClusters(); /// Generate cluster number vs time data set - int CreateCnumVsTime(DataSet_integer*, unsigned int, int, int) const; + int CreateCnumVsTime(DataSet_integer&, unsigned int, int, int) const; + /// Generate number unique clusters vs time data set + int NclustersObserved(DataSet_integer&, unsigned int, int) const; /// Sort clusters by population and renumber. int Sort(); /// Add given frame as noise. From 804411c2630bfa48989503380e0121d0b34707c1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 11:28:19 -0500 Subject: [PATCH 170/417] DRR - Cpptraj: Hide some debug info --- src/DataSet_PairwiseCache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index f310856101..61282b60cf 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -26,12 +26,12 @@ int DataSet_PairwiseCache::SetupFrameToIdx(Cframes const& framesToCache, unsigne int idx = 0; for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) frameToIdx_[*it] = idx++; -//# ifdef DEBUG_CLUSTER +# ifdef DEBUG_CLUSTER // DEBUG mprintf("DEBUG: frameToMat\n"); for (Cframes_it it = frameToIdx_.begin(); it != frameToIdx_.end(); ++it) mprintf("\tframeToIdx_[%u] = %i\n", it - frameToIdx_.begin(), *it); -//# endif +# endif return 0; } From a47c2dbdaee93157aed4d164c5a0ee5f38b12974 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 11:28:30 -0500 Subject: [PATCH 171/417] DRR - Cpptraj: Fix initialization --- src/Cluster/List.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index de39fd9871..6df70b12b7 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -84,7 +84,7 @@ const typedef std::vector Warray; Warray Windows; Windows.reserve( nwindows ); - for (int cnum = 0; cnum != Nclusters(); cnum++) + for (int w = 0; w != nwindows; w++) Windows.push_back( Barray(Nclusters(), false) ); // Loop over clusters From 2a6d9c120f3454a3982d67ef455a0add0f21db81 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 11:32:46 -0500 Subject: [PATCH 172/417] DRR - Cpptraj: Number unique clusters vs time calc now has info for windows when window size not evenly divisible by number of frames. --- test/Test_Cluster_DataSet/cvt.dat.save | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Test_Cluster_DataSet/cvt.dat.save b/test/Test_Cluster_DataSet/cvt.dat.save index 38c7f77c78..a70f0a89d0 100644 --- a/test/Test_Cluster_DataSet/cvt.dat.save +++ b/test/Test_Cluster_DataSet/cvt.dat.save @@ -9,3 +9,4 @@ 80 4 90 2 100 1 + 110 1 From b8734c9fd60897a4effd3054f58dee3d8a12ff60 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 11:52:17 -0500 Subject: [PATCH 173/417] DRR - Cpptraj: Ensure noise points are incremented by offset as well when creating cluster num vs time. Do not print pseudo F when fewer than 2 clusters. Fix cluster restore by centroid and epsilon. --- src/Cluster/List.cpp | 5 +++-- src/Cluster/Output.cpp | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 6df70b12b7..59cb836ab1 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -31,7 +31,7 @@ const cnum_temp.Resize( maxFrames ); // Make all clusters start at -1. This way cluster algorithms that // have noise points (i.e. no cluster assigned) will be distinguished. - std::fill(cnum_temp.begin(), cnum_temp.end(), -1); + std::fill(cnum_temp.begin(), cnum_temp.end(), NOISE + offset); if (offset == 0 && maxCluster < 0) { for (cluster_iterator C = begincluster(); C != endcluster(); C++) @@ -276,7 +276,8 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric progress.Finish(); // Now actually add sieved frames to their appropriate clusters for (idx = 0; idx < nframes; idx++) - idxToCluster[idx]->AddFrameToCluster( framesIn[idx] ); + if (idxToCluster[idx] != clusters_.end()) + idxToCluster[idx]->AddFrameToCluster( framesIn[idx] ); mprintf("\t%i of %i sieved frames were discarded as noise.\n", n_sieved_noise, Nsieved); } diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index 750602d010..6708e36d90 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -44,10 +44,13 @@ void Cpptraj::Cluster::Output::PrintClustersToFile(CpptrajFile& outfile, outfile.Printf("#Cluster %i has average-distance-to-centroid %f\n", C->Num(), *avgd); outfile.Printf("#DBI: %f\n", DBITotal); // Pseudo-F - double SSRSST = 0.0; - double pseudof = clusters.ComputePseudoF( SSRSST, metricIn ); - outfile.Printf("#pSF: %f\n", pseudof); - outfile.Printf("#SSR/SST: %f\n", SSRSST); + if (clusters.Nclusters() > 1) { + double SSRSST = 0.0; + double pseudof = clusters.ComputePseudoF( SSRSST, metricIn ); + outfile.Printf("#pSF: %f\n", pseudof); + outfile.Printf("#SSR/SST: %f\n", SSRSST); + } else + mprintf("Warning: Fewer than 2 cluster. Not calculating pseudo-F.\n"); // Call internal info routine. algorithmIn.Results( outfile ); From 5f1e0e8ec3ae8f7adb7d15e11eade1f415c7f433 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 11:54:01 -0500 Subject: [PATCH 174/417] DRR - Cpptraj: Another fix for add frames by centroid --- src/Cluster/List.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 59cb836ab1..ab322bbe4f 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -192,7 +192,8 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric } // END pragma omp parallel // Now actually add sieved frames to their appropriate clusters for (idx = 0; idx < nframes; idx++) - idxToCluster[idx]->AddFrameToCluster( framesIn[idx] ); + if (idxToCluster[idx] != clusters_.end()) + idxToCluster[idx]->AddFrameToCluster( framesIn[idx] ); # endif progress.Finish(); } From 4c1c1f82b71891b40cd2cab75e3f27dab20f67e6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 12:00:34 -0500 Subject: [PATCH 175/417] DRR - Cpptraj: init some variables --- src/Cluster/Results_Coords.cpp | 11 +++++++++++ src/Cluster/Results_Coords.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 5c6bfb7104..5e7c5b6d8e 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -7,6 +7,17 @@ const TrajectoryFile::TrajFormatType Cpptraj::Cluster::Results_Coords::DEF_TRAJ_FMT_ = TrajectoryFile::AMBERTRAJ; +/// CONSTRUCTOR +Cpptraj::Cluster::Results_Coords::Results_Coords(DataSet_Coords* ds) : + Results(COORDS), + coords_(ds), + writeRepFrameNum_(false), + clusterfmt_(TrajectoryFile::UNKNOWN_TRAJ), + singlerepfmt_(TrajectoryFile::UNKNOWN_TRAJ), + reptrajfmt_(TrajectoryFile::UNKNOWN_TRAJ), + avgfmt_(TrajectoryFile::UNKNOWN_TRAJ) +{} + void Cpptraj::Cluster::Results_Coords::GetClusterTrajArgs(ArgList& argIn, const char* trajKey, const char* fmtKey, diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index a82f9c679c..03fa845d95 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -9,7 +9,7 @@ namespace Cluster { /// Class for handling cluster results specific to COORDS input data. class Results_Coords : public Results { public: - Results_Coords(DataSet_Coords* ds) : Results(COORDS), coords_(ds) {} + Results_Coords(DataSet_Coords*); // ----- Results functions ------------------- int GetOptions(ArgList&); void Info() const; From a20905026f1aa0eb6685e54fe93796d17222eb35 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 12:19:20 -0500 Subject: [PATCH 176/417] DRR - Cpptraj: Support includesieved_cdist keyword again --- src/Cluster/Control.cpp | 41 ++++++++++++++++++++++++++++++++--------- src/Cluster/Control.h | 1 + src/Cluster/Output.cpp | 5 +++-- src/Cluster/Output.h | 2 +- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index df1a617bc0..3d77182c5d 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -28,6 +28,7 @@ Cpptraj::Cluster::Control::Control() : sieveRestore_(NO_RESTORE), restoreEpsilon_(0.0), includeSieveInCalc_(false), + includeSieveCdist_(false), bestRep_(BestReps::NO_REPS), nRepsToSave_(1), suppressInfo_(false), @@ -345,7 +346,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, // ----------------------------------------------------------------------------- const char* Cpptraj::Cluster::Control::CommonArgs_ = - "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [sievetoframe]] " + "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [includesieved_cdist] [sievetoframe]] " "[bestrep {cumulative|centroid|cumulative_nosieve} [savenreps <#>]] " "[noinfo|info ] [summary ] [sil ] " "[cpopvtime [{normpop|normframe}]] " @@ -388,6 +389,7 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da includeSieveInCalc_ = analyzeArgs.hasKey("includesieveincalc"); if (includeSieveInCalc_) mprintf("Warning: 'includesieveincalc' may be very slow.\n"); + includeSieveCdist_ = analyzeArgs.hasKey("includesieved_cdist"); // Determine how frames to cluster will be chosen if (frameSelect_ == UNSPECIFIED) { @@ -531,12 +533,6 @@ void Cpptraj::Cluster::Control::Info() const { if (sieveSeed_ > 0) mprintf(" using random seed %i", sieveSeed_); mprintf(".\n"); } - if (sieve_ != 1) { - if (includeSieveInCalc_) - mprintf("\tAll frames (including sieved) will be used to calc within-cluster average.\n"); - else - mprintf("\tOnly non-sieved frames will be used to calc within-cluster average.\n"); - } if (sieveRestore_ != NO_RESTORE) { mprintf("\tRestoring sieved frames"); if (sieveRestore_ == CLOSEST_CENTROID) @@ -562,8 +558,15 @@ void Cpptraj::Cluster::Control::Info() const { if (!clusterinfo_.empty()) mprintf("\tCluster information will be written to %s\n",clusterinfo_.c_str()); - if (!summaryfile_.empty()) + if (!summaryfile_.empty()) { mprintf("\tSummary of cluster results will be written to %s\n",summaryfile_.c_str()); + if (sieve_ != 1) { + if (includeSieveInCalc_) + mprintf("\tInternal cluster averages will include sieved frames.\n"); + if (includeSieveCdist_) + mprintf("\tBetween-cluster distances will include sieved frames.\n"); + } + } if (!sil_file_.empty()) { mprintf("\tFrame silhouettes will be written to %s.frame.dat, cluster silhouettes\n" "\t will be written to %s.cluster.dat\n", sil_file_.c_str(), sil_file_.c_str()); @@ -575,6 +578,26 @@ void Cpptraj::Cluster::Control::Info() const { } } + if (cnumvtime_ != 0) { + mprintf("\tCluster number vs time data set: %s\n", cnumvtime_->legend()); + if (grace_color_) + mprintf("\tGrace color instead of cluster number (1-15, 0 = noise) will be saved.\n"); + } + + if (clustersVtime_ != 0) { + mprintf("\tNumber of unique clusters observed over windows of size %i data set: %s\n", + windowSize_, clustersVtime_->legend()); + } + + if (cpopvtimefile_ != 0) { + mprintf("\tCluster pop vs time will be written to %s", cpopvtimefile_->DataFilename().base()); + if (norm_pop_ == Node::CLUSTERPOP) + mprintf(" (normalized by cluster size)"); + else if (norm_pop_ == Node::FRAME) + mprintf(" (normalized by frame)"); + mprintf("\n"); + } + if (!splitfile_.empty()) { mprintf("\tSummary comparing parts of trajectory data for clusters will be written to %s\n", splitfile_.c_str()); @@ -747,7 +770,7 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { return 1; } Output::Summary(outfile, clusters_, *algorithm_, pmatrix_, includeSieveInCalc_, - frameSieve_.SievedOut()); + includeSieveCdist_, frameSieve_.SievedOut()); timer_output_summary_.Stop(); } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 49fc35b126..93590b74e8 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -76,6 +76,7 @@ class Control { SieveRestoreType sieveRestore_; ///< Specify if/how sieved frames should be restored. double restoreEpsilon_; ///< Cutoff to use if restoring by epsilon to centroids. bool includeSieveInCalc_; ///< If true include sieved frames in later calculations. + bool includeSieveCdist_; ///< If true include sieved frames in cluster distance calc. BestReps::RepMethodType bestRep_; ///< How to determine best rep frames. int nRepsToSave_; ///< How many rep frames to save. diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index 6708e36d90..0e0a2ddf71 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -161,7 +161,8 @@ unsigned int Cpptraj::Cluster::Output::DetermineNameWidth(List const& clusters) /** Print a summary of clusters. */ int Cpptraj::Cluster::Output::Summary(CpptrajFile& outfile, List const& clusters, Algorithm const& algorithm, - PairwiseMatrix const& pmatrix, bool includeSieved, + PairwiseMatrix const& pmatrix, + bool includeSieved, bool includeSieveCdist, Cframes const& sievedOut) { double fmax = (double)pmatrix.DistMetric().Ntotal(); @@ -191,7 +192,7 @@ int Cpptraj::Cluster::Output::Summary(CpptrajFile& outfile, List const& clusters for (List::cluster_iterator c2 = c1; c2 != clusters.endcluster(); ++c2) if (c2 != c1) cluster_distances.addElement( algorithm.ClusterDistance( *c1, *c2, pmatrix, - includeSieved, sievedOut ) ); + includeSieveCdist, sievedOut ) ); //t_cdist.Stop(); unsigned int idx1 = 0; diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h index 23811410cc..e5e6095b42 100644 --- a/src/Cluster/Output.h +++ b/src/Cluster/Output.h @@ -18,7 +18,7 @@ class Output { static int PrintSilhouetteFrames(CpptrajFile&, List const&); static int PrintSilhouettes(CpptrajFile&, List const&); static int Summary(CpptrajFile&, List const&, Algorithm const&, PairwiseMatrix const&, - bool, Cframes const&); + bool, bool, Cframes const&); static void Summary_Part(CpptrajFile&, unsigned int, Cframes const&, List const&); private: static unsigned int DetermineNameWidth(List const&); From 7ce3a80f758e2f50b938bbc43a06e09f6eaca735 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 12:49:56 -0500 Subject: [PATCH 177/417] DRR - Cpptraj: Fix symmetric rmsd metric init and setup --- src/Cluster/Metric_SRMSD.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Metric_SRMSD.cpp b/src/Cluster/Metric_SRMSD.cpp index 8565f4d908..1d1d4c5222 100644 --- a/src/Cluster/Metric_SRMSD.cpp +++ b/src/Cluster/Metric_SRMSD.cpp @@ -12,7 +12,7 @@ int Cpptraj::Cluster::Metric_SRMSD::Init(DataSet_Coords* dIn, AtomMask const& ma } coords_ = dIn; mask_ = maskIn; - SRMSD_ = SymmetricRmsdCalc(mask_, !nofit, useMass, coords_->Top(), debugIn); + SRMSD_.InitSymmRMSD(!nofit, useMass, debugIn); return 0; } @@ -20,6 +20,8 @@ int Cpptraj::Cluster::Metric_SRMSD::Setup() { if (coords_->Top().SetupIntegerMask( mask_ )) return 1; mprintf("DEBUG: SRMSD metric topology: %s %s %i\n", coords_->legend(), coords_->Top().c_str(), coords_->Top().Natom()); + // false = no remap warning + if (SRMSD_.SetupSymmRMSD(coords_->Top(), mask_, false)) return 1; frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms()); frm2_ = frm1_; return 0; From 2450a1c89d335936ab7cf17f608cf50c4271af37 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 13:06:04 -0500 Subject: [PATCH 178/417] DRR - Cpptraj: Add 'lifetime' keyword --- src/Cluster/Control.cpp | 30 +++++++++++++++++++++++++++++- src/Cluster/Control.h | 2 ++ src/Cluster/Node.cpp | 9 +++++++++ src/Cluster/Node.h | 3 +++ src/cpptrajdepend | 2 +- 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 3d77182c5d..d85720c84e 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -37,7 +37,8 @@ Cpptraj::Cluster::Control::Control() : clustersVtime_(0), windowSize_(0), cpopvtimefile_(0), - norm_pop_(Node::NONE) + norm_pop_(Node::NONE), + calc_lifetimes_(false) {} Cpptraj::Cluster::Control::~Control() { @@ -471,6 +472,10 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da DataFile* clustersvtimefile = DFL.AddDataFile(analyzeArgs.GetStringKey("clustersvtime"), analyzeArgs); windowSize_ = analyzeArgs.getKeyInt("cvtwindow", 0); + + // Create cluster lifetime data sets? + calc_lifetimes_ = analyzeArgs.hasKey("lifetime"); + // Cluster number vs time grace_color_ = analyzeArgs.hasKey("gracecolor"); DataFile* cnumvtimefile = DFL.AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); @@ -598,6 +603,9 @@ void Cpptraj::Cluster::Control::Info() const { mprintf("\n"); } + if (calc_lifetimes_) + mprintf("\tCluster lifetime data sets will be created with aspect 'Lifetime'\n"); + if (!splitfile_.empty()) { mprintf("\tSummary comparing parts of trajectory data for clusters will be written to %s\n", splitfile_.c_str()); @@ -734,6 +742,7 @@ int Cpptraj::Cluster::Control::Run() { return 0; } +/** Write results to files etc. */ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { timer_output_.Start(); // Info @@ -828,6 +837,25 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { } } + // Cluster lifetime sets + if (calc_lifetimes_) { + MetaData md( dsname_, "Lifetime" ); + DataSet::SizeArray setsize(1, metric_->Ntotal()); + for (List::cluster_iterator node = clusters_.begin(); + node != clusters_.end(); ++node) + { + md.SetIdx( node->Num() ); + DataSet_integer* ds = (DataSet_integer*)DSL.AddSet( DataSet::INTEGER, md ); + if (ds == 0) { + mprinterr("Error: Could not allocate cluster lifetime DataSet\n"); + return 1; + } + ds->Allocate( setsize ); + node->CreateLifetimeSet( *ds, metric_->Ntotal() ); + } + } + + // Any other results if (results_ != 0) { timer_output_results_.Start(); results_->DoOutput( clusters_ ); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 93590b74e8..114bf03d94 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -95,6 +95,8 @@ class Control { DataFile* cpopvtimefile_; ///< Cluster population vs time file. Node::CnormType norm_pop_; ///< Cluster pop vs time normalization type + bool calc_lifetimes_; ///< If true create cluster lifetime data sets + std::string splitfile_; ///< Output file for splitting cluster results Cframes splitFrames_; ///< Frames at which to split diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index 704b52175b..e5b49a4e3a 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -167,3 +167,12 @@ const } } } + +/** Create cluster "lifetime" set, with 1 for cluster present and 0 for absent. */ +void Cpptraj::Cluster::Node::CreateLifetimeSet(DataSet_integer& life, unsigned int maxFrames) +const +{ + life.Resize( maxFrames ); + for (frame_iterator f = beginframe(); f != endframe(); ++f) + life[ *f ] = 1; +} diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 851814d8f6..e8ebabb47f 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -2,6 +2,7 @@ #define INC_CLUSTER_NODE_H #include "PairwiseMatrix.h" #include "../DataSet_float.h" +#include "../DataSet_integer.h" namespace Cpptraj { namespace Cluster { @@ -113,6 +114,8 @@ class Node { /// Calculate cluster population vs time. void CalcCpopVsTime(DataSet_float&, unsigned int, CnormType) const; + /// Create cluster lifetime set. + void CreateLifetimeSet(DataSet_integer&, unsigned int) const; private: Cframes frameList_; ///< List of frames belonging to this cluster. Centroid* centroid_; ///< Centroid of all frames in this cluster. diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 01c687171a..1c4cf4c5d5 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -159,7 +159,7 @@ Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../ArgList Cluster/Metric_Data_Manhattan.o : Cluster/Metric_Data_Manhattan.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.o : Cluster/Metric_SRMSD.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_SRMSD.h -Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Trajout_Single.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h From aba80e040c44683c51d2b655c7e9dcb8c0b1ab4c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 13:10:54 -0500 Subject: [PATCH 179/417] DRR - Cpptraj: Add unspecified algorithm type. --- src/Cluster/Algorithm.h | 2 +- src/Cluster/Control.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index 0262f96875..0ff3ea237b 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -9,7 +9,7 @@ namespace Cluster { /// Abstract base class for implementing clustering algorithms. class Algorithm { public: - enum AType { HIERAGGLO = 0, DBSCAN, DPEAKS, KMEANS }; + enum AType { HIERAGGLO = 0, DBSCAN, DPEAKS, KMEANS, UNSPECIFIED }; Algorithm(AType t) : debug_(0), type_(t) {} virtual ~Algorithm() {} diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index d85720c84e..4eba37e073 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -203,7 +203,7 @@ const char* Cpptraj::Cluster::Control::AlgorithmArgs_ = /** Set up Algorithm from keyword + arguments. */ int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { - Algorithm::AType atype; + Algorithm::AType atype = Algorithm::UNSPECIFIED; if (analyzeArgs.hasKey("hieragglo")) atype = Algorithm::HIERAGGLO; else if (analyzeArgs.hasKey("dbscan" )) atype = Algorithm::DBSCAN; else if (analyzeArgs.hasKey("kmeans") || From 6a2dd15048712f4b5900690862f1e21a00ebdd78 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 13:38:32 -0500 Subject: [PATCH 180/417] DRR - Cpptraj: Support readinfo etc keywords. In hier agglo clustering, check if target number of clusters present from the beginning. --- src/Cluster/Algorithm_HierAgglo.cpp | 5 +++ src/Cluster/Control.cpp | 68 +++++++++++++++++++++++++++++ src/Cluster/Control.h | 2 + 3 files changed, 75 insertions(+) diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 688eaf8d7f..ac83c79e74 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -105,6 +105,11 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, // Build initial clusters. if (clusters.empty()) buildInitialClusters(clusters, framesToCluster, pmatrix.MetricPtr()); + else if (clusters.Nclusters() <= nclusters_) { + mprintf("\tTarget number of clusters (%i) already reached (%i).\n", + nclusters_, clusters.Nclusters()); + return 0; + } mprintf("\t%i initial clusters.\n", clusters.Nclusters()); // Build initial cluster distance matrix. ClusterDistances_.SetupMatrix( clusters.Nclusters() ); diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 4eba37e073..3ca17215ff 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -3,6 +3,7 @@ #include "../DataSet_Coords.h" #include "Output.h" #include "../DataFile.h" // For loading pairwise cache +#include "../BufferedLine.h" // For loading info file // Metric classes #include "Metric_RMS.h" #include "Metric_DME.h" @@ -345,6 +346,66 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, return Common(analyzeArgs, DSL, DFL); } +// ----------------------------------------------------------------------------- +static int Err(int code) { + switch (code) { + case 0: mprinterr("Error: Could not open info file.\n"); break; + case 1: mprinterr("Error: Unexpected end of info file.\n"); break; + case 2: mprinterr("Error: Invalid number of clusters in info file.\n"); break; + case 3: mprinterr("Error: Invalid number of frames in info file.\n"); break; + } + return 1; +} + +/** Read clustering info from existing info file. */ +int Cpptraj::Cluster::Control::ReadInfo(std::string const& fname) { + if (fname.empty()) { + mprinterr("Error: No cluster info filename given.\n"); + return 1; + } + BufferedLine infile; + if (infile.OpenFileRead( fname )) return Err(0); + const char* ptr = infile.Line(); + if (ptr == 0) return Err(1); + ArgList infoLine( ptr, " " ); + int nclusters = infoLine.getKeyInt("#Clustering:", -1); + if (nclusters == -1) return Err(2); + int nframes = infoLine.getKeyInt("clusters", -1); + if (nframes == -1) return Err(3); + mprintf("\tNumber of frames in info file: %i\n", nframes); +// if (nframes != (int)FrameDistances().OriginalNframes()) { +// mprinterr("Error: # frames in cluster info file (%i) does not match" +// " current # frames (%zu)\n", nframes, FrameDistances().OriginalNframes()); +// return 1; +// } + // Scan down to clusters + std::string algorithmStr; + while (ptr[0] == '#') { + ptr = infile.Line(); + if (ptr == 0) return Err(1); + // Save previous clustering info. Includes newline. + if (ptr[1] == 'A' && ptr[2] == 'l' && ptr[3] == 'g') + algorithmStr.assign( ptr + 12 ); // Right past '#Algorithm: ' + } + if (!algorithmStr.empty()) mprintf("\tAlgorithm in info file: %s\n", algorithmStr.c_str()); + // Read clusters + Cframes frames; + for (int cnum = 0; cnum != nclusters; cnum++) { + if (ptr == 0) return Err(1); + frames.clear(); + // TODO: Check for busted lines? + for (int fidx = 0; fidx != nframes; fidx++) { + if (ptr[fidx] == 'X') + frames.push_back( fidx ); + } + clusters_.AddCluster( Node(metric_, frames, cnum) ); + mprintf("\tRead cluster %i, %zu frames.\n", cnum, frames.size()); + ptr = infile.Line(); + } + infile.CloseFile(); + return 0; +} + // ----------------------------------------------------------------------------- const char* Cpptraj::Cluster::Control::CommonArgs_ = "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [includesieved_cdist] [sievetoframe]] " @@ -359,6 +420,13 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da { clusters_.SetDebug( verbose_ ); + // Initialize clusters from existing info file. Metric must already be set up. + if (analyzeArgs.hasKey("readinfo") || + analyzeArgs.hasKey("readtxt")) + { + if (ReadInfo( analyzeArgs.GetStringKey("infofile") )) return 1; + } + if (results_ != 0) { if (results_->GetOptions(analyzeArgs)) return 1; } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 114bf03d94..34fc448058 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -54,6 +54,8 @@ class Control { static Algorithm* AllocateAlgorithm(Algorithm::AType); int AllocateAlgorithm(ArgList&); + int ReadInfo(std::string const&); + int Common(ArgList&, DataSetList&, DataFileList&); static const char* DEFAULT_PAIRDIST_NAME_; From 8af5a0b67c4b12f6029fce21d7428a05f49c6a81 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 13:44:35 -0500 Subject: [PATCH 181/417] DRR - Cpptraj: Remove Makefile from Cluster - unused and unneeded. --- src/Cluster/Makefile | 51 -------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/Cluster/Makefile diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile deleted file mode 100644 index db96e19e45..0000000000 --- a/src/Cluster/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# Cpptraj Cluster Makefile -include ../../config.h - -# Variables -AR = ar cqs -DEL_FILE = /bin/rm -f -TARGET = libcpptraj_cluster.a - -# Source files to be compiled -SOURCES= \ - Algorithm_HierAgglo.cpp \ - Centroid_Coord.cpp \ - Control.cpp \ - List.cpp \ - Metric_RMS.cpp \ - Node.cpp \ - PairwiseMatrix.cpp \ - PairwiseMatrix_MEM.cpp - -# Objects -OBJECTS=$(SOURCES:.cpp=.o) - -# Default target -all: $(TARGET) - -# Library target -$(TARGET): $(OBJECTS) - -$(DEL_FILE) $(TARGET) - $(AR) $(TARGET) $(OBJECTS) - -# Install all targets -install: all - -# Dependency targets -../findDepend: ../FindDepend.o - $(CXX) -o ../findDepend ../FindDepend.o - -depend: ../findDepend - ../findDepend $(SOURCES) > clusterdepend - -#dependclean: -# /bin/rm -f ../FindDepend.o ../findDepend - -# Clean/uninstall targets -clean: - $(DEL_FILE) $(OBJECTS) - -uninstall: clean - -# Header dependencies -include clusterdepend From 400c80bbd8390bfcfb09a27b99395adf274f699b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 13:53:27 -0500 Subject: [PATCH 182/417] DRR - Cpptraj: Add ability to continue kmeans clustering --- src/Cluster/Algorithm_Kmeans.cpp | 39 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index ec18856ebf..0875da7283 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -57,15 +57,6 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, Cframes const& framesToCluster, PairwiseMatrix const& pmatrix) { - // TODO handle case where there are existing clusters. - if (!clusters.empty()) { - mprinterr("Internal Error: Kmeans not set up for existing clusters yet.\n"); - return 1; - } - - // Determine seeds - FindKmeansSeeds( framesToCluster, pmatrix ); - if (mode_ == RANDOM) RN_.rn_set( kseed_ ); @@ -79,18 +70,26 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, for (int processIdx = 0; processIdx != pointCount; processIdx++) PointIndices.push_back( processIdx ); - // Add the seed clusters - for (Iarray::const_iterator seedIdx = SeedIndices_.begin(); - seedIdx != SeedIndices_.end(); ++seedIdx) - { - int seedFrame = framesToCluster[ *seedIdx ]; - // A centroid is created for new clusters. - clusters.AddCluster( Node(pmatrix.MetricPtr(), Cframes(1, seedFrame), clusters.Nclusters()) ); - // NOTE: No need to calc best rep frame, only 1 frame. - if (debug_ > 0) - mprintf("Put frame %i in cluster %i (seed index=%i).\n", - seedFrame, clusters.back().Num(), *seedIdx); + if (clusters.empty()) { + // Determine seeds + FindKmeansSeeds( framesToCluster, pmatrix ); + // Add the seed clusters + for (Iarray::const_iterator seedIdx = SeedIndices_.begin(); + seedIdx != SeedIndices_.end(); ++seedIdx) + { + int seedFrame = framesToCluster[ *seedIdx ]; + // A centroid is created for new clusters. + clusters.AddCluster( Node(pmatrix.MetricPtr(), Cframes(1, seedFrame), clusters.Nclusters()) ); + // NOTE: No need to calc best rep frame, only 1 frame. + if (debug_ > 0) + mprintf("Put frame %i in cluster %i (seed index=%i).\n", + seedFrame, clusters.back().Num(), *seedIdx); + } + } else { + // Ensure centroids are up to date. + clusters.UpdateCentroids( pmatrix.MetricPtr() ); } + // Assign points in 3 passes. If a point looked like it belonged to cluster A // at first, but then we added many other points and altered our cluster // shapes, its possible that we will want to reassign it to cluster B. From f3b491e9c520bfe84577047ca1ef69d1047e98af Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 14:04:20 -0500 Subject: [PATCH 183/417] DRR - Cpptraj: Use epsilon sieve restore for dpeaks. Dont do output stuff if no clusters found. --- src/Cluster/Algorithm.h | 2 + src/Cluster/Algorithm_DBscan.cpp | 98 ------------------------------- src/Cluster/Algorithm_DBscan.h | 2 - src/Cluster/Algorithm_DPeaks.h | 1 + src/Cluster/Control.cpp | 99 +++++++++++++++++--------------- 5 files changed, 56 insertions(+), 146 deletions(-) diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index 0ff3ea237b..11c8731fc3 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -26,6 +26,8 @@ class Algorithm { /// /return Algorithm-specific between-cluster distance. Default to centroid distance. virtual double ClusterDistance(Node const&, Node const&, PairwiseMatrix const&, bool, Cframes const&) const; + /// /return Epsilon for density-based algorithms; intended for use with sieve restore. + virtual double Epsilon() const { return 0.0; } // ------------------------------------------- /// Set debug level for algorithm void SetDebug(int d) { debug_ = d; } diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index d8dc9626af..c531ed4e88 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -228,105 +228,7 @@ void Cpptraj::Cluster::Algorithm_DBscan::RegionQuery(Iarray& NeighborPts, void Cpptraj::Cluster::Algorithm_DBscan::Results(CpptrajFile& outfile) const { outfile.Printf("#Algorithm: DBSCAN minpoints %i epsilon %g sieveToCentroid %i\n", minPoints_, epsilon_, (int)sieveToCentroid_); -/* TODO implement elsewhere - // List the number of noise points. - outfile.Printf("#NOISE_FRAMES:"); - unsigned int numNoise = 0; - for (unsigned int idx = 0; idx != Status_.size(); ++idx) - { - if ( Status_[idx] == NOISE ) { - outfile.Printf(" %u", FrameDistances().FramesToCluster()[idx]+1); - ++numNoise; - } - } - outfile.Printf("\n"); - outfile.Printf("#Number_of_noise_frames: %u\n", numNoise); -*/ -} - -/* -// Cluster_DBSCAN::AddSievedFrames() -void Cpptraj::Cluster::Algorithm_DBscan::AddSievedFrames() { - // NOTE: All cluster centroids must be up to date! - if (sieveToCentroid_) - mprintf("\tRestoring sieved frames if within %.3f of cluster centroid.\n", epsilon_); - else - mprintf("\tRestoring sieved frames if within %.3f of frame in nearest cluster.\n", - epsilon_); - // Vars allocated here in case of OpenMP - int n_sieved_noise = 0; - int Nsieved = 0; - int frame; - int nframes = (int)FrameDistances().OriginalNframes(); - ParallelProgress progress( nframes ); - // Need a temporary array to hold which frame belongs to which cluster. - // Otherwise we could be comparoing sieved frames to other sieved frames. - std::vector frameToCluster( nframes, clusters_.end() ); - // For OMP, every other thread will need its own Cdist. - ClusterDist* MyCdist = Cdist_; -# ifdef _OPENMP -# pragma omp parallel private(MyCdist, frame) firstprivate(progress) reduction(+ : Nsieved, n_sieved_noise) - { - int mythread = omp_get_thread_num(); - progress.SetThread( mythread ); - if (mythread == 0) { - mprintf("\tParallelizing calculation with %i threads\n", omp_get_num_threads()); - MyCdist = Cdist_; - } else - MyCdist = Cdist_->Copy(); -# pragma omp for schedule(dynamic) -# endif - for (frame = 0; frame < nframes; ++frame) { - progress.Update( frame ); - if (FrameDistances().FrameWasSieved(frame)) { - // Which clusters centroid is closest to this frame? - double mindist = std::numeric_limits::max(); - cluster_it minNode = clusters_.end(); - for (cluster_it Cnode = clusters_.begin(); Cnode != clusters_.end(); ++Cnode) { - double dist = MyCdist->FrameCentroidDist(frame, Cnode->Cent()); - if (dist < mindist) { - mindist = dist; - minNode = Cnode; - } - } - bool goodFrame = false; - if ( mindist < epsilon_ ) - // Frame is already within epsilon, accept. - goodFrame = true; - else if ( !sieveToCentroid_ ) { - // Check if any frames in the cluster are closer than epsilon to sieved frame. - for (int cidx=0; cidx < minNode->Nframes(); cidx++) - { - if ( MyCdist->FrameDist(frame, minNode->ClusterFrame(cidx)) < epsilon_ ) - { - goodFrame = true; - break; - } - } - } - // Add sieved frame to the closest cluster if closest distance is - // less than epsilon. - ++Nsieved; - if ( goodFrame ) - frameToCluster[frame] = minNode; - else - n_sieved_noise++; - } - } // END loop over frames -# ifdef _OPENMP - if (mythread > 0) - delete MyCdist; - } // END pragma omp parallel -# endif - progress.Finish(); - // Now actually add sieved frames to their appropriate clusters - for (frame = 0; frame < nframes; frame++) - if (frameToCluster[frame] != clusters_.end()) - frameToCluster[frame]->AddFrameToCluster( frame ); - mprintf("\t%i of %i sieved frames were discarded as noise.\n", - n_sieved_noise, Nsieved); } -*/ /** For each point p, calculate function Kdist(p) which is the distance of * the Kth nearest point to p. diff --git a/src/Cluster/Algorithm_DBscan.h b/src/Cluster/Algorithm_DBscan.h index ead9cc8168..6df15b2fd5 100644 --- a/src/Cluster/Algorithm_DBscan.h +++ b/src/Cluster/Algorithm_DBscan.h @@ -16,8 +16,6 @@ class Algorithm_DBscan : public Algorithm { void Results(CpptrajFile&) const; int DoClustering(List&, Cframes const&, PairwiseMatrix const&); void Timing(double) const {} - - //void AddSievedFrames(); // TODO fix this double Epsilon() const { return epsilon_; } private: typedef std::vector Iarray; diff --git a/src/Cluster/Algorithm_DPeaks.h b/src/Cluster/Algorithm_DPeaks.h index aaab3f613d..5f5940a3d6 100644 --- a/src/Cluster/Algorithm_DPeaks.h +++ b/src/Cluster/Algorithm_DPeaks.h @@ -14,6 +14,7 @@ class Algorithm_DPeaks : public Algorithm { void Results(CpptrajFile&) const; int DoClustering(List&, Cframes const&, PairwiseMatrix const&); void Timing(double) const {} + double Epsilon() const { return epsilon_; } private: void AssignClusterNum(int, int&); int Cluster_GaussianKernel(Cframes const&, PairwiseMatrix const&); diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 3ca17215ff..8dde2ceea3 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -479,12 +479,14 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da if (sieve_ != 1) { sieveRestore_ = CLOSEST_CENTROID; - if (algorithm_->Type() == Algorithm::DBSCAN) { + if (algorithm_->Type() == Algorithm::DBSCAN || + algorithm_->Type() == Algorithm::DPEAKS) + { if (!analyzeArgs.hasKey("sievetoframe")) sieveRestore_ = EPSILON_CENTROID; else sieveRestore_ = EPSILON_FRAME; - restoreEpsilon_ = ((Algorithm_DBscan*)algorithm_)->Epsilon(); + restoreEpsilon_ = algorithm_->Epsilon(); } } @@ -755,63 +757,68 @@ int Cpptraj::Cluster::Control::Run() { timer_cluster_.Stop(); // --------------------------------------------- - timer_post_.Start(); - //Timer cluster_post_coords; - timer_post_renumber_.Start(); - // Update cluster centroids here in case they need to be used to - // restore sieved frames - clusters_.UpdateCentroids( metric_ ); - - // Add sieved frames to existing clusters. - if ( sieveRestore_ != NO_RESTORE ) { - // Restore sieved frames - mprintf("\tRestoring sieved frames.\n"); - switch (sieveRestore_) { - case CLOSEST_CENTROID : - clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metric_ ); break; - case EPSILON_CENTROID : - case EPSILON_FRAME : - clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metric_, - (sieveRestore_ == EPSILON_CENTROID), - restoreEpsilon_ ); - break; - default: - mprinterr("Internal Error: Unhandled sieve restore type.\n"); - return 1; - } - // Re-calculate the cluster centroids + if (clusters_.Nclusters() == 0) { + mprintf("\tNo clusters found.\n"); + } else { + timer_post_.Start(); + //Timer cluster_post_coords; + timer_post_renumber_.Start(); + // Update cluster centroids here in case they need to be used to + // restore sieved frames clusters_.UpdateCentroids( metric_ ); - } - // Sort by population and renumber - clusters_.Sort(); + // Add sieved frames to existing clusters. + if ( sieveRestore_ != NO_RESTORE ) { + // Restore sieved frames + mprintf("\tRestoring sieved frames.\n"); + switch (sieveRestore_) { + case CLOSEST_CENTROID : + clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metric_ ); break; + case EPSILON_CENTROID : + case EPSILON_FRAME : + clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metric_, + (sieveRestore_ == EPSILON_CENTROID), + restoreEpsilon_ ); + break; + default: + mprinterr("Internal Error: Unhandled sieve restore type.\n"); + return 1; + } + // Re-calculate the cluster centroids + clusters_.UpdateCentroids( metric_ ); + } - timer_post_renumber_.Stop(); - timer_post_bestrep_.Start(); + // Sort by population and renumber + clusters_.Sort(); - // Find best representative frames for each cluster. - if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, pmatrix_, - frameSieve_.SievedOut(), verbose_)) - { - mprinterr("Error: Finding best representative frames for clusters failed.\n"); - return 1; - } + timer_post_renumber_.Stop(); + timer_post_bestrep_.Start(); - timer_post_bestrep_.Stop(); + // Find best representative frames for each cluster. + if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, pmatrix_, + frameSieve_.SievedOut(), verbose_)) + { + mprinterr("Error: Finding best representative frames for clusters failed.\n"); + return 1; + } - // DEBUG - print clusters to stdout - if (verbose_ > 0) { - mprintf("\nFINAL CLUSTERS:\n"); - clusters_.PrintClusters(); - } + timer_post_bestrep_.Stop(); + + // DEBUG - print clusters to stdout + if (verbose_ > 0) { + mprintf("\nFINAL CLUSTERS:\n"); + clusters_.PrintClusters(); + } - // TODO assign reference names + // TODO assign reference names + } timer_run_.Stop(); return 0; } /** Write results to files etc. */ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { + if (clusters_.Nclusters() == 0) return 0; timer_output_.Start(); // Info if (!suppressInfo_) { From 1556e2547535a9934f3874d845fc376e15f9d721 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 14:19:38 -0500 Subject: [PATCH 184/417] DRR - Cpptraj: Allow density peaks to restart --- src/Cluster/Algorithm_DPeaks.cpp | 16 ++++++++++++++++ src/Cluster/Algorithm_DPeaks.h | 1 + src/Cluster/Cframes.cpp | 6 ++++++ src/Cluster/Cframes.h | 1 + 4 files changed, 24 insertions(+) diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index 7b31cda8c8..964ccf3a15 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -112,6 +112,9 @@ int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, "Info: '%s'. Re-run the algorithm with appropriate distancecut and densitycut.\n", dvdfile_.c_str()); return 0; + } else if (clusters.Nclusters() > 0) { + nclusters = clusters.Nclusters(); + ChoosePointsFromClusters( clusters, framesToCluster ); } else if (choosePoints_ == MANUAL) nclusters = ChoosePointsManually(); else @@ -421,6 +424,19 @@ int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_DiscreteDensity(Cframes const& f return 0; } +int Cpptraj::Cluster::Algorithm_DPeaks::ChoosePointsFromClusters(List const& clusters, + Cframes const& framesToCluster) +{ + for (List::cluster_iterator C = clusters.begincluster(); C != clusters.endcluster(); ++C) + for (Node::frame_iterator frm = C->beginframe(); frm != C->endframe(); ++frm) + { + int idx = framesToCluster.FrameIdx( *frm ); + if (idx != -1) + Points_[idx].SetCluster( C->Num() ); + } + return 0; +} + int Cpptraj::Cluster::Algorithm_DPeaks::ChoosePointsManually() { int cnum = 0; for (Carray::iterator point = Points_.begin(); point != Points_.end(); ++point) { diff --git a/src/Cluster/Algorithm_DPeaks.h b/src/Cluster/Algorithm_DPeaks.h index 5f5940a3d6..9ece578fda 100644 --- a/src/Cluster/Algorithm_DPeaks.h +++ b/src/Cluster/Algorithm_DPeaks.h @@ -21,6 +21,7 @@ class Algorithm_DPeaks : public Algorithm { int Cluster_DiscreteDensity(Cframes const&, PairwiseMatrix const&); int ChoosePointsAutomatically(); int ChoosePointsManually(); + int ChoosePointsFromClusters(List const&, Cframes const&); enum ChooseType {PLOT_ONLY = 0, MANUAL, AUTOMATIC}; std::string dvdfile_; diff --git a/src/Cluster/Cframes.cpp b/src/Cluster/Cframes.cpp index 1f37b85b0d..cc272a31b3 100644 --- a/src/Cluster/Cframes.cpp +++ b/src/Cluster/Cframes.cpp @@ -6,6 +6,12 @@ bool Cpptraj::Cluster::Cframes::HasFrame(int frame) const { return !(it == frames_.end()); } +int Cpptraj::Cluster::Cframes::FrameIdx(int frame) const { + Iarray::const_iterator it = std::find(frames_.begin(), frames_.end(), frame); + if (it == frames_.end()) return -1; + return (int)(it - frames_.begin()); +} + void Cpptraj::Cluster::Cframes::Remove(int frame) { Iarray::iterator pend = std::remove( frames_.begin(), frames_.end(), frame); std::size_t newsize = pend - frames_.begin(); diff --git a/src/Cluster/Cframes.h b/src/Cluster/Cframes.h index a1c8091c19..0ac15d6ba6 100644 --- a/src/Cluster/Cframes.h +++ b/src/Cluster/Cframes.h @@ -30,6 +30,7 @@ class Cframes { bool empty() const { return frames_.empty(); } bool HasFrame(int) const; + int FrameIdx(int) const; void Insert(Cframes const& rhs) { frames_.insert(frames_.end(), rhs.begin(), rhs.end()); } void Remove(int); void Sort(); From 6f041a8e9d4cffc1d9a4d8caf3400e556cd62a87 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 14:21:59 -0500 Subject: [PATCH 185/417] DRR - Cpptraj: Some code cleanup. Update dependencies. --- src/Cluster/PairwiseMatrix.cpp | 23 ----------------------- src/Cluster/PairwiseMatrix.h | 6 +----- src/cpptrajdepend | 2 +- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index a37d3a4e53..262263912f 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -14,28 +14,6 @@ int Cpptraj::Cluster::PairwiseMatrix::Setup(Metric* metric, DataSet_PairwiseCach return 0; } -/** Set up frame number to matrix index for caching. */ -/* -int Cpptraj::Cluster::PairwiseMatrix::setupFrameToMat(Cframes const& framesToCache) -{ - if (metric_ == 0) { - mprinterr("Internal Error: PairwiseMatrix::setupFrameToMat(): null metric.\n"); - return 1; - } - frameToMat_.assign(metric_->Ntotal(), -1); - int idx = 0; - for (Cframes_it it = framesToCache.begin(); it != framesToCache.end(); ++it) - frameToMat_[*it] = idx++; -# ifdef DEBUG_CLUSTER - // DEBUG - mprintf("DEBUG: frameToMat\n"); - for (Cframes_it it = frameToMat_.begin(); it != frameToMat_.end(); ++it) - mprintf("\tframeToMat_[%u] = %i\n", it - frameToMat_.begin(), *it); -# endif - return 0; -} -*/ - /** \return distance between frames (cached or uncached). */ // TODO inline? double Cpptraj::Cluster::PairwiseMatrix::Frame_Distance(int f1, int f2) const { if (cache_ != 0) @@ -124,4 +102,3 @@ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesTo progress.Finish(); return 0; } - diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index bc7cae9737..387a01a4a2 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -14,19 +14,15 @@ class PairwiseMatrix { int Setup(Metric*, DataSet_PairwiseCache*); // ------------------------------------------- - /// \return distance between given frames.TODO const? + /// \return distance between given frames. double Frame_Distance(int, int) const; /// Request that distances for the specified frames be cached. int CacheDistances(Cframes const&, int); - /// Print only cached distances. TODO const? - //virtual void PrintCached() const = 0; // ------------------------------------------- //bool HasMetric() const { return (metric_ != 0); } /// \return internal metric, const. Metric const& DistMetric() const { return *metric_; } - /// \return internal metric. -// Metric& DistMetric() { return *metric_; } /// \return Pointer to distance metric Metric* MetricPtr() const { return metric_; } diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 1c4cf4c5d5..45e41ed6c1 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -150,7 +150,7 @@ Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/ Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_DPeaks.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../BufferedLine.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataIO.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../FrameArray.h Cluster/../FramePtrArray.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TrajectoryIO.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_DPeaks.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h From 14d4fb744981abea3ccad7993f8a18eea34035fc Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 19 Feb 2019 14:24:01 -0500 Subject: [PATCH 186/417] DRR - Cpptraj: More cleanup --- src/Cluster/Control.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 34fc448058..ba51cc08f0 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -43,9 +43,6 @@ class Control { int Output(DataSetList&); /// Print timing data void Timing(double) const; - - List const& Clusters() const { return clusters_; } - Metric const& DistMetric() const { return *metric_; } private: int AllocatePairwise(ArgList&, DataSetList&, DataFileList&); From d5fcad661f67505963af54251e8ee2af55ef556d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 28 Mar 2019 15:18:14 -0400 Subject: [PATCH 187/417] DRR - Cpptraj: Fix use of integer data set --- src/Cluster/Node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index e5b49a4e3a..329604eb40 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -174,5 +174,5 @@ const { life.Resize( maxFrames ); for (frame_iterator f = beginframe(); f != endframe(); ++f) - life[ *f ] = 1; + life.SetElement( *f, 1); } From 1a957c58e3e8f1adba980ce8c21049956e786706 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 18 Jul 2019 11:36:05 -0400 Subject: [PATCH 188/417] DRR - Cpptraj: Fix calls to PrepareTrajWrite. --- src/Cluster/Results_Coords.cpp | 11 ++++++----- src/cpptrajdepend | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 5e7c5b6d8e..123994c0d8 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -2,6 +2,7 @@ #include "../CpptrajStdio.h" #include "../StringRoutines.h" #include "../Trajout_Single.h" +#include "../DataSetList.h" // For PrepareTrajWrite /** The default output trajectory format. */ const TrajectoryFile::TrajFormatType Cpptraj::Cluster::Results_Coords::DEF_TRAJ_FMT_ = @@ -88,7 +89,7 @@ void Cpptraj::Cluster::Results_Coords::WriteClusterTraj( List const& CList ) con std::string cfilename = clusterfile_ + ".c" + integerToString( cnum ); // Set up trajectory file Trajout_Single clusterout; - if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, + if (clusterout.PrepareTrajWrite(cfilename, ArgList(), DataSetList(), clusterparm, coords_->CoordsInfo(), C->Nframes(), clusterfmt_)) { @@ -124,7 +125,7 @@ void Cpptraj::Cluster::Results_Coords::WriteAvgStruct( List const& CList ) const std::string cfilename = avgfile_ + ".c" + integerToString( cnum ) + tmpExt; // Set up trajectory file Trajout_Single clusterout; // FIXME CoordinateInfo OK for just coords? - if (clusterout.PrepareTrajWrite(cfilename, ArgList(), &avgparm, + if (clusterout.PrepareTrajWrite(cfilename, ArgList(), DataSetList(), &avgparm, CoordinateInfo(), 1, avgfmt_)) { mprinterr("Error: Could not set up cluster average file %s for write.\n", @@ -158,7 +159,7 @@ void Cpptraj::Cluster::Results_Coords::WriteSingleRepTraj( List const& CList ) c // Set up trajectory file. Use parm from COORDS DataSet. Topology *clusterparm = coords_->TopPtr(); int nRepsToSave = CList.front().BestReps().size(); - if (clusterout.PrepareTrajWrite(singlerepfile_, ArgList(), clusterparm, + if (clusterout.PrepareTrajWrite(singlerepfile_, ArgList(), DataSetList(), clusterparm, coords_->CoordsInfo(), CList.Nclusters() * nRepsToSave, singlerepfmt_)) { @@ -209,7 +210,7 @@ void Cpptraj::Cluster::Results_Coords::WriteRepTraj( List const& CList ) const { std::string cfilename = reptrajfile_ + ".c" + integerToString(C->Num()) + ("." + integerToString(framenum+1)) + tmpExt; // Set up trajectory file. - if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, + if (clusterout.PrepareTrajWrite(cfilename, ArgList(), DataSetList(), clusterparm, coords_->CoordsInfo(), 1, reptrajfmt_)) { mprinterr("Error: Could not set up representative trajectory file %s for write.\n", @@ -229,7 +230,7 @@ void Cpptraj::Cluster::Results_Coords::WriteRepTraj( List const& CList ) const { std::string cfilename = reptrajfile_ + ".c" + integerToString(C->Num()) + tmpExt; // Set up trajectory file. int nRepsToSave = C->BestReps().size(); - if (clusterout.PrepareTrajWrite(cfilename, ArgList(), clusterparm, + if (clusterout.PrepareTrajWrite(cfilename, ArgList(), DataSetList(), clusterparm, coords_->CoordsInfo(), nRepsToSave, reptrajfmt_)) { mprinterr("Error: Could not set up representative trajectory file %s for write.\n", diff --git a/src/cpptrajdepend b/src/cpptrajdepend index aa8893b05f..bd9bdc00b1 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -165,7 +165,7 @@ Cluster/Metric_SRMSD.o : Cluster/Metric_SRMSD.cpp Cluster/../ArgList.h Cluster/. Cluster/Node.o : Cluster/Node.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Output.o : Cluster/Output.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h -Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../Trajout_Single.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h +Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../CharMask.h Cluster/../Cluster/Cframes.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../Trajout_Single.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/Sieve.h ClusterMap.o : ClusterMap.cpp ArgList.h AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h From 1f35b310d4acf11772a07117249e01d6fb1f7e01 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 19 Jun 2020 14:50:46 -0400 Subject: [PATCH 189/417] Add a few missing depends. --- src/Cluster/Algorithm_DBscan.cpp | 1 + src/Cluster/Algorithm_DPeaks.cpp | 1 + src/Cluster/Algorithm_HierAgglo.cpp | 1 + src/Cluster/Algorithm_Kmeans.cpp | 1 + src/cpptrajdepend | 8 ++++---- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index c531ed4e88..76afb715e5 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -2,6 +2,7 @@ #include // sort #include "Algorithm_DBscan.h" #include "../CpptrajStdio.h" +#include "../ArgList.h" #include "../ProgressBar.h" #include "../StringRoutines.h" // integerToString #ifdef _OPENMP diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index 214dfa0d74..89a1ada898 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -2,6 +2,7 @@ #include // sort #include "Algorithm_DPeaks.h" #include "../CpptrajStdio.h" +#include "../ArgList.h" #include "../DataSet_Mesh.h" #include "../ProgressBar.h" diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index ac83c79e74..d55b029b97 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -1,6 +1,7 @@ #include // double max #include "Algorithm_HierAgglo.h" #include "../CpptrajStdio.h" +#include "../ArgList.h" #include "../ProgressBar.h" Cpptraj::Cluster::Algorithm_HierAgglo::Algorithm_HierAgglo() : diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 0875da7283..262b0f4f3b 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -1,4 +1,5 @@ #include "Algorithm_Kmeans.h" +#include "../ArgList.h" #include "../CpptrajStdio.h" #include "../ProgressBar.h" diff --git a/src/cpptrajdepend b/src/cpptrajdepend index d53422455c..fb3d2091bb 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -145,10 +145,10 @@ CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStd CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h SymbolExporting.h CharmmParamFile.o : CharmmParamFile.cpp ArgList.h AtomType.h BufferedLine.h CharmmParamFile.h Constants.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h StringRoutines.h TypeNameHolder.h Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DPeaks.o : Cluster/Algorithm_DPeaks.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Mesh.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../Spline.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_DPeaks.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomExtra.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DPeaks.o : Cluster/Algorithm_DPeaks.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Mesh.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../Spline.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_DPeaks.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../SymbolExporting.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h From 570062906abf881042ff90ecef5f2d6e96aa2c53 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 10:28:18 -0400 Subject: [PATCH 190/417] Add init --- src/Cluster/BestReps.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 1747abe1c1..407b255ac1 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -1,6 +1,8 @@ #include "BestReps.h" #include "../CpptrajStdio.h" +int Cpptraj::Cluster::BestReps::debug_ = 0; + /// Save up to maxSize of the best (lowest) representative scores/frames. void Cpptraj::Cluster::BestReps::SaveBestRep(RepMap& reps, RepPair const& Dist_Num, unsigned int maxSize) From 16d1a6a31da9efea237bd747d4033d46704e0d1a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 12:39:10 -0400 Subject: [PATCH 191/417] Use forward declarations --- src/Cluster/Algorithm.cpp | 2 ++ src/Cluster/Algorithm.h | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Algorithm.cpp b/src/Cluster/Algorithm.cpp index 9e32b31478..f2d1d2f7b9 100644 --- a/src/Cluster/Algorithm.cpp +++ b/src/Cluster/Algorithm.cpp @@ -1,5 +1,7 @@ #include "Algorithm.h" #include "../CpptrajStdio.h" +#include "Node.h" +#include "PairwiseMatrix.h" double Cpptraj::Cluster::Algorithm::ClusterDistance(Node const& C1, Node const& C2, PairwiseMatrix const& pmatrix, diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index 11c8731fc3..f5869e70a2 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -1,11 +1,13 @@ #ifndef INC_CLUSTER_ALGORITHM_H #define INC_CLUSTER_ALGORITHM_H -#include "PairwiseMatrix.h" -#include "List.h" -#include "../CpptrajFile.h" +class ArgList; +class CpptrajFile; namespace Cpptraj { namespace Cluster { - +class Cframes; +class List; +class Node; +class PairwiseMatrix; /// Abstract base class for implementing clustering algorithms. class Algorithm { public: From 814e27ba4132dddb38a28f62e050ba3021866c37 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 12:53:54 -0400 Subject: [PATCH 192/417] More forward declares --- src/Cluster/Algorithm_DBscan.cpp | 3 +++ src/Cluster/Algorithm_DBscan.h | 2 ++ src/Cluster/Algorithm_HierAgglo.h | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index 76afb715e5..9395ef2c3a 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -1,6 +1,9 @@ #include // double max #include // sort #include "Algorithm_DBscan.h" +#include "Cframes.h" +#include "List.h" +#include "Metric.h" #include "../CpptrajStdio.h" #include "../ArgList.h" #include "../ProgressBar.h" diff --git a/src/Cluster/Algorithm_DBscan.h b/src/Cluster/Algorithm_DBscan.h index 6df15b2fd5..9fd3e1292f 100644 --- a/src/Cluster/Algorithm_DBscan.h +++ b/src/Cluster/Algorithm_DBscan.h @@ -1,6 +1,8 @@ #ifndef INC_CLUSTER_ALGORITHM_DBSCAN_H #define INC_CLUSTER_ALGORITHM_DBSCAN_H #include "Algorithm.h" +#include "../Range.h" +#include namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index b540176c9c..e53ed17388 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -2,10 +2,12 @@ #define INC_CLUSTER_ALGORITHM_HIERAGGLO_H #include "Algorithm.h" #include "DynamicMatrix.h" +#include "List.h" +#include "../CpptrajFile.h" #include "../Timer.h" namespace Cpptraj { namespace Cluster { - +class Metric; /// Implement hierarchical agglomerative clustering class Algorithm_HierAgglo : public Algorithm { public: @@ -25,6 +27,7 @@ class Algorithm_HierAgglo : public Algorithm { static inline double minDist(Node const&, Node const&, PairwiseMatrix const&); static inline double maxDist(Node const&, Node const&, PairwiseMatrix const&); static inline double avgDist(Node const&, Node const&, PairwiseMatrix const&); + // TODO: Node instead of cluster_it? void calcMinDist(List::cluster_it&, List&, PairwiseMatrix const&); void calcMaxDist(List::cluster_it&, List&, PairwiseMatrix const&); void calcAvgDist(List::cluster_it&, List&, PairwiseMatrix const&); From 0a4fe86c4895f96f008ea88de49aa31c30c15da2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 13:33:43 -0400 Subject: [PATCH 193/417] Fixes for fwd declare --- src/Cluster/Algorithm_DPeaks.cpp | 1 + src/Cluster/Algorithm_DPeaks.h | 2 ++ src/Cluster/Algorithm_Kmeans.cpp | 3 +++ 3 files changed, 6 insertions(+) diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index 89a1ada898..5922bdbce2 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -1,6 +1,7 @@ #include // fabs #include // sort #include "Algorithm_DPeaks.h" +#include "List.h" #include "../CpptrajStdio.h" #include "../ArgList.h" #include "../DataSet_Mesh.h" diff --git a/src/Cluster/Algorithm_DPeaks.h b/src/Cluster/Algorithm_DPeaks.h index 9ece578fda..b6abcb5fa8 100644 --- a/src/Cluster/Algorithm_DPeaks.h +++ b/src/Cluster/Algorithm_DPeaks.h @@ -1,6 +1,8 @@ #ifndef INC_CLUSTER_ALGORITHM_DPEAKS_H #define INC_CLUSTER_ALGORITHM_DPEAKS_H #include "Algorithm.h" +#include +#include namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 748cc7b80d..de553d4c32 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -1,5 +1,8 @@ #include "Algorithm_Kmeans.h" +#include "Cframes.h" +#include "List.h" #include "../ArgList.h" +#include "../CpptrajFile.h" #include "../CpptrajStdio.h" #include "../ProgressBar.h" From 753567793dcfd6feacfa362fbddfe11614c6a5be Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 13:53:20 -0400 Subject: [PATCH 194/417] Make non-static class; use fwd declares --- src/Cluster/BestReps.cpp | 56 ++++++++++++++++++++++++++-------------- src/Cluster/BestReps.h | 35 +++++++++++++++---------- src/Cluster/Control.cpp | 9 ++++--- 3 files changed, 63 insertions(+), 37 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 407b255ac1..6d2b78ea83 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -1,9 +1,16 @@ #include "BestReps.h" +#include "List.h" +#include "Node.h" #include "../CpptrajStdio.h" -int Cpptraj::Cluster::BestReps::debug_ = 0; +/** CONSTRUCTOR */ +Cpptraj::Cluster::BestReps::BestReps() : + debug_(0), + nToSave_(0), + type_(NO_REPS) +{} -/// Save up to maxSize of the best (lowest) representative scores/frames. +/** Save up to maxSize of the best (lowest) representative scores/frames. */ void Cpptraj::Cluster::BestReps::SaveBestRep(RepMap& reps, RepPair const& Dist_Num, unsigned int maxSize) { @@ -22,7 +29,7 @@ void Cpptraj::Cluster::BestReps::SaveBestRep(RepMap& reps, RepPair const& Dist_N } } -/// Set given cluster node with best representative frames/scores in reps +/** Set given cluster node with best representative frames/scores in reps */ void Cpptraj::Cluster::BestReps::SetBestRepFrame(Node& node, RepMap const& reps) { if (!reps.empty()) { @@ -33,22 +40,31 @@ void Cpptraj::Cluster::BestReps::SetBestRepFrame(Node& node, RepMap const& reps) } } +/** Initialize best rep find. */ +int Cpptraj::Cluster::BestReps::InitBestReps(RepMethodType typeIn, int nToSaveIn, int debugIn) +{ + // TODO some error checking + type_ = typeIn; + nToSave_ = nToSaveIn; + debug_ = debugIn; + return 0; +} + /** Find best representative frames for each cluster. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames(RepMethodType type, int nToSave, - List& clusters, PairwiseMatrix const& pmatrix, - Cframes const& sievedFrames, int debug) +int Cpptraj::Cluster::BestReps::FindBestRepFrames(List& clusters, PairwiseMatrix const& pmatrix, + Cframes const& sievedFrames) +const { - debug_ = debug; int err = 0; - switch (type) { + switch (type_) { case CUMULATIVE: - err = FindBestRepFrames_CumulativeDist(nToSave, clusters, pmatrix); + err = FindBestRepFrames_CumulativeDist(clusters, pmatrix); break; case CENTROID: - err = FindBestRepFrames_Centroid(nToSave, clusters, pmatrix); + err = FindBestRepFrames_Centroid(clusters, pmatrix); break; case CUMULATIVE_NOSIEVE: - err = FindBestRepFrames_NoSieve_CumulativeDist(nToSave, clusters, pmatrix, sievedFrames); + err = FindBestRepFrames_NoSieve_CumulativeDist(clusters, pmatrix, sievedFrames); break; case NO_REPS: mprintf("Warning: Skipping best representative frame calc.\n"); @@ -76,8 +92,8 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames(RepMethodType type, int nToSav /** Find the frame in each cluster that is the best representative by * having the lowest cumulative distance to every other point in the cluster. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(int nToSave, List& clusters, - PairwiseMatrix const& pmatrix) +int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(List& clusters, PairwiseMatrix const& pmatrix) +const { int err = 0; for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { @@ -110,7 +126,7 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(int nToSave, Li if (f1 != f2) cdist += pmatrix.Frame_Distance(*f1, *f2); } - SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave); + SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave_); //tmp.Printf("%i %g %g\n", *f1+1, cdist, Cdist_->FrameCentroidDist(*f1, node->Cent())); } //tmp.CloseFile(); @@ -164,9 +180,9 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(int nToSave, Li * ignoring sieved frames. */ int Cpptraj::Cluster::BestReps:: - FindBestRepFrames_NoSieve_CumulativeDist(int nToSave, List& clusters, - PairwiseMatrix const& pmatrix, + FindBestRepFrames_NoSieve_CumulativeDist(List& clusters, PairwiseMatrix const& pmatrix, Cframes const& sievedFrames) +const { if (sievedFrames.size() > 0) mprintf("Warning: Ignoring sieved frames while looking for best representative.\n"); @@ -183,7 +199,7 @@ int Cpptraj::Cluster::BestReps:: //cdist += pmatrix.Cache().CachedDistance(*f1, *f2); // TODO benchmark the two ways cdist += pmatrix.Frame_Distance(*f1, *f2); } - SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave); + SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave_); } } if (bestReps.empty()) { @@ -199,8 +215,8 @@ int Cpptraj::Cluster::BestReps:: /** Find the frame in the cluster that is the best representative by * having the lowest distance to the cluster centroid. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(int nToSave, List& clusters, - PairwiseMatrix const& pmatrix) +int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(List& clusters, PairwiseMatrix const& pmatrix) +const { int err = 0; for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { @@ -211,7 +227,7 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(int nToSave, List& cl { double dist = pmatrix.MetricPtr()->FrameCentroidDist(*f1, node->Cent()); //mprintf("\t%8i %10.4g %10.4g %i\n", *f1+1, dist, mindist, minframe+1); - SaveBestRep(bestReps, RepPair(dist, *f1), nToSave); + SaveBestRep(bestReps, RepPair(dist, *f1), nToSave_); } if (bestReps.empty()) { mprinterr("Error: Could not determine represenative frame for cluster %i\n", diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index 12479ba858..1b65cae5bc 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -1,19 +1,24 @@ #ifndef INC_CLUSTER_BESTREPS_H #define INC_CLUSTER_BESTREPS_H #include -#include "Node.h" -#include "List.h" -#include "PairwiseMatrix.h" namespace Cpptraj { namespace Cluster { - -/// Used to find best representative structures for a cluster. TODO not static class +class Cframes; +class List; +class Node; +class PairwiseMatrix; +/// Used to find best representative structures for a cluster. class BestReps { public: enum RepMethodType { NO_REPS = 0, CUMULATIVE, CENTROID, CUMULATIVE_NOSIEVE }; - static int FindBestRepFrames(RepMethodType, int, List&, PairwiseMatrix const&, - Cframes const&, int); + /// CONSTRUCTOR + BestReps(); + + /// Initialize best rep frames search with method type, # to save, and debug level + int InitBestReps(RepMethodType, int, int); + /// Find best rep frames for each cluster in given list + int FindBestRepFrames(List&, PairwiseMatrix const&, Cframes const&) const; private: /// Used to pair representative score with frame number. typedef std::pair RepPair; @@ -21,18 +26,20 @@ class BestReps { typedef std::multimap RepMap; /// Save up to maxSize of the best (lowest) representative scores/frames. - static void SaveBestRep(RepMap&, RepPair const&, unsigned int); + static inline void SaveBestRep(RepMap&, RepPair const&, unsigned int); /// Set given cluster node with best representative frames/scores in reps - static void SetBestRepFrame(Node& node, RepMap const&); + static inline void SetBestRepFrame(Node& node, RepMap const&); + /// Find best representative frames by shortest distance to all other frames. - static int FindBestRepFrames_CumulativeDist(int, List&, PairwiseMatrix const&); + int FindBestRepFrames_CumulativeDist(List&, PairwiseMatrix const&) const; /// Find best representative frames by shortest distance, ignoring sieved frames. - static int FindBestRepFrames_NoSieve_CumulativeDist(int, List&, PairwiseMatrix const&, - Cframes const&); + int FindBestRepFrames_NoSieve_CumulativeDist(List&, PairwiseMatrix const&, Cframes const&) const; /// Find best representative frames by shortest distance to centroid. - static int FindBestRepFrames_Centroid(int, List&, PairwiseMatrix const&); + int FindBestRepFrames_Centroid(List&, PairwiseMatrix const&) const; - static int debug_; ///< Debug level, set in call to FindBestRepFrames + int debug_; ///< Debug level, set in call to FindBestRepFrames + int nToSave_; ///< Number of representatives to find + RepMethodType type_; ///< Method to use to find best reps }; } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 2e00fcfc83..1fcf0ae497 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -813,9 +813,12 @@ int Cpptraj::Cluster::Control::Run() { timer_post_bestrep_.Start(); // Find best representative frames for each cluster. - if (BestReps::FindBestRepFrames(bestRep_, nRepsToSave_, clusters_, pmatrix_, - frameSieve_.SievedOut(), verbose_)) - { + BestReps findBestReps; + if (findBestReps.InitBestReps(bestRep_, nRepsToSave_, verbose_)) { + mprinterr("Error: Initializing best representative frames search failed.\n"); + return 1; + } + if (findBestReps.FindBestRepFrames(clusters_, pmatrix_, frameSieve_.SievedOut())) { mprinterr("Error: Finding best representative frames for clusters failed.\n"); return 1; } From 339b77a7f77b6d20f3ebb84270eac5255c60d166 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 14:03:53 -0400 Subject: [PATCH 195/417] Fwd declares --- src/Cluster/Cmatrix_Binary.cpp | 1 + src/Cluster/Cmatrix_Binary.h | 6 ++---- src/Cluster/Cmatrix_NC.cpp | 3 +++ src/Cluster/Cmatrix_NC.h | 6 +++--- src/Cluster/Control.cpp | 1 + src/Cluster/Control.h | 25 ++++++++++++++----------- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/Cluster/Cmatrix_Binary.cpp b/src/Cluster/Cmatrix_Binary.cpp index 4cb4546b0f..df080719f8 100644 --- a/src/Cluster/Cmatrix_Binary.cpp +++ b/src/Cluster/Cmatrix_Binary.cpp @@ -1,4 +1,5 @@ #include "Cmatrix_Binary.h" +#include "Cframes.h" #include "../CpptrajStdio.h" Cpptraj::Cluster::Cmatrix_Binary::Cmatrix_Binary() : diff --git a/src/Cluster/Cmatrix_Binary.h b/src/Cluster/Cmatrix_Binary.h index 7b5e7de479..3b7540e83c 100644 --- a/src/Cluster/Cmatrix_Binary.h +++ b/src/Cluster/Cmatrix_Binary.h @@ -2,12 +2,10 @@ #define INC_CLUSTER_CMATRIX_BINARY_H #include // size_t #include "../CpptrajFile.h" -#include "../FileName.h" -#include "Cframes.h" - +class FileName; namespace Cpptraj { namespace Cluster { - +class Cframes; /// Used to read pairwise distance cache files in cpptraj binary format. class Cmatrix_Binary { public: diff --git a/src/Cluster/Cmatrix_NC.cpp b/src/Cluster/Cmatrix_NC.cpp index 60dbc28e83..5ea4ae8938 100644 --- a/src/Cluster/Cmatrix_NC.cpp +++ b/src/Cluster/Cmatrix_NC.cpp @@ -2,10 +2,13 @@ # include # include "../NC_Routines.h" #endif +#include "Cframes.h" #include "Cmatrix_NC.h" #include "../CpptrajStdio.h" +#include "../FileName.h" #ifdef BINTRAJ + /// CONSTRUCTOR Cpptraj::Cluster::Cmatrix_NC::Cmatrix_NC() : ncid_(-1), diff --git a/src/Cluster/Cmatrix_NC.h b/src/Cluster/Cmatrix_NC.h index 331adf5765..781594b98f 100644 --- a/src/Cluster/Cmatrix_NC.h +++ b/src/Cluster/Cmatrix_NC.h @@ -1,10 +1,10 @@ #ifndef INC_CLUSTER_CMATRIX_NC_H #define INC_CLUSTER_CMATRIX_NC_H -#include "../FileName.h" -#include "Cframes.h" +#include +class FileName; namespace Cpptraj { namespace Cluster { - +class Cframes; /// NetCDF cluster matrix file. class Cmatrix_NC { public: diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 1fcf0ae497..901018a9d0 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -1,5 +1,6 @@ #include "Control.h" #include "../CpptrajStdio.h" +#include "../DataFileList.h" #include "../DataSet_Coords.h" #include "Output.h" #include "../DataFile.h" // For loading pairwise cache diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index ba51cc08f0..c7399427d3 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -1,21 +1,22 @@ #ifndef INC_CLUSTER_CONTROL_H #define INC_CLUSTER_CONTROL_H -#include "List.h" -#include "Sieve.h" -#include "PairwiseMatrix.h" -#include "Algorithm.h" -#include "Metric.h" -#include "Results.h" +#include "Algorithm.h" // Algorithm::AType #include "BestReps.h" +#include "List.h" #include "Metric_Data.h" +#include "PairwiseMatrix.h" +#include "Sieve.h" +#include "../DataFile.h" // DataFile::DataFormatType #include "../Timer.h" -#include "../DataSetList.h" -#include "../DataFileList.h" -#include "../DataSet_Coords.h" -#include "../DataSet_PairwiseCache.h" +class DataSet_Coords; +class DataSet_PairwiseCache; +class DataFileList; +class DataSetList; namespace Cpptraj { namespace Cluster { - +class Algorithm; +class Metric; +class Results; /// Hold clusters, algorithm, and pairwise matrix. class Control { public: @@ -32,6 +33,8 @@ class Control { /// For determining how frames to cluster will be determined. enum FrameSelectType { UNSPECIFIED = 0, FROM_CACHE }; + // TODO ONE setup routine + int SetupForDataSets(Metric_Data::DsArray const&, DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); From 858320d4c0a7e3ca9927e82fe6e5155da4f193a4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 14:12:36 -0400 Subject: [PATCH 196/417] Start updating dependencies --- src/Cluster/List.cpp | 2 ++ src/Cluster/List.h | 8 +++++--- src/Cluster/Metric_DME.h | 1 + src/Cluster/Metric_Data.cpp | 1 + src/Cluster/Metric_Data.h | 2 +- src/cpptrajdepend | 32 ++++++++++++++++---------------- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 629bd76be1..89f87c3eed 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -1,7 +1,9 @@ #include // std::max #include // double max #include "List.h" +#include "Node.h" #include "../CpptrajStdio.h" +#include "../DataSet_integer.h" #include "../ProgressBar.h" #include "../Constants.h" // SMALL TODO use limits? diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 19739fcaac..e7cff772d3 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -1,11 +1,13 @@ #ifndef INC_CLUSTER_LIST_H #define INC_CLUSTER_LIST_H #include -#include "Node.h" -#include "../DataSet_integer.h" +#include "Cframes.h" +class DataSet_integer; namespace Cpptraj { namespace Cluster { - +class Metric; +class Node; +class PairwiseMatrix; /// Hold all individual clusters. /** Currently implemented as an STL list since sorting and erasing are more * efficient. diff --git a/src/Cluster/Metric_DME.h b/src/Cluster/Metric_DME.h index aafda6c63d..6b4c061388 100644 --- a/src/Cluster/Metric_DME.h +++ b/src/Cluster/Metric_DME.h @@ -3,6 +3,7 @@ #include "../AtomMask.h" #include "../DataSet_Coords.h" #include "Metric.h" +class AtomMask; namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Metric_Data.cpp b/src/Cluster/Metric_Data.cpp index 6111a378fb..8fe83729e3 100644 --- a/src/Cluster/Metric_Data.cpp +++ b/src/Cluster/Metric_Data.cpp @@ -3,6 +3,7 @@ #include "Centroid_Multi.h" #include "../Constants.h" // RADDEG, DEGRAD #include "../CpptrajStdio.h" +#include "../DataSet_1D.h" int Cpptraj::Cluster::Metric_Data::Init(DsArray const& dsIn) { diff --git a/src/Cluster/Metric_Data.h b/src/Cluster/Metric_Data.h index a399958391..f55ea8eab1 100644 --- a/src/Cluster/Metric_Data.h +++ b/src/Cluster/Metric_Data.h @@ -2,7 +2,7 @@ #define INC_CLUSTER_METRIC_DATA_H #include #include "Metric.h" -#include "../DataSet_1D.h" +class DataSet_1D; namespace Cpptraj { namespace Cluster { diff --git a/src/cpptrajdepend b/src/cpptrajdepend index c313be3292..196b3a04ff 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -92,7 +92,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.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 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 Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.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 -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Sieve.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 +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.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 DataSet_float.h DataSet_integer.h DataSet_string.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 @@ -146,35 +146,35 @@ ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h Segment.h SymbolExporting.h Unit.h CharmmParamFile.o : CharmmParamFile.cpp ArgList.h AtomType.h BufferedLine.h CharmmParamFile.h Constants.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h StringRoutines.h TypeNameHolder.h -Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DPeaks.o : Cluster/Algorithm_DPeaks.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Mesh.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../Spline.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_DPeaks.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Centroid.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h +Cluster/Algorithm_DPeaks.o : Cluster/Algorithm_DPeaks.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Mesh.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../Spline.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_DPeaks.h Cluster/Cframes.h Cluster/List.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h +Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../ArgList.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Cframes.h Cluster/List.h Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../BufferedLine.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_DPeaks.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../BufferedLine.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_DPeaks.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h Cluster/List.o : Cluster/List.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h -Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h -Cluster/Metric_Data_Manhattan.o : Cluster/Metric_Data_Manhattan.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Manhattan.h +Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h +Cluster/Metric_Data_Manhattan.o : Cluster/Metric_Data_Manhattan.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.o : Cluster/Metric_SRMSD.cpp Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_SRMSD.h Cluster/Node.o : Cluster/Node.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Output.o : Cluster/Output.cpp Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h +Cluster/Output.o : Cluster/Output.cpp Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h -Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../Trajout_Single.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h +Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../Trajout_Single.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Cframes.h Cluster/List.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/Sieve.h ClusterMap.o : ClusterMap.cpp AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h CompactFrameArray.o : CompactFrameArray.cpp Box.h CompactFrameArray.h CoordinateInfo.h CpptrajStdio.h Matrix_3x3.h Parallel.h ReplicaDimArray.h Vec3.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h @@ -187,7 +187,7 @@ CpptrajFile.o : CpptrajFile.cpp CpptrajFile.h CpptrajStdio.h FileIO.h FileIO_Bzi CpptrajState.o : CpptrajState.cpp Action.h ActionList.h ActionState.h Action_CreateCrd.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CompactFrameArray.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_Topology.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleNavigator.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FrameArray.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h ProgressBar.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Unit.h Vec3.h CpptrajStdio.o : CpptrajStdio.cpp Parallel.h 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/../FileName.h Cluster/Cframes.h Cluster/Cmatrix_NC.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataIO.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_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 +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_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_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 @@ -197,7 +197,7 @@ DataIO_CharmmOutput.o : DataIO_CharmmOutput.cpp ArgList.h AssociatedData.h Atom. DataIO_CharmmRepLog.o : DataIO_CharmmRepLog.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_CharmmRepLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.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 SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h DataIO_CharmmRtfPrm.o : DataIO_CharmmRtfPrm.cpp ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharmmParamFile.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRtfPrm.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Parameters.h DataSet_Topology.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_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_Binary.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.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_Cmatrix_NC.o : DataIO_Cmatrix_NC.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/../FileName.h Cluster/Cframes.h Cluster/Cmatrix_NC.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_NC.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.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_Cmatrix_NC.o : DataIO_Cmatrix_NC.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Cframes.h Cluster/Cmatrix_NC.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_NC.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.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_Cpout.o : DataIO_Cpout.cpp ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedLine.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cpout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_pH.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_Evecs.o : DataIO_Evecs.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedFrame.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Evecs.h DataSet.h DataSetList.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h DataSet_Modes.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_Gnuplot.o : DataIO_Gnuplot.cpp ArgList.h Array1D.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_Gnuplot.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.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 @@ -211,7 +211,7 @@ DataIO_VecTraj.o : DataIO_VecTraj.cpp ActionFrameCounter.h ArgList.h ArrayIterat DataIO_XVG.o : DataIO_XVG.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_XVG.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.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_Xplor.o : DataIO_Xplor.cpp ArgList.h ArrayIterator.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_Xplor.h DataSet.h DataSetList.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_GridFlt.h Dimension.h FileIO.h FileName.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 ProgressBar.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 DataSet.o : DataSet.cpp AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h -DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h Box.h Cluster/../FileName.h Cluster/Cframes.h Cluster/Cmatrix_NC.h CompactFrameArray.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_PairwiseCache_NC.h DataSet_Parameters.h DataSet_RemLog.h DataSet_StringVar.h DataSet_Tensor.h DataSet_Topology.h DataSet_Vector.h DataSet_Vector_Scalar.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_disk.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h DataSet_unsignedInt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h InputTrajCommon.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 Spline.h StringRoutines.h SymbolExporting.h SymmetricTensor.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h TypeNameHolder.h Unit.h Vec3.h +DataSetList.o : DataSetList.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h Box.h Cluster/Cframes.h Cluster/Cmatrix_NC.h CompactFrameArray.h ComplexArray.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_Coords_TRJ.h DataSet_GridDbl.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h DataSet_PairwiseCache_NC.h DataSet_Parameters.h DataSet_RemLog.h DataSet_StringVar.h DataSet_Tensor.h DataSet_Topology.h DataSet_Vector.h DataSet_Vector_Scalar.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_disk.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h DataSet_unsignedInt.h Dimension.h FileIO.h FileName.h Frame.h Grid.h GridBin.h InputTrajCommon.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 Spline.h StringRoutines.h SymbolExporting.h SymmetricTensor.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajFrameIndex.h Trajin.h TypeNameHolder.h Unit.h Vec3.h DataSet_1D.o : DataSet_1D.cpp ArrayIterator.h AssociatedData.h ComplexArray.h Constants.h Corr.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_1D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h PubFFT.h Range.h TextFormat.h DataSet_3D.o : DataSet_3D.cpp AssociatedData.h Box.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_3D.h Dimension.h FileIO.h FileName.h GridBin.h Matrix_3x3.h MetaData.h Parallel.h Range.h TextFormat.h Vec3.h DataSet_Coords.o : DataSet_Coords.cpp AssociatedData.h Atom.h AtomMask.h AtomType.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Coords.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 ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Topology.h TypeNameHolder.h Unit.h Vec3.h @@ -229,7 +229,7 @@ DataSet_PHREMD_Explicit.o : DataSet_PHREMD_Explicit.cpp AssociatedData.h Cph.h C DataSet_PHREMD_Implicit.o : DataSet_PHREMD_Implicit.cpp AssociatedData.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PHREMD.h DataSet_PHREMD_Implicit.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache.o : DataSet_PairwiseCache.cpp AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache_MEM.o : DataSet_PairwiseCache_MEM.cpp ArrayIterator.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Matrix.h MetaData.h Parallel.h Range.h TextFormat.h -DataSet_PairwiseCache_NC.o : DataSet_PairwiseCache_NC.cpp AssociatedData.h Cluster/../FileName.h Cluster/Cframes.h Cluster/Cmatrix_NC.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_NC.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h StringRoutines.h TextFormat.h +DataSet_PairwiseCache_NC.o : DataSet_PairwiseCache_NC.cpp AssociatedData.h Cluster/Cframes.h Cluster/Cmatrix_NC.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_NC.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h StringRoutines.h TextFormat.h DataSet_Parameters.o : DataSet_Parameters.cpp AssociatedData.h AtomType.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h TextFormat.h TypeNameHolder.h DataSet_RemLog.o : DataSet_RemLog.cpp AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h ReplicaDimArray.h TextFormat.h DataSet_StringVar.o : DataSet_StringVar.cpp AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_StringVar.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h From 7f4ab84fbb6cd831612e8c66f5be02d482a8dbe1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 14:33:30 -0400 Subject: [PATCH 197/417] More and more fwd delcares --- src/Cluster/Centroid_Multi.h | 1 + src/Cluster/Metric.h | 7 +++---- src/Cluster/Metric_DME.cpp | 1 + src/Cluster/Metric_DME.h | 1 - src/Cluster/Metric_Data.cpp | 1 + src/Cluster/Metric_Data.h | 1 + src/Cluster/Metric_Data_Euclid.cpp | 1 + src/Cluster/Metric_Data_Manhattan.cpp | 1 + src/Cluster/Metric_Matrix2D.cpp | 5 +++++ src/Cluster/Metric_Matrix2D.h | 4 ++-- src/Cluster/Metric_RMS.cpp | 1 + src/Cluster/Metric_RMS.h | 3 ++- src/Cluster/Metric_SRMSD.cpp | 1 + src/Cluster/Node.cpp | 13 +++++++++++++ src/Cluster/Node.h | 20 ++++++++++---------- src/Cluster/Output.cpp | 6 ++++++ src/Cluster/Output.h | 14 ++++++-------- 17 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/Cluster/Centroid_Multi.h b/src/Cluster/Centroid_Multi.h index 73bf18875c..c062e5d592 100644 --- a/src/Cluster/Centroid_Multi.h +++ b/src/Cluster/Centroid_Multi.h @@ -1,5 +1,6 @@ #ifndef INC_CLUSTER_CENTROID_MULTI_H #define INC_CLUSTER_CENTROID_MULTI_H +#include "Centroid.h" #include namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 8bf3b98407..874c54b6bb 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -1,12 +1,11 @@ #ifndef INC_CLUSTER_METRIC_H #define INC_CLUSTER_METRIC_H +#include #include -#include "../DataSet.h" -#include "Cframes.h" -#include "Centroid.h" namespace Cpptraj { namespace Cluster { - +class Centroid; +class Cframes; /// Definition of a noise point. const int NOISE = -1; /// Definition of an unclassified point. diff --git a/src/Cluster/Metric_DME.cpp b/src/Cluster/Metric_DME.cpp index 2f7db4e0fb..26fb43d41a 100644 --- a/src/Cluster/Metric_DME.cpp +++ b/src/Cluster/Metric_DME.cpp @@ -1,5 +1,6 @@ #include "Metric_DME.h" #include "Centroid_Coord.h" +#include "Cframes.h" #include "../CpptrajStdio.h" /** Initialize the metric. */ diff --git a/src/Cluster/Metric_DME.h b/src/Cluster/Metric_DME.h index 6b4c061388..aafda6c63d 100644 --- a/src/Cluster/Metric_DME.h +++ b/src/Cluster/Metric_DME.h @@ -3,7 +3,6 @@ #include "../AtomMask.h" #include "../DataSet_Coords.h" #include "Metric.h" -class AtomMask; namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Metric_Data.cpp b/src/Cluster/Metric_Data.cpp index 8fe83729e3..5037b5ecd0 100644 --- a/src/Cluster/Metric_Data.cpp +++ b/src/Cluster/Metric_Data.cpp @@ -1,6 +1,7 @@ #include // fabs, atan2, sin, cos #include "Metric_Data.h" #include "Centroid_Multi.h" +#include "Cframes.h" #include "../Constants.h" // RADDEG, DEGRAD #include "../CpptrajStdio.h" #include "../DataSet_1D.h" diff --git a/src/Cluster/Metric_Data.h b/src/Cluster/Metric_Data.h index f55ea8eab1..40e79efad3 100644 --- a/src/Cluster/Metric_Data.h +++ b/src/Cluster/Metric_Data.h @@ -2,6 +2,7 @@ #define INC_CLUSTER_METRIC_DATA_H #include #include "Metric.h" +class DataSet; class DataSet_1D; namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Metric_Data_Euclid.cpp b/src/Cluster/Metric_Data_Euclid.cpp index e6d5a1f916..99890d596d 100644 --- a/src/Cluster/Metric_Data_Euclid.cpp +++ b/src/Cluster/Metric_Data_Euclid.cpp @@ -2,6 +2,7 @@ #include "Metric_Data_Euclid.h" #include "Centroid_Multi.h" #include "../CpptrajStdio.h" +#include "../DataSet_1D.h" double Cpptraj::Cluster::Metric_Data_Euclid::FrameDist(int f1, int f2) { double dist = 0.0; diff --git a/src/Cluster/Metric_Data_Manhattan.cpp b/src/Cluster/Metric_Data_Manhattan.cpp index 62fb25d33d..5bccd06181 100644 --- a/src/Cluster/Metric_Data_Manhattan.cpp +++ b/src/Cluster/Metric_Data_Manhattan.cpp @@ -2,6 +2,7 @@ #include "Metric_Data_Manhattan.h" #include "Centroid_Multi.h" #include "../CpptrajStdio.h" +#include "../DataSet_1D.h" double Cpptraj::Cluster::Metric_Data_Manhattan::FrameDist(int f1, int f2) { double dist = 0.0; diff --git a/src/Cluster/Metric_Matrix2D.cpp b/src/Cluster/Metric_Matrix2D.cpp index 6a339b8a4d..ca783138d1 100644 --- a/src/Cluster/Metric_Matrix2D.cpp +++ b/src/Cluster/Metric_Matrix2D.cpp @@ -1,4 +1,9 @@ #include "Metric_Matrix2D.h" +#include "../DataSet_2D.h" + +unsigned int Cpptraj::Cluster::Metric_Matrix2D::Ntotal() const { + return (unsigned int)matrix_->Size(); +} static inline void idxToColRow(int idx, int Ncols, int& col, int& row) { diff --git a/src/Cluster/Metric_Matrix2D.h b/src/Cluster/Metric_Matrix2D.h index f95692fe19..e0bdc6d975 100644 --- a/src/Cluster/Metric_Matrix2D.h +++ b/src/Cluster/Metric_Matrix2D.h @@ -1,7 +1,7 @@ #ifndef INC_CLUSTER_METRIC_MATRIX2D_H #define INC_CLUSTER_METRIC_MATRIX2D_H #include "Metric.h" -#include "../DataSet_2D.h" +class DataSet_2D; namespace Cpptraj { namespace Cluster { @@ -19,7 +19,7 @@ class Metric_Matrix2D : public Metric { void FrameOpCentroid(int, Centroid*, double, CentOpType); std::string Description() const; void Info() const; - unsigned int Ntotal() const { return (unsigned int)matrix_->Size(); } + unsigned int Ntotal() const; // ------------------------------------------- int Init(DataSet_2D*); private: diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index 683b026423..16b6d60a92 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -1,5 +1,6 @@ #include "Metric_RMS.h" #include "Centroid_Coord.h" +#include "Cframes.h" #include "../CpptrajStdio.h" /** Initialize the metric. */ diff --git a/src/Cluster/Metric_RMS.h b/src/Cluster/Metric_RMS.h index da2f9bb096..b6ac801376 100644 --- a/src/Cluster/Metric_RMS.h +++ b/src/Cluster/Metric_RMS.h @@ -1,8 +1,9 @@ #ifndef INC_CLUSTER_METRIC_RMS_H #define INC_CLUSTER_METRIC_RMS_H +#include "Metric.h" #include "../AtomMask.h" #include "../DataSet_Coords.h" -#include "Metric.h" +#include "../Frame.h" namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Metric_SRMSD.cpp b/src/Cluster/Metric_SRMSD.cpp index 1d1d4c5222..33b2750b1c 100644 --- a/src/Cluster/Metric_SRMSD.cpp +++ b/src/Cluster/Metric_SRMSD.cpp @@ -1,5 +1,6 @@ #include "Metric_SRMSD.h" #include "Centroid_Coord.h" +#include "Cframes.h" #include "../CpptrajStdio.h" int Cpptraj::Cluster::Metric_SRMSD::Init(DataSet_Coords* dIn, AtomMask const& maskIn, diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index 329604eb40..4ef7e900b8 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -1,5 +1,10 @@ //#include // DBL_MAX #include "Node.h" +#include "Centroid.h" +#include "Metric.h" +#include "PairwiseMatrix.h" +#include "../DataSet_float.h" +#include "../DataSet_integer.h" // CONSTRUCTOR Cpptraj::Cluster::Node::Node() : @@ -58,6 +63,14 @@ Cpptraj::Cluster::Node& Cpptraj::Cluster::Node::operator=(const Node& rhs) { return *this; } +/** Calculate centroid of frames in this Node using given metric. */ +void Cpptraj::Cluster::Node::CalculateCentroid(Metric* Cdist) { + if (centroid_ == 0) + centroid_ = Cdist->NewCentroid( frameList_ ); + else + Cdist->CalculateCentroid( centroid_, frameList_ ); +} + /** Find the frame in the given cluster that is the best representative via * having the lowest cumulative distance to every other point in the cluster. * Should NOT be used if cluster contains sieved frames. diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 018a296c3e..a0c2ec1b9d 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -1,11 +1,16 @@ #ifndef INC_CLUSTER_NODE_H #define INC_CLUSTER_NODE_H -#include "PairwiseMatrix.h" -#include "../DataSet_float.h" -#include "../DataSet_integer.h" +#include +#include // std::pair +#include +#include "Cframes.h" // Cframes::const_iterator +class DataSet_integer; +class DataSet_float; namespace Cpptraj { namespace Cluster { - +class Centroid; +class Metric; +class PairwiseMatrix; // TODO implement needsUpdate_ /// Hold frame indices for a given cluster. @@ -80,12 +85,7 @@ class Node { double Silhouette() const { return avgSil_; } /// Calculate centroid of members of this cluster. - void CalculateCentroid(Metric* Cdist) { - if (centroid_ == 0) - centroid_ = Cdist->NewCentroid( frameList_ ); - else - Cdist->CalculateCentroid( centroid_, frameList_ ); - } + void CalculateCentroid(Metric*); /// Add frame to cluster void AddFrameToCluster(int fnum) { frameList_.push_back( fnum ); } /// Set cluster number (for bookkeeping). diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index d9313cbb79..7c1c39b3a4 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -1,7 +1,13 @@ #include // sqrt #include // sort, max #include "Output.h" +#include "Algorithm.h" +#include "List.h" +#include "Metric.h" +#include "Node.h" +#include "PairwiseMatrix.h" #include "../Matrix.h" +#include "../CpptrajFile.h" #include "../CpptrajStdio.h" // XMGRACE colors diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h index e5e6095b42..1731a15eb8 100644 --- a/src/Cluster/Output.h +++ b/src/Cluster/Output.h @@ -1,15 +1,13 @@ #ifndef INC_CLUSTER_OUTPUT_H #define INC_CLUSTER_OUTPUT_H -#include "../CpptrajFile.h" -#include "List.h" -#include "Algorithm.h" -#include "Metric.h" -#include "Cframes.h" -#include "PairwiseMatrix.h" // TODO anything that needs this calcd outside here? - +class CpptrajFile; namespace Cpptraj { namespace Cluster { - +class Algorithm; +class Cframes; +class List; +class Metric; +class PairwiseMatrix; // TODO anything that needs this calcd outside here? /// Cluster output routines. class Output { public: From 3d74148584e236bf36d7dbd4213fa7aa796a7420 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 14:40:23 -0400 Subject: [PATCH 198/417] Finish up initial round of forward declares --- src/Cluster/PairwiseMatrix.cpp | 4 +++- src/Cluster/PairwiseMatrix.h | 8 +++++--- src/Cluster/Results.h | 5 ++--- src/Cluster/Results_Coords.cpp | 6 +++++- src/Cluster/Results_Coords.h | 2 +- src/Cluster/Sieve.cpp | 1 + src/Cluster/Sieve.h | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 262263912f..73177befa9 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -2,8 +2,10 @@ #ifdef _OPENMP #include #endif -#include "../ProgressBar.h" +#include "Metric.h" #include "../CpptrajStdio.h" +#include "../DataSet_PairwiseCache.h" +#include "../ProgressBar.h" /** Set up PairwiseMatrix with Metric and optional cache. */ int Cpptraj::Cluster::PairwiseMatrix::Setup(Metric* metric, DataSet_PairwiseCache* cache) diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 387a01a4a2..1ae3b788ab 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -1,10 +1,12 @@ #ifndef INC_CLUSTER_PAIRWISE_MATRIX_H #define INC_CLUSTER_PAIRWISE_MATRIX_H -#include "../DataSet_PairwiseCache.h" -#include "Metric.h" +//#inc lude "../DataSet_PairwiseCache.h" +//#inc lude "Metric.h" +class DataSet_PairwiseCache; namespace Cpptraj { namespace Cluster { - +class Cframes; +class Metric; /// Used to calculate/caching pairwise distances according to a given metric. class PairwiseMatrix { public: diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h index 753d593ddf..e26152c50d 100644 --- a/src/Cluster/Results.h +++ b/src/Cluster/Results.h @@ -1,10 +1,9 @@ #ifndef INC_CLUSTER_RESULTS_H #define INC_CLUSTER_RESULTS_H -#include "../ArgList.h" -#include "List.h" +class ArgList; namespace Cpptraj { namespace Cluster { - +class List; //FIXME Should this be allocated and kept inside the Metric? /// Abstract base class for handling results specific to input data type. diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 123994c0d8..d7b15f254e 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -1,8 +1,12 @@ #include "Results_Coords.h" +#include "List.h" +#include "Node.h" +#include "../ArgList.h" #include "../CpptrajStdio.h" +#include "../DataSet_Coords.h" +#include "../DataSetList.h" // For PrepareTrajWrite #include "../StringRoutines.h" #include "../Trajout_Single.h" -#include "../DataSetList.h" // For PrepareTrajWrite /** The default output trajectory format. */ const TrajectoryFile::TrajFormatType Cpptraj::Cluster::Results_Coords::DEF_TRAJ_FMT_ = diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index 03fa845d95..0c1143a413 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -2,7 +2,7 @@ #define INC_CLUSTER_RESULTS_COORDS_H #include "Results.h" #include "../TrajectoryFile.h" -#include "../DataSet_Coords.h" +class DataSet_Coords; namespace Cpptraj { namespace Cluster { diff --git a/src/Cluster/Sieve.cpp b/src/Cluster/Sieve.cpp index 7c94f15ccc..a2acdea6c1 100644 --- a/src/Cluster/Sieve.cpp +++ b/src/Cluster/Sieve.cpp @@ -1,4 +1,5 @@ #include "Sieve.h" +#include "../DataSet_PairwiseCache.h" #include "../Random.h" void Cpptraj::Cluster::Sieve::DetermineTypeFromSieve( int sieveIn ) { diff --git a/src/Cluster/Sieve.h b/src/Cluster/Sieve.h index fb98fb3aab..6a7878773b 100644 --- a/src/Cluster/Sieve.h +++ b/src/Cluster/Sieve.h @@ -1,7 +1,7 @@ #ifndef INC_CLUSTER_SIEVE_H #define INC_CLUSTER_SIEVE_H #include "Cframes.h" -#include "../DataSet_PairwiseCache.h" +class DataSet_PairwiseCache; namespace Cpptraj { namespace Cluster { From d36bae21cf76e88701726982ff62d72a9c1bda3f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 2 Sep 2021 15:16:07 -0400 Subject: [PATCH 199/417] Finishing fixing up dependencies --- src/Cluster/Algorithm.cpp | 3 ++- src/Cluster/Algorithm_DBscan.cpp | 2 ++ src/Cluster/Algorithm_DPeaks.cpp | 2 ++ src/Cluster/Algorithm_HierAgglo.cpp | 2 ++ src/Cluster/Algorithm_Kmeans.cpp | 3 +++ src/Cluster/BestReps.cpp | 2 ++ src/Cluster/Control.cpp | 10 ++++++--- src/Cluster/Control.h | 1 + src/Cluster/List.cpp | 2 ++ src/cpptrajdepend | 32 ++++++++++++++--------------- 10 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/Cluster/Algorithm.cpp b/src/Cluster/Algorithm.cpp index f2d1d2f7b9..cabc409458 100644 --- a/src/Cluster/Algorithm.cpp +++ b/src/Cluster/Algorithm.cpp @@ -1,7 +1,8 @@ #include "Algorithm.h" -#include "../CpptrajStdio.h" +#include "Metric.h" #include "Node.h" #include "PairwiseMatrix.h" +#include "../CpptrajStdio.h" double Cpptraj::Cluster::Algorithm::ClusterDistance(Node const& C1, Node const& C2, PairwiseMatrix const& pmatrix, diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index 9395ef2c3a..f6787494c7 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -4,6 +4,8 @@ #include "Cframes.h" #include "List.h" #include "Metric.h" +#include "Node.h" +#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" #include "../ArgList.h" #include "../ProgressBar.h" diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index 5922bdbce2..39c3f04985 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -2,6 +2,8 @@ #include // sort #include "Algorithm_DPeaks.h" #include "List.h" +#include "Node.h" +#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" #include "../ArgList.h" #include "../DataSet_Mesh.h" diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index d55b029b97..64b8976477 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -1,5 +1,7 @@ #include // double max #include "Algorithm_HierAgglo.h" +#include "Node.h" +#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" #include "../ArgList.h" #include "../ProgressBar.h" diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index de553d4c32..e2a7add007 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -1,6 +1,9 @@ #include "Algorithm_Kmeans.h" #include "Cframes.h" #include "List.h" +#include "Metric.h" +#include "Node.h" +#include "PairwiseMatrix.h" #include "../ArgList.h" #include "../CpptrajFile.h" #include "../CpptrajStdio.h" diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 6d2b78ea83..eaac1e3eef 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -1,6 +1,8 @@ #include "BestReps.h" #include "List.h" +#include "Metric.h" #include "Node.h" +#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" /** CONSTRUCTOR */ diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 901018a9d0..8c7866f64d 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -1,10 +1,14 @@ #include "Control.h" +#include "Output.h" +#include "../ArgList.h" +#include "../BufferedLine.h" // For loading info file #include "../CpptrajStdio.h" +#include "../DataFile.h" // For loading pairwise cache #include "../DataFileList.h" #include "../DataSet_Coords.h" -#include "Output.h" -#include "../DataFile.h" // For loading pairwise cache -#include "../BufferedLine.h" // For loading info file +#include "../DataSet_float.h" +#include "../DataSet_integer.h" +#include "../DataSet_PairwiseCache.h" // Metric classes #include "Metric_RMS.h" #include "Metric_DME.h" diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index c7399427d3..68ef0abe90 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -4,6 +4,7 @@ #include "BestReps.h" #include "List.h" #include "Metric_Data.h" +#include "Node.h" // Node::CnormType #include "PairwiseMatrix.h" #include "Sieve.h" #include "../DataFile.h" // DataFile::DataFormatType diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 89f87c3eed..f820725838 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -1,7 +1,9 @@ #include // std::max #include // double max #include "List.h" +#include "Metric.h" #include "Node.h" +#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" #include "../DataSet_integer.h" #include "../ProgressBar.h" diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 196b3a04ff..ca125445c5 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -92,7 +92,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.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 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 Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.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 -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.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 DataSet_float.h DataSet_integer.h DataSet_string.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 @@ -146,35 +146,35 @@ ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h Segment.h SymbolExporting.h Unit.h CharmmParamFile.o : CharmmParamFile.cpp ArgList.h AtomType.h BufferedLine.h CharmmParamFile.h Constants.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h StringRoutines.h TypeNameHolder.h -Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h -Cluster/Algorithm_DPeaks.o : Cluster/Algorithm_DPeaks.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Mesh.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../Spline.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_DPeaks.h Cluster/Cframes.h Cluster/List.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h -Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../ArgList.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Cframes.h Cluster/List.h -Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../CpptrajStdio.h Cluster/Algorithm.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_DPeaks.o : Cluster/Algorithm_DPeaks.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Mesh.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../Spline.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_DPeaks.h Cluster/Cframes.h Cluster/List.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../ArgList.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../CpptrajStdio.h Cluster/BestReps.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../BufferedLine.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_DPeaks.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h +Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../BufferedLine.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_DPeaks.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h -Cluster/List.o : Cluster/List.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/List.o : Cluster/List.cpp Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h -Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h -Cluster/Metric_Data_Manhattan.o : Cluster/Metric_Data_Manhattan.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Manhattan.h +Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h +Cluster/Metric_Data_Manhattan.o : Cluster/Metric_Data_Manhattan.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.o : Cluster/Metric_SRMSD.cpp Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_SRMSD.h -Cluster/Node.o : Cluster/Node.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Output.o : Cluster/Output.cpp Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Centroid.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Output.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/PairwiseMatrix.h -Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../Trajout_Single.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Cframes.h Cluster/List.h Cluster/Results.h Cluster/Results_Coords.h +Cluster/Node.o : Cluster/Node.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h +Cluster/Output.o : Cluster/Output.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../Parallel.h Cluster/Algorithm.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h +Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Metric.h Cluster/PairwiseMatrix.h +Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../Trajout_Single.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Cframes.h Cluster/List.h Cluster/Node.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/Sieve.h ClusterMap.o : ClusterMap.cpp AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h CompactFrameArray.o : CompactFrameArray.cpp Box.h CompactFrameArray.h CoordinateInfo.h CpptrajStdio.h Matrix_3x3.h Parallel.h ReplicaDimArray.h Vec3.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h From 07b018366f792e5698a02ec702c31b703e6b61f6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 08:42:38 -0400 Subject: [PATCH 200/417] Assign to clusters noise instead of having a separate output routine. --- src/Cluster/Algorithm_DPeaks.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index 39c3f04985..682647845c 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -226,7 +226,15 @@ int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, } } } - } + // Ensure noise frames are sorted + std::vector noiseFrames; + for (Carray::const_iterator point = Points_.begin(); + point != Points_.end(); ++point) + if (point->Cnum() == -1) noiseFrames.push_back( point->Fnum() ); + std::sort( noiseFrames.begin(), noiseFrames.end() ); + for (std::vector::const_iterator f = noiseFrames.begin(); f != noiseFrames.end(); ++f) + clusters.AddNoise( *f ); + } // END noise calc // Add the clusters. for (Parray::const_iterator idx = C_start_stop.begin(); idx != C_start_stop.end(); idx += 2) @@ -868,18 +876,7 @@ void Cpptraj::Cluster::Algorithm_DPeaks::AssignClusterNum(int idx, int& cnum) { Points_[idx].SetCluster( cnum ); } +/** Write results to file. */ void Cpptraj::Cluster::Algorithm_DPeaks::Results(CpptrajFile& outfile) const { outfile.Printf("#Algorithm: DPeaks epsilon %g\n", epsilon_); - if (calc_noise_) { - outfile.Printf("#NOISE_FRAMES:"); - std::vector noiseFrames; - for (Carray::const_iterator point = Points_.begin(); - point != Points_.end(); ++point) - if (point->Cnum() == -1) noiseFrames.push_back( point->Fnum()+1 ); - std::sort( noiseFrames.begin(), noiseFrames.end() ); - for (std::vector::const_iterator f = noiseFrames.begin(); f != noiseFrames.end(); ++f) - outfile.Printf(" %i", *f); - outfile.Printf("\n"); - outfile.Printf("#Number_of_noise_frames: %zu\n", noiseFrames.size()); - } } From 7cf352af3873f8cc93837094b4c28fc60dd538e6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 09:58:25 -0400 Subject: [PATCH 201/417] If no clusters found with dpeaks, exit early; prevents a segfault --- src/Cluster/Algorithm_DPeaks.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index 682647845c..ba6f377758 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -125,6 +125,10 @@ int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, nclusters = ChoosePointsAutomatically(); mprintf("\tIdentified %i cluster centers from density vs distance peaks.\n", nclusters); + + // If no clusters found, no need to continue. + if (nclusters < 1) return 0; + // Each remaining point is assigned to the same cluster as its nearest // neighbor of higher density. Do this recursively until a cluster // center is found. From 225e53d693e06d386a7cbc36c11bd0f0ceca038b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 10:27:50 -0400 Subject: [PATCH 202/417] Protect against going too far into the tgtMask array --- src/SymmetricRmsdCalc.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SymmetricRmsdCalc.cpp b/src/SymmetricRmsdCalc.cpp index f145a50c8a..91c06de381 100644 --- a/src/SymmetricRmsdCalc.cpp +++ b/src/SymmetricRmsdCalc.cpp @@ -35,8 +35,13 @@ int SymmetricRmsdCalc::SetupSymmRMSD(Topology const& topIn, AtomMask const& tgtM Iarray SelectedIdx( topIn.Natom(), -1 ); int tgtIdx = 0; for (int originalAtom = 0; originalAtom != topIn.Natom(); ++originalAtom) - if ( originalAtom == tgtMask[tgtIdx] ) + { + if ( originalAtom == tgtMask[tgtIdx] ) { SelectedIdx[originalAtom] = tgtIdx++; + if (tgtIdx == tgtMask.Nselected()) + break; + } + } if (debug_ > 0) { mprintf("DEBUG: Original atom -> Selected Index mapping:\n"); for (int originalAtom = 0; originalAtom != topIn.Natom(); ++originalAtom) From d897c1f948e12cddebd9b991bb753553af85b51d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 11:33:46 -0400 Subject: [PATCH 203/417] Note but do not mark sievetoframe option in DBscan setup so that Control can pick it up. Add hidden nosieverestore option in order to directly compare against original dpeaks implementation --- src/Cluster/Algorithm_DBscan.cpp | 9 ++++++--- src/Cluster/Control.cpp | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index f6787494c7..40c895f474 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -45,7 +45,10 @@ int Cpptraj::Cluster::Algorithm_DBscan::Setup(ArgList& analyzeArgs) { "Error: Use 'epsilon '\n"); return 1; } - sieveToCentroid_ = !analyzeArgs.hasKey("sievetoframe"); + // NOTE: For backwards compatibility check if sievetoframe is here + // so it can be reported in info file, but do not mark + // it so that Control can pick it up. + sieveToCentroid_ = !analyzeArgs.Contains("sievetoframe"); } else { k_prefix_ = analyzeArgs.GetStringKey("kfile"); if (!k_prefix_.empty() && k_prefix_.at(k_prefix_.size()-1) != '/') @@ -63,7 +66,7 @@ void Cpptraj::Cluster::Algorithm_DBscan::Info() const { } else { mprintf("\t\tMinimum pts to form cluster= %i\n", minPoints_); mprintf("\t\tCluster distance criterion= %.3f\n", epsilon_); - if (sieveToCentroid_) +/* if (sieveToCentroid_) mprintf("\t\tSieved frames will be added back solely based on their\n" "\t\t closeness to cluster centroids.\n" "\t\t (This option is less accurate but faster.)\n"); @@ -71,7 +74,7 @@ void Cpptraj::Cluster::Algorithm_DBscan::Info() const { mprintf("\t\tSieved frames will only be added back if they are within\n" "\t\t %.3f of a frame in an existing cluster.\n" "\t\t (This option is more accurate and will identify sieved\n" - "\t\t frames as noise but is slower.)\n", epsilon_); + "\t\t frames as noise but is slower.)\n", epsilon_);*/ } } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 8c7866f64d..f36d8de450 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -505,7 +505,9 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da if (algorithm_->Type() == Algorithm::DBSCAN || algorithm_->Type() == Algorithm::DPEAKS) { - if (!analyzeArgs.hasKey("sievetoframe")) + if (analyzeArgs.hasKey("nosieverestore")) // Hidden option, currently for testing only + sieveRestore_ = NO_RESTORE; + else if (!analyzeArgs.hasKey("sievetoframe")) sieveRestore_ = EPSILON_CENTROID; else sieveRestore_ = EPSILON_FRAME; @@ -636,9 +638,9 @@ void Cpptraj::Cluster::Control::Info() const { if (sieveRestore_ == CLOSEST_CENTROID) mprintf(" by closest distance to centroid.\n"); else if (sieveRestore_ == EPSILON_CENTROID) - mprintf(" if within epsilon %f of a centroid.\n", restoreEpsilon_); + mprintf(" if within epsilon %f of a centroid (less accurate but faster).\n", restoreEpsilon_); else if (sieveRestore_ == EPSILON_FRAME) - mprintf(" if within epsilon %f of a frame.\n", restoreEpsilon_); + mprintf(" if within epsilon %f of a frame (more accurate and identifies noise but slower).\n", restoreEpsilon_); } mprintf("\tRepresentative frames will be chosen by"); From c0a0da64cd6c3b50888e228c4421ad8e93031218 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 11:48:46 -0400 Subject: [PATCH 204/417] Add build for cluster stuff --- src/Cluster/Makefile | 38 ++++++++++++++++++++++++++++++++++++++ src/Cluster/clusterdepend | 32 ++++++++++++++++++++++++-------- src/Cluster/clusterfiles | 27 +++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 src/Cluster/Makefile create mode 100644 src/Cluster/clusterfiles diff --git a/src/Cluster/Makefile b/src/Cluster/Makefile new file mode 100644 index 0000000000..933e2b0942 --- /dev/null +++ b/src/Cluster/Makefile @@ -0,0 +1,38 @@ +# Cluster code library Makefile +include ../../config.h + +include clusterfiles + +DEL_FILE = /bin/rm -f +AR = ar cqs +TARGET = libcpptraj_cluster.a + +# Objects +OBJECTS=$(CLUSTER_SOURCES:.cpp=.o) + +#CLUSTER_TARGET=Cluster/libcpptraj_cluster.a + +# Default target: library +all: $(TARGET) + +# Build library +$(TARGET): $(OBJECTS) + -$(DEL_FILE) $(TARGET) + $(AR) $(TARGET) $(OBJECTS) + +clean: + $(DEL_FILE) *.o $(TARGET) + +uninstall: clean + +# Dependency targets +../findDepend: + cd ../ && $(MAKE) findDepend + +depend: ../findDepend + ../findDepend $(CLUSTER_SOURCES) > clusterdepend + +#dependclean: +# $(DEL_FILE) FindDepend.o findDepend + +include clusterdepend diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 56a99ca364..f386043fd1 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,8 +1,24 @@ -Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../ClusterMatrix.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h -Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../Vec3.h Centroid.h Centroid_Coord.h -Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../ClusterMatrix.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../Vec3.h Algorithm.h Algorithm_HierAgglo.h Centroid.h Control.h List.h Metric.h Metric_RMS.h Node.h PairwiseMatrix.h PairwiseMatrix_MEM.h -List.o : List.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h List.h Metric.h Node.h PairwiseMatrix.h -Metric_RMS.o : Metric_RMS.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Centroid_Coord.h Metric.h Metric_RMS.h -Node.o : Node.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h Node.h PairwiseMatrix.h -PairwiseMatrix.o : PairwiseMatrix.cpp ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomExtra.h ../AtomMask.h ../Box.h ../CharMask.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterTypes.h ../ProgressBar.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../Vec3.h Centroid.h Metric.h Metric_RMS.h PairwiseMatrix.h -PairwiseMatrix_MEM.o : PairwiseMatrix_MEM.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../Dimension.h ../FileIO.h ../FileName.h ../Matrix.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Metric.h PairwiseMatrix.h PairwiseMatrix_MEM.h +Algorithm.o : Algorithm.cpp ../CpptrajStdio.h Algorithm.h Cframes.h Metric.h Node.h PairwiseMatrix.h +Algorithm_DBscan.o : Algorithm_DBscan.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 ../DataFile.h ../DataSet.h ../DataSetList.h ../DataSet_2D.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../DataSet_MatrixDbl.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 ../ProgressBar.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 Algorithm.h Algorithm_DBscan.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +Algorithm_DPeaks.o : Algorithm_DPeaks.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_Mesh.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../Spline.h ../TextFormat.h Algorithm.h Algorithm_DPeaks.h Cframes.h List.h Node.h PairwiseMatrix.h +Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h ../ProgressBar.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Cframes.h DynamicMatrix.h List.h Node.h PairwiseMatrix.h +Algorithm_Kmeans.o : Algorithm_Kmeans.cpp ../ArgList.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h ../ProgressBar.h ../Random.h Algorithm.h Algorithm_Kmeans.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +BestReps.o : BestReps.cpp ../CpptrajStdio.h BestReps.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h +Cframes.o : Cframes.cpp Cframes.h +Cmatrix_Binary.o : Cmatrix_Binary.cpp ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h Cframes.h Cmatrix_Binary.h +Cmatrix_NC.o : Cmatrix_NC.cpp ../CpptrajStdio.h ../FileName.h ../NC_Routines.h Cframes.h Cmatrix_NC.h +Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h Cframes.h Control.h DynamicMatrix.h List.h Metric.h Metric_DME.h Metric_Data.h Metric_Data_Euclid.h Metric_Data_Manhattan.h Metric_RMS.h Metric_SRMSD.h Node.h Output.h PairwiseMatrix.h Results.h Results_Coords.h Sieve.h +DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h +List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +Metric_DME.o : Metric_DME.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_DME.h +Metric_Data.o : Metric_Data.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Multi.h Cframes.h Metric.h Metric_Data.h +Metric_Data_Euclid.o : Metric_Data_Euclid.cpp ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Multi.h Metric.h Metric_Data.h Metric_Data_Euclid.h +Metric_Data_Manhattan.o : Metric_Data_Manhattan.cpp ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Multi.h Metric.h Metric_Data.h Metric_Data_Manhattan.h +Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_RMS.h +Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_SRMSD.h +Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Cframes.h Metric.h Node.h PairwiseMatrix.h +Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h +PairwiseMatrix.o : PairwiseMatrix.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Metric.h PairwiseMatrix.h +Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.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 ../OutputTrajCommon.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 ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Cframes.h List.h Node.h Results.h Results_Coords.h +Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h diff --git a/src/Cluster/clusterfiles b/src/Cluster/clusterfiles new file mode 100644 index 0000000000..da45b084ab --- /dev/null +++ b/src/Cluster/clusterfiles @@ -0,0 +1,27 @@ +# Files related to new clustering code +CLUSTER_SOURCES= \ + Algorithm.cpp \ + Algorithm_DBscan.cpp \ + Algorithm_DPeaks.cpp \ + Algorithm_HierAgglo.cpp \ + Algorithm_Kmeans.cpp \ + BestReps.cpp \ + Centroid_Coord.cpp \ + Cframes.cpp \ + Cmatrix_Binary.cpp \ + Cmatrix_NC.cpp \ + Control.cpp \ + DynamicMatrix.cpp \ + List.cpp \ + Metric_Data.cpp \ + Metric_Data_Euclid.cpp \ + Metric_Data_Manhattan.cpp \ + Metric_DME.cpp \ + Metric_RMS.cpp \ + Metric_SRMSD.cpp \ + Node.cpp \ + Output.cpp \ + PairwiseMatrix.cpp \ + Results_Coords.cpp \ + Sieve.cpp + From c823d5eecb1926a37d94d2e457a2956731e31862 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 13:48:08 -0400 Subject: [PATCH 205/417] Enable libcpptraj_cluster.a target --- src/Makefile | 22 ++++++++++++---------- src/cpptrajdepend | 24 ------------------------ src/cpptrajfiles | 29 +---------------------------- 3 files changed, 13 insertions(+), 62 deletions(-) diff --git a/src/Makefile b/src/Makefile index 4952e3209d..1dba8efe95 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,7 +7,7 @@ DEL_FILE = /bin/rm -f OBJECTS=$(SOURCES:.cpp=.o) $(CSOURCES:.c=.o) -#CLUSTER_TARGET=Cluster/libcpptraj_cluster.a +CLUSTER_TARGET=Cluster/libcpptraj_cluster.a # Default target: cpptraj only all: cpptraj$(SFX)$(EXE) @@ -19,8 +19,8 @@ install: $(INSTALL_TARGETS) install_cpptraj: cpptraj$(SFX)$(EXE) mv cpptraj$(SFX)$(EXE) $(CPPTRAJBIN) -cpptraj$(SFX)$(EXE): $(OBJECTS) $(FFT_TARGET) $(READLINE_TARGET) $(CUDA_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) $(TNGFILE_TARGET) - $(CXX) -o cpptraj$(SFX)$(EXE) $(OBJECTS) $(CUDA_TARGET) $(FFT_TARGET) $(READLINE_LIB) $(CPPTRAJ_LIB) $(LDFLAGS) +cpptraj$(SFX)$(EXE): $(OBJECTS) $(FFT_TARGET) $(READLINE_TARGET) $(CUDA_TARGET) $(CLUSTER_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) $(TNGFILE_TARGET) + $(CXX) -o cpptraj$(SFX)$(EXE) $(OBJECTS) $(CUDA_TARGET) $(CLUSTER_TARGET) $(FFT_TARGET) $(READLINE_LIB) $(CPPTRAJ_LIB) $(LDFLAGS) # libcpptraj --------------------------- # Rule to make libcpptraj-specific objects @@ -29,8 +29,8 @@ cpptraj$(SFX)$(EXE): $(OBJECTS) $(FFT_TARGET) $(READLINE_TARGET) $(CUDA_TARGET) libcpptraj: $(LIBCPPTRAJ_TARGET) -$(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX): $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(CUDA_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) $(TNGFILE_TARGET) - $(CXX) -shared -o $(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX) $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(CUDA_TARGET) $(CPPTRAJ_LIB) $(LDFLAGS) +$(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX): $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(CUDA_TARGET) $(CLUSTER_TARGET) $(XDRFILE_TARGET) $(ARPACK_TARGET) $(TNGFILE_TARGET) + $(CXX) -shared -o $(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX) $(LIBCPPTRAJ_OBJECTS) $(FFT_TARGET) $(CUDA_TARGET) $(CLUSTER_TARGET) $(CPPTRAJ_LIB) $(LDFLAGS) # Data directory ----------------------- install_dat: @@ -103,8 +103,8 @@ noarpack: cuda_kernels/libcpptraj_cuda.a: ../external.config.h cd cuda_kernels && $(MAKE) all -#Cluster/libcpptraj_cluster.a: -# cd Cluster && $(MAKE) all +$(CLUSTER_TARGET): + cd Cluster && $(MAKE) all # Dependency targets findDepend: FindDepend.o @@ -123,6 +123,7 @@ clean: cd xdrfile && $(MAKE) clean cd arpack && $(MAKE) clean cd cuda_kernels && $(MAKE) clean + cd Cluster && $(MAKE) clean cd tng && $(MAKE) clean uninstall_lib: @@ -141,9 +142,10 @@ uninstall_inc: uninstall: uninstall_lib uninstall_inc $(DEL_FILE) $(CPPTRAJBIN)/cpptraj$(SFX)$(EXE) $(DEL_FILE) $(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX) - cd readline && make uninstall - cd xdrfile && make uninstall - cd cuda_kernels && make uninstall + cd readline && $(MAKE) uninstall + cd xdrfile && $(MAKE) uninstall + cd cuda_kernels && $(MAKE) uninstall + cd Cluster && $(MAKE) uninstall # Header dependencies include cpptrajdepend diff --git a/src/cpptrajdepend b/src/cpptrajdepend index ca125445c5..b8ae7d3c24 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -146,30 +146,6 @@ ByteRoutines.o : ByteRoutines.cpp CIFfile.o : CIFfile.cpp Atom.h BufferedLine.h CIFfile.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h SymbolExporting.h CharMask.o : CharMask.cpp Atom.h CharMask.h CpptrajStdio.h MaskToken.h Molecule.h NameType.h Residue.h Segment.h SymbolExporting.h Unit.h CharmmParamFile.o : CharmmParamFile.cpp ArgList.h AtomType.h BufferedLine.h CharmmParamFile.h Constants.h CpptrajFile.h CpptrajStdio.h FileIO.h FileName.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h StringRoutines.h TypeNameHolder.h -Cluster/Algorithm.o : Cluster/Algorithm.cpp Cluster/../CpptrajStdio.h Cluster/Algorithm.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DBscan.o : Cluster/Algorithm_DBscan.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_2D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_MatrixDbl.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_DPeaks.o : Cluster/Algorithm_DPeaks.cpp Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_Mesh.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../Spline.h Cluster/../TextFormat.h Cluster/Algorithm.h Cluster/Algorithm_DPeaks.h Cluster/Cframes.h Cluster/List.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_HierAgglo.o : Cluster/Algorithm_HierAgglo.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Timer.h Cluster/Algorithm.h Cluster/Algorithm_HierAgglo.h Cluster/Cframes.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Algorithm_Kmeans.o : Cluster/Algorithm_Kmeans.cpp Cluster/../ArgList.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Random.h Cluster/Algorithm.h Cluster/Algorithm_Kmeans.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/BestReps.o : Cluster/BestReps.cpp Cluster/../CpptrajStdio.h Cluster/BestReps.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Centroid_Coord.o : Cluster/Centroid_Coord.cpp Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../Box.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h -Cluster/Cframes.o : Cluster/Cframes.cpp Cluster/Cframes.h -Cluster/Cmatrix_Binary.o : Cluster/Cmatrix_Binary.cpp Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h -Cluster/Cmatrix_NC.o : Cluster/Cmatrix_NC.cpp Cluster/../CpptrajStdio.h Cluster/../FileName.h Cluster/../NC_Routines.h Cluster/Cframes.h Cluster/Cmatrix_NC.h -Cluster/Control.o : Cluster/Control.cpp Cluster/../ArgList.h Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../BufferedLine.h Cluster/../Cluster/Cframes.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataFile.h Cluster/../DataFileList.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_1D.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../DataSet_PairwiseCache.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Random.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/Algorithm_DBscan.h Cluster/Algorithm_DPeaks.h Cluster/Algorithm_HierAgglo.h Cluster/Algorithm_Kmeans.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DynamicMatrix.h Cluster/List.h Cluster/Metric.h Cluster/Metric_DME.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h Cluster/Metric_Data_Manhattan.h Cluster/Metric_RMS.h Cluster/Metric_SRMSD.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h Cluster/Results.h Cluster/Results_Coords.h Cluster/Sieve.h -Cluster/DynamicMatrix.o : Cluster/DynamicMatrix.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajStdio.h Cluster/../Matrix.h Cluster/DynamicMatrix.h -Cluster/List.o : Cluster/List.cpp Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Metric_DME.o : Cluster/Metric_DME.cpp Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_DME.h -Cluster/Metric_Data.o : Cluster/Metric_Data.cpp Cluster/../AssociatedData.h Cluster/../Constants.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_Data.h -Cluster/Metric_Data_Euclid.o : Cluster/Metric_Data_Euclid.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Euclid.h -Cluster/Metric_Data_Manhattan.o : Cluster/Metric_Data_Manhattan.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Centroid_Multi.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Metric_Data_Manhattan.h -Cluster/Metric_RMS.o : Cluster/Metric_RMS.cpp Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_RMS.h -Cluster/Metric_SRMSD.o : Cluster/Metric_SRMSD.cpp Cluster/../ArrayIterator.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMap.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_Coords.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Frame.h Cluster/../Hungarian.h Cluster/../MapAtom.h Cluster/../MaskToken.h Cluster/../Matrix.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../SymmetricRmsdCalc.h Cluster/../TextFormat.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Centroid.h Cluster/Centroid_Coord.h Cluster/Cframes.h Cluster/Metric.h Cluster/Metric_SRMSD.h -Cluster/Node.o : Cluster/Node.cpp Cluster/../AssociatedData.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_1D.h Cluster/../DataSet_float.h Cluster/../DataSet_integer.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Centroid.h Cluster/Cframes.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h -Cluster/Output.o : Cluster/Output.cpp Cluster/../ArrayIterator.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Matrix.h Cluster/../Parallel.h Cluster/Algorithm.h Cluster/Cframes.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/Output.h Cluster/PairwiseMatrix.h -Cluster/PairwiseMatrix.o : Cluster/PairwiseMatrix.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../ProgressBar.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Metric.h Cluster/PairwiseMatrix.h -Cluster/Results_Coords.o : Cluster/Results_Coords.cpp Cluster/../ActionFrameCounter.h Cluster/../ArgList.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../CpptrajStdio.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../OutputTrajCommon.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../StringRoutines.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TrajectoryFile.h Cluster/../Trajout_Single.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Cframes.h Cluster/List.h Cluster/Node.h Cluster/Results.h Cluster/Results_Coords.h -Cluster/Sieve.o : Cluster/Sieve.cpp Cluster/../AssociatedData.h Cluster/../Cluster/Cframes.h Cluster/../CpptrajFile.h Cluster/../DataSet.h Cluster/../DataSet_PairwiseCache.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../MetaData.h Cluster/../Parallel.h Cluster/../Random.h Cluster/../Range.h Cluster/../TextFormat.h Cluster/Cframes.h Cluster/Sieve.h ClusterMap.o : ClusterMap.cpp AssociatedData.h ClusterMap.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_2D.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h ProgressBar.h ProgressTimer.h Range.h TextFormat.h Timer.h Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 868d2a917f..423c5f858f 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -1,33 +1,6 @@ -# Files related to new clustering code -CLUSTER_SOURCES= \ - Cluster/Algorithm.cpp \ - Cluster/Algorithm_DBscan.cpp \ - Cluster/Algorithm_DPeaks.cpp \ - Cluster/Algorithm_HierAgglo.cpp \ - Cluster/Algorithm_Kmeans.cpp \ - Cluster/BestReps.cpp \ - Cluster/Centroid_Coord.cpp \ - Cluster/Cframes.cpp \ - Cluster/Cmatrix_Binary.cpp \ - Cluster/Cmatrix_NC.cpp \ - Cluster/Control.cpp \ - Cluster/DynamicMatrix.cpp \ - Cluster/List.cpp \ - Cluster/Metric_Data.cpp \ - Cluster/Metric_Data_Euclid.cpp \ - Cluster/Metric_Data_Manhattan.cpp \ - Cluster/Metric_DME.cpp \ - Cluster/Metric_RMS.cpp \ - Cluster/Metric_SRMSD.cpp \ - Cluster/Node.cpp \ - Cluster/Output.cpp \ - Cluster/PairwiseMatrix.cpp \ - Cluster/Results_Coords.cpp \ - Cluster/Sieve.cpp - # These files are common to cpptraj/libcpptraj. Files that need to be built # differently for each will go into SOURCES/LIBCPPTRAJ_OBJECTS respectively. -COMMON_SOURCES= $(CLUSTER_SOURCES) \ +COMMON_SOURCES= \ SpaceGroup.cpp \ ActionFrameCounter.cpp \ ActionList.cpp \ From 321937430b5c101f64dc3a620c524e1bf6f72571 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 14:24:17 -0400 Subject: [PATCH 206/417] Have findDepend depend on FindDepend.cpp --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 1dba8efe95..a36c1c8b40 100644 --- a/src/Makefile +++ b/src/Makefile @@ -107,7 +107,7 @@ $(CLUSTER_TARGET): cd Cluster && $(MAKE) all # Dependency targets -findDepend: FindDepend.o +findDepend: FindDepend.cpp FindDepend.o $(CXX) -o findDepend FindDepend.o depend: findDepend From 7b08f546ca8d2086ebf963df0924ece78480b365 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 15:12:28 -0400 Subject: [PATCH 207/417] Simplify directory prefixes to cut down on redundant dependencies --- src/FindDepend.cpp | 66 ++++++++++++++++++++++++++++++++++++++++------ src/cpptrajdepend | 12 ++++----- 2 files changed, 64 insertions(+), 14 deletions(-) diff --git a/src/FindDepend.cpp b/src/FindDepend.cpp index fdd052cdbd..0f1430d48b 100644 --- a/src/FindDepend.cpp +++ b/src/FindDepend.cpp @@ -11,6 +11,7 @@ #include #include #include +#include using namespace std; @@ -50,12 +51,40 @@ bool IgnoreHeader(const char* headername) { return false; } -/** Add list of dependencies for the given file to appropriate map. */ -void GetDependencies(string const& filename) { - char buffer[BUFFERSIZE+1]; - char headername[BUFFERSIZE+1]; +/** Try to simplify a directory prefix that may contain '../'. */ +std::string SimplifyDirPrefix(std::string const& dirPrefix) { + if (dirPrefix.empty()) return dirPrefix; + + std::vector slashes; + for (std::string::const_iterator it = dirPrefix.begin(); it != dirPrefix.end(); ++it) + if ( *it == '/' ) { + slashes.push_back( it - dirPrefix.begin() ); + //printf("\tSlash at %li\n", slashes.back()); + } + // If only one slash, nothing to simplify + if (slashes.size() < 2) return dirPrefix; + // 012 + // Check for ../ + // 210 + for (std::vector::const_iterator it = slashes.begin(); it != slashes.end(); ++it) + { + if (*it > 1) { + if ( dirPrefix[*it-2] == '.' && dirPrefix[*it-1] == '.' ) { + //printf("\t../ at %li\n", *it); + // If this is ../ corresponding to 2nd slash, negates everything from the beginning to here + if (it - slashes.begin() == 1) { + std::string newStr = dirPrefix.substr(*it+1, dirPrefix.size() - *it+1); + //printf("\tNew prefix= %s\n", newStr.c_str()); + return newStr; + } + } + } + } + return dirPrefix; +} + +void SplitIntoDirAndBase(std::string& filename, std::string& dirPrefix, std::string& baseName) { // Determine path - string baseName, dirPrefix; size_t found = filename.find_last_of("/"); if (found == std::string::npos) { baseName = filename; @@ -65,10 +94,27 @@ void GetDependencies(string const& filename) { dirPrefix = filename.substr(0, found+1); } //printf("DEBUG: Dir='%s' Base='%s'\n", dirPrefix.c_str(), baseName.c_str()); + // Ascertain whether we can simplify the directory prefix + std::string newDirPrefix = SimplifyDirPrefix( dirPrefix ); + if (!dirPrefix.empty() && newDirPrefix.empty()) { + dirPrefix.clear(); + filename = baseName; + } +} + +/** Add list of dependencies for the given file to appropriate map. */ +void GetDependencies(string const& filenameIn) { + std::string filename = filenameIn; + char buffer[BUFFERSIZE+1]; + char headername[BUFFERSIZE+1]; + // Determine path + string baseName, dirPrefix; + SplitIntoDirAndBase(filename, dirPrefix, baseName); + // Determine type FileType type; string ext; - found = filename.find_last_of("."); + size_t found = filename.find_last_of("."); if (found != string::npos) ext = filename.substr(found); @@ -119,8 +165,12 @@ void GetDependencies(string const& filename) { // Get rid of last " size_t pos = strlen(headername); if (headername[pos-1]=='"') headername[pos-1]='\0'; - if (!IgnoreHeader(headername)) - depends.insert( dirPrefix + string(headername) ); + if (!IgnoreHeader(headername)) { + std::string newFileName = dirPrefix + string(headername); + std::string newdir, newbase; + SplitIntoDirAndBase(newFileName, newdir, newbase); + depends.insert( newFileName ); + } } //else //printf("\tSkipping system header line: %s", buffer); } diff --git a/src/cpptrajdepend b/src/cpptrajdepend index b8ae7d3c24..7370a7c78f 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -15,7 +15,7 @@ Action_Center.o : Action_Center.cpp Action.h ActionState.h Action_Center.h ArgLi Action_Channel.o : Action_Channel.cpp Action.h ActionState.h Action_Channel.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_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 SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Action_CheckChirality.o : Action_CheckChirality.cpp Action.h ActionState.h Action_CheckChirality.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharMask.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 DataSet_Mesh.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 Spline.h SymbolExporting.h TextFormat.h Timer.h Topology.h TorsionRoutines.h TypeNameHolder.h Unit.h Vec3.h Action_CheckStructure.o : Action_CheckStructure.cpp Action.h ActionState.h Action_CheckStructure.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 DataSet_double.h DataSet_integer.h DataSet_string.h Dimension.h DispatchObject.h ExclusionArray.h FileIO.h FileName.h FileTypes.h Frame.h ImageOption.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h StructureCheck.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h -Action_Closest.o : Action_Closest.cpp Action.h ActionState.h ActionTopWriter.h Action_Closest.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharMask.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 DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.h ImageOption.h ImageRoutines.h ImageTypes.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 cuda_kernels/../ImageOption.h cuda_kernels/kernel_wrappers.cuh +Action_Closest.o : Action_Closest.cpp Action.h ActionState.h ActionTopWriter.h Action_Closest.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharMask.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 DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.h ImageOption.h ImageRoutines.h ImageTypes.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 cuda_kernels/kernel_wrappers.cuh Action_ClusterDihedral.o : Action_ClusterDihedral.cpp Action.h ActionState.h Action_ClusterDihedral.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 DataSet_integer.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 TorsionRoutines.h TypeNameHolder.h Unit.h Vec3.h Action_Contacts.o : Action_Contacts.cpp Action.h ActionState.h Action_Contacts.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 DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.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_CreateCrd.o : Action_CreateCrd.cpp Action.h ActionState.h Action_CreateCrd.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CompactFrameArray.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_CRD.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 StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h @@ -86,13 +86,13 @@ Action_Vector.o : Action_Vector.cpp Action.h ActionState.h Action_Vector.h ArgLi 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 -Action_Watershell.o : Action_Watershell.cpp Action.h ActionState.h Action_Watershell.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharMask.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 DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.h ImageOption.h ImageRoutines.h ImageTypes.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 cuda_kernels/../ImageOption.h cuda_kernels/kernel_wrappers.cuh +Action_Watershell.o : Action_Watershell.cpp Action.h ActionState.h Action_Watershell.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharMask.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 DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.h ImageOption.h ImageRoutines.h ImageTypes.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 cuda_kernels/kernel_wrappers.cuh Action_XtalSymm.o : Action_XtalSymm.cpp Action.h ActionState.h Action_XtalSymm.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_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.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 SpaceGroup.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h AnalysisState.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 Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.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 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 Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.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 -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.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 DataSet_float.h DataSet_integer.h DataSet_string.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 @@ -150,7 +150,7 @@ ClusterMap.o : ClusterMap.cpp AssociatedData.h ClusterMap.h Constants.h CpptrajF Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/../AssociatedData.h Cluster/../Atom.h Cluster/../AtomMask.h Cluster/../AtomType.h Cluster/../BaseIOtype.h Cluster/../Box.h Cluster/../Constants.h Cluster/../CoordinateInfo.h Cluster/../CpptrajFile.h Cluster/../DataFile.h Cluster/../DataSet.h Cluster/../DataSetList.h Cluster/../DataSet_Coords.h Cluster/../DataSet_Coords_REF.h Cluster/../Dimension.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../FileTypes.h Cluster/../Frame.h Cluster/../MaskToken.h Cluster/../Matrix_3x3.h Cluster/../MetaData.h Cluster/../Molecule.h Cluster/../NameType.h Cluster/../Parallel.h Cluster/../ParameterHolders.h Cluster/../ParameterSet.h Cluster/../ParameterTypes.h Cluster/../Range.h Cluster/../ReferenceFrame.h Cluster/../ReplicaDimArray.h Cluster/../Residue.h Cluster/../Segment.h Cluster/../SymbolExporting.h Cluster/../TextFormat.h Cluster/../Timer.h Cluster/../Topology.h Cluster/../TypeNameHolder.h Cluster/../Unit.h Cluster/../Vec3.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h CompactFrameArray.o : CompactFrameArray.cpp Box.h CompactFrameArray.h CoordinateInfo.h CpptrajStdio.h Matrix_3x3.h Parallel.h ReplicaDimArray.h Vec3.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h @@ -172,7 +172,7 @@ DataIO_CharmmFastRep.o : DataIO_CharmmFastRep.cpp ArgList.h AssociatedData.h Ato DataIO_CharmmOutput.o : DataIO_CharmmOutput.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_CharmmOutput.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_double.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_CharmmRepLog.o : DataIO_CharmmRepLog.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_CharmmRepLog.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_RemLog.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 SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h DataIO_CharmmRtfPrm.o : DataIO_CharmmRtfPrm.cpp ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharmmParamFile.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_CharmmRtfPrm.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Parameters.h DataSet_Topology.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_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/../CpptrajFile.h Cluster/../FileIO.h Cluster/../FileName.h Cluster/../Parallel.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_Binary.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.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_Cmatrix_Binary.o : DataIO_Cmatrix_Binary.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Cframes.h Cluster/Cmatrix_Binary.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_Binary.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.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_Cmatrix_NC.o : DataIO_Cmatrix_NC.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Cframes.h Cluster/Cmatrix_NC.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cmatrix_NC.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.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_Cpout.o : DataIO_Cpout.cpp ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedLine.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Cpout.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h DataSet_PHREMD_Implicit.h DataSet_pH.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_Evecs.o : DataIO_Evecs.cpp ArgList.h ArrayIterator.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedFrame.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataIO.h DataIO_Evecs.h DataSet.h DataSetList.h DataSet_2D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_MatrixDbl.h DataSet_Modes.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 @@ -421,5 +421,5 @@ Vec3.o : Vec3.cpp Constants.h CpptrajStdio.h Vec3.h ViewRst.o : ViewRst.cpp ActionFrameCounter.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.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 OutputTrajCommon.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h ParmFile.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajectoryFile.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h ViewRst.h main.o : main.cpp Action.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h Cpptraj.h CpptrajFile.h CpptrajState.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h InputTrajCommon.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 ReplicaInfo.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Unit.h Vec3.h molsurf.o : molsurf.c molsurf.h -vmdplugin/dtrplugin.o : vmdplugin/dtrplugin.cpp vmdplugin/../ByteRoutines.h vmdplugin/dtrplugin.hxx vmdplugin/vmddir.h +vmdplugin/dtrplugin.o : vmdplugin/dtrplugin.cpp ByteRoutines.h vmdplugin/dtrplugin.hxx vmdplugin/vmddir.h xoshiro128plusplus.o : xoshiro128plusplus.cpp From eca5b0088a827799838fb1a7030942f087453b8a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 15:26:20 -0400 Subject: [PATCH 208/417] Start adding DrawGraph --- src/Cluster/DrawGraph.cpp | 151 ++++++++++++++++++++++++++++++++++++++ src/Cluster/DrawGraph.h | 11 +++ 2 files changed, 162 insertions(+) create mode 100644 src/Cluster/DrawGraph.cpp create mode 100644 src/Cluster/DrawGraph.h diff --git a/src/Cluster/DrawGraph.cpp b/src/Cluster/DrawGraph.cpp new file mode 100644 index 0000000000..6522960921 --- /dev/null +++ b/src/Cluster/DrawGraph.cpp @@ -0,0 +1,151 @@ +#include "DrawGraph.h" +#include "../Constants.h" +#include "../CpptrajStdio.h" +#include "../DataSet_1D.h" +#include "../PDBfile.h" +#include "../Vec3.h" +#include +#include + +void Cpptraj::Cluster::DrawGraph(bool use_z, DataSet* cnumvtime, + double min_tol, int max_iteration, int debug) +{ + if (use_z) + mprintf("\tCreating PDB of graph points based on pairwise distances. B-factor = cluster #.\n"); + else + mprintf("\tAttempting to draw graph based on pairwise distances.\n"); + unsigned int nframes = FrameDistances().Nrows(); + std::vector Xarray; // Coords + std::vector Farray; // Forces + Xarray.reserve( nframes ); + Farray.assign( nframes, Vec3(0.0) ); + // Initialize coordinates. X and Y only. + double zcoord = 0.0; + double theta_deg = 0.0; + double delta = 360.0 / (double)nframes; + for (unsigned int n = 0; n != nframes; n++, theta_deg += delta) { + double theta_rad = Constants::DEGRAD * theta_deg; + if (use_z) + zcoord = cos(theta_rad / 2.0); + Xarray.push_back( Vec3(cos(theta_rad), sin(theta_rad), zcoord) ); + } + // Write out initial graph + if (debug > 0 && !use_z) { + CpptrajFile graph0; + if (graph0.OpenWrite("InitialGraph.dat")) return; + for (std::vector::const_iterator XV = Xarray.begin(); + XV != Xarray.end(); ++XV) + graph0.Printf("%g %g %li\n", (*XV)[0], (*XV)[1], XV - Xarray.begin() + 1); + graph0.CloseFile(); + } + // Degrees of freedom. If Z ever initialized needs to be 3N + double deg_of_freedom = 2.0 * (double)nframes; + if (use_z) deg_of_freedom += (double)nframes; + double fnq = sqrt( deg_of_freedom ); + // Main loop for steepest descent + const double Rk = 1.0; + const double dxstm = 1.0E-5; + const double crits = 1.0E-6; + double rms = 1.0; + double dxst = 0.1; + double last_e = 0.0; + int iteration = 0; + mprintf(" \t%8s %12s %12s\n", " ", "ENE", "RMS"); + while (rms > min_tol && iteration < max_iteration) { + double e_total = 0.0; + unsigned int idx = 0; // Index into FrameDistances + for (unsigned int f1 = 0; f1 != nframes; f1++) + { + for (unsigned int f2 = f1 + 1; f2 != nframes; f2++) + { + //double Req = FrameDistances().GetCdist(f1, f2); + Vec3 V1_2 = Xarray[f1] - Xarray[f2]; + double r2 = V1_2.Magnitude2(); + double s = sqrt(r2); + double r = 2.0 / s; + double db = s - FrameDistances().GetElement(idx++); + double df = Rk * db; + double e = df * db; + e_total += e; + df *= r; + // Apply force + V1_2 *= df; + Farray[f1] -= V1_2; + Farray[f2] += V1_2; + } + } + // Calculate the magnitude of the force vector. + double sum = 0.0; + for (std::vector::const_iterator FV = Farray.begin(); FV != Farray.end(); ++FV) + sum += FV->Magnitude2(); + rms = sqrt( sum ) / fnq; + // Adjust search step size + if (dxst < crits) dxst = dxstm; + dxst = dxst / 2.0; + if (e_total < last_e) dxst = dxst * 2.4; + double dxsth = dxst / sqrt( sum ); + last_e = e_total; + // Update positions and reset force array. + std::vector::iterator FV = Farray.begin(); + for (std::vector::iterator XV = Xarray.begin(); + XV != Xarray.end(); ++XV, ++FV) + { + *XV += (*FV * dxsth); + *FV = 0.0; + } + // Write out current E. + mprintf("Iteration:\t%8i %12.4E %12.4E\n", iteration, e_total, rms); + iteration++; + } + // RMS error + unsigned int idx = 0; // Index into FrameDistances + double sumdiff2 = 0.0; + for (unsigned int f1 = 0; f1 != nframes; f1++) + { + for (unsigned int f2 = f1 + 1; f2 != nframes; f2++) + { + Vec3 V1_2 = Xarray[f1] - Xarray[f2]; + double r1_2 = sqrt( V1_2.Magnitude2() ); + double Req = FrameDistances().GetElement(idx); + double diff = r1_2 - Req; + sumdiff2 += (diff * diff); + if (debug > 0) + mprintf("\t\t%u to %u: D= %g Eq= %g Delta= %g\n", + f1+1, f2+1, r1_2, Req, fabs(diff)); + ++idx; + } + } + double rms_err = sqrt( sumdiff2 / (double)FrameDistances().Nelements() ); + mprintf("\tRMS error of final graph positions: %g\n", rms_err); + // Write out final graph with cluster numbers. + std::vector Nums; + Nums.reserve( nframes ); + if (cnumvtime != 0) { + ClusterSieve::SievedFrames const& sievedFrames = FrameDistances().FramesToCluster(); + DataSet_1D const& CVT = static_cast( *cnumvtime ); + for (unsigned int n = 0; n != nframes; n++) + Nums.push_back( (int)CVT.Dval(sievedFrames[n]) ); + } else + for (int n = 1; n <= (int)nframes; n++) + Nums.push_back( n ); + if (!use_z) { + CpptrajFile graph; + if (graph.OpenWrite("DrawGraph.dat")) return; + for (std::vector::const_iterator XV = Xarray.begin(); + XV != Xarray.end(); ++XV) + graph.Printf("%g %g %i \"%li\"\n", (*XV)[0], (*XV)[1], + Nums[XV - Xarray.begin()], XV - Xarray.begin() + 1); + graph.CloseFile(); + } else { + // Write out PDB with B-factors + PDBfile pdbout; + if (pdbout.OpenWrite("DrawGraph.pdb")) return; + pdbout.WriteTITLE("Cluster points."); + for (std::vector::const_iterator XV = Xarray.begin(); + XV != Xarray.end(); ++XV) + pdbout.WriteCoord(PDBfile::HETATM, XV - Xarray.begin() + 1, "HE", "HE", + XV - Xarray.begin() + 1, (*XV)[0], (*XV)[1], (*XV)[2], + 1.0, Nums[XV - Xarray.begin()], "HE", 0); + pdbout.CloseFile(); + } +} diff --git a/src/Cluster/DrawGraph.h b/src/Cluster/DrawGraph.h new file mode 100644 index 0000000000..536feeb40e --- /dev/null +++ b/src/Cluster/DrawGraph.h @@ -0,0 +1,11 @@ +#ifndef INC_CLUSTER_DRAWGRAPH_H +#define INC_CLUSTER_DRAWGRAPH_H +class DataSet; +namespace Cpptraj { +namespace Cluster { + +void DrawGraph(bool, DataSet*, double, int, int); + +} +} +#endif From 078a59de114aeb541749874ea1ce941950ca4bab Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Sep 2021 20:56:08 -0400 Subject: [PATCH 209/417] Use new classes for drawgraph --- src/Cluster/DrawGraph.cpp | 24 ++++++++++++++---------- src/Cluster/DrawGraph.h | 5 +++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Cluster/DrawGraph.cpp b/src/Cluster/DrawGraph.cpp index 6522960921..995301b8dd 100644 --- a/src/Cluster/DrawGraph.cpp +++ b/src/Cluster/DrawGraph.cpp @@ -1,4 +1,6 @@ #include "DrawGraph.h" +#include "Cframes.h" +#include "PairwiseMatrix.h" #include "../Constants.h" #include "../CpptrajStdio.h" #include "../DataSet_1D.h" @@ -7,14 +9,15 @@ #include #include -void Cpptraj::Cluster::DrawGraph(bool use_z, DataSet* cnumvtime, +void Cpptraj::Cluster::DrawGraph(Cframes const& framesToCluster, PairwiseMatrix const& pmatrix, + bool use_z, DataSet* cnumvtime, double min_tol, int max_iteration, int debug) { if (use_z) mprintf("\tCreating PDB of graph points based on pairwise distances. B-factor = cluster #.\n"); else mprintf("\tAttempting to draw graph based on pairwise distances.\n"); - unsigned int nframes = FrameDistances().Nrows(); + unsigned int nframes = framesToCluster.size(); std::vector Xarray; // Coords std::vector Farray; // Forces Xarray.reserve( nframes ); @@ -53,7 +56,7 @@ void Cpptraj::Cluster::DrawGraph(bool use_z, DataSet* cnumvtime, mprintf(" \t%8s %12s %12s\n", " ", "ENE", "RMS"); while (rms > min_tol && iteration < max_iteration) { double e_total = 0.0; - unsigned int idx = 0; // Index into FrameDistances + //unsigned int idx = 0; // Index into FrameDistances for (unsigned int f1 = 0; f1 != nframes; f1++) { for (unsigned int f2 = f1 + 1; f2 != nframes; f2++) @@ -63,7 +66,7 @@ void Cpptraj::Cluster::DrawGraph(bool use_z, DataSet* cnumvtime, double r2 = V1_2.Magnitude2(); double s = sqrt(r2); double r = 2.0 / s; - double db = s - FrameDistances().GetElement(idx++); + double db = s - pmatrix.Frame_Distance(framesToCluster[f1], framesToCluster[f2]);//FrameDistances().GetElement(idx++); double df = Rk * db; double e = df * db; e_total += e; @@ -98,7 +101,7 @@ void Cpptraj::Cluster::DrawGraph(bool use_z, DataSet* cnumvtime, iteration++; } // RMS error - unsigned int idx = 0; // Index into FrameDistances + //unsigned int idx = 0; // Index into FrameDistances double sumdiff2 = 0.0; for (unsigned int f1 = 0; f1 != nframes; f1++) { @@ -106,25 +109,26 @@ void Cpptraj::Cluster::DrawGraph(bool use_z, DataSet* cnumvtime, { Vec3 V1_2 = Xarray[f1] - Xarray[f2]; double r1_2 = sqrt( V1_2.Magnitude2() ); - double Req = FrameDistances().GetElement(idx); + double Req = pmatrix.Frame_Distance(framesToCluster[f1], framesToCluster[f2]);//FrameDistances().GetElement(idx); double diff = r1_2 - Req; sumdiff2 += (diff * diff); if (debug > 0) mprintf("\t\t%u to %u: D= %g Eq= %g Delta= %g\n", f1+1, f2+1, r1_2, Req, fabs(diff)); - ++idx; + //++idx; } } - double rms_err = sqrt( sumdiff2 / (double)FrameDistances().Nelements() ); + unsigned int Nelements = nframes * (nframes-1)/2; + double rms_err = sqrt( sumdiff2 / (double)Nelements ); mprintf("\tRMS error of final graph positions: %g\n", rms_err); // Write out final graph with cluster numbers. std::vector Nums; Nums.reserve( nframes ); if (cnumvtime != 0) { - ClusterSieve::SievedFrames const& sievedFrames = FrameDistances().FramesToCluster(); + //ClusterSieve::SievedFrames const& sievedFrames = FrameDistances().FramesToCluster(); DataSet_1D const& CVT = static_cast( *cnumvtime ); for (unsigned int n = 0; n != nframes; n++) - Nums.push_back( (int)CVT.Dval(sievedFrames[n]) ); + Nums.push_back( (int)CVT.Dval(framesToCluster[n]) ); } else for (int n = 1; n <= (int)nframes; n++) Nums.push_back( n ); diff --git a/src/Cluster/DrawGraph.h b/src/Cluster/DrawGraph.h index 536feeb40e..c8d1bfc5f5 100644 --- a/src/Cluster/DrawGraph.h +++ b/src/Cluster/DrawGraph.h @@ -3,8 +3,9 @@ class DataSet; namespace Cpptraj { namespace Cluster { - -void DrawGraph(bool, DataSet*, double, int, int); +class Cframes; +class PairwiseMatrix; +void DrawGraph(Cframes const&, PairwiseMatrix const&, bool, DataSet*, double, int, int); } } From 8519831a2b55456b595ab80ecf9aaa6d50abef6d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 4 Sep 2021 10:45:59 -0400 Subject: [PATCH 210/417] Add GraphType --- src/Cluster/DrawGraph.cpp | 7 ++++++- src/Cluster/DrawGraph.h | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Cluster/DrawGraph.cpp b/src/Cluster/DrawGraph.cpp index 995301b8dd..e116cfd886 100644 --- a/src/Cluster/DrawGraph.cpp +++ b/src/Cluster/DrawGraph.cpp @@ -10,9 +10,14 @@ #include void Cpptraj::Cluster::DrawGraph(Cframes const& framesToCluster, PairwiseMatrix const& pmatrix, - bool use_z, DataSet* cnumvtime, + GraphType graphTypeIn, DataSet* cnumvtime, double min_tol, int max_iteration, int debug) { + bool use_z; + if (graphTypeIn == THREED) + use_z = true; + else + use_z = false; if (use_z) mprintf("\tCreating PDB of graph points based on pairwise distances. B-factor = cluster #.\n"); else diff --git a/src/Cluster/DrawGraph.h b/src/Cluster/DrawGraph.h index c8d1bfc5f5..72096a2bdb 100644 --- a/src/Cluster/DrawGraph.h +++ b/src/Cluster/DrawGraph.h @@ -5,7 +5,10 @@ namespace Cpptraj { namespace Cluster { class Cframes; class PairwiseMatrix; -void DrawGraph(Cframes const&, PairwiseMatrix const&, bool, DataSet*, double, int, int); + +enum GraphType { TWOD = 0, THREED }; + +void DrawGraph(Cframes const&, PairwiseMatrix const&, GraphType, DataSet*, double, int, int); } } From f83db2009abd03662f8a922378f012f21d345344 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 4 Sep 2021 10:57:40 -0400 Subject: [PATCH 211/417] Start incorporating drawgraph --- src/Cluster/Control.cpp | 11 +++++++++-- src/Cluster/Control.h | 11 +++++++++++ src/Cluster/DrawGraph.cpp | 4 +++- src/Cluster/DrawGraph.h | 2 +- src/Cluster/clusterdepend | 3 ++- src/Cluster/clusterfiles | 1 + 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index f36d8de450..2662c162ff 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -44,7 +44,11 @@ Cpptraj::Cluster::Control::Control() : windowSize_(0), cpopvtimefile_(0), norm_pop_(Node::NONE), - calc_lifetimes_(false) + calc_lifetimes_(false), + drawGraph_(NO_DRAWGRAPH), + draw_tol_(0), + draw_maxit_(0), + debug_(0) {} Cpptraj::Cluster::Control::~Control() { @@ -909,7 +913,10 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { } } - // TODO DrawGraph + // Draw cluster Graph + if (drawGraph_ != NO_DRAWGRAPH) { + DrawGraph( frameSieve_.FramesToCluster(), pmatrix_, drawGraph_, cnumvtime_, draw_tol_, draw_maxit_, debug_ ); + } // # unique clusters vs time if (clustersVtime_ != 0) { diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 68ef0abe90..7e8c26ca61 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -2,6 +2,7 @@ #define INC_CLUSTER_CONTROL_H #include "Algorithm.h" // Algorithm::AType #include "BestReps.h" +#include "DrawGraph.h" // GraphType #include "List.h" #include "Metric_Data.h" #include "Node.h" // Node::CnormType @@ -24,6 +25,10 @@ class Control { Control(); ~Control(); + /// Set debug level + void SetDebug(int d) { debug_ = d; } + + // Help keywords static const char* PairwiseArgs_; static const char* AlgorithmArgs_; static const char* CoordsDataSetArgs_; @@ -103,6 +108,12 @@ class Control { std::string splitfile_; ///< Output file for splitting cluster results Cframes splitFrames_; ///< Frames at which to split + GraphType drawGraph_; ///< Indicate whether a cluster graph should be drawn + double draw_tol_; ///< Graph draw tolerance for min + int draw_maxit_; ///< Graph draw max iterations for min + + int debug_; ///< Cluster debug level + // Timers Timer timer_setup_; ///< Run - metric, frames to cluster setup Timer timer_pairwise_; ///< Run - pairwise caching diff --git a/src/Cluster/DrawGraph.cpp b/src/Cluster/DrawGraph.cpp index e116cfd886..b92e084708 100644 --- a/src/Cluster/DrawGraph.cpp +++ b/src/Cluster/DrawGraph.cpp @@ -14,7 +14,9 @@ void Cpptraj::Cluster::DrawGraph(Cframes const& framesToCluster, PairwiseMatrix double min_tol, int max_iteration, int debug) { bool use_z; - if (graphTypeIn == THREED) + if (graphTypeIn == NO_DRAWGRAPH) + return; + else if (graphTypeIn == THREED) use_z = true; else use_z = false; diff --git a/src/Cluster/DrawGraph.h b/src/Cluster/DrawGraph.h index 72096a2bdb..5afd5a67f5 100644 --- a/src/Cluster/DrawGraph.h +++ b/src/Cluster/DrawGraph.h @@ -6,7 +6,7 @@ namespace Cluster { class Cframes; class PairwiseMatrix; -enum GraphType { TWOD = 0, THREED }; +enum GraphType { NO_DRAWGRAPH = 0, TWOD, THREED }; void DrawGraph(Cframes const&, PairwiseMatrix const&, GraphType, DataSet*, double, int, int); diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index f386043fd1..a02ae72bd2 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -8,7 +8,8 @@ Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../Coordi Cframes.o : Cframes.cpp Cframes.h Cmatrix_Binary.o : Cmatrix_Binary.cpp ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h Cframes.h Cmatrix_Binary.h Cmatrix_NC.o : Cmatrix_NC.cpp ../CpptrajStdio.h ../FileName.h ../NC_Routines.h Cframes.h Cmatrix_NC.h -Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h Cframes.h Control.h DynamicMatrix.h List.h Metric.h Metric_DME.h Metric_Data.h Metric_Data_Euclid.h Metric_Data_Manhattan.h Metric_RMS.h Metric_SRMSD.h Node.h Output.h PairwiseMatrix.h Results.h Results_Coords.h Sieve.h +Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h Metric_DME.h Metric_Data.h Metric_Data_Euclid.h Metric_Data_Manhattan.h Metric_RMS.h Metric_SRMSD.h Node.h Output.h PairwiseMatrix.h Results.h Results_Coords.h Sieve.h +DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h PairwiseMatrix.h DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h Metric_DME.o : Metric_DME.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_DME.h diff --git a/src/Cluster/clusterfiles b/src/Cluster/clusterfiles index da45b084ab..67fe9d902e 100644 --- a/src/Cluster/clusterfiles +++ b/src/Cluster/clusterfiles @@ -11,6 +11,7 @@ CLUSTER_SOURCES= \ Cmatrix_Binary.cpp \ Cmatrix_NC.cpp \ Control.cpp \ + DrawGraph.cpp \ DynamicMatrix.cpp \ List.cpp \ Metric_Data.cpp \ From 9cf950a779d928475898482fd67367d9285a78f6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 4 Sep 2021 10:59:23 -0400 Subject: [PATCH 212/417] Update dependencies, set debug level for cluster --- src/Analysis_Cluster.cpp | 1 + src/cpptrajdepend | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 96f4777055..9278a9bc1b 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -13,6 +13,7 @@ void Analysis_Cluster::Help() const { // Analysis_Cluster::Setup() Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& setup, int debugIn) { + control_.SetDebug( debugIn ); Cpptraj::Cluster::Metric_Data::DsArray cluster_dataset; DataSet_Coords* coords = 0; // First check for data diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 7370a7c78f..03408aff14 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -92,7 +92,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.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 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 Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.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 -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.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 DataSet_float.h DataSet_integer.h DataSet_string.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 @@ -150,7 +150,7 @@ ClusterMap.o : ClusterMap.cpp AssociatedData.h ClusterMap.h Constants.h CpptrajF Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h CompactFrameArray.o : CompactFrameArray.cpp Box.h CompactFrameArray.h CoordinateInfo.h CpptrajStdio.h Matrix_3x3.h Parallel.h ReplicaDimArray.h Vec3.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h From 64ea9e4d44be57fcf7aeaa55bf5df3cccf703e4d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 4 Sep 2021 14:59:26 -0400 Subject: [PATCH 213/417] Add parsing of drawgraph options --- src/Cluster/Control.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 2662c162ff..993ded8276 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -545,6 +545,16 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da return 1; } + // Draw graph + if (analyzeArgs.hasKey("drawgraph")) + drawGraph_ = TWOD; + else if (analyzeArgs.hasKey("drawgraph3d")) + drawGraph_ = THREED; + else + drawGraph_ = NO_DRAWGRAPH; + draw_maxit_ = analyzeArgs.getKeyInt("draw_maxit", 1000); + draw_tol_ = analyzeArgs.getKeyDouble("draw_tol", 1.0E-5); + // Cluster info output suppressInfo_ = analyzeArgs.hasKey("noinfo"); if (!suppressInfo_) @@ -716,8 +726,11 @@ void Cpptraj::Cluster::Control::Info() const { } else mprintf("\t\tFrames will be split at the halfway point.\n"); } - - + // TODO loaded refs_ + if (drawGraph_ != NO_DRAWGRAPH) + mprintf("\tEXPERIMENTAL: Force-directed graph will be drawn from pairwise distances.\n" + "\t Max iterations= %i, min tolerance= %g\n", + draw_maxit_, draw_tol_); } /** Figure out which frames to cluster, cache distances if necessary, then From 0067526bd0c04d5fe784578da719bbde33a6f70c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 4 Sep 2021 20:35:59 -0400 Subject: [PATCH 214/417] Ensure Cluster subdir is always made --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index a36c1c8b40..a5b3470d2c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -103,7 +103,7 @@ noarpack: cuda_kernels/libcpptraj_cuda.a: ../external.config.h cd cuda_kernels && $(MAKE) all -$(CLUSTER_TARGET): +$(CLUSTER_TARGET):: cd Cluster && $(MAKE) all # Dependency targets From 1ccf1a0916430634d4e65cba0a0d9db3c6936ed3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 4 Sep 2021 20:46:00 -0400 Subject: [PATCH 215/417] Start adding an assignrefs test --- test/Test_Cluster_AssignRefs/RunTest.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 test/Test_Cluster_AssignRefs/RunTest.sh diff --git a/test/Test_Cluster_AssignRefs/RunTest.sh b/test/Test_Cluster_AssignRefs/RunTest.sh new file mode 100755 index 0000000000..673ff07660 --- /dev/null +++ b/test/Test_Cluster_AssignRefs/RunTest.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +. ../MasterTest.sh + +CleanFiles cluster.in summary.dat ksummary.dat + +INPUT='-i cluster.in' + +TESTNAME='Clustering, assign reference names' + +cat > cluster.in < Date: Sun, 5 Sep 2021 11:52:09 -0400 Subject: [PATCH 216/417] Assign refs --- test/Test_Cluster_AssignRefs/RunTest.sh | 11 +- test/Test_Cluster_AssignRefs/rep.c0.mol2 | 476 +++++++++++++++++++++++ test/Test_Cluster_AssignRefs/rep.c1.mol2 | 476 +++++++++++++++++++++++ test/Test_Cluster_AssignRefs/rep.c2.mol2 | 476 +++++++++++++++++++++++ test/Test_Cluster_AssignRefs/rep.c3.mol2 | 476 +++++++++++++++++++++++ test/Test_Cluster_AssignRefs/rep.c4.mol2 | 476 +++++++++++++++++++++++ 6 files changed, 2388 insertions(+), 3 deletions(-) create mode 100644 test/Test_Cluster_AssignRefs/rep.c0.mol2 create mode 100644 test/Test_Cluster_AssignRefs/rep.c1.mol2 create mode 100644 test/Test_Cluster_AssignRefs/rep.c2.mol2 create mode 100644 test/Test_Cluster_AssignRefs/rep.c3.mol2 create mode 100644 test/Test_Cluster_AssignRefs/rep.c4.mol2 diff --git a/test/Test_Cluster_AssignRefs/RunTest.sh b/test/Test_Cluster_AssignRefs/RunTest.sh index 673ff07660..0857e3a4c6 100755 --- a/test/Test_Cluster_AssignRefs/RunTest.sh +++ b/test/Test_Cluster_AssignRefs/RunTest.sh @@ -2,7 +2,7 @@ . ../MasterTest.sh -CleanFiles cluster.in summary.dat ksummary.dat +CleanFiles cluster.in summary.dat ksummary.dat PW INPUT='-i cluster.in' @@ -12,8 +12,13 @@ cat > cluster.in <MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -5.7680 10.4340 3.1170 N3 1 SER 0.184900 + 2 H1 -6.6890 10.6870 2.7870 H 1 SER 0.189800 + 3 H2 -5.2100 10.0860 2.3510 H 1 SER 0.189800 + 4 H3 -5.9170 9.7590 3.8530 H 1 SER 0.189800 + 5 CA -5.2170 11.7130 3.5910 CT 1 SER 0.056700 + 6 HA -5.5610 12.4000 2.8180 HP 1 SER 0.078200 + 7 CB -5.8450 12.0530 4.9400 CT 1 SER 0.259600 + 8 HB2 -6.9150 12.0870 4.7360 H1 1 SER 0.027300 + 9 HB3 -5.6180 13.0490 5.3200 H1 1 SER 0.027300 + 10 OG -5.5110 11.0600 5.8830 OH 1 SER -0.671400 + 11 HG -6.3300 10.6260 6.1350 HO 1 SER 0.423900 + 12 C -3.7060 11.8100 3.4370 C 1 SER 0.616300 + 13 O -3.3060 12.2490 2.3610 O 1 SER -0.572200 + 14 N -2.8890 11.4250 4.4200 N 2 TRP -0.415700 + 15 H -3.3730 11.1220 5.2530 H 2 TRP 0.271900 + 16 CA -1.4410 11.4680 4.3780 CT 2 TRP -0.027500 + 17 HA -1.1200 12.5090 4.3350 H1 2 TRP 0.112300 + 18 CB -0.8390 10.9680 5.6890 CT 2 TRP -0.005000 + 19 HB2 -0.7480 9.8830 5.7170 HC 2 TRP 0.033900 + 20 HB3 -1.5230 11.0700 6.5310 HC 2 TRP 0.033900 + 21 CG 0.4410 11.6340 6.0770 C* 2 TRP -0.141500 + 22 CD1 0.6100 12.9490 6.3450 CW 2 TRP -0.163800 + 23 HD1 -0.2180 13.6410 6.3960 H4 2 TRP 0.206200 + 24 NE1 1.9110 13.2180 6.7220 NA 2 TRP -0.341800 + 25 HE1 2.3330 14.1120 6.9300 H 2 TRP 0.341200 + 26 CE2 2.6500 12.0530 6.7490 CN 2 TRP 0.138000 + 27 CZ2 3.9870 11.6890 6.9510 CA 2 TRP -0.260100 + 28 HZ2 4.6160 12.4930 7.3040 HA 2 TRP 0.157200 + 29 CH2 4.4970 10.4090 6.7040 CA 2 TRP -0.113400 + 30 HH2 5.5280 10.1210 6.8450 HA 2 TRP 0.141700 + 31 CZ3 3.6350 9.4970 6.0850 CA 2 TRP -0.197200 + 32 HZ3 4.0190 8.5000 5.9230 HA 2 TRP 0.144700 + 33 CE3 2.3010 9.8260 5.8150 CA 2 TRP -0.238700 + 34 HE3 1.6840 9.1240 5.2750 HA 2 TRP 0.170000 + 35 CD2 1.7820 11.0720 6.2020 CB 2 TRP 0.124300 + 36 C -0.8820 10.6490 3.2230 C 2 TRP 0.597300 + 37 O 0.0310 11.0690 2.5160 O 2 TRP -0.567900 + 38 N -1.5970 9.5630 2.9220 N 3 THR -0.415700 + 39 H -2.3560 9.3890 3.5640 H 3 THR 0.271900 + 40 CA -1.5410 8.6910 1.7660 CT 3 THR -0.038900 + 41 HA -0.5220 8.3100 1.6870 H1 3 THR 0.100700 + 42 CB -2.4230 7.4570 1.9280 CT 3 THR 0.365400 + 43 HB -2.5120 7.0290 0.9300 H1 3 THR 0.004300 + 44 CG2 -2.0380 6.4860 3.0410 CT 3 THR -0.243800 + 45 HG21 -1.0720 5.9940 2.9280 HC 3 THR 0.064200 + 46 HG22 -2.0180 6.9130 4.0440 HC 3 THR 0.064200 + 47 HG23 -2.7280 5.6480 3.1350 HC 3 THR 0.064200 + 48 OG1 -3.6970 7.8900 2.3500 OH 3 THR -0.676100 + 49 HG1 -4.2910 7.7360 1.6110 HO 3 THR 0.410200 + 50 C -1.8770 9.4800 0.5080 C 3 THR 0.597300 + 51 O -2.9820 10.0080 0.4010 O 3 THR -0.567900 + 52 N -0.9030 9.3930 -0.4000 N 4 TRP -0.415700 + 53 H -0.0320 8.9310 -0.1790 H 4 TRP 0.271900 + 54 CA -0.9970 9.9330 -1.7420 CT 4 TRP -0.027500 + 55 HA -1.8480 10.6150 -1.7660 H1 4 TRP 0.112300 + 56 CB 0.2150 10.8430 -1.9150 CT 4 TRP -0.005000 + 57 HB2 0.3570 11.0170 -2.9810 HC 4 TRP 0.033900 + 58 HB3 1.0680 10.1950 -1.7130 HC 4 TRP 0.033900 + 59 CG 0.3420 12.1760 -1.2490 C* 4 TRP -0.141500 + 60 CD1 1.1540 12.4320 -0.1990 CW 4 TRP -0.163800 + 61 HD1 1.7870 11.7020 0.2840 H4 4 TRP 0.206200 + 62 NE1 0.9020 13.7360 0.1810 NA 4 TRP -0.341800 + 63 HE1 1.3860 14.2190 0.9250 H 4 TRP 0.341200 + 64 CE2 -0.1300 14.3060 -0.5370 CN 4 TRP 0.138000 + 65 CZ2 -0.7270 15.5710 -0.4810 CA 4 TRP -0.260100 + 66 HZ2 -0.4800 16.3510 0.2240 HA 4 TRP 0.157200 + 67 CH2 -1.7280 15.9150 -1.3980 CA 4 TRP -0.113400 + 68 HH2 -2.2060 16.8780 -1.3010 HA 4 TRP 0.141700 + 69 CZ3 -2.1300 14.9430 -2.3220 CA 4 TRP -0.197200 + 70 HZ3 -2.7990 15.1900 -3.1340 HA 4 TRP 0.144700 + 71 CE3 -1.5630 13.6640 -2.3610 CA 4 TRP -0.238700 + 72 HE3 -1.8520 12.9920 -3.1560 HA 4 TRP 0.170000 + 73 CD2 -0.5560 13.3080 -1.4500 CB 4 TRP 0.124300 + 74 C -1.0960 8.8680 -2.8250 C 4 TRP 0.597300 + 75 O -1.9990 8.8000 -3.6560 O 4 TRP -0.567900 + 76 N -0.0670 8.0190 -2.7700 N 5 GLU -0.516300 + 77 H 0.4970 8.2320 -1.9590 H 5 GLU 0.293600 + 78 CA 0.0600 6.7790 -3.5090 CT 5 GLU 0.039700 + 79 HA -0.8150 6.7010 -4.1550 H1 5 GLU 0.110500 + 80 CB 1.3250 6.9460 -4.3460 CT 5 GLU 0.056000 + 81 HB2 2.1200 7.1130 -3.6190 HC 5 GLU -0.017300 + 82 HB3 1.2900 7.9260 -4.8230 HC 5 GLU -0.017300 + 83 CG 1.6200 5.6970 -5.1710 CT 5 GLU 0.013600 + 84 HG2 1.4980 4.7510 -4.6440 HC 5 GLU -0.042500 + 85 HG3 2.6830 5.7840 -5.3990 HC 5 GLU -0.042500 + 86 CD 0.8160 5.6470 -6.4620 C 5 GLU 0.805400 + 87 OE1 1.0220 6.3280 -7.4890 O2 5 GLU -0.818800 + 88 OE2 -0.1350 4.8350 -6.4720 O2 5 GLU -0.818800 + 89 C -0.0360 5.7160 -2.4240 C 5 GLU 0.536600 + 90 O 0.8510 5.2760 -1.6960 O 5 GLU -0.581900 + 91 N -1.2680 5.2040 -2.3750 N 6 ASN -0.415700 + 92 H -1.9860 5.5020 -3.0190 H 6 ASN 0.271900 + 93 CA -1.6160 4.0240 -1.6100 CT 6 ASN 0.014300 + 94 HA -1.1720 4.0370 -0.6140 H1 6 ASN 0.104800 + 95 CB -3.1320 4.0310 -1.4320 CT 6 ASN -0.204100 + 96 HB2 -3.4970 4.0470 -2.4580 HC 6 ASN 0.079700 + 97 HB3 -3.5210 4.9820 -1.0660 HC 6 ASN 0.079700 + 98 CG -3.7000 2.8730 -0.6250 C 6 ASN 0.713000 + 99 OD1 -4.2670 1.9110 -1.1390 O 6 ASN -0.593100 + 100 ND2 -3.4840 2.7780 0.6890 N 6 ASN -0.919100 + 101 HD21 -3.1550 3.5520 1.2480 H 6 ASN 0.419600 + 102 HD22 -3.8070 1.9470 1.1630 H 6 ASN 0.419600 + 103 C -1.1640 2.7860 -2.3720 C 6 ASN 0.597300 + 104 O -1.8380 2.2400 -3.2430 O 6 ASN -0.567900 + 105 N -0.1320 2.1570 -1.8050 N 7 GLY -0.415700 + 106 H 0.1600 2.6730 -0.9880 H 7 GLY 0.271900 + 107 CA 0.5120 0.9240 -2.2110 CT 7 GLY -0.025200 + 108 HA2 1.5560 1.0230 -1.9130 H1 7 GLY 0.069800 + 109 HA3 0.4250 0.7590 -3.2840 H1 7 GLY 0.069800 + 110 C -0.0830 -0.2610 -1.4630 C 7 GLY 0.597300 + 111 O -0.0740 -0.3160 -0.2350 O 7 GLY -0.567900 + 112 N -0.7670 -1.2020 -2.1170 N 8 LYS -0.347900 + 113 H -0.8010 -1.0940 -3.1200 H 8 LYS 0.274700 + 114 CA -1.3410 -2.4090 -1.5570 CT 8 LYS -0.240000 + 115 HA -1.7590 -2.2360 -0.5650 H1 8 LYS 0.142600 + 116 CB -2.4810 -2.9270 -2.4290 CT 8 LYS -0.009400 + 117 HB2 -3.3330 -2.2590 -2.2990 HC 8 LYS 0.036200 + 118 HB3 -2.8280 -3.8330 -1.9330 HC 8 LYS 0.036200 + 119 CG -2.1600 -2.8460 -3.9190 CT 8 LYS 0.018700 + 120 HG2 -1.2040 -3.3500 -4.0600 HC 8 LYS 0.010300 + 121 HG3 -2.0540 -1.8430 -4.3320 HC 8 LYS 0.010300 + 122 CD -3.2090 -3.6110 -4.7200 CT 8 LYS -0.047900 + 123 HD2 -3.0030 -3.4430 -5.7770 HC 8 LYS 0.062100 + 124 HD3 -4.1550 -3.1600 -4.4220 HC 8 LYS 0.062100 + 125 CE -3.0090 -5.0880 -4.3900 CT 8 LYS -0.014300 + 126 HE2 -3.0800 -5.2280 -3.3110 HP 8 LYS 0.113500 + 127 HE3 -2.0430 -5.3750 -4.8050 HP 8 LYS 0.113500 + 128 NZ -4.0800 -5.8820 -5.0100 N3 8 LYS -0.385400 + 129 HZ1 -5.0060 -5.6560 -4.6770 H 8 LYS 0.340000 + 130 HZ2 -4.0590 -5.8450 -6.0190 H 8 LYS 0.340000 + 131 HZ3 -3.8690 -6.8220 -4.7060 H 8 LYS 0.340000 + 132 C -0.2920 -3.4830 -1.3050 C 8 LYS 0.734100 + 133 O 0.2280 -4.0620 -2.2560 O 8 LYS -0.589400 + 134 N -0.0200 -3.8230 -0.0430 N 9 TRP -0.415700 + 135 H -0.2850 -3.2090 0.7140 H 9 TRP 0.271900 + 136 CA 0.8560 -4.9230 0.3080 CT 9 TRP -0.027500 + 137 HA 1.8370 -4.9390 -0.1660 H1 9 TRP 0.112300 + 138 CB 1.1430 -4.7920 1.8010 CT 9 TRP -0.005000 + 139 HB2 0.2210 -5.0000 2.3450 HC 9 TRP 0.033900 + 140 HB3 1.3580 -3.7590 2.0720 HC 9 TRP 0.033900 + 141 CG 2.0830 -5.7030 2.5230 C* 9 TRP -0.141500 + 142 CD1 1.8320 -7.0090 2.7650 CW 9 TRP -0.163800 + 143 HD1 0.9460 -7.5960 2.5700 H4 9 TRP 0.206200 + 144 NE1 2.8900 -7.5900 3.4350 NA 9 TRP -0.341800 + 145 HE1 2.8550 -8.5930 3.5500 H 9 TRP 0.341200 + 146 CE2 3.9510 -6.7180 3.5670 CN 9 TRP 0.138000 + 147 CZ2 5.1960 -6.8260 4.1990 CA 9 TRP -0.260100 + 148 HZ2 5.3980 -7.7270 4.7600 HA 9 TRP 0.157200 + 149 CH2 6.0340 -5.7080 4.2780 CA 9 TRP -0.113400 + 150 HH2 6.9090 -5.7020 4.9110 HA 9 TRP 0.141700 + 151 CZ3 5.5880 -4.5250 3.6760 CA 9 TRP -0.197200 + 152 HZ3 6.2870 -3.7020 3.6470 HA 9 TRP 0.144700 + 153 CE3 4.3470 -4.4410 3.0330 CA 9 TRP -0.238700 + 154 HE3 4.0750 -3.5250 2.5290 HA 9 TRP 0.170000 + 155 CD2 3.4310 -5.5050 3.0460 CB 9 TRP 0.124300 + 156 C 0.1650 -6.2320 -0.0470 C 9 TRP 0.597300 + 157 O -1.0370 -6.3080 0.2010 O 9 TRP -0.567900 + 158 N 0.8840 -7.1300 -0.7240 N 10 THR -0.415700 + 159 H 1.8070 -6.8430 -1.0180 H 10 THR 0.271900 + 160 CA 0.3460 -8.3310 -1.3280 CT 10 THR -0.038900 + 161 HA -0.6100 -8.5160 -0.8390 H1 10 THR 0.100700 + 162 CB 0.2750 -8.1170 -2.8380 CT 10 THR 0.365400 + 163 HB 1.2160 -7.8660 -3.3270 H1 10 THR 0.004300 + 164 CG2 -0.3610 -9.2840 -3.5880 CT 10 THR -0.243800 + 165 HG21 -1.1800 -9.7360 -3.0280 HC 10 THR 0.064200 + 166 HG22 -0.8760 -9.0010 -4.5070 HC 10 THR 0.064200 + 167 HG23 0.3590 -10.0640 -3.8360 HC 10 THR 0.064200 + 168 OG1 -0.5660 -7.0260 -3.1360 OH 10 THR -0.676100 + 169 HG1 0.0210 -6.2740 -3.0250 HO 10 THR 0.410200 + 170 C 1.1620 -9.5610 -0.9570 C 10 THR 0.597300 + 171 O 2.2220 -9.7590 -1.5460 O 10 THR -0.567900 + 172 N 0.6560 -10.2540 0.0660 N 11 TRP -0.415700 + 173 H -0.2660 -10.0060 0.3960 H 11 TRP 0.271900 + 174 CA 1.1910 -11.4720 0.6400 CT 11 TRP -0.027500 + 175 HA 2.2460 -11.5670 0.3850 H1 11 TRP 0.112300 + 176 CB 1.3110 -11.2320 2.1420 CT 11 TRP -0.005000 + 177 HB2 0.2700 -11.1970 2.4630 HC 11 TRP 0.033900 + 178 HB3 1.8110 -10.2740 2.2890 HC 11 TRP 0.033900 + 179 CG 1.8950 -12.3760 2.9070 C* 11 TRP -0.141500 + 180 CD1 3.2140 -12.6300 3.0600 CW 11 TRP -0.163800 + 181 HD1 4.0570 -12.1390 2.5960 H4 11 TRP 0.206200 + 182 NE1 3.3190 -13.7390 3.8750 NA 11 TRP -0.341800 + 183 HE1 4.1730 -14.0700 4.3010 H 11 TRP 0.341200 + 184 CE2 2.0820 -14.2310 4.2400 CN 11 TRP 0.138000 + 185 CZ2 1.8030 -15.4120 4.9360 CA 11 TRP -0.260100 + 186 HZ2 2.5820 -16.0610 5.3080 HA 11 TRP 0.157200 + 187 CH2 0.4450 -15.5890 5.2290 CA 11 TRP -0.113400 + 188 HH2 0.2520 -16.4990 5.7770 HA 11 TRP 0.141700 + 189 CZ3 -0.5600 -14.8160 4.6350 CA 11 TRP -0.197200 + 190 HZ3 -1.6070 -15.0200 4.8030 HA 11 TRP 0.144700 + 191 CE3 -0.2130 -13.7550 3.7910 CA 11 TRP -0.238700 + 192 HE3 -0.9710 -13.1570 3.3070 HA 11 TRP 0.170000 + 193 CD2 1.1250 -13.3440 3.6810 CB 11 TRP 0.124300 + 194 C 0.3370 -12.6620 0.2240 C 11 TRP 0.597300 + 195 O -0.8770 -12.6190 0.4050 O 11 TRP -0.567900 + 196 N 0.9500 -13.6170 -0.4780 N 12 LYS -0.347900 + 197 H 1.9480 -13.6320 -0.3190 H 12 LYS 0.274700 + 198 CA 0.2790 -14.8140 -0.9440 CT 12 LYS -0.240000 + 199 HA -0.7510 -14.8560 -0.5900 H1 12 LYS 0.142600 + 200 CB 0.4020 -14.8590 -2.4650 CT 12 LYS -0.009400 + 201 HB2 0.2670 -15.8930 -2.7820 HC 12 LYS 0.036200 + 202 HB3 1.3850 -14.4640 -2.7190 HC 12 LYS 0.036200 + 203 CG -0.5780 -13.9090 -3.1480 CT 12 LYS 0.018700 + 204 HG2 -0.5640 -12.9260 -2.6770 HC 12 LYS 0.010300 + 205 HG3 -1.6090 -14.2340 -3.0070 HC 12 LYS 0.010300 + 206 CD -0.2670 -13.5570 -4.6000 CT 12 LYS -0.047900 + 207 HD2 -0.1010 -14.4600 -5.1870 HC 12 LYS 0.062100 + 208 HD3 0.5910 -12.8870 -4.6450 HC 12 LYS 0.062100 + 209 CE -1.3450 -12.7450 -5.3120 CT 12 LYS -0.014300 + 210 HE2 -1.4320 -11.8940 -4.6370 HP 12 LYS 0.113500 + 211 HE3 -2.2710 -13.3190 -5.3100 HP 12 LYS 0.113500 + 212 NZ -1.1100 -12.5860 -6.7560 N3 12 LYS -0.385400 + 213 HZ1 -0.9600 -13.4400 -7.2740 H 12 LYS 0.340000 + 214 HZ2 -2.0070 -12.2490 -7.0720 H 12 LYS 0.340000 + 215 HZ3 -0.3280 -11.9840 -6.9710 H 12 LYS 0.340000 + 216 C 0.8700 -15.9860 -0.1750 C 12 LYS 0.734100 + 217 O 0.1830 -16.9850 0.0320 O 12 LYS -0.589400 + 218 N 2.1620 -15.9530 0.1590 N 13 NME -0.415700 + 219 H 2.7350 -15.3410 -0.4050 H 13 NME 0.271900 + 220 CH3 2.8770 -16.8200 1.0740 CT 13 NME -0.149000 + 221 HH31 2.1070 -17.4590 1.5050 H1 13 NME 0.097600 + 222 HH32 3.5630 -17.4610 0.5190 H1 13 NME 0.097600 + 223 HH33 3.5440 -16.1940 1.6670 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** diff --git a/test/Test_Cluster_AssignRefs/rep.c1.mol2 b/test/Test_Cluster_AssignRefs/rep.c1.mol2 new file mode 100644 index 0000000000..db6b80c7a6 --- /dev/null +++ b/test/Test_Cluster_AssignRefs/rep.c1.mol2 @@ -0,0 +1,476 @@ +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N 4.4660 8.8010 1.8900 N3 1 SER 0.184900 + 2 H1 4.6250 8.6600 0.9030 H 1 SER 0.189800 + 3 H2 4.4430 9.7710 2.1740 H 1 SER 0.189800 + 4 H3 5.2700 8.4320 2.3760 H 1 SER 0.189800 + 5 CA 3.2040 8.1010 2.1790 CT 1 SER 0.056700 + 6 HA 2.7370 8.4460 3.1010 HP 1 SER 0.078200 + 7 CB 2.1990 8.4150 1.0740 CT 1 SER 0.259600 + 8 HB2 1.1670 8.4100 1.4230 H1 1 SER 0.027300 + 9 HB3 2.1700 7.6890 0.2620 H1 1 SER 0.027300 + 10 OG 2.4790 9.7080 0.5860 OH 1 SER -0.671400 + 11 HG 1.9410 9.9820 -0.1600 HO 1 SER 0.423900 + 12 C 3.4160 6.6210 2.4620 C 1 SER 0.616300 + 13 O 4.2300 5.8860 1.9060 O 1 SER -0.572200 + 14 N 2.5780 6.0860 3.3530 N 2 TRP -0.415700 + 15 H 1.9780 6.7230 3.8580 H 2 TRP 0.271900 + 16 CA 2.5130 4.6450 3.4840 CT 2 TRP -0.027500 + 17 HA 3.4840 4.1500 3.4880 H1 2 TRP 0.112300 + 18 CB 1.8690 4.4600 4.8550 CT 2 TRP -0.005000 + 19 HB2 0.9400 5.0070 5.0130 HC 2 TRP 0.033900 + 20 HB3 2.4750 4.9610 5.6110 HC 2 TRP 0.033900 + 21 CG 1.7510 3.0010 5.1600 C* 2 TRP -0.141500 + 22 CD1 2.7240 2.1190 5.4840 CW 2 TRP -0.163800 + 23 HD1 3.7340 2.4420 5.2810 H4 2 TRP 0.206200 + 24 NE1 2.2640 0.8310 5.6750 NA 2 TRP -0.341800 + 25 HE1 2.8030 0.0090 5.9060 H 2 TRP 0.341200 + 26 CE2 0.8840 0.8540 5.6690 CN 2 TRP 0.138000 + 27 CZ2 -0.0690 -0.1440 5.9010 CA 2 TRP -0.260100 + 28 HZ2 0.2710 -1.0840 6.3100 HA 2 TRP 0.157200 + 29 CH2 -1.4090 0.2110 5.6990 CA 2 TRP -0.113400 + 30 HH2 -2.1340 -0.5550 5.9290 HA 2 TRP 0.141700 + 31 CZ3 -1.7940 1.4590 5.1960 CA 2 TRP -0.197200 + 32 HZ3 -2.8090 1.7290 4.9430 HA 2 TRP 0.144700 + 33 CE3 -0.7940 2.4030 4.9370 CA 2 TRP -0.238700 + 34 HE3 -1.0040 3.3890 4.5490 HA 2 TRP 0.170000 + 35 CD2 0.5620 2.1560 5.2040 CB 2 TRP 0.124300 + 36 C 1.7250 3.9640 2.3740 C 2 TRP 0.597300 + 37 O 2.2100 3.0080 1.7730 O 2 TRP -0.567900 + 38 N 0.5780 4.5190 1.9770 N 3 THR -0.415700 + 39 H 0.3090 5.3470 2.4900 H 3 THR 0.271900 + 40 CA -0.1220 4.2560 0.7360 CT 3 THR -0.038900 + 41 HA -0.3120 3.1910 0.6070 H1 3 THR 0.100700 + 42 CB -1.4170 5.0590 0.6500 CT 3 THR 0.365400 + 43 HB -1.7310 5.2730 -0.3720 H1 3 THR 0.004300 + 44 CG2 -2.6130 4.3430 1.2690 CT 3 THR -0.243800 + 45 HG21 -2.7530 3.3680 0.8000 HC 3 THR 0.064200 + 46 HG22 -2.4860 4.0490 2.3110 HC 3 THR 0.064200 + 47 HG23 -3.5950 4.8070 1.1810 HC 3 THR 0.064200 + 48 OG1 -1.3390 6.3190 1.2790 OH 3 THR -0.676100 + 49 HG1 -1.5650 7.0260 0.6710 HO 3 THR 0.410200 + 50 C 0.7030 4.7070 -0.4610 C 3 THR 0.597300 + 51 O 0.7630 5.8760 -0.8350 O 3 THR -0.567900 + 52 N 1.3350 3.7850 -1.1910 N 4 TRP -0.415700 + 53 H 1.0980 2.8180 -1.0250 H 4 TRP 0.271900 + 54 CA 2.0190 4.0290 -2.4450 CT 4 TRP -0.027500 + 55 HA 2.3080 5.0550 -2.6720 H1 4 TRP 0.112300 + 56 CB 3.3730 3.3260 -2.4210 CT 4 TRP -0.005000 + 57 HB2 3.8530 3.3280 -3.4000 HC 4 TRP 0.033900 + 58 HB3 3.2960 2.2780 -2.1300 HC 4 TRP 0.033900 + 59 CG 4.4140 3.9860 -1.5760 C* 4 TRP -0.141500 + 60 CD1 5.0650 3.4640 -0.5110 CW 4 TRP -0.163800 + 61 HD1 4.8750 2.4910 -0.0840 H4 4 TRP 0.206200 + 62 NE1 5.8530 4.4490 0.0500 NA 4 TRP -0.341800 + 63 HE1 6.3810 4.3770 0.9080 H 4 TRP 0.341200 + 64 CE2 5.8450 5.6220 -0.6770 CN 4 TRP 0.138000 + 65 CZ2 6.5060 6.8370 -0.4620 CA 4 TRP -0.260100 + 66 HZ2 7.2610 6.9370 0.3040 HA 4 TRP 0.157200 + 67 CH2 6.3560 7.7430 -1.5190 CA 4 TRP -0.113400 + 68 HH2 6.8730 8.6890 -1.4500 HA 4 TRP 0.141700 + 69 CZ3 5.3870 7.5360 -2.5080 CA 4 TRP -0.197200 + 70 HZ3 5.2070 8.3130 -3.2370 HA 4 TRP 0.144700 + 71 CE3 4.6370 6.3620 -2.6450 CA 4 TRP -0.238700 + 72 HE3 3.8860 6.3140 -3.4190 HA 4 TRP 0.170000 + 73 CD2 4.9260 5.3440 -1.7220 CB 4 TRP 0.124300 + 74 C 1.2120 3.7380 -3.7020 C 4 TRP 0.597300 + 75 O 1.3970 4.4290 -4.7010 O 4 TRP -0.567900 + 76 N 0.3370 2.7290 -3.7030 N 5 GLU -0.516300 + 77 H 0.3200 2.2370 -2.8210 H 5 GLU 0.293600 + 78 CA -0.6890 2.5260 -4.7050 CT 5 GLU 0.039700 + 79 HA -0.7680 3.2880 -5.4810 H1 5 GLU 0.110500 + 80 CB -0.4660 1.2140 -5.4530 CT 5 GLU 0.056000 + 81 HB2 -0.5670 0.3720 -4.7690 HC 5 GLU -0.017300 + 82 HB3 0.5610 1.2410 -5.8170 HC 5 GLU -0.017300 + 83 CG -1.3540 0.9950 -6.6750 CT 5 GLU 0.013600 + 84 HG2 -1.3740 1.8890 -7.3000 HC 5 GLU -0.042500 + 85 HG3 -2.3990 0.8270 -6.4180 HC 5 GLU -0.042500 + 86 CD -0.8860 -0.2020 -7.4900 C 5 GLU 0.805400 + 87 OE1 -0.3230 0.0470 -8.5780 O2 5 GLU -0.818800 + 88 OE2 -1.1820 -1.3860 -7.2210 O2 5 GLU -0.818800 + 89 C -2.0370 2.5730 -4.0010 C 5 GLU 0.536600 + 90 O -2.2720 1.7950 -3.0790 O 5 GLU -0.581900 + 91 N -2.9390 3.4990 -4.3370 N 6 ASN -0.415700 + 92 H -2.6310 4.0840 -5.1000 H 6 ASN 0.271900 + 93 CA -4.1510 3.8240 -3.6130 CT 6 ASN 0.014300 + 94 HA -4.0930 3.5760 -2.5530 H1 6 ASN 0.104800 + 95 CB -4.2820 5.3410 -3.7090 CT 6 ASN -0.204100 + 96 HB2 -4.1080 5.7460 -4.7050 HC 6 ASN 0.079700 + 97 HB3 -3.4210 5.7640 -3.1910 HC 6 ASN 0.079700 + 98 CG -5.4800 6.0090 -3.0480 C 6 ASN 0.713000 + 99 OD1 -6.2750 6.7910 -3.5650 O 6 ASN -0.593100 + 100 ND2 -5.8290 5.5710 -1.8360 N 6 ASN -0.919100 + 101 HD21 -5.0850 5.0760 -1.3650 H 6 ASN 0.419600 + 102 HD22 -6.5850 6.0770 -1.3980 H 6 ASN 0.419600 + 103 C -5.4020 3.1350 -4.1400 C 6 ASN 0.597300 + 104 O -5.8990 3.5230 -5.1940 O 6 ASN -0.567900 + 105 N -5.8410 2.1610 -3.3390 N 7 GLY -0.415700 + 106 H -5.4270 2.0090 -2.4300 H 7 GLY 0.271900 + 107 CA -7.2180 1.7460 -3.5160 CT 7 GLY -0.025200 + 108 HA2 -7.6260 1.8440 -4.5220 H1 7 GLY 0.069800 + 109 HA3 -7.8840 2.3810 -2.9320 H1 7 GLY 0.069800 + 110 C -7.4960 0.3350 -3.0180 C 7 GLY 0.597300 + 111 O -8.4700 0.1330 -2.2960 O 7 GLY -0.567900 + 112 N -6.7580 -0.7110 -3.3960 N 8 LYS -0.347900 + 113 H -6.0100 -0.4910 -4.0390 H 8 LYS 0.274700 + 114 CA -6.7760 -1.9160 -2.5920 CT 8 LYS -0.240000 + 115 HA -7.3320 -1.8000 -1.6610 H1 8 LYS 0.142600 + 116 CB -7.3460 -3.0990 -3.3680 CT 8 LYS -0.009400 + 117 HB2 -7.3800 -3.9040 -2.6340 HC 8 LYS 0.036200 + 118 HB3 -6.5730 -3.4890 -4.0300 HC 8 LYS 0.036200 + 119 CG -8.6890 -3.0210 -4.0890 CT 8 LYS 0.018700 + 120 HG2 -8.8180 -1.9880 -4.4130 HC 8 LYS 0.010300 + 121 HG3 -9.5180 -3.2420 -3.4170 HC 8 LYS 0.010300 + 122 CD -8.7980 -3.9240 -5.3140 CT 8 LYS -0.047900 + 123 HD2 -9.7980 -3.7440 -5.7090 HC 8 LYS 0.062100 + 124 HD3 -8.7300 -4.9540 -4.9630 HC 8 LYS 0.062100 + 125 CE -7.7990 -3.6760 -6.4410 CT 8 LYS -0.014300 + 126 HE2 -6.8900 -4.1350 -6.0540 HP 8 LYS 0.113500 + 127 HE3 -7.5840 -2.6090 -6.4870 HP 8 LYS 0.113500 + 128 NZ -8.2320 -4.2560 -7.7220 N3 8 LYS -0.385400 + 129 HZ1 -7.4650 -4.3100 -8.3770 H 8 LYS 0.340000 + 130 HZ2 -8.5850 -5.1930 -7.5910 H 8 LYS 0.340000 + 131 HZ3 -8.9800 -3.7150 -8.1330 H 8 LYS 0.340000 + 132 C -5.3840 -2.2310 -2.0610 C 8 LYS 0.734100 + 133 O -4.6200 -3.0590 -2.5510 O 8 LYS -0.589400 + 134 N -4.9460 -1.4820 -1.0460 N 9 TRP -0.415700 + 135 H -5.6090 -0.8800 -0.5790 H 9 TRP 0.271900 + 136 CA -3.6490 -1.5680 -0.4060 CT 9 TRP -0.027500 + 137 HA -2.9430 -1.9060 -1.1650 H1 9 TRP 0.112300 + 138 CB -3.2110 -0.2220 0.1650 CT 9 TRP -0.005000 + 139 HB2 -3.7510 0.1650 1.0290 HC 9 TRP 0.033900 + 140 HB3 -3.3370 0.5080 -0.6350 HC 9 TRP 0.033900 + 141 CG -1.8000 -0.0390 0.6240 C* 9 TRP -0.141500 + 142 CD1 -1.3600 0.1390 1.8910 CW 9 TRP -0.163800 + 143 HD1 -2.0580 0.2350 2.7100 H4 9 TRP 0.206200 + 144 NE1 0.0150 0.2560 1.9450 NA 9 TRP -0.341800 + 145 HE1 0.5980 0.2830 2.7690 H 9 TRP 0.341200 + 146 CE2 0.5170 0.1070 0.6680 CN 9 TRP 0.138000 + 147 CZ2 1.8030 -0.2170 0.2220 CA 9 TRP -0.260100 + 148 HZ2 2.6460 -0.1840 0.8960 HA 9 TRP 0.157200 + 149 CH2 2.0910 -0.4240 -1.1330 CA 9 TRP -0.113400 + 150 HH2 3.0680 -0.6020 -1.5580 HA 9 TRP 0.141700 + 151 CZ3 1.0150 -0.4360 -2.0280 CA 9 TRP -0.197200 + 152 HZ3 1.0650 -0.6640 -3.0820 HA 9 TRP 0.144700 + 153 CE3 -0.2950 -0.3490 -1.5400 CA 9 TRP -0.238700 + 154 HE3 -1.1130 -0.4940 -2.2300 HA 9 TRP 0.170000 + 155 CD2 -0.5940 -0.0790 -0.1950 CB 9 TRP 0.124300 + 156 C -3.5260 -2.6610 0.6460 C 9 TRP 0.597300 + 157 O -4.2080 -2.4600 1.6490 O 9 TRP -0.567900 + 158 N -2.7250 -3.7160 0.4820 N 10 THR -0.415700 + 159 H -2.1350 -3.9020 -0.3170 H 10 THR 0.271900 + 160 CA -2.5140 -4.6360 1.5810 CT 10 THR -0.038900 + 161 HA -2.8850 -4.1410 2.4780 H1 10 THR 0.100700 + 162 CB -3.2090 -5.9800 1.3780 CT 10 THR 0.365400 + 163 HB -2.5580 -6.5610 0.7250 H1 10 THR 0.004300 + 164 CG2 -3.3850 -6.8010 2.6520 CT 10 THR -0.243800 + 165 HG21 -2.3810 -6.8850 3.0670 HC 10 THR 0.064200 + 166 HG22 -4.0000 -6.2360 3.3520 HC 10 THR 0.064200 + 167 HG23 -3.8530 -7.7650 2.4490 HC 10 THR 0.064200 + 168 OG1 -4.5030 -5.7820 0.8560 OH 10 THR -0.676100 + 169 HG1 -4.4140 -5.9670 -0.0820 HO 10 THR 0.410200 + 170 C -1.0250 -4.8980 1.7510 C 10 THR 0.597300 + 171 O -0.4330 -5.5470 0.8910 O 10 THR -0.567900 + 172 N -0.4970 -4.4110 2.8760 N 11 TRP -0.415700 + 173 H -1.0890 -3.8420 3.4650 H 11 TRP 0.271900 + 174 CA 0.8540 -4.5590 3.3770 CT 11 TRP -0.027500 + 175 HA 1.4710 -4.8400 2.5230 H1 11 TRP 0.112300 + 176 CB 1.4200 -3.2160 3.8330 CT 11 TRP -0.005000 + 177 HB2 0.8900 -2.9050 4.7330 HC 11 TRP 0.033900 + 178 HB3 1.2170 -2.4440 3.0900 HC 11 TRP 0.033900 + 179 CG 2.9030 -3.2940 3.9990 C* 11 TRP -0.141500 + 180 CD1 3.8410 -3.3710 3.0280 CW 11 TRP -0.163800 + 181 HD1 3.5890 -3.2880 1.9810 H4 11 TRP 0.206200 + 182 NE1 5.1230 -3.2630 3.5300 NA 11 TRP -0.341800 + 183 HE1 5.9330 -3.1990 2.9310 H 11 TRP 0.341200 + 184 CE2 5.0340 -3.1180 4.9000 CN 11 TRP 0.138000 + 185 CZ2 5.9580 -2.9380 5.9360 CA 11 TRP -0.260100 + 186 HZ2 6.9960 -2.8640 5.6490 HA 11 TRP 0.157200 + 187 CH2 5.5920 -2.9750 7.2870 CA 11 TRP -0.113400 + 188 HH2 6.3030 -2.8560 8.0910 HA 11 TRP 0.141700 + 189 CZ3 4.2380 -3.1870 7.5710 CA 11 TRP -0.197200 + 190 HZ3 3.9050 -3.1250 8.5970 HA 11 TRP 0.144700 + 191 CE3 3.2520 -3.2960 6.5840 CA 11 TRP -0.238700 + 192 HE3 2.2210 -3.5630 6.7640 HA 11 TRP 0.170000 + 193 CD2 3.6600 -3.2020 5.2430 CB 11 TRP 0.124300 + 194 C 1.0690 -5.7390 4.3130 C 11 TRP 0.597300 + 195 O 0.2060 -6.1720 5.0740 O 11 TRP -0.567900 + 196 N 2.2860 -6.2600 4.1370 N 12 LYS -0.347900 + 197 H 2.8040 -5.9740 3.3190 H 12 LYS 0.274700 + 198 CA 2.6640 -7.5870 4.5800 CT 12 LYS -0.240000 + 199 HA 1.8450 -8.2380 4.8870 H1 12 LYS 0.142600 + 200 CB 3.3260 -8.3710 3.4510 CT 12 LYS -0.009400 + 201 HB2 3.7370 -9.3090 3.8250 HC 12 LYS 0.036200 + 202 HB3 4.1770 -7.8600 3.0000 HC 12 LYS 0.036200 + 203 CG 2.3520 -8.7420 2.3370 CT 12 LYS 0.018700 + 204 HG2 1.9420 -7.8550 1.8530 HC 12 LYS 0.010300 + 205 HG3 1.6000 -9.3930 2.7820 HC 12 LYS 0.010300 + 206 CD 2.9880 -9.4270 1.1300 CT 12 LYS -0.047900 + 207 HD2 3.5610 -10.2580 1.5390 HC 12 LYS 0.062100 + 208 HD3 3.7070 -8.7520 0.6660 HC 12 LYS 0.062100 + 209 CE 1.8420 -9.7750 0.1840 CT 12 LYS -0.014300 + 210 HE2 1.2930 -8.8880 -0.1330 HP 12 LYS 0.113500 + 211 HE3 1.1780 -10.4020 0.7770 HP 12 LYS 0.113500 + 212 NZ 2.3420 -10.5060 -0.9900 N3 12 LYS -0.385400 + 213 HZ1 1.5910 -10.9180 -1.5250 H 12 LYS 0.340000 + 214 HZ2 2.8560 -9.8710 -1.5840 H 12 LYS 0.340000 + 215 HZ3 2.9500 -11.1870 -0.5580 H 12 LYS 0.340000 + 216 C 3.6240 -7.5520 5.7600 C 12 LYS 0.734100 + 217 O 3.2280 -7.6610 6.9190 O 12 LYS -0.589400 + 218 N 4.8650 -7.1570 5.4680 N 13 NME -0.415700 + 219 H 5.0840 -6.9390 4.5060 H 13 NME 0.271900 + 220 CH3 5.8420 -6.6940 6.4310 CT 13 NME -0.149000 + 221 HH31 6.5130 -7.4980 6.7320 H1 13 NME 0.097600 + 222 HH32 6.4650 -5.9170 5.9880 H1 13 NME 0.097600 + 223 HH33 5.3300 -6.2820 7.3010 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** diff --git a/test/Test_Cluster_AssignRefs/rep.c2.mol2 b/test/Test_Cluster_AssignRefs/rep.c2.mol2 new file mode 100644 index 0000000000..bb5097a216 --- /dev/null +++ b/test/Test_Cluster_AssignRefs/rep.c2.mol2 @@ -0,0 +1,476 @@ +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N 2.5680 12.3590 0.0930 N3 1 SER 0.184900 + 2 H1 2.4520 12.6480 1.0530 H 1 SER 0.189800 + 3 H2 3.4390 11.8470 0.1050 H 1 SER 0.189800 + 4 H3 2.4940 13.1000 -0.5900 H 1 SER 0.189800 + 5 CA 1.4740 11.4380 -0.2520 CT 1 SER 0.056700 + 6 HA 0.5820 12.0120 -0.5030 HP 1 SER 0.078200 + 7 CB 1.7870 10.6040 -1.4910 CT 1 SER 0.259600 + 8 HB2 1.0770 9.8150 -1.7390 H1 1 SER 0.027300 + 9 HB3 2.7160 10.0330 -1.5030 H1 1 SER 0.027300 + 10 OG 1.8050 11.5120 -2.5700 OH 1 SER -0.671400 + 11 HG 1.2410 11.1920 -3.2780 HO 1 SER 0.423900 + 12 C 1.1340 10.4410 0.8460 C 1 SER 0.616300 + 13 O 1.9210 9.5780 1.2290 O 1 SER -0.572200 + 14 N -0.1100 10.5190 1.3250 N 2 TRP -0.415700 + 15 H -0.7350 11.2130 0.9400 H 2 TRP 0.271900 + 16 CA -0.6210 9.6270 2.3460 CT 2 TRP -0.027500 + 17 HA 0.0680 9.6450 3.1910 H1 2 TRP 0.112300 + 18 CB -1.9560 10.1840 2.8310 CT 2 TRP -0.005000 + 19 HB2 -2.6630 10.2240 2.0020 HC 2 TRP 0.033900 + 20 HB3 -1.7570 11.1740 3.2440 HC 2 TRP 0.033900 + 21 CG -2.6340 9.3750 3.8900 C* 2 TRP -0.141500 + 22 CD1 -2.1450 8.5630 4.8540 CW 2 TRP -0.163800 + 23 HD1 -1.0930 8.3340 4.9420 H4 2 TRP 0.206200 + 24 NE1 -3.1320 8.0540 5.6750 NA 2 TRP -0.341800 + 25 HE1 -2.8540 7.5250 6.4890 H 2 TRP 0.341200 + 26 CE2 -4.3440 8.5330 5.2200 CN 2 TRP 0.138000 + 27 CZ2 -5.6430 8.3300 5.7010 CA 2 TRP -0.260100 + 28 HZ2 -5.7890 7.7550 6.6040 HA 2 TRP 0.157200 + 29 CH2 -6.7130 9.0640 5.1760 CA 2 TRP -0.113400 + 30 HH2 -7.7210 8.8180 5.4770 HA 2 TRP 0.141700 + 31 CZ3 -6.4910 9.9980 4.1570 CA 2 TRP -0.197200 + 32 HZ3 -7.3930 10.4420 3.7620 HA 2 TRP 0.144700 + 33 CE3 -5.2020 10.0560 3.6140 CA 2 TRP -0.238700 + 34 HE3 -5.1840 10.4400 2.6050 HA 2 TRP 0.170000 + 35 CD2 -4.0720 9.4070 4.1360 CB 2 TRP 0.124300 + 36 C -0.7150 8.1530 1.9820 C 2 TRP 0.597300 + 37 O -0.2180 7.2160 2.6030 O 2 TRP -0.567900 + 38 N -1.2340 7.9240 0.7730 N 3 THR -0.415700 + 39 H -1.5800 8.6950 0.2190 H 3 THR 0.271900 + 40 CA -1.3990 6.6510 0.1020 CT 3 THR -0.038900 + 41 HA -0.9170 5.8440 0.6530 H1 3 THR 0.100700 + 42 CB -2.8700 6.2770 -0.0560 CT 3 THR 0.365400 + 43 HB -3.0300 5.4690 -0.7700 H1 3 THR 0.004300 + 44 CG2 -3.5410 5.8570 1.2480 CT 3 THR -0.243800 + 45 HG21 -3.8090 6.7030 1.8800 HC 3 THR 0.064200 + 46 HG22 -4.4430 5.2690 1.0770 HC 3 THR 0.064200 + 47 HG23 -2.7990 5.3080 1.8280 HC 3 THR 0.064200 + 48 OG1 -3.6900 7.3330 -0.5060 OH 3 THR -0.676100 + 49 HG1 -3.2660 7.8240 -1.2130 HO 3 THR 0.410200 + 50 C -0.6630 6.6690 -1.2300 C 3 THR 0.597300 + 51 O -1.2490 7.0580 -2.2380 O 3 THR -0.567900 + 52 N 0.5790 6.1830 -1.1700 N 4 TRP -0.415700 + 53 H 0.9870 5.9260 -0.2820 H 4 TRP 0.271900 + 54 CA 1.3900 5.9670 -2.3510 CT 4 TRP -0.027500 + 55 HA 1.2890 6.8610 -2.9660 H1 4 TRP 0.112300 + 56 CB 2.8500 5.7490 -1.9670 CT 4 TRP -0.005000 + 57 HB2 2.9260 4.8660 -1.3310 HC 4 TRP 0.033900 + 58 HB3 3.2520 6.6210 -1.4510 HC 4 TRP 0.033900 + 59 CG 3.6850 5.4910 -3.1800 C* 4 TRP -0.141500 + 60 CD1 4.0950 6.5170 -3.9590 CW 4 TRP -0.163800 + 61 HD1 3.9800 7.5810 -3.8150 H4 4 TRP 0.206200 + 62 NE1 4.9450 6.0410 -4.9390 NA 4 TRP -0.341800 + 63 HE1 5.2850 6.6710 -5.6510 H 4 TRP 0.341200 + 64 CE2 4.9670 4.6610 -4.9620 CN 4 TRP 0.138000 + 65 CZ2 5.4360 3.6970 -5.8630 CA 4 TRP -0.260100 + 66 HZ2 5.9280 3.9440 -6.7920 HA 4 TRP 0.157200 + 67 CH2 5.2070 2.3460 -5.5760 CA 4 TRP -0.113400 + 68 HH2 5.4960 1.6060 -6.3090 HA 4 TRP 0.141700 + 69 CZ3 4.6420 1.9950 -4.3450 CA 4 TRP -0.197200 + 70 HZ3 4.3290 0.9730 -4.1840 HA 4 TRP 0.144700 + 71 CE3 4.1900 2.9490 -3.4250 CA 4 TRP -0.238700 + 72 HE3 3.6870 2.5960 -2.5370 HA 4 TRP 0.170000 + 73 CD2 4.3250 4.3090 -3.7460 CB 4 TRP 0.124300 + 74 C 0.9310 4.8060 -3.2220 C 4 TRP 0.597300 + 75 O 0.9250 4.9430 -4.4440 O 4 TRP -0.567900 + 76 N 0.6050 3.7060 -2.5400 N 5 GLU -0.516300 + 77 H 0.7070 3.7410 -1.5360 H 5 GLU 0.293600 + 78 CA -0.3310 2.7250 -3.0490 CT 5 GLU 0.039700 + 79 HA -0.3320 2.9730 -4.1110 H1 5 GLU 0.110500 + 80 CB 0.2620 1.3700 -2.6720 CT 5 GLU 0.056000 + 81 HB2 -0.2040 1.0320 -1.7470 HC 5 GLU -0.017300 + 82 HB3 1.3510 1.3380 -2.6300 HC 5 GLU -0.017300 + 83 CG -0.1270 0.3600 -3.7480 CT 5 GLU 0.013600 + 84 HG2 0.2170 0.8280 -4.6700 HC 5 GLU -0.042500 + 85 HG3 -1.2030 0.2020 -3.8110 HC 5 GLU -0.042500 + 86 CD 0.4760 -1.0240 -3.5570 C 5 GLU 0.805400 + 87 OE1 1.6160 -1.1670 -4.0500 O2 5 GLU -0.818800 + 88 OE2 -0.1930 -1.8730 -2.9290 O2 5 GLU -0.818800 + 89 C -1.7420 2.9050 -2.5070 C 5 GLU 0.536600 + 90 O -1.9210 3.0310 -1.2980 O 5 GLU -0.581900 + 91 N -2.6790 3.1430 -3.4280 N 6 ASN -0.415700 + 92 H -2.5920 2.8810 -4.3990 H 6 ASN 0.271900 + 93 CA -4.0650 3.4410 -3.1260 CT 6 ASN 0.014300 + 94 HA -3.9240 4.1410 -2.3030 H1 6 ASN 0.104800 + 95 CB -4.6650 4.2250 -4.2900 CT 6 ASN -0.204100 + 96 HB2 -5.3610 3.5720 -4.8190 HC 6 ASN 0.079700 + 97 HB3 -3.8970 4.6230 -4.9520 HC 6 ASN 0.079700 + 98 CG -5.4840 5.4210 -3.8260 C 6 ASN 0.713000 + 99 OD1 -6.2700 5.3410 -2.8850 O 6 ASN -0.593100 + 100 ND2 -5.3640 6.6030 -4.4350 N 6 ASN -0.919100 + 101 HD21 -4.7420 6.7100 -5.2240 H 6 ASN 0.419600 + 102 HD22 -5.7640 7.4310 -4.0170 H 6 ASN 0.419600 + 103 C -4.7510 2.2190 -2.5330 C 6 ASN 0.597300 + 104 O -4.3910 1.0670 -2.7640 O 6 ASN -0.567900 + 105 N -5.7230 2.5060 -1.6640 N 7 GLY -0.415700 + 106 H -5.8760 3.4590 -1.3680 H 7 GLY 0.271900 + 107 CA -6.5190 1.4880 -1.0070 CT 7 GLY -0.025200 + 108 HA2 -7.0480 0.8370 -1.7030 H1 7 GLY 0.069800 + 109 HA3 -7.2680 1.9040 -0.3330 H1 7 GLY 0.069800 + 110 C -5.6480 0.5550 -0.1790 C 7 GLY 0.597300 + 111 O -4.8170 1.0730 0.5640 O 7 GLY -0.567900 + 112 N -5.7610 -0.7740 -0.2370 N 8 LYS -0.347900 + 113 H -6.5070 -1.1000 -0.8340 H 8 LYS 0.274700 + 114 CA -5.1460 -1.7160 0.6770 CT 8 LYS -0.240000 + 115 HA -5.1270 -1.3090 1.6880 H1 8 LYS 0.142600 + 116 CB -6.0850 -2.9180 0.6270 CT 8 LYS -0.009400 + 117 HB2 -5.5930 -3.7470 1.1380 HC 8 LYS 0.036200 + 118 HB3 -6.3050 -3.1020 -0.4240 HC 8 LYS 0.036200 + 119 CG -7.4230 -2.7380 1.3370 CT 8 LYS 0.018700 + 120 HG2 -7.9280 -1.9520 0.7750 HC 8 LYS 0.010300 + 121 HG3 -7.2810 -2.3880 2.3590 HC 8 LYS 0.010300 + 122 CD -8.2550 -4.0080 1.1840 CT 8 LYS -0.047900 + 123 HD2 -7.9580 -4.6940 1.9770 HC 8 LYS 0.062100 + 124 HD3 -8.0580 -4.4660 0.2150 HC 8 LYS 0.062100 + 125 CE -9.7430 -3.7230 1.3700 CT 8 LYS -0.014300 + 126 HE2 -10.0110 -3.1490 0.4830 HP 8 LYS 0.113500 + 127 HE3 -9.8560 -3.0290 2.2020 HP 8 LYS 0.113500 + 128 NZ -10.5970 -4.9150 1.4860 N3 8 LYS -0.385400 + 129 HZ1 -11.5440 -4.6690 1.2360 H 8 LYS 0.340000 + 130 HZ2 -10.1950 -5.5770 0.8390 H 8 LYS 0.340000 + 131 HZ3 -10.5230 -5.3640 2.3880 H 8 LYS 0.340000 + 132 C -3.7030 -2.1350 0.4330 C 8 LYS 0.734100 + 133 O -3.3980 -2.5010 -0.6990 O 8 LYS -0.589400 + 134 N -2.8370 -2.1440 1.4500 N 9 TRP -0.415700 + 135 H -3.2660 -1.8890 2.3280 H 9 TRP 0.271900 + 136 CA -1.4700 -2.6120 1.3410 CT 9 TRP -0.027500 + 137 HA -0.9110 -2.4110 0.4270 H1 9 TRP 0.112300 + 138 CB -0.6970 -1.8800 2.4340 CT 9 TRP -0.005000 + 139 HB2 -1.1700 -2.2050 3.3600 HC 9 TRP 0.033900 + 140 HB3 -0.7590 -0.7960 2.3390 HC 9 TRP 0.033900 + 141 CG 0.7540 -2.1150 2.7070 C* 9 TRP -0.141500 + 142 CD1 1.3100 -2.4420 3.8960 CW 9 TRP -0.163800 + 143 HD1 0.7430 -2.4140 4.8140 H4 9 TRP 0.206200 + 144 NE1 2.6710 -2.6170 3.7440 NA 9 TRP -0.341800 + 145 HE1 3.2160 -2.8110 4.5720 H 9 TRP 0.341200 + 146 CE2 3.0490 -2.2770 2.4610 CN 9 TRP 0.138000 + 147 CZ2 4.3240 -2.3840 1.8930 CA 9 TRP -0.260100 + 148 HZ2 5.2410 -2.5570 2.4360 HA 9 TRP 0.157200 + 149 CH2 4.4740 -2.0090 0.5520 CA 9 TRP -0.113400 + 150 HH2 5.5070 -1.9800 0.2390 HA 9 TRP 0.141700 + 151 CZ3 3.3440 -1.6840 -0.2070 CA 9 TRP -0.197200 + 152 HZ3 3.4230 -1.5230 -1.2720 HA 9 TRP 0.144700 + 153 CE3 2.0780 -1.7830 0.3830 CA 9 TRP -0.238700 + 154 HE3 1.2270 -1.5610 -0.2430 HA 9 TRP 0.170000 + 155 CD2 1.8470 -2.0440 1.7430 CB 9 TRP 0.124300 + 156 C -1.3820 -4.1250 1.4810 C 9 TRP 0.597300 + 157 O -1.3300 -4.6880 2.5720 O 9 TRP -0.567900 + 158 N -1.5080 -4.8160 0.3460 N 10 THR -0.415700 + 159 H -1.4630 -4.3840 -0.5660 H 10 THR 0.271900 + 160 CA -1.1440 -6.2190 0.3410 CT 10 THR -0.038900 + 161 HA -1.8110 -6.7080 1.0500 H1 10 THR 0.100700 + 162 CB -1.3370 -6.9320 -0.9940 CT 10 THR 0.365400 + 163 HB -1.0100 -7.9700 -0.9320 H1 10 THR 0.004300 + 164 CG2 -2.8370 -6.9880 -1.2690 CT 10 THR -0.243800 + 165 HG21 -3.0490 -5.9310 -1.4260 HC 10 THR 0.064200 + 166 HG22 -3.0930 -7.4340 -2.2300 HC 10 THR 0.064200 + 167 HG23 -3.2920 -7.4700 -0.4030 HC 10 THR 0.064200 + 168 OG1 -0.6650 -6.3420 -2.0850 OH 10 THR -0.676100 + 169 HG1 -1.0290 -6.7400 -2.8800 HO 10 THR 0.410200 + 170 C 0.2210 -6.5310 0.9390 C 10 THR 0.597300 + 171 O 1.2720 -6.1100 0.4610 O 10 THR -0.567900 + 172 N 0.1500 -7.2510 2.0610 N 11 TRP -0.415700 + 173 H -0.7370 -7.5370 2.4510 H 11 TRP 0.271900 + 174 CA 1.2940 -7.9120 2.6540 CT 11 TRP -0.027500 + 175 HA 1.8970 -7.0870 3.0340 H1 11 TRP 0.112300 + 176 CB 0.7440 -8.6050 3.8970 CT 11 TRP -0.005000 + 177 HB2 0.3160 -9.5760 3.6490 HC 11 TRP 0.033900 + 178 HB3 -0.0950 -8.0490 4.3160 HC 11 TRP 0.033900 + 179 CG 1.7590 -8.8560 4.9660 C* 11 TRP -0.141500 + 180 CD1 2.1020 -7.9870 5.9430 CW 11 TRP -0.163800 + 181 HD1 1.6360 -7.0200 6.0620 H4 11 TRP 0.206200 + 182 NE1 3.2700 -8.4370 6.5260 NA 11 TRP -0.341800 + 183 HE1 3.6120 -8.1090 7.4180 H 11 TRP 0.341200 + 184 CE2 3.6120 -9.6990 6.0830 CN 11 TRP 0.138000 + 185 CZ2 4.4720 -10.7340 6.4680 CA 11 TRP -0.260100 + 186 HZ2 5.1160 -10.8350 7.3300 HA 11 TRP 0.157200 + 187 CH2 4.5160 -11.9490 5.7740 CA 11 TRP -0.113400 + 188 HH2 5.2680 -12.6640 6.0730 HA 11 TRP 0.141700 + 189 CZ3 3.6270 -12.2020 4.7220 CA 11 TRP -0.197200 + 190 HZ3 3.6240 -13.0850 4.1010 HA 11 TRP 0.144700 + 191 CE3 2.7960 -11.1600 4.2940 CA 11 TRP -0.238700 + 192 HE3 2.1260 -11.4320 3.4920 HA 11 TRP 0.170000 + 193 CD2 2.7060 -9.9640 5.0230 CB 11 TRP 0.124300 + 194 C 2.2050 -8.7470 1.7660 C 11 TRP 0.597300 + 195 O 1.7170 -9.7200 1.1960 O 11 TRP -0.567900 + 196 N 3.4990 -8.4290 1.8490 N 12 LYS -0.347900 + 197 H 3.7020 -7.5930 2.3770 H 12 LYS 0.274700 + 198 CA 4.5550 -9.1850 1.2060 CT 12 LYS -0.240000 + 199 HA 4.1150 -9.8690 0.4800 H1 12 LYS 0.142600 + 200 CB 5.4900 -8.1870 0.5290 CT 12 LYS -0.009400 + 201 HB2 6.2940 -8.8110 0.1400 HC 12 LYS 0.036200 + 202 HB3 5.7640 -7.3570 1.1810 HC 12 LYS 0.036200 + 203 CG 4.7910 -7.5370 -0.6610 CT 12 LYS 0.018700 + 204 HG2 3.9210 -7.0310 -0.2420 HC 12 LYS 0.010300 + 205 HG3 4.5470 -8.3270 -1.3710 HC 12 LYS 0.010300 + 206 CD 5.6030 -6.4730 -1.3950 CT 12 LYS -0.047900 + 207 HD2 5.6910 -5.6540 -0.6820 HC 12 LYS 0.062100 + 208 HD3 4.9000 -6.1680 -2.1710 HC 12 LYS 0.062100 + 209 CE 6.9770 -6.9350 -1.8700 CT 12 LYS -0.014300 + 210 HE2 6.8710 -7.8940 -2.3760 HP 12 LYS 0.113500 + 211 HE3 7.5210 -7.2920 -0.9950 HP 12 LYS 0.113500 + 212 NZ 7.6300 -5.9360 -2.7310 N3 12 LYS -0.385400 + 213 HZ1 7.1600 -5.9920 -3.6230 H 12 LYS 0.340000 + 214 HZ2 7.7390 -5.0680 -2.2270 H 12 LYS 0.340000 + 215 HZ3 8.5080 -6.2730 -3.0990 H 12 LYS 0.340000 + 216 C 5.3320 -10.1440 2.0970 C 12 LYS 0.734100 + 217 O 5.3550 -11.2770 1.6220 O 12 LYS -0.589400 + 218 N 5.8320 -9.7320 3.2630 N 13 NME -0.415700 + 219 H 5.5630 -8.7890 3.5060 H 13 NME 0.271900 + 220 CH3 6.9330 -10.2970 4.0170 CT 13 NME -0.149000 + 221 HH31 7.7560 -9.5830 3.9870 H1 13 NME 0.097600 + 222 HH32 6.7090 -10.3500 5.0820 H1 13 NME 0.097600 + 223 HH33 7.4080 -11.1820 3.5940 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** diff --git a/test/Test_Cluster_AssignRefs/rep.c3.mol2 b/test/Test_Cluster_AssignRefs/rep.c3.mol2 new file mode 100644 index 0000000000..0671ae0863 --- /dev/null +++ b/test/Test_Cluster_AssignRefs/rep.c3.mol2 @@ -0,0 +1,476 @@ +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -1.6840 5.3290 4.3870 N3 1 SER 0.184900 + 2 H1 -1.2140 5.1190 3.5180 H 1 SER 0.189800 + 3 H2 -2.1480 4.4620 4.6130 H 1 SER 0.189800 + 4 H3 -2.3450 6.0920 4.4250 H 1 SER 0.189800 + 5 CA -0.6640 5.7090 5.3760 CT 1 SER 0.056700 + 6 HA -1.0940 6.0860 6.3040 HP 1 SER 0.078200 + 7 CB 0.1940 4.6200 6.0140 CT 1 SER 0.259600 + 8 HB2 -0.5270 4.0790 6.6260 H1 1 SER 0.027300 + 9 HB3 0.9280 5.1670 6.6050 H1 1 SER 0.027300 + 10 OG 0.7860 3.7450 5.0800 OH 1 SER -0.671400 + 11 HG 1.1870 3.0700 5.6330 HO 1 SER 0.423900 + 12 C 0.2410 6.7600 4.7490 C 1 SER 0.616300 + 13 O -0.1020 7.9360 4.8530 O 1 SER -0.572200 + 14 N 1.3630 6.4020 4.1210 N 2 TRP -0.415700 + 15 H 1.5020 5.4040 4.0570 H 2 TRP 0.271900 + 16 CA 2.2770 7.3020 3.4470 CT 2 TRP -0.027500 + 17 HA 2.3960 8.1530 4.1180 H1 2 TRP 0.112300 + 18 CB 3.6470 6.6300 3.4670 CT 2 TRP -0.005000 + 19 HB2 3.6020 5.6820 2.9300 HC 2 TRP 0.033900 + 20 HB3 3.7980 6.5070 4.5390 HC 2 TRP 0.033900 + 21 CG 4.8270 7.4200 3.0000 C* 2 TRP -0.141500 + 22 CD1 5.6790 8.1100 3.7900 CW 2 TRP -0.163800 + 23 HD1 5.7340 8.1640 4.8680 H4 2 TRP 0.206200 + 24 NE1 6.6270 8.7350 3.0040 NA 2 TRP -0.341800 + 25 HE1 7.2550 9.3650 3.4830 H 2 TRP 0.341200 + 26 CE2 6.4650 8.4780 1.6580 CN 2 TRP 0.138000 + 27 CZ2 7.0370 8.8990 0.4520 CA 2 TRP -0.260100 + 28 HZ2 7.8550 9.6030 0.4940 HA 2 TRP 0.157200 + 29 CH2 6.5430 8.4520 -0.7790 CA 2 TRP -0.113400 + 30 HH2 6.9980 8.7870 -1.7000 HA 2 TRP 0.141700 + 31 CZ3 5.4380 7.5920 -0.8070 CA 2 TRP -0.197200 + 32 HZ3 4.9510 7.4260 -1.7570 HA 2 TRP 0.144700 + 33 CE3 4.8900 7.1490 0.4020 CA 2 TRP -0.238700 + 34 HE3 4.0610 6.4560 0.3830 HA 2 TRP 0.170000 + 35 CD2 5.3410 7.6120 1.6480 CB 2 TRP 0.124300 + 36 C 1.8270 7.7200 2.0540 C 2 TRP 0.597300 + 37 O 1.9930 8.8650 1.6380 O 2 TRP -0.567900 + 38 N 1.3040 6.7680 1.2790 N 3 THR -0.415700 + 39 H 1.1020 5.9000 1.7530 H 3 THR 0.271900 + 40 CA 0.6210 7.0580 0.0340 CT 3 THR -0.038900 + 41 HA 1.2370 7.6880 -0.6070 H1 3 THR 0.100700 + 42 CB 0.3030 5.7730 -0.7260 CT 3 THR 0.365400 + 43 HB -0.3910 5.9550 -1.5470 H1 3 THR 0.004300 + 44 CG2 1.5880 5.2390 -1.3520 CT 3 THR -0.243800 + 45 HG21 1.8690 5.6600 -2.3180 HC 3 THR 0.064200 + 46 HG22 2.4010 5.2850 -0.6280 HC 3 THR 0.064200 + 47 HG23 1.4520 4.1640 -1.4680 HC 3 THR 0.064200 + 48 OG1 -0.1560 4.7220 0.0950 OH 3 THR -0.676100 + 49 HG1 -0.6950 4.1610 -0.4670 HO 3 THR 0.410200 + 50 C -0.6710 7.8200 0.2930 C 3 THR 0.597300 + 51 O -1.4410 7.5070 1.1970 O 3 THR -0.567900 + 52 N -0.9550 8.8220 -0.5430 N 4 TRP -0.415700 + 53 H -0.2990 9.0600 -1.2730 H 4 TRP 0.271900 + 54 CA -2.1610 9.6220 -0.4760 CT 4 TRP -0.027500 + 55 HA -2.6090 9.5500 0.5160 H1 4 TRP 0.112300 + 56 CB -1.8300 11.0440 -0.9170 CT 4 TRP -0.005000 + 57 HB2 -2.7620 11.5480 -0.6620 HC 4 TRP 0.033900 + 58 HB3 -1.6460 11.1210 -1.9880 HC 4 TRP 0.033900 + 59 CG -0.6290 11.6400 -0.2550 C* 4 TRP -0.141500 + 60 CD1 0.6030 11.8210 -0.7830 CW 4 TRP -0.163800 + 61 HD1 0.8570 11.6700 -1.8220 H4 4 TRP 0.206200 + 62 NE1 1.4060 12.3980 0.1810 NA 4 TRP -0.341800 + 63 HE1 2.4100 12.4870 0.1060 H 4 TRP 0.341200 + 64 CE2 0.7260 12.7100 1.3400 CN 4 TRP 0.138000 + 65 CZ2 1.0210 13.4160 2.5120 CA 4 TRP -0.260100 + 66 HZ2 1.8990 14.0310 2.6470 HA 4 TRP 0.157200 + 67 CH2 0.0210 13.4800 3.4900 CA 4 TRP -0.113400 + 68 HH2 0.3010 13.9640 4.4140 HA 4 TRP 0.141700 + 69 CZ3 -1.2070 12.8320 3.3140 CA 4 TRP -0.197200 + 70 HZ3 -1.9050 12.9090 4.1350 HA 4 TRP 0.144700 + 71 CE3 -1.5140 12.1430 2.1350 CA 4 TRP -0.238700 + 72 HE3 -2.5390 11.8100 2.2090 HA 4 TRP 0.170000 + 73 CD2 -0.5360 12.0970 1.1280 CB 4 TRP 0.124300 + 74 C -3.1640 8.9010 -1.3650 C 4 TRP 0.597300 + 75 O -4.3440 8.8640 -1.0240 O 4 TRP -0.567900 + 76 N -2.7340 8.4590 -2.5490 N 5 GLU -0.516300 + 77 H -1.8400 8.7280 -2.9340 H 5 GLU 0.293600 + 78 CA -3.4770 7.5610 -3.4100 CT 5 GLU 0.039700 + 79 HA -4.5380 7.8090 -3.3730 H1 5 GLU 0.110500 + 80 CB -3.0310 7.7150 -4.8610 CT 5 GLU 0.056000 + 81 HB2 -2.0330 7.2790 -4.9060 HC 5 GLU -0.017300 + 82 HB3 -2.9580 8.7610 -5.1600 HC 5 GLU -0.017300 + 83 CG -3.8130 6.9800 -5.9460 CT 5 GLU 0.013600 + 84 HG2 -3.9370 5.9440 -5.6330 HC 5 GLU -0.042500 + 85 HG3 -3.1640 6.9730 -6.8220 HC 5 GLU -0.042500 + 86 CD -5.1760 7.5390 -6.3280 C 5 GLU 0.805400 + 87 OE1 -5.8350 6.9500 -7.2120 O2 5 GLU -0.818800 + 88 OE2 -5.6370 8.4950 -5.6680 O2 5 GLU -0.818800 + 89 C -3.2650 6.1730 -2.8230 C 5 GLU 0.536600 + 90 O -2.1640 5.6360 -2.9200 O 5 GLU -0.581900 + 91 N -4.2990 5.5480 -2.2540 N 6 ASN -0.415700 + 92 H -5.2530 5.8760 -2.2840 H 6 ASN 0.271900 + 93 CA -4.3980 4.2440 -1.6310 CT 6 ASN 0.014300 + 94 HA -3.4340 4.1170 -1.1370 H1 6 ASN 0.104800 + 95 CB -5.5950 4.2310 -0.6850 CT 6 ASN -0.204100 + 96 HB2 -6.4620 4.4050 -1.3220 HC 6 ASN 0.079700 + 97 HB3 -5.5610 5.0730 0.0080 HC 6 ASN 0.079700 + 98 CG -5.7270 2.9230 0.0810 C 6 ASN 0.713000 + 99 OD1 -4.7700 2.4140 0.6620 O 6 ASN -0.593100 + 100 ND2 -6.9500 2.3900 0.1360 N 6 ASN -0.919100 + 101 HD21 -7.7410 2.7100 -0.4040 H 6 ASN 0.419600 + 102 HD22 -7.0720 1.6740 0.8370 H 6 ASN 0.419600 + 103 C -4.6560 3.1030 -2.6050 C 6 ASN 0.597300 + 104 O -5.7170 2.9910 -3.2150 O 6 ASN -0.567900 + 105 N -3.6480 2.3420 -3.0370 N 7 GLY -0.415700 + 106 H -2.7730 2.3360 -2.5320 H 7 GLY 0.271900 + 107 CA -3.7530 1.3080 -4.0460 CT 7 GLY -0.025200 + 108 HA2 -3.0210 1.8550 -4.6410 H1 7 GLY 0.069800 + 109 HA3 -4.7150 1.3960 -4.5510 H1 7 GLY 0.069800 + 110 C -3.5480 -0.1110 -3.5360 C 7 GLY 0.597300 + 111 O -3.9190 -0.4810 -2.4240 O 7 GLY -0.567900 + 112 N -2.8390 -0.9590 -4.2840 N 8 LYS -0.347900 + 113 H -2.3800 -0.5510 -5.0860 H 8 LYS 0.274700 + 114 CA -2.6730 -2.3860 -4.0920 CT 8 LYS -0.240000 + 115 HA -3.6090 -2.7290 -3.6530 H1 8 LYS 0.142600 + 116 CB -2.4550 -3.1670 -5.3840 CT 8 LYS -0.009400 + 117 HB2 -3.4080 -3.3420 -5.8830 HC 8 LYS 0.036200 + 118 HB3 -2.1350 -4.1730 -5.1150 HC 8 LYS 0.036200 + 119 CG -1.5030 -2.6190 -6.4440 CT 8 LYS 0.018700 + 120 HG2 -0.5180 -2.7480 -5.9970 HC 8 LYS 0.010300 + 121 HG3 -1.7180 -1.5530 -6.5060 HC 8 LYS 0.010300 + 122 CD -1.5670 -3.1530 -7.8730 CT 8 LYS -0.047900 + 123 HD2 -0.8940 -2.4790 -8.4020 HC 8 LYS 0.062100 + 124 HD3 -2.5880 -3.1150 -8.2550 HC 8 LYS 0.062100 + 125 CE -1.1260 -4.6130 -7.8590 CT 8 LYS -0.014300 + 126 HE2 -1.8090 -5.1880 -7.2340 HP 8 LYS 0.113500 + 127 HE3 -0.0860 -4.6440 -7.5320 HP 8 LYS 0.113500 + 128 NZ -1.1140 -5.0930 -9.2490 N3 8 LYS -0.385400 + 129 HZ1 -0.5390 -4.4820 -9.8120 H 8 LYS 0.340000 + 130 HZ2 -0.6490 -5.9760 -9.4080 H 8 LYS 0.340000 + 131 HZ3 -2.0510 -5.0780 -9.6250 H 8 LYS 0.340000 + 132 C -1.5990 -2.7870 -3.0900 C 8 LYS 0.734100 + 133 O -0.4090 -2.5360 -3.2640 O 8 LYS -0.589400 + 134 N -2.1030 -3.5900 -2.1500 N 9 TRP -0.415700 + 135 H -3.1110 -3.6500 -2.1980 H 9 TRP 0.271900 + 136 CA -1.3750 -4.0590 -0.9890 CT 9 TRP -0.027500 + 137 HA -0.5190 -3.3870 -0.9290 H1 9 TRP 0.112300 + 138 CB -2.2020 -3.8670 0.2790 CT 9 TRP -0.005000 + 139 HB2 -3.1330 -4.4130 0.1290 HC 9 TRP 0.033900 + 140 HB3 -2.4630 -2.8160 0.4090 HC 9 TRP 0.033900 + 141 CG -1.5770 -4.3990 1.5290 C* 9 TRP -0.141500 + 142 CD1 -2.1010 -5.3150 2.3730 CW 9 TRP -0.163800 + 143 HD1 -3.1010 -5.7060 2.2520 H4 9 TRP 0.206200 + 144 NE1 -1.2050 -5.7580 3.3260 NA 9 TRP -0.341800 + 145 HE1 -1.3650 -6.4630 4.0310 H 9 TRP 0.341200 + 146 CE2 -0.0880 -4.9530 3.2240 CN 9 TRP 0.138000 + 147 CZ2 1.0190 -4.8320 4.0730 CA 9 TRP -0.260100 + 148 HZ2 1.1340 -5.5540 4.8680 HA 9 TRP 0.157200 + 149 CH2 2.0180 -3.8800 3.8380 CA 9 TRP -0.113400 + 150 HH2 2.7550 -3.6580 4.5960 HA 9 TRP 0.141700 + 151 CZ3 1.7930 -3.0050 2.7690 CA 9 TRP -0.197200 + 152 HZ3 2.4260 -2.1290 2.7600 HA 9 TRP 0.144700 + 153 CE3 0.6510 -3.0560 1.9600 CA 9 TRP -0.238700 + 154 HE3 0.4150 -2.2160 1.3240 HA 9 TRP 0.170000 + 155 CD2 -0.2610 -4.1150 2.0930 CB 9 TRP 0.124300 + 156 C -0.8290 -5.4750 -1.1010 C 9 TRP 0.597300 + 157 O -1.5450 -6.4710 -1.0260 O 9 TRP -0.567900 + 158 N 0.4980 -5.5990 -1.1850 N 10 THR -0.415700 + 159 H 1.1250 -4.8080 -1.1410 H 10 THR 0.271900 + 160 CA 1.2450 -6.8340 -1.3030 CT 10 THR -0.038900 + 161 HA 0.6660 -7.3380 -2.0770 H1 10 THR 0.100700 + 162 CB 2.6500 -6.6980 -1.8840 CT 10 THR 0.365400 + 163 HB 3.3580 -6.4760 -1.0850 H1 10 THR 0.004300 + 164 CG2 3.1930 -7.9910 -2.4850 CT 10 THR -0.243800 + 165 HG21 3.4000 -7.8050 -3.5390 HC 10 THR 0.064200 + 166 HG22 4.0490 -8.3670 -1.9250 HC 10 THR 0.064200 + 167 HG23 2.4950 -8.8250 -2.4190 HC 10 THR 0.064200 + 168 OG1 2.8800 -5.6690 -2.8200 OH 10 THR -0.676100 + 169 HG1 2.7350 -4.8040 -2.4280 HO 10 THR 0.410200 + 170 C 1.3570 -7.6660 -0.0340 C 10 THR 0.597300 + 171 O 2.2660 -7.4790 0.7710 O 10 THR -0.567900 + 172 N 0.4450 -8.6390 0.0160 N 11 TRP -0.415700 + 173 H -0.3250 -8.6270 -0.6370 H 11 TRP 0.271900 + 174 CA 0.3690 -9.5060 1.1750 CT 11 TRP -0.027500 + 175 HA 0.2920 -8.8770 2.0620 H1 11 TRP 0.112300 + 176 CB -0.9340 -10.2910 1.0520 CT 11 TRP -0.005000 + 177 HB2 -0.8670 -10.9690 0.2010 HC 11 TRP 0.033900 + 178 HB3 -1.6860 -9.5060 0.9740 HC 11 TRP 0.033900 + 179 CG -1.1160 -11.1560 2.2570 C* 11 TRP -0.141500 + 180 CD1 -1.1670 -10.7370 3.5420 CW 11 TRP -0.163800 + 181 HD1 -0.9400 -9.7280 3.8520 H4 11 TRP 0.206200 + 182 NE1 -1.5660 -11.7360 4.4070 NA 11 TRP -0.341800 + 183 HE1 -1.7980 -11.5770 5.3770 H 11 TRP 0.341200 + 184 CE2 -1.8510 -12.9070 3.7360 CN 11 TRP 0.138000 + 185 CZ2 -2.2630 -14.1950 4.0980 CA 11 TRP -0.260100 + 186 HZ2 -2.6470 -14.2750 5.1040 HA 11 TRP 0.157200 + 187 CH2 -2.3900 -15.2080 3.1400 CA 11 TRP -0.113400 + 188 HH2 -3.0040 -16.0650 3.3740 HA 11 TRP 0.141700 + 189 CZ3 -1.9230 -14.9170 1.8530 CA 11 TRP -0.197200 + 190 HZ3 -1.9380 -15.6770 1.0850 HA 11 TRP 0.144700 + 191 CE3 -1.3970 -13.6590 1.5360 CA 11 TRP -0.238700 + 192 HE3 -0.8380 -13.5170 0.6230 HA 11 TRP 0.170000 + 193 CD2 -1.4390 -12.5700 2.4210 CB 11 TRP 0.124300 + 194 C 1.5790 -10.4030 1.3960 C 11 TRP 0.597300 + 195 O 1.7910 -11.2800 0.5620 O 11 TRP -0.567900 + 196 N 2.2520 -10.0440 2.4920 N 12 LYS -0.347900 + 197 H 2.0610 -9.1310 2.8780 H 12 LYS 0.274700 + 198 CA 3.3530 -10.8270 3.0160 CT 12 LYS -0.240000 + 199 HA 4.0220 -11.0650 2.1890 H1 12 LYS 0.142600 + 200 CB 4.1230 -9.8870 3.9380 CT 12 LYS -0.009400 + 201 HB2 4.9620 -10.4580 4.3350 HC 12 LYS 0.036200 + 202 HB3 3.5610 -9.7420 4.8610 HC 12 LYS 0.036200 + 203 CG 4.5190 -8.5310 3.3600 CT 12 LYS 0.018700 + 204 HG2 3.5650 -8.0390 3.1680 HC 12 LYS 0.010300 + 205 HG3 5.0430 -8.5780 2.4060 HC 12 LYS 0.010300 + 206 CD 5.3820 -7.8400 4.4120 CT 12 LYS -0.047900 + 207 HD2 4.9690 -8.0920 5.3890 HC 12 LYS 0.062100 + 208 HD3 5.2410 -6.7660 4.2940 HC 12 LYS 0.062100 + 209 CE 6.8360 -8.2680 4.2400 CT 12 LYS -0.014300 + 210 HE2 7.1330 -7.9280 3.2480 HP 12 LYS 0.113500 + 211 HE3 6.9600 -9.3500 4.1850 HP 12 LYS 0.113500 + 212 NZ 7.6530 -7.7100 5.3290 N3 12 LYS -0.385400 + 213 HZ1 7.8470 -6.7250 5.2140 H 12 LYS 0.340000 + 214 HZ2 7.1980 -7.7880 6.2280 H 12 LYS 0.340000 + 215 HZ3 8.5860 -8.0940 5.2880 H 12 LYS 0.340000 + 216 C 2.9220 -12.0390 3.8290 C 12 LYS 0.734100 + 217 O 3.5830 -13.0670 3.6930 O 12 LYS -0.589400 + 218 N 1.9520 -11.8410 4.7240 N 13 NME -0.415700 + 219 H 1.5230 -10.9340 4.8460 H 13 NME 0.271900 + 220 CH3 1.6920 -12.7810 5.7950 CT 13 NME -0.149000 + 221 HH31 2.6150 -12.8720 6.3670 H1 13 NME 0.097600 + 222 HH32 0.9000 -12.4860 6.4840 H1 13 NME 0.097600 + 223 HH33 1.5530 -13.7860 5.3970 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** diff --git a/test/Test_Cluster_AssignRefs/rep.c4.mol2 b/test/Test_Cluster_AssignRefs/rep.c4.mol2 new file mode 100644 index 0000000000..709e541122 --- /dev/null +++ b/test/Test_Cluster_AssignRefs/rep.c4.mol2 @@ -0,0 +1,476 @@ +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -1.8890 9.1590 7.5690 N3 1 SER 0.184900 + 2 H1 -1.0370 8.6910 7.2960 H 1 SER 0.189800 + 3 H2 -1.9000 9.2980 8.5690 H 1 SER 0.189800 + 4 H3 -2.5380 8.4470 7.2650 H 1 SER 0.189800 + 5 CA -2.0640 10.5010 6.9930 CT 1 SER 0.056700 + 6 HA -3.1000 10.8240 7.1020 HP 1 SER 0.078200 + 7 CB -1.2300 11.5610 7.7070 CT 1 SER 0.259600 + 8 HB2 -1.6700 11.8110 8.6730 H1 1 SER 0.027300 + 9 HB3 -1.2480 12.5030 7.1590 H1 1 SER 0.027300 + 10 OG 0.1230 11.2160 7.9040 OH 1 SER -0.671400 + 11 HG 0.2740 11.7280 8.7010 HO 1 SER 0.423900 + 12 C -1.6130 10.4180 5.5420 C 1 SER 0.616300 + 13 O -2.4980 10.4330 4.6890 O 1 SER -0.572200 + 14 N -0.3660 10.5720 5.0900 N 2 TRP -0.415700 + 15 H 0.3440 10.6120 5.8080 H 2 TRP 0.271900 + 16 CA 0.1950 10.6970 3.7600 CT 2 TRP -0.027500 + 17 HA -0.2180 11.5690 3.2540 H1 2 TRP 0.112300 + 18 CB 1.7100 10.8790 3.7090 CT 2 TRP -0.005000 + 19 HB2 2.2080 9.9860 4.0870 HC 2 TRP 0.033900 + 20 HB3 1.9270 11.6410 4.4580 HC 2 TRP 0.033900 + 21 CG 2.2650 11.2910 2.3840 C* 2 TRP -0.141500 + 22 CD1 2.0320 12.5000 1.8270 CW 2 TRP -0.163800 + 23 HD1 1.5380 13.3330 2.3050 H4 2 TRP 0.206200 + 24 NE1 2.8600 12.5800 0.7240 NA 2 TRP -0.341800 + 25 HE1 2.9290 13.4040 0.1430 H 2 TRP 0.341200 + 26 CE2 3.6620 11.4600 0.6460 CN 2 TRP 0.138000 + 27 CZ2 4.6200 11.1600 -0.3300 CA 2 TRP -0.260100 + 28 HZ2 5.0590 11.8630 -1.0230 HA 2 TRP 0.157200 + 29 CH2 5.0910 9.8430 -0.3770 CA 2 TRP -0.113400 + 30 HH2 5.8540 9.6100 -1.1050 HA 2 TRP 0.141700 + 31 CZ3 4.5450 8.8500 0.4450 CA 2 TRP -0.197200 + 32 HZ3 4.8230 7.8400 0.1820 HA 2 TRP 0.144700 + 33 CE3 3.5490 9.1590 1.3790 CA 2 TRP -0.238700 + 34 HE3 3.1350 8.4300 2.0590 HA 2 TRP 0.170000 + 35 CD2 3.0750 10.4770 1.4830 CB 2 TRP 0.124300 + 36 C -0.1900 9.6090 2.7680 C 2 TRP 0.597300 + 37 O -0.4520 9.9630 1.6210 O 2 TRP -0.567900 + 38 N -0.2680 8.4020 3.3340 N 3 THR -0.415700 + 39 H -0.2600 8.2750 4.3360 H 3 THR 0.271900 + 40 CA -0.6060 7.1720 2.6470 CT 3 THR -0.038900 + 41 HA -0.1800 7.2660 1.6480 H1 3 THR 0.100700 + 42 CB -0.0930 5.9920 3.4680 CT 3 THR 0.365400 + 43 HB -0.5860 5.0810 3.1280 H1 3 THR 0.004300 + 44 CG2 1.3430 5.6480 3.0810 CT 3 THR -0.243800 + 45 HG21 1.3060 5.0050 2.2020 HC 3 THR 0.064200 + 46 HG22 1.9550 6.5430 2.9670 HC 3 THR 0.064200 + 47 HG23 1.8280 5.0680 3.8660 HC 3 THR 0.064200 + 48 OG1 -0.2730 6.2460 4.8430 OH 3 THR -0.676100 + 49 HG1 0.4280 5.7500 5.2710 HO 3 THR 0.410200 + 50 C -2.0730 6.8820 2.3630 C 3 THR 0.597300 + 51 O -2.8840 6.6850 3.2650 O 3 THR -0.567900 + 52 N -2.4140 6.7960 1.0750 N 4 TRP -0.415700 + 53 H -1.6310 6.7560 0.4390 H 4 TRP 0.271900 + 54 CA -3.6890 6.2860 0.6130 CT 4 TRP -0.027500 + 55 HA -4.2880 6.0200 1.4850 H1 4 TRP 0.112300 + 56 CB -4.4650 7.2750 -0.2530 CT 4 TRP -0.005000 + 57 HB2 -5.4500 6.8210 -0.3660 HC 4 TRP 0.033900 + 58 HB3 -4.0220 7.1620 -1.2420 HC 4 TRP 0.033900 + 59 CG -4.6320 8.7230 0.0770 C* 4 TRP -0.141500 + 60 CD1 -3.9020 9.7130 -0.4830 CW 4 TRP -0.163800 + 61 HD1 -3.0890 9.5530 -1.1760 H4 4 TRP 0.206200 + 62 NE1 -4.4730 10.9230 -0.1410 NA 4 TRP -0.341800 + 63 HE1 -4.1360 11.8610 -0.3060 H 4 TRP 0.341200 + 64 CE2 -5.4690 10.7460 0.7980 CN 4 TRP 0.138000 + 65 CZ2 -6.3300 11.6930 1.3650 CA 4 TRP -0.260100 + 66 HZ2 -6.2760 12.7460 1.1300 HA 4 TRP 0.157200 + 67 CH2 -7.3740 11.1960 2.1540 CA 4 TRP -0.113400 + 68 HH2 -8.2300 11.8220 2.3620 HA 4 TRP 0.141700 + 69 CZ3 -7.6300 9.8240 2.2590 CA 4 TRP -0.197200 + 70 HZ3 -8.3790 9.4820 2.9590 HA 4 TRP 0.144700 + 71 CE3 -6.7760 8.9050 1.6380 CA 4 TRP -0.238700 + 72 HE3 -6.9740 7.8720 1.8840 HA 4 TRP 0.170000 + 73 CD2 -5.7030 9.3470 0.8480 CB 4 TRP 0.124300 + 74 C -3.6320 4.9260 -0.0680 C 4 TRP 0.597300 + 75 O -4.2790 3.9520 0.3090 O 4 TRP -0.567900 + 76 N -2.7950 4.8720 -1.1060 N 5 GLU -0.516300 + 77 H -2.2780 5.7080 -1.3390 H 5 GLU 0.293600 + 78 CA -2.5350 3.7230 -1.9500 CT 5 GLU 0.039700 + 79 HA -3.0070 2.9480 -1.3460 H1 5 GLU 0.110500 + 80 CB -3.4130 3.5240 -3.1830 CT 5 GLU 0.056000 + 81 HB2 -3.1390 4.1410 -4.0380 HC 5 GLU -0.017300 + 82 HB3 -4.3860 3.7870 -2.7670 HC 5 GLU -0.017300 + 83 CG -3.4700 2.1080 -3.7480 CT 5 GLU 0.013600 + 84 HG2 -2.4470 1.7930 -3.9530 HC 5 GLU -0.042500 + 85 HG3 -4.0390 2.4250 -4.6230 HC 5 GLU -0.042500 + 86 CD -4.1890 1.1230 -2.8370 C 5 GLU 0.805400 + 87 OE1 -3.8030 0.7710 -1.7020 O2 5 GLU -0.818800 + 88 OE2 -5.2630 0.6010 -3.2070 O2 5 GLU -0.818800 + 89 C -1.0580 3.5180 -2.2550 C 5 GLU 0.536600 + 90 O -0.3010 4.4140 -2.6190 O 5 GLU -0.581900 + 91 N -0.6680 2.2650 -2.0090 N 6 ASN -0.415700 + 92 H -1.3230 1.6560 -1.5390 H 6 ASN 0.271900 + 93 CA 0.6390 1.6960 -2.2670 CT 6 ASN 0.014300 + 94 HA 1.2390 2.4530 -2.7720 H1 6 ASN 0.104800 + 95 CB 1.4120 1.3660 -0.9930 CT 6 ASN -0.204100 + 96 HB2 2.2240 0.7030 -1.2910 HC 6 ASN 0.079700 + 97 HB3 0.7120 0.8820 -0.3110 HC 6 ASN 0.079700 + 98 CG 2.1540 2.5500 -0.3910 C 6 ASN 0.713000 + 99 OD1 2.8090 3.3470 -1.0580 O 6 ASN -0.593100 + 100 ND2 2.3590 2.5190 0.9280 N 6 ASN -0.919100 + 101 HD21 1.8690 1.8970 1.5560 H 6 ASN 0.419600 + 102 HD22 3.0240 3.1960 1.2720 H 6 ASN 0.419600 + 103 C 0.5090 0.4880 -3.1850 C 6 ASN 0.597300 + 104 O -0.4570 -0.2500 -3.0040 O 6 ASN -0.567900 + 105 N 1.4630 0.2470 -4.0870 N 7 GLY -0.415700 + 106 H 2.3720 0.6580 -3.9320 H 7 GLY 0.271900 + 107 CA 1.3990 -0.9020 -4.9670 CT 7 GLY -0.025200 + 108 HA2 2.1800 -0.8820 -5.7280 H1 7 GLY 0.069800 + 109 HA3 0.5010 -0.7990 -5.5760 H1 7 GLY 0.069800 + 110 C 1.4480 -2.2750 -4.3130 C 7 GLY 0.597300 + 111 O 0.7270 -2.5760 -3.3640 O 7 GLY -0.567900 + 112 N 2.3610 -3.1180 -4.8010 N 8 LYS -0.347900 + 113 H 3.0800 -2.7840 -5.4260 H 8 LYS 0.274700 + 114 CA 2.5410 -4.5140 -4.4580 CT 8 LYS -0.240000 + 115 HA 1.6270 -5.0150 -4.1380 H1 8 LYS 0.142600 + 116 CB 3.1230 -5.2830 -5.6410 CT 8 LYS -0.009400 + 117 HB2 2.4350 -5.2430 -6.4860 HC 8 LYS 0.036200 + 118 HB3 3.3350 -6.3180 -5.3720 HC 8 LYS 0.036200 + 119 CG 4.4160 -4.7460 -6.2480 CT 8 LYS 0.018700 + 120 HG2 5.3080 -4.9600 -5.6600 HC 8 LYS 0.010300 + 121 HG3 4.3930 -3.6740 -6.4390 HC 8 LYS 0.010300 + 122 CD 4.7260 -5.5030 -7.5360 CT 8 LYS -0.047900 + 123 HD2 3.9920 -5.2720 -8.3080 HC 8 LYS 0.062100 + 124 HD3 4.5840 -6.5430 -7.2410 HC 8 LYS 0.062100 + 125 CE 6.1480 -5.3380 -8.0660 CT 8 LYS -0.014300 + 126 HE2 6.5210 -6.2900 -8.4440 HP 8 LYS 0.113500 + 127 HE3 6.8480 -5.0250 -7.2900 HP 8 LYS 0.113500 + 128 NZ 6.1770 -4.4200 -9.2140 N3 8 LYS -0.385400 + 129 HZ1 6.0460 -3.5470 -8.7220 H 8 LYS 0.340000 + 130 HZ2 7.1310 -4.3920 -9.5460 H 8 LYS 0.340000 + 131 HZ3 5.4710 -4.5500 -9.9250 H 8 LYS 0.340000 + 132 C 3.5120 -4.5190 -3.2860 C 8 LYS 0.734100 + 133 O 4.6240 -5.0420 -3.2860 O 8 LYS -0.589400 + 134 N 2.9250 -4.2560 -2.1160 N 9 TRP -0.415700 + 135 H 2.0100 -3.8790 -2.3160 H 9 TRP 0.271900 + 136 CA 3.3410 -4.2620 -0.7280 CT 9 TRP -0.027500 + 137 HA 4.4100 -4.0450 -0.7240 H1 9 TRP 0.112300 + 138 CB 2.6250 -3.0680 -0.1040 CT 9 TRP -0.005000 + 139 HB2 1.5890 -3.2940 0.1480 HC 9 TRP 0.033900 + 140 HB3 2.8350 -2.1940 -0.7210 HC 9 TRP 0.033900 + 141 CG 3.2880 -2.4620 1.0910 C* 9 TRP -0.141500 + 142 CD1 2.9250 -2.4360 2.3930 CW 9 TRP -0.163800 + 143 HD1 1.9490 -2.7990 2.6780 H4 9 TRP 0.206200 + 144 NE1 3.8550 -1.8450 3.2240 NA 9 TRP -0.341800 + 145 HE1 3.8850 -1.8480 4.2340 H 9 TRP 0.341200 + 146 CE2 4.8270 -1.3030 2.4080 CN 9 TRP 0.138000 + 147 CZ2 5.9110 -0.4710 2.7140 CA 9 TRP -0.260100 + 148 HZ2 6.1390 -0.1560 3.7210 HA 9 TRP 0.157200 + 149 CH2 6.8410 -0.1410 1.7220 CA 9 TRP -0.113400 + 150 HH2 7.7250 0.4050 2.0180 HA 9 TRP 0.141700 + 151 CZ3 6.5840 -0.5900 0.4210 CA 9 TRP -0.197200 + 152 HZ3 7.2310 -0.2350 -0.3680 HA 9 TRP 0.144700 + 153 CE3 5.4240 -1.2970 0.0820 CA 9 TRP -0.238700 + 154 HE3 5.1390 -1.4650 -0.9460 HA 9 TRP 0.170000 + 155 CD2 4.4790 -1.6200 1.0690 CB 9 TRP 0.124300 + 156 C 2.9450 -5.5930 -0.1050 C 9 TRP 0.597300 + 157 O 3.0220 -6.6750 -0.6820 O 9 TRP -0.567900 + 158 N 2.5310 -5.6090 1.1640 N 10 THR -0.415700 + 159 H 2.7110 -4.7940 1.7310 H 10 THR 0.271900 + 160 CA 2.2540 -6.8740 1.8150 CT 10 THR -0.038900 + 161 HA 2.9820 -7.6670 1.6440 H1 10 THR 0.100700 + 162 CB 2.2070 -6.6220 3.3200 CT 10 THR 0.365400 + 163 HB 1.7220 -5.6670 3.5260 H1 10 THR 0.004300 + 164 CG2 1.4560 -7.6590 4.1490 CT 10 THR -0.243800 + 165 HG21 1.5810 -7.4640 5.2140 HC 10 THR 0.064200 + 166 HG22 0.4020 -7.4680 3.9460 HC 10 THR 0.064200 + 167 HG23 1.7250 -8.6400 3.7550 HC 10 THR 0.064200 + 168 OG1 3.4600 -6.5010 3.9540 OH 10 THR -0.676100 + 169 HG1 3.3850 -6.0970 4.8220 HO 10 THR 0.410200 + 170 C 0.8890 -7.3540 1.3440 C 10 THR 0.597300 + 171 O -0.1720 -6.7600 1.5240 O 10 THR -0.567900 + 172 N 0.9060 -8.5220 0.6990 N 11 TRP -0.415700 + 173 H 1.7230 -9.1150 0.7340 H 11 TRP 0.271900 + 174 CA -0.1880 -9.0660 -0.0800 CT 11 TRP -0.027500 + 175 HA -0.7370 -8.2200 -0.4950 H1 11 TRP 0.112300 + 176 CB 0.4120 -10.0100 -1.1170 CT 11 TRP -0.005000 + 177 HB2 1.1130 -10.7100 -0.6610 HC 11 TRP 0.033900 + 178 HB3 0.8870 -9.3680 -1.8590 HC 11 TRP 0.033900 + 179 CG -0.5390 -10.9280 -1.8160 C* 11 TRP -0.141500 + 180 CD1 -1.3130 -10.6860 -2.8980 CW 11 TRP -0.163800 + 181 HD1 -1.3370 -9.7640 -3.4600 H4 11 TRP 0.206200 + 182 NE1 -1.9710 -11.7860 -3.4110 NA 11 TRP -0.341800 + 183 HE1 -2.3840 -11.8640 -4.3300 H 11 TRP 0.341200 + 184 CE2 -1.9570 -12.7630 -2.4370 CN 11 TRP 0.138000 + 185 CZ2 -2.7850 -13.8650 -2.1910 CA 11 TRP -0.260100 + 186 HZ2 -3.6310 -14.0120 -2.8460 HA 11 TRP 0.157200 + 187 CH2 -2.6000 -14.7090 -1.0890 CA 11 TRP -0.113400 + 188 HH2 -3.3150 -15.4730 -0.8230 HA 11 TRP 0.141700 + 189 CZ3 -1.5180 -14.3450 -0.2780 CA 11 TRP -0.197200 + 190 HZ3 -1.3250 -14.9360 0.6040 HA 11 TRP 0.144700 + 191 CE3 -0.8090 -13.1460 -0.4190 CA 11 TRP -0.238700 + 192 HE3 -0.0380 -12.8340 0.2700 HA 11 TRP 0.170000 + 193 CD2 -1.0340 -12.2590 -1.4840 CB 11 TRP 0.124300 + 194 C -1.0790 -9.7520 0.9460 C 11 TRP 0.597300 + 195 O -0.7100 -10.6730 1.6720 O 11 TRP -0.567900 + 196 N -2.3440 -9.3260 0.9490 N 12 LYS -0.347900 + 197 H -2.4560 -8.3390 0.7700 H 12 LYS 0.274700 + 198 CA -3.4700 -9.9260 1.6360 CT 12 LYS -0.240000 + 199 HA -3.0970 -10.4390 2.5220 H1 12 LYS 0.142600 + 200 CB -4.3840 -8.8140 2.1420 CT 12 LYS -0.009400 + 201 HB2 -5.3890 -9.1120 2.4400 HC 12 LYS 0.036200 + 202 HB3 -4.4390 -8.0090 1.4090 HC 12 LYS 0.036200 + 203 CG -3.7990 -8.0920 3.3520 CT 12 LYS 0.018700 + 204 HG2 -2.8890 -7.5660 3.0640 HC 12 LYS 0.010300 + 205 HG3 -3.6910 -8.7240 4.2330 HC 12 LYS 0.010300 + 206 CD -4.8480 -7.0240 3.6500 CT 12 LYS -0.047900 + 207 HD2 -5.6910 -7.4110 4.2220 HC 12 LYS 0.062100 + 208 HD3 -5.1300 -6.4950 2.7400 HC 12 LYS 0.062100 + 209 CE -4.1080 -6.0190 4.5290 CT 12 LYS -0.014300 + 210 HE2 -3.1830 -5.6350 4.0990 HP 12 LYS 0.113500 + 211 HE3 -3.8850 -6.5530 5.4520 HP 12 LYS 0.113500 + 212 NZ -4.8770 -4.8020 4.8290 N3 12 LYS -0.385400 + 213 HZ1 -5.1320 -4.3050 3.9870 H 12 LYS 0.340000 + 214 HZ2 -5.7180 -4.9680 5.3620 H 12 LYS 0.340000 + 215 HZ3 -4.2500 -4.2630 5.4100 H 12 LYS 0.340000 + 216 C -4.3950 -10.7780 0.7790 C 12 LYS 0.734100 + 217 O -4.4830 -11.9390 1.1720 O 12 LYS -0.589400 + 218 N -4.8320 -10.2020 -0.3440 N 13 NME -0.415700 + 219 H -4.6470 -9.2390 -0.5870 H 13 NME 0.271900 + 220 CH3 -5.7200 -10.8660 -1.2770 CT 13 NME -0.149000 + 221 HH31 -5.5910 -11.9460 -1.3400 H1 13 NME 0.097600 + 222 HH32 -6.7570 -10.8860 -0.9420 H1 13 NME 0.097600 + 223 HH33 -5.7770 -10.3580 -2.2400 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** From 7168fa63a3e374e98123fb18b997c75071d2e050 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 5 Sep 2021 14:30:35 -0400 Subject: [PATCH 217/417] Add test comparison --- test/Test_Cluster_AssignRefs/RunTest.sh | 4 ++-- test/Test_Cluster_AssignRefs/ksummary.dat.save | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test/Test_Cluster_AssignRefs/ksummary.dat.save diff --git a/test/Test_Cluster_AssignRefs/RunTest.sh b/test/Test_Cluster_AssignRefs/RunTest.sh index 0857e3a4c6..e98ffe5b49 100755 --- a/test/Test_Cluster_AssignRefs/RunTest.sh +++ b/test/Test_Cluster_AssignRefs/RunTest.sh @@ -20,7 +20,7 @@ for i=0;i<5;i++ done cluster Kmeans data D1 kmeans clusters 5 summary ksummary.dat assignrefs refcut 3.0 refmask :1-12&!@H= EOF -RunCpptraj "Test1" - +RunCpptraj "$TESTNAME" +DoTest ksummary.dat.save ksummary.dat EndTest diff --git a/test/Test_Cluster_AssignRefs/ksummary.dat.save b/test/Test_Cluster_AssignRefs/ksummary.dat.save new file mode 100644 index 0000000000..f7ea85e564 --- /dev/null +++ b/test/Test_Cluster_AssignRefs/ksummary.dat.save @@ -0,0 +1,6 @@ +#Cluster Frames Frac AvgDist Stdev Centroid AvgCDist Name RMS + 0 29 0.287 1.150 0.889 56 9.100 ([C0]) 3.143 + 1 28 0.277 0.927 0.649 70 6.706 ([C2]) 3.544 + 2 18 0.178 1.049 0.708 83 6.497 [C1] 2.354 + 3 14 0.139 1.521 1.029 77 5.592 [C2] 2.295 + 4 12 0.119 1.346 1.137 88 8.765 ([C1]) 3.009 From cf6db6ef8f19c734135df4fa8f893fe73fdd5da7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 5 Sep 2021 14:45:04 -0400 Subject: [PATCH 218/417] Add assign refs to cluster function --- src/Cluster/AssignRefsToClusters.cpp | 62 ++++++++++++++++++++++++++++ src/Cluster/AssignRefsToClusters.h | 15 +++++++ 2 files changed, 77 insertions(+) create mode 100644 src/Cluster/AssignRefsToClusters.cpp create mode 100644 src/Cluster/AssignRefsToClusters.h diff --git a/src/Cluster/AssignRefsToClusters.cpp b/src/Cluster/AssignRefsToClusters.cpp new file mode 100644 index 0000000000..6b7cadc4f2 --- /dev/null +++ b/src/Cluster/AssignRefsToClusters.cpp @@ -0,0 +1,62 @@ +#include "AssignRefsToClusters.h" +#include "List.h" +#include "Node.h" +#include "../CpptrajStdio.h" +#include "../DataSet_Coords.h" +#include "../DataSetList.h" +#include "../Frame.h" + +int Cpptraj::Cluster::AssignRefsToClusters( DataSetList const& refSets, + std::string const& refmaskexpr, + double refCut, + bool useMass, + DataSet_Coords& coords, + List& CList ) +{ + // Pre-center all reference coords at the origin. No need to store trans vectors. + std::vector refFrames; + refFrames.reserve( refSets.size() ); + for (unsigned int idx = 0; idx != refSets.size(); idx++) { + AtomMask rMask( refmaskexpr ); + DataSet_Coords_REF* REF_ds = (DataSet_Coords_REF*)refSets[idx]; + if ( REF_ds->Top().SetupIntegerMask( rMask, REF_ds->RefFrame() ) ) { + mprintf("Warning: Could not set up mask for reference '%s'\n", REF_ds->legend()); + continue; + } + refFrames.push_back( Frame(REF_ds->RefFrame(), rMask) ); + refFrames.back().CenterOnOrigin( useMass ); + } + // For each cluster, assign the reference name with the lowest RMSD + // to the representative frame that is below the cutoff. + AtomMask tMask( refmaskexpr ); + if (coords.Top().SetupIntegerMask( tMask )) { + mprinterr("Error: Could not set up mask for assigning references.\n"); + return 1; + } + Frame TGT( coords.AllocateFrame(), tMask ); + unsigned int cidx = 0; + for (List::cluster_it cluster = CList.begin(); + cluster != CList.end(); ++cluster, ++cidx) + { + coords.GetFrame( cluster->BestRepFrame(), TGT, tMask ); + double minRms = TGT.RMSD_CenteredRef( refFrames[0], useMass ); + unsigned int minIdx = 0; + for (unsigned int idx = 1; idx < refSets.size(); idx++) { + double rms = TGT.RMSD_CenteredRef( refFrames[idx], useMass ); + if (rms < minRms) { + minRms = rms; + minIdx = idx; + } + } + if (minRms < refCut) { + //mprintf("DEBUG: Assigned cluster %i to reference \"%s\" (%g)\n", cidx, + // refSets[minIdx]->Meta().Name().c_str(), minRms); + cluster->SetNameAndRms( refSets[minIdx]->Meta().Name(), minRms ); + } else { + //mprintf("DEBUG: Cluster %i was closest to reference \"(%s)\" (%g)\n", cidx, + // refSets[minIdx]->Meta().Name().c_str(), minRms); + cluster->SetNameAndRms( "(" + refSets[minIdx]->Meta().Name() + ")", minRms ); + } + } + return 0; +} diff --git a/src/Cluster/AssignRefsToClusters.h b/src/Cluster/AssignRefsToClusters.h new file mode 100644 index 0000000000..d3ef78a415 --- /dev/null +++ b/src/Cluster/AssignRefsToClusters.h @@ -0,0 +1,15 @@ +#ifndef INC_CLUSTER_ASSIGNREFSTOCLUSTERS_H +#define INC_CLUSTER_ASSIGNREFSTOCLUSTERS_H +#include +class DataSet_Coords; +class DataSetList; +namespace Cpptraj { +namespace Cluster { +class List; + +int AssignRefsToClusters(DataSetList const&, std::string const&, double, bool, + DataSet_Coords&, List& CList); + +} +} +#endif From 374b91b328cfb6a570bd836f16f5cac3c7003ddd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 5 Sep 2021 14:45:31 -0400 Subject: [PATCH 219/417] Add to files and depends --- src/Cluster/clusterdepend | 1 + src/Cluster/clusterfiles | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index a02ae72bd2..05b130ba71 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -3,6 +3,7 @@ Algorithm_DBscan.o : Algorithm_DBscan.cpp ../ArgList.h ../ArrayIterator.h ../Ass Algorithm_DPeaks.o : Algorithm_DPeaks.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_Mesh.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../Spline.h ../TextFormat.h Algorithm.h Algorithm_DPeaks.h Cframes.h List.h Node.h PairwiseMatrix.h Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h ../ProgressBar.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Cframes.h DynamicMatrix.h List.h Node.h PairwiseMatrix.h Algorithm_Kmeans.o : Algorithm_Kmeans.cpp ../ArgList.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h ../ProgressBar.h ../Random.h Algorithm.h Algorithm_Kmeans.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +AssignRefsToClusters.o : AssignRefsToClusters.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.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 AssignRefsToClusters.h Cframes.h List.h Node.h BestReps.o : BestReps.cpp ../CpptrajStdio.h BestReps.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.o : Cframes.cpp Cframes.h diff --git a/src/Cluster/clusterfiles b/src/Cluster/clusterfiles index 67fe9d902e..7a5ddae7b8 100644 --- a/src/Cluster/clusterfiles +++ b/src/Cluster/clusterfiles @@ -5,6 +5,7 @@ CLUSTER_SOURCES= \ Algorithm_DPeaks.cpp \ Algorithm_HierAgglo.cpp \ Algorithm_Kmeans.cpp \ + AssignRefsToClusters.cpp \ BestReps.cpp \ Centroid_Coord.cpp \ Cframes.cpp \ From 60b8edaeaef1f15af3e5b46aa93f46d03c910ca9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 06:12:01 -0400 Subject: [PATCH 220/417] Add assignrefs options to Results_Coords --- src/Cluster/Control.h | 2 +- src/Cluster/Results.h | 4 ++-- src/Cluster/Results_Coords.cpp | 15 ++++++++++++++- src/Cluster/Results_Coords.h | 7 ++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 7e8c26ca61..03df1f7aa8 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -107,7 +107,7 @@ class Control { std::string splitfile_; ///< Output file for splitting cluster results Cframes splitFrames_; ///< Frames at which to split - + // TODO make class vars in DrawGraph.cpp GraphType drawGraph_; ///< Indicate whether a cluster graph should be drawn double draw_tol_; ///< Graph draw tolerance for min int draw_maxit_; ///< Graph draw max iterations for min diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h index e26152c50d..49fa318c8e 100644 --- a/src/Cluster/Results.h +++ b/src/Cluster/Results.h @@ -1,11 +1,11 @@ #ifndef INC_CLUSTER_RESULTS_H #define INC_CLUSTER_RESULTS_H class ArgList; +class DataSetList; namespace Cpptraj { namespace Cluster { class List; //FIXME Should this be allocated and kept inside the Metric? - /// Abstract base class for handling results specific to input data type. class Results { public: @@ -14,7 +14,7 @@ class Results { Results(Type t) : type_(t) {} virtual ~Results() {} - virtual int GetOptions(ArgList&) = 0; + virtual int GetOptions(ArgList&, DataSetList const&) = 0; virtual void Info() const = 0; virtual int DoOutput(List const&) const = 0; private: diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index d7b15f254e..5f27a61f80 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -36,13 +36,26 @@ void Cpptraj::Cluster::Results_Coords::GetClusterTrajArgs(ArgList& argIn, fmt = TrajectoryFile::WriteFormatFromFname( trajName, DEF_TRAJ_FMT_ ); } -int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs) { +/** Get user specified options. */ +int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs, DataSetList const& DSL) +{ writeRepFrameNum_ = analyzeArgs.hasKey("repframe"); GetClusterTrajArgs(analyzeArgs, "clusterout", "clusterfmt", clusterfile_, clusterfmt_); GetClusterTrajArgs(analyzeArgs, "singlerepout", "singlerepfmt", singlerepfile_, singlerepfmt_); GetClusterTrajArgs(analyzeArgs, "repout", "repfmt", reptrajfile_, reptrajfmt_); GetClusterTrajArgs(analyzeArgs, "avgout", "avgfmt", avgfile_, avgfmt_); + if (analyzeArgs.hasKey("assignrefs")) { + refSets_ = DSL.GetSetsOfType("*", DataSet::REF_FRAME); + if (refSets_.empty()) { + mprinterr("Error: 'assignrefs' specified but no references loaded.\n"); + return 1; + } + refCut_ = analyzeArgs.getKeyDouble("refcut", 1.0); + refmaskexpr_ = analyzeArgs.GetStringKey("refmask"); + useMass_ = analyzeArgs.hasKey("userefmass"); + } + return 0; } diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index 0c1143a413..452fdd8840 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -1,6 +1,7 @@ #ifndef INC_CLUSTER_RESULTS_COORDS_H #define INC_CLUSTER_RESULTS_COORDS_H #include "Results.h" +#include "../DataSetList.h" // for assignrefs #include "../TrajectoryFile.h" class DataSet_Coords; namespace Cpptraj { @@ -11,7 +12,7 @@ class Results_Coords : public Results { public: Results_Coords(DataSet_Coords*); // ----- Results functions ------------------- - int GetOptions(ArgList&); + int GetOptions(ArgList&, DataSetList const&); void Info() const; int DoOutput(List const&) const; private: @@ -35,6 +36,10 @@ class Results_Coords : public Results { std::string reptrajfile_; ///< Cluster rep to separate trajectory filename. std::string avgfile_; ///< Cluster traj average structure filename. + DataSetList refSets_; ///< Hold reference frames to compare to + std::string refmaskexpr_; ///< Select atoms to compare in ref frames and cluster reps + double refCut_; ///< RMSD cutoff for assigning refs in Ang. + bool useMass_; ///< Whether to mass-weight RMS or not, based on metric }; } From 945503bf3fc68fa91efac082a81b8f165e07688a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 09:57:56 -0400 Subject: [PATCH 221/417] Return type, usemass, mask --- src/Cluster/Metric.h | 3 +++ src/Cluster/Metric_DME.h | 2 ++ src/Cluster/Metric_RMS.h | 4 ++++ src/Cluster/Metric_SRMSD.h | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index 874c54b6bb..f363f6b812 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -43,6 +43,9 @@ class Metric { virtual void Info() const = 0; /// \return total number of frames. virtual unsigned int Ntotal() const = 0; + + /// \return Metric type + Type MetricType() const { return type_; } private: Type type_; }; diff --git a/src/Cluster/Metric_DME.h b/src/Cluster/Metric_DME.h index aafda6c63d..2a6454613f 100644 --- a/src/Cluster/Metric_DME.h +++ b/src/Cluster/Metric_DME.h @@ -23,6 +23,8 @@ class Metric_DME : public Metric { unsigned int Ntotal() const { return (unsigned int)coords_->Size(); } // ------------------------------------------- int Init(DataSet_Coords*, AtomMask const&); + /// \return Atom mask + AtomMask const& Mask() const { return mask_; } private: DataSet_Coords* coords_; AtomMask mask_; diff --git a/src/Cluster/Metric_RMS.h b/src/Cluster/Metric_RMS.h index b6ac801376..6f75051c59 100644 --- a/src/Cluster/Metric_RMS.h +++ b/src/Cluster/Metric_RMS.h @@ -24,6 +24,10 @@ class Metric_RMS : public Metric { unsigned int Ntotal() const { return (unsigned int)coords_->Size(); } // ------------------------------------------- int Init(DataSet_Coords*, AtomMask const&, bool, bool); + /// \return whether RMS is mass-weighted + bool UseMass() const { return useMass_; } + /// \return Atom mask + AtomMask const& Mask() const { return mask_; } private: DataSet_Coords* coords_; AtomMask mask_; diff --git a/src/Cluster/Metric_SRMSD.h b/src/Cluster/Metric_SRMSD.h index 9e847e94dc..55d8f9f779 100644 --- a/src/Cluster/Metric_SRMSD.h +++ b/src/Cluster/Metric_SRMSD.h @@ -12,6 +12,10 @@ class Metric_SRMSD : public Metric { public: Metric_SRMSD() : Metric(SRMSD) {} int Init(DataSet_Coords*,AtomMask const&,bool,bool,int); + /// \return whether RMSD is mass-weighted + bool UseMass() const { return SRMSD_.UseMass(); } + /// \return Atom mask + AtomMask const& Mask() const { return mask_; } // ----- Metric ------------------------------ int Setup(); double FrameDist(int, int); From 2d4633c064ea6d76bfa7b26a6c38d717dcf4c2a6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 10:03:45 -0400 Subject: [PATCH 222/417] Set defaults from metric if needed --- src/Cluster/Results.h | 3 ++- src/Cluster/Results_Coords.cpp | 30 +++++++++++++++++++++++++++--- src/Cluster/Results_Coords.h | 2 +- src/Cluster/clusterdepend | 2 +- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h index 49fa318c8e..6a2b86b018 100644 --- a/src/Cluster/Results.h +++ b/src/Cluster/Results.h @@ -5,6 +5,7 @@ class DataSetList; namespace Cpptraj { namespace Cluster { class List; +class Metric; //FIXME Should this be allocated and kept inside the Metric? /// Abstract base class for handling results specific to input data type. class Results { @@ -14,7 +15,7 @@ class Results { Results(Type t) : type_(t) {} virtual ~Results() {} - virtual int GetOptions(ArgList&, DataSetList const&) = 0; + virtual int GetOptions(ArgList&, DataSetList const&, Metric const&) = 0; virtual void Info() const = 0; virtual int DoOutput(List const&) const = 0; private: diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 5f27a61f80..32d06685c7 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -1,5 +1,8 @@ #include "Results_Coords.h" #include "List.h" +#include "Metric_DME.h" +#include "Metric_RMS.h" +#include "Metric_SRMSD.h" #include "Node.h" #include "../ArgList.h" #include "../CpptrajStdio.h" @@ -23,7 +26,7 @@ Cpptraj::Cluster::Results_Coords::Results_Coords(DataSet_Coords* ds) : avgfmt_(TrajectoryFile::UNKNOWN_TRAJ) {} - +/** Get arguments related to writing cluster data to trajectories. */ void Cpptraj::Cluster::Results_Coords::GetClusterTrajArgs(ArgList& argIn, const char* trajKey, const char* fmtKey, std::string& trajName, @@ -37,7 +40,8 @@ void Cpptraj::Cluster::Results_Coords::GetClusterTrajArgs(ArgList& argIn, } /** Get user specified options. */ -int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs, DataSetList const& DSL) +int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs, DataSetList const& DSL, + Metric const& metricIn) { writeRepFrameNum_ = analyzeArgs.hasKey("repframe"); GetClusterTrajArgs(analyzeArgs, "clusterout", "clusterfmt", clusterfile_, clusterfmt_); @@ -53,12 +57,32 @@ int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs, DataSetLi } refCut_ = analyzeArgs.getKeyDouble("refcut", 1.0); refmaskexpr_ = analyzeArgs.GetStringKey("refmask"); - useMass_ = analyzeArgs.hasKey("userefmass"); + useMass_ = false; + // Attempt to set defaults from Metric if applicable + if (metricIn.MetricType() == Metric::RMS) { + Metric_RMS const& met = static_cast( metricIn ); + useMass_ = met.UseMass(); + if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); + } else if (metricIn.MetricType() == Metric::SRMSD) { + Metric_SRMSD const& met = static_cast( metricIn ); + useMass_ = met.UseMass(); + if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); + } else if (metricIn.MetricType() == Metric::DME) { + Metric_DME const& met = static_cast( metricIn ); + if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); + } + // Set a default mask if needed + if (refmaskexpr_.empty()) { + refmaskexpr_.assign("!@H="); + mprintf("Warning: 'assignrefs' specified but no 'refmask' given.\n" + "Warning: Using default mask expression: '%s'\n", refmaskexpr_.c_str()); + } } return 0; } +/** Write info on what results will be calculated/written. */ void Cpptraj::Cluster::Results_Coords::Info() const { if (!clusterfile_.empty()) mprintf("\tCluster trajectories will be written to %s, format %s\n", diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index 452fdd8840..a08560ac86 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -12,7 +12,7 @@ class Results_Coords : public Results { public: Results_Coords(DataSet_Coords*); // ----- Results functions ------------------- - int GetOptions(ArgList&, DataSetList const&); + int GetOptions(ArgList&, DataSetList const&, Metric const&); void Info() const; int DoOutput(List const&) const; private: diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 05b130ba71..49ad199b5b 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -22,5 +22,5 @@ Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Cframes.h Metric.h Node.h PairwiseMatrix.h Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h PairwiseMatrix.o : PairwiseMatrix.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Metric.h PairwiseMatrix.h -Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.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 ../OutputTrajCommon.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 ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Cframes.h List.h Node.h Results.h Results_Coords.h +Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Cframes.h List.h Metric.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h From eec786d07cc02f66ce438cc01cb335b6dab0cdab Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 10:12:51 -0400 Subject: [PATCH 223/417] Move assignrefs routine to Results_Coords. Create separate function CalcResults, purpose of which is calculating things that belong in cluster nodes. --- src/Cluster/Results.h | 1 + src/Cluster/Results_Coords.cpp | 70 +++++++++++++++++++++++++++++++++- src/Cluster/Results_Coords.h | 3 ++ 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h index 6a2b86b018..9ba51c888d 100644 --- a/src/Cluster/Results.h +++ b/src/Cluster/Results.h @@ -18,6 +18,7 @@ class Results { virtual int GetOptions(ArgList&, DataSetList const&, Metric const&) = 0; virtual void Info() const = 0; virtual int DoOutput(List const&) const = 0; + virtual int CalcResults(List&) const = 0; private: Type type_; }; diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 32d06685c7..60fc978265 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -100,9 +100,16 @@ void Cpptraj::Cluster::Results_Coords::Info() const { if (!avgfile_.empty()) mprintf("\tAverage structures for clusters will be written to %s, format %s\n", avgfile_.c_str(), TrajectoryFile::FormatString(avgfmt_)); + + if (!refSets_.empty()) + mprintf("\tClusters will be identified with loaded reference structures if RMSD\n" + "\t (mask '%s') to representative frame is < %g Ang.\n", + refmaskexpr_.c_str(), refCut_); } +/** Do any output needed. */ int Cpptraj::Cluster::Results_Coords::DoOutput(List const& CList) const { + int err = 0; // Write clusters to trajectories if (!clusterfile_.empty()) WriteClusterTraj( CList ); @@ -115,7 +122,16 @@ int Cpptraj::Cluster::Results_Coords::DoOutput(List const& CList) const { // Write average structures for each cluster to separate files. if (!avgfile_.empty()) WriteAvgStruct( CList ); - return 0; + return err; +} + +/** Calculate any results that belong in clusters. */ +int Cpptraj::Cluster::Results_Coords::CalcResults(List& CList) const { + int err = 0; + // Assign reference structures to clusters + if (!refSets_.empty()) + err += AssignRefsToClusters( CList ); + return err; } /** Write frames in each cluster to a trajectory file. */ @@ -291,3 +307,55 @@ void Cpptraj::Cluster::Results_Coords::WriteRepTraj( List const& CList ) const { } } } + +/** Assign reference frames to clusters via closest RMSD. */ +int Cpptraj::Cluster::Results_Coords::AssignRefsToClusters( List& CList ) +const +{ + // Pre-center all reference coords at the origin. No need to store trans vectors. + std::vector refFrames; + refFrames.reserve( refSets_.size() ); + for (unsigned int idx = 0; idx != refSets_.size(); idx++) { + AtomMask rMask( refmaskexpr_ ); + DataSet_Coords_REF* REF_ds = (DataSet_Coords_REF*)refSets_[idx]; + if ( REF_ds->Top().SetupIntegerMask( rMask, REF_ds->RefFrame() ) ) { + mprintf("Warning: Could not set up mask for reference '%s'\n", REF_ds->legend()); + continue; + } + refFrames.push_back( Frame(REF_ds->RefFrame(), rMask) ); + refFrames.back().CenterOnOrigin( useMass_ ); + } + // For each cluster, assign the reference name with the lowest RMSD + // to the representative frame that is below the cutoff. + AtomMask tMask( refmaskexpr_ ); + if (coords_->Top().SetupIntegerMask( tMask )) { + mprinterr("Error: Could not set up mask for assigning references.\n"); + return 1; + } + Frame TGT( coords_->AllocateFrame(), tMask ); + unsigned int cidx = 0; + for (List::cluster_it cluster = CList.begin(); + cluster != CList.end(); ++cluster, ++cidx) + { + coords_->GetFrame( cluster->BestRepFrame(), TGT, tMask ); + double minRms = TGT.RMSD_CenteredRef( refFrames[0], useMass_ ); + unsigned int minIdx = 0; + for (unsigned int idx = 1; idx < refSets_.size(); idx++) { + double rms = TGT.RMSD_CenteredRef( refFrames[idx], useMass_ ); + if (rms < minRms) { + minRms = rms; + minIdx = idx; + } + } + if (minRms < refCut_) { + //mprintf("DEBUG: Assigned cluster %i to reference \"%s\" (%g)\n", cidx, + // refSets_[minIdx]->Meta().Name().c_str(), minRms); + cluster->SetNameAndRms( refSets_[minIdx]->Meta().Name(), minRms ); + } else { + //mprintf("DEBUG: Cluster %i was closest to reference \"(%s)\" (%g)\n", cidx, + // refSets_[minIdx]->Meta().Name().c_str(), minRms); + cluster->SetNameAndRms( "(" + refSets_[minIdx]->Meta().Name() + ")", minRms ); + } + } + return 0; +} diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index a08560ac86..b32e481062 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -15,6 +15,7 @@ class Results_Coords : public Results { int GetOptions(ArgList&, DataSetList const&, Metric const&); void Info() const; int DoOutput(List const&) const; + int CalcResults(List&) const; private: void GetClusterTrajArgs(ArgList&, const char*, const char*, std::string&, TrajectoryFile::TrajFormatType&) const; @@ -23,6 +24,8 @@ class Results_Coords : public Results { void WriteSingleRepTraj( List const& ) const; void WriteRepTraj( List const& ) const; + int AssignRefsToClusters(List&) const; + static const TrajectoryFile::TrajFormatType DEF_TRAJ_FMT_; DataSet_Coords* coords_; ///< The COORDS data set From 38dd1361ce8ac3c8853d0369078d58fe4cda6670 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 10:14:31 -0400 Subject: [PATCH 224/417] assignrefs now in Results_Coords --- src/Cluster/AssignRefsToClusters.cpp | 62 ---------------------------- src/Cluster/AssignRefsToClusters.h | 15 ------- src/Cluster/clusterdepend | 1 - src/Cluster/clusterfiles | 1 - 4 files changed, 79 deletions(-) delete mode 100644 src/Cluster/AssignRefsToClusters.cpp delete mode 100644 src/Cluster/AssignRefsToClusters.h diff --git a/src/Cluster/AssignRefsToClusters.cpp b/src/Cluster/AssignRefsToClusters.cpp deleted file mode 100644 index 6b7cadc4f2..0000000000 --- a/src/Cluster/AssignRefsToClusters.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "AssignRefsToClusters.h" -#include "List.h" -#include "Node.h" -#include "../CpptrajStdio.h" -#include "../DataSet_Coords.h" -#include "../DataSetList.h" -#include "../Frame.h" - -int Cpptraj::Cluster::AssignRefsToClusters( DataSetList const& refSets, - std::string const& refmaskexpr, - double refCut, - bool useMass, - DataSet_Coords& coords, - List& CList ) -{ - // Pre-center all reference coords at the origin. No need to store trans vectors. - std::vector refFrames; - refFrames.reserve( refSets.size() ); - for (unsigned int idx = 0; idx != refSets.size(); idx++) { - AtomMask rMask( refmaskexpr ); - DataSet_Coords_REF* REF_ds = (DataSet_Coords_REF*)refSets[idx]; - if ( REF_ds->Top().SetupIntegerMask( rMask, REF_ds->RefFrame() ) ) { - mprintf("Warning: Could not set up mask for reference '%s'\n", REF_ds->legend()); - continue; - } - refFrames.push_back( Frame(REF_ds->RefFrame(), rMask) ); - refFrames.back().CenterOnOrigin( useMass ); - } - // For each cluster, assign the reference name with the lowest RMSD - // to the representative frame that is below the cutoff. - AtomMask tMask( refmaskexpr ); - if (coords.Top().SetupIntegerMask( tMask )) { - mprinterr("Error: Could not set up mask for assigning references.\n"); - return 1; - } - Frame TGT( coords.AllocateFrame(), tMask ); - unsigned int cidx = 0; - for (List::cluster_it cluster = CList.begin(); - cluster != CList.end(); ++cluster, ++cidx) - { - coords.GetFrame( cluster->BestRepFrame(), TGT, tMask ); - double minRms = TGT.RMSD_CenteredRef( refFrames[0], useMass ); - unsigned int minIdx = 0; - for (unsigned int idx = 1; idx < refSets.size(); idx++) { - double rms = TGT.RMSD_CenteredRef( refFrames[idx], useMass ); - if (rms < minRms) { - minRms = rms; - minIdx = idx; - } - } - if (minRms < refCut) { - //mprintf("DEBUG: Assigned cluster %i to reference \"%s\" (%g)\n", cidx, - // refSets[minIdx]->Meta().Name().c_str(), minRms); - cluster->SetNameAndRms( refSets[minIdx]->Meta().Name(), minRms ); - } else { - //mprintf("DEBUG: Cluster %i was closest to reference \"(%s)\" (%g)\n", cidx, - // refSets[minIdx]->Meta().Name().c_str(), minRms); - cluster->SetNameAndRms( "(" + refSets[minIdx]->Meta().Name() + ")", minRms ); - } - } - return 0; -} diff --git a/src/Cluster/AssignRefsToClusters.h b/src/Cluster/AssignRefsToClusters.h deleted file mode 100644 index d3ef78a415..0000000000 --- a/src/Cluster/AssignRefsToClusters.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef INC_CLUSTER_ASSIGNREFSTOCLUSTERS_H -#define INC_CLUSTER_ASSIGNREFSTOCLUSTERS_H -#include -class DataSet_Coords; -class DataSetList; -namespace Cpptraj { -namespace Cluster { -class List; - -int AssignRefsToClusters(DataSetList const&, std::string const&, double, bool, - DataSet_Coords&, List& CList); - -} -} -#endif diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 49ad199b5b..08ad239d2e 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -3,7 +3,6 @@ Algorithm_DBscan.o : Algorithm_DBscan.cpp ../ArgList.h ../ArrayIterator.h ../Ass Algorithm_DPeaks.o : Algorithm_DPeaks.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_Mesh.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../Spline.h ../TextFormat.h Algorithm.h Algorithm_DPeaks.h Cframes.h List.h Node.h PairwiseMatrix.h Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h ../ProgressBar.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Cframes.h DynamicMatrix.h List.h Node.h PairwiseMatrix.h Algorithm_Kmeans.o : Algorithm_Kmeans.cpp ../ArgList.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h ../ProgressBar.h ../Random.h Algorithm.h Algorithm_Kmeans.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h -AssignRefsToClusters.o : AssignRefsToClusters.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.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 AssignRefsToClusters.h Cframes.h List.h Node.h BestReps.o : BestReps.cpp ../CpptrajStdio.h BestReps.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.o : Cframes.cpp Cframes.h diff --git a/src/Cluster/clusterfiles b/src/Cluster/clusterfiles index 7a5ddae7b8..67fe9d902e 100644 --- a/src/Cluster/clusterfiles +++ b/src/Cluster/clusterfiles @@ -5,7 +5,6 @@ CLUSTER_SOURCES= \ Algorithm_DPeaks.cpp \ Algorithm_HierAgglo.cpp \ Algorithm_Kmeans.cpp \ - AssignRefsToClusters.cpp \ BestReps.cpp \ Centroid_Coord.cpp \ Cframes.cpp \ From e79e71da9359e02d68bfcfbeaff67b0c046b4ce1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 10:15:47 -0400 Subject: [PATCH 225/417] Fix GetOptions call, add CalcResults call. --- src/Cluster/Control.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 993ded8276..9e4e424615 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -455,7 +455,7 @@ int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, Da } if (results_ != 0) { - if (results_->GetOptions(analyzeArgs)) return 1; + if (results_->GetOptions(analyzeArgs, DSL, *metric_)) return 1; } // Allocate PairwiseMatrix (and optionally a cache). Metric must already be set up. @@ -981,6 +981,7 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { // Any other results if (results_ != 0) { timer_output_results_.Start(); + results_->CalcResults( clusters_ ); results_->DoOutput( clusters_ ); timer_output_results_.Stop(); } From 04a7701ee913af71dd917c32e906f4935cdcda20 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 14:15:52 -0400 Subject: [PATCH 226/417] Create single unified setup routine instead of two separate ones --- src/Cluster/Control.cpp | 121 +++++++++++++++++++++++++++++++++++----- src/Cluster/Control.h | 12 ++-- 2 files changed, 114 insertions(+), 19 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 9e4e424615..99a6b9c51e 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -264,10 +264,8 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type return met; } -const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = - "{dme|rms|srmsd} [mass] [nofit] []"; - /** Set up clustering for 1D scalar sets. */ +/* int Cpptraj::Cluster::Control::SetupForDataSets(Metric_Data::DsArray const& inputSets, DataSet_Coords* ds, ArgList& analyzeArgs, @@ -303,9 +301,10 @@ int Cpptraj::Cluster::Control::SetupForDataSets(Metric_Data::DsArray const& inpu } return Common(analyzeArgs, DSL, DFL); -} +}*/ /** Set up clustering for a COORDS DataSet.*/ +/* int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, ArgList& analyzeArgs, DataSetList& DSL, @@ -338,14 +337,6 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, bool nofit = analyzeArgs.hasKey("nofit"); // Get the mask string std::string maskExpr = analyzeArgs.GetMaskNext(); - /*if (!refs_.empty() && refmaskexpr_.empty()) { TODO enable - refmaskexpr_ = maskexpr_; - if (refmaskexpr_.empty()) { - refmaskexpr_.assign("!@H="); - mprintf("Warning: 'assignrefs' specified but no 'refmask' given.\n" - "Warning: Using default mask expression: '%s'\n", refmaskexpr_.c_str()); - } - }*/ int err = 0; switch (mtype) { @@ -371,7 +362,7 @@ int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, if (results_ == 0) return 1; return Common(analyzeArgs, DSL, DFL); -} +}*/ // ----------------------------------------------------------------------------- static int Err(int code) { @@ -442,11 +433,113 @@ const char* Cpptraj::Cluster::Control::CommonArgs_ = "[out [gracecolor]] [] " "[clustersvtime cvtwindow <#> "; +const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = + "{dme|rms|srmsd} [mass] [nofit] []"; + + /** Common setup. */ -int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) +//int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) +int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, + DataSet* coordsSet, + ArgList& analyzeArgs, + DataSetList& DSL, + DataFileList& DFL, + int verboseIn) { + verbose_ = verboseIn; clusters_.SetDebug( verbose_ ); + // Determine if clustering on COORDS set or scalar sets + // TODO separate Metric from Euclid/Manhattan to allow COORDS/1D combos + if (setsToCluster.empty()) { + mprinterr("Error: No sets to cluster.\n"); + return 1; + } + + // Determine the metric type based on what sets we are clustering on + if (setsToCluster.size() == 1 && setsToCluster[0]->Group() == DataSet::COORDINATES) { + // Clustering on coords + mprintf("\tClustering on coordinates: '%s'\n", setsToCluster[0]->legend()); + // Determine Metric. Valid ones for COORDS are RMS, DME, SRMSD + int usedme = (int)analyzeArgs.hasKey("dme"); + int userms = (int)analyzeArgs.hasKey("rms"); + int usesrms = (int)analyzeArgs.hasKey("srmsd"); + if (usedme + userms + usesrms > 1) { + mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); + return 1; + } + Metric::Type mtype = Metric::RMS; // Default + if (usedme) mtype = Metric::DME; + else if (userms) mtype = Metric::RMS; + else if (usesrms) mtype = Metric::SRMSD; + if (metric_ != 0) delete metric_; + metric_ = 0; + metric_ = AllocateMetric( mtype ); + if (metric_ == 0) return 1; + // COORDS Metric init. + bool useMass = analyzeArgs.hasKey("mass"); + bool nofit = analyzeArgs.hasKey("nofit"); + // Get the mask string + std::string maskExpr = analyzeArgs.GetMaskNext(); + int err = 0; + DataSet_Coords* ds = static_cast( setsToCluster[0] ); + switch (mtype) { + case Metric::RMS : + err = ((Metric_RMS*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass); break; + case Metric::DME : + err = ((Metric_DME*)metric_)->Init(ds, AtomMask(maskExpr)); break; + case Metric::SRMSD : + err = ((Metric_SRMSD*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass, verbose_); + break; + default: + mprinterr("Error: Unhandled Metric setup.\n"); + err = 1; + } + if (err != 0) { + mprinterr("Error: Metric setup failed.\n"); + return 1; + } + } else { + mprintf("\tClustering on %zu data set(s).\n", setsToCluster.size()); + // Clustering on data + Metric_Data::DsArray cluster_datasets; + for (DataSetList::const_iterator ds = setsToCluster.begin(); ds != setsToCluster.end(); ++ds) + { + // Clustering only allowed on 1D data sets. + if ( (*ds)->Group() != DataSet::SCALAR_1D ) { + mprinterr("Error: Clustering only allowed on 1D scalar data sets, %s is %zuD.\n", + (*ds)->legend(), (*ds)->Ndim()); + return 1; + } + cluster_datasets.push_back( *ds ); + } + if (cluster_datasets.empty()) { + mprinterr("Error: No valid data sets to cluster on.\n"); + return 1; + } + // Choose metric for 'data' + Metric::Type mtype = Metric::EUCLID; // Default + if (analyzeArgs.hasKey("euclid")) + mtype = Metric::EUCLID; + else if (analyzeArgs.hasKey("manhattan")) + mtype = Metric::MANHATTAN; + if (metric_ != 0) delete metric_; + metric_ = 0; + metric_ = AllocateMetric( mtype ); + if (metric_ == 0) return 1; + // Metric init. + int err = ((Metric_Data*)metric_)->Init( cluster_datasets ); + if (err != 0) return 1; + } + + // Set up results for COORDS DataSet + if (coordsSet != 0) { + mprintf("\tCoordinates set for cluster results: %s\n", coordsSet->legend()); + if (results_ != 0) delete results_; + results_ = (Results*)new Results_Coords( static_cast( coordsSet ) ); + if (results_ == 0) return 1; + } + // Initialize clusters from existing info file. Metric must already be set up. if (analyzeArgs.hasKey("readinfo") || analyzeArgs.hasKey("readtxt")) diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 03df1f7aa8..12c98f5191 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -1,10 +1,10 @@ #ifndef INC_CLUSTER_CONTROL_H #define INC_CLUSTER_CONTROL_H #include "Algorithm.h" // Algorithm::AType -#include "BestReps.h" +#include "BestReps.h" // BestReps::RepMethodType #include "DrawGraph.h" // GraphType #include "List.h" -#include "Metric_Data.h" +#include "Metric.h" // Metric::Type #include "Node.h" // Node::CnormType #include "PairwiseMatrix.h" #include "Sieve.h" @@ -41,9 +41,11 @@ class Control { // TODO ONE setup routine - int SetupForDataSets(Metric_Data::DsArray const&, DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); + //int SetupForDataSets(Metric_Data::DsArray const&, DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); - int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); + //int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); + /// Setup clustering + int SetupClustering(DataSetList const&, DataSet*, ArgList&, DataSetList&, DataFileList&, int); /// Provide information on how clustering calculation is currently set up. void Info() const; /// Perform clustering. @@ -62,7 +64,7 @@ class Control { int ReadInfo(std::string const&); - int Common(ArgList&, DataSetList&, DataFileList&); + //int Common(ArgList&, DataSetList&, DataFileList&); static const char* DEFAULT_PAIRDIST_NAME_; From b5518fb64039f34376b8279c6d8bbe2a38bba8cf Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 14:33:15 -0400 Subject: [PATCH 227/417] Use the new setup interface for clustering --- src/Analysis_Cluster.cpp | 31 +++++++++---------------------- src/cpptrajdepend | 4 ++-- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 9278a9bc1b..a56aaca13a 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -1,7 +1,6 @@ #include "Analysis_Cluster.h" #include "CpptrajStdio.h" #include "DataSet_Coords.h" -#include "Cluster/Metric_Data.h" using namespace Cpptraj::Cluster; @@ -14,13 +13,13 @@ void Analysis_Cluster::Help() const { Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& setup, int debugIn) { control_.SetDebug( debugIn ); - Cpptraj::Cluster::Metric_Data::DsArray cluster_dataset; + DataSetList inputDsets; DataSet_Coords* coords = 0; // First check for data std::string dataSetname = analyzeArgs.GetStringKey("data"); if (!dataSetname.empty()) { + // Get data sets for clustering ArgList dsnames(dataSetname, ","); - DataSetList inputDsets; for (ArgList::const_iterator name = dsnames.begin(); name != dsnames.end(); ++name) { DataSetList tempDSL = setup.DSL().GetMultipleSets( *name ); if (tempDSL.empty()) { @@ -29,36 +28,24 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s } inputDsets += tempDSL; } - for (DataSetList::const_iterator ds = inputDsets.begin(); ds != inputDsets.end(); ++ds) { - // Clustering only allowed on 1D data sets. - if ( (*ds)->Group() != DataSet::SCALAR_1D ) { - mprinterr("Error: Clustering only allowed on 1D scalar data sets, %s is %zuD.\n", - (*ds)->legend(), (*ds)->Ndim()); - return Analysis::ERR; - } - cluster_dataset.push_back( *ds ); - } - } - // Attempt to get coords DataSet from datasetlist. Do this - // if crdset is specified or no other DataSets specified. + // If 'crdset' specified or if 'nocoords' *not* specified, attempt to get + // COORDS DataSet from master DataSetList. std::string setname = analyzeArgs.GetStringKey("crdset"); - if (!setname.empty() || cluster_dataset.empty()) { + if (!setname.empty() || !analyzeArgs.hasKey("nocoords")) { coords = (DataSet_Coords*)setup.DSL().FindCoordsSet( setname ); if (coords == 0) { mprinterr("Error: Could not locate COORDS set corresponding to %s\n", setname.c_str()); return Analysis::ERR; } + // If 'data' was not specified, this is the set we will cluster on. + if (dataSetname.empty()) + inputDsets.AddCopyOfSet( coords ); } - if (!cluster_dataset.empty()) { - if (control_.SetupForDataSets(cluster_dataset, coords, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) - return Analysis::ERR; - } else { - if (control_.SetupForCoordsDataSet(coords, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) + if (control_.SetupClustering(inputDsets, coords, analyzeArgs, setup.DSL(), setup.DFL(), debugIn)) return Analysis::ERR; - } control_.Info(); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 03408aff14..1fae47128f 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -92,7 +92,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.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 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 Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.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 -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 +Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.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 DataSet_float.h DataSet_integer.h DataSet_string.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 @@ -150,7 +150,7 @@ ClusterMap.o : ClusterMap.cpp AssociatedData.h ClusterMap.h Constants.h CpptrajF Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Metric_Data.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h CompactFrameArray.o : CompactFrameArray.cpp Box.h CompactFrameArray.h CoordinateInfo.h CpptrajStdio.h Matrix_3x3.h Parallel.h ReplicaDimArray.h Vec3.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h From 54479c6b5afe8ff283d1626074885765bdbe581f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 14:43:42 -0400 Subject: [PATCH 228/417] CalcResults needs to come first since the results are used in Summary --- src/Cluster/Control.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 99a6b9c51e..a5b1899480 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -958,6 +958,14 @@ int Cpptraj::Cluster::Control::Run() { int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { if (clusters_.Nclusters() == 0) return 0; timer_output_.Start(); + + // Results that require additional calculations + if (results_ != 0) { + timer_output_results_.Start(); + results_->CalcResults( clusters_ ); + timer_output_results_.Stop(); + } + // Info if (!suppressInfo_) { CpptrajFile outfile; @@ -1074,7 +1082,6 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { // Any other results if (results_ != 0) { timer_output_results_.Start(); - results_->CalcResults( clusters_ ); results_->DoOutput( clusters_ ); timer_output_results_.Stop(); } From aca0ef89d4e53cff61967336d1aed837f5adb75f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Sep 2021 14:44:52 -0400 Subject: [PATCH 229/417] Enable assignrefs test --- test/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Makefile b/test/Makefile index 90ede330a2..9c7b8b4d58 100644 --- a/test/Makefile +++ b/test/Makefile @@ -107,6 +107,7 @@ test.cluster: @-cd Test_Cluster_TrajWrites && ./RunTest.sh $(OPT) @-cd Test_Cluster_Dpeaks && ./RunTest.sh $(OPT) @-cd Test_Cluster_Nreps && ./RunTest.sh $(OPT) + @-cd Test_Cluster_AssignRefs && ./RunTest.sh $(OPT) test.ired: @-cd Test_IRED && ./RunTest.sh $(OPT) From 93d63859c0acfa19d829ef1c67b04e12aa4344a1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 10:06:58 -0400 Subject: [PATCH 230/417] Add 'nocoords' keyword to tests --- test/Test_Cluster_DataSet/RunTest.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Test_Cluster_DataSet/RunTest.sh b/test/Test_Cluster_DataSet/RunTest.sh index d564f8a478..a0f72ce8be 100755 --- a/test/Test_Cluster_DataSet/RunTest.sh +++ b/test/Test_Cluster_DataSet/RunTest.sh @@ -14,9 +14,9 @@ OneDS() { cat > ds.in < Date: Tue, 7 Sep 2021 10:09:49 -0400 Subject: [PATCH 231/417] Provide feedback when no coordinates given for results --- src/Cluster/Control.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index a5b1899480..4d422876b4 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -538,7 +538,8 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (results_ != 0) delete results_; results_ = (Results*)new Results_Coords( static_cast( coordsSet ) ); if (results_ == 0) return 1; - } + } else + mprintf("\tNo coordinates set provided for cluster results.\n"); // Initialize clusters from existing info file. Metric must already be set up. if (analyzeArgs.hasKey("readinfo") || From 0e0eb21758860489369761575b44778d27dbb2b3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 10:22:29 -0400 Subject: [PATCH 232/417] Protect tests that require netcdf --- test/Test_Cluster_AssignRefs/RunTest.sh | 2 ++ test/Test_Cluster_SymmRMSD/RunTest.sh | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/Test_Cluster_AssignRefs/RunTest.sh b/test/Test_Cluster_AssignRefs/RunTest.sh index e98ffe5b49..bfee0907e0 100755 --- a/test/Test_Cluster_AssignRefs/RunTest.sh +++ b/test/Test_Cluster_AssignRefs/RunTest.sh @@ -8,6 +8,8 @@ INPUT='-i cluster.in' TESTNAME='Clustering, assign reference names' +Requires netcdf + cat > cluster.in < cluster.in < Date: Tue, 7 Sep 2021 10:51:15 -0400 Subject: [PATCH 233/417] Start adding more in depth pairwise cache tests --- test/Test_Cluster_Cache/RunTest.sh | 68 +++++++++++++++++++ .../nosieve.mem.save.info.dat.save | 16 +++++ 2 files changed, 84 insertions(+) create mode 100755 test/Test_Cluster_Cache/RunTest.sh create mode 100644 test/Test_Cluster_Cache/nosieve.mem.save.info.dat.save diff --git a/test/Test_Cluster_Cache/RunTest.sh b/test/Test_Cluster_Cache/RunTest.sh new file mode 100755 index 0000000000..d6e65a16e1 --- /dev/null +++ b/test/Test_Cluster_Cache/RunTest.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +. ../MasterTest.sh + +CleanFiles cluster.in *.cnumvtime.dat *.info.dat *.summary.dat PW0 + +INPUT="-i cluster.in" +TESTNAME='Cluster pairwise cache tests' + +# +Cluster() { + PREFIX=$1 + if [ "$PREFIX" = 'random' ] ; then + RNG='rng setdefault marsaglia' + else + RNG='' + fi + SIEVEARG=$2 + SAVEARG=$3 + cat > cluster.in < Date: Tue, 7 Sep 2021 11:00:32 -0400 Subject: [PATCH 234/417] Add missing comma --- src/DataSet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DataSet.cpp b/src/DataSet.cpp index 2fbfdc879b..31a1dbca14 100644 --- a/src/DataSet.cpp +++ b/src/DataSet.cpp @@ -27,7 +27,7 @@ const char* DataSet::Descriptions_[] = { "pH REMD (implicit)", // PH_IMPL "parameters", // PARAMETERS "pairwise matrix (mem)", // PMATRIX_MEM - "pairwise matrix (NetCDF)" // PMATRIX_NC + "pairwise matrix (NetCDF)", // PMATRIX_NC "tensor", // TENSOR "string variable", // STRINGVAR "vector with scalar", // VECTOR_SCALAR From 722d8a3d40fa64a85b22cb9fef45b8fd6e3f2491 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 11:01:28 -0400 Subject: [PATCH 235/417] Add test for disk cache and no cache --- test/Test_Cluster_Cache/RunTest.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/Test_Cluster_Cache/RunTest.sh b/test/Test_Cluster_Cache/RunTest.sh index d6e65a16e1..ef4e992c5c 100755 --- a/test/Test_Cluster_Cache/RunTest.sh +++ b/test/Test_Cluster_Cache/RunTest.sh @@ -2,7 +2,7 @@ . ../MasterTest.sh -CleanFiles cluster.in *.cnumvtime.dat *.info.dat *.summary.dat PW0 +CleanFiles cluster.in *.cnumvtime.dat *.info.dat *.summary.dat PW0 PW1 INPUT="-i cluster.in" TESTNAME='Cluster pairwise cache tests' @@ -45,6 +45,14 @@ DoTest nosieve.mem.save.cnumvtime.dat nosieve.mem.load.cnumvtime.dat DoTest nosieve.mem.save.info.dat nosieve.mem.load.info.dat DoTest nosieve.mem.save.summary.dat nosieve.mem.load.summary.dat +# Test on-disk cache with no sieve +Cluster nosieve.disk.save " " "savepairdist pairdist PW1 pairwisecache disk" +DoTest nosieve.mem.save.info.dat.save nosieve.disk.save.info.dat + +# Test no cache, no sieve +Cluster nosieve.nocache.save " " "pairwisecache none" +DoTest nosieve.mem.save.info.dat.save nosieve.nocache.save.info.dat + # Test sieving #Cluster nosieve #Cluster sieve5 "$SIEVEARGS" From 27810fe47190fd7a3f93948960506de47327fe3a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 11:03:40 -0400 Subject: [PATCH 236/417] Add pairwise cache with sieve 5 test --- test/Test_Cluster_Cache/RunTest.sh | 11 +++++++++-- .../sieve5.mem.save.info.dat.save | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 test/Test_Cluster_Cache/sieve5.mem.save.info.dat.save diff --git a/test/Test_Cluster_Cache/RunTest.sh b/test/Test_Cluster_Cache/RunTest.sh index ef4e992c5c..2d640db80b 100755 --- a/test/Test_Cluster_Cache/RunTest.sh +++ b/test/Test_Cluster_Cache/RunTest.sh @@ -35,8 +35,6 @@ EOF #DoTest $PREFIX.summary.dat.save $PREFIX.summary.dat } -SIEVEARGS="sieve 5 bestrep cumulative includesieveincalc" - # Test in-memory cache save/load with no sieve Cluster nosieve.mem.save " " "savepairdist pairdist PW0 pairwisecache mem" Cluster nosieve.mem.load " " "loadpairdist pairdist PW0" @@ -53,6 +51,15 @@ DoTest nosieve.mem.save.info.dat.save nosieve.disk.save.info.dat Cluster nosieve.nocache.save " " "pairwisecache none" DoTest nosieve.mem.save.info.dat.save nosieve.nocache.save.info.dat +SIEVEARGS="sieve 5" +# Test in-memory cache save/load with no sieve +Cluster sieve5.mem.save "$SIEVEARGS" "savepairdist pairdist PW0 pairwisecache mem" +Cluster sieve5.mem.load "$SIEVEARGS" "loadpairdist pairdist PW0" +DoTest sieve5.mem.save.info.dat.save sieve5.mem.save.info.dat +DoTest sieve5.mem.save.cnumvtime.dat sieve5.mem.load.cnumvtime.dat +DoTest sieve5.mem.save.info.dat sieve5.mem.load.info.dat +DoTest sieve5.mem.save.summary.dat sieve5.mem.load.summary.dat + # Test sieving #Cluster nosieve #Cluster sieve5 "$SIEVEARGS" diff --git a/test/Test_Cluster_Cache/sieve5.mem.save.info.dat.save b/test/Test_Cluster_Cache/sieve5.mem.save.info.dat.save new file mode 100644 index 0000000000..55c50946c9 --- /dev/null +++ b/test/Test_Cluster_Cache/sieve5.mem.save.info.dat.save @@ -0,0 +1,17 @@ +#Clustering: 5 clusters 101 frames +#Cluster 0 has average-distance-to-centroid 1.286585 +#Cluster 1 has average-distance-to-centroid 1.055150 +#Cluster 2 has average-distance-to-centroid 1.535737 +#Cluster 3 has average-distance-to-centroid 1.714581 +#Cluster 4 has average-distance-to-centroid 1.272984 +#DBI: 0.915507 +#pSF: 81.794520 +#SSR/SST: 0.773145 +#Algorithm: HierAgglo linkage average-linkage nclusters 5 epsilon 1.79769e+308 +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +.............................................................................XXXXXXXXXXXXXXXXXXXXXXXX +...............................................................XXXXXXXXXXXXXX........................ +..XXXXXXXXXXX........................................................................................ +XX................................................................................................... +#Representative frames: 24 101 76 12 1 +#Sieve value: 5 From ad442d4aac3ee74a1344ece03dfbd1409df6f404 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 11:05:00 -0400 Subject: [PATCH 237/417] Add the remainder of the sieve pairwise cache tests --- test/Test_Cluster_Cache/RunTest.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/Test_Cluster_Cache/RunTest.sh b/test/Test_Cluster_Cache/RunTest.sh index 2d640db80b..e33b71bd14 100755 --- a/test/Test_Cluster_Cache/RunTest.sh +++ b/test/Test_Cluster_Cache/RunTest.sh @@ -52,7 +52,7 @@ Cluster nosieve.nocache.save " " "pairwisecache none" DoTest nosieve.mem.save.info.dat.save nosieve.nocache.save.info.dat SIEVEARGS="sieve 5" -# Test in-memory cache save/load with no sieve +# Test in-memory cache save/load with sieve Cluster sieve5.mem.save "$SIEVEARGS" "savepairdist pairdist PW0 pairwisecache mem" Cluster sieve5.mem.load "$SIEVEARGS" "loadpairdist pairdist PW0" DoTest sieve5.mem.save.info.dat.save sieve5.mem.save.info.dat @@ -60,6 +60,14 @@ DoTest sieve5.mem.save.cnumvtime.dat sieve5.mem.load.cnumvtime.dat DoTest sieve5.mem.save.info.dat sieve5.mem.load.info.dat DoTest sieve5.mem.save.summary.dat sieve5.mem.load.summary.dat +# Test on-disk cache with sieve +Cluster sieve5.disk.save "$SIEVEARGS" "savepairdist pairdist PW1 pairwisecache disk" +DoTest sieve5.mem.save.info.dat.save sieve5.disk.save.info.dat + +# Test no cache, with sieve +Cluster sieve5.nocache.save "$SIEVEARGS" "pairwisecache none" +DoTest sieve5.mem.save.info.dat.save sieve5.nocache.save.info.dat + # Test sieving #Cluster nosieve #Cluster sieve5 "$SIEVEARGS" From ca84d6f3a77ebde9f8ac328803dc42e018bc37f1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 11:08:36 -0400 Subject: [PATCH 238/417] Add some feedback about the pairwise cache --- src/Cluster/Control.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 4d422876b4..3faa735d2c 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -751,6 +751,11 @@ void Cpptraj::Cluster::Control::Info() const { mprintf(" if within epsilon %f of a frame (more accurate and identifies noise but slower).\n", restoreEpsilon_); } + if (cache_ == 0) + mprintf("\tPairwise distances will not be cached.\n"); + else + mprintf("\tPairwise distances will be cached: %s\n", cache_->legend()); + mprintf("\tRepresentative frames will be chosen by"); switch (bestRep_) { case BestReps::CUMULATIVE: mprintf(" lowest cumulative distance to all other frames.\n"); break; From dacbc646d9a094b795666b0c7ac8409c96e6504f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 11:10:06 -0400 Subject: [PATCH 239/417] Enable pairwise cache test --- test/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Makefile b/test/Makefile index 9c7b8b4d58..49ae0a1508 100644 --- a/test/Makefile +++ b/test/Makefile @@ -108,6 +108,7 @@ test.cluster: @-cd Test_Cluster_Dpeaks && ./RunTest.sh $(OPT) @-cd Test_Cluster_Nreps && ./RunTest.sh $(OPT) @-cd Test_Cluster_AssignRefs && ./RunTest.sh $(OPT) + @-cd Test_Cluster_Cache && ./RunTest.sh $(OPT) test.ired: @-cd Test_IRED && ./RunTest.sh $(OPT) From 2004f8f3dde091194db6fd2f2ca2cf043677a34e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 11:23:50 -0400 Subject: [PATCH 240/417] Get rid of old test code --- test/Test_Cluster_Nreps/RunTest.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/Test_Cluster_Nreps/RunTest.sh b/test/Test_Cluster_Nreps/RunTest.sh index 175ed1c076..343b2b2257 100755 --- a/test/Test_Cluster_Nreps/RunTest.sh +++ b/test/Test_Cluster_Nreps/RunTest.sh @@ -18,10 +18,6 @@ trajin ../DPDP.nc #2drms !@H= out 2drms.gnu cluster kmeans clusters 2 info clusters.2.dat summary summary.2.dat \ savepairdist pairdist PD savenreps 5 - -#\ -# singlerepout singlerep.nc \ -# repout Rep repfmt netcdf repframe EOF RunCpptraj "$TESTNAME" From 34f2a35dcb09f1cc1e377d56fd4c283c55837b45 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 11:26:09 -0400 Subject: [PATCH 241/417] Test singlerepfmt keyword --- test/Test_Cluster_TrajWrites/RunTest.sh | 2 +- test/Test_Cluster_TrajWrites/single.save | 4888 +++++++++++++++++++--- 2 files changed, 4285 insertions(+), 605 deletions(-) diff --git a/test/Test_Cluster_TrajWrites/RunTest.sh b/test/Test_Cluster_TrajWrites/RunTest.sh index 5f055dd091..f91dbabb60 100755 --- a/test/Test_Cluster_TrajWrites/RunTest.sh +++ b/test/Test_Cluster_TrajWrites/RunTest.sh @@ -19,7 +19,7 @@ run runanalysis cluster crdset CRD1 C1 :2-10 clusters 3 epsilon 4.0 \ out cnumvtime.dat summary avg.summary.dat nofit \ clusterout cluster info clusterinfo.txt \ - singlerepout single repout rep repframe lifetime \ + singlerepout single singlerepfmt mol2 repout rep repframe lifetime \ avgout Avg avgfmt restart write lifetime.dat C1[Lifetime] EOF diff --git a/test/Test_Cluster_TrajWrites/single.save b/test/Test_Cluster_TrajWrites/single.save index e66dd52361..681d71ebcb 100644 --- a/test/Test_Cluster_TrajWrites/single.save +++ b/test/Test_Cluster_TrajWrites/single.save @@ -1,604 +1,4284 @@ -Cpptraj Generated trajectory - -5.855 10.416 2.349 -5.667 9.597 1.787 -6.805 10.394 2.689 -5.639 - 11.249 1.820 -4.911 10.395 3.477 -5.340 10.883 4.353 -4.529 8.960 - 3.826 -5.388 8.385 4.173 -3.822 8.896 4.654 -4.054 8.398 2.623 - -4.044 7.449 2.767 -3.685 11.223 3.119 -3.579 11.815 2.047 -2.726 - 11.331 4.042 -2.895 10.761 4.858 -1.386 11.879 3.982 -1.490 12.905 - 3.629 -0.629 11.919 5.307 -0.439 10.926 5.712 -1.356 12.305 6.022 - 0.701 12.599 5.371 0.978 13.906 5.580 0.290 14.730 5.693 2.344 - 14.106 5.595 2.868 14.966 5.673 3.042 12.934 5.386 4.384 12.574 - 5.558 5.049 13.356 5.893 4.766 11.233 5.434 5.786 10.947 5.643 - 3.807 10.249 5.164 4.192 9.244 5.260 2.463 10.635 5.220 1.755 - 9.821 5.156 2.012 11.962 5.298 -0.563 11.340 2.820 0.166 12.081 - 2.164 -0.633 10.024 2.608 -1.240 9.497 3.220 -0.204 9.244 1.465 - 0.794 9.651 1.304 0.181 7.816 1.841 0.164 7.135 0.990 1.521 - 7.632 2.547 1.632 8.438 3.272 1.599 6.626 2.959 2.210 7.661 - 1.703 -0.654 7.336 2.871 -1.499 7.032 2.531 -1.015 9.255 0.177 - -2.014 8.549 0.059 -0.576 10.087 -0.770 0.286 10.577 -0.576 -1.221 - 10.269 -2.055 -2.239 10.637 -1.930 -0.447 11.263 -2.916 -0.821 11.217 - -3.938 0.605 11.002 -3.021 -0.374 12.653 -2.369 0.661 13.149 -1.654 - 1.629 12.689 -1.520 0.390 14.406 -1.152 1.041 14.800 -0.488 -0.956 - 14.658 -1.322 -1.794 15.725 -0.974 -1.381 16.478 -0.320 -3.140 15.677 - -1.356 -3.713 16.559 -1.114 -3.712 14.529 -1.919 -4.779 14.426 -2.049 - -2.836 13.511 -2.314 -3.113 12.597 -2.818 -1.445 13.621 -2.158 -1.340 - 8.998 -2.884 -2.431 8.476 -3.102 -0.248 8.312 -3.230 0.623 8.686 - -2.879 -0.141 6.984 -3.800 -0.884 6.817 -4.580 1.141 6.992 -4.628 - 1.941 7.351 -3.980 1.079 7.806 -5.349 1.592 5.683 -5.270 1.861 - 4.904 -4.558 2.470 5.933 -5.866 0.599 5.252 -6.340 0.694 5.815 - -7.452 -0.343 4.488 -6.038 -0.153 5.941 -2.692 0.296 6.294 -1.604 - -0.935 4.886 -2.933 -1.185 4.696 -3.893 -1.409 3.965 -1.919 -1.086 - 4.389 -0.968 -2.931 3.852 -1.927 -3.264 3.357 -2.839 -3.387 4.842 - -1.887 -3.425 3.017 -0.755 -4.212 2.076 -0.829 -3.029 3.296 0.489 - -2.254 3.940 0.553 -3.355 2.823 1.319 -0.795 2.593 -2.159 -0.923 - 1.953 -3.200 0.030 2.142 -1.212 0.202 2.742 -0.418 0.664 0.840 - -1.174 1.735 0.991 -1.040 0.563 0.356 -2.145 0.018 -0.073 -0.141 - 0.215 0.130 1.055 -0.726 -1.059 -0.647 -0.955 -0.996 -1.629 -1.279 - -2.117 0.174 -1.351 -1.740 1.194 -2.716 -2.524 -0.139 -3.426 -1.700 - -0.064 -3.177 -3.267 0.512 -2.811 -3.219 -1.495 -2.343 -4.201 -1.425 - -2.350 -2.632 -2.289 -4.249 -3.505 -1.916 -4.255 -3.925 -2.922 -4.705 - -2.515 -1.944 -4.915 -4.442 -0.913 -4.911 -4.004 0.085 -4.306 -5.342 - -0.832 -6.287 -4.750 -1.346 -6.734 -5.390 -0.704 -6.917 -3.990 -1.133 - -6.414 -5.136 -2.270 -0.299 -3.277 0.078 0.074 -3.589 -1.051 0.135 - -3.899 1.177 -0.144 -3.530 2.075 0.891 -5.131 1.084 1.703 -5.084 - 0.358 1.439 -5.468 2.468 0.584 -5.540 3.141 2.100 -4.626 2.674 - 2.254 -6.711 2.626 2.116 -7.640 3.598 1.448 -7.526 4.439 2.987 - -8.695 3.408 2.772 -9.599 3.804 3.801 -8.507 2.309 4.887 -9.237 - 1.813 5.212 -10.205 2.164 5.441 -8.779 0.611 6.215 -9.373 0.149 - 4.908 -7.659 -0.037 5.387 -7.228 -0.904 3.896 -6.908 0.573 3.608 - -5.966 0.131 3.302 -7.285 1.789 0.055 -6.336 0.678 -0.957 -6.634 - 1.310 0.484 -6.936 -0.435 1.389 -6.677 -0.799 -0.215 -8.046 -1.050 - -1.279 -7.932 -0.845 0.153 -8.237 -2.518 1.228 -8.168 -2.683 -0.270 - -9.587 -3.090 -1.353 -9.692 -3.027 -0.207 -9.586 -4.178 0.317 -10.390 - -2.644 -0.595 -7.309 -3.271 -0.300 -6.410 -3.109 0.222 -9.312 -0.326 - 1.382 -9.709 -0.424 -0.678 -10.106 0.257 -1.644 -9.811 0.287 -0.326 - -11.332 0.944 0.711 -11.236 1.266 -1.262 -11.400 2.147 -2.232 -11.684 - 1.738 -1.364 -10.421 2.616 -0.864 -12.330 3.248 -0.080 -11.914 4.268 - 0.258 -10.904 4.446 0.426 -12.992 4.967 1.153 -12.953 5.667 -0.151 - -14.155 4.501 -0.160 -15.441 5.055 0.237 -15.589 6.049 -0.901 -16.410 - 4.368 -0.998 -17.410 4.764 -1.664 -16.141 3.226 -2.151 -17.003 2.795 - -1.687 -14.812 2.786 -2.219 -14.549 1.884 -1.005 -13.770 3.435 -0.438 - -12.504 -0.020 -1.476 -12.865 -0.571 0.774 -12.994 -0.292 1.545 -12.536 - 0.172 0.970 -13.771 -1.499 0.518 -13.301 -2.372 2.482 -13.852 -1.693 - 2.758 -14.556 -2.478 2.908 -14.369 -0.833 3.183 -12.500 -1.779 3.434 - -12.126 -0.787 2.588 -11.726 -2.265 4.529 -12.639 -2.483 4.385 -13.099 - -3.461 5.133 -13.336 -1.901 5.166 -11.262 -2.647 5.161 -10.726 -1.698 - 4.550 -10.662 -3.316 6.501 -11.172 -3.260 6.336 -11.590 -4.164 6.870 - -10.235 -3.332 7.166 -11.648 -2.667 0.497 -15.192 -1.226 -0.239 -15.740 - -2.044 0.957 -15.750 -0.104 1.711 -15.316 0.408 0.441 -16.948 0.527 - -0.377 -17.395 -0.038 1.109 -17.803 0.630 -0.044 -16.620 1.446 - 0.094 9.538 3.050 0.611 9.534 2.183 -0.619 10.245 3.161 0.770 - 9.617 3.797 -0.541 8.226 3.251 -0.984 8.203 4.247 -1.562 7.976 - 2.144 -1.995 7.009 2.399 -0.992 7.923 1.216 -2.557 8.974 2.103 - -3.248 8.593 1.556 0.433 7.057 3.261 1.432 6.950 2.552 0.077 - 5.986 3.974 -0.799 6.053 4.474 0.614 4.641 4.021 1.588 4.752 - 4.496 -0.323 3.832 4.913 -1.204 3.587 4.319 -0.521 4.445 5.792 - 0.202 2.565 5.510 1.503 2.353 5.813 2.252 3.013 5.402 1.710 - 1.104 6.364 2.593 0.616 6.409 0.503 0.471 6.577 0.164 -0.778 - 7.113 0.913 -1.480 7.448 -1.200 -1.002 7.335 -1.515 -1.910 7.827 - -2.194 -0.125 6.886 -3.232 -0.415 6.953 -1.803 1.045 6.224 -2.501 - 1.752 5.800 -0.453 1.421 6.134 0.891 3.987 2.675 1.990 3.531 - 2.366 -0.056 4.222 1.764 -0.844 4.638 2.240 -0.220 3.724 0.413 - -0.273 2.636 0.394 -1.540 4.254 -0.140 -1.587 3.958 -1.188 -2.752 - 3.590 0.508 -2.516 3.353 1.546 -3.587 4.278 0.638 -3.061 2.663 - 0.025 -1.654 5.655 -0.255 -0.823 6.106 -0.088 0.961 4.190 -0.427 - 1.272 5.378 -0.461 1.544 3.282 -1.213 1.222 2.325 -1.181 2.415 - 3.605 -2.325 2.586 4.679 -2.405 3.735 2.844 -2.243 3.436 1.802 - -2.122 4.257 3.096 -1.320 4.658 3.097 -3.391 4.905 2.261 -4.425 - 4.387 1.332 -4.608 5.767 2.843 -5.334 6.161 2.380 -6.140 6.193 - 4.071 -4.868 7.142 5.012 -5.283 7.738 4.788 -6.155 7.287 6.239 - -4.625 8.019 6.974 -4.925 6.603 6.411 -3.415 6.775 7.288 -2.810 - 5.723 5.442 -2.919 5.275 5.526 -1.939 5.502 4.260 -3.643 1.606 - 3.360 -3.591 1.544 4.238 -4.449 0.949 2.232 -3.870 1.089 1.436 - -3.265 -0.067 1.969 -4.869 -0.058 2.723 -5.656 0.139 0.622 -5.556 - -0.310 -0.218 -5.026 1.178 0.426 -5.823 -0.497 0.706 -6.940 0.102 - 1.352 -7.581 -1.467 1.134 -6.684 -0.713 -0.620 -7.655 0.337 -1.234 - -7.941 -1.797 -1.242 -7.663 -1.421 1.956 -4.173 -1.602 1.375 -3.105 - -2.219 2.935 -4.605 -1.898 3.369 -5.459 -3.356 3.574 -3.975 -3.329 - 3.502 -2.887 -3.288 5.097 -4.050 -3.386 5.463 -5.072 -2.302 5.410 - -3.707 -4.335 5.705 -3.129 -5.390 6.154 -3.573 -4.099 5.882 -1.827 - -3.238 5.602 -1.379 -4.714 6.366 -1.188 -4.654 2.999 -4.523 -4.815 - 2.708 -5.706 -5.453 2.563 -3.547 -5.107 2.758 -2.618 -6.672 1.799 - -3.718 -6.656 1.232 -4.649 -7.531 2.457 -3.589 -6.735 0.811 -2.562 - -6.507 1.199 -1.418 -6.927 -0.487 -2.805 -7.223 -0.729 -3.740 -6.680 - -1.603 -1.914 -7.051 -1.491 -0.896 -7.449 -2.792 -2.483 -7.298 -3.577 - -1.742 -6.891 -3.037 -3.387 -8.910 -2.722 -2.916 -9.046 -1.934 -3.657 - -9.510 -2.424 -2.056 -9.552 -3.971 -3.515 -8.998 -4.197 -4.426 -10.610 - -3.794 -3.708 -9.569 -5.154 -2.552 -9.892 -4.758 -1.589 -8.508 -5.394 - -2.475 -10.318 -6.338 -3.000 -10.417 -7.037 -2.277 -11.142 -6.041 -3.502 - -9.791 -6.871 -3.678 -5.201 -1.926 -1.750 -4.555 -2.611 -2.539 -4.616 - -1.198 -0.796 -5.247 -0.606 -0.274 -3.231 -1.392 -0.418 -2.613 -1.585 - -1.294 -2.902 -0.029 0.185 -3.677 0.216 0.911 -2.970 0.679 -0.641 - -1.521 0.060 0.750 -1.250 0.315 2.050 -1.933 0.418 2.880 0.112 - 0.391 2.269 0.473 0.452 3.210 0.802 -0.015 1.145 2.181 -0.054 - 0.903 2.937 0.029 1.670 2.548 -0.162 -0.444 3.601 -0.091 -0.675 - 1.613 -0.374 -1.464 1.916 -0.496 -2.494 0.251 -0.411 -1.145 -0.401 - -0.554 -1.994 -0.202 -0.094 0.146 -3.046 -2.453 0.658 -3.430 -2.360 - 1.822 -2.119 -3.370 0.373 -1.523 -3.309 -0.441 -1.592 -4.336 1.315 - -2.200 -4.320 2.220 -1.611 -5.820 0.964 -1.080 -6.336 1.765 -3.013 - -6.422 0.937 -3.776 -5.732 1.299 -3.209 -6.740 -0.087 -2.984 -7.304 - 1.577 -1.047 -6.168 -0.280 -0.327 -5.579 -0.517 -0.181 -3.979 1.761 - 0.749 -4.231 0.997 -0.025 -3.441 2.973 -0.845 -3.260 3.533 1.292 - -3.507 3.573 2.043 -3.032 2.940 1.312 -2.654 4.838 1.229 -3.325 - 5.692 0.596 -1.832 4.805 2.637 -2.021 5.116 3.135 -0.932 4.488 - 2.589 -0.393 3.728 4.402 -0.615 4.938 4.979 0.182 4.713 4.786 - -1.581 5.846 5.941 -1.694 6.630 6.787 -1.063 6.403 6.131 -2.815 - 7.447 7.050 -2.907 8.007 5.072 -3.718 7.599 5.244 -4.665 8.089 - 3.866 -3.531 6.914 3.020 -4.166 7.135 3.677 -2.442 6.049 1.755 - -4.918 3.906 1.109 -5.733 4.561 2.863 -5.257 3.243 3.279 -4.570 - 2.630 3.641 -6.440 3.550 3.143 -6.962 4.368 3.676 -7.291 2.284 - 4.350 -8.128 2.468 4.032 -6.747 1.409 2.296 -7.747 1.819 1.860 - -6.954 1.211 1.687 -8.028 2.678 2.224 -8.986 0.932 2.737 -9.863 - 1.328 2.779 -8.728 0.030 0.782 -9.312 0.553 0.339 -8.356 0.271 - 0.299 -9.628 1.478 0.581 -10.446 -0.362 0.798 -11.310 0.113 -0.387 - -10.508 -0.642 1.080 -10.388 -1.239 4.989 -6.185 4.210 5.324 -6.797 - 5.221 5.718 -5.180 3.719 5.389 -4.680 2.906 6.998 -4.811 4.287 - 7.270 -3.773 4.093 7.016 -4.990 5.362 7.755 -5.399 3.768 - 2.568 12.359 0.093 2.452 12.648 1.053 3.439 11.847 0.105 2.494 - 13.100 -0.590 1.474 11.438 -0.252 0.582 12.012 -0.503 1.787 10.604 - -1.491 1.077 9.815 -1.739 2.716 10.033 -1.503 1.805 11.512 -2.570 - 1.241 11.192 -3.278 1.134 10.441 0.846 1.921 9.578 1.229 -0.110 - 10.519 1.325 -0.735 11.213 0.940 -0.621 9.627 2.346 0.068 9.645 - 3.191 -1.956 10.184 2.831 -2.663 10.224 2.002 -1.757 11.174 3.244 - -2.634 9.375 3.890 -2.145 8.563 4.854 -1.093 8.334 4.942 -3.132 - 8.054 5.675 -2.854 7.525 6.489 -4.344 8.533 5.220 -5.643 8.330 - 5.701 -5.789 7.755 6.604 -6.713 9.064 5.176 -7.721 8.818 5.477 - -6.491 9.998 4.157 -7.393 10.442 3.762 -5.202 10.056 3.614 -5.184 - 10.440 2.605 -4.072 9.407 4.136 -0.715 8.153 1.982 -0.218 7.216 - 2.603 -1.234 7.924 0.773 -1.580 8.695 0.219 -1.399 6.651 0.102 - -0.917 5.844 0.653 -2.870 6.277 -0.056 -3.030 5.469 -0.770 -3.541 - 5.857 1.248 -3.809 6.703 1.880 -4.443 5.269 1.077 -2.799 5.308 - 1.828 -3.690 7.333 -0.506 -3.266 7.824 -1.213 -0.663 6.669 -1.230 - -1.249 7.058 -2.238 0.579 6.183 -1.170 0.987 5.926 -0.282 1.390 - 5.967 -2.351 1.289 6.861 -2.966 2.850 5.749 -1.967 2.926 4.866 - -1.331 3.252 6.621 -1.451 3.685 5.491 -3.180 4.095 6.517 -3.959 - 3.980 7.581 -3.815 4.945 6.041 -4.939 5.285 6.671 -5.651 4.967 - 4.661 -4.962 5.436 3.697 -5.863 5.928 3.944 -6.792 5.207 2.346 - -5.576 5.496 1.606 -6.309 4.642 1.995 -4.345 4.329 0.973 -4.184 - 4.190 2.949 -3.425 3.687 2.596 -2.537 4.325 4.309 -3.746 0.931 - 4.806 -3.222 0.925 4.943 -4.444 0.605 3.706 -2.540 0.707 3.741 - -1.536 -0.331 2.725 -3.049 -0.332 2.973 -4.111 0.262 1.370 -2.672 - -0.204 1.032 -1.747 1.351 1.338 -2.630 -0.127 0.360 -3.748 0.217 - 0.828 -4.670 -1.203 0.202 -3.811 0.476 -1.024 -3.557 1.616 -1.167 - -4.050 -0.193 -1.873 -2.929 -1.742 2.905 -2.507 -1.921 3.031 -1.298 - -2.679 3.143 -3.428 -2.592 2.881 -4.399 -4.065 3.441 -3.126 -3.924 - 4.141 -2.303 -4.665 4.225 -4.290 -5.361 3.572 -4.819 -3.897 4.623 - -4.952 -5.484 5.421 -3.826 -6.270 5.341 -2.885 -5.364 6.603 -4.435 - -4.742 6.710 -5.224 -5.764 7.431 -4.017 -4.751 2.219 -2.533 -4.391 - 1.067 -2.764 -5.723 2.506 -1.664 -5.876 3.459 -1.368 -6.519 1.488 - -1.007 -7.048 0.837 -1.703 -7.268 1.904 -0.333 -5.648 0.555 -0.179 - -4.817 1.073 0.564 -5.761 -0.774 -0.237 -6.507 -1.100 -0.834 -5.146 - -1.716 0.677 -5.127 -1.309 1.688 -6.085 -2.918 0.627 -5.593 -3.747 - 1.138 -6.305 -3.102 -0.424 -7.423 -2.738 1.337 -7.928 -1.952 0.775 - -7.281 -2.388 2.359 -8.255 -4.008 1.184 -7.958 -4.694 1.977 -8.058 - -4.466 0.215 -9.743 -3.723 1.370 -10.011 -3.149 0.483 -9.856 -3.029 - 2.202 -10.597 -4.915 1.486 -11.544 -4.669 1.236 -10.195 -5.577 0.839 - -10.523 -5.364 2.388 -3.703 -2.135 0.433 -3.398 -2.501 -0.699 -2.837 - -2.144 1.450 -3.266 -1.889 2.328 -1.470 -2.612 1.341 -0.911 -2.411 - 0.427 -0.697 -1.880 2.434 -1.170 -2.205 3.360 -0.759 -0.796 2.339 - 0.754 -2.115 2.707 1.310 -2.442 3.896 0.743 -2.414 4.814 2.671 - -2.617 3.744 3.216 -2.811 4.572 3.049 -2.277 2.461 4.324 -2.384 - 1.893 5.241 -2.557 2.436 4.474 -2.009 0.552 5.507 -1.980 0.239 - 3.344 -1.684 -0.207 3.423 -1.523 -1.272 2.078 -1.783 0.383 1.227 - -1.561 -0.243 1.847 -2.044 1.743 -1.382 -4.125 1.481 -1.330 -4.688 - 2.572 -1.508 -4.816 0.346 -1.463 -4.384 -0.566 -1.144 -6.219 0.341 - -1.811 -6.708 1.050 -1.337 -6.932 -0.994 -1.010 -7.970 -0.932 -2.837 - -6.988 -1.269 -3.049 -5.931 -1.426 -3.093 -7.434 -2.230 -3.292 -7.470 - -0.403 -0.665 -6.342 -2.085 -1.029 -6.740 -2.880 0.221 -6.531 0.939 - 1.272 -6.110 0.461 0.150 -7.251 2.061 -0.737 -7.537 2.451 1.294 - -7.912 2.654 1.897 -7.087 3.034 0.744 -8.605 3.897 0.316 -9.576 - 3.649 -0.095 -8.049 4.316 1.759 -8.856 4.966 2.102 -7.987 5.943 - 1.636 -7.020 6.062 3.270 -8.437 6.526 3.612 -8.109 7.418 3.612 - -9.699 6.083 4.472 -10.734 6.468 5.116 -10.835 7.330 4.516 -11.949 - 5.774 5.268 -12.664 6.073 3.627 -12.202 4.722 3.624 -13.085 4.101 - 2.796 -11.160 4.294 2.126 -11.432 3.492 2.706 -9.964 5.023 2.205 - -8.747 1.766 1.717 -9.720 1.196 3.499 -8.429 1.849 3.702 -7.593 - 2.377 4.555 -9.185 1.206 4.115 -9.869 0.480 5.490 -8.187 0.529 - 6.294 -8.811 0.140 5.764 -7.357 1.181 4.791 -7.537 -0.661 3.921 - -7.031 -0.242 4.547 -8.327 -1.371 5.603 -6.473 -1.395 5.691 -5.654 - -0.682 4.900 -6.168 -2.171 6.977 -6.935 -1.870 6.871 -7.894 -2.376 - 7.521 -7.292 -0.995 7.630 -5.936 -2.731 7.160 -5.992 -3.623 7.739 - -5.068 -2.227 8.508 -6.273 -3.099 5.332 -10.144 2.097 5.355 -11.277 - 1.622 5.832 -9.732 3.263 5.563 -8.789 3.506 6.933 -10.297 4.017 - 7.756 -9.583 3.987 6.709 -10.350 5.082 7.408 -11.182 3.594 - -3.531 2.565 1.736 -2.805 2.412 1.051 -4.292 1.941 1.507 -3.754 - 3.536 1.573 -2.911 2.285 3.040 -3.571 2.324 3.907 -2.717 0.776 - 3.156 -3.696 0.300 3.198 -2.209 0.584 4.101 -1.971 0.264 2.074 - -1.857 -0.687 2.133 -1.656 3.027 3.479 -1.653 3.851 4.390 -0.616 - 2.972 2.643 -0.649 2.273 1.915 0.596 3.764 2.692 0.663 4.252 - 3.665 1.887 2.953 2.618 2.059 2.554 1.619 1.759 2.069 3.243 - 3.135 3.559 3.174 3.472 3.697 4.476 2.991 3.471 5.416 4.632 - 4.442 4.554 4.855 4.822 5.463 5.252 4.603 3.332 6.482 5.073 - 2.857 7.187 5.457 3.579 6.775 5.091 1.488 7.706 5.545 1.183 - 5.783 4.609 0.624 5.864 4.564 -0.452 4.503 4.245 1.060 3.776 - 3.877 0.352 4.251 4.144 2.438 0.676 4.945 1.735 1.199 6.019 - 2.024 0.114 4.693 0.551 -0.235 3.787 0.272 -0.151 5.614 -0.536 - 0.777 6.139 -0.759 -0.344 4.797 -1.811 -0.577 5.525 -2.588 0.800 - 3.883 -2.243 1.724 4.402 -1.990 0.730 2.953 -1.680 0.782 3.757 - -3.326 -1.369 3.830 -1.765 -1.232 3.189 -2.467 -1.224 6.649 -0.233 - -2.245 6.218 0.299 -0.918 7.894 -0.608 0.028 8.091 -0.902 -1.784 - 8.979 -0.193 -1.796 9.144 0.885 -1.267 10.268 -0.824 -1.997 11.026 - -0.542 -1.192 10.161 -1.906 0.035 10.821 -0.338 1.178 10.881 -1.057 - 1.367 10.693 -2.103 2.205 11.262 -0.216 3.169 11.309 -0.513 1.767 - 11.527 1.066 2.393 12.114 2.172 3.447 12.346 2.208 1.587 12.377 - 3.287 2.032 12.843 4.154 0.211 12.119 3.296 -0.407 12.333 4.155 - -0.386 11.579 2.150 -1.450 11.405 2.199 0.364 11.328 0.990 -3.223 - 8.760 -0.636 -4.157 8.951 0.140 -3.449 8.378 -1.895 -2.606 8.302 - -2.446 -4.655 7.880 -2.525 -5.572 7.882 -1.935 -4.945 8.595 -3.842 - -4.096 8.481 -4.516 -4.928 9.670 -3.663 -6.203 8.141 -4.577 -6.198 - 7.051 -4.596 -6.175 8.464 -5.618 -7.479 8.757 -4.021 -7.676 8.847 - -2.790 -8.319 9.181 -4.844 -4.265 6.423 -2.724 -3.358 6.062 -3.471 - -5.025 5.590 -2.010 -5.767 6.005 -1.465 -5.061 4.143 -2.082 -4.210 - 3.715 -1.553 -6.373 3.787 -1.387 -7.254 4.082 -1.957 -6.411 4.212 - -0.384 -6.343 2.295 -1.088 -5.820 1.816 -0.085 -6.774 1.536 -2.097 - -7.009 1.880 -3.017 -6.773 0.531 -1.994 -4.969 3.706 -3.537 -5.802 - 4.049 -4.373 -3.885 2.985 -3.832 -3.182 3.026 -3.108 -3.571 2.045 - -4.889 -2.995 2.533 -5.675 -4.516 1.834 -5.390 -3.159 0.651 -4.439 - -3.806 0.060 -3.577 -2.211 0.049 -5.160 -1.717 0.611 -5.839 -1.729 - -1.292 -4.900 -2.606 -1.826 -4.532 -1.090 -1.921 -6.134 -1.753 -2.017 - -6.994 -0.829 -2.927 -5.806 0.116 -1.121 -6.619 0.850 -1.119 -5.814 - -0.189 -0.082 -6.743 0.904 -1.696 -7.793 0.182 -1.871 -8.591 1.395 - -2.576 -7.379 1.881 -0.743 -8.475 2.696 -0.552 -7.777 1.307 0.158 - -8.693 2.427 -1.247 -9.745 1.701 -1.571 -10.368 2.978 -0.518 -10.175 - 2.996 -2.054 -9.532 -0.877 -1.467 -3.651 -0.060 -0.616 -3.303 -1.183 - -2.423 -2.771 -2.099 -2.817 -2.929 -0.361 -2.916 -1.684 0.624 -2.477 - -1.840 -0.814 -2.387 -0.326 -1.794 -2.802 -0.092 -0.890 -1.305 -0.434 - 0.091 -2.741 0.811 -0.299 -3.249 2.001 -1.293 -3.564 2.281 0.820 - -3.276 2.810 0.827 -3.492 3.797 1.924 -2.754 2.167 3.237 -2.533 - 2.601 3.499 -2.869 3.593 4.223 -2.211 1.661 5.214 -2.056 2.062 - 3.862 -1.928 0.338 4.544 -1.549 -0.408 2.504 -1.920 -0.002 2.276 - -1.563 -0.996 1.528 -2.492 0.830 -0.121 -4.418 -1.714 -1.011 -5.181 - -2.085 1.081 -4.909 -1.404 1.749 -4.153 -1.352 1.446 -6.272 -1.075 - 0.761 -6.963 -1.566 2.840 -6.706 -1.521 3.586 -5.921 -1.395 3.515 - -7.955 -0.963 4.312 -8.324 -1.609 3.913 -7.751 0.031 2.702 -8.658 - -0.779 2.723 -6.881 -2.915 2.269 -6.076 -3.176 1.388 -6.387 0.442 - 2.217 -5.783 1.119 0.570 -7.356 0.860 0.120 -7.916 0.150 0.569 - -7.827 2.230 0.927 -7.063 2.919 -0.829 -8.251 2.674 -1.215 -9.011 - 1.995 -1.521 -7.435 2.465 -1.070 -8.758 4.059 -0.846 -8.003 5.158 - -0.445 -7.000 5.172 -0.993 -8.848 6.241 -0.755 -8.663 7.205 -1.537 - -10.056 5.856 -2.059 -11.127 6.592 -2.003 -11.101 7.670 -2.486 -12.300 - 5.959 -2.892 -13.167 6.460 -2.515 -12.270 4.559 -2.862 -13.138 4.019 - -2.137 -11.175 3.773 -2.357 -11.138 2.717 -1.572 -10.074 4.438 1.587 - -8.949 2.375 1.303 -10.072 1.963 2.668 -8.698 3.116 2.782 -7.778 - 3.516 3.603 -9.748 3.468 3.847 -10.468 2.687 4.841 -9.085 4.065 - 5.442 -9.890 4.488 4.428 -8.435 4.836 5.799 -8.483 3.041 5.432 - -7.581 2.553 6.051 -9.244 2.302 7.122 -8.165 3.733 6.952 -7.181 - 4.171 7.900 -8.090 2.973 7.746 -9.009 4.840 7.805 -10.030 4.462 - 7.001 -8.961 5.634 9.018 -8.373 5.213 9.691 -8.538 4.478 8.882 - -7.377 5.315 9.421 -8.825 6.021 3.023 -10.633 4.562 3.109 -11.857 - 4.502 2.520 -10.056 5.656 2.258 -9.102 5.452 2.124 -10.787 6.843 - 3.017 -11.340 7.133 1.940 -10.009 7.583 1.189 -11.334 6.721 - -1.136 7.169 4.585 -0.230 6.899 4.231 -1.507 6.298 4.937 -1.549 - 7.452 3.707 -0.845 8.217 5.575 -1.765 8.697 5.909 -0.322 7.654 - 6.893 -1.256 7.277 7.310 0.023 8.473 7.523 0.628 6.615 6.803 - 0.823 6.338 7.701 0.095 9.277 5.019 -0.308 10.417 4.796 1.380 - 8.972 4.820 1.682 8.105 5.241 2.357 9.844 4.201 2.088 10.850 - 4.521 3.736 9.398 4.679 4.018 8.382 4.403 3.701 9.354 5.768 - 4.817 10.386 4.377 5.036 11.399 5.245 4.580 11.628 6.197 6.063 - 12.171 4.738 6.429 12.966 5.243 6.396 11.764 3.462 7.229 12.390 - 2.527 7.891 13.184 2.836 7.441 11.728 1.312 8.122 12.263 0.667 - 6.569 10.682 0.987 6.715 10.232 0.016 5.652 10.100 1.870 4.988 - 9.301 1.574 5.607 10.620 3.173 2.288 9.779 2.682 2.418 10.785 - 1.988 1.939 8.590 2.185 1.912 7.822 2.840 1.681 8.303 0.788 - 2.138 9.005 0.090 2.278 6.941 0.447 1.878 6.651 -0.525 3.795 - 6.978 0.289 4.080 7.781 -0.391 4.253 7.037 1.276 4.114 6.037 - -0.159 1.934 5.835 1.252 1.047 5.579 0.987 0.177 8.348 0.559 - -0.546 7.710 1.322 -0.254 9.139 -0.426 0.468 9.380 -1.090 -1.615 - 9.577 -0.659 -2.059 9.861 0.295 -1.549 10.759 -1.622 -2.523 11.241 - -1.700 -1.293 10.382 -2.612 -0.617 11.835 -1.164 0.510 12.258 -1.780 - 0.790 11.871 -2.748 1.139 13.253 -1.057 2.087 13.551 -1.236 0.392 - 13.610 0.047 0.533 14.559 1.066 1.366 15.245 1.020 -0.493 14.685 - 2.010 -0.529 15.450 2.773 -1.642 13.892 1.902 -2.245 13.985 2.793 - -1.758 12.911 0.911 -2.576 12.210 0.833 -0.760 12.789 -0.070 -2.510 - 8.487 -1.229 -3.663 8.460 -0.803 -2.078 7.697 -2.216 -1.094 7.723 - -2.440 -2.731 6.754 -3.101 -3.780 7.005 -3.256 -2.209 6.836 -4.532 - -1.145 6.616 -4.451 -2.361 7.880 -4.808 -2.794 6.050 -5.703 -2.681 - 4.980 -5.529 -2.216 6.356 -6.575 -4.224 6.344 -6.133 -4.451 6.546 - -7.345 -5.100 6.433 -5.246 -2.555 5.339 -2.569 -1.441 4.839 -2.427 - -3.704 4.698 -2.342 -4.620 5.116 -2.422 -3.811 3.342 -1.842 -2.851 - 3.199 -1.347 -4.884 3.425 -0.761 -5.873 3.547 -1.204 -4.804 4.229 - -0.029 -4.914 2.217 0.165 -4.090 1.310 0.261 -6.038 1.960 0.836 - -6.865 2.457 0.535 -5.986 1.160 1.450 -4.091 2.326 -2.940 -4.948 - 2.437 -3.813 -3.157 1.402 -3.181 -2.462 1.310 -2.454 -3.102 0.606 - -4.390 -2.131 0.829 -4.833 -3.691 1.098 -5.165 -3.417 -0.839 -4.032 - -4.411 -1.025 -3.333 -2.589 -1.768 -4.515 -1.741 -1.413 -4.933 -2.835 - -3.185 -4.341 -3.922 -3.258 -4.357 -2.198 -4.048 -5.427 -2.743 -3.829 - -6.345 -2.408 -5.036 -5.018 -0.689 -3.944 -5.629 -0.255 -4.497 -4.796 - -0.426 -2.895 -5.499 -0.198 -4.455 -6.981 0.888 -4.483 -6.898 -0.455 - -3.701 -7.725 -0.686 -5.829 -7.432 -1.769 -5.883 -7.320 -0.168 -6.523 - -6.770 -0.337 -6.066 -8.841 -0.766 -5.363 -9.425 0.640 -6.067 -9.094 - -0.680 -6.955 -9.177 -2.316 -3.583 -2.967 -1.104 -3.479 -2.789 -3.086 - -4.259 -2.111 -4.042 -4.408 -2.398 -2.660 -4.723 -0.806 -1.773 -4.173 - -0.491 -3.781 -4.541 0.213 -4.708 -4.878 -0.251 -4.005 -3.496 0.426 - -3.706 -5.301 1.498 -4.777 -5.872 2.095 -5.779 -5.893 1.693 -4.422 - -6.275 3.367 -5.015 -6.753 4.030 -3.130 -5.896 3.670 -2.402 -5.964 - 4.864 -2.695 -6.508 5.750 -1.163 -5.318 4.954 -0.602 -5.556 5.846 - -0.698 -4.645 3.819 0.234 -4.099 3.823 -1.394 -4.629 2.604 -1.003 - -4.139 1.724 -2.646 -5.255 2.500 -2.213 -6.168 -0.976 -3.013 -7.069 - -1.218 -0.891 -6.350 -0.964 -0.271 -5.562 -0.841 -0.281 -7.635 -1.240 - -1.019 -8.323 -1.654 0.778 -7.545 -2.335 1.691 -7.285 -1.798 1.171 - -8.916 -2.879 0.264 -9.520 -2.888 1.666 -8.751 -3.835 1.895 -9.323 - -2.174 0.346 -6.673 -3.355 -0.482 -6.316 -3.026 0.319 -8.268 0.007 - 1.367 -7.813 0.460 -0.443 -9.226 0.541 -1.228 -9.553 -0.004 0.109 - -10.119 1.539 0.633 -9.487 2.256 -1.083 -10.751 2.252 -1.654 -11.406 - 1.595 -1.708 -9.957 2.662 -0.825 -11.501 3.519 -1.206 -11.147 4.767 - -1.773 -10.248 4.958 -1.031 -12.172 5.676 -1.328 -12.057 6.635 -0.564 - -13.288 5.012 -0.381 -14.593 5.485 -0.776 -14.804 6.468 -0.032 -15.576 - 4.551 0.074 -16.611 4.840 0.262 -15.164 3.246 0.665 -15.818 2.487 - 0.106 -13.853 2.779 0.138 -13.779 1.702 -0.341 -12.869 3.675 0.967 - -11.236 0.962 0.512 -11.774 -0.045 2.183 -11.491 1.449 2.382 -10.908 - 2.250 3.205 -12.225 0.731 2.919 -12.334 -0.315 4.596 -11.596 0.756 - 5.288 -12.253 0.230 5.008 -11.538 1.764 4.514 -10.253 0.036 3.961 - -9.649 0.755 4.034 -10.264 -0.942 5.926 -9.732 -0.217 5.845 -8.960 - -0.983 6.557 -10.516 -0.635 6.492 -9.175 1.086 6.554 -9.971 1.828 - 5.905 -8.350 1.489 7.846 -8.630 0.903 8.429 -9.239 0.347 7.716 - -7.667 0.625 8.324 -8.561 1.790 3.325 -13.621 1.324 3.535 -14.592 - 0.600 3.344 -13.768 2.651 3.119 -13.016 3.286 3.842 -14.945 3.333 - 3.704 -15.842 2.728 4.917 -14.861 3.495 3.323 -15.006 4.289 - 0.301 5.095 3.481 1.218 5.143 3.060 0.067 4.167 3.804 -0.318 - 5.321 2.715 0.221 6.146 4.506 -0.731 6.060 5.029 1.297 5.946 - 5.570 1.131 4.964 6.013 1.176 6.672 6.374 2.556 5.824 4.946 - 3.223 6.038 5.603 0.263 7.489 3.790 -0.752 7.998 3.321 1.479 - 8.015 3.627 2.233 7.398 3.894 1.700 9.264 2.927 1.378 10.063 - 3.595 3.192 9.384 2.631 3.466 8.552 1.983 3.771 9.256 3.546 - 3.714 10.601 1.937 3.517 11.880 2.330 3.013 12.149 3.246 4.135 - 12.813 1.521 4.237 13.800 1.707 4.674 12.111 0.462 5.300 12.511 - -0.725 5.328 13.580 -0.873 5.880 11.553 -1.565 6.395 11.966 -2.419 - 5.800 10.189 -1.256 6.274 9.474 -1.913 5.056 9.774 -0.146 5.163 - 8.732 0.115 4.571 10.728 0.763 0.882 9.503 1.665 0.242 10.528 - 1.442 0.732 8.452 0.856 1.368 7.683 1.014 0.020 8.448 -0.406 - -0.359 9.447 -0.621 1.029 8.131 -1.506 0.564 7.771 -2.423 1.973 - 9.214 -2.021 1.556 9.830 -2.818 2.235 9.933 -1.245 2.889 8.918 - -2.534 1.859 7.055 -1.129 1.317 6.273 -1.259 -1.137 7.460 -0.409 - -0.966 6.245 -0.333 -2.280 8.151 -0.387 -2.108 9.145 -0.340 -3.659 - 7.769 -0.163 -3.842 7.681 0.908 -4.581 8.774 -0.847 -5.591 8.388 - -0.708 -4.418 8.849 -1.922 -4.641 10.181 -0.344 -4.790 11.224 -1.191 - -4.903 11.027 -2.246 -4.660 12.390 -0.461 -4.750 13.280 -0.929 -4.290 - 12.186 0.853 -3.924 13.071 1.874 -4.005 14.147 1.854 -3.465 12.488 - 3.061 -3.361 13.169 3.893 -3.398 11.101 3.235 -3.102 10.797 4.229 - -3.710 10.287 2.139 -3.397 9.257 2.217 -4.185 10.772 0.910 -3.922 - 6.375 -0.716 -4.351 5.438 -0.046 -3.575 6.197 -1.993 -2.804 6.768 - -2.307 -3.685 4.895 -2.619 -4.731 4.602 -2.524 -3.454 4.999 -4.124 - -2.417 5.316 -4.242 -3.911 5.952 -4.391 -3.848 3.782 -4.956 -3.372 - 2.929 -4.473 -3.418 4.023 -5.928 -5.363 3.629 -4.964 -5.880 2.790 - -4.195 -6.003 4.159 -5.897 -2.842 3.717 -2.154 -1.615 3.746 -2.093 - -3.536 2.616 -1.855 -4.493 2.549 -2.169 -2.935 1.375 -1.408 -2.107 - 1.561 -0.725 -3.984 0.592 -0.624 -3.766 -0.462 -0.448 -4.962 0.556 - -1.104 -4.198 1.156 0.773 -3.363 1.877 1.315 -5.248 0.773 1.502 - -5.947 0.215 1.034 -5.068 0.582 2.477 -2.408 0.624 -2.622 -3.090 - -0.083 -3.361 -1.132 0.874 -2.924 -0.634 1.492 -2.299 -0.370 0.303 - -4.016 0.276 1.122 -4.334 -0.885 -0.119 -4.878 0.542 -0.773 -3.444 - 0.027 -1.709 -2.837 1.831 -0.812 -3.790 2.101 -0.160 -4.512 2.744 - -1.872 -3.413 2.321 -2.749 -3.903 4.116 -1.695 -4.057 3.890 -1.423 - -5.088 4.614 -2.663 -4.118 4.980 -0.631 -3.385 5.360 -1.067 -2.461 - 4.491 0.287 -3.061 6.242 -0.374 -4.204 6.022 -0.147 -5.247 6.916 - -1.229 -4.158 6.959 0.848 -3.638 7.973 0.856 -4.037 6.879 0.644 - -2.571 6.262 2.098 -3.979 5.285 2.050 -3.728 6.753 2.847 -3.513 - 6.438 2.340 -4.944 2.831 -2.217 -1.933 3.064 -1.338 -1.106 2.618 - -3.474 -1.537 2.144 -4.129 -2.142 2.663 -3.854 -0.140 3.601 -3.512 - 0.297 1.514 -3.214 0.634 0.628 -3.570 0.110 1.582 -2.127 0.580 - 1.299 -3.509 2.084 0.353 -4.402 2.455 -0.085 -5.153 1.815 0.382 - -4.484 3.833 -0.296 -5.045 4.329 1.051 -3.393 4.350 1.190 -2.780 - 5.601 0.474 -2.917 6.398 1.985 -1.644 5.791 1.862 -1.109 6.721 - 2.635 -1.009 4.725 3.180 -0.092 4.892 2.558 -1.680 3.499 3.063 - -1.133 2.717 1.806 -2.846 3.280 2.550 -5.371 -0.083 2.113 -6.044 - -1.013 3.145 -6.052 0.899 3.716 -5.455 1.480 3.350 -7.436 1.275 - 4.083 -7.817 0.563 4.080 -7.482 2.614 3.359 -7.171 3.370 4.391 - -8.919 3.021 4.686 -8.940 4.071 3.505 -9.543 2.911 5.155 -9.398 - 2.408 5.236 -6.674 2.621 5.679 -6.780 3.466 2.047 -8.222 1.308 - 1.179 -7.869 2.104 1.869 -9.273 0.504 2.598 -9.414 -0.181 0.579 - -9.902 0.305 -0.068 -9.031 0.207 0.525 -10.755 -0.959 1.345 -11.471 - -0.906 0.891 -10.172 -1.804 -0.731 -11.476 -1.331 -2.003 -11.034 -1.213 - -2.268 -10.039 -0.888 -2.900 -11.998 -1.629 -3.856 -11.908 -1.315 -2.257 - -13.110 -2.134 -2.724 -14.313 -2.677 -3.784 -14.465 -2.823 -1.781 -15.308 - -2.957 -2.075 -16.256 -3.383 -0.420 -14.986 -2.893 0.318 -15.694 -3.240 - 0.026 -13.747 -2.416 1.033 -13.359 -2.380 -0.887 -12.785 -1.956 0.109 - -10.642 1.549 0.937 -11.320 2.154 -1.149 -10.543 1.984 -1.801 -9.895 - 1.566 -1.738 -11.268 3.092 -1.176 -11.153 4.019 -3.172 -10.827 3.369 - -3.814 -11.704 3.286 -3.445 -10.227 2.501 -3.303 -10.134 4.722 -2.481 - -9.449 4.928 -3.399 -10.910 5.482 -4.585 -9.307 4.760 -5.412 -9.983 - 4.544 -4.644 -8.547 3.980 -4.906 -8.624 6.086 -4.468 -7.635 5.951 - -4.369 -9.120 6.895 -6.335 -8.406 6.356 -6.902 -7.897 5.693 -6.783 - -9.311 6.379 -6.471 -7.903 7.221 -1.697 -12.768 2.833 -1.212 -13.582 - 3.616 -2.099 -13.200 1.636 -2.404 -12.577 0.902 -2.074 -14.512 1.022 - -2.022 -14.448 -0.065 -1.246 -15.064 1.467 -3.018 -15.054 1.083 - -4.987 12.127 0.226 -5.075 13.027 0.676 -4.362 12.389 -0.522 -5.888 - 12.029 -0.220 -4.489 10.920 0.903 -5.320 10.699 1.572 -4.305 9.704 - 0.000 -3.442 9.855 -0.650 -5.258 9.809 -0.519 -4.459 8.467 0.660 - -4.321 7.849 -0.062 -3.195 11.169 1.664 -2.540 12.188 1.456 -2.779 - 10.171 2.447 -3.362 9.351 2.531 -1.472 10.032 3.057 -0.999 10.966 - 3.361 -1.502 9.219 4.348 -2.092 8.347 4.065 -2.169 9.676 5.079 - -0.200 8.767 4.927 0.814 9.543 5.373 0.893 10.618 5.312 1.882 - 8.782 5.806 2.725 9.150 6.222 1.616 7.433 5.685 2.341 6.268 - 5.961 3.353 6.420 6.306 1.752 5.001 5.880 2.208 4.061 6.157 - 0.435 5.006 5.407 -0.112 4.080 5.311 -0.321 6.152 5.129 -1.375 - 6.075 4.907 0.273 7.420 5.226 -0.428 9.571 2.049 0.562 10.283 - 1.901 -0.873 8.538 1.330 -1.665 8.059 1.734 -0.055 8.077 0.227 - 0.822 8.718 0.140 0.437 6.651 0.462 0.976 6.395 -0.450 1.337 - 6.543 1.689 0.766 6.822 2.574 1.804 5.563 1.793 2.105 7.307 - 1.572 -0.506 5.615 0.618 -0.068 4.815 0.918 -0.677 8.270 -1.149 - -1.723 7.735 -1.509 0.009 9.005 -2.027 0.928 9.288 -1.719 -0.112 - 9.171 -3.461 -1.157 9.292 -3.745 0.668 10.396 -3.931 0.671 10.301 - -5.017 1.715 10.307 -3.641 0.193 11.688 -3.349 -0.832 12.447 -3.799 - -1.388 12.176 -4.685 -0.970 13.553 -2.984 -1.504 14.392 -3.159 0.029 - 13.605 -2.033 0.369 14.566 -1.073 -0.264 15.403 -0.819 1.448 14.304 - -0.220 1.751 14.978 0.567 2.156 13.105 -0.365 3.043 12.878 0.208 - 1.863 12.175 -1.371 2.438 11.262 -1.360 0.767 12.408 -2.217 0.245 - 7.962 -4.314 -0.533 7.472 -5.129 1.479 7.461 -4.216 2.153 7.987 - -3.678 1.759 6.076 -4.536 1.536 5.957 -5.596 3.259 5.827 -4.400 - 3.411 4.752 -4.493 3.547 6.196 -3.416 4.191 6.444 -5.439 3.665 - 6.279 -6.379 5.037 5.757 -5.476 4.482 7.870 -4.993 4.918 8.125 - -3.850 4.186 8.766 -5.813 0.917 5.195 -3.624 1.055 5.215 -2.403 - 0.065 4.371 -4.238 0.227 4.292 -5.232 -0.900 3.559 -3.525 -1.024 - 3.984 -2.529 -2.189 3.529 -4.342 -1.981 3.028 -5.287 -2.624 4.523 - -4.447 -3.277 2.668 -3.715 -4.037 3.056 -2.831 -3.659 1.508 -4.253 - -3.267 1.180 -5.124 -4.466 1.076 -3.824 -0.195 2.240 -3.243 0.477 - 1.763 -4.155 -0.365 1.601 -2.083 -1.125 1.929 -1.503 0.232 0.324 - -1.749 1.299 0.339 -1.973 -0.238 -0.446 -2.360 0.096 0.096 -0.250 - 0.860 0.608 0.565 -1.030 -0.552 0.055 -1.601 -0.906 -0.700 -1.352 - -0.953 1.410 -0.819 -0.467 2.226 -2.837 -0.704 1.658 -3.169 -1.217 - 2.561 -3.430 -0.996 0.791 -3.188 0.766 1.863 -2.872 1.256 0.942 - -2.703 1.054 2.796 -4.675 1.072 2.016 -5.127 0.650 2.914 -5.170 - 0.489 1.239 -5.175 2.513 2.043 -6.261 2.517 2.129 -4.962 2.955 - 1.069 -4.452 3.342 3.021 -4.481 2.992 3.968 -3.487 3.470 2.753 - -4.656 4.317 3.184 -1.058 -2.444 1.497 -1.616 -3.163 0.671 -0.133 - -2.873 2.359 0.206 -2.162 2.992 0.357 -4.227 2.517 0.945 -4.478 - 1.634 1.299 -4.244 3.717 0.817 -4.057 4.676 2.055 -3.466 3.610 - 1.977 -5.571 3.843 1.420 -6.618 4.492 0.463 -6.690 4.987 2.277 - -7.700 4.451 2.018 -8.609 4.809 3.385 -7.421 3.677 4.481 -8.178 - 3.246 4.515 -9.245 3.413 5.464 -7.573 2.455 6.338 -8.167 2.229 - 5.444 -6.186 2.263 6.266 -5.691 1.768 4.298 -5.457 2.603 4.302 - -4.387 2.457 3.238 -6.061 3.298 -0.702 -5.320 2.552 -1.368 -5.653 - 3.529 -0.829 -6.013 1.418 -0.210 -5.738 0.669 -1.736 -7.125 1.215 - -2.105 -7.476 2.178 -2.875 -6.725 0.281 -3.320 -7.672 -0.023 -3.924 - -5.916 1.037 -3.519 -4.910 1.151 -4.770 -5.744 0.371 -4.380 -6.403 - 1.899 -2.430 -5.991 -0.838 -2.101 -5.135 -0.555 -0.892 -8.314 0.781 - -0.604 -8.473 -0.404 -0.616 -9.298 1.640 -1.240 -9.383 2.429 0.141 - -10.507 1.389 0.578 -10.530 0.391 1.281 -10.652 2.393 0.803 -10.792 - 3.363 1.902 -9.762 2.488 2.312 -11.678 2.047 3.261 -11.534 1.095 - 3.284 -10.714 0.392 3.978 -12.713 1.044 4.834 -12.823 0.518 3.506 - -13.653 1.938 3.907 -14.955 2.261 4.730 -15.345 1.681 3.255 -15.592 - 3.323 3.647 -16.483 3.792 2.113 -15.030 3.905 1.544 -15.598 4.627 - 1.748 -13.708 3.622 0.858 -13.228 4.000 2.403 -13.033 2.580 -0.808 - -11.693 1.294 -1.430 -12.043 2.294 -0.762 -12.403 0.164 -0.050 -12.127 - -0.498 -1.602 -13.540 -0.155 -2.491 -13.514 0.475 -2.035 -13.396 -1.611 - -2.493 -14.336 -1.920 -1.167 -13.474 -2.267 -2.961 -12.218 -1.898 -2.339 - -11.323 -1.898 -3.729 -12.220 -1.124 -3.599 -12.278 -3.283 -4.015 -13.282 - -3.368 -2.742 -12.242 -3.955 -4.697 -11.249 -3.534 -4.291 -10.240 -3.613 - -5.356 -11.339 -2.670 -5.409 -11.527 -4.790 -6.304 -11.069 -4.887 -4.913 - -11.123 -5.572 -5.645 -12.493 -4.972 -1.085 -14.897 0.302 -1.936 -15.562 - 0.889 0.199 -15.229 0.154 0.797 -14.561 -0.311 0.840 -16.340 0.828 - 1.593 -16.836 0.216 1.333 -15.950 1.718 0.093 -17.068 1.147 - -0.713 15.277 1.662 -0.304 15.729 2.467 -0.042 15.282 0.907 -1.574 - 15.665 1.303 -1.062 13.938 2.161 -1.678 13.940 3.060 -1.783 13.088 - 1.119 -1.101 12.689 0.368 -2.503 13.650 0.524 -2.413 11.975 1.711 - -3.358 11.985 1.541 0.141 13.091 2.551 1.249 13.362 2.093 0.006 - 12.203 3.539 -0.936 11.961 3.809 1.036 11.338 4.077 1.995 11.830 - 3.911 0.748 11.151 5.563 -0.078 10.467 5.759 0.300 12.111 5.821 - 1.873 10.887 6.512 3.007 10.187 6.282 3.325 9.583 5.445 3.912 - 10.226 7.325 4.901 10.051 7.223 3.323 10.901 8.375 3.768 11.197 - 9.669 4.720 10.746 9.906 2.888 11.903 10.499 3.154 12.101 11.527 - 1.646 12.352 10.036 1.053 12.902 10.753 1.229 12.091 8.725 0.225 - 12.369 8.443 2.073 11.353 7.880 1.235 10.034 3.317 2.346 9.612 - 3.004 0.156 9.313 3.004 -0.771 9.639 3.239 0.284 8.096 2.228 - 1.270 7.686 2.445 -0.831 7.117 2.584 -0.763 6.418 1.750 -0.810 - 6.495 3.977 -1.276 7.143 4.719 -1.371 5.562 3.936 0.221 6.262 - 4.244 -2.057 7.813 2.535 -2.175 8.011 1.604 0.174 8.382 0.737 - -0.790 9.060 0.387 0.972 7.813 -0.169 1.731 7.217 0.130 0.614 - 7.921 -1.569 -0.021 8.795 -1.712 1.876 8.221 -2.372 1.767 7.981 - -3.430 2.566 7.451 -2.029 2.365 9.633 -2.312 1.662 10.586 -2.966 - 0.794 10.422 -3.588 2.278 11.779 -2.644 1.913 12.707 -2.803 3.300 - 11.659 -1.724 4.169 12.557 -1.092 4.185 13.604 -1.354 5.030 12.080 - -0.096 5.732 12.674 0.470 5.011 10.720 0.235 5.598 10.393 1.081 - 4.199 9.795 -0.431 4.281 8.731 -0.262 3.334 10.272 -1.429 -0.117 - 6.656 -1.996 -1.213 6.730 -2.547 0.555 5.509 -1.869 1.445 5.535 - -1.392 0.110 4.249 -2.428 -0.102 4.491 -3.469 1.289 3.280 -2.418 - 0.929 2.263 -2.575 1.812 3.239 -1.463 2.258 3.434 -3.587 1.759 - 3.512 -4.553 2.855 2.546 -3.794 3.367 4.476 -3.587 3.863 4.822 - -2.493 3.850 4.867 -4.672 -1.196 3.829 -1.768 -1.362 3.683 -0.559 - -2.217 3.627 -2.605 -2.038 3.926 -3.553 -3.535 3.113 -2.292 -3.633 - 2.711 -1.283 -4.471 4.316 -2.351 -4.330 4.828 -3.303 -4.107 5.013 - -1.595 -5.923 3.939 -2.099 -6.274 3.017 -1.365 -6.913 4.588 -2.716 - -6.738 5.459 -3.197 -7.843 4.354 -2.397 -4.013 2.003 -3.217 -4.227 - 2.218 -4.408 -4.218 0.851 -2.573 -4.049 0.759 -1.582 -4.873 -0.237 - -3.272 -4.723 -0.172 -4.349 -5.934 -0.086 -3.074 -4.408 -1.562 -2.685 - -3.244 -1.713 -2.322 -5.392 -2.424 -2.419 -6.344 -2.122 -2.568 -5.224 - -3.668 -1.696 -4.916 -3.527 -0.660 -6.562 -4.388 -1.546 -6.393 -5.397 - -1.172 -7.040 -4.534 -2.515 -7.678 -3.655 -0.808 -7.949 -2.882 -1.527 - -7.344 -3.279 0.159 -8.909 -4.503 -0.499 -8.585 -5.103 0.352 -9.146 - -5.085 -1.389 -10.102 -3.618 -0.153 -10.802 -3.424 -0.965 -9.670 -2.660 - 0.137 -10.734 -4.128 1.074 -11.402 -4.839 0.812 -10.103 -4.532 1.752 - -11.347 -3.470 1.532 -4.123 -4.517 -2.316 -4.336 -5.020 -3.417 -2.985 - -4.715 -1.648 -2.784 -4.136 -0.845 -1.870 -5.506 -2.127 -1.821 -5.286 - -3.194 -0.545 -5.000 -1.564 -0.462 -5.175 -0.491 -0.577 -3.912 -1.619 - 0.632 -5.602 -2.262 1.357 -6.623 -1.753 1.090 -7.083 -0.812 2.270 - -7.005 -2.715 2.866 -7.817 -2.640 2.325 -6.146 -3.794 3.122 -6.092 - -4.944 3.887 -6.843 -5.077 2.788 -5.110 -5.884 3.481 -4.979 -6.702 - 1.701 -4.242 -5.729 1.438 -3.513 -6.482 0.910 -4.378 -4.582 0.131 - -3.633 -4.516 1.189 -5.322 -3.581 -1.997 -6.990 -1.810 -2.384 -7.302 - -0.686 -1.605 -7.855 -2.748 -1.324 -7.472 -3.639 -1.512 -9.286 -2.537 - -2.374 -9.797 -2.109 -1.346 -9.921 -3.915 -1.323 -10.998 -3.749 -2.591 - -9.715 -4.773 -2.762 -8.651 -4.931 -2.443 -10.149 -5.762 -3.509 -10.190 - -4.427 -0.279 -9.441 -4.701 0.420 -9.319 -4.055 -0.427 -9.561 -1.506 - 0.677 -9.843 -1.966 -0.645 -9.646 -0.191 -1.515 -9.296 0.184 0.345 - -9.835 0.850 1.357 -9.609 0.514 -0.028 -8.856 1.959 -1.037 -9.048 - 2.323 -0.099 -7.851 1.544 0.947 -8.898 3.092 2.290 -8.763 3.029 - 2.854 -8.401 2.182 2.815 -8.714 4.305 3.779 -8.465 4.476 1.846 - -8.779 5.286 1.811 -8.929 6.677 2.701 -8.946 7.288 0.598 -9.002 - 7.373 0.659 -9.002 8.451 -0.599 -9.124 6.657 -1.592 -9.336 7.026 - -0.530 -9.032 5.262 -1.519 -9.061 4.828 0.657 -8.910 4.522 0.316 - -11.245 1.422 -0.763 -11.805 1.599 1.441 -11.942 1.604 2.282 -11.404 - 1.452 1.632 -13.304 2.060 0.834 -13.906 1.626 2.956 -13.926 1.627 - 2.978 -14.990 1.861 3.839 -13.482 2.088 3.101 -13.880 0.109 2.883 - -12.871 -0.242 2.318 -14.566 -0.216 4.508 -14.390 -0.185 4.717 -15.253 - 0.448 5.281 -13.706 0.166 4.739 -14.758 -1.648 4.521 -13.847 -2.205 - 4.002 -15.476 -2.008 6.119 -15.243 -1.798 6.387 -15.434 -2.753 6.708 - -14.482 -1.491 6.355 -16.083 -1.290 1.484 -13.473 3.566 0.823 -14.318 - 4.164 2.170 -12.486 4.148 2.779 -11.923 3.571 2.188 -12.259 5.579 - 1.243 -11.810 5.884 2.484 -13.124 6.172 3.022 -11.567 5.697 - -1.889 9.159 7.569 -1.037 8.691 7.296 -1.900 9.298 8.569 -2.538 - 8.447 7.265 -2.064 10.501 6.993 -3.100 10.824 7.102 -1.230 11.561 - 7.707 -1.670 11.811 8.673 -1.248 12.503 7.159 0.123 11.216 7.904 - 0.274 11.728 8.701 -1.613 10.418 5.542 -2.498 10.433 4.689 -0.366 - 10.572 5.090 0.344 10.612 5.808 0.195 10.697 3.760 -0.218 11.569 - 3.254 1.710 10.879 3.709 2.208 9.986 4.087 1.927 11.641 4.458 - 2.265 11.291 2.384 2.032 12.500 1.827 1.538 13.333 2.305 2.860 - 12.580 0.724 2.929 13.404 0.143 3.662 11.460 0.646 4.620 11.160 - -0.330 5.059 11.863 -1.023 5.091 9.843 -0.377 5.854 9.610 -1.105 - 4.545 8.850 0.445 4.823 7.840 0.182 3.549 9.159 1.379 3.135 - 8.430 2.059 3.075 10.477 1.483 -0.190 9.609 2.768 -0.452 9.963 - 1.621 -0.268 8.402 3.334 -0.260 8.275 4.336 -0.606 7.172 2.647 - -0.180 7.266 1.648 -0.093 5.992 3.468 -0.586 5.081 3.128 1.343 - 5.648 3.081 1.306 5.005 2.202 1.955 6.543 2.967 1.828 5.068 - 3.866 -0.273 6.246 4.843 0.428 5.750 5.271 -2.073 6.882 2.363 - -2.884 6.685 3.265 -2.414 6.796 1.075 -1.631 6.756 0.439 -3.689 - 6.286 0.613 -4.288 6.020 1.485 -4.465 7.275 -0.253 -5.450 6.821 - -0.366 -4.022 7.162 -1.242 -4.632 8.723 0.077 -3.902 9.713 -0.483 - -3.089 9.553 -1.176 -4.473 10.923 -0.141 -4.136 11.861 -0.306 -5.469 - 10.746 0.798 -6.330 11.693 1.365 -6.276 12.746 1.130 -7.374 11.196 - 2.154 -8.230 11.822 2.362 -7.630 9.824 2.259 -8.379 9.482 2.959 - -6.776 8.905 1.638 -6.974 7.872 1.884 -5.703 9.347 0.848 -3.632 - 4.926 -0.068 -4.279 3.952 0.309 -2.795 4.872 -1.106 -2.278 5.708 - -1.339 -2.535 3.723 -1.950 -3.007 2.948 -1.346 -3.413 3.524 -3.183 - -3.139 4.141 -4.038 -4.386 3.787 -2.767 -3.470 2.108 -3.748 -2.447 - 1.793 -3.953 -4.039 2.425 -4.623 -4.189 1.123 -2.837 -3.803 0.771 - -1.702 -5.263 0.601 -3.207 -1.058 3.518 -2.255 -0.301 4.414 -2.619 - -0.668 2.265 -2.009 -1.323 1.656 -1.539 0.639 1.696 -2.267 1.239 - 2.453 -2.772 1.412 1.366 -0.993 2.224 0.703 -1.291 0.712 0.882 - -0.311 2.154 2.550 -0.391 2.809 3.347 -1.058 2.359 2.519 0.928 - 1.869 1.897 1.556 3.024 3.196 1.272 0.509 0.488 -3.185 -0.457 - -0.250 -3.004 1.463 0.247 -4.087 2.372 0.658 -3.932 1.399 -0.902 - -4.967 2.180 -0.882 -5.728 0.501 -0.799 -5.576 1.448 -2.275 -4.313 - 0.727 -2.576 -3.364 2.361 -3.118 -4.801 3.080 -2.784 -5.426 2.541 - -4.514 -4.458 1.627 -5.015 -4.138 3.123 -5.283 -5.641 2.435 -5.243 - -6.486 3.335 -6.318 -5.372 4.416 -4.746 -6.248 5.308 -4.960 -5.660 - 4.393 -3.674 -6.439 4.726 -5.503 -7.536 3.992 -5.272 -8.308 4.584 - -6.543 -7.241 6.148 -5.338 -8.066 6.521 -6.290 -8.444 6.848 -5.025 - -7.290 6.177 -4.420 -9.214 6.046 -3.547 -8.722 7.131 -4.392 -9.546 - 5.471 -4.550 -9.925 3.512 -4.519 -3.286 4.624 -5.042 -3.286 2.925 - -4.256 -2.116 2.010 -3.879 -2.316 3.341 -4.262 -0.728 4.410 -4.045 - -0.724 2.625 -3.068 -0.104 1.589 -3.294 0.148 2.835 -2.194 -0.721 - 3.288 -2.462 1.091 2.925 -2.436 2.393 1.949 -2.799 2.678 3.855 - -1.845 3.224 3.885 -1.848 4.234 4.827 -1.303 2.408 5.911 -0.471 - 2.714 6.139 -0.156 3.721 6.841 -0.141 1.722 7.725 0.405 2.018 - 6.584 -0.590 0.421 7.231 -0.235 -0.368 5.424 -1.297 0.082 5.139 - -1.465 -0.946 4.479 -1.620 1.069 2.945 -5.593 -0.105 3.022 -6.675 - -0.682 2.531 -5.609 1.164 2.711 -4.794 1.731 2.254 -6.874 1.815 - 2.982 -7.667 1.644 2.207 -6.622 3.320 1.722 -5.667 3.526 1.456 - -7.659 4.149 1.581 -7.464 5.214 0.402 -7.468 3.946 1.725 -8.640 - 3.755 3.460 -6.501 3.954 3.385 -6.097 4.822 0.889 -7.354 1.344 - -0.172 -6.760 1.524 0.906 -8.522 0.699 1.723 -9.115 0.734 -0.188 - -9.066 -0.080 -0.737 -8.220 -0.495 0.412 -10.010 -1.117 1.113 -10.710 - -0.661 0.887 -9.368 -1.859 -0.539 -10.928 -1.816 -1.313 -10.686 -2.898 - -1.337 -9.764 -3.460 -1.971 -11.786 -3.411 -2.384 -11.864 -4.330 -1.957 - -12.763 -2.437 -2.785 -13.865 -2.191 -3.631 -14.012 -2.846 -2.600 -14.709 - -1.089 -3.315 -15.473 -0.823 -1.518 -14.345 -0.278 -1.325 -14.936 0.604 - -0.809 -13.146 -0.419 -0.038 -12.834 0.270 -1.034 -12.259 -1.484 -1.079 - -9.752 0.946 -0.710 -10.673 1.672 -2.344 -9.326 0.949 -2.456 -8.339 - 0.770 -3.470 -9.926 1.636 -3.097 -10.439 2.522 -4.384 -8.814 2.142 - -5.389 -9.112 2.440 -4.439 -8.009 1.409 -3.799 -8.092 3.352 -2.889 - -7.566 3.064 -3.691 -8.724 4.233 -4.848 -7.024 3.650 -5.691 -7.411 - 4.222 -5.130 -6.495 2.740 -4.108 -6.019 4.529 -3.183 -5.635 4.099 - -3.885 -6.553 5.452 -4.877 -4.802 4.829 -5.132 -4.305 3.987 -5.718 - -4.968 5.362 -4.250 -4.263 5.410 -4.395 -10.778 0.779 -4.483 -11.939 - 1.172 -4.832 -10.202 -0.344 -4.647 -9.239 -0.587 -5.720 -10.866 -1.277 - -5.591 -11.946 -1.340 -6.757 -10.886 -0.942 -5.777 -10.358 -2.240 +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -5.8550 10.4160 2.3490 N3 1 SER 0.184900 + 2 H1 -5.6670 9.5970 1.7870 H 1 SER 0.189800 + 3 H2 -6.8050 10.3940 2.6890 H 1 SER 0.189800 + 4 H3 -5.6390 11.2490 1.8200 H 1 SER 0.189800 + 5 CA -4.9110 10.3950 3.4770 CT 1 SER 0.056700 + 6 HA -5.3400 10.8830 4.3530 HP 1 SER 0.078200 + 7 CB -4.5290 8.9600 3.8260 CT 1 SER 0.259600 + 8 HB2 -5.3880 8.3850 4.1730 H1 1 SER 0.027300 + 9 HB3 -3.8220 8.8960 4.6540 H1 1 SER 0.027300 + 10 OG -4.0540 8.3980 2.6230 OH 1 SER -0.671400 + 11 HG -4.0440 7.4490 2.7670 HO 1 SER 0.423900 + 12 C -3.6850 11.2230 3.1190 C 1 SER 0.616300 + 13 O -3.5790 11.8150 2.0470 O 1 SER -0.572200 + 14 N -2.7260 11.3310 4.0420 N 2 TRP -0.415700 + 15 H -2.8950 10.7610 4.8580 H 2 TRP 0.271900 + 16 CA -1.3860 11.8790 3.9820 CT 2 TRP -0.027500 + 17 HA -1.4900 12.9050 3.6290 H1 2 TRP 0.112300 + 18 CB -0.6290 11.9190 5.3070 CT 2 TRP -0.005000 + 19 HB2 -0.4390 10.9260 5.7120 HC 2 TRP 0.033900 + 20 HB3 -1.3560 12.3050 6.0220 HC 2 TRP 0.033900 + 21 CG 0.7010 12.5990 5.3710 C* 2 TRP -0.141500 + 22 CD1 0.9780 13.9060 5.5800 CW 2 TRP -0.163800 + 23 HD1 0.2900 14.7300 5.6930 H4 2 TRP 0.206200 + 24 NE1 2.3440 14.1060 5.5950 NA 2 TRP -0.341800 + 25 HE1 2.8680 14.9660 5.6730 H 2 TRP 0.341200 + 26 CE2 3.0420 12.9340 5.3860 CN 2 TRP 0.138000 + 27 CZ2 4.3840 12.5740 5.5580 CA 2 TRP -0.260100 + 28 HZ2 5.0490 13.3560 5.8930 HA 2 TRP 0.157200 + 29 CH2 4.7660 11.2330 5.4340 CA 2 TRP -0.113400 + 30 HH2 5.7860 10.9470 5.6430 HA 2 TRP 0.141700 + 31 CZ3 3.8070 10.2490 5.1640 CA 2 TRP -0.197200 + 32 HZ3 4.1920 9.2440 5.2600 HA 2 TRP 0.144700 + 33 CE3 2.4630 10.6350 5.2200 CA 2 TRP -0.238700 + 34 HE3 1.7550 9.8210 5.1560 HA 2 TRP 0.170000 + 35 CD2 2.0120 11.9620 5.2980 CB 2 TRP 0.124300 + 36 C -0.5630 11.3400 2.8200 C 2 TRP 0.597300 + 37 O 0.1660 12.0810 2.1640 O 2 TRP -0.567900 + 38 N -0.6330 10.0240 2.6080 N 3 THR -0.415700 + 39 H -1.2400 9.4970 3.2200 H 3 THR 0.271900 + 40 CA -0.2040 9.2440 1.4650 CT 3 THR -0.038900 + 41 HA 0.7940 9.6510 1.3040 H1 3 THR 0.100700 + 42 CB 0.1810 7.8160 1.8410 CT 3 THR 0.365400 + 43 HB 0.1640 7.1350 0.9900 H1 3 THR 0.004300 + 44 CG2 1.5210 7.6320 2.5470 CT 3 THR -0.243800 + 45 HG21 1.6320 8.4380 3.2720 HC 3 THR 0.064200 + 46 HG22 1.5990 6.6260 2.9590 HC 3 THR 0.064200 + 47 HG23 2.2100 7.6610 1.7030 HC 3 THR 0.064200 + 48 OG1 -0.6540 7.3360 2.8710 OH 3 THR -0.676100 + 49 HG1 -1.4990 7.0320 2.5310 HO 3 THR 0.410200 + 50 C -1.0150 9.2550 0.1770 C 3 THR 0.597300 + 51 O -2.0140 8.5490 0.0590 O 3 THR -0.567900 + 52 N -0.5760 10.0870 -0.7700 N 4 TRP -0.415700 + 53 H 0.2860 10.5770 -0.5760 H 4 TRP 0.271900 + 54 CA -1.2210 10.2690 -2.0550 CT 4 TRP -0.027500 + 55 HA -2.2390 10.6370 -1.9300 H1 4 TRP 0.112300 + 56 CB -0.4470 11.2630 -2.9160 CT 4 TRP -0.005000 + 57 HB2 -0.8210 11.2170 -3.9380 HC 4 TRP 0.033900 + 58 HB3 0.6050 11.0020 -3.0210 HC 4 TRP 0.033900 + 59 CG -0.3740 12.6530 -2.3690 C* 4 TRP -0.141500 + 60 CD1 0.6610 13.1490 -1.6540 CW 4 TRP -0.163800 + 61 HD1 1.6290 12.6890 -1.5200 H4 4 TRP 0.206200 + 62 NE1 0.3900 14.4060 -1.1520 NA 4 TRP -0.341800 + 63 HE1 1.0410 14.8000 -0.4880 H 4 TRP 0.341200 + 64 CE2 -0.9560 14.6580 -1.3220 CN 4 TRP 0.138000 + 65 CZ2 -1.7940 15.7250 -0.9740 CA 4 TRP -0.260100 + 66 HZ2 -1.3810 16.4780 -0.3200 HA 4 TRP 0.157200 + 67 CH2 -3.1400 15.6770 -1.3560 CA 4 TRP -0.113400 + 68 HH2 -3.7130 16.5590 -1.1140 HA 4 TRP 0.141700 + 69 CZ3 -3.7120 14.5290 -1.9190 CA 4 TRP -0.197200 + 70 HZ3 -4.7790 14.4260 -2.0490 HA 4 TRP 0.144700 + 71 CE3 -2.8360 13.5110 -2.3140 CA 4 TRP -0.238700 + 72 HE3 -3.1130 12.5970 -2.8180 HA 4 TRP 0.170000 + 73 CD2 -1.4450 13.6210 -2.1580 CB 4 TRP 0.124300 + 74 C -1.3400 8.9980 -2.8840 C 4 TRP 0.597300 + 75 O -2.4310 8.4760 -3.1020 O 4 TRP -0.567900 + 76 N -0.2480 8.3120 -3.2300 N 5 GLU -0.516300 + 77 H 0.6230 8.6860 -2.8790 H 5 GLU 0.293600 + 78 CA -0.1410 6.9840 -3.8000 CT 5 GLU 0.039700 + 79 HA -0.8840 6.8170 -4.5800 H1 5 GLU 0.110500 + 80 CB 1.1410 6.9920 -4.6280 CT 5 GLU 0.056000 + 81 HB2 1.9410 7.3510 -3.9800 HC 5 GLU -0.017300 + 82 HB3 1.0790 7.8060 -5.3490 HC 5 GLU -0.017300 + 83 CG 1.5920 5.6830 -5.2700 CT 5 GLU 0.013600 + 84 HG2 1.8610 4.9040 -4.5580 HC 5 GLU -0.042500 + 85 HG3 2.4700 5.9330 -5.8660 HC 5 GLU -0.042500 + 86 CD 0.5990 5.2520 -6.3400 C 5 GLU 0.805400 + 87 OE1 0.6940 5.8150 -7.4520 O2 5 GLU -0.818800 + 88 OE2 -0.3430 4.4880 -6.0380 O2 5 GLU -0.818800 + 89 C -0.1530 5.9410 -2.6920 C 5 GLU 0.536600 + 90 O 0.2960 6.2940 -1.6040 O 5 GLU -0.581900 + 91 N -0.9350 4.8860 -2.9330 N 6 ASN -0.415700 + 92 H -1.1850 4.6960 -3.8930 H 6 ASN 0.271900 + 93 CA -1.4090 3.9650 -1.9190 CT 6 ASN 0.014300 + 94 HA -1.0860 4.3890 -0.9680 H1 6 ASN 0.104800 + 95 CB -2.9310 3.8520 -1.9270 CT 6 ASN -0.204100 + 96 HB2 -3.2640 3.3570 -2.8390 HC 6 ASN 0.079700 + 97 HB3 -3.3870 4.8420 -1.8870 HC 6 ASN 0.079700 + 98 CG -3.4250 3.0170 -0.7550 C 6 ASN 0.713000 + 99 OD1 -4.2120 2.0760 -0.8290 O 6 ASN -0.593100 + 100 ND2 -3.0290 3.2960 0.4890 N 6 ASN -0.919100 + 101 HD21 -2.2540 3.9400 0.5530 H 6 ASN 0.419600 + 102 HD22 -3.3550 2.8230 1.3190 H 6 ASN 0.419600 + 103 C -0.7950 2.5930 -2.1590 C 6 ASN 0.597300 + 104 O -0.9230 1.9530 -3.2000 O 6 ASN -0.567900 + 105 N 0.0300 2.1420 -1.2120 N 7 GLY -0.415700 + 106 H 0.2020 2.7420 -0.4180 H 7 GLY 0.271900 + 107 CA 0.6640 0.8400 -1.1740 CT 7 GLY -0.025200 + 108 HA2 1.7350 0.9910 -1.0400 H1 7 GLY 0.069800 + 109 HA3 0.5630 0.3560 -2.1450 H1 7 GLY 0.069800 + 110 C 0.0180 -0.0730 -0.1410 C 7 GLY 0.597300 + 111 O 0.2150 0.1300 1.0550 O 7 GLY -0.567900 + 112 N -0.7260 -1.0590 -0.6470 N 8 LYS -0.347900 + 113 H -0.9550 -0.9960 -1.6290 H 8 LYS 0.274700 + 114 CA -1.2790 -2.1170 0.1740 CT 8 LYS -0.240000 + 115 HA -1.3510 -1.7400 1.1940 H1 8 LYS 0.142600 + 116 CB -2.7160 -2.5240 -0.1390 CT 8 LYS -0.009400 + 117 HB2 -3.4260 -1.7000 -0.0640 HC 8 LYS 0.036200 + 118 HB3 -3.1770 -3.2670 0.5120 HC 8 LYS 0.036200 + 119 CG -2.8110 -3.2190 -1.4950 CT 8 LYS 0.018700 + 120 HG2 -2.3430 -4.2010 -1.4250 HC 8 LYS 0.010300 + 121 HG3 -2.3500 -2.6320 -2.2890 HC 8 LYS 0.010300 + 122 CD -4.2490 -3.5050 -1.9160 CT 8 LYS -0.047900 + 123 HD2 -4.2550 -3.9250 -2.9220 HC 8 LYS 0.062100 + 124 HD3 -4.7050 -2.5150 -1.9440 HC 8 LYS 0.062100 + 125 CE -4.9150 -4.4420 -0.9130 CT 8 LYS -0.014300 + 126 HE2 -4.9110 -4.0040 0.0850 HP 8 LYS 0.113500 + 127 HE3 -4.3060 -5.3420 -0.8320 HP 8 LYS 0.113500 + 128 NZ -6.2870 -4.7500 -1.3460 N3 8 LYS -0.385400 + 129 HZ1 -6.7340 -5.3900 -0.7040 H 8 LYS 0.340000 + 130 HZ2 -6.9170 -3.9900 -1.1330 H 8 LYS 0.340000 + 131 HZ3 -6.4140 -5.1360 -2.2700 H 8 LYS 0.340000 + 132 C -0.2990 -3.2770 0.0780 C 8 LYS 0.734100 + 133 O 0.0740 -3.5890 -1.0510 O 8 LYS -0.589400 + 134 N 0.1350 -3.8990 1.1770 N 9 TRP -0.415700 + 135 H -0.1440 -3.5300 2.0750 H 9 TRP 0.271900 + 136 CA 0.8910 -5.1310 1.0840 CT 9 TRP -0.027500 + 137 HA 1.7030 -5.0840 0.3580 H1 9 TRP 0.112300 + 138 CB 1.4390 -5.4680 2.4680 CT 9 TRP -0.005000 + 139 HB2 0.5840 -5.5400 3.1410 HC 9 TRP 0.033900 + 140 HB3 2.1000 -4.6260 2.6740 HC 9 TRP 0.033900 + 141 CG 2.2540 -6.7110 2.6260 C* 9 TRP -0.141500 + 142 CD1 2.1160 -7.6400 3.5980 CW 9 TRP -0.163800 + 143 HD1 1.4480 -7.5260 4.4390 H4 9 TRP 0.206200 + 144 NE1 2.9870 -8.6950 3.4080 NA 9 TRP -0.341800 + 145 HE1 2.7720 -9.5990 3.8040 H 9 TRP 0.341200 + 146 CE2 3.8010 -8.5070 2.3090 CN 9 TRP 0.138000 + 147 CZ2 4.8870 -9.2370 1.8130 CA 9 TRP -0.260100 + 148 HZ2 5.2120 -10.2050 2.1640 HA 9 TRP 0.157200 + 149 CH2 5.4410 -8.7790 0.6110 CA 9 TRP -0.113400 + 150 HH2 6.2150 -9.3730 0.1490 HA 9 TRP 0.141700 + 151 CZ3 4.9080 -7.6590 -0.0370 CA 9 TRP -0.197200 + 152 HZ3 5.3870 -7.2280 -0.9040 HA 9 TRP 0.144700 + 153 CE3 3.8960 -6.9080 0.5730 CA 9 TRP -0.238700 + 154 HE3 3.6080 -5.9660 0.1310 HA 9 TRP 0.170000 + 155 CD2 3.3020 -7.2850 1.7890 CB 9 TRP 0.124300 + 156 C 0.0550 -6.3360 0.6780 C 9 TRP 0.597300 + 157 O -0.9570 -6.6340 1.3100 O 9 TRP -0.567900 + 158 N 0.4840 -6.9360 -0.4350 N 10 THR -0.415700 + 159 H 1.3890 -6.6770 -0.7990 H 10 THR 0.271900 + 160 CA -0.2150 -8.0460 -1.0500 CT 10 THR -0.038900 + 161 HA -1.2790 -7.9320 -0.8450 H1 10 THR 0.100700 + 162 CB 0.1530 -8.2370 -2.5180 CT 10 THR 0.365400 + 163 HB 1.2280 -8.1680 -2.6830 H1 10 THR 0.004300 + 164 CG2 -0.2700 -9.5870 -3.0900 CT 10 THR -0.243800 + 165 HG21 -1.3530 -9.6920 -3.0270 HC 10 THR 0.064200 + 166 HG22 -0.2070 -9.5860 -4.1780 HC 10 THR 0.064200 + 167 HG23 0.3170 -10.3900 -2.6440 HC 10 THR 0.064200 + 168 OG1 -0.5950 -7.3090 -3.2710 OH 10 THR -0.676100 + 169 HG1 -0.3000 -6.4100 -3.1090 HO 10 THR 0.410200 + 170 C 0.2220 -9.3120 -0.3260 C 10 THR 0.597300 + 171 O 1.3820 -9.7090 -0.4240 O 10 THR -0.567900 + 172 N -0.6780 -10.1060 0.2570 N 11 TRP -0.415700 + 173 H -1.6440 -9.8110 0.2870 H 11 TRP 0.271900 + 174 CA -0.3260 -11.3320 0.9440 CT 11 TRP -0.027500 + 175 HA 0.7110 -11.2360 1.2660 H1 11 TRP 0.112300 + 176 CB -1.2620 -11.4000 2.1470 CT 11 TRP -0.005000 + 177 HB2 -2.2320 -11.6840 1.7380 HC 11 TRP 0.033900 + 178 HB3 -1.3640 -10.4210 2.6160 HC 11 TRP 0.033900 + 179 CG -0.8640 -12.3300 3.2480 C* 11 TRP -0.141500 + 180 CD1 -0.0800 -11.9140 4.2680 CW 11 TRP -0.163800 + 181 HD1 0.2580 -10.9040 4.4460 H4 11 TRP 0.206200 + 182 NE1 0.4260 -12.9920 4.9670 NA 11 TRP -0.341800 + 183 HE1 1.1530 -12.9530 5.6670 H 11 TRP 0.341200 + 184 CE2 -0.1510 -14.1550 4.5010 CN 11 TRP 0.138000 + 185 CZ2 -0.1600 -15.4410 5.0550 CA 11 TRP -0.260100 + 186 HZ2 0.2370 -15.5890 6.0490 HA 11 TRP 0.157200 + 187 CH2 -0.9010 -16.4100 4.3680 CA 11 TRP -0.113400 + 188 HH2 -0.9980 -17.4100 4.7640 HA 11 TRP 0.141700 + 189 CZ3 -1.6640 -16.1410 3.2260 CA 11 TRP -0.197200 + 190 HZ3 -2.1510 -17.0030 2.7950 HA 11 TRP 0.144700 + 191 CE3 -1.6870 -14.8120 2.7860 CA 11 TRP -0.238700 + 192 HE3 -2.2190 -14.5490 1.8840 HA 11 TRP 0.170000 + 193 CD2 -1.0050 -13.7700 3.4350 CB 11 TRP 0.124300 + 194 C -0.4380 -12.5040 -0.0200 C 11 TRP 0.597300 + 195 O -1.4760 -12.8650 -0.5710 O 11 TRP -0.567900 + 196 N 0.7740 -12.9940 -0.2920 N 12 LYS -0.347900 + 197 H 1.5450 -12.5360 0.1720 H 12 LYS 0.274700 + 198 CA 0.9700 -13.7710 -1.4990 CT 12 LYS -0.240000 + 199 HA 0.5180 -13.3010 -2.3720 H1 12 LYS 0.142600 + 200 CB 2.4820 -13.8520 -1.6930 CT 12 LYS -0.009400 + 201 HB2 2.7580 -14.5560 -2.4780 HC 12 LYS 0.036200 + 202 HB3 2.9080 -14.3690 -0.8330 HC 12 LYS 0.036200 + 203 CG 3.1830 -12.5000 -1.7790 CT 12 LYS 0.018700 + 204 HG2 3.4340 -12.1260 -0.7870 HC 12 LYS 0.010300 + 205 HG3 2.5880 -11.7260 -2.2650 HC 12 LYS 0.010300 + 206 CD 4.5290 -12.6390 -2.4830 CT 12 LYS -0.047900 + 207 HD2 4.3850 -13.0990 -3.4610 HC 12 LYS 0.062100 + 208 HD3 5.1330 -13.3360 -1.9010 HC 12 LYS 0.062100 + 209 CE 5.1660 -11.2620 -2.6470 CT 12 LYS -0.014300 + 210 HE2 5.1610 -10.7260 -1.6980 HP 12 LYS 0.113500 + 211 HE3 4.5500 -10.6620 -3.3160 HP 12 LYS 0.113500 + 212 NZ 6.5010 -11.1720 -3.2600 N3 12 LYS -0.385400 + 213 HZ1 6.3360 -11.5900 -4.1640 H 12 LYS 0.340000 + 214 HZ2 6.8700 -10.2350 -3.3320 H 12 LYS 0.340000 + 215 HZ3 7.1660 -11.6480 -2.6670 H 12 LYS 0.340000 + 216 C 0.4970 -15.1920 -1.2260 C 12 LYS 0.734100 + 217 O -0.2390 -15.7400 -2.0440 O 12 LYS -0.589400 + 218 N 0.9570 -15.7500 -0.1040 N 13 NME -0.415700 + 219 H 1.7110 -15.3160 0.4080 H 13 NME 0.271900 + 220 CH3 0.4410 -16.9480 0.5270 CT 13 NME -0.149000 + 221 HH31 -0.3770 -17.3950 -0.0380 H1 13 NME 0.097600 + 222 HH32 1.1090 -17.8030 0.6300 H1 13 NME 0.097600 + 223 HH33 -0.0440 -16.6200 1.4460 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N 0.0940 9.5380 3.0500 N3 1 SER 0.184900 + 2 H1 0.6110 9.5340 2.1830 H 1 SER 0.189800 + 3 H2 -0.6190 10.2450 3.1610 H 1 SER 0.189800 + 4 H3 0.7700 9.6170 3.7970 H 1 SER 0.189800 + 5 CA -0.5410 8.2260 3.2510 CT 1 SER 0.056700 + 6 HA -0.9840 8.2030 4.2470 HP 1 SER 0.078200 + 7 CB -1.5620 7.9760 2.1440 CT 1 SER 0.259600 + 8 HB2 -1.9950 7.0090 2.3990 H1 1 SER 0.027300 + 9 HB3 -0.9920 7.9230 1.2160 H1 1 SER 0.027300 + 10 OG -2.5570 8.9740 2.1030 OH 1 SER -0.671400 + 11 HG -3.2480 8.5930 1.5560 HO 1 SER 0.423900 + 12 C 0.4330 7.0570 3.2610 C 1 SER 0.616300 + 13 O 1.4320 6.9500 2.5520 O 1 SER -0.572200 + 14 N 0.0770 5.9860 3.9740 N 2 TRP -0.415700 + 15 H -0.7990 6.0530 4.4740 H 2 TRP 0.271900 + 16 CA 0.6140 4.6410 4.0210 CT 2 TRP -0.027500 + 17 HA 1.5880 4.7520 4.4960 H1 2 TRP 0.112300 + 18 CB -0.3230 3.8320 4.9130 CT 2 TRP -0.005000 + 19 HB2 -1.2040 3.5870 4.3190 HC 2 TRP 0.033900 + 20 HB3 -0.5210 4.4450 5.7920 HC 2 TRP 0.033900 + 21 CG 0.2020 2.5650 5.5100 C* 2 TRP -0.141500 + 22 CD1 1.5030 2.3530 5.8130 CW 2 TRP -0.163800 + 23 HD1 2.2520 3.0130 5.4020 H4 2 TRP 0.206200 + 24 NE1 1.7100 1.1040 6.3640 NA 2 TRP -0.341800 + 25 HE1 2.5930 0.6160 6.4090 H 2 TRP 0.341200 + 26 CE2 0.5030 0.4710 6.5770 CN 2 TRP 0.138000 + 27 CZ2 0.1640 -0.7780 7.1130 CA 2 TRP -0.260100 + 28 HZ2 0.9130 -1.4800 7.4480 HA 2 TRP 0.157200 + 29 CH2 -1.2000 -1.0020 7.3350 CA 2 TRP -0.113400 + 30 HH2 -1.5150 -1.9100 7.8270 HA 2 TRP 0.141700 + 31 CZ3 -2.1940 -0.1250 6.8860 CA 2 TRP -0.197200 + 32 HZ3 -3.2320 -0.4150 6.9530 HA 2 TRP 0.144700 + 33 CE3 -1.8030 1.0450 6.2240 CA 2 TRP -0.238700 + 34 HE3 -2.5010 1.7520 5.8000 HA 2 TRP 0.170000 + 35 CD2 -0.4530 1.4210 6.1340 CB 2 TRP 0.124300 + 36 C 0.8910 3.9870 2.6750 C 2 TRP 0.597300 + 37 O 1.9900 3.5310 2.3660 O 2 TRP -0.567900 + 38 N -0.0560 4.2220 1.7640 N 3 THR -0.415700 + 39 H -0.8440 4.6380 2.2400 H 3 THR 0.271900 + 40 CA -0.2200 3.7240 0.4130 CT 3 THR -0.038900 + 41 HA -0.2730 2.6360 0.3940 H1 3 THR 0.100700 + 42 CB -1.5400 4.2540 -0.1400 CT 3 THR 0.365400 + 43 HB -1.5870 3.9580 -1.1880 H1 3 THR 0.004300 + 44 CG2 -2.7520 3.5900 0.5080 CT 3 THR -0.243800 + 45 HG21 -2.5160 3.3530 1.5460 HC 3 THR 0.064200 + 46 HG22 -3.5870 4.2780 0.6380 HC 3 THR 0.064200 + 47 HG23 -3.0610 2.6630 0.0250 HC 3 THR 0.064200 + 48 OG1 -1.6540 5.6550 -0.2550 OH 3 THR -0.676100 + 49 HG1 -0.8230 6.1060 -0.0880 HO 3 THR 0.410200 + 50 C 0.9610 4.1900 -0.4270 C 3 THR 0.597300 + 51 O 1.2720 5.3780 -0.4610 O 3 THR -0.567900 + 52 N 1.5440 3.2820 -1.2130 N 4 TRP -0.415700 + 53 H 1.2220 2.3250 -1.1810 H 4 TRP 0.271900 + 54 CA 2.4150 3.6050 -2.3250 CT 4 TRP -0.027500 + 55 HA 2.5860 4.6790 -2.4050 H1 4 TRP 0.112300 + 56 CB 3.7350 2.8440 -2.2430 CT 4 TRP -0.005000 + 57 HB2 3.4360 1.8020 -2.1220 HC 4 TRP 0.033900 + 58 HB3 4.2570 3.0960 -1.3200 HC 4 TRP 0.033900 + 59 CG 4.6580 3.0970 -3.3910 C* 4 TRP -0.141500 + 60 CD1 4.9050 2.2610 -4.4250 CW 4 TRP -0.163800 + 61 HD1 4.3870 1.3320 -4.6080 H4 4 TRP 0.206200 + 62 NE1 5.7670 2.8430 -5.3340 NA 4 TRP -0.341800 + 63 HE1 6.1610 2.3800 -6.1400 H 4 TRP 0.341200 + 64 CE2 6.1930 4.0710 -4.8680 CN 4 TRP 0.138000 + 65 CZ2 7.1420 5.0120 -5.2830 CA 4 TRP -0.260100 + 66 HZ2 7.7380 4.7880 -6.1550 HA 4 TRP 0.157200 + 67 CH2 7.2870 6.2390 -4.6250 CA 4 TRP -0.113400 + 68 HH2 8.0190 6.9740 -4.9250 HA 4 TRP 0.141700 + 69 CZ3 6.6030 6.4110 -3.4150 CA 4 TRP -0.197200 + 70 HZ3 6.7750 7.2880 -2.8100 HA 4 TRP 0.144700 + 71 CE3 5.7230 5.4420 -2.9190 CA 4 TRP -0.238700 + 72 HE3 5.2750 5.5260 -1.9390 HA 4 TRP 0.170000 + 73 CD2 5.5020 4.2600 -3.6430 CB 4 TRP 0.124300 + 74 C 1.6060 3.3600 -3.5910 C 4 TRP 0.597300 + 75 O 1.5440 4.2380 -4.4490 O 4 TRP -0.567900 + 76 N 0.9490 2.2320 -3.8700 N 5 GLU -0.516300 + 77 H 1.0890 1.4360 -3.2650 H 5 GLU 0.293600 + 78 CA -0.0670 1.9690 -4.8690 CT 5 GLU 0.039700 + 79 HA -0.0580 2.7230 -5.6560 H1 5 GLU 0.110500 + 80 CB 0.1390 0.6220 -5.5560 CT 5 GLU 0.056000 + 81 HB2 -0.3100 -0.2180 -5.0260 HC 5 GLU -0.017300 + 82 HB3 1.1780 0.4260 -5.8230 HC 5 GLU -0.017300 + 83 CG -0.4970 0.7060 -6.9400 CT 5 GLU 0.013600 + 84 HG2 0.1020 1.3520 -7.5810 HC 5 GLU -0.042500 + 85 HG3 -1.4670 1.1340 -6.6840 HC 5 GLU -0.042500 + 86 CD -0.7130 -0.6200 -7.6550 C 5 GLU 0.805400 + 87 OE1 0.3370 -1.2340 -7.9410 O2 5 GLU -0.818800 + 88 OE2 -1.7970 -1.2420 -7.6630 O2 5 GLU -0.818800 + 89 C -1.4210 1.9560 -4.1730 C 5 GLU 0.536600 + 90 O -1.6020 1.3750 -3.1050 O 5 GLU -0.581900 + 91 N -2.2190 2.9350 -4.6050 N 6 ASN -0.415700 + 92 H -1.8980 3.3690 -5.4590 H 6 ASN 0.271900 + 93 CA -3.3560 3.5740 -3.9750 CT 6 ASN 0.014300 + 94 HA -3.3290 3.5020 -2.8870 H1 6 ASN 0.104800 + 95 CB -3.2880 5.0970 -4.0500 CT 6 ASN -0.204100 + 96 HB2 -3.3860 5.4630 -5.0720 HC 6 ASN 0.079700 + 97 HB3 -2.3020 5.4100 -3.7070 HC 6 ASN 0.079700 + 98 CG -4.3350 5.7050 -3.1290 C 6 ASN 0.713000 + 99 OD1 -5.3900 6.1540 -3.5730 O 6 ASN -0.593100 + 100 ND2 -4.0990 5.8820 -1.8270 N 6 ASN -0.919100 + 101 HD21 -3.2380 5.6020 -1.3790 H 6 ASN 0.419600 + 102 HD22 -4.7140 6.3660 -1.1880 H 6 ASN 0.419600 + 103 C -4.6540 2.9990 -4.5230 C 6 ASN 0.597300 + 104 O -4.8150 2.7080 -5.7060 O 6 ASN -0.567900 + 105 N -5.4530 2.5630 -3.5470 N 7 GLY -0.415700 + 106 H -5.1070 2.7580 -2.6180 H 7 GLY 0.271900 + 107 CA -6.6720 1.7990 -3.7180 CT 7 GLY -0.025200 + 108 HA2 -6.6560 1.2320 -4.6490 H1 7 GLY 0.069800 + 109 HA3 -7.5310 2.4570 -3.5890 H1 7 GLY 0.069800 + 110 C -6.7350 0.8110 -2.5620 C 7 GLY 0.597300 + 111 O -6.5070 1.1990 -1.4180 O 7 GLY -0.567900 + 112 N -6.9270 -0.4870 -2.8050 N 8 LYS -0.347900 + 113 H -7.2230 -0.7290 -3.7400 H 8 LYS 0.274700 + 114 CA -6.6800 -1.6030 -1.9140 CT 8 LYS -0.240000 + 115 HA -7.0510 -1.4910 -0.8960 H1 8 LYS 0.142600 + 116 CB -7.4490 -2.7920 -2.4830 CT 8 LYS -0.009400 + 117 HB2 -7.2980 -3.5770 -1.7420 HC 8 LYS 0.036200 + 118 HB3 -6.8910 -3.0370 -3.3870 HC 8 LYS 0.036200 + 119 CG -8.9100 -2.7220 -2.9160 CT 8 LYS 0.018700 + 120 HG2 -9.0460 -1.9340 -3.6570 HC 8 LYS 0.010300 + 121 HG3 -9.5100 -2.4240 -2.0560 HC 8 LYS 0.010300 + 122 CD -9.5520 -3.9710 -3.5150 CT 8 LYS -0.047900 + 123 HD2 -8.9980 -4.1970 -4.4260 HC 8 LYS 0.062100 + 124 HD3 -10.6100 -3.7940 -3.7080 HC 8 LYS 0.062100 + 125 CE -9.5690 -5.1540 -2.5520 CT 8 LYS -0.014300 + 126 HE2 -9.8920 -4.7580 -1.5890 HP 8 LYS 0.113500 + 127 HE3 -8.5080 -5.3940 -2.4750 HP 8 LYS 0.113500 + 128 NZ -10.3180 -6.3380 -3.0000 N3 8 LYS -0.385400 + 129 HZ1 -10.4170 -7.0370 -2.2770 H 8 LYS 0.340000 + 130 HZ2 -11.1420 -6.0410 -3.5020 H 8 LYS 0.340000 + 131 HZ3 -9.7910 -6.8710 -3.6780 H 8 LYS 0.340000 + 132 C -5.2010 -1.9260 -1.7500 C 8 LYS 0.734100 + 133 O -4.5550 -2.6110 -2.5390 O 8 LYS -0.589400 + 134 N -4.6160 -1.1980 -0.7960 N 9 TRP -0.415700 + 135 H -5.2470 -0.6060 -0.2740 H 9 TRP 0.271900 + 136 CA -3.2310 -1.3920 -0.4180 CT 9 TRP -0.027500 + 137 HA -2.6130 -1.5850 -1.2940 H1 9 TRP 0.112300 + 138 CB -2.9020 -0.0290 0.1850 CT 9 TRP -0.005000 + 139 HB2 -3.6770 0.2160 0.9110 HC 9 TRP 0.033900 + 140 HB3 -2.9700 0.6790 -0.6410 HC 9 TRP 0.033900 + 141 CG -1.5210 0.0600 0.7500 C* 9 TRP -0.141500 + 142 CD1 -1.2500 0.3150 2.0500 CW 9 TRP -0.163800 + 143 HD1 -1.9330 0.4180 2.8800 H4 9 TRP 0.206200 + 144 NE1 0.1120 0.3910 2.2690 NA 9 TRP -0.341800 + 145 HE1 0.4730 0.4520 3.2100 H 9 TRP 0.341200 + 146 CE2 0.8020 -0.0150 1.1450 CN 9 TRP 0.138000 + 147 CZ2 2.1810 -0.0540 0.9030 CA 9 TRP -0.260100 + 148 HZ2 2.9370 0.0290 1.6700 HA 9 TRP 0.157200 + 149 CH2 2.5480 -0.1620 -0.4440 CA 9 TRP -0.113400 + 150 HH2 3.6010 -0.0910 -0.6750 HA 9 TRP 0.141700 + 151 CZ3 1.6130 -0.3740 -1.4640 CA 9 TRP -0.197200 + 152 HZ3 1.9160 -0.4960 -2.4940 HA 9 TRP 0.144700 + 153 CE3 0.2510 -0.4110 -1.1450 CA 9 TRP -0.238700 + 154 HE3 -0.4010 -0.5540 -1.9940 HA 9 TRP 0.170000 + 155 CD2 -0.2020 -0.0940 0.1460 CB 9 TRP 0.124300 + 156 C -3.0460 -2.4530 0.6580 C 9 TRP 0.597300 + 157 O -3.4300 -2.3600 1.8220 O 9 TRP -0.567900 + 158 N -2.1190 -3.3700 0.3730 N 10 THR -0.415700 + 159 H -1.5230 -3.3090 -0.4410 H 10 THR 0.271900 + 160 CA -1.5920 -4.3360 1.3150 CT 10 THR -0.038900 + 161 HA -2.2000 -4.3200 2.2200 H1 10 THR 0.100700 + 162 CB -1.6110 -5.8200 0.9640 CT 10 THR 0.365400 + 163 HB -1.0800 -6.3360 1.7650 H1 10 THR 0.004300 + 164 CG2 -3.0130 -6.4220 0.9370 CT 10 THR -0.243800 + 165 HG21 -3.7760 -5.7320 1.2990 HC 10 THR 0.064200 + 166 HG22 -3.2090 -6.7400 -0.0870 HC 10 THR 0.064200 + 167 HG23 -2.9840 -7.3040 1.5770 HC 10 THR 0.064200 + 168 OG1 -1.0470 -6.1680 -0.2800 OH 10 THR -0.676100 + 169 HG1 -0.3270 -5.5790 -0.5170 HO 10 THR 0.410200 + 170 C -0.1810 -3.9790 1.7610 C 10 THR 0.597300 + 171 O 0.7490 -4.2310 0.9970 O 10 THR -0.567900 + 172 N -0.0250 -3.4410 2.9730 N 11 TRP -0.415700 + 173 H -0.8450 -3.2600 3.5330 H 11 TRP 0.271900 + 174 CA 1.2920 -3.5070 3.5730 CT 11 TRP -0.027500 + 175 HA 2.0430 -3.0320 2.9400 H1 11 TRP 0.112300 + 176 CB 1.3120 -2.6540 4.8380 CT 11 TRP -0.005000 + 177 HB2 1.2290 -3.3250 5.6920 HC 11 TRP 0.033900 + 178 HB3 0.5960 -1.8320 4.8050 HC 11 TRP 0.033900 + 179 CG 2.6370 -2.0210 5.1160 C* 11 TRP -0.141500 + 180 CD1 3.1350 -0.9320 4.4880 CW 11 TRP -0.163800 + 181 HD1 2.5890 -0.3930 3.7280 H4 11 TRP 0.206200 + 182 NE1 4.4020 -0.6150 4.9380 NA 11 TRP -0.341800 + 183 HE1 4.9790 0.1820 4.7130 H 11 TRP 0.341200 + 184 CE2 4.7860 -1.5810 5.8460 CN 11 TRP 0.138000 + 185 CZ2 5.9410 -1.6940 6.6300 CA 11 TRP -0.260100 + 186 HZ2 6.7870 -1.0630 6.4030 HA 11 TRP 0.157200 + 187 CH2 6.1310 -2.8150 7.4470 CA 11 TRP -0.113400 + 188 HH2 7.0500 -2.9070 8.0070 HA 11 TRP 0.141700 + 189 CZ3 5.0720 -3.7180 7.5990 CA 11 TRP -0.197200 + 190 HZ3 5.2440 -4.6650 8.0890 HA 11 TRP 0.144700 + 191 CE3 3.8660 -3.5310 6.9140 CA 11 TRP -0.238700 + 192 HE3 3.0200 -4.1660 7.1350 HA 11 TRP 0.170000 + 193 CD2 3.6770 -2.4420 6.0490 CB 11 TRP 0.124300 + 194 C 1.7550 -4.9180 3.9060 C 11 TRP 0.597300 + 195 O 1.1090 -5.7330 4.5610 O 11 TRP -0.567900 + 196 N 2.8630 -5.2570 3.2430 N 12 LYS -0.347900 + 197 H 3.2790 -4.5700 2.6300 H 12 LYS 0.274700 + 198 CA 3.6410 -6.4400 3.5500 CT 12 LYS -0.240000 + 199 HA 3.1430 -6.9620 4.3680 H1 12 LYS 0.142600 + 200 CB 3.6760 -7.2910 2.2840 CT 12 LYS -0.009400 + 201 HB2 4.3500 -8.1280 2.4680 HC 12 LYS 0.036200 + 202 HB3 4.0320 -6.7470 1.4090 HC 12 LYS 0.036200 + 203 CG 2.2960 -7.7470 1.8190 CT 12 LYS 0.018700 + 204 HG2 1.8600 -6.9540 1.2110 HC 12 LYS 0.010300 + 205 HG3 1.6870 -8.0280 2.6780 HC 12 LYS 0.010300 + 206 CD 2.2240 -8.9860 0.9320 CT 12 LYS -0.047900 + 207 HD2 2.7370 -9.8630 1.3280 HC 12 LYS 0.062100 + 208 HD3 2.7790 -8.7280 0.0300 HC 12 LYS 0.062100 + 209 CE 0.7820 -9.3120 0.5530 CT 12 LYS -0.014300 + 210 HE2 0.3390 -8.3560 0.2710 HP 12 LYS 0.113500 + 211 HE3 0.2990 -9.6280 1.4780 HP 12 LYS 0.113500 + 212 NZ 0.5810 -10.4460 -0.3620 N3 12 LYS -0.385400 + 213 HZ1 0.7980 -11.3100 0.1130 H 12 LYS 0.340000 + 214 HZ2 -0.3870 -10.5080 -0.6420 H 12 LYS 0.340000 + 215 HZ3 1.0800 -10.3880 -1.2390 H 12 LYS 0.340000 + 216 C 4.9890 -6.1850 4.2100 C 12 LYS 0.734100 + 217 O 5.3240 -6.7970 5.2210 O 12 LYS -0.589400 + 218 N 5.7180 -5.1800 3.7190 N 13 NME -0.415700 + 219 H 5.3890 -4.6800 2.9060 H 13 NME 0.271900 + 220 CH3 6.9980 -4.8110 4.2870 CT 13 NME -0.149000 + 221 HH31 7.2700 -3.7730 4.0930 H1 13 NME 0.097600 + 222 HH32 7.0160 -4.9900 5.3620 H1 13 NME 0.097600 + 223 HH33 7.7550 -5.3990 3.7680 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N 2.5680 12.3590 0.0930 N3 1 SER 0.184900 + 2 H1 2.4520 12.6480 1.0530 H 1 SER 0.189800 + 3 H2 3.4390 11.8470 0.1050 H 1 SER 0.189800 + 4 H3 2.4940 13.1000 -0.5900 H 1 SER 0.189800 + 5 CA 1.4740 11.4380 -0.2520 CT 1 SER 0.056700 + 6 HA 0.5820 12.0120 -0.5030 HP 1 SER 0.078200 + 7 CB 1.7870 10.6040 -1.4910 CT 1 SER 0.259600 + 8 HB2 1.0770 9.8150 -1.7390 H1 1 SER 0.027300 + 9 HB3 2.7160 10.0330 -1.5030 H1 1 SER 0.027300 + 10 OG 1.8050 11.5120 -2.5700 OH 1 SER -0.671400 + 11 HG 1.2410 11.1920 -3.2780 HO 1 SER 0.423900 + 12 C 1.1340 10.4410 0.8460 C 1 SER 0.616300 + 13 O 1.9210 9.5780 1.2290 O 1 SER -0.572200 + 14 N -0.1100 10.5190 1.3250 N 2 TRP -0.415700 + 15 H -0.7350 11.2130 0.9400 H 2 TRP 0.271900 + 16 CA -0.6210 9.6270 2.3460 CT 2 TRP -0.027500 + 17 HA 0.0680 9.6450 3.1910 H1 2 TRP 0.112300 + 18 CB -1.9560 10.1840 2.8310 CT 2 TRP -0.005000 + 19 HB2 -2.6630 10.2240 2.0020 HC 2 TRP 0.033900 + 20 HB3 -1.7570 11.1740 3.2440 HC 2 TRP 0.033900 + 21 CG -2.6340 9.3750 3.8900 C* 2 TRP -0.141500 + 22 CD1 -2.1450 8.5630 4.8540 CW 2 TRP -0.163800 + 23 HD1 -1.0930 8.3340 4.9420 H4 2 TRP 0.206200 + 24 NE1 -3.1320 8.0540 5.6750 NA 2 TRP -0.341800 + 25 HE1 -2.8540 7.5250 6.4890 H 2 TRP 0.341200 + 26 CE2 -4.3440 8.5330 5.2200 CN 2 TRP 0.138000 + 27 CZ2 -5.6430 8.3300 5.7010 CA 2 TRP -0.260100 + 28 HZ2 -5.7890 7.7550 6.6040 HA 2 TRP 0.157200 + 29 CH2 -6.7130 9.0640 5.1760 CA 2 TRP -0.113400 + 30 HH2 -7.7210 8.8180 5.4770 HA 2 TRP 0.141700 + 31 CZ3 -6.4910 9.9980 4.1570 CA 2 TRP -0.197200 + 32 HZ3 -7.3930 10.4420 3.7620 HA 2 TRP 0.144700 + 33 CE3 -5.2020 10.0560 3.6140 CA 2 TRP -0.238700 + 34 HE3 -5.1840 10.4400 2.6050 HA 2 TRP 0.170000 + 35 CD2 -4.0720 9.4070 4.1360 CB 2 TRP 0.124300 + 36 C -0.7150 8.1530 1.9820 C 2 TRP 0.597300 + 37 O -0.2180 7.2160 2.6030 O 2 TRP -0.567900 + 38 N -1.2340 7.9240 0.7730 N 3 THR -0.415700 + 39 H -1.5800 8.6950 0.2190 H 3 THR 0.271900 + 40 CA -1.3990 6.6510 0.1020 CT 3 THR -0.038900 + 41 HA -0.9170 5.8440 0.6530 H1 3 THR 0.100700 + 42 CB -2.8700 6.2770 -0.0560 CT 3 THR 0.365400 + 43 HB -3.0300 5.4690 -0.7700 H1 3 THR 0.004300 + 44 CG2 -3.5410 5.8570 1.2480 CT 3 THR -0.243800 + 45 HG21 -3.8090 6.7030 1.8800 HC 3 THR 0.064200 + 46 HG22 -4.4430 5.2690 1.0770 HC 3 THR 0.064200 + 47 HG23 -2.7990 5.3080 1.8280 HC 3 THR 0.064200 + 48 OG1 -3.6900 7.3330 -0.5060 OH 3 THR -0.676100 + 49 HG1 -3.2660 7.8240 -1.2130 HO 3 THR 0.410200 + 50 C -0.6630 6.6690 -1.2300 C 3 THR 0.597300 + 51 O -1.2490 7.0580 -2.2380 O 3 THR -0.567900 + 52 N 0.5790 6.1830 -1.1700 N 4 TRP -0.415700 + 53 H 0.9870 5.9260 -0.2820 H 4 TRP 0.271900 + 54 CA 1.3900 5.9670 -2.3510 CT 4 TRP -0.027500 + 55 HA 1.2890 6.8610 -2.9660 H1 4 TRP 0.112300 + 56 CB 2.8500 5.7490 -1.9670 CT 4 TRP -0.005000 + 57 HB2 2.9260 4.8660 -1.3310 HC 4 TRP 0.033900 + 58 HB3 3.2520 6.6210 -1.4510 HC 4 TRP 0.033900 + 59 CG 3.6850 5.4910 -3.1800 C* 4 TRP -0.141500 + 60 CD1 4.0950 6.5170 -3.9590 CW 4 TRP -0.163800 + 61 HD1 3.9800 7.5810 -3.8150 H4 4 TRP 0.206200 + 62 NE1 4.9450 6.0410 -4.9390 NA 4 TRP -0.341800 + 63 HE1 5.2850 6.6710 -5.6510 H 4 TRP 0.341200 + 64 CE2 4.9670 4.6610 -4.9620 CN 4 TRP 0.138000 + 65 CZ2 5.4360 3.6970 -5.8630 CA 4 TRP -0.260100 + 66 HZ2 5.9280 3.9440 -6.7920 HA 4 TRP 0.157200 + 67 CH2 5.2070 2.3460 -5.5760 CA 4 TRP -0.113400 + 68 HH2 5.4960 1.6060 -6.3090 HA 4 TRP 0.141700 + 69 CZ3 4.6420 1.9950 -4.3450 CA 4 TRP -0.197200 + 70 HZ3 4.3290 0.9730 -4.1840 HA 4 TRP 0.144700 + 71 CE3 4.1900 2.9490 -3.4250 CA 4 TRP -0.238700 + 72 HE3 3.6870 2.5960 -2.5370 HA 4 TRP 0.170000 + 73 CD2 4.3250 4.3090 -3.7460 CB 4 TRP 0.124300 + 74 C 0.9310 4.8060 -3.2220 C 4 TRP 0.597300 + 75 O 0.9250 4.9430 -4.4440 O 4 TRP -0.567900 + 76 N 0.6050 3.7060 -2.5400 N 5 GLU -0.516300 + 77 H 0.7070 3.7410 -1.5360 H 5 GLU 0.293600 + 78 CA -0.3310 2.7250 -3.0490 CT 5 GLU 0.039700 + 79 HA -0.3320 2.9730 -4.1110 H1 5 GLU 0.110500 + 80 CB 0.2620 1.3700 -2.6720 CT 5 GLU 0.056000 + 81 HB2 -0.2040 1.0320 -1.7470 HC 5 GLU -0.017300 + 82 HB3 1.3510 1.3380 -2.6300 HC 5 GLU -0.017300 + 83 CG -0.1270 0.3600 -3.7480 CT 5 GLU 0.013600 + 84 HG2 0.2170 0.8280 -4.6700 HC 5 GLU -0.042500 + 85 HG3 -1.2030 0.2020 -3.8110 HC 5 GLU -0.042500 + 86 CD 0.4760 -1.0240 -3.5570 C 5 GLU 0.805400 + 87 OE1 1.6160 -1.1670 -4.0500 O2 5 GLU -0.818800 + 88 OE2 -0.1930 -1.8730 -2.9290 O2 5 GLU -0.818800 + 89 C -1.7420 2.9050 -2.5070 C 5 GLU 0.536600 + 90 O -1.9210 3.0310 -1.2980 O 5 GLU -0.581900 + 91 N -2.6790 3.1430 -3.4280 N 6 ASN -0.415700 + 92 H -2.5920 2.8810 -4.3990 H 6 ASN 0.271900 + 93 CA -4.0650 3.4410 -3.1260 CT 6 ASN 0.014300 + 94 HA -3.9240 4.1410 -2.3030 H1 6 ASN 0.104800 + 95 CB -4.6650 4.2250 -4.2900 CT 6 ASN -0.204100 + 96 HB2 -5.3610 3.5720 -4.8190 HC 6 ASN 0.079700 + 97 HB3 -3.8970 4.6230 -4.9520 HC 6 ASN 0.079700 + 98 CG -5.4840 5.4210 -3.8260 C 6 ASN 0.713000 + 99 OD1 -6.2700 5.3410 -2.8850 O 6 ASN -0.593100 + 100 ND2 -5.3640 6.6030 -4.4350 N 6 ASN -0.919100 + 101 HD21 -4.7420 6.7100 -5.2240 H 6 ASN 0.419600 + 102 HD22 -5.7640 7.4310 -4.0170 H 6 ASN 0.419600 + 103 C -4.7510 2.2190 -2.5330 C 6 ASN 0.597300 + 104 O -4.3910 1.0670 -2.7640 O 6 ASN -0.567900 + 105 N -5.7230 2.5060 -1.6640 N 7 GLY -0.415700 + 106 H -5.8760 3.4590 -1.3680 H 7 GLY 0.271900 + 107 CA -6.5190 1.4880 -1.0070 CT 7 GLY -0.025200 + 108 HA2 -7.0480 0.8370 -1.7030 H1 7 GLY 0.069800 + 109 HA3 -7.2680 1.9040 -0.3330 H1 7 GLY 0.069800 + 110 C -5.6480 0.5550 -0.1790 C 7 GLY 0.597300 + 111 O -4.8170 1.0730 0.5640 O 7 GLY -0.567900 + 112 N -5.7610 -0.7740 -0.2370 N 8 LYS -0.347900 + 113 H -6.5070 -1.1000 -0.8340 H 8 LYS 0.274700 + 114 CA -5.1460 -1.7160 0.6770 CT 8 LYS -0.240000 + 115 HA -5.1270 -1.3090 1.6880 H1 8 LYS 0.142600 + 116 CB -6.0850 -2.9180 0.6270 CT 8 LYS -0.009400 + 117 HB2 -5.5930 -3.7470 1.1380 HC 8 LYS 0.036200 + 118 HB3 -6.3050 -3.1020 -0.4240 HC 8 LYS 0.036200 + 119 CG -7.4230 -2.7380 1.3370 CT 8 LYS 0.018700 + 120 HG2 -7.9280 -1.9520 0.7750 HC 8 LYS 0.010300 + 121 HG3 -7.2810 -2.3880 2.3590 HC 8 LYS 0.010300 + 122 CD -8.2550 -4.0080 1.1840 CT 8 LYS -0.047900 + 123 HD2 -7.9580 -4.6940 1.9770 HC 8 LYS 0.062100 + 124 HD3 -8.0580 -4.4660 0.2150 HC 8 LYS 0.062100 + 125 CE -9.7430 -3.7230 1.3700 CT 8 LYS -0.014300 + 126 HE2 -10.0110 -3.1490 0.4830 HP 8 LYS 0.113500 + 127 HE3 -9.8560 -3.0290 2.2020 HP 8 LYS 0.113500 + 128 NZ -10.5970 -4.9150 1.4860 N3 8 LYS -0.385400 + 129 HZ1 -11.5440 -4.6690 1.2360 H 8 LYS 0.340000 + 130 HZ2 -10.1950 -5.5770 0.8390 H 8 LYS 0.340000 + 131 HZ3 -10.5230 -5.3640 2.3880 H 8 LYS 0.340000 + 132 C -3.7030 -2.1350 0.4330 C 8 LYS 0.734100 + 133 O -3.3980 -2.5010 -0.6990 O 8 LYS -0.589400 + 134 N -2.8370 -2.1440 1.4500 N 9 TRP -0.415700 + 135 H -3.2660 -1.8890 2.3280 H 9 TRP 0.271900 + 136 CA -1.4700 -2.6120 1.3410 CT 9 TRP -0.027500 + 137 HA -0.9110 -2.4110 0.4270 H1 9 TRP 0.112300 + 138 CB -0.6970 -1.8800 2.4340 CT 9 TRP -0.005000 + 139 HB2 -1.1700 -2.2050 3.3600 HC 9 TRP 0.033900 + 140 HB3 -0.7590 -0.7960 2.3390 HC 9 TRP 0.033900 + 141 CG 0.7540 -2.1150 2.7070 C* 9 TRP -0.141500 + 142 CD1 1.3100 -2.4420 3.8960 CW 9 TRP -0.163800 + 143 HD1 0.7430 -2.4140 4.8140 H4 9 TRP 0.206200 + 144 NE1 2.6710 -2.6170 3.7440 NA 9 TRP -0.341800 + 145 HE1 3.2160 -2.8110 4.5720 H 9 TRP 0.341200 + 146 CE2 3.0490 -2.2770 2.4610 CN 9 TRP 0.138000 + 147 CZ2 4.3240 -2.3840 1.8930 CA 9 TRP -0.260100 + 148 HZ2 5.2410 -2.5570 2.4360 HA 9 TRP 0.157200 + 149 CH2 4.4740 -2.0090 0.5520 CA 9 TRP -0.113400 + 150 HH2 5.5070 -1.9800 0.2390 HA 9 TRP 0.141700 + 151 CZ3 3.3440 -1.6840 -0.2070 CA 9 TRP -0.197200 + 152 HZ3 3.4230 -1.5230 -1.2720 HA 9 TRP 0.144700 + 153 CE3 2.0780 -1.7830 0.3830 CA 9 TRP -0.238700 + 154 HE3 1.2270 -1.5610 -0.2430 HA 9 TRP 0.170000 + 155 CD2 1.8470 -2.0440 1.7430 CB 9 TRP 0.124300 + 156 C -1.3820 -4.1250 1.4810 C 9 TRP 0.597300 + 157 O -1.3300 -4.6880 2.5720 O 9 TRP -0.567900 + 158 N -1.5080 -4.8160 0.3460 N 10 THR -0.415700 + 159 H -1.4630 -4.3840 -0.5660 H 10 THR 0.271900 + 160 CA -1.1440 -6.2190 0.3410 CT 10 THR -0.038900 + 161 HA -1.8110 -6.7080 1.0500 H1 10 THR 0.100700 + 162 CB -1.3370 -6.9320 -0.9940 CT 10 THR 0.365400 + 163 HB -1.0100 -7.9700 -0.9320 H1 10 THR 0.004300 + 164 CG2 -2.8370 -6.9880 -1.2690 CT 10 THR -0.243800 + 165 HG21 -3.0490 -5.9310 -1.4260 HC 10 THR 0.064200 + 166 HG22 -3.0930 -7.4340 -2.2300 HC 10 THR 0.064200 + 167 HG23 -3.2920 -7.4700 -0.4030 HC 10 THR 0.064200 + 168 OG1 -0.6650 -6.3420 -2.0850 OH 10 THR -0.676100 + 169 HG1 -1.0290 -6.7400 -2.8800 HO 10 THR 0.410200 + 170 C 0.2210 -6.5310 0.9390 C 10 THR 0.597300 + 171 O 1.2720 -6.1100 0.4610 O 10 THR -0.567900 + 172 N 0.1500 -7.2510 2.0610 N 11 TRP -0.415700 + 173 H -0.7370 -7.5370 2.4510 H 11 TRP 0.271900 + 174 CA 1.2940 -7.9120 2.6540 CT 11 TRP -0.027500 + 175 HA 1.8970 -7.0870 3.0340 H1 11 TRP 0.112300 + 176 CB 0.7440 -8.6050 3.8970 CT 11 TRP -0.005000 + 177 HB2 0.3160 -9.5760 3.6490 HC 11 TRP 0.033900 + 178 HB3 -0.0950 -8.0490 4.3160 HC 11 TRP 0.033900 + 179 CG 1.7590 -8.8560 4.9660 C* 11 TRP -0.141500 + 180 CD1 2.1020 -7.9870 5.9430 CW 11 TRP -0.163800 + 181 HD1 1.6360 -7.0200 6.0620 H4 11 TRP 0.206200 + 182 NE1 3.2700 -8.4370 6.5260 NA 11 TRP -0.341800 + 183 HE1 3.6120 -8.1090 7.4180 H 11 TRP 0.341200 + 184 CE2 3.6120 -9.6990 6.0830 CN 11 TRP 0.138000 + 185 CZ2 4.4720 -10.7340 6.4680 CA 11 TRP -0.260100 + 186 HZ2 5.1160 -10.8350 7.3300 HA 11 TRP 0.157200 + 187 CH2 4.5160 -11.9490 5.7740 CA 11 TRP -0.113400 + 188 HH2 5.2680 -12.6640 6.0730 HA 11 TRP 0.141700 + 189 CZ3 3.6270 -12.2020 4.7220 CA 11 TRP -0.197200 + 190 HZ3 3.6240 -13.0850 4.1010 HA 11 TRP 0.144700 + 191 CE3 2.7960 -11.1600 4.2940 CA 11 TRP -0.238700 + 192 HE3 2.1260 -11.4320 3.4920 HA 11 TRP 0.170000 + 193 CD2 2.7060 -9.9640 5.0230 CB 11 TRP 0.124300 + 194 C 2.2050 -8.7470 1.7660 C 11 TRP 0.597300 + 195 O 1.7170 -9.7200 1.1960 O 11 TRP -0.567900 + 196 N 3.4990 -8.4290 1.8490 N 12 LYS -0.347900 + 197 H 3.7020 -7.5930 2.3770 H 12 LYS 0.274700 + 198 CA 4.5550 -9.1850 1.2060 CT 12 LYS -0.240000 + 199 HA 4.1150 -9.8690 0.4800 H1 12 LYS 0.142600 + 200 CB 5.4900 -8.1870 0.5290 CT 12 LYS -0.009400 + 201 HB2 6.2940 -8.8110 0.1400 HC 12 LYS 0.036200 + 202 HB3 5.7640 -7.3570 1.1810 HC 12 LYS 0.036200 + 203 CG 4.7910 -7.5370 -0.6610 CT 12 LYS 0.018700 + 204 HG2 3.9210 -7.0310 -0.2420 HC 12 LYS 0.010300 + 205 HG3 4.5470 -8.3270 -1.3710 HC 12 LYS 0.010300 + 206 CD 5.6030 -6.4730 -1.3950 CT 12 LYS -0.047900 + 207 HD2 5.6910 -5.6540 -0.6820 HC 12 LYS 0.062100 + 208 HD3 4.9000 -6.1680 -2.1710 HC 12 LYS 0.062100 + 209 CE 6.9770 -6.9350 -1.8700 CT 12 LYS -0.014300 + 210 HE2 6.8710 -7.8940 -2.3760 HP 12 LYS 0.113500 + 211 HE3 7.5210 -7.2920 -0.9950 HP 12 LYS 0.113500 + 212 NZ 7.6300 -5.9360 -2.7310 N3 12 LYS -0.385400 + 213 HZ1 7.1600 -5.9920 -3.6230 H 12 LYS 0.340000 + 214 HZ2 7.7390 -5.0680 -2.2270 H 12 LYS 0.340000 + 215 HZ3 8.5080 -6.2730 -3.0990 H 12 LYS 0.340000 + 216 C 5.3320 -10.1440 2.0970 C 12 LYS 0.734100 + 217 O 5.3550 -11.2770 1.6220 O 12 LYS -0.589400 + 218 N 5.8320 -9.7320 3.2630 N 13 NME -0.415700 + 219 H 5.5630 -8.7890 3.5060 H 13 NME 0.271900 + 220 CH3 6.9330 -10.2970 4.0170 CT 13 NME -0.149000 + 221 HH31 7.7560 -9.5830 3.9870 H1 13 NME 0.097600 + 222 HH32 6.7090 -10.3500 5.0820 H1 13 NME 0.097600 + 223 HH33 7.4080 -11.1820 3.5940 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -3.5310 2.5650 1.7360 N3 1 SER 0.184900 + 2 H1 -2.8050 2.4120 1.0510 H 1 SER 0.189800 + 3 H2 -4.2920 1.9410 1.5070 H 1 SER 0.189800 + 4 H3 -3.7540 3.5360 1.5730 H 1 SER 0.189800 + 5 CA -2.9110 2.2850 3.0400 CT 1 SER 0.056700 + 6 HA -3.5710 2.3240 3.9070 HP 1 SER 0.078200 + 7 CB -2.7170 0.7760 3.1560 CT 1 SER 0.259600 + 8 HB2 -3.6960 0.3000 3.1980 H1 1 SER 0.027300 + 9 HB3 -2.2090 0.5840 4.1010 H1 1 SER 0.027300 + 10 OG -1.9710 0.2640 2.0740 OH 1 SER -0.671400 + 11 HG -1.8570 -0.6870 2.1330 HO 1 SER 0.423900 + 12 C -1.6560 3.0270 3.4790 C 1 SER 0.616300 + 13 O -1.6530 3.8510 4.3900 O 1 SER -0.572200 + 14 N -0.6160 2.9720 2.6430 N 2 TRP -0.415700 + 15 H -0.6490 2.2730 1.9150 H 2 TRP 0.271900 + 16 CA 0.5960 3.7640 2.6920 CT 2 TRP -0.027500 + 17 HA 0.6630 4.2520 3.6650 H1 2 TRP 0.112300 + 18 CB 1.8870 2.9530 2.6180 CT 2 TRP -0.005000 + 19 HB2 2.0590 2.5540 1.6190 HC 2 TRP 0.033900 + 20 HB3 1.7590 2.0690 3.2430 HC 2 TRP 0.033900 + 21 CG 3.1350 3.5590 3.1740 C* 2 TRP -0.141500 + 22 CD1 3.4720 3.6970 4.4760 CW 2 TRP -0.163800 + 23 HD1 2.9910 3.4710 5.4160 H4 2 TRP 0.206200 + 24 NE1 4.6320 4.4420 4.5540 NA 2 TRP -0.341800 + 25 HE1 4.8550 4.8220 5.4630 H 2 TRP 0.341200 + 26 CE2 5.2520 4.6030 3.3320 CN 2 TRP 0.138000 + 27 CZ2 6.4820 5.0730 2.8570 CA 2 TRP -0.260100 + 28 HZ2 7.1870 5.4570 3.5790 HA 2 TRP 0.157200 + 29 CH2 6.7750 5.0910 1.4880 CA 2 TRP -0.113400 + 30 HH2 7.7060 5.5450 1.1830 HA 2 TRP 0.141700 + 31 CZ3 5.7830 4.6090 0.6240 CA 2 TRP -0.197200 + 32 HZ3 5.8640 4.5640 -0.4520 HA 2 TRP 0.144700 + 33 CE3 4.5030 4.2450 1.0600 CA 2 TRP -0.238700 + 34 HE3 3.7760 3.8770 0.3520 HA 2 TRP 0.170000 + 35 CD2 4.2510 4.1440 2.4380 CB 2 TRP 0.124300 + 36 C 0.6760 4.9450 1.7350 C 2 TRP 0.597300 + 37 O 1.1990 6.0190 2.0240 O 2 TRP -0.567900 + 38 N 0.1140 4.6930 0.5510 N 3 THR -0.415700 + 39 H -0.2350 3.7870 0.2720 H 3 THR 0.271900 + 40 CA -0.1510 5.6140 -0.5360 CT 3 THR -0.038900 + 41 HA 0.7770 6.1390 -0.7590 H1 3 THR 0.100700 + 42 CB -0.3440 4.7970 -1.8110 CT 3 THR 0.365400 + 43 HB -0.5770 5.5250 -2.5880 H1 3 THR 0.004300 + 44 CG2 0.8000 3.8830 -2.2430 CT 3 THR -0.243800 + 45 HG21 1.7240 4.4020 -1.9900 HC 3 THR 0.064200 + 46 HG22 0.7300 2.9530 -1.6800 HC 3 THR 0.064200 + 47 HG23 0.7820 3.7570 -3.3260 HC 3 THR 0.064200 + 48 OG1 -1.3690 3.8300 -1.7650 OH 3 THR -0.676100 + 49 HG1 -1.2320 3.1890 -2.4670 HO 3 THR 0.410200 + 50 C -1.2240 6.6490 -0.2330 C 3 THR 0.597300 + 51 O -2.2450 6.2180 0.2990 O 3 THR -0.567900 + 52 N -0.9180 7.8940 -0.6080 N 4 TRP -0.415700 + 53 H 0.0280 8.0910 -0.9020 H 4 TRP 0.271900 + 54 CA -1.7840 8.9790 -0.1930 CT 4 TRP -0.027500 + 55 HA -1.7960 9.1440 0.8850 H1 4 TRP 0.112300 + 56 CB -1.2670 10.2680 -0.8240 CT 4 TRP -0.005000 + 57 HB2 -1.9970 11.0260 -0.5420 HC 4 TRP 0.033900 + 58 HB3 -1.1920 10.1610 -1.9060 HC 4 TRP 0.033900 + 59 CG 0.0350 10.8210 -0.3380 C* 4 TRP -0.141500 + 60 CD1 1.1780 10.8810 -1.0570 CW 4 TRP -0.163800 + 61 HD1 1.3670 10.6930 -2.1030 H4 4 TRP 0.206200 + 62 NE1 2.2050 11.2620 -0.2160 NA 4 TRP -0.341800 + 63 HE1 3.1690 11.3090 -0.5130 H 4 TRP 0.341200 + 64 CE2 1.7670 11.5270 1.0660 CN 4 TRP 0.138000 + 65 CZ2 2.3930 12.1140 2.1720 CA 4 TRP -0.260100 + 66 HZ2 3.4470 12.3460 2.2080 HA 4 TRP 0.157200 + 67 CH2 1.5870 12.3770 3.2870 CA 4 TRP -0.113400 + 68 HH2 2.0320 12.8430 4.1540 HA 4 TRP 0.141700 + 69 CZ3 0.2110 12.1190 3.2960 CA 4 TRP -0.197200 + 70 HZ3 -0.4070 12.3330 4.1550 HA 4 TRP 0.144700 + 71 CE3 -0.3860 11.5790 2.1500 CA 4 TRP -0.238700 + 72 HE3 -1.4500 11.4050 2.1990 HA 4 TRP 0.170000 + 73 CD2 0.3640 11.3280 0.9900 CB 4 TRP 0.124300 + 74 C -3.2230 8.7600 -0.6360 C 4 TRP 0.597300 + 75 O -4.1570 8.9510 0.1400 O 4 TRP -0.567900 + 76 N -3.4490 8.3780 -1.8950 N 5 GLU -0.516300 + 77 H -2.6060 8.3020 -2.4460 H 5 GLU 0.293600 + 78 CA -4.6550 7.8800 -2.5250 CT 5 GLU 0.039700 + 79 HA -5.5720 7.8820 -1.9350 H1 5 GLU 0.110500 + 80 CB -4.9450 8.5950 -3.8420 CT 5 GLU 0.056000 + 81 HB2 -4.0960 8.4810 -4.5160 HC 5 GLU -0.017300 + 82 HB3 -4.9280 9.6700 -3.6630 HC 5 GLU -0.017300 + 83 CG -6.2030 8.1410 -4.5770 CT 5 GLU 0.013600 + 84 HG2 -6.1980 7.0510 -4.5960 HC 5 GLU -0.042500 + 85 HG3 -6.1750 8.4640 -5.6180 HC 5 GLU -0.042500 + 86 CD -7.4790 8.7570 -4.0210 C 5 GLU 0.805400 + 87 OE1 -7.6760 8.8470 -2.7900 O2 5 GLU -0.818800 + 88 OE2 -8.3190 9.1810 -4.8440 O2 5 GLU -0.818800 + 89 C -4.2650 6.4230 -2.7240 C 5 GLU 0.536600 + 90 O -3.3580 6.0620 -3.4710 O 5 GLU -0.581900 + 91 N -5.0250 5.5900 -2.0100 N 6 ASN -0.415700 + 92 H -5.7670 6.0050 -1.4650 H 6 ASN 0.271900 + 93 CA -5.0610 4.1430 -2.0820 CT 6 ASN 0.014300 + 94 HA -4.2100 3.7150 -1.5530 H1 6 ASN 0.104800 + 95 CB -6.3730 3.7870 -1.3870 CT 6 ASN -0.204100 + 96 HB2 -7.2540 4.0820 -1.9570 HC 6 ASN 0.079700 + 97 HB3 -6.4110 4.2120 -0.3840 HC 6 ASN 0.079700 + 98 CG -6.3430 2.2950 -1.0880 C 6 ASN 0.713000 + 99 OD1 -5.8200 1.8160 -0.0850 O 6 ASN -0.593100 + 100 ND2 -6.7740 1.5360 -2.0970 N 6 ASN -0.919100 + 101 HD21 -7.0090 1.8800 -3.0170 H 6 ASN 0.419600 + 102 HD22 -6.7730 0.5310 -1.9940 H 6 ASN 0.419600 + 103 C -4.9690 3.7060 -3.5370 C 6 ASN 0.597300 + 104 O -5.8020 4.0490 -4.3730 O 6 ASN -0.567900 + 105 N -3.8850 2.9850 -3.8320 N 7 GLY -0.415700 + 106 H -3.1820 3.0260 -3.1080 H 7 GLY 0.271900 + 107 CA -3.5710 2.0450 -4.8890 CT 7 GLY -0.025200 + 108 HA2 -2.9950 2.5330 -5.6750 H1 7 GLY 0.069800 + 109 HA3 -4.5160 1.8340 -5.3900 H1 7 GLY 0.069800 + 110 C -3.1590 0.6510 -4.4390 C 7 GLY 0.597300 + 111 O -3.8060 0.0600 -3.5770 O 7 GLY -0.567900 + 112 N -2.2110 0.0490 -5.1600 N 8 LYS -0.347900 + 113 H -1.7170 0.6110 -5.8390 H 8 LYS 0.274700 + 114 CA -1.7290 -1.2920 -4.9000 CT 8 LYS -0.240000 + 115 HA -2.6060 -1.8260 -4.5320 H1 8 LYS 0.142600 + 116 CB -1.0900 -1.9210 -6.1340 CT 8 LYS -0.009400 + 117 HB2 -1.7530 -2.0170 -6.9940 HC 8 LYS 0.036200 + 118 HB3 -0.8290 -2.9270 -5.8060 HC 8 LYS 0.036200 + 119 CG 0.1160 -1.1210 -6.6190 CT 8 LYS 0.018700 + 120 HG2 0.8500 -1.1190 -5.8140 HC 8 LYS 0.010300 + 121 HG3 -0.1890 -0.0820 -6.7430 HC 8 LYS 0.010300 + 122 CD 0.9040 -1.6960 -7.7930 CT 8 LYS -0.047900 + 123 HD2 0.1820 -1.8710 -8.5910 HC 8 LYS 0.062100 + 124 HD3 1.3950 -2.5760 -7.3790 HC 8 LYS 0.062100 + 125 CE 1.8810 -0.7430 -8.4750 CT 8 LYS -0.014300 + 126 HE2 2.6960 -0.5520 -7.7770 HP 8 LYS 0.113500 + 127 HE3 1.3070 0.1580 -8.6930 HP 8 LYS 0.113500 + 128 NZ 2.4270 -1.2470 -9.7450 N3 8 LYS -0.385400 + 129 HZ1 1.7010 -1.5710 -10.3680 H 8 LYS 0.340000 + 130 HZ2 2.9780 -0.5180 -10.1750 H 8 LYS 0.340000 + 131 HZ3 2.9960 -2.0540 -9.5320 H 8 LYS 0.340000 + 132 C -0.8770 -1.4670 -3.6510 C 8 LYS 0.734100 + 133 O -0.0600 -0.6160 -3.3030 O 8 LYS -0.589400 + 134 N -1.1830 -2.4230 -2.7710 N 9 TRP -0.415700 + 135 H -2.0990 -2.8170 -2.9290 H 9 TRP 0.271900 + 136 CA -0.3610 -2.9160 -1.6840 CT 9 TRP -0.027500 + 137 HA 0.6240 -2.4770 -1.8400 H1 9 TRP 0.112300 + 138 CB -0.8140 -2.3870 -0.3260 CT 9 TRP -0.005000 + 139 HB2 -1.7940 -2.8020 -0.0920 HC 9 TRP 0.033900 + 140 HB3 -0.8900 -1.3050 -0.4340 HC 9 TRP 0.033900 + 141 CG 0.0910 -2.7410 0.8110 C* 9 TRP -0.141500 + 142 CD1 -0.2990 -3.2490 2.0010 CW 9 TRP -0.163800 + 143 HD1 -1.2930 -3.5640 2.2810 H4 9 TRP 0.206200 + 144 NE1 0.8200 -3.2760 2.8100 NA 9 TRP -0.341800 + 145 HE1 0.8270 -3.4920 3.7970 H 9 TRP 0.341200 + 146 CE2 1.9240 -2.7540 2.1670 CN 9 TRP 0.138000 + 147 CZ2 3.2370 -2.5330 2.6010 CA 9 TRP -0.260100 + 148 HZ2 3.4990 -2.8690 3.5930 HA 9 TRP 0.157200 + 149 CH2 4.2230 -2.2110 1.6610 CA 9 TRP -0.113400 + 150 HH2 5.2140 -2.0560 2.0620 HA 9 TRP 0.141700 + 151 CZ3 3.8620 -1.9280 0.3380 CA 9 TRP -0.197200 + 152 HZ3 4.5440 -1.5490 -0.4080 HA 9 TRP 0.144700 + 153 CE3 2.5040 -1.9200 -0.0020 CA 9 TRP -0.238700 + 154 HE3 2.2760 -1.5630 -0.9960 HA 9 TRP 0.170000 + 155 CD2 1.5280 -2.4920 0.8300 CB 9 TRP 0.124300 + 156 C -0.1210 -4.4180 -1.7140 C 9 TRP 0.597300 + 157 O -1.0110 -5.1810 -2.0850 O 9 TRP -0.567900 + 158 N 1.0810 -4.9090 -1.4040 N 10 THR -0.415700 + 159 H 1.7490 -4.1530 -1.3520 H 10 THR 0.271900 + 160 CA 1.4460 -6.2720 -1.0750 CT 10 THR -0.038900 + 161 HA 0.7610 -6.9630 -1.5660 H1 10 THR 0.100700 + 162 CB 2.8400 -6.7060 -1.5210 CT 10 THR 0.365400 + 163 HB 3.5860 -5.9210 -1.3950 H1 10 THR 0.004300 + 164 CG2 3.5150 -7.9550 -0.9630 CT 10 THR -0.243800 + 165 HG21 4.3120 -8.3240 -1.6090 HC 10 THR 0.064200 + 166 HG22 3.9130 -7.7510 0.0310 HC 10 THR 0.064200 + 167 HG23 2.7020 -8.6580 -0.7790 HC 10 THR 0.064200 + 168 OG1 2.7230 -6.8810 -2.9150 OH 10 THR -0.676100 + 169 HG1 2.2690 -6.0760 -3.1760 HO 10 THR 0.410200 + 170 C 1.3880 -6.3870 0.4420 C 10 THR 0.597300 + 171 O 2.2170 -5.7830 1.1190 O 10 THR -0.567900 + 172 N 0.5700 -7.3560 0.8600 N 11 TRP -0.415700 + 173 H 0.1200 -7.9160 0.1500 H 11 TRP 0.271900 + 174 CA 0.5690 -7.8270 2.2300 CT 11 TRP -0.027500 + 175 HA 0.9270 -7.0630 2.9190 H1 11 TRP 0.112300 + 176 CB -0.8290 -8.2510 2.6740 CT 11 TRP -0.005000 + 177 HB2 -1.2150 -9.0110 1.9950 HC 11 TRP 0.033900 + 178 HB3 -1.5210 -7.4350 2.4650 HC 11 TRP 0.033900 + 179 CG -1.0700 -8.7580 4.0590 C* 11 TRP -0.141500 + 180 CD1 -0.8460 -8.0030 5.1580 CW 11 TRP -0.163800 + 181 HD1 -0.4450 -7.0000 5.1720 H4 11 TRP 0.206200 + 182 NE1 -0.9930 -8.8480 6.2410 NA 11 TRP -0.341800 + 183 HE1 -0.7550 -8.6630 7.2050 H 11 TRP 0.341200 + 184 CE2 -1.5370 -10.0560 5.8560 CN 11 TRP 0.138000 + 185 CZ2 -2.0590 -11.1270 6.5920 CA 11 TRP -0.260100 + 186 HZ2 -2.0030 -11.1010 7.6700 HA 11 TRP 0.157200 + 187 CH2 -2.4860 -12.3000 5.9590 CA 11 TRP -0.113400 + 188 HH2 -2.8920 -13.1670 6.4600 HA 11 TRP 0.141700 + 189 CZ3 -2.5150 -12.2700 4.5590 CA 11 TRP -0.197200 + 190 HZ3 -2.8620 -13.1380 4.0190 HA 11 TRP 0.144700 + 191 CE3 -2.1370 -11.1750 3.7730 CA 11 TRP -0.238700 + 192 HE3 -2.3570 -11.1380 2.7170 HA 11 TRP 0.170000 + 193 CD2 -1.5720 -10.0740 4.4380 CB 11 TRP 0.124300 + 194 C 1.5870 -8.9490 2.3750 C 11 TRP 0.597300 + 195 O 1.3030 -10.0720 1.9630 O 11 TRP -0.567900 + 196 N 2.6680 -8.6980 3.1160 N 12 LYS -0.347900 + 197 H 2.7820 -7.7780 3.5160 H 12 LYS 0.274700 + 198 CA 3.6030 -9.7480 3.4680 CT 12 LYS -0.240000 + 199 HA 3.8470 -10.4680 2.6870 H1 12 LYS 0.142600 + 200 CB 4.8410 -9.0850 4.0650 CT 12 LYS -0.009400 + 201 HB2 5.4420 -9.8900 4.4880 HC 12 LYS 0.036200 + 202 HB3 4.4280 -8.4350 4.8360 HC 12 LYS 0.036200 + 203 CG 5.7990 -8.4830 3.0410 CT 12 LYS 0.018700 + 204 HG2 5.4320 -7.5810 2.5530 HC 12 LYS 0.010300 + 205 HG3 6.0510 -9.2440 2.3020 HC 12 LYS 0.010300 + 206 CD 7.1220 -8.1650 3.7330 CT 12 LYS -0.047900 + 207 HD2 6.9520 -7.1810 4.1710 HC 12 LYS 0.062100 + 208 HD3 7.9000 -8.0900 2.9730 HC 12 LYS 0.062100 + 209 CE 7.7460 -9.0090 4.8400 CT 12 LYS -0.014300 + 210 HE2 7.8050 -10.0300 4.4620 HP 12 LYS 0.113500 + 211 HE3 7.0010 -8.9610 5.6340 HP 12 LYS 0.113500 + 212 NZ 9.0180 -8.3730 5.2130 N3 12 LYS -0.385400 + 213 HZ1 9.6910 -8.5380 4.4780 H 12 LYS 0.340000 + 214 HZ2 8.8820 -7.3770 5.3150 H 12 LYS 0.340000 + 215 HZ3 9.4210 -8.8250 6.0210 H 12 LYS 0.340000 + 216 C 3.0230 -10.6330 4.5620 C 12 LYS 0.734100 + 217 O 3.1090 -11.8570 4.5020 O 12 LYS -0.589400 + 218 N 2.5200 -10.0560 5.6560 N 13 NME -0.415700 + 219 H 2.2580 -9.1020 5.4520 H 13 NME 0.271900 + 220 CH3 2.1240 -10.7870 6.8430 CT 13 NME -0.149000 + 221 HH31 3.0170 -11.3400 7.1330 H1 13 NME 0.097600 + 222 HH32 1.9400 -10.0090 7.5830 H1 13 NME 0.097600 + 223 HH33 1.1890 -11.3340 6.7210 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -1.1360 7.1690 4.5850 N3 1 SER 0.184900 + 2 H1 -0.2300 6.8990 4.2310 H 1 SER 0.189800 + 3 H2 -1.5070 6.2980 4.9370 H 1 SER 0.189800 + 4 H3 -1.5490 7.4520 3.7070 H 1 SER 0.189800 + 5 CA -0.8450 8.2170 5.5750 CT 1 SER 0.056700 + 6 HA -1.7650 8.6970 5.9090 HP 1 SER 0.078200 + 7 CB -0.3220 7.6540 6.8930 CT 1 SER 0.259600 + 8 HB2 -1.2560 7.2770 7.3100 H1 1 SER 0.027300 + 9 HB3 0.0230 8.4730 7.5230 H1 1 SER 0.027300 + 10 OG 0.6280 6.6150 6.8030 OH 1 SER -0.671400 + 11 HG 0.8230 6.3380 7.7010 HO 1 SER 0.423900 + 12 C 0.0950 9.2770 5.0190 C 1 SER 0.616300 + 13 O -0.3080 10.4170 4.7960 O 1 SER -0.572200 + 14 N 1.3800 8.9720 4.8200 N 2 TRP -0.415700 + 15 H 1.6820 8.1050 5.2410 H 2 TRP 0.271900 + 16 CA 2.3570 9.8440 4.2010 CT 2 TRP -0.027500 + 17 HA 2.0880 10.8500 4.5210 H1 2 TRP 0.112300 + 18 CB 3.7360 9.3980 4.6790 CT 2 TRP -0.005000 + 19 HB2 4.0180 8.3820 4.4030 HC 2 TRP 0.033900 + 20 HB3 3.7010 9.3540 5.7680 HC 2 TRP 0.033900 + 21 CG 4.8170 10.3860 4.3770 C* 2 TRP -0.141500 + 22 CD1 5.0360 11.3990 5.2450 CW 2 TRP -0.163800 + 23 HD1 4.5800 11.6280 6.1970 H4 2 TRP 0.206200 + 24 NE1 6.0630 12.1710 4.7380 NA 2 TRP -0.341800 + 25 HE1 6.4290 12.9660 5.2430 H 2 TRP 0.341200 + 26 CE2 6.3960 11.7640 3.4620 CN 2 TRP 0.138000 + 27 CZ2 7.2290 12.3900 2.5270 CA 2 TRP -0.260100 + 28 HZ2 7.8910 13.1840 2.8360 HA 2 TRP 0.157200 + 29 CH2 7.4410 11.7280 1.3120 CA 2 TRP -0.113400 + 30 HH2 8.1220 12.2630 0.6670 HA 2 TRP 0.141700 + 31 CZ3 6.5690 10.6820 0.9870 CA 2 TRP -0.197200 + 32 HZ3 6.7150 10.2320 0.0160 HA 2 TRP 0.144700 + 33 CE3 5.6520 10.1000 1.8700 CA 2 TRP -0.238700 + 34 HE3 4.9880 9.3010 1.5740 HA 2 TRP 0.170000 + 35 CD2 5.6070 10.6200 3.1730 CB 2 TRP 0.124300 + 36 C 2.2880 9.7790 2.6820 C 2 TRP 0.597300 + 37 O 2.4180 10.7850 1.9880 O 2 TRP -0.567900 + 38 N 1.9390 8.5900 2.1850 N 3 THR -0.415700 + 39 H 1.9120 7.8220 2.8400 H 3 THR 0.271900 + 40 CA 1.6810 8.3030 0.7880 CT 3 THR -0.038900 + 41 HA 2.1380 9.0050 0.0900 H1 3 THR 0.100700 + 42 CB 2.2780 6.9410 0.4470 CT 3 THR 0.365400 + 43 HB 1.8780 6.6510 -0.5250 H1 3 THR 0.004300 + 44 CG2 3.7950 6.9780 0.2890 CT 3 THR -0.243800 + 45 HG21 4.0800 7.7810 -0.3910 HC 3 THR 0.064200 + 46 HG22 4.2530 7.0370 1.2760 HC 3 THR 0.064200 + 47 HG23 4.1140 6.0370 -0.1590 HC 3 THR 0.064200 + 48 OG1 1.9340 5.8350 1.2520 OH 3 THR -0.676100 + 49 HG1 1.0470 5.5790 0.9870 HO 3 THR 0.410200 + 50 C 0.1770 8.3480 0.5590 C 3 THR 0.597300 + 51 O -0.5460 7.7100 1.3220 O 3 THR -0.567900 + 52 N -0.2540 9.1390 -0.4260 N 4 TRP -0.415700 + 53 H 0.4680 9.3800 -1.0900 H 4 TRP 0.271900 + 54 CA -1.6150 9.5770 -0.6590 CT 4 TRP -0.027500 + 55 HA -2.0590 9.8610 0.2950 H1 4 TRP 0.112300 + 56 CB -1.5490 10.7590 -1.6220 CT 4 TRP -0.005000 + 57 HB2 -2.5230 11.2410 -1.7000 HC 4 TRP 0.033900 + 58 HB3 -1.2930 10.3820 -2.6120 HC 4 TRP 0.033900 + 59 CG -0.6170 11.8350 -1.1640 C* 4 TRP -0.141500 + 60 CD1 0.5100 12.2580 -1.7800 CW 4 TRP -0.163800 + 61 HD1 0.7900 11.8710 -2.7480 H4 4 TRP 0.206200 + 62 NE1 1.1390 13.2530 -1.0570 NA 4 TRP -0.341800 + 63 HE1 2.0870 13.5510 -1.2360 H 4 TRP 0.341200 + 64 CE2 0.3920 13.6100 0.0470 CN 4 TRP 0.138000 + 65 CZ2 0.5330 14.5590 1.0660 CA 4 TRP -0.260100 + 66 HZ2 1.3660 15.2450 1.0200 HA 4 TRP 0.157200 + 67 CH2 -0.4930 14.6850 2.0100 CA 4 TRP -0.113400 + 68 HH2 -0.5290 15.4500 2.7730 HA 4 TRP 0.141700 + 69 CZ3 -1.6420 13.8920 1.9020 CA 4 TRP -0.197200 + 70 HZ3 -2.2450 13.9850 2.7930 HA 4 TRP 0.144700 + 71 CE3 -1.7580 12.9110 0.9110 CA 4 TRP -0.238700 + 72 HE3 -2.5760 12.2100 0.8330 HA 4 TRP 0.170000 + 73 CD2 -0.7600 12.7890 -0.0700 CB 4 TRP 0.124300 + 74 C -2.5100 8.4870 -1.2290 C 4 TRP 0.597300 + 75 O -3.6630 8.4600 -0.8030 O 4 TRP -0.567900 + 76 N -2.0780 7.6970 -2.2160 N 5 GLU -0.516300 + 77 H -1.0940 7.7230 -2.4400 H 5 GLU 0.293600 + 78 CA -2.7310 6.7540 -3.1010 CT 5 GLU 0.039700 + 79 HA -3.7800 7.0050 -3.2560 H1 5 GLU 0.110500 + 80 CB -2.2090 6.8360 -4.5320 CT 5 GLU 0.056000 + 81 HB2 -1.1450 6.6160 -4.4510 HC 5 GLU -0.017300 + 82 HB3 -2.3610 7.8800 -4.8080 HC 5 GLU -0.017300 + 83 CG -2.7940 6.0500 -5.7030 CT 5 GLU 0.013600 + 84 HG2 -2.6810 4.9800 -5.5290 HC 5 GLU -0.042500 + 85 HG3 -2.2160 6.3560 -6.5750 HC 5 GLU -0.042500 + 86 CD -4.2240 6.3440 -6.1330 C 5 GLU 0.805400 + 87 OE1 -4.4510 6.5460 -7.3450 O2 5 GLU -0.818800 + 88 OE2 -5.1000 6.4330 -5.2460 O2 5 GLU -0.818800 + 89 C -2.5550 5.3390 -2.5690 C 5 GLU 0.536600 + 90 O -1.4410 4.8390 -2.4270 O 5 GLU -0.581900 + 91 N -3.7040 4.6980 -2.3420 N 6 ASN -0.415700 + 92 H -4.6200 5.1160 -2.4220 H 6 ASN 0.271900 + 93 CA -3.8110 3.3420 -1.8420 CT 6 ASN 0.014300 + 94 HA -2.8510 3.1990 -1.3470 H1 6 ASN 0.104800 + 95 CB -4.8840 3.4250 -0.7610 CT 6 ASN -0.204100 + 96 HB2 -5.8730 3.5470 -1.2040 HC 6 ASN 0.079700 + 97 HB3 -4.8040 4.2290 -0.0290 HC 6 ASN 0.079700 + 98 CG -4.9140 2.2170 0.1650 C 6 ASN 0.713000 + 99 OD1 -4.0900 1.3100 0.2610 O 6 ASN -0.593100 + 100 ND2 -6.0380 1.9600 0.8360 N 6 ASN -0.919100 + 101 HD21 -6.8650 2.4570 0.5350 H 6 ASN 0.419600 + 102 HD22 -5.9860 1.1600 1.4500 H 6 ASN 0.419600 + 103 C -4.0910 2.3260 -2.9400 C 6 ASN 0.597300 + 104 O -4.9480 2.4370 -3.8130 O 6 ASN -0.567900 + 105 N -3.1570 1.4020 -3.1810 N 7 GLY -0.415700 + 106 H -2.4620 1.3100 -2.4540 H 7 GLY 0.271900 + 107 CA -3.1020 0.6060 -4.3900 CT 7 GLY -0.025200 + 108 HA2 -2.1310 0.8290 -4.8330 H1 7 GLY 0.069800 + 109 HA3 -3.6910 1.0980 -5.1650 H1 7 GLY 0.069800 + 110 C -3.4170 -0.8390 -4.0320 C 7 GLY 0.597300 + 111 O -4.4110 -1.0250 -3.3330 O 7 GLY -0.567900 + 112 N -2.5890 -1.7680 -4.5150 N 8 LYS -0.347900 + 113 H -1.7410 -1.4130 -4.9330 H 8 LYS 0.274700 + 114 CA -2.8350 -3.1850 -4.3410 CT 8 LYS -0.240000 + 115 HA -3.9220 -3.2580 -4.3570 H1 8 LYS 0.142600 + 116 CB -2.1980 -4.0480 -5.4270 CT 8 LYS -0.009400 + 117 HB2 -2.7430 -3.8290 -6.3450 HC 8 LYS 0.036200 + 118 HB3 -2.4080 -5.0360 -5.0180 HC 8 LYS 0.036200 + 119 CG -0.6890 -3.9440 -5.6290 CT 8 LYS 0.018700 + 120 HG2 -0.2550 -4.4970 -4.7960 HC 8 LYS 0.010300 + 121 HG3 -0.4260 -2.8950 -5.4990 HC 8 LYS 0.010300 + 122 CD -0.1980 -4.4550 -6.9810 CT 8 LYS -0.047900 + 123 HD2 0.8880 -4.4830 -6.8980 HC 8 LYS 0.062100 + 124 HD3 -0.4550 -3.7010 -7.7250 HC 8 LYS 0.062100 + 125 CE -0.6860 -5.8290 -7.4320 CT 8 LYS -0.014300 + 126 HE2 -1.7690 -5.8830 -7.3200 HP 8 LYS 0.113500 + 127 HE3 -0.1680 -6.5230 -6.7700 HP 8 LYS 0.113500 + 128 NZ -0.3370 -6.0660 -8.8410 N3 8 LYS -0.385400 + 129 HZ1 -0.7660 -5.3630 -9.4250 H 8 LYS 0.340000 + 130 HZ2 0.6400 -6.0670 -9.0940 H 8 LYS 0.340000 + 131 HZ3 -0.6800 -6.9550 -9.1770 H 8 LYS 0.340000 + 132 C -2.3160 -3.5830 -2.9670 C 8 LYS 0.734100 + 133 O -1.1040 -3.4790 -2.7890 O 8 LYS -0.589400 + 134 N -3.0860 -4.2590 -2.1110 N 9 TRP -0.415700 + 135 H -4.0420 -4.4080 -2.3980 H 9 TRP 0.271900 + 136 CA -2.6600 -4.7230 -0.8060 CT 9 TRP -0.027500 + 137 HA -1.7730 -4.1730 -0.4910 H1 9 TRP 0.112300 + 138 CB -3.7810 -4.5410 0.2130 CT 9 TRP -0.005000 + 139 HB2 -4.7080 -4.8780 -0.2510 HC 9 TRP 0.033900 + 140 HB3 -4.0050 -3.4960 0.4260 HC 9 TRP 0.033900 + 141 CG -3.7060 -5.3010 1.4980 C* 9 TRP -0.141500 + 142 CD1 -4.7770 -5.8720 2.0950 CW 9 TRP -0.163800 + 143 HD1 -5.7790 -5.8930 1.6930 H4 9 TRP 0.206200 + 144 NE1 -4.4220 -6.2750 3.3670 NA 9 TRP -0.341800 + 145 HE1 -5.0150 -6.7530 4.0300 H 9 TRP 0.341200 + 146 CE2 -3.1300 -5.8960 3.6700 CN 9 TRP 0.138000 + 147 CZ2 -2.4020 -5.9640 4.8640 CA 9 TRP -0.260100 + 148 HZ2 -2.6950 -6.5080 5.7500 HA 9 TRP 0.157200 + 149 CH2 -1.1630 -5.3180 4.9540 CA 9 TRP -0.113400 + 150 HH2 -0.6020 -5.5560 5.8460 HA 9 TRP 0.141700 + 151 CZ3 -0.6980 -4.6450 3.8190 CA 9 TRP -0.197200 + 152 HZ3 0.2340 -4.0990 3.8230 HA 9 TRP 0.144700 + 153 CE3 -1.3940 -4.6290 2.6040 CA 9 TRP -0.238700 + 154 HE3 -1.0030 -4.1390 1.7240 HA 9 TRP 0.170000 + 155 CD2 -2.6460 -5.2550 2.5000 CB 9 TRP 0.124300 + 156 C -2.2130 -6.1680 -0.9760 C 9 TRP 0.597300 + 157 O -3.0130 -7.0690 -1.2180 O 9 TRP -0.567900 + 158 N -0.8910 -6.3500 -0.9640 N 10 THR -0.415700 + 159 H -0.2710 -5.5620 -0.8410 H 10 THR 0.271900 + 160 CA -0.2810 -7.6350 -1.2400 CT 10 THR -0.038900 + 161 HA -1.0190 -8.3230 -1.6540 H1 10 THR 0.100700 + 162 CB 0.7780 -7.5450 -2.3350 CT 10 THR 0.365400 + 163 HB 1.6910 -7.2850 -1.7980 H1 10 THR 0.004300 + 164 CG2 1.1710 -8.9160 -2.8790 CT 10 THR -0.243800 + 165 HG21 0.2640 -9.5200 -2.8880 HC 10 THR 0.064200 + 166 HG22 1.6660 -8.7510 -3.8350 HC 10 THR 0.064200 + 167 HG23 1.8950 -9.3230 -2.1740 HC 10 THR 0.064200 + 168 OG1 0.3460 -6.6730 -3.3550 OH 10 THR -0.676100 + 169 HG1 -0.4820 -6.3160 -3.0260 HO 10 THR 0.410200 + 170 C 0.3190 -8.2680 0.0070 C 10 THR 0.597300 + 171 O 1.3670 -7.8130 0.4600 O 10 THR -0.567900 + 172 N -0.4430 -9.2260 0.5410 N 11 TRP -0.415700 + 173 H -1.2280 -9.5530 -0.0040 H 11 TRP 0.271900 + 174 CA 0.1090 -10.1190 1.5390 CT 11 TRP -0.027500 + 175 HA 0.6330 -9.4870 2.2560 H1 11 TRP 0.112300 + 176 CB -1.0830 -10.7510 2.2520 CT 11 TRP -0.005000 + 177 HB2 -1.6540 -11.4060 1.5950 HC 11 TRP 0.033900 + 178 HB3 -1.7080 -9.9570 2.6620 HC 11 TRP 0.033900 + 179 CG -0.8250 -11.5010 3.5190 C* 11 TRP -0.141500 + 180 CD1 -1.2060 -11.1470 4.7670 CW 11 TRP -0.163800 + 181 HD1 -1.7730 -10.2480 4.9580 H4 11 TRP 0.206200 + 182 NE1 -1.0310 -12.1720 5.6760 NA 11 TRP -0.341800 + 183 HE1 -1.3280 -12.0570 6.6350 H 11 TRP 0.341200 + 184 CE2 -0.5640 -13.2880 5.0120 CN 11 TRP 0.138000 + 185 CZ2 -0.3810 -14.5930 5.4850 CA 11 TRP -0.260100 + 186 HZ2 -0.7760 -14.8040 6.4680 HA 11 TRP 0.157200 + 187 CH2 -0.0320 -15.5760 4.5510 CA 11 TRP -0.113400 + 188 HH2 0.0740 -16.6110 4.8400 HA 11 TRP 0.141700 + 189 CZ3 0.2620 -15.1640 3.2460 CA 11 TRP -0.197200 + 190 HZ3 0.6650 -15.8180 2.4870 HA 11 TRP 0.144700 + 191 CE3 0.1060 -13.8530 2.7790 CA 11 TRP -0.238700 + 192 HE3 0.1380 -13.7790 1.7020 HA 11 TRP 0.170000 + 193 CD2 -0.3410 -12.8690 3.6750 CB 11 TRP 0.124300 + 194 C 0.9670 -11.2360 0.9620 C 11 TRP 0.597300 + 195 O 0.5120 -11.7740 -0.0450 O 11 TRP -0.567900 + 196 N 2.1830 -11.4910 1.4490 N 12 LYS -0.347900 + 197 H 2.3820 -10.9080 2.2500 H 12 LYS 0.274700 + 198 CA 3.2050 -12.2250 0.7310 CT 12 LYS -0.240000 + 199 HA 2.9190 -12.3340 -0.3150 H1 12 LYS 0.142600 + 200 CB 4.5960 -11.5960 0.7560 CT 12 LYS -0.009400 + 201 HB2 5.2880 -12.2530 0.2300 HC 12 LYS 0.036200 + 202 HB3 5.0080 -11.5380 1.7640 HC 12 LYS 0.036200 + 203 CG 4.5140 -10.2530 0.0360 CT 12 LYS 0.018700 + 204 HG2 3.9610 -9.6490 0.7550 HC 12 LYS 0.010300 + 205 HG3 4.0340 -10.2640 -0.9420 HC 12 LYS 0.010300 + 206 CD 5.9260 -9.7320 -0.2170 CT 12 LYS -0.047900 + 207 HD2 5.8450 -8.9600 -0.9830 HC 12 LYS 0.062100 + 208 HD3 6.5570 -10.5160 -0.6350 HC 12 LYS 0.062100 + 209 CE 6.4920 -9.1750 1.0860 CT 12 LYS -0.014300 + 210 HE2 6.5540 -9.9710 1.8280 HP 12 LYS 0.113500 + 211 HE3 5.9050 -8.3500 1.4890 HP 12 LYS 0.113500 + 212 NZ 7.8460 -8.6300 0.9030 N3 12 LYS -0.385400 + 213 HZ1 8.4290 -9.2390 0.3470 H 12 LYS 0.340000 + 214 HZ2 7.7160 -7.6670 0.6250 H 12 LYS 0.340000 + 215 HZ3 8.3240 -8.5610 1.7900 H 12 LYS 0.340000 + 216 C 3.3250 -13.6210 1.3240 C 12 LYS 0.734100 + 217 O 3.5350 -14.5920 0.6000 O 12 LYS -0.589400 + 218 N 3.3440 -13.7680 2.6510 N 13 NME -0.415700 + 219 H 3.1190 -13.0160 3.2860 H 13 NME 0.271900 + 220 CH3 3.8420 -14.9450 3.3330 CT 13 NME -0.149000 + 221 HH31 3.7040 -15.8420 2.7280 H1 13 NME 0.097600 + 222 HH32 4.9170 -14.8610 3.4950 H1 13 NME 0.097600 + 223 HH33 3.3230 -15.0060 4.2890 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N 0.3010 5.0950 3.4810 N3 1 SER 0.184900 + 2 H1 1.2180 5.1430 3.0600 H 1 SER 0.189800 + 3 H2 0.0670 4.1670 3.8040 H 1 SER 0.189800 + 4 H3 -0.3180 5.3210 2.7150 H 1 SER 0.189800 + 5 CA 0.2210 6.1460 4.5060 CT 1 SER 0.056700 + 6 HA -0.7310 6.0600 5.0290 HP 1 SER 0.078200 + 7 CB 1.2970 5.9460 5.5700 CT 1 SER 0.259600 + 8 HB2 1.1310 4.9640 6.0130 H1 1 SER 0.027300 + 9 HB3 1.1760 6.6720 6.3740 H1 1 SER 0.027300 + 10 OG 2.5560 5.8240 4.9460 OH 1 SER -0.671400 + 11 HG 3.2230 6.0380 5.6030 HO 1 SER 0.423900 + 12 C 0.2630 7.4890 3.7900 C 1 SER 0.616300 + 13 O -0.7520 7.9980 3.3210 O 1 SER -0.572200 + 14 N 1.4790 8.0150 3.6270 N 2 TRP -0.415700 + 15 H 2.2330 7.3980 3.8940 H 2 TRP 0.271900 + 16 CA 1.7000 9.2640 2.9270 CT 2 TRP -0.027500 + 17 HA 1.3780 10.0630 3.5950 H1 2 TRP 0.112300 + 18 CB 3.1920 9.3840 2.6310 CT 2 TRP -0.005000 + 19 HB2 3.4660 8.5520 1.9830 HC 2 TRP 0.033900 + 20 HB3 3.7710 9.2560 3.5460 HC 2 TRP 0.033900 + 21 CG 3.7140 10.6010 1.9370 C* 2 TRP -0.141500 + 22 CD1 3.5170 11.8800 2.3300 CW 2 TRP -0.163800 + 23 HD1 3.0130 12.1490 3.2460 H4 2 TRP 0.206200 + 24 NE1 4.1350 12.8130 1.5210 NA 2 TRP -0.341800 + 25 HE1 4.2370 13.8000 1.7070 H 2 TRP 0.341200 + 26 CE2 4.6740 12.1110 0.4620 CN 2 TRP 0.138000 + 27 CZ2 5.3000 12.5110 -0.7250 CA 2 TRP -0.260100 + 28 HZ2 5.3280 13.5800 -0.8730 HA 2 TRP 0.157200 + 29 CH2 5.8800 11.5530 -1.5650 CA 2 TRP -0.113400 + 30 HH2 6.3950 11.9660 -2.4190 HA 2 TRP 0.141700 + 31 CZ3 5.8000 10.1890 -1.2560 CA 2 TRP -0.197200 + 32 HZ3 6.2740 9.4740 -1.9130 HA 2 TRP 0.144700 + 33 CE3 5.0560 9.7740 -0.1460 CA 2 TRP -0.238700 + 34 HE3 5.1630 8.7320 0.1150 HA 2 TRP 0.170000 + 35 CD2 4.5710 10.7280 0.7630 CB 2 TRP 0.124300 + 36 C 0.8820 9.5030 1.6650 C 2 TRP 0.597300 + 37 O 0.2420 10.5280 1.4420 O 2 TRP -0.567900 + 38 N 0.7320 8.4520 0.8560 N 3 THR -0.415700 + 39 H 1.3680 7.6830 1.0140 H 3 THR 0.271900 + 40 CA 0.0200 8.4480 -0.4060 CT 3 THR -0.038900 + 41 HA -0.3590 9.4470 -0.6210 H1 3 THR 0.100700 + 42 CB 1.0290 8.1310 -1.5060 CT 3 THR 0.365400 + 43 HB 0.5640 7.7710 -2.4230 H1 3 THR 0.004300 + 44 CG2 1.9730 9.2140 -2.0210 CT 3 THR -0.243800 + 45 HG21 1.5560 9.8300 -2.8180 HC 3 THR 0.064200 + 46 HG22 2.2350 9.9330 -1.2450 HC 3 THR 0.064200 + 47 HG23 2.8890 8.9180 -2.5340 HC 3 THR 0.064200 + 48 OG1 1.8590 7.0550 -1.1290 OH 3 THR -0.676100 + 49 HG1 1.3170 6.2730 -1.2590 HO 3 THR 0.410200 + 50 C -1.1370 7.4600 -0.4090 C 3 THR 0.597300 + 51 O -0.9660 6.2450 -0.3330 O 3 THR -0.567900 + 52 N -2.2800 8.1510 -0.3870 N 4 TRP -0.415700 + 53 H -2.1080 9.1450 -0.3400 H 4 TRP 0.271900 + 54 CA -3.6590 7.7690 -0.1630 CT 4 TRP -0.027500 + 55 HA -3.8420 7.6810 0.9080 H1 4 TRP 0.112300 + 56 CB -4.5810 8.7740 -0.8470 CT 4 TRP -0.005000 + 57 HB2 -5.5910 8.3880 -0.7080 HC 4 TRP 0.033900 + 58 HB3 -4.4180 8.8490 -1.9220 HC 4 TRP 0.033900 + 59 CG -4.6410 10.1810 -0.3440 C* 4 TRP -0.141500 + 60 CD1 -4.7900 11.2240 -1.1910 CW 4 TRP -0.163800 + 61 HD1 -4.9030 11.0270 -2.2460 H4 4 TRP 0.206200 + 62 NE1 -4.6600 12.3900 -0.4610 NA 4 TRP -0.341800 + 63 HE1 -4.7500 13.2800 -0.9290 H 4 TRP 0.341200 + 64 CE2 -4.2900 12.1860 0.8530 CN 4 TRP 0.138000 + 65 CZ2 -3.9240 13.0710 1.8740 CA 4 TRP -0.260100 + 66 HZ2 -4.0050 14.1470 1.8540 HA 4 TRP 0.157200 + 67 CH2 -3.4650 12.4880 3.0610 CA 4 TRP -0.113400 + 68 HH2 -3.3610 13.1690 3.8930 HA 4 TRP 0.141700 + 69 CZ3 -3.3980 11.1010 3.2350 CA 4 TRP -0.197200 + 70 HZ3 -3.1020 10.7970 4.2290 HA 4 TRP 0.144700 + 71 CE3 -3.7100 10.2870 2.1390 CA 4 TRP -0.238700 + 72 HE3 -3.3970 9.2570 2.2170 HA 4 TRP 0.170000 + 73 CD2 -4.1850 10.7720 0.9100 CB 4 TRP 0.124300 + 74 C -3.9220 6.3750 -0.7160 C 4 TRP 0.597300 + 75 O -4.3510 5.4380 -0.0460 O 4 TRP -0.567900 + 76 N -3.5750 6.1970 -1.9930 N 5 GLU -0.516300 + 77 H -2.8040 6.7680 -2.3070 H 5 GLU 0.293600 + 78 CA -3.6850 4.8950 -2.6190 CT 5 GLU 0.039700 + 79 HA -4.7310 4.6020 -2.5240 H1 5 GLU 0.110500 + 80 CB -3.4540 4.9990 -4.1240 CT 5 GLU 0.056000 + 81 HB2 -2.4170 5.3160 -4.2420 HC 5 GLU -0.017300 + 82 HB3 -3.9110 5.9520 -4.3910 HC 5 GLU -0.017300 + 83 CG -3.8480 3.7820 -4.9560 CT 5 GLU 0.013600 + 84 HG2 -3.3720 2.9290 -4.4730 HC 5 GLU -0.042500 + 85 HG3 -3.4180 4.0230 -5.9280 HC 5 GLU -0.042500 + 86 CD -5.3630 3.6290 -4.9640 C 5 GLU 0.805400 + 87 OE1 -5.8800 2.7900 -4.1950 O2 5 GLU -0.818800 + 88 OE2 -6.0030 4.1590 -5.8970 O2 5 GLU -0.818800 + 89 C -2.8420 3.7170 -2.1540 C 5 GLU 0.536600 + 90 O -1.6150 3.7460 -2.0930 O 5 GLU -0.581900 + 91 N -3.5360 2.6160 -1.8550 N 6 ASN -0.415700 + 92 H -4.4930 2.5490 -2.1690 H 6 ASN 0.271900 + 93 CA -2.9350 1.3750 -1.4080 CT 6 ASN 0.014300 + 94 HA -2.1070 1.5610 -0.7250 H1 6 ASN 0.104800 + 95 CB -3.9840 0.5920 -0.6240 CT 6 ASN -0.204100 + 96 HB2 -3.7660 -0.4620 -0.4480 HC 6 ASN 0.079700 + 97 HB3 -4.9620 0.5560 -1.1040 HC 6 ASN 0.079700 + 98 CG -4.1980 1.1560 0.7730 C 6 ASN 0.713000 + 99 OD1 -3.3630 1.8770 1.3150 O 6 ASN -0.593100 + 100 ND2 -5.2480 0.7730 1.5020 N 6 ASN -0.919100 + 101 HD21 -5.9470 0.2150 1.0340 H 6 ASN 0.419600 + 102 HD22 -5.0680 0.5820 2.4770 H 6 ASN 0.419600 + 103 C -2.4080 0.6240 -2.6220 C 6 ASN 0.597300 + 104 O -3.0900 -0.0830 -3.3610 O 6 ASN -0.567900 + 105 N -1.1320 0.8740 -2.9240 N 7 GLY -0.415700 + 106 H -0.6340 1.4920 -2.2990 H 7 GLY 0.271900 + 107 CA -0.3700 0.3030 -4.0160 CT 7 GLY -0.025200 + 108 HA2 0.2760 1.1220 -4.3340 H1 7 GLY 0.069800 + 109 HA3 -0.8850 -0.1190 -4.8780 H1 7 GLY 0.069800 + 110 C 0.5420 -0.7730 -3.4440 C 7 GLY 0.597300 + 111 O 0.0270 -1.7090 -2.8370 O 7 GLY -0.567900 + 112 N 1.8310 -0.8120 -3.7900 N 8 LYS -0.347900 + 113 H 2.1010 -0.1600 -4.5120 H 8 LYS 0.274700 + 114 CA 2.7440 -1.8720 -3.4130 CT 8 LYS -0.240000 + 115 HA 2.3210 -2.7490 -3.9030 H1 8 LYS 0.142600 + 116 CB 4.1160 -1.6950 -4.0570 CT 8 LYS -0.009400 + 117 HB2 3.8900 -1.4230 -5.0880 HC 8 LYS 0.036200 + 118 HB3 4.6140 -2.6630 -4.1180 HC 8 LYS 0.036200 + 119 CG 4.9800 -0.6310 -3.3850 CT 8 LYS 0.018700 + 120 HG2 5.3600 -1.0670 -2.4610 HC 8 LYS 0.010300 + 121 HG3 4.4910 0.2870 -3.0610 HC 8 LYS 0.010300 + 122 CD 6.2420 -0.3740 -4.2040 CT 8 LYS -0.047900 + 123 HD2 6.0220 -0.1470 -5.2470 HC 8 LYS 0.062100 + 124 HD3 6.9160 -1.2290 -4.1580 HC 8 LYS 0.062100 + 125 CE 6.9590 0.8480 -3.6380 CT 8 LYS -0.014300 + 126 HE2 7.9730 0.8560 -4.0370 HP 8 LYS 0.113500 + 127 HE3 6.8790 0.6440 -2.5710 HP 8 LYS 0.113500 + 128 NZ 6.2620 2.0980 -3.9790 N3 8 LYS -0.385400 + 129 HZ1 5.2850 2.0500 -3.7280 H 8 LYS 0.340000 + 130 HZ2 6.7530 2.8470 -3.5130 H 8 LYS 0.340000 + 131 HZ3 6.4380 2.3400 -4.9440 H 8 LYS 0.340000 + 132 C 2.8310 -2.2170 -1.9330 C 8 LYS 0.734100 + 133 O 3.0640 -1.3380 -1.1060 O 8 LYS -0.589400 + 134 N 2.6180 -3.4740 -1.5370 N 9 TRP -0.415700 + 135 H 2.1440 -4.1290 -2.1420 H 9 TRP 0.271900 + 136 CA 2.6630 -3.8540 -0.1400 CT 9 TRP -0.027500 + 137 HA 3.6010 -3.5120 0.2970 H1 9 TRP 0.112300 + 138 CB 1.5140 -3.2140 0.6340 CT 9 TRP -0.005000 + 139 HB2 0.6280 -3.5700 0.1100 HC 9 TRP 0.033900 + 140 HB3 1.5820 -2.1270 0.5800 HC 9 TRP 0.033900 + 141 CG 1.2990 -3.5090 2.0840 C* 9 TRP -0.141500 + 142 CD1 0.3530 -4.4020 2.4550 CW 9 TRP -0.163800 + 143 HD1 -0.0850 -5.1530 1.8150 H4 9 TRP 0.206200 + 144 NE1 0.3820 -4.4840 3.8330 NA 9 TRP -0.341800 + 145 HE1 -0.2960 -5.0450 4.3290 H 9 TRP 0.341200 + 146 CE2 1.0510 -3.3930 4.3500 CN 9 TRP 0.138000 + 147 CZ2 1.1900 -2.7800 5.6010 CA 9 TRP -0.260100 + 148 HZ2 0.4740 -2.9170 6.3980 HA 9 TRP 0.157200 + 149 CH2 1.9850 -1.6440 5.7910 CA 9 TRP -0.113400 + 150 HH2 1.8620 -1.1090 6.7210 HA 9 TRP 0.141700 + 151 CZ3 2.6350 -1.0090 4.7250 CA 9 TRP -0.197200 + 152 HZ3 3.1800 -0.0920 4.8920 HA 9 TRP 0.144700 + 153 CE3 2.5580 -1.6800 3.4990 CA 9 TRP -0.238700 + 154 HE3 3.0630 -1.1330 2.7170 HA 9 TRP 0.170000 + 155 CD2 1.8060 -2.8460 3.2800 CB 9 TRP 0.124300 + 156 C 2.5500 -5.3710 -0.0830 C 9 TRP 0.597300 + 157 O 2.1130 -6.0440 -1.0130 O 9 TRP -0.567900 + 158 N 3.1450 -6.0520 0.8990 N 10 THR -0.415700 + 159 H 3.7160 -5.4550 1.4800 H 10 THR 0.271900 + 160 CA 3.3500 -7.4360 1.2750 CT 10 THR -0.038900 + 161 HA 4.0830 -7.8170 0.5630 H1 10 THR 0.100700 + 162 CB 4.0800 -7.4820 2.6140 CT 10 THR 0.365400 + 163 HB 3.3590 -7.1710 3.3700 H1 10 THR 0.004300 + 164 CG2 4.3910 -8.9190 3.0210 CT 10 THR -0.243800 + 165 HG21 4.6860 -8.9400 4.0710 HC 10 THR 0.064200 + 166 HG22 3.5050 -9.5430 2.9110 HC 10 THR 0.064200 + 167 HG23 5.1550 -9.3980 2.4080 HC 10 THR 0.064200 + 168 OG1 5.2360 -6.6740 2.6210 OH 10 THR -0.676100 + 169 HG1 5.6790 -6.7800 3.4660 HO 10 THR 0.410200 + 170 C 2.0470 -8.2220 1.3080 C 10 THR 0.597300 + 171 O 1.1790 -7.8690 2.1040 O 10 THR -0.567900 + 172 N 1.8690 -9.2730 0.5040 N 11 TRP -0.415700 + 173 H 2.5980 -9.4140 -0.1810 H 11 TRP 0.271900 + 174 CA 0.5790 -9.9020 0.3050 CT 11 TRP -0.027500 + 175 HA -0.0680 -9.0310 0.2070 H1 11 TRP 0.112300 + 176 CB 0.5250 -10.7550 -0.9590 CT 11 TRP -0.005000 + 177 HB2 1.3450 -11.4710 -0.9060 HC 11 TRP 0.033900 + 178 HB3 0.8910 -10.1720 -1.8040 HC 11 TRP 0.033900 + 179 CG -0.7310 -11.4760 -1.3310 C* 11 TRP -0.141500 + 180 CD1 -2.0030 -11.0340 -1.2130 CW 11 TRP -0.163800 + 181 HD1 -2.2680 -10.0390 -0.8880 H4 11 TRP 0.206200 + 182 NE1 -2.9000 -11.9980 -1.6290 NA 11 TRP -0.341800 + 183 HE1 -3.8560 -11.9080 -1.3150 H 11 TRP 0.341200 + 184 CE2 -2.2570 -13.1100 -2.1340 CN 11 TRP 0.138000 + 185 CZ2 -2.7240 -14.3130 -2.6770 CA 11 TRP -0.260100 + 186 HZ2 -3.7840 -14.4650 -2.8230 HA 11 TRP 0.157200 + 187 CH2 -1.7810 -15.3080 -2.9570 CA 11 TRP -0.113400 + 188 HH2 -2.0750 -16.2560 -3.3830 HA 11 TRP 0.141700 + 189 CZ3 -0.4200 -14.9860 -2.8930 CA 11 TRP -0.197200 + 190 HZ3 0.3180 -15.6940 -3.2400 HA 11 TRP 0.144700 + 191 CE3 0.0260 -13.7470 -2.4160 CA 11 TRP -0.238700 + 192 HE3 1.0330 -13.3590 -2.3800 HA 11 TRP 0.170000 + 193 CD2 -0.8870 -12.7850 -1.9560 CB 11 TRP 0.124300 + 194 C 0.1090 -10.6420 1.5490 C 11 TRP 0.597300 + 195 O 0.9370 -11.3200 2.1540 O 11 TRP -0.567900 + 196 N -1.1490 -10.5430 1.9840 N 12 LYS -0.347900 + 197 H -1.8010 -9.8950 1.5660 H 12 LYS 0.274700 + 198 CA -1.7380 -11.2680 3.0920 CT 12 LYS -0.240000 + 199 HA -1.1760 -11.1530 4.0190 H1 12 LYS 0.142600 + 200 CB -3.1720 -10.8270 3.3690 CT 12 LYS -0.009400 + 201 HB2 -3.8140 -11.7040 3.2860 HC 12 LYS 0.036200 + 202 HB3 -3.4450 -10.2270 2.5010 HC 12 LYS 0.036200 + 203 CG -3.3030 -10.1340 4.7220 CT 12 LYS 0.018700 + 204 HG2 -2.4810 -9.4490 4.9280 HC 12 LYS 0.010300 + 205 HG3 -3.3990 -10.9100 5.4820 HC 12 LYS 0.010300 + 206 CD -4.5850 -9.3070 4.7600 CT 12 LYS -0.047900 + 207 HD2 -5.4120 -9.9830 4.5440 HC 12 LYS 0.062100 + 208 HD3 -4.6440 -8.5470 3.9800 HC 12 LYS 0.062100 + 209 CE -4.9060 -8.6240 6.0860 CT 12 LYS -0.014300 + 210 HE2 -4.4680 -7.6350 5.9510 HP 12 LYS 0.113500 + 211 HE3 -4.3690 -9.1200 6.8950 HP 12 LYS 0.113500 + 212 NZ -6.3350 -8.4060 6.3560 N3 12 LYS -0.385400 + 213 HZ1 -6.9020 -7.8970 5.6930 H 12 LYS 0.340000 + 214 HZ2 -6.7830 -9.3110 6.3790 H 12 LYS 0.340000 + 215 HZ3 -6.4710 -7.9030 7.2210 H 12 LYS 0.340000 + 216 C -1.6970 -12.7680 2.8330 C 12 LYS 0.734100 + 217 O -1.2120 -13.5820 3.6160 O 12 LYS -0.589400 + 218 N -2.0990 -13.2000 1.6360 N 13 NME -0.415700 + 219 H -2.4040 -12.5770 0.9020 H 13 NME 0.271900 + 220 CH3 -2.0740 -14.5120 1.0220 CT 13 NME -0.149000 + 221 HH31 -2.0220 -14.4480 -0.0650 H1 13 NME 0.097600 + 222 HH32 -1.2460 -15.0640 1.4670 H1 13 NME 0.097600 + 223 HH33 -3.0180 -15.0540 1.0830 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -4.9870 12.1270 0.2260 N3 1 SER 0.184900 + 2 H1 -5.0750 13.0270 0.6760 H 1 SER 0.189800 + 3 H2 -4.3620 12.3890 -0.5220 H 1 SER 0.189800 + 4 H3 -5.8880 12.0290 -0.2200 H 1 SER 0.189800 + 5 CA -4.4890 10.9200 0.9030 CT 1 SER 0.056700 + 6 HA -5.3200 10.6990 1.5720 HP 1 SER 0.078200 + 7 CB -4.3050 9.7040 0.0000 CT 1 SER 0.259600 + 8 HB2 -3.4420 9.8550 -0.6500 H1 1 SER 0.027300 + 9 HB3 -5.2580 9.8090 -0.5190 H1 1 SER 0.027300 + 10 OG -4.4590 8.4670 0.6600 OH 1 SER -0.671400 + 11 HG -4.3210 7.8490 -0.0620 HO 1 SER 0.423900 + 12 C -3.1950 11.1690 1.6640 C 1 SER 0.616300 + 13 O -2.5400 12.1880 1.4560 O 1 SER -0.572200 + 14 N -2.7790 10.1710 2.4470 N 2 TRP -0.415700 + 15 H -3.3620 9.3510 2.5310 H 2 TRP 0.271900 + 16 CA -1.4720 10.0320 3.0570 CT 2 TRP -0.027500 + 17 HA -0.9990 10.9660 3.3610 H1 2 TRP 0.112300 + 18 CB -1.5020 9.2190 4.3480 CT 2 TRP -0.005000 + 19 HB2 -2.0920 8.3470 4.0650 HC 2 TRP 0.033900 + 20 HB3 -2.1690 9.6760 5.0790 HC 2 TRP 0.033900 + 21 CG -0.2000 8.7670 4.9270 C* 2 TRP -0.141500 + 22 CD1 0.8140 9.5430 5.3730 CW 2 TRP -0.163800 + 23 HD1 0.8930 10.6180 5.3120 H4 2 TRP 0.206200 + 24 NE1 1.8820 8.7820 5.8060 NA 2 TRP -0.341800 + 25 HE1 2.7250 9.1500 6.2220 H 2 TRP 0.341200 + 26 CE2 1.6160 7.4330 5.6850 CN 2 TRP 0.138000 + 27 CZ2 2.3410 6.2680 5.9610 CA 2 TRP -0.260100 + 28 HZ2 3.3530 6.4200 6.3060 HA 2 TRP 0.157200 + 29 CH2 1.7520 5.0010 5.8800 CA 2 TRP -0.113400 + 30 HH2 2.2080 4.0610 6.1570 HA 2 TRP 0.141700 + 31 CZ3 0.4350 5.0060 5.4070 CA 2 TRP -0.197200 + 32 HZ3 -0.1120 4.0800 5.3110 HA 2 TRP 0.144700 + 33 CE3 -0.3210 6.1520 5.1290 CA 2 TRP -0.238700 + 34 HE3 -1.3750 6.0750 4.9070 HA 2 TRP 0.170000 + 35 CD2 0.2730 7.4200 5.2260 CB 2 TRP 0.124300 + 36 C -0.4280 9.5710 2.0490 C 2 TRP 0.597300 + 37 O 0.5620 10.2830 1.9010 O 2 TRP -0.567900 + 38 N -0.8730 8.5380 1.3300 N 3 THR -0.415700 + 39 H -1.6650 8.0590 1.7340 H 3 THR 0.271900 + 40 CA -0.0550 8.0770 0.2270 CT 3 THR -0.038900 + 41 HA 0.8220 8.7180 0.1400 H1 3 THR 0.100700 + 42 CB 0.4370 6.6510 0.4620 CT 3 THR 0.365400 + 43 HB 0.9760 6.3950 -0.4500 H1 3 THR 0.004300 + 44 CG2 1.3370 6.5430 1.6890 CT 3 THR -0.243800 + 45 HG21 0.7660 6.8220 2.5740 HC 3 THR 0.064200 + 46 HG22 1.8040 5.5630 1.7930 HC 3 THR 0.064200 + 47 HG23 2.1050 7.3070 1.5720 HC 3 THR 0.064200 + 48 OG1 -0.5060 5.6150 0.6180 OH 3 THR -0.676100 + 49 HG1 -0.0680 4.8150 0.9180 HO 3 THR 0.410200 + 50 C -0.6770 8.2700 -1.1490 C 3 THR 0.597300 + 51 O -1.7230 7.7350 -1.5090 O 3 THR -0.567900 + 52 N 0.0090 9.0050 -2.0270 N 4 TRP -0.415700 + 53 H 0.9280 9.2880 -1.7190 H 4 TRP 0.271900 + 54 CA -0.1120 9.1710 -3.4610 CT 4 TRP -0.027500 + 55 HA -1.1570 9.2920 -3.7450 H1 4 TRP 0.112300 + 56 CB 0.6680 10.3960 -3.9310 CT 4 TRP -0.005000 + 57 HB2 0.6710 10.3010 -5.0170 HC 4 TRP 0.033900 + 58 HB3 1.7150 10.3070 -3.6410 HC 4 TRP 0.033900 + 59 CG 0.1930 11.6880 -3.3490 C* 4 TRP -0.141500 + 60 CD1 -0.8320 12.4470 -3.7990 CW 4 TRP -0.163800 + 61 HD1 -1.3880 12.1760 -4.6850 H4 4 TRP 0.206200 + 62 NE1 -0.9700 13.5530 -2.9840 NA 4 TRP -0.341800 + 63 HE1 -1.5040 14.3920 -3.1590 H 4 TRP 0.341200 + 64 CE2 0.0290 13.6050 -2.0330 CN 4 TRP 0.138000 + 65 CZ2 0.3690 14.5660 -1.0730 CA 4 TRP -0.260100 + 66 HZ2 -0.2640 15.4030 -0.8190 HA 4 TRP 0.157200 + 67 CH2 1.4480 14.3040 -0.2200 CA 4 TRP -0.113400 + 68 HH2 1.7510 14.9780 0.5670 HA 4 TRP 0.141700 + 69 CZ3 2.1560 13.1050 -0.3650 CA 4 TRP -0.197200 + 70 HZ3 3.0430 12.8780 0.2080 HA 4 TRP 0.144700 + 71 CE3 1.8630 12.1750 -1.3710 CA 4 TRP -0.238700 + 72 HE3 2.4380 11.2620 -1.3600 HA 4 TRP 0.170000 + 73 CD2 0.7670 12.4080 -2.2170 CB 4 TRP 0.124300 + 74 C 0.2450 7.9620 -4.3140 C 4 TRP 0.597300 + 75 O -0.5330 7.4720 -5.1290 O 4 TRP -0.567900 + 76 N 1.4790 7.4610 -4.2160 N 5 GLU -0.516300 + 77 H 2.1530 7.9870 -3.6780 H 5 GLU 0.293600 + 78 CA 1.7590 6.0760 -4.5360 CT 5 GLU 0.039700 + 79 HA 1.5360 5.9570 -5.5960 H1 5 GLU 0.110500 + 80 CB 3.2590 5.8270 -4.4000 CT 5 GLU 0.056000 + 81 HB2 3.4110 4.7520 -4.4930 HC 5 GLU -0.017300 + 82 HB3 3.5470 6.1960 -3.4160 HC 5 GLU -0.017300 + 83 CG 4.1910 6.4440 -5.4390 CT 5 GLU 0.013600 + 84 HG2 3.6650 6.2790 -6.3790 HC 5 GLU -0.042500 + 85 HG3 5.0370 5.7570 -5.4760 HC 5 GLU -0.042500 + 86 CD 4.4820 7.8700 -4.9930 C 5 GLU 0.805400 + 87 OE1 4.9180 8.1250 -3.8500 O2 5 GLU -0.818800 + 88 OE2 4.1860 8.7660 -5.8130 O2 5 GLU -0.818800 + 89 C 0.9170 5.1950 -3.6240 C 5 GLU 0.536600 + 90 O 1.0550 5.2150 -2.4030 O 5 GLU -0.581900 + 91 N 0.0650 4.3710 -4.2380 N 6 ASN -0.415700 + 92 H 0.2270 4.2920 -5.2320 H 6 ASN 0.271900 + 93 CA -0.9000 3.5590 -3.5250 CT 6 ASN 0.014300 + 94 HA -1.0240 3.9840 -2.5290 H1 6 ASN 0.104800 + 95 CB -2.1890 3.5290 -4.3420 CT 6 ASN -0.204100 + 96 HB2 -1.9810 3.0280 -5.2870 HC 6 ASN 0.079700 + 97 HB3 -2.6240 4.5230 -4.4470 HC 6 ASN 0.079700 + 98 CG -3.2770 2.6680 -3.7150 C 6 ASN 0.713000 + 99 OD1 -4.0370 3.0560 -2.8310 O 6 ASN -0.593100 + 100 ND2 -3.6590 1.5080 -4.2530 N 6 ASN -0.919100 + 101 HD21 -3.2670 1.1800 -5.1240 H 6 ASN 0.419600 + 102 HD22 -4.4660 1.0760 -3.8240 H 6 ASN 0.419600 + 103 C -0.1950 2.2400 -3.2430 C 6 ASN 0.597300 + 104 O 0.4770 1.7630 -4.1550 O 6 ASN -0.567900 + 105 N -0.3650 1.6010 -2.0830 N 7 GLY -0.415700 + 106 H -1.1250 1.9290 -1.5030 H 7 GLY 0.271900 + 107 CA 0.2320 0.3240 -1.7490 CT 7 GLY -0.025200 + 108 HA2 1.2990 0.3390 -1.9730 H1 7 GLY 0.069800 + 109 HA3 -0.2380 -0.4460 -2.3600 H1 7 GLY 0.069800 + 110 C 0.0960 0.0960 -0.2500 C 7 GLY 0.597300 + 111 O 0.8600 0.6080 0.5650 O 7 GLY -0.567900 + 112 N -1.0300 -0.5520 0.0550 N 8 LYS -0.347900 + 113 H -1.6010 -0.9060 -0.7000 H 8 LYS 0.274700 + 114 CA -1.3520 -0.9530 1.4100 CT 8 LYS -0.240000 + 115 HA -0.8190 -0.4670 2.2260 H1 8 LYS 0.142600 + 116 CB -2.8370 -0.7040 1.6580 CT 8 LYS -0.009400 + 117 HB2 -3.1690 -1.2170 2.5610 HC 8 LYS 0.036200 + 118 HB3 -3.4300 -0.9960 0.7910 HC 8 LYS 0.036200 + 119 CG -3.1880 0.7660 1.8630 CT 8 LYS 0.018700 + 120 HG2 -2.8720 1.2560 0.9420 HC 8 LYS 0.010300 + 121 HG3 -2.7030 1.0540 2.7960 HC 8 LYS 0.010300 + 122 CD -4.6750 1.0720 2.0160 CT 8 LYS -0.047900 + 123 HD2 -5.1270 0.6500 2.9140 HC 8 LYS 0.062100 + 124 HD3 -5.1700 0.4890 1.2390 HC 8 LYS 0.062100 + 125 CE -5.1750 2.5130 2.0430 CT 8 LYS -0.014300 + 126 HE2 -6.2610 2.5170 2.1290 HP 8 LYS 0.113500 + 127 HE3 -4.9620 2.9550 1.0690 HP 8 LYS 0.113500 + 128 NZ -4.4520 3.3420 3.0210 N3 8 LYS -0.385400 + 129 HZ1 -4.4810 2.9920 3.9680 H 8 LYS 0.340000 + 130 HZ2 -3.4870 3.4700 2.7530 H 8 LYS 0.340000 + 131 HZ3 -4.6560 4.3170 3.1840 H 8 LYS 0.340000 + 132 C -1.0580 -2.4440 1.4970 C 8 LYS 0.734100 + 133 O -1.6160 -3.1630 0.6710 O 8 LYS -0.589400 + 134 N -0.1330 -2.8730 2.3590 N 9 TRP -0.415700 + 135 H 0.2060 -2.1620 2.9920 H 9 TRP 0.271900 + 136 CA 0.3570 -4.2270 2.5170 CT 9 TRP -0.027500 + 137 HA 0.9450 -4.4780 1.6340 H1 9 TRP 0.112300 + 138 CB 1.2990 -4.2440 3.7170 CT 9 TRP -0.005000 + 139 HB2 0.8170 -4.0570 4.6760 HC 9 TRP 0.033900 + 140 HB3 2.0550 -3.4660 3.6100 HC 9 TRP 0.033900 + 141 CG 1.9770 -5.5710 3.8430 C* 9 TRP -0.141500 + 142 CD1 1.4200 -6.6180 4.4920 CW 9 TRP -0.163800 + 143 HD1 0.4630 -6.6900 4.9870 H4 9 TRP 0.206200 + 144 NE1 2.2770 -7.7000 4.4510 NA 9 TRP -0.341800 + 145 HE1 2.0180 -8.6090 4.8090 H 9 TRP 0.341200 + 146 CE2 3.3850 -7.4210 3.6770 CN 9 TRP 0.138000 + 147 CZ2 4.4810 -8.1780 3.2460 CA 9 TRP -0.260100 + 148 HZ2 4.5150 -9.2450 3.4130 HA 9 TRP 0.157200 + 149 CH2 5.4640 -7.5730 2.4550 CA 9 TRP -0.113400 + 150 HH2 6.3380 -8.1670 2.2290 HA 9 TRP 0.141700 + 151 CZ3 5.4440 -6.1860 2.2630 CA 9 TRP -0.197200 + 152 HZ3 6.2660 -5.6910 1.7680 HA 9 TRP 0.144700 + 153 CE3 4.2980 -5.4570 2.6030 CA 9 TRP -0.238700 + 154 HE3 4.3020 -4.3870 2.4570 HA 9 TRP 0.170000 + 155 CD2 3.2380 -6.0610 3.2980 CB 9 TRP 0.124300 + 156 C -0.7020 -5.3200 2.5520 C 9 TRP 0.597300 + 157 O -1.3680 -5.6530 3.5290 O 9 TRP -0.567900 + 158 N -0.8290 -6.0130 1.4180 N 10 THR -0.415700 + 159 H -0.2100 -5.7380 0.6690 H 10 THR 0.271900 + 160 CA -1.7360 -7.1250 1.2150 CT 10 THR -0.038900 + 161 HA -2.1050 -7.4760 2.1780 H1 10 THR 0.100700 + 162 CB -2.8750 -6.7250 0.2810 CT 10 THR 0.365400 + 163 HB -3.3200 -7.6720 -0.0230 H1 10 THR 0.004300 + 164 CG2 -3.9240 -5.9160 1.0370 CT 10 THR -0.243800 + 165 HG21 -3.5190 -4.9100 1.1510 HC 10 THR 0.064200 + 166 HG22 -4.7700 -5.7440 0.3710 HC 10 THR 0.064200 + 167 HG23 -4.3800 -6.4030 1.8990 HC 10 THR 0.064200 + 168 OG1 -2.4300 -5.9910 -0.8380 OH 10 THR -0.676100 + 169 HG1 -2.1010 -5.1350 -0.5550 HO 10 THR 0.410200 + 170 C -0.8920 -8.3140 0.7810 C 10 THR 0.597300 + 171 O -0.6040 -8.4730 -0.4040 O 10 THR -0.567900 + 172 N -0.6160 -9.2980 1.6400 N 11 TRP -0.415700 + 173 H -1.2400 -9.3830 2.4290 H 11 TRP 0.271900 + 174 CA 0.1410 -10.5070 1.3890 CT 11 TRP -0.027500 + 175 HA 0.5780 -10.5300 0.3910 H1 11 TRP 0.112300 + 176 CB 1.2810 -10.6520 2.3930 CT 11 TRP -0.005000 + 177 HB2 0.8030 -10.7920 3.3630 HC 11 TRP 0.033900 + 178 HB3 1.9020 -9.7620 2.4880 HC 11 TRP 0.033900 + 179 CG 2.3120 -11.6780 2.0470 C* 11 TRP -0.141500 + 180 CD1 3.2610 -11.5340 1.0950 CW 11 TRP -0.163800 + 181 HD1 3.2840 -10.7140 0.3920 H4 11 TRP 0.206200 + 182 NE1 3.9780 -12.7130 1.0440 NA 11 TRP -0.341800 + 183 HE1 4.8340 -12.8230 0.5180 H 11 TRP 0.341200 + 184 CE2 3.5060 -13.6530 1.9380 CN 11 TRP 0.138000 + 185 CZ2 3.9070 -14.9550 2.2610 CA 11 TRP -0.260100 + 186 HZ2 4.7300 -15.3450 1.6810 HA 11 TRP 0.157200 + 187 CH2 3.2550 -15.5920 3.3230 CA 11 TRP -0.113400 + 188 HH2 3.6470 -16.4830 3.7920 HA 11 TRP 0.141700 + 189 CZ3 2.1130 -15.0300 3.9050 CA 11 TRP -0.197200 + 190 HZ3 1.5440 -15.5980 4.6270 HA 11 TRP 0.144700 + 191 CE3 1.7480 -13.7080 3.6220 CA 11 TRP -0.238700 + 192 HE3 0.8580 -13.2280 4.0000 HA 11 TRP 0.170000 + 193 CD2 2.4030 -13.0330 2.5800 CB 11 TRP 0.124300 + 194 C -0.8080 -11.6930 1.2940 C 11 TRP 0.597300 + 195 O -1.4300 -12.0430 2.2940 O 11 TRP -0.567900 + 196 N -0.7620 -12.4030 0.1640 N 12 LYS -0.347900 + 197 H -0.0500 -12.1270 -0.4980 H 12 LYS 0.274700 + 198 CA -1.6020 -13.5400 -0.1550 CT 12 LYS -0.240000 + 199 HA -2.4910 -13.5140 0.4750 H1 12 LYS 0.142600 + 200 CB -2.0350 -13.3960 -1.6110 CT 12 LYS -0.009400 + 201 HB2 -2.4930 -14.3360 -1.9200 HC 12 LYS 0.036200 + 202 HB3 -1.1670 -13.4740 -2.2670 HC 12 LYS 0.036200 + 203 CG -2.9610 -12.2180 -1.8980 CT 12 LYS 0.018700 + 204 HG2 -2.3390 -11.3230 -1.8980 HC 12 LYS 0.010300 + 205 HG3 -3.7290 -12.2200 -1.1240 HC 12 LYS 0.010300 + 206 CD -3.5990 -12.2780 -3.2830 CT 12 LYS -0.047900 + 207 HD2 -4.0150 -13.2820 -3.3680 HC 12 LYS 0.062100 + 208 HD3 -2.7420 -12.2420 -3.9550 HC 12 LYS 0.062100 + 209 CE -4.6970 -11.2490 -3.5340 CT 12 LYS -0.014300 + 210 HE2 -4.2910 -10.2400 -3.6130 HP 12 LYS 0.113500 + 211 HE3 -5.3560 -11.3390 -2.6700 HP 12 LYS 0.113500 + 212 NZ -5.4090 -11.5270 -4.7900 N3 12 LYS -0.385400 + 213 HZ1 -6.3040 -11.0690 -4.8870 H 12 LYS 0.340000 + 214 HZ2 -4.9130 -11.1230 -5.5720 H 12 LYS 0.340000 + 215 HZ3 -5.6450 -12.4930 -4.9720 H 12 LYS 0.340000 + 216 C -1.0850 -14.8970 0.3020 C 12 LYS 0.734100 + 217 O -1.9360 -15.5620 0.8890 O 12 LYS -0.589400 + 218 N 0.1990 -15.2290 0.1540 N 13 NME -0.415700 + 219 H 0.7970 -14.5610 -0.3110 H 13 NME 0.271900 + 220 CH3 0.8400 -16.3400 0.8280 CT 13 NME -0.149000 + 221 HH31 1.5930 -16.8360 0.2160 H1 13 NME 0.097600 + 222 HH32 1.3330 -15.9500 1.7180 H1 13 NME 0.097600 + 223 HH33 0.0930 -17.0680 1.1470 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -0.7130 15.2770 1.6620 N3 1 SER 0.184900 + 2 H1 -0.3040 15.7290 2.4670 H 1 SER 0.189800 + 3 H2 -0.0420 15.2820 0.9070 H 1 SER 0.189800 + 4 H3 -1.5740 15.6650 1.3030 H 1 SER 0.189800 + 5 CA -1.0620 13.9380 2.1610 CT 1 SER 0.056700 + 6 HA -1.6780 13.9400 3.0600 HP 1 SER 0.078200 + 7 CB -1.7830 13.0880 1.1190 CT 1 SER 0.259600 + 8 HB2 -1.1010 12.6890 0.3680 H1 1 SER 0.027300 + 9 HB3 -2.5030 13.6500 0.5240 H1 1 SER 0.027300 + 10 OG -2.4130 11.9750 1.7110 OH 1 SER -0.671400 + 11 HG -3.3580 11.9850 1.5410 HO 1 SER 0.423900 + 12 C 0.1410 13.0910 2.5510 C 1 SER 0.616300 + 13 O 1.2490 13.3620 2.0930 O 1 SER -0.572200 + 14 N 0.0060 12.2030 3.5390 N 2 TRP -0.415700 + 15 H -0.9360 11.9610 3.8090 H 2 TRP 0.271900 + 16 CA 1.0360 11.3380 4.0770 CT 2 TRP -0.027500 + 17 HA 1.9950 11.8300 3.9110 H1 2 TRP 0.112300 + 18 CB 0.7480 11.1510 5.5630 CT 2 TRP -0.005000 + 19 HB2 -0.0780 10.4670 5.7590 HC 2 TRP 0.033900 + 20 HB3 0.3000 12.1110 5.8210 HC 2 TRP 0.033900 + 21 CG 1.8730 10.8870 6.5120 C* 2 TRP -0.141500 + 22 CD1 3.0070 10.1870 6.2820 CW 2 TRP -0.163800 + 23 HD1 3.3250 9.5830 5.4450 H4 2 TRP 0.206200 + 24 NE1 3.9120 10.2260 7.3250 NA 2 TRP -0.341800 + 25 HE1 4.9010 10.0510 7.2230 H 2 TRP 0.341200 + 26 CE2 3.3230 10.9010 8.3750 CN 2 TRP 0.138000 + 27 CZ2 3.7680 11.1970 9.6690 CA 2 TRP -0.260100 + 28 HZ2 4.7200 10.7460 9.9060 HA 2 TRP 0.157200 + 29 CH2 2.8880 11.9030 10.4990 CA 2 TRP -0.113400 + 30 HH2 3.1540 12.1010 11.5270 HA 2 TRP 0.141700 + 31 CZ3 1.6460 12.3520 10.0360 CA 2 TRP -0.197200 + 32 HZ3 1.0530 12.9020 10.7530 HA 2 TRP 0.144700 + 33 CE3 1.2290 12.0910 8.7250 CA 2 TRP -0.238700 + 34 HE3 0.2250 12.3690 8.4430 HA 2 TRP 0.170000 + 35 CD2 2.0730 11.3530 7.8800 CB 2 TRP 0.124300 + 36 C 1.2350 10.0340 3.3170 C 2 TRP 0.597300 + 37 O 2.3460 9.6120 3.0040 O 2 TRP -0.567900 + 38 N 0.1560 9.3130 3.0040 N 3 THR -0.415700 + 39 H -0.7710 9.6390 3.2390 H 3 THR 0.271900 + 40 CA 0.2840 8.0960 2.2280 CT 3 THR -0.038900 + 41 HA 1.2700 7.6860 2.4450 H1 3 THR 0.100700 + 42 CB -0.8310 7.1170 2.5840 CT 3 THR 0.365400 + 43 HB -0.7630 6.4180 1.7500 H1 3 THR 0.004300 + 44 CG2 -0.8100 6.4950 3.9770 CT 3 THR -0.243800 + 45 HG21 -1.2760 7.1430 4.7190 HC 3 THR 0.064200 + 46 HG22 -1.3710 5.5620 3.9360 HC 3 THR 0.064200 + 47 HG23 0.2210 6.2620 4.2440 HC 3 THR 0.064200 + 48 OG1 -2.0570 7.8130 2.5350 OH 3 THR -0.676100 + 49 HG1 -2.1750 8.0110 1.6040 HO 3 THR 0.410200 + 50 C 0.1740 8.3820 0.7370 C 3 THR 0.597300 + 51 O -0.7900 9.0600 0.3870 O 3 THR -0.567900 + 52 N 0.9720 7.8130 -0.1690 N 4 TRP -0.415700 + 53 H 1.7310 7.2170 0.1300 H 4 TRP 0.271900 + 54 CA 0.6140 7.9210 -1.5690 CT 4 TRP -0.027500 + 55 HA -0.0210 8.7950 -1.7120 H1 4 TRP 0.112300 + 56 CB 1.8760 8.2210 -2.3720 CT 4 TRP -0.005000 + 57 HB2 1.7670 7.9810 -3.4300 HC 4 TRP 0.033900 + 58 HB3 2.5660 7.4510 -2.0290 HC 4 TRP 0.033900 + 59 CG 2.3650 9.6330 -2.3120 C* 4 TRP -0.141500 + 60 CD1 1.6620 10.5860 -2.9660 CW 4 TRP -0.163800 + 61 HD1 0.7940 10.4220 -3.5880 H4 4 TRP 0.206200 + 62 NE1 2.2780 11.7790 -2.6440 NA 4 TRP -0.341800 + 63 HE1 1.9130 12.7070 -2.8030 H 4 TRP 0.341200 + 64 CE2 3.3000 11.6590 -1.7240 CN 4 TRP 0.138000 + 65 CZ2 4.1690 12.5570 -1.0920 CA 4 TRP -0.260100 + 66 HZ2 4.1850 13.6040 -1.3540 HA 4 TRP 0.157200 + 67 CH2 5.0300 12.0800 -0.0960 CA 4 TRP -0.113400 + 68 HH2 5.7320 12.6740 0.4700 HA 4 TRP 0.141700 + 69 CZ3 5.0110 10.7200 0.2350 CA 4 TRP -0.197200 + 70 HZ3 5.5980 10.3930 1.0810 HA 4 TRP 0.144700 + 71 CE3 4.1990 9.7950 -0.4310 CA 4 TRP -0.238700 + 72 HE3 4.2810 8.7310 -0.2620 HA 4 TRP 0.170000 + 73 CD2 3.3340 10.2720 -1.4290 CB 4 TRP 0.124300 + 74 C -0.1170 6.6560 -1.9960 C 4 TRP 0.597300 + 75 O -1.2130 6.7300 -2.5470 O 4 TRP -0.567900 + 76 N 0.5550 5.5090 -1.8690 N 5 GLU -0.516300 + 77 H 1.4450 5.5350 -1.3920 H 5 GLU 0.293600 + 78 CA 0.1100 4.2490 -2.4280 CT 5 GLU 0.039700 + 79 HA -0.1020 4.4910 -3.4690 H1 5 GLU 0.110500 + 80 CB 1.2890 3.2800 -2.4180 CT 5 GLU 0.056000 + 81 HB2 0.9290 2.2630 -2.5750 HC 5 GLU -0.017300 + 82 HB3 1.8120 3.2390 -1.4630 HC 5 GLU -0.017300 + 83 CG 2.2580 3.4340 -3.5870 CT 5 GLU 0.013600 + 84 HG2 1.7590 3.5120 -4.5530 HC 5 GLU -0.042500 + 85 HG3 2.8550 2.5460 -3.7940 HC 5 GLU -0.042500 + 86 CD 3.3670 4.4760 -3.5870 C 5 GLU 0.805400 + 87 OE1 3.8630 4.8220 -2.4930 O2 5 GLU -0.818800 + 88 OE2 3.8500 4.8670 -4.6720 O2 5 GLU -0.818800 + 89 C -1.1960 3.8290 -1.7680 C 5 GLU 0.536600 + 90 O -1.3620 3.6830 -0.5590 O 5 GLU -0.581900 + 91 N -2.2170 3.6270 -2.6050 N 6 ASN -0.415700 + 92 H -2.0380 3.9260 -3.5530 H 6 ASN 0.271900 + 93 CA -3.5350 3.1130 -2.2920 CT 6 ASN 0.014300 + 94 HA -3.6330 2.7110 -1.2830 H1 6 ASN 0.104800 + 95 CB -4.4710 4.3160 -2.3510 CT 6 ASN -0.204100 + 96 HB2 -4.3300 4.8280 -3.3030 HC 6 ASN 0.079700 + 97 HB3 -4.1070 5.0130 -1.5950 HC 6 ASN 0.079700 + 98 CG -5.9230 3.9390 -2.0990 C 6 ASN 0.713000 + 99 OD1 -6.2740 3.0170 -1.3650 O 6 ASN -0.593100 + 100 ND2 -6.9130 4.5880 -2.7160 N 6 ASN -0.919100 + 101 HD21 -6.7380 5.4590 -3.1970 H 6 ASN 0.419600 + 102 HD22 -7.8430 4.3540 -2.3970 H 6 ASN 0.419600 + 103 C -4.0130 2.0030 -3.2170 C 6 ASN 0.597300 + 104 O -4.2270 2.2180 -4.4080 O 6 ASN -0.567900 + 105 N -4.2180 0.8510 -2.5730 N 7 GLY -0.415700 + 106 H -4.0490 0.7590 -1.5820 H 7 GLY 0.271900 + 107 CA -4.8730 -0.2370 -3.2720 CT 7 GLY -0.025200 + 108 HA2 -4.7230 -0.1720 -4.3490 H1 7 GLY 0.069800 + 109 HA3 -5.9340 -0.0860 -3.0740 H1 7 GLY 0.069800 + 110 C -4.4080 -1.5620 -2.6850 C 7 GLY 0.597300 + 111 O -3.2440 -1.7130 -2.3220 O 7 GLY -0.567900 + 112 N -5.3920 -2.4240 -2.4190 N 8 LYS -0.347900 + 113 H -6.3440 -2.1220 -2.5680 H 8 LYS 0.274700 + 114 CA -5.2240 -3.6680 -1.6960 CT 8 LYS -0.240000 + 115 HA -4.9160 -3.5270 -0.6600 H1 8 LYS 0.142600 + 116 CB -6.5620 -4.3880 -1.5460 CT 8 LYS -0.009400 + 117 HB2 -6.3930 -5.3970 -1.1720 HC 8 LYS 0.036200 + 118 HB3 -7.0400 -4.5340 -2.5150 HC 8 LYS 0.036200 + 119 CG -7.6780 -3.6550 -0.8080 CT 8 LYS 0.018700 + 120 HG2 -7.9490 -2.8820 -1.5270 HC 8 LYS 0.010300 + 121 HG3 -7.3440 -3.2790 0.1590 HC 8 LYS 0.010300 + 122 CD -8.9090 -4.5030 -0.4990 CT 8 LYS -0.047900 + 123 HD2 -8.5850 -5.1030 0.3520 HC 8 LYS 0.062100 + 124 HD3 -9.1460 -5.0850 -1.3890 HC 8 LYS 0.062100 + 125 CE -10.1020 -3.6180 -0.1530 CT 8 LYS -0.014300 + 126 HE2 -10.8020 -3.4240 -0.9650 HP 8 LYS 0.113500 + 127 HE3 -9.6700 -2.6600 0.1370 HP 8 LYS 0.113500 + 128 NZ -10.7340 -4.1280 1.0740 N3 8 LYS -0.385400 + 129 HZ1 -11.4020 -4.8390 0.8120 H 8 LYS 0.340000 + 130 HZ2 -10.1030 -4.5320 1.7520 H 8 LYS 0.340000 + 131 HZ3 -11.3470 -3.4700 1.5320 H 8 LYS 0.340000 + 132 C -4.1230 -4.5170 -2.3160 C 8 LYS 0.734100 + 133 O -4.3360 -5.0200 -3.4170 O 8 LYS -0.589400 + 134 N -2.9850 -4.7150 -1.6480 N 9 TRP -0.415700 + 135 H -2.7840 -4.1360 -0.8450 H 9 TRP 0.271900 + 136 CA -1.8700 -5.5060 -2.1270 CT 9 TRP -0.027500 + 137 HA -1.8210 -5.2860 -3.1940 H1 9 TRP 0.112300 + 138 CB -0.5450 -5.0000 -1.5640 CT 9 TRP -0.005000 + 139 HB2 -0.4620 -5.1750 -0.4910 HC 9 TRP 0.033900 + 140 HB3 -0.5770 -3.9120 -1.6190 HC 9 TRP 0.033900 + 141 CG 0.6320 -5.6020 -2.2620 C* 9 TRP -0.141500 + 142 CD1 1.3570 -6.6230 -1.7530 CW 9 TRP -0.163800 + 143 HD1 1.0900 -7.0830 -0.8120 H4 9 TRP 0.206200 + 144 NE1 2.2700 -7.0050 -2.7150 NA 9 TRP -0.341800 + 145 HE1 2.8660 -7.8170 -2.6400 H 9 TRP 0.341200 + 146 CE2 2.3250 -6.1460 -3.7940 CN 9 TRP 0.138000 + 147 CZ2 3.1220 -6.0920 -4.9440 CA 9 TRP -0.260100 + 148 HZ2 3.8870 -6.8430 -5.0770 HA 9 TRP 0.157200 + 149 CH2 2.7880 -5.1100 -5.8840 CA 9 TRP -0.113400 + 150 HH2 3.4810 -4.9790 -6.7020 HA 9 TRP 0.141700 + 151 CZ3 1.7010 -4.2420 -5.7290 CA 9 TRP -0.197200 + 152 HZ3 1.4380 -3.5130 -6.4820 HA 9 TRP 0.144700 + 153 CE3 0.9100 -4.3780 -4.5820 CA 9 TRP -0.238700 + 154 HE3 0.1310 -3.6330 -4.5160 HA 9 TRP 0.170000 + 155 CD2 1.1890 -5.3220 -3.5810 CB 9 TRP 0.124300 + 156 C -1.9970 -6.9900 -1.8100 C 9 TRP 0.597300 + 157 O -2.3840 -7.3020 -0.6860 O 9 TRP -0.567900 + 158 N -1.6050 -7.8550 -2.7480 N 10 THR -0.415700 + 159 H -1.3240 -7.4720 -3.6390 H 10 THR 0.271900 + 160 CA -1.5120 -9.2860 -2.5370 CT 10 THR -0.038900 + 161 HA -2.3740 -9.7970 -2.1090 H1 10 THR 0.100700 + 162 CB -1.3460 -9.9210 -3.9150 CT 10 THR 0.365400 + 163 HB -1.3230 -10.9980 -3.7490 H1 10 THR 0.004300 + 164 CG2 -2.5910 -9.7150 -4.7730 CT 10 THR -0.243800 + 165 HG21 -2.7620 -8.6510 -4.9310 HC 10 THR 0.064200 + 166 HG22 -2.4430 -10.1490 -5.7620 HC 10 THR 0.064200 + 167 HG23 -3.5090 -10.1900 -4.4270 HC 10 THR 0.064200 + 168 OG1 -0.2790 -9.4410 -4.7010 OH 10 THR -0.676100 + 169 HG1 0.4200 -9.3190 -4.0550 HO 10 THR 0.410200 + 170 C -0.4270 -9.5610 -1.5060 C 10 THR 0.597300 + 171 O 0.6770 -9.8430 -1.9660 O 10 THR -0.567900 + 172 N -0.6450 -9.6460 -0.1910 N 11 TRP -0.415700 + 173 H -1.5150 -9.2960 0.1840 H 11 TRP 0.271900 + 174 CA 0.3450 -9.8350 0.8500 CT 11 TRP -0.027500 + 175 HA 1.3570 -9.6090 0.5140 H1 11 TRP 0.112300 + 176 CB -0.0280 -8.8560 1.9590 CT 11 TRP -0.005000 + 177 HB2 -1.0370 -9.0480 2.3230 HC 11 TRP 0.033900 + 178 HB3 -0.0990 -7.8510 1.5440 HC 11 TRP 0.033900 + 179 CG 0.9470 -8.8980 3.0920 C* 11 TRP -0.141500 + 180 CD1 2.2900 -8.7630 3.0290 CW 11 TRP -0.163800 + 181 HD1 2.8540 -8.4010 2.1820 H4 11 TRP 0.206200 + 182 NE1 2.8150 -8.7140 4.3050 NA 11 TRP -0.341800 + 183 HE1 3.7790 -8.4650 4.4760 H 11 TRP 0.341200 + 184 CE2 1.8460 -8.7790 5.2860 CN 11 TRP 0.138000 + 185 CZ2 1.8110 -8.9290 6.6770 CA 11 TRP -0.260100 + 186 HZ2 2.7010 -8.9460 7.2880 HA 11 TRP 0.157200 + 187 CH2 0.5980 -9.0020 7.3730 CA 11 TRP -0.113400 + 188 HH2 0.6590 -9.0020 8.4510 HA 11 TRP 0.141700 + 189 CZ3 -0.5990 -9.1240 6.6570 CA 11 TRP -0.197200 + 190 HZ3 -1.5920 -9.3360 7.0260 HA 11 TRP 0.144700 + 191 CE3 -0.5300 -9.0320 5.2620 CA 11 TRP -0.238700 + 192 HE3 -1.5190 -9.0610 4.8280 HA 11 TRP 0.170000 + 193 CD2 0.6570 -8.9100 4.5220 CB 11 TRP 0.124300 + 194 C 0.3160 -11.2450 1.4220 C 11 TRP 0.597300 + 195 O -0.7630 -11.8050 1.5990 O 11 TRP -0.567900 + 196 N 1.4410 -11.9420 1.6040 N 12 LYS -0.347900 + 197 H 2.2820 -11.4040 1.4520 H 12 LYS 0.274700 + 198 CA 1.6320 -13.3040 2.0600 CT 12 LYS -0.240000 + 199 HA 0.8340 -13.9060 1.6260 H1 12 LYS 0.142600 + 200 CB 2.9560 -13.9260 1.6270 CT 12 LYS -0.009400 + 201 HB2 2.9780 -14.9900 1.8610 HC 12 LYS 0.036200 + 202 HB3 3.8390 -13.4820 2.0880 HC 12 LYS 0.036200 + 203 CG 3.1010 -13.8800 0.1090 CT 12 LYS 0.018700 + 204 HG2 2.8830 -12.8710 -0.2420 HC 12 LYS 0.010300 + 205 HG3 2.3180 -14.5660 -0.2160 HC 12 LYS 0.010300 + 206 CD 4.5080 -14.3900 -0.1850 CT 12 LYS -0.047900 + 207 HD2 4.7170 -15.2530 0.4480 HC 12 LYS 0.062100 + 208 HD3 5.2810 -13.7060 0.1660 HC 12 LYS 0.062100 + 209 CE 4.7390 -14.7580 -1.6480 CT 12 LYS -0.014300 + 210 HE2 4.5210 -13.8470 -2.2050 HP 12 LYS 0.113500 + 211 HE3 4.0020 -15.4760 -2.0080 HP 12 LYS 0.113500 + 212 NZ 6.1190 -15.2430 -1.7980 N3 12 LYS -0.385400 + 213 HZ1 6.3870 -15.4340 -2.7530 H 12 LYS 0.340000 + 214 HZ2 6.7080 -14.4820 -1.4910 H 12 LYS 0.340000 + 215 HZ3 6.3550 -16.0830 -1.2900 H 12 LYS 0.340000 + 216 C 1.4840 -13.4730 3.5660 C 12 LYS 0.734100 + 217 O 0.8230 -14.3180 4.1640 O 12 LYS -0.589400 + 218 N 2.1700 -12.4860 4.1480 N 13 NME -0.415700 + 219 H 2.7790 -11.9230 3.5710 H 13 NME 0.271900 + 220 CH3 2.1880 -12.2590 5.5790 CT 13 NME -0.149000 + 221 HH31 1.2430 -11.8100 5.8840 H1 13 NME 0.097600 + 222 HH32 2.4840 -13.1240 6.1720 H1 13 NME 0.097600 + 223 HH33 3.0220 -11.5670 5.6970 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** +@MOLECULE +Cpptraj Generated mol2 file. + 223 230 13 0 0 +SMALL +USER_CHARGES + + +@ATOM + 1 N -1.8890 9.1590 7.5690 N3 1 SER 0.184900 + 2 H1 -1.0370 8.6910 7.2960 H 1 SER 0.189800 + 3 H2 -1.9000 9.2980 8.5690 H 1 SER 0.189800 + 4 H3 -2.5380 8.4470 7.2650 H 1 SER 0.189800 + 5 CA -2.0640 10.5010 6.9930 CT 1 SER 0.056700 + 6 HA -3.1000 10.8240 7.1020 HP 1 SER 0.078200 + 7 CB -1.2300 11.5610 7.7070 CT 1 SER 0.259600 + 8 HB2 -1.6700 11.8110 8.6730 H1 1 SER 0.027300 + 9 HB3 -1.2480 12.5030 7.1590 H1 1 SER 0.027300 + 10 OG 0.1230 11.2160 7.9040 OH 1 SER -0.671400 + 11 HG 0.2740 11.7280 8.7010 HO 1 SER 0.423900 + 12 C -1.6130 10.4180 5.5420 C 1 SER 0.616300 + 13 O -2.4980 10.4330 4.6890 O 1 SER -0.572200 + 14 N -0.3660 10.5720 5.0900 N 2 TRP -0.415700 + 15 H 0.3440 10.6120 5.8080 H 2 TRP 0.271900 + 16 CA 0.1950 10.6970 3.7600 CT 2 TRP -0.027500 + 17 HA -0.2180 11.5690 3.2540 H1 2 TRP 0.112300 + 18 CB 1.7100 10.8790 3.7090 CT 2 TRP -0.005000 + 19 HB2 2.2080 9.9860 4.0870 HC 2 TRP 0.033900 + 20 HB3 1.9270 11.6410 4.4580 HC 2 TRP 0.033900 + 21 CG 2.2650 11.2910 2.3840 C* 2 TRP -0.141500 + 22 CD1 2.0320 12.5000 1.8270 CW 2 TRP -0.163800 + 23 HD1 1.5380 13.3330 2.3050 H4 2 TRP 0.206200 + 24 NE1 2.8600 12.5800 0.7240 NA 2 TRP -0.341800 + 25 HE1 2.9290 13.4040 0.1430 H 2 TRP 0.341200 + 26 CE2 3.6620 11.4600 0.6460 CN 2 TRP 0.138000 + 27 CZ2 4.6200 11.1600 -0.3300 CA 2 TRP -0.260100 + 28 HZ2 5.0590 11.8630 -1.0230 HA 2 TRP 0.157200 + 29 CH2 5.0910 9.8430 -0.3770 CA 2 TRP -0.113400 + 30 HH2 5.8540 9.6100 -1.1050 HA 2 TRP 0.141700 + 31 CZ3 4.5450 8.8500 0.4450 CA 2 TRP -0.197200 + 32 HZ3 4.8230 7.8400 0.1820 HA 2 TRP 0.144700 + 33 CE3 3.5490 9.1590 1.3790 CA 2 TRP -0.238700 + 34 HE3 3.1350 8.4300 2.0590 HA 2 TRP 0.170000 + 35 CD2 3.0750 10.4770 1.4830 CB 2 TRP 0.124300 + 36 C -0.1900 9.6090 2.7680 C 2 TRP 0.597300 + 37 O -0.4520 9.9630 1.6210 O 2 TRP -0.567900 + 38 N -0.2680 8.4020 3.3340 N 3 THR -0.415700 + 39 H -0.2600 8.2750 4.3360 H 3 THR 0.271900 + 40 CA -0.6060 7.1720 2.6470 CT 3 THR -0.038900 + 41 HA -0.1800 7.2660 1.6480 H1 3 THR 0.100700 + 42 CB -0.0930 5.9920 3.4680 CT 3 THR 0.365400 + 43 HB -0.5860 5.0810 3.1280 H1 3 THR 0.004300 + 44 CG2 1.3430 5.6480 3.0810 CT 3 THR -0.243800 + 45 HG21 1.3060 5.0050 2.2020 HC 3 THR 0.064200 + 46 HG22 1.9550 6.5430 2.9670 HC 3 THR 0.064200 + 47 HG23 1.8280 5.0680 3.8660 HC 3 THR 0.064200 + 48 OG1 -0.2730 6.2460 4.8430 OH 3 THR -0.676100 + 49 HG1 0.4280 5.7500 5.2710 HO 3 THR 0.410200 + 50 C -2.0730 6.8820 2.3630 C 3 THR 0.597300 + 51 O -2.8840 6.6850 3.2650 O 3 THR -0.567900 + 52 N -2.4140 6.7960 1.0750 N 4 TRP -0.415700 + 53 H -1.6310 6.7560 0.4390 H 4 TRP 0.271900 + 54 CA -3.6890 6.2860 0.6130 CT 4 TRP -0.027500 + 55 HA -4.2880 6.0200 1.4850 H1 4 TRP 0.112300 + 56 CB -4.4650 7.2750 -0.2530 CT 4 TRP -0.005000 + 57 HB2 -5.4500 6.8210 -0.3660 HC 4 TRP 0.033900 + 58 HB3 -4.0220 7.1620 -1.2420 HC 4 TRP 0.033900 + 59 CG -4.6320 8.7230 0.0770 C* 4 TRP -0.141500 + 60 CD1 -3.9020 9.7130 -0.4830 CW 4 TRP -0.163800 + 61 HD1 -3.0890 9.5530 -1.1760 H4 4 TRP 0.206200 + 62 NE1 -4.4730 10.9230 -0.1410 NA 4 TRP -0.341800 + 63 HE1 -4.1360 11.8610 -0.3060 H 4 TRP 0.341200 + 64 CE2 -5.4690 10.7460 0.7980 CN 4 TRP 0.138000 + 65 CZ2 -6.3300 11.6930 1.3650 CA 4 TRP -0.260100 + 66 HZ2 -6.2760 12.7460 1.1300 HA 4 TRP 0.157200 + 67 CH2 -7.3740 11.1960 2.1540 CA 4 TRP -0.113400 + 68 HH2 -8.2300 11.8220 2.3620 HA 4 TRP 0.141700 + 69 CZ3 -7.6300 9.8240 2.2590 CA 4 TRP -0.197200 + 70 HZ3 -8.3790 9.4820 2.9590 HA 4 TRP 0.144700 + 71 CE3 -6.7760 8.9050 1.6380 CA 4 TRP -0.238700 + 72 HE3 -6.9740 7.8720 1.8840 HA 4 TRP 0.170000 + 73 CD2 -5.7030 9.3470 0.8480 CB 4 TRP 0.124300 + 74 C -3.6320 4.9260 -0.0680 C 4 TRP 0.597300 + 75 O -4.2790 3.9520 0.3090 O 4 TRP -0.567900 + 76 N -2.7950 4.8720 -1.1060 N 5 GLU -0.516300 + 77 H -2.2780 5.7080 -1.3390 H 5 GLU 0.293600 + 78 CA -2.5350 3.7230 -1.9500 CT 5 GLU 0.039700 + 79 HA -3.0070 2.9480 -1.3460 H1 5 GLU 0.110500 + 80 CB -3.4130 3.5240 -3.1830 CT 5 GLU 0.056000 + 81 HB2 -3.1390 4.1410 -4.0380 HC 5 GLU -0.017300 + 82 HB3 -4.3860 3.7870 -2.7670 HC 5 GLU -0.017300 + 83 CG -3.4700 2.1080 -3.7480 CT 5 GLU 0.013600 + 84 HG2 -2.4470 1.7930 -3.9530 HC 5 GLU -0.042500 + 85 HG3 -4.0390 2.4250 -4.6230 HC 5 GLU -0.042500 + 86 CD -4.1890 1.1230 -2.8370 C 5 GLU 0.805400 + 87 OE1 -3.8030 0.7710 -1.7020 O2 5 GLU -0.818800 + 88 OE2 -5.2630 0.6010 -3.2070 O2 5 GLU -0.818800 + 89 C -1.0580 3.5180 -2.2550 C 5 GLU 0.536600 + 90 O -0.3010 4.4140 -2.6190 O 5 GLU -0.581900 + 91 N -0.6680 2.2650 -2.0090 N 6 ASN -0.415700 + 92 H -1.3230 1.6560 -1.5390 H 6 ASN 0.271900 + 93 CA 0.6390 1.6960 -2.2670 CT 6 ASN 0.014300 + 94 HA 1.2390 2.4530 -2.7720 H1 6 ASN 0.104800 + 95 CB 1.4120 1.3660 -0.9930 CT 6 ASN -0.204100 + 96 HB2 2.2240 0.7030 -1.2910 HC 6 ASN 0.079700 + 97 HB3 0.7120 0.8820 -0.3110 HC 6 ASN 0.079700 + 98 CG 2.1540 2.5500 -0.3910 C 6 ASN 0.713000 + 99 OD1 2.8090 3.3470 -1.0580 O 6 ASN -0.593100 + 100 ND2 2.3590 2.5190 0.9280 N 6 ASN -0.919100 + 101 HD21 1.8690 1.8970 1.5560 H 6 ASN 0.419600 + 102 HD22 3.0240 3.1960 1.2720 H 6 ASN 0.419600 + 103 C 0.5090 0.4880 -3.1850 C 6 ASN 0.597300 + 104 O -0.4570 -0.2500 -3.0040 O 6 ASN -0.567900 + 105 N 1.4630 0.2470 -4.0870 N 7 GLY -0.415700 + 106 H 2.3720 0.6580 -3.9320 H 7 GLY 0.271900 + 107 CA 1.3990 -0.9020 -4.9670 CT 7 GLY -0.025200 + 108 HA2 2.1800 -0.8820 -5.7280 H1 7 GLY 0.069800 + 109 HA3 0.5010 -0.7990 -5.5760 H1 7 GLY 0.069800 + 110 C 1.4480 -2.2750 -4.3130 C 7 GLY 0.597300 + 111 O 0.7270 -2.5760 -3.3640 O 7 GLY -0.567900 + 112 N 2.3610 -3.1180 -4.8010 N 8 LYS -0.347900 + 113 H 3.0800 -2.7840 -5.4260 H 8 LYS 0.274700 + 114 CA 2.5410 -4.5140 -4.4580 CT 8 LYS -0.240000 + 115 HA 1.6270 -5.0150 -4.1380 H1 8 LYS 0.142600 + 116 CB 3.1230 -5.2830 -5.6410 CT 8 LYS -0.009400 + 117 HB2 2.4350 -5.2430 -6.4860 HC 8 LYS 0.036200 + 118 HB3 3.3350 -6.3180 -5.3720 HC 8 LYS 0.036200 + 119 CG 4.4160 -4.7460 -6.2480 CT 8 LYS 0.018700 + 120 HG2 5.3080 -4.9600 -5.6600 HC 8 LYS 0.010300 + 121 HG3 4.3930 -3.6740 -6.4390 HC 8 LYS 0.010300 + 122 CD 4.7260 -5.5030 -7.5360 CT 8 LYS -0.047900 + 123 HD2 3.9920 -5.2720 -8.3080 HC 8 LYS 0.062100 + 124 HD3 4.5840 -6.5430 -7.2410 HC 8 LYS 0.062100 + 125 CE 6.1480 -5.3380 -8.0660 CT 8 LYS -0.014300 + 126 HE2 6.5210 -6.2900 -8.4440 HP 8 LYS 0.113500 + 127 HE3 6.8480 -5.0250 -7.2900 HP 8 LYS 0.113500 + 128 NZ 6.1770 -4.4200 -9.2140 N3 8 LYS -0.385400 + 129 HZ1 6.0460 -3.5470 -8.7220 H 8 LYS 0.340000 + 130 HZ2 7.1310 -4.3920 -9.5460 H 8 LYS 0.340000 + 131 HZ3 5.4710 -4.5500 -9.9250 H 8 LYS 0.340000 + 132 C 3.5120 -4.5190 -3.2860 C 8 LYS 0.734100 + 133 O 4.6240 -5.0420 -3.2860 O 8 LYS -0.589400 + 134 N 2.9250 -4.2560 -2.1160 N 9 TRP -0.415700 + 135 H 2.0100 -3.8790 -2.3160 H 9 TRP 0.271900 + 136 CA 3.3410 -4.2620 -0.7280 CT 9 TRP -0.027500 + 137 HA 4.4100 -4.0450 -0.7240 H1 9 TRP 0.112300 + 138 CB 2.6250 -3.0680 -0.1040 CT 9 TRP -0.005000 + 139 HB2 1.5890 -3.2940 0.1480 HC 9 TRP 0.033900 + 140 HB3 2.8350 -2.1940 -0.7210 HC 9 TRP 0.033900 + 141 CG 3.2880 -2.4620 1.0910 C* 9 TRP -0.141500 + 142 CD1 2.9250 -2.4360 2.3930 CW 9 TRP -0.163800 + 143 HD1 1.9490 -2.7990 2.6780 H4 9 TRP 0.206200 + 144 NE1 3.8550 -1.8450 3.2240 NA 9 TRP -0.341800 + 145 HE1 3.8850 -1.8480 4.2340 H 9 TRP 0.341200 + 146 CE2 4.8270 -1.3030 2.4080 CN 9 TRP 0.138000 + 147 CZ2 5.9110 -0.4710 2.7140 CA 9 TRP -0.260100 + 148 HZ2 6.1390 -0.1560 3.7210 HA 9 TRP 0.157200 + 149 CH2 6.8410 -0.1410 1.7220 CA 9 TRP -0.113400 + 150 HH2 7.7250 0.4050 2.0180 HA 9 TRP 0.141700 + 151 CZ3 6.5840 -0.5900 0.4210 CA 9 TRP -0.197200 + 152 HZ3 7.2310 -0.2350 -0.3680 HA 9 TRP 0.144700 + 153 CE3 5.4240 -1.2970 0.0820 CA 9 TRP -0.238700 + 154 HE3 5.1390 -1.4650 -0.9460 HA 9 TRP 0.170000 + 155 CD2 4.4790 -1.6200 1.0690 CB 9 TRP 0.124300 + 156 C 2.9450 -5.5930 -0.1050 C 9 TRP 0.597300 + 157 O 3.0220 -6.6750 -0.6820 O 9 TRP -0.567900 + 158 N 2.5310 -5.6090 1.1640 N 10 THR -0.415700 + 159 H 2.7110 -4.7940 1.7310 H 10 THR 0.271900 + 160 CA 2.2540 -6.8740 1.8150 CT 10 THR -0.038900 + 161 HA 2.9820 -7.6670 1.6440 H1 10 THR 0.100700 + 162 CB 2.2070 -6.6220 3.3200 CT 10 THR 0.365400 + 163 HB 1.7220 -5.6670 3.5260 H1 10 THR 0.004300 + 164 CG2 1.4560 -7.6590 4.1490 CT 10 THR -0.243800 + 165 HG21 1.5810 -7.4640 5.2140 HC 10 THR 0.064200 + 166 HG22 0.4020 -7.4680 3.9460 HC 10 THR 0.064200 + 167 HG23 1.7250 -8.6400 3.7550 HC 10 THR 0.064200 + 168 OG1 3.4600 -6.5010 3.9540 OH 10 THR -0.676100 + 169 HG1 3.3850 -6.0970 4.8220 HO 10 THR 0.410200 + 170 C 0.8890 -7.3540 1.3440 C 10 THR 0.597300 + 171 O -0.1720 -6.7600 1.5240 O 10 THR -0.567900 + 172 N 0.9060 -8.5220 0.6990 N 11 TRP -0.415700 + 173 H 1.7230 -9.1150 0.7340 H 11 TRP 0.271900 + 174 CA -0.1880 -9.0660 -0.0800 CT 11 TRP -0.027500 + 175 HA -0.7370 -8.2200 -0.4950 H1 11 TRP 0.112300 + 176 CB 0.4120 -10.0100 -1.1170 CT 11 TRP -0.005000 + 177 HB2 1.1130 -10.7100 -0.6610 HC 11 TRP 0.033900 + 178 HB3 0.8870 -9.3680 -1.8590 HC 11 TRP 0.033900 + 179 CG -0.5390 -10.9280 -1.8160 C* 11 TRP -0.141500 + 180 CD1 -1.3130 -10.6860 -2.8980 CW 11 TRP -0.163800 + 181 HD1 -1.3370 -9.7640 -3.4600 H4 11 TRP 0.206200 + 182 NE1 -1.9710 -11.7860 -3.4110 NA 11 TRP -0.341800 + 183 HE1 -2.3840 -11.8640 -4.3300 H 11 TRP 0.341200 + 184 CE2 -1.9570 -12.7630 -2.4370 CN 11 TRP 0.138000 + 185 CZ2 -2.7850 -13.8650 -2.1910 CA 11 TRP -0.260100 + 186 HZ2 -3.6310 -14.0120 -2.8460 HA 11 TRP 0.157200 + 187 CH2 -2.6000 -14.7090 -1.0890 CA 11 TRP -0.113400 + 188 HH2 -3.3150 -15.4730 -0.8230 HA 11 TRP 0.141700 + 189 CZ3 -1.5180 -14.3450 -0.2780 CA 11 TRP -0.197200 + 190 HZ3 -1.3250 -14.9360 0.6040 HA 11 TRP 0.144700 + 191 CE3 -0.8090 -13.1460 -0.4190 CA 11 TRP -0.238700 + 192 HE3 -0.0380 -12.8340 0.2700 HA 11 TRP 0.170000 + 193 CD2 -1.0340 -12.2590 -1.4840 CB 11 TRP 0.124300 + 194 C -1.0790 -9.7520 0.9460 C 11 TRP 0.597300 + 195 O -0.7100 -10.6730 1.6720 O 11 TRP -0.567900 + 196 N -2.3440 -9.3260 0.9490 N 12 LYS -0.347900 + 197 H -2.4560 -8.3390 0.7700 H 12 LYS 0.274700 + 198 CA -3.4700 -9.9260 1.6360 CT 12 LYS -0.240000 + 199 HA -3.0970 -10.4390 2.5220 H1 12 LYS 0.142600 + 200 CB -4.3840 -8.8140 2.1420 CT 12 LYS -0.009400 + 201 HB2 -5.3890 -9.1120 2.4400 HC 12 LYS 0.036200 + 202 HB3 -4.4390 -8.0090 1.4090 HC 12 LYS 0.036200 + 203 CG -3.7990 -8.0920 3.3520 CT 12 LYS 0.018700 + 204 HG2 -2.8890 -7.5660 3.0640 HC 12 LYS 0.010300 + 205 HG3 -3.6910 -8.7240 4.2330 HC 12 LYS 0.010300 + 206 CD -4.8480 -7.0240 3.6500 CT 12 LYS -0.047900 + 207 HD2 -5.6910 -7.4110 4.2220 HC 12 LYS 0.062100 + 208 HD3 -5.1300 -6.4950 2.7400 HC 12 LYS 0.062100 + 209 CE -4.1080 -6.0190 4.5290 CT 12 LYS -0.014300 + 210 HE2 -3.1830 -5.6350 4.0990 HP 12 LYS 0.113500 + 211 HE3 -3.8850 -6.5530 5.4520 HP 12 LYS 0.113500 + 212 NZ -4.8770 -4.8020 4.8290 N3 12 LYS -0.385400 + 213 HZ1 -5.1320 -4.3050 3.9870 H 12 LYS 0.340000 + 214 HZ2 -5.7180 -4.9680 5.3620 H 12 LYS 0.340000 + 215 HZ3 -4.2500 -4.2630 5.4100 H 12 LYS 0.340000 + 216 C -4.3950 -10.7780 0.7790 C 12 LYS 0.734100 + 217 O -4.4830 -11.9390 1.1720 O 12 LYS -0.589400 + 218 N -4.8320 -10.2020 -0.3440 N 13 NME -0.415700 + 219 H -4.6470 -9.2390 -0.5870 H 13 NME 0.271900 + 220 CH3 -5.7200 -10.8660 -1.2770 CT 13 NME -0.149000 + 221 HH31 -5.5910 -11.9460 -1.3400 H1 13 NME 0.097600 + 222 HH32 -6.7570 -10.8860 -0.9420 H1 13 NME 0.097600 + 223 HH33 -5.7770 -10.3580 -2.2400 H1 13 NME 0.097600 +@BOND + 1 12 13 1 + 2 12 14 1 + 3 7 10 1 + 4 5 7 1 + 5 5 12 1 + 6 1 5 1 + 7 36 37 1 + 8 36 38 1 + 9 33 35 1 + 10 31 33 1 + 11 29 31 1 + 12 27 29 1 + 13 26 27 1 + 14 26 35 1 + 15 24 26 1 + 16 22 24 1 + 17 21 22 1 + 18 21 35 1 + 19 18 21 1 + 20 16 18 1 + 21 16 36 1 + 22 14 16 1 + 23 50 51 1 + 24 50 52 1 + 25 42 44 1 + 26 42 48 1 + 27 40 42 1 + 28 40 50 1 + 29 38 40 1 + 30 74 75 1 + 31 74 76 1 + 32 71 73 1 + 33 69 71 1 + 34 67 69 1 + 35 65 67 1 + 36 64 65 1 + 37 64 73 1 + 38 62 64 1 + 39 60 62 1 + 40 59 60 1 + 41 59 73 1 + 42 56 59 1 + 43 54 56 1 + 44 54 74 1 + 45 52 54 1 + 46 89 90 1 + 47 89 91 1 + 48 86 87 1 + 49 86 88 1 + 50 83 86 1 + 51 80 83 1 + 52 78 80 1 + 53 78 89 1 + 54 76 78 1 + 55 103 104 1 + 56 103 105 1 + 57 98 99 1 + 58 98 100 1 + 59 95 98 1 + 60 93 95 1 + 61 93 103 1 + 62 91 93 1 + 63 110 111 1 + 64 110 112 1 + 65 107 110 1 + 66 105 107 1 + 67 132 133 1 + 68 132 134 1 + 69 125 128 1 + 70 122 125 1 + 71 119 122 1 + 72 116 119 1 + 73 114 116 1 + 74 114 132 1 + 75 112 114 1 + 76 156 157 1 + 77 156 158 1 + 78 153 155 1 + 79 151 153 1 + 80 149 151 1 + 81 147 149 1 + 82 146 147 1 + 83 146 155 1 + 84 144 146 1 + 85 142 144 1 + 86 141 142 1 + 87 141 155 1 + 88 138 141 1 + 89 136 138 1 + 90 136 156 1 + 91 134 136 1 + 92 170 171 1 + 93 170 172 1 + 94 162 164 1 + 95 162 168 1 + 96 160 162 1 + 97 160 170 1 + 98 158 160 1 + 99 194 195 1 + 100 194 196 1 + 101 191 193 1 + 102 189 191 1 + 103 187 189 1 + 104 185 187 1 + 105 184 185 1 + 106 184 193 1 + 107 182 184 1 + 108 180 182 1 + 109 179 180 1 + 110 179 193 1 + 111 176 179 1 + 112 174 176 1 + 113 174 194 1 + 114 172 174 1 + 115 216 217 1 + 116 216 218 1 + 117 209 212 1 + 118 206 209 1 + 119 203 206 1 + 120 200 203 1 + 121 198 200 1 + 122 198 216 1 + 123 196 198 1 + 124 218 220 1 + 125 10 11 1 + 126 7 8 1 + 127 7 9 1 + 128 5 6 1 + 129 1 2 1 + 130 1 3 1 + 131 1 4 1 + 132 33 34 1 + 133 31 32 1 + 134 29 30 1 + 135 27 28 1 + 136 24 25 1 + 137 22 23 1 + 138 18 19 1 + 139 18 20 1 + 140 16 17 1 + 141 14 15 1 + 142 48 49 1 + 143 44 45 1 + 144 44 46 1 + 145 44 47 1 + 146 42 43 1 + 147 40 41 1 + 148 38 39 1 + 149 71 72 1 + 150 69 70 1 + 151 67 68 1 + 152 65 66 1 + 153 62 63 1 + 154 60 61 1 + 155 56 57 1 + 156 56 58 1 + 157 54 55 1 + 158 52 53 1 + 159 83 84 1 + 160 83 85 1 + 161 80 81 1 + 162 80 82 1 + 163 78 79 1 + 164 76 77 1 + 165 100 101 1 + 166 100 102 1 + 167 95 96 1 + 168 95 97 1 + 169 93 94 1 + 170 91 92 1 + 171 107 108 1 + 172 107 109 1 + 173 105 106 1 + 174 128 129 1 + 175 128 130 1 + 176 128 131 1 + 177 125 126 1 + 178 125 127 1 + 179 122 123 1 + 180 122 124 1 + 181 119 120 1 + 182 119 121 1 + 183 116 117 1 + 184 116 118 1 + 185 114 115 1 + 186 112 113 1 + 187 153 154 1 + 188 151 152 1 + 189 149 150 1 + 190 147 148 1 + 191 144 145 1 + 192 142 143 1 + 193 138 139 1 + 194 138 140 1 + 195 136 137 1 + 196 134 135 1 + 197 168 169 1 + 198 164 165 1 + 199 164 166 1 + 200 164 167 1 + 201 162 163 1 + 202 160 161 1 + 203 158 159 1 + 204 191 192 1 + 205 189 190 1 + 206 187 188 1 + 207 185 186 1 + 208 182 183 1 + 209 180 181 1 + 210 176 177 1 + 211 176 178 1 + 212 174 175 1 + 213 172 173 1 + 214 212 213 1 + 215 212 214 1 + 216 212 215 1 + 217 209 210 1 + 218 209 211 1 + 219 206 207 1 + 220 206 208 1 + 221 203 204 1 + 222 203 205 1 + 223 200 201 1 + 224 200 202 1 + 225 198 199 1 + 226 196 197 1 + 227 220 221 1 + 228 220 222 1 + 229 220 223 1 + 230 218 219 1 +@SUBSTRUCTURE + 1 SER 1 **** 0 **** **** + 2 TRP 14 **** 0 **** **** + 3 THR 38 **** 0 **** **** + 4 TRP 52 **** 0 **** **** + 5 GLU 76 **** 0 **** **** + 6 ASN 91 **** 0 **** **** + 7 GLY 105 **** 0 **** **** + 8 LYS 112 **** 0 **** **** + 9 TRP 134 **** 0 **** **** + 10 THR 158 **** 0 **** **** + 11 TRP 172 **** 0 **** **** + 12 LYS 196 **** 0 **** **** + 13 NME 218 **** 0 **** **** From 4af0193e1e3475569662e80b1327f2484af8f264 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 11:32:31 -0400 Subject: [PATCH 242/417] Add cumulative best rep test --- test/Test_Cluster_Nreps/RunTest.sh | 20 +- test/Test_Cluster_Nreps/cumulative.save | 336 ++++++++++++++++++++++++ 2 files changed, 350 insertions(+), 6 deletions(-) create mode 100644 test/Test_Cluster_Nreps/cumulative.save diff --git a/test/Test_Cluster_Nreps/RunTest.sh b/test/Test_Cluster_Nreps/RunTest.sh index 343b2b2257..334b9369d5 100755 --- a/test/Test_Cluster_Nreps/RunTest.sh +++ b/test/Test_Cluster_Nreps/RunTest.sh @@ -3,15 +3,14 @@ . ../MasterTest.sh CleanFiles cluster.in 2drms.gnu clusters.*.dat summary.*.dat singlerep.nc \ - Rep.c*.nc PD + Rep.c*.nc PD cumulative -TESTNAME='Clustering with specified # reps' -Requires netcdf +TESTNAME='Cluster representative frames tests' +INPUT='-i cluster.in' +UNITNAME='Test saving 5 best reps' +CheckFor netcdf if [ $? -eq 0 ] ; then - - INPUT='-i cluster.in' - cat > cluster.in < cluster.in < Date: Tue, 7 Sep 2021 13:15:11 -0400 Subject: [PATCH 243/417] Add centroid and cumulative_nosieve option tests for bestrep --- test/Test_Cluster_Nreps/RunTest.sh | 20 +- test/Test_Cluster_Nreps/centroid.save | 336 ++++++++++++++++++ .../cumulative_nosieve.save | 336 ++++++++++++++++++ 3 files changed, 691 insertions(+), 1 deletion(-) create mode 100644 test/Test_Cluster_Nreps/centroid.save create mode 100644 test/Test_Cluster_Nreps/cumulative_nosieve.save diff --git a/test/Test_Cluster_Nreps/RunTest.sh b/test/Test_Cluster_Nreps/RunTest.sh index 334b9369d5..ec8bdfa37b 100755 --- a/test/Test_Cluster_Nreps/RunTest.sh +++ b/test/Test_Cluster_Nreps/RunTest.sh @@ -3,7 +3,7 @@ . ../MasterTest.sh CleanFiles cluster.in 2drms.gnu clusters.*.dat summary.*.dat singlerep.nc \ - Rep.c*.nc PD cumulative + Rep.c*.nc PD cumulative centroid cumulative_nosieve TESTNAME='Cluster representative frames tests' INPUT='-i cluster.in' @@ -33,5 +33,23 @@ EOF RunCpptraj "$UNITNAME" DoTest cumulative.save cumulative +UNITNAME='Test centroid best rep' +cat > cluster.in < cluster.in < Date: Tue, 7 Sep 2021 13:25:20 -0400 Subject: [PATCH 244/417] Add pwrecalc option test --- test/Test_Cluster_Cache/RunTest.sh | 4 ++++ .../sieve3.mem.load.info.dat.save | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/Test_Cluster_Cache/sieve3.mem.load.info.dat.save diff --git a/test/Test_Cluster_Cache/RunTest.sh b/test/Test_Cluster_Cache/RunTest.sh index e33b71bd14..63b661152c 100755 --- a/test/Test_Cluster_Cache/RunTest.sh +++ b/test/Test_Cluster_Cache/RunTest.sh @@ -68,6 +68,10 @@ DoTest sieve5.mem.save.info.dat.save sieve5.disk.save.info.dat Cluster sieve5.nocache.save "$SIEVEARGS" "pairwisecache none" DoTest sieve5.mem.save.info.dat.save sieve5.nocache.save.info.dat +# Test loading pairwise cache with different sieve +Cluster sieve3.mem.load "sieve 3" "loadpairdist pairdist PW1 pwrecalc" +DoTest sieve3.mem.load.info.dat.save sieve3.mem.load.info.dat + # Test sieving #Cluster nosieve #Cluster sieve5 "$SIEVEARGS" diff --git a/test/Test_Cluster_Cache/sieve3.mem.load.info.dat.save b/test/Test_Cluster_Cache/sieve3.mem.load.info.dat.save new file mode 100644 index 0000000000..396868afbc --- /dev/null +++ b/test/Test_Cluster_Cache/sieve3.mem.load.info.dat.save @@ -0,0 +1,17 @@ +#Clustering: 5 clusters 101 frames +#Cluster 0 has average-distance-to-centroid 1.262084 +#Cluster 1 has average-distance-to-centroid 1.390234 +#Cluster 2 has average-distance-to-centroid 1.535737 +#Cluster 3 has average-distance-to-centroid 1.516388 +#Cluster 4 has average-distance-to-centroid 1.272984 +#DBI: 0.959637 +#pSF: 74.452487 +#SSR/SST: 0.756228 +#Algorithm: HierAgglo linkage average-linkage nclusters 5 epsilon 1.79769e+308 +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +......XXXXX..................................................................XXXXXXXXXXXXXXXXXXXXXXXX +...............................................................XXXXXXXXXXXXXX........................ +..XXXX.....XXX....................................................................................... +XX................................................................................................... +#Representative frames: 24 101 76 13 1 +#Sieve value: 3 From d663d311fc3b3533101bee78bbb286b7b1a829ae Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 13:57:08 -0400 Subject: [PATCH 245/417] Add mismatch fatal option --- src/Cluster/Control.cpp | 2 +- src/Cluster/PairwiseMatrix.cpp | 22 ++++++++++++++++++---- src/Cluster/PairwiseMatrix.h | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 3faa735d2c..145faa7167 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -882,7 +882,7 @@ int Cpptraj::Cluster::Control::Run() { timer_pairwise_.Start(); // Cache distances if necessary - if (pmatrix_.CacheDistances( framesToCluster, sieve_ )) return 1; + if (pmatrix_.CacheDistances( framesToCluster, sieve_, true )) return 1; if (pmatrix_.HasCache() && verbose_ > 1) pmatrix_.Cache().PrintCached(); diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index 73177befa9..e558e1161e 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -36,23 +36,37 @@ double Cpptraj::Cluster::PairwiseMatrix::Frame_Distance(int f1, int f2) const { * \param framesToCache the frames to cache. * \param sieveIn Sieve value (if any) used to generate framesToCache. This is * purely for bookkeeping inside DataSet_PairwiseCache. + * \param mismatch_fatal When true, if a cache is present but the frames to + * cache do not match what is in the cache, exit with an error; + * otherwise recalculate the cache. */ -int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCache, int sieveIn) +int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCache, int sieveIn, + bool mismatch_fatal) { if (framesToCache.size() < 1) return 0; // If no cache we can leave. if (cache_ == 0) return 0; + bool do_cache = true; if (cache_->Size() > 0) { + do_cache = false; mprintf("\tUsing existing cache '%s'\n", cache_->legend()); // If cache is already populated, check that it is valid. // The frames to cache must match cached frames. if (!cache_->CachedFramesMatch( framesToCache )) { - mprinterr("Error: Frames to cache do not match those in existing cache.\n"); - return 1; + if (mismatch_fatal) { + mprinterr("Error: Frames to cache do not match those in existing cache.\n"); + return 1; + } else { + mprintf("Warning: Frames to cache do not match those in existing cache.\n" + "Warning: Re-calculating pairwise cache.\n"); + do_cache = true; + } } // TODO Check metric? Total frames? - } else { + } + + if (do_cache) { // Sanity check if (metric_ == 0) { mprinterr("Internal Error: PairwiseMatrix::CacheDistances(): Metric is null.\n"); diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h index 1ae3b788ab..59c2f95ea0 100644 --- a/src/Cluster/PairwiseMatrix.h +++ b/src/Cluster/PairwiseMatrix.h @@ -19,7 +19,7 @@ class PairwiseMatrix { /// \return distance between given frames. double Frame_Distance(int, int) const; /// Request that distances for the specified frames be cached. - int CacheDistances(Cframes const&, int); + int CacheDistances(Cframes const&, int, bool); // ------------------------------------------- //bool HasMetric() const { return (metric_ != 0); } From 2352d00b67b253e8f16129081817104113a24940 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 14:02:40 -0400 Subject: [PATCH 246/417] Add pwrecalc option --- src/Cluster/Control.cpp | 15 +++++++++++---- src/Cluster/Control.h | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 145faa7167..7e7e4b5ba7 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -48,7 +48,8 @@ Cpptraj::Cluster::Control::Control() : drawGraph_(NO_DRAWGRAPH), draw_tol_(0), draw_maxit_(0), - debug_(0) + debug_(0), + pw_mismatch_fatal_(true) {} Cpptraj::Cluster::Control::~Control() { @@ -557,6 +558,7 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, mprinterr("Error: PairwiseMatrix setup failed.\n"); return 1; } + pw_mismatch_fatal_ = !analyzeArgs.hasKey("pwrecalc"); // Allocate algorithm if (AllocateAlgorithm( analyzeArgs )) { @@ -701,7 +703,7 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (clustersVtime_ == 0) return 1; clustersvtimefile->AddDataSet( clustersVtime_ ); } - + // Cluster split analysis splitfile_ = analyzeArgs.GetStringKey("summarysplit"); if (splitfile_.empty()) // For backwards compat. @@ -753,8 +755,13 @@ void Cpptraj::Cluster::Control::Info() const { if (cache_ == 0) mprintf("\tPairwise distances will not be cached.\n"); - else + else { mprintf("\tPairwise distances will be cached: %s\n", cache_->legend()); + if (pw_mismatch_fatal_) + mprintf("\tPairwise distance calculation will be halted if frames in cache do not match.\n"); + else + mprintf("\tPairwise distances will be recalculated if frames in cache do not match.\n"); + } mprintf("\tRepresentative frames will be chosen by"); switch (bestRep_) { @@ -882,7 +889,7 @@ int Cpptraj::Cluster::Control::Run() { timer_pairwise_.Start(); // Cache distances if necessary - if (pmatrix_.CacheDistances( framesToCluster, sieve_, true )) return 1; + if (pmatrix_.CacheDistances( framesToCluster, sieve_, pw_mismatch_fatal_ )) return 1; if (pmatrix_.HasCache() && verbose_ > 1) pmatrix_.Cache().PrintCached(); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 12c98f5191..c3dbd85897 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -116,6 +116,8 @@ class Control { int debug_; ///< Cluster debug level + bool pw_mismatch_fatal_; ///< Controls if PW distances should be recalculated + // Timers Timer timer_setup_; ///< Run - metric, frames to cluster setup Timer timer_pairwise_; ///< Run - pairwise caching From ae313b29933b6608b3d51554c927a176e17bffc4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 14:33:59 -0400 Subject: [PATCH 247/417] Hide some debug info. --- src/Cluster/Control.cpp | 8 +++++--- src/Cluster/List.cpp | 13 ++++++++----- src/Cluster/Metric_DME.cpp | 6 ++++++ src/Cluster/Metric_RMS.cpp | 6 ++++++ src/Cluster/Metric_SRMSD.cpp | 2 ++ 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 7e7e4b5ba7..0138bb5547 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -182,7 +182,8 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis mprinterr("Error: Could not allocate pairwise cache.\n"); return 1; } - mprintf("DEBUG: Allocated pairwise distance cache: %s\n", cache_->legend()); + if (debug_ > 0) + mprintf("DEBUG: Allocated pairwise distance cache: %s\n", cache_->legend()); } } @@ -202,8 +203,9 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis DataFile* pwd_file = DFL.AddDataFile( pairdistname, pairdisttype, ArgList() ); if (pwd_file == 0) return 1; pwd_file->AddDataSet( cache_ ); - mprintf("DEBUG: Saving pw distance cache '%s' to file '%s'\n", cache_->legend(), - pwd_file->DataFilename().full()); + if (debug_ > 0) + mprintf("DEBUG: Saving pw distance cache '%s' to file '%s'\n", cache_->legend(), + pwd_file->DataFilename().full()); } else mprintf("Warning: Can only save pairwise distance cache for in-memory caches.\n"); } diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index f820725838..559e1b9960 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -79,7 +79,8 @@ const // Determine number of windows int nwindows = (int)maxFrames / windowSize; if (((int)maxFrames % windowSize) != 0) nwindows++; - mprintf("DEBUG: %u frames, %i windows, window size %i.\n", maxFrames, nwindows, windowSize); + if (debug_ > 0) + mprintf("DEBUG: %u frames, %i windows, window size %i.\n", maxFrames, nwindows, windowSize); // Create a bool array for each window that will record if cluster is present // during that window. @@ -487,10 +488,12 @@ int Cpptraj::Cluster::List::CalcSilhouette(PairwiseMatrix const& pmatrix, } // END loop over cluster frames //std::sort( SiVals.begin(), SiVals.end() ); // DEBUG - mprintf("DEBUG: Cluster frame silhouette values for cluster %i\n", Ci->Num()); - for (Node::SilPairArray::const_iterator it = Ci->FrameSilhouettes().begin(); - it != Ci->FrameSilhouettes().end(); ++it) - mprintf("\t%8i %g\n", it->first+1, it->second); + if (debug_ > 1) { + mprintf("DEBUG: Cluster frame silhouette values for cluster %i\n", Ci->Num()); + for (Node::SilPairArray::const_iterator it = Ci->FrameSilhouettes().begin(); + it != Ci->FrameSilhouettes().end(); ++it) + mprintf("\t%8i %g\n", it->first+1, it->second); + } if (ci_frames > 0) avg_si /= (double)ci_frames; //mprintf("DEBUG: Cluster silhouette: %8i %g\n", Ci->Num(), avg_si); diff --git a/src/Cluster/Metric_DME.cpp b/src/Cluster/Metric_DME.cpp index 26fb43d41a..43a3f24e0d 100644 --- a/src/Cluster/Metric_DME.cpp +++ b/src/Cluster/Metric_DME.cpp @@ -11,8 +11,10 @@ int Cpptraj::Cluster::Metric_DME::Init(DataSet_Coords* dIn, AtomMask const& mask mprinterr("Internal Error: Metric_DME::Init() called with null data set.\n"); return 1; } +# ifdef DEBUG_CLUSTER mprintf("DEBUG: Init DME metric for '%s', mask '%s'\n", dIn->legend(), maskIn.MaskString()); +# endif coords_ = dIn; mask_ = maskIn; @@ -22,11 +24,15 @@ int Cpptraj::Cluster::Metric_DME::Init(DataSet_Coords* dIn, AtomMask const& mask /** Set up the metric. */ int Cpptraj::Cluster::Metric_DME::Setup() { if (coords_->Top().SetupIntegerMask( mask_ )) return 1; +# ifdef DEBUG_CLUSTER mprintf("DEBUG: DME metric topology: %s %s %i\n", coords_->legend(), coords_->Top().c_str(), coords_->Top().Natom()); +# endif if (frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms())) return 1; frm2_ = frm1_; +# ifdef DEBUG_CLUSTER mprintf("DEBUG: Setup DME metric for %i atoms, %zu frames.\n", frm1_.Natom(), coords_->Size()); +# endif return 0; } diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index 16b6d60a92..d75d963b27 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -12,8 +12,10 @@ int Cpptraj::Cluster::Metric_RMS::Init(DataSet_Coords* dIn, AtomMask const& mask mprinterr("Internal Error: Metric_RMS::Init() called with null data set.\n"); return 1; } +# ifdef DEBUG_CLUSTER mprintf("DEBUG: Init RMS metric for '%s', mask '%s', nofit=%i, usemass=%i\n", dIn->legend(), maskIn.MaskString(), (int)nofit, (int)useMass); +# endif coords_ = dIn; mask_ = maskIn; nofit_ = nofit; @@ -25,11 +27,15 @@ int Cpptraj::Cluster::Metric_RMS::Init(DataSet_Coords* dIn, AtomMask const& mask /** Set up the metric. */ int Cpptraj::Cluster::Metric_RMS::Setup() { if (coords_->Top().SetupIntegerMask( mask_ )) return 1; +# ifdef DEBUG_CLUSTER mprintf("DEBUG: RMS metric topology: %s %s %i\n", coords_->legend(), coords_->Top().c_str(), coords_->Top().Natom()); +# endif if (frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms())) return 1; frm2_ = frm1_; +# ifdef DEBUG_CLUSTER mprintf("DEBUG: Setup RMS metric for %i atoms, %zu frames.\n", frm1_.Natom(), coords_->Size()); +# endif return 0; } diff --git a/src/Cluster/Metric_SRMSD.cpp b/src/Cluster/Metric_SRMSD.cpp index 33b2750b1c..fa23c5396a 100644 --- a/src/Cluster/Metric_SRMSD.cpp +++ b/src/Cluster/Metric_SRMSD.cpp @@ -19,8 +19,10 @@ int Cpptraj::Cluster::Metric_SRMSD::Init(DataSet_Coords* dIn, AtomMask const& ma int Cpptraj::Cluster::Metric_SRMSD::Setup() { if (coords_->Top().SetupIntegerMask( mask_ )) return 1; +# ifdef DEBUG_CLUSTER mprintf("DEBUG: SRMSD metric topology: %s %s %i\n", coords_->legend(), coords_->Top().c_str(), coords_->Top().Natom()); +# endif // false = no remap warning if (SRMSD_.SetupSymmRMSD(coords_->Top(), mask_, false)) return 1; frm1_.SetupFrameFromMask(mask_, coords_->Top().Atoms()); From ad2ccdad479ba36b5a10ba0f26f507ca2ea181b2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 14:53:28 -0400 Subject: [PATCH 248/417] Get rid of wrong sizeInBytes routine (does not account for different types). Use DataSize() for pairwise data set. --- src/DataSet_PairwiseCache_MEM.h | 2 +- src/Matrix.h | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/DataSet_PairwiseCache_MEM.h b/src/DataSet_PairwiseCache_MEM.h index 090ef11cfc..f53a060f97 100644 --- a/src/DataSet_PairwiseCache_MEM.h +++ b/src/DataSet_PairwiseCache_MEM.h @@ -13,7 +13,7 @@ class DataSet_PairwiseCache_MEM : public DataSet_PairwiseCache { int Allocate(SizeArray const&); void Add(size_t, const void*) { return; } void WriteBuffer(CpptrajFile&, SizeArray const&) const { return; } - size_t MemUsageInBytes() const { return Mat_.sizeInBytes(); } + size_t MemUsageInBytes() const { return Mat_.DataSize(); } // int Append(DataSet*) { return 1; } //# ifdef MPI // int Sync(size_t, std::vector const&, Parallel::Comm const&) { return 1; } diff --git a/src/Matrix.h b/src/Matrix.h index 7ecd0e302d..816ec1e916 100644 --- a/src/Matrix.h +++ b/src/Matrix.h @@ -26,10 +26,8 @@ template class Matrix { size_t size() const { return nelements_; } /// \return current matrix type. MType Type() const { return type_; } - /// \return estimated size in bytes. + /// \return estimated size in bytes for given number of columns and rows. static size_t sizeInBytes(size_t,size_t); - /// \return current size in bytes. - size_t sizeInBytes() const { return sizeInBytes(Ncols(), Nrows()); } /// Set up matrix for given number of cols and rows. int resize(size_t,size_t); /// \return element at specified col and row. @@ -60,9 +58,12 @@ template class Matrix { iterator end() const { return elements_ + nelements_; } /// \return memory used by matrix in bytes. size_t DataSize() const { - return (nelements_*sizeof(T)) + sizeof(T) + - (5 * sizeof(size_t) + sizeof(MType) + - sizeof(long int(*)())); + return (nelements_*sizeof(T)) + // elements_ array + sizeof(T*) + // elements_ + sizeof(T) + // diagElt_ + (5 * sizeof(size_t)) + // ncols_, nrows_, nelements_, maxElements_, currentElement_ + sizeof(MType) + // type_ + sizeof(long int(*)()); // indexFxn_ } /// Clear matrix void clear() { From e331dc7f9eeb28918bff3d14c3187c5e91ae3e5f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 15:10:30 -0400 Subject: [PATCH 249/417] Add est. disk usage in bytes calc --- src/Cluster/Cmatrix_NC.cpp | 5 +++++ src/Cluster/Cmatrix_NC.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/Cluster/Cmatrix_NC.cpp b/src/Cluster/Cmatrix_NC.cpp index 5ea4ae8938..926b0ccc46 100644 --- a/src/Cluster/Cmatrix_NC.cpp +++ b/src/Cluster/Cmatrix_NC.cpp @@ -47,6 +47,11 @@ bool Cpptraj::Cluster::Cmatrix_NC::ID_Cmatrix(FileName const& fname) { # endif } +/** \return estimated matrix disk usage in bytes for given number of rows. */ +size_t Cpptraj::Cluster::Cmatrix_NC::EstimatedDiskUsageInBytes(size_t sizeIn) { + return ((sizeIn*(sizeIn-1))/2)*sizeof(float); +} + #ifdef BINTRAJ // DEFINES #define NC_CMATRIX_NFRAMES "n_original_frames" diff --git a/src/Cluster/Cmatrix_NC.h b/src/Cluster/Cmatrix_NC.h index 781594b98f..aa8ada23c6 100644 --- a/src/Cluster/Cmatrix_NC.h +++ b/src/Cluster/Cmatrix_NC.h @@ -11,6 +11,8 @@ class Cmatrix_NC { enum ModeType { READ=0, WRITE }; Cmatrix_NC(); ~Cmatrix_NC(); + /// \return Estimated disk usage in bytes for given # rows + static size_t EstimatedDiskUsageInBytes(size_t); /// \return true if file is NetCDF cluster matrix file. static bool ID_Cmatrix(FileName const&); /// Open cluster matrix file for reading. Set sieve ID. From e8b6f75ae15bee013c6ab4ff24b45672530ab36f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 7 Sep 2021 20:46:52 -0400 Subject: [PATCH 250/417] Add pairwise cache in memory estimation, catch bad alloc error --- src/DataSet_PairwiseCache_MEM.cpp | 11 +++++++++-- src/cpptrajdepend | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp index fa6c7c7f31..b05289d950 100644 --- a/src/DataSet_PairwiseCache_MEM.cpp +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -1,5 +1,6 @@ #include "DataSet_PairwiseCache_MEM.h" #include "CpptrajStdio.h" +#include "StringRoutines.h" int DataSet_PairwiseCache_MEM::Allocate(SizeArray const& sizeIn) { int err = 0; @@ -21,12 +22,18 @@ int DataSet_PairwiseCache_MEM::SetupCache(unsigned int Ntotal, Cframes const& fr { unsigned int sizeIn = framesToCache.size(); if (sizeIn > 0) { - if (Mat_.resize(0, sizeIn)) return 1; // Upper triangle + mprintf("\tEstimated pair-wise matrix memory usage: > %s\n", + ByteString(Mat_.sizeInBytes( 0L, sizeIn ), BYTE_DECIMAL).c_str()); + try { Mat_.resize(0, sizeIn); } // Upper triangle + catch (const std::bad_alloc&) { + mprinterr("Error: Not enough memory to allocate pair-wise matrix.\n" + "Error: Consider using the 'sieve' keyword to reduce memory usage.\n"); + return 1; + } # ifdef DEBUG_CLUSTER mprintf("DEBUG: PairwiseMatrix_MEM set up for %i rows, size= %zu bytes.\n", Mat_.Nrows(), Mat_.sizeInBytes()); # endif - // TODO probably need to save metricDescription and sieve here for potential file write. } else Mat_.clear(); SetSieveVal( sieve ); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 1fae47128f..b9e82daab2 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -204,7 +204,7 @@ DataSet_Modes.o : DataSet_Modes.cpp ArgList.h ArrayIterator.h AssociatedData.h A DataSet_PHREMD_Explicit.o : DataSet_PHREMD_Explicit.cpp AssociatedData.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PHREMD.h DataSet_PHREMD_Explicit.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h Range.h TextFormat.h DataSet_PHREMD_Implicit.o : DataSet_PHREMD_Implicit.cpp AssociatedData.h Cph.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PHREMD.h DataSet_PHREMD_Implicit.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h Range.h TextFormat.h DataSet_PairwiseCache.o : DataSet_PairwiseCache.cpp AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h TextFormat.h -DataSet_PairwiseCache_MEM.o : DataSet_PairwiseCache_MEM.cpp ArrayIterator.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Matrix.h MetaData.h Parallel.h Range.h TextFormat.h +DataSet_PairwiseCache_MEM.o : DataSet_PairwiseCache_MEM.cpp ArrayIterator.h AssociatedData.h Cluster/Cframes.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_MEM.h Dimension.h FileIO.h FileName.h Matrix.h MetaData.h Parallel.h Range.h StringRoutines.h TextFormat.h DataSet_PairwiseCache_NC.o : DataSet_PairwiseCache_NC.cpp AssociatedData.h Cluster/Cframes.h Cluster/Cmatrix_NC.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_PairwiseCache.h DataSet_PairwiseCache_NC.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h StringRoutines.h TextFormat.h DataSet_Parameters.o : DataSet_Parameters.cpp AssociatedData.h AtomType.h Constants.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_Parameters.h Dimension.h FileIO.h FileName.h MetaData.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h TextFormat.h TypeNameHolder.h DataSet_RemLog.o : DataSet_RemLog.cpp AssociatedData.h CpptrajFile.h CpptrajStdio.h DataSet.h DataSet_RemLog.h Dimension.h FileIO.h FileName.h MetaData.h Parallel.h Range.h ReplicaDimArray.h TextFormat.h From 568e777059acf97ff3b600d90b66562fe3a2c2f0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 08:45:57 -0400 Subject: [PATCH 251/417] Fix output messages --- src/DataSet_PairwiseCache_MEM.cpp | 2 +- src/DataSet_PairwiseCache_NC.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DataSet_PairwiseCache_MEM.cpp b/src/DataSet_PairwiseCache_MEM.cpp index b05289d950..7c6291d92e 100644 --- a/src/DataSet_PairwiseCache_MEM.cpp +++ b/src/DataSet_PairwiseCache_MEM.cpp @@ -22,7 +22,7 @@ int DataSet_PairwiseCache_MEM::SetupCache(unsigned int Ntotal, Cframes const& fr { unsigned int sizeIn = framesToCache.size(); if (sizeIn > 0) { - mprintf("\tEstimated pair-wise matrix memory usage: > %s\n", + mprintf("\tEstimated pair-wise matrix memory usage: >= %s\n", ByteString(Mat_.sizeInBytes( 0L, sizeIn ), BYTE_DECIMAL).c_str()); try { Mat_.resize(0, sizeIn); } // Upper triangle catch (const std::bad_alloc&) { diff --git a/src/DataSet_PairwiseCache_NC.cpp b/src/DataSet_PairwiseCache_NC.cpp index fdbfc9a550..4b942a2766 100644 --- a/src/DataSet_PairwiseCache_NC.cpp +++ b/src/DataSet_PairwiseCache_NC.cpp @@ -11,8 +11,8 @@ int DataSet_PairwiseCache_NC::SetupCache(unsigned int Ntotal, Cframes const& fra } unsigned int sizeIn = framesToCache.size(); mprintf("\tPairwise cache file: '%s'\n", Meta().Fname().full()); - mprintf("\tEstimated pair-wise matrix disk usage: > %s\n", - ByteString( ((sizeIn*(sizeIn-1))/2)*sizeof(float), BYTE_DECIMAL).c_str()); + mprintf("\tEstimated pair-wise matrix disk usage: >= %s\n", + ByteString( file_.EstimatedDiskUsageInBytes(sizeIn), BYTE_DECIMAL ).c_str()); if (file_.CreateCmatrix(Meta().Fname(), Ntotal, sizeIn, sieve, metricDescription)) return 1; // Write actual frames array if necessary From dfbe43ecb6f7a50db1019a9017bdc1bdb57613a0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 09:00:02 -0400 Subject: [PATCH 252/417] Better description of the pairwise cache in Info --- src/Cluster/Control.cpp | 12 ++++++++---- src/DataSet.h | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 0138bb5547..0fab4039e3 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -206,8 +206,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis if (debug_ > 0) mprintf("DEBUG: Saving pw distance cache '%s' to file '%s'\n", cache_->legend(), pwd_file->DataFilename().full()); - } else - mprintf("Warning: Can only save pairwise distance cache for in-memory caches.\n"); + } } } @@ -758,9 +757,14 @@ void Cpptraj::Cluster::Control::Info() const { if (cache_ == 0) mprintf("\tPairwise distances will not be cached.\n"); else { - mprintf("\tPairwise distances will be cached: %s\n", cache_->legend()); + if (cache_->Size() > 0) + mprintf("\tUsing existing pairwise cache: %s (%s)\n", + cache_->legend(), cache_->description()); + else + mprintf("\tPairwise distances will be cached: %s (%s)\n", + cache_->legend(), cache_->description()); if (pw_mismatch_fatal_) - mprintf("\tPairwise distance calculation will be halted if frames in cache do not match.\n"); + mprintf("\tCalculation will be halted if frames in cache do not match.\n"); else mprintf("\tPairwise distances will be recalculated if frames in cache do not match.\n"); } diff --git a/src/DataSet.h b/src/DataSet.h index e84c239611..966364f522 100644 --- a/src/DataSet.h +++ b/src/DataSet.h @@ -130,8 +130,10 @@ class DataSet { return *first < *second; } }; - /// \return Text description based on DataType + /// \return Text description based on given DataType static const char* description(DataType t) { return Descriptions_[t]; } + /// \return Text description based on current DataType + const char* description() const { return Descriptions_[dType_]; } protected: TextFormat format_; ///< Text output data format. private: From 9e564aa60786557c1e927672c128479b8de7be39 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 09:08:33 -0400 Subject: [PATCH 253/417] Put COORDS set for results in Results info routine --- src/Cluster/Control.cpp | 12 +++++++----- src/Cluster/Results_Coords.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 0fab4039e3..e58096d304 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -534,14 +534,12 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (err != 0) return 1; } - // Set up results for COORDS DataSet + // Set up results that depend on COORDS DataSet if (coordsSet != 0) { - mprintf("\tCoordinates set for cluster results: %s\n", coordsSet->legend()); if (results_ != 0) delete results_; results_ = (Results*)new Results_Coords( static_cast( coordsSet ) ); if (results_ == 0) return 1; - } else - mprintf("\tNo coordinates set provided for cluster results.\n"); + } // Initialize clusters from existing info file. Metric must already be set up. if (analyzeArgs.hasKey("readinfo") || @@ -734,7 +732,11 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, void Cpptraj::Cluster::Control::Info() const { if (metric_ != 0) metric_->Info(); if (algorithm_ != 0) algorithm_->Info(); - if (results_ != 0) results_->Info(); + + if (results_ != 0) + results_->Info(); + else + mprintf("\tNo coordinates set provided for cluster results.\n"); // TODO frameSelect if (sieve_ > 1) diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 60fc978265..a5b761d08f 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -84,7 +84,13 @@ int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs, DataSetLi /** Write info on what results will be calculated/written. */ void Cpptraj::Cluster::Results_Coords::Info() const { - if (!clusterfile_.empty()) + if (coords_ == 0) { + mprintf("\tNo coordinates set provided for cluster results.\n"); + return; + } + + mprintf("\tCoordinates set for cluster results: %s\n", coords_->legend()); + if (!clusterfile_.empty()) mprintf("\tCluster trajectories will be written to %s, format %s\n", clusterfile_.c_str(), TrajectoryFile::FormatString(clusterfmt_)); if (!singlerepfile_.empty()) From d20613412f8edfd812fd79ba1deeeb43cf20a78d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 09:11:27 -0400 Subject: [PATCH 254/417] Test loading previously written pairwise disk cache --- test/Test_Cluster_Cache/RunTest.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/Test_Cluster_Cache/RunTest.sh b/test/Test_Cluster_Cache/RunTest.sh index 63b661152c..4cca0fbb52 100755 --- a/test/Test_Cluster_Cache/RunTest.sh +++ b/test/Test_Cluster_Cache/RunTest.sh @@ -2,7 +2,8 @@ . ../MasterTest.sh -CleanFiles cluster.in *.cnumvtime.dat *.info.dat *.summary.dat PW0 PW1 +CleanFiles cluster.in *.cnumvtime.dat *.info.dat *.summary.dat PW0 PW1 \ + CpptrajPairwiseCache INPUT="-i cluster.in" TESTNAME='Cluster pairwise cache tests' @@ -46,6 +47,8 @@ DoTest nosieve.mem.save.summary.dat nosieve.mem.load.summary.dat # Test on-disk cache with no sieve Cluster nosieve.disk.save " " "savepairdist pairdist PW1 pairwisecache disk" DoTest nosieve.mem.save.info.dat.save nosieve.disk.save.info.dat +Cluster nosieve.disk.load " " "loadpairdist pairdist PW1" +DoTest nosieve.mem.save.info.dat.save nosieve.disk.load.info.dat # Test no cache, no sieve Cluster nosieve.nocache.save " " "pairwisecache none" From 818250acaa878ec9270ab8515ab03abfc4826143 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 13:18:26 -0400 Subject: [PATCH 255/417] Have masks report number selected --- src/Cluster/Metric_DME.cpp | 1 + src/Cluster/Metric_RMS.cpp | 1 + src/Cluster/Metric_SRMSD.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/Cluster/Metric_DME.cpp b/src/Cluster/Metric_DME.cpp index 43a3f24e0d..b954edadc0 100644 --- a/src/Cluster/Metric_DME.cpp +++ b/src/Cluster/Metric_DME.cpp @@ -24,6 +24,7 @@ int Cpptraj::Cluster::Metric_DME::Init(DataSet_Coords* dIn, AtomMask const& mask /** Set up the metric. */ int Cpptraj::Cluster::Metric_DME::Setup() { if (coords_->Top().SetupIntegerMask( mask_ )) return 1; + mask_.MaskInfo(); # ifdef DEBUG_CLUSTER mprintf("DEBUG: DME metric topology: %s %s %i\n", coords_->legend(), coords_->Top().c_str(), coords_->Top().Natom()); diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index d75d963b27..b632dd6c16 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -27,6 +27,7 @@ int Cpptraj::Cluster::Metric_RMS::Init(DataSet_Coords* dIn, AtomMask const& mask /** Set up the metric. */ int Cpptraj::Cluster::Metric_RMS::Setup() { if (coords_->Top().SetupIntegerMask( mask_ )) return 1; + mask_.MaskInfo(); # ifdef DEBUG_CLUSTER mprintf("DEBUG: RMS metric topology: %s %s %i\n", coords_->legend(), coords_->Top().c_str(), coords_->Top().Natom()); diff --git a/src/Cluster/Metric_SRMSD.cpp b/src/Cluster/Metric_SRMSD.cpp index fa23c5396a..936b93d5e7 100644 --- a/src/Cluster/Metric_SRMSD.cpp +++ b/src/Cluster/Metric_SRMSD.cpp @@ -19,6 +19,7 @@ int Cpptraj::Cluster::Metric_SRMSD::Init(DataSet_Coords* dIn, AtomMask const& ma int Cpptraj::Cluster::Metric_SRMSD::Setup() { if (coords_->Top().SetupIntegerMask( mask_ )) return 1; + mask_.MaskInfo(); # ifdef DEBUG_CLUSTER mprintf("DEBUG: SRMSD metric topology: %s %s %i\n", coords_->legend(), coords_->Top().c_str(), coords_->Top().Natom()); From 6ff4c0214d880412d907db533172f2e30e2253b3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 14:39:33 -0400 Subject: [PATCH 256/417] Get rid of old code --- src/Cluster/Control.cpp | 100 ---------------------------------------- 1 file changed, 100 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index e58096d304..f20e34a0d5 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -266,106 +266,6 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type return met; } -/** Set up clustering for 1D scalar sets. */ -/* -int Cpptraj::Cluster::Control::SetupForDataSets(Metric_Data::DsArray const& inputSets, - DataSet_Coords* ds, - ArgList& analyzeArgs, - DataSetList& DSL, - DataFileList& DFL, - int verboseIn) -{ - verbose_ = verboseIn; - if (inputSets.empty()) { - mprinterr("Internal Error: Control::SetupForDataSets() called with no DataSets.\n"); - return 1; - } - Metric::Type mtype = Metric::EUCLID; // Default - if (analyzeArgs.hasKey("euclid")) - mtype = Metric::EUCLID; - else if (analyzeArgs.hasKey("manhattan")) - mtype = Metric::MANHATTAN; - if (metric_ != 0) delete metric_; - metric_ = 0; - metric_ = AllocateMetric( mtype ); - if (metric_ == 0) return 1; - // Metric init. - int err = ((Metric_Data*)metric_)->Init( inputSets ); - if (err != 0) return 1; - - // No results for data sets yet - if (results_ != 0) delete results_; - results_ = 0; - // Set up results for COORDS DataSet - if (ds != 0) { - results_ = (Results*)new Results_Coords( ds ); - if (results_ == 0) return 1; - } - - return Common(analyzeArgs, DSL, DFL); -}*/ - -/** Set up clustering for a COORDS DataSet.*/ -/* -int Cpptraj::Cluster::Control::SetupForCoordsDataSet(DataSet_Coords* ds, - ArgList& analyzeArgs, - DataSetList& DSL, - DataFileList& DFL, - int verboseIn) -{ - verbose_ = verboseIn; - if (ds == 0) { - mprinterr("Internal Error: Control::SetupForCoordsDataSet() called with null DataSet.\n"); - return 1; - } - // Determine Metric. Valid ones for COORDS are RMS, DME, SRMSD - int usedme = (int)analyzeArgs.hasKey("dme"); - int userms = (int)analyzeArgs.hasKey("rms"); - int usesrms = (int)analyzeArgs.hasKey("srmsd"); - if (usedme + userms + usesrms > 1) { - mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); - return 1; - } - Metric::Type mtype = Metric::RMS; // Default - if (usedme) mtype = Metric::DME; - else if (userms) mtype = Metric::RMS; - else if (usesrms) mtype = Metric::SRMSD; - if (metric_ != 0) delete metric_; - metric_ = 0; - metric_ = AllocateMetric( mtype ); - if (metric_ == 0) return 1; - // Metric init. - bool useMass = analyzeArgs.hasKey("mass"); - bool nofit = analyzeArgs.hasKey("nofit"); - // Get the mask string - std::string maskExpr = analyzeArgs.GetMaskNext(); - - int err = 0; - switch (mtype) { - case Metric::RMS : - err = ((Metric_RMS*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass); break; - case Metric::DME : - err = ((Metric_DME*)metric_)->Init(ds, AtomMask(maskExpr)); break; - case Metric::SRMSD : - err = ((Metric_SRMSD*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass, verbose_); - break; - default: - mprinterr("Error: Unhandled Metric setup.\n"); - err = 1; - } - if (err != 0) { - mprinterr("Error: Metric setup failed.\n"); - return 1; - } - - // Set up results for COORDS DataSet - if (results_ != 0) delete results_; - results_ = (Results*)new Results_Coords( ds ); - if (results_ == 0) return 1; - - return Common(analyzeArgs, DSL, DFL); -}*/ - // ----------------------------------------------------------------------------- static int Err(int code) { switch (code) { From 5c26e0d307676ccbac1ec303a81f548da792825f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 14:53:01 -0400 Subject: [PATCH 257/417] Start adding help function --- src/Analysis_Cluster.cpp | 3 ++- src/Cluster/Control.cpp | 9 +++++++++ src/Cluster/Control.h | 14 ++++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index a56aaca13a..76f9937e32 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -6,7 +6,8 @@ using namespace Cpptraj::Cluster; // Analysis_Cluster::Help() void Analysis_Cluster::Help() const { - + mprintf("\t[{crdset [,...] [nocoords]\n"); + Control::Help(); } // Analysis_Cluster::Setup() diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index f20e34a0d5..9066a3d7f8 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -628,6 +628,15 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, return 0; } +/** Print help text to STDOUT. */ +void Cpptraj::Cluster::Control::Help() { + mprintf(" Algorithms: %s\n", AlgorithmArgs_); + Algorithm_HierAgglo::Help(); + Algorithm_DBscan::Help(); + Algorithm_Kmeans::Help(); + Algorithm_DPeaks::Help(); +} + // ----------------------------------------------------------------------------- void Cpptraj::Cluster::Control::Info() const { if (metric_ != 0) metric_->Info(); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index c3dbd85897..9a803c0ea2 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -28,12 +28,6 @@ class Control { /// Set debug level void SetDebug(int d) { debug_ = d; } - // Help keywords - static const char* PairwiseArgs_; - static const char* AlgorithmArgs_; - static const char* CoordsDataSetArgs_; - static const char* CommonArgs_; - /// For determining how any sieved frames should be restored. enum SieveRestoreType { NO_RESTORE = 0, CLOSEST_CENTROID, EPSILON_CENTROID, EPSILON_FRAME }; /// For determining how frames to cluster will be determined. @@ -54,7 +48,15 @@ class Control { int Output(DataSetList&); /// Print timing data void Timing(double) const; + /// Print help text to STDOUT + static void Help(); private: + // Help keywords + static const char* PairwiseArgs_; + static const char* AlgorithmArgs_; + static const char* CoordsDataSetArgs_; + static const char* CommonArgs_; + int AllocatePairwise(ArgList&, DataSetList&, DataFileList&); static Metric* AllocateMetric(Metric::Type); From 29f49a03964d2afc3f704c57910bc87342061764 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 15:02:45 -0400 Subject: [PATCH 258/417] Add cluster restart from info file test --- test/Test_Cluster_ReadInfo/RunTest.sh | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 test/Test_Cluster_ReadInfo/RunTest.sh diff --git a/test/Test_Cluster_ReadInfo/RunTest.sh b/test/Test_Cluster_ReadInfo/RunTest.sh new file mode 100755 index 0000000000..46ec716b37 --- /dev/null +++ b/test/Test_Cluster_ReadInfo/RunTest.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +. ../MasterTest.sh + +# Clean +CleanFiles cluster.in C?.info.dat PW + +TESTNAME='Cluster read info tests' +Requires netcdf +INPUT="-i cluster.in" + +cat > cluster.in < cluster.in < Date: Wed, 8 Sep 2021 15:03:17 -0400 Subject: [PATCH 259/417] Enable cluster restart test --- test/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Makefile b/test/Makefile index 49ae0a1508..66bbb97e4f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -109,6 +109,7 @@ test.cluster: @-cd Test_Cluster_Nreps && ./RunTest.sh $(OPT) @-cd Test_Cluster_AssignRefs && ./RunTest.sh $(OPT) @-cd Test_Cluster_Cache && ./RunTest.sh $(OPT) + @-cd Test_Cluster_ReadInfo && ./RunTest.sh $(OPT) test.ired: @-cd Test_IRED && ./RunTest.sh $(OPT) From 3dec4048a2eabcea69ec5a6fef26fe141de2adc3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Sep 2021 16:02:54 -0400 Subject: [PATCH 260/417] Add more help args --- src/Analysis_Cluster.cpp | 2 +- src/Cluster/Control.cpp | 8 +++++++- src/Cluster/Control.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index 76f9937e32..d70791224f 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -6,7 +6,7 @@ using namespace Cpptraj::Cluster; // Analysis_Cluster::Help() void Analysis_Cluster::Help() const { - mprintf("\t[{crdset [,...] [nocoords]\n"); + mprintf("\t[{crdset [,...] [nocoords]}]\n"); Control::Help(); } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 9066a3d7f8..b81e000492 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -338,6 +338,8 @@ const char* Cpptraj::Cluster::Control::CommonArgs_ = const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = "{dme|rms|srmsd} [mass] [nofit] []"; +const char* Cpptraj::Cluster::Control::MetricArgs_ = + "{rms|srmsd|dme|euclid|manhattan}"; /** Common setup. */ //int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) @@ -630,11 +632,15 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, /** Print help text to STDOUT. */ void Cpptraj::Cluster::Control::Help() { - mprintf(" Algorithms: %s\n", AlgorithmArgs_); + mprintf("\t[] [] [readinfo infofile ]\n"); + mprintf(" Algorithms: [%s]\n", AlgorithmArgs_); Algorithm_HierAgglo::Help(); Algorithm_DBscan::Help(); Algorithm_Kmeans::Help(); Algorithm_DPeaks::Help(); + mprintf(" Metrics: [%s]\n", MetricArgs_); + mprintf(" ('euclid' and 'manhattan' only work with 'data')\n"); + mprintf("\t%s\n", CoordsDataSetArgs_); } // ----------------------------------------------------------------------------- diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 9a803c0ea2..a591796308 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -54,6 +54,7 @@ class Control { // Help keywords static const char* PairwiseArgs_; static const char* AlgorithmArgs_; + static const char* MetricArgs_; static const char* CoordsDataSetArgs_; static const char* CommonArgs_; From 97f3b62319084bb4e80fc7a2d0005c9f42bcef83 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 08:35:31 -0400 Subject: [PATCH 261/417] Clean up hieragglo help. Start working on sieve options help --- src/Cluster/Algorithm_HierAgglo.cpp | 31 +++++++++++++++-------------- src/Cluster/Algorithm_HierAgglo.h | 5 ++++- src/Cluster/Control.cpp | 6 +++++- src/Cluster/Control.h | 1 + 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 64b8976477..3a044cf322 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -6,23 +6,21 @@ #include "../ArgList.h" #include "../ProgressBar.h" +/** CONSTRUCTOR */ Cpptraj::Cluster::Algorithm_HierAgglo::Algorithm_HierAgglo() : Algorithm(HIERAGGLO), nclusters_(-1), epsilon_(-1.0), - linkage_(AVERAGELINK)//, -// includeSievedFrames_(false) + linkage_(AVERAGELINK) {} +/** Print keywords to STDOUT */ void Cpptraj::Cluster::Algorithm_HierAgglo::Help() { mprintf("\t[hieragglo [epsilon ] [clusters ] [linkage|averagelinkage|complete]\n" - "\t [epsilonplot ] [includesieved_cdist]]\n"); + "\t [epsilonplot ]\n"); } -static const char* LinkageString[] = { - "single-linkage", "average-linkage", "complete-linkage" -}; - +/** Process user args */ int Cpptraj::Cluster::Algorithm_HierAgglo::Setup(ArgList& analyzeArgs) { nclusters_ = analyzeArgs.getKeyInt("clusters", -1); epsilon_ = analyzeArgs.getKeyDouble("epsilon", -1.0); @@ -30,7 +28,6 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::Setup(ArgList& analyzeArgs) { else if (analyzeArgs.hasKey("averagelinkage")) linkage_ = AVERAGELINK; else if (analyzeArgs.hasKey("complete")) linkage_ = COMPLETELINK; else linkage_ = AVERAGELINK; // DEFAULT linkage -// includeSievedFrames_ = analyzeArgs.hasKey("includesieved_cdist"); std::string epsilonPlot = analyzeArgs.GetStringKey("epsilonplot"); if (!epsilonPlot.empty()) { if (eps_v_n_.OpenWrite( epsilonPlot )) return 1; @@ -45,27 +42,30 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::Setup(ArgList& analyzeArgs) { return 0; } +/** Strings corresponding to LINKAGETYPE */ +const char* Cpptraj::Cluster::Algorithm_HierAgglo::LinkageString_[] = { + "single-linkage", "average-linkage", "complete-linkage" +}; + +/** Print info */ void Cpptraj::Cluster::Algorithm_HierAgglo::Info() const { mprintf("\tHierarchical Agglomerative:"); if (nclusters_ != -1) mprintf(" %i clusters,",nclusters_); if (epsilon_ != -1.0) mprintf(" epsilon %.3f,",epsilon_); - mprintf(" %s.\n", LinkageString[linkage_]); + mprintf(" %s.\n", LinkageString_[linkage_]); if (eps_v_n_.IsOpen()) mprintf("\tWriting epsilon vs # clusters to '%s'\n", eps_v_n_.Filename().full()); - /*if (includeSievedFrames_) - mprintf("\tSieved frames will be included in final cluster distance calculation.\n" - "Warning: 'includesieved_cdist' may be very slow.\n"); - else - mprintf("\tSieved frames will not be included in final cluster distance calculation.\n");*/ } +/** Write info on clustering to info file. */ void Cpptraj::Cluster::Algorithm_HierAgglo::Results(CpptrajFile& outfile) const { outfile.Printf("#Algorithm: HierAgglo linkage %s nclusters %i epsilon %g\n", - LinkageString[linkage_], nclusters_, epsilon_); + LinkageString_[linkage_], nclusters_, epsilon_); } +/** Print clustering timing. */ void Cpptraj::Cluster::Algorithm_HierAgglo::Timing(double total) const { # ifdef TIMER time_findMin_.WriteTiming(2, "Find min distance", total); @@ -342,6 +342,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcAvgDist(List::cluster_it& C1_it, } } +/** \return the Distance between the two given cluster Nodes. */ double Cpptraj::Cluster::Algorithm_HierAgglo::ClusterDistance(Node const& C1, Node const& C2, PairwiseMatrix const& pmatrix, bool includeSieved, diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index e53ed17388..2a70fa8dcc 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -32,8 +32,11 @@ class Algorithm_HierAgglo : public Algorithm { void calcMaxDist(List::cluster_it&, List&, PairwiseMatrix const&); void calcAvgDist(List::cluster_it&, List&, PairwiseMatrix const&); - /// Type of distance calculation between clusters. + /// Type of distance calculation between clusters; corresponds to LinkageString_. enum LINKAGETYPE { SINGLELINK = 0, AVERAGELINK, COMPLETELINK }; + /// Describe LINKAGETYPE + static const char* LinkageString_[]; + int nclusters_; ///< Target # of clusters. double epsilon_; ///< Once the min distance between clusters is > epsilon, stop. LINKAGETYPE linkage_; ///< Cluster Linkage type. diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index b81e000492..3fb64a2c9d 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -328,7 +328,6 @@ int Cpptraj::Cluster::Control::ReadInfo(std::string const& fname) { // ----------------------------------------------------------------------------- const char* Cpptraj::Cluster::Control::CommonArgs_ = - "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [includesieved_cdist] [sievetoframe]] " "[bestrep {cumulative|centroid|cumulative_nosieve} [savenreps <#>]] " "[noinfo|info ] [summary ] [sil ] " "[cpopvtime [{normpop|normframe}]] " @@ -341,6 +340,9 @@ const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = const char* Cpptraj::Cluster::Control::MetricArgs_ = "{rms|srmsd|dme|euclid|manhattan}"; +const char* Cpptraj::Cluster::Control::SieveArgs_ = + "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [includesieved_cdist] [sievetoframe]]"; + /** Common setup. */ //int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, @@ -483,6 +485,8 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (includeSieveInCalc_) mprintf("Warning: 'includesieveincalc' may be very slow.\n"); includeSieveCdist_ = analyzeArgs.hasKey("includesieved_cdist"); + if (includeSieveCdist_) + mprintf("Warning: 'includesieved_cdist' may be very slow.\n"); // Determine how frames to cluster will be chosen if (frameSelect_ == UNSPECIFIED) { diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index a591796308..2bc15dc3c2 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -55,6 +55,7 @@ class Control { static const char* PairwiseArgs_; static const char* AlgorithmArgs_; static const char* MetricArgs_; + static const char* SieveArgs_; static const char* CoordsDataSetArgs_; static const char* CommonArgs_; From 8dec99800fa512d2be3efb0b93d7b88ddde899dc Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 09:03:23 -0400 Subject: [PATCH 262/417] Fix up sieve options --- src/Cluster/Algorithm_DBscan.cpp | 2 +- src/Cluster/Algorithm_DPeaks.cpp | 6 +-- src/Cluster/Algorithm_HierAgglo.cpp | 2 +- src/Cluster/Algorithm_Kmeans.cpp | 2 +- src/Cluster/Control.cpp | 64 +++++++++++++++++++++-------- src/Cluster/Control.h | 3 +- 6 files changed, 55 insertions(+), 24 deletions(-) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index 40c895f474..77d8440600 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -26,7 +26,7 @@ Cpptraj::Cluster::Algorithm_DBscan::Algorithm_DBscan() : // Algorithm_DBscan::Help() void Cpptraj::Cluster::Algorithm_DBscan::Help() { - mprintf("\t[dbscan minpoints epsilon [sievetoframe] [kdist [kfile ]]]\n"); + mprintf("\t[dbscan minpoints epsilon [kdist [kfile ]]]\n"); } // Cluster_DBSCAN::SetupCluster() diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index ba6f377758..e1e082ee35 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -20,9 +20,9 @@ Cpptraj::Cluster::Algorithm_DPeaks::Algorithm_DPeaks() : void Cpptraj::Cluster::Algorithm_DPeaks::Help() { mprintf("\t[dpeaks epsilon [noise] [dvdfile ]\n" - "\t [choosepoints {manual | auto}]\n" - "\t [distancecut ] [densitycut ]\n" - "\t [runavg ] [deltafile ] [gauss]]\n"); + "\t [choosepoints {manual | auto}]\n" + "\t [distancecut ] [densitycut ]\n" + "\t [runavg ] [deltafile ] [gauss]]\n"); } int Cpptraj::Cluster::Algorithm_DPeaks::Setup(ArgList& analyzeArgs) { diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 3a044cf322..4b9a439bc8 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -17,7 +17,7 @@ Cpptraj::Cluster::Algorithm_HierAgglo::Algorithm_HierAgglo() : /** Print keywords to STDOUT */ void Cpptraj::Cluster::Algorithm_HierAgglo::Help() { mprintf("\t[hieragglo [epsilon ] [clusters ] [linkage|averagelinkage|complete]\n" - "\t [epsilonplot ]\n"); + "\t [epsilonplot ]]\n"); } /** Process user args */ diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index e2a7add007..41b80183d3 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -19,7 +19,7 @@ Cpptraj::Cluster::Algorithm_Kmeans::Algorithm_Kmeans() : {} void Cpptraj::Cluster::Algorithm_Kmeans::Help() { - mprintf("\t[kmeans clusters [randompoint [kseed ]] [maxit ]\n"); + mprintf("\t[kmeans clusters [randompoint [kseed ]] [maxit ]]\n"); } // SetupCluster() diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 3fb64a2c9d..d18cf7ab74 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -334,14 +334,17 @@ const char* Cpptraj::Cluster::Control::CommonArgs_ = "[out [gracecolor]] [] " "[clustersvtime cvtwindow <#> "; -const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = - "{dme|rms|srmsd} [mass] [nofit] []"; - const char* Cpptraj::Cluster::Control::MetricArgs_ = "{rms|srmsd|dme|euclid|manhattan}"; -const char* Cpptraj::Cluster::Control::SieveArgs_ = - "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [includesieved_cdist] [sievetoframe]]"; +const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = + "[{dme|rms|srmsd} [mass] [nofit] []]"; + +const char* Cpptraj::Cluster::Control::SieveArgs1_ = + "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [includesieved_cdist]"; + +const char* Cpptraj::Cluster::Control::SieveArgs2_ = + " [{sievetoframe|sievetocentroid|closestcentroid}] [repsilon ]]"; /** Common setup. */ //int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) @@ -503,21 +506,45 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, } } - // Choose sieve restore option based on algorithm and frames to cluster. + // Choose sieve restore options if (sieve_ != 1) { - sieveRestore_ = CLOSEST_CENTROID; - if (algorithm_->Type() == Algorithm::DBSCAN || - algorithm_->Type() == Algorithm::DPEAKS) - { + // Determine sieve restore type + if (sieveRestore_ == NO_RESTORE) { + // No option set yet. See if a keyword has been specified. if (analyzeArgs.hasKey("nosieverestore")) // Hidden option, currently for testing only sieveRestore_ = NO_RESTORE; - else if (!analyzeArgs.hasKey("sievetoframe")) - sieveRestore_ = EPSILON_CENTROID; - else + else if (analyzeArgs.hasKey("sievetoframe")) sieveRestore_ = EPSILON_FRAME; - restoreEpsilon_ = algorithm_->Epsilon(); + else if (analyzeArgs.hasKey("sievetocentroid")) + sieveRestore_ = EPSILON_CENTROID; + else if (analyzeArgs.hasKey("closestcentroid")) + sieveRestore_ = CLOSEST_CENTROID; + else { + // Nothing specified yet. Choose restore option based on algorithm. + if (algorithm_->Type() == Algorithm::DBSCAN || + algorithm_->Type() == Algorithm::DPEAKS) + sieveRestore_ = EPSILON_CENTROID; + else + sieveRestore_ = CLOSEST_CENTROID; + } + } + // Determine sieve restore epsilon + if (sieveRestore_ == EPSILON_FRAME || + sieveRestore_ == EPSILON_CENTROID) + { + // Epsilon-based sieve restore + if (algorithm_->Type() == Algorithm::DBSCAN || + algorithm_->Type() == Algorithm::DPEAKS) + { + // Using a density-based algorithm with epsilon-based restore; + // use restore epsilon from algorithm. + restoreEpsilon_ = algorithm_->Epsilon(); + } } + double rEps = analyzeArgs.getKeyDouble("repsilon", -1.0); + if (rEps > 0) + restoreEpsilon_ = rEps; } // Best rep options @@ -636,15 +663,18 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, /** Print help text to STDOUT. */ void Cpptraj::Cluster::Control::Help() { - mprintf("\t[] [] [readinfo infofile ]\n"); - mprintf(" Algorithms: [%s]\n", AlgorithmArgs_); + mprintf("\t[] [] [] [readinfo infofile ]\n"); + mprintf(" Algorithm Args: [%s]\n", AlgorithmArgs_); Algorithm_HierAgglo::Help(); Algorithm_DBscan::Help(); Algorithm_Kmeans::Help(); Algorithm_DPeaks::Help(); - mprintf(" Metrics: [%s]\n", MetricArgs_); + mprintf(" Metric Args: [%s]\n", MetricArgs_); mprintf(" ('euclid' and 'manhattan' only work with 'data')\n"); mprintf("\t%s\n", CoordsDataSetArgs_); + mprintf(" Sieve Args:\n"); + mprintf("\t%s\n", SieveArgs1_); + mprintf("\t%s\n", SieveArgs2_); } // ----------------------------------------------------------------------------- diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 2bc15dc3c2..1726b5c08d 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -55,7 +55,8 @@ class Control { static const char* PairwiseArgs_; static const char* AlgorithmArgs_; static const char* MetricArgs_; - static const char* SieveArgs_; + static const char* SieveArgs1_; + static const char* SieveArgs2_; static const char* CoordsDataSetArgs_; static const char* CommonArgs_; From d288cbb043a83bf241135c7ee4b07ebac4d99831 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 09:26:52 -0400 Subject: [PATCH 263/417] Add output and coords output args --- src/Analysis_Cluster.cpp | 2 +- src/Cluster/Control.cpp | 29 ++++++++++++++++++++++------- src/Cluster/Control.h | 7 +++++-- src/Cluster/Results_Coords.cpp | 9 +++++++++ src/Cluster/Results_Coords.h | 1 + 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Cluster.cpp index d70791224f..adf663121f 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Cluster.cpp @@ -6,7 +6,7 @@ using namespace Cpptraj::Cluster; // Analysis_Cluster::Help() void Analysis_Cluster::Help() const { - mprintf("\t[{crdset [,...] [nocoords]}]\n"); + mprintf("\t[{crdset | data [,...] [nocoords]}]\n"); Control::Help(); } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index d18cf7ab74..c4624f3d32 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -327,12 +327,6 @@ int Cpptraj::Cluster::Control::ReadInfo(std::string const& fname) { } // ----------------------------------------------------------------------------- -const char* Cpptraj::Cluster::Control::CommonArgs_ = - "[bestrep {cumulative|centroid|cumulative_nosieve} [savenreps <#>]] " - "[noinfo|info ] [summary ] [sil ] " - "[cpopvtime [{normpop|normframe}]] " - "[out [gracecolor]] [] " - "[clustersvtime cvtwindow <#> "; const char* Cpptraj::Cluster::Control::MetricArgs_ = "{rms|srmsd|dme|euclid|manhattan}"; @@ -346,6 +340,18 @@ const char* Cpptraj::Cluster::Control::SieveArgs1_ = const char* Cpptraj::Cluster::Control::SieveArgs2_ = " [{sievetoframe|sievetocentroid|closestcentroid}] [repsilon ]]"; +const char* Cpptraj::Cluster::Control::BestRepArgs_ = + "[bestrep {cumulative|centroid|cumulative_nosieve}] [savenreps <#>]"; + +const char* Cpptraj::Cluster::Control::OutputArgs1_ = + "[out [gracecolor]] [noinfo|info ] [summary ]"; + +const char* Cpptraj::Cluster::Control::OutputArgs2_ = + "[clustersvtime [cvtwindow <#>]] [sil ]"; + +const char* Cpptraj::Cluster::Control::OutputArgs3_ = + "[cpopvtime [{normpop|normframe}]]"; + /** Common setup. */ //int Cpptraj::Cluster::Control::Common(ArgList& analyzeArgs, DataSetList& DSL, DataFileList& DFL) int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, @@ -663,7 +669,8 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, /** Print help text to STDOUT. */ void Cpptraj::Cluster::Control::Help() { - mprintf("\t[] [] [] [readinfo infofile ]\n"); + mprintf("\t[] [] [] [] [] []\n" + "\t[] [readinfo infofile ]\n"); mprintf(" Algorithm Args: [%s]\n", AlgorithmArgs_); Algorithm_HierAgglo::Help(); Algorithm_DBscan::Help(); @@ -675,6 +682,14 @@ void Cpptraj::Cluster::Control::Help() { mprintf(" Sieve Args:\n"); mprintf("\t%s\n", SieveArgs1_); mprintf("\t%s\n", SieveArgs2_); + mprintf(" BestRep Args:\n"); + mprintf("\t%s\n", BestRepArgs_); + mprintf(" Output Args:\n"); + mprintf("\t%s\n", OutputArgs1_); + mprintf("\t%s\n", OutputArgs2_); + mprintf("\t%s\n", OutputArgs3_); + mprintf(" Coordinate Output Args:\n"); + Results_Coords::Help(); } // ----------------------------------------------------------------------------- diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 1726b5c08d..3377f7b2ac 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -55,10 +55,13 @@ class Control { static const char* PairwiseArgs_; static const char* AlgorithmArgs_; static const char* MetricArgs_; + static const char* CoordsDataSetArgs_; static const char* SieveArgs1_; static const char* SieveArgs2_; - static const char* CoordsDataSetArgs_; - static const char* CommonArgs_; + static const char* BestRepArgs_; + static const char* OutputArgs1_; + static const char* OutputArgs2_; + static const char* OutputArgs3_; int AllocatePairwise(ArgList&, DataSetList&, DataFileList&); diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index a5b761d08f..477b2b7f44 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -26,6 +26,15 @@ Cpptraj::Cluster::Results_Coords::Results_Coords(DataSet_Coords* ds) : avgfmt_(TrajectoryFile::UNKNOWN_TRAJ) {} +/** Help for Results_Coords keywords. */ +void Cpptraj::Cluster::Results_Coords::Help() { + mprintf("\t[clusterout [clusterfmt ]]\n" + "\t[singlerepout [singlerepfmt ]]\n" + "\t[repout [repfmt ] [repframe]]\n" + "\t[avgout [avgfmt ]]\n" + "\t[assignrefs [refcut ] [refmask ]]\n"); +} + /** Get arguments related to writing cluster data to trajectories. */ void Cpptraj::Cluster::Results_Coords::GetClusterTrajArgs(ArgList& argIn, const char* trajKey, const char* fmtKey, diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index b32e481062..9077c7b667 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -11,6 +11,7 @@ namespace Cluster { class Results_Coords : public Results { public: Results_Coords(DataSet_Coords*); + static void Help(); // ----- Results functions ------------------- int GetOptions(ArgList&, DataSetList const&, Metric const&); void Info() const; From b2f47799ce7d2c4597d38aa240d2f2223db7cb61 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 09:32:51 -0400 Subject: [PATCH 264/417] Add graph args. --- src/Cluster/Control.cpp | 7 ++++++- src/Cluster/Control.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index c4624f3d32..e7046113a3 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -352,6 +352,9 @@ const char* Cpptraj::Cluster::Control::OutputArgs2_ = const char* Cpptraj::Cluster::Control::OutputArgs3_ = "[cpopvtime [{normpop|normframe}]]"; +const char* Cpptraj::Cluster::Control::GraphArgs_ = + "[{drawgraph|drawgraph3d} [draw_tol ] [draw_maxit ] [] [] [] [] []\n" - "\t[] [readinfo infofile ]\n"); + "\t[] [] [readinfo infofile ]\n"); mprintf(" Algorithm Args: [%s]\n", AlgorithmArgs_); Algorithm_HierAgglo::Help(); Algorithm_DBscan::Help(); @@ -690,6 +693,8 @@ void Cpptraj::Cluster::Control::Help() { mprintf("\t%s\n", OutputArgs3_); mprintf(" Coordinate Output Args:\n"); Results_Coords::Help(); + mprintf(" Graph Args:\n"); + mprintf("\t%s\n", GraphArgs_); } // ----------------------------------------------------------------------------- diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 3377f7b2ac..36096030cb 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -62,6 +62,7 @@ class Control { static const char* OutputArgs1_; static const char* OutputArgs2_; static const char* OutputArgs3_; + static const char* GraphArgs_; int AllocatePairwise(ArgList&, DataSetList&, DataFileList&); From ad39a91a4b73015e738eb06d6c1c8597c64633a7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 09:57:37 -0400 Subject: [PATCH 265/417] Add missing help keywords. --- src/Cluster/Control.cpp | 26 ++++++++++++++++++-------- src/Cluster/Control.h | 4 +++- src/Cluster/Results_Coords.cpp | 8 ++++---- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index e7046113a3..57028b2d52 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -70,8 +70,11 @@ DataFile::DataFormatType Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_TYPE_ = DataFile::CMATRIX_BINARY; # endif -const char* Cpptraj::Cluster::Control::PairwiseArgs_ = - "[pairdist ] [loadpairdist] [savepairdist] [pairwisecache {mem|disk|none}]"; +const char* Cpptraj::Cluster::Control::PairwiseArgs1_ = + "[pairdist ] [pwrecalc]"; + +const char* Cpptraj::Cluster::Control::PairwiseArgs2_ = + "[loadpairdist] [savepairdist] [pairwisecache {mem|disk|none}]"; /** Set up PairwiseMatrix from arguments. */ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetList& DSL, @@ -209,6 +212,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis } } } + pw_mismatch_fatal_ = !analyzeArgs.hasKey("pwrecalc"); return 0; } @@ -347,10 +351,13 @@ const char* Cpptraj::Cluster::Control::OutputArgs1_ = "[out [gracecolor]] [noinfo|info ] [summary ]"; const char* Cpptraj::Cluster::Control::OutputArgs2_ = - "[clustersvtime [cvtwindow <#>]] [sil ]"; + "[summarysplit ] [splitframe ]"; const char* Cpptraj::Cluster::Control::OutputArgs3_ = - "[cpopvtime [{normpop|normframe}]]"; + "[clustersvtime [cvtwindow <#>]] [sil ]"; + +const char* Cpptraj::Cluster::Control::OutputArgs4_ = + "[cpopvtime [{normpop|normframe}]] [lifetime]"; const char* Cpptraj::Cluster::Control::GraphArgs_ = "[{drawgraph|drawgraph3d} [draw_tol ] [draw_maxit ] [] [] [] [] []\n" - "\t[] [] [readinfo infofile ]\n"); + mprintf("\t[] [] [] [] [] []\n" + "\t[] [] [] [readinfo infofile ]\n"); mprintf(" Algorithm Args: [%s]\n", AlgorithmArgs_); Algorithm_HierAgglo::Help(); Algorithm_DBscan::Help(); @@ -681,7 +687,10 @@ void Cpptraj::Cluster::Control::Help() { Algorithm_DPeaks::Help(); mprintf(" Metric Args: [%s]\n", MetricArgs_); mprintf(" ('euclid' and 'manhattan' only work with 'data')\n"); - mprintf("\t%s\n", CoordsDataSetArgs_); + mprintf("\t{%s | [{euclid|manhattan}]}\n", CoordsDataSetArgs_); + mprintf(" Pairwise Args:\n"); + mprintf("\t%s\n", PairwiseArgs1_); + mprintf("\t%s\n", PairwiseArgs2_); mprintf(" Sieve Args:\n"); mprintf("\t%s\n", SieveArgs1_); mprintf("\t%s\n", SieveArgs2_); @@ -691,6 +700,7 @@ void Cpptraj::Cluster::Control::Help() { mprintf("\t%s\n", OutputArgs1_); mprintf("\t%s\n", OutputArgs2_); mprintf("\t%s\n", OutputArgs3_); + mprintf("\t%s\n", OutputArgs4_); mprintf(" Coordinate Output Args:\n"); Results_Coords::Help(); mprintf(" Graph Args:\n"); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 36096030cb..cbb6d027f6 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -52,7 +52,8 @@ class Control { static void Help(); private: // Help keywords - static const char* PairwiseArgs_; + static const char* PairwiseArgs1_; + static const char* PairwiseArgs2_; static const char* AlgorithmArgs_; static const char* MetricArgs_; static const char* CoordsDataSetArgs_; @@ -62,6 +63,7 @@ class Control { static const char* OutputArgs1_; static const char* OutputArgs2_; static const char* OutputArgs3_; + static const char* OutputArgs4_; static const char* GraphArgs_; int AllocatePairwise(ArgList&, DataSetList&, DataFileList&); diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 477b2b7f44..925bece5c9 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -28,10 +28,10 @@ Cpptraj::Cluster::Results_Coords::Results_Coords(DataSet_Coords* ds) : /** Help for Results_Coords keywords. */ void Cpptraj::Cluster::Results_Coords::Help() { - mprintf("\t[clusterout [clusterfmt ]]\n" - "\t[singlerepout [singlerepfmt ]]\n" - "\t[repout [repfmt ] [repframe]]\n" - "\t[avgout [avgfmt ]]\n" + mprintf("\t[clusterout [clusterfmt ]]\n" + "\t[singlerepout [singlerepfmt ]]\n" + "\t[repout [repfmt ] [repframe]]\n" + "\t[avgout [avgfmt ]]\n" "\t[assignrefs [refcut ] [refmask ]]\n"); } From 47cdc7104803ef939804cb696af36e1e210ea457 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 10:35:54 -0400 Subject: [PATCH 266/417] Fix cluster code when no netcdf --- src/Cluster/Cmatrix_NC.cpp | 33 +++++++++--------------------- src/Cluster/Cmatrix_NC.h | 12 +++++------ src/Cluster/Control.cpp | 10 +++++++-- src/DataIO_Cmatrix_NC.cpp | 2 ++ src/DataIO_Cmatrix_NC.h | 2 ++ src/DataSetList.cpp | 9 +++++++- src/DataSet_PairwiseCache_NC.cpp | 2 ++ src/DataSet_PairwiseCache_NC.h | 2 ++ test/Test_Cluster_Cache/RunTest.sh | 1 + 9 files changed, 40 insertions(+), 33 deletions(-) diff --git a/src/Cluster/Cmatrix_NC.cpp b/src/Cluster/Cmatrix_NC.cpp index 926b0ccc46..3a08929cc4 100644 --- a/src/Cluster/Cmatrix_NC.cpp +++ b/src/Cluster/Cmatrix_NC.cpp @@ -1,14 +1,13 @@ +#include "Cmatrix_NC.h" #ifdef BINTRAJ # include # include "../NC_Routines.h" +# include "Cframes.h" #endif -#include "Cframes.h" -#include "Cmatrix_NC.h" #include "../CpptrajStdio.h" #include "../FileName.h" #ifdef BINTRAJ - /// CONSTRUCTOR Cpptraj::Cluster::Cmatrix_NC::Cmatrix_NC() : ncid_(-1), @@ -23,16 +22,23 @@ Cpptraj::Cluster::Cmatrix_NC::Cmatrix_NC() : mode_(READ) {} +/// DESTRUCTOR Cpptraj::Cluster::Cmatrix_NC::~Cmatrix_NC() { CloseCmatrix(); } +/** \return true if NetCDF file has CPPTRAJ_CMATRIX conventions. */ bool Cpptraj::Cluster::Cmatrix_NC::IsCpptrajCmatrix(int NCID) { return (NC::GetAttrText(NCID, "Conventions") == "CPPTRAJ_CMATRIX"); } + +#else /* BINTRAJ */ +Cpptraj::Cluster::Cmatrix_NC::Cmatrix_NC() {} +Cpptraj::Cluster::Cmatrix_NC::~Cmatrix_NC() {} #endif // NC_Cmatrix::ID_Cmatrix() +/** \return True if the file specified by name is a NetCDF cluxtre matrix file. */ bool Cpptraj::Cluster::Cmatrix_NC::ID_Cmatrix(FileName const& fname) { # ifdef BINTRAJ int NCID; @@ -353,23 +359,4 @@ void Cpptraj::Cluster::Cmatrix_NC::CloseCmatrix() { // TODO: Set all IDs to -1 too? } } -#else -Cpptraj::Cluster::Cmatrix_NC::NC_Cmatrix() {} -Cpptraj::Cluster::Cmatrix_NC::~NC_Cmatrix() {} -int Cpptraj::Cluster::Cmatrix_NC::OpenCmatrixRead(FileName const&, int&) { return 1; } -double Cpptraj::Cluster::Cmatrix_NC::GetCmatrixElement(unsigned int, unsigned int) const { return 0.0; } -double Cpptraj::Cluster::Cmatrix_NC::GetCmatrixElement(unsigned int) const { return 0.0; } -std::vector Cpptraj::Cluster::Cmatrix_NC::GetSieveStatus() const { return std::vector(); } -int Cpptraj::Cluster::Cmatrix_NC::GetCmatrix(float*) const { return 1; } -int Cpptraj::Cluster::Cmatrix_NC::CreateCmatrix(FileName const&, unsigned int, unsigned int, int, std::string const&) -{ - mprinterr("Error: Cpptraj was compiled without NetCDF. Cannot create NetCDF matrix file.\n"); - return 1; -} -int Cpptraj::Cluster::Cmatrix_NC::WriteFramesArray(std::vector const&) const { return 1; } -int Cpptraj::Cluster::Cmatrix_NC::WriteCmatrixElement(unsigned int, unsigned int, double) const { return 1; } -int Cpptraj::Cluster::Cmatrix_NC::WriteCmatrix(const float*) const { return 1; } -void Cpptraj::Cluster::Cmatrix_NC::CloseCmatrix() {} -void Cpptraj::Cluster::Cmatrix_NC::Sync() const {} -int Cpptraj::Cluster::Cmatrix_NC::ReopenSharedWrite(FileName const&) { return 1; } -#endif +#endif /* BINTRAJ */ diff --git a/src/Cluster/Cmatrix_NC.h b/src/Cluster/Cmatrix_NC.h index aa8ada23c6..c2b5506418 100644 --- a/src/Cluster/Cmatrix_NC.h +++ b/src/Cluster/Cmatrix_NC.h @@ -15,6 +15,8 @@ class Cmatrix_NC { static size_t EstimatedDiskUsageInBytes(size_t); /// \return true if file is NetCDF cluster matrix file. static bool ID_Cmatrix(FileName const&); + +# ifdef BINTRAJ /// Open cluster matrix file for reading. Set sieve ID. int OpenCmatrixRead(FileName const&, int&); /// Get cluster matrix element (col, row) @@ -40,18 +42,14 @@ class Cmatrix_NC { int WriteCmatrix(const float*) const; /// Close cluster matrix file. void CloseCmatrix(); -# ifdef BINTRAJ + /// \return Matrix size unsigned int MatrixSize() const { return mSize_; } /// \return Matrix rows. unsigned int MatrixRows() const { return nRows_; } /// \return Current access mode ModeType Mode() const { return mode_; } -# else - unsigned int MatrixSize() const { return 0; } - unsigned int MatrixRows() const { return 0; } - ModeType Mode() const { return READ; } -# endif +# endif /* BINTRAJ */ private: # ifdef BINTRAJ static inline bool IsCpptrajCmatrix(int); @@ -67,7 +65,7 @@ class Cmatrix_NC { unsigned int nRows_; ///< Number of rows (actual frames, N) in matrix dimension. unsigned int mSize_; ///< Actual matrix size. ModeType mode_; ///< Access mode. -# endif +# endif /* BINTRAJ */ }; } diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 57028b2d52..5a78c2615d 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -165,9 +165,15 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis if (!pw_typeString.empty()) { if (pw_typeString == "mem") pw_type = DataSet::PMATRIX_MEM; - else if (pw_typeString == "disk") + else if (pw_typeString == "disk") { +# ifdef BINTRAJ pw_type = DataSet::PMATRIX_NC; - else if (pw_typeString == "none") +# else + // TODO regular disk file option + mprinterr("Error: Pairwise disk cache requires NetCDF.\n"); + return 1; +# endif + } else if (pw_typeString == "none") pw_type = DataSet::UNKNOWN_DATA; else { mprinterr("Error: Unrecognized option for 'pairwisecache' ('%s')\n", pw_typeString.c_str()); diff --git a/src/DataIO_Cmatrix_NC.cpp b/src/DataIO_Cmatrix_NC.cpp index ee86205d5c..8e31b298fc 100644 --- a/src/DataIO_Cmatrix_NC.cpp +++ b/src/DataIO_Cmatrix_NC.cpp @@ -1,3 +1,4 @@ +#ifdef BINTRAJ #include "DataIO_Cmatrix_NC.h" #include "DataSet_PairwiseCache_MEM.h" // TODO just pairwisecache #include "CpptrajStdio.h" @@ -51,3 +52,4 @@ int DataIO_Cmatrix_NC::WriteData(FileName const& fname, DataSetList const& SetLi file_.CloseCmatrix(); return 0; } +#endif /* BINTRAJ */ diff --git a/src/DataIO_Cmatrix_NC.h b/src/DataIO_Cmatrix_NC.h index c5025ef76d..a8ed093ffd 100644 --- a/src/DataIO_Cmatrix_NC.h +++ b/src/DataIO_Cmatrix_NC.h @@ -1,5 +1,6 @@ #ifndef INC_DATAIO_CMATRIX_NC_H #define INC_DATAIO_CMATRIX_NC_H +#ifdef BINTRAJ #include "DataIO.h" #include "Cluster/Cmatrix_NC.h" /// Read/write NetCDF pairwise matrix files. @@ -20,4 +21,5 @@ class DataIO_Cmatrix_NC : public DataIO { private: Cpptraj::Cluster::Cmatrix_NC file_; }; +#endif /* BINTRAJ */ #endif diff --git a/src/DataSetList.cpp b/src/DataSetList.cpp index 08dcc9df26..4978b29b15 100644 --- a/src/DataSetList.cpp +++ b/src/DataSetList.cpp @@ -80,7 +80,14 @@ DataSet* DataSetList::NewSet(DataSet::DataType typeIn) { case DataSet::PARAMETERS : ds = DataSet_Parameters::Alloc(); break; // TODO useDiskCache case DataSet::PMATRIX_MEM : ds = DataSet_PairwiseCache_MEM::Alloc(); break; - case DataSet::PMATRIX_NC : ds = DataSet_PairwiseCache_NC::Alloc(); break; + case DataSet::PMATRIX_NC : +# ifdef BINTRAJ + ds = DataSet_PairwiseCache_NC::Alloc(); +# else + mprinterr("Error: NetCDF pairwise disk cache requires NetCDF.\n"); + ds = 0; +# endif + break; case DataSet::TENSOR : ds = DataSet_Tensor::Alloc(); break; case DataSet::STRINGVAR : ds = DataSet_StringVar::Alloc(); break; case DataSet::VECTOR_SCALAR : ds = DataSet_Vector_Scalar::Alloc(); break; diff --git a/src/DataSet_PairwiseCache_NC.cpp b/src/DataSet_PairwiseCache_NC.cpp index 4b942a2766..4e171c2e69 100644 --- a/src/DataSet_PairwiseCache_NC.cpp +++ b/src/DataSet_PairwiseCache_NC.cpp @@ -1,3 +1,4 @@ +#ifdef BINTRAJ #include "DataSet_PairwiseCache_NC.h" #include "CpptrajStdio.h" #include "StringRoutines.h" // ByteString @@ -28,3 +29,4 @@ int DataSet_PairwiseCache_NC::SetupCache(unsigned int Ntotal, Cframes const& fra return SetupFrameToIdx(framesToCache, Ntotal); } +#endif /* BINTRAJ */ diff --git a/src/DataSet_PairwiseCache_NC.h b/src/DataSet_PairwiseCache_NC.h index 2c861e3d1c..521e487ef1 100644 --- a/src/DataSet_PairwiseCache_NC.h +++ b/src/DataSet_PairwiseCache_NC.h @@ -1,5 +1,6 @@ #ifndef INC_DATASET_PAIRWISECACHE_NC_H #define INC_DATASET_PAIRWISECACHE_NC_H +#ifdef BINTRAJ #include "DataSet_PairwiseCache.h" #include "Cluster/Cmatrix_NC.h" /// Cache pairwise distances in NetCDF file. @@ -29,4 +30,5 @@ class DataSet_PairwiseCache_NC : public DataSet_PairwiseCache { private: Cpptraj::Cluster::Cmatrix_NC file_; ///< Hold cached distances on disk }; +#endif /* BINTRAJ */ #endif diff --git a/test/Test_Cluster_Cache/RunTest.sh b/test/Test_Cluster_Cache/RunTest.sh index 4cca0fbb52..f8e8f05de3 100755 --- a/test/Test_Cluster_Cache/RunTest.sh +++ b/test/Test_Cluster_Cache/RunTest.sh @@ -7,6 +7,7 @@ CleanFiles cluster.in *.cnumvtime.dat *.info.dat *.summary.dat PW0 PW1 \ INPUT="-i cluster.in" TESTNAME='Cluster pairwise cache tests' +Requires netcdf # Cluster() { From b05dea88095cbf3eed0354e7b2d09b6bccce7afe Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 10:44:34 -0400 Subject: [PATCH 267/417] Make it so cluster tests do not need netcdf trajectory. Protect the netcdf pairwise test. --- test/Test_Cluster/RunTest.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/test/Test_Cluster/RunTest.sh b/test/Test_Cluster/RunTest.sh index 3a24991369..b5e9365527 100755 --- a/test/Test_Cluster/RunTest.sh +++ b/test/Test_Cluster/RunTest.sh @@ -10,13 +10,13 @@ CleanFiles cluster.in cnumvtime.dat avg.summary.dat summary.dat CpptrajPairDist cinfo.dat mysil.cluster.dat mysil.frame.dat cascii?.info TESTNAME='Hierarchical agglomerative clustering tests' -Requires netcdf +#Requires netcdf INPUT="-i cluster.in" # Test in-memory PW dist calc cat > cluster.in < cluster.in < cluster.in < cluster.in < cluster.in < cluster.in < Date: Thu, 9 Sep 2021 10:48:02 -0400 Subject: [PATCH 268/417] Remove netcdf requirement --- test/Test_Cluster_DBSCAN/RunTest.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/Test_Cluster_DBSCAN/RunTest.sh b/test/Test_Cluster_DBSCAN/RunTest.sh index a79b29e475..a236b2ae0a 100755 --- a/test/Test_Cluster_DBSCAN/RunTest.sh +++ b/test/Test_Cluster_DBSCAN/RunTest.sh @@ -6,11 +6,11 @@ CleanFiles dbscan.in summary.dat info.dat rvc.dat sievesummary.dat.? \ sieveinfo.dat.? Kdist.dat Kdist.4.dat rms2d.gnu Kmatrix.gnu Kmatrix.max.dat INPUT="-i dbscan.in" TESTNAME='Cluster DBSCAN tests' -Requires netcdf +#Requires netcdf # Test clustering cat > dbscan.in < dbscan.in < dbscan.in < dbscan.in < dbscan.in < Date: Thu, 9 Sep 2021 10:50:21 -0400 Subject: [PATCH 269/417] Remove netcdf requirement. Ensure leftover files from old versions are cleaned --- test/Test_Cluster_Dpeaks/RunTest.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/Test_Cluster_Dpeaks/RunTest.sh b/test/Test_Cluster_Dpeaks/RunTest.sh index d3aba9d1d5..f740f85cfc 100755 --- a/test/Test_Cluster_Dpeaks/RunTest.sh +++ b/test/Test_Cluster_Dpeaks/RunTest.sh @@ -2,14 +2,14 @@ . ../MasterTest.sh -CleanFiles dpeaks.in dpeaks.dat summary.dat info.dat +CleanFiles dpeaks.in dpeaks.dat summary.dat info.dat MyPairDist INPUT="-i dpeaks.in" TESTNAME='Density peaks clustering test' -Requires netcdf +#Requires netcdf cat > dpeaks.in < Date: Thu, 9 Sep 2021 10:51:00 -0400 Subject: [PATCH 270/417] Remove netcdf requirement --- test/Test_Cluster_Kmeans/RunTest.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Test_Cluster_Kmeans/RunTest.sh b/test/Test_Cluster_Kmeans/RunTest.sh index 62d0f8369f..e188229560 100755 --- a/test/Test_Cluster_Kmeans/RunTest.sh +++ b/test/Test_Cluster_Kmeans/RunTest.sh @@ -4,7 +4,7 @@ CleanFiles kmeans.in ptraj.txt ptraj.c? summary.dat info.dat cpptraj.crd.c? random.dat rinfo.dat random.crd.c? TESTNAME='Cluster k-means tests' -Requires netcdf +#Requires netcdf TOP=../tz2.parm7 INPUT="kmeans.in" @@ -13,7 +13,7 @@ RunPtraj() { #CPPTRAJ=`which ptraj` CPPTRAJ=/home/droe/Amber/GIT/amber/AmberTools/src/ptraj/ptraj cat > kmeans.in < kmeans.in < kmeans.in < Date: Thu, 9 Sep 2021 10:55:02 -0400 Subject: [PATCH 271/417] Remove netcdf dependency --- test/Test_Cluster_RandomSieve/RunTest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Test_Cluster_RandomSieve/RunTest.sh b/test/Test_Cluster_RandomSieve/RunTest.sh index 733255cd89..2b9443b29a 100755 --- a/test/Test_Cluster_RandomSieve/RunTest.sh +++ b/test/Test_Cluster_RandomSieve/RunTest.sh @@ -5,14 +5,14 @@ CleanFiles cluster.in random.out random.info.dat random.summary.dat \ random.crd.c? random.cpop.agr random.rep.*.pdb CpptrajPairDist TESTNAME='Cluster tests with random sieves' -Requires netcdf +#Requires netcdf PREFIX="random" INPUT="-i cluster.in" Ctest() { cat > cluster.in < Date: Thu, 9 Sep 2021 10:55:35 -0400 Subject: [PATCH 272/417] Remove netcdf dependency --- test/Test_Cluster_ReadInfo/RunTest.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Test_Cluster_ReadInfo/RunTest.sh b/test/Test_Cluster_ReadInfo/RunTest.sh index 46ec716b37..159b752fdf 100755 --- a/test/Test_Cluster_ReadInfo/RunTest.sh +++ b/test/Test_Cluster_ReadInfo/RunTest.sh @@ -6,13 +6,13 @@ CleanFiles cluster.in C?.info.dat PW TESTNAME='Cluster read info tests' -Requires netcdf +#Requires netcdf INPUT="-i cluster.in" cat > cluster.in < cluster.in < Date: Thu, 9 Sep 2021 11:00:40 -0400 Subject: [PATCH 273/417] Protect test when no netcdf --- test/Test_Grid_Rotate_Simple/RunTest.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Test_Grid_Rotate_Simple/RunTest.sh b/test/Test_Grid_Rotate_Simple/RunTest.sh index 30ef34b85e..8a1e7ca57d 100755 --- a/test/Test_Grid_Rotate_Simple/RunTest.sh +++ b/test/Test_Grid_Rotate_Simple/RunTest.sh @@ -4,6 +4,8 @@ CleanFiles grid.in tyr.rmsfit.dx tyr.rmsfit.dcd tyr.gridfit.dx +TESTNAME='Grid rotation tests.' +Requires netcdf RunTyr() { INPUT='-i grid.in' From ca6abc5d7a053b3a8d3a7df9ab4220e878516ab4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 11:07:44 -0400 Subject: [PATCH 274/417] Add missing include --- src/Cluster/Cmatrix_NC.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Cluster/Cmatrix_NC.h b/src/Cluster/Cmatrix_NC.h index c2b5506418..951dff95ba 100644 --- a/src/Cluster/Cmatrix_NC.h +++ b/src/Cluster/Cmatrix_NC.h @@ -1,6 +1,7 @@ #ifndef INC_CLUSTER_CMATRIX_NC_H #define INC_CLUSTER_CMATRIX_NC_H #include +#include class FileName; namespace Cpptraj { namespace Cluster { From 856e4cfa4ba51f00b7deca142d8a25052545151d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 11:11:32 -0400 Subject: [PATCH 275/417] Fix openmp compile --- src/Cluster/List.cpp | 7 +++++-- src/Cluster/PairwiseMatrix.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 559e1b9960..34e03ab88d 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -8,6 +8,9 @@ #include "../DataSet_integer.h" #include "../ProgressBar.h" #include "../Constants.h" // SMALL TODO use limits? +#ifdef _OPENMP +# include +#endif void Cpptraj::Cluster::List::PrintClusters() const { //mprintf("CLUSTER: %u clusters, %u frames.\n", clusters_.size(), @@ -232,9 +235,9 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric progress.SetThread( mythread ); if (mythread == 0) { mprintf("\tParallelizing calculation with %i threads\n", omp_get_num_threads()); - MyCdist = Cdist_; + MyCdist = metricIn; } else - MyCdist = Cdist_->Copy(); + MyCdist = metricIn->Copy(); # pragma omp for # endif for (idx = 0; idx < nframes; ++idx) { diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp index e558e1161e..a6adde1107 100644 --- a/src/Cluster/PairwiseMatrix.cpp +++ b/src/Cluster/PairwiseMatrix.cpp @@ -112,7 +112,7 @@ int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesTo } # ifdef _OPENMP if (mythread > 0) - delete MyCdist; + delete MyMetric; } // END omp parallel # endif progress.Finish(); From bd6f6edd26e69390aefab6bc05e12c35f260dd0e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 12:06:53 -0400 Subject: [PATCH 276/417] Return to previous analysis name for pytraj --- ...nalysis_Cluster.cpp => Analysis_Clustering.cpp} | 14 +++++++------- src/{Analysis_Cluster.h => Analysis_Clustering.h} | 12 ++++++------ src/Command.cpp | 4 ++-- src/cpptrajdepend | 4 ++-- src/cpptrajfiles | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) rename src/{Analysis_Cluster.cpp => Analysis_Clustering.cpp} (86%) rename src/{Analysis_Cluster.h => Analysis_Clustering.h} (58%) diff --git a/src/Analysis_Cluster.cpp b/src/Analysis_Clustering.cpp similarity index 86% rename from src/Analysis_Cluster.cpp rename to src/Analysis_Clustering.cpp index adf663121f..e401d5ecd6 100644 --- a/src/Analysis_Cluster.cpp +++ b/src/Analysis_Clustering.cpp @@ -1,17 +1,17 @@ -#include "Analysis_Cluster.h" +#include "Analysis_Clustering.h" #include "CpptrajStdio.h" #include "DataSet_Coords.h" using namespace Cpptraj::Cluster; -// Analysis_Cluster::Help() -void Analysis_Cluster::Help() const { +// Analysis_Clustering::Help() +void Analysis_Clustering::Help() const { mprintf("\t[{crdset | data [,...] [nocoords]}]\n"); Control::Help(); } -// Analysis_Cluster::Setup() -Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& setup, int debugIn) +// Analysis_Clustering::Setup() +Analysis::RetType Analysis_Clustering::Setup(ArgList& analyzeArgs, AnalysisSetup& setup, int debugIn) { control_.SetDebug( debugIn ); DataSetList inputDsets; @@ -56,8 +56,8 @@ Analysis::RetType Analysis_Cluster::Setup(ArgList& analyzeArgs, AnalysisSetup& s } -// Analysis_Cluster::Analyze() -Analysis::RetType Analysis_Cluster::Analyze() { +// Analysis_Clustering::Analyze() +Analysis::RetType Analysis_Clustering::Analyze() { Timer t_total; t_total.Start(); if (control_.Run() != 0) { diff --git a/src/Analysis_Cluster.h b/src/Analysis_Clustering.h similarity index 58% rename from src/Analysis_Cluster.h rename to src/Analysis_Clustering.h index 74b0a75a16..78caca727e 100644 --- a/src/Analysis_Cluster.h +++ b/src/Analysis_Clustering.h @@ -1,12 +1,12 @@ -#ifndef INC_ANALYSIS_CLUSTER_H -#define INC_ANALYSIS_CLUSTER_H +#ifndef INC_ANALYSIS_CLUSTERING_H +#define INC_ANALYSIS_CLUSTERING_H #include "Analysis.h" #include "Cluster/Control.h" -/// -class Analysis_Cluster : public Analysis { +/// +class Analysis_Clustering : public Analysis { public: - Analysis_Cluster() : masterDSL_(0) {} - DispatchObject* Alloc() const { return (DispatchObject*)new Analysis_Cluster(); } + Analysis_Clustering() : masterDSL_(0) {} + DispatchObject* Alloc() const { return (DispatchObject*)new Analysis_Clustering(); } void Help() const; Analysis::RetType Setup(ArgList&, AnalysisSetup&, int); diff --git a/src/Command.cpp b/src/Command.cpp index 3c5067d17a..4854391fc5 100644 --- a/src/Command.cpp +++ b/src/Command.cpp @@ -189,7 +189,7 @@ #include "Analysis_Multicurve.h" #include "Analysis_TI.h" #include "Analysis_ConstantPHStats.h" -#include "Analysis_Cluster.h" +#include "Analysis_Clustering.h" #include "Analysis_HausdorffDistance.h" #include "Analysis_Slope.h" #include "Analysis_EvalPlateau.h" @@ -384,7 +384,7 @@ void Command::Init() { Command::AddCmd( new Analysis_AutoCorr(), Cmd::ANA, 1, "autocorr" ); Command::AddCmd( new Analysis_Average(), Cmd::ANA, 1, "avg" ); Command::AddCmd( new Analysis_State(), Cmd::ANA, 1, "calcstate" ); - Command::AddCmd( new Analysis_Cluster(), Cmd::ANA, 1, "cluster" ); + Command::AddCmd( new Analysis_Clustering(), Cmd::ANA, 1, "cluster" ); Command::AddCmd( new Analysis_Corr(), Cmd::ANA, 2, "corr", "correlationcoe" ); Command::AddCmd( new Analysis_ConstantPHStats,Cmd::ANA,1, "cphstats" ); Command::AddCmd( new Analysis_CrankShaft(), Cmd::ANA, 2, "crank", "crankshaft" ); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index b9e82daab2..9b3c97dd8c 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -92,7 +92,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.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 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 Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.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 -Analysis_Cluster.o : Analysis_Cluster.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Cluster.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 +Analysis_Clustering.o : Analysis_Clustering.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.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 DataSet_float.h DataSet_integer.h DataSet_string.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 @@ -150,7 +150,7 @@ ClusterMap.o : ClusterMap.cpp AssociatedData.h ClusterMap.h Constants.h CpptrajF Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Cluster.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h CompactFrameArray.o : CompactFrameArray.cpp Box.h CompactFrameArray.h CoordinateInfo.h CpptrajStdio.h Matrix_3x3.h Parallel.h ReplicaDimArray.h Vec3.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 423c5f858f..e3befea6c9 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -95,7 +95,7 @@ COMMON_SOURCES= \ Analysis_AmdBias.cpp \ Analysis_AutoCorr.cpp \ Analysis_Average.cpp \ - Analysis_Cluster.cpp \ + Analysis_Clustering.cpp \ Analysis_Corr.cpp \ Analysis_ConstantPHStats.cpp \ Analysis_CrankShaft.cpp \ From 83cd14aef9b4c4d4ba0266cf7e5c762ba61e3771 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 13:34:24 -0400 Subject: [PATCH 277/417] Ensure data set name is the last argument. --- src/Cluster/Control.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 5a78c2615d..d7642420ad 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -637,26 +637,7 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, // Cluster number vs time grace_color_ = analyzeArgs.hasKey("gracecolor"); DataFile* cnumvtimefile = DFL.AddDataFile(analyzeArgs.GetStringKey("out"), analyzeArgs); - // NOTE overall set name extracted here. This should be the last thing done. - dsname_ = analyzeArgs.GetStringNext(); - // --------------------------------------------- - // Cluster number vs time data set - cnumvtime_ = DSL.AddSet(DataSet::INTEGER, dsname_, "Cnum"); - if (cnumvtime_ == 0) return 1; - if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); - - // Set up number of unique clusters vs time DataSet - if (clustersvtimefile != 0) { - if (windowSize_ < 2) { - mprinterr("Error: For # clusters seen vs time, cvtwindow must be specified and > 1\n"); - return 1; - } - clustersVtime_ = DSL.AddSet(DataSet::INTEGER, MetaData(cnumvtime_->Meta().Name(), "NCVT")); - if (clustersVtime_ == 0) return 1; - clustersvtimefile->AddDataSet( clustersVtime_ ); - } - // Cluster split analysis splitfile_ = analyzeArgs.GetStringKey("summarysplit"); if (splitfile_.empty()) // For backwards compat. @@ -678,6 +659,25 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, } } + // Overall set name extracted here. All other arguments should already be processed. + dsname_ = analyzeArgs.GetStringNext(); + // --------------------------------------------- + + // Cluster number vs time data set + cnumvtime_ = DSL.AddSet(DataSet::INTEGER, dsname_, "Cnum"); + if (cnumvtime_ == 0) return 1; + if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); + + // Set up number of unique clusters vs time DataSet + if (clustersvtimefile != 0) { + if (windowSize_ < 2) { + mprinterr("Error: For # clusters seen vs time, cvtwindow must be specified and > 1\n"); + return 1; + } + clustersVtime_ = DSL.AddSet(DataSet::INTEGER, MetaData(cnumvtime_->Meta().Name(), "NCVT")); + if (clustersVtime_ == 0) return 1; + clustersvtimefile->AddDataSet( clustersVtime_ ); + } return 0; } From 909a607e26f5215c353f9d36f9acce44a7054f31 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 14:15:09 -0400 Subject: [PATCH 278/417] To maintain compatibility with pytraj, ensure the cache is allocated after cluster number vs time set. Also ensure that a default data set name gets set. --- src/Cluster/Control.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index d7642420ad..88d8fc4a27 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -182,15 +182,35 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis } // Allocate cache if necessary if (pw_type != DataSet::UNKNOWN_DATA) { - MetaData meta( pairdistname ); + MetaData meta; + if (!pairdistname.empty()) + meta.SetName( pairdistname ); + else + meta.SetName( DSL.GenerateDefaultName("CMATRIX") ); // Cache-specific setup. if (pw_type == DataSet::PMATRIX_NC) meta.SetFileName( pairdistname ); // TODO separate file name? - cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, meta, "CMATRIX" ); + //cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, meta, "CMATRIX" ); + // To maintain compatibility with pytraj, the cluster number vs time + // set **MUST** be allocated before the cache. Set up outside the + // DataSetList here and set up; add to DataSetList later in Setup. + // TODO should this be inside DataSetList? + meta.SetEnsembleNum( DSL.EnsembleNum() ); + DataSet* pwset = DSL.CheckForSet(meta); + // NOTE: This should never happen since we already checked for cache above + if (pwset != 0) { + mprinterr("Internal Error: Pairwise cache '%s' already exists.\n", meta.Name().c_str()); + return 1; + } + cache_ = (DataSet_PairwiseCache*)DSL.Allocate(pw_type); if (cache_ == 0) { mprinterr("Error: Could not allocate pairwise cache.\n"); return 1; } + if (cache_->SetMeta( meta )) { + mprinterr("Internal Error: Could not set pairwise cache metadata.\n"); + return 1; + } if (debug_ > 0) mprintf("DEBUG: Allocated pairwise distance cache: %s\n", cache_->legend()); } @@ -661,6 +681,8 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, // Overall set name extracted here. All other arguments should already be processed. dsname_ = analyzeArgs.GetStringNext(); + if (dsname_.empty()) + dsname_ = DSL.GenerateDefaultName("CLUSTER"); // --------------------------------------------- // Cluster number vs time data set @@ -668,6 +690,10 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (cnumvtime_ == 0) return 1; if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); + // Add pairwise cache to the DataSetList so it is after cnumvtime for pytraj + if (cache_ != 0) + DSL.AddSet( cache_ ); + // Set up number of unique clusters vs time DataSet if (clustersvtimefile != 0) { if (windowSize_ < 2) { From b8a0a16b207bb9294995d586f711e3d2a4b638b5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 14:30:13 -0400 Subject: [PATCH 279/417] Create an AllocateSet routine that will allocate a DataSet but not add it to the DataSetList --- src/Cluster/Control.cpp | 9 +++++---- src/DataSetList.cpp | 34 ++++++++++++++++++++++++++-------- src/DataSetList.h | 2 ++ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 88d8fc4a27..6d1d93ba08 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -194,7 +194,8 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis // To maintain compatibility with pytraj, the cluster number vs time // set **MUST** be allocated before the cache. Set up outside the // DataSetList here and set up; add to DataSetList later in Setup. - // TODO should this be inside DataSetList? + cache_ = (DataSet_PairwiseCache*)DSL.AllocateSet( pw_type, meta ); + /* // TODO should this be inside DataSetList? meta.SetEnsembleNum( DSL.EnsembleNum() ); DataSet* pwset = DSL.CheckForSet(meta); // NOTE: This should never happen since we already checked for cache above @@ -202,15 +203,15 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis mprinterr("Internal Error: Pairwise cache '%s' already exists.\n", meta.Name().c_str()); return 1; } - cache_ = (DataSet_PairwiseCache*)DSL.Allocate(pw_type); + cache_ = (DataSet_PairwiseCache*)DSL.Allocate(pw_type);*/ if (cache_ == 0) { mprinterr("Error: Could not allocate pairwise cache.\n"); return 1; } - if (cache_->SetMeta( meta )) { +/* if (cache_->SetMeta( meta )) { mprinterr("Internal Error: Could not set pairwise cache metadata.\n"); return 1; - } + }*/ if (debug_ > 0) mprintf("DEBUG: Allocated pairwise distance cache: %s\n", cache_->legend()); } diff --git a/src/DataSetList.cpp b/src/DataSetList.cpp index 4978b29b15..af0b2f162f 100644 --- a/src/DataSetList.cpp +++ b/src/DataSetList.cpp @@ -428,12 +428,14 @@ DataSet* DataSetList::AddSet( DataSet::DataType inType, MetaData const& metaIn, return AddSet( inType, meta ); } -/** Add a DataSet of specified type, set it up and return pointer to it. +/** Allocate a DataSet of specified type, set it up and return pointer to it. + * It will not be added to the list. * \param inType type of DataSet to add. * \param metaIn DataSet MetaData. * \return pointer to successfully set-up DataSet or 0 if error. */ -DataSet* DataSetList::AddSet(DataSet::DataType inType, MetaData const& metaIn) +DataSet* DataSetList::AllocateSet(DataSet::DataType inType, MetaData const& metaIn) +const { // TODO Always generate default name if empty? # ifdef TIMER time_total_.Start(); @@ -488,13 +490,29 @@ DataSet* DataSetList::AddSet(DataSet::DataType inType, MetaData const& metaIn) # endif # ifdef TIMER time_setup_.Stop(); - time_push_.Start(); # endif - Push_Back(DS); -# ifdef TIMER - time_push_.Stop(); -# endif - //fprintf(stderr,"ADDED dataset %s\n",dsetName); + //fprintf(stderr,"ALLOCATED dataset %s\n",dsetName); + return DS; +} + +/** Add a DataSet of specified type, set it up and return pointer to it. + * \param inType type of DataSet to add. + * \param metaIn DataSet MetaData. + * \return pointer to successfully set-up DataSet or 0 if error. + */ +DataSet* DataSetList::AddSet(DataSet::DataType inType, MetaData const& metaIn) +{ + DataSet* DS = AllocateSet(inType, metaIn); + if (DS != 0) { +# ifdef TIMER + time_push_.Start(); +# endif + Push_Back(DS); +# ifdef TIMER + time_push_.Stop(); +# endif + //fprintf(stderr,"ADDED dataset %s\n",dsetName); + } return DS; } diff --git a/src/DataSetList.h b/src/DataSetList.h index d3756d05f9..8fb262f986 100644 --- a/src/DataSetList.h +++ b/src/DataSetList.h @@ -108,6 +108,8 @@ class DataSetList { DataSet* AddSet_NoCheck(DataSet::DataType, MetaData const&); /// Add an already set up DataSet to list; memory for DataSet will be freed. int AddSet( DataSet* ); + /// Allocate DataSet but do not add to the list + DataSet* AllocateSet(DataSet::DataType, MetaData const&) const; /// Add new sets or append to existing ones. int AddOrAppendSets(std::string const&, Darray const&, DataListType const&); /// Add a copy of the DataSet to the list; memory for DataSet will not be freed. From 5ada1794db7f05b73047bffdcdca3bb07a928eeb Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 14:37:44 -0400 Subject: [PATCH 280/417] Only add the cache if it was actually allocated --- src/Cluster/Control.cpp | 20 +++++--------------- src/Cluster/Control.h | 1 + 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 6d1d93ba08..80ccd58b64 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -27,6 +27,7 @@ Cpptraj::Cluster::Control::Control() : metric_(0), algorithm_(0), results_(0), + cache_was_allocated_(false), verbose_(0), frameSelect_(UNSPECIFIED), sieve_(1), @@ -84,6 +85,7 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis mprinterr("Internal Error: AllocatePairwise(): Metric is null.\n"); return 1; } + cache_was_allocated_ = false; // Determine if we are saving/loading pairwise distances std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); @@ -195,23 +197,11 @@ int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetLis // set **MUST** be allocated before the cache. Set up outside the // DataSetList here and set up; add to DataSetList later in Setup. cache_ = (DataSet_PairwiseCache*)DSL.AllocateSet( pw_type, meta ); - /* // TODO should this be inside DataSetList? - meta.SetEnsembleNum( DSL.EnsembleNum() ); - DataSet* pwset = DSL.CheckForSet(meta); - // NOTE: This should never happen since we already checked for cache above - if (pwset != 0) { - mprinterr("Internal Error: Pairwise cache '%s' already exists.\n", meta.Name().c_str()); - return 1; - } - cache_ = (DataSet_PairwiseCache*)DSL.Allocate(pw_type);*/ if (cache_ == 0) { mprinterr("Error: Could not allocate pairwise cache.\n"); return 1; } -/* if (cache_->SetMeta( meta )) { - mprinterr("Internal Error: Could not set pairwise cache metadata.\n"); - return 1; - }*/ + cache_was_allocated_ = true; if (debug_ > 0) mprintf("DEBUG: Allocated pairwise distance cache: %s\n", cache_->legend()); } @@ -691,8 +681,8 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (cnumvtime_ == 0) return 1; if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); - // Add pairwise cache to the DataSetList so it is after cnumvtime for pytraj - if (cache_ != 0) + // If cache was alloaced, add to the DataSetList so it is after cnumvtime for pytraj + if (cache_was_allocated_) DSL.AddSet( cache_ ); // Set up number of unique clusters vs time DataSet diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index cbb6d027f6..62607012a6 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -89,6 +89,7 @@ class Control { Algorithm* algorithm_; ///< Hold the clustering algorithm. Results* results_; ///< Hold output routines specific to data being clustered. std::string dsname_; ///< Name for output data sets. + bool cache_was_allocated_; ///< True if cache was allocated and needs to be added to DSL int verbose_; FrameSelectType frameSelect_; ///< How frames to cluster should be determined. From 94476c2ec554702e1b9d88c40cb88acc39a4fbd0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 14:48:16 -0400 Subject: [PATCH 281/417] Improve code docs. --- src/Analysis_Clustering.h | 2 +- src/Cluster/Algorithm.cpp | 1 + src/Cluster/Algorithm_DPeaks.cpp | 9 +++++++++ src/Cluster/Algorithm_Kmeans.cpp | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Analysis_Clustering.h b/src/Analysis_Clustering.h index 78caca727e..e2a78a6e74 100644 --- a/src/Analysis_Clustering.h +++ b/src/Analysis_Clustering.h @@ -2,7 +2,7 @@ #define INC_ANALYSIS_CLUSTERING_H #include "Analysis.h" #include "Cluster/Control.h" -/// +/// Perform cluster analysis on DataSets class Analysis_Clustering : public Analysis { public: Analysis_Clustering() : masterDSL_(0) {} diff --git a/src/Cluster/Algorithm.cpp b/src/Cluster/Algorithm.cpp index cabc409458..9412955090 100644 --- a/src/Cluster/Algorithm.cpp +++ b/src/Cluster/Algorithm.cpp @@ -4,6 +4,7 @@ #include "PairwiseMatrix.h" #include "../CpptrajStdio.h" +/** \return Distance between given cluster centroids. */ double Cpptraj::Cluster::Algorithm::ClusterDistance(Node const& C1, Node const& C2, PairwiseMatrix const& pmatrix, bool includeSieved, diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index e1e082ee35..57adb0d9c4 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -9,6 +9,7 @@ #include "../DataSet_Mesh.h" #include "../ProgressBar.h" +/** CONSTRUCTOR */ Cpptraj::Cluster::Algorithm_DPeaks::Algorithm_DPeaks() : Algorithm(DPEAKS), densityCut_(-1.0), @@ -18,6 +19,7 @@ Cpptraj::Cluster::Algorithm_DPeaks::Algorithm_DPeaks() : calc_noise_(false), useGaussianKernel_(false) {} +/** Print help to STDOUT. */ void Cpptraj::Cluster::Algorithm_DPeaks::Help() { mprintf("\t[dpeaks epsilon [noise] [dvdfile ]\n" "\t [choosepoints {manual | auto}]\n" @@ -25,6 +27,7 @@ void Cpptraj::Cluster::Algorithm_DPeaks::Help() { "\t [runavg ] [deltafile ] [gauss]]\n"); } +/** Set up density peaks algorithm. */ int Cpptraj::Cluster::Algorithm_DPeaks::Setup(ArgList& analyzeArgs) { epsilon_ = analyzeArgs.getKeyDouble("epsilon", -1.0); if (epsilon_ <= 0.0) { @@ -67,6 +70,7 @@ int Cpptraj::Cluster::Algorithm_DPeaks::Setup(ArgList& analyzeArgs) { return 0; } +/** Print dpeaks algorithm info. */ void Cpptraj::Cluster::Algorithm_DPeaks::Info() const { mprintf("---------------------------------------------------------------------------\n" "Warning: The dpeaks algorithm is still under development. USE WITH CAUTION!\n" @@ -96,6 +100,7 @@ void Cpptraj::Cluster::Algorithm_DPeaks::Info() const { mprintf("\t\tNo clustering, only writing density versus distance file.\n"); } +/** Perform density peaks clustering. */ int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, Cframes const& framesToCluster, PairwiseMatrix const& pmatrix) @@ -255,6 +260,7 @@ int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, } // ----------------------------------------------------------------------------- +/** Gaussian kernel for density peaks. */ int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_GaussianKernel(Cframes const& framesToCluster, PairwiseMatrix const& pmatrix) { @@ -339,6 +345,7 @@ int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_GaussianKernel(Cframes const& fr } // ----------------------------------------------------------------------------- +/** Discrete density. */ int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_DiscreteDensity(Cframes const& framesToCluster, PairwiseMatrix const& pmatrix) { @@ -440,6 +447,7 @@ int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_DiscreteDensity(Cframes const& f return 0; } +/** Choose points from clusters. */ int Cpptraj::Cluster::Algorithm_DPeaks::ChoosePointsFromClusters(List const& clusters, Cframes const& framesToCluster) { @@ -453,6 +461,7 @@ int Cpptraj::Cluster::Algorithm_DPeaks::ChoosePointsFromClusters(List const& clu return 0; } +/** Choose points based on user specified cutoffs. */ int Cpptraj::Cluster::Algorithm_DPeaks::ChoosePointsManually() { int cnum = 0; for (Carray::iterator point = Points_.begin(); point != Points_.end(); ++point) { diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 41b80183d3..8f047e5580 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -9,6 +9,7 @@ #include "../CpptrajStdio.h" #include "../ProgressBar.h" +/** CONSTRUCTOR */ Cpptraj::Cluster::Algorithm_Kmeans::Algorithm_Kmeans() : Algorithm(KMEANS), nclusters_(0), @@ -18,11 +19,13 @@ Cpptraj::Cluster::Algorithm_Kmeans::Algorithm_Kmeans() : clusterToClusterCentroid_(false) {} +/** Print help to stdout. */ void Cpptraj::Cluster::Algorithm_Kmeans::Help() { mprintf("\t[kmeans clusters [randompoint [kseed ]] [maxit ]]\n"); } // SetupCluster() +/** Set up kmeans clustering. */ int Cpptraj::Cluster::Algorithm_Kmeans::Setup(ArgList& analyzeArgs) { nclusters_ = analyzeArgs.getKeyInt("clusters", -1); if (nclusters_ < 2) { @@ -39,6 +42,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::Setup(ArgList& analyzeArgs) { } // ClusteringInfo() +/** Print kmeans clustering info. */ void Cpptraj::Cluster::Algorithm_Kmeans::Info() const { mprintf("\tK-MEANS: Looking for %i clusters.\n", nclusters_); if (mode_ == SEQUENTIAL) @@ -55,11 +59,13 @@ void Cpptraj::Cluster::Algorithm_Kmeans::Info() const { } // ClusterResults() +/** Write kemans info to info file. */ void Cpptraj::Cluster::Algorithm_Kmeans::Results(CpptrajFile& outfile) const { outfile.Printf("#Algorithm: Kmeans nclusters %i maxit %i\n", nclusters_, maxIt_); } // Cpptraj::Cluster::Algorithm_Kmeans::Cluster() +/** Perform kmeans clustering. */ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, Cframes const& framesToCluster, PairwiseMatrix const& pmatrix) From 15c4940a0f4e38aceb61555635ce24ca62e837f8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 15:57:37 -0400 Subject: [PATCH 282/417] Add more description to cluster help. --- src/Cluster/Control.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 80ccd58b64..fbaa9b44e2 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -728,6 +728,12 @@ void Cpptraj::Cluster::Control::Help() { Results_Coords::Help(); mprintf(" Graph Args:\n"); mprintf("\t%s\n", GraphArgs_); + mprintf(" Cluster input frames using the specified clustering algorithm\n" + " and distance metric. In order to speed up clustering of large\n" + " trajectories, the 'sieve' keyword can be used. In addition,\n" + " subsequent clustering calculations can be sped up by\n" + " writing/reading calculated pair distances between each frame\n" + " to/from a file/DataSet specified by 'pairdist'.\n"); } // ----------------------------------------------------------------------------- From c02bed6c785ca261550967c5ead117ee15887177 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 15:57:52 -0400 Subject: [PATCH 283/417] Update the cluster manual entry. --- doc/cpptraj.lyx | 637 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 457 insertions(+), 180 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index d367e77aec..e0b4e7d235 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -40100,11 +40100,20 @@ cluster \end_inset - [crdset | nocoords] + [{crdset | data [,...] [nocoords]}] \end_layout \begin_layout LyX-Code - Algorithms: + [] [] [] [] [] [] +\end_layout + +\begin_layout LyX-Code + [] [] [] [readinfo infofile ] +\end_layout + +\begin_layout LyX-Code + Algorithm Args: [{hieragglo|dbscan|kmeans|dpeaks}] \end_layout \begin_layout LyX-Code @@ -40112,64 +40121,83 @@ cluster \end_layout \begin_layout LyX-Code - [epsilonplot ] [includesieved_cdist]] + [epsilonplot ]] \end_layout \begin_layout LyX-Code - [dbscan minpoints epsilon [sievetoframe] [kdist [kfile ]]] + [dbscan minpoints epsilon [kdist [kfile ]]] \end_layout \begin_layout LyX-Code - [dpeaks epsilon [noise] [dvdfile ] + [kmeans clusters [randompoint [kseed ]] [maxit ]] \end_layout \begin_layout LyX-Code - [choosepoints {manual | auto}] + [dpeaks epsilon [noise] [dvdfile ] \end_layout \begin_layout LyX-Code - [distancecut ] [densitycut ] + [choosepoints {manual | auto}] \end_layout \begin_layout LyX-Code - [runavg ] [deltafile ] [gauss]] + [distancecut ] [densitycut ] \end_layout \begin_layout LyX-Code - [kmeans clusters [randompoint [kseed ]] [maxit ] + [runavg ] [deltafile ] [gauss]] \end_layout \begin_layout LyX-Code - [{readtxt|readinfo} infofile ] + Metric Args: [{rms|srmsd|dme|euclid|manhattan}] \end_layout \begin_layout LyX-Code - Distance options: + ('euclid' and 'manhattan' only work with 'data') \end_layout \begin_layout LyX-Code - {[[rms | srmsd] [] [mass] [nofit]] | [dme []] | + {[{dme|rms|srmsd} [mass] [nofit] []] | [{euclid|manhattan}]} \end_layout \begin_layout LyX-Code - [data [,,...]]} + Pairwise Args: \end_layout \begin_layout LyX-Code - [sieve <#> [random [sieveseed <#>]]] [loadpairdist] [savepairdist] [pairdist - ] + [pairdist ] [pwrecalc] +\end_layout + +\begin_layout LyX-Code + [loadpairdist] [savepairdist] [pairwisecache {mem|disk|none}] +\end_layout + +\begin_layout LyX-Code + Sieve Args: +\end_layout + +\begin_layout LyX-Code + [sieve <#> [sieveseed <#>] [random] [includesieveincalc] [includesieved_cdist] +\end_layout + +\begin_layout LyX-Code + [{sievetoframe|sievetocentroid|closestcentroid}] [repsilon ]] \end_layout \begin_layout LyX-Code - [pairwisecache {mem | none}] [includesieveincalc] [pwrecalc] + BestRep Args: \end_layout \begin_layout LyX-Code - Output options: + [bestrep {cumulative|centroid|cumulative_nosieve}] [savenreps <#>] \end_layout \begin_layout LyX-Code - [out ] [gracecolor] [summary ] [info ] + Output Args: +\end_layout + +\begin_layout LyX-Code + [out [gracecolor]] [noinfo|info ] [summary ] \end_layout \begin_layout LyX-Code @@ -40177,39 +40205,43 @@ cluster \end_layout \begin_layout LyX-Code - [bestrep {cumulative|centroid|cumulative_nosieve}] [savenreps <#>] + [clustersvtime [cvtwindow <#>]] [sil ] \end_layout \begin_layout LyX-Code - [clustersvtime cvtwindow ] + [cpopvtime [{normpop|normframe}]] [lifetime] \end_layout \begin_layout LyX-Code - [cpopvtime [normpop | normframe] [lifetime]] + Coordinate Output Args: \end_layout \begin_layout LyX-Code - [sil ] [assignrefs [refcut ] [refmask ]] + [clusterout [clusterfmt ]] \end_layout \begin_layout LyX-Code - Coordinate output options: + [singlerepout [singlerepfmt ]] \end_layout \begin_layout LyX-Code - [ clusterout [clusterfmt ] ] + [repout [repfmt ] [repframe]] \end_layout \begin_layout LyX-Code - [ singlerepout [singlerepfmt ] ] + [avgout [avgfmt ]] \end_layout \begin_layout LyX-Code - [ repout [repfmt ] [repframe] ] + [assignrefs [refcut ] [refmask ]] \end_layout \begin_layout LyX-Code - [ avgout [avgfmt ] ] + Graph Args: +\end_layout + +\begin_layout LyX-Code + [{drawgraph|drawgraph3d} [draw_tol ] [draw_maxit ] Name of previously generated COORDS data set. - If not specified the default COORDS set will be used unless +set>] Name of COORDS data set to cluster on/use for coordinate output. + If not specified the default COORDS set will be generated and used unless + \series bold nocoords \series default has been specified. \end_layout +\begin_layout Description +[data +\begin_inset space ~ +\end_inset + +[,,...] Distance between frames calculated using specified data + set(s) (Euclidean distance). +\end_layout + +\begin_deeper \begin_layout Description [nocoords] Do not use a COORDS data set; distance metrics that require coordinat es and coordiante output will be disabled. \end_layout +\end_deeper +\begin_layout Description +[] Name for generated cluster DataSets. +\end_layout + +\begin_layout Description +[readinfo] Read in previous cluster results from +\series bold +info +\series default +. + Clustering will continue if possible (can be used to restart clustering). +\begin_inset Separator latexpar +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Description +infofile +\begin_inset space ~ +\end_inset + + Cluster info file to read. +\end_layout + +\end_deeper \begin_layout Standard Algorithms: \end_layout @@ -40314,15 +40385,6 @@ averagelinkage] . \end_layout -\begin_layout Description -[includesieved_cdist] Include sieved frames in final cluster distance calculatio -n ( -\bar under -may be very slow -\bar default -). -\end_layout - \end_deeper \begin_layout Description dbscan Use DBSCAN clustering algorithm of Ester et al. @@ -40357,11 +40419,6 @@ epsilon Distance cutoff between points for forming a cluster. \end_layout -\begin_layout Description -[sievetoframe] When restoring sieved frames, compare frame to every frame - in a cluster instead of the centroid; slower but more accurate. -\end_layout - \begin_layout Description [kdist \begin_inset space ~ @@ -40568,31 +40625,13 @@ randompoint iterations are reached (default 100). \end_layout -\end_deeper -\begin_layout Description -readtxt|readinfo No clustering - read in previous cluster results. -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Description -infofile -\begin_inset space ~ -\end_inset - - Cluster info file to read. -\end_layout - \end_deeper \begin_layout Standard Distance Metric Options: \end_layout \begin_layout Description -[rms +[{rms \begin_inset space ~ \end_inset @@ -40600,12 +40639,16 @@ Distance Metric Options: \begin_inset space ~ \end_inset -srmsd[]] (Default +srmsd} +\begin_inset space ~ +\end_inset + +[]] (Default \series bold rms \series default -) Distance between frames calculated via best-fit coordinate RMSD using - atoms in +) Distance between coordinate frames calculated via best-fit coordinate + RMSD using atoms in \series bold \series default @@ -40643,8 +40686,8 @@ dme \begin_inset space ~ \end_inset -[] Distance between frames calculated using distance-RMSD (aka DME, - +[] Distance between coordinate frames calculated using distance-RMSD + (aka DME, \series bold \emph on distrmsd @@ -40658,41 +40701,20 @@ distrmsd \end_layout \begin_layout Description -[data -\begin_inset space ~ -\end_inset - -[,,...] Distance between frames calculated using specified data - set(s) (Euclidean distance). -\end_layout - -\begin_layout Description -[sieve -\begin_inset space ~ -\end_inset - -<#>] Perform clustering only for every +euclid Use Euclidean distance between scalar 1D data set(s) (default when + \series bold -<#> +data \series default - frame. - After clustering, all other frames will be added to clusters. + has been specified). \end_layout \begin_layout Description -[random] When -\series bold -sieve -\series default - is specified, select initial frames to cluster randomly. +manhatttan Use Manhattan distance between scalar 1D data set(s). \end_layout -\begin_layout Description -[sieveseed -\begin_inset space ~ -\end_inset - -<#>] Seed for random sieving; if not set the wallclock time will be used. +\begin_layout Standard +Pairwise Distance Matrix Options: \end_layout \begin_layout Description @@ -40700,23 +40722,36 @@ sieve \begin_inset space ~ \end_inset -] File to use for loading/saving pairwise distances. +] DataSet/File to use for loading/saving pairwise distances. \end_layout \begin_layout Description -[loadpairdist] Load pairwise distances from +[pwrecalc] If the loaded pairwise distance matrix does not match the current + setup, force recalculation. +\end_layout + +\begin_layout Description +[loadpairdist] Load pairwise distances from file/DataSet \series bold - + +\series default + (CpptrajPairDist if +\series bold +pairdist \series default - (CpptrajPairDist if pairdist not specified). + not specified). \end_layout \begin_layout Description -[savepairdist] Save pairwise distances from +[savepairdist] Save pairwise distances from file/DataSet \series bold - + +\series default + (CpptrajPairDist if +\series bold +pairdist \series default - (CpptrajPairDist if pairdist not specified). + not specified). NOTE: If sieving was performed only the calculated distances are saved. \end_layout @@ -40749,6 +40784,48 @@ none}] Cache pairwise distance data in memory (default), to disk, or disable SSD) - data is saved to a file named 'CpptrajPairwiseCache'. \end_layout +\begin_layout Standard +Sieving Options: +\end_layout + +\begin_layout Description +[sieve +\begin_inset space ~ +\end_inset + +<#>] Perform clustering only for every +\series bold +<#> +\series default + frame. + After clustering, all other frames will be added to clusters. +\end_layout + +\begin_layout Description +[random] When +\series bold +sieve +\series default + is specified, select initial frames to cluster randomly. +\end_layout + +\begin_layout Description +[sieveseed +\begin_inset space ~ +\end_inset + +<#>] Seed for random sieving; if not set the wallclock time will be used. +\end_layout + +\begin_layout Description +[includesieved_cdist] Include sieved frames in final cluster distance calculatio +n ( +\bar under +may be very slow +\bar default +). +\end_layout + \begin_layout Description [includesieveincalc] Include sieved frames when calculating within-cluster average ( @@ -40759,8 +40836,91 @@ may be very slow \end_layout \begin_layout Description -[pwrecalc] If a loaded pairwise distance file does not match the current - setup, force recalculation. +[sievetoframe] When restoring sieved frames, compare frame to every frame + in a cluster using a cutoff of +\series bold + +\series default + (default is algorithm +\series bold +epsilon +\series default + when using DPeaks/DBscan) instead of the centroid; slower but more accurate. +\end_layout + +\begin_layout Description +[sievetocentroid] When restoring sieved frames, compare frame to cluster + centroid using a cutoff of +\series bold + +\series default + (default is algorithm +\series bold +epsilon +\series default + when using DPeaks/DBscan). + Default method for DPeaks/DBSCAN. +\end_layout + +\begin_layout Description +[closestcentroid] When restoring sieved frames, add each frame to its closest + centroid. + Default method for hieragglo/kmeans. +\end_layout + +\begin_layout Description +[repsilon +\begin_inset space ~ +\end_inset + +] Epsilon to use for sievetoframe/sievetocentroid (default is algorithm + +\series bold +epsilon +\series default + when using DPeaks/DBscan). +\end_layout + +\begin_layout Standard +Best Representative Options: +\end_layout + +\begin_layout Description +[bestrep +\begin_inset space ~ +\end_inset + +{cumulative|centroid|cumulative_nosieve}] Method for choosing cluster representa +tive frames. +\end_layout + +\begin_deeper +\begin_layout Description +cumulative Choose by lowest cumulative distance to all other frames in cluster. + Default when not sieving. +\end_layout + +\begin_layout Description +centroid Choose by lowest distance to cluster centroid. + Default when sieving. +\end_layout + +\begin_layout Description +cumulative_nosieve Choose by lowest cumulative distance to all other frames, + ignoring sieved frames. +\end_layout + +\end_deeper +\begin_layout Description +[savenreps +\begin_inset space ~ +\end_inset + +<#>] Number of best representative frames to choose (default 1). \end_layout \begin_layout Standard @@ -40781,6 +40941,7 @@ Output Options: DBSCAN) will assign noise points a value of -1. \end_layout +\begin_deeper \begin_layout Description [gracecolor] Instead of cluster # vs frame, write cluster# + 1 (corresponding to colors used by XMGRACE) vs frame. @@ -40789,6 +40950,7 @@ Output Options: DBSCAN) will assign noise points a color of 0 (blank). \end_layout +\end_deeper \begin_layout Description [summary \begin_inset space ~ @@ -40893,6 +41055,10 @@ Where is the number of clusters, is the number of frames clustered, '.' means 'not in cluster' and 'X' means 'in cluster'. \end_layout +\begin_layout Description +[noinfo] Suppress printing of cluster info. +\end_layout + \begin_layout Description [summarysplit \begin_inset space ~ @@ -40957,40 +41123,6 @@ summarysplit '100,200,300'. \end_layout -\begin_layout Description -[bestrep -\begin_inset space ~ -\end_inset - -{cumulative|centroid|cumulative_nosieve}] Method for choosing cluster representa -tive frames. -\end_layout - -\begin_deeper -\begin_layout Description -cumulative Choose by lowest cumulative distance to all other frames in cluster. - Default when not sieving. -\end_layout - -\begin_layout Description -centroid Choose by lowest distance to cluster centroid. - Default when sieving. -\end_layout - -\begin_layout Description -cumulative_nosieve Choose by lowest cumulative distance to all other frames, - ignoring sieved frames. -\end_layout - -\end_deeper -\begin_layout Description -[savenreps -\begin_inset space ~ -\end_inset - -<#>] Number of best representative frames to choose (default 1). -\end_layout - \begin_layout Description [clustersvtime \begin_inset space ~ @@ -41000,6 +41132,7 @@ cumulative_nosieve Choose by lowest cumulative distance to all other frames, to . \end_layout +\begin_deeper \begin_layout Description [cvtwindow \begin_inset space ~ @@ -41012,6 +41145,17 @@ clustersvtime output. \end_layout +\end_deeper +\begin_layout Description +[sil +\begin_inset space ~ +\end_inset + +] Write average cluster silhouette value for each cluster to '.cl +uster.dat' and cluster silhouette value for each individual frame to '.fra +me.dat'. +\end_layout + \begin_layout Description [cpopvtime \begin_inset space ~ @@ -41045,47 +41189,31 @@ normframe \end_layout \begin_layout Description -[sil -\begin_inset space ~ -\end_inset - -] Write average cluster silhouette value for each cluster to '.cl -uster.dat' and cluster silhouette value for each individual frame to '.fra -me.dat'. -\end_layout - -\begin_layout Description -assignrefs In -\series bold -summary -\series default -/ +[lifetime] Create a DataSet with aspect +\emph on +[Lifetime] +\emph default + for each cluster; for each frame, have 1 if the cluster is present and + 0 otherwise. + Can be used with \series bold -summarysplit +\emph on +lifetime \series default -, assign clusters to loaded representative structures if RMSD to that reference - is less than specified cutoff. -\end_layout - -\begin_deeper -\begin_layout Description -[refcut -\begin_inset space ~ -\end_inset - -] RMSD cutoff in Angstroms. -\end_layout +\emph default + analysis ( +\begin_inset CommandInset ref +LatexCommand vref +reference "subsec:cpptraj-lifetime" +plural "false" +caps "false" +noprefix "false" -\begin_layout Description -[refmask -\begin_inset space ~ \end_inset -] Mask to use for RMSD calculation. - If not specified the default mask is all heavy atoms. +). \end_layout -\end_deeper \begin_layout Standard Coordinate Output Options: \end_layout @@ -41099,6 +41227,7 @@ clusterout where X is the cluster number. \end_layout +\begin_deeper \begin_layout Description clusterfmt \begin_inset space ~ @@ -41107,6 +41236,7 @@ clusterfmt Format keyword for clusterout (default Amber Trajectory). \end_layout +\end_deeper \begin_layout Description singlerepout \begin_inset space ~ @@ -41116,6 +41246,7 @@ singlerepout . \end_layout +\begin_deeper \begin_layout Description singlerepfmt \begin_inset space ~ @@ -41124,6 +41255,7 @@ singlerepfmt Format keyword for singlerepout (default Amber Trajectory). \end_layout +\end_deeper \begin_layout Description repout \begin_inset space ~ @@ -41134,6 +41266,7 @@ repout extension. \end_layout +\begin_deeper \begin_layout Description repfmt \begin_inset space ~ @@ -41150,6 +41283,7 @@ repout filename. \end_layout +\end_deeper \begin_layout Description avgout \begin_inset space ~ @@ -41160,6 +41294,7 @@ avgout filename extension. \end_layout +\begin_deeper \begin_layout Description avgfmt \begin_inset space ~ @@ -41168,12 +41303,72 @@ avgfmt Format keyword for avgout. \end_layout +\end_deeper +\begin_layout Description +assignrefs In +\series bold +summary +\series default +/ +\series bold +summarysplit +\series default +, assign clusters to loaded representative structures if RMSD to that reference + is less than specified cutoff. +\end_layout + +\begin_deeper +\begin_layout Description +[refcut +\begin_inset space ~ +\end_inset + +] RMSD cutoff in Angstroms. +\end_layout + +\begin_layout Description +[refmask +\begin_inset space ~ +\end_inset + +] Mask to use for RMSD calculation. + If not specified the default mask is all heavy atoms. +\end_layout + +\end_deeper \begin_layout Standard -DataSet Aspects: +DataSets Created: +\end_layout + +\begin_layout Description + Cluster number vs time (color number if +\series bold +gracecolor +\series default + specified). \end_layout \begin_layout Description -[Pop] Cluster population vs time; index corresponds to cluster number. +[NCVT] ( +\series bold +clustersvtime +\series default + only). + Number of unique clusters observed over time. +\end_layout + +\begin_layout Description +[Pop]: Cluster X population vs time; index X corresponds to cluster + number. +\end_layout + +\begin_layout Description +[Lifetime]: ( +\series bold +lifetime +\series default + only). + For each cluster X, contain 1 if cluster present that frame, 0 otherwise. \end_layout \end_deeper @@ -41252,7 +41447,7 @@ cluster C1 :2-10 clusters 3 epsilon 4.0 out cnumvtime.dat summary avg.summary.da \end_layout \begin_layout Subsubsection* -Clustering Metrics +Clustering Success Metrics (info file) \end_layout \begin_layout Standard @@ -41276,7 +41471,7 @@ The pseudo-F statistic (pSF) is another measure of clustering goodness. within group. \series bold -High values are good +Higher values of pseudo-F are good \series default . Generally, one selects a cluster-count that gives a peak in the pseudo-f @@ -41386,13 +41581,14 @@ The second way is automatically; cpptraj will attempt to identify outliers \end_layout \begin_layout Subsubsection* -The CpptrajPairDist file format +The Binary pairwise matrix file format \end_layout \begin_layout Standard -The CpptrajPairDist file is binary; the exact format depends on what version - of cpptraj generated the file (since earlier versions had no concept of - 'sieve'). +When NetCDF is not present, the pairwise matrix file will be written in + binary. + The exact format depends on what version of cpptraj generated the file + (since earlier versions had no concept of 'sieve'). The CpptrajPairDist file starts with a 4 byte header containing the characters 'C' 'T' 'M' followed by the version number. A quick way to figure out the version is to use the linux 'od' command @@ -41469,6 +41665,87 @@ The code that cpptraj uses to read in CpptrajPairDist files is in ClusterMatrix: :LoadFile() (ClusterMatrix.cpp). \end_layout +\begin_layout Subsubsection* +The NetCDF pairwise matrix format +\end_layout + +\begin_layout Standard +The default way to write pairwise matrix files is now with NetCDF. + This will be set up with the following parameters: +\end_layout + +\begin_layout LyX-Code +Attributes: +\end_layout + +\begin_deeper +\begin_layout Description +Conventions +\begin_inset Quotes eld +\end_inset + +CPPTRAJ_CMATRIX +\begin_inset Quotes erd +\end_inset + + +\end_layout + +\begin_layout Description +Version +\end_layout + +\begin_layout Description +MetricDescription +\end_layout + +\end_deeper +\begin_layout LyX-Code +Dimensions: +\end_layout + +\begin_deeper +\begin_layout Description +n_original_frames Number of frames originally in the set (i.e. + before sieving). +\end_layout + +\begin_layout Description +n_rows Number of rows in the upper-triangle pairwise matrix. +\end_layout + +\begin_layout Description +msize Actual size of the matrix; should be (nRows_ * (nRows_-1)) / 2; +\end_layout + +\end_deeper +\begin_layout LyX-Code +Variables: +\end_layout + +\begin_deeper +\begin_layout Description +sieve (integer, no dimension). + Sieve value. +\end_layout + +\begin_layout Description +matrix (float, dimension msize). + The pairwise matrix, flattened to 1 dimension. + Index calc is: i1 = i + 1; index = (((nRows_ * i) - ((i1 * i) / 2)) + j + - i1); +\end_layout + +\begin_layout Description +actual +\begin_inset space ~ +\end_inset + +frames (integer, dimension n_rows). + The actual frame numbers for which pairwise distances were calculated. +\end_layout + +\end_deeper \begin_layout Subsection cphstats \end_layout From 503ac663e1e37f29185786e473c2ca79f2a7d99a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 16:07:13 -0400 Subject: [PATCH 284/417] Add info about cluster pairwise matrix files; add cluster example using pairdist --- doc/cpptraj.lyx | 139 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 128 insertions(+), 11 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index e0b4e7d235..eac4a30454 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -2791,7 +2791,7 @@ status open \begin_layout Plain Layout \align center \begin_inset Tabular - + @@ -3514,7 +3514,7 @@ Read Only - + \begin_inset Text \begin_layout Plain Layout @@ -3523,7 +3523,7 @@ Charmm Output \end_inset - + \begin_inset Text \begin_layout Plain Layout @@ -3532,7 +3532,7 @@ Charmm Output \end_inset - + \begin_inset Text \begin_layout Plain Layout @@ -3541,7 +3541,7 @@ charmmout \end_inset - + \begin_inset Text \begin_layout Plain Layout @@ -3550,13 +3550,107 @@ charmmout \end_inset - + \begin_inset Text \begin_layout Plain Layout Energy information, Read Only \end_layout +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +Pairwise Cache (binary) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +.cmatrix +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +cmatrix +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +pairwise distances +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Used for cluster analysis. +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +Pairwise Cache (NetCDF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +.nccmatrix +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +nccmatrix +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +pairwise distances +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Used for cluster analysis. +\end_layout + \end_inset @@ -5148,6 +5242,20 @@ Cpptraj if this is not successful. \end_layout +\begin_layout Standard +If a file contains the header: +\end_layout + +\begin_layout LyX-Code +#F1 F2 +\end_layout + +\begin_layout Standard +CPPTRAJ will assume the file contains pairwise distances for clustering, + where the F1 and F2 columns contain the frame numbers, and the column + contains the distance. +\end_layout + \begin_layout Subsection Grace Data File Options \end_layout @@ -41421,9 +41529,11 @@ cluster data endToEnd clusters 10 epsilon 3.0 summary summary.dat info info.dat \end_layout \begin_layout Standard -Example: cluster on the CA atoms of residues 2-10 using average-linkage, - stopping when either 3 clusters are reached or the minimum distance between - clusters is 4.0, writing the cluster number vs time to +Example: two clustering commands on the CA atoms of residues 2-10 using + average-linkage, stopping when either 3 clusters are reached or the minimum + distance between clusters is 4.0 for the first, and 8 clusters or minimum + distance 2.0 for the second. + The first command will write the cluster number vs time to \begin_inset Quotes eld \end_inset @@ -41439,11 +41549,18 @@ avg.summary.dat \begin_inset Quotes erd \end_inset -: +. + The second clustering command will use the pairwise distance matrix from + the first to speed things up: +\end_layout + +\begin_layout LyX-Code +cluster C1 :2-10 clusters 3 epsilon 4.0 info C1.info out cnumvtime.dat summary + avg.summary.dat pairdist PW \end_layout \begin_layout LyX-Code -cluster C1 :2-10 clusters 3 epsilon 4.0 out cnumvtime.dat summary avg.summary.dat +cluster C2 :2-10 clusters 8 epsilon 2.0 info C2.info pairdist PW \end_layout \begin_layout Subsubsection* From d5847b81f85f10aa3f346d6a843add9c6e11bc09 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 16:07:58 -0400 Subject: [PATCH 285/417] Major revision increase to 6.0.0. Complete overhaul of the clustering code. --- src/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Version.h b/src/Version.h index d3cd984d75..1c3a03c74d 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 "V5.4.1" +#define CPPTRAJ_INTERNAL_VERSION "V6.0.0" /// PYTRAJ relies on this #define CPPTRAJ_VERSION_STRING CPPTRAJ_INTERNAL_VERSION #endif From 588ea5e9142ceb404733c018a720b5507be46286 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 9 Sep 2021 20:40:14 -0400 Subject: [PATCH 286/417] loadpairdist unnecessary here --- test/Test_Cluster_ReadInfo/RunTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Test_Cluster_ReadInfo/RunTest.sh b/test/Test_Cluster_ReadInfo/RunTest.sh index 159b752fdf..e6ce7a3dce 100755 --- a/test/Test_Cluster_ReadInfo/RunTest.sh +++ b/test/Test_Cluster_ReadInfo/RunTest.sh @@ -17,7 +17,7 @@ loadcrd ../tz2.crd name MyCrd # Cluster to 3 clusters cluster crdset MyCrd C1 :2-10 hieragglo clusters 3 info C1.info.dat savepairdist pairdist PW # Cluster to 8 clusters, use existing PW -cluster crdset MyCrd C2 :2-10 hieragglo clusters 8 info C2.info.dat loadpairdist pairdist PW +cluster crdset MyCrd C2 :2-10 hieragglo clusters 8 info C2.info.dat pairdist PW EOF RunCpptraj "Cluster restart test, part 1" From d5c53cf5afa2dc2e6bcb3fa061618bc7eec4e088 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 09:04:31 -0400 Subject: [PATCH 287/417] If starting with more clusters than target # clusters in kmeans, remove the low population clusters. --- src/Cluster/Algorithm_Kmeans.cpp | 33 ++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 8f047e5580..95a8b92639 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -83,6 +83,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, for (int processIdx = 0; processIdx != pointCount; processIdx++) PointIndices.push_back( processIdx ); + int startIteration = 0; if (clusters.empty()) { // Determine seeds FindKmeansSeeds( framesToCluster, pmatrix ); @@ -99,14 +100,37 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, seedFrame, clusters.back().Num(), *seedIdx); } } else { + // Clusters already exist. + mprintf("\t%i existing clusters.\n", clusters.Nclusters()); + if (clusters.Nclusters() > nclusters_) { + // We currently have more clusters than target clusters. + // Keep the top nclusters_ clusters and break up the rest. + mprintf("\t# of input clusters %i larger than target # clusters %i.\n" + "\tRemoving low-population clusters.\n", clusters.Nclusters(), + nclusters_); + clusters.Sort(); + while (clusters.Nclusters() > nclusters_) { + List::cluster_it lastCluster = clusters.end(); + --lastCluster; + clusters.RemoveCluster( lastCluster ); + } + mprintf("\tNow %i existing clusters.\n", clusters.Nclusters()); + } else if (clusters.Nclusters() < nclusters_) { + mprintf("\t# of input clusters %i smaller than target # clusters %i.\n", + clusters.Nclusters(), nclusters_); + return 1; // FIXME + } + // Ensure centroids are up to date. clusters.UpdateCentroids( pmatrix.MetricPtr() ); + // Since clusters already exist, go beyond the initial pass. + startIteration = 1; } // Assign points in 3 passes. If a point looked like it belonged to cluster A // at first, but then we added many other points and altered our cluster // shapes, its possible that we will want to reassign it to cluster B. - for (int iteration = 0; iteration != maxIt_; iteration++) + for (int iteration = startIteration; iteration != maxIt_; iteration++) { if (mode_ == RANDOM) { RN_.ShufflePoints( PointIndices ); @@ -200,14 +224,15 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, pointFrame, oldClusterIdx, closestCluster->Num(), closestDist); } else { if (debug_ > 0) - mprintf("Frame %i staying in cluster %i\n", pointFrame, closestCluster->Num()); + mprintf("Frame %i staying in cluster %i (dist= %f)\n", + pointFrame, closestCluster->Num(), closestDist); } - if (clusterToClusterCentroid_) { + //if (clusterToClusterCentroid_) { //if (oldBestRep != NewBestRep) { // C1->AlignToBestRep( pmatrix.MetricPtr() ); // FIXME: Only relevant for COORDS dist? // C1->CalculateCentroid( pmatrix.MetricPtr() ); // FIXME: Seems unnessecary to align prior //} - } + //} } // } } // END loop over points to cluster From 17c86d748cf10bc8cb3188e5eeee652693e8e8fa Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 09:44:24 -0400 Subject: [PATCH 288/417] Start trying to handle kmeans restart when target # clusters > current clusters --- src/Cluster/Algorithm_Kmeans.cpp | 66 ++++++++++++++++++++++++++++++++ src/Cluster/Algorithm_Kmeans.h | 1 + 2 files changed, 67 insertions(+) diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 95a8b92639..747ce768ae 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -249,6 +249,72 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, return 0; } +// FindSeedsFromClusters +/** Given current clusters, find points that are far away from centroids + * that can be used as new cluster seeds. + */ +int Cpptraj::Cluster::Algorithm_Kmeans::FindSeedsFromClusters(List& clusters, + Cframes const& FramesToCluster, + PairwiseMatrix const& pmatrix) +{ + int nSeedsToFind = nclusters_ - clusters.Nclusters(); + mprintf("\tTarget # seeds= %i\n", nSeedsToFind); + if (nSeedsToFind < 1) return 0; + // Ensure centroids are up to date + clusters.UpdateCentroids( pmatrix.MetricPtr() ); + SeedIndices_.resize( nSeedsToFind, -1 ); + int nSeedsFound = 0; + while (nSeedsFound < nSeedsToFind) + { + // Find the farthest point in each cluster. + std::vector MaxDst; + std::vector MaxFrame; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) + { + double maxdist = 0; + int maxframe = -1; + + for (Node::frame_iterator frm = node->beginframe(); frm != node->endframe(); ++frm) + { + double dist = pmatrix.MetricPtr()->FrameCentroidDist(*frm, node->Cent()); + if (dist > maxdist) { + maxdist = dist; + maxframe = *frm; + } + } + mprintf("DEBUG: seed %i maxdist= %f maxframe= %i\n", + nSeedsFound, maxdist, maxframe); + MaxDst.push_back( maxdist ); + MaxFrame.push_back( maxframe ); + } + if (nSeedsFound == 0) { + // For the first seed, just choose the one with the largest distance to centroid. + int maxi = -1; + double maxd = 0; + List::cluster_it maxclust = clusters.end(); + int idx = 0; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node, idx++) + { + if (MaxDst[idx] > maxd) { + maxd = MaxDst[idx]; + maxi = idx; + maxclust = node; + } + } + maxclust->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), MaxFrame[maxi] ); + SeedIndices_[nSeedsFound] = MaxFrame[maxi]; + mprintf("DEBUG: Frame %i from cluster %i (%f) chosen as first seed.\n", + MaxFrame[maxi], maxi, MaxDst[maxi]); + } else { + // Out of the list of farthest points, choose the one with the largest + // cumulative distance to existing seeds. + } + + } + + return 0; +} + // FindKmeansSeeds() /** Find some seed-points for K-means clustering. Take the first point as an * arbitrary first choice. Then, at each iteration, add the point whose total diff --git a/src/Cluster/Algorithm_Kmeans.h b/src/Cluster/Algorithm_Kmeans.h index 1464fc4f9d..fcc0a2e29c 100644 --- a/src/Cluster/Algorithm_Kmeans.h +++ b/src/Cluster/Algorithm_Kmeans.h @@ -19,6 +19,7 @@ class Algorithm_Kmeans : public Algorithm { typedef std::vector Iarray; enum KmeansModeType { SEQUENTIAL, RANDOM }; + int FindSeedsFromClusters(List&, Cframes const&, PairwiseMatrix const&); int FindKmeansSeeds(Cframes const&, PairwiseMatrix const&); Random_Number RN_; From 19fe45b531fca798087884871a26d12a25e9e35e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 10:08:32 -0400 Subject: [PATCH 289/417] Add kmeans restart test --- test/Test_Cluster_ReadInfo/RunTest.sh | 32 +++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/test/Test_Cluster_ReadInfo/RunTest.sh b/test/Test_Cluster_ReadInfo/RunTest.sh index e6ce7a3dce..838adc0cb1 100755 --- a/test/Test_Cluster_ReadInfo/RunTest.sh +++ b/test/Test_Cluster_ReadInfo/RunTest.sh @@ -9,6 +9,7 @@ TESTNAME='Cluster read info tests' #Requires netcdf INPUT="-i cluster.in" +# Hier. Agglo. cat > cluster.in < cluster.in < cluster.in < cluster.in < Date: Fri, 10 Sep 2021 10:13:31 -0400 Subject: [PATCH 290/417] Handle case where kmeans restart target # clusters is greater than existing clusters --- src/Cluster/Algorithm_Kmeans.cpp | 59 ++++++++++++++++++++++++++------ src/Cluster/Algorithm_Kmeans.h | 4 +-- 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 747ce768ae..b831566633 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -116,9 +116,25 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, } mprintf("\tNow %i existing clusters.\n", clusters.Nclusters()); } else if (clusters.Nclusters() < nclusters_) { + // We have fewer clusters than target clusters. + // Try to find new seeds to make up the difference. mprintf("\t# of input clusters %i smaller than target # clusters %i.\n", clusters.Nclusters(), nclusters_); - return 1; // FIXME + mprintf("\tWill attempt to find seeds from existing clusters.\n"); + Iarray Seeds = FindSeedsFromClusters(clusters, pmatrix); + if (Seeds.empty()) { + mprinterr("Error: Finding seeds from existing clusters failed.\n"); + return 1; + } + // Add the seed clusters + for (Iarray::const_iterator seed = Seeds.begin(); seed != Seeds.end(); ++seed) + { + // A centroid is created for new clusters. + clusters.AddCluster( Node(pmatrix.MetricPtr(), Cframes(1, *seed), clusters.Nclusters()) ); + // NOTE: No need to calc best rep frame, only 1 frame. + if (debug_ > 0) + mprintf("Put frame %i in cluster %i.\n", *seed, clusters.back().Num()); + } } // Ensure centroids are up to date. @@ -252,17 +268,19 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, // FindSeedsFromClusters /** Given current clusters, find points that are far away from centroids * that can be used as new cluster seeds. + * \return Array containing frame numbers to be used as seeds. */ -int Cpptraj::Cluster::Algorithm_Kmeans::FindSeedsFromClusters(List& clusters, - Cframes const& FramesToCluster, - PairwiseMatrix const& pmatrix) +Cpptraj::Cluster::Algorithm_Kmeans::Iarray + Cpptraj::Cluster::Algorithm_Kmeans::FindSeedsFromClusters(List& clusters, + PairwiseMatrix const& pmatrix) +const { int nSeedsToFind = nclusters_ - clusters.Nclusters(); mprintf("\tTarget # seeds= %i\n", nSeedsToFind); - if (nSeedsToFind < 1) return 0; + if (nSeedsToFind < 1) return Iarray(); // Ensure centroids are up to date clusters.UpdateCentroids( pmatrix.MetricPtr() ); - SeedIndices_.resize( nSeedsToFind, -1 ); + Iarray Seeds( nSeedsToFind, -1 ); int nSeedsFound = 0; while (nSeedsFound < nSeedsToFind) { @@ -302,17 +320,38 @@ int Cpptraj::Cluster::Algorithm_Kmeans::FindSeedsFromClusters(List& clusters, } } maxclust->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), MaxFrame[maxi] ); - SeedIndices_[nSeedsFound] = MaxFrame[maxi]; + Seeds[nSeedsFound++] = MaxFrame[maxi]; mprintf("DEBUG: Frame %i from cluster %i (%f) chosen as first seed.\n", MaxFrame[maxi], maxi, MaxDst[maxi]); } else { - // Out of the list of farthest points, choose the one with the largest - // cumulative distance to existing seeds. + // Out of the list of farthest points, choose the one with the largest + // cumulative distance to existing seeds. + std::vector cumulativeDist; + int maxi = -1; + double maxd = 0; + List::cluster_it maxclust = clusters.end(); + int idx = 0; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node, idx++) + { + double cdist = 0; + int frm1 = MaxFrame[idx]; + for (int is = 0; is < nSeedsFound; is++) + cdist += pmatrix.Frame_Distance(frm1, Seeds[is]); + if (cdist > maxd) { + maxd = cdist; + maxi = idx; + maxclust = node; + } + } + mprintf("DEBUG: Frame %i from cluster %i (%f, %f) chosen as seed %i.\n", + MaxFrame[maxi], maxi, MaxDst[maxi], maxd, nSeedsFound); + maxclust->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), MaxFrame[maxi] ); + Seeds[nSeedsFound++] = MaxFrame[maxi]; } } - return 0; + return Seeds; } // FindKmeansSeeds() diff --git a/src/Cluster/Algorithm_Kmeans.h b/src/Cluster/Algorithm_Kmeans.h index fcc0a2e29c..38ddef24df 100644 --- a/src/Cluster/Algorithm_Kmeans.h +++ b/src/Cluster/Algorithm_Kmeans.h @@ -19,14 +19,14 @@ class Algorithm_Kmeans : public Algorithm { typedef std::vector Iarray; enum KmeansModeType { SEQUENTIAL, RANDOM }; - int FindSeedsFromClusters(List&, Cframes const&, PairwiseMatrix const&); + Iarray FindSeedsFromClusters(List&, PairwiseMatrix const&) const; int FindKmeansSeeds(Cframes const&, PairwiseMatrix const&); Random_Number RN_; int nclusters_; ///< Target number of clusters. int kseed_; int maxIt_; - Iarray SeedIndices_; + Iarray SeedIndices_; ///< Hold indices into framesToCluster of seed frames KmeansModeType mode_; bool clusterToClusterCentroid_; }; From 0df0c3e3dc67fc63b8020c152815e3ccf5023313 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 10:14:32 -0400 Subject: [PATCH 291/417] Make messages clearer --- src/Cluster/Algorithm_Kmeans.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index b831566633..cf829f42b9 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -105,7 +105,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, if (clusters.Nclusters() > nclusters_) { // We currently have more clusters than target clusters. // Keep the top nclusters_ clusters and break up the rest. - mprintf("\t# of input clusters %i larger than target # clusters %i.\n" + mprintf("\tNumber of input clusters %i larger than target number of clusters %i.\n" "\tRemoving low-population clusters.\n", clusters.Nclusters(), nclusters_); clusters.Sort(); @@ -118,7 +118,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, } else if (clusters.Nclusters() < nclusters_) { // We have fewer clusters than target clusters. // Try to find new seeds to make up the difference. - mprintf("\t# of input clusters %i smaller than target # clusters %i.\n", + mprintf("\tNumber of input clusters %i smaller than target number of clusters %i.\n", clusters.Nclusters(), nclusters_); mprintf("\tWill attempt to find seeds from existing clusters.\n"); Iarray Seeds = FindSeedsFromClusters(clusters, pmatrix); From 73105c5a8a44adc6558a3615860bf9b3eb1863ff Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 10:15:13 -0400 Subject: [PATCH 292/417] Add test for kmeans restart where target clusters > existing clusters. Not sure the seed choice algorithm is optimal but it appears to work ok. --- test/Test_Cluster_ReadInfo/C7.info.dat.save | 22 +++++++++++++++++++++ test/Test_Cluster_ReadInfo/RunTest.sh | 14 +++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 test/Test_Cluster_ReadInfo/C7.info.dat.save diff --git a/test/Test_Cluster_ReadInfo/C7.info.dat.save b/test/Test_Cluster_ReadInfo/C7.info.dat.save new file mode 100644 index 0000000000..6de1b09dcb --- /dev/null +++ b/test/Test_Cluster_ReadInfo/C7.info.dat.save @@ -0,0 +1,22 @@ +#Clustering: 8 clusters 101 frames +#Cluster 0 has average-distance-to-centroid 2.144707 +#Cluster 1 has average-distance-to-centroid 1.458470 +#Cluster 2 has average-distance-to-centroid 2.199040 +#Cluster 3 has average-distance-to-centroid 1.722155 +#Cluster 4 has average-distance-to-centroid 1.761383 +#Cluster 5 has average-distance-to-centroid 0.826871 +#Cluster 6 has average-distance-to-centroid 1.415996 +#Cluster 7 has average-distance-to-centroid 0.000000 +#DBI: 0.974704 +#pSF: 32.241184 +#SSR/SST: 0.708179 +#Algorithm: Kmeans nclusters 8 maxit 100 +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +.............................................................................XXXXXXXXXXXXXXXXXXXXXXXX +.................................................................XXXXXXXXXXXX........................ +.....XXXXXXX......................................................................................... +...XX.......XX....................................................................................... +...............................................................XX.................................... +.XX.................................................................................................. +X.................................................................................................... +#Representative frames: 32 96 76 11 13 64 2 1 diff --git a/test/Test_Cluster_ReadInfo/RunTest.sh b/test/Test_Cluster_ReadInfo/RunTest.sh index 838adc0cb1..ac14091896 100755 --- a/test/Test_Cluster_ReadInfo/RunTest.sh +++ b/test/Test_Cluster_ReadInfo/RunTest.sh @@ -63,6 +63,20 @@ EOF RunCpptraj "K-means cluster restart test, part 2" DoTest C4.info.dat C6.info.dat +# K-means, try to cluster to more clusters from fewer clusters. +cat > cluster.in < Date: Fri, 10 Sep 2021 10:18:00 -0400 Subject: [PATCH 293/417] Add note. --- src/Cluster/Algorithm_Kmeans.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index cf829f42b9..7e104453be 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -85,7 +85,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, int startIteration = 0; if (clusters.empty()) { - // Determine seeds + // Determine seeds TODO have FindKmeansSeeds return Iarray with frame #s? FindKmeansSeeds( framesToCluster, pmatrix ); // Add the seed clusters for (Iarray::const_iterator seedIdx = SeedIndices_.begin(); From f136daffa328c695ed096c6b594500f040324c13 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 10:20:58 -0400 Subject: [PATCH 294/417] Compare info.dat --- test/Test_Cluster_DBSCAN/RunTest.sh | 1 + test/Test_Cluster_DBSCAN/info.dat.save | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/Test_Cluster_DBSCAN/info.dat.save diff --git a/test/Test_Cluster_DBSCAN/RunTest.sh b/test/Test_Cluster_DBSCAN/RunTest.sh index a236b2ae0a..01da893651 100755 --- a/test/Test_Cluster_DBSCAN/RunTest.sh +++ b/test/Test_Cluster_DBSCAN/RunTest.sh @@ -20,6 +20,7 @@ create rvc.dat R0 C0 EOF RunCpptraj "DBSCAN test" DoTest rvc.dat.save rvc.dat +DoTest info.dat.save info.dat # Test 4-dist plot generation cat > dbscan.in < Date: Fri, 10 Sep 2021 10:36:14 -0400 Subject: [PATCH 295/417] Ensure existing clusters are removed for restart DBscan, will be recreated at the end. --- src/Cluster/Algorithm_DBscan.cpp | 5 +++++ src/Cluster/List.cpp | 6 ++++++ src/Cluster/List.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index 77d8440600..4b662ec3e4 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -113,6 +113,11 @@ int Cpptraj::Cluster::Algorithm_DBscan::DoClustering(List& clusters, Status_[it-framesToCluster.begin()] = node->Num(); } } + mprintf("DEBUG: Status based on existing clusters:\n"); + for (Iarray::const_iterator stat = Status_.begin(); stat != Status_.end(); ++stat) + mprintf("\t%10li %i\n", stat-Status_.begin(), *stat); + // Blow away existing clusters + clusters.Clear(); } ProgressBar progress( nPtsToCluster ); for (unsigned int idx = 0; idx != nPtsToCluster; idx++) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 34e03ab88d..2452a974b4 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -148,6 +148,12 @@ void Cpptraj::Cluster::List::RemoveEmptyClusters() { } } +/** Clear everything. */ +void Cpptraj::Cluster::List::Clear() { + clusters_.clear(); + noise_.clear(); +} + // ----------------------------------------------------------------------------- void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric* metricIn) { diff --git a/src/Cluster/List.h b/src/Cluster/List.h index e7cff772d3..170b8a576d 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -47,6 +47,8 @@ class List { void RemoveCluster( cluster_it& it ) { clusters_.erase( it ); } /// Remove clusters with no population void RemoveEmptyClusters(); + /// Remove all clusters + void Clear(); /// Generate cluster number vs time data set int CreateCnumVsTime(DataSet_integer&, unsigned int, int, int) const; /// Generate number unique clusters vs time data set From c73d9f28d06c5219b4e8c5495a97f9e195fbb762 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 13:10:32 -0400 Subject: [PATCH 296/417] Add DBscan restart test --- test/Test_Cluster_ReadInfo/C9.info.dat.save | 18 ++++++++++++++++ test/Test_Cluster_ReadInfo/RunTest.sh | 23 +++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 test/Test_Cluster_ReadInfo/C9.info.dat.save diff --git a/test/Test_Cluster_ReadInfo/C9.info.dat.save b/test/Test_Cluster_ReadInfo/C9.info.dat.save new file mode 100644 index 0000000000..e920bb162d --- /dev/null +++ b/test/Test_Cluster_ReadInfo/C9.info.dat.save @@ -0,0 +1,18 @@ +#Clustering: 5 clusters 101 frames +#Cluster 0 has average-distance-to-centroid 1.288278 +#Cluster 1 has average-distance-to-centroid 1.072369 +#Cluster 2 has average-distance-to-centroid 1.315443 +#Cluster 3 has average-distance-to-centroid 0.589236 +#Cluster 4 has average-distance-to-centroid 0.620107 +#DBI: 1.939900 +#pSF: 88.323117 +#SSR/SST: 0.819148 +#Algorithm: DBSCAN minpoints 5 epsilon 1.7 sieveToCentroid 1 +#NOISE_FRAMES: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 64 65 66 67 +#Number_of_noise_frames: 18 +..............XXXXXXXXXXXXXXXX....XXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +.............................................................................XXXXXXXXXXXXXX.X.XXXX.XX +...................................................................XXXXXXXXXX........................ +..............................XXXX................................................................... +...........................................................................................X.X....X.. +#Representative frames: 24 101 76 32 92 diff --git a/test/Test_Cluster_ReadInfo/RunTest.sh b/test/Test_Cluster_ReadInfo/RunTest.sh index ac14091896..af8ac8c202 100755 --- a/test/Test_Cluster_ReadInfo/RunTest.sh +++ b/test/Test_Cluster_ReadInfo/RunTest.sh @@ -77,6 +77,29 @@ EOF RunCpptraj "K-means cluster restart, 3 to 8 clusters." DoTest C7.info.dat.save C7.info.dat +# DBscan +cat > cluster.in < cluster.in < Date: Fri, 10 Sep 2021 13:44:15 -0400 Subject: [PATCH 297/417] Hide some debug info --- src/Cluster/Algorithm_DBscan.cpp | 8 +++++--- src/Cluster/Algorithm_Kmeans.cpp | 17 +++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index 4b662ec3e4..442977cceb 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -113,9 +113,11 @@ int Cpptraj::Cluster::Algorithm_DBscan::DoClustering(List& clusters, Status_[it-framesToCluster.begin()] = node->Num(); } } - mprintf("DEBUG: Status based on existing clusters:\n"); - for (Iarray::const_iterator stat = Status_.begin(); stat != Status_.end(); ++stat) - mprintf("\t%10li %i\n", stat-Status_.begin(), *stat); + if (debug_ > 0) { + mprintf("DEBUG: Status based on existing clusters:\n"); + for (Iarray::const_iterator stat = Status_.begin(); stat != Status_.end(); ++stat) + mprintf("\t%10li %i\n", stat-Status_.begin(), *stat); + } // Blow away existing clusters clusters.Clear(); } diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 7e104453be..3c6971dcad 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -275,6 +275,8 @@ Cpptraj::Cluster::Algorithm_Kmeans::Iarray PairwiseMatrix const& pmatrix) const { + // TODO change algorithm to do normal seed choice, then pick seeds that are + // far away from existing centroids. int nSeedsToFind = nclusters_ - clusters.Nclusters(); mprintf("\tTarget # seeds= %i\n", nSeedsToFind); if (nSeedsToFind < 1) return Iarray(); @@ -300,8 +302,9 @@ const maxframe = *frm; } } - mprintf("DEBUG: seed %i maxdist= %f maxframe= %i\n", - nSeedsFound, maxdist, maxframe); + if (debug_ > 0) + mprintf("DEBUG: cluster %i seed %i maxdist= %f maxframe= %i\n", + node->Num(), nSeedsFound, maxdist, maxframe); MaxDst.push_back( maxdist ); MaxFrame.push_back( maxframe ); } @@ -321,8 +324,9 @@ const } maxclust->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), MaxFrame[maxi] ); Seeds[nSeedsFound++] = MaxFrame[maxi]; - mprintf("DEBUG: Frame %i from cluster %i (%f) chosen as first seed.\n", - MaxFrame[maxi], maxi, MaxDst[maxi]); + if (debug_ > 0) + mprintf("DEBUG: Frame %i from cluster %i (%f) chosen as first seed.\n", + MaxFrame[maxi], maxi, MaxDst[maxi]); } else { // Out of the list of farthest points, choose the one with the largest // cumulative distance to existing seeds. @@ -343,8 +347,9 @@ const maxclust = node; } } - mprintf("DEBUG: Frame %i from cluster %i (%f, %f) chosen as seed %i.\n", - MaxFrame[maxi], maxi, MaxDst[maxi], maxd, nSeedsFound); + if (debug_ > 0) + mprintf("DEBUG: Frame %i from cluster %i (%f, %f) chosen as seed %i.\n", + MaxFrame[maxi], maxi, MaxDst[maxi], maxd, nSeedsFound); maxclust->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), MaxFrame[maxi] ); Seeds[nSeedsFound++] = MaxFrame[maxi]; } From fbf36eb27a95e2953e6683f7b48e974ba42af862 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 13:44:33 -0400 Subject: [PATCH 298/417] Add ability to read initial clusters from cnumvtime set --- src/Cluster/Control.cpp | 59 +++++++++++++++++++++++++++++++++++++++-- src/Cluster/Control.h | 4 ++- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index fbaa9b44e2..567db3b342 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -304,6 +304,7 @@ int Cpptraj::Cluster::Control::ReadInfo(std::string const& fname) { mprinterr("Error: No cluster info filename given.\n"); return 1; } + mprintf("\tReading clusters from info file '%s'\n", fname.c_str()); BufferedLine infile; if (infile.OpenFileRead( fname )) return Err(0); const char* ptr = infile.Line(); @@ -347,6 +348,43 @@ int Cpptraj::Cluster::Control::ReadInfo(std::string const& fname) { return 0; } +/** Set up clusters from a cluster number vs time data set. */ +int Cpptraj::Cluster::Control::InitClustersFromSet(DataSet* cnvt) { + if (cnvt == 0) { + mprinterr("Internal Error: InitClustersFromSet: Null set.\n"); + return 1; + } + mprintf("\tReading clusters from cluster num vs time set '%s'\n", cnvt->legend()); + if (cnvt->Group() != DataSet::SCALAR_1D) { + mprinterr("Error: Set '%s' is not a scalar 1D set.\n", cnvt->legend()); + return 1; + } + if (cnvt->Type() != DataSet::INTEGER) { + mprintf("Warning: Set '%s' is not an integer set. Floating point values\n" + "Warning: will be rounded to integer values.\n", cnvt->legend()); + } + // Hold frames for each cluster + std::vector clusterFrames; + DataSet_1D const& ds = static_cast( *cnvt ); + for (unsigned int idx = 0; idx != cnvt->Size(); idx++) + { + int cnum = ds.Dval(idx); + if (cnum > -1) { + if (cnum >= (int)clusterFrames.size()) { + while ((int)clusterFrames.size() <= cnum) + clusterFrames.push_back( Cframes() ); + } + clusterFrames[cnum].push_back( (int)idx ); + } + } + int clusterNum = 0; + for (std::vector::const_iterator frames = clusterFrames.begin(); + frames != clusterFrames.end(); + ++frames, ++clusterNum) + clusters_.AddCluster( Node(metric_, *frames, clusterNum) ); + return 0; +} + // ----------------------------------------------------------------------------- const char* Cpptraj::Cluster::Control::MetricArgs_ = @@ -485,7 +523,23 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (analyzeArgs.hasKey("readinfo") || analyzeArgs.hasKey("readtxt")) { - if (ReadInfo( analyzeArgs.GetStringKey("infofile") )) return 1; + std::string iname = analyzeArgs.GetStringKey("infofile"); + if (!iname.empty()) { + if (ReadInfo( iname )) return 1; + } else { + iname = analyzeArgs.GetStringKey("cnvtset"); + if (!iname.empty()) { + DataSet* cnvt = DSL.GetDataSet( iname ); + if (cnvt == 0) { + mprinterr("Error: Input cluster num vs time set '%s' not found.\n", iname.c_str()); + return 1; + } + if (InitClustersFromSet( cnvt )) return 1; + } else { + mprinterr("Error: Must specify either 'infofile' or 'cnvtset' with 'readinfo'\n"); + return 1; + } + } } if (results_ != 0) { @@ -702,7 +756,8 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, /** Print help text to STDOUT. */ void Cpptraj::Cluster::Control::Help() { mprintf("\t[] [] [] [] [] []\n" - "\t[] [] [] [readinfo infofile ]\n"); + "\t[] [] []\n" + "\t[readinfo {infofile | cnvtset }]\n"); mprintf(" Algorithm Args: [%s]\n", AlgorithmArgs_); Algorithm_HierAgglo::Help(); Algorithm_DBscan::Help(); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 62607012a6..79d4eac516 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -72,8 +72,10 @@ class Control { static Algorithm* AllocateAlgorithm(Algorithm::AType); int AllocateAlgorithm(ArgList&); - + /// Initialize clusters from Info file int ReadInfo(std::string const&); + /// Initialize clusters from cluster number vs time DataSet + int InitClustersFromSet(DataSet*); //int Common(ArgList&, DataSetList&, DataFileList&); From d84b44d7a07edb5b1e16b5dcb40c23f8af5d5b8e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 13:44:58 -0400 Subject: [PATCH 299/417] Comment out debug statement --- test/Test_Cluster_ReadInfo/RunTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Test_Cluster_ReadInfo/RunTest.sh b/test/Test_Cluster_ReadInfo/RunTest.sh index af8ac8c202..915a63dec3 100755 --- a/test/Test_Cluster_ReadInfo/RunTest.sh +++ b/test/Test_Cluster_ReadInfo/RunTest.sh @@ -53,7 +53,7 @@ cat > cluster.in < Date: Fri, 10 Sep 2021 13:48:41 -0400 Subject: [PATCH 300/417] Add readinfo cnvtset test --- test/Test_Cluster_ReadInfo/RunTest.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/Test_Cluster_ReadInfo/RunTest.sh b/test/Test_Cluster_ReadInfo/RunTest.sh index 915a63dec3..7a21341ad4 100755 --- a/test/Test_Cluster_ReadInfo/RunTest.sh +++ b/test/Test_Cluster_ReadInfo/RunTest.sh @@ -3,7 +3,7 @@ . ../MasterTest.sh # Clean -CleanFiles cluster.in C?.info.dat PW +CleanFiles cluster.in C?.info.dat PW C2.dat C??.info.dat TESTNAME='Cluster read info tests' #Requires netcdf @@ -18,7 +18,7 @@ loadcrd ../tz2.crd name MyCrd # Cluster to 3 clusters cluster crdset MyCrd C1 :2-10 hieragglo clusters 3 info C1.info.dat savepairdist pairdist PW # Cluster to 8 clusters, use existing PW -cluster crdset MyCrd C2 :2-10 hieragglo clusters 8 info C2.info.dat pairdist PW +cluster crdset MyCrd C2 :2-10 hieragglo clusters 8 info C2.info.dat pairdist PW out C2.dat EOF RunCpptraj "Hierarchical aggolmerative cluster restart test, part 1" @@ -32,9 +32,17 @@ cluster crdset MyCrd C3 :2-10 hieragglo clusters 3 \ readinfo infofile C2.info.dat \ info C3.info.dat \ loadpairdist pairdist PW + +# Same but use cnumvime set +readdata C2.dat name MyClusters +cluster crdset MyCrd C10 :2-10 hieragglo clusters 3 \ + readinfo cnvtset MyClusters \ + info C10.info.dat \ + pairdist PW EOF RunCpptraj "Hierarchical agglomerative cluster restart test, part 2" DoTest C1.info.dat C3.info.dat +DoTest C1.info.dat C10.info.dat # K-means cat > cluster.in < Date: Fri, 10 Sep 2021 13:49:05 -0400 Subject: [PATCH 301/417] Clean up savepairdist/loadpairdist entries. Add cnvtset keyword --- doc/cpptraj.lyx | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index eac4a30454..87104c9902 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -40217,7 +40217,11 @@ cluster \begin_layout LyX-Code [] [] [] [readinfo infofile ] + Output>] [] +\end_layout + +\begin_layout LyX-Code + [readinfo {infofile | cnvtset }] \end_layout \begin_layout LyX-Code @@ -40396,12 +40400,9 @@ es and coordiante output will be disabled. \end_layout \begin_layout Description -[readinfo] Read in previous cluster results from -\series bold -info -\series default -. - Clustering will continue if possible (can be used to restart clustering). +[readinfo] Use previous cluster results to set up initial clusters. + Clustering will continue if possible (i.e. + this can be used to restart clustering). \begin_inset Separator latexpar \end_inset @@ -40414,7 +40415,19 @@ infofile \begin_inset space ~ \end_inset - Cluster info file to read. + Cluster +\series bold +info +\series default + file to read. +\end_layout + +\begin_layout Description +cnvtset +\begin_inset space ~ +\end_inset + + Cluster number vs time data set to use. \end_layout \end_deeper @@ -40830,7 +40843,8 @@ Pairwise Distance Matrix Options: \begin_inset space ~ \end_inset -] DataSet/File to use for loading/saving pairwise distances. +] Pairwise cache DataSet/File name to use for loading/saving pairwise + distances. \end_layout \begin_layout Description @@ -40839,9 +40853,9 @@ Pairwise Distance Matrix Options: \end_layout \begin_layout Description -[loadpairdist] Load pairwise distances from file/DataSet +[loadpairdist] Load pairwise distances from file specified by \series bold - +pairdist \series default (CpptrajPairDist if \series bold @@ -40851,9 +40865,9 @@ pairdist \end_layout \begin_layout Description -[savepairdist] Save pairwise distances from file/DataSet +[savepairdist] Save pairwise distances to file specified by \series bold - +pairdist \series default (CpptrajPairDist if \series bold From 2414a8cf308c473d43bc659d5e875db9000e829a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 14:03:06 -0400 Subject: [PATCH 302/417] Start creating Node versions of bestrep functions --- src/Cluster/BestReps.cpp | 54 ++++++++++++++++++++++++---------------- src/Cluster/BestReps.h | 2 ++ 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index eaac1e3eef..8c0d3776b4 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -90,54 +90,53 @@ const return err; } -// ClusterList::FindBestRepFrames_CumulativeDist() -/** Find the frame in each cluster that is the best representative by +/** Find the frame(s) in the node that is best representative by * having the lowest cumulative distance to every other point in the cluster. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(List& clusters, PairwiseMatrix const& pmatrix) +int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(Node& node, + PairwiseMatrix const& pmatrix) const { int err = 0; - for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { - //node->Cent()->Print("centroid." + integerToString(node->Num())); // DEBUG + //node.Cent()->Print("centroid." + integerToString(node.Num())); // DEBUG //CpptrajFile tmp; // DEBUG - //tmp.OpenWrite("c"+integerToString(node->Num())+".bestRep.dat"); // DEBUG + //tmp.OpenWrite("c"+integerToString(node.Num())+".bestRep.dat"); // DEBUG // Handle special cases - if (node->Nframes() == 1) { - node->BestReps().clear(); + if (node.Nframes() == 1) { + node.BestReps().clear(); if (debug_ > 0) - mprintf("DEBUG: Only 1 frame, best rep: %i\n", node->ClusterFrame(0)); + mprintf("DEBUG: Only 1 frame, best rep: %i\n", node.ClusterFrame(0)); // Only one frame. That is the best rep. - node->BestReps().push_back( RepPair(node->ClusterFrame(0), 0.0) ); - } else if (node->Nframes() == 2) { - node->BestReps().clear(); + node.BestReps().push_back( RepPair(node.ClusterFrame(0), 0.0) ); + } else if (node.Nframes() == 2) { + node.BestReps().clear(); if (debug_ > 0) - mprintf("DEBUG: 2 frames %i and %i, using former as best rep.\n", node->ClusterFrame(0), node->ClusterFrame(1)); + mprintf("DEBUG: 2 frames %i and %i, using former as best rep.\n", node.ClusterFrame(0), node.ClusterFrame(1)); // Two frames, distance from f1 to f2 same as f2 to f1. Take f1 by convention. - node->BestReps().push_back( RepPair(node->ClusterFrame(0), - pmatrix.Frame_Distance(node->ClusterFrame(0), node->ClusterFrame(1))) ); + node.BestReps().push_back( RepPair(node.ClusterFrame(0), + pmatrix.Frame_Distance(node.ClusterFrame(0), node.ClusterFrame(1))) ); } else { // Find cumulative distance of each frame to all other frames. RepMap bestReps; - for (Node::frame_iterator f1 = node->beginframe(); - f1 != node->endframe(); ++f1) + for (Node::frame_iterator f1 = node.beginframe(); + f1 != node.endframe(); ++f1) { double cdist = 0.0; - for (Node::frame_iterator f2 = node->beginframe(); f2 != node->endframe(); ++f2) + for (Node::frame_iterator f2 = node.beginframe(); f2 != node.endframe(); ++f2) { if (f1 != f2) cdist += pmatrix.Frame_Distance(*f1, *f2); } SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave_); - //tmp.Printf("%i %g %g\n", *f1+1, cdist, Cdist_->FrameCentroidDist(*f1, node->Cent())); + //tmp.Printf("%i %g %g\n", *f1+1, cdist, Cdist_->FrameCentroidDist(*f1, node.Cent())); } //tmp.CloseFile(); if (bestReps.empty()) { mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node->Num()); + node.Num()); err++; } - SetBestRepFrame( *node, bestReps ); + SetBestRepFrame( node, bestReps ); // DEBUG if (debug_ > 0) { mprintf("DEBUG: Best reps:\n"); @@ -145,6 +144,19 @@ const mprintf("\t%i (%20.10E)\n", it->second, it->first); } } + return err; +} + +// ClusterList::FindBestRepFrames_CumulativeDist() +/** Find the frame in each cluster that is the best representative by + * having the lowest cumulative distance to every other point in the cluster. + */ +int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(List& clusters, PairwiseMatrix const& pmatrix) +const +{ + int err = 0; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { + err += FindBestRepFrames_CumulativeDist(*node, pmatrix); } return err; /* diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index 1b65cae5bc..79756a4b38 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -30,6 +30,8 @@ class BestReps { /// Set given cluster node with best representative frames/scores in reps static inline void SetBestRepFrame(Node& node, RepMap const&); + /// Find best rep frames in node by shortest distance to all other frames. + int FindBestRepFrames_CumulativeDist(Node&, PairwiseMatrix const&) const; /// Find best representative frames by shortest distance to all other frames. int FindBestRepFrames_CumulativeDist(List&, PairwiseMatrix const&) const; /// Find best representative frames by shortest distance, ignoring sieved frames. From ca1e70aefb3caf0763c770eb1b82b69dd8f3377d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 14:08:49 -0400 Subject: [PATCH 303/417] Create Node versions of the bestrep functions --- src/Cluster/BestReps.cpp | 61 ++++++++++++++++++++++++++++------------ src/Cluster/BestReps.h | 4 +++ 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 8c0d3776b4..698fb2787a 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -189,25 +189,22 @@ const */ } -/** Find the frame in each cluster that is the best representative by +/** Find the frame in Node that is the best representative by * having the lowest cumulative distance to every other point in the cluster, * ignoring sieved frames. */ int Cpptraj::Cluster::BestReps:: - FindBestRepFrames_NoSieve_CumulativeDist(List& clusters, PairwiseMatrix const& pmatrix, + FindBestRepFrames_NoSieve_CumulativeDist(Node& node, PairwiseMatrix const& pmatrix, Cframes const& sievedFrames) const { - if (sievedFrames.size() > 0) - mprintf("Warning: Ignoring sieved frames while looking for best representative.\n"); int err = 0; - for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { RepMap bestReps; - for (Node::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) + for (Node::frame_iterator f1 = node.beginframe(); f1 != node.endframe(); ++f1) { if (!sievedFrames.HasFrame( *f1 )) { double cdist = 0.0; - for (Node::frame_iterator f2 = node->beginframe(); f2 != node->endframe(); ++f2) + for (Node::frame_iterator f2 = node.beginframe(); f2 != node.endframe(); ++f2) { if (f1 != f2 && !sievedFrames.HasFrame( *f2 )) //cdist += pmatrix.Cache().CachedDistance(*f1, *f2); // TODO benchmark the two ways @@ -218,37 +215,65 @@ const } if (bestReps.empty()) { mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node->Num()); + node.Num()); err++; } - SetBestRepFrame( *node, bestReps ); + SetBestRepFrame( node, bestReps ); + return err; +} + +/** Find the frame in each cluster that is the best representative by + * having the lowest cumulative distance to every other point in the cluster, + * ignoring sieved frames. + */ +int Cpptraj::Cluster::BestReps:: + FindBestRepFrames_NoSieve_CumulativeDist(List& clusters, PairwiseMatrix const& pmatrix, + Cframes const& sievedFrames) +const +{ + if (sievedFrames.size() > 0) + mprintf("Warning: Ignoring sieved frames while looking for best representative.\n"); + int err = 0; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { + err += FindBestRepFrames_NoSieve_CumulativeDist(*node, pmatrix, sievedFrames); } return err; } -/** Find the frame in the cluster that is the best representative by +/** Find the frame in the node that is the best representative by * having the lowest distance to the cluster centroid. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(List& clusters, PairwiseMatrix const& pmatrix) +int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(Node& node, PairwiseMatrix const& pmatrix) const { int err = 0; - for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { - //mprintf("DEBUG: FindBestRepFrames_Centroid: Cluster %i\n", node->Num()); + //mprintf("DEBUG: FindBestRepFrames_Centroid: Cluster %i\n", node.Num()); RepMap bestReps; - //node->Cent()->Print("centroid." + integerToString(node->Num())); // DEBUG - for (Node::frame_iterator f1 = node->beginframe(); f1 != node->endframe(); ++f1) + //node.Cent()->Print("centroid." + integerToString(node.Num())); // DEBUG + for (Node::frame_iterator f1 = node.beginframe(); f1 != node.endframe(); ++f1) { - double dist = pmatrix.MetricPtr()->FrameCentroidDist(*f1, node->Cent()); + double dist = pmatrix.MetricPtr()->FrameCentroidDist(*f1, node.Cent()); //mprintf("\t%8i %10.4g %10.4g %i\n", *f1+1, dist, mindist, minframe+1); SaveBestRep(bestReps, RepPair(dist, *f1), nToSave_); } if (bestReps.empty()) { mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node->Num()); + node.Num()); err++; } - SetBestRepFrame( *node, bestReps ); + SetBestRepFrame( node, bestReps ); + return err; +} + +/** Find the frame in each cluster that is the best representative by + * having the lowest distance to the cluster centroid. + */ +int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(List& clusters, PairwiseMatrix const& pmatrix) +const +{ + int err = 0; + for (List::cluster_it node = clusters.begin(); node != clusters.end(); ++node) { + err += FindBestRepFrames_Centroid(*node, pmatrix); } return err; } diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index 79756a4b38..c8252e6cd9 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -34,8 +34,12 @@ class BestReps { int FindBestRepFrames_CumulativeDist(Node&, PairwiseMatrix const&) const; /// Find best representative frames by shortest distance to all other frames. int FindBestRepFrames_CumulativeDist(List&, PairwiseMatrix const&) const; + /// Find best rep frames in node by shortest distance, ignoring sieved frames. + int FindBestRepFrames_NoSieve_CumulativeDist(Node&, PairwiseMatrix const&, Cframes const&) const; /// Find best representative frames by shortest distance, ignoring sieved frames. int FindBestRepFrames_NoSieve_CumulativeDist(List&, PairwiseMatrix const&, Cframes const&) const; + /// Find best rep frames in node by shortest distance to centroid. + int FindBestRepFrames_Centroid(Node&, PairwiseMatrix const&) const; /// Find best representative frames by shortest distance to centroid. int FindBestRepFrames_Centroid(List&, PairwiseMatrix const&) const; From 950ca08e5fe1847541776425303dce5f000a4efb Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 14:31:33 -0400 Subject: [PATCH 304/417] Create separate print routine for debug; some cleanup --- src/Cluster/BestReps.cpp | 183 ++++++++++++++++++++------------------- src/Cluster/BestReps.h | 5 ++ 2 files changed, 100 insertions(+), 88 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 698fb2787a..700d61738e 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -52,6 +52,17 @@ int Cpptraj::Cluster::BestReps::InitBestReps(RepMethodType typeIn, int nToSaveIn return 0; } +/** Print best reps to stdout. */ +void Cpptraj::Cluster::BestReps::PrintBestReps(List& clusters) { + for (List::cluster_iterator node = clusters.begin(); node != clusters.end(); ++node) + { + mprintf("DEBUG: Cluster %i best reps:\n", node->Num()); + for (Node::RepPairArray::const_iterator it = node->BestReps().begin(); + it != node->BestReps().end(); ++it) + mprintf("\t%i (%g)\n", it->second, it->first); + } +} + /** Find best representative frames for each cluster. */ int Cpptraj::Cluster::BestReps::FindBestRepFrames(List& clusters, PairwiseMatrix const& pmatrix, Cframes const& sievedFrames) @@ -77,15 +88,8 @@ const } // DEBUG - if (debug_ > 0) { - for (List::cluster_iterator node = clusters.begin(); node != clusters.end(); ++node) - { - mprintf("DEBUG: Cluster %i best reps:\n", node->Num()); - for (Node::RepPairArray::const_iterator it = node->BestReps().begin(); - it != node->BestReps().end(); ++it) - mprintf("\t%i (%g)\n", it->second, it->first); - } - } + if (debug_ > 0) + PrintBestReps(clusters); return err; } @@ -98,52 +102,52 @@ int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(Node& node, const { int err = 0; - //node.Cent()->Print("centroid." + integerToString(node.Num())); // DEBUG - //CpptrajFile tmp; // DEBUG - //tmp.OpenWrite("c"+integerToString(node.Num())+".bestRep.dat"); // DEBUG - // Handle special cases - if (node.Nframes() == 1) { - node.BestReps().clear(); - if (debug_ > 0) - mprintf("DEBUG: Only 1 frame, best rep: %i\n", node.ClusterFrame(0)); - // Only one frame. That is the best rep. - node.BestReps().push_back( RepPair(node.ClusterFrame(0), 0.0) ); - } else if (node.Nframes() == 2) { - node.BestReps().clear(); - if (debug_ > 0) - mprintf("DEBUG: 2 frames %i and %i, using former as best rep.\n", node.ClusterFrame(0), node.ClusterFrame(1)); - // Two frames, distance from f1 to f2 same as f2 to f1. Take f1 by convention. - node.BestReps().push_back( RepPair(node.ClusterFrame(0), - pmatrix.Frame_Distance(node.ClusterFrame(0), node.ClusterFrame(1))) ); - } else { - // Find cumulative distance of each frame to all other frames. - RepMap bestReps; - for (Node::frame_iterator f1 = node.beginframe(); - f1 != node.endframe(); ++f1) + //node.Cent()->Print("centroid." + integerToString(node.Num())); // DEBUG + //CpptrajFile tmp; // DEBUG + //tmp.OpenWrite("c"+integerToString(node.Num())+".bestRep.dat"); // DEBUG + // Handle special cases + if (node.Nframes() == 1) { + node.BestReps().clear(); + if (debug_ > 0) + mprintf("DEBUG: Only 1 frame, best rep: %i\n", node.ClusterFrame(0)); + // Only one frame. That is the best rep. + node.BestReps().push_back( RepPair(node.ClusterFrame(0), 0.0) ); + } else if (node.Nframes() == 2) { + node.BestReps().clear(); + if (debug_ > 0) + mprintf("DEBUG: 2 frames %i and %i, using former as best rep.\n", + node.ClusterFrame(0), node.ClusterFrame(1)); + // Two frames, distance from f1 to f2 same as f2 to f1. Take f1 by convention. + node.BestReps().push_back(RepPair(node.ClusterFrame(0), + pmatrix.Frame_Distance(node.ClusterFrame(0), node.ClusterFrame(1)))); + } else { + // Find cumulative distance of each frame to all other frames. + RepMap bestReps; + for (Node::frame_iterator f1 = node.beginframe(); f1 != node.endframe(); ++f1) + { + double cdist = 0.0; + for (Node::frame_iterator f2 = node.beginframe(); f2 != node.endframe(); ++f2) { - double cdist = 0.0; - for (Node::frame_iterator f2 = node.beginframe(); f2 != node.endframe(); ++f2) - { - if (f1 != f2) - cdist += pmatrix.Frame_Distance(*f1, *f2); - } - SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave_); - //tmp.Printf("%i %g %g\n", *f1+1, cdist, Cdist_->FrameCentroidDist(*f1, node.Cent())); - } - //tmp.CloseFile(); - if (bestReps.empty()) { - mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node.Num()); - err++; - } - SetBestRepFrame( node, bestReps ); - // DEBUG - if (debug_ > 0) { - mprintf("DEBUG: Best reps:\n"); - for (RepMap::const_iterator it = bestReps.begin(); it != bestReps.end(); ++it) - mprintf("\t%i (%20.10E)\n", it->second, it->first); + if (f1 != f2) + cdist += pmatrix.Frame_Distance(*f1, *f2); } + SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave_); + //tmp.Printf("%i %g %g\n", *f1+1, cdist, Cdist_->FrameCentroidDist(*f1, node.Cent())); } + //tmp.CloseFile(); + if (bestReps.empty()) { + mprinterr("Error: Could not determine represenative frame for cluster %i\n", + node.Num()); + err++; + } + SetBestRepFrame( node, bestReps ); + // DEBUG + if (debug_ > 0) { + mprintf("DEBUG: Best reps:\n"); + for (RepMap::const_iterator it = bestReps.begin(); it != bestReps.end(); ++it) + mprintf("\t%i (%20.10E)\n", it->second, it->first); + } + } return err; } @@ -151,7 +155,8 @@ const /** Find the frame in each cluster that is the best representative by * having the lowest cumulative distance to every other point in the cluster. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(List& clusters, PairwiseMatrix const& pmatrix) +int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(List& clusters, + PairwiseMatrix const& pmatrix) const { int err = 0; @@ -199,26 +204,26 @@ int Cpptraj::Cluster::BestReps:: const { int err = 0; - RepMap bestReps; - for (Node::frame_iterator f1 = node.beginframe(); f1 != node.endframe(); ++f1) - { - if (!sievedFrames.HasFrame( *f1 )) { - double cdist = 0.0; - for (Node::frame_iterator f2 = node.beginframe(); f2 != node.endframe(); ++f2) - { - if (f1 != f2 && !sievedFrames.HasFrame( *f2 )) - //cdist += pmatrix.Cache().CachedDistance(*f1, *f2); // TODO benchmark the two ways - cdist += pmatrix.Frame_Distance(*f1, *f2); - } - SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave_); + RepMap bestReps; + for (Node::frame_iterator f1 = node.beginframe(); f1 != node.endframe(); ++f1) + { + if (!sievedFrames.HasFrame( *f1 )) { + double cdist = 0.0; + for (Node::frame_iterator f2 = node.beginframe(); f2 != node.endframe(); ++f2) + { + if (f1 != f2 && !sievedFrames.HasFrame( *f2 )) + //cdist += pmatrix.Cache().CachedDistance(*f1, *f2); // TODO benchmark the two ways + cdist += pmatrix.Frame_Distance(*f1, *f2); } + SaveBestRep(bestReps, RepPair(cdist, *f1), nToSave_); } - if (bestReps.empty()) { - mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node.Num()); - err++; - } - SetBestRepFrame( node, bestReps ); + } + if (bestReps.empty()) { + mprinterr("Error: Could not determine represenative frame for cluster %i\n", + node.Num()); + err++; + } + SetBestRepFrame( node, bestReps ); return err; } @@ -243,32 +248,34 @@ const /** Find the frame in the node that is the best representative by * having the lowest distance to the cluster centroid. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(Node& node, PairwiseMatrix const& pmatrix) +int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(Node& node, + PairwiseMatrix const& pmatrix) const { int err = 0; - //mprintf("DEBUG: FindBestRepFrames_Centroid: Cluster %i\n", node.Num()); - RepMap bestReps; - //node.Cent()->Print("centroid." + integerToString(node.Num())); // DEBUG - for (Node::frame_iterator f1 = node.beginframe(); f1 != node.endframe(); ++f1) - { - double dist = pmatrix.MetricPtr()->FrameCentroidDist(*f1, node.Cent()); - //mprintf("\t%8i %10.4g %10.4g %i\n", *f1+1, dist, mindist, minframe+1); - SaveBestRep(bestReps, RepPair(dist, *f1), nToSave_); - } - if (bestReps.empty()) { - mprinterr("Error: Could not determine represenative frame for cluster %i\n", - node.Num()); - err++; - } - SetBestRepFrame( node, bestReps ); + //mprintf("DEBUG: FindBestRepFrames_Centroid: Cluster %i\n", node.Num()); + RepMap bestReps; + //node.Cent()->Print("centroid." + integerToString(node.Num())); // DEBUG + for (Node::frame_iterator f1 = node.beginframe(); f1 != node.endframe(); ++f1) + { + double dist = pmatrix.MetricPtr()->FrameCentroidDist(*f1, node.Cent()); + //mprintf("\t%8i %10.4g %10.4g %i\n", *f1+1, dist, mindist, minframe+1); + SaveBestRep(bestReps, RepPair(dist, *f1), nToSave_); + } + if (bestReps.empty()) { + mprinterr("Error: Could not determine represenative frame for cluster %i\n", + node.Num()); + err++; + } + SetBestRepFrame( node, bestReps ); return err; } /** Find the frame in each cluster that is the best representative by * having the lowest distance to the cluster centroid. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(List& clusters, PairwiseMatrix const& pmatrix) +int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(List& clusters, + PairwiseMatrix const& pmatrix) const { int err = 0; diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index c8252e6cd9..825db2d8cc 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -19,7 +19,12 @@ class BestReps { int InitBestReps(RepMethodType, int, int); /// Find best rep frames for each cluster in given list int FindBestRepFrames(List&, PairwiseMatrix const&, Cframes const&) const; + /// Find the best rep frames for given node + int FindBestRepFrames(Node&, PairwiseMatrix const&, Cframes const&) const; private: + /// Print best reps to stdout + static void PrintBestReps(List&); + /// Used to pair representative score with frame number. typedef std::pair RepPair; /// Used to hold pairs of representative scores to frames. From 118aafda9eba03911c4d875913bf73e082cd5783 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 14:33:30 -0400 Subject: [PATCH 305/417] Make print function take a node --- src/Cluster/BestReps.cpp | 19 +++++++++---------- src/Cluster/BestReps.h | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 700d61738e..60dbca1f56 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -53,14 +53,11 @@ int Cpptraj::Cluster::BestReps::InitBestReps(RepMethodType typeIn, int nToSaveIn } /** Print best reps to stdout. */ -void Cpptraj::Cluster::BestReps::PrintBestReps(List& clusters) { - for (List::cluster_iterator node = clusters.begin(); node != clusters.end(); ++node) - { - mprintf("DEBUG: Cluster %i best reps:\n", node->Num()); - for (Node::RepPairArray::const_iterator it = node->BestReps().begin(); - it != node->BestReps().end(); ++it) - mprintf("\t%i (%g)\n", it->second, it->first); - } +void Cpptraj::Cluster::BestReps::PrintBestReps(Node const& node) { + mprintf("DEBUG: Cluster %i best reps:\n", node.Num()); + for (Node::RepPairArray::const_iterator it = node.BestReps().begin(); + it != node.BestReps().end(); ++it) + mprintf("\t%i (%g)\n", it->second, it->first); } /** Find best representative frames for each cluster. */ @@ -88,8 +85,10 @@ const } // DEBUG - if (debug_ > 0) - PrintBestReps(clusters); + if (debug_ > 0) { + for (List::cluster_iterator node = clusters.begin(); node != clusters.end(); ++node) + PrintBestReps(*node); + } return err; } diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index 825db2d8cc..e06e24e28e 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -23,7 +23,7 @@ class BestReps { int FindBestRepFrames(Node&, PairwiseMatrix const&, Cframes const&) const; private: /// Print best reps to stdout - static void PrintBestReps(List&); + static void PrintBestReps(Node const&); /// Used to pair representative score with frame number. typedef std::pair RepPair; From 9df972753d6fa41a6ce9b390ea595b04930d54e9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 14:36:01 -0400 Subject: [PATCH 306/417] Best reps function for a node --- src/Cluster/BestReps.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 60dbca1f56..4132a6cb42 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -93,6 +93,37 @@ const return err; } +/** Find best representative frames for given node. */ +int Cpptraj::Cluster::BestReps::FindBestRepFrames(Node& node, PairwiseMatrix const& pmatrix, + Cframes const& sievedFrames) +const +{ + int err = 0; + switch (type_) { + case CUMULATIVE: + err = FindBestRepFrames_CumulativeDist(node, pmatrix); + break; + case CENTROID: + err = FindBestRepFrames_Centroid(node, pmatrix); + break; + case CUMULATIVE_NOSIEVE: + err = FindBestRepFrames_NoSieve_CumulativeDist(node, pmatrix, sievedFrames); + break; + case NO_REPS: + mprintf("Warning: Skipping best representative frame calc.\n"); + break; + default: + mprinterr("Internal Error: BestReps::FindBestRepFrames: Unhandled type.\n"); + err = 1; + } + + // DEBUG + if (debug_ > 0) + PrintBestReps(node); + + return err; +} + /** Find the frame(s) in the node that is best representative by * having the lowest cumulative distance to every other point in the cluster. */ From 185c2ebd9b40c5aa73abc32c883edfba724cf758 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 14:59:16 -0400 Subject: [PATCH 307/417] Add best rep frames output to summary by parts. --- src/Cluster/Control.cpp | 9 ++++++++- src/Cluster/Output.cpp | 33 ++++++++++++++++++++++++++++++++- src/Cluster/Output.h | 4 +++- src/Cluster/clusterdepend | 2 +- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 567db3b342..178d0ebfdd 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -1095,7 +1095,14 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { mprinterr("Error: Could not set up summary split file.\n"); return 1; } - Output::Summary_Part(outfile, metric_->Ntotal(), splitFrames_, clusters_); + BestReps findBestReps; + // TODO support > 1 best rep? + if (findBestReps.InitBestReps(bestRep_, 1, verbose_)) { + mprinterr("Error: Init of best reps calc for summary by parts failed.\n"); + return 1; + } + Output::Summary_Part(outfile, metric_->Ntotal(), splitFrames_, clusters_, + findBestReps, pmatrix_, frameSieve_.SievedOut()); } // Cluster number vs time diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index 7c1c39b3a4..e43d42592c 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -2,6 +2,7 @@ #include // sort, max #include "Output.h" #include "Algorithm.h" +#include "BestReps.h" #include "List.h" #include "Metric.h" #include "Node.h" @@ -289,7 +290,10 @@ int Cpptraj::Cluster::Output::Summary(CpptrajFile& outfile, List const& clusters void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, unsigned int clusterDataSetSize, Cframes const& splitFrames, - List const& clusters) + List const& clusters, + BestReps const& findBestReps, + PairwiseMatrix const& pmatrix, + Cframes const& framesToCluster) { // If no split frames were specified, use halfway point. Cframes actualSplitFrames; @@ -364,7 +368,12 @@ void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, if (nWidth < 8) nWidth = 8; outfile.Printf(" %*s %6s", nWidth, "Name", "RMS"); } + // Best reps header + for (unsigned int pm = 1; pm <= partMax.size(); ++pm) + outfile.Printf(" %7s%u", "Rep", pm); + // END HEADER outfile.Printf("\n"); + // LOOP OVER CLUSTERS int color = 1; // xmgrace color, 1-15 for (List::cluster_iterator node = clusters.begincluster(); @@ -375,6 +384,7 @@ void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, double frac = (double)numframes / fmax; std::fill( numInPart.begin(), numInPart.end(), 0 ); std::fill( firstFrame.begin(), firstFrame.end(), -1 ); + std::vector clusterPart(actualSplitFrames.size() + 1); // DEBUG //mprintf("\tCluster %i\n",node->num); // Count how many frames are in each part. @@ -392,6 +402,7 @@ void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, if (numInPart[ bin ] == 0) firstFrame[ bin ] = *frame1 - trajOffset[ bin ] + 1; ++numInPart[ bin ]; + clusterPart[bin].AddFrameToCluster(*frame1); } outfile.Printf("%-8i %8i %8.4f %2i %10s", node->Num(), numframes, frac, color, XMGRACE_COLOR[color]); @@ -405,6 +416,26 @@ void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, outfile.Printf(" %8i", *ff); if (nWidth > 0) outfile.Printf(" %*s %6.2f", nWidth, node->Cname().c_str(), node->RefRms()); + // Print best reps for each part. + // TODO handle case when clusters dont have same number best reps + for (std::vector::iterator node = clusterPart.begin(); + node != clusterPart.end(); ++node) + { + if (node->Nframes() == 0) { + outfile.Printf(" %8i", -1); + } else { + findBestReps.FindBestRepFrames(*node, pmatrix, framesToCluster); + // TODO handle multiple best reps? + //if (node->BestReps().size() < 2) + outfile.Printf(" %8i", node->BestRepFrame()+1); + //else { + // for (Node::RepPairArray::const_iterator rep = node->BestReps().begin(); + // rep != node->BestReps().end(); ++rep) + // outfile.Printf(" %8i %8.3f", rep->first+1, rep->second); + //} + } + } + // END LINE outfile.Printf("\n"); if (color<15) ++color; } diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h index 1731a15eb8..775dc617a3 100644 --- a/src/Cluster/Output.h +++ b/src/Cluster/Output.h @@ -8,6 +8,7 @@ class Cframes; class List; class Metric; class PairwiseMatrix; // TODO anything that needs this calcd outside here? +class BestReps; /// Cluster output routines. class Output { public: @@ -17,7 +18,8 @@ class Output { static int PrintSilhouettes(CpptrajFile&, List const&); static int Summary(CpptrajFile&, List const&, Algorithm const&, PairwiseMatrix const&, bool, bool, Cframes const&); - static void Summary_Part(CpptrajFile&, unsigned int, Cframes const&, List const&); + static void Summary_Part(CpptrajFile&, unsigned int, Cframes const&, List const&, + BestReps const&, PairwiseMatrix const&, Cframes const&); private: static unsigned int DetermineNameWidth(List const&); }; diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 08ad239d2e..33042704bd 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -19,7 +19,7 @@ Metric_Data_Manhattan.o : Metric_Data_Manhattan.cpp ../AssociatedData.h ../Cpptr Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_RMS.h Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_SRMSD.h Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Cframes.h Metric.h Node.h PairwiseMatrix.h -Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h +Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h PairwiseMatrix.o : PairwiseMatrix.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Metric.h PairwiseMatrix.h Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Cframes.h List.h Metric.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h From 4b1ea58bbe36782ab7fac87368a260470f84484c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 15:04:25 -0400 Subject: [PATCH 308/417] Ensure assignrefs output comes last --- src/Cluster/Output.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index e43d42592c..8e4b7b1fb4 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -362,15 +362,15 @@ void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, outfile.Printf(" %7s%u", "Frac", pm); for (unsigned int pm = 1; pm <= partMax.size(); ++pm) outfile.Printf(" %7s%u", "First", pm); + // Best reps header + for (unsigned int pm = 1; pm <= partMax.size(); ++pm) + outfile.Printf(" %7s%u", "Rep", pm); // Determine if cluster names will be output. unsigned int nWidth = DetermineNameWidth(clusters); if (nWidth > 0) { if (nWidth < 8) nWidth = 8; outfile.Printf(" %*s %6s", nWidth, "Name", "RMS"); } - // Best reps header - for (unsigned int pm = 1; pm <= partMax.size(); ++pm) - outfile.Printf(" %7s%u", "Rep", pm); // END HEADER outfile.Printf("\n"); @@ -414,8 +414,6 @@ void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, for (std::vector::const_iterator ff = firstFrame.begin(); ff != firstFrame.end(); ++ff) outfile.Printf(" %8i", *ff); - if (nWidth > 0) - outfile.Printf(" %*s %6.2f", nWidth, node->Cname().c_str(), node->RefRms()); // Print best reps for each part. // TODO handle case when clusters dont have same number best reps for (std::vector::iterator node = clusterPart.begin(); @@ -435,6 +433,9 @@ void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, //} } } + // Cluster name from assignrefs + if (nWidth > 0) + outfile.Printf(" %*s %6.2f", nWidth, node->Cname().c_str(), node->RefRms()); // END LINE outfile.Printf("\n"); if (color<15) ++color; From d0e12494475a4c2f9c791fd6599eddd62e719b8c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 15:08:50 -0400 Subject: [PATCH 309/417] Add info on how assignrefs output is written to summary/summarysplit files. Fix up description of summary/summarysplit. --- doc/cpptraj.lyx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 87104c9902..52559de6a2 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -41110,6 +41110,9 @@ Stdev Standard deviation of points in the cluster. \begin_layout Description Centroid Frame # of structure in cluster that has the lowest cumulative distance to every other point. + If multiple representatives are being saved this column is replaced with + two columns for each representative, 'Rep' (representative frame #) and + 'RepScore' (score according to current best representative metric). \end_layout \begin_layout Description @@ -41190,7 +41193,8 @@ Where is the number of clusters, is the number of frames clustered, portions of the trajectory specified by splitframe with format '#Cluster Total Frac C# Color NumInX ... FracX ... - FirstX': + FirstX ... + RepX': \begin_inset Separator latexpar \end_inset @@ -41231,6 +41235,11 @@ FirstX Frame in the Xth portion of the trajectory where the cluster is first observed. \end_layout +\begin_layout Description +RepX Best representative frame in the Xth portion of the trajectory for + that cluster. +\end_layout + \end_deeper \begin_layout Description [splitframe @@ -41435,8 +41444,18 @@ summary \series bold summarysplit \series default -, assign clusters to loaded representative structures if RMSD to that reference +, assign clusters to loaded reference structures if RMSD to that reference is less than specified cutoff. + This will be printed in +\series bold +summary +\series default + and +\series bold +summarysplit +\series default + files as 2 extra columns: 'Name' (reference name) and 'RMS' (RMS to cluster + centroid). \end_layout \begin_deeper From 5585a6b93a43df8e8e90d56073f1394a79fe65fb Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 15:21:55 -0400 Subject: [PATCH 310/417] Add blurb about SSR/SST --- doc/cpptraj.lyx | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 52559de6a2..7bac4b996a 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -41154,6 +41154,10 @@ AvgCDist Average distance of this cluster to every other cluster. \begin_inset Newline newline \end_inset +#SSR/SST: +\begin_inset Newline newline +\end_inset + #Algorithm: \begin_inset Newline newline \end_inset @@ -41173,8 +41177,8 @@ AvgCDist Average distance of this cluster to every other cluster. Where is the number of clusters, is the number of frames clustered, ranges from 0 to -1, is the average distance of all frames in that cluster to the centroid, is the Davies-Bouldin Index, - is the pseudo-F statistic, and contains the - frame # of the representative frame (i.e. + is the pseudo-F statistic, is the SSR/SST ratio, and contains the frame # of the representative frame (i.e. closest to the centroid) for each cluster. Each cluster has a line made up of characters (one for each frame) where '.' means 'not in cluster' and 'X' means 'in cluster'. @@ -41633,6 +41637,26 @@ Higher values of pseudo-F are good \end_layout +\begin_layout Standard +The SSR/SST is the ratio of the sum of squares regression (SSR or between + sum of squares) and the total sum of squares (SST). + The SSR is calculated via the sum of the squared distances of all points + within a given cluster to its centroid, and summed together for all clusters. + The total sum of squares is the sum of squared distances for all frames + to the overall mean. + The ratio lies between 0 and 1 and is supposed to give the fraction of + explained variance by the data. + The ratio should increase with cluster count. + +\series bold +There should be a point at which adding more clusters does not substantially + increase SSR/SST +\series default +, i.e. + the point where increasing the cluster count does not add new information + and should not increase further. +\end_layout + \begin_layout Standard The cluster silhouette is a measure of how well each point fits within a cluster. From 82658985c78b3278658e3bc648cfb1daca4bf034 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 10 Sep 2021 15:25:15 -0400 Subject: [PATCH 311/417] Summary by parts now has best rep output --- test/Test_Cluster_Sieve/nosieve.half.dat.save | 12 ++++++------ test/Test_Cluster_Sieve/random.half.dat.save | 12 ++++++------ test/Test_Cluster_Sieve/sieve5.half.dat.save | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/Test_Cluster_Sieve/nosieve.half.dat.save b/test/Test_Cluster_Sieve/nosieve.half.dat.save index 3e3c25322f..ad57d74403 100644 --- a/test/Test_Cluster_Sieve/nosieve.half.dat.save +++ b/test/Test_Cluster_Sieve/nosieve.half.dat.save @@ -1,8 +1,8 @@ # 1st <= 24 < 2nd # 1st= 24 2nd= 77 -#Cluster Total Frac C# Color NumIn1st NumIn2nd Frac1 Frac2 First1 First2 -0 49 0.4851 1 black 10 39 0.4167 0.5065 15 1 -1 24 0.2376 2 red 0 24 0.0000 0.3117 -1 54 -2 14 0.1386 3 green 0 14 0.0000 0.1818 -1 40 -3 12 0.1188 4 blue 12 0 0.5000 0.0000 3 -1 -4 2 0.0198 5 yellow 2 0 0.0833 0.0000 1 -1 +#Cluster Total Frac C# Color NumIn1st NumIn2nd Frac1 Frac2 First1 First2 Rep1 Rep2 +0 49 0.4851 1 black 10 39 0.4167 0.5065 15 1 24 32 +1 24 0.2376 2 red 0 24 0.0000 0.3117 -1 54 -1 101 +2 14 0.1386 3 green 0 14 0.0000 0.1818 -1 40 -1 76 +3 12 0.1188 4 blue 12 0 0.5000 0.0000 3 -1 12 -1 +4 2 0.0198 5 yellow 2 0 0.0833 0.0000 1 -1 1 -1 diff --git a/test/Test_Cluster_Sieve/random.half.dat.save b/test/Test_Cluster_Sieve/random.half.dat.save index e4fb584ce1..2841f617bc 100644 --- a/test/Test_Cluster_Sieve/random.half.dat.save +++ b/test/Test_Cluster_Sieve/random.half.dat.save @@ -1,8 +1,8 @@ # 1st <= 24 < 2nd # 1st= 24 2nd= 77 -#Cluster Total Frac C# Color NumIn1st NumIn2nd Frac1 Frac2 First1 First2 -0 51 0.5050 1 black 11 40 0.4583 0.5195 14 1 -1 24 0.2376 2 red 0 24 0.0000 0.3117 -1 54 -2 13 0.1287 3 green 0 13 0.0000 0.1688 -1 41 -3 11 0.1089 4 blue 11 0 0.4583 0.0000 3 -1 -4 2 0.0198 5 yellow 2 0 0.0833 0.0000 1 -1 +#Cluster Total Frac C# Color NumIn1st NumIn2nd Frac1 Frac2 First1 First2 Rep1 Rep2 +0 51 0.5050 1 black 11 40 0.4583 0.5195 14 1 24 32 +1 24 0.2376 2 red 0 24 0.0000 0.3117 -1 54 -1 101 +2 13 0.1287 3 green 0 13 0.0000 0.1688 -1 41 -1 76 +3 11 0.1089 4 blue 11 0 0.4583 0.0000 3 -1 12 -1 +4 2 0.0198 5 yellow 2 0 0.0833 0.0000 1 -1 1 -1 diff --git a/test/Test_Cluster_Sieve/sieve5.half.dat.save b/test/Test_Cluster_Sieve/sieve5.half.dat.save index fa92ee85cb..aa6dbb9d9a 100644 --- a/test/Test_Cluster_Sieve/sieve5.half.dat.save +++ b/test/Test_Cluster_Sieve/sieve5.half.dat.save @@ -1,8 +1,8 @@ # 1st <= 24 < 2nd # 1st= 24 2nd= 77 -#Cluster Total Frac C# Color NumIn1st NumIn2nd Frac1 Frac2 First1 First2 -0 50 0.4950 1 black 11 39 0.4583 0.5065 14 1 -1 24 0.2376 2 red 0 24 0.0000 0.3117 -1 54 -2 14 0.1386 3 green 0 14 0.0000 0.1818 -1 40 -3 11 0.1089 4 blue 11 0 0.4583 0.0000 3 -1 -4 2 0.0198 5 yellow 2 0 0.0833 0.0000 1 -1 +#Cluster Total Frac C# Color NumIn1st NumIn2nd Frac1 Frac2 First1 First2 Rep1 Rep2 +0 50 0.4950 1 black 11 39 0.4583 0.5065 14 1 24 32 +1 24 0.2376 2 red 0 24 0.0000 0.3117 -1 54 -1 101 +2 14 0.1386 3 green 0 14 0.0000 0.1818 -1 40 -1 76 +3 11 0.1089 4 blue 11 0 0.4583 0.0000 3 -1 12 -1 +4 2 0.0198 5 yellow 2 0 0.0833 0.0000 1 -1 1 -1 From de8db65915915f2727b5ec724de41a7679da5535 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 09:50:50 -0400 Subject: [PATCH 312/417] Update CMakeLists.txt with most recent versions from Amber gitlab --- CMakeLists.txt | 4 +- src/CMakeLists.txt | 128 ++++++++++++++++++++++++++++---------------- test/CMakeLists.txt | 14 ++--- 3 files changed, 91 insertions(+), 55 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index daaaee0b8a..4f6231b2f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,10 +49,12 @@ if(NOT INSIDE_AMBER) set(BUNDLE_SIGNATURE CPTJ) include(Packaging) - # header installation option + # build options option(INSTALL_HEADERS "Copy headers to the include/cpptraj folder of the install directory. Useful for building with pytraj." FALSE) option(BUILD_PARALLEL_COMBINATIONS "If true, then combinations of all enabled parallelizations will be built, e.g. cpptraj.OMP.MPI and cpptraj.OMP.MPI.cuda" FALSE) + + option(INSTALL_TESTS "Copy tests to the test/ folder of the install directory" FALSE) else() set(INSTALL_HEADERS FALSE) set(BUILD_PARALLEL_COMBINATIONS FALSE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f0c96cf167..ee85103247 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,32 +18,35 @@ foreach(LINE ${CPPTRAJFILES_CONTENTS}) if(NOT "${LINE}" MATCHES "^#") # extract the name of the source file mentioned in the line (a string after whitespace or an equals sign) - string(REGEX MATCH "[^ :=]+\.(cpp|c|LIBCPPTRAJ\.o)" SOURCE_FILE_NAME "${LINE}") - + string(REGEX MATCH "[^ :=]+\.(o|cpp|c|LIBCPPTRAJ\.o)" SOURCE_FILE_NAME "${LINE}") + # get name of variable that the following list is being set to # must exclude parentheses so that we don't match dereferences of other variables string(REGEX MATCH "[^$\(\)]+=" VARIABLE_NAME "${LINE}") - + # if we are starting a new source list, update LIST_NAME accordingly if(NOT "${VARIABLE_NAME}" STREQUAL "") string(REPLACE "=" "" VARIABLE_NAME "${VARIABLE_NAME}") set(LIST_NAME ${VARIABLE_NAME}) endif() - + # did we get a new source file? if(NOT "${SOURCE_FILE_NAME}" STREQUAL "") - + if("${LIST_NAME}" STREQUAL "") message(FATAL_ERROR "cpptrajfiles parser error: got source files before any source lists!") endif() - + # get rid of LIBCPPTRAJ.o suffix if it exists string(REPLACE "LIBCPPTRAJ.o" "cpp" SOURCE_FILE_NAME "${SOURCE_FILE_NAME}") + + # also convert .o to .cpp (used in some variables) + string(REPLACE ".o" ".cpp" SOURCE_FILE_NAME "${SOURCE_FILE_NAME}") - + list(APPEND ${LIST_NAME} ${SOURCE_FILE_NAME}) endif() - + #message("\"${LINE}\" - SFN: \"${SOURCE_FILE_NAME}\" - VN: \"${VARIABLE_NAME}\"") endif() endforeach() @@ -52,20 +55,35 @@ endforeach() # COMMON_SOURCES - all C++ source files used for both cpptraj and libcpptraj, that are compiled the same way for both # CSOURCES - all C source files used for cpptraj and libcpptraj # SOURCES - C++ sources for cpptraj only -# LIBCPPTRAJ_OBJECTS - C++ sources for libcpptraj that should be compiled with the LIBCPPTRAJ definition +# LIBCPPTRAJ_OBJECTS - C++ sources for libcpptraj that should be compiled with the LIBCPPTRAJ definition +# LIBCPPTRAJ_CORE_OBJECTS - C++ sources which contain "core" functionality. +# LIBCPPTRAJ_FILE_OBJECTS - C++ sources which contain basic file-related functionality. Requires core library +# LIBCPPTRAJ_TRAJ_OBJECTS - C++ sources which contain trajectory file functionality. Requires core and file libraries, as well as libxdrfile. +# LIBCPPTRAJ_PARM_OBJECTS - C++ sources which contain parameter file functionality. Requires core and file libraries. # pub_fft.F90 is not in the source lists set(PUBFFT_FORTRAN_SOURCE pub_fft.F90) #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# with icc, cpptraj needs -fp-model source in order to produce floating point results that match gcc +set(FP_SOURCE_FLAG "") +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + check_cxx_compiler_flag("-fp-model source" FP_MODEL_SOURCE_WORKS) + + if(FP_MODEL_SOURCE_WORKS) + set(FP_SOURCE_FLAG "-fp-model source") + endif() +endif() + +# all sources should use optimized compile flags set_property(SOURCE ${PUBFFT_FORTRAN_SOURCE} PROPERTY COMPILE_FLAGS "${OPT_FFLAGS_SPC}") -set_property(SOURCE ${COMMON_SOURCES} ${SOURCES} ${LIBCPPTRAJ_OBJECTS} PROPERTY COMPILE_FLAGS "${OPT_CXXFLAGS_SPC}") +set_property(SOURCE ${COMMON_SOURCES} ${SOURCES} ${LIBCPPTRAJ_OBJECTS} PROPERTY COMPILE_FLAGS "${OPT_CXXFLAGS_SPC} ${FP_SOURCE_FLAG}") set_property(SOURCE ${CSOURCES} PROPERTY COMPILE_FLAGS "${OPT_CFLAGS_SPC}") include_directories(${AMBERTOOLS_INC_DIR}) -if(fftw_ENABLED) +if(fftw_ENABLED) set_property(SOURCE PubFFT.cpp PROPERTY COMPILE_DEFINITIONS FFTW_FFT) endif() @@ -89,13 +107,13 @@ make_pic_if_needed(cpptraj_common_obj) # it turns out that CMake's cuda library passes the include paths after the first one from each of these generator expressions to nvcc without the -I flag # This causes the error "A single input file is required for a non-link phase when an outputfile is specified" target_include_directories(cpptraj_common_obj PRIVATE $ $) - + #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- # cpptraj executable add_executable(cpptraj $ ${SOURCES}) -target_link_libraries(cpptraj netcdf netlib) +target_link_libraries(cpptraj netcdf netlib xdrfile) install(TARGETS cpptraj DESTINATION ${BINDIR}) #------------------------------------------------------------------------------------------ @@ -104,13 +122,31 @@ install(TARGETS cpptraj DESTINATION ${BINDIR}) add_library(libcpptraj $ ${LIBCPPTRAJ_OBJECTS}) set_property(TARGET libcpptraj PROPERTY COMPILE_DEFINITIONS LIBCPPTRAJ) -target_link_libraries(libcpptraj netcdf netlib) +target_link_libraries(libcpptraj netlib netcdf xdrfile) remove_prefix(libcpptraj) install_libraries(libcpptraj) #tell others where to find the cpptraj includes target_include_directories(libcpptraj INTERFACE .) +#------------------------------------------------------------------------------------------ +# Static libraries +# (not installed, used by other targets inside Amber which only need a subset of cpptraj functionality) +add_library(cpptraj_core STATIC ${LIBCPPTRAJ_CORE_OBJECTS}) +add_library(cpptraj_file STATIC ${LIBCPPTRAJ_FILE_OBJECTS}) +add_library(cpptraj_traj STATIC ${LIBCPPTRAJ_TRAJ_OBJECTS}) +add_library(cpptraj_parm STATIC ${LIBCPPTRAJ_PARM_OBJECTS}) + +# all libraries include the current dir as an interface directory +targets_include_directories(cpptraj_core cpptraj_file cpptraj_traj cpptraj_parm DIRECTORIES INTERFACE .) + +# cpptraj_traj needs xdrfile and netcdf +target_include_directories(cpptraj_traj PRIVATE $ $) +target_link_libraries(cpptraj_traj xdrfile netcdf) + +# all libs need netlib +targets_link_libraries(cpptraj_core cpptraj_file cpptraj_traj cpptraj_parm LIBRARIES netlib) + #------------------------------------------------------------------------------------------ # DLL exports/imports @@ -130,13 +166,13 @@ if(INSTALL_HEADERS) # grab all .h files from the main directory. file(GLOB CPPTRAJ_HEADERS "*.h") list(REMOVE_ITEM CPPTRAJ_HEADERS "SymbolExporting.h") - + # also grab xdrfile headers since some of them are used by cpptraj headers file(GLOB XDRFILE_HEADERS "xdrfile/*.h") install(FILES ${CPPTRAJ_HEADERS} DESTINATION ${INCDIR}/cpptraj) install(FILES ${XDRFILE_HEADERS} DESTINATION ${INCDIR}/cpptraj/xdrfile) - + # configure SymbolExporting.h specially for the current install type if(SHARED) set(CPPTRAJ_IS_SHARED 1) @@ -144,9 +180,9 @@ if(INSTALL_HEADERS) set(CPPTRAJ_IS_SHARED 0) endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SymbolExporting-installversion.h.in ${CMAKE_CURRENT_BINARY_DIR}/SymbolExporting-installversion.h @ONLY) - + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SymbolExporting-installversion.h DESTINATION ${INCDIR}/cpptraj RENAME SymbolExporting.h) - + endif() #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -159,17 +195,17 @@ endif() if(libbz2_ENABLED) add_definitions(-DHASBZ2) include_directories(${BZIP2_INCLUDE_DIR}) - targets_link_libraries(cpptraj libcpptraj LIBRARIES bzip2) + targets_link_libraries(cpptraj cpptraj_file libcpptraj LIBRARIES BZip2::BZip2) endif() if(zlib_ENABLED) add_definitions(-DHASGZ) include_directories(${ZLIB_INCLUDE_DIRS}) - targets_link_libraries(cpptraj libcpptraj LIBRARIES ${ZLIB_LIBRARIES}) + targets_link_libraries(cpptraj cpptraj_file libcpptraj LIBRARIES ZLIB::ZLIB) endif() if(fftw_ENABLED) - target_include_directories(cpptraj_common_obj PRIVATE $) + target_include_directories(cpptraj_common_obj PRIVATE $) targets_link_libraries(cpptraj libcpptraj LIBRARIES fftw) endif() @@ -181,8 +217,11 @@ else() target_compile_definitions(libcpptraj PRIVATE NO_READLINE) endif() -#xdrfile -targets_link_libraries(cpptraj libcpptraj LIBRARIES xdrfile) +if(tng_io_ENABLED) + add_definitions(-DHAS_TNGFILE) + include_directories($) + targets_link_libraries(cpptraj cpptraj_file libcpptraj LIBRARIES tng_io) +endif() # libsander if(INSIDE_AMBER AND ("${AMBER_TOOLS}" MATCHES "sander" AND BUILD_SANDER_API)) @@ -191,7 +230,6 @@ if(INSIDE_AMBER AND ("${AMBER_TOOLS}" MATCHES "sander" AND BUILD_SANDER_API)) target_link_libraries(cpptraj libsander) endif() - # arpack if(arpack_DISABLED) add_definitions(-DNO_ARPACK) @@ -205,13 +243,13 @@ if(MPI) make_mpi_version(cpptraj_common_obj cpptraj_common_obj_mpi LANGUAGES CXX) make_mpi_version(cpptraj cpptraj.MPI LANGUAGES CXX SWAP_SOURCES $ TO $ INSTALL) make_mpi_version(libcpptraj libcpptraj_mpi LANGUAGES CXX SWAP_SOURCES $ TO $ INSTALL) - + set_property(TARGET cpptraj.MPI libcpptraj_mpi cpptraj_common_obj_mpi APPEND PROPERTY COMPILE_DEFINITIONS MPI) # since we use CXX mpi, we have to define this manually - + if(pnetcdf_ENABLED) targets_link_libraries(cpptraj.MPI libcpptraj_mpi LIBRARIES pnetcdf) target_include_directories(cpptraj_common_obj_mpi PUBLIC $) - set_property(TARGET cpptraj.MPI libcpptraj_mpi cpptraj_common_obj_mpi APPEND PROPERTY COMPILE_DEFINITIONS HAS_PNETCDF) + set_property(TARGET cpptraj.MPI libcpptraj_mpi cpptraj_common_obj_mpi APPEND PROPERTY COMPILE_DEFINITIONS HAS_PNETCDF) endif() endif() @@ -226,43 +264,37 @@ if(BUILD_PARALLEL_COMBINATIONS AND (MPI AND OPENMP)) make_openmp_version(cpptraj.MPI cpptraj.MPI.OMP LANGUAGES CXX SWAP_SOURCES $ TO $ INSTALL) make_openmp_version(libcpptraj_mpi libcpptraj_mpi_omp LANGUAGES CXX SWAP_SOURCES $ TO $ INSTALL) endif() - + # CUDA if(CUDA) - if(HIP) - # TODO: Replace __HIP_PLATFORM_HCC__ after 4.1 rocm release - add_compile_definitions(__HIP_PLATFORM_HCC__) - add_compile_options(-fPIC) - include_directories(${CUDA_TOOLKIT_ROOT_DIR}/include) - endif() add_subdirectory(cuda_kernels) - + include_directories(${CUDA_INCLUDE_DIRS}) - + copy_target(cpptraj_common_obj cpptraj_common_obj_cuda) target_compile_definitions(cpptraj_common_obj_cuda PRIVATE CUDA) - + copy_target(cpptraj cpptraj.cuda SWAP_SOURCES $ TO $) copy_target(libcpptraj libcpptraj_cuda SWAP_SOURCES $ TO $) - + target_compile_definitions(cpptraj.cuda PRIVATE CUDA) target_compile_definitions(libcpptraj_cuda PRIVATE CUDA) - + targets_link_libraries(cpptraj.cuda libcpptraj_cuda LIBRARIES cpptraj_cuda_routines) - + install(TARGETS cpptraj.cuda DESTINATION ${BINDIR} COMPONENT CUDA) - + if(BUILD_PARALLEL_COMBINATIONS AND MPI) make_mpi_version(cpptraj_common_obj_cuda cpptraj_common_obj_mpi_cuda LANGUAGES CXX) make_mpi_version(cpptraj.cuda cpptraj.MPI.cuda LANGUAGES CXX SWAP_SOURCES $ TO $ INSTALL) make_mpi_version(libcpptraj_cuda libcpptraj_mpi_cuda LANGUAGES CXX SWAP_SOURCES $ TO $ INSTALL) - + set_property(TARGET cpptraj.MPI.cuda libcpptraj_mpi_cuda cpptraj_common_obj_mpi_cuda APPEND PROPERTY COMPILE_DEFINITIONS MPI) # since we use CXX mpi, we have to define this manually - + if(pnetcdf_ENABLED) targets_link_libraries(cpptraj.MPI.cuda libcpptraj_mpi_cuda LIBRARIES pnetcdf) target_include_directories(cpptraj_common_obj_mpi_cuda PUBLIC $) - set_property(TARGET cpptraj.MPI.cuda libcpptraj_mpi_cuda cpptraj_common_obj_mpi_cuda APPEND PROPERTY COMPILE_DEFINITIONS HAS_PNETCDF) + set_property(TARGET cpptraj.MPI.cuda libcpptraj_mpi_cuda cpptraj_common_obj_mpi_cuda APPEND PROPERTY COMPILE_DEFINITIONS HAS_PNETCDF) endif() endif() @@ -278,7 +310,9 @@ if(CUDA) make_openmp_version(cpptraj.MPI.cuda cpptraj.MPI.OMP.cuda LANGUAGES CXX SWAP_SOURCES $ TO $ INSTALL) make_openmp_version(libcpptraj_mpi_cuda libcpptraj_mpi_omp_cuda LANGUAGES CXX SWAP_SOURCES $ TO $ INSTALL) endif() - - - + + + endif() + + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f87cbfea32..a508465422 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,11 +1,11 @@ -if(INSTALL_TESTS) - if(INSIDE_AMBER) - - # install to full path inside AmberTools directory - install(DIRECTORY . USE_SOURCE_PERMISSIONS DESTINATION AmberTools/src/cpptraj/test/ COMPONENT Tests) - else() +if(INSIDE_AMBER) + + # install to full path inside AmberTools directory + install(DIRECTORY . USE_SOURCE_PERMISSIONS DESTINATION AmberTools/src/cpptraj/test/ COMPONENT Tests ${TESTS_EXCLUDE_OPTION}) +else() + if(INSTALL_TESTS) # install to top-level dir install(DIRECTORY . USE_SOURCE_PERMISSIONS DESTINATION test/ COMPONENT Tests) endif() -endif() \ No newline at end of file +endif() From e0c6d3e6507db65a07605702ca5393303b5253df Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 09:57:21 -0400 Subject: [PATCH 313/417] Add file that can be used to test cmake --- devtools/RunCmake.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 devtools/RunCmake.sh diff --git a/devtools/RunCmake.sh b/devtools/RunCmake.sh new file mode 100755 index 0000000000..1387971436 --- /dev/null +++ b/devtools/RunCmake.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Can be used to test the cmake install. +# Assumes 'git submodule update --init --recursive' has been run in top dir. + +if [ -z "$CPPTRAJHOME" ] ; then + echo "CPPTRAJHOME must be set." + exit 1 +fi + +HOME=$CPPTRAJHOME +#export BUILD_FLAGS="-DOPENMP=TRUE" +#export BUILD_FLAGS="-DMPI=TRUE ${BUILD_FLAGS}" +#-DNetCDF_LIBRARIES_C=$HOME/lib/libnetcdf.so -DNetCDF_INCLUDES=$HOME/include +installdir=$HOME/install +COMPILER=gnu +cmake .. $BUILD_FLAGS -DCOMPILER=${COMPILER^^} -DINSTALL_HEADERS=FALSE \ + -DCMAKE_INSTALL_PREFIX=$installdir -DCMAKE_LIBRARY_PATH=$HOME/lib \ + -DPRINT_PACKAGING_REPORT=TRUE + From d6109daf9f768f6de499bfc45df6c221ec2dd115 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 09:58:49 -0400 Subject: [PATCH 314/417] Ensure installdir is created --- devtools/RunCmake.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/devtools/RunCmake.sh b/devtools/RunCmake.sh index 1387971436..97d00b4ca2 100755 --- a/devtools/RunCmake.sh +++ b/devtools/RunCmake.sh @@ -7,12 +7,16 @@ if [ -z "$CPPTRAJHOME" ] ; then echo "CPPTRAJHOME must be set." exit 1 fi - HOME=$CPPTRAJHOME + +installdir=$HOME/install +if [ ! -d "$installdir" ] ; then + mkdir $installdir +fi + #export BUILD_FLAGS="-DOPENMP=TRUE" #export BUILD_FLAGS="-DMPI=TRUE ${BUILD_FLAGS}" #-DNetCDF_LIBRARIES_C=$HOME/lib/libnetcdf.so -DNetCDF_INCLUDES=$HOME/include -installdir=$HOME/install COMPILER=gnu cmake .. $BUILD_FLAGS -DCOMPILER=${COMPILER^^} -DINSTALL_HEADERS=FALSE \ -DCMAKE_INSTALL_PREFIX=$installdir -DCMAKE_LIBRARY_PATH=$HOME/lib \ From 5a21c4f578df5def49ed9035d317b444b0dcf33c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 10:01:14 -0400 Subject: [PATCH 315/417] targets_include_directories is missing in the cmake submodule --- src/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee85103247..a80c1688f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -138,7 +138,8 @@ add_library(cpptraj_traj STATIC ${LIBCPPTRAJ_TRAJ_OBJECTS}) add_library(cpptraj_parm STATIC ${LIBCPPTRAJ_PARM_OBJECTS}) # all libraries include the current dir as an interface directory -targets_include_directories(cpptraj_core cpptraj_file cpptraj_traj cpptraj_parm DIRECTORIES INTERFACE .) +# FIXME DISABLED UNTIL CMAKE SUBMODULE UPDATED +#targets_include_directories(cpptraj_core cpptraj_file cpptraj_traj cpptraj_parm DIRECTORIES INTERFACE .) # cpptraj_traj needs xdrfile and netcdf target_include_directories(cpptraj_traj PRIVATE $ $) From d51b1b85fc2e4cf14b68747978a033a701ee635c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 10:05:07 -0400 Subject: [PATCH 316/417] Start trying to add cmake file for cluster subdir --- src/Cluster/CMakeLists.txt | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/Cluster/CMakeLists.txt diff --git a/src/Cluster/CMakeLists.txt b/src/Cluster/CMakeLists.txt new file mode 100644 index 0000000000..36b984c57f --- /dev/null +++ b/src/Cluster/CMakeLists.txt @@ -0,0 +1,41 @@ +#CMake buildfile for CPPTRAJ Cluster subdirectory. +set(CLUSTER_SOURCES + Algorithm_DBscan.cpp + Algorithm_DPeaks.cpp + Algorithm_HierAgglo.cpp + Algorithm_Kmeans.cpp + BestReps.cpp + Centroid_Coord.cpp + Cframes.cpp + Cmatrix_Binary.cpp + Cmatrix_NC.cpp + Control.cpp + DrawGraph.cpp + DynamicMatrix.cpp + List.cpp + Metric_Data.cpp + Metric_Data_Euclid.cpp + Metric_Data_Manhattan.cpp + Metric_DME.cpp + Metric_RMS.cpp + Metric_SRMSD.cpp + Node.cpp + Output.cpp + PairwiseMatrix.cpp + Results_Coords.cpp + Sieve.cpp +) + +#------------------------------------------------------------------------------------------ +#I assume that this library should be optimized +add_compile_options(${OPT_CFLAGS}) + +#if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") +# # xdrfile is not set up to build as a Windows shared library. Someone would need to add dll exports to all of the symbols (bluh) +# add_library(xdrfile STATIC ${CLUSTER_SOURCES}) +#else() + add_library(Cluster ${CLUSTER_SOURCES}) +#endif() + +target_include_directories(Cluster PUBLIC .) +install_libraries(Cluster) From fd05288e0ebe6885ede6f5a2a5d41801eb2f9b02 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 11:03:43 -0400 Subject: [PATCH 317/417] Rename library to cpptraj_cluster to be consistent with make. Add missing source. Make static, add pic flag if needed. --- src/CMakeLists.txt | 5 +++-- src/Cluster/CMakeLists.txt | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a80c1688f6..4ea0003057 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(xdrfile) +add_subdirectory(Cluster) #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Parse cpptrajfiles @@ -113,7 +114,7 @@ target_include_directories(cpptraj_common_obj PRIVATE $ ${SOURCES}) -target_link_libraries(cpptraj netcdf netlib xdrfile) +target_link_libraries(cpptraj netcdf netlib xdrfile cpptraj_cluster) install(TARGETS cpptraj DESTINATION ${BINDIR}) #------------------------------------------------------------------------------------------ @@ -122,7 +123,7 @@ install(TARGETS cpptraj DESTINATION ${BINDIR}) add_library(libcpptraj $ ${LIBCPPTRAJ_OBJECTS}) set_property(TARGET libcpptraj PROPERTY COMPILE_DEFINITIONS LIBCPPTRAJ) -target_link_libraries(libcpptraj netlib netcdf xdrfile) +target_link_libraries(libcpptraj netlib netcdf xdrfile cpptraj_cluster) remove_prefix(libcpptraj) install_libraries(libcpptraj) diff --git a/src/Cluster/CMakeLists.txt b/src/Cluster/CMakeLists.txt index 36b984c57f..fa6c329176 100644 --- a/src/Cluster/CMakeLists.txt +++ b/src/Cluster/CMakeLists.txt @@ -1,5 +1,6 @@ #CMake buildfile for CPPTRAJ Cluster subdirectory. set(CLUSTER_SOURCES + Algorithm.cpp Algorithm_DBscan.cpp Algorithm_DPeaks.cpp Algorithm_HierAgglo.cpp @@ -28,14 +29,16 @@ set(CLUSTER_SOURCES #------------------------------------------------------------------------------------------ #I assume that this library should be optimized -add_compile_options(${OPT_CFLAGS}) +#add_compile_options(${OPT_CXXFLAGS_SPC}) +set_property(SOURCE ${CLUSTER_SOURCES} PROPERTY COMPILE_FLAGS "${OPT_CXXFLAGS_SPC}") #if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") # # xdrfile is not set up to build as a Windows shared library. Someone would need to add dll exports to all of the symbols (bluh) # add_library(xdrfile STATIC ${CLUSTER_SOURCES}) #else() - add_library(Cluster ${CLUSTER_SOURCES}) + add_library(cpptraj_cluster STATIC ${CLUSTER_SOURCES}) + make_pic_if_needed(cpptraj_cluster) #endif() -target_include_directories(Cluster PUBLIC .) -install_libraries(Cluster) +target_include_directories(cpptraj_cluster PUBLIC .) +install_libraries(cpptraj_cluster) From 1733778dead1b0c824df930aed9f1d4efc46da9d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 09:40:00 -0600 Subject: [PATCH 318/417] libcpptraj_cluster needs netcdf includes --- src/Cluster/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/CMakeLists.txt b/src/Cluster/CMakeLists.txt index fa6c329176..4ae3aa584a 100644 --- a/src/Cluster/CMakeLists.txt +++ b/src/Cluster/CMakeLists.txt @@ -40,5 +40,5 @@ set_property(SOURCE ${CLUSTER_SOURCES} PROPERTY COMPILE_FLAGS "${OPT_CXXFLAGS_SP make_pic_if_needed(cpptraj_cluster) #endif() -target_include_directories(cpptraj_cluster PUBLIC .) +target_include_directories(cpptraj_cluster PUBLIC . PRIVATE $) install_libraries(cpptraj_cluster) From 80f1b0d504c39b472bd5896ed0b0a18e980b8e62 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 13:46:59 -0400 Subject: [PATCH 319/417] Use breaks where appropriate instead of continue. Address some comments. --- src/Cluster/Algorithm_Kmeans.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 3c6971dcad..27fa75a410 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -169,7 +169,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, { if (debug_ < 1) progress.Update( prog ); int oldClusterIdx = -1; -// if ( iteration != 0 || mode_ != SEQUENTIAL) // FIXME: Should this really happen for RANDOM +// if ( iteration != 0 || mode_ != SEQUENTIAL) // { int pointFrame = framesToCluster[ *pointIdx ]; if (debug_ > 0) @@ -184,7 +184,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, // If this point is alone in its cluster its in the right place if (C1->Nframes() == 1) { pointWasYanked = false; - continue; // FIXME: should this be a break? + break; } //oldBestRep = C1->BestRepFrame(); oldClusterIdx = C1->Num(); @@ -196,8 +196,8 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, mprintf("Remove Frame %i from cluster %i\n", pointFrame, C1->Num()); //if (clusterToClusterCentroid_) { // if (oldBestRep != NewBestRep) - // C1->AlignToBestRep( pmatrix.MetricPtr() ); // FIXME: Only relevant for COORDS dist? - // C1->CalculateCentroid( pmatrix.MetricPtr() ); // FIXME: Seems unnessecary to align prior + // C1->AlignToBestRep( pmatrix.MetricPtr() ); // Only relevant for COORDS dist? + // C1->CalculateCentroid( pmatrix.MetricPtr() ); // TODO Seems unnessecary to align prior //} } } @@ -210,7 +210,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, if (debug_ > 0) mprintf("Frame %i was already used to seed cluster %i\n", pointFrame, C1->Num()); - continue; // FIXME break? + break; } } } @@ -245,8 +245,8 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, } //if (clusterToClusterCentroid_) { //if (oldBestRep != NewBestRep) { - // C1->AlignToBestRep( pmatrix.MetricPtr() ); // FIXME: Only relevant for COORDS dist? - // C1->CalculateCentroid( pmatrix.MetricPtr() ); // FIXME: Seems unnessecary to align prior + // C1->AlignToBestRep( pmatrix.MetricPtr() ); // Only relevant for COORDS dist? + // C1->CalculateCentroid( pmatrix.MetricPtr() ); // TODO Seems unnessecary to align prior //} //} } @@ -259,7 +259,6 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, mprintf("\tK-means round %i: %i points changed cluster assignment.\n", iteration, Nchanged); } // END k-means iterations // Remove any empty clusters - // FIXME: Will there ever be empty clusters? clusters.RemoveEmptyClusters(); // NOTE in PTRAJ here align all frames to best rep return 0; From fa63269b8bf18d2b3804d23c4b09e5d08e455010 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 13:52:23 -0400 Subject: [PATCH 320/417] Args were in the wrong order --- src/Cluster/BestReps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 4132a6cb42..6c3101878d 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -57,7 +57,7 @@ void Cpptraj::Cluster::BestReps::PrintBestReps(Node const& node) { mprintf("DEBUG: Cluster %i best reps:\n", node.Num()); for (Node::RepPairArray::const_iterator it = node.BestReps().begin(); it != node.BestReps().end(); ++it) - mprintf("\t%i (%g)\n", it->second, it->first); + mprintf("\t%i (%g)\n", it->first, it->second); } /** Find best representative frames for each cluster. */ From fd16641b50447ef1241a93310746733fce87c31a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 14:09:35 -0400 Subject: [PATCH 321/417] Resolve FIXMEs that should be TODOs --- src/Cluster/Metric_DME.cpp | 4 ++-- src/Cluster/Metric_RMS.cpp | 4 ++-- src/Cluster/Results.h | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Metric_DME.cpp b/src/Cluster/Metric_DME.cpp index b954edadc0..c96b17125e 100644 --- a/src/Cluster/Metric_DME.cpp +++ b/src/Cluster/Metric_DME.cpp @@ -91,8 +91,8 @@ Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_DME::NewCentroid( Cframes c } // Subtract Notes -// FIXME: Handle single frame -// FIXME: Check if frame is in cluster? +// TODO: Handle single frame +// TODO: Check if frame is in cluster? void Cpptraj::Cluster::Metric_DME::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, CentOpType OP) { diff --git a/src/Cluster/Metric_RMS.cpp b/src/Cluster/Metric_RMS.cpp index b632dd6c16..47c8eeb01c 100644 --- a/src/Cluster/Metric_RMS.cpp +++ b/src/Cluster/Metric_RMS.cpp @@ -118,8 +118,8 @@ Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_RMS::NewCentroid( Cframes c } // Subtract Notes -// FIXME: Handle single frame -// FIXME: Check if frame is in cluster? +// TODO: Handle single frame +// TODO: Check if frame is in cluster? void Cpptraj::Cluster::Metric_RMS::FrameOpCentroid(int frame, Centroid* centIn, double oldSize, CentOpType OP) { diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h index 9ba51c888d..7f2f844a28 100644 --- a/src/Cluster/Results.h +++ b/src/Cluster/Results.h @@ -6,7 +6,6 @@ namespace Cpptraj { namespace Cluster { class List; class Metric; -//FIXME Should this be allocated and kept inside the Metric? /// Abstract base class for handling results specific to input data type. class Results { public: From f4466d9a7ca522dba5e5d263915843fedf6d3eb9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 14:10:38 -0400 Subject: [PATCH 322/417] Fix printf arg types --- src/DataSet_PairwiseCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DataSet_PairwiseCache.cpp b/src/DataSet_PairwiseCache.cpp index 61282b60cf..fbae1ac7d7 100644 --- a/src/DataSet_PairwiseCache.cpp +++ b/src/DataSet_PairwiseCache.cpp @@ -84,7 +84,7 @@ void DataSet_PairwiseCache::PrintCached() const { for (Cframes::const_iterator it2 = it1 + 1; it2 != FrameToIdx().end(); ++it2) { if (*it2 != -1) - mprintf("\t%zu %i %f\n", it1-FrameToIdx().begin()+1, it2-FrameToIdx().begin()+1, + mprintf("\t%li %li %f\n", it1-FrameToIdx().begin()+1, it2-FrameToIdx().begin()+1, CachedDistance(*it1, *it2)); } } From 87cd6f04817e25e2ed31b7372785d95cf4bed783 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 14:11:37 -0400 Subject: [PATCH 323/417] Try to resolve ordering issue. --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4ea0003057..6e3ced2082 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -114,7 +114,7 @@ target_include_directories(cpptraj_common_obj PRIVATE $ ${SOURCES}) -target_link_libraries(cpptraj netcdf netlib xdrfile cpptraj_cluster) +target_link_libraries(cpptraj cpptraj_cluster netcdf netlib xdrfile) install(TARGETS cpptraj DESTINATION ${BINDIR}) #------------------------------------------------------------------------------------------ @@ -123,7 +123,7 @@ install(TARGETS cpptraj DESTINATION ${BINDIR}) add_library(libcpptraj $ ${LIBCPPTRAJ_OBJECTS}) set_property(TARGET libcpptraj PROPERTY COMPILE_DEFINITIONS LIBCPPTRAJ) -target_link_libraries(libcpptraj netlib netcdf xdrfile cpptraj_cluster) +target_link_libraries(libcpptraj cpptraj_cluster netlib netcdf xdrfile) remove_prefix(libcpptraj) install_libraries(libcpptraj) From d9363f5c8e3aaff293aafc469f37cbb95e49513e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 11 Sep 2021 14:59:46 -0400 Subject: [PATCH 324/417] Fix printf format --- src/Cluster/List.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 2452a974b4..dafae71aed 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -15,7 +15,7 @@ void Cpptraj::Cluster::List::PrintClusters() const { //mprintf("CLUSTER: %u clusters, %u frames.\n", clusters_.size(), // FrameDistances().OriginalNframes() ); - mprintf("CLUSTER: %u clusters.\n", clusters_.size()); + mprintf("CLUSTER: %zu clusters.\n", clusters_.size()); for (cluster_iterator C = begincluster(); C != endcluster(); C++) { mprintf("\t%8i : ",C->Num()); for (Node::frame_iterator fnum = C->beginframe(); From 0e291cbe54a3967b7e457afdb517d22a88401f3c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 12 Sep 2021 10:37:20 -0400 Subject: [PATCH 325/417] Add arrays for metrics and centroids --- src/Cluster/CentroidArray.cpp | 7 +++++++ src/Cluster/CentroidArray.h | 17 +++++++++++++++++ src/Cluster/MetricArray.cpp | 7 +++++++ src/Cluster/MetricArray.h | 17 +++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 src/Cluster/CentroidArray.cpp create mode 100644 src/Cluster/CentroidArray.h create mode 100644 src/Cluster/MetricArray.cpp create mode 100644 src/Cluster/MetricArray.h diff --git a/src/Cluster/CentroidArray.cpp b/src/Cluster/CentroidArray.cpp new file mode 100644 index 0000000000..10936f1f19 --- /dev/null +++ b/src/Cluster/CentroidArray.cpp @@ -0,0 +1,7 @@ +#include "CentroidArray.h" +#include "Centroid.h" + +/** CONSTRUCTOR */ +Cpptraj::Cluster::CentroidArray::CentroidArray() {} + + diff --git a/src/Cluster/CentroidArray.h b/src/Cluster/CentroidArray.h new file mode 100644 index 0000000000..7bb5c75501 --- /dev/null +++ b/src/Cluster/CentroidArray.h @@ -0,0 +1,17 @@ +#ifndef CPPTRAJ_CLUSTER_CENTROIDARRAY_H +#define CPPTRAJ_CLUSTER_CENTROIDARRAY_H +#include +namespace Cpptraj { +namespace Cluster { +class Centroid; +/// Hold Centroids of various types +class CentroidArray { + public: + CentroidArray(); + private: + std::vector centroids_; +}; + +} +} +#endif diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp new file mode 100644 index 0000000000..7b2bc08834 --- /dev/null +++ b/src/Cluster/MetricArray.cpp @@ -0,0 +1,7 @@ +#include "MetricArray.h" +#include "Metric.h" + +/** CONSTRUCTOR */ +Cpptraj::Cluster::MetricArray::MetricArray() {} + + diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h new file mode 100644 index 0000000000..8017f9c696 --- /dev/null +++ b/src/Cluster/MetricArray.h @@ -0,0 +1,17 @@ +#ifndef CPPTRAJ_CLUSTER_METRICARRAY_H +#define CPPTRAJ_CLUSTER_METRICARRAY_H +#include +namespace Cpptraj { +namespace Cluster { +class Metric; +/// Hold Metrics of various types +class MetricArray { + public: + MetricArray(); + private: + std::vector metrics_; +}; + +} +} +#endif From 2be8f6588f0aa0d8e3704b14708b422f0fe84a02 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 12 Sep 2021 10:48:55 -0400 Subject: [PATCH 326/417] Add copy/assignment --- src/Cluster/MetricArray.cpp | 18 ++++++++++++++++++ src/Cluster/MetricArray.h | 10 +++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 7b2bc08834..3fd23f11eb 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -4,4 +4,22 @@ /** CONSTRUCTOR */ Cpptraj::Cluster::MetricArray::MetricArray() {} +/** COPY CONSTRUCTOR */ +Cpptraj::Cluster::MetricArray::MetricArray(MetricArray const& rhs) { + metrics_.reserve( rhs.metrics_.size() ); + for (std::vector::const_iterator it = rhs.metrics_.begin(); it != rhs.metrics_.end(); ++it) + metrics_.push_back( (*it)->Copy() ); +} + +/** ASSIGNMENT */ +Cpptraj::Cluster::MetricArray& + Cpptraj::Cluster::MetricArray::operator=(MetricArray const& rhs) +{ + if (this == &rhs) return *this; + metrics_.clear(); + metrics_.reserve( rhs.metrics_.size() ); + for (std::vector::const_iterator it = rhs.metrics_.begin(); it != rhs.metrics_.end(); ++it) + metrics_.push_back( (*it)->Copy() ); + return *this; +} diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 8017f9c696..3d926fb712 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -7,9 +7,17 @@ class Metric; /// Hold Metrics of various types class MetricArray { public: + /// CONSTRUCTOR MetricArray(); + /// COPY + MetricArray(MetricArray const&); + /// ASSIGN + MetricArray& operator=(MetricArray const&); + /// Types of distance calculation + enum DistanceType { MANHATTAN = 0, EUCLID }; private: - std::vector metrics_; + std::vector metrics_; ///< Hold each Metric + DistanceType type_; ///< Type of distance calc to perform }; } From 0fdde86d2dbce8c6c42fbae4b637e7423f99b2a9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 08:23:58 -0400 Subject: [PATCH 327/417] Start Metric_Scalar --- src/Cluster/Metric_Scalar.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/Cluster/Metric_Scalar.h diff --git a/src/Cluster/Metric_Scalar.h b/src/Cluster/Metric_Scalar.h new file mode 100644 index 0000000000..d47b66eba8 --- /dev/null +++ b/src/Cluster/Metric_Scalar.h @@ -0,0 +1,21 @@ +#ifndef INC_CPPTRAJ_CLUSTER_METRIC_SCALAR_H +#define INC_CPPTRAJ_CLUSTER_METRIC_SCALAR_H +#include "Metric.h" +class DataSet_1D; +namespace Cpptraj { +namespace Cluster { +/// Metric for regular 1D scalar DataSet +class Metric_Scalar : public Metric { + public: + /// CONSTRUCTOR + Metric_Scalar(); + /// Setup + int Setup(); + /// \return Absolute difference between two values indicated by given indices + double FrameDist(int, int); + /// \return Absolute difference between two values of given Centroids (averages) + double CentroidDist(Centroid*, Centroid*); + /// \return Absolute difference between value indicated by index and value of centroid (average) + + + From fbfc7df3603c46ad2da9aea87549f0066a6fc2e4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 10:44:35 -0400 Subject: [PATCH 328/417] Start implementation of Metric_Scalar --- src/Cluster/Metric_Scalar.cpp | 30 ++++++++++++++++++++++++++++++ src/Cluster/Metric_Scalar.h | 32 +++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 src/Cluster/Metric_Scalar.cpp diff --git a/src/Cluster/Metric_Scalar.cpp b/src/Cluster/Metric_Scalar.cpp new file mode 100644 index 0000000000..dd8e6d84be --- /dev/null +++ b/src/Cluster/Metric_Scalar.cpp @@ -0,0 +1,30 @@ +#include "Metric_Scalar.h" +#include "../CpptrajStdio.h" +#include "../DataSet_1D.h" +#include // fabs + +/** CONSTRUCTOR */ +Cpptraj::Cluster::Metric_Scalar::Metric_Scalar() : + Metric(SCALAR), + data_(0) +{} + +/** Initialize. */ +int Cpptraj::Cluster::Metric_Scalar::Init(DataSet_1D* dataIn) { + if (dataIn == 0) { + mprinterr("Internal Error: Metric_Scalar::Init called with null set.\n"); + return 1; + } + data_ = dataIn; + return 0; +} + +/** Set up. Not much to do for a DataSet. */ +int Cpptraj::Cluster::Metric_Scalar::Setup() { + return 0; +} + +/** \return Absolute difference between points */ +double Cpptraj::Cluster::Metric_Scalar::FrameDist(int f1, int f2) { + return fabs( data_->Dval(f1) - data_->Dval(f2) ); +} diff --git a/src/Cluster/Metric_Scalar.h b/src/Cluster/Metric_Scalar.h index d47b66eba8..4e9a855c1c 100644 --- a/src/Cluster/Metric_Scalar.h +++ b/src/Cluster/Metric_Scalar.h @@ -4,18 +4,44 @@ class DataSet_1D; namespace Cpptraj { namespace Cluster { -/// Metric for regular 1D scalar DataSet +/// Metric for delta between points in a regular 1D scalar DataSet. class Metric_Scalar : public Metric { public: /// CONSTRUCTOR Metric_Scalar(); + /// Initialize with DataSet + int Init(DataSet_1D*); + + // ----- Metric Routines --------------------- /// Setup int Setup(); + /// \return Copy of this Metric TODO const? + Metric* Copy() { return new Metric_Scalar( *this ); } + /// \return Absolute difference between two values indicated by given indices double FrameDist(int, int); /// \return Absolute difference between two values of given Centroids (averages) double CentroidDist(Centroid*, Centroid*); /// \return Absolute difference between value indicated by index and value of centroid (average) + double FrameCentroidDist(int, Centroid*); + + /// Calculate centroid (average) from given frames. + void CalculateCentroid(Centroid*, Cframes const&); + /// \return new centroid from given frames. + Centroid* NewCentroid(Cframes const&); + /// Update centroid (average) by performing given operation between given frame and centroid. + void FrameOpCentroid(int, Centroid*, double, CentOpType); + + /// \return string containing description of the distance metric + std::string Description() const; + /// Print Metric info to stdout. + void Info() const; + /// \return total number of frames. + unsigned int Ntotal() const; + private: + DataSet_1D* data_; ///< DataSet to calculate distances for. +}; - - +} +} +#endif From 9a5b0eade6aedfd49e0d18a0b52dd482e9b5d284 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 10:52:12 -0400 Subject: [PATCH 329/417] Start using Centroid_Num --- src/Cluster/Centroid_Num.h | 3 +++ src/Cluster/Metric_Scalar.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/Cluster/Centroid_Num.h b/src/Cluster/Centroid_Num.h index eb02a1a818..81b019a7db 100644 --- a/src/Cluster/Centroid_Num.h +++ b/src/Cluster/Centroid_Num.h @@ -1,5 +1,6 @@ #ifndef INC_CLUSTER_CENTROID_NUM_H #define INC_CLUSTER_CENTROID_NUM_H +#include "Centroid.h" namespace Cpptraj { namespace Cluster { @@ -10,6 +11,8 @@ class Centroid_Num : public Centroid { Centroid_Num(double val, double x, double y) : cval_(val), sumx_(x), sumy_(y) {} Centroid* Copy() { return (Centroid*)new Centroid_Num(cval_, sumx_, sumy_); } + /// \return Current value of average. + double Cval() const { return cval_; } private: double cval_; double sumx_; // For storing periodic average diff --git a/src/Cluster/Metric_Scalar.cpp b/src/Cluster/Metric_Scalar.cpp index dd8e6d84be..e76267a69c 100644 --- a/src/Cluster/Metric_Scalar.cpp +++ b/src/Cluster/Metric_Scalar.cpp @@ -1,4 +1,5 @@ #include "Metric_Scalar.h" +#include "Centroid_Num.h" #include "../CpptrajStdio.h" #include "../DataSet_1D.h" #include // fabs @@ -28,3 +29,8 @@ int Cpptraj::Cluster::Metric_Scalar::Setup() { double Cpptraj::Cluster::Metric_Scalar::FrameDist(int f1, int f2) { return fabs( data_->Dval(f1) - data_->Dval(f2) ); } + +/** \return Absolute difference between centroids. */ +double Cpptraj::Cluster::Metric_Scalar::CentroidDist(Centroid* c1, Centroid* c2) { + return fabs( ((Centroid_Num*)c1)->Cval() - ((Centroid_Num*)c2)->Cval() ); +} From 8573ce48ed7e0f59964d17ff451b0a61575422b4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 10:57:21 -0400 Subject: [PATCH 330/417] Start adding centroid calcs. --- src/Cluster/Centroid_Num.h | 3 +++ src/Cluster/Metric_Scalar.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Cluster/Centroid_Num.h b/src/Cluster/Centroid_Num.h index 81b019a7db..5f28a8296f 100644 --- a/src/Cluster/Centroid_Num.h +++ b/src/Cluster/Centroid_Num.h @@ -13,6 +13,9 @@ class Centroid_Num : public Centroid { Centroid* Copy() { return (Centroid*)new Centroid_Num(cval_, sumx_, sumy_); } /// \return Current value of average. double Cval() const { return cval_; } + + /// Set average value. + void SetCval(double c) { cval_ = c; } private: double cval_; double sumx_; // For storing periodic average diff --git a/src/Cluster/Metric_Scalar.cpp b/src/Cluster/Metric_Scalar.cpp index e76267a69c..4fb0ea0716 100644 --- a/src/Cluster/Metric_Scalar.cpp +++ b/src/Cluster/Metric_Scalar.cpp @@ -1,5 +1,6 @@ #include "Metric_Scalar.h" #include "Centroid_Num.h" +#include "Cframes.h" #include "../CpptrajStdio.h" #include "../DataSet_1D.h" #include // fabs @@ -34,3 +35,17 @@ double Cpptraj::Cluster::Metric_Scalar::FrameDist(int f1, int f2) { double Cpptraj::Cluster::Metric_Scalar::CentroidDist(Centroid* c1, Centroid* c2) { return fabs( ((Centroid_Num*)c1)->Cval() - ((Centroid_Num*)c2)->Cval() ); } + +/** \return Absolute difference between point and centroid. */ +double Cpptraj::Cluster::Metric_Scalar::FrameCentroidDist(int f1, Centroid* c1) { + return fabs( data_->Dval(f1) - ((Centroid_Num*)c1)->Cval() ); +} + +/** Calculate centroid from specified frames. */ +void Cpptraj::Cluster::Metric_Scalar::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) +{ + double val = 0.0; + for (Cframes::const_iterator frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) + val += data_->Dval( *frm ); + ((Centroid_Num*)centIn)->SetCval( val / (double)cframesIn.size() ); +} From e350a877c8c14ecdf38e195de23c9fbf6d7f569a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 11:08:49 -0400 Subject: [PATCH 331/417] Finish Metric_Scalar implementation --- src/Cluster/Metric_Scalar.cpp | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/Cluster/Metric_Scalar.cpp b/src/Cluster/Metric_Scalar.cpp index 4fb0ea0716..a34bf52b6f 100644 --- a/src/Cluster/Metric_Scalar.cpp +++ b/src/Cluster/Metric_Scalar.cpp @@ -49,3 +49,44 @@ void Cpptraj::Cluster::Metric_Scalar::CalculateCentroid(Centroid* centIn, Cframe val += data_->Dval( *frm ); ((Centroid_Num*)centIn)->SetCval( val / (double)cframesIn.size() ); } + +/** \return New centroid from specified frames. */ +Cpptraj::Cluster::Centroid* + Cpptraj::Cluster::Metric_Scalar::NewCentroid(Cframes const& cframesIn) +{ + Centroid_Num* cent = new Centroid_Num(); + CalculateCentroid(cent, cframesIn); + return cent; +} + +/** Perform given operation between frame and centroid. */ +void Cpptraj::Cluster::Metric_Scalar::FrameOpCentroid(int frame, Centroid* centIn, + double oldSize, CentOpType OP) +{ + Centroid_Num* cent = (Centroid_Num*)centIn; + + double newcval = cent->Cval() * oldSize; + double fval = data_->Dval(frame); + if (OP == ADDFRAME) { + newcval += fval; + newcval /= ( oldSize + 1 ); + } else { // SUBTRACTFRAME + newcval -= fval; + newcval /= ( oldSize - 1 ); + } + + cent->SetCval( newcval ); +} + +/** \return 1 line description */ +std::string Cpptraj::Cluster::Metric_Scalar::Description() const { + return "Data set " + data_->Meta().Legend(); +} + +/** Print info to STDOUT. */ +void Cpptraj::Cluster::Metric_Scalar::Info() const { + mprintf("\tMetric: Data set '%s'\n", data_->legend()); +} + +/** \return DataSet size */ +unsigned int Cpptraj::Cluster::Metric_Scalar::Ntotal() const { return data_->Size(); } From 18a36c1fb345fbfb506dfec4ea54b0b9e76b11d4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 11:26:46 -0400 Subject: [PATCH 332/417] Add Metric_Torsion --- src/Cluster/Centroid_Num.h | 8 +++ src/Cluster/Metric_Torsion.cpp | 116 +++++++++++++++++++++++++++++++++ src/Cluster/Metric_Torsion.h | 47 +++++++++++++ 3 files changed, 171 insertions(+) create mode 100644 src/Cluster/Metric_Torsion.cpp create mode 100644 src/Cluster/Metric_Torsion.h diff --git a/src/Cluster/Centroid_Num.h b/src/Cluster/Centroid_Num.h index 5f28a8296f..5ce9617307 100644 --- a/src/Cluster/Centroid_Num.h +++ b/src/Cluster/Centroid_Num.h @@ -14,8 +14,16 @@ class Centroid_Num : public Centroid { /// \return Current value of average. double Cval() const { return cval_; } + /// \return Sum of cos(theta); for periodic average + double SumX() const { return sumx_; } + /// \return Sum of sin(theta); for periodic average + double SumY() const { return sumy_; } + /// Set average value. void SetCval(double c) { cval_ = c; } + + /// For periodic average; set sum of cos(theta) and sum of sin(theta) + void SetPeriodicSums(double x, double y) { sumx_ = x; sumy_ = y; } private: double cval_; double sumx_; // For storing periodic average diff --git a/src/Cluster/Metric_Torsion.cpp b/src/Cluster/Metric_Torsion.cpp new file mode 100644 index 0000000000..17b270bdf6 --- /dev/null +++ b/src/Cluster/Metric_Torsion.cpp @@ -0,0 +1,116 @@ +#include "Metric_Torsion.h" +#include "Centroid_Num.h" +#include "Cframes.h" +#include "../Constants.h" +#include "../CpptrajStdio.h" +#include "../DataSet_1D.h" +#include // fabs, atan2 + +/** CONSTRUCTOR */ +Cpptraj::Cluster::Metric_Torsion::Metric_Torsion() : + Metric(TORSION), + data_(0) +{} + +/** Initialize. */ +int Cpptraj::Cluster::Metric_Torsion::Init(DataSet_1D* dataIn) { + if (dataIn == 0) { + mprinterr("Internal Error: Metric_Torsion::Init called with null set.\n"); + return 1; + } + data_ = dataIn; + return 0; +} + +/** Set up. Not much to do for a DataSet. */ +int Cpptraj::Cluster::Metric_Torsion::Setup() { + return 0; +} + +/// \return smallest difference between two angles (in degrees). +static inline double DistCalc_Dih(double d1, double d2) { + double diff = fabs(d1 - d2); + if (diff > 180.0) + return (360.0 - diff); + else + return diff; +} + +/** \return Shortest absolute difference between torsions */ +double Cpptraj::Cluster::Metric_Torsion::FrameDist(int f1, int f2) { + return DistCalc_Dih( data_->Dval(f1), data_->Dval(f2) ); +} + +/** \return Absolute difference between centroids. */ +double Cpptraj::Cluster::Metric_Torsion::CentroidDist(Centroid* c1, Centroid* c2) { + return DistCalc_Dih( ((Centroid_Num*)c1)->Cval(), ((Centroid_Num*)c2)->Cval() ); +} + +/** \return Absolute difference between point and centroid. */ +double Cpptraj::Cluster::Metric_Torsion::FrameCentroidDist(int f1, Centroid* c1) { + return DistCalc_Dih( data_->Dval(f1), ((Centroid_Num*)c1)->Cval() ); +} + +/** Calculate centroid from specified frames. + * Calculate unambiguous average dihedral angle (in degrees) by converting to + * cartesian coords using x = cos(theta), y = sin(theta), and: + * tan(avgtheta) = avgy / avgx = SUM[sin(theta)] / SUM[cos(theta)] + * See Eq. 2 from Altis et al., J. Chem. Phys., 126 p. 244111 (2007). + */ +void Cpptraj::Cluster::Metric_Torsion::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) +{ + double sumy = 0.0; + double sumx = 0.0; + // TODO: Convert angles to radians prior to this call? + for (Cframes::const_iterator frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) { + double theta = data_->Dval( *frm ) * Constants::DEGRAD; + sumy += sin( theta ); + sumx += cos( theta ); + } + ((Centroid_Num*)centIn)->SetCval( atan2(sumy, sumx) * Constants::RADDEG ); + ((Centroid_Num*)centIn)->SetPeriodicSums( sumx, sumy ); +} + +/** \return New centroid from specified frames. */ +Cpptraj::Cluster::Centroid* + Cpptraj::Cluster::Metric_Torsion::NewCentroid(Cframes const& cframesIn) +{ + Centroid_Num* cent = new Centroid_Num(); + CalculateCentroid(cent, cframesIn); + return cent; +} + +/** Perform given operation between frame and centroid. */ +void Cpptraj::Cluster::Metric_Torsion::FrameOpCentroid(int frame, Centroid* centIn, + double oldSize, CentOpType OP) +{ + Centroid_Num* cent = (Centroid_Num*)centIn; + + double sumx = cent->SumX(); + double sumy = cent->SumY(); + double ftheta = data_->Dval(frame) * Constants::DEGRAD; + if (OP == ADDFRAME) { + sumy += sin( ftheta ); + sumx += cos( ftheta ); + } else { // SUBTRACTFRAME + sumy -= sin( ftheta ); + sumx -= cos( ftheta ); + } + double newcval = atan2(sumy, sumx) * Constants::RADDEG; + + cent->SetCval( newcval ); + cent->SetPeriodicSums( sumx, sumy ); +} + +/** \return 1 line description */ +std::string Cpptraj::Cluster::Metric_Torsion::Description() const { + return "Torsion data set " + data_->Meta().Legend(); +} + +/** Print info to STDOUT. */ +void Cpptraj::Cluster::Metric_Torsion::Info() const { + mprintf("\tMetric: Torsion data set '%s'\n", data_->legend()); +} + +/** \return DataSet size */ +unsigned int Cpptraj::Cluster::Metric_Torsion::Ntotal() const { return data_->Size(); } diff --git a/src/Cluster/Metric_Torsion.h b/src/Cluster/Metric_Torsion.h new file mode 100644 index 0000000000..d1dd90de45 --- /dev/null +++ b/src/Cluster/Metric_Torsion.h @@ -0,0 +1,47 @@ +#ifndef INC_CPPTRAJ_CLUSTER_METRIC_TORSION_H +#define INC_CPPTRAJ_CLUSTER_METRIC_TORSION_H +#include "Metric.h" +class DataSet_1D; +namespace Cpptraj { +namespace Cluster { +/// Metric for delta between points in a 1D scalar DataSet of a torsion (360 deg.). +class Metric_Torsion : public Metric { + public: + /// CONSTRUCTOR + Metric_Torsion(); + /// Initialize with DataSet + int Init(DataSet_1D*); + + // ----- Metric Routines --------------------- + /// Setup + int Setup(); + /// \return Copy of this Metric TODO const? + Metric* Copy() { return new Metric_Torsion( *this ); } + + /// \return Absolute difference between two values indicated by given indices + double FrameDist(int, int); + /// \return Absolute difference between two values of given Centroids (averages) + double CentroidDist(Centroid*, Centroid*); + /// \return Absolute difference between value indicated by index and value of centroid (average) + double FrameCentroidDist(int, Centroid*); + + /// Calculate centroid (average) from given frames. + void CalculateCentroid(Centroid*, Cframes const&); + /// \return new centroid from given frames. + Centroid* NewCentroid(Cframes const&); + /// Update centroid (average) by performing given operation between given frame and centroid. + void FrameOpCentroid(int, Centroid*, double, CentOpType); + + /// \return string containing description of the distance metric + std::string Description() const; + /// Print Metric info to stdout. + void Info() const; + /// \return total number of frames. + unsigned int Ntotal() const; + private: + DataSet_1D* data_; ///< DataSet to calculate distances for. +}; + +} +} +#endif From 2e2ae6f2bd6f96c519632546885767db24936afa Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 11:56:29 -0400 Subject: [PATCH 333/417] Start adding init to MetricArray --- src/Cluster/MetricArray.cpp | 88 +++++++++++++++++++++++++++++++++++++ src/Cluster/MetricArray.h | 16 ++++++- 2 files changed, 103 insertions(+), 1 deletion(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 3fd23f11eb..feaa77de17 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -1,9 +1,23 @@ #include "MetricArray.h" #include "Metric.h" +#include "../ArgList.h" +#include "../CpptrajStdio.h" +#include "../DataSetList.h" +// Metric classes +#include "Metric_RMS.h" +#include "Metric_DME.h" +#include "Metric_Scalar.h" +#include "Metric_SRMSD.h" +#include "Metric_Torsion.h" /** CONSTRUCTOR */ Cpptraj::Cluster::MetricArray::MetricArray() {} +/** DESTRUCTOR */ +Cpptraj::Cluster::MetricArray::~MetricArray() { + Clear(); +} + /** COPY CONSTRUCTOR */ Cpptraj::Cluster::MetricArray::MetricArray(MetricArray const& rhs) { metrics_.reserve( rhs.metrics_.size() ); @@ -23,3 +37,77 @@ Cpptraj::Cluster::MetricArray& return *this; } +/** Clear the metric array. */ +void Cpptraj::Cluster::MetricArray::Clear() { + for (std::vector::iterator it = metrics_.begin(); it != metrics_.end(); ++it) + delete *it; + sets_.clear(); +} + +/** /return Pointer to Metric of given type. */ +Cpptraj::Cluster::Metric* Cpptraj::Cluster::MetricArray::AllocateMetric(Metric::Type mtype) +{ + Metric* met = 0; + switch (mtype) { + case Metric::RMS : met = new Metric_RMS(); break; + case Metric::DME : met = new Metric_DME(); break; + case Metric::SRMSD : met = new Metric_SRMSD(); break; + case Metric::SCALAR : met = new Metric_Scalar(); break; + case Metric::TORSION : met = new Metric_Torsion(); break; + default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); + } + return met; +} + +/** Initialize with given sets and arguments. */ +int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, ArgList& analyzeArgs) +{ + // Get rid of any previous metrics + Clear(); + // Get arguments for any COORDS metrics + int usedme = (int)analyzeArgs.hasKey("dme"); + int userms = (int)analyzeArgs.hasKey("rms"); + int usesrms = (int)analyzeArgs.hasKey("srmsd"); + bool useMass = analyzeArgs.hasKey("mass"); + bool nofit = analyzeArgs.hasKey("nofit"); + std::string maskExpr = analyzeArgs.GetMaskNext(); + // Check args + if (usedme + userms + usesrms > 1) { + mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); + return 1; + } + Metric::Type coordsMetricType; + if (usedme) coordsMetricType = Metric::DME; + else if (userms) coordsMetricType = Metric::RMS; + else if (usesrms) coordsMetricType = Metric::SRMSD; + else coordsMetricType = Metric::RMS; // default + + // For each input set, set up the appropriate metric + for (DataSetList::const_iterator ds = dslIn.begin(); ds != dslIn.end(); ++ds) + { + Metric::Type mtype = Metric::UNKNOWN_METRIC; + if ( (*ds)->Group() == DataSet::COORDINATES ) + { + mtype = coordsMetricType; + } else if ((*ds)->Group() == DataSet::SCALAR_1D) { + if ( (*ds)->Meta().IsTorsionArray() ) + mtype = Metric::TORSION; + else + mtype = Metric::SCALAR; + } + + if (mtype == Metric::UNKNOWN_METRIC) { + mprinterr("Error: Set '%s' is a type not yet supported by Cluster.\n", (*ds)->legend()); + return 1; + } + + Metric* met = AllocateMetric( mtype ); + if (met == 0) { + mprinterr("Internal Error: Could not allocate metric for set '%s'\n", (*ds)->legend()); + return 1; + } + + } + + return 0; +} diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 3d926fb712..9445e9dd84 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -1,22 +1,36 @@ #ifndef CPPTRAJ_CLUSTER_METRICARRAY_H #define CPPTRAJ_CLUSTER_METRICARRAY_H #include +#include "Metric.h" // Metric::Type +class ArgList; +class DataSet; +class DataSetList; namespace Cpptraj { namespace Cluster { -class Metric; + /// Hold Metrics of various types class MetricArray { public: /// CONSTRUCTOR MetricArray(); + /// DESTRUCTOR + ~MetricArray(); /// COPY MetricArray(MetricArray const&); /// ASSIGN MetricArray& operator=(MetricArray const&); /// Types of distance calculation enum DistanceType { MANHATTAN = 0, EUCLID }; + /// Initialize with data sets and user arguments + int InitMetricArray(DataSetList const&, ArgList&); private: + /// Clear array + void Clear(); + /// Allocate metric of given type + Metric* AllocateMetric(Metric::Type); + std::vector metrics_; ///< Hold each Metric + std::vector sets_; ///< Sets corresponding to each Metric DistanceType type_; ///< Type of distance calc to perform }; From 442933e603223db317dc92e62c018ab0ad045e96 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 12:02:48 -0400 Subject: [PATCH 334/417] Add call to Init for allocated metric --- src/Cluster/MetricArray.cpp | 28 ++++++++++++++++++++++++++-- src/Cluster/MetricArray.h | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index feaa77de17..ad3087453b 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -60,7 +60,8 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::MetricArray::AllocateMetric(Metric:: } /** Initialize with given sets and arguments. */ -int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, ArgList& analyzeArgs) +int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, ArgList& analyzeArgs, + int debugIn) { // Get rid of any previous metrics Clear(); @@ -107,7 +108,30 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg return 1; } - } + // Initialize the metric + int err = 0; + switch (mtype) { + case Metric::RMS : + err = ((Metric_RMS*)met)->Init((DataSet_Coords*)*ds, AtomMask(maskExpr), nofit, useMass); break; + case Metric::DME : + err = ((Metric_DME*)met)->Init((DataSet_Coords*)*ds, AtomMask(maskExpr)); break; + case Metric::SRMSD : + err = ((Metric_SRMSD*)met)->Init((DataSet_Coords*)*ds, AtomMask(maskExpr), nofit, useMass, debugIn); break; + case Metric::SCALAR : + err = ((Metric_Scalar*)met)->Init((DataSet_1D*)*ds); break; + case Metric::TORSION : + err = ((Metric_Torsion*)met)->Init((DataSet_1D*)*ds); break; + default: + mprinterr("Error: Unhandled Metric setup.\n"); + err = 1; + } + if (err != 0) { + mprinterr("Error: Metric setup failed.\n"); + return 1; + } + metrics_.push_back( met ); + + } // END loop over input data sets return 0; } diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 9445e9dd84..ec56524c49 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -22,7 +22,7 @@ class MetricArray { /// Types of distance calculation enum DistanceType { MANHATTAN = 0, EUCLID }; /// Initialize with data sets and user arguments - int InitMetricArray(DataSetList const&, ArgList&); + int InitMetricArray(DataSetList const&, ArgList&, int); private: /// Clear array void Clear(); From 4ea3584146223bf8183e9793805dc0ad65dc0663 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 12:04:37 -0400 Subject: [PATCH 335/417] Parse euclid and manhattan args --- src/Cluster/MetricArray.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index ad3087453b..f39f77136c 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -72,6 +72,19 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg bool useMass = analyzeArgs.hasKey("mass"); bool nofit = analyzeArgs.hasKey("nofit"); std::string maskExpr = analyzeArgs.GetMaskNext(); + // Get other args + if (analyzeArgs.hasKey("euclid")) + type_ = EUCLID; + else if (analyzeArgs.hasKey("manhattan")) + type_ = MANHATTAN; + else { + // Default + if (dslIn.size() > 1) + type_ = EUCLID; + else + type_ = MANHATTAN; + } + // Check args if (usedme + userms + usesrms > 1) { mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); From a7644985038d486385fd4126500fe3d30ccaff91 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 12:06:14 -0400 Subject: [PATCH 336/417] Add recognized keywords --- src/Cluster/MetricArray.cpp | 4 ++++ src/Cluster/MetricArray.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index f39f77136c..0bcb6dffac 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -59,6 +59,10 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::MetricArray::AllocateMetric(Metric:: return met; } +/** Recognized args. */ +const char* Cpptraj::Cluster::MetricArray::MetricArgs_ = + "[{dme|rms|srmsd} [mass] [nofit] []] [{euclid|manhattan}]"; + /** Initialize with given sets and arguments. */ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, ArgList& analyzeArgs, int debugIn) diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index ec56524c49..e69a2297e0 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -19,8 +19,11 @@ class MetricArray { MetricArray(MetricArray const&); /// ASSIGN MetricArray& operator=(MetricArray const&); + /// Types of distance calculation enum DistanceType { MANHATTAN = 0, EUCLID }; + /// Recognized keywords + static const char* MetricArgs_; /// Initialize with data sets and user arguments int InitMetricArray(DataSetList const&, ArgList&, int); private: From 78a2b20212588b5f3331daffc9dbcd0ff4a4bf51 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 12:15:30 -0400 Subject: [PATCH 337/417] Add metric weights --- src/Cluster/MetricArray.cpp | 25 +++++++++++++++++++++++-- src/Cluster/MetricArray.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 0bcb6dffac..b97664378e 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -3,6 +3,7 @@ #include "../ArgList.h" #include "../CpptrajStdio.h" #include "../DataSetList.h" +#include "../StringRoutines.h" // Metric classes #include "Metric_RMS.h" #include "Metric_DME.h" @@ -42,6 +43,7 @@ void Cpptraj::Cluster::MetricArray::Clear() { for (std::vector::iterator it = metrics_.begin(); it != metrics_.end(); ++it) delete *it; sets_.clear(); + weights_.clear(); } /** /return Pointer to Metric of given type. */ @@ -61,7 +63,7 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::MetricArray::AllocateMetric(Metric:: /** Recognized args. */ const char* Cpptraj::Cluster::MetricArray::MetricArgs_ = - "[{dme|rms|srmsd} [mass] [nofit] []] [{euclid|manhattan}]"; + "[{dme|rms|srmsd} [mass] [nofit] []] [{euclid|manhattan}] [wgt ]"; /** Initialize with given sets and arguments. */ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, ArgList& analyzeArgs, @@ -88,6 +90,7 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg else type_ = MANHATTAN; } + std::string wgtArgStr = analyzeArgs.GetStringKey("wgt"); // Check args if (usedme + userms + usesrms > 1) { @@ -147,8 +150,26 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg return 1; } metrics_.push_back( met ); + sets_.push_back( *ds ); } // END loop over input data sets + // Process weight args if needed + if (!wgtArgStr.empty()) { + ArgList wgtArgs(wgtArgStr, ","); + // Need 1 arg for every set + if (wgtArgs.Nargs() != (int)metrics_.size()) { + mprinterr("Error: Expected %zu comma-separated args for wgt, got %i\n", + metrics_.size(), wgtArgs.Nargs()); + return 1; + } + weights_.reserve( wgtArgs.Nargs() ); + for (int arg = 0; arg != wgtArgs.Nargs(); arg++) + weights_.push_back( convertToDouble( wgtArgs[arg] ) ); + } else { + // Default weights are 1 + weights_.assign(metrics_.size(), 1.0); + } + return 0; -} +} diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index e69a2297e0..1d31e6352c 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -34,6 +34,7 @@ class MetricArray { std::vector metrics_; ///< Hold each Metric std::vector sets_; ///< Sets corresponding to each Metric + std::vector weights_; ///< Weight of each metric DistanceType type_; ///< Type of distance calc to perform }; From 6ff33eeacabb859011e931066daa30902caed50c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 12:16:06 -0400 Subject: [PATCH 338/417] Remove old metric files --- src/Cluster/Metric_Data.cpp | 177 -------------------------- src/Cluster/Metric_Data.h | 45 ------- src/Cluster/Metric_Data_Euclid.cpp | 48 ------- src/Cluster/Metric_Data_Euclid.h | 22 ---- src/Cluster/Metric_Data_Manhattan.cpp | 45 ------- src/Cluster/Metric_Data_Manhattan.h | 22 ---- 6 files changed, 359 deletions(-) delete mode 100644 src/Cluster/Metric_Data.cpp delete mode 100644 src/Cluster/Metric_Data.h delete mode 100644 src/Cluster/Metric_Data_Euclid.cpp delete mode 100644 src/Cluster/Metric_Data_Euclid.h delete mode 100644 src/Cluster/Metric_Data_Manhattan.cpp delete mode 100644 src/Cluster/Metric_Data_Manhattan.h diff --git a/src/Cluster/Metric_Data.cpp b/src/Cluster/Metric_Data.cpp deleted file mode 100644 index 5037b5ecd0..0000000000 --- a/src/Cluster/Metric_Data.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include // fabs, atan2, sin, cos -#include "Metric_Data.h" -#include "Centroid_Multi.h" -#include "Cframes.h" -#include "../Constants.h" // RADDEG, DEGRAD -#include "../CpptrajStdio.h" -#include "../DataSet_1D.h" - -int Cpptraj::Cluster::Metric_Data::Init(DsArray const& dsIn) -{ - ntotal_ = 0; - for (DsArray::const_iterator ds = dsIn.begin(); ds != dsIn.end(); ++ds) { - if ( (*ds)->Group() != DataSet::SCALAR_1D) { - mprinterr("Error: Set '%s' is not 1D scalar - cannot use for clustering.\n", - (*ds)->legend()); - return 1; - } - dsets_.push_back( (DataSet_1D*)*ds ); - if ( dsets_.back()->Meta().IsTorsionArray() ) - dcalcs_.push_back( DistCalc_Dih ); - else - dcalcs_.push_back( DistCalc_Std ); - } - return 0; -} - -/** Total number of points is number in smallest set. */ -int Cpptraj::Cluster::Metric_Data::Setup() { - ntotal_ = 0; - for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) - { - if (ntotal_ == 0) - ntotal_ = (*ds)->Size(); - else { - if ( (*ds)->Size() < ntotal_ ) { - mprintf("Warning: Set '%s' size %zu is smaller than current size %u.\n", - (*ds)->legend(), (*ds)->Size(), ntotal_); - ntotal_ = (*ds)->Size(); - } - } - } - return 0; -} - -/// Calculate smallest difference between two angles (in degrees). -double Cpptraj::Cluster::Metric_Data::DistCalc_Dih(double d1, double d2) { - double diff = fabs(d1 - d2); - if (diff > 180.0) - return (360.0 - diff); - else - return diff; -} - -/// Calculate basic difference. -double Cpptraj::Cluster::Metric_Data::DistCalc_Std(double d1, double d2) { - return fabs(d1 - d2); -} - -/** Calculate unambiguous average dihedral angle (in degrees) by converting to - * cartesian coords using x = cos(theta), y = sin(theta), and: - * tan(avgtheta) = avgy / avgx = SUM[sin(theta)] / SUM[cos(theta)] - * See Eq. 2 from Altis et al., J. Chem. Phys., 126 p. 244111 (2007). - */ -double Cpptraj::Cluster::Metric_Data::AvgCalc_Dih(DataSet_1D const& dsIn, - Cframes const& cframesIn, - double& sumx, double& sumy) -{ - sumy = 0.0; - sumx = 0.0; - // TODO: Convert angles to radians prior to this call? - for (Cframes::const_iterator frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) { - double theta = dsIn.Dval( *frm ) * Constants::DEGRAD; - sumy += sin( theta ); - sumx += cos( theta ); - } - return atan2(sumy, sumx) * Constants::RADDEG; -} - -double Cpptraj::Cluster::Metric_Data::AvgCalc_Std(DataSet_1D const& dsIn, - Cframes const& cframesIn) -{ - double val = 0.0; - for (Cframes::const_iterator frm = cframesIn.begin(); frm != cframesIn.end(); ++frm) - val += dsIn.Dval( *frm ); - return (val / (double)cframesIn.size()); -} - -/* Update centroid value for adding/removing a frame. - * \param fval value of frame being added/removed. - * \param cval current centroid value. - * \param isTorsion data is periodic. - * \param oldSize Previous size of the centroid. - * \param OP Operation being performed. - */ -double Cpptraj::Cluster::Metric_Data::DistCalc_FrameCentroid(double fval, double cval, - bool isTorsion, - double oldSize, CentOpType OP, - double& sumx, double& sumy) -{ - double newcval; - if (isTorsion) { - double ftheta = fval * Constants::DEGRAD; - if (OP == ADDFRAME) { - sumy += sin( ftheta ); - sumx += cos( ftheta ); - } else { // SUBTRACTFRAME - sumy -= sin( ftheta ); - sumx -= cos( ftheta ); - } - newcval = atan2(sumy, sumx) * Constants::RADDEG; - } else { - newcval = cval * oldSize; - if (OP == ADDFRAME) { - newcval += fval; - newcval /= ( oldSize + 1 ); - } else { // SUBTRACTFRAME - newcval -= fval; - newcval /= ( oldSize - 1 ); - } - } - return newcval; -} - -void Cpptraj::Cluster::Metric_Data::CalculateCentroid(Centroid* centIn, Cframes const& cframesIn) { - Centroid_Multi* cent = (Centroid_Multi*)centIn; - cent->Cvals().resize( dsets_.size(), 0.0 ); - cent->SumX().resize( dsets_.size(), 0.0 ); - cent->SumY().resize( dsets_.size(), 0.0 ); - for (unsigned int idx = 0; idx != dsets_.size(); ++idx) { - if (dsets_[idx]->Meta().IsTorsionArray()) - cent->Cvals()[idx] = AvgCalc_Dih(*dsets_[idx], cframesIn, - cent->SumX()[idx], cent->SumY()[idx]); - else - cent->Cvals()[idx] = AvgCalc_Std(*dsets_[idx], cframesIn); - } -// mprintf("DEBUG: Centroids:"); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" %f (sumy=%f sumx=%f)", cent->cvals_[i], cent->Sumy_[i], cent->Sumx_[i]); -// mprintf("\n"); -} - -Cpptraj::Cluster::Centroid* Cpptraj::Cluster::Metric_Data::NewCentroid(Cframes const& cframesIn) { - Centroid_Multi* cent = new Centroid_Multi(); - CalculateCentroid(cent, cframesIn); - return cent; -} - -//static const char* OPSTRING[] = {"ADD", "SUBTRACT"}; // DEBUG - -void Cpptraj::Cluster::Metric_Data::FrameOpCentroid(int frame, Centroid* centIn, - double oldSize, CentOpType OP) -{ - Centroid_Multi* cent = (Centroid_Multi*)centIn; -// mprintf("DEBUG: Old Centroids:"); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" sumy=%f sumx=%f", cent->Sumy_[i], cent->Sumx_[i]); -// //mprintf(" %f", cent->cvals_[i]); -// mprintf("\n"); - for (unsigned int i = 0; i != dsets_.size(); ++i) - cent->Cvals()[i] = DistCalc_FrameCentroid(dsets_[i]->Dval(frame), - cent->Cvals()[i], dsets_[i]->Meta().IsTorsionArray(), oldSize, OP, - cent->SumX()[i], cent->SumY()[i]); -// mprintf("DEBUG: New Centroids after %s frame %i:", OPSTRING[OP], frame); -// for (unsigned int i = 0; i != cent->cvals_.size(); i++) -// mprintf(" %f", cent->cvals_[i]); -// mprintf("\n"); -} - -std::string Cpptraj::Cluster::Metric_Data::SetNames(std::string const& descrip) const { - std::string description(descrip); - for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) - if (ds == dsets_.begin()) - description.append( (*ds)->Meta().PrintName() ); - else - description.append( "," + (*ds)->Meta().PrintName() ); - return description; -} diff --git a/src/Cluster/Metric_Data.h b/src/Cluster/Metric_Data.h deleted file mode 100644 index 40e79efad3..0000000000 --- a/src/Cluster/Metric_Data.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_CLUSTER_METRIC_DATA_H -#define INC_CLUSTER_METRIC_DATA_H -#include -#include "Metric.h" -class DataSet; -class DataSet_1D; -namespace Cpptraj { -namespace Cluster { - -/// Abstract base class for Metrics that use scalar DataSets -class Metric_Data : public Metric { - public: - Metric_Data(Type t) : Metric(t), ntotal_(0) {} - virtual ~Metric_Data() {} - - /// Input to Metric_Data - typedef std::vector DsArray; - // ----- Metric ------------------------------ - int Setup(); - void CalculateCentroid(Centroid*, Cframes const&); - Centroid* NewCentroid(Cframes const&); - void FrameOpCentroid(int, Centroid*, double, CentOpType); - unsigned int Ntotal() const { return ntotal_; } - // ------------------------------------------- - int Init(DsArray const&); - protected: - typedef double (*DistCalc)(double,double); - typedef std::vector D1Array; - typedef std::vector DcArray; - - static double DistCalc_Dih(double,double); - static double DistCalc_Std(double,double); - static double AvgCalc_Dih(DataSet_1D const&, Cframes const&, double&, double&); - static double AvgCalc_Std(DataSet_1D const&, Cframes const&); - static double DistCalc_FrameCentroid(double, double, bool, double, CentOpType, double&, double&); - std::string SetNames(std::string const&) const; - // TODO private - D1Array dsets_; ///< The input data sets - DcArray dcalcs_; ///< Distance calc for each set - unsigned int ntotal_; ///< Total number of data points in the smallest set -}; - -} -} -#endif diff --git a/src/Cluster/Metric_Data_Euclid.cpp b/src/Cluster/Metric_Data_Euclid.cpp deleted file mode 100644 index 99890d596d..0000000000 --- a/src/Cluster/Metric_Data_Euclid.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include // sqrt -#include "Metric_Data_Euclid.h" -#include "Centroid_Multi.h" -#include "../CpptrajStdio.h" -#include "../DataSet_1D.h" - -double Cpptraj::Cluster::Metric_Data_Euclid::FrameDist(int f1, int f2) { - double dist = 0.0; - DcArray::const_iterator dcalc = dcalcs_.begin(); - for (D1Array::iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds, ++dcalc) { - double diff = (*dcalc)((*ds)->Dval(f1), (*ds)->Dval(f2)); - dist += (diff * diff); - } - return sqrt(dist); -} - -double Cpptraj::Cluster::Metric_Data_Euclid::CentroidDist(Centroid* c1, Centroid* c2) { - double dist = 0.0; - Centroid_Multi::Darray::const_iterator c2val = ((Centroid_Multi*)c2)->Cvals().begin(); - DcArray::const_iterator dcalc = dcalcs_.begin(); - for (Centroid_Multi::Darray::const_iterator c1val = ((Centroid_Multi*)c1)->Cvals().begin(); - c1val != ((Centroid_Multi*)c1)->Cvals().end(); - ++c1val, ++dcalc) - { - double diff = (*dcalc)(*c1val, *(c2val++)); - dist += (diff * diff); - } - return sqrt(dist); -} - -double Cpptraj::Cluster::Metric_Data_Euclid::FrameCentroidDist(int f1, Centroid* c1) { - double dist = 0.0; - Centroid_Multi::Darray::const_iterator c1val = ((Centroid_Multi*)c1)->Cvals().begin(); - DcArray::const_iterator dcalc = dcalcs_.begin(); - for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) { - double diff = (*dcalc)((*ds)->Dval(f1), *(c1val++)); - dist += (diff * diff); - } - return sqrt(dist); -} - -std::string Cpptraj::Cluster::Metric_Data_Euclid::Description() const { - return SetNames("data (Euclidean) "); -} - -void Cpptraj::Cluster::Metric_Data_Euclid::Info() const { - mprintf("\tMetric: Euclidean distance (%zu sets)\n", dsets_.size()); -} diff --git a/src/Cluster/Metric_Data_Euclid.h b/src/Cluster/Metric_Data_Euclid.h deleted file mode 100644 index b9bbb38eba..0000000000 --- a/src/Cluster/Metric_Data_Euclid.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef INC_CLUSTER_METRIC_DATA_EUCLID -#define INC_CLUSTER_METRIC_DATA_EUCLID -#include "Metric_Data.h" -namespace Cpptraj { -namespace Cluster { - -/// Metric for scalar DataSet(s), Euclidean distance. -class Metric_Data_Euclid : public Metric_Data { - public: - Metric_Data_Euclid() : Metric_Data(EUCLID) {} - // ----- Metric ------------------------------ - double FrameDist(int, int); - double CentroidDist( Centroid*, Centroid* ); - double FrameCentroidDist(int, Centroid*); - Metric* Copy() { return new Metric_Data_Euclid( *this ); } - std::string Description() const; - void Info() const; -}; - -} -} -#endif diff --git a/src/Cluster/Metric_Data_Manhattan.cpp b/src/Cluster/Metric_Data_Manhattan.cpp deleted file mode 100644 index 5bccd06181..0000000000 --- a/src/Cluster/Metric_Data_Manhattan.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include // fabs -#include "Metric_Data_Manhattan.h" -#include "Centroid_Multi.h" -#include "../CpptrajStdio.h" -#include "../DataSet_1D.h" - -double Cpptraj::Cluster::Metric_Data_Manhattan::FrameDist(int f1, int f2) { - double dist = 0.0; - DcArray::const_iterator dcalc = dcalcs_.begin(); - for (D1Array::iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds, ++dcalc) { - dist += fabs( (*dcalc)((*ds)->Dval(f1), (*ds)->Dval(f2)) ); - } - return dist; -} - -double Cpptraj::Cluster::Metric_Data_Manhattan::CentroidDist(Centroid* c1, Centroid* c2) { - double dist = 0.0; - Centroid_Multi::Darray::const_iterator c2val = ((Centroid_Multi*)c2)->Cvals().begin(); - DcArray::const_iterator dcalc = dcalcs_.begin(); - for (Centroid_Multi::Darray::const_iterator c1val = ((Centroid_Multi*)c1)->Cvals().begin(); - c1val != ((Centroid_Multi*)c1)->Cvals().end(); - ++c1val, ++dcalc) - { - dist += fabs( (*dcalc)(*c1val, *(c2val++)) ); - } - return dist; -} - -double Cpptraj::Cluster::Metric_Data_Manhattan::FrameCentroidDist(int f1, Centroid* c1) { - double dist = 0.0; - Centroid_Multi::Darray::const_iterator c1val = ((Centroid_Multi*)c1)->Cvals().begin(); - DcArray::const_iterator dcalc = dcalcs_.begin(); - for (D1Array::const_iterator ds = dsets_.begin(); ds != dsets_.end(); ++ds) { - dist += fabs( (*dcalc)((*ds)->Dval(f1), *(c1val++)) ); - } - return dist; -} - -std::string Cpptraj::Cluster::Metric_Data_Manhattan::Description() const { - return SetNames("data (Manhattan) "); -} - -void Cpptraj::Cluster::Metric_Data_Manhattan::Info() const { - mprintf("\tMetric: Manhattan distance (%zu sets)\n", dsets_.size()); -} diff --git a/src/Cluster/Metric_Data_Manhattan.h b/src/Cluster/Metric_Data_Manhattan.h deleted file mode 100644 index c465ad1d0b..0000000000 --- a/src/Cluster/Metric_Data_Manhattan.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef INC_CLUSTER_METRIC_DATA_MANHATTAN -#define INC_CLUSTER_METRIC_DATA_MANHATTAN -#include "Metric_Data.h" -namespace Cpptraj { -namespace Cluster { - -/// Metric for scalar DataSet(s), Manhattan distance. -class Metric_Data_Manhattan : public Metric_Data { - public: - Metric_Data_Manhattan() : Metric_Data(MANHATTAN) {} - // ----- Metric ------------------------------ - double FrameDist(int, int); - double CentroidDist( Centroid*, Centroid* ); - double FrameCentroidDist(int, Centroid*); - Metric* Copy() { return new Metric_Data_Manhattan( *this ); } - std::string Description() const; - void Info() const; -}; - -} -} -#endif From a1ba34e845a238825b0959dbfe475c700cf3440b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 12:16:24 -0400 Subject: [PATCH 339/417] Remove obsolete metric types --- src/Cluster/Metric.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index f363f6b812..a99927f132 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -14,7 +14,7 @@ const int UNCLASSIFIED = -2; /// Abstract base class for calculating distance between points or determining centroid. class Metric { public: - enum Type { RMS=0, DME, SRMSD, EUCLID, MANHATTAN, MATRIX2D }; + enum Type { RMS=0, DME, SRMSD, SCALAR, TORSION, EUCLID, MANHATTAN, MATRIX2D, UNKNOWN_METRIC }; enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; /// CONSTRUCTOR From 4aea9a797c0bf4fff07664078b1f05f31f1ce04e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 13:50:14 -0400 Subject: [PATCH 340/417] Add Info routine for MetricArray --- src/Cluster/MetricArray.cpp | 10 ++++++++++ src/Cluster/MetricArray.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index b97664378e..c613d00640 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -173,3 +173,13 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg return 0; } + +/** Call the info array for all metrics.*/ +void Cpptraj::Cluster::MetricArray::Info() const { + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + { + mprintf("\tMetric %u for '%s', weight factor %g\n", + idx, sets_[idx]->legend(), weights_[idx]); + metrics_[idx]->Info(); + } +} diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 1d31e6352c..66ed9f8e32 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -26,6 +26,11 @@ class MetricArray { static const char* MetricArgs_; /// Initialize with data sets and user arguments int InitMetricArray(DataSetList const&, ArgList&, int); + + /// \return True if no metrics have been initialized + bool empty() const { return metrics_.empty(); } + /// Call Info() routines for all metrics + void Info() const; private: /// Clear array void Clear(); From 61d980763896839d6f82dd483c431e50b32f44bf Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 13:53:26 -0400 Subject: [PATCH 341/417] Add setup for metrics --- src/Cluster/MetricArray.cpp | 16 +++++++++++++++- src/Cluster/MetricArray.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index c613d00640..33c59852e4 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -174,7 +174,21 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg return 0; } -/** Call the info array for all metrics.*/ +/** Call the Setup function for all metrics. */ +int Cpptraj::Cluster::MetricArray::Setup() { + int err = 0; + for (std::vector::const_iterator it = metrics_.begin(); + it != metrics_.end(); ++it) + { + if ((*it)->Setup()) { + mprinterr("Error: Metric '%s' setup failed.\n", (*it)->Description().c_str()); + err++; + } + } + return err; +} + +/** Call the Info function for all metrics. */ void Cpptraj::Cluster::MetricArray::Info() const { for (unsigned int idx = 0; idx != metrics_.size(); idx++) { diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 66ed9f8e32..1fe77442b5 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -26,6 +26,8 @@ class MetricArray { static const char* MetricArgs_; /// Initialize with data sets and user arguments int InitMetricArray(DataSetList const&, ArgList&, int); + /// Set up all metrics + int Setup(); /// \return True if no metrics have been initialized bool empty() const { return metrics_.empty(); } From e093dccecfa64db2df1c947d467126bb339263b6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 13:56:10 -0400 Subject: [PATCH 342/417] Really remove obsolete metric types --- src/Cluster/Metric.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/Metric.h b/src/Cluster/Metric.h index a99927f132..bfa561c35e 100644 --- a/src/Cluster/Metric.h +++ b/src/Cluster/Metric.h @@ -14,7 +14,7 @@ const int UNCLASSIFIED = -2; /// Abstract base class for calculating distance between points or determining centroid. class Metric { public: - enum Type { RMS=0, DME, SRMSD, SCALAR, TORSION, EUCLID, MANHATTAN, MATRIX2D, UNKNOWN_METRIC }; + enum Type { RMS=0, DME, SRMSD, SCALAR, TORSION, MATRIX2D, UNKNOWN_METRIC }; enum CentOpType { ADDFRAME=0, SUBTRACTFRAME }; /// CONSTRUCTOR From 429bf520c2232aef8f4bae7d84cc2d43e7bc5573 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 14:02:26 -0400 Subject: [PATCH 343/417] Ensure # of points covered by Metrics is the same --- src/Cluster/MetricArray.cpp | 21 +++++++++++++++++++-- src/Cluster/MetricArray.h | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 33c59852e4..19138ad86e 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -12,7 +12,10 @@ #include "Metric_Torsion.h" /** CONSTRUCTOR */ -Cpptraj::Cluster::MetricArray::MetricArray() {} +Cpptraj::Cluster::MetricArray::MetricArray() : + type_(MANHATTAN), + ntotal_(0) +{} /** DESTRUCTOR */ Cpptraj::Cluster::MetricArray::~MetricArray() { @@ -174,9 +177,12 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg return 0; } -/** Call the Setup function for all metrics. */ +/** Call the Setup function for all metrics. Check that size of each Metric + * is the same. + */ int Cpptraj::Cluster::MetricArray::Setup() { int err = 0; + ntotal_ = 0; for (std::vector::const_iterator it = metrics_.begin(); it != metrics_.end(); ++it) { @@ -184,6 +190,17 @@ int Cpptraj::Cluster::MetricArray::Setup() { mprinterr("Error: Metric '%s' setup failed.\n", (*it)->Description().c_str()); err++; } + if (ntotal_ == 0) + ntotal_ = (*it)->Ntotal(); + else { + if ( (*it)->Ntotal() != ntotal_ ) { + mprinterr("Error: Number of points covered by metric '%s' (%u) is not equal\n" + "Error: to number of points covered by metric '%s' (%u)\n", + (*it)->Description().c_str(), (*it)->Ntotal(), + metrics_.front()->Description().c_str(), metrics_.front()->Ntotal()); + return 1; + } + } } return err; } diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 1fe77442b5..3c9d4c02c1 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -33,6 +33,8 @@ class MetricArray { bool empty() const { return metrics_.empty(); } /// Call Info() routines for all metrics void Info() const; + /// \return Number of points covered by each Metric + unsigned int Ntotal() const { return ntotal_; } private: /// Clear array void Clear(); @@ -43,6 +45,7 @@ class MetricArray { std::vector sets_; ///< Sets corresponding to each Metric std::vector weights_; ///< Weight of each metric DistanceType type_; ///< Type of distance calc to perform + unsigned int ntotal_; ///< Total number of points covered by any Metric }; } From d73d178209bf7e2987107e08d1b5ad2468154187 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 14:19:17 -0400 Subject: [PATCH 344/417] Add tool to check for missing source files from make/cmake --- devtools/CheckForMissingSource.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 devtools/CheckForMissingSource.sh diff --git a/devtools/CheckForMissingSource.sh b/devtools/CheckForMissingSource.sh new file mode 100755 index 0000000000..805b8e6a57 --- /dev/null +++ b/devtools/CheckForMissingSource.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +MAKE_SOURCES=`ls *files` +if [ -z "$MAKE_SOURCES" ] ; then + MAKE_SOURCES=Makefile +fi +CMAKE_SOURCES=CMakeLists.txt + +echo "Make sources : $MAKE_SOURCES" +echo "Cmake sources : $CMAKE_SOURCES" + +if [ ! -f "$MAKE_SOURCES" ] ; then + echo "Make sources not found." + exit 1 +fi + +if [ ! -f "$CMAKE_SOURCES" ] ; then + echo "Cmake sources not found." + exit 1 +fi + +SOURCES=`ls *.cpp *.c *.F90 2> /dev/null` + +for FILE1 in $MAKE_SOURCES $CMAKE_SOURCES ; do + for FILE2 in $SOURCES ; do + if [ -z "`grep $FILE2 $FILE1`" ] ; then + echo "$FILE2 appears to be missing from $FILE1" + fi + done +done From 3048d0c04ca7e7a2dd14469ed9babcfe56069a84 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 14:19:50 -0400 Subject: [PATCH 345/417] Start incorporating MetricArray --- src/Cluster/CMakeLists.txt | 6 +++--- src/Cluster/MetricArray.h | 2 +- src/Cluster/clusterdepend | 8 ++++---- src/Cluster/clusterfiles | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Cluster/CMakeLists.txt b/src/Cluster/CMakeLists.txt index 4ae3aa584a..e9ad3746e8 100644 --- a/src/Cluster/CMakeLists.txt +++ b/src/Cluster/CMakeLists.txt @@ -14,12 +14,12 @@ set(CLUSTER_SOURCES DrawGraph.cpp DynamicMatrix.cpp List.cpp - Metric_Data.cpp - Metric_Data_Euclid.cpp - Metric_Data_Manhattan.cpp + MetricArray.cpp Metric_DME.cpp Metric_RMS.cpp + Metric_Scalar.cpp Metric_SRMSD.cpp + Metric_Torsion.cpp Node.cpp Output.cpp PairwiseMatrix.cpp diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 3c9d4c02c1..a3599e724b 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -41,7 +41,7 @@ class MetricArray { /// Allocate metric of given type Metric* AllocateMetric(Metric::Type); - std::vector metrics_; ///< Hold each Metric + std::vector metrics_; ///< Hold each Metric TODO deal with OpenMP std::vector sets_; ///< Sets corresponding to each Metric std::vector weights_; ///< Weight of each metric DistanceType type_; ///< Type of distance calc to perform diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 33042704bd..30f3d29815 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -8,16 +8,16 @@ Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../Coordi Cframes.o : Cframes.cpp Cframes.h Cmatrix_Binary.o : Cmatrix_Binary.cpp ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h Cframes.h Cmatrix_Binary.h Cmatrix_NC.o : Cmatrix_NC.cpp ../CpptrajStdio.h ../FileName.h ../NC_Routines.h Cframes.h Cmatrix_NC.h -Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h Metric_DME.h Metric_Data.h Metric_Data_Euclid.h Metric_Data_Manhattan.h Metric_RMS.h Metric_SRMSD.h Node.h Output.h PairwiseMatrix.h Results.h Results_Coords.h Sieve.h +Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.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 ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h MetricArray.h Node.h Output.h PairwiseMatrix.h Results.h Results_Coords.h Sieve.h DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h PairwiseMatrix.h DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.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 ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h Metric_DME.o : Metric_DME.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_DME.h -Metric_Data.o : Metric_Data.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Multi.h Cframes.h Metric.h Metric_Data.h -Metric_Data_Euclid.o : Metric_Data_Euclid.cpp ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Multi.h Metric.h Metric_Data.h Metric_Data_Euclid.h -Metric_Data_Manhattan.o : Metric_Data_Manhattan.cpp ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Multi.h Metric.h Metric_Data.h Metric_Data_Manhattan.h Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_RMS.h Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_SRMSD.h +Metric_Scalar.o : Metric_Scalar.cpp ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Scalar.h +Metric_Torsion.o : Metric_Torsion.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Torsion.h Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Cframes.h Metric.h Node.h PairwiseMatrix.h Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h PairwiseMatrix.o : PairwiseMatrix.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Metric.h PairwiseMatrix.h diff --git a/src/Cluster/clusterfiles b/src/Cluster/clusterfiles index 67fe9d902e..ed6405133d 100644 --- a/src/Cluster/clusterfiles +++ b/src/Cluster/clusterfiles @@ -14,12 +14,12 @@ CLUSTER_SOURCES= \ DrawGraph.cpp \ DynamicMatrix.cpp \ List.cpp \ - Metric_Data.cpp \ - Metric_Data_Euclid.cpp \ - Metric_Data_Manhattan.cpp \ + MetricArray.cpp \ Metric_DME.cpp \ Metric_RMS.cpp \ + Metric_Scalar.cpp \ Metric_SRMSD.cpp \ + Metric_Torsion.cpp \ Node.cpp \ Output.cpp \ PairwiseMatrix.cpp \ From 521d46d7952df74c240e4fd6309efb81122eea7b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 14:24:45 -0400 Subject: [PATCH 346/417] Add destruct, assign and copy to CentroidArray --- src/Cluster/CentroidArray.cpp | 28 ++++++++++++++++++++++++++++ src/Cluster/CentroidArray.h | 9 +++++++++ 2 files changed, 37 insertions(+) diff --git a/src/Cluster/CentroidArray.cpp b/src/Cluster/CentroidArray.cpp index 10936f1f19..43c08d2c69 100644 --- a/src/Cluster/CentroidArray.cpp +++ b/src/Cluster/CentroidArray.cpp @@ -4,4 +4,32 @@ /** CONSTRUCTOR */ Cpptraj::Cluster::CentroidArray::CentroidArray() {} +/** DESTRUCTOR */ +Cpptraj::Cluster::CentroidArray::~CentroidArray() { + Clear(); +} +/** COPY CONSTRUCTOR */ +Cpptraj::Cluster::CentroidArray::CentroidArray(CentroidArray const& rhs) { + centroids_.reserve( rhs.centroids_.size() ); + for (std::vector::const_iterator it = rhs.centroids_.begin(); it != rhs.centroids_.end(); ++it) + centroids_.push_back( (*it)->Copy() ); +} + +/** ASSIGNMENT */ +Cpptraj::Cluster::CentroidArray& + Cpptraj::Cluster::CentroidArray::operator=(CentroidArray const& rhs) +{ + if (this == &rhs) return *this; + centroids_.clear(); + centroids_.reserve( rhs.centroids_.size() ); + for (std::vector::const_iterator it = rhs.centroids_.begin(); it != rhs.centroids_.end(); ++it) + centroids_.push_back( (*it)->Copy() ); + return *this; +} + +/** Clear the centroid array. */ +void Cpptraj::Cluster::CentroidArray::Clear() { + for (std::vector::iterator it = centroids_.begin(); it != centroids_.end(); ++it) + delete *it; +} diff --git a/src/Cluster/CentroidArray.h b/src/Cluster/CentroidArray.h index 7bb5c75501..14db529917 100644 --- a/src/Cluster/CentroidArray.h +++ b/src/Cluster/CentroidArray.h @@ -7,7 +7,16 @@ class Centroid; /// Hold Centroids of various types class CentroidArray { public: + /// CONSTRUCTOR CentroidArray(); + /// DESTRUCTOR + ~CentroidArray(); + /// COPY + CentroidArray(CentroidArray const&); + /// ASSIGN + CentroidArray& operator=(CentroidArray const&); + /// Clear the centroid array + void Clear(); private: std::vector centroids_; }; From 78a0b1074dffb97f647b5a9fffb8262d6fc3586c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 14:26:46 -0400 Subject: [PATCH 347/417] Add missing vars to copy/assign --- src/Cluster/MetricArray.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 19138ad86e..dcb42d57a1 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -23,7 +23,12 @@ Cpptraj::Cluster::MetricArray::~MetricArray() { } /** COPY CONSTRUCTOR */ -Cpptraj::Cluster::MetricArray::MetricArray(MetricArray const& rhs) { +Cpptraj::Cluster::MetricArray::MetricArray(MetricArray const& rhs) : + sets_(rhs.sets_), + weights_(rhs.weights_), + type_(rhs.type_), + ntotal_(rhs.ntotal_) +{ metrics_.reserve( rhs.metrics_.size() ); for (std::vector::const_iterator it = rhs.metrics_.begin(); it != rhs.metrics_.end(); ++it) metrics_.push_back( (*it)->Copy() ); @@ -38,6 +43,10 @@ Cpptraj::Cluster::MetricArray& metrics_.reserve( rhs.metrics_.size() ); for (std::vector::const_iterator it = rhs.metrics_.begin(); it != rhs.metrics_.end(); ++it) metrics_.push_back( (*it)->Copy() ); + sets_ = rhs.sets_; + weights_ = rhs.weights_; + type_ = rhs.type_; + ntotal_ = rhs.ntotal_; return *this; } From a047f795711fc02647e7c8312b91265ef96235b2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 14:37:16 -0400 Subject: [PATCH 348/417] Add new centroid calc --- src/Cluster/CentroidArray.h | 3 +++ src/Cluster/MetricArray.cpp | 12 ++++++++++++ src/Cluster/MetricArray.h | 5 ++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Cluster/CentroidArray.h b/src/Cluster/CentroidArray.h index 14db529917..a465c08b66 100644 --- a/src/Cluster/CentroidArray.h +++ b/src/Cluster/CentroidArray.h @@ -17,6 +17,9 @@ class CentroidArray { CentroidArray& operator=(CentroidArray const&); /// Clear the centroid array void Clear(); + + /// Add given centroid to array + void push_back( Centroid* c) { centroids_.push_back( c ); } private: std::vector centroids_; }; diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index dcb42d57a1..d792dc229e 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -1,4 +1,5 @@ #include "MetricArray.h" +#include "CentroidArray.h" #include "Metric.h" #include "../ArgList.h" #include "../CpptrajStdio.h" @@ -223,3 +224,14 @@ void Cpptraj::Cluster::MetricArray::Info() const { metrics_[idx]->Info(); } } + +// ----------------------------------------------- +void Cpptraj::Cluster::MetricArray::NewCentroid(CentroidArray& centroids, Cframes const& framesIn) +// TODO const? +{ + centroids.Clear(); + for (std::vector::iterator it = metrics_.begin(); it != metrics_.end(); ++it) + { + centroids.push_back( (*it)->NewCentroid( framesIn ) ); + } +} diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index a3599e724b..07515c5828 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -7,7 +7,7 @@ class DataSet; class DataSetList; namespace Cpptraj { namespace Cluster { - +class CentroidArray; /// Hold Metrics of various types class MetricArray { public: @@ -35,6 +35,9 @@ class MetricArray { void Info() const; /// \return Number of points covered by each Metric unsigned int Ntotal() const { return ntotal_; } + + /// Calculate new centroid for each metric + void NewCentroid(CentroidArray&, Cframes const&); private: /// Clear array void Clear(); From 066e906f696f58f5587d4eb814e6960c6dc55f14 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 14:37:33 -0400 Subject: [PATCH 349/417] Add CentroidArray --- src/Cluster/CMakeLists.txt | 1 + src/Cluster/clusterdepend | 25 +++++++++++++------------ src/Cluster/clusterfiles | 1 + 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Cluster/CMakeLists.txt b/src/Cluster/CMakeLists.txt index e9ad3746e8..33979826c1 100644 --- a/src/Cluster/CMakeLists.txt +++ b/src/Cluster/CMakeLists.txt @@ -7,6 +7,7 @@ set(CLUSTER_SOURCES Algorithm_Kmeans.cpp BestReps.cpp Centroid_Coord.cpp + CentroidArray.cpp Cframes.cpp Cmatrix_Binary.cpp Cmatrix_NC.cpp diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 30f3d29815..033832b0dd 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,25 +1,26 @@ -Algorithm.o : Algorithm.cpp ../CpptrajStdio.h Algorithm.h Cframes.h Metric.h Node.h PairwiseMatrix.h -Algorithm_DBscan.o : Algorithm_DBscan.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 ../DataFile.h ../DataSet.h ../DataSetList.h ../DataSet_2D.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../DataSet_MatrixDbl.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 ../ProgressBar.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 Algorithm.h Algorithm_DBscan.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h -Algorithm_DPeaks.o : Algorithm_DPeaks.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_Mesh.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../Spline.h ../TextFormat.h Algorithm.h Algorithm_DPeaks.h Cframes.h List.h Node.h PairwiseMatrix.h -Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h ../ProgressBar.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h Cframes.h DynamicMatrix.h List.h Node.h PairwiseMatrix.h -Algorithm_Kmeans.o : Algorithm_Kmeans.cpp ../ArgList.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h ../ProgressBar.h ../Random.h Algorithm.h Algorithm_Kmeans.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h -BestReps.o : BestReps.cpp ../CpptrajStdio.h BestReps.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +Algorithm.o : Algorithm.cpp ../CpptrajStdio.h Algorithm.h CentroidArray.h Cframes.h Metric.h Node.h PairwiseMatrix.h +Algorithm_DBscan.o : Algorithm_DBscan.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 ../DataFile.h ../DataSet.h ../DataSetList.h ../DataSet_2D.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../DataSet_MatrixDbl.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 ../ProgressBar.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 Algorithm.h Algorithm_DBscan.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +Algorithm_DPeaks.o : Algorithm_DPeaks.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_Mesh.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../Spline.h ../TextFormat.h Algorithm.h Algorithm_DPeaks.h CentroidArray.h Cframes.h List.h Node.h PairwiseMatrix.h +Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h ../ProgressBar.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h CentroidArray.h Cframes.h DynamicMatrix.h List.h Node.h PairwiseMatrix.h +Algorithm_Kmeans.o : Algorithm_Kmeans.cpp ../ArgList.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h ../ProgressBar.h ../Random.h Algorithm.h Algorithm_Kmeans.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +BestReps.o : BestReps.cpp ../CpptrajStdio.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +CentroidArray.o : CentroidArray.cpp Centroid.h CentroidArray.h Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.o : Cframes.cpp Cframes.h Cmatrix_Binary.o : Cmatrix_Binary.cpp ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h Cframes.h Cmatrix_Binary.h Cmatrix_NC.o : Cmatrix_NC.cpp ../CpptrajStdio.h ../FileName.h ../NC_Routines.h Cframes.h Cmatrix_NC.h -Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.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 ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h MetricArray.h Node.h Output.h PairwiseMatrix.h Results.h Results_Coords.h Sieve.h +Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.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 ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h CentroidArray.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h MetricArray.h Node.h Output.h PairwiseMatrix.h Results.h Results_Coords.h Sieve.h DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h PairwiseMatrix.h DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h -List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h -MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.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 ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h +List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.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 ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h Metric_DME.o : Metric_DME.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_DME.h Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_RMS.h Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_SRMSD.h Metric_Scalar.o : Metric_Scalar.cpp ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Scalar.h Metric_Torsion.o : Metric_Torsion.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Torsion.h -Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Cframes.h Metric.h Node.h PairwiseMatrix.h -Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h +Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h CentroidArray.h Cframes.h Metric.h Node.h PairwiseMatrix.h +Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h PairwiseMatrix.o : PairwiseMatrix.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Metric.h PairwiseMatrix.h -Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Cframes.h List.h Metric.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h +Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Cframes.h List.h Metric.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h diff --git a/src/Cluster/clusterfiles b/src/Cluster/clusterfiles index ed6405133d..a3eec29b44 100644 --- a/src/Cluster/clusterfiles +++ b/src/Cluster/clusterfiles @@ -7,6 +7,7 @@ CLUSTER_SOURCES= \ Algorithm_Kmeans.cpp \ BestReps.cpp \ Centroid_Coord.cpp \ + CentroidArray.cpp \ Cframes.cpp \ Cmatrix_Binary.cpp \ Cmatrix_NC.cpp \ From b37a14b0e4c15ff839227dabe13514b68b0574bb Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 14:49:16 -0400 Subject: [PATCH 350/417] Add CalculateCentroid --- src/Cluster/CentroidArray.h | 7 ++++++- src/Cluster/MetricArray.cpp | 12 ++++++++++++ src/Cluster/MetricArray.h | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Cluster/CentroidArray.h b/src/Cluster/CentroidArray.h index a465c08b66..4bd0b27e67 100644 --- a/src/Cluster/CentroidArray.h +++ b/src/Cluster/CentroidArray.h @@ -18,8 +18,13 @@ class CentroidArray { /// Clear the centroid array void Clear(); - /// Add given centroid to array + /// \return number of centroids + unsigned int size() const { return centroids_.size(); } + + /// Add given centroid pointer to array void push_back( Centroid* c) { centroids_.push_back( c ); } + /// \return Centroid pointer at given position + Centroid* operator[](int idx) const { return centroids_[idx]; } private: std::vector centroids_; }; diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index d792dc229e..9bf1259ae6 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -226,6 +226,7 @@ void Cpptraj::Cluster::MetricArray::Info() const { } // ----------------------------------------------- +/** Calculate new centroids for given list. */ void Cpptraj::Cluster::MetricArray::NewCentroid(CentroidArray& centroids, Cframes const& framesIn) // TODO const? { @@ -235,3 +236,14 @@ void Cpptraj::Cluster::MetricArray::NewCentroid(CentroidArray& centroids, Cframe centroids.push_back( (*it)->NewCentroid( framesIn ) ); } } + +/** Calculate centroids in given list. */ +void Cpptraj::Cluster::MetricArray::CalculateCentroid(CentroidArray& centroids, Cframes const& framesIn) +{ + if (centroids.size() != metrics_.size()) { + mprinterr("Internal Error: MetricArray::CalculateCentroid: centroids and metrics_ sizes do not match.\n"); + return; + } + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + metrics_[idx]->CalculateCentroid( centroids[idx], framesIn ); +} diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 07515c5828..b024f330c6 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -38,6 +38,8 @@ class MetricArray { /// Calculate new centroid for each metric void NewCentroid(CentroidArray&, Cframes const&); + /// Calculate centroids for each metric + void CalculateCentroid(CentroidArray&, Cframes const&); private: /// Clear array void Clear(); From 82b1de0d84de36c7862dd85f62f0b68c3fd09f58 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 15:22:27 -0400 Subject: [PATCH 351/417] Add the difference distance calcs --- src/Cluster/MetricArray.cpp | 51 +++++++++++++++++++++++++++++++++++++ src/Cluster/MetricArray.h | 9 +++++++ 2 files changed, 60 insertions(+) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 9bf1259ae6..349d5d5756 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -1,4 +1,5 @@ #include "MetricArray.h" +#include //sqrt #include "CentroidArray.h" #include "Metric.h" #include "../ArgList.h" @@ -27,6 +28,7 @@ Cpptraj::Cluster::MetricArray::~MetricArray() { Cpptraj::Cluster::MetricArray::MetricArray(MetricArray const& rhs) : sets_(rhs.sets_), weights_(rhs.weights_), + temp_(rhs.temp_), type_(rhs.type_), ntotal_(rhs.ntotal_) { @@ -46,6 +48,7 @@ Cpptraj::Cluster::MetricArray& metrics_.push_back( (*it)->Copy() ); sets_ = rhs.sets_; weights_ = rhs.weights_; + temp_ = rhs.temp_; type_ = rhs.type_; ntotal_ = rhs.ntotal_; return *this; @@ -57,6 +60,7 @@ void Cpptraj::Cluster::MetricArray::Clear() { delete *it; sets_.clear(); weights_.clear(); + temp_.clear(); } /** /return Pointer to Metric of given type. */ @@ -183,6 +187,8 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg // Default weights are 1 weights_.assign(metrics_.size(), 1.0); } + // Temp space for calcs + temp_.assign(metrics_.size(), 0.0); return 0; } @@ -217,6 +223,8 @@ int Cpptraj::Cluster::MetricArray::Setup() { /** Call the Info function for all metrics. */ void Cpptraj::Cluster::MetricArray::Info() const { + static const char* DistanceTypeStr[] = { "Manhattan", "Euclidean" }; + mprintf("\tUsing %s distance.\n", DistanceTypeStr[type_]); for (unsigned int idx = 0; idx != metrics_.size(); idx++) { mprintf("\tMetric %u for '%s', weight factor %g\n", @@ -247,3 +255,46 @@ void Cpptraj::Cluster::MetricArray::CalculateCentroid(CentroidArray& centroids, for (unsigned int idx = 0; idx != metrics_.size(); idx++) metrics_[idx]->CalculateCentroid( centroids[idx], framesIn ); } + +/** Update centroids by performing given operation between given frame and centroids. */ +void Cpptraj::Cluster::MetricArray::FrameOpCentroid(int f1, CentroidArray& centroids, + double oldSize, Metric::CentOpType OP) +{ + if (centroids.size() != metrics_.size()) { + mprinterr("Internal Error: MetricArray::FrameOpCentroid: centroids and metrics_ sizes do not match.\n"); + return; + } + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + metrics_[idx]->FrameOpCentroid( f1, centroids[idx], oldSize, OP ); +} + +/** Manhattan distance. */ +double Cpptraj::Cluster::MetricArray::Dist_Manhattan() const { + double dist = 0.0; + for (unsigned int idx = 0; idx != temp_.size(); idx++) + dist += (weights_[idx] * temp_[idx]); + return dist; +} + +/** Euclidean distance. */ +double Cpptraj::Cluster::MetricArray::Dist_Euclidean() const { + double sumdist2 = 0.0; + for (unsigned int idx = 0; idx != temp_.size(); idx++) { + double dist2 = temp_[idx] * temp_[idx]; + sumdist2 += (weights_[idx] * dist2); + } + return sqrt(sumdist2); +} + +/** Perform distance calc according to current type. */ +double Cpptraj::Cluster::MetricArray::DistCalc() const { + double dist = 0; + switch (type_) { + case MANHATTAN : dist = Dist_Manhattan(); break; + case EUCLID : dist = Dist_Euclidean(); break; + } + return dist; +} + +/** Calculate distance between given frame and centroids. */ + diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index b024f330c6..a9a2c0a9d6 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -40,15 +40,24 @@ class MetricArray { void NewCentroid(CentroidArray&, Cframes const&); /// Calculate centroids for each metric void CalculateCentroid(CentroidArray&, Cframes const&); + /// Update centroids by performing given operation between given frame and centroids. + void FrameOpCentroid(int, CentroidArray&, double, Metric::CentOpType); private: /// Clear array void Clear(); /// Allocate metric of given type Metric* AllocateMetric(Metric::Type); + /// Manhattan distance + double Dist_Manhattan() const; + /// Euclidean distance + double Dist_Euclidean() const; + /// Distance based on type_ + double DistCalc() const; std::vector metrics_; ///< Hold each Metric TODO deal with OpenMP std::vector sets_; ///< Sets corresponding to each Metric std::vector weights_; ///< Weight of each metric + std::vector temp_; ///< For calculations; hold distances from each metric. DistanceType type_; ///< Type of distance calc to perform unsigned int ntotal_; ///< Total number of points covered by any Metric }; From 53c19ae9c23d89c30b0dd61423d2cf874899aafc Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 16:14:03 -0400 Subject: [PATCH 352/417] Frame to centroids distance --- src/Cluster/MetricArray.cpp | 11 ++++++++++- src/Cluster/MetricArray.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 349d5d5756..239fa0da50 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -297,4 +297,13 @@ double Cpptraj::Cluster::MetricArray::DistCalc() const { } /** Calculate distance between given frame and centroids. */ - +double Cpptraj::Cluster::MetricArray::FrameCentroidDist(int frame, CentroidArray const& centroids ) +{ + if (centroids.size() != metrics_.size()) { + mprinterr("Internal Error: MetricArray::FrameOpCentroid: centroids and metrics_ sizes do not match.\n"); + return -1.0; + } + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + temp_[idx] = metrics_[idx]->FrameCentroidDist( frame, centroids[idx] ); + return DistCalc(); +} diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index a9a2c0a9d6..8eca32fa9f 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -42,6 +42,8 @@ class MetricArray { void CalculateCentroid(CentroidArray&, Cframes const&); /// Update centroids by performing given operation between given frame and centroids. void FrameOpCentroid(int, CentroidArray&, double, Metric::CentOpType); + /// \return distance between given frame and centroids + double FrameCentroidDist(int, CentroidArray const&); private: /// Clear array void Clear(); From b2cb3c52d9b93df9b56d26f64cf28c41e5b4be17 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 16:14:17 -0400 Subject: [PATCH 353/417] Convert to use CentroidArray/MetricArray --- src/Cluster/Node.cpp | 54 +++++++++++++++++---------------------- src/Cluster/Node.h | 38 +++++++++++++-------------- src/Cluster/clusterdepend | 2 +- 3 files changed, 43 insertions(+), 51 deletions(-) diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index 4ef7e900b8..f746c57742 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -1,14 +1,12 @@ //#include // DBL_MAX #include "Node.h" -#include "Centroid.h" -#include "Metric.h" +#include "MetricArray.h" #include "PairwiseMatrix.h" #include "../DataSet_float.h" #include "../DataSet_integer.h" // CONSTRUCTOR Cpptraj::Cluster::Node::Node() : - centroid_(0), avgSil_(0), eccentricity_(0), refRms_(0), @@ -17,35 +15,31 @@ Cpptraj::Cluster::Node::Node() : {} // DESTRUCTOR -Cpptraj::Cluster::Node::~Node() { - if (centroid_ != 0) delete centroid_; -} +Cpptraj::Cluster::Node::~Node() { } /** Create new cluster with given number containing given frames. Calculate * initial centroid and set initial best rep frame to front, even though * that will probably be wrong when number of frames in the list > 1. */ -Cpptraj::Cluster::Node::Node(Metric* Cdist, Cframes const& frameListIn, int numIn) : +Cpptraj::Cluster::Node::Node(MetricArray& Cdist, Cframes const& frameListIn, int numIn) : frameList_(frameListIn), - centroid_(Cdist->NewCentroid(frameList_)), bestReps_(1, RepPair(frameListIn.front(), 0.0)), eccentricity_(0.0), num_(numIn), needsUpdate_(true) -{} +{ + Cdist.NewCentroid( centroids_, frameListIn ); +} // COPY CONSTRUCTOR Cpptraj::Cluster::Node::Node(const Node& rhs) : frameList_( rhs.frameList_ ), - centroid_(0), + centroids_(rhs.centroids_), bestReps_( rhs.bestReps_ ), eccentricity_( rhs.eccentricity_ ), num_( rhs.num_ ), needsUpdate_( rhs.needsUpdate_ ) -{ - if (rhs.centroid_ != 0) - centroid_ = rhs.centroid_->Copy(); -} +{ } // ASSIGNMENT Cpptraj::Cluster::Node& Cpptraj::Cluster::Node::operator=(const Node& rhs) { @@ -54,21 +48,17 @@ Cpptraj::Cluster::Node& Cpptraj::Cluster::Node::operator=(const Node& rhs) { num_ = rhs.num_; bestReps_ = rhs.bestReps_; frameList_ = rhs.frameList_; - if (centroid_ != 0) delete centroid_; - if (rhs.centroid_ != 0) - centroid_ = rhs.centroid_->Copy(); - else - centroid_ = 0; + centroids_ = rhs.centroids_; needsUpdate_ = rhs.needsUpdate_; return *this; } /** Calculate centroid of frames in this Node using given metric. */ -void Cpptraj::Cluster::Node::CalculateCentroid(Metric* Cdist) { - if (centroid_ == 0) - centroid_ = Cdist->NewCentroid( frameList_ ); +void Cpptraj::Cluster::Node::CalculateCentroid(MetricArray& Cdist) { + if (centroids_.empty()) + Cdist.NewCentroid( centroids_, frameList_ ); else - Cdist->CalculateCentroid( centroid_, frameList_ ); + Cdist.CalculateCentroid( centroids_, frameList_ ); } /** Find the frame in the given cluster that is the best representative via @@ -122,29 +112,31 @@ void Cpptraj::Cluster::Node::CalcEccentricity(PairwiseMatrix const& FrameDistanc /** Calculate average distance between all members in cluster and * the centroid. */ -double Cpptraj::Cluster::Node::CalcAvgToCentroid( Metric* Cdist ) const +double Cpptraj::Cluster::Node::CalcAvgToCentroid( MetricArray& Cdist ) const { double avgdist = 0.0; //int idx = 0; // DEBUG //mprintf("AVG DISTANCES FOR CLUSTER %d:\n", Num()); // DEBUG for (frame_iterator frm = frameList_.begin(); frm != frameList_.end(); ++frm) { - double dist = Cdist->FrameCentroidDist( *frm, centroid_ ); + double dist = Cdist.FrameCentroidDist( *frm, centroids_ ); //mprintf("\tDist to %i is %f\n", idx++, dist); // DEBUG avgdist += dist; } return ( avgdist / (double)frameList_.size() ); } -void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(Metric* Cdist, int frame) { - Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), - Metric::SUBTRACTFRAME); +/** Remove specified frame, update the centroid. */ +void Cpptraj::Cluster::Node::RemoveFrameUpdateCentroid(MetricArray& Cdist, int frame) { + Cdist.FrameOpCentroid(frame, centroids_, (double)frameList_.size(), + Metric::SUBTRACTFRAME); RemoveFrameFromCluster( frame ); } -void Cpptraj::Cluster::Node::AddFrameUpdateCentroid(Metric* Cdist, int frame) { - Cdist->FrameOpCentroid(frame, centroid_, (double)frameList_.size(), - Metric::ADDFRAME); +/** Add specified frame, update the centroid. */ +void Cpptraj::Cluster::Node::AddFrameUpdateCentroid(MetricArray& Cdist, int frame) { + Cdist.FrameOpCentroid(frame, centroids_, (double)frameList_.size(), + Metric::ADDFRAME); AddFrameToCluster( frame ); } diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index a0c2ec1b9d..81344e6ba7 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -3,13 +3,13 @@ #include #include // std::pair #include +#include "CentroidArray.h" #include "Cframes.h" // Cframes::const_iterator class DataSet_integer; class DataSet_float; namespace Cpptraj { namespace Cluster { -class Centroid; -class Metric; +class MetricArray; class PairwiseMatrix; // TODO implement needsUpdate_ @@ -24,7 +24,7 @@ class Node { // things like calculating RMSD modify Metric itself to avoid // always reallocating Frames. /// CONSTRUCTOR - Take Metric for calculating centroid, frames, and cluster index. - Node(Metric*, Cframes const&, int); + Node(MetricArray&, Cframes const&, int); /// COPY CONSTRUCTOR Node(const Node&); /// ASSIGNMENT @@ -47,7 +47,7 @@ class Node { /// Find and set frame in the cluster that has lowest distance to all other frames. // int SetBestRep_CumulativeDist(DataSet_Cmatrix const&); /// Calculate average distance of all members to centroid - double CalcAvgToCentroid( Metric*) const; + double CalcAvgToCentroid(MetricArray&) const; /// Const iterator over frame numbers typedef Cframes::const_iterator frame_iterator; /// Const iterator to beginning of frames @@ -69,8 +69,8 @@ class Node { else return bestReps_.front().first; } - /// \return Cluster centroid. - Centroid* Cent() const { return centroid_; } + /// \return Cluster centroid array. + CentroidArray const& Cent() const { return centroids_; } /// \return name assigned via reference std::string const& Cname() const { return name_; } /// \return RMS to reference @@ -85,7 +85,7 @@ class Node { double Silhouette() const { return avgSil_; } /// Calculate centroid of members of this cluster. - void CalculateCentroid(Metric*); + void CalculateCentroid(MetricArray&); /// Add frame to cluster void AddFrameToCluster(int fnum) { frameList_.push_back( fnum ); } /// Set cluster number (for bookkeeping). @@ -107,25 +107,25 @@ class Node { /// Calculate eccentricity for frames in this cluster. void CalcEccentricity(PairwiseMatrix const&); /// Remove specified frame from cluster and update centroid. - void RemoveFrameUpdateCentroid(Metric*, int); + void RemoveFrameUpdateCentroid(MetricArray&, int); /// Add specified frame to cluster and update centroid. - void AddFrameUpdateCentroid(Metric*, int); + void AddFrameUpdateCentroid(MetricArray&, int); /// Calculate cluster population vs time. void CalcCpopVsTime(DataSet_float&, unsigned int, CnormType) const; /// Create cluster lifetime set. void CreateLifetimeSet(DataSet_integer&, unsigned int) const; private: - Cframes frameList_; ///< List of frames belonging to this cluster. - Centroid* centroid_; ///< Centroid of all frames in this cluster. - std::string name_; ///< Cluster name assigned from reference. - RepPairArray bestReps_; ///< Hold best representative frames and their score. - SilPairArray frameSil_; ///< Frame silhouette values. - double avgSil_; ///< Average silhouette value for cluster TODO s.d. as well? - double eccentricity_; ///< Maximum distance between any 2 frames. - double refRms_; ///< Cluster rms to reference (if assigned). - int num_; ///< Cluster number, used for bookkeeping. - bool needsUpdate_; ///< True if internal metrics need updating (e.g. after frames added). + Cframes frameList_; ///< List of frames belonging to this cluster. + CentroidArray centroids_; ///< Centroids (1 for each metric) for all frames in this cluster. + std::string name_; ///< Cluster name assigned from reference. + RepPairArray bestReps_; ///< Hold best representative frames and their score. + SilPairArray frameSil_; ///< Frame silhouette values. + double avgSil_; ///< Average silhouette value for cluster TODO s.d. as well? + double eccentricity_; ///< Maximum distance between any 2 frames. + double refRms_; ///< Cluster rms to reference (if assigned). + int num_; ///< Cluster number, used for bookkeeping. + bool needsUpdate_; ///< True if internal metrics need updating (e.g. after frames added). }; // ----- INLINE FUNCTIONS ------------------------------------------------------ /** Use > since we give higher priority to larger clusters. */ diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 033832b0dd..808c5e5130 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -19,7 +19,7 @@ Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../Ato Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_SRMSD.h Metric_Scalar.o : Metric_Scalar.cpp ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Scalar.h Metric_Torsion.o : Metric_Torsion.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Torsion.h -Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h CentroidArray.h Cframes.h Metric.h Node.h PairwiseMatrix.h +Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h Metric.h MetricArray.h Node.h PairwiseMatrix.h Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h PairwiseMatrix.o : PairwiseMatrix.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Metric.h PairwiseMatrix.h Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Cframes.h List.h Metric.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h From c8aa80511d4fa990be7bb663a94e3d9f173b8dc7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 16:14:36 -0400 Subject: [PATCH 354/417] Add empty() --- src/Cluster/CentroidArray.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Cluster/CentroidArray.h b/src/Cluster/CentroidArray.h index 4bd0b27e67..d6232bf4e9 100644 --- a/src/Cluster/CentroidArray.h +++ b/src/Cluster/CentroidArray.h @@ -20,6 +20,8 @@ class CentroidArray { /// \return number of centroids unsigned int size() const { return centroids_.size(); } + /// \return true if no centroids + bool empty() const { return centroids_.empty(); } /// Add given centroid pointer to array void push_back( Centroid* c) { centroids_.push_back( c ); } From 84e135f5f965a71e76d8c229fe642692046a502e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 13 Sep 2021 16:16:31 -0400 Subject: [PATCH 355/417] Update code comments, delete commented out code --- src/Cluster/Node.cpp | 28 ---------------------------- src/Cluster/Node.h | 2 +- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index f746c57742..69eb18ce23 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -61,34 +61,6 @@ void Cpptraj::Cluster::Node::CalculateCentroid(MetricArray& Cdist) { Cdist.CalculateCentroid( centroids_, frameList_ ); } -/** Find the frame in the given cluster that is the best representative via - * having the lowest cumulative distance to every other point in the cluster. - * Should NOT be used if cluster contains sieved frames. - * \return best representative frame number, or -1 on error. - */ -/* -int Cpptraj::Cluster::Node::SetBestRep_CumulativeDist(DataSet_Cmatrix const& FrameDistancesIn) { - double mindist = DBL_MAX; - int minframe = -1; - for (frame_iterator frm1 = frameList_.begin(); frm1 != frameList_.end(); ++frm1) - { - double cdist = 0.0; - for (frame_iterator frm2 = frameList_.begin(); frm2 != frameList_.end(); ++frm2) - { - if (frm1 != frm2) - cdist += FrameDistancesIn.GetFdist(*frm1, *frm2); - } - if (cdist < mindist) { - mindist = cdist; - minframe = *frm1; - } - } - if (minframe == -1) - return -1; - repFrame_ = minframe; - return minframe; -}*/ - /** Calculate the eccentricity of this cluster (i.e. the largest distance * between any two points in the cluster). */ diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index 81344e6ba7..e994420d8a 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -18,7 +18,7 @@ class Node { public: Node(); ~Node(); - // NOTE: Taking a pointer to Metric here instead of a reference allows + // NOTE: Taking a non-const reference to Metric here allows // PairwiseMatrix to be passed in as const to routines while still // allowing Metric to be used. Metric needs to be non-const because // things like calculating RMSD modify Metric itself to avoid From 41da926212da84b48ee35753e141f3bf22b1a0cf Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 09:28:46 -0400 Subject: [PATCH 356/417] Fold PairwiseMatrix functionality into MetricArray --- src/Cluster/MetricArray.cpp | 384 ++++++++++++++++++++++++++++++++++-- src/Cluster/MetricArray.h | 46 ++++- src/Cluster/clusterdepend | 2 +- 3 files changed, 410 insertions(+), 22 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 239fa0da50..3aa7d512c7 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -1,10 +1,18 @@ #include "MetricArray.h" #include //sqrt +// For filling the pairwise cache +#ifdef _OPENMP +#include +#endif #include "CentroidArray.h" #include "Metric.h" #include "../ArgList.h" #include "../CpptrajStdio.h" +#include "../DataFile.h" +#include "../DataFileList.h" +#include "../DataSet_PairwiseCache.h" #include "../DataSetList.h" +#include "../ProgressBar.h" #include "../StringRoutines.h" // Metric classes #include "Metric_RMS.h" @@ -15,8 +23,12 @@ /** CONSTRUCTOR */ Cpptraj::Cluster::MetricArray::MetricArray() : + debug_(0), type_(MANHATTAN), - ntotal_(0) + ntotal_(0), + cache_(0), + cacheWasAllocated_(false), + pw_mismatch_fatal_(true) {} /** DESTRUCTOR */ @@ -29,8 +41,12 @@ Cpptraj::Cluster::MetricArray::MetricArray(MetricArray const& rhs) : sets_(rhs.sets_), weights_(rhs.weights_), temp_(rhs.temp_), + debug_(rhs.debug_), type_(rhs.type_), - ntotal_(rhs.ntotal_) + ntotal_(rhs.ntotal_), + cache_(rhs.cache_), + cacheWasAllocated_(rhs.cacheWasAllocated_), + pw_mismatch_fatal_(rhs.pw_mismatch_fatal_) { metrics_.reserve( rhs.metrics_.size() ); for (std::vector::const_iterator it = rhs.metrics_.begin(); it != rhs.metrics_.end(); ++it) @@ -49,8 +65,12 @@ Cpptraj::Cluster::MetricArray& sets_ = rhs.sets_; weights_ = rhs.weights_; temp_ = rhs.temp_; + debug_ = rhs.debug_; type_ = rhs.type_; ntotal_ = rhs.ntotal_; + cache_ = rhs.cache_; + cacheWasAllocated_ = rhs.cacheWasAllocated_; + pw_mismatch_fatal_ = rhs.pw_mismatch_fatal_; return *this; } @@ -61,6 +81,176 @@ void Cpptraj::Cluster::MetricArray::Clear() { sets_.clear(); weights_.clear(); temp_.clear(); + cache_ = 0; + cacheWasAllocated_ = false; + pw_mismatch_fatal_ = true; +} + +/** Set up pairwise cache from arguments. */ +int Cpptraj::Cluster::MetricArray::setupPairwiseCache(ArgList& analyzeArgs, + DataSetList& DSL, + DataFileList& DFL) +{ + if (metrics_.empty()) { + mprinterr("Internal Error: allocatePairwise(): No Metrics.\n"); + return 1; + } + cacheWasAllocated_ = false; + // The default pairwise cache file/dataset name + const char* DEFAULT_PAIRDIST_NAME_ = "CpptrajPairDist"; + // The default pairwise cache file type + DataFile::DataFormatType DEFAULT_PAIRDIST_TYPE_ = +# ifdef BINTRAJ + DataFile::CMATRIX_NETCDF; +# else + DataFile::CMATRIX_BINARY; +# endif + + // Determine if we are saving/loading pairwise distances + std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); + DataFile::DataFormatType pairdisttype = DataFile::UNKNOWN_DATA; + bool load_pair = analyzeArgs.hasKey("loadpairdist"); + bool save_pair = analyzeArgs.hasKey("savepairdist"); + // Check if we need to set a default file name +/* std::string fname; + if (pairdistname.empty()) + fname = DEFAULT_PAIRDIST_NAME_; + else { + fname = pairdistname; + // To remain backwards compatible, assume we want to load if + // a pairdist name was specified. + if (!load_pair && !save_pair) { + mprintf("Warning: 'pairdist' specified but 'loadpairdist'/'savepairdist' not specified." + "Warning: Assuming 'loadpairdist'.\n"); + load_pair = true; + } + }*/ + + cache_ = 0; + if (load_pair || + (!save_pair && !pairdistname.empty())) + { + // If 'loadpairdist' specified or 'pairdist' specified and 'savepairdist' + // not specified, we either want to load from file or use an existing + // data set. + if (pairdistname.empty()) { + pairdistname = DEFAULT_PAIRDIST_NAME_; + pairdisttype = DEFAULT_PAIRDIST_TYPE_; + } + // First check if pairwise data exists + DataSetList selected = DSL.SelectGroupSets( pairdistname, DataSet::PWCACHE ); + if (!selected.empty()) { + if (selected.size() > 1) + mprintf("Warning: '%s' matches multiple sets; only using '%s'\n", + pairdistname.c_str(), selected[0]->legend()); + cache_ = (DataSet_PairwiseCache*)selected[0]; + mprintf("\tUsing existing pairwise set '%s'\n", cache_->legend()); + // Next check if file exists + } else if (File::Exists( pairdistname )) { + mprintf("\tLoading pairwise distances from file '%s'\n", pairdistname.c_str()); + DataFile dfIn; + // TODO set data set name with ArgList? + if (dfIn.ReadDataIn( pairdistname, ArgList(), DSL )) return 1; + DataSet* ds = DSL.GetDataSet( pairdistname ); + if (ds == 0) return 1; + if (ds->Group() != DataSet::PWCACHE) { + mprinterr("Internal Error: AllocatePairwise(): Set is not a pairwise cache.\n"); + return 1; + } + cache_ = (DataSet_PairwiseCache*)ds; + if (cache_ != 0 && save_pair) { + mprintf("Warning: 'savepairdist' specified but pairwise cache loaded from file.\n" + "Warning: Disabling 'savepairdist'.\n"); + save_pair = false; + } + } else + pairdisttype = DEFAULT_PAIRDIST_TYPE_; + + if (cache_ == 0) { + // Just 'pairdist' specified or loadpairdist specified and set/file not found. + // Warn the user. + mprintf("Warning: Pairwise distance matrix specified but cache/file '%s' not found.\n", pairdistname.c_str()); + if (!save_pair) { + // If the file (or dataset) does not yet exist we will assume we want to save. + mprintf("Warning: Pairwise distance matrix specified but not found; will save distances.\n"); + save_pair = true; + } + } + } // END if load_pair + + // Create a pairwise cache if necessary + if (cache_ == 0) { + // Process DataSet type arguments + DataSet::DataType pw_type = DataSet::PMATRIX_MEM; + std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); + if (!pw_typeString.empty()) { + if (pw_typeString == "mem") + pw_type = DataSet::PMATRIX_MEM; + else if (pw_typeString == "disk") { +# ifdef BINTRAJ + pw_type = DataSet::PMATRIX_NC; +# else + // TODO regular disk file option + mprinterr("Error: Pairwise disk cache requires NetCDF.\n"); + return 1; +# endif + } else if (pw_typeString == "none") + pw_type = DataSet::UNKNOWN_DATA; + else { + mprinterr("Error: Unrecognized option for 'pairwisecache' ('%s')\n", pw_typeString.c_str()); + return 1; + } + } + // Allocate cache if necessary + if (pw_type != DataSet::UNKNOWN_DATA) { + MetaData meta; + if (!pairdistname.empty()) + meta.SetName( pairdistname ); + else + meta.SetName( DSL.GenerateDefaultName("CMATRIX") ); + // Cache-specific setup. + if (pw_type == DataSet::PMATRIX_NC) + meta.SetFileName( pairdistname ); // TODO separate file name? + //cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, meta, "CMATRIX" ); + // To maintain compatibility with pytraj, the cluster number vs time + // set **MUST** be allocated before the cache. Set up outside the + // DataSetList here and set up; add to DataSetList later in Setup. + cache_ = (DataSet_PairwiseCache*)DSL.AllocateSet( pw_type, meta ); + if (cache_ == 0) { + mprinterr("Error: Could not allocate pairwise cache.\n"); + return 1; + } + cacheWasAllocated_ = true; + if (debug_ > 0) + mprintf("DEBUG: Allocated pairwise distance cache: %s\n", cache_->legend()); + } + } + + // Setup pairwise matrix + //if (pmatrix_.Setup(metric_, cache_)) return 1; + + if (save_pair) { + if (cache_ == 0) { + mprintf("Warning: Not caching distances; ignoring 'savepairdist'\n"); + } else { + if (pairdistname.empty()) + pairdistname = DEFAULT_PAIRDIST_NAME_; + if (pairdisttype == DataFile::UNKNOWN_DATA) + pairdisttype = DEFAULT_PAIRDIST_TYPE_; + // TODO enable saving for other set types? + if (cache_->Type() == DataSet::PMATRIX_MEM) { + DataFile* pwd_file = DFL.AddDataFile( pairdistname, pairdisttype, ArgList() ); + if (pwd_file == 0) return 1; + pwd_file->AddDataSet( cache_ ); + if (debug_ > 0) + mprintf("DEBUG: Saving pw distance cache '%s' to file '%s'\n", cache_->legend(), + pwd_file->DataFilename().full()); + } + } + } + pw_mismatch_fatal_ = !analyzeArgs.hasKey("pwrecalc"); + + return 0; } /** /return Pointer to Metric of given type. */ @@ -78,13 +268,12 @@ Cpptraj::Cluster::Metric* Cpptraj::Cluster::MetricArray::AllocateMetric(Metric:: return met; } -/** Recognized args. */ +/** Recognized metric args. */ const char* Cpptraj::Cluster::MetricArray::MetricArgs_ = "[{dme|rms|srmsd} [mass] [nofit] []] [{euclid|manhattan}] [wgt ]"; /** Initialize with given sets and arguments. */ -int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, ArgList& analyzeArgs, - int debugIn) +int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& dslIn, ArgList& analyzeArgs) { // Get rid of any previous metrics Clear(); @@ -153,7 +342,7 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg case Metric::DME : err = ((Metric_DME*)met)->Init((DataSet_Coords*)*ds, AtomMask(maskExpr)); break; case Metric::SRMSD : - err = ((Metric_SRMSD*)met)->Init((DataSet_Coords*)*ds, AtomMask(maskExpr), nofit, useMass, debugIn); break; + err = ((Metric_SRMSD*)met)->Init((DataSet_Coords*)*ds, AtomMask(maskExpr), nofit, useMass, debug_); break; case Metric::SCALAR : err = ((Metric_Scalar*)met)->Init((DataSet_1D*)*ds); break; case Metric::TORSION : @@ -193,6 +382,22 @@ int Cpptraj::Cluster::MetricArray::InitMetricArray(DataSetList const& dslIn, Arg return 0; } +/** Initialize metrics and pairwise cache (if needed). */ +int Cpptraj::Cluster::MetricArray::Initialize(DataSetList& dslIn, DataFileList& dflIn, + ArgList& analyzeArgs, int debugIn) +{ + debug_ = debugIn; + if (initMetricArray(dslIn, analyzeArgs)) { + mprinterr("Error: Metric initialization failed.\n"); + return 1; + } + if (setupPairwiseCache(analyzeArgs, dslIn, dflIn)) { + mprinterr("Error: Pairwise cache initialization failed.\n"); + return 1; + } + return 0; +} + /** Call the Setup function for all metrics. Check that size of each Metric * is the same. */ @@ -269,33 +474,42 @@ void Cpptraj::Cluster::MetricArray::FrameOpCentroid(int f1, CentroidArray& centr } /** Manhattan distance. */ -double Cpptraj::Cluster::MetricArray::Dist_Manhattan() const { +double Cpptraj::Cluster::MetricArray::Dist_Manhattan(const double* arrayIn, unsigned int length) const { double dist = 0.0; - for (unsigned int idx = 0; idx != temp_.size(); idx++) - dist += (weights_[idx] * temp_[idx]); + for (unsigned int idx = 0; idx != length; idx++) + dist += (weights_[idx] * arrayIn[idx]); return dist; } /** Euclidean distance. */ -double Cpptraj::Cluster::MetricArray::Dist_Euclidean() const { +double Cpptraj::Cluster::MetricArray::Dist_Euclidean(const double* arrayIn, unsigned int length) const { double sumdist2 = 0.0; - for (unsigned int idx = 0; idx != temp_.size(); idx++) { - double dist2 = temp_[idx] * temp_[idx]; + for (unsigned int idx = 0; idx != length; idx++) { + double dist2 = arrayIn[idx] * arrayIn[idx]; sumdist2 += (weights_[idx] * dist2); } return sqrt(sumdist2); } /** Perform distance calc according to current type. */ -double Cpptraj::Cluster::MetricArray::DistCalc() const { +double Cpptraj::Cluster::MetricArray::DistCalc(std::vector const& arrayIn) const { double dist = 0; switch (type_) { - case MANHATTAN : dist = Dist_Manhattan(); break; - case EUCLID : dist = Dist_Euclidean(); break; + case MANHATTAN : dist = Dist_Manhattan(&arrayIn[0], arrayIn.size()); break; + case EUCLID : dist = Dist_Euclidean(&arrayIn[0], arrayIn.size()); break; } return dist; } +/** Perform distance calc according to current type. */ +double Cpptraj::Cluster::MetricArray::DistCalc(const double* arrayIn, unsigned int length) const { + double dist = 0; + switch (type_) { + case MANHATTAN : dist = Dist_Manhattan(arrayIn, length); break; + case EUCLID : dist = Dist_Euclidean(arrayIn, length); break; + } + return dist; +} /** Calculate distance between given frame and centroids. */ double Cpptraj::Cluster::MetricArray::FrameCentroidDist(int frame, CentroidArray const& centroids ) { @@ -305,5 +519,143 @@ double Cpptraj::Cluster::MetricArray::FrameCentroidDist(int frame, CentroidArray } for (unsigned int idx = 0; idx != metrics_.size(); idx++) temp_[idx] = metrics_[idx]->FrameCentroidDist( frame, centroids[idx] ); - return DistCalc(); + return DistCalc(temp_); +} + +/** \return distance between frames (uncached). */ +double Cpptraj::Cluster::MetricArray::Uncached_Frame_Distance(int f1, int f2) +{ + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + temp_[idx] = metrics_[idx]->FrameDist(f1, f2); + return DistCalc(temp_); +} + +/** \return distance between frames (cached or uncached). */ +double Cpptraj::Cluster::MetricArray::Frame_Distance(int f1, int f2) { + if (cache_ != 0) + { + // TODO protect against f1/f2 out of bounds. + int idx1 = cache_->FrameToIdx()[f1]; + if (idx1 != -1) { + int idx2 = cache_->FrameToIdx()[f2]; + if (idx2 != -1) + return cache_->CachedDistance(idx1, idx2); + } + } + // If here, distance was not cached or no cache. + return Uncached_Frame_Distance(f1, f2); +} + +// ----------------------------------------------- +/** \return A string containing the description of all metrics. */ +std::string Cpptraj::Cluster::MetricArray::descriptionOfMetrics() const { + std::string out; + for (std::vector::const_iterator it = metrics_.begin(); + it != metrics_.end(); ++it) + { + if (it != metrics_.begin()) + out.append(","); + out.append( (*it)->Description() ); + } + return out; +} + +/** Request that distances for frames in given array be cached. + * \param framesToCache the frames to cache. + * \param sieveIn Sieve value (if any) used to generate framesToCache. This is + * purely for bookkeeping inside DataSet_PairwiseCache. + * When pw_mismatch_fatal_ is true, if a cache is present but the frames to + * cache do not match what is in the cache, exit with an error; + * otherwise recalculate the cache. + */ +int Cpptraj::Cluster::MetricArray::CacheDistances(Cframes const& framesToCache, int sieveIn) +{ + if (framesToCache.size() < 1) return 0; + // If no cache we can leave. + if (cache_ == 0) return 0; + + bool do_cache = true; + if (cache_->Size() > 0) { + do_cache = false; + mprintf("\tUsing existing cache '%s'\n", cache_->legend()); + // If cache is already populated, check that it is valid. + // The frames to cache must match cached frames. + if (!cache_->CachedFramesMatch( framesToCache )) { + if (pw_mismatch_fatal_) { + mprinterr("Error: Frames to cache do not match those in existing cache.\n"); + return 1; + } else { + mprintf("Warning: Frames to cache do not match those in existing cache.\n" + "Warning: Re-calculating pairwise cache.\n"); + do_cache = true; + } + } + // TODO Check metric? Total frames? + } + + if (do_cache) { + // Sanity check + if (metrics_.empty()) { + mprinterr("Internal Error: MetricArray::CacheDistances(): Metric is null.\n"); + return 1; + } + // Cache setup + if (cache_->SetupCache( Ntotal(), framesToCache, sieveIn, descriptionOfMetrics() )) + return 1; + // Fill cache + if (calcFrameDistances(framesToCache)) + return 1; + } + return 0; +} + +/** Cache distances between given frames using SetElement(). */ +int Cpptraj::Cluster::MetricArray::calcFrameDistances(Cframes const& framesToCache) +{ + mprintf("\tCaching distances for %zu frames.\n", framesToCache.size()); + + int f2end = (int)framesToCache.size(); + int f1end = f2end - 1; + ParallelProgress progress(f1end); + int f1, f2; + // For OMP, every other thread will need its own Cdist. + Metric** MyMetrics = &metrics_[0]; + double* MyTemp = &temp_[0]; +# ifdef _OPENMP +# pragma omp parallel private(MyMetrics, f1, f2) firstprivate(progress) + { + int mythread = omp_get_thread_num(); + progress.SetThread( mythread ); + if (mythread == 0) { + mprintf("\tParallelizing pairwise distance calc with %i threads\n", omp_get_num_threads()); + MyMetrics = &metrics_[0]; + } else { + // Copy every Metric in metrics_ + MyMetrics = new Metric*[metrics_.size()]; + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + MyMetrics[idx] = metrics_[idx]->Copy(); + MyTemp = new double[metrics_.size()]; + } +# pragma omp for schedule(dynamic) +# endif + for (f1 = 0; f1 < f1end; f1++) { + progress.Update(f1); + for (f2 = f1 + 1; f2 < f2end; f2++) { + //cache_->SetElement( f1, f2, MyMetric->FrameDist(framesToCache[f1], framesToCache[f2]) ); + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + MyTemp[idx] = MyMetrics[idx]->FrameDist(framesToCache[f1], framesToCache[f2]); + cache_->SetElement( f1, f2, DistCalc(MyTemp, metrics_.size()) ); + } + } +# ifdef _OPENMP + if (mythread > 0) { + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + delete MyMetrics[idx]; + delete[] MyMetrics; + delete[] MyTemp; + } + } // END omp parallel +# endif + progress.Finish(); + return 0; } diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 8eca32fa9f..be551e60ae 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -3,7 +3,9 @@ #include #include "Metric.h" // Metric::Type class ArgList; +class DataFileList; class DataSet; +class DataSet_PairwiseCache; class DataSetList; namespace Cpptraj { namespace Cluster { @@ -22,10 +24,10 @@ class MetricArray { /// Types of distance calculation enum DistanceType { MANHATTAN = 0, EUCLID }; - /// Recognized keywords + /// Recognized metric keywords static const char* MetricArgs_; /// Initialize with data sets and user arguments - int InitMetricArray(DataSetList const&, ArgList&, int); + int Initialize(DataSetList&, DataFileList&, ArgList&, int); /// Set up all metrics int Setup(); @@ -36,6 +38,17 @@ class MetricArray { /// \return Number of points covered by each Metric unsigned int Ntotal() const { return ntotal_; } + // TODO: The Cache() and CacheWasAllocated() routines are only needed + // because pytraj expects the cluster # vs time set to be + // allocated *before* the cache. So it is potentially + // allocated via InitMetricArray(), but added to the master + // DataSetList later. If/when pytraj is modified to change + // this dependency, these two routines can be retired. + /// \return Pointer to internal pairwise cache. + DataSet_PairwiseCache* Cache() const { return cache_; } + /// \return true if cache was allocated by MetricArray + bool CacheWasAllocated() const { return cacheWasAllocated_; } + /// Calculate new centroid for each metric void NewCentroid(CentroidArray&, Cframes const&); /// Calculate centroids for each metric @@ -44,24 +57,47 @@ class MetricArray { void FrameOpCentroid(int, CentroidArray&, double, Metric::CentOpType); /// \return distance between given frame and centroids double FrameCentroidDist(int, CentroidArray const&); + + /// \return distance between frames (uncached) + double Uncached_Frame_Distance(int, int); + /// \return distance between frames (cached or uncached) + double Frame_Distance(int, int); + + /// Request that the pairwise cache be filled with distances for specified frames. + int CacheDistances(Cframes const&, int); private: /// Clear array void Clear(); + /// Set up pairwise cache + int setupPairwiseCache(ArgList&, DataSetList&, DataFileList&); /// Allocate metric of given type Metric* AllocateMetric(Metric::Type); + /// Initialize with data sets and user arguments + int initMetricArray(DataSetList const&, ArgList&); /// Manhattan distance - double Dist_Manhattan() const; + double Dist_Manhattan(const double*, unsigned int) const; /// Euclidean distance - double Dist_Euclidean() const; + double Dist_Euclidean(const double*, unsigned int) const; + /// Distance based on type_ + double DistCalc(std::vector const&) const; /// Distance based on type_ - double DistCalc() const; + double DistCalc(const double*, unsigned int) const; + + /// \return a string containing description of all metrics + std::string descriptionOfMetrics() const; + /// Fill the pairwise cache with distances for specified frames. + int calcFrameDistances(Cframes const&); std::vector metrics_; ///< Hold each Metric TODO deal with OpenMP std::vector sets_; ///< Sets corresponding to each Metric std::vector weights_; ///< Weight of each metric std::vector temp_; ///< For calculations; hold distances from each metric. + int debug_; ///< Debug level DistanceType type_; ///< Type of distance calc to perform unsigned int ntotal_; ///< Total number of points covered by any Metric + DataSet_PairwiseCache* cache_; ///< Optional cache for frame-frame distances. + bool cacheWasAllocated_; ///< True is cache was allocated by InitMetricArray() + bool pw_mismatch_fatal_; ///< Controls if PW distances should be recalculated on mismatch }; } diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 808c5e5130..730203636a 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -13,7 +13,7 @@ Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../A DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h PairwiseMatrix.h DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h -MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.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 ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h +MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Cluster/Cframes.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_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../ProgressBar.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h Metric_DME.o : Metric_DME.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_DME.h Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_RMS.h Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_SRMSD.h From dcec5811d33788f0a8d975c856de5efc071436d8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 09:35:55 -0400 Subject: [PATCH 357/417] Add keywords strings for pairwise --- src/Cluster/MetricArray.cpp | 9 +++++++++ src/Cluster/MetricArray.h | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 3aa7d512c7..1a02e8c3de 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -86,6 +86,15 @@ void Cpptraj::Cluster::MetricArray::Clear() { pw_mismatch_fatal_ = true; } +/** Pairwise args 1 */ +const char* Cpptraj::Cluster::MetricArray::PairwiseArgs1_ = + "[pairdist ] [pwrecalc]"; + +/** Pairwise args 2 */ +const char* Cpptraj::Cluster::MetricArray::PairwiseArgs2_ = + "[loadpairdist] [savepairdist] [pairwisecache {mem|disk|none}]"; + + /** Set up pairwise cache from arguments. */ int Cpptraj::Cluster::MetricArray::setupPairwiseCache(ArgList& analyzeArgs, DataSetList& DSL, diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index be551e60ae..d762a272bb 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -26,10 +26,17 @@ class MetricArray { enum DistanceType { MANHATTAN = 0, EUCLID }; /// Recognized metric keywords static const char* MetricArgs_; + /// Recognized pairwise keywords 1 + static const char* PairwiseArgs1_; + /// Recognized pairwise keywords 2 + static const char* PairwiseArgs2_; + /// Initialize with data sets and user arguments int Initialize(DataSetList&, DataFileList&, ArgList&, int); /// Set up all metrics int Setup(); + /// Request that the pairwise cache be filled with distances for specified frames. + int CacheDistances(Cframes const&, int); /// \return True if no metrics have been initialized bool empty() const { return metrics_.empty(); } @@ -63,8 +70,6 @@ class MetricArray { /// \return distance between frames (cached or uncached) double Frame_Distance(int, int); - /// Request that the pairwise cache be filled with distances for specified frames. - int CacheDistances(Cframes const&, int); private: /// Clear array void Clear(); From 42040b0bf311d551396e321ebb2703ae1a7d0a45 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 09:43:27 -0400 Subject: [PATCH 358/417] Need to pass in two data set lists; one for sets to cluster, the other to add the cache to if needed. --- src/Cluster/MetricArray.cpp | 11 ++++++----- src/Cluster/MetricArray.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 1a02e8c3de..44a00dd547 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -282,7 +282,7 @@ const char* Cpptraj::Cluster::MetricArray::MetricArgs_ = "[{dme|rms|srmsd} [mass] [nofit] []] [{euclid|manhattan}] [wgt ]"; /** Initialize with given sets and arguments. */ -int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& dslIn, ArgList& analyzeArgs) +int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& setsToCluster, ArgList& analyzeArgs) { // Get rid of any previous metrics Clear(); @@ -300,7 +300,7 @@ int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& dslIn, Arg type_ = MANHATTAN; else { // Default - if (dslIn.size() > 1) + if (setsToCluster.size() > 1) type_ = EUCLID; else type_ = MANHATTAN; @@ -319,7 +319,7 @@ int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& dslIn, Arg else coordsMetricType = Metric::RMS; // default // For each input set, set up the appropriate metric - for (DataSetList::const_iterator ds = dslIn.begin(); ds != dslIn.end(); ++ds) + for (DataSetList::const_iterator ds = setsToCluster.begin(); ds != setsToCluster.end(); ++ds) { Metric::Type mtype = Metric::UNKNOWN_METRIC; if ( (*ds)->Group() == DataSet::COORDINATES ) @@ -392,11 +392,12 @@ int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& dslIn, Arg } /** Initialize metrics and pairwise cache (if needed). */ -int Cpptraj::Cluster::MetricArray::Initialize(DataSetList& dslIn, DataFileList& dflIn, +int Cpptraj::Cluster::MetricArray::Initialize(DataSetList const& setsToCluster, + DataSetList& dslIn, DataFileList& dflIn, ArgList& analyzeArgs, int debugIn) { debug_ = debugIn; - if (initMetricArray(dslIn, analyzeArgs)) { + if (initMetricArray(setsToCluster, analyzeArgs)) { mprinterr("Error: Metric initialization failed.\n"); return 1; } diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index d762a272bb..db9ff7751c 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -31,8 +31,8 @@ class MetricArray { /// Recognized pairwise keywords 2 static const char* PairwiseArgs2_; - /// Initialize with data sets and user arguments - int Initialize(DataSetList&, DataFileList&, ArgList&, int); + /// Initialize with sets to cluster, master data set/file lists (for cache), and user arguments + int Initialize(DataSetList const&, DataSetList&, DataFileList&, ArgList&, int); /// Set up all metrics int Setup(); /// Request that the pairwise cache be filled with distances for specified frames. From d4db2637ef9dd1e42ec61bf06a495db23acf5f9e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 09:46:34 -0400 Subject: [PATCH 359/417] Centroid_Multi now unused (covered by CentroidArray). PairwiseMatrix folded into MetricArray. --- src/Cluster/CMakeLists.txt | 1 - src/Cluster/Centroid_Multi.h | 32 --------- src/Cluster/PairwiseMatrix.cpp | 120 --------------------------------- src/Cluster/PairwiseMatrix.h | 45 ------------- src/Cluster/clusterdepend | 3 +- src/Cluster/clusterfiles | 1 - 6 files changed, 1 insertion(+), 201 deletions(-) delete mode 100644 src/Cluster/Centroid_Multi.h delete mode 100644 src/Cluster/PairwiseMatrix.cpp delete mode 100644 src/Cluster/PairwiseMatrix.h diff --git a/src/Cluster/CMakeLists.txt b/src/Cluster/CMakeLists.txt index 33979826c1..c9ad5d9ceb 100644 --- a/src/Cluster/CMakeLists.txt +++ b/src/Cluster/CMakeLists.txt @@ -23,7 +23,6 @@ set(CLUSTER_SOURCES Metric_Torsion.cpp Node.cpp Output.cpp - PairwiseMatrix.cpp Results_Coords.cpp Sieve.cpp ) diff --git a/src/Cluster/Centroid_Multi.h b/src/Cluster/Centroid_Multi.h deleted file mode 100644 index c062e5d592..0000000000 --- a/src/Cluster/Centroid_Multi.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef INC_CLUSTER_CENTROID_MULTI_H -#define INC_CLUSTER_CENTROID_MULTI_H -#include "Centroid.h" -#include -namespace Cpptraj { -namespace Cluster { - -/// Cluster centroid for multiple DataSets -class Centroid_Multi : public Centroid { - public: - typedef std::vector Darray; - Centroid_Multi() {} - Centroid_Multi(Darray const& val, Darray const& x, Darray const& y) : - cvals_(val), Sumx_(x), Sumy_(y) {} - - Centroid* Copy() { return (Centroid*)new Centroid_Multi(cvals_, Sumx_, Sumy_); } - - Darray const& Cvals() const { return cvals_; } - - Darray& Cvals() { return cvals_; } - Darray& SumX() { return Sumx_; } - Darray& SumY() { return Sumy_; } - private: - Darray cvals_; - Darray Sumx_; // For storing periodic average - Darray Sumy_; // For storing periodic average -}; - - -} -} -#endif diff --git a/src/Cluster/PairwiseMatrix.cpp b/src/Cluster/PairwiseMatrix.cpp deleted file mode 100644 index a6adde1107..0000000000 --- a/src/Cluster/PairwiseMatrix.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include "PairwiseMatrix.h" -#ifdef _OPENMP -#include -#endif -#include "Metric.h" -#include "../CpptrajStdio.h" -#include "../DataSet_PairwiseCache.h" -#include "../ProgressBar.h" - -/** Set up PairwiseMatrix with Metric and optional cache. */ -int Cpptraj::Cluster::PairwiseMatrix::Setup(Metric* metric, DataSet_PairwiseCache* cache) -{ - if (metric == 0) return 1; - metric_ = metric; - cache_ = cache; - return 0; -} - -/** \return distance between frames (cached or uncached). */ // TODO inline? -double Cpptraj::Cluster::PairwiseMatrix::Frame_Distance(int f1, int f2) const { - if (cache_ != 0) - { - // TODO protect against f1/f2 out of bounds. - int idx1 = cache_->FrameToIdx()[f1]; - if (idx1 != -1) { - int idx2 = cache_->FrameToIdx()[f2]; - if (idx2 != -1) - return cache_->CachedDistance(idx1, idx2); - } - } - // If here, distance was not cached or no cache. - return metric_->FrameDist(f1, f2); -} - -/** Request that distances for frames in given array be cached. - * \param framesToCache the frames to cache. - * \param sieveIn Sieve value (if any) used to generate framesToCache. This is - * purely for bookkeeping inside DataSet_PairwiseCache. - * \param mismatch_fatal When true, if a cache is present but the frames to - * cache do not match what is in the cache, exit with an error; - * otherwise recalculate the cache. - */ -int Cpptraj::Cluster::PairwiseMatrix::CacheDistances(Cframes const& framesToCache, int sieveIn, - bool mismatch_fatal) -{ - if (framesToCache.size() < 1) return 0; - // If no cache we can leave. - if (cache_ == 0) return 0; - - bool do_cache = true; - if (cache_->Size() > 0) { - do_cache = false; - mprintf("\tUsing existing cache '%s'\n", cache_->legend()); - // If cache is already populated, check that it is valid. - // The frames to cache must match cached frames. - if (!cache_->CachedFramesMatch( framesToCache )) { - if (mismatch_fatal) { - mprinterr("Error: Frames to cache do not match those in existing cache.\n"); - return 1; - } else { - mprintf("Warning: Frames to cache do not match those in existing cache.\n" - "Warning: Re-calculating pairwise cache.\n"); - do_cache = true; - } - } - // TODO Check metric? Total frames? - } - - if (do_cache) { - // Sanity check - if (metric_ == 0) { - mprinterr("Internal Error: PairwiseMatrix::CacheDistances(): Metric is null.\n"); - return 1; - } - // Cache setup - if (cache_->SetupCache( metric_->Ntotal(), framesToCache, sieveIn, metric_->Description() )) - return 1; - // Fill cache - if (CalcFrameDistances(framesToCache)) - return 1; - } - return 0; -} - -/** Cache distances between given frames using SetElement(). */ -int Cpptraj::Cluster::PairwiseMatrix::CalcFrameDistances(Cframes const& framesToCache) -{ - mprintf("\tCaching distances for %zu frames.\n", framesToCache.size()); - - int f2end = (int)framesToCache.size(); - int f1end = f2end - 1; - ParallelProgress progress(f1end); - int f1, f2; - // For OMP, every other thread will need its own Cdist. - Metric* MyMetric = metric_; -# ifdef _OPENMP -# pragma omp parallel private(MyMetric, f1, f2) firstprivate(progress) - { - int mythread = omp_get_thread_num(); - progress.SetThread( mythread ); - if (mythread == 0) { - mprintf("\tParallelizing pairwise distance calc with %i threads\n", omp_get_num_threads()); - MyMetric = metric_; - } else - MyMetric = metric_->Copy(); -# pragma omp for schedule(dynamic) -# endif - for (f1 = 0; f1 < f1end; f1++) { - progress.Update(f1); - for (f2 = f1 + 1; f2 < f2end; f2++) - cache_->SetElement( f1, f2, MyMetric->FrameDist(framesToCache[f1], framesToCache[f2]) ); - } -# ifdef _OPENMP - if (mythread > 0) - delete MyMetric; - } // END omp parallel -# endif - progress.Finish(); - return 0; -} diff --git a/src/Cluster/PairwiseMatrix.h b/src/Cluster/PairwiseMatrix.h deleted file mode 100644 index 59c2f95ea0..0000000000 --- a/src/Cluster/PairwiseMatrix.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_CLUSTER_PAIRWISE_MATRIX_H -#define INC_CLUSTER_PAIRWISE_MATRIX_H -//#inc lude "../DataSet_PairwiseCache.h" -//#inc lude "Metric.h" -class DataSet_PairwiseCache; -namespace Cpptraj { -namespace Cluster { -class Cframes; -class Metric; -/// Used to calculate/caching pairwise distances according to a given metric. -class PairwiseMatrix { - public: - PairwiseMatrix() : cache_(0), metric_(0) {} - - /// Set up with given metric and optional cache. - int Setup(Metric*, DataSet_PairwiseCache*); - - // ------------------------------------------- - /// \return distance between given frames. - double Frame_Distance(int, int) const; - /// Request that distances for the specified frames be cached. - int CacheDistances(Cframes const&, int, bool); - - // ------------------------------------------- - //bool HasMetric() const { return (metric_ != 0); } - /// \return internal metric, const. - Metric const& DistMetric() const { return *metric_; } - /// \return Pointer to distance metric - Metric* MetricPtr() const { return metric_; } - - /// \return true if PairwiseMatrix contains a cache. - bool HasCache() const { return (cache_ != 0); } - /// \return internal cache, const. - DataSet_PairwiseCache const& Cache() const { return *cache_; } - private: - /// Internal routine used to cache pairwise distances. - int CalcFrameDistances(Cframes const&); - - DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. - Metric* metric_; ///< The current distance metric. -}; - -} /* END namespace Cluster */ -} /* END namespace Cpptraj */ -#endif diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 730203636a..c10023b411 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -9,7 +9,7 @@ Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../Coordi Cframes.o : Cframes.cpp Cframes.h Cmatrix_Binary.o : Cmatrix_Binary.cpp ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h Cframes.h Cmatrix_Binary.h Cmatrix_NC.o : Cmatrix_NC.cpp ../CpptrajStdio.h ../FileName.h ../NC_Routines.h Cframes.h Cmatrix_NC.h -Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.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 ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h CentroidArray.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h MetricArray.h Node.h Output.h PairwiseMatrix.h Results.h Results_Coords.h Sieve.h +Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.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 ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h CentroidArray.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h MetricArray.h Node.h Output.h Results.h Results_Coords.h Sieve.h DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h PairwiseMatrix.h DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h @@ -21,6 +21,5 @@ Metric_Scalar.o : Metric_Scalar.cpp ../AssociatedData.h ../CpptrajFile.h ../Cppt Metric_Torsion.o : Metric_Torsion.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Torsion.h Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h Metric.h MetricArray.h Node.h PairwiseMatrix.h Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h -PairwiseMatrix.o : PairwiseMatrix.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h Metric.h PairwiseMatrix.h Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Cframes.h List.h Metric.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h diff --git a/src/Cluster/clusterfiles b/src/Cluster/clusterfiles index a3eec29b44..fbdd6c0e17 100644 --- a/src/Cluster/clusterfiles +++ b/src/Cluster/clusterfiles @@ -23,7 +23,6 @@ CLUSTER_SOURCES= \ Metric_Torsion.cpp \ Node.cpp \ Output.cpp \ - PairwiseMatrix.cpp \ Results_Coords.cpp \ Sieve.cpp From 0addb5d63fcc215e202fdb5cf2d36eea5cccaac9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 09:49:58 -0400 Subject: [PATCH 360/417] Add info about cache to Info() print --- src/Cluster/MetricArray.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 44a00dd547..478e9fe503 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -446,6 +446,21 @@ void Cpptraj::Cluster::MetricArray::Info() const { idx, sets_[idx]->legend(), weights_[idx]); metrics_[idx]->Info(); } + + if (cache_ == 0) + mprintf("\tPairwise distances will not be cached.\n"); + else { + if (cache_->Size() > 0) + mprintf("\tUsing existing pairwise cache: %s (%s)\n", + cache_->legend(), cache_->description()); + else + mprintf("\tPairwise distances will be cached: %s (%s)\n", + cache_->legend(), cache_->description()); + if (pw_mismatch_fatal_) + mprintf("\tCalculation will be halted if frames in cache do not match.\n"); + else + mprintf("\tPairwise distances will be recalculated if frames in cache do not match.\n"); + } } // ----------------------------------------------- From 6faf6bc7668b95c9c9d216735f03848de4854dea Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 09:57:46 -0400 Subject: [PATCH 361/417] Make coordsMetricType a class var --- src/Cluster/MetricArray.cpp | 14 ++++++++------ src/Cluster/MetricArray.h | 23 +++++++++++++---------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 478e9fe503..29d28c783b 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -25,6 +25,7 @@ Cpptraj::Cluster::MetricArray::MetricArray() : debug_(0), type_(MANHATTAN), + coordsMetricType_(Metric::RMS), ntotal_(0), cache_(0), cacheWasAllocated_(false), @@ -43,6 +44,7 @@ Cpptraj::Cluster::MetricArray::MetricArray(MetricArray const& rhs) : temp_(rhs.temp_), debug_(rhs.debug_), type_(rhs.type_), + coordsMetricType_(rhs.coordsMetricType_), ntotal_(rhs.ntotal_), cache_(rhs.cache_), cacheWasAllocated_(rhs.cacheWasAllocated_), @@ -67,6 +69,7 @@ Cpptraj::Cluster::MetricArray& temp_ = rhs.temp_; debug_ = rhs.debug_; type_ = rhs.type_; + coordsMetricType_ = rhs.coordsMetricType_; ntotal_ = rhs.ntotal_; cache_ = rhs.cache_; cacheWasAllocated_ = rhs.cacheWasAllocated_; @@ -312,11 +315,10 @@ int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& setsToClus mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); return 1; } - Metric::Type coordsMetricType; - if (usedme) coordsMetricType = Metric::DME; - else if (userms) coordsMetricType = Metric::RMS; - else if (usesrms) coordsMetricType = Metric::SRMSD; - else coordsMetricType = Metric::RMS; // default + if (usedme) coordsMetricType_ = Metric::DME; + else if (userms) coordsMetricType_ = Metric::RMS; + else if (usesrms) coordsMetricType_ = Metric::SRMSD; + else coordsMetricType_ = Metric::RMS; // default // For each input set, set up the appropriate metric for (DataSetList::const_iterator ds = setsToCluster.begin(); ds != setsToCluster.end(); ++ds) @@ -324,7 +326,7 @@ int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& setsToClus Metric::Type mtype = Metric::UNKNOWN_METRIC; if ( (*ds)->Group() == DataSet::COORDINATES ) { - mtype = coordsMetricType; + mtype = coordsMetricType_; } else if ((*ds)->Group() == DataSet::SCALAR_1D) { if ( (*ds)->Meta().IsTorsionArray() ) mtype = Metric::TORSION; diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index db9ff7751c..8f4b241748 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -44,6 +44,8 @@ class MetricArray { void Info() const; /// \return Number of points covered by each Metric unsigned int Ntotal() const { return ntotal_; } + /// \return Metric type that will be used for any COORDS sets + Metric::Type CoordsMetricType() const { return coordsMetricType_; } // TODO: The Cache() and CacheWasAllocated() routines are only needed // because pytraj expects the cluster # vs time set to be @@ -93,16 +95,17 @@ class MetricArray { /// Fill the pairwise cache with distances for specified frames. int calcFrameDistances(Cframes const&); - std::vector metrics_; ///< Hold each Metric TODO deal with OpenMP - std::vector sets_; ///< Sets corresponding to each Metric - std::vector weights_; ///< Weight of each metric - std::vector temp_; ///< For calculations; hold distances from each metric. - int debug_; ///< Debug level - DistanceType type_; ///< Type of distance calc to perform - unsigned int ntotal_; ///< Total number of points covered by any Metric - DataSet_PairwiseCache* cache_; ///< Optional cache for frame-frame distances. - bool cacheWasAllocated_; ///< True is cache was allocated by InitMetricArray() - bool pw_mismatch_fatal_; ///< Controls if PW distances should be recalculated on mismatch + std::vector metrics_; ///< Hold each Metric TODO deal with OpenMP + std::vector sets_; ///< Sets corresponding to each Metric + std::vector weights_; ///< Weight of each metric + std::vector temp_; ///< For calculations; hold distances from each metric. + int debug_; ///< Debug level + DistanceType type_; ///< Type of distance calc to perform + Metric::Type coordsMetricType_; ///< The metric type for any COORDS data sets. + unsigned int ntotal_; ///< Total number of points covered by any Metric + DataSet_PairwiseCache* cache_; ///< Optional cache for frame-frame distances. + bool cacheWasAllocated_; ///< True is cache was allocated by InitMetricArray() + bool pw_mismatch_fatal_; ///< Controls if PW distances should be recalculated on mismatch }; } From 5df23a7e6c26ba5e7b96a1ac25ace39caa6545c5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 10:05:22 -0400 Subject: [PATCH 362/417] Replace coords metric type var with function that returns first COORDS-related metric --- src/Cluster/MetricArray.cpp | 28 ++++++++++++++++++++-------- src/Cluster/MetricArray.h | 5 ++--- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 29d28c783b..43fbdd82c8 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -25,7 +25,6 @@ Cpptraj::Cluster::MetricArray::MetricArray() : debug_(0), type_(MANHATTAN), - coordsMetricType_(Metric::RMS), ntotal_(0), cache_(0), cacheWasAllocated_(false), @@ -44,7 +43,6 @@ Cpptraj::Cluster::MetricArray::MetricArray(MetricArray const& rhs) : temp_(rhs.temp_), debug_(rhs.debug_), type_(rhs.type_), - coordsMetricType_(rhs.coordsMetricType_), ntotal_(rhs.ntotal_), cache_(rhs.cache_), cacheWasAllocated_(rhs.cacheWasAllocated_), @@ -69,7 +67,6 @@ Cpptraj::Cluster::MetricArray& temp_ = rhs.temp_; debug_ = rhs.debug_; type_ = rhs.type_; - coordsMetricType_ = rhs.coordsMetricType_; ntotal_ = rhs.ntotal_; cache_ = rhs.cache_; cacheWasAllocated_ = rhs.cacheWasAllocated_; @@ -265,6 +262,20 @@ int Cpptraj::Cluster::MetricArray::setupPairwiseCache(ArgList& analyzeArgs, return 0; } +/** \return Pointer to first Metric related to COORDS, or 0 if not present. */ +Cpptraj::Cluster::Metric const* + Cpptraj::Cluster::MetricArray::CoordsMetric() const +{ + for (std::vector::const_iterator it = metrics_.begin(); it != metrics_.end(); ++it) + { + if ( (*it)->MetricType() == Metric::RMS || + (*it)->MetricType() == Metric::DME || + (*it)->MetricType() == Metric::SRMSD ) + return *it; + } + return 0; +} + /** /return Pointer to Metric of given type. */ Cpptraj::Cluster::Metric* Cpptraj::Cluster::MetricArray::AllocateMetric(Metric::Type mtype) { @@ -315,10 +326,11 @@ int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& setsToClus mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); return 1; } - if (usedme) coordsMetricType_ = Metric::DME; - else if (userms) coordsMetricType_ = Metric::RMS; - else if (usesrms) coordsMetricType_ = Metric::SRMSD; - else coordsMetricType_ = Metric::RMS; // default + Metric::Type coordsMetricType; + if (usedme) coordsMetricType = Metric::DME; + else if (userms) coordsMetricType = Metric::RMS; + else if (usesrms) coordsMetricType = Metric::SRMSD; + else coordsMetricType = Metric::RMS; // default // For each input set, set up the appropriate metric for (DataSetList::const_iterator ds = setsToCluster.begin(); ds != setsToCluster.end(); ++ds) @@ -326,7 +338,7 @@ int Cpptraj::Cluster::MetricArray::initMetricArray(DataSetList const& setsToClus Metric::Type mtype = Metric::UNKNOWN_METRIC; if ( (*ds)->Group() == DataSet::COORDINATES ) { - mtype = coordsMetricType_; + mtype = coordsMetricType; } else if ((*ds)->Group() == DataSet::SCALAR_1D) { if ( (*ds)->Meta().IsTorsionArray() ) mtype = Metric::TORSION; diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 8f4b241748..ba35e24033 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -44,8 +44,8 @@ class MetricArray { void Info() const; /// \return Number of points covered by each Metric unsigned int Ntotal() const { return ntotal_; } - /// \return Metric type that will be used for any COORDS sets - Metric::Type CoordsMetricType() const { return coordsMetricType_; } + /// \return First Metric (if any) having to do with a COORDS set + Metric const* CoordsMetric() const; // TODO: The Cache() and CacheWasAllocated() routines are only needed // because pytraj expects the cluster # vs time set to be @@ -101,7 +101,6 @@ class MetricArray { std::vector temp_; ///< For calculations; hold distances from each metric. int debug_; ///< Debug level DistanceType type_; ///< Type of distance calc to perform - Metric::Type coordsMetricType_; ///< The metric type for any COORDS data sets. unsigned int ntotal_; ///< Total number of points covered by any Metric DataSet_PairwiseCache* cache_; ///< Optional cache for frame-frame distances. bool cacheWasAllocated_; ///< True is cache was allocated by InitMetricArray() From 483b50e6ee64764745d43d7fa5099df47b7c7ecd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 10:08:05 -0400 Subject: [PATCH 363/417] Use MetricArray --- src/Cluster/Results.h | 4 ++-- src/Cluster/Results_Coords.cpp | 28 ++++++++++++++++------------ src/Cluster/Results_Coords.h | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/Cluster/Results.h b/src/Cluster/Results.h index 7f2f844a28..9677d06d29 100644 --- a/src/Cluster/Results.h +++ b/src/Cluster/Results.h @@ -5,7 +5,7 @@ class DataSetList; namespace Cpptraj { namespace Cluster { class List; -class Metric; +class MetricArray; /// Abstract base class for handling results specific to input data type. class Results { public: @@ -14,7 +14,7 @@ class Results { Results(Type t) : type_(t) {} virtual ~Results() {} - virtual int GetOptions(ArgList&, DataSetList const&, Metric const&) = 0; + virtual int GetOptions(ArgList&, DataSetList const&, MetricArray const&) = 0; virtual void Info() const = 0; virtual int DoOutput(List const&) const = 0; virtual int CalcResults(List&) const = 0; diff --git a/src/Cluster/Results_Coords.cpp b/src/Cluster/Results_Coords.cpp index 925bece5c9..9dec0c6ffd 100644 --- a/src/Cluster/Results_Coords.cpp +++ b/src/Cluster/Results_Coords.cpp @@ -3,6 +3,7 @@ #include "Metric_DME.h" #include "Metric_RMS.h" #include "Metric_SRMSD.h" +#include "MetricArray.h" #include "Node.h" #include "../ArgList.h" #include "../CpptrajStdio.h" @@ -50,7 +51,7 @@ void Cpptraj::Cluster::Results_Coords::GetClusterTrajArgs(ArgList& argIn, /** Get user specified options. */ int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs, DataSetList const& DSL, - Metric const& metricIn) + MetricArray const& metricIn) { writeRepFrameNum_ = analyzeArgs.hasKey("repframe"); GetClusterTrajArgs(analyzeArgs, "clusterout", "clusterfmt", clusterfile_, clusterfmt_); @@ -68,17 +69,20 @@ int Cpptraj::Cluster::Results_Coords::GetOptions(ArgList& analyzeArgs, DataSetLi refmaskexpr_ = analyzeArgs.GetStringKey("refmask"); useMass_ = false; // Attempt to set defaults from Metric if applicable - if (metricIn.MetricType() == Metric::RMS) { - Metric_RMS const& met = static_cast( metricIn ); - useMass_ = met.UseMass(); - if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); - } else if (metricIn.MetricType() == Metric::SRMSD) { - Metric_SRMSD const& met = static_cast( metricIn ); - useMass_ = met.UseMass(); - if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); - } else if (metricIn.MetricType() == Metric::DME) { - Metric_DME const& met = static_cast( metricIn ); - if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); + Metric const* coordsMetric = metricIn.CoordsMetric(); + if (coordsMetric != 0) { + if (coordsMetric->MetricType() == Metric::RMS) { + Metric_RMS const& met = static_cast( *coordsMetric ); + useMass_ = met.UseMass(); + if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); + } else if (coordsMetric->MetricType() == Metric::SRMSD) { + Metric_SRMSD const& met = static_cast( *coordsMetric ); + useMass_ = met.UseMass(); + if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); + } else if (coordsMetric->MetricType() == Metric::DME) { + Metric_DME const& met = static_cast( *coordsMetric ); + if (refmaskexpr_.empty()) refmaskexpr_ = met.Mask().MaskString(); + } } // Set a default mask if needed if (refmaskexpr_.empty()) { diff --git a/src/Cluster/Results_Coords.h b/src/Cluster/Results_Coords.h index 9077c7b667..076fd80516 100644 --- a/src/Cluster/Results_Coords.h +++ b/src/Cluster/Results_Coords.h @@ -13,7 +13,7 @@ class Results_Coords : public Results { Results_Coords(DataSet_Coords*); static void Help(); // ----- Results functions ------------------- - int GetOptions(ArgList&, DataSetList const&, Metric const&); + int GetOptions(ArgList&, DataSetList const&, MetricArray const&); void Info() const; int DoOutput(List const&) const; int CalcResults(List&) const; From fdf28e3a1bdf767c8090e032e132a42a3ac0a953 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 10:10:06 -0400 Subject: [PATCH 364/417] Change name to better reflect what it is --- src/Cluster/MetricArray.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index ba35e24033..63befb7756 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -47,16 +47,16 @@ class MetricArray { /// \return First Metric (if any) having to do with a COORDS set Metric const* CoordsMetric() const; - // TODO: The Cache() and CacheWasAllocated() routines are only needed + // TODO: The CachePtr() and CacheWasAllocated() routines are only needed // because pytraj expects the cluster # vs time set to be // allocated *before* the cache. So it is potentially // allocated via InitMetricArray(), but added to the master // DataSetList later. If/when pytraj is modified to change // this dependency, these two routines can be retired. /// \return Pointer to internal pairwise cache. - DataSet_PairwiseCache* Cache() const { return cache_; } + DataSet_PairwiseCache* CachePtr() const { return cache_; } /// \return true if cache was allocated by MetricArray - bool CacheWasAllocated() const { return cacheWasAllocated_; } + bool CacheWasAllocated() const { return cacheWasAllocated_; } /// Calculate new centroid for each metric void NewCentroid(CentroidArray&, Cframes const&); From 35f34816c5698d5d7a34ddb8c608a58f3153ef12 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 10:12:12 -0400 Subject: [PATCH 365/417] Add routines for accessing the pairwise cache from outside MetricArray --- src/Cluster/MetricArray.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 63befb7756..2fb8e7f595 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -58,6 +58,11 @@ class MetricArray { /// \return true if cache was allocated by MetricArray bool CacheWasAllocated() const { return cacheWasAllocated_; } + /// \return true if there is a distance cache. + bool HasCache() const { return (cache_ != 0); } + /// \return internal cache, const. + DataSet_PairwiseCache const& Cache() const { return *cache_; } + /// Calculate new centroid for each metric void NewCentroid(CentroidArray&, Cframes const&); /// Calculate centroids for each metric From ffb00e1e6f9f40a9320ec5ac9128b4e521564280 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 10:25:48 -0400 Subject: [PATCH 366/417] Start switching to MetricArray --- src/Cluster/List.cpp | 4 ++-- src/Cluster/List.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index dafae71aed..9868de7545 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -1,7 +1,7 @@ #include // std::max #include // double max #include "List.h" -#include "Metric.h" +#include "MetricArray.h" #include "Node.h" #include "PairwiseMatrix.h" #include "../CpptrajStdio.h" @@ -130,7 +130,7 @@ int Cpptraj::Cluster::List::Sort() { } /** Update centroids. */ -void Cpptraj::Cluster::List::UpdateCentroids( Metric* metric ) { +void Cpptraj::Cluster::List::UpdateCentroids( MetricArray& metric ) { for (cluster_it node = clusters_.begin(); node != clusters_.end(); ++node) { node->SortFrameList(); node->CalculateCentroid( metric ); diff --git a/src/Cluster/List.h b/src/Cluster/List.h index 170b8a576d..ce9232823e 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -5,7 +5,7 @@ class DataSet_integer; namespace Cpptraj { namespace Cluster { -class Metric; +class MetricArray; class Node; class PairwiseMatrix; /// Hold all individual clusters. @@ -58,7 +58,7 @@ class List { /// Add given frame as noise. void AddNoise(int f) { noise_.push_back( f ); } /// Update centroids TODO check if they need updating - void UpdateCentroids(Metric*); + void UpdateCentroids(MetricArray&); /// Add given frames to clusters based on distance to centroid. TODO save original frames void AddFramesByCentroid(Cframes const&, Metric*); /// Add given frames to clusters based on distance to centroid and cutoff. From d6dcc9f8776af587688ca5a5acbe206bf8502c47 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 11:35:47 -0400 Subject: [PATCH 367/417] Create a copy of MetricArray itself for OpenMP --- src/Cluster/MetricArray.cpp | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 43fbdd82c8..3caa08a225 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -658,8 +658,7 @@ int Cpptraj::Cluster::MetricArray::calcFrameDistances(Cframes const& framesToCac ParallelProgress progress(f1end); int f1, f2; // For OMP, every other thread will need its own Cdist. - Metric** MyMetrics = &metrics_[0]; - double* MyTemp = &temp_[0]; + MetricArray* MyMetrics = this; # ifdef _OPENMP # pragma omp parallel private(MyMetrics, f1, f2) firstprivate(progress) { @@ -667,32 +666,20 @@ int Cpptraj::Cluster::MetricArray::calcFrameDistances(Cframes const& framesToCac progress.SetThread( mythread ); if (mythread == 0) { mprintf("\tParallelizing pairwise distance calc with %i threads\n", omp_get_num_threads()); - MyMetrics = &metrics_[0]; - } else { - // Copy every Metric in metrics_ - MyMetrics = new Metric*[metrics_.size()]; - for (unsigned int idx = 0; idx != metrics_.size(); idx++) - MyMetrics[idx] = metrics_[idx]->Copy(); - MyTemp = new double[metrics_.size()]; - } + MyMetrics = this; + } else + MyMetrics = new MetricArray(*this); # pragma omp for schedule(dynamic) # endif for (f1 = 0; f1 < f1end; f1++) { progress.Update(f1); for (f2 = f1 + 1; f2 < f2end; f2++) { - //cache_->SetElement( f1, f2, MyMetric->FrameDist(framesToCache[f1], framesToCache[f2]) ); - for (unsigned int idx = 0; idx != metrics_.size(); idx++) - MyTemp[idx] = MyMetrics[idx]->FrameDist(framesToCache[f1], framesToCache[f2]); - cache_->SetElement( f1, f2, DistCalc(MyTemp, metrics_.size()) ); + cache_->SetElement( f1, f2, MyMetrics->Uncached_Frame_Distance(framesToCache[f1], framesToCache[f2]) ); } } # ifdef _OPENMP - if (mythread > 0) { - for (unsigned int idx = 0; idx != metrics_.size(); idx++) - delete MyMetrics[idx]; - delete[] MyMetrics; - delete[] MyTemp; - } + if (mythread > 0) + delete MyMetrics; } // END omp parallel # endif progress.Finish(); From 2fc44d060d5afe408fbdf92cf45b0c5031353325 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 11:47:04 -0400 Subject: [PATCH 368/417] Add CentroidDist --- src/Cluster/MetricArray.cpp | 15 ++++++++++++++- src/Cluster/MetricArray.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 3caa08a225..b1ca148a8e 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -540,6 +540,7 @@ double Cpptraj::Cluster::MetricArray::DistCalc(std::vector const& arrayI return dist; } +// FIXME deprecate /** Perform distance calc according to current type. */ double Cpptraj::Cluster::MetricArray::DistCalc(const double* arrayIn, unsigned int length) const { double dist = 0; @@ -553,7 +554,7 @@ double Cpptraj::Cluster::MetricArray::DistCalc(const double* arrayIn, unsigned i double Cpptraj::Cluster::MetricArray::FrameCentroidDist(int frame, CentroidArray const& centroids ) { if (centroids.size() != metrics_.size()) { - mprinterr("Internal Error: MetricArray::FrameOpCentroid: centroids and metrics_ sizes do not match.\n"); + mprinterr("Internal Error: MetricArray::FrameCentroidDist: centroids and metrics_ sizes do not match.\n"); return -1.0; } for (unsigned int idx = 0; idx != metrics_.size(); idx++) @@ -561,6 +562,18 @@ double Cpptraj::Cluster::MetricArray::FrameCentroidDist(int frame, CentroidArray return DistCalc(temp_); } +/** Calculate distance between given centroids. */ +double Cpptraj::Cluster::MetricArray::CentroidDist(CentroidArray const& C1, CentroidArray const& C2) +{ + if (C1.size() != metrics_.size() || C2.size() != metrics_.size()) { + mprinterr("Internal Error: MetricArray::CentroidDist: centroids and metrics_ sizes do not match.\n"); + return -1.0; + } + for (unsigned int idx = 0; idx != metrics_.size(); idx++) + temp_[idx] = metrics_[idx]->CentroidDist( C1[idx], C2[idx] ); + return DistCalc(temp_); +} + /** \return distance between frames (uncached). */ double Cpptraj::Cluster::MetricArray::Uncached_Frame_Distance(int f1, int f2) { diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 2fb8e7f595..8c55042b6e 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -71,6 +71,8 @@ class MetricArray { void FrameOpCentroid(int, CentroidArray&, double, Metric::CentOpType); /// \return distance between given frame and centroids double FrameCentroidDist(int, CentroidArray const&); + /// \return distance between given centroids + double CentroidDist(CentroidArray const&, CentroidArray const&); /// \return distance between frames (uncached) double Uncached_Frame_Distance(int, int); From b86d8ead1c5f6dd3314f9efb122474070241fe31 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 11:50:43 -0400 Subject: [PATCH 369/417] Use MetricArray --- src/Cluster/List.cpp | 39 +++++++++++++++++++-------------------- src/Cluster/List.h | 11 +++++------ src/Cluster/clusterdepend | 4 ++-- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/Cluster/List.cpp b/src/Cluster/List.cpp index 9868de7545..7bc9e745a6 100644 --- a/src/Cluster/List.cpp +++ b/src/Cluster/List.cpp @@ -3,7 +3,6 @@ #include "List.h" #include "MetricArray.h" #include "Node.h" -#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" #include "../DataSet_integer.h" #include "../ProgressBar.h" @@ -155,7 +154,7 @@ void Cpptraj::Cluster::List::Clear() { } // ----------------------------------------------------------------------------- -void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric* metricIn) +void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, MetricArray& metricIn) { // NOTE: All cluster centroids must be up to date. int idx; @@ -164,7 +163,7 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric cluster_it minNode, Cnode; ParallelProgress progress( nframes ); // For OMP, every other thread will need its own Cdist. - Metric* MyCdist = metricIn; + MetricArray* MyCdist = &metricIn; # ifdef _OPENMP // For OMP need a temp. array to hold which frame goes to which cluster to avoid clashes std::vector idxToCluster( nframes, clusters_.end() ); @@ -174,9 +173,9 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric progress.SetThread( mythread ); if (mythread == 0) { mprintf("\tParallelizing sieve restore calc with %i threads\n", omp_get_num_threads()); - MyCdist = metricIn; + MyCdist = &metricIn; } else - MyCdist = metricIn->Copy(); + MyCdist = new MetricArray(metricIn); # pragma omp for # endif for (idx = 0; idx < nframes; ++idx) { @@ -214,7 +213,7 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric /** Add frames to clusters that are within epsilon of a cluster centroid (if * sieveToCentroid) or epsilon of any frame in a cluster otherwise. */ -void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric* metricIn, +void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, MetricArray& metricIn, bool sieveToCentroid, double epsilon) { // NOTE: All cluster centroids must be up to date! @@ -233,7 +232,7 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric // Otherwise we could be comparoing sieved frames to other sieved frames. std::vector idxToCluster( nframes, clusters_.end() ); // For OMP, every other thread will need its own Cdist. - Metric* MyCdist = metricIn; + MetricArray* MyCdist = &metricIn; # ifdef _OPENMP # pragma omp parallel private(MyCdist, idx) firstprivate(progress) reduction(+ : Nsieved, n_sieved_noise) { @@ -241,9 +240,9 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric progress.SetThread( mythread ); if (mythread == 0) { mprintf("\tParallelizing calculation with %i threads\n", omp_get_num_threads()); - MyCdist = metricIn; + MyCdist = &metricIn; } else - MyCdist = metricIn->Copy(); + MyCdist = new MetricArray(metricIn); # pragma omp for # endif for (idx = 0; idx < nframes; ++idx) { @@ -267,7 +266,7 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric // Check if any frames in the cluster are closer than epsilon to sieved frame. for (int cidx=0; cidx < minNode->Nframes(); cidx++) { //TODO just use PairwiseMatrix::Frame_Distance here? - if ( MyCdist->FrameDist(frame, minNode->ClusterFrame(cidx)) < epsilon ) + if ( MyCdist->Frame_Distance(frame, minNode->ClusterFrame(cidx)) < epsilon ) { goodFrame = true; break; @@ -305,7 +304,7 @@ void Cpptraj::Cluster::List::AddFramesByCentroid(Cframes const& framesIn, Metric * between cluster centroids. * NOTE: To use this, cluster centroids should be fully up-to-date. */ -double Cpptraj::Cluster::List::ComputeDBI(std::vector& averageDist, Metric* metricIn) +double Cpptraj::Cluster::List::ComputeDBI(std::vector& averageDist, MetricArray& metricIn) const { averageDist.clear(); @@ -325,7 +324,7 @@ const for (cluster_iterator c2 = begincluster(); c2 != endcluster(); ++c2, ++nc2) { if (c1 != c2) { double Fred = averageDist[nc1] + averageDist[nc2]; - Fred /= metricIn->CentroidDist( c1->Cent(), c2->Cent() ); + Fred /= metricIn.CentroidDist( c1->Cent(), c2->Cent() ); if (Fred > MaxFred) MaxFred = Fred; } @@ -351,7 +350,7 @@ const * NOTE: This calc differs slightly from PTRAJ in that real centroids are used * instead of representative structures. */ -double Cpptraj::Cluster::List::ComputePseudoF(double& SSRSST, Metric* metricIn) const +double Cpptraj::Cluster::List::ComputePseudoF(double& SSRSST, MetricArray& metricIn) const { // Calculation makes no sense with fewer than 2 clusters. if (Nclusters() < 2) { @@ -383,9 +382,9 @@ double Cpptraj::Cluster::List::ComputePseudoF(double& SSRSST, Metric* metricIn) { for (Node::frame_iterator f1 = C1->beginframe(); f1 != C1->endframe(); ++f1) { - double dist = metricIn->FrameCentroidDist(*f1, c_all.Cent()); + double dist = metricIn.FrameCentroidDist(*f1, c_all.Cent()); gss += (dist * dist); - dist = metricIn->FrameCentroidDist(*f1, C1->Cent()); + dist = metricIn.FrameCentroidDist(*f1, C1->Cent()); wss += (dist * dist); } } @@ -417,7 +416,7 @@ double Cpptraj::Cluster::List::ComputePseudoF(double& SSRSST, Metric* metricIn) * is dissimilar and may fit better in a neighboring cluster. Values of 0 * indicate the point is on a border between two clusters. */ -int Cpptraj::Cluster::List::CalcSilhouette(PairwiseMatrix const& pmatrix, +int Cpptraj::Cluster::List::CalcSilhouette(MetricArray& metrics, Cframes const& sievedFrames, bool includeSieved) { @@ -439,7 +438,7 @@ int Cpptraj::Cluster::List::CalcSilhouette(PairwiseMatrix const& pmatrix, for (Node::frame_iterator f2 = Ci->beginframe(); f2 != Ci->endframe(); ++f2) { if (f1 != f2) { - ai += pmatrix.Frame_Distance(*f1, *f2); + ai += metrics.Frame_Distance(*f1, *f2); ++self_frames; } } @@ -447,7 +446,7 @@ int Cpptraj::Cluster::List::CalcSilhouette(PairwiseMatrix const& pmatrix, for (Node::frame_iterator f2 = Ci->beginframe(); f2 != Ci->endframe(); ++f2) { if (f1 != f2 && !sievedFrames.HasFrame(*f2)) { - ai += pmatrix.Frame_Distance(*f1, *f2); // TODO any benefit from GetFdist vs Frame_Distance + ai += metrics.Frame_Distance(*f1, *f2); ++self_frames; } } @@ -466,14 +465,14 @@ int Cpptraj::Cluster::List::CalcSilhouette(PairwiseMatrix const& pmatrix, // NOTE: ASSUMING NO EMPTY CLUSTERS if (includeSieved) { for (Node::frame_iterator f2 = Cj->beginframe(); f2 != Cj->endframe(); ++f2) - bi += pmatrix.Frame_Distance(*f1, *f2); + bi += metrics.Frame_Distance(*f1, *f2); bi /= (double)Cj->Nframes(); } else { int cj_frames = 0; for (Node::frame_iterator f2 = Cj->beginframe(); f2 != Cj->endframe(); ++f2) { if (!sievedFrames.HasFrame(*f2)) { - bi += pmatrix.Frame_Distance(*f1, *f2); + bi += metrics.Frame_Distance(*f1, *f2); ++cj_frames; } } diff --git a/src/Cluster/List.h b/src/Cluster/List.h index ce9232823e..713d9fe976 100644 --- a/src/Cluster/List.h +++ b/src/Cluster/List.h @@ -7,7 +7,6 @@ namespace Cpptraj { namespace Cluster { class MetricArray; class Node; -class PairwiseMatrix; /// Hold all individual clusters. /** Currently implemented as an STL list since sorting and erasing are more * efficient. @@ -60,16 +59,16 @@ class List { /// Update centroids TODO check if they need updating void UpdateCentroids(MetricArray&); /// Add given frames to clusters based on distance to centroid. TODO save original frames - void AddFramesByCentroid(Cframes const&, Metric*); + void AddFramesByCentroid(Cframes const&, MetricArray&); /// Add given frames to clusters based on distance to centroid and cutoff. - void AddFramesByCentroid(Cframes const&, Metric*, bool, double); + void AddFramesByCentroid(Cframes const&, MetricArray&, bool, double); /// Calculate the Davies-Bouldin index. - double ComputeDBI(std::vector&, Metric*) const; + double ComputeDBI(std::vector&, MetricArray&) const; /// Calculate pseudo-F - double ComputePseudoF(double&, Metric*) const; + double ComputePseudoF(double&, MetricArray&) const; /// Calculate cluster and cluster frame silhouettes TODO data sets - int CalcSilhouette(PairwiseMatrix const&, Cframes const&, bool); + int CalcSilhouette(MetricArray&, Cframes const&, bool); private: typedef std::list Narray; Narray clusters_; ///< Hold all clusters. diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index c10023b411..f0706b78fa 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -12,7 +12,7 @@ Cmatrix_NC.o : Cmatrix_NC.cpp ../CpptrajStdio.h ../FileName.h ../NC_Routines.h C Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.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 ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h CentroidArray.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h MetricArray.h Node.h Output.h Results.h Results_Coords.h Sieve.h DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h PairwiseMatrix.h DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h -List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Cluster/Cframes.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_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../ProgressBar.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h Metric_DME.o : Metric_DME.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_DME.h Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_RMS.h @@ -21,5 +21,5 @@ Metric_Scalar.o : Metric_Scalar.cpp ../AssociatedData.h ../CpptrajFile.h ../Cppt Metric_Torsion.o : Metric_Torsion.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Torsion.h Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h Metric.h MetricArray.h Node.h PairwiseMatrix.h Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h -Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Cframes.h List.h Metric.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h +Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h From 8bca61ee4bb6c146a148921f34bfd9c587a2b5d3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 12:02:30 -0400 Subject: [PATCH 370/417] Switch from PairwiseMatrix to MetricArray --- src/Cluster/Algorithm.cpp | 9 ++++----- src/Cluster/Algorithm.h | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Cluster/Algorithm.cpp b/src/Cluster/Algorithm.cpp index 9412955090..7d75a8c813 100644 --- a/src/Cluster/Algorithm.cpp +++ b/src/Cluster/Algorithm.cpp @@ -1,18 +1,17 @@ #include "Algorithm.h" -#include "Metric.h" +#include "MetricArray.h" #include "Node.h" -#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" /** \return Distance between given cluster centroids. */ double Cpptraj::Cluster::Algorithm::ClusterDistance(Node const& C1, Node const& C2, - PairwiseMatrix const& pmatrix, + MetricArray& pmatrix, bool includeSieved, Cframes const& sievedOut) const { - if (C1.Cent() == 0 || C2.Cent() == 0) { + if (C1.Cent().empty() || C2.Cent().empty()) { mprinterr("Internal Error: One or both centroids are null in ClusterDistance().\n"); return -1.0; } - return pmatrix.MetricPtr()->CentroidDist( C1.Cent(), C2.Cent() ); + return pmatrix.CentroidDist( C1.Cent(), C2.Cent() ); } diff --git a/src/Cluster/Algorithm.h b/src/Cluster/Algorithm.h index f5869e70a2..21297c997a 100644 --- a/src/Cluster/Algorithm.h +++ b/src/Cluster/Algorithm.h @@ -7,7 +7,7 @@ namespace Cluster { class Cframes; class List; class Node; -class PairwiseMatrix; +class MetricArray; /// Abstract base class for implementing clustering algorithms. class Algorithm { public: @@ -22,11 +22,11 @@ class Algorithm { /// Report brief details on algorithm setup to a file. virtual void Results(CpptrajFile&) const = 0; /// Perform clustering on specified frames using given distance matrix. - virtual int DoClustering(List&, Cframes const&, PairwiseMatrix const&) = 0; + virtual int DoClustering(List&, Cframes const&, MetricArray&) = 0; /// Report any timing data virtual void Timing(double) const = 0; /// /return Algorithm-specific between-cluster distance. Default to centroid distance. - virtual double ClusterDistance(Node const&, Node const&, PairwiseMatrix const&, + virtual double ClusterDistance(Node const&, Node const&, MetricArray&, bool, Cframes const&) const; /// /return Epsilon for density-based algorithms; intended for use with sieve restore. virtual double Epsilon() const { return 0.0; } From 545e8b2e081adc999cfc726b1bee9bd1747b6940 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 12:05:05 -0400 Subject: [PATCH 371/417] Convert to use MetricArray --- src/Cluster/BestReps.cpp | 21 ++++++++++----------- src/Cluster/BestReps.h | 18 +++++++++--------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/Cluster/BestReps.cpp b/src/Cluster/BestReps.cpp index 6c3101878d..3db4172a33 100644 --- a/src/Cluster/BestReps.cpp +++ b/src/Cluster/BestReps.cpp @@ -1,8 +1,7 @@ #include "BestReps.h" #include "List.h" -#include "Metric.h" +#include "MetricArray.h" #include "Node.h" -#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" /** CONSTRUCTOR */ @@ -61,7 +60,7 @@ void Cpptraj::Cluster::BestReps::PrintBestReps(Node const& node) { } /** Find best representative frames for each cluster. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames(List& clusters, PairwiseMatrix const& pmatrix, +int Cpptraj::Cluster::BestReps::FindBestRepFrames(List& clusters, MetricArray& pmatrix, Cframes const& sievedFrames) const { @@ -94,7 +93,7 @@ const } /** Find best representative frames for given node. */ -int Cpptraj::Cluster::BestReps::FindBestRepFrames(Node& node, PairwiseMatrix const& pmatrix, +int Cpptraj::Cluster::BestReps::FindBestRepFrames(Node& node, MetricArray& pmatrix, Cframes const& sievedFrames) const { @@ -128,7 +127,7 @@ const * having the lowest cumulative distance to every other point in the cluster. */ int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(Node& node, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) const { int err = 0; @@ -186,7 +185,7 @@ const * having the lowest cumulative distance to every other point in the cluster. */ int Cpptraj::Cluster::BestReps::FindBestRepFrames_CumulativeDist(List& clusters, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) const { int err = 0; @@ -229,7 +228,7 @@ const * ignoring sieved frames. */ int Cpptraj::Cluster::BestReps:: - FindBestRepFrames_NoSieve_CumulativeDist(Node& node, PairwiseMatrix const& pmatrix, + FindBestRepFrames_NoSieve_CumulativeDist(Node& node, MetricArray& pmatrix, Cframes const& sievedFrames) const { @@ -262,7 +261,7 @@ const * ignoring sieved frames. */ int Cpptraj::Cluster::BestReps:: - FindBestRepFrames_NoSieve_CumulativeDist(List& clusters, PairwiseMatrix const& pmatrix, + FindBestRepFrames_NoSieve_CumulativeDist(List& clusters, MetricArray& pmatrix, Cframes const& sievedFrames) const { @@ -279,7 +278,7 @@ const * having the lowest distance to the cluster centroid. */ int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(Node& node, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) const { int err = 0; @@ -288,7 +287,7 @@ const //node.Cent()->Print("centroid." + integerToString(node.Num())); // DEBUG for (Node::frame_iterator f1 = node.beginframe(); f1 != node.endframe(); ++f1) { - double dist = pmatrix.MetricPtr()->FrameCentroidDist(*f1, node.Cent()); + double dist = pmatrix.FrameCentroidDist(*f1, node.Cent()); //mprintf("\t%8i %10.4g %10.4g %i\n", *f1+1, dist, mindist, minframe+1); SaveBestRep(bestReps, RepPair(dist, *f1), nToSave_); } @@ -305,7 +304,7 @@ const * having the lowest distance to the cluster centroid. */ int Cpptraj::Cluster::BestReps::FindBestRepFrames_Centroid(List& clusters, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) const { int err = 0; diff --git a/src/Cluster/BestReps.h b/src/Cluster/BestReps.h index e06e24e28e..6d4dfb33bc 100644 --- a/src/Cluster/BestReps.h +++ b/src/Cluster/BestReps.h @@ -5,8 +5,8 @@ namespace Cpptraj { namespace Cluster { class Cframes; class List; +class MetricArray; class Node; -class PairwiseMatrix; /// Used to find best representative structures for a cluster. class BestReps { public: @@ -18,9 +18,9 @@ class BestReps { /// Initialize best rep frames search with method type, # to save, and debug level int InitBestReps(RepMethodType, int, int); /// Find best rep frames for each cluster in given list - int FindBestRepFrames(List&, PairwiseMatrix const&, Cframes const&) const; + int FindBestRepFrames(List&, MetricArray&, Cframes const&) const; /// Find the best rep frames for given node - int FindBestRepFrames(Node&, PairwiseMatrix const&, Cframes const&) const; + int FindBestRepFrames(Node&, MetricArray&, Cframes const&) const; private: /// Print best reps to stdout static void PrintBestReps(Node const&); @@ -36,17 +36,17 @@ class BestReps { static inline void SetBestRepFrame(Node& node, RepMap const&); /// Find best rep frames in node by shortest distance to all other frames. - int FindBestRepFrames_CumulativeDist(Node&, PairwiseMatrix const&) const; + int FindBestRepFrames_CumulativeDist(Node&, MetricArray&) const; /// Find best representative frames by shortest distance to all other frames. - int FindBestRepFrames_CumulativeDist(List&, PairwiseMatrix const&) const; + int FindBestRepFrames_CumulativeDist(List&, MetricArray&) const; /// Find best rep frames in node by shortest distance, ignoring sieved frames. - int FindBestRepFrames_NoSieve_CumulativeDist(Node&, PairwiseMatrix const&, Cframes const&) const; + int FindBestRepFrames_NoSieve_CumulativeDist(Node&, MetricArray&, Cframes const&) const; /// Find best representative frames by shortest distance, ignoring sieved frames. - int FindBestRepFrames_NoSieve_CumulativeDist(List&, PairwiseMatrix const&, Cframes const&) const; + int FindBestRepFrames_NoSieve_CumulativeDist(List&, MetricArray&, Cframes const&) const; /// Find best rep frames in node by shortest distance to centroid. - int FindBestRepFrames_Centroid(Node&, PairwiseMatrix const&) const; + int FindBestRepFrames_Centroid(Node&, MetricArray&) const; /// Find best representative frames by shortest distance to centroid. - int FindBestRepFrames_Centroid(List&, PairwiseMatrix const&) const; + int FindBestRepFrames_Centroid(List&, MetricArray&) const; int debug_; ///< Debug level, set in call to FindBestRepFrames int nToSave_; ///< Number of representatives to find From c27ce6efeba538a10c6ea03886f1882c4dbaa5b4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 12:05:30 -0400 Subject: [PATCH 372/417] Convert from Metric*/PairwiseMatrix to MetricArray --- src/Cluster/Output.cpp | 16 +++++++--------- src/Cluster/Output.h | 9 ++++----- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Cluster/Output.cpp b/src/Cluster/Output.cpp index 8e4b7b1fb4..c58c9a0ab6 100644 --- a/src/Cluster/Output.cpp +++ b/src/Cluster/Output.cpp @@ -4,9 +4,8 @@ #include "Algorithm.h" #include "BestReps.h" #include "List.h" -#include "Metric.h" +#include "MetricArray.h" #include "Node.h" -#include "PairwiseMatrix.h" #include "../Matrix.h" #include "../CpptrajFile.h" #include "../CpptrajStdio.h" @@ -26,9 +25,8 @@ const char* XMGRACE_COLOR[] = { */ void Cpptraj::Cluster::Output::PrintClustersToFile(CpptrajFile& outfile, List const& clusters, -//std::string const& filename, Algorithm const& algorithmIn, - Metric* metricIn, int sieve, + MetricArray& metricIn, int sieve, Cframes const& sievedFrames) { //CpptrajFile outfile; @@ -40,7 +38,7 @@ void Cpptraj::Cluster::Output::PrintClustersToFile(CpptrajFile& outfile, return; }*/ outfile.Printf("#Clustering: %i clusters %u frames\n", - clusters.Nclusters(), metricIn->Ntotal()); + clusters.Nclusters(), metricIn.Ntotal()); // DBI std::vector averageDist; double DBITotal = clusters.ComputeDBI( averageDist, metricIn ); @@ -79,7 +77,7 @@ void Cpptraj::Cluster::Output::PrintClustersToFile(CpptrajFile& outfile, for (List::cluster_iterator C1 = clusters.begincluster(); C1 != clusters.endcluster(); ++C1) { buffer.clear(); - buffer.resize(metricIn->Ntotal(), '.'); + buffer.resize(metricIn.Ntotal(), '.'); for (Node::frame_iterator f1 = C1->beginframe(); f1 != C1->endframe(); ++f1) buffer[ *f1 ] = 'X'; buffer += '\n'; @@ -168,11 +166,11 @@ unsigned int Cpptraj::Cluster::Output::DetermineNameWidth(List const& clusters) /** Print a summary of clusters. */ int Cpptraj::Cluster::Output::Summary(CpptrajFile& outfile, List const& clusters, Algorithm const& algorithm, - PairwiseMatrix const& pmatrix, + MetricArray& pmatrix, bool includeSieved, bool includeSieveCdist, Cframes const& sievedOut) { - double fmax = (double)pmatrix.DistMetric().Ntotal(); + double fmax = (double)pmatrix.Ntotal(); //if (FrameDistances().SieveValue() != 1 && !includeSieveInAvg) // mprintf("Warning: Within cluster average distance (AvgDist) does not include sieved frames.\n"); outfile.Printf("%-8s %8s %8s %8s %8s","#Cluster","Frames","Frac", "AvgDist","Stdev"); @@ -292,7 +290,7 @@ void Cpptraj::Cluster::Output::Summary_Part(CpptrajFile& outfile, Cframes const& splitFrames, List const& clusters, BestReps const& findBestReps, - PairwiseMatrix const& pmatrix, + MetricArray& pmatrix, Cframes const& framesToCluster) { // If no split frames were specified, use halfway point. diff --git a/src/Cluster/Output.h b/src/Cluster/Output.h index 775dc617a3..2491710327 100644 --- a/src/Cluster/Output.h +++ b/src/Cluster/Output.h @@ -6,20 +6,19 @@ namespace Cluster { class Algorithm; class Cframes; class List; -class Metric; -class PairwiseMatrix; // TODO anything that needs this calcd outside here? +class MetricArray; class BestReps; /// Cluster output routines. class Output { public: - static void PrintClustersToFile(CpptrajFile&, List const&, Algorithm const&, Metric*, + static void PrintClustersToFile(CpptrajFile&, List const&, Algorithm const&, MetricArray&, int, Cframes const&); static int PrintSilhouetteFrames(CpptrajFile&, List const&); static int PrintSilhouettes(CpptrajFile&, List const&); - static int Summary(CpptrajFile&, List const&, Algorithm const&, PairwiseMatrix const&, + static int Summary(CpptrajFile&, List const&, Algorithm const&, MetricArray&, bool, bool, Cframes const&); static void Summary_Part(CpptrajFile&, unsigned int, Cframes const&, List const&, - BestReps const&, PairwiseMatrix const&, Cframes const&); + BestReps const&, MetricArray&, Cframes const&); private: static unsigned int DetermineNameWidth(List const&); }; From abd6dbbdd8bd98c613bbc687359b5b2e2a8ab462 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 12:13:35 -0400 Subject: [PATCH 373/417] Use MetricArray in place of PairwiseMatrix --- src/Cluster/Algorithm_DBscan.cpp | 15 +++++++-------- src/Cluster/Algorithm_DBscan.h | 10 +++++----- src/Cluster/Algorithm_DPeaks.cpp | 10 +++++----- src/Cluster/Algorithm_DPeaks.h | 6 +++--- src/Cluster/Algorithm_HierAgglo.cpp | 24 ++++++++++++------------ src/Cluster/Algorithm_HierAgglo.h | 20 ++++++++++---------- src/Cluster/Algorithm_Kmeans.cpp | 29 ++++++++++++++--------------- src/Cluster/Algorithm_Kmeans.h | 6 +++--- 8 files changed, 59 insertions(+), 61 deletions(-) diff --git a/src/Cluster/Algorithm_DBscan.cpp b/src/Cluster/Algorithm_DBscan.cpp index 442977cceb..853c3cf5ea 100644 --- a/src/Cluster/Algorithm_DBscan.cpp +++ b/src/Cluster/Algorithm_DBscan.cpp @@ -3,9 +3,8 @@ #include "Algorithm_DBscan.h" #include "Cframes.h" #include "List.h" -#include "Metric.h" +#include "MetricArray.h" #include "Node.h" -#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" #include "../ArgList.h" #include "../ProgressBar.h" @@ -81,7 +80,7 @@ void Cpptraj::Cluster::Algorithm_DBscan::Info() const { // Cluster_DBSCAN::Cluster() int Cpptraj::Cluster::Algorithm_DBscan::DoClustering(List& clusters, Cframes const& framesToCluster, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { // Check if only need to calculate Kdist function(s) if (!kdist_.Empty()) { @@ -151,14 +150,14 @@ int Cpptraj::Cluster::Algorithm_DBscan::DoClustering(List& clusters, } // Add clusters. for (unsigned int cnum = 0; cnum != C0.size(); cnum++) - clusters.AddCluster( Node(pmatrix.MetricPtr(), C0[cnum], cnum) ); + clusters.AddCluster( Node(pmatrix, C0[cnum], cnum) ); } return 0; } // Cluster_DBSCAN::ExpandCluster() bool Cpptraj::Cluster::Algorithm_DBscan::ExpandCluster(Cframes const& framesToCluster, - PairwiseMatrix const& pmatrix, + MetricArray& pmatrix, unsigned int point, int ClusterId) { //seeds:=SetOfPoints.regionQuery(Point,Eps); @@ -224,7 +223,7 @@ bool Cpptraj::Cluster::Algorithm_DBscan::ExpandCluster(Cframes const& framesToCl // Cluster_DBSCAN::RegionQuery() void Cpptraj::Cluster::Algorithm_DBscan::RegionQuery(Iarray& NeighborPts, Cframes const& framesToCluster, - PairwiseMatrix const& pmatrix, + MetricArray& pmatrix, int point) const { NeighborPts.clear(); @@ -251,7 +250,7 @@ void Cpptraj::Cluster::Algorithm_DBscan::Results(CpptrajFile& outfile) const { */ void Cpptraj::Cluster::Algorithm_DBscan::ComputeKdist( int Kval, Cframes const& FramesToCluster, - PairwiseMatrix const& pmatrix ) + MetricArray& pmatrix ) const { std::vector dists; @@ -289,7 +288,7 @@ const // Cluster_DBSCAN::ComputeKdistMap() void Cpptraj::Cluster::Algorithm_DBscan::ComputeKdistMap( Range const& Kvals, Cframes const& FramesToCluster, - PairwiseMatrix const& pmatrix ) + MetricArray& pmatrix ) const { int pt1_idx, pt2_idx, d_idx, point; diff --git a/src/Cluster/Algorithm_DBscan.h b/src/Cluster/Algorithm_DBscan.h index 9fd3e1292f..ed5f263a09 100644 --- a/src/Cluster/Algorithm_DBscan.h +++ b/src/Cluster/Algorithm_DBscan.h @@ -16,16 +16,16 @@ class Algorithm_DBscan : public Algorithm { int Setup(ArgList&); void Info() const; void Results(CpptrajFile&) const; - int DoClustering(List&, Cframes const&, PairwiseMatrix const&); + int DoClustering(List&, Cframes const&, MetricArray&); void Timing(double) const {} double Epsilon() const { return epsilon_; } private: typedef std::vector Iarray; - bool ExpandCluster(Cframes const&, PairwiseMatrix const&, unsigned int, int); - void RegionQuery(Iarray&, Cframes const&, PairwiseMatrix const&, int) const; - void ComputeKdist( int, Cframes const&, PairwiseMatrix const&) const ; - void ComputeKdistMap( Range const&, Cframes const&, PairwiseMatrix const& ) const ; + bool ExpandCluster(Cframes const&, MetricArray&, unsigned int, int); + void RegionQuery(Iarray&, Cframes const&, MetricArray&, int) const; + void ComputeKdist( int, Cframes const&, MetricArray&) const ; + void ComputeKdistMap( Range const&, Cframes const&, MetricArray& ) const ; Iarray Status_; ///< Status of each point: unclassified, noise, or in cluster Iarray seeds_; ///< Results from first RegionQuery diff --git a/src/Cluster/Algorithm_DPeaks.cpp b/src/Cluster/Algorithm_DPeaks.cpp index 57adb0d9c4..5499fe5517 100644 --- a/src/Cluster/Algorithm_DPeaks.cpp +++ b/src/Cluster/Algorithm_DPeaks.cpp @@ -2,8 +2,8 @@ #include // sort #include "Algorithm_DPeaks.h" #include "List.h" +#include "MetricArray.h" #include "Node.h" -#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" #include "../ArgList.h" #include "../DataSet_Mesh.h" @@ -103,7 +103,7 @@ void Cpptraj::Cluster::Algorithm_DPeaks::Info() const { /** Perform density peaks clustering. */ int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, Cframes const& framesToCluster, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { int err = 0; // Calculate local densities @@ -254,7 +254,7 @@ int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, frames.push_back( Points_[i].Fnum() ); } if (!frames.empty()) - clusters.AddCluster( Node(pmatrix.MetricPtr(), frames, clusters.Nclusters()) ); + clusters.AddCluster( Node(pmatrix, frames, clusters.Nclusters()) ); } return 0; } @@ -262,7 +262,7 @@ int Cpptraj::Cluster::Algorithm_DPeaks::DoClustering(List& clusters, // ----------------------------------------------------------------------------- /** Gaussian kernel for density peaks. */ int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_GaussianKernel(Cframes const& framesToCluster, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { mprintf("\tStarting DPeaks clustering. Using Gaussian kernel to calculate density.\n"); // First determine which frames are being clustered. @@ -347,7 +347,7 @@ int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_GaussianKernel(Cframes const& fr // ----------------------------------------------------------------------------- /** Discrete density. */ int Cpptraj::Cluster::Algorithm_DPeaks::Cluster_DiscreteDensity(Cframes const& framesToCluster, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { mprintf("\tStarting DPeaks clustering, discrete density calculation.\n"); Points_.clear(); diff --git a/src/Cluster/Algorithm_DPeaks.h b/src/Cluster/Algorithm_DPeaks.h index b6abcb5fa8..211bce174f 100644 --- a/src/Cluster/Algorithm_DPeaks.h +++ b/src/Cluster/Algorithm_DPeaks.h @@ -14,13 +14,13 @@ class Algorithm_DPeaks : public Algorithm { int Setup(ArgList&); void Info() const; void Results(CpptrajFile&) const; - int DoClustering(List&, Cframes const&, PairwiseMatrix const&); + int DoClustering(List&, Cframes const&, MetricArray&); void Timing(double) const {} double Epsilon() const { return epsilon_; } private: void AssignClusterNum(int, int&); - int Cluster_GaussianKernel(Cframes const&, PairwiseMatrix const&); - int Cluster_DiscreteDensity(Cframes const&, PairwiseMatrix const&); + int Cluster_GaussianKernel(Cframes const&, MetricArray&); + int Cluster_DiscreteDensity(Cframes const&, MetricArray&); int ChoosePointsAutomatically(); int ChoosePointsManually(); int ChoosePointsFromClusters(List const&, Cframes const&); diff --git a/src/Cluster/Algorithm_HierAgglo.cpp b/src/Cluster/Algorithm_HierAgglo.cpp index 4b9a439bc8..6ea0c39e6c 100644 --- a/src/Cluster/Algorithm_HierAgglo.cpp +++ b/src/Cluster/Algorithm_HierAgglo.cpp @@ -1,7 +1,7 @@ #include // double max #include "Algorithm_HierAgglo.h" +#include "MetricArray.h" #include "Node.h" -#include "PairwiseMatrix.h" #include "../CpptrajStdio.h" #include "../ArgList.h" #include "../ProgressBar.h" @@ -77,7 +77,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::Timing(double total) const { /** Default: put all frames in their own starting cluster. */ void Cpptraj::Cluster::Algorithm_HierAgglo::buildInitialClusters(List& clusters, Cframes const& framesToCluster, - Metric* metric) + MetricArray& metric) { int num = 0; for (Cframes_it frm = framesToCluster.begin(); frm != framesToCluster.end(); ++frm) @@ -97,7 +97,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::buildInitialClusters(List& clusters, */ int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, Cframes const& framesToCluster, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { // If epsilon not given make it huge if (epsilon_ == -1.0) epsilon_ = std::numeric_limits::max(); @@ -107,7 +107,7 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, ProgressBar cluster_progress(-10); // Build initial clusters. if (clusters.empty()) - buildInitialClusters(clusters, framesToCluster, pmatrix.MetricPtr()); + buildInitialClusters(clusters, framesToCluster, pmatrix); else if (clusters.Nclusters() <= nclusters_) { mprintf("\tTarget number of clusters (%i) already reached (%i).\n", nclusters_, clusters.Nclusters()); @@ -157,7 +157,7 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::DoClustering(List& clusters, /** Find and merge the two closest clusters. * \return 1 if clustering is complete, 0 otherwise. */ -int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters, PairwiseMatrix const& pmatrix) +int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters, MetricArray& pmatrix) { int C1, C2; // Find the minimum distance between clusters. C1 will be lower than C2. @@ -237,7 +237,7 @@ int Cpptraj::Cluster::Algorithm_HierAgglo::MergeClosest(List& clusters, Pairwise /** \return The shortest distance between any two points in C1 and C2. */ double Cpptraj::Cluster::Algorithm_HierAgglo::minDist(Node const& C1, Node const& C2, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { double min = std::numeric_limits::max(); for (Node::frame_iterator c1frames = C1.beginframe(); c1frames != C1.endframe(); ++c1frames) @@ -255,7 +255,7 @@ double Cpptraj::Cluster::Algorithm_HierAgglo::minDist(Node const& C1, /** \return The longest distance between any two points in C1 and C2. */ double Cpptraj::Cluster::Algorithm_HierAgglo::maxDist(Node const& C1, Node const& C2, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { double max = -1.0; for (Node::frame_iterator c1frames = C1.beginframe(); c1frames != C1.endframe(); ++c1frames) @@ -273,7 +273,7 @@ double Cpptraj::Cluster::Algorithm_HierAgglo::maxDist(Node const& C1, /** \return The average distance between points in C1 and C2. */ double Cpptraj::Cluster::Algorithm_HierAgglo::avgDist(Node const& C1, Node const& C2, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { double sum = 0.0; for (Node::frame_iterator c1frames = C1.beginframe(); c1frames != C1.endframe(); ++c1frames) @@ -292,7 +292,7 @@ double Cpptraj::Cluster::Algorithm_HierAgglo::avgDist(Node const& C1, * iterator C1 and frames in all other clusters. */ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMinDist(List::cluster_it& C1_it, List& clusters, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { // All cluster distances to C1 must be recalcd. for (List::cluster_it C2_it = clusters.begin(); @@ -310,7 +310,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMinDist(List::cluster_it& C1_it, * iterator C1 and frames in all other clusters. */ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMaxDist(List::cluster_it& C1_it, List& clusters, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { // All cluster distances to C1 must be recalcd. for (List::cluster_it C2_it = clusters.begin(); @@ -328,7 +328,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcMaxDist(List::cluster_it& C1_it, * iterator C1 and frames in all other clusters. */ void Cpptraj::Cluster::Algorithm_HierAgglo::calcAvgDist(List::cluster_it& C1_it, List& clusters, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { // All cluster distances to C1 must be recalcd. for (List::cluster_it C2_it = clusters.begin(); @@ -344,7 +344,7 @@ void Cpptraj::Cluster::Algorithm_HierAgglo::calcAvgDist(List::cluster_it& C1_it, /** \return the Distance between the two given cluster Nodes. */ double Cpptraj::Cluster::Algorithm_HierAgglo::ClusterDistance(Node const& C1, Node const& C2, - PairwiseMatrix const& pmatrix, + MetricArray& pmatrix, bool includeSieved, Cframes const& sievedOut) const diff --git a/src/Cluster/Algorithm_HierAgglo.h b/src/Cluster/Algorithm_HierAgglo.h index 2a70fa8dcc..1d8ee42fb6 100644 --- a/src/Cluster/Algorithm_HierAgglo.h +++ b/src/Cluster/Algorithm_HierAgglo.h @@ -16,21 +16,21 @@ class Algorithm_HierAgglo : public Algorithm { int Setup(ArgList&); void Info() const; void Results(CpptrajFile&) const; - int DoClustering(List&, Cframes const&, PairwiseMatrix const&); + int DoClustering(List&, Cframes const&, MetricArray&); void Timing(double) const; - double ClusterDistance(Node const&, Node const&, PairwiseMatrix const&, + double ClusterDistance(Node const&, Node const&, MetricArray&, bool, Cframes const&) const; private: - void buildInitialClusters(List&, Cframes const&, Metric*); + void buildInitialClusters(List&, Cframes const&, MetricArray&); //void InitializeClusterDistances(); - int MergeClosest(List&, PairwiseMatrix const&); - static inline double minDist(Node const&, Node const&, PairwiseMatrix const&); - static inline double maxDist(Node const&, Node const&, PairwiseMatrix const&); - static inline double avgDist(Node const&, Node const&, PairwiseMatrix const&); + int MergeClosest(List&, MetricArray&); + static inline double minDist(Node const&, Node const&, MetricArray&); + static inline double maxDist(Node const&, Node const&, MetricArray&); + static inline double avgDist(Node const&, Node const&, MetricArray&); // TODO: Node instead of cluster_it? - void calcMinDist(List::cluster_it&, List&, PairwiseMatrix const&); - void calcMaxDist(List::cluster_it&, List&, PairwiseMatrix const&); - void calcAvgDist(List::cluster_it&, List&, PairwiseMatrix const&); + void calcMinDist(List::cluster_it&, List&, MetricArray&); + void calcMaxDist(List::cluster_it&, List&, MetricArray&); + void calcAvgDist(List::cluster_it&, List&, MetricArray&); /// Type of distance calculation between clusters; corresponds to LinkageString_. enum LINKAGETYPE { SINGLELINK = 0, AVERAGELINK, COMPLETELINK }; diff --git a/src/Cluster/Algorithm_Kmeans.cpp b/src/Cluster/Algorithm_Kmeans.cpp index 27fa75a410..a1d4e317bf 100644 --- a/src/Cluster/Algorithm_Kmeans.cpp +++ b/src/Cluster/Algorithm_Kmeans.cpp @@ -1,9 +1,8 @@ #include "Algorithm_Kmeans.h" #include "Cframes.h" #include "List.h" -#include "Metric.h" +#include "MetricArray.h" #include "Node.h" -#include "PairwiseMatrix.h" #include "../ArgList.h" #include "../CpptrajFile.h" #include "../CpptrajStdio.h" @@ -68,7 +67,7 @@ void Cpptraj::Cluster::Algorithm_Kmeans::Results(CpptrajFile& outfile) const { /** Perform kmeans clustering. */ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, Cframes const& framesToCluster, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { if (mode_ == RANDOM) RN_.rn_set( kseed_ ); @@ -93,7 +92,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, { int seedFrame = framesToCluster[ *seedIdx ]; // A centroid is created for new clusters. - clusters.AddCluster( Node(pmatrix.MetricPtr(), Cframes(1, seedFrame), clusters.Nclusters()) ); + clusters.AddCluster( Node(pmatrix, Cframes(1, seedFrame), clusters.Nclusters()) ); // NOTE: No need to calc best rep frame, only 1 frame. if (debug_ > 0) mprintf("Put frame %i in cluster %i (seed index=%i).\n", @@ -130,7 +129,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, for (Iarray::const_iterator seed = Seeds.begin(); seed != Seeds.end(); ++seed) { // A centroid is created for new clusters. - clusters.AddCluster( Node(pmatrix.MetricPtr(), Cframes(1, *seed), clusters.Nclusters()) ); + clusters.AddCluster( Node(pmatrix, Cframes(1, *seed), clusters.Nclusters()) ); // NOTE: No need to calc best rep frame, only 1 frame. if (debug_ > 0) mprintf("Put frame %i in cluster %i.\n", *seed, clusters.back().Num()); @@ -138,7 +137,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, } // Ensure centroids are up to date. - clusters.UpdateCentroids( pmatrix.MetricPtr() ); + clusters.UpdateCentroids( pmatrix ); // Since clusters already exist, go beyond the initial pass. startIteration = 1; } @@ -188,7 +187,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, } //oldBestRep = C1->BestRepFrame(); oldClusterIdx = C1->Num(); - C1->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), pointFrame ); // TEST + C1->RemoveFrameUpdateCentroid( pmatrix, pointFrame ); // TEST // C1->RemoveFrameFromCluster( pointFrame ); //newBestRep = C1->FindBestRepFrame(); // C1->CalculateCentroid( pmatrix.MetricPtr() ); @@ -220,7 +219,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, List::cluster_it closestCluster = clusters.begin(); for (List::cluster_it C1 = clusters.begin(); C1 != clusters.end(); ++C1) { - double dist = pmatrix.MetricPtr()->FrameCentroidDist(pointFrame, C1->Cent()); + double dist = pmatrix.FrameCentroidDist(pointFrame, C1->Cent()); if (closestDist < 0.0 || dist < closestDist) { closestDist = dist; @@ -228,7 +227,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, } } //oldBestRep = closestCluster->BestRepFrame(); - closestCluster->AddFrameUpdateCentroid( pmatrix.MetricPtr(), pointFrame ); // TEST + closestCluster->AddFrameUpdateCentroid( pmatrix, pointFrame ); // TEST // closestCluster->AddFrameToCluster( pointFrame ); //newBestRep = closestCluster->FindBestFrameFrame(); // closestCluster->CalculateCentroid( pmatrix.MetricPtr() ); @@ -271,7 +270,7 @@ int Cpptraj::Cluster::Algorithm_Kmeans::DoClustering(List& clusters, */ Cpptraj::Cluster::Algorithm_Kmeans::Iarray Cpptraj::Cluster::Algorithm_Kmeans::FindSeedsFromClusters(List& clusters, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) const { // TODO change algorithm to do normal seed choice, then pick seeds that are @@ -280,7 +279,7 @@ const mprintf("\tTarget # seeds= %i\n", nSeedsToFind); if (nSeedsToFind < 1) return Iarray(); // Ensure centroids are up to date - clusters.UpdateCentroids( pmatrix.MetricPtr() ); + clusters.UpdateCentroids( pmatrix ); Iarray Seeds( nSeedsToFind, -1 ); int nSeedsFound = 0; while (nSeedsFound < nSeedsToFind) @@ -295,7 +294,7 @@ const for (Node::frame_iterator frm = node->beginframe(); frm != node->endframe(); ++frm) { - double dist = pmatrix.MetricPtr()->FrameCentroidDist(*frm, node->Cent()); + double dist = pmatrix.FrameCentroidDist(*frm, node->Cent()); if (dist > maxdist) { maxdist = dist; maxframe = *frm; @@ -321,7 +320,7 @@ const maxclust = node; } } - maxclust->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), MaxFrame[maxi] ); + maxclust->RemoveFrameUpdateCentroid( pmatrix, MaxFrame[maxi] ); Seeds[nSeedsFound++] = MaxFrame[maxi]; if (debug_ > 0) mprintf("DEBUG: Frame %i from cluster %i (%f) chosen as first seed.\n", @@ -349,7 +348,7 @@ const if (debug_ > 0) mprintf("DEBUG: Frame %i from cluster %i (%f, %f) chosen as seed %i.\n", MaxFrame[maxi], maxi, MaxDst[maxi], maxd, nSeedsFound); - maxclust->RemoveFrameUpdateCentroid( pmatrix.MetricPtr(), MaxFrame[maxi] ); + maxclust->RemoveFrameUpdateCentroid( pmatrix, MaxFrame[maxi] ); Seeds[nSeedsFound++] = MaxFrame[maxi]; } @@ -364,7 +363,7 @@ const * distance from our set of seeds is as large as possible. */ int Cpptraj::Cluster::Algorithm_Kmeans::FindKmeansSeeds(Cframes const& FramesToCluster, - PairwiseMatrix const& pmatrix) + MetricArray& pmatrix) { // SeedIndices will hold indices into FramesToCluster SeedIndices_.resize( nclusters_, 1 ); // 1 used to be consistent with ptraj diff --git a/src/Cluster/Algorithm_Kmeans.h b/src/Cluster/Algorithm_Kmeans.h index 38ddef24df..0b23a6eae4 100644 --- a/src/Cluster/Algorithm_Kmeans.h +++ b/src/Cluster/Algorithm_Kmeans.h @@ -13,14 +13,14 @@ class Algorithm_Kmeans : public Algorithm { int Setup(ArgList&); void Info() const; void Results(CpptrajFile&) const; - int DoClustering(List&, Cframes const&, PairwiseMatrix const&); + int DoClustering(List&, Cframes const&, MetricArray&); void Timing(double) const {} private: typedef std::vector Iarray; enum KmeansModeType { SEQUENTIAL, RANDOM }; - Iarray FindSeedsFromClusters(List&, PairwiseMatrix const&) const; - int FindKmeansSeeds(Cframes const&, PairwiseMatrix const&); + Iarray FindSeedsFromClusters(List&, MetricArray&) const; + int FindKmeansSeeds(Cframes const&, MetricArray&); Random_Number RN_; int nclusters_; ///< Target number of clusters. From 2d7120599ade2d95004f4a924b74a37f53aa8b49 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 12:17:36 -0400 Subject: [PATCH 374/417] Finish removing PairwiseMatrix --- src/Cluster/Node.cpp | 3 +-- src/Cluster/Node.h | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Cluster/Node.cpp b/src/Cluster/Node.cpp index 69eb18ce23..9cfaf1e83f 100644 --- a/src/Cluster/Node.cpp +++ b/src/Cluster/Node.cpp @@ -1,7 +1,6 @@ //#include // DBL_MAX #include "Node.h" #include "MetricArray.h" -#include "PairwiseMatrix.h" #include "../DataSet_float.h" #include "../DataSet_integer.h" @@ -64,7 +63,7 @@ void Cpptraj::Cluster::Node::CalculateCentroid(MetricArray& Cdist) { /** Calculate the eccentricity of this cluster (i.e. the largest distance * between any two points in the cluster). */ -void Cpptraj::Cluster::Node::CalcEccentricity(PairwiseMatrix const& FrameDistancesIn) { +void Cpptraj::Cluster::Node::CalcEccentricity(MetricArray& FrameDistancesIn) { double maxdist = 0.0; frame_iterator frame1_end = frameList_.end(); --frame1_end; diff --git a/src/Cluster/Node.h b/src/Cluster/Node.h index e994420d8a..f2a0ef0a9a 100644 --- a/src/Cluster/Node.h +++ b/src/Cluster/Node.h @@ -10,7 +10,6 @@ class DataSet_float; namespace Cpptraj { namespace Cluster { class MetricArray; -class PairwiseMatrix; // TODO implement needsUpdate_ /// Hold frame indices for a given cluster. @@ -19,7 +18,7 @@ class Node { Node(); ~Node(); // NOTE: Taking a non-const reference to Metric here allows - // PairwiseMatrix to be passed in as const to routines while still + // MetricArray to be passed in as const to routines while still // allowing Metric to be used. Metric needs to be non-const because // things like calculating RMSD modify Metric itself to avoid // always reallocating Frames. @@ -105,7 +104,7 @@ class Node { /// Set cluster name and RMS to reference inline void SetNameAndRms(std::string const&, double); /// Calculate eccentricity for frames in this cluster. - void CalcEccentricity(PairwiseMatrix const&); + void CalcEccentricity(MetricArray&); /// Remove specified frame from cluster and update centroid. void RemoveFrameUpdateCentroid(MetricArray&, int); /// Add specified frame to cluster and update centroid. From 04fa60e23a030c7c66898a6331d68247dadfbae2 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 13:18:45 -0400 Subject: [PATCH 375/417] Last changes to MetricArray --- src/Cluster/Control.cpp | 328 +++++++------------------------------- src/Cluster/Control.h | 32 +--- src/Cluster/DrawGraph.cpp | 4 +- src/Cluster/DrawGraph.h | 4 +- src/Cluster/clusterdepend | 18 +-- 5 files changed, 76 insertions(+), 310 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 178d0ebfdd..08ba924fe1 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -9,12 +9,6 @@ #include "../DataSet_float.h" #include "../DataSet_integer.h" #include "../DataSet_PairwiseCache.h" -// Metric classes -#include "Metric_RMS.h" -#include "Metric_DME.h" -#include "Metric_Data_Euclid.h" -#include "Metric_Data_Manhattan.h" -#include "Metric_SRMSD.h" // Algorithms #include "Algorithm_HierAgglo.h" #include "Algorithm_DBscan.h" @@ -24,10 +18,8 @@ #include "Results_Coords.h" Cpptraj::Cluster::Control::Control() : - metric_(0), algorithm_(0), results_(0), - cache_was_allocated_(false), verbose_(0), frameSelect_(UNSPECIFIED), sieve_(1), @@ -49,191 +41,14 @@ Cpptraj::Cluster::Control::Control() : drawGraph_(NO_DRAWGRAPH), draw_tol_(0), draw_maxit_(0), - debug_(0), - pw_mismatch_fatal_(true) + debug_(0) {} Cpptraj::Cluster::Control::~Control() { if (algorithm_ != 0) delete algorithm_; - if (metric_ != 0 ) delete metric_; if (results_ != 0 ) delete results_; } -// ----------------------------------------------------------------------------- -/** The default pairwise cache file name. */ -const char* Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_NAME_ = "CpptrajPairDist"; - -/** The default pairwise distance file type. */ -DataFile::DataFormatType Cpptraj::Cluster::Control::DEFAULT_PAIRDIST_TYPE_ = -# ifdef BINTRAJ - DataFile::CMATRIX_NETCDF; -# else - DataFile::CMATRIX_BINARY; -# endif - -const char* Cpptraj::Cluster::Control::PairwiseArgs1_ = - "[pairdist ] [pwrecalc]"; - -const char* Cpptraj::Cluster::Control::PairwiseArgs2_ = - "[loadpairdist] [savepairdist] [pairwisecache {mem|disk|none}]"; - -/** Set up PairwiseMatrix from arguments. */ -int Cpptraj::Cluster::Control::AllocatePairwise(ArgList& analyzeArgs, DataSetList& DSL, - DataFileList& DFL) -{ - if (metric_ == 0) { - mprinterr("Internal Error: AllocatePairwise(): Metric is null.\n"); - return 1; - } - cache_was_allocated_ = false; - - // Determine if we are saving/loading pairwise distances - std::string pairdistname = analyzeArgs.GetStringKey("pairdist"); - DataFile::DataFormatType pairdisttype = DataFile::UNKNOWN_DATA; - bool load_pair = analyzeArgs.hasKey("loadpairdist"); - bool save_pair = analyzeArgs.hasKey("savepairdist"); - // Check if we need to set a default file name -/* std::string fname; - if (pairdistname.empty()) - fname = DEFAULT_PAIRDIST_NAME_; - else { - fname = pairdistname; - // To remain backwards compatible, assume we want to load if - // a pairdist name was specified. - if (!load_pair && !save_pair) { - mprintf("Warning: 'pairdist' specified but 'loadpairdist'/'savepairdist' not specified." - "Warning: Assuming 'loadpairdist'.\n"); - load_pair = true; - } - }*/ - - cache_ = 0; - if (load_pair || - (!save_pair && !pairdistname.empty())) - { - // If 'loadpairdist' specified or 'pairdist' specified and 'savepairdist' - // not specified, we either want to load from file or use an existing - // data set. - if (pairdistname.empty()) { - pairdistname = DEFAULT_PAIRDIST_NAME_; - pairdisttype = DEFAULT_PAIRDIST_TYPE_; - } - // First check if pairwise data exists - DataSetList selected = DSL.SelectGroupSets( pairdistname, DataSet::PWCACHE ); - if (!selected.empty()) { - if (selected.size() > 1) - mprintf("Warning: '%s' matches multiple sets; only using '%s'\n", - pairdistname.c_str(), selected[0]->legend()); - cache_ = (DataSet_PairwiseCache*)selected[0]; - mprintf("\tUsing existing pairwise set '%s'\n", cache_->legend()); - // Next check if file exists - } else if (File::Exists( pairdistname )) { - mprintf("\tLoading pairwise distances from file '%s'\n", pairdistname.c_str()); - DataFile dfIn; - // TODO set data set name with ArgList? - if (dfIn.ReadDataIn( pairdistname, ArgList(), DSL )) return 1; - DataSet* ds = DSL.GetDataSet( pairdistname ); - if (ds == 0) return 1; - if (ds->Group() != DataSet::PWCACHE) { - mprinterr("Internal Error: AllocatePairwise(): Set is not a pairwise cache.\n"); - return 1; - } - cache_ = (DataSet_PairwiseCache*)ds; - if (cache_ != 0 && save_pair) { - mprintf("Warning: 'savepairdist' specified but pairwise cache loaded from file.\n" - "Warning: Disabling 'savepairdist'.\n"); - save_pair = false; - } - } else - pairdisttype = DEFAULT_PAIRDIST_TYPE_; - - if (cache_ == 0) { - // Just 'pairdist' specified or loadpairdist specified and set/file not found. - // Warn the user. - mprintf("Warning: Pairwise distance matrix specified but cache/file '%s' not found.\n", pairdistname.c_str()); - if (!save_pair) { - // If the file (or dataset) does not yet exist we will assume we want to save. - mprintf("Warning: Pairwise distance matrix specified but not found; will save distances.\n"); - save_pair = true; - } - } - } // END if load_pair - - // Create a pairwise cache if necessary - if (cache_ == 0) { - // Process DataSet type arguments - DataSet::DataType pw_type = DataSet::PMATRIX_MEM; - std::string pw_typeString = analyzeArgs.GetStringKey("pairwisecache"); - if (!pw_typeString.empty()) { - if (pw_typeString == "mem") - pw_type = DataSet::PMATRIX_MEM; - else if (pw_typeString == "disk") { -# ifdef BINTRAJ - pw_type = DataSet::PMATRIX_NC; -# else - // TODO regular disk file option - mprinterr("Error: Pairwise disk cache requires NetCDF.\n"); - return 1; -# endif - } else if (pw_typeString == "none") - pw_type = DataSet::UNKNOWN_DATA; - else { - mprinterr("Error: Unrecognized option for 'pairwisecache' ('%s')\n", pw_typeString.c_str()); - return 1; - } - } - // Allocate cache if necessary - if (pw_type != DataSet::UNKNOWN_DATA) { - MetaData meta; - if (!pairdistname.empty()) - meta.SetName( pairdistname ); - else - meta.SetName( DSL.GenerateDefaultName("CMATRIX") ); - // Cache-specific setup. - if (pw_type == DataSet::PMATRIX_NC) - meta.SetFileName( pairdistname ); // TODO separate file name? - //cache_ = (DataSet_PairwiseCache*)DSL.AddSet( pw_type, meta, "CMATRIX" ); - // To maintain compatibility with pytraj, the cluster number vs time - // set **MUST** be allocated before the cache. Set up outside the - // DataSetList here and set up; add to DataSetList later in Setup. - cache_ = (DataSet_PairwiseCache*)DSL.AllocateSet( pw_type, meta ); - if (cache_ == 0) { - mprinterr("Error: Could not allocate pairwise cache.\n"); - return 1; - } - cache_was_allocated_ = true; - if (debug_ > 0) - mprintf("DEBUG: Allocated pairwise distance cache: %s\n", cache_->legend()); - } - } - - // Setup pairwise matrix - if (pmatrix_.Setup(metric_, cache_)) return 1; - - if (save_pair) { - if (cache_ == 0) { - mprintf("Warning: Not caching distances; ignoring 'savepairdist'\n"); - } else { - if (pairdistname.empty()) - pairdistname = DEFAULT_PAIRDIST_NAME_; - if (pairdisttype == DataFile::UNKNOWN_DATA) - pairdisttype = DEFAULT_PAIRDIST_TYPE_; - // TODO enable saving for other set types? - if (cache_->Type() == DataSet::PMATRIX_MEM) { - DataFile* pwd_file = DFL.AddDataFile( pairdistname, pairdisttype, ArgList() ); - if (pwd_file == 0) return 1; - pwd_file->AddDataSet( cache_ ); - if (debug_ > 0) - mprintf("DEBUG: Saving pw distance cache '%s' to file '%s'\n", cache_->legend(), - pwd_file->DataFilename().full()); - } - } - } - pw_mismatch_fatal_ = !analyzeArgs.hasKey("pwrecalc"); - - return 0; -} - // ----------------------------------------------------------------------------- /** \return Pointer to Algorithm of given type. */ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algorithm::AType atype) @@ -249,6 +64,7 @@ Cpptraj::Cluster::Algorithm* Cpptraj::Cluster::Control::AllocateAlgorithm(Algori return alg; } +/** Recognized algorithm keywords. */ const char* Cpptraj::Cluster::Control::AlgorithmArgs_ = "{hieragglo|dbscan|kmeans|dpeaks}"; @@ -271,22 +87,6 @@ int Cpptraj::Cluster::Control::AllocateAlgorithm(ArgList& analyzeArgs) { return 0; } -// ----------------------------------------------------------------------------- -/** /return Pointer to Metric of given type. */ -Cpptraj::Cluster::Metric* Cpptraj::Cluster::Control::AllocateMetric(Metric::Type mtype) -{ - Metric* met = 0; - switch (mtype) { - case Metric::RMS : met = new Metric_RMS(); break; - case Metric::DME : met = new Metric_DME(); break; - case Metric::SRMSD : met = new Metric_SRMSD(); break; - case Metric::EUCLID : met = new Metric_Data_Euclid(); break; - case Metric::MANHATTAN : met = new Metric_Data_Manhattan(); break; - default: mprinterr("Error: Unhandled Metric in AllocateMetric.\n"); - } - return met; -} - // ----------------------------------------------------------------------------- static int Err(int code) { switch (code) { @@ -340,7 +140,7 @@ int Cpptraj::Cluster::Control::ReadInfo(std::string const& fname) { if (ptr[fidx] == 'X') frames.push_back( fidx ); } - clusters_.AddCluster( Node(metric_, frames, cnum) ); + clusters_.AddCluster( Node(metrics_, frames, cnum) ); mprintf("\tRead cluster %i, %zu frames.\n", cnum, frames.size()); ptr = infile.Line(); } @@ -381,18 +181,12 @@ int Cpptraj::Cluster::Control::InitClustersFromSet(DataSet* cnvt) { for (std::vector::const_iterator frames = clusterFrames.begin(); frames != clusterFrames.end(); ++frames, ++clusterNum) - clusters_.AddCluster( Node(metric_, *frames, clusterNum) ); + clusters_.AddCluster( Node(metrics_, *frames, clusterNum) ); return 0; } // ----------------------------------------------------------------------------- -const char* Cpptraj::Cluster::Control::MetricArgs_ = - "{rms|srmsd|dme|euclid|manhattan}"; - -const char* Cpptraj::Cluster::Control::CoordsDataSetArgs_ = - "[{dme|rms|srmsd} [mass] [nofit] []]"; - const char* Cpptraj::Cluster::Control::SieveArgs1_ = "[sieve <#> [sieveseed <#>] [random] [includesieveincalc] [includesieved_cdist]"; @@ -435,7 +229,12 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, mprinterr("Error: No sets to cluster.\n"); return 1; } - + + if (metrics_.Initialize( setsToCluster, DSL, DFL, analyzeArgs, verbose_ )) { + mprinterr("Error: Could not initialize distance metrics/cache.\n"); + return 1; + } +/* // Determine the metric type based on what sets we are clustering on if (setsToCluster.size() == 1 && setsToCluster[0]->Group() == DataSet::COORDINATES) { // Clustering on coords @@ -511,6 +310,7 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, int err = ((Metric_Data*)metric_)->Init( cluster_datasets ); if (err != 0) return 1; } +*/ // Set up results that depend on COORDS DataSet if (coordsSet != 0) { @@ -543,14 +343,15 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, } if (results_ != 0) { - if (results_->GetOptions(analyzeArgs, DSL, *metric_)) return 1; + if (results_->GetOptions(analyzeArgs, DSL, metrics_)) return 1; } +/* // Allocate PairwiseMatrix (and optionally a cache). Metric must already be set up. if (AllocatePairwise( analyzeArgs, DSL, DFL )) { mprinterr("Error: PairwiseMatrix setup failed.\n"); return 1; - } + }*/ // Allocate algorithm if (AllocateAlgorithm( analyzeArgs )) { @@ -581,13 +382,13 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (frameSelect_ == UNSPECIFIED) { // If no other frame selection option like sieve provided and an already // set up cache is present, use the cached frames. - if (sieve_ == 1 && pmatrix_.HasCache() && pmatrix_.Cache().Size() > 0) + if (sieve_ == 1 && metrics_.HasCache() && metrics_.Cache().Size() > 0) { frameSelect_ = FROM_CACHE; - if (pmatrix_.Cache().SieveVal() != 1) { - sieve_ = pmatrix_.Cache().SieveVal(); + if (metrics_.Cache().SieveVal() != 1) { + sieve_ = metrics_.Cache().SieveVal(); mprintf("Warning: No sieve specified; using sieve value from cache '%s': %i\n", - pmatrix_.Cache().legend(), sieve_); + metrics_.Cache().legend(), sieve_); } } } @@ -736,8 +537,8 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); // If cache was alloaced, add to the DataSetList so it is after cnumvtime for pytraj - if (cache_was_allocated_) - DSL.AddSet( cache_ ); + if (metrics_.CacheWasAllocated()) + DSL.AddSet( metrics_.CachePtr() ); // Set up number of unique clusters vs time DataSet if (clustersvtimefile != 0) { @@ -763,12 +564,11 @@ void Cpptraj::Cluster::Control::Help() { Algorithm_DBscan::Help(); Algorithm_Kmeans::Help(); Algorithm_DPeaks::Help(); - mprintf(" Metric Args: [%s]\n", MetricArgs_); - mprintf(" ('euclid' and 'manhattan' only work with 'data')\n"); - mprintf("\t{%s | [{euclid|manhattan}]}\n", CoordsDataSetArgs_); + mprintf(" Metric Args:\n"); + mprintf("\t%s\n", MetricArray::MetricArgs_); mprintf(" Pairwise Args:\n"); - mprintf("\t%s\n", PairwiseArgs1_); - mprintf("\t%s\n", PairwiseArgs2_); + mprintf("\t%s\n", MetricArray::PairwiseArgs1_); + mprintf("\t%s\n", MetricArray::PairwiseArgs2_); mprintf(" Sieve Args:\n"); mprintf("\t%s\n", SieveArgs1_); mprintf("\t%s\n", SieveArgs2_); @@ -793,9 +593,11 @@ void Cpptraj::Cluster::Control::Help() { // ----------------------------------------------------------------------------- void Cpptraj::Cluster::Control::Info() const { - if (metric_ != 0) metric_->Info(); + metrics_.Info(); if (algorithm_ != 0) algorithm_->Info(); + metrics_.Info(); + if (results_ != 0) results_->Info(); else @@ -819,21 +621,6 @@ void Cpptraj::Cluster::Control::Info() const { mprintf(" if within epsilon %f of a frame (more accurate and identifies noise but slower).\n", restoreEpsilon_); } - if (cache_ == 0) - mprintf("\tPairwise distances will not be cached.\n"); - else { - if (cache_->Size() > 0) - mprintf("\tUsing existing pairwise cache: %s (%s)\n", - cache_->legend(), cache_->description()); - else - mprintf("\tPairwise distances will be cached: %s (%s)\n", - cache_->legend(), cache_->description()); - if (pw_mismatch_fatal_) - mprintf("\tCalculation will be halted if frames in cache do not match.\n"); - else - mprintf("\tPairwise distances will be recalculated if frames in cache do not match.\n"); - } - mprintf("\tRepresentative frames will be chosen by"); switch (bestRep_) { case BestReps::CUMULATIVE: mprintf(" lowest cumulative distance to all other frames.\n"); break; @@ -915,7 +702,7 @@ void Cpptraj::Cluster::Control::Info() const { * and representative frames will be determined. */ int Cpptraj::Cluster::Control::Run() { - if (metric_ == 0 || algorithm_ == 0) { // TODO check pmatrix_? + if (metrics_.empty() || algorithm_ == 0) { // TODO check pmatrix_? mprinterr("Internal Error: Cluster::Control is not set up.\n"); return 1; } @@ -924,7 +711,7 @@ int Cpptraj::Cluster::Control::Run() { timer_run_.Start(); timer_setup_.Start(); // Set up the Metric - if (metric_->Setup()) { + if (metrics_.Setup()) { mprinterr("Error: Metric setup failed.\n"); return 1; } @@ -934,11 +721,11 @@ int Cpptraj::Cluster::Control::Run() { int frameSelectErr = 1; switch ( frameSelect_ ) { case UNSPECIFIED: - frameSelectErr = frameSieve_.SetFramesToCluster(sieve_, metric_->Ntotal(), sieveSeed_); + frameSelectErr = frameSieve_.SetFramesToCluster(sieve_, metrics_.Ntotal(), sieveSeed_); break; case FROM_CACHE : - mprintf("\tClustering frames present in pairwise cache '%s'\n", pmatrix_.Cache().legend()); - frameSelectErr = frameSieve_.SetupFromCache( pmatrix_.Cache(), metric_->Ntotal() ); + mprintf("\tClustering frames present in pairwise cache '%s'\n", metrics_.Cache().legend()); + frameSelectErr = frameSieve_.SetupFromCache( metrics_.Cache(), metrics_.Ntotal() ); break; default : mprinterr("Internal Error: Cluster::Control::Run(): Unhandled frame selection type.\n"); @@ -948,11 +735,11 @@ int Cpptraj::Cluster::Control::Run() { return 1; } if (verbose_ >= 0) { - if (frameSieve_.FramesToCluster().size() < metric_->Ntotal()) + if (frameSieve_.FramesToCluster().size() < metrics_.Ntotal()) mprintf("\tClustering %zu of %u points.\n", frameSieve_.FramesToCluster().size(), - metric_->Ntotal()); + metrics_.Ntotal()); else - mprintf("\tClustering %u points.\n", metric_->Ntotal()); + mprintf("\tClustering %u points.\n", metrics_.Ntotal()); } Cframes const& framesToCluster = frameSieve_.FramesToCluster(); @@ -960,15 +747,15 @@ int Cpptraj::Cluster::Control::Run() { timer_pairwise_.Start(); // Cache distances if necessary - if (pmatrix_.CacheDistances( framesToCluster, sieve_, pw_mismatch_fatal_ )) return 1; - if (pmatrix_.HasCache() && verbose_ > 1) - pmatrix_.Cache().PrintCached(); + if (metrics_.CacheDistances( framesToCluster, sieve_ )) return 1; + if (metrics_.HasCache() && verbose_ > 1) + metrics_.Cache().PrintCached(); timer_pairwise_.Stop(); timer_cluster_.Start(); // Cluster - if (algorithm_->DoClustering(clusters_, framesToCluster, pmatrix_) != 0) { + if (algorithm_->DoClustering(clusters_, framesToCluster, metrics_) != 0) { mprinterr("Error: Clustering failed.\n"); return 1; } @@ -984,7 +771,7 @@ int Cpptraj::Cluster::Control::Run() { timer_post_renumber_.Start(); // Update cluster centroids here in case they need to be used to // restore sieved frames - clusters_.UpdateCentroids( metric_ ); + clusters_.UpdateCentroids( metrics_ ); // Add sieved frames to existing clusters. if ( sieveRestore_ != NO_RESTORE ) { @@ -992,10 +779,10 @@ int Cpptraj::Cluster::Control::Run() { mprintf("\tRestoring sieved frames.\n"); switch (sieveRestore_) { case CLOSEST_CENTROID : - clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metric_ ); break; + clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metrics_ ); break; case EPSILON_CENTROID : case EPSILON_FRAME : - clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metric_, + clusters_.AddFramesByCentroid( frameSieve_.SievedOut(), metrics_, (sieveRestore_ == EPSILON_CENTROID), restoreEpsilon_ ); break; @@ -1004,7 +791,7 @@ int Cpptraj::Cluster::Control::Run() { return 1; } // Re-calculate the cluster centroids - clusters_.UpdateCentroids( metric_ ); + clusters_.UpdateCentroids( metrics_ ); } // Sort by population and renumber @@ -1019,7 +806,7 @@ int Cpptraj::Cluster::Control::Run() { mprinterr("Error: Initializing best representative frames search failed.\n"); return 1; } - if (findBestReps.FindBestRepFrames(clusters_, pmatrix_, frameSieve_.SievedOut())) { + if (findBestReps.FindBestRepFrames(clusters_, metrics_, frameSieve_.SievedOut())) { mprinterr("Error: Finding best representative frames for clusters failed.\n"); return 1; } @@ -1055,7 +842,7 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { CpptrajFile outfile; if (outfile.OpenWrite( clusterinfo_ )) return 1; timer_output_info_.Start(); - Output::PrintClustersToFile(outfile, clusters_, *algorithm_, metric_, + Output::PrintClustersToFile(outfile, clusters_, *algorithm_, metrics_, frameSieve_.SieveValue(), frameSieve_.FramesToCluster()); timer_output_info_.Stop(); outfile.CloseFile(); @@ -1065,7 +852,7 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { if (!sil_file_.empty()) { if (frameSieve_.SieveValue() != 1 && !includeSieveInCalc_) mprintf("Warning: Silhouettes do not include sieved frames.\n"); - clusters_.CalcSilhouette(pmatrix_, frameSieve_.SievedOut(), includeSieveInCalc_); + clusters_.CalcSilhouette(metrics_, frameSieve_.SievedOut(), includeSieveInCalc_); CpptrajFile Ffile, Cfile; if (Ffile.OpenWrite(sil_file_ + ".frame.dat")) return 1; Output::PrintSilhouetteFrames(Ffile, clusters_); @@ -1083,7 +870,7 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { mprinterr("Error: Could not set up cluster summary file.\n"); return 1; } - Output::Summary(outfile, clusters_, *algorithm_, pmatrix_, includeSieveInCalc_, + Output::Summary(outfile, clusters_, *algorithm_, metrics_, includeSieveInCalc_, includeSieveCdist_, frameSieve_.SievedOut()); timer_output_summary_.Stop(); } @@ -1101,17 +888,18 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { mprinterr("Error: Init of best reps calc for summary by parts failed.\n"); return 1; } - Output::Summary_Part(outfile, metric_->Ntotal(), splitFrames_, clusters_, - findBestReps, pmatrix_, frameSieve_.SievedOut()); + // TODO just pass in metrics_ + Output::Summary_Part(outfile, metrics_.Ntotal(), splitFrames_, clusters_, + findBestReps, metrics_, frameSieve_.SievedOut()); } // Cluster number vs time if (cnumvtime_ != 0) { int err = 0; if (grace_color_) - err = clusters_.CreateCnumVsTime(*((DataSet_integer*)cnumvtime_), metric_->Ntotal(), 1, 15); + err = clusters_.CreateCnumVsTime(*((DataSet_integer*)cnumvtime_), metrics_.Ntotal(), 1, 15); else - err = clusters_.CreateCnumVsTime(*((DataSet_integer*)cnumvtime_), metric_->Ntotal(), 0, -1); + err = clusters_.CreateCnumVsTime(*((DataSet_integer*)cnumvtime_), metrics_.Ntotal(), 0, -1); if (err != 0) { mprinterr("Error: Creation of cluster num vs time data set failed.\n"); return 1; @@ -1120,12 +908,12 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { // Draw cluster Graph if (drawGraph_ != NO_DRAWGRAPH) { - DrawGraph( frameSieve_.FramesToCluster(), pmatrix_, drawGraph_, cnumvtime_, draw_tol_, draw_maxit_, debug_ ); + DrawGraph( frameSieve_.FramesToCluster(), metrics_, drawGraph_, cnumvtime_, draw_tol_, draw_maxit_, debug_ ); } // # unique clusters vs time if (clustersVtime_ != 0) { - if (clusters_.NclustersObserved(*((DataSet_integer*)clustersVtime_), metric_->Ntotal(), + if (clusters_.NclustersObserved(*((DataSet_integer*)clustersVtime_), metrics_.Ntotal(), windowSize_)) { mprinterr("Error: Creation of # unique clusters vs time data set failed.\n"); @@ -1136,7 +924,7 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { // Cluster population vs time if (cpopvtimefile_ != 0) { MetaData md( dsname_, "Pop" ); - DataSet::SizeArray setsize(1, metric_->Ntotal()); + DataSet::SizeArray setsize(1, metrics_.Ntotal()); for (List::cluster_iterator node = clusters_.begin(); node != clusters_.end(); ++node) { @@ -1148,14 +936,14 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { } ds->Allocate( setsize ); if (cpopvtimefile_ != 0) cpopvtimefile_->AddDataSet( ds ); - node->CalcCpopVsTime( *ds, metric_->Ntotal(), norm_pop_ ); + node->CalcCpopVsTime( *ds, metrics_.Ntotal(), norm_pop_ ); } } // Cluster lifetime sets if (calc_lifetimes_) { MetaData md( dsname_, "Lifetime" ); - DataSet::SizeArray setsize(1, metric_->Ntotal()); + DataSet::SizeArray setsize(1, metrics_.Ntotal()); for (List::cluster_iterator node = clusters_.begin(); node != clusters_.end(); ++node) { @@ -1166,7 +954,7 @@ int Cpptraj::Cluster::Control::Output(DataSetList& DSL) { return 1; } ds->Allocate( setsize ); - node->CreateLifetimeSet( *ds, metric_->Ntotal() ); + node->CreateLifetimeSet( *ds, metrics_.Ntotal() ); } } diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 79d4eac516..158fcfd4cb 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -4,14 +4,13 @@ #include "BestReps.h" // BestReps::RepMethodType #include "DrawGraph.h" // GraphType #include "List.h" -#include "Metric.h" // Metric::Type +#include "MetricArray.h" #include "Node.h" // Node::CnormType -#include "PairwiseMatrix.h" #include "Sieve.h" -#include "../DataFile.h" // DataFile::DataFormatType #include "../Timer.h" class DataSet_Coords; class DataSet_PairwiseCache; +class DataFile; class DataFileList; class DataSetList; namespace Cpptraj { @@ -33,11 +32,6 @@ class Control { /// For determining how frames to cluster will be determined. enum FrameSelectType { UNSPECIFIED = 0, FROM_CACHE }; - // TODO ONE setup routine - - //int SetupForDataSets(Metric_Data::DsArray const&, DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); - - //int SetupForCoordsDataSet(DataSet_Coords*, ArgList&, DataSetList&, DataFileList&, int); /// Setup clustering int SetupClustering(DataSetList const&, DataSet*, ArgList&, DataSetList&, DataFileList&, int); /// Provide information on how clustering calculation is currently set up. @@ -52,10 +46,7 @@ class Control { static void Help(); private: // Help keywords - static const char* PairwiseArgs1_; - static const char* PairwiseArgs2_; static const char* AlgorithmArgs_; - static const char* MetricArgs_; static const char* CoordsDataSetArgs_; static const char* SieveArgs1_; static const char* SieveArgs2_; @@ -66,32 +57,21 @@ class Control { static const char* OutputArgs4_; static const char* GraphArgs_; - int AllocatePairwise(ArgList&, DataSetList&, DataFileList&); - - static Metric* AllocateMetric(Metric::Type); - + /// \return Algorithm of given type static Algorithm* AllocateAlgorithm(Algorithm::AType); + /// Allocate algorithm from keywords int AllocateAlgorithm(ArgList&); /// Initialize clusters from Info file int ReadInfo(std::string const&); /// Initialize clusters from cluster number vs time DataSet int InitClustersFromSet(DataSet*); - //int Common(ArgList&, DataSetList&, DataFileList&); - - static const char* DEFAULT_PAIRDIST_NAME_; - - static DataFile::DataFormatType DEFAULT_PAIRDIST_TYPE_; - List clusters_; ///< Hold cluster results. Sieve frameSieve_; ///< Hold frames to cluster, frames to "sieve" out. - Metric* metric_; ///< Hold the distance metric. - DataSet_PairwiseCache* cache_; ///< Hold any cached pairwise distances. - PairwiseMatrix pmatrix_; ///< Encapsulates the metric and any cached distances. + MetricArray metrics_; ///< Hold the distance metrics and any cached distances. Algorithm* algorithm_; ///< Hold the clustering algorithm. Results* results_; ///< Hold output routines specific to data being clustered. std::string dsname_; ///< Name for output data sets. - bool cache_was_allocated_; ///< True if cache was allocated and needs to be added to DSL int verbose_; FrameSelectType frameSelect_; ///< How frames to cluster should be determined. @@ -130,8 +110,6 @@ class Control { int debug_; ///< Cluster debug level - bool pw_mismatch_fatal_; ///< Controls if PW distances should be recalculated - // Timers Timer timer_setup_; ///< Run - metric, frames to cluster setup Timer timer_pairwise_; ///< Run - pairwise caching diff --git a/src/Cluster/DrawGraph.cpp b/src/Cluster/DrawGraph.cpp index b92e084708..2bd16d2c1a 100644 --- a/src/Cluster/DrawGraph.cpp +++ b/src/Cluster/DrawGraph.cpp @@ -1,6 +1,6 @@ #include "DrawGraph.h" #include "Cframes.h" -#include "PairwiseMatrix.h" +#include "MetricArray.h" #include "../Constants.h" #include "../CpptrajStdio.h" #include "../DataSet_1D.h" @@ -9,7 +9,7 @@ #include #include -void Cpptraj::Cluster::DrawGraph(Cframes const& framesToCluster, PairwiseMatrix const& pmatrix, +void Cpptraj::Cluster::DrawGraph(Cframes const& framesToCluster, MetricArray& pmatrix, GraphType graphTypeIn, DataSet* cnumvtime, double min_tol, int max_iteration, int debug) { diff --git a/src/Cluster/DrawGraph.h b/src/Cluster/DrawGraph.h index 5afd5a67f5..914c406c17 100644 --- a/src/Cluster/DrawGraph.h +++ b/src/Cluster/DrawGraph.h @@ -4,11 +4,11 @@ class DataSet; namespace Cpptraj { namespace Cluster { class Cframes; -class PairwiseMatrix; +class MetricArray; enum GraphType { NO_DRAWGRAPH = 0, TWOD, THREED }; -void DrawGraph(Cframes const&, PairwiseMatrix const&, GraphType, DataSet*, double, int, int); +void DrawGraph(Cframes const&, MetricArray&, GraphType, DataSet*, double, int, int); } } diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index f0706b78fa..3f386c3bc4 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -1,16 +1,16 @@ -Algorithm.o : Algorithm.cpp ../CpptrajStdio.h Algorithm.h CentroidArray.h Cframes.h Metric.h Node.h PairwiseMatrix.h -Algorithm_DBscan.o : Algorithm_DBscan.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 ../DataFile.h ../DataSet.h ../DataSetList.h ../DataSet_2D.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../DataSet_MatrixDbl.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 ../ProgressBar.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 Algorithm.h Algorithm_DBscan.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h -Algorithm_DPeaks.o : Algorithm_DPeaks.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_Mesh.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../Spline.h ../TextFormat.h Algorithm.h Algorithm_DPeaks.h CentroidArray.h Cframes.h List.h Node.h PairwiseMatrix.h -Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h ../ProgressBar.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h CentroidArray.h Cframes.h DynamicMatrix.h List.h Node.h PairwiseMatrix.h -Algorithm_Kmeans.o : Algorithm_Kmeans.cpp ../ArgList.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h ../ProgressBar.h ../Random.h Algorithm.h Algorithm_Kmeans.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h -BestReps.o : BestReps.cpp ../CpptrajStdio.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h Node.h PairwiseMatrix.h +Algorithm.o : Algorithm.cpp ../CpptrajStdio.h Algorithm.h CentroidArray.h Cframes.h Metric.h MetricArray.h Node.h +Algorithm_DBscan.o : Algorithm_DBscan.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 ../DataFile.h ../DataSet.h ../DataSetList.h ../DataSet_2D.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../DataSet_MatrixDbl.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 ../ProgressBar.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 Algorithm.h Algorithm_DBscan.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h +Algorithm_DPeaks.o : Algorithm_DPeaks.cpp ../ArgList.h ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_Mesh.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../Spline.h ../TextFormat.h Algorithm.h Algorithm_DPeaks.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h +Algorithm_HierAgglo.o : Algorithm_HierAgglo.cpp ../ArgList.h ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h ../ProgressBar.h ../Timer.h Algorithm.h Algorithm_HierAgglo.h CentroidArray.h Cframes.h DynamicMatrix.h List.h Metric.h MetricArray.h Node.h +Algorithm_Kmeans.o : Algorithm_Kmeans.cpp ../ArgList.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h ../ProgressBar.h ../Random.h Algorithm.h Algorithm_Kmeans.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h +BestReps.o : BestReps.cpp ../CpptrajStdio.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h CentroidArray.o : CentroidArray.cpp Centroid.h CentroidArray.h Centroid_Coord.o : Centroid_Coord.cpp ../Atom.h ../AtomMask.h ../Box.h ../CoordinateInfo.h ../CpptrajFile.h ../FileIO.h ../FileName.h ../Frame.h ../MaskToken.h ../Matrix_3x3.h ../Molecule.h ../NameType.h ../Parallel.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.o : Cframes.cpp Cframes.h Cmatrix_Binary.o : Cmatrix_Binary.cpp ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Parallel.h Cframes.h Cmatrix_Binary.h Cmatrix_NC.o : Cmatrix_NC.cpp ../CpptrajStdio.h ../FileName.h ../NC_Routines.h Cframes.h Cmatrix_NC.h Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../BufferedLine.h ../Cluster/Cframes.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 ../DataSet_PairwiseCache.h ../DataSet_float.h ../DataSet_integer.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 ../Random.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Algorithm.h Algorithm_DBscan.h Algorithm_DPeaks.h Algorithm_HierAgglo.h Algorithm_Kmeans.h BestReps.h CentroidArray.h Cframes.h Control.h DrawGraph.h DynamicMatrix.h List.h Metric.h MetricArray.h Node.h Output.h Results.h Results_Coords.h Sieve.h -DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h PairwiseMatrix.h +DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h Metric.h MetricArray.h DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Cluster/Cframes.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_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../ProgressBar.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h @@ -19,7 +19,7 @@ Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../Ato Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_SRMSD.h Metric_Scalar.o : Metric_Scalar.cpp ../AssociatedData.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Scalar.h Metric_Torsion.o : Metric_Torsion.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h Centroid.h Centroid_Num.h Cframes.h Metric.h Metric_Torsion.h -Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h Metric.h MetricArray.h Node.h PairwiseMatrix.h -Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h Node.h Output.h PairwiseMatrix.h +Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h Metric.h MetricArray.h Node.h +Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h Output.h Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h From c8d611218445a8928486c033285876d57189a366 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 13:30:13 -0400 Subject: [PATCH 376/417] Update main depends. Remove duplicate Info() call. --- src/Cluster/Control.cpp | 2 -- src/cpptrajdepend | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 08ba924fe1..aad4e286a4 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -596,8 +596,6 @@ void Cpptraj::Cluster::Control::Info() const { metrics_.Info(); if (algorithm_ != 0) algorithm_->Info(); - metrics_.Info(); - if (results_ != 0) results_->Info(); else diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 9b3c97dd8c..f32546bd69 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -92,7 +92,7 @@ AnalysisList.o : AnalysisList.cpp ActionState.h Analysis.h AnalysisList.h Analys Analysis_AmdBias.o : Analysis_AmdBias.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AmdBias.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 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 Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_AutoCorr.o : Analysis_AutoCorr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_AutoCorr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_Average.o : Analysis_Average.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Average.h ArgList.h Array1D.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 -Analysis_Clustering.o : Analysis_Clustering.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.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 +Analysis_Clustering.o : Analysis_Clustering.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Clustering.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/CentroidArray.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/MetricArray.h Cluster/Node.h Cluster/Sieve.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 Analysis_ConstantPHStats.o : Analysis_ConstantPHStats.cpp ActionState.h Analysis.h AnalysisState.h Analysis_ConstantPHStats.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h Cph.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Mesh.h DataSet_pH.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 Spline.h StringRoutines.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Analysis_Corr.o : Analysis_Corr.cpp ActionState.h Analysis.h AnalysisState.h Analysis_Corr.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_1D.h DataSet_Coords.h DataSet_Coords_REF.h DataSet_Vector.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 Analysis_CrankShaft.o : Analysis_CrankShaft.cpp ActionState.h Analysis.h AnalysisState.h Analysis_CrankShaft.h Analysis_Statistics.h ArgList.h Array1D.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 DataSet_float.h DataSet_integer.h DataSet_string.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 @@ -150,7 +150,7 @@ ClusterMap.o : ClusterMap.cpp AssociatedData.h ClusterMap.h Constants.h CpptrajF Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/Node.h Cluster/PairwiseMatrix.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h ActionTopWriter.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiPucker.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_EvalPlateau.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BoxArgs.h BufferedLine.h CharMask.h Cluster/Algorithm.h Cluster/BestReps.h Cluster/CentroidArray.h Cluster/Cframes.h Cluster/Control.h Cluster/DrawGraph.h Cluster/List.h Cluster/Metric.h Cluster/MetricArray.h Cluster/Node.h Cluster/Sieve.h ClusterMap.h Cmd.h CmdInput.h CmdList.h Command.h CompactFrameArray.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.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_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Ewald.h EwaldOptions.h Ewald_ParticleMesh.h ExclusionArray.h Exec.h Exec_AddMissingRes.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_Emin.h Exec_Flatten.h Exec_GenerateAmberRst.h Exec_Graft.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_Random.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h GIST_PME.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageOption.h ImageTypes.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Segment.h Spline.h SplineFxnTable.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Unit.h Vec3.h cuda_kernels/GistCudaSetup.cuh helpme_standalone.h molsurf.h CompactFrameArray.o : CompactFrameArray.cpp Box.h CompactFrameArray.h CoordinateInfo.h CpptrajStdio.h Matrix_3x3.h Parallel.h ReplicaDimArray.h Vec3.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h From a496a1911c557c74dc72d700f6ecda073eb03b29 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 13:37:02 -0400 Subject: [PATCH 377/417] Remove obsolete comment --- src/Cluster/Control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index aad4e286a4..49f40d8224 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -700,7 +700,7 @@ void Cpptraj::Cluster::Control::Info() const { * and representative frames will be determined. */ int Cpptraj::Cluster::Control::Run() { - if (metrics_.empty() || algorithm_ == 0) { // TODO check pmatrix_? + if (metrics_.empty() || algorithm_ == 0) { mprinterr("Internal Error: Cluster::Control is not set up.\n"); return 1; } From 397af8b1a0be89c3122ba9574942be416ffbbbca Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 13:43:34 -0400 Subject: [PATCH 378/417] double* form of the distance routines is not needed. --- src/Cluster/MetricArray.cpp | 22 ++++++---------------- src/Cluster/MetricArray.h | 6 ++---- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index b1ca148a8e..9e89628435 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -513,17 +513,17 @@ void Cpptraj::Cluster::MetricArray::FrameOpCentroid(int f1, CentroidArray& centr } /** Manhattan distance. */ -double Cpptraj::Cluster::MetricArray::Dist_Manhattan(const double* arrayIn, unsigned int length) const { +double Cpptraj::Cluster::MetricArray::Dist_Manhattan(std::vector const& arrayIn) const { double dist = 0.0; - for (unsigned int idx = 0; idx != length; idx++) + for (unsigned int idx = 0; idx != arrayIn.size(); idx++) dist += (weights_[idx] * arrayIn[idx]); return dist; } /** Euclidean distance. */ -double Cpptraj::Cluster::MetricArray::Dist_Euclidean(const double* arrayIn, unsigned int length) const { +double Cpptraj::Cluster::MetricArray::Dist_Euclidean(std::vector const& arrayIn) const { double sumdist2 = 0.0; - for (unsigned int idx = 0; idx != length; idx++) { + for (unsigned int idx = 0; idx != arrayIn.size(); idx++) { double dist2 = arrayIn[idx] * arrayIn[idx]; sumdist2 += (weights_[idx] * dist2); } @@ -534,22 +534,12 @@ double Cpptraj::Cluster::MetricArray::Dist_Euclidean(const double* arrayIn, unsi double Cpptraj::Cluster::MetricArray::DistCalc(std::vector const& arrayIn) const { double dist = 0; switch (type_) { - case MANHATTAN : dist = Dist_Manhattan(&arrayIn[0], arrayIn.size()); break; - case EUCLID : dist = Dist_Euclidean(&arrayIn[0], arrayIn.size()); break; + case MANHATTAN : dist = Dist_Manhattan(arrayIn); break; + case EUCLID : dist = Dist_Euclidean(arrayIn); break; } return dist; } -// FIXME deprecate -/** Perform distance calc according to current type. */ -double Cpptraj::Cluster::MetricArray::DistCalc(const double* arrayIn, unsigned int length) const { - double dist = 0; - switch (type_) { - case MANHATTAN : dist = Dist_Manhattan(arrayIn, length); break; - case EUCLID : dist = Dist_Euclidean(arrayIn, length); break; - } - return dist; -} /** Calculate distance between given frame and centroids. */ double Cpptraj::Cluster::MetricArray::FrameCentroidDist(int frame, CentroidArray const& centroids ) { diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 8c55042b6e..8685f41340 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -89,13 +89,11 @@ class MetricArray { /// Initialize with data sets and user arguments int initMetricArray(DataSetList const&, ArgList&); /// Manhattan distance - double Dist_Manhattan(const double*, unsigned int) const; + double Dist_Manhattan(std::vector const&) const; /// Euclidean distance - double Dist_Euclidean(const double*, unsigned int) const; + double Dist_Euclidean(std::vector const&) const; /// Distance based on type_ double DistCalc(std::vector const&) const; - /// Distance based on type_ - double DistCalc(const double*, unsigned int) const; /// \return a string containing description of all metrics std::string descriptionOfMetrics() const; From 086f60e633b4e61be0e2eb574b0d5043402e3538 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 13:48:11 -0400 Subject: [PATCH 379/417] Update code comments --- src/Cluster/MetricArray.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 8685f41340..5b867953a2 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -11,6 +11,10 @@ namespace Cpptraj { namespace Cluster { class CentroidArray; /// Hold Metrics of various types +/** This serves as the main interface for all distance calculations related + * to clustering. If using more than one metric, the total distanace will + * be accumulated as Euclidean (sqrt(SUM(d^2))) or Manhattan (SUM(d)). + */ class MetricArray { public: /// CONSTRUCTOR @@ -100,7 +104,7 @@ class MetricArray { /// Fill the pairwise cache with distances for specified frames. int calcFrameDistances(Cframes const&); - std::vector metrics_; ///< Hold each Metric TODO deal with OpenMP + std::vector metrics_; ///< Hold each Metric std::vector sets_; ///< Sets corresponding to each Metric std::vector weights_; ///< Weight of each metric std::vector temp_; ///< For calculations; hold distances from each metric. From 13f73a317e59f8518f5286c046908adb67b6e443 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 14:25:28 -0400 Subject: [PATCH 380/417] Uncached distance calc can be private --- src/Cluster/MetricArray.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 5b867953a2..a2e84f8b73 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -78,8 +78,6 @@ class MetricArray { /// \return distance between given centroids double CentroidDist(CentroidArray const&, CentroidArray const&); - /// \return distance between frames (uncached) - double Uncached_Frame_Distance(int, int); /// \return distance between frames (cached or uncached) double Frame_Distance(int, int); @@ -98,6 +96,8 @@ class MetricArray { double Dist_Euclidean(std::vector const&) const; /// Distance based on type_ double DistCalc(std::vector const&) const; + /// \return distance between frames (uncached) + double Uncached_Frame_Distance(int, int); /// \return a string containing description of all metrics std::string descriptionOfMetrics() const; From 03643eb656183ac24332b741f87f585671bd8199 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 14 Sep 2021 16:20:38 -0400 Subject: [PATCH 381/417] Remove unneeded fwd declare --- src/Cluster/Control.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 158fcfd4cb..0545b918b7 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -16,7 +16,6 @@ class DataSetList; namespace Cpptraj { namespace Cluster { class Algorithm; -class Metric; class Results; /// Hold clusters, algorithm, and pairwise matrix. class Control { From 3306124325838b3577d2f73f3d466fe7d2f6999a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 13:24:23 -0400 Subject: [PATCH 382/417] Update version for cmake --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f6231b2f7..f3577f4061 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ project(cpptraj NONE) #version number #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- -set(cpptraj_MAJOR_VERSION 4) -set(cpptraj_MINOR_VERSION 3) -set(cpptraj_TWEAK_VERSION 4) +set(cpptraj_MAJOR_VERSION 6) +set(cpptraj_MINOR_VERSION 0) +set(cpptraj_TWEAK_VERSION 0) set(cpptraj_VERSION "${cpptraj_MAJOR_VERSION}.${cpptraj_MINOR_VERSION}.${cpptraj_TWEAK_VERSION}") @@ -69,4 +69,4 @@ add_subdirectory(test) #-------------------------------------------------------------- if(NOT INSIDE_AMBER) print_build_report() -endif() \ No newline at end of file +endif() From f28b8b0fc2da235f20f485be313a6757940cb83f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 13:33:55 -0400 Subject: [PATCH 383/417] Add test clustering on RMSD and data --- test/Test_Cluster_CoordsAndData/RunTest.sh | 30 ++++++ .../c1.cnvt.dat.save | 102 ++++++++++++++++++ .../c1.info.dat.save | 16 +++ .../c1.summary.dat.save | 6 ++ 4 files changed, 154 insertions(+) create mode 100755 test/Test_Cluster_CoordsAndData/RunTest.sh create mode 100644 test/Test_Cluster_CoordsAndData/c1.cnvt.dat.save create mode 100644 test/Test_Cluster_CoordsAndData/c1.info.dat.save create mode 100644 test/Test_Cluster_CoordsAndData/c1.summary.dat.save diff --git a/test/Test_Cluster_CoordsAndData/RunTest.sh b/test/Test_Cluster_CoordsAndData/RunTest.sh new file mode 100755 index 0000000000..72ff0fefc0 --- /dev/null +++ b/test/Test_Cluster_CoordsAndData/RunTest.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +. ../MasterTest.sh + +TESTNAME='Test clustering on coordinates and data' + +CleanFiles cluster.in c1.info.dat c1.summary.dat c1.cnvt.dat data.dat + +INPUT='-i cluster.in' + +cat > cluster.in < Date: Wed, 15 Sep 2021 13:42:16 -0400 Subject: [PATCH 384/417] Add error message when no frames to cluster. --- src/Cluster/Sieve.cpp | 6 +++++- src/Cluster/clusterdepend | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Sieve.cpp b/src/Cluster/Sieve.cpp index a2acdea6c1..32df0866da 100644 --- a/src/Cluster/Sieve.cpp +++ b/src/Cluster/Sieve.cpp @@ -1,4 +1,5 @@ #include "Sieve.h" +#include "../CpptrajStdio.h" #include "../DataSet_PairwiseCache.h" #include "../Random.h" @@ -17,7 +18,10 @@ void Cpptraj::Cluster::Sieve::DetermineTypeFromSieve( int sieveIn ) { /** Setup which frames should be clustered.*/ int Cpptraj::Cluster::Sieve::SetFramesToCluster(int sieveIn, std::size_t maxFrames, int iseed) { - if (maxFrames < 1) return 1; + if (maxFrames < 1) { + mprinterr("Error: No frames to cluster.\n"); + return 1; + } DetermineTypeFromSieve( sieveIn ); framesToCluster_.clear(); sievedOut_.clear(); diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 3f386c3bc4..598f3d797f 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -22,4 +22,4 @@ Metric_Torsion.o : Metric_Torsion.cpp ../AssociatedData.h ../Constants.h ../Cppt Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h Metric.h MetricArray.h Node.h Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h Output.h Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h -Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h +Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h From dae59fb9390d831f07430a43ea12654f7126a96f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 13:44:42 -0400 Subject: [PATCH 385/417] Move the error message to Control --- src/Cluster/Control.cpp | 4 ++++ src/Cluster/Sieve.cpp | 7 ++----- src/Cluster/clusterdepend | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 49f40d8224..93f8a01c9f 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -713,6 +713,10 @@ int Cpptraj::Cluster::Control::Run() { mprinterr("Error: Metric setup failed.\n"); return 1; } + if (metrics_.Ntotal() < 1) { + mprinterr("Error: No frames to cluster; all input sets are empty.\n"); + return 1; + } // Figure out which frames to cluster frameSieve_.Clear(); diff --git a/src/Cluster/Sieve.cpp b/src/Cluster/Sieve.cpp index 32df0866da..aa95b8afeb 100644 --- a/src/Cluster/Sieve.cpp +++ b/src/Cluster/Sieve.cpp @@ -1,5 +1,4 @@ #include "Sieve.h" -#include "../CpptrajStdio.h" #include "../DataSet_PairwiseCache.h" #include "../Random.h" @@ -18,10 +17,8 @@ void Cpptraj::Cluster::Sieve::DetermineTypeFromSieve( int sieveIn ) { /** Setup which frames should be clustered.*/ int Cpptraj::Cluster::Sieve::SetFramesToCluster(int sieveIn, std::size_t maxFrames, int iseed) { - if (maxFrames < 1) { - mprinterr("Error: No frames to cluster.\n"); - return 1; - } + // Sanity check. Should never be called with maxFrames < 1 + if (maxFrames < 1) return 1; DetermineTypeFromSieve( sieveIn ); framesToCluster_.clear(); sievedOut_.clear(); diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 598f3d797f..3f386c3bc4 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -22,4 +22,4 @@ Metric_Torsion.o : Metric_Torsion.cpp ../AssociatedData.h ../Constants.h ../Cppt Node.o : Node.cpp ../AssociatedData.h ../CpptrajFile.h ../DataSet.h ../DataSet_1D.h ../DataSet_float.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h Metric.h MetricArray.h Node.h Output.o : Output.cpp ../ArrayIterator.h ../CpptrajFile.h ../CpptrajStdio.h ../FileIO.h ../FileName.h ../Matrix.h ../Parallel.h Algorithm.h BestReps.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h Output.h Results_Coords.o : Results_Coords.cpp ../ActionFrameCounter.h ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSetList.h ../DataSet_Coords.h ../DataSet_Coords_REF.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OutputTrajCommon.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TrajectoryFile.h ../Trajout_Single.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Node.h Results.h Results_Coords.h -Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h +Sieve.o : Sieve.cpp ../AssociatedData.h ../Cluster/Cframes.h ../CpptrajFile.h ../DataSet.h ../DataSet_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../Random.h ../Range.h ../TextFormat.h Cframes.h Sieve.h From 153a912d0bf6b03df79d5188b9a9041d788acc88 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:04:20 -0400 Subject: [PATCH 386/417] Add calculation for determining how much each metric contributes to total distance --- src/Cluster/Control.cpp | 3 +++ src/Cluster/MetricArray.cpp | 34 ++++++++++++++++++++++++++++++++++ src/Cluster/MetricArray.h | 2 ++ 3 files changed, 39 insertions(+) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 93f8a01c9f..1a4edeb227 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -745,6 +745,9 @@ int Cpptraj::Cluster::Control::Run() { } Cframes const& framesToCluster = frameSieve_.FramesToCluster(); + // Calculate contribution to total for each metric + metrics_.CalculateMetricContributions(framesToCluster); + timer_setup_.Stop(); timer_pairwise_.Start(); diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 9e89628435..8398100da3 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -588,6 +588,40 @@ double Cpptraj::Cluster::MetricArray::Frame_Distance(int f1, int f2) { return Uncached_Frame_Distance(f1, f2); } +/** Loop over all pairs. For each distance, evaluate the contribution + * of each metric to the total distance (Manhattan). + */ +void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& framesToCluster) { + if (metrics_.size() < 2) { + mprintf("\tLess than 2 metrics; skipping metric contribution calculation.\n"); + return; + } + mprintf("\tCalculating metric contributions:\n"); + std::vector mfrac( metrics_.size(), 0 ); + unsigned int ndist = 0; + for (Cframes_it frm1 = framesToCluster.begin(); frm1 != framesToCluster.end(); ++frm1) + { + for (Cframes_it frm2 = frm1 + 1; frm2 != framesToCluster.end(); ++frm2) + { + ndist++; + // Populate the temp array + Uncached_Frame_Distance(*frm1, *frm2); + double sum = 0; + for (std::vector::const_iterator it = temp_.begin(); it != temp_.end(); ++it) + sum += *it; + for (unsigned int idx = 0; idx != temp_.size(); idx++) + mfrac[idx] += temp_[idx] / sum; + } + } + mprintf("\t"); + for (unsigned int idx = 0; idx != mfrac.size(); idx++) + mprintf(" %1s%05i", "M", idx); + mprintf("\n\t"); + for (std::vector::const_iterator it = mfrac.begin(); it != mfrac.end(); ++it) + mprintf(" %6.4f", *it / (double)ndist); + mprintf("\n"); +} + // ----------------------------------------------- /** \return A string containing the description of all metrics. */ std::string Cpptraj::Cluster::MetricArray::descriptionOfMetrics() const { diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index a2e84f8b73..de3f61b971 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -81,6 +81,8 @@ class MetricArray { /// \return distance between frames (cached or uncached) double Frame_Distance(int, int); + /// Calculate contributions of each metric to total distance, print to stdout + void CalculateMetricContributions(Cframes const&); private: /// Clear array void Clear(); From 1b36dfa374f340142900f83f5b4ee3c483619d8a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:10:15 -0400 Subject: [PATCH 387/417] Write out description for Info instead of just the legend again --- src/Cluster/Metric_Scalar.cpp | 2 +- src/Cluster/Metric_Torsion.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cluster/Metric_Scalar.cpp b/src/Cluster/Metric_Scalar.cpp index a34bf52b6f..6b3206a9b3 100644 --- a/src/Cluster/Metric_Scalar.cpp +++ b/src/Cluster/Metric_Scalar.cpp @@ -85,7 +85,7 @@ std::string Cpptraj::Cluster::Metric_Scalar::Description() const { /** Print info to STDOUT. */ void Cpptraj::Cluster::Metric_Scalar::Info() const { - mprintf("\tMetric: Data set '%s'\n", data_->legend()); + mprintf("\tMetric: Data set type: '%s'\n", data_->description()); } /** \return DataSet size */ diff --git a/src/Cluster/Metric_Torsion.cpp b/src/Cluster/Metric_Torsion.cpp index 17b270bdf6..b50275987e 100644 --- a/src/Cluster/Metric_Torsion.cpp +++ b/src/Cluster/Metric_Torsion.cpp @@ -109,7 +109,7 @@ std::string Cpptraj::Cluster::Metric_Torsion::Description() const { /** Print info to STDOUT. */ void Cpptraj::Cluster::Metric_Torsion::Info() const { - mprintf("\tMetric: Torsion data set '%s'\n", data_->legend()); + mprintf("\tMetric: Torsion set type: '%s'\n", data_->description()); } /** \return DataSet size */ From 1ccada8e5d3c6ed6b460d3b1670580e55cd301a4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:18:03 -0400 Subject: [PATCH 388/417] Add metricstats keyword --- src/Cluster/Control.cpp | 98 +++++++---------------------------------- src/Cluster/Control.h | 1 + 2 files changed, 17 insertions(+), 82 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 1a4edeb227..b0a92467d8 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -17,6 +17,7 @@ // Results #include "Results_Coords.h" +/** CONSTRUCTOR */ Cpptraj::Cluster::Control::Control() : algorithm_(0), results_(0), @@ -41,9 +42,11 @@ Cpptraj::Cluster::Control::Control() : drawGraph_(NO_DRAWGRAPH), draw_tol_(0), draw_maxit_(0), - debug_(0) + debug_(0), + calcMetricContributions_(false) {} +/** DESTRUCTOR */ Cpptraj::Cluster::Control::~Control() { if (algorithm_ != 0) delete algorithm_; if (results_ != 0 ) delete results_; @@ -203,7 +206,7 @@ const char* Cpptraj::Cluster::Control::OutputArgs2_ = "[summarysplit ] [splitframe ]"; const char* Cpptraj::Cluster::Control::OutputArgs3_ = - "[clustersvtime [cvtwindow <#>]] [sil ]"; + "[clustersvtime [cvtwindow <#>]] [sil ] [metricstats]"; const char* Cpptraj::Cluster::Control::OutputArgs4_ = "[cpopvtime [{normpop|normframe}]] [lifetime]"; @@ -223,94 +226,21 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, verbose_ = verboseIn; clusters_.SetDebug( verbose_ ); - // Determine if clustering on COORDS set or scalar sets - // TODO separate Metric from Euclid/Manhattan to allow COORDS/1D combos if (setsToCluster.empty()) { mprinterr("Error: No sets to cluster.\n"); return 1; } + // Initialize metrics based on set types. Also initializes the pairwise cache. if (metrics_.Initialize( setsToCluster, DSL, DFL, analyzeArgs, verbose_ )) { mprinterr("Error: Could not initialize distance metrics/cache.\n"); return 1; } -/* - // Determine the metric type based on what sets we are clustering on - if (setsToCluster.size() == 1 && setsToCluster[0]->Group() == DataSet::COORDINATES) { - // Clustering on coords - mprintf("\tClustering on coordinates: '%s'\n", setsToCluster[0]->legend()); - // Determine Metric. Valid ones for COORDS are RMS, DME, SRMSD - int usedme = (int)analyzeArgs.hasKey("dme"); - int userms = (int)analyzeArgs.hasKey("rms"); - int usesrms = (int)analyzeArgs.hasKey("srmsd"); - if (usedme + userms + usesrms > 1) { - mprinterr("Error: Specify either 'dme', 'rms', or 'srmsd'.\n"); - return 1; - } - Metric::Type mtype = Metric::RMS; // Default - if (usedme) mtype = Metric::DME; - else if (userms) mtype = Metric::RMS; - else if (usesrms) mtype = Metric::SRMSD; - if (metric_ != 0) delete metric_; - metric_ = 0; - metric_ = AllocateMetric( mtype ); - if (metric_ == 0) return 1; - // COORDS Metric init. - bool useMass = analyzeArgs.hasKey("mass"); - bool nofit = analyzeArgs.hasKey("nofit"); - // Get the mask string - std::string maskExpr = analyzeArgs.GetMaskNext(); - int err = 0; - DataSet_Coords* ds = static_cast( setsToCluster[0] ); - switch (mtype) { - case Metric::RMS : - err = ((Metric_RMS*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass); break; - case Metric::DME : - err = ((Metric_DME*)metric_)->Init(ds, AtomMask(maskExpr)); break; - case Metric::SRMSD : - err = ((Metric_SRMSD*)metric_)->Init(ds, AtomMask(maskExpr), nofit, useMass, verbose_); - break; - default: - mprinterr("Error: Unhandled Metric setup.\n"); - err = 1; - } - if (err != 0) { - mprinterr("Error: Metric setup failed.\n"); - return 1; - } - } else { - mprintf("\tClustering on %zu data set(s).\n", setsToCluster.size()); - // Clustering on data - Metric_Data::DsArray cluster_datasets; - for (DataSetList::const_iterator ds = setsToCluster.begin(); ds != setsToCluster.end(); ++ds) - { - // Clustering only allowed on 1D data sets. - if ( (*ds)->Group() != DataSet::SCALAR_1D ) { - mprinterr("Error: Clustering only allowed on 1D scalar data sets, %s is %zuD.\n", - (*ds)->legend(), (*ds)->Ndim()); - return 1; - } - cluster_datasets.push_back( *ds ); - } - if (cluster_datasets.empty()) { - mprinterr("Error: No valid data sets to cluster on.\n"); - return 1; - } - // Choose metric for 'data' - Metric::Type mtype = Metric::EUCLID; // Default - if (analyzeArgs.hasKey("euclid")) - mtype = Metric::EUCLID; - else if (analyzeArgs.hasKey("manhattan")) - mtype = Metric::MANHATTAN; - if (metric_ != 0) delete metric_; - metric_ = 0; - metric_ = AllocateMetric( mtype ); - if (metric_ == 0) return 1; - // Metric init. - int err = ((Metric_Data*)metric_)->Init( cluster_datasets ); - if (err != 0) return 1; - } -*/ + calcMetricContributions_ = analyzeArgs.hasKey("metricstats"); + if (calcMetricContributions_ && setsToCluster.size() < 2) { + mprintf("Warning: 'metricstats' is only relevant with 2 or more input data sets. Disabling.\n"); + calcMetricContributions_ = false; + } // Set up results that depend on COORDS DataSet if (coordsSet != 0) { @@ -594,6 +524,9 @@ void Cpptraj::Cluster::Control::Help() { // ----------------------------------------------------------------------------- void Cpptraj::Cluster::Control::Info() const { metrics_.Info(); + if (calcMetricContributions_) + mprintf("\tContributions of each metric to the total distance will be printed to STDOUT.\n"); + if (algorithm_ != 0) algorithm_->Info(); if (results_ != 0) @@ -746,7 +679,8 @@ int Cpptraj::Cluster::Control::Run() { Cframes const& framesToCluster = frameSieve_.FramesToCluster(); // Calculate contribution to total for each metric - metrics_.CalculateMetricContributions(framesToCluster); + if (calcMetricContributions_) + metrics_.CalculateMetricContributions(framesToCluster); timer_setup_.Stop(); timer_pairwise_.Start(); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index 0545b918b7..a3c4c31f6e 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -108,6 +108,7 @@ class Control { int draw_maxit_; ///< Graph draw max iterations for min int debug_; ///< Cluster debug level + bool calcMetricContributions_; ///< If true, determine how much each metric contributes to total distance // Timers Timer timer_setup_; ///< Run - metric, frames to cluster setup From 454491cb7c5a6b92a8a21fa32309b65842a498fd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:21:09 -0400 Subject: [PATCH 389/417] Improve output message --- src/Cluster/MetricArray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 8398100da3..e4ea60d105 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -596,7 +596,7 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& mprintf("\tLess than 2 metrics; skipping metric contribution calculation.\n"); return; } - mprintf("\tCalculating metric contributions:\n"); + mprintf("\tCalculating metric contributions to total distance:\n"); std::vector mfrac( metrics_.size(), 0 ); unsigned int ndist = 0; for (Cframes_it frm1 = framesToCluster.begin(); frm1 != framesToCluster.end(); ++frm1) From 6915f0a6cc76487d996bc8ff2c740f1372b86320 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:21:18 -0400 Subject: [PATCH 390/417] Add metricstats keyword --- test/Test_Cluster_CoordsAndData/RunTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Test_Cluster_CoordsAndData/RunTest.sh b/test/Test_Cluster_CoordsAndData/RunTest.sh index 72ff0fefc0..515e3b0c50 100755 --- a/test/Test_Cluster_CoordsAndData/RunTest.sh +++ b/test/Test_Cluster_CoordsAndData/RunTest.sh @@ -20,7 +20,7 @@ runanalysis cluster c1 \ rms :1-12&!@H= \ out c1.cnvt.dat \ info c1.info.dat \ - summary c1.summary.dat + summary c1.summary.dat metricstats EOF RunCpptraj "$TESTNAME" DoTest c1.info.dat.save c1.info.dat From 781c8955899b515434fcf8074c7604cdccf75372 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:33:57 -0400 Subject: [PATCH 391/417] Fix up help --- src/Analysis_Clustering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analysis_Clustering.cpp b/src/Analysis_Clustering.cpp index e401d5ecd6..e793a3aef1 100644 --- a/src/Analysis_Clustering.cpp +++ b/src/Analysis_Clustering.cpp @@ -6,7 +6,7 @@ using namespace Cpptraj::Cluster; // Analysis_Clustering::Help() void Analysis_Clustering::Help() const { - mprintf("\t[{crdset | data [,...] [nocoords]}]\n"); + mprintf("\t[crdset ] [data [,...]] [nocoords]\n"); Control::Help(); } From 3a29a80a85908e7664245e9126cc0aeaf704d33a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:34:02 -0400 Subject: [PATCH 392/417] Update manual entry with ability to cluster on any combo of coords/1d sets. Add metricstats keyword. --- doc/cpptraj.lyx | 66 +++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 7bac4b996a..f37e265296 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -40208,7 +40208,7 @@ cluster \end_inset - [{crdset | data [,...] [nocoords]}] + [crdset ] [data [,...]] [nocoords] \end_layout \begin_layout LyX-Code @@ -40261,15 +40261,11 @@ cluster \end_layout \begin_layout LyX-Code - Metric Args: [{rms|srmsd|dme|euclid|manhattan}] + Metric Args: \end_layout \begin_layout LyX-Code - ('euclid' and 'manhattan' only work with 'data') -\end_layout - -\begin_layout LyX-Code - {[{dme|rms|srmsd} [mass] [nofit] []] | [{euclid|manhattan}]} + [{dme|rms|srmsd} [mass] [nofit] []] [{euclid|manhattan}] [wgt ] \end_layout \begin_layout LyX-Code @@ -40317,7 +40313,7 @@ cluster \end_layout \begin_layout LyX-Code - [clustersvtime [cvtwindow <#>]] [sil ] + [clustersvtime [cvtwindow <#>]] [sil ] [metricstats] \end_layout \begin_layout LyX-Code @@ -40370,7 +40366,7 @@ cluster \begin_inset space ~ \end_inset -set>] Name of COORDS data set to cluster on/use for coordinate output. +set>] Name of COORDS data set to cluster on and/or use for coordinate output. If not specified the default COORDS set will be generated and used unless \series bold @@ -40385,18 +40381,19 @@ nocoords \end_inset [,,...] Distance between frames calculated using specified data - set(s) (Euclidean distance). + set(s). + Currently 1D scalar sets and COORDS sets are supported. \end_layout \begin_deeper \begin_layout Description [nocoords] Do not use a COORDS data set; distance metrics that require coordinat -es and coordiante output will be disabled. +es and coordinate output will be disabled. \end_layout \end_deeper \begin_layout Description -[] Name for generated cluster DataSets. +[] Data set Name for generated cluster data sets. \end_layout \begin_layout Description @@ -40419,7 +40416,7 @@ infofile \series bold info \series default - file to read. + file to read clusters from. \end_layout \begin_layout Description @@ -40427,7 +40424,7 @@ cnvtset \begin_inset space ~ \end_inset - Cluster number vs time data set to use. + Cluster number vs time data set to use to generate initial clusters. \end_layout \end_deeper @@ -40768,8 +40765,8 @@ srmsd} \series bold rms \series default -) Distance between coordinate frames calculated via best-fit coordinate - RMSD using atoms in +) For COORDS data, distance between coordinate frames calculated via best-fit + coordinate RMSD using atoms in \series bold \series default @@ -40807,8 +40804,8 @@ dme \begin_inset space ~ \end_inset -[] Distance between coordinate frames calculated using distance-RMSD - (aka DME, +[] For COORDS data, distance between coordinate frames calculated + using distance-RMSD (aka DME, \series bold \emph on distrmsd @@ -40822,16 +40819,13 @@ distrmsd \end_layout \begin_layout Description -euclid Use Euclidean distance between scalar 1D data set(s) (default when - -\series bold -data -\series default - has been specified). +euclid Use Euclidean distance (sqrt(SUM(distance^2))) when more than one + data set has been specified (default). \end_layout \begin_layout Description -manhatttan Use Manhattan distance between scalar 1D data set(s). +manhatttan Use Manhattan distance (SUM(distance)) when more than one data + set has been specified. \end_layout \begin_layout Standard @@ -41291,6 +41285,21 @@ uster.dat' and cluster silhouette value for each individual frame to '.f me.dat'. \end_layout +\begin_layout Description +[metricstats] When more than one metric in use, print the fraction contribution + of each metric to the total distance to output with format: +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +The output will occur just after clustering has started but before any pairwise + distances are cached. + This may be slow for large numbers of frames. +\end_layout + \begin_layout Description [cpopvtime \begin_inset space ~ @@ -41525,8 +41534,11 @@ Note cluster population vs time data sets are not generated until the analysis \end_layout \begin_layout Standard -Cluster input frames using the specified clustering algorithm and distance - metric. +Cluster input frames using the specified input data sets (can be any combination + of coordinates/COORDS and/or 1D scalar data) with the specified clustering + algorithm. + For COORDS sets, the distance metric can be RMSD, symmetry-corrected RMSD, + or DME. In order to speed up clustering of large trajectories, the \series bold sieve From d99b1ae41b2d5f86b598db65e65178b0b6653cfd Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:35:20 -0400 Subject: [PATCH 393/417] Enable coords/1d clustering test --- test/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Makefile b/test/Makefile index 66bbb97e4f..3bded85042 100644 --- a/test/Makefile +++ b/test/Makefile @@ -110,6 +110,7 @@ test.cluster: @-cd Test_Cluster_AssignRefs && ./RunTest.sh $(OPT) @-cd Test_Cluster_Cache && ./RunTest.sh $(OPT) @-cd Test_Cluster_ReadInfo && ./RunTest.sh $(OPT) + @-cd Test_Cluster_CoordsAndData && ./RunTest.sh $(OPT) test.ired: @-cd Test_IRED && ./RunTest.sh $(OPT) From 2b588462c6d06856c514069de7590572caef5ea4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:41:52 -0400 Subject: [PATCH 394/417] Add weights to distance contribution calc --- src/Cluster/MetricArray.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index e4ea60d105..9ce7da2dae 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -607,10 +607,10 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& // Populate the temp array Uncached_Frame_Distance(*frm1, *frm2); double sum = 0; - for (std::vector::const_iterator it = temp_.begin(); it != temp_.end(); ++it) - sum += *it; for (unsigned int idx = 0; idx != temp_.size(); idx++) - mfrac[idx] += temp_[idx] / sum; + sum += (weights_[idx] * temp_[idx]); + for (unsigned int idx = 0; idx != temp_.size(); idx++) + mfrac[idx] += (weights_[idx]*temp_[idx]) / sum; } } mprintf("\t"); From 19fa2ebe6ca41d2cabf864f434691460aa5eb467 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:42:19 -0400 Subject: [PATCH 395/417] Add entry for wgt keyword --- doc/cpptraj.lyx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index f37e265296..ceb2a9f3b2 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -40828,6 +40828,17 @@ manhatttan Use Manhattan distance (SUM(distance)) when more than one data set has been specified. \end_layout +\begin_layout Description +wgt +\begin_inset space ~ +\end_inset + + Factor to multiply distances from each metric by in a comma-separated + list. + Can be used to adjust the contribution from each metric. + Default is 1 for each metric. +\end_layout + \begin_layout Standard Pairwise Distance Matrix Options: \end_layout From 613f4c20ce682d0a34b16b0c74b20f6e5e712fda Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Sep 2021 14:49:09 -0400 Subject: [PATCH 396/417] Test the wgt keyword --- test/Test_Cluster_DataSet/RunTest.sh | 20 +++++++++++++++++-- .../twodswgt.info.dat.save | 18 +++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 test/Test_Cluster_DataSet/twodswgt.info.dat.save diff --git a/test/Test_Cluster_DataSet/RunTest.sh b/test/Test_Cluster_DataSet/RunTest.sh index a0f72ce8be..2005f0c6a8 100755 --- a/test/Test_Cluster_DataSet/RunTest.sh +++ b/test/Test_Cluster_DataSet/RunTest.sh @@ -4,7 +4,7 @@ CleanFiles ds.in *.summary.dat *.info.dat *.gnu *.d1.c1.dat \ eps_v_n.dat twodihds.kmeans.info.dat onedihds.kmeans.info.dat \ - cvt.dat + cvt.dat twodswgt.info.dat INPUT="-i ds.in" TESTNAME='Clustering via datasets tests' @@ -33,13 +33,28 @@ trajin ../tz2.nc distance d1 :1 :13 hbond hb1 #debug analysis 2 -cluster nocoords c1 data d1,hb1[UU] clusters 5 epsilon 4.0 out twods.gnu summary twods.summary.dat info twods.info.dat gracecolor +cluster nocoords c1 data d1,hb1[UU] metricstats \ + clusters 5 epsilon 4.0 out twods.gnu summary twods.summary.dat info twods.info.dat gracecolor create twods.d1.c1.dat d1 hb1[UU] c1 EOF RunCpptraj "Clustering, Two DataSets" DoTest twods.info.dat.save twods.info.dat } +TwoDSwgt() { + TOP=../tz2.parm7 + cat > ds.in < ds.in < Date: Wed, 15 Sep 2021 14:51:51 -0400 Subject: [PATCH 397/417] Have metricstats and wgt reference each other --- doc/cpptraj.lyx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index ceb2a9f3b2..459da58085 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -40837,6 +40837,12 @@ wgt list. Can be used to adjust the contribution from each metric. Default is 1 for each metric. + The +\series bold +metricstats +\series default + keyword can be used to determine the relative contribution of each metric + to the distance. \end_layout \begin_layout Standard @@ -41298,7 +41304,13 @@ me.dat'. \begin_layout Description [metricstats] When more than one metric in use, print the fraction contribution - of each metric to the total distance to output with format: + of each metric to the total distance. + This information can be used in conjunction with the +\series bold +wgt +\series default + keyword to adjust the contribution of each metric to the total distance. + It is written to output with format: \begin_inset Newline newline \end_inset From 45497f955fe07d1d738ba4edec83d8b4652d9f0a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 06:25:06 -0400 Subject: [PATCH 398/417] Put all coords results setup in the same place --- src/Cluster/Control.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index b0a92467d8..895448e2d4 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -242,13 +242,6 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, calcMetricContributions_ = false; } - // Set up results that depend on COORDS DataSet - if (coordsSet != 0) { - if (results_ != 0) delete results_; - results_ = (Results*)new Results_Coords( static_cast( coordsSet ) ); - if (results_ == 0) return 1; - } - // Initialize clusters from existing info file. Metric must already be set up. if (analyzeArgs.hasKey("readinfo") || analyzeArgs.hasKey("readtxt")) @@ -272,17 +265,14 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, } } - if (results_ != 0) { + // Set up results that depend on COORDS DataSet + if (coordsSet != 0) { + if (results_ != 0) delete results_; + results_ = (Results*)new Results_Coords( static_cast( coordsSet ) ); + if (results_ == 0) return 1; if (results_->GetOptions(analyzeArgs, DSL, metrics_)) return 1; } -/* - // Allocate PairwiseMatrix (and optionally a cache). Metric must already be set up. - if (AllocatePairwise( analyzeArgs, DSL, DFL )) { - mprinterr("Error: PairwiseMatrix setup failed.\n"); - return 1; - }*/ - // Allocate algorithm if (AllocateAlgorithm( analyzeArgs )) { mprinterr("Error: Algorithm setup failed.\n"); From 228a93642222068325cb90f316af39bdea2d3ce1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 10:23:42 -0400 Subject: [PATCH 399/417] Redirect metric stats to a file --- src/Cluster/Control.cpp | 30 +++++++++++++++++++++--------- src/Cluster/Control.h | 3 ++- src/Cluster/MetricArray.cpp | 15 +++++++++------ src/Cluster/MetricArray.h | 5 +++-- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 895448e2d4..aa16bc9656 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -43,7 +43,7 @@ Cpptraj::Cluster::Control::Control() : draw_tol_(0), draw_maxit_(0), debug_(0), - calcMetricContributions_(false) + metricContribFile_(0) {} /** DESTRUCTOR */ @@ -236,10 +236,21 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, mprinterr("Error: Could not initialize distance metrics/cache.\n"); return 1; } - calcMetricContributions_ = analyzeArgs.hasKey("metricstats"); - if (calcMetricContributions_ && setsToCluster.size() < 2) { - mprintf("Warning: 'metricstats' is only relevant with 2 or more input data sets. Disabling.\n"); - calcMetricContributions_ = false; + + // Determine if metric contributions should be determined + metricContribFile_ = 0; + std::string metricContribArg = analyzeArgs.GetStringKey("metricstats"); + if (!metricContribArg.empty()) { + if (setsToCluster.size() < 2) { + mprintf("Warning: 'metricstats' is only relevant with 2 or more input data sets. Skipping.\n"); + } else { + metricContribFile_ = DFL.AddCpptrajFile(metricContribArg, "Metric Contributions", + DataFileList::TEXT); + if (metricContribFile_ == 0) { + mprinterr("Error: Could not set up 'metricstats' file.\n"); + return 1; + } + } } // Initialize clusters from existing info file. Metric must already be set up. @@ -514,8 +525,9 @@ void Cpptraj::Cluster::Control::Help() { // ----------------------------------------------------------------------------- void Cpptraj::Cluster::Control::Info() const { metrics_.Info(); - if (calcMetricContributions_) - mprintf("\tContributions of each metric to the total distance will be printed to STDOUT.\n"); + if (metricContribFile_ != 0) + mprintf("\tContributions of each metric to the total distance will be printed to '%s'.\n", + metricContribFile_->Filename().full()); if (algorithm_ != 0) algorithm_->Info(); @@ -669,8 +681,8 @@ int Cpptraj::Cluster::Control::Run() { Cframes const& framesToCluster = frameSieve_.FramesToCluster(); // Calculate contribution to total for each metric - if (calcMetricContributions_) - metrics_.CalculateMetricContributions(framesToCluster); + if (metricContribFile_ != 0) + metrics_.CalculateMetricContributions(framesToCluster, *metricContribFile_); timer_setup_.Stop(); timer_pairwise_.Start(); diff --git a/src/Cluster/Control.h b/src/Cluster/Control.h index a3c4c31f6e..4c9c9ad8c2 100644 --- a/src/Cluster/Control.h +++ b/src/Cluster/Control.h @@ -108,7 +108,8 @@ class Control { int draw_maxit_; ///< Graph draw max iterations for min int debug_; ///< Cluster debug level - bool calcMetricContributions_; ///< If true, determine how much each metric contributes to total distance + + CpptrajFile* metricContribFile_; ///< If not null, determine how much each metric contributes to total distance // Timers Timer timer_setup_; ///< Run - metric, frames to cluster setup diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 9ce7da2dae..2c301606ba 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -7,6 +7,7 @@ #include "CentroidArray.h" #include "Metric.h" #include "../ArgList.h" +#include "../CpptrajFile.h" #include "../CpptrajStdio.h" #include "../DataFile.h" #include "../DataFileList.h" @@ -591,7 +592,9 @@ double Cpptraj::Cluster::MetricArray::Frame_Distance(int f1, int f2) { /** Loop over all pairs. For each distance, evaluate the contribution * of each metric to the total distance (Manhattan). */ -void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& framesToCluster) { +void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& framesToCluster, + CpptrajFile& outfile) +{ if (metrics_.size() < 2) { mprintf("\tLess than 2 metrics; skipping metric contribution calculation.\n"); return; @@ -613,13 +616,13 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& mfrac[idx] += (weights_[idx]*temp_[idx]) / sum; } } - mprintf("\t"); + outfile.Printf("#"); for (unsigned int idx = 0; idx != mfrac.size(); idx++) - mprintf(" %1s%05i", "M", idx); - mprintf("\n\t"); + outfile.Printf(" %1s%05i", "M", idx); + outfile.Printf("\n "); for (std::vector::const_iterator it = mfrac.begin(); it != mfrac.end(); ++it) - mprintf(" %6.4f", *it / (double)ndist); - mprintf("\n"); + outfile.Printf(" %6.4f", *it / (double)ndist); + outfile.Printf("\n"); } // ----------------------------------------------- diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index de3f61b971..04aba02f0a 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -3,6 +3,7 @@ #include #include "Metric.h" // Metric::Type class ArgList; +class CpptrajFile; class DataFileList; class DataSet; class DataSet_PairwiseCache; @@ -81,8 +82,8 @@ class MetricArray { /// \return distance between frames (cached or uncached) double Frame_Distance(int, int); - /// Calculate contributions of each metric to total distance, print to stdout - void CalculateMetricContributions(Cframes const&); + /// Calculate contributions of each metric to total distance, print to given file + void CalculateMetricContributions(Cframes const&, CpptrajFile&); private: /// Clear array void Clear(); From 74660ebe86896baa2686ab7691161adf2fbb6b35 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 10:24:17 -0400 Subject: [PATCH 400/417] Add metricstats test save --- test/Test_Cluster_CoordsAndData/RunTest.sh | 5 +++-- test/Test_Cluster_CoordsAndData/metricstats.dat.save | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 test/Test_Cluster_CoordsAndData/metricstats.dat.save diff --git a/test/Test_Cluster_CoordsAndData/RunTest.sh b/test/Test_Cluster_CoordsAndData/RunTest.sh index 515e3b0c50..06ccafb6ac 100755 --- a/test/Test_Cluster_CoordsAndData/RunTest.sh +++ b/test/Test_Cluster_CoordsAndData/RunTest.sh @@ -4,7 +4,7 @@ TESTNAME='Test clustering on coordinates and data' -CleanFiles cluster.in c1.info.dat c1.summary.dat c1.cnvt.dat data.dat +CleanFiles cluster.in c1.info.dat c1.summary.dat c1.cnvt.dat data.dat metricstats.dat INPUT='-i cluster.in' @@ -20,11 +20,12 @@ runanalysis cluster c1 \ rms :1-12&!@H= \ out c1.cnvt.dat \ info c1.info.dat \ - summary c1.summary.dat metricstats + summary c1.summary.dat metricstats metricstats.dat EOF RunCpptraj "$TESTNAME" DoTest c1.info.dat.save c1.info.dat DoTest c1.summary.dat.save c1.summary.dat DoTest c1.cnvt.dat.save c1.cnvt.dat +DoTest metricstats.dat.save metricstats.dat EndTest diff --git a/test/Test_Cluster_CoordsAndData/metricstats.dat.save b/test/Test_Cluster_CoordsAndData/metricstats.dat.save new file mode 100644 index 0000000000..27aaa9c37d --- /dev/null +++ b/test/Test_Cluster_CoordsAndData/metricstats.dat.save @@ -0,0 +1,2 @@ +# M00000 M00001 + 0.5091 0.4909 From 15f1122a75a5a804dae32d15e43f1e8f1a40124c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 10:27:15 -0400 Subject: [PATCH 401/417] Add metricstats save files --- test/Test_Cluster_DataSet/RunTest.sh | 8 +++++--- test/Test_Cluster_DataSet/twods.metricstats.save | 2 ++ test/Test_Cluster_DataSet/twodswgt.metricstats.save | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 test/Test_Cluster_DataSet/twods.metricstats.save create mode 100644 test/Test_Cluster_DataSet/twodswgt.metricstats.save diff --git a/test/Test_Cluster_DataSet/RunTest.sh b/test/Test_Cluster_DataSet/RunTest.sh index 2005f0c6a8..e4918380df 100755 --- a/test/Test_Cluster_DataSet/RunTest.sh +++ b/test/Test_Cluster_DataSet/RunTest.sh @@ -4,7 +4,7 @@ CleanFiles ds.in *.summary.dat *.info.dat *.gnu *.d1.c1.dat \ eps_v_n.dat twodihds.kmeans.info.dat onedihds.kmeans.info.dat \ - cvt.dat twodswgt.info.dat + cvt.dat twodswgt.info.dat *.metricstats INPUT="-i ds.in" TESTNAME='Clustering via datasets tests' @@ -33,12 +33,13 @@ trajin ../tz2.nc distance d1 :1 :13 hbond hb1 #debug analysis 2 -cluster nocoords c1 data d1,hb1[UU] metricstats \ +cluster nocoords c1 data d1,hb1[UU] metricstats twods.metricstats \ clusters 5 epsilon 4.0 out twods.gnu summary twods.summary.dat info twods.info.dat gracecolor create twods.d1.c1.dat d1 hb1[UU] c1 EOF RunCpptraj "Clustering, Two DataSets" DoTest twods.info.dat.save twods.info.dat + DoTest twods.metricstats.save twods.metricstats } TwoDSwgt() { @@ -48,11 +49,12 @@ trajin ../tz2.nc distance d1 :1 :13 hbond hb1 #debug analysis 2 -cluster nocoords c1 data d1,hb1[UU] metricstats wgt 1,9 \ +cluster nocoords c1 data d1,hb1[UU] metricstats twodswgt.metricstats wgt 1,9 \ clusters 5 epsilon 4.0 info twodswgt.info.dat EOF RunCpptraj "Clustering, Two DataSets with specified weights" DoTest twodswgt.info.dat.save twodswgt.info.dat + DoTest twodswgt.metricstats.save twodswgt.metricstats } OneDihDS() { diff --git a/test/Test_Cluster_DataSet/twods.metricstats.save b/test/Test_Cluster_DataSet/twods.metricstats.save new file mode 100644 index 0000000000..c67284cbe1 --- /dev/null +++ b/test/Test_Cluster_DataSet/twods.metricstats.save @@ -0,0 +1,2 @@ +# M00000 M00001 + 0.9038 0.0962 diff --git a/test/Test_Cluster_DataSet/twodswgt.metricstats.save b/test/Test_Cluster_DataSet/twodswgt.metricstats.save new file mode 100644 index 0000000000..a4789f3fac --- /dev/null +++ b/test/Test_Cluster_DataSet/twodswgt.metricstats.save @@ -0,0 +1,2 @@ +# M00000 M00001 + 0.7492 0.2508 From 71eadd3feb83de7f0babc6d7d75a0fc1e41051e4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 10:37:46 -0400 Subject: [PATCH 402/417] Adjust metric summation based on distance calculation type --- src/Cluster/MetricArray.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 2c301606ba..bb2f582df0 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -610,10 +610,21 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& // Populate the temp array Uncached_Frame_Distance(*frm1, *frm2); double sum = 0; - for (unsigned int idx = 0; idx != temp_.size(); idx++) - sum += (weights_[idx] * temp_[idx]); - for (unsigned int idx = 0; idx != temp_.size(); idx++) - mfrac[idx] += (weights_[idx]*temp_[idx]) / sum; + if (type_ == MANHATTAN) { + for (unsigned int idx = 0; idx != temp_.size(); idx++) + sum += (weights_[idx] * temp_[idx]); + for (unsigned int idx = 0; idx != temp_.size(); idx++) + mfrac[idx] += (weights_[idx]*temp_[idx]) / sum; + } else if (type_ == EUCLID) { + for (unsigned int idx = 0; idx != temp_.size(); idx++) + sum += (weights_[idx] * (temp_[idx]*temp_[idx])); + for (unsigned int idx = 0; idx != temp_.size(); idx++) + mfrac[idx] += (weights_[idx] * (temp_[idx]*temp_[idx])) / sum; + } else { + // Sanity check + mprinterr("Internal Error: CalculateMetricContributions: Unhandled metric summation.\n"); + return; + } } } outfile.Printf("#"); From 21cba236276808d08bb00f764a8ae96bedd0eb3a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 10:39:03 -0400 Subject: [PATCH 403/417] Add test with manhattan distance --- test/Test_Cluster_DataSet/RunTest.sh | 18 +++++++++++++++++- test/Test_Cluster_DataSet/twodsm.info.dat.save | 16 ++++++++++++++++ .../twodsm.metricstats.save | 2 ++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/Test_Cluster_DataSet/twodsm.info.dat.save create mode 100644 test/Test_Cluster_DataSet/twodsm.metricstats.save diff --git a/test/Test_Cluster_DataSet/RunTest.sh b/test/Test_Cluster_DataSet/RunTest.sh index e4918380df..771a37e146 100755 --- a/test/Test_Cluster_DataSet/RunTest.sh +++ b/test/Test_Cluster_DataSet/RunTest.sh @@ -4,7 +4,7 @@ CleanFiles ds.in *.summary.dat *.info.dat *.gnu *.d1.c1.dat \ eps_v_n.dat twodihds.kmeans.info.dat onedihds.kmeans.info.dat \ - cvt.dat twodswgt.info.dat *.metricstats + cvt.dat *.metricstats INPUT="-i ds.in" TESTNAME='Clustering via datasets tests' @@ -42,6 +42,21 @@ EOF DoTest twods.metricstats.save twods.metricstats } +TwoDSmanhattan() { + TOP=../tz2.parm7 + cat > ds.in < ds.in < Date: Thu, 16 Sep 2021 10:40:15 -0400 Subject: [PATCH 404/417] Metric stats calc now takes manhattan/euclid into account --- test/Test_Cluster_CoordsAndData/metricstats.dat.save | 2 +- test/Test_Cluster_DataSet/twods.metricstats.save | 2 +- test/Test_Cluster_DataSet/twodswgt.metricstats.save | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Test_Cluster_CoordsAndData/metricstats.dat.save b/test/Test_Cluster_CoordsAndData/metricstats.dat.save index 27aaa9c37d..b6c13b23bb 100644 --- a/test/Test_Cluster_CoordsAndData/metricstats.dat.save +++ b/test/Test_Cluster_CoordsAndData/metricstats.dat.save @@ -1,2 +1,2 @@ # M00000 M00001 - 0.5091 0.4909 + 0.4912 0.5088 diff --git a/test/Test_Cluster_DataSet/twods.metricstats.save b/test/Test_Cluster_DataSet/twods.metricstats.save index c67284cbe1..6494811852 100644 --- a/test/Test_Cluster_DataSet/twods.metricstats.save +++ b/test/Test_Cluster_DataSet/twods.metricstats.save @@ -1,2 +1,2 @@ # M00000 M00001 - 0.9038 0.0962 + 0.9324 0.0676 diff --git a/test/Test_Cluster_DataSet/twodswgt.metricstats.save b/test/Test_Cluster_DataSet/twodswgt.metricstats.save index a4789f3fac..679e6826a8 100644 --- a/test/Test_Cluster_DataSet/twodswgt.metricstats.save +++ b/test/Test_Cluster_DataSet/twodswgt.metricstats.save @@ -1,2 +1,2 @@ # M00000 M00001 - 0.7492 0.2508 + 0.8483 0.1517 From 9fc2758961d990dd08f5b58aada3c6fb319beaff Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 10:51:15 -0400 Subject: [PATCH 405/417] Calculate average and SD of individual metric contributions. Change output format for metricstats. --- src/Cluster/MetricArray.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index bb2f582df0..d267dd6ba0 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -13,6 +13,7 @@ #include "../DataFileList.h" #include "../DataSet_PairwiseCache.h" #include "../DataSetList.h" +#include "../OnlineVarT.h" // for metric stats average #include "../ProgressBar.h" #include "../StringRoutines.h" // Metric classes @@ -601,6 +602,7 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& } mprintf("\tCalculating metric contributions to total distance:\n"); std::vector mfrac( metrics_.size(), 0 ); + std::vector> mavg( metrics_.size() ); unsigned int ndist = 0; for (Cframes_it frm1 = framesToCluster.begin(); frm1 != framesToCluster.end(); ++frm1) { @@ -609,6 +611,10 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& ndist++; // Populate the temp array Uncached_Frame_Distance(*frm1, *frm2); + // Do averages + for (unsigned int idx = 0; idx != temp_.size(); idx++) + mavg[idx].accumulate( temp_[idx] ); + // Do fractions double sum = 0; if (type_ == MANHATTAN) { for (unsigned int idx = 0; idx != temp_.size(); idx++) @@ -627,6 +633,7 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& } } } +/* outfile.Printf("#"); for (unsigned int idx = 0; idx != mfrac.size(); idx++) outfile.Printf(" %1s%05i", "M", idx); @@ -634,6 +641,15 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& for (std::vector::const_iterator it = mfrac.begin(); it != mfrac.end(); ++it) outfile.Printf(" %6.4f", *it / (double)ndist); outfile.Printf("\n"); +*/ + outfile.Printf("%-7s %6s %12s %12s %s\n", "#Metric", "Frac", "Avg", "SD", "Description"); + for (unsigned int idx = 0; idx != mfrac.size(); idx++) { + outfile.Printf("%-7u %6.4f %12.4f %12.4f \"%s\"\n", idx, + mfrac[idx] / (double)ndist, + mavg[idx].mean(), sqrt(mavg[idx].variance()), + metrics_[idx]->Description().c_str()); + } + outfile.Flush(); } // ----------------------------------------------- From 4150dbe53b04aba7a2eae9b9394248a7cbbe6260 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 11:15:27 -0400 Subject: [PATCH 406/417] Use OnlineVarT to calculate frac averages. Report frac SD as well. --- src/Cluster/MetricArray.cpp | 45 ++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index d267dd6ba0..8e73d09d15 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -601,8 +601,12 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& return; } mprintf("\tCalculating metric contributions to total distance:\n"); - std::vector mfrac( metrics_.size(), 0 ); + // This array will accumulate contribution fractions + std::vector> mfrac( metrics_.size() ); + // This array will accumulate contribution averages std::vector> mavg( metrics_.size() ); + // This array will hold each contribution, adjust for distance type and weight + std::vector mcont( metrics_.size() ); unsigned int ndist = 0; for (Cframes_it frm1 = framesToCluster.begin(); frm1 != framesToCluster.end(); ++frm1) { @@ -610,27 +614,36 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& { ndist++; // Populate the temp array + //double dist = Uncached_Frame_Distance(*frm1, *frm2); - // Do averages - for (unsigned int idx = 0; idx != temp_.size(); idx++) - mavg[idx].accumulate( temp_[idx] ); - // Do fractions + // Do individual contributions, adjusted for weights and distance type double sum = 0; if (type_ == MANHATTAN) { - for (unsigned int idx = 0; idx != temp_.size(); idx++) - sum += (weights_[idx] * temp_[idx]); - for (unsigned int idx = 0; idx != temp_.size(); idx++) - mfrac[idx] += (weights_[idx]*temp_[idx]) / sum; + for (unsigned int idx = 0; idx != temp_.size(); idx++) { + mcont[idx] = (weights_[idx] * temp_[idx]); + sum += mcont[idx]; + } } else if (type_ == EUCLID) { - for (unsigned int idx = 0; idx != temp_.size(); idx++) - sum += (weights_[idx] * (temp_[idx]*temp_[idx])); - for (unsigned int idx = 0; idx != temp_.size(); idx++) - mfrac[idx] += (weights_[idx] * (temp_[idx]*temp_[idx])) / sum; + for (unsigned int idx = 0; idx != temp_.size(); idx++) { + mcont[idx] = (weights_[idx] * (temp_[idx]*temp_[idx])); + sum += mcont[idx]; + } } else { // Sanity check mprinterr("Internal Error: CalculateMetricContributions: Unhandled metric summation.\n"); return; } + // Do fractions + for (unsigned int idx = 0; idx != temp_.size(); idx++) + mfrac[idx].accumulate( mcont[idx] / sum ); + // Do averages + //mprintf("DEBUG: %8i %8i %8.3f", *frm1 + 1, *frm2 + 1, dist); + for (unsigned int idx = 0; idx != temp_.size(); idx++) + { + mavg[idx].accumulate( temp_[idx] ); + //mprintf(" {%8.3f %8.3f}=%6.2f", temp_[idx], mcont[idx], mcont[idx] / sum); + } + //mprintf("\n"); } } /* @@ -642,10 +655,10 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& outfile.Printf(" %6.4f", *it / (double)ndist); outfile.Printf("\n"); */ - outfile.Printf("%-7s %6s %12s %12s %s\n", "#Metric", "Frac", "Avg", "SD", "Description"); + outfile.Printf("%-7s %6s %6s %12s %12s %s\n", "#Metric", "FracAv", "FracSD", "Avg", "SD", "Description"); for (unsigned int idx = 0; idx != mfrac.size(); idx++) { - outfile.Printf("%-7u %6.4f %12.4f %12.4f \"%s\"\n", idx, - mfrac[idx] / (double)ndist, + outfile.Printf("%-7u %6.4f %6.4f %12.4f %12.4f \"%s\"\n", idx, + mfrac[idx].mean(), sqrt(mfrac[idx].variance()), mavg[idx].mean(), sqrt(mavg[idx].variance()), metrics_[idx]->Description().c_str()); } From 750efe5e7bd9c3afd044dd9825a6b3b7b651ab24 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 11:15:54 -0400 Subject: [PATCH 407/417] Update for new format --- test/Test_Cluster_CoordsAndData/metricstats.dat.save | 5 +++-- test/Test_Cluster_DataSet/twods.metricstats.save | 5 +++-- test/Test_Cluster_DataSet/twodsm.metricstats.save | 5 +++-- test/Test_Cluster_DataSet/twodswgt.metricstats.save | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/Test_Cluster_CoordsAndData/metricstats.dat.save b/test/Test_Cluster_CoordsAndData/metricstats.dat.save index b6c13b23bb..e95c00bc7d 100644 --- a/test/Test_Cluster_CoordsAndData/metricstats.dat.save +++ b/test/Test_Cluster_CoordsAndData/metricstats.dat.save @@ -1,2 +1,3 @@ -# M00000 M00001 - 0.4912 0.5088 +#Metric FracAv FracSD Avg SD Description +0 0.4912 0.2786 5.3519 1.9783 "rms :1-12&!@H*" +1 0.5088 0.2786 7.0594 5.3447 "Data set DATA" diff --git a/test/Test_Cluster_DataSet/twods.metricstats.save b/test/Test_Cluster_DataSet/twods.metricstats.save index 6494811852..6f24ef488e 100644 --- a/test/Test_Cluster_DataSet/twods.metricstats.save +++ b/test/Test_Cluster_DataSet/twods.metricstats.save @@ -1,2 +1,3 @@ -# M00000 M00001 - 0.9324 0.0676 +#Metric FracAv FracSD Avg SD Description +0 0.9324 0.1867 7.0594 5.3447 "Data set d1" +1 0.0676 0.1867 0.4352 0.6127 "Data set hb1[UU]" diff --git a/test/Test_Cluster_DataSet/twodsm.metricstats.save b/test/Test_Cluster_DataSet/twodsm.metricstats.save index c67284cbe1..821c4e827b 100644 --- a/test/Test_Cluster_DataSet/twodsm.metricstats.save +++ b/test/Test_Cluster_DataSet/twodsm.metricstats.save @@ -1,2 +1,3 @@ -# M00000 M00001 - 0.9038 0.0962 +#Metric FracAv FracSD Avg SD Description +0 0.9038 0.1783 7.0594 5.3447 "Data set d1" +1 0.0962 0.1783 0.4352 0.6127 "Data set hb1[UU]" diff --git a/test/Test_Cluster_DataSet/twodswgt.metricstats.save b/test/Test_Cluster_DataSet/twodswgt.metricstats.save index 679e6826a8..01421a041d 100644 --- a/test/Test_Cluster_DataSet/twodswgt.metricstats.save +++ b/test/Test_Cluster_DataSet/twodswgt.metricstats.save @@ -1,2 +1,3 @@ -# M00000 M00001 - 0.8483 0.1517 +#Metric FracAv FracSD Avg SD Description +0 0.8483 0.2841 7.0594 5.3447 "Data set d1" +1 0.1517 0.2841 0.4352 0.6127 "Data set hb1[UU]" From 9e403429d76042a3bbe212898a804031f7b97d7a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 11:16:42 -0400 Subject: [PATCH 408/417] Update help text --- src/Cluster/Control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index aa16bc9656..49f51a2f8e 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -206,7 +206,7 @@ const char* Cpptraj::Cluster::Control::OutputArgs2_ = "[summarysplit ] [splitframe ]"; const char* Cpptraj::Cluster::Control::OutputArgs3_ = - "[clustersvtime [cvtwindow <#>]] [sil ] [metricstats]"; + "[clustersvtime [cvtwindow <#>]] [sil ] [metricstats ]"; const char* Cpptraj::Cluster::Control::OutputArgs4_ = "[cpopvtime [{normpop|normframe}]] [lifetime]"; From cc8f40045c8a50639c33a64f5c9c29b0410dea6d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 11:21:35 -0400 Subject: [PATCH 409/417] Update metricstats entry. --- doc/cpptraj.lyx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 459da58085..886da03fc3 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -40313,7 +40313,7 @@ cluster \end_layout \begin_layout LyX-Code - [clustersvtime [cvtwindow <#>]] [sil ] [metricstats] + [clustersvtime [cvtwindow <#>]] [sil ] [metricstats ] \end_layout \begin_layout LyX-Code @@ -40837,7 +40837,7 @@ wgt list. Can be used to adjust the contribution from each metric. Default is 1 for each metric. - The + Output from the \series bold metricstats \series default @@ -41303,24 +41303,32 @@ me.dat'. \end_layout \begin_layout Description -[metricstats] When more than one metric in use, print the fraction contribution +[metricstats +\begin_inset space ~ +\end_inset + +] When more than one metric in use, print the fraction contribution of each metric to the total distance. This information can be used in conjunction with the \series bold wgt \series default keyword to adjust the contribution of each metric to the total distance. - It is written to output with format: + It is written to with format: \begin_inset Newline newline \end_inset - +#Metric FracAv FracSD Avg SD Description \begin_inset Newline newline \end_inset -The output will occur just after clustering has started but before any pairwise - distances are cached. - This may be slow for large numbers of frames. +Where #Metric is the metric number, FracAv and FracSD are the average and + standard devation of the fraction contribution of that metric to the total + distance (taking into account distance type and weights), Avg and SD are + the average and standard devation of the unmodified distance from that + metric, and Description is the metric description. + This may be slow for large numbers of frames, so it is advisable to run + this on a smaller (potentially sieved) number of frames. \end_layout \begin_layout Description From a156451bd57be96a32b405d1d9fe91ad537d2ba4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 11:26:51 -0400 Subject: [PATCH 410/417] Update dependencies --- src/Cluster/clusterdepend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cluster/clusterdepend b/src/Cluster/clusterdepend index 3f386c3bc4..cf51e1e619 100644 --- a/src/Cluster/clusterdepend +++ b/src/Cluster/clusterdepend @@ -13,7 +13,7 @@ Control.o : Control.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../A DrawGraph.o : DrawGraph.cpp ../AssociatedData.h ../Atom.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../NameType.h ../PDBfile.h ../Parallel.h ../Range.h ../Residue.h ../SymbolExporting.h ../TextFormat.h ../Vec3.h Cframes.h DrawGraph.h Metric.h MetricArray.h DynamicMatrix.o : DynamicMatrix.cpp ../ArrayIterator.h ../CpptrajStdio.h ../Matrix.h DynamicMatrix.h List.o : List.cpp ../AssociatedData.h ../Constants.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_1D.h ../DataSet_integer.h ../Dimension.h ../FileIO.h ../FileName.h ../MetaData.h ../Parallel.h ../ProgressBar.h ../Range.h ../TextFormat.h CentroidArray.h Cframes.h List.h Metric.h MetricArray.h Node.h -MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Cluster/Cframes.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_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../ProgressBar.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h +MetricArray.o : MetricArray.cpp ../ArgList.h ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../BaseIOtype.h ../Box.h ../Cluster/Cframes.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_PairwiseCache.h ../Dimension.h ../FileIO.h ../FileName.h ../FileTypes.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../OnlineVarT.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../ProgressBar.h ../Range.h ../ReferenceFrame.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../StringRoutines.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Timer.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h CentroidArray.h Metric.h MetricArray.h Metric_DME.h Metric_RMS.h Metric_SRMSD.h Metric_Scalar.h Metric_Torsion.h Metric_DME.o : Metric_DME.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_DME.h Metric_RMS.o : Metric_RMS.cpp ../AssociatedData.h ../Atom.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.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 ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_RMS.h Metric_SRMSD.o : Metric_SRMSD.cpp ../ArrayIterator.h ../AssociatedData.h ../Atom.h ../AtomMap.h ../AtomMask.h ../AtomType.h ../Box.h ../Constants.h ../CoordinateInfo.h ../CpptrajFile.h ../CpptrajStdio.h ../DataSet.h ../DataSet_Coords.h ../Dimension.h ../FileIO.h ../FileName.h ../Frame.h ../Hungarian.h ../MapAtom.h ../MaskToken.h ../Matrix.h ../Matrix_3x3.h ../MetaData.h ../Molecule.h ../NameType.h ../Parallel.h ../ParameterHolders.h ../ParameterSet.h ../ParameterTypes.h ../Range.h ../ReplicaDimArray.h ../Residue.h ../Segment.h ../SymbolExporting.h ../SymmetricRmsdCalc.h ../TextFormat.h ../Topology.h ../TypeNameHolder.h ../Unit.h ../Vec3.h Centroid.h Centroid_Coord.h Cframes.h Metric.h Metric_SRMSD.h From b077218b0035344583249997c75ec7ed16516a94 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 11:31:21 -0400 Subject: [PATCH 411/417] Add some const --- src/Cluster/MetricArray.cpp | 7 +++++-- src/Cluster/MetricArray.h | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 8e73d09d15..9b591dd1e0 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -482,10 +482,10 @@ void Cpptraj::Cluster::MetricArray::Info() const { // ----------------------------------------------- /** Calculate new centroids for given list. */ void Cpptraj::Cluster::MetricArray::NewCentroid(CentroidArray& centroids, Cframes const& framesIn) -// TODO const? +const { centroids.Clear(); - for (std::vector::iterator it = metrics_.begin(); it != metrics_.end(); ++it) + for (std::vector::const_iterator it = metrics_.begin(); it != metrics_.end(); ++it) { centroids.push_back( (*it)->NewCentroid( framesIn ) ); } @@ -493,6 +493,7 @@ void Cpptraj::Cluster::MetricArray::NewCentroid(CentroidArray& centroids, Cframe /** Calculate centroids in given list. */ void Cpptraj::Cluster::MetricArray::CalculateCentroid(CentroidArray& centroids, Cframes const& framesIn) +const { if (centroids.size() != metrics_.size()) { mprinterr("Internal Error: MetricArray::CalculateCentroid: centroids and metrics_ sizes do not match.\n"); @@ -505,6 +506,7 @@ void Cpptraj::Cluster::MetricArray::CalculateCentroid(CentroidArray& centroids, /** Update centroids by performing given operation between given frame and centroids. */ void Cpptraj::Cluster::MetricArray::FrameOpCentroid(int f1, CentroidArray& centroids, double oldSize, Metric::CentOpType OP) +const { if (centroids.size() != metrics_.size()) { mprinterr("Internal Error: MetricArray::FrameOpCentroid: centroids and metrics_ sizes do not match.\n"); @@ -590,6 +592,7 @@ double Cpptraj::Cluster::MetricArray::Frame_Distance(int f1, int f2) { return Uncached_Frame_Distance(f1, f2); } +// ----------------------------------------------- /** Loop over all pairs. For each distance, evaluate the contribution * of each metric to the total distance (Manhattan). */ diff --git a/src/Cluster/MetricArray.h b/src/Cluster/MetricArray.h index 04aba02f0a..6d62f46f46 100644 --- a/src/Cluster/MetricArray.h +++ b/src/Cluster/MetricArray.h @@ -69,11 +69,11 @@ class MetricArray { DataSet_PairwiseCache const& Cache() const { return *cache_; } /// Calculate new centroid for each metric - void NewCentroid(CentroidArray&, Cframes const&); + void NewCentroid(CentroidArray&, Cframes const&) const; /// Calculate centroids for each metric - void CalculateCentroid(CentroidArray&, Cframes const&); + void CalculateCentroid(CentroidArray&, Cframes const&) const; /// Update centroids by performing given operation between given frame and centroids. - void FrameOpCentroid(int, CentroidArray&, double, Metric::CentOpType); + void FrameOpCentroid(int, CentroidArray&, double, Metric::CentOpType) const; /// \return distance between given frame and centroids double FrameCentroidDist(int, CentroidArray const&); /// \return distance between given centroids From 8f61cd79c66295db8ee46fc7695a3729b5ed8cd5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 12:13:27 -0400 Subject: [PATCH 412/417] Add some feedback for frameSelect_ var in Info() --- src/Cluster/Control.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index 49f51a2f8e..f788bb358a 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -467,7 +467,7 @@ int Cpptraj::Cluster::Control::SetupClustering(DataSetList const& setsToCluster, if (cnumvtime_ == 0) return 1; if (cnumvtimefile != 0) cnumvtimefile->AddDataSet( cnumvtime_ ); - // If cache was alloaced, add to the DataSetList so it is after cnumvtime for pytraj + // If cache was allocated, add to the DataSetList so it is after cnumvtime for pytraj if (metrics_.CacheWasAllocated()) DSL.AddSet( metrics_.CachePtr() ); @@ -536,14 +536,19 @@ void Cpptraj::Cluster::Control::Info() const { else mprintf("\tNo coordinates set provided for cluster results.\n"); - // TODO frameSelect - if (sieve_ > 1) - mprintf("\tInitial clustering sieve value is %i frames.\n", sieve_); - else if (sieve_ < -1) { - mprintf("\tInitial clustering will be randomly sieved (with value %i)", -sieve_); - if (sieveSeed_ > 0) mprintf(" using random seed %i", sieveSeed_); - mprintf(".\n"); + if (frameSelect_ == FROM_CACHE) { + mprintf("\tWill cluster frames present in existing pairwise cache '%s'\n", + metrics_.Cache().legend()); + } else { + if (sieve_ > 1) + mprintf("\tInitial clustering sieve value is %i frames.\n", sieve_); + else if (sieve_ < -1) { + mprintf("\tInitial clustering will be randomly sieved (with value %i)", -sieve_); + if (sieveSeed_ > 0) mprintf(" using random seed %i", sieveSeed_); + mprintf(".\n"); + } } + if (sieveRestore_ != NO_RESTORE) { mprintf("\tRestoring sieved frames"); if (sieveRestore_ == CLOSEST_CENTROID) From 1f7ee8ad93c01e72e931ad029b020f138eca9209 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Sep 2021 12:23:08 -0400 Subject: [PATCH 413/417] Fix up some of the descriptions. --- doc/cpptraj.lyx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 886da03fc3..be3e1a81b8 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -41570,7 +41570,12 @@ Cluster input frames using the specified input data sets (can be any combination algorithm. For COORDS sets, the distance metric can be RMSD, symmetry-corrected RMSD, or DME. - In order to speed up clustering of large trajectories, the + When multiple data sets are present, the total distance can be determined + either via the Euclidean (default) or Manhattan method. +\end_layout + +\begin_layout Standard +In order to speed up clustering of large trajectories, the \series bold sieve \series default @@ -41887,7 +41892,8 @@ The NetCDF pairwise matrix format \end_layout \begin_layout Standard -The default way to write pairwise matrix files is now with NetCDF. +The default way to write pairwise matrix files as of version 6.0.0 is with + NetCDF. This will be set up with the following parameters: \end_layout From 56a6a8578882561a06a75819b2ac9e68517cf65b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 17 Sep 2021 08:49:23 -0400 Subject: [PATCH 414/417] Add min and max distance contribution to metricstats calc --- src/Cluster/MetricArray.cpp | 47 +++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/src/Cluster/MetricArray.cpp b/src/Cluster/MetricArray.cpp index 9b591dd1e0..9d0636a0ca 100644 --- a/src/Cluster/MetricArray.cpp +++ b/src/Cluster/MetricArray.cpp @@ -1,4 +1,5 @@ #include "MetricArray.h" +#include // std::min,max #include //sqrt // For filling the pairwise cache #ifdef _OPENMP @@ -610,14 +611,19 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& std::vector> mavg( metrics_.size() ); // This array will hold each contribution, adjust for distance type and weight std::vector mcont( metrics_.size() ); - unsigned int ndist = 0; + // These arrays will record the minimum and maximum distance contributions + std::vector mmin; + std::vector mmax; +// mprintf("DEBUG: %8s %8s %8s %8s", "Frame1", "Frame2", "Distance", "Sum"); // DEBUG +// for (unsigned int idx = 0; idx != metrics_.size(); idx++) // DEBUG +// mprintf(" {%8s %8s %6s}", "Raw", "Adj.", "Frac"); // DEBUG +// mprintf("\n"); // DEBUG for (Cframes_it frm1 = framesToCluster.begin(); frm1 != framesToCluster.end(); ++frm1) { for (Cframes_it frm2 = frm1 + 1; frm2 != framesToCluster.end(); ++frm2) { - ndist++; // Populate the temp array - //double dist = + //double dist = Uncached_Frame_Distance(*frm1, *frm2); // DEBUG Uncached_Frame_Distance(*frm1, *frm2); // Do individual contributions, adjusted for weights and distance type double sum = 0; @@ -636,33 +642,38 @@ void Cpptraj::Cluster::MetricArray::CalculateMetricContributions(Cframes const& mprinterr("Internal Error: CalculateMetricContributions: Unhandled metric summation.\n"); return; } - // Do fractions + // Do fraction contributions for (unsigned int idx = 0; idx != temp_.size(); idx++) mfrac[idx].accumulate( mcont[idx] / sum ); + // Set initial min/max values + if (mmin.empty()) { + mmin.resize( metrics_.size() ); + mmax.resize( metrics_.size() ); + for (unsigned int idx = 0; idx != temp_.size(); idx++) { + mmin[idx] = temp_[idx]; + mmax[idx] = temp_[idx]; + } + } // Do averages - //mprintf("DEBUG: %8i %8i %8.3f", *frm1 + 1, *frm2 + 1, dist); + //mprintf("DEBUG: %8i %8i %8.3f %8.3f", *frm1 + 1, *frm2 + 1, dist, sum); // DEBUG for (unsigned int idx = 0; idx != temp_.size(); idx++) { mavg[idx].accumulate( temp_[idx] ); - //mprintf(" {%8.3f %8.3f}=%6.2f", temp_[idx], mcont[idx], mcont[idx] / sum); + mmin[idx] = std::min( temp_[idx], mmin[idx] ); + mmax[idx] = std::max( temp_[idx], mmax[idx] ); + //mprintf(" {%8.3f %8.3f %6.2f}", temp_[idx], mcont[idx], mcont[idx] / sum); // DEBUG } - //mprintf("\n"); + //mprintf("\n"); // DEBUG } } -/* - outfile.Printf("#"); - for (unsigned int idx = 0; idx != mfrac.size(); idx++) - outfile.Printf(" %1s%05i", "M", idx); - outfile.Printf("\n "); - for (std::vector::const_iterator it = mfrac.begin(); it != mfrac.end(); ++it) - outfile.Printf(" %6.4f", *it / (double)ndist); - outfile.Printf("\n"); -*/ - outfile.Printf("%-7s %6s %6s %12s %12s %s\n", "#Metric", "FracAv", "FracSD", "Avg", "SD", "Description"); + // Output + outfile.Printf("%-7s %6s %6s %12s %12s %12s %12s %s\n", + "#Metric", "FracAv", "FracSD", "Avg", "SD", "Min", "Max", "Description"); for (unsigned int idx = 0; idx != mfrac.size(); idx++) { - outfile.Printf("%-7u %6.4f %6.4f %12.4f %12.4f \"%s\"\n", idx, + outfile.Printf("%-7u %6.4f %6.4f %12.4f %12.4f %12.4f %12.4f \"%s\"\n", idx, mfrac[idx].mean(), sqrt(mfrac[idx].variance()), mavg[idx].mean(), sqrt(mavg[idx].variance()), + mmin[idx], mmax[idx], metrics_[idx]->Description().c_str()); } outfile.Flush(); From 73d77d259391214b159c036af9c22ecfe63f77a0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 17 Sep 2021 08:51:36 -0400 Subject: [PATCH 415/417] Min and max contributions now reported --- test/Test_Cluster_CoordsAndData/metricstats.dat.save | 6 +++--- test/Test_Cluster_DataSet/twods.metricstats.save | 6 +++--- test/Test_Cluster_DataSet/twodsm.metricstats.save | 6 +++--- test/Test_Cluster_DataSet/twodswgt.metricstats.save | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/Test_Cluster_CoordsAndData/metricstats.dat.save b/test/Test_Cluster_CoordsAndData/metricstats.dat.save index e95c00bc7d..f91d66ae61 100644 --- a/test/Test_Cluster_CoordsAndData/metricstats.dat.save +++ b/test/Test_Cluster_CoordsAndData/metricstats.dat.save @@ -1,3 +1,3 @@ -#Metric FracAv FracSD Avg SD Description -0 0.4912 0.2786 5.3519 1.9783 "rms :1-12&!@H*" -1 0.5088 0.2786 7.0594 5.3447 "Data set DATA" +#Metric FracAv FracSD Avg SD Min Max Description +0 0.4912 0.2786 5.3519 1.9783 1.0753 9.6914 "rms :1-12&!@H*" +1 0.5088 0.2786 7.0594 5.3447 0.0050 20.8420 "Data set DATA" diff --git a/test/Test_Cluster_DataSet/twods.metricstats.save b/test/Test_Cluster_DataSet/twods.metricstats.save index 6f24ef488e..29972bd9cd 100644 --- a/test/Test_Cluster_DataSet/twods.metricstats.save +++ b/test/Test_Cluster_DataSet/twods.metricstats.save @@ -1,3 +1,3 @@ -#Metric FracAv FracSD Avg SD Description -0 0.9324 0.1867 7.0594 5.3447 "Data set d1" -1 0.0676 0.1867 0.4352 0.6127 "Data set hb1[UU]" +#Metric FracAv FracSD Avg SD Min Max Description +0 0.9324 0.1867 7.0594 5.3447 0.0050 20.8420 "Data set d1" +1 0.0676 0.1867 0.4352 0.6127 0.0000 3.0000 "Data set hb1[UU]" diff --git a/test/Test_Cluster_DataSet/twodsm.metricstats.save b/test/Test_Cluster_DataSet/twodsm.metricstats.save index 821c4e827b..211379a8f6 100644 --- a/test/Test_Cluster_DataSet/twodsm.metricstats.save +++ b/test/Test_Cluster_DataSet/twodsm.metricstats.save @@ -1,3 +1,3 @@ -#Metric FracAv FracSD Avg SD Description -0 0.9038 0.1783 7.0594 5.3447 "Data set d1" -1 0.0962 0.1783 0.4352 0.6127 "Data set hb1[UU]" +#Metric FracAv FracSD Avg SD Min Max Description +0 0.9038 0.1783 7.0594 5.3447 0.0050 20.8420 "Data set d1" +1 0.0962 0.1783 0.4352 0.6127 0.0000 3.0000 "Data set hb1[UU]" diff --git a/test/Test_Cluster_DataSet/twodswgt.metricstats.save b/test/Test_Cluster_DataSet/twodswgt.metricstats.save index 01421a041d..8dab03784e 100644 --- a/test/Test_Cluster_DataSet/twodswgt.metricstats.save +++ b/test/Test_Cluster_DataSet/twodswgt.metricstats.save @@ -1,3 +1,3 @@ -#Metric FracAv FracSD Avg SD Description -0 0.8483 0.2841 7.0594 5.3447 "Data set d1" -1 0.1517 0.2841 0.4352 0.6127 "Data set hb1[UU]" +#Metric FracAv FracSD Avg SD Min Max Description +0 0.8483 0.2841 7.0594 5.3447 0.0050 20.8420 "Data set d1" +1 0.1517 0.2841 0.4352 0.6127 0.0000 3.0000 "Data set hb1[UU]" From 62e346a6504868171c6cc375bfb0c57fe0c2ac8d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 17 Sep 2021 08:53:55 -0400 Subject: [PATCH 416/417] Add Min and Max description to metricstats help entry --- doc/cpptraj.lyx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index be3e1a81b8..820f2b9c4e 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -41318,15 +41318,16 @@ wgt \begin_inset Newline newline \end_inset -#Metric FracAv FracSD Avg SD Description +#Metric FracAv FracSD Avg SD Min Max Description \begin_inset Newline newline \end_inset Where #Metric is the metric number, FracAv and FracSD are the average and standard devation of the fraction contribution of that metric to the total - distance (taking into account distance type and weights), Avg and SD are - the average and standard devation of the unmodified distance from that - metric, and Description is the metric description. + distance (taking into account distance type and weights), Avg, SD, Min, + and Max are the average, standard devation, minimum, and maximum of the + unmodified distance contribution from that metric, and Description is the + metric description. This may be slow for large numbers of frames, so it is advisable to run this on a smaller (potentially sieved) number of frames. \end_layout From d3a291dfcbc4fc316e4b3187f8fceb42060d33ea Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 17 Sep 2021 09:01:50 -0400 Subject: [PATCH 417/417] Improve help text. --- src/Cluster/Control.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Cluster/Control.cpp b/src/Cluster/Control.cpp index f788bb358a..c596b327f3 100644 --- a/src/Cluster/Control.cpp +++ b/src/Cluster/Control.cpp @@ -514,12 +514,15 @@ void Cpptraj::Cluster::Control::Help() { Results_Coords::Help(); mprintf(" Graph Args:\n"); mprintf("\t%s\n", GraphArgs_); - mprintf(" Cluster input frames using the specified clustering algorithm\n" - " and distance metric. In order to speed up clustering of large\n" - " trajectories, the 'sieve' keyword can be used. In addition,\n" - " subsequent clustering calculations can be sped up by\n" - " writing/reading calculated pair distances between each frame\n" - " to/from a file/DataSet specified by 'pairdist'.\n"); + mprintf(" Cluster the data from given input data set(s) (currently any combination\n" + " of COORDS and 1D sets are supported) using the specified clustering\n" + " algorithm. If any input sets are COORDS sets, the metric used to calculate\n" + " frame-frame distances can also be specified (default RMSD).\n" + " In order to speed up clustering of large sets, the 'sieve' keyword can be\n" + " used to cluster a subset of the data, after which the remaining frames\n" + " are added back in. In addition, subsequent clustering calculations can be\n" + " sped up by writing to/reading from a pair-wise distance cache file/DataSet\n" + " specified by 'pairdist'.\n"); } // -----------------------------------------------------------------------------