From 1dfe14a8227a9985cf358f7a8b2a117896c99f0e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 3 May 2021 10:41:50 -0400 Subject: [PATCH 01/48] Start PuckerToken class --- src/Pucker_PuckerToken.cpp | 5 +++++ src/Pucker_PuckerToken.h | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/Pucker_PuckerToken.cpp create mode 100644 src/Pucker_PuckerToken.h diff --git a/src/Pucker_PuckerToken.cpp b/src/Pucker_PuckerToken.cpp new file mode 100644 index 0000000000..883eb13e01 --- /dev/null +++ b/src/Pucker_PuckerToken.cpp @@ -0,0 +1,5 @@ +#include "Pucker_PuckerToken.h" + +using namespace Cpptraj; + +Pucker::PuckerToken::PuckerToken() {} diff --git a/src/Pucker_PuckerToken.h b/src/Pucker_PuckerToken.h new file mode 100644 index 0000000000..fd5f6a7e44 --- /dev/null +++ b/src/Pucker_PuckerToken.h @@ -0,0 +1,18 @@ +#ifndef INC_PUCKER_PUCKERTOKEN_H +#define INC_PUCKER_PUCKERTOKEN_H +#include +#include "NameType.h" +namespace Cpptraj { +namespace Pucker { +/// Used to search for atoms involved in puckering in a Topology +class PuckerToken { + public: + PuckerToken(); + + private: + typedef std::vector atomNames_; ///< Atoms that define the pucker. +}; + +} +} +#endif From 901e33286b5a0d15283af63c5a3f9c6b83881521 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 3 May 2021 10:44:19 -0400 Subject: [PATCH 02/48] Fix typedef --- src/Pucker_PuckerToken.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Pucker_PuckerToken.h b/src/Pucker_PuckerToken.h index fd5f6a7e44..e943d73b2d 100644 --- a/src/Pucker_PuckerToken.h +++ b/src/Pucker_PuckerToken.h @@ -9,8 +9,9 @@ class PuckerToken { public: PuckerToken(); + typedef std::vector NameArray; private: - typedef std::vector atomNames_; ///< Atoms that define the pucker. + NameArray atomNames_; ///< Atoms that define the pucker. }; } From 8435dfcb6ee41e4c04d5de926e45a5cf01487ed9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 3 May 2021 10:53:13 -0400 Subject: [PATCH 03/48] Start adding pucker search class --- src/Pucker_PuckerSearch.h | 20 ++++++++++++++++++++ src/Pucker_PuckerToken.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/Pucker_PuckerSearch.h diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h new file mode 100644 index 0000000000..de2729d71b --- /dev/null +++ b/src/Pucker_PuckerSearch.h @@ -0,0 +1,20 @@ +#ifndef INC_PUCKER_PUCKERSEARCH_H +#define INC_PUCKER_PUCKERSEARCH_H +namespace Cpptraj { +namespace Pucker { +// Forward declares +class PuckerToken; +/// Used to search for puckers in a Topology +class PuckerSearch { + public: + PuckerSearch(); + /// Search for any defined puckers in residue range in given Topology + int FindPuckers(Topology const&, Range const&); + private: + std::vector puckersToSearchFor_; ///< List of puckers to search for + std::vector foundPuckers_; ///< List of found puckers +}; + +} +} +#endif diff --git a/src/Pucker_PuckerToken.h b/src/Pucker_PuckerToken.h index e943d73b2d..2ae4f1634b 100644 --- a/src/Pucker_PuckerToken.h +++ b/src/Pucker_PuckerToken.h @@ -4,7 +4,7 @@ #include "NameType.h" namespace Cpptraj { namespace Pucker { -/// Used to search for atoms involved in puckering in a Topology +/// Used to define atoms involved in puckering class PuckerToken { public: PuckerToken(); From 9b93b6755b10b528e74202dc3baaff5f7a6adbf3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 3 May 2021 13:53:23 -0400 Subject: [PATCH 04/48] Add PuckerMask --- src/Pucker_PuckerMask.cpp | 5 +++++ src/Pucker_PuckerMask.h | 16 ++++++++++++++++ src/Pucker_PuckerSearch.cpp | 5 +++++ src/Pucker_PuckerSearch.h | 5 +++++ 4 files changed, 31 insertions(+) create mode 100644 src/Pucker_PuckerMask.cpp create mode 100644 src/Pucker_PuckerMask.h create mode 100644 src/Pucker_PuckerSearch.cpp diff --git a/src/Pucker_PuckerMask.cpp b/src/Pucker_PuckerMask.cpp new file mode 100644 index 0000000000..11ce52e288 --- /dev/null +++ b/src/Pucker_PuckerMask.cpp @@ -0,0 +1,5 @@ +#include "Pucker_PuckerMask.h" + +using namespace Cpptraj; + +Pucker::PuckerMask::PuckerMask() {} diff --git a/src/Pucker_PuckerMask.h b/src/Pucker_PuckerMask.h new file mode 100644 index 0000000000..095a5b5261 --- /dev/null +++ b/src/Pucker_PuckerMask.h @@ -0,0 +1,16 @@ +#ifndef INC_PUCKER_PUCKERMASK_H +#define INC_PUCKER_PUCKERMASK_H +#include +namespace Cpptraj { +namespace Pucker { +/// Used to define found puckers in Topology +class PuckerMask { + public: + PuckerMask(); + private: + std::vector atoms_; ///< Hold atom indices defining pucker +}; + +} +} +#endif diff --git a/src/Pucker_PuckerSearch.cpp b/src/Pucker_PuckerSearch.cpp new file mode 100644 index 0000000000..7f1ecbd2a2 --- /dev/null +++ b/src/Pucker_PuckerSearch.cpp @@ -0,0 +1,5 @@ +#include "Pucker_PuckerSearch.h" + +using namespace Cpptraj; + +Pucker::PuckerSearch::PuckerSearch() {} diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h index de2729d71b..d1d6ebbb05 100644 --- a/src/Pucker_PuckerSearch.h +++ b/src/Pucker_PuckerSearch.h @@ -1,5 +1,10 @@ #ifndef INC_PUCKER_PUCKERSEARCH_H #define INC_PUCKER_PUCKERSEARCH_H +#include +#include "Pucker_PuckerToken.h" +#include "Pucker_PuckerMask.h" +class Range; +class Topology; namespace Cpptraj { namespace Pucker { // Forward declares From a27dd59a633704e57b2927ccd9f164c44e7fd6c0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 3 May 2021 14:14:28 -0400 Subject: [PATCH 05/48] Add some pucker types --- src/Pucker.h | 12 ++++++++++++ src/Pucker_PuckerSearch.cpp | 35 +++++++++++++++++++++++++++++++++++ src/Pucker_PuckerSearch.h | 3 +++ src/Pucker_PuckerToken.cpp | 4 ++++ src/Pucker_PuckerToken.h | 2 +- 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/Pucker.h diff --git a/src/Pucker.h b/src/Pucker.h new file mode 100644 index 0000000000..d915f8fe3f --- /dev/null +++ b/src/Pucker.h @@ -0,0 +1,12 @@ +#ifndef INC_PUCKER_H +#define INC_PUCKER_H +namespace Cpptraj { +namespace Pucker { + +enum Type { NUCLEIC = 0, FURANOSE, PYRANOSE }; + +enum Method { ALTONA_SUNDARALINGAM = 0, CREMER_POPLE }; + +} +} +#endif diff --git a/src/Pucker_PuckerSearch.cpp b/src/Pucker_PuckerSearch.cpp index 7f1ecbd2a2..4d7e6a6e95 100644 --- a/src/Pucker_PuckerSearch.cpp +++ b/src/Pucker_PuckerSearch.cpp @@ -1,5 +1,40 @@ #include "Pucker_PuckerSearch.h" +#include "CpptrajStdio.h" using namespace Cpptraj; Pucker::PuckerSearch::PuckerSearch() {} + +/** Indicate we want to search for the specified pre-defined pucker. */ +int Pucker::PuckerSearch::SearchFor(Type ptype) { + PuckerToken::NameArray names; + if (ptype == NUCLEIC) { + // Amber nucleic acid + names.push_back("C1'"); + names.push_back("C2'"); + names.push_back("C3'"); + names.push_back("C4'"); + names.push_back("O4'"); + } else if (ptype == FURANOSE) { + // Glycam furanose + names.push_back("C1"); + names.push_back("C2"); + names.push_back("C3"); + names.push_back("C4"); + names.push_back("O4"); + } else if (ptype == PYRANOSE) { + names.push_back("C1"); + names.push_back("C2"); + names.push_back("C3"); + names.push_back("C4"); + names.push_back("C5"); + names.push_back("O5"); + } else { + mprinterr("Internal Error: PuckerSearch::SearchFor(): Unhandled pucker type.\n"); + return 1; + } + puckersToSearchFor_.push_back( PuckerToken(names) ); + return 0; +} + + diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h index d1d6ebbb05..928e7f671a 100644 --- a/src/Pucker_PuckerSearch.h +++ b/src/Pucker_PuckerSearch.h @@ -3,6 +3,7 @@ #include #include "Pucker_PuckerToken.h" #include "Pucker_PuckerMask.h" +#include "Pucker.h" class Range; class Topology; namespace Cpptraj { @@ -15,6 +16,8 @@ class PuckerSearch { PuckerSearch(); /// Search for any defined puckers in residue range in given Topology int FindPuckers(Topology const&, Range const&); + /// Indicate we want to search for the given pre-defined type + int SearchFor(Type); private: std::vector puckersToSearchFor_; ///< List of puckers to search for std::vector foundPuckers_; ///< List of found puckers diff --git a/src/Pucker_PuckerToken.cpp b/src/Pucker_PuckerToken.cpp index 883eb13e01..8e4d160d29 100644 --- a/src/Pucker_PuckerToken.cpp +++ b/src/Pucker_PuckerToken.cpp @@ -3,3 +3,7 @@ using namespace Cpptraj; Pucker::PuckerToken::PuckerToken() {} + +Pucker::PuckerToken::PuckerToken(NameArray const& namesIn) : + atomNames_(namesIn) +{} diff --git a/src/Pucker_PuckerToken.h b/src/Pucker_PuckerToken.h index 2ae4f1634b..64c09eac62 100644 --- a/src/Pucker_PuckerToken.h +++ b/src/Pucker_PuckerToken.h @@ -8,8 +8,8 @@ namespace Pucker { class PuckerToken { public: PuckerToken(); - typedef std::vector NameArray; + PuckerToken(NameArray const&); private: NameArray atomNames_; ///< Atoms that define the pucker. }; From d23d282cd445a2729be3535c632726b00a66eda7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 3 May 2021 15:17:23 -0400 Subject: [PATCH 06/48] Start doing the find pucker routine --- src/Pucker_PuckerMask.cpp | 4 ++++ src/Pucker_PuckerMask.h | 2 ++ src/Pucker_PuckerToken.cpp | 41 ++++++++++++++++++++++++++++++++++++++ src/Pucker_PuckerToken.h | 7 +++++++ src/cpptrajdepend | 3 +++ src/cpptrajfiles | 3 +++ 6 files changed, 60 insertions(+) diff --git a/src/Pucker_PuckerMask.cpp b/src/Pucker_PuckerMask.cpp index 11ce52e288..e113cf679d 100644 --- a/src/Pucker_PuckerMask.cpp +++ b/src/Pucker_PuckerMask.cpp @@ -3,3 +3,7 @@ using namespace Cpptraj; Pucker::PuckerMask::PuckerMask() {} + +Pucker::PuckerMask::PuckerMask(std::vector const& atomsIn) : + atoms_(atomsIn) +{} diff --git a/src/Pucker_PuckerMask.h b/src/Pucker_PuckerMask.h index 095a5b5261..b2636c9b49 100644 --- a/src/Pucker_PuckerMask.h +++ b/src/Pucker_PuckerMask.h @@ -7,6 +7,8 @@ namespace Pucker { class PuckerMask { public: PuckerMask(); + + PuckerMask(std::vector const&); private: std::vector atoms_; ///< Hold atom indices defining pucker }; diff --git a/src/Pucker_PuckerToken.cpp b/src/Pucker_PuckerToken.cpp index 8e4d160d29..4d17856d87 100644 --- a/src/Pucker_PuckerToken.cpp +++ b/src/Pucker_PuckerToken.cpp @@ -1,4 +1,6 @@ #include "Pucker_PuckerToken.h" +#include "Topology.h" +#include "Pucker_PuckerMask.h" using namespace Cpptraj; @@ -7,3 +9,42 @@ Pucker::PuckerToken::PuckerToken() {} Pucker::PuckerToken::PuckerToken(NameArray const& namesIn) : atomNames_(namesIn) {} + +/** Recursive function for finding pucker atoms. */ +void Pucker::PuckerToken::FindAtoms(Topology const& topIn, int at, + unsigned int idx, unsigned int maxidx, std::vector& indices) +const +{ + if (idx >= maxidx) return; + + for (Atom::bond_iterator it = topIn[at].bondbegin(); it != topIn[at].bondend(); ++it) + { + if (topIn[*it].Name() == atomNames_[idx]) { + indices[idx] = *it; + + FindAtoms( topIn, *it, idx+1, maxidx, indices ); + } + } +} + +/** \return PuckerMask containing indices of this pucker found in specified residue. + */ +Pucker::PuckerMask Pucker::PuckerToken::FindPuckerAtoms(Topology const& topIn, int resnum) +const +{ + Residue const& currentRes = topIn.Res( resnum ); + + std::vector indices(atomNames_.size(), -1); + + // Find the first atom + for (int at = currentRes.FirstAtom(); at != currentRes.LastAtom(); ++at) + { + if (topIn[at].Name() == atomNames_.front()) { + indices[0] = at; + + FindAtoms( topIn, at, 1, atomNames_.size(), indices ); + break; + } + } + return PuckerMask( indices ); +} diff --git a/src/Pucker_PuckerToken.h b/src/Pucker_PuckerToken.h index 64c09eac62..e935c4c164 100644 --- a/src/Pucker_PuckerToken.h +++ b/src/Pucker_PuckerToken.h @@ -2,15 +2,22 @@ #define INC_PUCKER_PUCKERTOKEN_H #include #include "NameType.h" +// Forward declares +class Topology; namespace Cpptraj { namespace Pucker { +class PuckerMask; /// Used to define atoms involved in puckering class PuckerToken { public: PuckerToken(); typedef std::vector NameArray; PuckerToken(NameArray const&); + + PuckerMask FindPuckerAtoms(Topology const&, int) const; private: + void FindAtoms(Topology const&, int, unsigned int, unsigned int, std::vector&) const; + NameArray atomNames_; ///< Atoms that define the pucker. }; diff --git a/src/cpptrajdepend b/src/cpptrajdepend index f623aa071a..9cdabd67f0 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -363,6 +363,9 @@ PotentialTerm_OpenMM.o : PotentialTerm_OpenMM.cpp Atom.h AtomMask.h AtomType.h B ProgressBar.o : ProgressBar.cpp CpptrajStdio.h ProgressBar.h ProgressTimer.o : ProgressTimer.cpp CpptrajStdio.h ProgressTimer.h Timer.h PubFFT.o : PubFFT.cpp ArrayIterator.h ComplexArray.h CpptrajStdio.h PubFFT.h +Pucker_PuckerMask.o : Pucker_PuckerMask.cpp Pucker_PuckerMask.h +Pucker_PuckerSearch.o : Pucker_PuckerSearch.cpp CpptrajStdio.h NameType.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h +Pucker_PuckerToken.o : Pucker_PuckerToken.cpp Atom.h AtomMask.h AtomType.h Box.h Constants.h CoordinateInfo.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Pucker_PuckerMask.h Pucker_PuckerToken.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h RNG.o : RNG.cpp CpptrajStdio.h RNG.h RNG_Marsaglia.o : RNG_Marsaglia.cpp CpptrajStdio.h RNG.h RNG_Marsaglia.h RNG_MersenneTwister.o : RNG_MersenneTwister.cpp CpptrajStdio.h RNG.h RNG_MersenneTwister.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index e93dcd8f41..9a0c8921fa 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -362,6 +362,9 @@ COMMON_SOURCES= \ ProgressBar.cpp \ ProgressTimer.cpp \ PubFFT.cpp \ + Pucker_PuckerMask.cpp \ + Pucker_PuckerSearch.cpp \ + Pucker_PuckerToken.cpp \ ExternalFxn.cpp \ Random.cpp \ Range.cpp \ From 93e26a04fd50c00d355131fa21d75fe89b0f5d56 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 10 May 2021 13:24:02 -0400 Subject: [PATCH 07/48] Start the multipucker action --- src/Action_MultiPucker.cpp | 25 +++++++++++++++++++++++++ src/Action_MultiPucker.h | 19 +++++++++++++++++++ src/cpptrajdepend | 1 + src/cpptrajfiles | 1 + 4 files changed, 46 insertions(+) create mode 100644 src/Action_MultiPucker.cpp create mode 100644 src/Action_MultiPucker.h diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp new file mode 100644 index 0000000000..979966c19e --- /dev/null +++ b/src/Action_MultiPucker.cpp @@ -0,0 +1,25 @@ +#include "Action_MultiPucker.h" +#include "CpptrajStdio.h" + +// Action_MultiPucker::Help() +void Action_MultiPucker::Help() const { + +} + +// Action_MultiPucker::Init() +Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, int debugIn) +{ + +} + +// Action_MultiPucker::Setup() +Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) +{ + +} + +// Action_MultiPucker::DoAction() +Action::RetType Action_MultiPucker::DoAction(int frameNum, ActionFrame& frm) +{ + +} diff --git a/src/Action_MultiPucker.h b/src/Action_MultiPucker.h new file mode 100644 index 0000000000..29ed796d6f --- /dev/null +++ b/src/Action_MultiPucker.h @@ -0,0 +1,19 @@ +#ifndef INC_ACTION_MULTIPUCKER_H +#define INC_ACTION_MULTIPUCKER_H +#include "Action.h" +#include "Pucker_PuckerSearch.h" +/// Automatically detect and calculate puckers within a residue range. +class Action_MultiPucker : public Action { + public: + Action_MultiPucker() {} + DispatchObject* Alloc() const { return (DispatchObject*)new Action_MultiPucker(); } + void Help() const; + private: + Action::RetType Init(ArgList&, ActionInit&, int); + Action::RetType Setup(ActionSetup&); + Action::RetType DoAction(int, ActionFrame&); + void Print() {} + + Cpptraj::Pucker::PuckerSearch puckerSearch_; +}; +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 9cdabd67f0..aa2bbeba35 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -50,6 +50,7 @@ Action_Matrix.o : Action_Matrix.cpp Action.h ActionFrameCounter.h ActionState.h Action_MinImage.o : Action_MinImage.cpp Action.h ActionState.h Action_MinImage.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Action_Molsurf.o : Action_Molsurf.cpp Action.h ActionState.h Action_Molsurf.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 molsurf.h Action_MultiDihedral.o : Action_MultiDihedral.cpp Action.h ActionState.h Action_MultiDihedral.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 DihedralSearch.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 TorsionRoutines.h TypeNameHolder.h Unit.h Vec3.h +Action_MultiPucker.o : Action_MultiPucker.cpp Action.h ActionState.h Action_MultiPucker.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 Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.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_MultiVector.o : Action_MultiVector.cpp Action.h ActionState.h Action_MultiVector.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_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 Action_NAstruct.o : Action_NAstruct.cpp Action.h ActionState.h Action_NAstruct.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h AxisType.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 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 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 Action_NMRrst.o : Action_NMRrst.cpp Action.h ActionState.h Action_NMRrst.h ArgList.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedLine.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_double.h DataSet_float.h Dimension.h DispatchObject.h DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.h ImageOption.h MapAtom.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 ViewRst.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index 9a0c8921fa..d2c4f63969 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -53,6 +53,7 @@ COMMON_SOURCES= \ Action_MinImage.cpp \ Action_Molsurf.cpp \ Action_MultiDihedral.cpp \ + Action_MultiPucker.cpp \ Action_MultiVector.cpp \ Action_NAstruct.cpp \ Action_NativeContacts.cpp \ From e6489f1a7d1dc9ae9722ed9fd55adf9c4006e5c7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 10 May 2021 13:59:26 -0400 Subject: [PATCH 08/48] Add name to pucker token --- src/Pucker_PuckerToken.cpp | 4 ++-- src/Pucker_PuckerToken.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Pucker_PuckerToken.cpp b/src/Pucker_PuckerToken.cpp index 4d17856d87..18592fadbe 100644 --- a/src/Pucker_PuckerToken.cpp +++ b/src/Pucker_PuckerToken.cpp @@ -6,8 +6,8 @@ using namespace Cpptraj; Pucker::PuckerToken::PuckerToken() {} -Pucker::PuckerToken::PuckerToken(NameArray const& namesIn) : - atomNames_(namesIn) +Pucker::PuckerToken::PuckerToken(std::string const& nameIn, NameArray const& anamesIn) : + name_(nameIn), atomNames_(anamesIn) {} /** Recursive function for finding pucker atoms. */ diff --git a/src/Pucker_PuckerToken.h b/src/Pucker_PuckerToken.h index e935c4c164..e39cde826f 100644 --- a/src/Pucker_PuckerToken.h +++ b/src/Pucker_PuckerToken.h @@ -12,12 +12,14 @@ class PuckerToken { public: PuckerToken(); typedef std::vector NameArray; - PuckerToken(NameArray const&); + /// CONSTRUCTOR - take name and array of atom names + PuckerToken(std::string const&, NameArray const&); PuckerMask FindPuckerAtoms(Topology const&, int) const; private: void FindAtoms(Topology const&, int, unsigned int, unsigned int, std::vector&) const; + std::string name_; ///< Pucker name. NameArray atomNames_; ///< Atoms that define the pucker. }; From a2b94fc21946f50521bd010b37a4531c471cd70b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 10 May 2021 14:10:41 -0400 Subject: [PATCH 09/48] Add ability to define custom types --- src/Pucker.h | 2 +- src/Pucker_PuckerSearch.cpp | 52 ++++++++++++++++++++++++++++++++++++- src/Pucker_PuckerSearch.h | 9 +++++++ src/Pucker_PuckerToken.h | 2 ++ 4 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/Pucker.h b/src/Pucker.h index d915f8fe3f..ff70141784 100644 --- a/src/Pucker.h +++ b/src/Pucker.h @@ -3,7 +3,7 @@ namespace Cpptraj { namespace Pucker { -enum Type { NUCLEIC = 0, FURANOSE, PYRANOSE }; +enum Type { NUCLEIC = 0, FURANOSE, PYRANOSE, NTYPES }; enum Method { ALTONA_SUNDARALINGAM = 0, CREMER_POPLE }; diff --git a/src/Pucker_PuckerSearch.cpp b/src/Pucker_PuckerSearch.cpp index 4d7e6a6e95..f00640c2ab 100644 --- a/src/Pucker_PuckerSearch.cpp +++ b/src/Pucker_PuckerSearch.cpp @@ -1,10 +1,18 @@ #include "Pucker_PuckerSearch.h" #include "CpptrajStdio.h" +#include "ArgList.h" using namespace Cpptraj; Pucker::PuckerSearch::PuckerSearch() {} +/** Recognized pucker keywords. */ +const char* Pucker::PuckerSearch::Keywords_[] = { + "nucleic", // NUCLEIC + "furanose", // FURANOSE + "pyranose" // PYRANOSE +}; + /** Indicate we want to search for the specified pre-defined pucker. */ int Pucker::PuckerSearch::SearchFor(Type ptype) { PuckerToken::NameArray names; @@ -33,8 +41,50 @@ int Pucker::PuckerSearch::SearchFor(Type ptype) { mprinterr("Internal Error: PuckerSearch::SearchFor(): Unhandled pucker type.\n"); return 1; } - puckersToSearchFor_.push_back( PuckerToken(names) ); + puckersToSearchFor_.push_back( PuckerToken(Keywords_[ptype], names) ); + return 0; +} + +/** See if ArgList has any recognized pucker type keywords. */ +int Pucker::PuckerSearch::SearchForArgs(ArgList& argIn) { + for (int i = 0; i != (int)NTYPES; i++) { + if (argIn.hasKey( Keywords_[i] )) + SearchFor( (Type)i ); + } return 0; } +/** Define a custom pucker argument from ArgList: + * 'puckertype ::...:' + */ +int Pucker::PuckerSearch::SearchForNewTypeArgs(ArgList& argIn) { + std::string puckertype_arg = argIn.GetStringKey("puckertype"); + while (!puckertype_arg.empty()) { + ArgList puckertype(puckertype_arg, ":"); + if (puckertype.Nargs() < 6) { + mprinterr("Error: Malformed puckertype arg '%s': expected at least 6 args, got %i\n", + puckertype_arg.c_str(), puckertype.Nargs()); + return 1; + } + PuckerToken::NameArray atomNames; + atomNames.reserve(puckertype.Nargs()-1); + for (int iarg = 1; iarg != puckertype.Nargs(); iarg++) + atomNames.push_back( puckertype[iarg] ); + SearchForNewType(puckertype[0], atomNames); + puckertype_arg = argIn.GetStringKey("puckertype"); + } + return 0; +} +/** Define a custom pucker */ +int Pucker::PuckerSearch::SearchForNewType(std::string const& name, PuckerToken::NameArray const& atomNames) +{ + for (std::vector::const_iterator tkn = puckersToSearchFor_.begin(); + tkn != puckersToSearchFor_.end(); ++tkn) + if (tkn->Name() == name) { + mprintf("Warning: Pucker type %s already defined.\n", name.c_str()); + return 1; + } + puckersToSearchFor_.push_back( PuckerToken(name, atomNames) ); + return 0; +} diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h index 928e7f671a..a28224952a 100644 --- a/src/Pucker_PuckerSearch.h +++ b/src/Pucker_PuckerSearch.h @@ -6,6 +6,7 @@ #include "Pucker.h" class Range; class Topology; +class ArgList; namespace Cpptraj { namespace Pucker { // Forward declares @@ -18,7 +19,15 @@ class PuckerSearch { int FindPuckers(Topology const&, Range const&); /// Indicate we want to search for the given pre-defined type int SearchFor(Type); + /// Look at ArgList for recognized pucker keywords + int SearchForArgs(ArgList&); + /// Search for new types defined in ArgList + int SearchForNewTypeArgs(ArgList&); private: + static const char* Keywords_[]; ///< Keywords corresponding to Pucker::Type + /// Define a new custom pucker type + int SearchForNewType(std::string const&, PuckerToken::NameArray const&); + std::vector puckersToSearchFor_; ///< List of puckers to search for std::vector foundPuckers_; ///< List of found puckers }; diff --git a/src/Pucker_PuckerToken.h b/src/Pucker_PuckerToken.h index e39cde826f..7fd6dd630e 100644 --- a/src/Pucker_PuckerToken.h +++ b/src/Pucker_PuckerToken.h @@ -14,6 +14,8 @@ class PuckerToken { typedef std::vector NameArray; /// CONSTRUCTOR - take name and array of atom names PuckerToken(std::string const&, NameArray const&); + /// \return pucker token name + std::string const& Name() const { return name_; } PuckerMask FindPuckerAtoms(Topology const&, int) const; private: From 95a5f5ff923b076e3f316192789baf31ff5c7916 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 10 May 2021 14:24:24 -0400 Subject: [PATCH 10/48] Add Search for all --- src/Pucker_PuckerSearch.cpp | 8 ++++++++ src/Pucker_PuckerSearch.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/Pucker_PuckerSearch.cpp b/src/Pucker_PuckerSearch.cpp index f00640c2ab..597d3954d2 100644 --- a/src/Pucker_PuckerSearch.cpp +++ b/src/Pucker_PuckerSearch.cpp @@ -88,3 +88,11 @@ int Pucker::PuckerSearch::SearchForNewType(std::string const& name, PuckerToken: puckersToSearchFor_.push_back( PuckerToken(name, atomNames) ); return 0; } + +/** If no puckers selected yet, select all. */ +int Pucker::PuckerSearch::SearchForAll() { + if (!puckersToSearchFor_.empty()) return 0; + for (int ptype = 0; ptype != (int)NTYPES; ptype++) + SearchFor( (Type)ptype ); + return 0; +} diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h index a28224952a..ba12d93537 100644 --- a/src/Pucker_PuckerSearch.h +++ b/src/Pucker_PuckerSearch.h @@ -23,6 +23,8 @@ class PuckerSearch { int SearchForArgs(ArgList&); /// Search for new types defined in ArgList int SearchForNewTypeArgs(ArgList&); + /// Search for all types if no types yet defined + int SearchForAll(); private: static const char* Keywords_[]; ///< Keywords corresponding to Pucker::Type /// Define a new custom pucker type From 7fe7584748c68bf90c7c1d43554a1f23b396ab57 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 10 May 2021 14:33:50 -0400 Subject: [PATCH 11/48] Finish up init --- src/Action_MultiPucker.cpp | 37 ++++++++++++++++++++++++++++++++++++- src/Action_MultiPucker.h | 7 ++++++- src/Pucker_PuckerSearch.cpp | 7 +++++++ src/Pucker_PuckerSearch.h | 2 ++ src/cpptrajdepend | 2 +- 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 979966c19e..c2d64c7343 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -1,6 +1,11 @@ #include "Action_MultiPucker.h" #include "CpptrajStdio.h" +Action_MultiPucker::Action_MultiPucker() : + outfile_(0), + masterDSL_(0) +{} + // Action_MultiPucker::Help() void Action_MultiPucker::Help() const { @@ -9,7 +14,37 @@ void Action_MultiPucker::Help() const { // Action_MultiPucker::Init() Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, int debugIn) { - + // Get Keywords + outfile_ = init.DFL().AddDataFile( actionArgs.GetStringKey("out"), actionArgs); + std::string resrange_arg = actionArgs.GetStringKey("resrange"); + if (!resrange_arg.empty()) + if (resRange_.SetRange( resrange_arg )) return Action::ERR; + // Search for known pucker keywords + if (puckerSearch_.SearchForArgs( actionArgs )) return Action::ERR; + // Get custom pucker args + if (puckerSearch_.SearchForNewTypeArgs( actionArgs )) return Action::ERR; + // If no pucker types are yet selected, this will select all. + puckerSearch_.SearchForAll(); + + // Setup DataSet(s) name + dsetname_ = actionArgs.GetStringNext(); + + mprintf(" MULTIPUCKER: Calculating"); + puckerSearch_.PrintTypes(); + if (!resRange_.Empty()) + mprintf(" puckers for residues in range %s\n", resRange_.RangeArg()); + else + mprintf(" puckers for all solute residues.\n"); + if (!dsetname_.empty()) + mprintf("\tDataSet name: %s\n", dsetname_.c_str()); + if (outfile_ != 0) mprintf("\tOutput to %s\n", outfile_->DataFilename().base()); + //if (minTorsion_ > -180.0) + // mprintf("\tOutput range is 0 to 360 degrees.\n"); + //else + // mprintf("\tOutput range is -180 to 180 degrees.\n"); + init.DSL().SetDataSetsPending(true); + masterDSL_ = init.DslPtr(); + return Action::OK; } // Action_MultiPucker::Setup() diff --git a/src/Action_MultiPucker.h b/src/Action_MultiPucker.h index 29ed796d6f..787a1c0266 100644 --- a/src/Action_MultiPucker.h +++ b/src/Action_MultiPucker.h @@ -2,10 +2,11 @@ #define INC_ACTION_MULTIPUCKER_H #include "Action.h" #include "Pucker_PuckerSearch.h" +#include "Range.h" /// Automatically detect and calculate puckers within a residue range. class Action_MultiPucker : public Action { public: - Action_MultiPucker() {} + Action_MultiPucker(); DispatchObject* Alloc() const { return (DispatchObject*)new Action_MultiPucker(); } void Help() const; private: @@ -15,5 +16,9 @@ class Action_MultiPucker : public Action { void Print() {} Cpptraj::Pucker::PuckerSearch puckerSearch_; + Range resRange_; + std::string dsetname_; + DataFile* outfile_; + DataSetList* masterDSL_; }; #endif diff --git a/src/Pucker_PuckerSearch.cpp b/src/Pucker_PuckerSearch.cpp index 597d3954d2..0760dd3cff 100644 --- a/src/Pucker_PuckerSearch.cpp +++ b/src/Pucker_PuckerSearch.cpp @@ -96,3 +96,10 @@ int Pucker::PuckerSearch::SearchForAll() { SearchFor( (Type)ptype ); return 0; } + +/** Print all set up types to stdout. */ +void Pucker::PuckerSearch::PrintTypes() const { + for (std::vector::const_iterator it = puckersToSearchFor_.begin(); + it != puckersToSearchFor_.end(); ++it) + mprintf(" %s", it->Name().c_str()); +} diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h index ba12d93537..1a3d093310 100644 --- a/src/Pucker_PuckerSearch.h +++ b/src/Pucker_PuckerSearch.h @@ -25,6 +25,8 @@ class PuckerSearch { int SearchForNewTypeArgs(ArgList&); /// Search for all types if no types yet defined int SearchForAll(); + /// Print types to search for to stdout + void PrintTypes() const; private: static const char* Keywords_[]; ///< Keywords corresponding to Pucker::Type /// Define a new custom pucker type diff --git a/src/cpptrajdepend b/src/cpptrajdepend index aa2bbeba35..f1f1e5f5c7 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -365,7 +365,7 @@ ProgressBar.o : ProgressBar.cpp CpptrajStdio.h ProgressBar.h ProgressTimer.o : ProgressTimer.cpp CpptrajStdio.h ProgressTimer.h Timer.h PubFFT.o : PubFFT.cpp ArrayIterator.h ComplexArray.h CpptrajStdio.h PubFFT.h Pucker_PuckerMask.o : Pucker_PuckerMask.cpp Pucker_PuckerMask.h -Pucker_PuckerSearch.o : Pucker_PuckerSearch.cpp CpptrajStdio.h NameType.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h +Pucker_PuckerSearch.o : Pucker_PuckerSearch.cpp ArgList.h CpptrajStdio.h NameType.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h Pucker_PuckerToken.o : Pucker_PuckerToken.cpp Atom.h AtomMask.h AtomType.h Box.h Constants.h CoordinateInfo.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Pucker_PuckerMask.h Pucker_PuckerToken.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h RNG.o : RNG.cpp CpptrajStdio.h RNG.h RNG_Marsaglia.o : RNG_Marsaglia.cpp CpptrajStdio.h RNG.h RNG_Marsaglia.h From e60d91c66465f2b16928fbbcbcb1c1679b6250c0 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 10 May 2021 15:18:43 -0400 Subject: [PATCH 12/48] Ensure found pucker is a cycle --- src/Pucker_PuckerToken.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/Pucker_PuckerToken.cpp b/src/Pucker_PuckerToken.cpp index 18592fadbe..9f095ce564 100644 --- a/src/Pucker_PuckerToken.cpp +++ b/src/Pucker_PuckerToken.cpp @@ -1,6 +1,7 @@ #include "Pucker_PuckerToken.h" #include "Topology.h" #include "Pucker_PuckerMask.h" +#include "CpptrajStdio.h" using namespace Cpptraj; @@ -15,7 +16,17 @@ void Pucker::PuckerToken::FindAtoms(Topology const& topIn, int at, unsigned int idx, unsigned int maxidx, std::vector& indices) const { - if (idx >= maxidx) return; + if (idx >= maxidx) { + // Make sure this is a cycle (i.e. this should be first atom detected) + if (idx > maxidx) { + // Sanity check + mprinterr("Internal Error: PuckerToken::FindAtoms: Index out of range.\n"); + return; + } + if (at == indices[0]) + indices[idx] = at; + return; + } for (Atom::bond_iterator it = topIn[at].bondbegin(); it != topIn[at].bondend(); ++it) { @@ -34,7 +45,7 @@ const { Residue const& currentRes = topIn.Res( resnum ); - std::vector indices(atomNames_.size(), -1); + std::vector indices(atomNames_.size()+1, -1); // Find the first atom for (int at = currentRes.FirstAtom(); at != currentRes.LastAtom(); ++at) @@ -46,5 +57,24 @@ const break; } } - return PuckerMask( indices ); + // DEBUG + mprintf("DEBUG: Results for pucker '%s', residue %i:", name_.c_str(), resnum+1); + for (std::vector::const_iterator it = indices.begin(); it != indices.end(); ++it) + mprintf(" %i", *it); + mprintf("\n"); + // Check if the entire pucker was found. + std::vector actualIndices; + actualIndices.reserve(atomNames_.size()); + if (indices.back() == -1) { + // This means a cycle was not found. + return PuckerMask(); + } + for (unsigned int idx = 0; idx != atomNames_.size(); idx++) + { + if (indices[idx] == -1) { + return PuckerMask(); + } + actualIndices.push_back( indices[idx] ); + } + return PuckerMask( actualIndices ); } From aea523fb65458f4084b76bdd336f1ad1f2ddf89a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 10 May 2021 15:23:19 -0400 Subject: [PATCH 13/48] Add FindPuckers --- src/Action_MultiPucker.cpp | 20 +++++++++++++++++++- src/Pucker_PuckerMask.h | 2 ++ src/Pucker_PuckerSearch.cpp | 24 ++++++++++++++++++++++++ src/cpptrajdepend | 4 ++-- 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index c2d64c7343..4c80b67bb5 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -50,7 +50,25 @@ Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, // Action_MultiPucker::Setup() Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) { - + Range actualRange; + // If range is empty (i.e. no resrange arg given) look through all + // solute residues. + if (resRange_.Empty()) + actualRange = setup.Top().SoluteResidues(); + else { + // If user range specified, create new range shifted by -1 since internal + // resnums start from 0. + actualRange = resRange_; + actualRange.ShiftBy(-1); + } + // Exit if no residues specified + if (actualRange.Empty()) { + mprinterr("Error: No residues specified for %s\n",setup.Top().c_str()); + return Action::ERR; + } + // Search for specified dihedrals in each residue in the range + if (puckerSearch_.FindDihedrals(setup.Top(), actualRange)) + return Action::SKIP; } // Action_MultiPucker::DoAction() diff --git a/src/Pucker_PuckerMask.h b/src/Pucker_PuckerMask.h index b2636c9b49..e0cec7ab10 100644 --- a/src/Pucker_PuckerMask.h +++ b/src/Pucker_PuckerMask.h @@ -9,6 +9,8 @@ class PuckerMask { PuckerMask(); PuckerMask(std::vector const&); + + bool None() const { return atoms_.empty(); } private: std::vector atoms_; ///< Hold atom indices defining pucker }; diff --git a/src/Pucker_PuckerSearch.cpp b/src/Pucker_PuckerSearch.cpp index 0760dd3cff..351770814d 100644 --- a/src/Pucker_PuckerSearch.cpp +++ b/src/Pucker_PuckerSearch.cpp @@ -1,6 +1,8 @@ #include "Pucker_PuckerSearch.h" #include "CpptrajStdio.h" #include "ArgList.h" +#include "Range.h" +#include "Topology.h" using namespace Cpptraj; @@ -103,3 +105,25 @@ void Pucker::PuckerSearch::PrintTypes() const { it != puckersToSearchFor_.end(); ++it) mprintf(" %s", it->Name().c_str()); } + +/** Find all defined puckers in a residue range */ +int Pucker::PuckerSearch::FindPuckers(Topology const& currentParm, Range const& rangeIn) +{ + foundPuckers_.clear(); + for (Range::const_iterator res = rangeIn.begin(); res != rangeIn.end(); ++res) + { + for (std::vector::const_iterator tkn = puckersToSearchFor_.begin(); + tkn != puckersToSearchFor_.end(); ++tkn) + { + PuckerMask puckerMask = tkn->FindPuckerAtoms(currentParm, *res); + if (!puckerMask.None()) { + foundPuckers_.push_back( puckerMask ); + } + } + } + if (foundPuckers_.empty()) { + mprintf("Warning: No puckers selected for topology %s\n", currentParm.c_str()); + return 1; + } + return 0; +} diff --git a/src/cpptrajdepend b/src/cpptrajdepend index f1f1e5f5c7..03db83efb2 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -365,8 +365,8 @@ ProgressBar.o : ProgressBar.cpp CpptrajStdio.h ProgressBar.h ProgressTimer.o : ProgressTimer.cpp CpptrajStdio.h ProgressTimer.h Timer.h PubFFT.o : PubFFT.cpp ArrayIterator.h ComplexArray.h CpptrajStdio.h PubFFT.h Pucker_PuckerMask.o : Pucker_PuckerMask.cpp Pucker_PuckerMask.h -Pucker_PuckerSearch.o : Pucker_PuckerSearch.cpp ArgList.h CpptrajStdio.h NameType.h Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h -Pucker_PuckerToken.o : Pucker_PuckerToken.cpp Atom.h AtomMask.h AtomType.h Box.h Constants.h CoordinateInfo.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Pucker_PuckerMask.h Pucker_PuckerToken.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h +Pucker_PuckerSearch.o : Pucker_PuckerSearch.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h Constants.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 Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h +Pucker_PuckerToken.o : Pucker_PuckerToken.cpp Atom.h AtomMask.h AtomType.h Box.h Constants.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 Pucker_PuckerMask.h Pucker_PuckerToken.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h RNG.o : RNG.cpp CpptrajStdio.h RNG.h RNG_Marsaglia.o : RNG_Marsaglia.cpp CpptrajStdio.h RNG.h RNG_Marsaglia.h RNG_MersenneTwister.o : RNG_MersenneTwister.cpp CpptrajStdio.h RNG.h RNG_MersenneTwister.h From 43119416b7df7fdbfda70c117a6f44066070021d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 09:06:47 -0400 Subject: [PATCH 14/48] Add function to create string from pucker atoms --- src/Pucker_PuckerMask.cpp | 12 ++++++++++++ src/Pucker_PuckerMask.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/Pucker_PuckerMask.cpp b/src/Pucker_PuckerMask.cpp index e113cf679d..b270c61708 100644 --- a/src/Pucker_PuckerMask.cpp +++ b/src/Pucker_PuckerMask.cpp @@ -1,4 +1,5 @@ #include "Pucker_PuckerMask.h" +#include "Topology.h" using namespace Cpptraj; @@ -7,3 +8,14 @@ Pucker::PuckerMask::PuckerMask() {} Pucker::PuckerMask::PuckerMask(std::vector const& atomsIn) : atoms_(atomsIn) {} + +std::string Pucker::PuckerMask::PuckerMaskString(Topology const& topIn) const { + std::string out; + for (std::vector::const_iterator it = atoms_.begin(); it != atoms_.end(); ++it) + { + if (it != atoms_.begin()) + out.append(" "); + out.append( topIn.TruncResNameAtomName( *it ) ); + } + return out; +} diff --git a/src/Pucker_PuckerMask.h b/src/Pucker_PuckerMask.h index e0cec7ab10..69f11ef550 100644 --- a/src/Pucker_PuckerMask.h +++ b/src/Pucker_PuckerMask.h @@ -1,6 +1,8 @@ #ifndef INC_PUCKER_PUCKERMASK_H #define INC_PUCKER_PUCKERMASK_H #include +#include +class Topology; namespace Cpptraj { namespace Pucker { /// Used to define found puckers in Topology @@ -11,6 +13,7 @@ class PuckerMask { PuckerMask(std::vector const&); bool None() const { return atoms_.empty(); } + std::string PuckerMaskString(Topology const&) const; private: std::vector atoms_; ///< Hold atom indices defining pucker }; From 8fe6e5fd2472c009933e1af887138ad72757f044 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 09:13:14 -0400 Subject: [PATCH 15/48] Can only handle puckers of 5 or 6 atoms --- src/Pucker_PuckerSearch.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Pucker_PuckerSearch.cpp b/src/Pucker_PuckerSearch.cpp index 351770814d..4edd3b0b57 100644 --- a/src/Pucker_PuckerSearch.cpp +++ b/src/Pucker_PuckerSearch.cpp @@ -10,7 +10,7 @@ Pucker::PuckerSearch::PuckerSearch() {} /** Recognized pucker keywords. */ const char* Pucker::PuckerSearch::Keywords_[] = { - "nucleic", // NUCLEIC + "nucleic", // NUCLEIC RIBOSE "furanose", // FURANOSE "pyranose" // PYRANOSE }; @@ -19,7 +19,7 @@ const char* Pucker::PuckerSearch::Keywords_[] = { int Pucker::PuckerSearch::SearchFor(Type ptype) { PuckerToken::NameArray names; if (ptype == NUCLEIC) { - // Amber nucleic acid + // Amber nucleic acid ribose names.push_back("C1'"); names.push_back("C2'"); names.push_back("C3'"); @@ -68,11 +68,15 @@ int Pucker::PuckerSearch::SearchForNewTypeArgs(ArgList& argIn) { puckertype_arg.c_str(), puckertype.Nargs()); return 1; } + if (puckertype.Nargs() > 7) { + mprinterr("Error: Can only handle puckers with 5 or 6 atoms, got %i\n", puckertype.Nargs()-1); + return 1; + } PuckerToken::NameArray atomNames; atomNames.reserve(puckertype.Nargs()-1); for (int iarg = 1; iarg != puckertype.Nargs(); iarg++) atomNames.push_back( puckertype[iarg] ); - SearchForNewType(puckertype[0], atomNames); + if (SearchForNewType(puckertype[0], atomNames)) return 1; puckertype_arg = argIn.GetStringKey("puckertype"); } return 0; @@ -81,11 +85,15 @@ int Pucker::PuckerSearch::SearchForNewTypeArgs(ArgList& argIn) { /** Define a custom pucker */ int Pucker::PuckerSearch::SearchForNewType(std::string const& name, PuckerToken::NameArray const& atomNames) { + if (atomNames.size() < 5 || atomNames.size() > 6) { + mprinterr("Error: Can only handle puckers with 5 or 6 atoms. New type has %zu\n", atomNames.size()); + return 1; + } for (std::vector::const_iterator tkn = puckersToSearchFor_.begin(); tkn != puckersToSearchFor_.end(); ++tkn) if (tkn->Name() == name) { mprintf("Warning: Pucker type %s already defined.\n", name.c_str()); - return 1; + return 0; } puckersToSearchFor_.push_back( PuckerToken(name, atomNames) ); return 0; From 1f31760cfcf9a460da8ee241a23955b021ad36f9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:09:41 -0400 Subject: [PATCH 16/48] Add residue number and name to PuckerMask --- src/Pucker_PuckerMask.cpp | 8 ++++++-- src/Pucker_PuckerMask.h | 13 ++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Pucker_PuckerMask.cpp b/src/Pucker_PuckerMask.cpp index b270c61708..fa20f9da2e 100644 --- a/src/Pucker_PuckerMask.cpp +++ b/src/Pucker_PuckerMask.cpp @@ -5,10 +5,14 @@ using namespace Cpptraj; Pucker::PuckerMask::PuckerMask() {} -Pucker::PuckerMask::PuckerMask(std::vector const& atomsIn) : - atoms_(atomsIn) +/** CONSTRUCTOR - res #, name, index */ +Pucker::PuckerMask::PuckerMask(int resnumIn, std::string const& nameIn, std::vector const& atomsIn) : + atoms_(atomsIn), + aspect_(nameIn), + resnum_(resnumIn) {} +/** \return string based on atoms in mask. */ std::string Pucker::PuckerMask::PuckerMaskString(Topology const& topIn) const { std::string out; for (std::vector::const_iterator it = atoms_.begin(); it != atoms_.end(); ++it) diff --git a/src/Pucker_PuckerMask.h b/src/Pucker_PuckerMask.h index 69f11ef550..8f6f918346 100644 --- a/src/Pucker_PuckerMask.h +++ b/src/Pucker_PuckerMask.h @@ -9,13 +9,20 @@ namespace Pucker { class PuckerMask { public: PuckerMask(); - - PuckerMask(std::vector const&); - + /// CONSTRUCTOR - residue number, name (DataSet aspect), res # (DataSet index) + PuckerMask(int, std::string const&, std::vector const&); + /// \return true if mask is empty bool None() const { return atoms_.empty(); } + /// \return string based on atoms in the mask std::string PuckerMaskString(Topology const&) const; + /// \return Residue number pucker belongs to + int ResNum() const { return resnum_; } + /// \return Name of pucker + std::string const& Name() const { return aspect_; } private: std::vector atoms_; ///< Hold atom indices defining pucker + std::string aspect_; ///< DataSet aspect + int resnum_; ///< Residue number (DataSet index) }; } From 8c065ed88fa188df7942980d59794568e7480656 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:11:35 -0400 Subject: [PATCH 17/48] Add name and res num --- src/Pucker_PuckerToken.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pucker_PuckerToken.cpp b/src/Pucker_PuckerToken.cpp index 9f095ce564..704bc58fc8 100644 --- a/src/Pucker_PuckerToken.cpp +++ b/src/Pucker_PuckerToken.cpp @@ -76,5 +76,5 @@ const } actualIndices.push_back( indices[idx] ); } - return PuckerMask( actualIndices ); + return PuckerMask( resnum, Name(), actualIndices ); } From 4f6431af75c226cf9aee87be0aafc35dfd7bd91b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:13:37 -0400 Subject: [PATCH 18/48] Add iterators --- src/Pucker_PuckerSearch.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h index 1a3d093310..f2deccc131 100644 --- a/src/Pucker_PuckerSearch.h +++ b/src/Pucker_PuckerSearch.h @@ -27,6 +27,15 @@ class PuckerSearch { int SearchForAll(); /// Print types to search for to stdout void PrintTypes() const; + /// \return Number of found puckers + unsigned int Npuckers() const { return foundPuckers_.size(); } + + /// Const iterator over found puckers + typedef std::vector::const_iterator mask_it; + /// \return iterator to beginning of found puckers list + mask_it begin() const { return foundPuckers_.begin(); } + /// \return iterator to end of found puckers list + mask_it end() const { return foundPuckers_.end(); } private: static const char* Keywords_[]; ///< Keywords corresponding to Pucker::Type /// Define a new custom pucker type From c966f7a35b692a89a260dc454ba80622a3b63bed Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:14:51 -0400 Subject: [PATCH 19/48] Do pucker setup --- src/Action_MultiPucker.cpp | 37 +++++++++++++++++++++++++++++++++++-- src/Action_MultiPucker.h | 11 ++++++----- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 4c80b67bb5..e1900f18d1 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -1,6 +1,8 @@ #include "Action_MultiPucker.h" #include "CpptrajStdio.h" +using namespace Cpptraj; + Action_MultiPucker::Action_MultiPucker() : outfile_(0), masterDSL_(0) @@ -66,9 +68,40 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) mprinterr("Error: No residues specified for %s\n",setup.Top().c_str()); return Action::ERR; } - // Search for specified dihedrals in each residue in the range - if (puckerSearch_.FindDihedrals(setup.Top(), actualRange)) + // Search for specified puckers in each residue in the range + if (puckerSearch_.FindPuckers(setup.Top(), actualRange)) return Action::SKIP; + mprintf("\tResRange=[%s]", resRange_.RangeArg()); + puckerSearch_.PrintTypes(); + mprintf(", %u puckers.\n", puckerSearch_.Npuckers()); + + // Print selected puckers, set up DataSets + data_.clear(); + if (dsetname_.empty()) + dsetname_ = masterDSL_->GenerateDefaultName("MPUCKER"); + for (Pucker::PuckerSearch::mask_it pucker = puckerSearch_.begin(); + pucker != puckerSearch_.end(); ++pucker) + { + int resNum = pucker->ResNum() + 1; + // See if Dataset already present. FIXME should AddSet do this? + MetaData md( dsetname_, pucker->Name(), resNum ); + DataSet* ds = masterDSL_->CheckForSet(md); + if (ds == 0) { + // Create new DataSet + md.SetScalarMode( MetaData::M_PUCKER ); + md.SetScalarType( MetaData::PUCKER ); // TODO pucker types + ds = masterDSL_->AddSet( DataSet::DOUBLE, md ); + if (ds == 0) return Action::ERR; + // Add to outfile + if (outfile_ != 0) + outfile_->AddDataSet( ds ); + } + data_.push_back( ds ); + //if (debug_ > 0) { + mprintf("\tPUCKER [%s]: %s", ds->legend(), pucker->PuckerMaskString(setup.Top()).c_str()); + //} + } + return Action::OK; } // Action_MultiPucker::DoAction() diff --git a/src/Action_MultiPucker.h b/src/Action_MultiPucker.h index 787a1c0266..d292d523b8 100644 --- a/src/Action_MultiPucker.h +++ b/src/Action_MultiPucker.h @@ -15,10 +15,11 @@ class Action_MultiPucker : public Action { Action::RetType DoAction(int, ActionFrame&); void Print() {} - Cpptraj::Pucker::PuckerSearch puckerSearch_; - Range resRange_; - std::string dsetname_; - DataFile* outfile_; - DataSetList* masterDSL_; + Cpptraj::Pucker::PuckerSearch puckerSearch_; ///< Used to search for puckers + std::vector data_; ///< Output DataSets, 1 per pucker + Range resRange_; ///< Residue range to search + std::string dsetname_; ///< Output data set(s) name + DataFile* outfile_; ///< File to write sets to + DataSetList* masterDSL_; ///< Pointer to master DataSetList }; #endif From 600c07efa2220c4195e8fd8a4b2d3d8e4c2ed300 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:29:01 -0400 Subject: [PATCH 20/48] Add UNSPECIFIED enum. Add iterator over mask atoms. --- src/Pucker.h | 2 +- src/Pucker_PuckerMask.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Pucker.h b/src/Pucker.h index ff70141784..4da8856a85 100644 --- a/src/Pucker.h +++ b/src/Pucker.h @@ -5,7 +5,7 @@ namespace Pucker { enum Type { NUCLEIC = 0, FURANOSE, PYRANOSE, NTYPES }; -enum Method { ALTONA_SUNDARALINGAM = 0, CREMER_POPLE }; +enum Method { ALTONA_SUNDARALINGAM = 0, CREMER_POPLE, UNSPECIFIED }; } } diff --git a/src/Pucker_PuckerMask.h b/src/Pucker_PuckerMask.h index 8f6f918346..e754aaf069 100644 --- a/src/Pucker_PuckerMask.h +++ b/src/Pucker_PuckerMask.h @@ -19,6 +19,13 @@ class PuckerMask { int ResNum() const { return resnum_; } /// \return Name of pucker std::string const& Name() const { return aspect_; } + + /// Const iterator over pucker atoms + typedef std::vector::const_iterator atom_it; + /// \return iterator to beginning of pucker atoms + atom_it begin() const { return atoms_.begin(); } + /// \return iterator to end of pucker atoms + atom_it end() const { return atoms_.end(); } private: std::vector atoms_; ///< Hold atom indices defining pucker std::string aspect_; ///< DataSet aspect From 114bb420f964e64988ca857e358f5d376db4bd41 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:45:57 -0400 Subject: [PATCH 21/48] Add function returning number of atoms in mask --- src/Pucker_PuckerMask.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Pucker_PuckerMask.h b/src/Pucker_PuckerMask.h index e754aaf069..533634a725 100644 --- a/src/Pucker_PuckerMask.h +++ b/src/Pucker_PuckerMask.h @@ -19,6 +19,8 @@ class PuckerMask { int ResNum() const { return resnum_; } /// \return Name of pucker std::string const& Name() const { return aspect_; } + /// \return Number of atoms in pucker + unsigned int Natoms() const { return atoms_.size(); } /// Const iterator over pucker atoms typedef std::vector::const_iterator atom_it; From def7dd4cf21d338094e49688ef611ce4fca79c80 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:46:07 -0400 Subject: [PATCH 22/48] Finish up action. --- src/Action_MultiPucker.cpp | 62 ++++++++++++++++++++++++++++++++++++-- src/Action_MultiPucker.h | 3 ++ src/cpptrajdepend | 4 +-- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index e1900f18d1..c665ff4257 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -1,11 +1,13 @@ #include "Action_MultiPucker.h" #include "CpptrajStdio.h" +#include "TorsionRoutines.h" using namespace Cpptraj; Action_MultiPucker::Action_MultiPucker() : outfile_(0), - masterDSL_(0) + masterDSL_(0), + defaultMethod_(Pucker::ALTONA_SUNDARALINGAM) {} // Action_MultiPucker::Help() @@ -18,6 +20,9 @@ Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, { // Get Keywords outfile_ = init.DFL().AddDataFile( actionArgs.GetStringKey("out"), actionArgs); + if (actionArgs.hasKey("altona")) defaultMethod_ = Pucker::ALTONA_SUNDARALINGAM; + else if (actionArgs.hasKey("cremer")) defaultMethod_ = Pucker::CREMER_POPLE; + else defaultMethod_ = Pucker::UNSPECIFIED; std::string resrange_arg = actionArgs.GetStringKey("resrange"); if (!resrange_arg.empty()) if (resRange_.SetRange( resrange_arg )) return Action::ERR; @@ -77,11 +82,28 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) // Print selected puckers, set up DataSets data_.clear(); + puckerMethods_.clear(); + if (dsetname_.empty()) dsetname_ = masterDSL_->GenerateDefaultName("MPUCKER"); for (Pucker::PuckerSearch::mask_it pucker = puckerSearch_.begin(); pucker != puckerSearch_.end(); ++pucker) { + // setup/check the method + Pucker::Method methodToUse = defaultMethod_; + if (methodToUse == Pucker::UNSPECIFIED) { + if (pucker->Natoms() > 5) + methodToUse = Pucker::CREMER_POPLE; + else + methodToUse = Pucker::ALTONA_SUNDARALINGAM; + } else if (methodToUse == Pucker::ALTONA_SUNDARALINGAM) { + if (pucker->Natoms() > 5) { + mprinterr("Error: Pucker '%s' has too many atoms for Altona-Sundaralingam method.\n"); + return Action::ERR; + } + } + puckerMethods_.push_back( methodToUse ); + int resNum = pucker->ResNum() + 1; // See if Dataset already present. FIXME should AddSet do this? MetaData md( dsetname_, pucker->Name(), resNum ); @@ -98,7 +120,9 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) } data_.push_back( ds ); //if (debug_ > 0) { - mprintf("\tPUCKER [%s]: %s", ds->legend(), pucker->PuckerMaskString(setup.Top()).c_str()); + static const char* methodStr[] = { "Altona", "Cremer", "Unspecified" }; + mprintf("\tPUCKER [%s]: %s (%s)", ds->legend(), pucker->PuckerMaskString(setup.Top()).c_str(), + methodStr[puckerMethods_.back()]); //} } return Action::OK; @@ -107,5 +131,39 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) // Action_MultiPucker::DoAction() Action::RetType Action_MultiPucker::DoAction(int frameNum, ActionFrame& frm) { + const double* XYZ[6]; + for (int i = 0; i != 6; i++) + XYZ[i] = 0; + double pval, aval, tval; + std::vector::const_iterator ds = data_.begin(); + std::vector::const_iterator method = puckerMethods_.begin(); + for (Pucker::PuckerSearch::mask_it pucker = puckerSearch_.begin(); + pucker != puckerSearch_.end(); ++pucker, ++ds) + { + // Since puckers are always at least 5 atoms, just reinit the 6th coord + XYZ[5] = 0; + // Get pucker coordinates + unsigned int idx = 0; + for (Pucker::PuckerMask::atom_it atm = pucker->begin(); atm != pucker->end(); ++atm, ++idx) + XYZ[idx] = frm.Frm().XYZ( *atm ); + // Do pucker calculation + switch (*method) { + case Pucker::ALTONA_SUNDARALINGAM: + pval = Pucker_AS( XYZ[0], XYZ[1], XYZ[2], XYZ[3], XYZ[4], aval ); + break; + case Pucker::CREMER_POPLE: + pval = Pucker_CP( XYZ[0], XYZ[1], XYZ[2], XYZ[3], XYZ[4], XYZ[5], + pucker->Natoms(), aval, tval ); + break; + case Pucker::UNSPECIFIED : // Sanity check + return Action::ERR; + } + + pval *= Constants::RADDEG; + //if (torsion < minTorsion_) + // torsion += 360.0; + (*ds)->Add(frameNum, &pval); + } + return Action::OK; } diff --git a/src/Action_MultiPucker.h b/src/Action_MultiPucker.h index d292d523b8..f10d9cd4e6 100644 --- a/src/Action_MultiPucker.h +++ b/src/Action_MultiPucker.h @@ -1,6 +1,7 @@ #ifndef INC_ACTION_MULTIPUCKER_H #define INC_ACTION_MULTIPUCKER_H #include "Action.h" +#include "Pucker.h" #include "Pucker_PuckerSearch.h" #include "Range.h" /// Automatically detect and calculate puckers within a residue range. @@ -17,9 +18,11 @@ class Action_MultiPucker : public Action { Cpptraj::Pucker::PuckerSearch puckerSearch_; ///< Used to search for puckers std::vector data_; ///< Output DataSets, 1 per pucker + std::vector puckerMethods_; ///< Method to use for each pucker Range resRange_; ///< Residue range to search std::string dsetname_; ///< Output data set(s) name DataFile* outfile_; ///< File to write sets to DataSetList* masterDSL_; ///< Pointer to master DataSetList + Cpptraj::Pucker::Method defaultMethod_; ///< Which calculation method to use. }; #endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 03db83efb2..60891124c0 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -50,7 +50,7 @@ Action_Matrix.o : Action_Matrix.cpp Action.h ActionFrameCounter.h ActionState.h Action_MinImage.o : Action_MinImage.cpp Action.h ActionState.h Action_MinImage.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h FileIO.h FileName.h FileTypes.h Frame.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h TextFormat.h Timer.h Topology.h TypeNameHolder.h Unit.h Vec3.h Action_Molsurf.o : Action_Molsurf.cpp Action.h ActionState.h Action_Molsurf.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 molsurf.h Action_MultiDihedral.o : Action_MultiDihedral.cpp Action.h ActionState.h Action_MultiDihedral.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 DihedralSearch.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 TorsionRoutines.h TypeNameHolder.h Unit.h Vec3.h -Action_MultiPucker.o : Action_MultiPucker.cpp Action.h ActionState.h Action_MultiPucker.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 Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.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_MultiPucker.o : Action_MultiPucker.cpp Action.h ActionState.h Action_MultiPucker.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 Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.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_MultiVector.o : Action_MultiVector.cpp Action.h ActionState.h Action_MultiVector.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_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 Action_NAstruct.o : Action_NAstruct.cpp Action.h ActionState.h Action_NAstruct.h ArgList.h AssociatedData.h Atom.h AtomMask.h AtomType.h AxisType.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 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 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 Action_NMRrst.o : Action_NMRrst.cpp Action.h ActionState.h Action_NMRrst.h ArgList.h AssociatedData.h Atom.h AtomMap.h AtomMask.h AtomType.h BaseIOtype.h Box.h BufferedLine.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_double.h DataSet_float.h Dimension.h DispatchObject.h DistRoutines.h FileIO.h FileName.h FileTypes.h Frame.h ImageOption.h MapAtom.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 ViewRst.h @@ -364,7 +364,7 @@ PotentialTerm_OpenMM.o : PotentialTerm_OpenMM.cpp Atom.h AtomMask.h AtomType.h B ProgressBar.o : ProgressBar.cpp CpptrajStdio.h ProgressBar.h ProgressTimer.o : ProgressTimer.cpp CpptrajStdio.h ProgressTimer.h Timer.h PubFFT.o : PubFFT.cpp ArrayIterator.h ComplexArray.h CpptrajStdio.h PubFFT.h -Pucker_PuckerMask.o : Pucker_PuckerMask.cpp Pucker_PuckerMask.h +Pucker_PuckerMask.o : Pucker_PuckerMask.cpp Atom.h AtomMask.h AtomType.h Box.h Constants.h CoordinateInfo.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Pucker_PuckerMask.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h Pucker_PuckerSearch.o : Pucker_PuckerSearch.cpp ArgList.h Atom.h AtomMask.h AtomType.h Box.h Constants.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 Pucker.h Pucker_PuckerMask.h Pucker_PuckerSearch.h Pucker_PuckerToken.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h Pucker_PuckerToken.o : Pucker_PuckerToken.cpp Atom.h AtomMask.h AtomType.h Box.h Constants.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 Pucker_PuckerMask.h Pucker_PuckerToken.h Range.h ReplicaDimArray.h Residue.h Segment.h SymbolExporting.h Topology.h TypeNameHolder.h Unit.h Vec3.h RNG.o : RNG.cpp CpptrajStdio.h RNG.h From 54d25532540cfc7a2c03c50f33d6b33fb861ac1d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:48:39 -0400 Subject: [PATCH 23/48] Enable multipucker --- src/Command.cpp | 2 ++ src/cpptrajdepend | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Command.cpp b/src/Command.cpp index dfda61f538..42d7c724c0 100644 --- a/src/Command.cpp +++ b/src/Command.cpp @@ -150,6 +150,7 @@ #include "Action_XtalSymm.h" #include "Action_Time.h" #include "Action_DihedralRMS.h" +#include "Action_MultiPucker.h" // ----- ANALYSIS -------------------------------------------------------------- #include "Analysis_Hist.h" #include "Analysis_Corr.h" @@ -341,6 +342,7 @@ void Command::Init() { Command::AddCmd( new Action_MinImage(), Cmd::ACT, 1, "minimage" ); Command::AddCmd( new Action_Molsurf(), Cmd::ACT, 1, "molsurf" ); Command::AddCmd( new Action_MultiDihedral(), Cmd::ACT, 1, "multidihedral" ); + Command::AddCmd( new Action_MultiPucker(), Cmd::ACT, 1, "multipucker" ); Command::AddCmd( new Action_MultiVector(), Cmd::ACT, 1, "multivector" ); Command::AddCmd( new Action_NAstruct(), Cmd::ACT, 1, "nastruct" ); Command::AddCmd( new Action_NativeContacts(),Cmd::ACT, 1, "nativecontacts" ); diff --git a/src/cpptrajdepend b/src/cpptrajdepend index 60891124c0..421b1bd6a6 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -160,7 +160,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 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_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 ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.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_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_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 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 ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.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_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_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 946f4798cf04bf9e47298b67b477015a05fa6293 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 10:52:26 -0400 Subject: [PATCH 24/48] Start adding multipucker test --- test/Test_MultiPucker/RunTest.sh | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 test/Test_MultiPucker/RunTest.sh diff --git a/test/Test_MultiPucker/RunTest.sh b/test/Test_MultiPucker/RunTest.sh new file mode 100755 index 0000000000..db423b5e0d --- /dev/null +++ b/test/Test_MultiPucker/RunTest.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +. ../MasterTest.sh + +# Clean +CleanFiles pucker.in nucleic.dat + +TESTNAME='MultiPucker tests' +Requires maxthreads 3 + +# Test 1 +Nucleic() { + TOP=../adh026.3.pdb + INPUT=pucker.in + cat > pucker.in < Ptest.in < Ptest.in < Date: Tue, 11 May 2021 11:02:27 -0400 Subject: [PATCH 25/48] Fix the pucker cycle check --- src/Action_MultiPucker.cpp | 2 +- src/Pucker_PuckerToken.cpp | 31 ++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index c665ff4257..e278f1a0ba 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -121,7 +121,7 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) data_.push_back( ds ); //if (debug_ > 0) { static const char* methodStr[] = { "Altona", "Cremer", "Unspecified" }; - mprintf("\tPUCKER [%s]: %s (%s)", ds->legend(), pucker->PuckerMaskString(setup.Top()).c_str(), + mprintf("\tPUCKER [%s]: %s (%s)\n", ds->legend(), pucker->PuckerMaskString(setup.Top()).c_str(), methodStr[puckerMethods_.back()]); //} } diff --git a/src/Pucker_PuckerToken.cpp b/src/Pucker_PuckerToken.cpp index 704bc58fc8..37d32716c6 100644 --- a/src/Pucker_PuckerToken.cpp +++ b/src/Pucker_PuckerToken.cpp @@ -17,23 +17,32 @@ void Pucker::PuckerToken::FindAtoms(Topology const& topIn, int at, const { if (idx >= maxidx) { - // Make sure this is a cycle (i.e. this should be first atom detected) + // Make sure this is a cycle (i.e. this should be bonded to the first atom detected) + mprintf("DEBUG: Checking for cycle at=%i idx=%u maxidx=%u indices=", at, idx, maxidx); + for (std::vector::const_iterator it = indices.begin(); it != indices.end(); ++it) + mprintf(" %i", *it); + mprintf("\n"); if (idx > maxidx) { // Sanity check mprinterr("Internal Error: PuckerToken::FindAtoms: Index out of range.\n"); return; } - if (at == indices[0]) - indices[idx] = at; - return; - } - - for (Atom::bond_iterator it = topIn[at].bondbegin(); it != topIn[at].bondend(); ++it) - { - if (topIn[*it].Name() == atomNames_[idx]) { - indices[idx] = *it; + for (Atom::bond_iterator it = topIn[at].bondbegin(); it != topIn[at].bondend(); ++it) + { + if (*it == indices[0]) { + indices[idx] = *it; + return; + } + } + } else { + // Check that this atom is bonded to the next one expected in the sequence. + for (Atom::bond_iterator it = topIn[at].bondbegin(); it != topIn[at].bondend(); ++it) + { + if (topIn[*it].Name() == atomNames_[idx]) { + indices[idx] = *it; - FindAtoms( topIn, *it, idx+1, maxidx, indices ); + FindAtoms( topIn, *it, idx+1, maxidx, indices ); + } } } } From 3471a10b4d4908c815577df5843731f9660ef789 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 11:16:33 -0400 Subject: [PATCH 26/48] Add pucker wrapping --- src/Action_MultiPucker.cpp | 40 +++++++++++++++++++++++++++++--------- src/Action_MultiPucker.h | 5 +++++ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index e278f1a0ba..c80a4d639c 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -4,15 +4,22 @@ using namespace Cpptraj; +const double Action_MultiPucker::PERIOD_ = 360.0; + +/** CONSTRUCTOR */ Action_MultiPucker::Action_MultiPucker() : outfile_(0), masterDSL_(0), - defaultMethod_(Pucker::ALTONA_SUNDARALINGAM) + defaultMethod_(Pucker::ALTONA_SUNDARALINGAM), + puckerMin_(0), + puckerMax_(0), + offset_(0) {} // Action_MultiPucker::Help() void Action_MultiPucker::Help() const { - + mprintf("\t[] [ ...] [out ] [altona|cremer]\n" + "\t[range360] [offset ]\n"); } // Action_MultiPucker::Init() @@ -23,6 +30,12 @@ Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, if (actionArgs.hasKey("altona")) defaultMethod_ = Pucker::ALTONA_SUNDARALINGAM; else if (actionArgs.hasKey("cremer")) defaultMethod_ = Pucker::CREMER_POPLE; else defaultMethod_ = Pucker::UNSPECIFIED; + offset_ = actionArgs.getKeyDouble("offset",0.0); + if (actionArgs.hasKey("range360")) + puckerMin_ = 0.0; + else + puckerMin_ = -180.0; + puckerMax_ = puckerMin_ + PERIOD_; std::string resrange_arg = actionArgs.GetStringKey("resrange"); if (!resrange_arg.empty()) if (resRange_.SetRange( resrange_arg )) return Action::ERR; @@ -42,13 +55,20 @@ Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, mprintf(" puckers for residues in range %s\n", resRange_.RangeArg()); else mprintf(" puckers for all solute residues.\n"); + if (defaultMethod_ == Pucker::ALTONA_SUNDARALINGAM) + mprintf("\tUsing Altona & Sundaralingam method.\n"); + else if (defaultMethod_ == Pucker::CREMER_POPLE) + mprintf("\tUsing Cremer & Pople method.\n"); + if (offset_!=0) + mprintf("\tOffset: %f degrees will be added to values.\n", offset_); + if (puckerMin_ > -180.0) + mprintf("\tOutput range is 0 to 360 degrees.\n"); + else + mprintf("\tOutput range is -180 to 180 degrees.\n"); if (!dsetname_.empty()) mprintf("\tDataSet name: %s\n", dsetname_.c_str()); if (outfile_ != 0) mprintf("\tOutput to %s\n", outfile_->DataFilename().base()); - //if (minTorsion_ > -180.0) - // mprintf("\tOutput range is 0 to 360 degrees.\n"); - //else - // mprintf("\tOutput range is -180 to 180 degrees.\n"); + init.DSL().SetDataSetsPending(true); masterDSL_ = init.DslPtr(); return Action::OK; @@ -160,9 +180,11 @@ Action::RetType Action_MultiPucker::DoAction(int frameNum, ActionFrame& frm) return Action::ERR; } - pval *= Constants::RADDEG; - //if (torsion < minTorsion_) - // torsion += 360.0; + pval = (pval * Constants::RADDEG) + offset_; + if (pval > puckerMax_) + pval -= PERIOD_; + else if (pval < puckerMin_) + pval += PERIOD_; (*ds)->Add(frameNum, &pval); } return Action::OK; diff --git a/src/Action_MultiPucker.h b/src/Action_MultiPucker.h index f10d9cd4e6..809382860d 100644 --- a/src/Action_MultiPucker.h +++ b/src/Action_MultiPucker.h @@ -16,6 +16,8 @@ class Action_MultiPucker : public Action { Action::RetType DoAction(int, ActionFrame&); void Print() {} + static const double PERIOD_; ///< Pucker period in degrees (360) + Cpptraj::Pucker::PuckerSearch puckerSearch_; ///< Used to search for puckers std::vector data_; ///< Output DataSets, 1 per pucker std::vector puckerMethods_; ///< Method to use for each pucker @@ -24,5 +26,8 @@ class Action_MultiPucker : public Action { DataFile* outfile_; ///< File to write sets to DataSetList* masterDSL_; ///< Pointer to master DataSetList Cpptraj::Pucker::Method defaultMethod_; ///< Which calculation method to use. + double puckerMin_; ///< Min pucker value; set to 0 or -180 + double puckerMax_; ///< Max pucker value; set to 360 or 180 + double offset_; ///< Offset to add to pucker values. }; #endif From b4a38bc134058ad5393c3862e07c2308cdd23754 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 11:17:23 -0400 Subject: [PATCH 27/48] Add nucleic ribose test --- test/Test_MultiPucker/RunTest.sh | 2 +- test/Test_MultiPucker/nucleic.dat.save | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/Test_MultiPucker/nucleic.dat.save diff --git a/test/Test_MultiPucker/RunTest.sh b/test/Test_MultiPucker/RunTest.sh index db423b5e0d..cd972cbd9c 100755 --- a/test/Test_MultiPucker/RunTest.sh +++ b/test/Test_MultiPucker/RunTest.sh @@ -24,7 +24,7 @@ multipucker ADHcp resrange 1-3 cremer out nucleic.dat #pucker p3-cp :3@C1' :3@C2' :3@C3' :3@C4' :3@O4' out pucker.dat cremer EOF RunCpptraj "MultiPucker command test" - #DoTest pucker.dat.save pucker.dat + DoTest nucleic.dat.save nucleic.dat } Furanoid() { diff --git a/test/Test_MultiPucker/nucleic.dat.save b/test/Test_MultiPucker/nucleic.dat.save new file mode 100644 index 0000000000..c110587beb --- /dev/null +++ b/test/Test_MultiPucker/nucleic.dat.save @@ -0,0 +1,4 @@ +#Frame nucleic:1 nucleic:2 nucleic:3 nucleic:1 nucleic:2 nucleic:3 + 1 -14.2619 23.7864 9.6036 -103.1602 -68.3267 -80.2398 + 2 5.5533 15.6753 21.9679 -85.9473 -74.9047 -71.3376 + 3 -3.2007 3.0248 11.7775 -92.5475 -87.5275 -79.5626 From 0fae3d907309826b6b6a41455f071598e879a342 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 11:20:11 -0400 Subject: [PATCH 28/48] Clean up setup output --- src/Action_MultiPucker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index c80a4d639c..f3767d474d 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -96,9 +96,9 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) // Search for specified puckers in each residue in the range if (puckerSearch_.FindPuckers(setup.Top(), actualRange)) return Action::SKIP; - mprintf("\tResRange=[%s]", resRange_.RangeArg()); + mprintf("\tResults of search in residue range [%s] for types", resRange_.RangeArg()); puckerSearch_.PrintTypes(); - mprintf(", %u puckers.\n", puckerSearch_.Npuckers()); + mprintf(", %u puckers found.\n", puckerSearch_.Npuckers()); // Print selected puckers, set up DataSets data_.clear(); From 6ddba39b0ce036374c514155b4346135ba263d70 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 11:36:31 -0400 Subject: [PATCH 29/48] Add ability to save amplitude and theta --- src/Action_MultiPucker.cpp | 72 +++++++++++++++++++++++++++++++------- src/Action_MultiPucker.h | 4 +++ src/Pucker_PuckerSearch.h | 2 ++ 3 files changed, 65 insertions(+), 13 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index f3767d474d..3266840ec6 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -13,7 +13,9 @@ Action_MultiPucker::Action_MultiPucker() : defaultMethod_(Pucker::ALTONA_SUNDARALINGAM), puckerMin_(0), puckerMax_(0), - offset_(0) + offset_(0), + calc_amp_(false), + calc_theta_(false) {} // Action_MultiPucker::Help() @@ -102,6 +104,8 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) // Print selected puckers, set up DataSets data_.clear(); + amp_.clear(); + theta_.clear(); puckerMethods_.clear(); if (dsetname_.empty()) @@ -138,7 +142,39 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) if (outfile_ != 0) outfile_->AddDataSet( ds ); } - data_.push_back( ds ); + data_.push_back( ds ); + + // Set up amplitude + if (calc_amp_) { + MetaData amp_md(dsetname_, pucker->Name() + "Amp", resNum); + ds = masterDSL_->CheckForSet(md); + if (ds == 0) { + md.SetScalarMode(MetaData::M_PUCKER); + ds = masterDSL_->AddSet(DataSet::DOUBLE, amp_md); + if (ds == 0) return Action::ERR; + } + amp_.push_back( ds ); + } else + amp_.push_back( 0 ); + + // Set up theta (> 5 atoms only) + if (calc_theta_) { + if (pucker->Natoms() < 6) { + mprintf("Warning: 'theta' calc. not supported for < 6 atoms.\n"); + theta_.push_back( 0 ); + } else { + MetaData theta_md(dsetname_, pucker->Name() + "Theta", resNum); + ds = masterDSL_->CheckForSet(md); + if (ds == 0) { + md.SetScalarMode(MetaData::M_PUCKER); + ds = masterDSL_->AddSet(DataSet::DOUBLE, theta_md); + if (ds == 0) return Action::ERR; + } + theta_.push_back( ds ); + } + } else + theta_.push_back( 0 ); + //if (debug_ > 0) { static const char* methodStr[] = { "Altona", "Cremer", "Unspecified" }; mprintf("\tPUCKER [%s]: %s (%s)\n", ds->legend(), pucker->PuckerMaskString(setup.Top()).c_str(), @@ -156,36 +192,46 @@ Action::RetType Action_MultiPucker::DoAction(int frameNum, ActionFrame& frm) XYZ[i] = 0; double pval, aval, tval; - std::vector::const_iterator ds = data_.begin(); - std::vector::const_iterator method = puckerMethods_.begin(); - for (Pucker::PuckerSearch::mask_it pucker = puckerSearch_.begin(); - pucker != puckerSearch_.end(); ++pucker, ++ds) + //std::vector::const_iterator ds = data_.begin(); + //std::vector::const_iterator method = puckerMethods_.begin(); + for (unsigned int idx = 0; idx != puckerSearch_.Npuckers(); idx++) { + Pucker::PuckerMask const& pucker = puckerSearch_.FoundPucker(idx); // Since puckers are always at least 5 atoms, just reinit the 6th coord XYZ[5] = 0; // Get pucker coordinates - unsigned int idx = 0; - for (Pucker::PuckerMask::atom_it atm = pucker->begin(); atm != pucker->end(); ++atm, ++idx) - XYZ[idx] = frm.Frm().XYZ( *atm ); + unsigned int jdx = 0; + for (Pucker::PuckerMask::atom_it atm = pucker.begin(); atm != pucker.end(); ++atm, ++jdx) + XYZ[jdx] = frm.Frm().XYZ( *atm ); // Do pucker calculation - switch (*method) { + switch (puckerMethods_[idx]) { case Pucker::ALTONA_SUNDARALINGAM: pval = Pucker_AS( XYZ[0], XYZ[1], XYZ[2], XYZ[3], XYZ[4], aval ); break; case Pucker::CREMER_POPLE: pval = Pucker_CP( XYZ[0], XYZ[1], XYZ[2], XYZ[3], XYZ[4], XYZ[5], - pucker->Natoms(), aval, tval ); + pucker.Natoms(), aval, tval ); break; case Pucker::UNSPECIFIED : // Sanity check return Action::ERR; } - + + if (amp_[idx] != 0) { + aval *= Constants::RADDEG; + amp_[idx]->Add(frameNum, &aval); + } + + if (theta_[idx] != 0) { + tval *= Constants::RADDEG; + theta_[idx]->Add(frameNum, &tval); + } + pval = (pval * Constants::RADDEG) + offset_; if (pval > puckerMax_) pval -= PERIOD_; else if (pval < puckerMin_) pval += PERIOD_; - (*ds)->Add(frameNum, &pval); + data_[idx]->Add(frameNum, &pval); } return Action::OK; } diff --git a/src/Action_MultiPucker.h b/src/Action_MultiPucker.h index 809382860d..056318b73a 100644 --- a/src/Action_MultiPucker.h +++ b/src/Action_MultiPucker.h @@ -20,6 +20,8 @@ class Action_MultiPucker : public Action { Cpptraj::Pucker::PuckerSearch puckerSearch_; ///< Used to search for puckers std::vector data_; ///< Output DataSets, 1 per pucker + std::vector amp_; ///< Output amplitude DataSets, 1 per pucker + std::vector theta_; ///< Output theta DataSets, 1 per pucker std::vector puckerMethods_; ///< Method to use for each pucker Range resRange_; ///< Residue range to search std::string dsetname_; ///< Output data set(s) name @@ -29,5 +31,7 @@ class Action_MultiPucker : public Action { double puckerMin_; ///< Min pucker value; set to 0 or -180 double puckerMax_; ///< Max pucker value; set to 360 or 180 double offset_; ///< Offset to add to pucker values. + bool calc_amp_; ///< If true save amplitude as well + bool calc_theta_; ///< If true save theta as well }; #endif diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h index f2deccc131..98187a486f 100644 --- a/src/Pucker_PuckerSearch.h +++ b/src/Pucker_PuckerSearch.h @@ -29,6 +29,8 @@ class PuckerSearch { void PrintTypes() const; /// \return Number of found puckers unsigned int Npuckers() const { return foundPuckers_.size(); } + /// \return Specified found pucker mask + PuckerMask const& FoundPucker(unsigned int idx) const { return foundPuckers_[idx]; } /// Const iterator over found puckers typedef std::vector::const_iterator mask_it; From 361b688ab6de0d5869bfaef475b30672ec888428 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 11:42:07 -0400 Subject: [PATCH 30/48] Add files to redirect amplitude/theta sets to --- src/Action_MultiPucker.cpp | 14 ++++++++++++++ src/Action_MultiPucker.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 3266840ec6..7f32b40e34 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -9,6 +9,8 @@ const double Action_MultiPucker::PERIOD_ = 360.0; /** CONSTRUCTOR */ Action_MultiPucker::Action_MultiPucker() : outfile_(0), + ampfile_(0), + thetafile_(0), masterDSL_(0), defaultMethod_(Pucker::ALTONA_SUNDARALINGAM), puckerMin_(0), @@ -21,6 +23,7 @@ Action_MultiPucker::Action_MultiPucker() : // Action_MultiPucker::Help() void Action_MultiPucker::Help() const { mprintf("\t[] [ ...] [out ] [altona|cremer]\n" + "\t[amplitude [ampout ]] [theta [thetaout ]]\n" "\t[range360] [offset ]\n"); } @@ -32,6 +35,15 @@ Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, if (actionArgs.hasKey("altona")) defaultMethod_ = Pucker::ALTONA_SUNDARALINGAM; else if (actionArgs.hasKey("cremer")) defaultMethod_ = Pucker::CREMER_POPLE; else defaultMethod_ = Pucker::UNSPECIFIED; + ampfile_ = 0; + calc_amp_ = actionArgs.hasKey("amplitude"); + if (calc_amp_) { + ampfile_ = init.DFL().AddDataFile( actionArgs.GetStringKey("ampout"), actionArgs); + } + calc_theta_ = actionArgs.hasKey("theta"); + if (calc_theta_) { + thetafile_ = init.DFL().AddDataFile( actionArgs.GetStringKey("thetaout"), actionArgs); + } offset_ = actionArgs.getKeyDouble("offset",0.0); if (actionArgs.hasKey("range360")) puckerMin_ = 0.0; @@ -152,6 +164,7 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) md.SetScalarMode(MetaData::M_PUCKER); ds = masterDSL_->AddSet(DataSet::DOUBLE, amp_md); if (ds == 0) return Action::ERR; + if (ampfile_ != 0) ampfile_->AddDataSet( ds ); } amp_.push_back( ds ); } else @@ -169,6 +182,7 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) md.SetScalarMode(MetaData::M_PUCKER); ds = masterDSL_->AddSet(DataSet::DOUBLE, theta_md); if (ds == 0) return Action::ERR; + if (thetafile_ != 0) thetafile_->AddDataSet( ds ); } theta_.push_back( ds ); } diff --git a/src/Action_MultiPucker.h b/src/Action_MultiPucker.h index 056318b73a..9192ed334e 100644 --- a/src/Action_MultiPucker.h +++ b/src/Action_MultiPucker.h @@ -26,6 +26,8 @@ class Action_MultiPucker : public Action { Range resRange_; ///< Residue range to search std::string dsetname_; ///< Output data set(s) name DataFile* outfile_; ///< File to write sets to + DataFile* ampfile_; ///< File to write amplitude sets to + DataFile* thetafile_; ///< File to write theta sets to DataSetList* masterDSL_; ///< Pointer to master DataSetList Cpptraj::Pucker::Method defaultMethod_; ///< Which calculation method to use. double puckerMin_; ///< Min pucker value; set to 0 or -180 From 62d363aca12636305f7f13e1e3457e8654ef1709 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 11:44:37 -0400 Subject: [PATCH 31/48] Add amp/theta info to init --- src/Action_MultiPucker.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 7f32b40e34..03637c5070 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -81,7 +81,15 @@ Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, mprintf("\tOutput range is -180 to 180 degrees.\n"); if (!dsetname_.empty()) mprintf("\tDataSet name: %s\n", dsetname_.c_str()); - if (outfile_ != 0) mprintf("\tOutput to %s\n", outfile_->DataFilename().base()); + if (outfile_ != 0) mprintf("\tOutput to %s\n", outfile_->DataFilename().full()); + if (calc_amp_) { + mprintf("\tAmplitudes (in degrees) will be calculated.\n"); + if (ampfile_ != 0) mprintf("\tAmplitudes output to %s\n", ampfile_->DataFilename().full()); + } + if (calc_theta_) { + mprintf("\tThetas (in degrees) will be calculated.\n"); + if (thetafile_ != 0) mprintf("\tThetas output to %s\n", thetafile_->DataFilename().full()); + } init.DSL().SetDataSetsPending(true); masterDSL_ = init.DslPtr(); From 03ffb4f93b9650de1847638ece0b29d360523aca Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 11:56:19 -0400 Subject: [PATCH 32/48] Check amp/theta metadata, not pucker metadata --- src/Action_MultiPucker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 03637c5070..33a344dc0d 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -167,7 +167,7 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) // Set up amplitude if (calc_amp_) { MetaData amp_md(dsetname_, pucker->Name() + "Amp", resNum); - ds = masterDSL_->CheckForSet(md); + ds = masterDSL_->CheckForSet(amp_md); if (ds == 0) { md.SetScalarMode(MetaData::M_PUCKER); ds = masterDSL_->AddSet(DataSet::DOUBLE, amp_md); @@ -185,7 +185,7 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) theta_.push_back( 0 ); } else { MetaData theta_md(dsetname_, pucker->Name() + "Theta", resNum); - ds = masterDSL_->CheckForSet(md); + ds = masterDSL_->CheckForSet(theta_md); if (ds == 0) { md.SetScalarMode(MetaData::M_PUCKER); ds = masterDSL_->AddSet(DataSet::DOUBLE, theta_md); From 0296ef220c84b3a5a1a852253b977f056a1604f6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 11:58:10 -0400 Subject: [PATCH 33/48] Add furanoid test with amplitude --- test/Test_MultiPucker/RunTest.sh | 15 ++++++++------- test/Test_MultiPucker/furanoid.dat.save | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 test/Test_MultiPucker/furanoid.dat.save diff --git a/test/Test_MultiPucker/RunTest.sh b/test/Test_MultiPucker/RunTest.sh index cd972cbd9c..dce10928de 100755 --- a/test/Test_MultiPucker/RunTest.sh +++ b/test/Test_MultiPucker/RunTest.sh @@ -3,7 +3,7 @@ . ../MasterTest.sh # Clean -CleanFiles pucker.in nucleic.dat +CleanFiles pucker.in nucleic.dat furanoid.dat TESTNAME='MultiPucker tests' Requires maxthreads 3 @@ -28,18 +28,19 @@ EOF } Furanoid() { - UNITNAME='5-member ring pucker, Cremer & Pople Furanoid test' + UNITNAME='MultiPucker 5-member ring pucker, Cremer & Pople Furanoid test' CheckFor maxthreads 1 if [ $? -eq 0 ] ; then TOP="" INPUT="-i Ptest.in" cat > Ptest.in < Date: Tue, 11 May 2021 12:05:13 -0400 Subject: [PATCH 34/48] Add test for pyranoid sugar, both specified and auto detect --- test/Test_MultiPucker/RunTest.sh | 22 +++++++++++++------- test/Test_MultiPucker/pyranoid.auto.dat.save | 2 ++ test/Test_MultiPucker/pyranoid.type.dat.save | 2 ++ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 test/Test_MultiPucker/pyranoid.auto.dat.save create mode 100644 test/Test_MultiPucker/pyranoid.type.dat.save diff --git a/test/Test_MultiPucker/RunTest.sh b/test/Test_MultiPucker/RunTest.sh index dce10928de..97bde53f2f 100755 --- a/test/Test_MultiPucker/RunTest.sh +++ b/test/Test_MultiPucker/RunTest.sh @@ -3,7 +3,7 @@ . ../MasterTest.sh # Clean -CleanFiles pucker.in nucleic.dat furanoid.dat +CleanFiles pucker.in nucleic.dat furanoid.dat pyranoid.type.dat pyranoid.auto.dat TESTNAME='MultiPucker tests' Requires maxthreads 3 @@ -45,24 +45,32 @@ EOF } Pyranoid() { - UNITNAME='6-member ring pucker, Cremer & Pople Pyranoid test' + UNITNAME='MultiPucker 6-member ring pucker, Cremer & Pople Pyranoid test' CheckFor maxthreads 1 if [ $? -eq 0 ] ; then TOP="" INPUT="-i Ptest.in" cat > Ptest.in < Date: Tue, 11 May 2021 12:06:00 -0400 Subject: [PATCH 35/48] Fix test name --- test/Test_MultiPucker/RunTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Test_MultiPucker/RunTest.sh b/test/Test_MultiPucker/RunTest.sh index 97bde53f2f..87a969826a 100755 --- a/test/Test_MultiPucker/RunTest.sh +++ b/test/Test_MultiPucker/RunTest.sh @@ -62,7 +62,7 @@ multipucker Pyr pyranose cremer \ amplitude ampout pyranoid.auto.dat \ theta thetaout pyranoid.auto.dat range360 EOF - RunCpptraj "6-member ring pucker, Cremer & Pople Pyranoid test." + RunCpptraj "$UNITNAME" DoTest pyranoid.type.dat.save pyranoid.type.dat DoTest pyranoid.auto.dat.save pyranoid.auto.dat fi From d7674c599bbed69be6321ebedcf0aa253dd51d0b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 14:43:41 -0400 Subject: [PATCH 36/48] Properly trap when no topolgies loaded for info commands. --- src/DataSetList.cpp | 6 +++++- src/Exec_Top.cpp | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/DataSetList.cpp b/src/DataSetList.cpp index a8e613a384..776a78c4fb 100644 --- a/src/DataSetList.cpp +++ b/src/DataSetList.cpp @@ -1086,8 +1086,12 @@ Topology* DataSetList::GetTopByIndex(ArgList& argIn) const { return 0; } } - if (top == 0) // By default return first parm if nothing else specified. + if (top == 0) { + // By default return first parm if nothing else specified. + if (TopList_.empty()) + return 0; top = TopList_.front(); + } return ((DataSet_Topology*)top)->TopPtr(); } diff --git a/src/Exec_Top.cpp b/src/Exec_Top.cpp index 10f3551fdd..6cabe0f530 100644 --- a/src/Exec_Top.cpp +++ b/src/Exec_Top.cpp @@ -29,7 +29,10 @@ static int CommonSetup(TopInfo& info, CpptrajState& State, ArgList& argIn, const if (REF.error()) return 1; if (REF.empty()) { parm = State.DSL().GetTopByIndex( argIn ); - if (parm == 0) return 1; + if (parm == 0) { + mprinterr("Error: No topologies loaded.\n"); + return 1; + } } else mprintf("\tUsing '%s'\n", REF.refName()); std::string outname = argIn.GetStringKey("out"); From 5a87a34cdb4d0dccf57ebdebcfd8cad579df4020 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 14:45:07 -0400 Subject: [PATCH 37/48] Hide some debug info --- src/Action_MultiPucker.cpp | 3 +++ src/Pucker_PuckerToken.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 33a344dc0d..23cff2640a 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -73,6 +73,9 @@ Action::RetType Action_MultiPucker::Init(ArgList& actionArgs, ActionInit& init, mprintf("\tUsing Altona & Sundaralingam method.\n"); else if (defaultMethod_ == Pucker::CREMER_POPLE) mprintf("\tUsing Cremer & Pople method.\n"); + else + mprintf("\tAltona & Sundaralingam method will be used for 5 atom puckers.\n" + "\tCremer & Pople method will be used for 6 atom puckers.\n"); if (offset_!=0) mprintf("\tOffset: %f degrees will be added to values.\n", offset_); if (puckerMin_ > -180.0) diff --git a/src/Pucker_PuckerToken.cpp b/src/Pucker_PuckerToken.cpp index 37d32716c6..3966893769 100644 --- a/src/Pucker_PuckerToken.cpp +++ b/src/Pucker_PuckerToken.cpp @@ -18,10 +18,10 @@ const { if (idx >= maxidx) { // Make sure this is a cycle (i.e. this should be bonded to the first atom detected) - mprintf("DEBUG: Checking for cycle at=%i idx=%u maxidx=%u indices=", at, idx, maxidx); - for (std::vector::const_iterator it = indices.begin(); it != indices.end(); ++it) - mprintf(" %i", *it); - mprintf("\n"); + //mprintf("DEBUG: Checking for cycle at=%i idx=%u maxidx=%u indices=", at, idx, maxidx); + //for (std::vector::const_iterator it = indices.begin(); it != indices.end(); ++it) + // mprintf(" %i", *it); + //mprintf("\n"); if (idx > maxidx) { // Sanity check mprinterr("Internal Error: PuckerToken::FindAtoms: Index out of range.\n"); @@ -67,10 +67,10 @@ const } } // DEBUG - mprintf("DEBUG: Results for pucker '%s', residue %i:", name_.c_str(), resnum+1); - for (std::vector::const_iterator it = indices.begin(); it != indices.end(); ++it) - mprintf(" %i", *it); - mprintf("\n"); + //mprintf("DEBUG: Results for pucker '%s', residue %i:", name_.c_str(), resnum+1); + //for (std::vector::const_iterator it = indices.begin(); it != indices.end(); ++it) + // mprintf(" %i", *it); + //mprintf("\n"); // Check if the entire pucker was found. std::vector actualIndices; actualIndices.reserve(atomNames_.size()); From 72e8451d7c015cd71eac095d62975ba7e7787aea Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 14:46:36 -0400 Subject: [PATCH 38/48] Make PrintTypes const --- src/DihedralSearch.cpp | 6 +++--- src/DihedralSearch.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DihedralSearch.cpp b/src/DihedralSearch.cpp index 5961ceaed7..4edb49e323 100644 --- a/src/DihedralSearch.cpp +++ b/src/DihedralSearch.cpp @@ -324,9 +324,9 @@ void DihedralSearch::Clear() { } // DihedralSearch::PrintTypes() -void DihedralSearch::PrintTypes() { - for (std::vector::iterator tkn = dihedralTokens_.begin(); - tkn != dihedralTokens_.end(); ++tkn) +void DihedralSearch::PrintTypes() const { + for (std::vector::const_iterator tkn = dihedralTokens_.begin(); + tkn != dihedralTokens_.end(); ++tkn) mprintf(" %s", tkn->Name().c_str()); } diff --git a/src/DihedralSearch.h b/src/DihedralSearch.h index 080bee6c66..ce57dc5c07 100644 --- a/src/DihedralSearch.h +++ b/src/DihedralSearch.h @@ -48,7 +48,7 @@ class DihedralSearch { /// Clear found dihedrals only. void ClearFound() { dihedrals_.clear(); } /// Print dihedrals currently being searched for. - void PrintTypes(); + void PrintTypes() const; /// \return Mask of atoms that will move upon rotation. static AtomMask MovingAtoms(Topology const&, int, int); private: From 4b88e6725e8ae3308d71881d5375ab5594b25d51 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 14:59:48 -0400 Subject: [PATCH 39/48] Add index to multipcuker setup output. Make multidihedral setup output like multipucker --- src/Action_MultiDihedral.cpp | 10 +++------- src/Action_MultiPucker.cpp | 2 +- src/DihedralSearch.cpp | 9 +++++++++ src/DihedralSearch.h | 1 + 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Action_MultiDihedral.cpp b/src/Action_MultiDihedral.cpp index 412d31bf59..8f75ddb5be 100644 --- a/src/Action_MultiDihedral.cpp +++ b/src/Action_MultiDihedral.cpp @@ -109,13 +109,9 @@ Action::RetType Action_MultiDihedral::Setup(ActionSetup& setup) { outfile_->AddDataSet( ds ); } data_.push_back( ds ); - if (debug_ > 0) { - mprintf("\tDIH [%s]:", ds->legend()); - mprintf(" :%i@%i", setup.Top()[dih->A0()].ResNum()+1, dih->A0() + 1); - mprintf(" :%i@%i", setup.Top()[dih->A1()].ResNum()+1, dih->A1() + 1); - mprintf(" :%i@%i", setup.Top()[dih->A2()].ResNum()+1, dih->A2() + 1); - mprintf(" :%i@%i\n", setup.Top()[dih->A3()].ResNum()+1, dih->A3() + 1); - } + //if (debug_ > 0) { + mprintf("\t%zu [%s]: %s\n", data_.size(), ds->legend(), dih->DihedralMaskString(setup.Top()).c_str()); + //} } return Action::OK; } diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 23cff2640a..69c49f8425 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -202,7 +202,7 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) //if (debug_ > 0) { static const char* methodStr[] = { "Altona", "Cremer", "Unspecified" }; - mprintf("\tPUCKER [%s]: %s (%s)\n", ds->legend(), pucker->PuckerMaskString(setup.Top()).c_str(), + mprintf("\t%zu [%s]: %s (%s)\n", data_.size(),ds->legend(), pucker->PuckerMaskString(setup.Top()).c_str(), methodStr[puckerMethods_.back()]); //} } diff --git a/src/DihedralSearch.cpp b/src/DihedralSearch.cpp index 4edb49e323..58120ef487 100644 --- a/src/DihedralSearch.cpp +++ b/src/DihedralSearch.cpp @@ -93,6 +93,15 @@ DihedralSearch::DihedralMask::DihedralMask(int a0, int a1, int a2, int a3, DihedralType t) : a0_(a0), a1_(a1), a2_(a2), a3_(a3), res_(res), name_(n), type_(t) {} +/** \return string based on atoms in mask. */ +std::string DihedralSearch::DihedralMask::DihedralMaskString(Topology const& topIn) const { + std::string out( topIn.TruncResNameAtomName( a0_ )); + out.append(" " + topIn.TruncResNameAtomName( a1_ )); + out.append(" " + topIn.TruncResNameAtomName( a2_ )); + out.append(" " + topIn.TruncResNameAtomName( a3_ )); + return out; +} + // ----------------------------------------------------------------------------- // CONSTRUCTOR - Custom type DihedralSearch::DihedralToken::DihedralToken(int off, diff --git a/src/DihedralSearch.h b/src/DihedralSearch.h index ce57dc5c07..469959a1b4 100644 --- a/src/DihedralSearch.h +++ b/src/DihedralSearch.h @@ -95,6 +95,7 @@ class DihedralSearch::DihedralMask { std::string const& Name() const { return name_; } bool None() const { return (a0_ == -1); } DihedralType Type() const { return type_; } + std::string DihedralMaskString(Topology const&) const; private: int a0_, a1_, a2_, a3_, res_; std::string name_; From 5df6fa6bd360a550b8997f8f7eb66ee07d951e57 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 15:11:01 -0400 Subject: [PATCH 40/48] Enable multipucker test --- test/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/Makefile b/test/Makefile index 42609c3c00..9061002c6e 100644 --- a/test/Makefile +++ b/test/Makefile @@ -480,6 +480,9 @@ test.flatten: test.random: @-cd Test_Random && ./RunTest.sh $(OPT) +test.multipucker: + @-cd Test_MultiPucker && ./RunTest.sh $(OPT) + # Every test target should go here. COMPLETETESTS=test.general \ test.strip \ @@ -633,7 +636,8 @@ COMPLETETESTS=test.general \ test.evalplateau \ test.graft \ test.flatten \ - test.random + test.random \ + test.multipucker test.all: $(MAKE) test.complete summary From 540e3d8fe0a054dbb4e63edd7732ce35ca8d27bc Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 15:11:03 -0400 Subject: [PATCH 41/48] Revision bump for addition of multipucker command --- src/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Version.h b/src/Version.h index 37ebe70960..bdbe66bb49 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.3.2" +#define CPPTRAJ_INTERNAL_VERSION "V5.3.3" /// PYTRAJ relies on this #define CPPTRAJ_VERSION_STRING CPPTRAJ_INTERNAL_VERSION #endif From b1f5696da52beb6c929d82b119daa3e883b38e64 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 15:13:17 -0400 Subject: [PATCH 42/48] Does not really need fixing --- src/Action_MultiDihedral.cpp | 2 +- src/Action_MultiPucker.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Action_MultiDihedral.cpp b/src/Action_MultiDihedral.cpp index 8f75ddb5be..cefe5e5f58 100644 --- a/src/Action_MultiDihedral.cpp +++ b/src/Action_MultiDihedral.cpp @@ -95,7 +95,7 @@ Action::RetType Action_MultiDihedral::Setup(ActionSetup& setup) { dih != dihSearch_.end(); ++dih) { int resNum = dih->ResNum() + 1; - // See if Dataset already present. FIXME should AddSet do this? + // See if Dataset already present. MetaData md( dsetname_, dih->Name(), resNum ); DataSet* ds = masterDSL_->CheckForSet(md); if (ds == 0) { diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 69c49f8425..5bd7a02fb2 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -152,7 +152,7 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) puckerMethods_.push_back( methodToUse ); int resNum = pucker->ResNum() + 1; - // See if Dataset already present. FIXME should AddSet do this? + // See if Dataset already present. MetaData md( dsetname_, pucker->Name(), resNum ); DataSet* ds = masterDSL_->CheckForSet(md); if (ds == 0) { From 3a6bbcb1b5ac866de119fee94d0b194db3b873ac Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 15:20:28 -0400 Subject: [PATCH 43/48] Protect against divide by zero --- src/Action_NativeContacts.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Action_NativeContacts.cpp b/src/Action_NativeContacts.cpp index e27e7a65b1..2b21e13a08 100644 --- a/src/Action_NativeContacts.cpp +++ b/src/Action_NativeContacts.cpp @@ -731,7 +731,10 @@ void Action_NativeContacts::WriteContactPDB( contactListType& ContactsIn, Cpptra } // Normalize so the strongest contact value is 100.00 norm = (double)*std::max_element(atomContactFrac.begin(), atomContactFrac.end()); - norm = 100.00 / norm; + if (norm > 0) + norm = 100.00 / norm; + else + norm = 1.0; PDBfile& contactPDB = static_cast( *fileIn ); mprintf("\tWriting contacts PDB to '%s'\n", fileIn->Filename().full()); contactPDB.WriteTITLE( numnative_->Meta().Name() + " " + Mask1_.MaskExpression() + " " + From 8651134ccb43d883df44e5774f5233b47e284ab6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 15:34:23 -0400 Subject: [PATCH 44/48] Fix up help --- src/Action_DihedralRMS.cpp | 2 +- src/Action_MultiDihedral.cpp | 5 ++--- src/Action_MultiPucker.cpp | 9 +++++++-- src/DihedralSearch.cpp | 4 +++- src/DihedralSearch.h | 2 +- src/Pucker_PuckerSearch.cpp | 12 ++++++++++++ src/Pucker_PuckerSearch.h | 6 ++++++ 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/Action_DihedralRMS.cpp b/src/Action_DihedralRMS.cpp index 19dfbb3f46..40b7f37bb0 100644 --- a/src/Action_DihedralRMS.cpp +++ b/src/Action_DihedralRMS.cpp @@ -18,7 +18,7 @@ void Action_DihedralRMS::Help() const { "\t[tgtrange [refrange ]]\n" " Calculate RMSD of selected dihedrals to dihedrals in a\n" " reference structure.\n", - ReferenceAction::Help(), DihedralSearch::newTypeArgsHelp_); + ReferenceAction::Help(), DihedralSearch::newTypeArgsHelp()); } // Action_DihedralRMS::Init() diff --git a/src/Action_MultiDihedral.cpp b/src/Action_MultiDihedral.cpp index cefe5e5f58..5a0d61e4e7 100644 --- a/src/Action_MultiDihedral.cpp +++ b/src/Action_MultiDihedral.cpp @@ -13,10 +13,9 @@ Action_MultiDihedral::Action_MultiDihedral() : {} void Action_MultiDihedral::Help() const { - mprintf("\t[] [resrange ] [out ] [range360]\n"); - mprintf("\t[dihtype ::::[:] ...]\n"); + mprintf("\t[] [] [resrange ] [out ] [range360]\n"); + mprintf("\t[%s]\n", DihedralSearch::newTypeArgsHelp()); DihedralSearch::OffsetHelp(); - //mprintf("\t[range360]\n"); mprintf("\t = "); DihedralSearch::ListKnownTypes(); mprintf(" Calculate specified dihedral angle types for residues in given .\n"); diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 5bd7a02fb2..957a9362ba 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -22,9 +22,14 @@ Action_MultiPucker::Action_MultiPucker() : // Action_MultiPucker::Help() void Action_MultiPucker::Help() const { - mprintf("\t[] [ ...] [out ] [altona|cremer]\n" + mprintf("\t[] [] [out ] [altona|cremer]\n" + "\t[%s]\n" "\t[amplitude [ampout ]] [theta [thetaout ]]\n" - "\t[range360] [offset ]\n"); + "\t[range360] [offset ]\n", + Pucker::PuckerSearch::newTypeArgsHelp()); + mprintf("\t = "); + Pucker::PuckerSearch::ListKnownTypes(); + mprintf(" Calculate specified pucker types for residues in given .\n"); } // Action_MultiPucker::Init() diff --git a/src/DihedralSearch.cpp b/src/DihedralSearch.cpp index 58120ef487..3a3dcdb908 100644 --- a/src/DihedralSearch.cpp +++ b/src/DihedralSearch.cpp @@ -251,7 +251,9 @@ void DihedralSearch::SearchForArgs(ArgList& argIn) { } } -const char* DihedralSearch::newTypeArgsHelp_ = "dihtype ::::[:] ..."; +const char* DihedralSearch::newTypeArgsHelp() { + return "dihtype ::::[:] ..."; +} /** Get custom dihedral arguments: * 'dihtype ::::[:]' diff --git a/src/DihedralSearch.h b/src/DihedralSearch.h index 469959a1b4..c3702fe649 100644 --- a/src/DihedralSearch.h +++ b/src/DihedralSearch.h @@ -31,7 +31,7 @@ class DihedralSearch { /// Search for known dihedral type keywords. void SearchForArgs(ArgList&); /// Contains keywords for SearchNewTypeArgs() - static const char* newTypeArgsHelp_; + static const char* newTypeArgsHelp(); /// Search for new type via args int SearchForNewTypeArgs(ArgList&); /// Add a new dihedral type to be searched for. diff --git a/src/Pucker_PuckerSearch.cpp b/src/Pucker_PuckerSearch.cpp index 4edd3b0b57..9c0f81512b 100644 --- a/src/Pucker_PuckerSearch.cpp +++ b/src/Pucker_PuckerSearch.cpp @@ -15,6 +15,13 @@ const char* Pucker::PuckerSearch::Keywords_[] = { "pyranose" // PYRANOSE }; +/** Print known types to stdout. */ +void Pucker::PuckerSearch::ListKnownTypes() { + for (int i = 0; i != (int)NTYPES; i++) + mprintf(" %s", Keywords_[i]); + mprintf("\n"); +} + /** Indicate we want to search for the specified pre-defined pucker. */ int Pucker::PuckerSearch::SearchFor(Type ptype) { PuckerToken::NameArray names; @@ -56,6 +63,11 @@ int Pucker::PuckerSearch::SearchForArgs(ArgList& argIn) { return 0; } +/** New type arg help */ +const char* Pucker::PuckerSearch::newTypeArgsHelp() { + return "puckertype :::::[:] ..."; +} + /** Define a custom pucker argument from ArgList: * 'puckertype ::...:' */ diff --git a/src/Pucker_PuckerSearch.h b/src/Pucker_PuckerSearch.h index 98187a486f..6043264004 100644 --- a/src/Pucker_PuckerSearch.h +++ b/src/Pucker_PuckerSearch.h @@ -15,6 +15,12 @@ class PuckerToken; class PuckerSearch { public: PuckerSearch(); + + /// Print known type keywords to stdout + static void ListKnownTypes(); + /// Print help for new type args + static const char* newTypeArgsHelp(); + /// Search for any defined puckers in residue range in given Topology int FindPuckers(Topology const&, Range const&); /// Indicate we want to search for the given pre-defined type From d62adfa9357b98ebd106feae82dce040d59524e5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 15:52:20 -0400 Subject: [PATCH 45/48] Add missing resrange arg to help --- src/Action_MultiPucker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 957a9362ba..10c36d6f78 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -22,8 +22,8 @@ Action_MultiPucker::Action_MultiPucker() : // Action_MultiPucker::Help() void Action_MultiPucker::Help() const { - mprintf("\t[] [] [out ] [altona|cremer]\n" - "\t[%s]\n" + mprintf("\t[] [] [resrange ] [out ]\n" + "\t[altona|cremer] [%s]\n" "\t[amplitude [ampout ]] [theta [thetaout ]]\n" "\t[range360] [offset ]\n", Pucker::PuckerSearch::newTypeArgsHelp()); From 17d7cb4be6d959c4355f6b867e4777dfc1595f30 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 15:52:34 -0400 Subject: [PATCH 46/48] Add multipucker manual entry. --- doc/cpptraj.lyx | 216 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 214 insertions(+), 2 deletions(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 100df26df2..596dddae10 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -29967,11 +29967,11 @@ Offset: -2= in previous res, -1= in previous res, 0=All \end_deeper \begin_layout Standard -DataSet Aspects: +DataSets Generated: \end_layout \begin_layout Description -[[] [] [out ] [resrange ] +\end_layout + +\begin_layout LyX-Code + [altona|cremer] [puckertype :::::[:] + ...] +\end_layout + +\begin_layout LyX-Code + [amplitude [ampout ]] [theta [thetaout ]] +\end_layout + +\begin_layout LyX-Code + [range360] [offset ] +\end_layout + +\begin_layout LyX-Code + = nucleic furanose pyranose +\end_layout + +\begin_deeper +\begin_layout Description +[] Output data set name. +\end_layout + +\begin_layout Description + Pucker types to look for. + +\end_layout + +\begin_layout Description +[out +\begin_inset space ~ +\end_inset + +] Output file name to write pucker data to. +\end_layout + +\begin_layout Description +[resrange +\begin_inset space ~ +\end_inset + +] Residue range to look for puckers in. + Default is all solute residues. +\end_layout + +\begin_layout Description +[puckertype +\begin_inset space ~ +\end_inset + +:::::[:] Search for a custom pucker type called + using atom names , , , , and (also for + 6 atom puckers). +\end_layout + +\begin_layout Description +[altona] Use method of Altona & Sundaralingam (5 atoms only). + This is the default when pucker has 5 atoms. +\end_layout + +\begin_layout Description +[cremer] Use method of Cremer and Pople (5 or 6 atoms). + This is the default when pucker has 6 atoms. +\end_layout + +\begin_layout Description +[amplitude] Also calculate amplitude (in degrees). +\end_layout + +\begin_deeper +\begin_layout Description +ampout +\begin_inset space ~ +\end_inset + + File to write amplitude sets to. +\end_layout + +\end_deeper +\begin_layout Description +[theta] (Valid for 6 atoms only) Also calculate theta (in degrees). +\end_layout + +\begin_deeper +\begin_layout Description +thetaout +\begin_inset space ~ +\end_inset + + File to write theta sets to. +\end_layout + +\end_deeper +\begin_layout Description +[range360] Wrap pucker values from 0.0 to 360.0 (default is -180.0 to 180.0). +\end_layout + +\begin_layout Description +[offset +\begin_inset space ~ +\end_inset + +] Add to pucker values. +\end_layout + +\begin_layout Standard +DataSets Generated: +\end_layout + +\begin_layout Description +[]:<#> Aspect corresponds to the pucker type name (e.g. + [nucleic], [furanose], etc). + The index is the residue number. +\end_layout + +\begin_layout Description +[Amp]:<#> +\series bold +amplitude +\series default + only. + Data set for pucker amplitude. +\end_layout + +\begin_layout Description +[Theta]:<#> +\series bold +theta +\series default + only. + Data set for pucker theta. +\end_layout + +\end_deeper +\begin_layout Standard + +\shape italic +Note data sets are not generated until +\series bold +run +\series default + is called. +\end_layout + +\begin_layout Standard +Calculate specified pucker types for residues in given range. + By default, puckers are identified based on standard Amber atom names. + The resulting data sets will have aspect equal to [] and index + equal to residue #. + In order to be identified as a pucker, all consecutive atoms in the pucker + must be bonded, and the last atom of the pucker must be bonded to the first. +\end_layout + +\begin_layout Standard +For example, to calculate all nucleic acid ribose puckers for residues 6 + to 9: +\end_layout + +\begin_layout LyX-Code +multipucker MyPuckers nucleic resrange 6-9 out Pucker_6-9.dat +\end_layout + +\begin_layout Standard +This will generate data sets named MyPuckers[nucleic]:6, MyPuckers[nucleic]:7, + etc. + Puckers other than those defined in +\series bold + +\series default + can be searched for using +\series bold +puckertype +\series default +. + For example to create a custom pucker type called furanoid using atoms + C2, C3, C4, C5, and O2, then search for and calculate that pucker (with + amplitudes) using the method of Cremer and Pople in all residues: +\end_layout + +\begin_layout LyX-Code +multipucker Furanoid puckertype furanoid:C2:C3:C4:C5:O2 cremer +\backslash + +\end_layout + +\begin_layout LyX-Code + out furanoid.dat amplitude ampout furanoid.dat +\end_layout + \begin_layout Subsection multivector \end_layout From 186f38e962535bdaf25fa86b2fe936a28a95e104 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 15:55:28 -0400 Subject: [PATCH 47/48] Add note about GMXDATA env. variable. #901 and #893 should be addressed now. --- doc/cpptraj.lyx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 596dddae10..14307c0bf8 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -13382,6 +13382,17 @@ Charmm PSF: \end_layout \end_deeper +\begin_layout Subsubsection +Gromacs Top +\end_layout + +\begin_layout Standard +By default cpptraj will look for Gromacs topology data (that is not in the + same directory) in the directory defined by the GMXDATA environment variable; + specifically, it expects things to be in the "$GMXDATA/top" directory. + +\end_layout + \begin_layout Subsection parmbox \end_layout From 863e9a3bac7af9f4316f58aa54f55c211507ea7b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Tue, 11 May 2021 19:52:35 -0400 Subject: [PATCH 48/48] Fix argument formatting --- src/Action_MultiPucker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Action_MultiPucker.cpp b/src/Action_MultiPucker.cpp index 10c36d6f78..46b6d0115c 100644 --- a/src/Action_MultiPucker.cpp +++ b/src/Action_MultiPucker.cpp @@ -150,7 +150,8 @@ Action::RetType Action_MultiPucker::Setup(ActionSetup& setup) methodToUse = Pucker::ALTONA_SUNDARALINGAM; } else if (methodToUse == Pucker::ALTONA_SUNDARALINGAM) { if (pucker->Natoms() > 5) { - mprinterr("Error: Pucker '%s' has too many atoms for Altona-Sundaralingam method.\n"); + mprinterr("Error: Pucker '%s' res %i has too many atoms for Altona-Sundaralingam method.\n", + pucker->Name().c_str(), pucker->ResNum()); return Action::ERR; } }