Update to prepare for 2018.4 point release
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / readpull.cpp
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team.
6  * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
7  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8  * and including many others, as listed in the AUTHORS file in the
9  * top-level source directory and at http://www.gromacs.org.
10  *
11  * GROMACS is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * GROMACS is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with GROMACS; if not, see
23  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
25  *
26  * If you want to redistribute modifications to GROMACS, please
27  * consider that scientific software is very special. Version
28  * control is crucial - bugs must be traceable. We will be happy to
29  * consider code for inclusion in the official distribution, but
30  * derived work must not be called official GROMACS. Details are found
31  * in the README & COPYING files - if they are missing, get the
32  * official version at http://www.gromacs.org.
33  *
34  * To help us fund GROMACS development, we humbly ask that you cite
35  * the research papers on the package. Check out http://www.gromacs.org.
36  */
37 #include "gmxpre.h"
38
39 #include <assert.h>
40 #include <stdlib.h>
41 #include <string.h>
42
43 #include "gromacs/fileio/readinp.h"
44 #include "gromacs/fileio/warninp.h"
45 #include "gromacs/gmxpreprocess/readir.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/mdlib/mdatoms.h"
48 #include "gromacs/mdlib/mdrun.h"
49 #include "gromacs/mdtypes/inputrec.h"
50 #include "gromacs/mdtypes/md_enums.h"
51 #include "gromacs/mdtypes/pull-params.h"
52 #include "gromacs/pbcutil/pbc.h"
53 #include "gromacs/pulling/pull.h"
54 #include "gromacs/topology/topology.h"
55 #include "gromacs/utility/cstringutil.h"
56 #include "gromacs/utility/fatalerror.h"
57 #include "gromacs/utility/futil.h"
58 #include "gromacs/utility/smalloc.h"
59
60
61 static void string2dvec(const char buf[], dvec nums)
62 {
63     double dum;
64
65     if (sscanf(buf, "%lf%lf%lf%lf", &nums[0], &nums[1], &nums[2], &dum) != 3)
66     {
67         gmx_fatal(FARGS, "Expected three numbers at input line %s", buf);
68     }
69 }
70
71 static void init_pull_group(t_pull_group *pg,
72                             const char   *wbuf)
73 {
74     double d;
75     int    n;
76
77     pg->nweight = 0;
78     while (sscanf(wbuf, "%lf %n", &d, &n) == 1)
79     {
80         if (pg->nweight % 100 == 0)
81         {
82             srenew(pg->weight, pg->nweight+100);
83         }
84         pg->weight[pg->nweight++] = d;
85         wbuf += n;
86     }
87 }
88
89 static void process_pull_dim(char *dim_buf, ivec dim, const t_pull_coord *pcrd)
90 {
91     int           ndim, d, nchar;
92     char         *ptr, pulldim1[STRLEN];
93
94     ptr  = dim_buf;
95     ndim = 0;
96     for (d = 0; d < DIM; d++)
97     {
98         if (sscanf(ptr, "%s%n", pulldim1, &nchar) != 1)
99         {
100             gmx_fatal(FARGS, "Less than 3 pull dimensions given in pull_dim: '%s'",
101                       dim_buf);
102         }
103
104         if (gmx_strncasecmp(pulldim1, "N", 1) == 0)
105         {
106             dim[d] = 0;
107         }
108         else if (gmx_strncasecmp(pulldim1, "Y", 1) == 0)
109         {
110             dim[d] = 1;
111             ndim++;
112         }
113         else
114         {
115             gmx_fatal(FARGS, "Please use Y(ES) or N(O) for pull_dim only (not %s)",
116                       pulldim1);
117         }
118         ptr += nchar;
119     }
120     if (ndim == 0)
121     {
122         gmx_fatal(FARGS, "All entries in pull dim are N");
123     }
124     if ((pcrd->eGeom == epullgDIHEDRAL) && (ndim < 3))
125     {
126         gmx_fatal(FARGS, "Pull geometry dihedral is only useful with pull-dim = Y Y Y");
127     }
128     if ((pcrd->eGeom == epullgANGLE || pcrd->eGeom == epullgANGLEAXIS ) && (ndim < 2))
129     {
130         gmx_fatal(FARGS, "Pull geometry %s is only useful with pull-dim = Y for at least 2 dimensions",
131                   EPULLGEOM(pcrd->eGeom));
132     }
133 }
134
135 static void init_pull_coord(t_pull_coord *pcrd, int coord_index_for_output,
136                             char *dim_buf,
137                             const char *origin_buf, const char *vec_buf,
138                             warninp_t wi)
139 {
140     int    m;
141     dvec   origin, vec;
142     char   buf[STRLEN];
143
144     if (pcrd->eType == epullCONSTRAINT && (pcrd->eGeom == epullgCYL ||
145                                            pcrd->eGeom == epullgDIRRELATIVE ||
146                                            pcrd->eGeom == epullgANGLE ||
147                                            pcrd->eGeom == epullgANGLEAXIS ||
148                                            pcrd->eGeom == epullgDIHEDRAL))
149     {
150         gmx_fatal(FARGS, "Pulling of type %s can not be combined with geometry %s. Consider using pull type %s.",
151                   epull_names[pcrd->eType],
152                   epullg_names[pcrd->eGeom],
153                   epull_names[epullUMBRELLA]);
154     }
155
156     if (pcrd->eType == epullEXTERNAL)
157     {
158         if (pcrd->externalPotentialProvider[0] == '\0')
159         {
160             sprintf(buf, "The use of pull type '%s' for pull coordinate %d requires that the name of the module providing the potential external is set with the option %s%d%s",
161                     epull_names[pcrd->eType], coord_index_for_output,
162                     "pull-coord", coord_index_for_output, "-potential-provider");
163             warning_error(wi, buf);
164         }
165
166         if (pcrd->rate != 0)
167         {
168             sprintf(buf, "The use of pull type '%s' for pull coordinate %d requires that the pull rate is zero",
169                     epull_names[pcrd->eType], coord_index_for_output);
170             warning_error(wi, buf);
171         }
172
173         if (pcrd->eGeom == epullgCYL)
174         {
175             /* Warn the user of a PBC restriction, caused by the fact that
176              * there is no reference value with an external pull potential.
177              */
178             sprintf(buf, "With pull type '%s' and geometry '%s', the distance component along the cylinder axis between atoms in the cylinder group and the COM of the pull group should be smaller than half the box length",
179                     epull_names[pcrd->eType], epullg_names[pcrd->eGeom]);
180             warning_note(wi, buf);
181         }
182     }
183
184     process_pull_dim(dim_buf, pcrd->dim, pcrd);
185
186     string2dvec(origin_buf, origin);
187     if (pcrd->group[0] != 0 && dnorm(origin) > 0)
188     {
189         gmx_fatal(FARGS, "The pull origin can only be set with an absolute reference");
190     }
191
192     /* Check the given initial reference value and warn for dangerous values */
193     if (pcrd->eGeom == epullgDIST)
194     {
195         if (pcrd->bStart && pcrd->init < 0)
196         {
197             sprintf(buf, "The initial reference distance set by pull-coord-init is set to a negative value (%g) with geometry %s while distances need to be non-negative. "
198                     "This may work, since you have set pull-coord-start to 'yes' which modifies this value, but only for certain starting distances. "
199                     "If this is a mistake you may want to use geometry %s instead.",
200                     pcrd->init, EPULLGEOM(pcrd->eGeom), EPULLGEOM(epullgDIR));
201             warning(wi, buf);
202         }
203     }
204     else if (pcrd->eGeom == epullgANGLE || pcrd->eGeom == epullgANGLEAXIS)
205     {
206         if (pcrd->bStart && (pcrd->init < 0 || pcrd->init > 180))
207         {
208             /* This value of pcrd->init may be ok depending on pcrd->bStart which modifies pcrd->init later on */
209             sprintf(buf, "The initial reference angle set by pull-coord-init (%g) is outside of the allowed range [0, 180] degrees for geometry (%s). "
210                     "This may work, since you have set pull-coord-start to 'yes' which modifies this value, but only for certain starting angles.",
211                     pcrd->init, EPULLGEOM(pcrd->eGeom));
212             warning(wi, buf);
213         }
214     }
215     else if (pcrd->eGeom == epullgDIHEDRAL)
216     {
217         if (pcrd->bStart && (pcrd->init < -180 || pcrd->init > 180))
218         {
219             sprintf(buf, "The initial reference angle set by pull-coord-init (%g) is outside of the allowed range [-180, 180] degrees for geometry (%s). "
220                     "This may work, since you have set pull-coord-start to 'yes' which modifies this value, but only for certain starting angles.",
221                     pcrd->init, EPULLGEOM(pcrd->eGeom));
222             warning(wi, buf);
223         }
224     }
225
226     /* Check and set the pull vector */
227     clear_dvec(vec);
228     string2dvec(vec_buf, vec);
229
230     if (pcrd->eGeom == epullgDIR || pcrd->eGeom == epullgCYL || pcrd->eGeom == epullgDIRPBC || pcrd->eGeom == epullgANGLEAXIS)
231     {
232         if (dnorm2(vec) == 0)
233         {
234             gmx_fatal(FARGS, "With pull geometry %s the pull vector can not be 0,0,0",
235                       epullg_names[pcrd->eGeom]);
236         }
237         for (int d = 0; d < DIM; d++)
238         {
239             if (vec[d] != 0 && pcrd->dim[d] == 0)
240             {
241                 gmx_fatal(FARGS, "pull-coord-vec has non-zero %c-component while pull_dim for the %c-dimension is set to N", 'x'+d, 'x'+d);
242             }
243         }
244
245         /* Normalize the direction vector */
246         dsvmul(1/dnorm(vec), vec, vec);
247     }
248     else /* This case is for are all the geometries where the pull vector is not used */
249     {
250         if (dnorm2(vec) > 0)
251         {
252             sprintf(buf, "A pull vector is given (%g  %g  %g) but will not be used with geometry %s. If you really want to use this "
253                     "vector, consider using geometry %s instead.",
254                     vec[0], vec[1], vec[2], EPULLGEOM(pcrd->eGeom),
255                     pcrd->eGeom == epullgANGLE ? EPULLGEOM(epullgANGLEAXIS) : EPULLGEOM(epullgDIR));
256             warning(wi, buf);
257         }
258     }
259     for (m = 0; m < DIM; m++)
260     {
261         pcrd->origin[m] = origin[m];
262         pcrd->vec[m]    = vec[m];
263     }
264 }
265
266 char **read_pullparams(int *ninp_p, t_inpfile **inp_p,
267                        pull_params_t *pull,
268                        warninp_t wi)
269 {
270     int           ninp, nscan, idum;
271     t_inpfile    *inp;
272     const char   *tmp;
273     char        **grpbuf;
274     char          buf[STRLEN];
275     char          provider[STRLEN], groups[STRLEN], dim_buf[STRLEN];
276     char          wbuf[STRLEN], origin_buf[STRLEN], vec_buf[STRLEN];
277
278     t_pull_group *pgrp;
279     t_pull_coord *pcrd;
280
281     ninp   = *ninp_p;
282     inp    = *inp_p;
283
284     /* read pull parameters */
285     CTYPE("Cylinder radius for dynamic reaction force groups (nm)");
286     RTYPE("pull-cylinder-r",  pull->cylinder_r, 1.5);
287     RTYPE("pull-constr-tol",  pull->constr_tol, 1E-6);
288     EETYPE("pull-print-com", pull->bPrintCOM, yesno_names);
289     EETYPE("pull-print-ref-value", pull->bPrintRefValue, yesno_names);
290     EETYPE("pull-print-components", pull->bPrintComp, yesno_names);
291     ITYPE("pull-nstxout",     pull->nstxout, 50);
292     ITYPE("pull-nstfout",     pull->nstfout, 50);
293     CTYPE("Number of pull groups");
294     ITYPE("pull-ngroups",     pull->ngroup, 1);
295     CTYPE("Number of pull coordinates");
296     ITYPE("pull-ncoords",     pull->ncoord, 1);
297
298     if (pull->ngroup < 1)
299     {
300         gmx_fatal(FARGS, "pull-ngroups should be >= 1");
301     }
302     /* We always add an absolute reference group (index 0), even if not used */
303     pull->ngroup += 1;
304
305     if (pull->ncoord < 1)
306     {
307         gmx_fatal(FARGS, "pull-ncoords should be >= 1");
308     }
309
310     snew(pull->group, pull->ngroup);
311
312     snew(pull->coord, pull->ncoord);
313
314     /* pull group options */
315     CTYPE("Group and coordinate parameters");
316
317     /* Read the pull groups */
318     snew(grpbuf, pull->ngroup);
319     /* Group 0 is the absolute reference, we don't read anything for 0 */
320     for (int groupNum = 1; groupNum < pull->ngroup; groupNum++)
321     {
322         pgrp = &pull->group[groupNum];
323         snew(grpbuf[groupNum], STRLEN);
324         sprintf(buf, "pull-group%d-name", groupNum);
325         STYPE(buf,              grpbuf[groupNum], "");
326         sprintf(buf, "pull-group%d-weights", groupNum);
327         STYPE(buf,              wbuf, "");
328         sprintf(buf, "pull-group%d-pbcatom", groupNum);
329         ITYPE(buf,              pgrp->pbcatom, 0);
330
331         /* Initialize the pull group */
332         init_pull_group(pgrp, wbuf);
333     }
334
335     /* Read the pull coordinates */
336     for (int coordNum = 1; coordNum < pull->ncoord + 1; coordNum++)
337     {
338         pcrd = &pull->coord[coordNum - 1];
339         sprintf(buf, "pull-coord%d-type", coordNum);
340         EETYPE(buf,             pcrd->eType, epull_names);
341         sprintf(buf, "pull-coord%d-potential-provider", coordNum);
342         STYPE(buf,              provider, "");
343         pcrd->externalPotentialProvider = gmx_strdup(provider);
344         sprintf(buf, "pull-coord%d-geometry", coordNum);
345         EETYPE(buf,             pcrd->eGeom, epullg_names);
346         sprintf(buf, "pull-coord%d-groups", coordNum);
347         STYPE(buf,              groups, "");
348
349         switch (pcrd->eGeom)
350         {
351             case epullgDIHEDRAL:
352                 pcrd->ngroup = 6; break;
353             case epullgDIRRELATIVE:
354             case epullgANGLE:
355                 pcrd->ngroup = 4; break;
356             default:
357                 pcrd->ngroup = 2; break;
358         }
359
360         nscan = sscanf(groups, "%d %d %d %d %d %d %d",
361                        &pcrd->group[0], &pcrd->group[1], &pcrd->group[2], &pcrd->group[3],
362                        &pcrd->group[4], &pcrd->group[5], &idum);
363         if (nscan != pcrd->ngroup)
364         {
365             sprintf(wbuf, "%s should contain %d pull group indices with geometry %s",
366                     buf, pcrd->ngroup, epullg_names[pcrd->eGeom]);
367             set_warning_line(wi, nullptr, -1);
368             warning_error(wi, wbuf);
369         }
370         for (int g = 0; g < pcrd->ngroup; g++)
371         {
372             if (pcrd->group[g] < 0 || pcrd->group[g] >= pull->ngroup)
373             {
374                 /* Quit with a fatal error to avoid invalid memory access */
375                 gmx_fatal(FARGS, "%s contains an invalid pull group %d, you should have %d <= group <= %d",
376                           buf, pcrd->group[g], 0, pull->ngroup - 1);
377             }
378         }
379
380         sprintf(buf, "pull-coord%d-dim", coordNum);
381         STYPE(buf,              dim_buf,     "Y Y Y");
382         sprintf(buf, "pull-coord%d-origin", coordNum);
383         STYPE(buf,              origin_buf,  "0.0 0.0 0.0");
384         sprintf(buf, "pull-coord%d-vec", coordNum);
385         STYPE(buf,              vec_buf,     "0.0 0.0 0.0");
386         sprintf(buf, "pull-coord%d-start", coordNum);
387         EETYPE(buf,             pcrd->bStart, yesno_names);
388         sprintf(buf, "pull-coord%d-init", coordNum);
389         RTYPE(buf,              pcrd->init,  0.0);
390         sprintf(buf, "pull-coord%d-rate", coordNum);
391         RTYPE(buf,              pcrd->rate,  0.0);
392         sprintf(buf, "pull-coord%d-k", coordNum);
393         RTYPE(buf,              pcrd->k,     0.0);
394         sprintf(buf, "pull-coord%d-kB", coordNum);
395         RTYPE(buf,              pcrd->kB,    pcrd->k);
396
397         /* Initialize the pull coordinate */
398         init_pull_coord(pcrd, coordNum, dim_buf, origin_buf, vec_buf, wi);
399     }
400
401     *ninp_p   = ninp;
402     *inp_p    = inp;
403
404     return grpbuf;
405 }
406
407 void make_pull_groups(pull_params_t *pull,
408                       char **pgnames,
409                       const t_blocka *grps, char **gnames)
410 {
411     int           g, ig = -1, i;
412     t_pull_group *pgrp;
413
414     /* Absolute reference group (might not be used) is special */
415     pgrp          = &pull->group[0];
416     pgrp->nat     = 0;
417     pgrp->pbcatom = -1;
418
419     for (g = 1; g < pull->ngroup; g++)
420     {
421         pgrp = &pull->group[g];
422
423         if (strcmp(pgnames[g], "") == 0)
424         {
425             gmx_fatal(FARGS, "Pull option pull_group%d required by grompp has not been set.", g);
426         }
427
428         ig        = search_string(pgnames[g], grps->nr, gnames);
429         pgrp->nat = grps->index[ig+1] - grps->index[ig];
430
431         fprintf(stderr, "Pull group %d '%s' has %d atoms\n",
432                 g, pgnames[g], pgrp->nat);
433
434         if (pgrp->nat == 0)
435         {
436             gmx_fatal(FARGS, "Pull group %d '%s' is empty", g, pgnames[g]);
437         }
438
439         snew(pgrp->ind, pgrp->nat);
440         for (i = 0; i < pgrp->nat; i++)
441         {
442             pgrp->ind[i] = grps->a[grps->index[ig]+i];
443         }
444
445         if (pgrp->nweight > 0 && pgrp->nweight != pgrp->nat)
446         {
447             gmx_fatal(FARGS, "Number of weights (%d) for pull group %d '%s' does not match the number of atoms (%d)",
448                       pgrp->nweight, g, pgnames[g], pgrp->nat);
449         }
450
451         if (pgrp->nat == 1)
452         {
453             /* No pbc is required for this group */
454             pgrp->pbcatom = -1;
455         }
456         else
457         {
458             if (pgrp->pbcatom > 0)
459             {
460                 pgrp->pbcatom -= 1;
461             }
462             else if (pgrp->pbcatom == 0)
463             {
464                 pgrp->pbcatom = pgrp->ind[(pgrp->nat-1)/2];
465             }
466             else
467             {
468                 /* Use cosine weighting */
469                 pgrp->pbcatom = -1;
470             }
471         }
472     }
473 }
474
475 void make_pull_coords(pull_params_t *pull)
476 {
477     int           c;
478     t_pull_coord *pcrd;
479
480     for (c = 0; c < pull->ncoord; c++)
481     {
482         pcrd = &pull->coord[c];
483
484         if (pcrd->group[0] < 0 || pcrd->group[0] >= pull->ngroup ||
485             pcrd->group[1] < 0 || pcrd->group[1] >= pull->ngroup)
486         {
487             gmx_fatal(FARGS, "Pull group index in pull-coord%d-groups out of range, should be between %d and %d", c+1, 0, pull->ngroup+1);
488         }
489
490         if (pcrd->group[0] == pcrd->group[1])
491         {
492             gmx_fatal(FARGS, "Identical pull group indices in pull-coord%d-groups", c+1);
493         }
494
495         if (pcrd->eGeom == epullgCYL)
496         {
497             if (pull->group[pcrd->group[0]].nweight > 0)
498             {
499                 gmx_fatal(FARGS, "Weights are not supported for the reference group with cylinder pulling");
500             }
501         }
502     }
503 }
504
505 pull_t *set_pull_init(t_inputrec *ir, const gmx_mtop_t *mtop,
506                       rvec *x, matrix box, real lambda,
507                       const gmx_output_env_t *oenv,
508                       warninp_t wi)
509 {
510     pull_params_t *pull;
511     pull_t        *pull_work;
512     t_pbc          pbc;
513     int            c;
514     double         t_start;
515
516     pull      = ir->pull;
517     pull_work = init_pull(nullptr, pull, ir, 0, nullptr, mtop, nullptr, oenv, lambda, FALSE, ContinuationOptions());
518     auto mdAtoms = gmx::makeMDAtoms(nullptr, *mtop, *ir, false);
519     auto md      = mdAtoms->mdatoms();
520     atoms2md(mtop, ir, -1, nullptr, mtop->natoms, mdAtoms.get());
521     if (ir->efep)
522     {
523         update_mdatoms(md, lambda);
524     }
525
526     set_pbc(&pbc, ir->ePBC, box);
527
528     t_start = ir->init_t + ir->init_step*ir->delta_t;
529
530     pull_calc_coms(nullptr, pull_work, md, &pbc, t_start, x, nullptr);
531
532     int groupThatFailsPbc = pullCheckPbcWithinGroups(*pull_work, x, pbc);
533     if (groupThatFailsPbc >= 0)
534     {
535         char buf[STRLEN];
536         sprintf(buf,
537                 "Pull group %d has atoms at a distance larger than %g times half the box size from the PBC atom (%d). If atoms are or will more beyond half the box size from the PBC atom, the COM will be ill defined.",
538                 groupThatFailsPbc,
539                 c_pullGroupPbcMargin,
540                 pull->group[groupThatFailsPbc].pbcatom);
541         set_warning_line(wi, nullptr, -1);
542         warning(wi, buf);
543     }
544
545     fprintf(stderr, "Pull group  natoms  pbc atom  distance at start  reference at t=0\n");
546     for (c = 0; c < pull->ncoord; c++)
547     {
548         t_pull_coord *pcrd;
549         t_pull_group *pgrp0, *pgrp1;
550         double        value;
551         real          init = 0;
552
553         pcrd  = &pull->coord[c];
554
555         pgrp0 = &pull->group[pcrd->group[0]];
556         pgrp1 = &pull->group[pcrd->group[1]];
557         fprintf(stderr, "%8d  %8d  %8d\n",
558                 pcrd->group[0], pgrp0->nat, pgrp0->pbcatom+1);
559         fprintf(stderr, "%8d  %8d  %8d ",
560                 pcrd->group[1], pgrp1->nat, pgrp1->pbcatom+1);
561
562         if (pcrd->bStart)
563         {
564             init       = pcrd->init;
565             pcrd->init = 0;
566         }
567
568         value  = get_pull_coord_value(pull_work, c, &pbc);
569
570         value *= pull_conversion_factor_internal2userinput(pcrd);
571         fprintf(stderr, " %10.3f %s", value, pull_coordinate_units(pcrd));
572
573         if (pcrd->bStart)
574         {
575             pcrd->init = value + init;
576         }
577
578         if (pcrd->eGeom == epullgDIST)
579         {
580             if (pcrd->init < 0)
581             {
582                 gmx_fatal(FARGS, "The initial pull distance (%g) needs to be non-negative with geometry %s. If you want a signed distance, use geometry %s instead.",
583                           pcrd->init, EPULLGEOM(pcrd->eGeom), EPULLGEOM(epullgDIR));
584             }
585
586             /* TODO: With a positive init but a negative rate things could still
587              * go wrong, but it might be fine if you don't pull too far.
588              * We should give a warning or note when there is only one pull dim
589              * active, since that is usually the problematic case when you should
590              * be using direction. We will do this later, since an already planned
591              * generalization of the pull code makes pull dim available here.
592              */
593         }
594         else if (pcrd->eGeom == epullgANGLE || pcrd->eGeom == epullgANGLEAXIS)
595         {
596             if (pcrd->init < 0 || pcrd->init > 180)
597             {
598                 gmx_fatal(FARGS,  "The initial pull reference angle (%g) is outside of the allowed range [0, 180] degrees.", pcrd->init);
599             }
600         }
601         else if (pcrd->eGeom == epullgDIHEDRAL)
602         {
603             if (pcrd->init < -180 || pcrd->init > 180)
604             {
605                 gmx_fatal(FARGS,  "The initial pull reference angle (%g) is outside of the allowed range [-180, 180] degrees.",
606                           pcrd->init);
607             }
608         }
609
610
611         fprintf(stderr, "     %10.3f %s\n", pcrd->init, pull_coordinate_units(pcrd));
612     }
613
614     return pull_work;
615 }