2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2008,2009,2010,2011,2012 by the GROMACS development team.
5 * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
6 * Copyright (c) 2019,2020, 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.
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.
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.
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.
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.
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.
42 #include "gromacs/commandline/pargs.h"
43 #include "gromacs/fileio/confio.h"
44 #include "gromacs/fileio/trxio.h"
45 #include "gromacs/fileio/xvgr.h"
46 #include "gromacs/gmxana/gmx_ana.h"
47 #include "gromacs/math/units.h"
48 #include "gromacs/math/vec.h"
49 #include "gromacs/pbcutil/pbc.h"
50 #include "gromacs/pbcutil/rmpbc.h"
51 #include "gromacs/statistics/statistics.h"
52 #include "gromacs/topology/index.h"
53 #include "gromacs/topology/topology.h"
54 #include "gromacs/trajectory/trajectoryframe.h"
55 #include "gromacs/utility/arraysize.h"
56 #include "gromacs/utility/cstringutil.h"
57 #include "gromacs/utility/fatalerror.h"
58 #include "gromacs/utility/gmxassert.h"
59 #include "gromacs/utility/smalloc.h"
61 #define EPSI0 (EPSILON0 * E_CHARGE * E_CHARGE * AVOGADRO / (KILO * NANO)) /* EPSILON0 in SI units */
63 static void index_atom2mol(int* n
, int* index
, t_block
* mols
)
65 int nat
, i
, nmol
, mol
, j
;
73 while (index
[i
] > mols
->index
[mol
])
78 gmx_fatal(FARGS
, "Atom index out of range: %d", index
[i
] + 1);
81 for (j
= mols
->index
[mol
]; j
< mols
->index
[mol
+ 1]; j
++)
83 if (i
>= nat
|| index
[i
] != j
)
85 gmx_fatal(FARGS
, "The index group does not consist of whole molecules");
92 fprintf(stderr
, "\nSplit group of %d atoms into %d molecules\n", nat
, nmol
);
97 static gmx_bool
precalc(t_topology top
, real mass2
[], real qmol
[])
111 for (i
= 0; i
< top
.mols
.nr
; i
++)
113 k
= top
.mols
.index
[i
];
114 l
= top
.mols
.index
[i
+ 1];
118 for (j
= k
; j
< l
; j
++)
120 mtot
+= top
.atoms
.atom
[j
].m
;
121 qtot
+= top
.atoms
.atom
[j
].q
;
124 for (j
= k
; j
< l
; j
++)
126 top
.atoms
.atom
[j
].q
-= top
.atoms
.atom
[j
].m
* qtot
/ mtot
;
127 mass2
[j
] = top
.atoms
.atom
[j
].m
/ mtot
;
144 if (std::abs(qall
) > 0.01)
146 printf("\n\nSystem not neutral (q=%f) will not calculate translational part of the dipole "
159 static void remove_jump(matrix box
, int natoms
, rvec xp
[], rvec x
[])
165 for (d
= 0; d
< DIM
; d
++)
167 hbox
[d
] = 0.5 * box
[d
][d
];
169 for (i
= 0; i
< natoms
; i
++)
171 for (m
= DIM
- 1; m
>= 0; m
--)
173 while (x
[i
][m
] - xp
[i
][m
] <= -hbox
[m
])
175 for (d
= 0; d
<= m
; d
++)
177 x
[i
][d
] += box
[m
][d
];
180 while (x
[i
][m
] - xp
[i
][m
] > hbox
[m
])
182 for (d
= 0; d
<= m
; d
++)
184 x
[i
][d
] -= box
[m
][d
];
191 static void calc_mj(t_topology top
,
210 calc_box_center(ecenterRECT
, box
, center
);
214 set_pbc(&pbc
, pbcType
, box
);
220 for (i
= 0; i
< isize
; i
++)
224 k
= top
.mols
.index
[index0
[i
]];
225 l
= top
.mols
.index
[index0
[i
+ 1]];
226 for (j
= k
; j
< l
; j
++)
228 svmul(mass2
[j
], fr
[j
], tmp
);
234 svmul(qmol
[k
], mt1
, mt1
);
238 pbc_dx(&pbc
, mt1
, center
, mt2
);
239 svmul(qmol
[k
], mt2
, mt1
);
247 static real
calceps(real prefactor
, real md2
, real mj2
, real cor
, real eps_rf
, gmx_bool bCOR
)
250 /* bCOR determines if the correlation is computed via
251 * static properties (FALSE) or the correlation integral (TRUE)
259 epsilon
= md2
- 2.0 * cor
+ mj2
;
263 epsilon
= md2
+ mj2
+ 2.0 * cor
;
268 epsilon
= 1.0 + prefactor
* epsilon
;
272 epsilon
= 2.0 * eps_rf
+ 1.0 + 2.0 * eps_rf
* prefactor
* epsilon
;
273 epsilon
/= 2.0 * eps_rf
+ 1.0 - prefactor
* epsilon
;
281 static real
calc_cacf(FILE* fcacf
, real prefactor
, real cacf
[], real time
[], int nfr
, const int vfr
[], int ei
, int nshift
)
288 real sigma_ret
= 0.0;
298 rfr
= static_cast<real
>(nfr
+ i
) / nshift
;
301 if (time
[vfr
[i
]] <= time
[vfr
[ei
]])
306 fprintf(fcacf
, "%.3f\t%10.6g\t%10.6g\n", time
[vfr
[i
]], cacf
[i
], sigma
);
310 deltat
= (time
[vfr
[i
+ 1]] - time
[vfr
[i
]]);
312 corint
= 2.0 * deltat
* cacf
[i
] * prefactor
;
313 if (i
== 0 || (i
+ 1) == nfr
)
324 printf("Too less points.\n");
330 static void calc_mjdsp(FILE* fmjdsp
, real prefactor
, real dsp2
[], real time
[], int nfr
, const real refr
[])
335 fprintf(fmjdsp
, "#Prefactor fit E-H: 1 / 6.0*V*k_B*T: %g\n", prefactor
);
337 for (i
= 0; i
< nfr
; i
++)
342 dsp2
[i
] *= prefactor
/ refr
[i
];
343 fprintf(fmjdsp
, "%.3f\t%10.6g\n", time
[i
], dsp2
[i
]);
349 static void dielectric(FILE* fmj
,
375 const gmx_output_env_t
* oenv
)
378 int valloc
, nalloc
, nfr
, nvfr
;
380 real
* xshfr
= nullptr;
383 real
* cacf
= nullptr;
384 real
* time
= nullptr;
387 real prefactorav
= 0.0;
388 real prefactor
= 0.0;
390 real volume_av
= 0.0;
391 real dk_s
, dk_d
, dk_f
;
405 rvec
* mjdsp
= nullptr;
406 real
* dsp2
= nullptr;
411 rvec
* mtrans
= nullptr;
414 * Variables for the least-squares fit for Einstein-Helfand and Green-Kubo
424 gmx_rmpbc_t gpbc
= nullptr;
443 /* This is the main loop over frames */
458 gpbc
= gmx_rmpbc_init(&top
.idef
, pbcType
, fr
.natoms
);
468 srenew(time
, nalloc
);
470 srenew(mjdsp
, nalloc
);
471 srenew(dsp2
, nalloc
);
472 srenew(mtrans
, nalloc
);
473 srenew(xshfr
, nalloc
);
475 for (i
= nfr
; i
< nalloc
; i
++)
477 clear_rvec(mjdsp
[i
]);
479 clear_rvec(mtrans
[i
]);
484 GMX_RELEASE_ASSERT(time
!= nullptr, "Memory not allocated correctly - time array is NULL");
491 time
[nfr
] = fr
.time
- t0
;
493 if (time
[nfr
] <= bfit
)
497 if (time
[nfr
] <= efit
)
507 remove_jump(fr
.box
, fr
.natoms
, xp
, fr
.x
);
514 for (i
= 0; i
< fr
.natoms
; i
++)
516 copy_rvec(fr
.x
[i
], xp
[i
]);
520 gmx_rmpbc_trxfr(gpbc
, &fr
);
522 calc_mj(top
, pbcType
, fr
.box
, bNoJump
, nmols
, indexm
, fr
.x
, mtrans
[nfr
], mass2
, qmol
);
524 for (i
= 0; i
< isize
; i
++)
527 svmul(top
.atoms
.atom
[j
].q
, fr
.x
[j
], fr
.x
[j
]);
528 rvec_inc(mu
[nfr
], fr
.x
[j
]);
531 /*if(mod(nfr,nshift)==0){*/
532 if (nfr
% nshift
== 0)
534 for (j
= nfr
; j
>= 0; j
--)
536 rvec_sub(mtrans
[nfr
], mtrans
[j
], tmp
);
537 dsp2
[nfr
- j
] += norm2(tmp
);
538 xshfr
[nfr
- j
] += 1.0;
555 srenew(cacf
, valloc
);
558 if (time
[nfr
] <= bvit
)
562 if (time
[nfr
] <= evit
)
567 clear_rvec(v0
[nvfr
]);
576 for (i
= 0; i
< isize
; i
++)
579 svmul(mass2
[j
], fr
.v
[j
], fr
.v
[j
]);
580 svmul(qmol
[j
], fr
.v
[j
], fr
.v
[j
]);
581 rvec_inc(v0
[nvfr
], fr
.v
[j
]);
584 fprintf(fcur
, "%.3f\t%.6f\t%.6f\t%.6f\n", time
[nfr
], v0
[nfr
][XX
], v0
[nfr
][YY
], v0
[nfr
][ZZ
]);
587 /*if(mod(nvfr,nshift)==0){*/
588 if (nvfr
% nshift
== 0)
590 for (j
= nvfr
; j
>= 0; j
--)
594 cacf
[nvfr
- j
] += iprod(v0
[nvfr
], v0
[j
]);
598 djc
[nvfr
- j
] += iprod(mu
[vfr
[j
]], v0
[nvfr
]);
607 volume
= det(fr
.box
);
610 rvec_inc(mja_tmp
, mtrans
[nfr
]);
611 mjd
+= iprod(mu
[nfr
], mtrans
[nfr
]);
612 rvec_inc(mdvec
, mu
[nfr
]);
614 mj2
+= iprod(mtrans
[nfr
], mtrans
[nfr
]);
615 md2
+= iprod(mu
[nfr
], mu
[nfr
]);
617 fprintf(fmj
, "%.3f\t%8.5f\t%8.5f\t%8.5f\t%8.5f\t%8.5f\n", time
[nfr
], mtrans
[nfr
][XX
],
618 mtrans
[nfr
][YY
], mtrans
[nfr
][ZZ
], mj2
/ refr
, norm(mja_tmp
) / refr
);
619 fprintf(fmd
, "%.3f\t%8.5f\t%8.5f\t%8.5f\t%8.5f\t%8.5f\n", time
[nfr
], mu
[nfr
][XX
],
620 mu
[nfr
][YY
], mu
[nfr
][ZZ
], md2
/ refr
, norm(mdvec
) / refr
);
624 } while (read_next_frame(oenv
, status
, &fr
));
626 gmx_rmpbc_done(gpbc
);
631 prefactor
/= 3.0 * EPSILON0
* volume_av
* BOLTZ
* temp
;
634 prefactorav
= E_CHARGE
* E_CHARGE
;
635 prefactorav
/= volume_av
* BOLTZMANN
* temp
* NANO
* 6.0;
637 fprintf(stderr
, "Prefactor fit E-H: 1 / 6.0*V*k_B*T: %g\n", prefactorav
);
639 calc_mjdsp(fmjdsp
, prefactorav
, dsp2
, time
, nfr
, xshfr
);
642 * Now we can average and calculate the correlation functions
650 svmul(1.0 / refr
, mdvec
, mdvec
);
651 svmul(1.0 / refr
, mja_tmp
, mja_tmp
);
653 mdav2
= norm2(mdvec
);
655 mjdav
= iprod(mdvec
, mja_tmp
);
658 printf("\n\nAverage translational dipole moment M_J [enm] after %d frames (|M|^2): %f %f %f "
660 nfr
, mja_tmp
[XX
], mja_tmp
[YY
], mja_tmp
[ZZ
], mj2
);
661 printf("\n\nAverage molecular dipole moment M_D [enm] after %d frames (|M|^2): %f %f %f (%f)\n",
662 nfr
, mdvec
[XX
], mdvec
[YY
], mdvec
[ZZ
], md2
);
669 printf("\nCalculating M_D - current correlation integral ... \n");
670 corint
= calc_cacf(mcor
, prefactorav
/ EPSI0
, djc
, time
, nvfr
, vfr
, ie
, nshift
);
676 printf("\nCalculating current autocorrelation ... \n");
677 sgk
= calc_cacf(outf
, prefactorav
/ PICO
, cacf
, time
, nvfr
, vfr
, ie
, nshift
);
682 snew(xfit
, ie
- ii
+ 1);
683 snew(yfit
, ie
- ii
+ 1);
685 for (i
= ii
; i
<= ie
; i
++)
688 xfit
[i
- ii
] = std::log(time
[vfr
[i
]]);
689 rtmp
= std::abs(cacf
[i
]);
690 yfit
[i
- ii
] = std::log(rtmp
);
693 lsq_y_ax_b(ie
- ii
, xfit
, yfit
, &sigma
, &malt
, &err
, &rest
);
695 malt
= std::exp(malt
);
699 malt
*= prefactorav
* 2.0e12
/ sigma
;
708 /* Calculation of the dielectric constant */
710 fprintf(stderr
, "\n********************************************\n");
711 dk_s
= calceps(prefactor
, md2
, mj2
, mjd
, eps_rf
, FALSE
);
712 fprintf(stderr
, "\nAbsolute values:\n epsilon=%f\n", dk_s
);
713 fprintf(stderr
, " <M_D^2> , <M_J^2>, <(M_J*M_D)^2>: (%f, %f, %f)\n\n", md2
, mj2
, mjd
);
714 fprintf(stderr
, "********************************************\n");
717 dk_f
= calceps(prefactor
, md2
- mdav2
, mj2
- mj
, mjd
- mjdav
, eps_rf
, FALSE
);
718 fprintf(stderr
, "\n\nFluctuations:\n epsilon=%f\n\n", dk_f
);
719 fprintf(stderr
, "\n deltaM_D , deltaM_J, deltaM_JD: (%f, %f, %f)\n", md2
- mdav2
, mj2
- mj
,
721 fprintf(stderr
, "\n********************************************\n");
724 dk_d
= calceps(prefactor
, md2
- mdav2
, mj2
- mj
, corint
, eps_rf
, TRUE
);
725 fprintf(stderr
, "\nStatic dielectric constant using integral and fluctuations: %f\n", dk_d
);
726 fprintf(stderr
, "\n < M_JM_D > via integral: %.3f\n", -1.0 * corint
);
729 fprintf(stderr
, "\n***************************************************");
730 fprintf(stderr
, "\n\nAverage volume V=%f nm^3 at T=%f K\n", volume_av
, temp
);
731 fprintf(stderr
, "and corresponding refactor 1.0 / 3.0*V*k_B*T*EPSILON_0: %f \n", prefactor
);
734 if (bACF
&& (ii
< nvfr
))
736 fprintf(stderr
, "Integral and integrated fit to the current acf yields at t=%f:\n", time
[vfr
[ii
]]);
737 fprintf(stderr
, "sigma=%8.3f (pure integral: %.3f)\n",
738 sgk
- malt
* std::pow(time
[vfr
[ii
]], sigma
), sgk
);
743 fprintf(stderr
, "\nStart fit at %f ps (%f).\n", time
[bi
], bfit
);
744 fprintf(stderr
, "End fit at %f ps (%f).\n\n", time
[ei
], efit
);
746 snew(xfit
, ei
- bi
+ 1);
747 snew(yfit
, ei
- bi
+ 1);
749 for (i
= bi
; i
<= ei
; i
++)
751 xfit
[i
- bi
] = time
[i
];
752 yfit
[i
- bi
] = dsp2
[i
];
755 lsq_y_ax_b(ei
- bi
, xfit
, yfit
, &sigma
, &malt
, &err
, &rest
);
758 dk_d
= calceps(prefactor
, md2
, 0.5 * malt
/ prefactorav
, corint
, eps_rf
, TRUE
);
761 "Einstein-Helfand fit to the MSD of the translational dipole moment yields:\n\n");
762 fprintf(stderr
, "sigma=%.4f\n", sigma
);
763 fprintf(stderr
, "translational fraction of M^2: %.4f\n", 0.5 * malt
/ prefactorav
);
764 fprintf(stderr
, "Dielectric constant using EH: %.4f\n", dk_d
);
771 fprintf(stderr
, "Too few points for a fit.\n");
796 int gmx_current(int argc
, char* argv
[])
799 static int nshift
= 1000;
800 static real temp
= 300.0;
801 static real eps_rf
= 0.0;
802 static gmx_bool bNoJump
= TRUE
;
803 static real bfit
= 100.0;
804 static real bvit
= 0.5;
805 static real efit
= 400.0;
806 static real evit
= 5.0;
812 "Shift of the frames for averaging the correlation functions and the mean-square "
814 { "-nojump", FALSE
, etBOOL
, { &bNoJump
}, "Removes jumps of atoms across the box." },
819 "Dielectric constant of the surrounding medium. The value zero corresponds to "
820 "infinity (tin-foil boundary conditions)." },
825 "Begin of the fit of the straight line to the MSD of the translational fraction "
826 "of the dipole moment." },
831 "End of the fit of the straight line to the MSD of the translational fraction of "
832 "the dipole moment." },
837 "Begin of the fit of the current autocorrelation function to a*t^b." },
842 "End of the fit of the current autocorrelation function to a*t^b." },
843 { "-temp", FALSE
, etREAL
, { &temp
}, "Temperature for calculating epsilon." }
846 gmx_output_env_t
* oenv
;
848 char** grpname
= nullptr;
851 real
* mass2
= nullptr;
854 int* indexm
= nullptr;
860 PbcType pbcType
= PbcType::Unset
;
864 FILE* outf
= nullptr;
865 FILE* mcor
= nullptr;
868 FILE* fmjdsp
= nullptr;
869 FILE* fcur
= nullptr;
870 t_filenm fnm
[] = { { efTPS
, nullptr, nullptr, ffREAD
}, /* this is for the topology */
871 { efNDX
, nullptr, nullptr, ffOPTRD
},
872 { efTRX
, "-f", nullptr, ffREAD
}, /* and this for the trajectory */
873 { efXVG
, "-o", "current", ffWRITE
},
874 { efXVG
, "-caf", "caf", ffOPTWR
},
875 { efXVG
, "-dsp", "dsp", ffWRITE
},
876 { efXVG
, "-md", "md", ffWRITE
},
877 { efXVG
, "-mj", "mj", ffWRITE
},
878 { efXVG
, "-mc", "mc", ffOPTWR
} };
880 #define NFILE asize(fnm)
883 const char* desc
[] = {
884 "[THISMODULE] is a tool for calculating the current autocorrelation function, the "
886 "of the rotational and translational dipole moment of the system, and the resulting static",
887 "dielectric constant. To obtain a reasonable result, the index group has to be neutral.",
888 "Furthermore, the routine is capable of extracting the static conductivity from the "
890 "autocorrelation function, if velocities are given. Additionally, an Einstein-Helfand fit ",
891 "can be used to obtain the static conductivity.",
893 "The flag [TT]-caf[tt] is for the output of the current autocorrelation function and "
894 "[TT]-mc[tt] writes the",
895 "correlation of the rotational and translational part of the dipole moment in the "
897 "file. However, this option is only available for trajectories containing velocities.",
898 "Options [TT]-sh[tt] and [TT]-tr[tt] are responsible for the averaging and integration of "
900 "autocorrelation functions. Since averaging proceeds by shifting the starting point",
901 "through the trajectory, the shift can be modified with [TT]-sh[tt] to enable the choice "
903 "starting points. Towards the end, statistical inaccuracy grows and integrating the",
904 "correlation function only yields reliable values until a certain point, depending on",
905 "the number of frames. The option [TT]-tr[tt] controls the region of the integral taken "
907 "for calculating the static dielectric constant.",
909 "Option [TT]-temp[tt] sets the temperature required for the computation of the static "
910 "dielectric constant.",
912 "Option [TT]-eps[tt] controls the dielectric constant of the surrounding medium for "
914 "a Reaction Field or dipole corrections of the Ewald summation ([TT]-eps[tt]\\=0 "
916 "tin-foil boundary conditions).",
918 "[TT]-[no]nojump[tt] unfolds the coordinates to allow free diffusion. This is required to "
920 "translational dipole moment, required for the Einstein-Helfand fit. The results from the "
922 "the determination of the dielectric constant for system of charged molecules. However, it "
923 "is also possible to extract",
924 "the dielectric constant from the fluctuations of the total dipole moment in folded "
925 "coordinates. But this",
926 "option has to be used with care, since only very short time spans fulfill the "
927 "approximation that the density",
928 "of the molecules is approximately constant and the averages are already converged. To be "
930 "the dielectric constant should be calculated with the help of the Einstein-Helfand method "
932 "the translational part of the dielectric constant."
936 /* At first the arguments will be parsed and the system information processed */
937 if (!parse_common_args(&argc
, argv
, PCA_CAN_TIME
| PCA_CAN_VIEW
, NFILE
, fnm
, asize(pa
), pa
,
938 asize(desc
), desc
, 0, nullptr, &oenv
))
943 bACF
= opt2bSet("-caf", NFILE
, fnm
);
944 bINT
= opt2bSet("-mc", NFILE
, fnm
);
946 read_tps_conf(ftp2fn(efTPS
, NFILE
, fnm
), &top
, &pbcType
, nullptr, nullptr, box
, TRUE
);
948 indexfn
= ftp2fn_null(efNDX
, NFILE
, fnm
);
951 get_index(&(top
.atoms
), indexfn
, 1, &isize
, &index0
, grpname
);
953 flags
= flags
| TRX_READ_X
| TRX_READ_V
;
955 read_first_frame(oenv
, &status
, ftp2fn(efTRX
, NFILE
, fnm
), &fr
, flags
);
957 snew(mass2
, top
.atoms
.nr
);
958 snew(qmol
, top
.atoms
.nr
);
960 precalc(top
, mass2
, qmol
);
965 for (i
= 0; i
< isize
; i
++)
967 indexm
[i
] = index0
[i
];
973 index_atom2mol(&nmols
, indexm
, &top
.mols
);
979 outf
= xvgropen(opt2fn("-caf", NFILE
, fnm
), "Current autocorrelation function",
980 output_env_get_xvgr_tlabel(oenv
), "ACF (e nm/ps)\\S2", oenv
);
981 fprintf(outf
, "# time\t acf\t average \t std.dev\n");
983 fcur
= xvgropen(opt2fn("-o", NFILE
, fnm
), "Current", output_env_get_xvgr_tlabel(oenv
),
984 "J(t) (e nm/ps)", oenv
);
985 fprintf(fcur
, "# time\t Jx\t Jy \t J_z \n");
988 mcor
= xvgropen(opt2fn("-mc", NFILE
, fnm
),
989 "M\\sD\\N - current autocorrelation function",
990 output_env_get_xvgr_tlabel(oenv
),
991 "< M\\sD\\N (0)\\c7\\CJ(t) > (e nm/ps)\\S2", oenv
);
992 fprintf(mcor
, "# time\t M_D(0) J(t) acf \t Integral acf\n");
996 fmj
= xvgropen(opt2fn("-mj", NFILE
, fnm
), "Averaged translational part of M",
997 output_env_get_xvgr_tlabel(oenv
), "< M\\sJ\\N > (enm)", oenv
);
998 fprintf(fmj
, "# time\t x\t y \t z \t average of M_J^2 \t std.dev\n");
999 fmd
= xvgropen(opt2fn("-md", NFILE
, fnm
), "Averaged rotational part of M",
1000 output_env_get_xvgr_tlabel(oenv
), "< M\\sD\\N > (enm)", oenv
);
1001 fprintf(fmd
, "# time\t x\t y \t z \t average of M_D^2 \t std.dev\n");
1004 opt2fn("-dsp", NFILE
, fnm
), "MSD of the squared translational dipole moment M",
1005 output_env_get_xvgr_tlabel(oenv
),
1006 "<|M\\sJ\\N(t)-M\\sJ\\N(0)|\\S2\\N > / 6.0*V*k\\sB\\N*T / Sm\\S-1\\Nps\\S-1\\N", oenv
);
1009 /* System information is read and prepared, dielectric() processes the frames
1010 * and calculates the requested quantities */
1012 dielectric(fmj
, fmd
, outf
, fcur
, mcor
, fmjdsp
, bNoJump
, bACF
, bINT
, pbcType
, top
, fr
, temp
, bfit
, efit
,
1013 bvit
, evit
, status
, isize
, nmols
, nshift
, index0
, indexm
, mass2
, qmol
, eps_rf
, oenv
);