Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 : Copyright (c) 2012-2023 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 "SecondaryStructureRMSD.h"
23 : #include "core/ActionShortcut.h"
24 : #include "core/ActionRegister.h"
25 :
26 : namespace PLMD {
27 : namespace secondarystructure {
28 :
29 : //+PLUMEDOC COLVAR PARABETARMSD
30 : /*
31 : Probe the parallel beta sheet content of your protein structure.
32 :
33 : Two protein segments containing three contiguous residues can form a parallel beta sheet.
34 : Although if the two segments are part of the same protein chain they must be separated by
35 : a minimum of 3 residues to make room for the turn. This colvar thus generates the set of
36 : all possible six residue sections that could conceivably form a parallel beta sheet
37 : and calculates the RMSD distance between the configuration in which the residues find themselves
38 : and an idealized parallel beta sheet structure. These distances can be calculated by either
39 : aligning the instantaneous structure with the reference structure and measuring each
40 : atomic displacement or by calculating differences between the set of inter-atomic
41 : distances in the reference and instantaneous structures.
42 :
43 : This colvar is based on the following reference \cite pietrucci09jctc. The authors of
44 : this paper use the set of distances from the parallel beta sheet configurations to measure
45 : the number of segments whose configuration resembles a parallel beta sheet. This is done by calculating
46 : the following sum of functions of the rmsd distances:
47 :
48 : \f[
49 : s = \sum_i \frac{ 1 - \left(\frac{r_i-d_0}{r_0}\right)^n } { 1 - \left(\frac{r_i-d_0}{r_0}\right)^m }
50 : \f]
51 :
52 : where the sum runs over all possible segments of parallel beta sheet. By default the
53 : NN, MM and D_0 parameters are set equal to those used in \cite pietrucci09jctc. The R_0
54 : parameter must be set by the user - the value used in \cite pietrucci09jctc was 0.08 nm.
55 :
56 : If you change the function in the above sum you can calculate quantities such as the average
57 : distance from a structure composed of only parallel beta sheets or the distance between the set of
58 : residues that is closest to a parallel beta sheet and the reference configuration. To do these sorts of
59 : calculations you can use the AVERAGE and MIN keywords. In addition you can use the LESS_THAN
60 : keyword if you would like to change the form of the switching function. If you use any of these
61 : options you no longer need to specify NN, R_0, MM and D_0.
62 :
63 : Please be aware that for codes like gromacs you must ensure that plumed
64 : reconstructs the chains involved in your CV when you calculate this CV using
65 : anything other than TYPE=DRMSD. For more details as to how to do this see \ref WHOLEMOLECULES.
66 :
67 : \par Examples
68 :
69 : The following input calculates the number of six residue segments of
70 : protein that are in an parallel beta sheet configuration.
71 :
72 : \plumedfile
73 : #SETTINGS MOLFILE=regtest/basic/rt32/helix.pdb
74 : MOLINFO STRUCTURE=beta.pdb
75 : pb: PARABETARMSD RESIDUES=all STRANDS_CUTOFF=1
76 : \endplumedfile
77 :
78 : Here the same is done use RMSD instead of DRMSD
79 :
80 : \plumedfile
81 : #SETTINGS MOLFILE=regtest/basic/rt32/helix.pdb
82 : MOLINFO STRUCTURE=helix.pdb
83 : WHOLEMOLECULES ENTITY0=1-100
84 : hh: PARABETARMSD RESIDUES=all TYPE=OPTIMAL R_0=0.1 STRANDS_CUTOFF=1
85 : \endplumedfile
86 :
87 : */
88 : //+ENDPLUMEDOC
89 :
90 : class ParabetaRMSD : public ActionShortcut {
91 : public:
92 : static void registerKeywords( Keywords& keys );
93 : explicit ParabetaRMSD(const ActionOptions&);
94 : };
95 :
96 : PLUMED_REGISTER_ACTION(ParabetaRMSD,"PARABETARMSD")
97 :
98 83 : void ParabetaRMSD::registerKeywords( Keywords& keys ) {
99 83 : SecondaryStructureRMSD::registerKeywords( keys );
100 249 : keys.remove("ATOMS"); keys.remove("SEGMENT"); keys.remove("BONDLENGTH");
101 249 : keys.remove("NO_ACTION_LOG"); keys.remove("CUTOFF_ATOMS"); keys.remove("STRUCTURE");
102 166 : keys.add("compulsory","STYLE","all","Parallel beta sheets can either form in a single chain or from a pair of chains. If STYLE=all all "
103 : "chain configuration with the appropriate geometry are counted. If STYLE=inter "
104 : "only sheet-like configurations involving two chains are counted, while if STYLE=intra "
105 : "only sheet-like configurations involving a single chain are counted");
106 83 : keys.needsAction("LOWEST");
107 83 : }
108 :
109 15 : ParabetaRMSD::ParabetaRMSD(const ActionOptions&ao):
110 : Action(ao),
111 15 : ActionShortcut(ao)
112 : {
113 : // Read in the input and create a string that describes how to compute the less than
114 15 : std::string ltmap; bool uselessthan=SecondaryStructureRMSD::readShortcutWords( ltmap, this );
115 : // read in the backbone atoms
116 30 : std::vector<unsigned> chains; std::string atoms; SecondaryStructureRMSD::readBackboneAtoms( this, plumed, "protein", chains, atoms );
117 :
118 : bool intra_chain(false), inter_chain(false); std::string seglist;
119 15 : std::string style; parse("STYLE",style); unsigned jjkk=1;
120 30 : if( Tools::caseInSensStringCompare(style, "all") ) {
121 : intra_chain=true; inter_chain=true;
122 2 : } else if( Tools::caseInSensStringCompare(style, "inter") ) {
123 : intra_chain=false; inter_chain=true;
124 0 : } else if( Tools::caseInSensStringCompare(style, "intra") ) {
125 : intra_chain=true; inter_chain=false;
126 : } else {
127 0 : error( style + " is not a valid directive for the STYLE keyword");
128 : }
129 :
130 : // This constructs all conceivable sections of antibeta sheet in the backbone of the chains
131 : if( intra_chain ) {
132 14 : unsigned nprevious=0; std::vector<unsigned> nlist(30);
133 215 : for(unsigned i=0; i<chains.size(); ++i) {
134 201 : if( chains[i]<40 ) error("segment of backbone is not long enough to form an antiparallel beta hairpin. Each backbone fragment must contain a minimum of 8 residues");
135 : // Loop over all possible triples in each 8 residue segment of protein
136 201 : unsigned nres=chains[i]/5;
137 201 : if( chains[i]%5!=0 ) error("backbone segment received does not contain a multiple of five residues");
138 213 : for(unsigned ires=0; ires<nres-8; ires++) {
139 42 : for(unsigned jres=ires+6; jres<nres-2; jres++) {
140 480 : for(unsigned k=0; k<15; ++k) {
141 450 : nlist[k]=nprevious + ires*5+k;
142 450 : nlist[k+15]=nprevious + jres*5+k;
143 : }
144 : std::string nlstr, num;
145 30 : Tools::convert( nlist[0], nlstr );
146 30 : Tools::convert(jjkk, num); jjkk++;
147 60 : seglist += " SEGMENT" + num + "=" + nlstr;
148 900 : for(unsigned kk=1; kk<nlist.size(); ++kk ) { Tools::convert( nlist[kk], nlstr ); seglist += "," + nlstr; }
149 : }
150 : }
151 201 : nprevious+=chains[i];
152 : }
153 : }
154 : // This constructs all conceivable sections of antibeta sheet that form between chains
155 15 : if( inter_chain ) {
156 21 : if( chains.size()==1 && !Tools::caseInSensStringCompare(style, "all") ) error("there is only one chain defined so cannot use inter_chain option");
157 15 : std::vector<unsigned> nlist(30);
158 219 : for(unsigned ichain=1; ichain<chains.size(); ++ichain) {
159 2040 : unsigned iprev=0; for(unsigned i=0; i<ichain; ++i) iprev+=chains[i];
160 204 : unsigned inres=chains[ichain]/5;
161 204 : if( chains[ichain]%5!=0 ) error("backbone segment received does not contain a multiple of five residues");
162 1428 : for(unsigned ires=0; ires<inres-2; ++ires) {
163 12240 : for(unsigned jchain=0; jchain<ichain; ++jchain) {
164 69768 : unsigned jprev=0; for(unsigned i=0; i<jchain; ++i) jprev+=chains[i];
165 11016 : unsigned jnres=chains[jchain]/5;
166 11016 : if( chains[jchain]%5!=0 ) error("backbone segment received does not contain a multiple of five residues");
167 77112 : for(unsigned jres=0; jres<jnres-2; ++jres) {
168 1057536 : for(unsigned k=0; k<15; ++k) {
169 991440 : nlist[k]=iprev + ires*5+k;
170 991440 : nlist[k+15]=jprev + jres*5+k;
171 : }
172 : std::string nlstr, num;
173 66096 : Tools::convert( nlist[0], nlstr );
174 66096 : Tools::convert(jjkk, num); jjkk++;
175 132192 : seglist += " SEGMENT" + num + "=" + nlstr;
176 1982880 : for(unsigned kk=1; kk<nlist.size(); ++kk ) { Tools::convert( nlist[kk], nlstr ); seglist += "," + nlstr; }
177 : }
178 : }
179 : }
180 : }
181 : }
182 :
183 : // Build the reference structure ( in angstroms )
184 15 : std::vector<Vector> reference(30);
185 15 : reference[0]=Vector( 1.244, -4.620, -2.127); // N i
186 15 : reference[1]=Vector(-0.016, -4.500, -1.395); // CA
187 15 : reference[2]=Vector( 0.105, -5.089, 0.024); // CB
188 15 : reference[3]=Vector(-0.287, -3.000, -1.301); // C
189 15 : reference[4]=Vector( 0.550, -2.245, -0.822); // O
190 15 : reference[5]=Vector(-1.445, -2.551, -1.779); // N i+1
191 15 : reference[6]=Vector(-1.752, -1.130, -1.677); // CA
192 15 : reference[7]=Vector(-2.113, -0.550, -3.059); // CB
193 15 : reference[8]=Vector(-2.906, -0.961, -0.689); // C
194 15 : reference[9]=Vector(-3.867, -1.738, -0.695); // O
195 15 : reference[10]=Vector(-2.774, 0.034, 0.190); // N i+2
196 15 : reference[11]=Vector(-3.788, 0.331, 1.201); // CA
197 15 : reference[12]=Vector(-3.188, 0.300, 2.624); // CB
198 15 : reference[13]=Vector(-4.294, 1.743, 0.937); // C
199 15 : reference[14]=Vector(-3.503, 2.671, 0.821); // O
200 15 : reference[15]=Vector( 4.746, -2.363, 0.188); // N j
201 15 : reference[16]=Vector( 3.427, -1.839, 0.545); // CA
202 15 : reference[17]=Vector( 3.135, -1.958, 2.074); // CB
203 15 : reference[18]=Vector( 3.346, -0.365, 0.181); // C
204 15 : reference[19]=Vector( 4.237, 0.412, 0.521); // O
205 15 : reference[20]=Vector( 2.261, 0.013, -0.487); // N j+1
206 15 : reference[21]=Vector( 2.024, 1.401, -0.875); // CA
207 15 : reference[22]=Vector( 1.489, 1.514, -2.313); // CB
208 15 : reference[23]=Vector( 0.914, 1.902, 0.044); // C
209 15 : reference[24]=Vector(-0.173, 1.330, 0.052); // O
210 15 : reference[25]=Vector( 1.202, 2.940, 0.828); // N j+2
211 15 : reference[26]=Vector( 0.190, 3.507, 1.718); // CA
212 15 : reference[27]=Vector( 0.772, 3.801, 3.104); // CB
213 15 : reference[28]=Vector(-0.229, 4.791, 1.038); // C
214 15 : reference[29]=Vector( 0.523, 5.771, 0.996); // O
215 : // Store the secondary structure ( last number makes sure we convert to internal units nm )
216 : std::string ref0, ref1, ref2;
217 15 : Tools::convert( reference[0][0], ref0 );
218 15 : Tools::convert( reference[0][1], ref1 );
219 15 : Tools::convert( reference[0][2], ref2 );
220 30 : std::string structure=" STRUCTURE1=" + ref0 + "," + ref1 + "," + ref2;
221 450 : for(unsigned i=1; i<30; ++i) {
222 1740 : for(unsigned k=0; k<3; ++k) { Tools::convert( reference[i][k], ref0 ); structure += "," + ref0; }
223 : }
224 :
225 15 : reference[0]=Vector(-1.439, -5.122, -1.144); // N i
226 15 : reference[1]=Vector(-0.816, -3.803, -1.013); // CA
227 15 : reference[2]=Vector( 0.099, -3.509, -2.206); // CB
228 15 : reference[3]=Vector(-1.928, -2.770, -0.952); // C
229 15 : reference[4]=Vector(-2.991, -2.970, -1.551); // O
230 15 : reference[5]=Vector(-1.698, -1.687, -0.215); // N i+1
231 15 : reference[6]=Vector(-2.681, -0.613, -0.143); // CA
232 15 : reference[7]=Vector(-3.323, -0.477, 1.267); // CB
233 15 : reference[8]=Vector(-1.984, 0.681, -0.574); // C
234 15 : reference[9]=Vector(-0.807, 0.921, -0.273); // O
235 15 : reference[10]=Vector(-2.716, 1.492, -1.329); // N i+2
236 15 : reference[11]=Vector(-2.196, 2.731, -1.883); // CA
237 15 : reference[12]=Vector(-2.263, 2.692, -3.418); // CB
238 15 : reference[13]=Vector(-2.989, 3.949, -1.433); // C
239 15 : reference[14]=Vector(-4.214, 3.989, -1.583); // O
240 15 : reference[15]=Vector( 2.464, -4.352, 2.149); // N j
241 15 : reference[16]=Vector( 3.078, -3.170, 1.541); // CA
242 15 : reference[17]=Vector( 3.398, -3.415, 0.060); // CB
243 15 : reference[18]=Vector( 2.080, -2.021, 1.639); // C
244 15 : reference[19]=Vector( 0.938, -2.178, 1.225); // O
245 15 : reference[20]=Vector( 2.525, -0.886, 2.183); // N j+1
246 15 : reference[21]=Vector( 1.692, 0.303, 2.346); // CA
247 15 : reference[22]=Vector( 1.541, 0.665, 3.842); // CB
248 15 : reference[23]=Vector( 2.420, 1.410, 1.608); // C
249 15 : reference[24]=Vector( 3.567, 1.733, 1.937); // O
250 15 : reference[25]=Vector( 1.758, 1.976, 0.600); // N j+2
251 15 : reference[26]=Vector( 2.373, 2.987, -0.238); // CA
252 15 : reference[27]=Vector( 2.367, 2.527, -1.720); // CB
253 15 : reference[28]=Vector( 1.684, 4.331, -0.148); // C
254 15 : reference[29]=Vector( 0.486, 4.430, -0.415); // O
255 : // Store the secondary structure ( last number makes sure we convert to internal units nm )
256 15 : Tools::convert( reference[0][0], ref0 );
257 15 : Tools::convert( reference[0][1], ref1 );
258 15 : Tools::convert( reference[0][2], ref2 );
259 30 : structure +=" STRUCTURE2=" + ref0 + "," + ref1 + "," + ref2;
260 450 : for(unsigned i=1; i<30; ++i) {
261 1740 : for(unsigned k=0; k<3; ++k) { Tools::convert( reference[i][k], ref0 ); structure += "," + ref0; }
262 : }
263 :
264 15 : std::string strands_cutoff; parse("STRANDS_CUTOFF",strands_cutoff);
265 30 : std::string nopbcstr=""; bool nopbc; parseFlag("NOPBC",nopbc); if( nopbc ) nopbcstr = " NOPBC";
266 28 : if( strands_cutoff.length()>0 ) strands_cutoff=" CUTOFF_ATOMS=6,21 STRANDS_CUTOFF="+strands_cutoff;
267 30 : std::string type; parse("TYPE",type); std::string lab = getShortcutLabel() + "_low"; if( uselessthan ) lab = getShortcutLabel();
268 15 : if( seglist.length()==0 ) error("no segments to investigate");
269 30 : readInputLine( getShortcutLabel() + "_both: SECONDARY_STRUCTURE_RMSD BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + strands_cutoff + nopbcstr );
270 15 : if( ltmap.length()>0 ) {
271 : // Create the lowest line
272 30 : readInputLine( lab + ": LOWEST ARG=" + getShortcutLabel() + "_both.struct-1," + getShortcutLabel() + "_both.struct-2" );
273 : // Create the less than object
274 15 : SecondaryStructureRMSD::expandShortcut( uselessthan, getShortcutLabel(), lab, ltmap, this );
275 : }
276 15 : }
277 :
278 : }
279 : }
|