Skip to content

Commit 8338b3d

Browse files
committed
Now the Secondary structure works with the manual and the new shorcuts
1 parent 2060d68 commit 8338b3d

File tree

8 files changed

+74
-9
lines changed

8 files changed

+74
-9
lines changed

src/secondarystructure/AlphaRMSD.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class AlphaRMSD : public ActionShortcut {
108108
PLUMED_REGISTER_ACTION(AlphaRMSD,"ALPHARMSD")
109109

110110
void AlphaRMSD::registerKeywords( Keywords& keys ) {
111-
SecondaryStructureBase<Vector>::registerKeywords( keys );
111+
SecondaryStructureInput::registerKeywords( keys );
112112
keys.remove("ATOMS");
113113
keys.remove("SEGMENT");
114114
keys.remove("STRUCTURE");
@@ -122,11 +122,11 @@ AlphaRMSD::AlphaRMSD(const ActionOptions&ao):
122122
ActionShortcut(ao) {
123123
// Read in the input and create a string that describes how to compute the less than
124124
std::string ltmap;
125-
bool uselessthan=SecondaryStructureBase<Vector>::readShortcutWords( ltmap, this );
125+
bool uselessthan=SecondaryStructureInput::readShortcutWords( ltmap, this );
126126
// read in the backbone atoms
127127
std::vector<unsigned> chains;
128128
std::vector<std::string> all_atoms;
129-
SecondaryStructureBase<Vector>::readBackboneAtoms( this, plumed, "protein", chains, all_atoms );
129+
SecondaryStructureInput::readBackboneAtoms( this, plumed, "protein", chains, all_atoms );
130130

131131
// This constructs all conceivable sections of alpha helix in the backbone of the chains
132132
unsigned nprevious=0, segno=1;

src/secondarystructure/AntibetaRMSD.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class AntibetaRMSD : public ActionShortcut {
116116
PLUMED_REGISTER_ACTION(AntibetaRMSD,"ANTIBETARMSD")
117117

118118
void AntibetaRMSD::registerKeywords( Keywords& keys ) {
119-
SecondaryStructureBase<Vector>::registerKeywords( keys );
119+
SecondaryStructureInput::registerKeywords( keys );
120120
keys.remove("ATOMS");
121121
keys.remove("SEGMENT");
122122
keys.remove("STRUCTURE");
@@ -140,11 +140,11 @@ AntibetaRMSD::AntibetaRMSD(const ActionOptions&ao):
140140
ActionShortcut(ao) {
141141
// Read in the input and create a string that describes how to compute the less than
142142
std::string ltmap;
143-
bool uselessthan=SecondaryStructureBase<Vector>::readShortcutWords( ltmap, this );
143+
bool uselessthan=SecondaryStructureInput::readShortcutWords( ltmap, this );
144144
// read in the backbone atoms
145145
std::vector<unsigned> chains;
146146
std::vector<std::string> all_atoms;
147-
SecondaryStructureBase<Vector>::readBackboneAtoms( this, plumed, "protein", chains, all_atoms );
147+
SecondaryStructureInput::readBackboneAtoms( this, plumed, "protein", chains, all_atoms );
148148

149149
bool intra_chain(false), inter_chain(false);
150150
std::string style;

src/secondarystructure/ParabetaRMSD.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class ParabetaRMSD : public ActionShortcut {
116116
PLUMED_REGISTER_ACTION(ParabetaRMSD,"PARABETARMSD")
117117

118118
void ParabetaRMSD::registerKeywords( Keywords& keys ) {
119-
SecondaryStructureBase<Vector>::registerKeywords( keys );
119+
SecondaryStructureInput::registerKeywords( keys );
120120
keys.remove("ATOMS");
121121
keys.remove("SEGMENT");
122122
keys.remove("STRUCTURE");
@@ -141,11 +141,11 @@ ParabetaRMSD::ParabetaRMSD(const ActionOptions&ao):
141141
ActionShortcut(ao) {
142142
// Read in the input and create a string that describes how to compute the less than
143143
std::string ltmap;
144-
bool uselessthan=SecondaryStructureBase<Vector>::readShortcutWords( ltmap, this );
144+
bool uselessthan=SecondaryStructureInput::readShortcutWords( ltmap, this );
145145
// read in the backbone atoms
146146
std::vector<unsigned> chains;
147147
std::vector<std::string> all_atoms;
148-
SecondaryStructureBase<Vector>::readBackboneAtoms( this, plumed, "protein", chains, all_atoms );
148+
SecondaryStructureInput::readBackboneAtoms( this, plumed, "protein", chains, all_atoms );
149149

150150
bool intra_chain(false), inter_chain(false);
151151
std::string style;

src/secondarystructure/SecondaryStructureBase.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "core/GenericMolInfo.h"
3030
#include "core/ParallelTaskManager.h"
3131
#include "tools/ColvarOutput.h"
32+
#include "tools/TypeUtils.h"
3233
#include <vector>
3334
#include <type_traits>
3435

@@ -86,6 +87,9 @@ class SecondaryStructureBase: public ActionWithVector {
8687
static void getForceIndices( std::size_t task_index, std::size_t colno, std::size_t ntotal_force, const T& actiondata, const ParallelActionsInput& input, ForceIndexHolder force_indices );
8788
};
8889

90+
//this is used to get some of the static non template dependant functionalities for Secondary structure
91+
using SecondaryStructureInput=SecondaryStructureBase<Empty>;
92+
8993
template <class T,typename myPTM>
9094
unsigned SecondaryStructureBase<T,myPTM>::getNumberOfDerivatives() {
9195
return 3*getNumberOfAtoms()+virialSize;
@@ -112,6 +116,7 @@ bool SecondaryStructureBase<T,myPTM>::readShortcutWords( std::string& ltmap, Act
112116
template <class T,typename myPTM>
113117
void SecondaryStructureBase<T,myPTM>::registerKeywords( Keywords& keys ) {
114118
ActionWithVector::registerKeywords( keys );
119+
T::registerKeywords( keys );
115120
PTM::registerKeywords( keys );
116121
keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions");
117122
keys.addInputKeyword("optional","MASK","vector","a vector which is used to determine which elements of the secondary structure variable should be computed");

src/secondarystructure/SecondaryStructureDRMSD.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ class SecondaryStructureDRMSDInput {
9999
flexibleMemory<unsigned> drmsd_atoms{};
100100
/// The general input for the secondary structure variable
101101
public:
102+
static void registerKeywords( Keywords& keys ) {
103+
keys.setDisplayName("SECONDARY_STRUCTURE_DRMSD");
104+
}
102105
static constexpr bool needsBondLength=true;
103106
typedef T precision;
104107
size_t natoms{0};

src/secondarystructure/SecondaryStructureRMSD.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ class SecondaryStructureRMSDInput {
125125
/// The list of reference configurations
126126
std::vector<RMSD> myrmsd;
127127
public:
128+
static void registerKeywords( Keywords& keys ) {
129+
keys.setDisplayName("SECONDARY_STRUCTURE_RMSD");
130+
}
128131
static constexpr bool needsType=true;
129132
/// The number of atoms
130133
std::size_t natoms;

src/tools/TypeUtils.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2+
Copyright (c) 2012-2025 The plumed team
3+
(see the PEOPLE file at the root of the distribution for a list of names)
4+
5+
See http://www.plumed.org for more information.
6+
7+
This file is part of plumed, version 2.
8+
9+
plumed is free software: you can redistribute it and/or modify
10+
it under the terms of the GNU Lesser General Public License as published by
11+
the Free Software Foundation, either version 3 of the License, or
12+
(at your option) any later version.
13+
14+
plumed is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU Lesser General Public License for more details.
18+
19+
You should have received a copy of the GNU Lesser General Public License
20+
along with plumed. If not, see <http://www.gnu.org/licenses/>.
21+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22+
#include "TypeUtils.h"

src/tools/TypeUtils.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2+
Copyright (c) 2012-2025 The plumed team
3+
(see the PEOPLE file at the root of the distribution for a list of names)
4+
5+
See http://www.plumed.org for more information.
6+
7+
This file is part of plumed, version 2.
8+
9+
plumed is free software: you can redistribute it and/or modify
10+
it under the terms of the GNU Lesser General Public License as published by
11+
the Free Software Foundation, either version 3 of the License, or
12+
(at your option) any later version.
13+
14+
plumed is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU Lesser General Public License for more details.
18+
19+
You should have received a copy of the GNU Lesser General Public License
20+
along with plumed. If not, see <http://www.gnu.org/licenses/>.
21+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22+
#ifndef __PLUMED_tools_TypeUtils_h
23+
#define __PLUMED_tools_TypeUtils_h
24+
namespace PLMD {
25+
class Keywords;
26+
// An empty type witha a empty registerKeywords
27+
// This is useful when setting up certains shortcuts (see ANTIBETARMSD for example)
28+
struct Empty {
29+
static void registerKeywords( Keywords& keys ) {}
30+
};
31+
} //namespace PLMD
32+
#endif // __PLUMED_tools_TypeUtils_h

0 commit comments

Comments
 (0)