From f251dc006328cb69b7844dc02c24a107e522376f Mon Sep 17 00:00:00 2001 From: lindahl Date: Wed, 6 Nov 2002 09:46:18 +0000 Subject: [PATCH] Partial commit of the project to remove all static variables. Implemented several new input variables. Started work on Andersen temperature coupling, and a framework for Generalized-Born type potentials. Added function types for fourier dihedrals, Amber/OPLS impropers and dihedral restraints (not yet working). --- acinclude.m4 | 228 ++++++++++++++++++++++++++++ configure.ac | 16 +- include/3dview.h | 8 +- include/Makefile.am | 30 ++-- include/assert.h | 5 - include/atomprop.h | 2 +- include/axp_asm.h | 1 - include/binio.h | 90 +++++++++++ include/block_tx.h | 2 +- include/bondf.h | 4 - include/calcgrid.h | 2 +- include/calch.h | 4 - include/calcmu.h | 2 +- include/callf77.h | 1 - include/confio.h | 5 - include/constr.h | 2 +- include/copyrite.h | 29 ++-- include/detectcpu.h | 4 +- include/disre.h | 5 - include/do_fit.h | 5 +- include/do_md.h | 4 - include/dummies.h | 2 +- include/ebin.h | 5 +- include/edsam.h | 2 +- include/enxio.h | 4 - include/ewald.h | 1 - include/ewald_util.h | 2 +- include/fatal.h | 5 - include/ffscanf.h | 2 +- include/fftgrid.h | 2 +- include/fftw_wrapper.h | 2 +- include/filenm.h | 16 +- include/force.h | 5 +- include/futil.h | 12 +- include/gbutil.h | 2 +- include/gmxcomplex.h | 2 - include/gmxfio.h | 1 - include/grompp.h | 20 ++- include/gstat.h | 1 - include/index.h | 4 +- include/init.h | 5 - include/invblock.h | 4 - include/macros.h | 24 ++- include/magic.h | 2 +- include/main.h | 6 +- include/maths.h | 5 - include/matio.h | 4 - include/mdatoms.h | 1 - include/mdebin.h | 11 +- include/mdrun.h | 11 +- include/metacode.h | 1 - include/mshift.h | 6 +- include/mvdata.h | 5 - include/names.h | 58 +++---- include/network.h | 4 - include/nhash.h | 5 - include/nr.h | 1 - include/nrama.h | 6 +- include/nrjac.h | 1 - include/nrnb.h | 4 - include/ns.h | 5 - include/nsb.h | 1 - include/nsgrid.h | 5 - include/orires.h | 5 - include/pbc.h | 4 - include/pdbio.h | 4 - include/pdebug.h | 6 - include/physics.h | 5 - include/pme.h | 2 - include/ppc_altivec.h | 1 - include/pppm.h | 1 - include/princ.h | 1 - include/pull.h | 1 - include/random.h | 41 +++-- include/rbin.h | 4 - include/rdgroup.h | 4 - include/readcomp.h | 5 - include/readinp.h | 17 ++- include/renum.h | 4 - include/reorder.h | 4 - include/rmpbc.h | 5 +- include/rwtop.h | 89 ----------- include/sheader.h | 5 - include/shift.h | 7 - include/shift_util.h | 1 - include/smalloc.h | 10 +- include/sortwater.h | 2 +- include/split.h | 5 - include/statusio.h | 5 - include/statutil.h | 1 - include/strdb.h | 5 - include/string2.h | 7 +- include/struc2.h | 4 - include/superb.h | 4 - include/symtab.h | 7 +- include/sysstuff.h | 5 - include/tags.h | 6 +- include/tgroup.h | 7 - include/tpxio.h | 13 +- include/transfer.h | 5 +- include/trnio.h | 1 - include/txtdump.h | 20 +-- include/typedefs.h | 1 - include/types/atoms.h | 14 +- include/types/enums.h | 19 ++- include/types/fcdata.h | 18 +++ include/types/forcerec.h | 9 ++ include/types/graph.h | 4 + include/types/idef.h | 48 +++--- include/types/ifunc.h | 2 +- include/types/inputrec.h | 42 ++++-- include/types/nrnb.h | 3 +- include/types/topology.h | 7 +- include/update.h | 15 +- include/utils.h | 5 - include/vcm.h | 4 - include/vec.h | 21 +-- include/viewit.h | 5 - include/wgms.h | 2 - include/wman.h | 19 +-- include/writeps.h | 72 ++++----- include/x86_3dnow.h | 1 - include/x86_sse.h | 1 - include/x86_sse2.h | 1 - include/xdrf.h | 1 - include/xtcio.h | 1 - include/xvgr.h | 7 +- share/template/Makefile.am | 6 - share/template/README | 6 +- share/top/ffgmxnb.itp | 8 +- share/top/ffoplsaa.rtp | 2 +- share/top/methanol.itp | 100 +++++++----- src/contrib/addquote.c | 3 +- src/contrib/anaf.c | 4 +- src/contrib/calcfdev.c | 2 +- src/contrib/copyrgt.c | 74 +-------- src/contrib/do_shift.c | 2 +- src/contrib/dsspcore.c | 302 ++----------------------------------- src/contrib/ehanal.c | 2 +- src/contrib/ehdata.c | 2 +- src/contrib/ehdata.h | 2 +- src/contrib/ehole.c | 2 +- src/contrib/g_anavel.c | 29 ++-- src/contrib/glasmd.c | 5 +- src/contrib/hexamer.c | 2 +- src/contrib/hrefify.c | 26 ++-- src/contrib/mk6_n.c | 2 +- src/contrib/mkice.c | 8 +- src/contrib/mkyaw.c | 2 +- src/contrib/my_dssp.c | 2 +- src/contrib/options.c | 2 +- src/contrib/optwat.c | 14 +- src/contrib/prfn.c | 6 +- src/contrib/sigeps.c | 2 +- src/contrib/test.c | 2 +- src/gmxlib/3dview.c | 48 +++--- src/gmxlib/Makefile.am | 7 +- src/gmxlib/atomprop.c | 4 +- src/gmxlib/block_tx.c | 3 +- src/gmxlib/bondfree.c | 54 +++++-- src/gmxlib/calcgrid.c | 1 - src/gmxlib/calch.c | 1 - src/gmxlib/cinvsqrtdata.c | 5 +- src/gmxlib/confio.c | 8 +- src/gmxlib/copyrite.c | 104 ++++++++----- src/gmxlib/crecipdata.c | 6 +- src/gmxlib/debugb.h | 2 +- src/gmxlib/detectcpu.c | 101 ++++++++++--- src/gmxlib/disre.c | 8 +- src/gmxlib/dlb.h | 4 - src/gmxlib/do_fit.c | 25 +-- src/gmxlib/enxio.c | 2 +- src/gmxlib/ewald_util.c | 6 +- src/gmxlib/f77_wrappers.c | 3 +- src/gmxlib/fatal.c | 3 +- src/gmxlib/ffscanf.c | 9 +- src/gmxlib/filenm.c | 42 +++--- src/gmxlib/fnbf.c | 4 +- src/gmxlib/four1.c | 4 +- src/gmxlib/fourn.c | 3 +- src/gmxlib/ftocstr.c | 3 +- src/gmxlib/futil.c | 10 +- src/gmxlib/gbutil.c | 3 +- src/gmxlib/gmxfio.c | 12 +- src/gmxlib/ifunc.c | 80 +++++----- src/gmxlib/index.c | 44 +++--- src/gmxlib/inner.h | 2 +- src/gmxlib/inner_altivec.c | 2 +- src/gmxlib/invblock.c | 4 +- src/gmxlib/libxdrf.c | 7 +- src/gmxlib/macros.c | 20 +-- src/gmxlib/main.c | 43 +++++- src/gmxlib/maths.c | 2 +- src/gmxlib/matio.c | 4 +- src/gmxlib/metacode.c | 7 +- src/gmxlib/mgmx.c | 24 +-- src/gmxlib/mgmxtest.c | 2 +- src/gmxlib/minvert.c | 21 +-- src/gmxlib/minvert.h | 2 +- src/gmxlib/mkinl.c | 7 +- src/gmxlib/mkinl.h | 7 +- src/gmxlib/mkinl_calcdist.c | 7 +- src/gmxlib/mkinl_declarations.c | 7 +- src/gmxlib/mkinl_fortrandata.h | 6 +- src/gmxlib/mkinl_innerloop.c | 7 +- src/gmxlib/mkinl_interactions.c | 7 +- src/gmxlib/mkinl_invsqrt.c | 7 +- src/gmxlib/mkinl_outerloop.c | 7 +- src/gmxlib/mkinl_recip.c | 2 +- src/gmxlib/mshift.c | 29 ++-- src/gmxlib/mvdata.c | 3 +- src/gmxlib/mvxvf.c | 3 +- src/gmxlib/names.c | 68 +++++---- src/gmxlib/network.c | 16 +- src/gmxlib/nrama.c | 16 +- src/gmxlib/nrjac.c | 11 +- src/gmxlib/nrnb.c | 11 +- src/gmxlib/orires.c | 4 +- src/gmxlib/pargs.c | 21 ++- src/gmxlib/pbc.c | 2 +- src/gmxlib/pdbio.c | 8 +- src/gmxlib/princ.c | 4 +- src/gmxlib/rando.c | 2 +- src/gmxlib/random.c | 160 ++++++++++++++------ src/gmxlib/rbin.c | 4 +- src/gmxlib/rdgroup.c | 2 +- src/gmxlib/readinp.c | 23 +-- src/gmxlib/repfirst.c | 3 +- src/gmxlib/replace.c | 8 +- src/gmxlib/replace.h | 8 +- src/gmxlib/rmpbc.c | 2 +- src/gmxlib/sheader.c | 6 +- src/gmxlib/shift_util.c | 4 +- src/gmxlib/smalloc.c | 22 ++- src/gmxlib/sortwater.c | 2 +- src/gmxlib/stat.c | 2 +- src/gmxlib/statutil.c | 2 +- src/gmxlib/strdb.c | 16 +- src/gmxlib/string2.c | 6 +- src/gmxlib/symtab.c | 20 ++- src/gmxlib/testfft.c | 2 +- src/gmxlib/testlr.c | 4 +- src/gmxlib/testtab.c | 3 +- src/gmxlib/testxml.c | 4 +- src/gmxlib/threadsync.c | 16 +- src/gmxlib/tpxio.c | 326 +++++++++++++++++++++++++++++++++------- src/gmxlib/trnio.c | 7 +- src/gmxlib/trxio.c | 2 +- src/gmxlib/tstsqrtc.c | 4 +- src/gmxlib/txtdump.c | 160 +++++++++++++++----- src/gmxlib/typedefs.c | 2 +- src/gmxlib/vec.c | 108 ++----------- src/gmxlib/viewit.c | 12 +- src/gmxlib/wgms.c | 2 +- src/gmxlib/widget.c | 4 +- src/gmxlib/widget.h | 4 +- src/gmxlib/wman.c | 174 +++++++++++++-------- src/gmxlib/writeps.c | 270 +++++++++++++++++---------------- src/gmxlib/x86_sse.s | 2 +- src/gmxlib/xdrd.c | 20 ++- src/gmxlib/xmlio.c | 47 +++--- src/gmxlib/xmlio.h | 1 - src/gmxlib/xtcio.c | 2 +- src/gmxlib/xvgr.c | 39 ++--- src/kernel/add_par.c | 4 +- src/kernel/add_par.h | 2 +- src/kernel/convparm.c | 35 ++++- src/kernel/convparm.h | 4 - src/kernel/do_gct.c | 2 +- src/kernel/dum_parm.c | 2 +- src/kernel/dum_parm.h | 2 +- src/kernel/ffscan.c | 2 +- src/kernel/gctio.c | 4 +- src/kernel/gen_ad.c | 16 +- src/kernel/gen_ad.h | 5 +- src/kernel/gen_dum.c | 4 +- src/kernel/gen_dum.h | 2 +- src/kernel/genhydro.c | 9 +- src/kernel/genhydro.h | 2 +- src/kernel/glaasje.c | 2 +- src/kernel/glaasje.h | 2 +- src/kernel/gmxcheck.c | 2 +- src/kernel/gmxdump.c | 16 +- src/kernel/grompp.c | 120 +++++++++++---- src/kernel/h_db.c | 8 +- src/kernel/h_db.h | 6 +- src/kernel/hackblock.c | 8 +- src/kernel/hackblock.h | 6 +- src/kernel/hizzie.c | 10 +- src/kernel/hizzie.h | 2 +- src/kernel/init_sh.c | 3 +- src/kernel/ion_data.h | 2 +- src/kernel/ionize.c | 33 ++-- src/kernel/ionize.h | 2 +- src/kernel/luck.c | 7 +- src/kernel/md.c | 58 ++++--- src/kernel/mdrun.c | 10 +- src/kernel/mk_ghat.c | 2 +- src/kernel/nm2type.c | 4 +- src/kernel/pdb2gmx.c | 45 +++--- src/kernel/pdb2top.c | 15 +- src/kernel/pdb2top.h | 8 +- src/kernel/pgutil.c | 4 +- src/kernel/pgutil.h | 4 - src/kernel/protonate.c | 1 - src/kernel/readir.c | 190 +++++++++++++++++++---- src/kernel/readir.h | 7 +- src/kernel/relax_sh.c | 8 +- src/kernel/resall.c | 2 +- src/kernel/resall.h | 5 - src/kernel/rtp2xml.c | 2 +- src/kernel/sorting.c | 2 +- src/kernel/sorting.h | 4 - src/kernel/specbond.c | 4 +- src/kernel/specbond.h | 1 - src/kernel/splitter.c | 10 +- src/kernel/splitter.h | 2 +- src/kernel/ter_db.c | 2 +- src/kernel/ter_db.h | 4 - src/kernel/tomorse.c | 3 +- src/kernel/topcat.c | 2 +- src/kernel/topcat.h | 5 - src/kernel/topdef.h | 4 - src/kernel/topdirs.c | 9 +- src/kernel/topdirs.h | 4 - src/kernel/topexcl.c | 5 +- src/kernel/topexcl.h | 4 - src/kernel/topio.c | 38 ++--- src/kernel/topio.h | 4 - src/kernel/toppush.c | 124 +++++++++------ src/kernel/toppush.h | 7 +- src/kernel/topshake.c | 3 +- src/kernel/topshake.h | 4 - src/kernel/toputil.c | 11 +- src/kernel/toputil.h | 4 - src/kernel/tpbcmp.c | 35 ++++- src/kernel/tpbcmp.h | 2 +- src/kernel/tpbconv.c | 6 +- src/kernel/x2top.c | 6 +- src/kernel/x2top.h | 1 - src/kernel/xlate.c | 4 +- src/kernel/xlate.h | 2 +- src/kernel/xmdrun.h | 1 - src/kernel/xutils.c | 2 +- src/mdlib/Makefile.am | 10 +- src/mdlib/calcmu.c | 4 +- src/mdlib/calcvir.c | 4 +- src/mdlib/callf77.c | 4 +- src/mdlib/clincs.c | 4 +- src/mdlib/compnl.c | 2 +- src/mdlib/constr.c | 13 +- src/mdlib/coupling.c | 96 +++++++----- src/mdlib/csettle.c | 203 ++++++++++++++++++------- src/mdlib/dummies.c | 2 +- src/mdlib/ebin.c | 4 +- src/mdlib/edsam.c | 2 +- src/mdlib/ewald.c | 2 +- src/mdlib/fftgrid.c | 4 +- src/mdlib/force.c | 22 ++- src/mdlib/ghat.c | 4 +- src/mdlib/init.c | 21 ++- src/mdlib/mdatom.c | 32 ++-- src/mdlib/mdebin.c | 21 ++- src/mdlib/minimize.c | 47 +++--- src/mdlib/ns.c | 4 +- src/mdlib/nsb.c | 4 +- src/mdlib/nsgrid.c | 3 +- src/mdlib/pme.c | 2 +- src/mdlib/pppm.c | 8 +- src/mdlib/pull.c | 2 +- src/mdlib/pull_internal.h | 2 +- src/mdlib/pullinit.c | 4 +- src/mdlib/pullio.c | 10 +- src/mdlib/pullutil.c | 2 +- src/mdlib/shakef.c | 2 +- src/mdlib/sim_util.c | 34 +++-- src/mdlib/splittop.c | 3 +- src/mdlib/splittop.h | 2 +- src/mdlib/tables.c | 6 +- src/mdlib/tgroup.c | 4 +- src/mdlib/timefft.c | 2 +- src/mdlib/update.c | 72 ++++----- src/mdlib/vcm.c | 4 +- src/mdlib/wnblist.c | 3 +- src/mdlib/wnblist.h | 5 +- src/ngmx/Xstuff.h | 5 - src/ngmx/alert.bm | 3 - src/ngmx/buttons.c | 2 +- src/ngmx/buttons.h | 2 +- src/ngmx/dialogs.c | 2 +- src/ngmx/dialogs.h | 2 +- src/ngmx/dlg.c | 2 +- src/ngmx/ff.bm | 3 - src/ngmx/fgrid.c | 2 +- src/ngmx/fgrid.h | 5 - src/ngmx/filter.c | 2 +- src/ngmx/gmxlogo.c | 2 +- src/ngmx/gromacs.bm | 3 - src/ngmx/highway.c | 2 +- src/ngmx/info.bm | 4 - src/ngmx/logo.c | 2 +- src/ngmx/logo.h | 4 - src/ngmx/manager.c | 8 +- src/ngmx/manager.h | 1 - src/ngmx/molps.c | 12 +- src/ngmx/molps.h | 4 - src/ngmx/nener.c | 2 +- src/ngmx/nener.h | 4 - src/ngmx/ngmx.c | 9 +- src/ngmx/nleg.c | 2 +- src/ngmx/nleg.h | 4 - src/ngmx/nload.c | 2 +- src/ngmx/nload.h | 4 - src/ngmx/nmol.c | 2 +- src/ngmx/nmol.h | 4 - src/ngmx/play.bm | 3 - src/ngmx/popup.c | 2 +- src/ngmx/popup.h | 4 - src/ngmx/pulldown.c | 2 +- src/ngmx/pulldown.h | 5 +- src/ngmx/rewind.bm | 3 - src/ngmx/scrollw.c | 2 +- src/ngmx/showcol.c | 2 +- src/ngmx/stop.bm | 3 - src/ngmx/stop_ani.bm | 4 +- src/ngmx/vbox.c | 2 +- src/ngmx/x11.c | 2 +- src/ngmx/x11.h | 5 - src/ngmx/xdlg.c | 2 +- src/ngmx/xdlg.h | 4 - src/ngmx/xdlghi.c | 2 +- src/ngmx/xdlghi.h | 4 - src/ngmx/xdlgitem.c | 2 +- src/ngmx/xdlgitem.h | 5 - src/ngmx/xmb.c | 2 +- src/ngmx/xmb.h | 5 - src/ngmx/xrama.c | 8 +- src/ngmx/xstat.c | 2 +- src/ngmx/xutil.c | 2 +- src/ngmx/xutil.h | 4 - src/tools/addconf.c | 2 +- src/tools/addconf.h | 1 - src/tools/anadih.c | 11 +- src/tools/angstat.h | 1 - src/tools/autocorr.c | 2 +- src/tools/average.c | 2 +- src/tools/bondlist.c | 2 +- src/tools/calcpot.c | 10 +- src/tools/calcpot.h | 1 - src/tools/cdist.c | 2 +- src/tools/cdist.h | 2 +- src/tools/cmat.c | 2 +- src/tools/cmat.h | 1 - src/tools/correct.c | 2 +- src/tools/disco.c | 2 +- src/tools/disco.h | 2 +- src/tools/discopar.c | 2 +- src/tools/dlist.c | 2 +- src/tools/do_dssp.c | 2 +- src/tools/dtools.c | 2 +- src/tools/editconf.c | 2 +- src/tools/edittop.c | 2 +- src/tools/eigio.c | 2 +- src/tools/eigio.h | 2 +- src/tools/eneconv.c | 2 +- src/tools/expfit.c | 2 +- src/tools/fitahx.c | 2 +- src/tools/fitahx.h | 1 - src/tools/g_anaeig.c | 2 +- src/tools/g_analyze.c | 2 +- src/tools/g_angle.c | 2 +- src/tools/g_bond.c | 2 +- src/tools/g_bundle.c | 2 +- src/tools/g_chi.c | 2 +- src/tools/g_cluster.c | 2 +- src/tools/g_clustsize.c | 2 +- src/tools/g_com.c | 2 +- src/tools/g_confrms.c | 2 +- src/tools/g_covar.c | 2 +- src/tools/g_density.c | 2 +- src/tools/g_dielectric.c | 2 +- src/tools/g_dih.c | 2 +- src/tools/g_dipoles.c | 4 +- src/tools/g_disre.c | 4 +- src/tools/g_dist.c | 2 +- src/tools/g_dyndom.c | 2 +- src/tools/g_enemat.c | 2 +- src/tools/g_energy.c | 2 +- src/tools/g_gyrate.c | 2 +- src/tools/g_h2order.c | 2 +- src/tools/g_hbond.c | 4 - src/tools/g_helix.c | 2 +- src/tools/g_lie.c | 2 +- src/tools/g_mdmat.c | 2 +- src/tools/g_mindist.c | 10 +- src/tools/g_morph.c | 2 +- src/tools/g_msd.c | 2 +- src/tools/g_multipoles.c | 2 +- src/tools/g_nmeig.c | 2 +- src/tools/g_nmens.c | 2 +- src/tools/g_order.c | 2 +- src/tools/g_potential.c | 2 +- src/tools/g_rama.c | 2 +- src/tools/g_rdf.c | 2 +- src/tools/g_relax.c | 2 +- src/tools/g_rms.c | 4 +- src/tools/g_rmsdist.c | 2 +- src/tools/g_rmsf.c | 2 +- src/tools/g_rotacf.c | 2 +- src/tools/g_run_rms.c | 7 +- src/tools/g_saltbr.c | 2 +- src/tools/g_sas.c | 2 +- src/tools/g_sgangle.c | 2 +- src/tools/g_sorient.c | 2 +- src/tools/g_tcaf.c | 2 +- src/tools/g_traj.c | 2 +- src/tools/g_velacc.c | 2 +- src/tools/g_wham.c | 2 +- src/tools/genbox.c | 2 +- src/tools/genconf.c | 2 +- src/tools/gendr.c | 2 +- src/tools/genion.c | 2 +- src/tools/genpr.c | 2 +- src/tools/hxprops.c | 2 +- src/tools/hxprops.h | 2 +- src/tools/levenmar.c | 2 +- src/tools/lsq.c | 2 +- src/tools/luck.c | 2 +- src/tools/make_ndx.c | 2 +- src/tools/mcprop.c | 2 +- src/tools/mcprop.h | 2 +- src/tools/mk_angndx.c | 2 +- src/tools/my_rdf.c | 2 +- src/tools/nsc.c | 2 +- src/tools/nsc.h | 2 +- src/tools/orise.c | 2 +- src/tools/orise.h | 2 +- src/tools/pinput.c | 2 +- src/tools/pinput.h | 1 - src/tools/polynomials.c | 2 +- src/tools/pp2shift.c | 2 +- src/tools/proptim.c | 2 +- src/tools/ql77.c | 2 +- src/tools/ql77.h | 2 +- src/tools/readev.c | 2 +- src/tools/readev.h | 2 +- src/tools/recomb.c | 2 +- src/tools/recomb.h | 1 - src/tools/residues.c | 2 +- src/tools/sas2mat.c | 2 +- src/tools/smooth.c | 2 +- src/tools/testacf.c | 2 +- src/tools/trjcat.c | 3 +- src/tools/trjconv.c | 5 +- src/tools/trjorder.c | 2 +- src/tools/wheel.c | 4 +- src/tools/xpm2ps.c | 58 ++++--- 557 files changed, 3676 insertions(+), 3018 deletions(-) create mode 100644 include/binio.h delete mode 100644 include/rwtop.h rewrite share/top/methanol.itp (90%) diff --git a/acinclude.m4 b/acinclude.m4 index 252ca4ed40..4390e0f92c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -887,6 +887,234 @@ fi ]) +dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +dnl +dnl This macro figures out how to build C programs using POSIX +dnl threads. It sets the PTHREAD_LIBS output variable to the threads +dnl library and linker flags, and the PTHREAD_CFLAGS output variable +dnl to any special C compiler flags that are needed. (The user can also +dnl force certain compiler flags/libs to be tested by setting these +dnl environment variables.) +dnl +dnl Also sets PTHREAD_CC to any special C compiler that is needed for +dnl multi-threaded programs (defaults to the value of CC otherwise). +dnl (This is necessary on AIX to use the special cc_r compiler alias.) +dnl +dnl If you are only building threads programs, you may wish to +dnl use these variables in your default LIBS, CFLAGS, and CC: +dnl +dnl LIBS="$PTHREAD_LIBS $LIBS" +dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +dnl CC="$PTHREAD_CC" +dnl +dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute +dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE +dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +dnl +dnl ACTION-IF-FOUND is a list of shell commands to run if a threads +dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands +dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, +dnl the default action will define HAVE_PTHREAD. +dnl +dnl Please let the authors know if this macro fails on any platform, +dnl or if you have any other suggestions or comments. This macro was +dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org) +dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread +dnl macros posted by AFC to the autoconf macro repository. We are also +dnl grateful for the helpful feedback of numerous users. +dnl +dnl @version $Id$ +dnl @author Steven G. Johnson and Alejandro Forero Cuervo + +AC_DEFUN([ACX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_SAVE +AC_LANG_C +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) + AC_MSG_RESULT($acx_pthread_ok) + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# pthread: Linux, etcetera +# --thread-safe: KAI C++ + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthread or + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_TRY_LINK([#include ], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($acx_pthread_ok) + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: threads are created detached by default + # and the JOINABLE attribute has a nonstandard name (UNDETACHED). + AC_MSG_CHECKING([for joinable pthread attribute]) + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_JOINABLE;], + ok=PTHREAD_CREATE_JOINABLE, ok=unknown) + if test x"$ok" = xunknown; then + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_UNDETACHED;], + ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) + fi + if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then + AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, + [Define to the necessary symbol if this constant + uses a non-standard name on your system.]) + fi + AC_MSG_RESULT(${ok}) + if test x"$ok" = xunknown; then + AC_MSG_WARN([we do not know how to create joinable pthreads]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; + *solaris* | alpha*-osf*) flag="-D_REENTRANT";; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with cc_r + AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + acx_pthread_ok=no + $2 +fi +AC_LANG_RESTORE +])dnl ACX_PTHREAD + + # # Below, we include our patched version of libtool.m4, from diff --git a/configure.ac b/configure.ac index f6eef78564..d43e79ba81 100644 --- a/configure.ac +++ b/configure.ac @@ -3,12 +3,12 @@ ####################################################################### AC_PREREQ(2.50) -AC_INIT(GROMACS, 3.1.99_20020920, gmx-users@gromacs.org) +AC_INIT(GROMACS, 3.1.99_20021031, gmx-users@gromacs.org) AC_CONFIG_SRCDIR(src/gmxlib/3dview.c) AC_CONFIG_AUX_DIR(config) AC_CANONICAL_HOST -AM_INIT_AUTOMAKE(gromacs, 3.1.99_20020920) +AM_INIT_AUTOMAKE(gromacs, 3.1.99_20021031) AC_PREFIX_DEFAULT(/usr/local/gromacs) AM_CONFIG_HEADER(src/config.h) dnl This is the version info according to the libtool versioning system. @@ -59,6 +59,10 @@ AC_SUBST(F77LINK,"\$(LINK)") AC_ARG_ENABLE(mpi, [ --enable-mpi compile for parallel runs using MPI],,enable_mpi=no) +### Threads +AC_ARG_ENABLE(threads, + [ --disable-threads don't try to use multithreading],,enable_threads=yes) + ### MPI environment AC_ARG_ENABLE(mpi-environment, @@ -209,7 +213,7 @@ if test -z "$CC_FOR_BUILD"; then fi AC_SUBST(CC_FOR_BUILD) -if test "$enable_fortran" = "yes"; then +if test "$enable_fortran" = "yes"; then AC_PROG_F77( $f77_names ) if test -z "$F77"; then AC_MSG_ERROR([No fortran compiler found]) @@ -239,6 +243,12 @@ if test "$enable_mpi" = "yes"; then AC_DEFINE(USE_MPI,,[Make a parallel version of GROMACS using MPI]) fi +if test "$enable_threads" = "yes"; then + AC_MSG_CHECKING([for pthreads]) + AC_MSG_RESULT([yes]) +# ACX_PTHREAD([],AC_MSG_ERROR([Cannot compile with pthreads; use --disable-threads]) +fi + if test "$enable_fortran" = "yes"; then AC_F77_LIBRARY_LDFLAGS AC_F77_WRAPPERS diff --git a/include/3dview.h b/include/3dview.h index c27b1dd306..48ecfcdd85 100644 --- a/include/3dview.h +++ b/include/3dview.h @@ -33,7 +33,6 @@ #ifndef _3dview_h #define _3dview_h -static char *SRCID_3dview_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif @@ -47,13 +46,15 @@ typedef real vec4[4]; typedef real mat4[4][4]; typedef int iv2[2]; - + typedef struct { matrix box; vec4 eye,origin; /* The eye and origin position */ mat4 proj; /* Projection matrix */ mat4 Rot; /* Total rotation matrix */ real sc_x,sc_y; /* Scaling for aspect ratio */ + mat4 RotP[DIM]; /* state for 3d rotations */ + mat4 RotM[DIM]; } t_3dview; extern void print_m4(FILE *fp,char *s,mat4 A); @@ -92,6 +93,9 @@ extern bool zoom_3d(t_3dview *view,real fac); * FALSE otherwise. */ +extern void init_rotate_3d(t_3dview *view); +/* Initiates the state of 3d rotation matrices in the structure */ + extern void rotate_3d(t_3dview *view,int axis,bool bPositive); /* Rotate the eye around the center of the box, around axis */ diff --git a/include/Makefile.am b/include/Makefile.am index 7c8e05691b..f02bb131a5 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -7,36 +7,36 @@ SUBDIRS = . types include_HEADERS = \ 3dview.h do_md.h invblock.h nrjac.h \ - rwtop.h tpxio.h assert.h \ + rwtop.h tpxio.h assert.h dihre.h \ nrnb.h sheader.h transfer.h \ - atomprop.h dummies.h list.h ns.h \ + atomprop.h dummies.h ns.h \ shift.h trnio.h axp_asm.h ebin.h \ macros.h nsb.h shift_util.h txtdump.h \ - binio.h edsam.h magic.h nsgrid.h \ + edsam.h magic.h nsgrid.h \ typedefs.h block_tx.h enxio.h \ main.h pbc.h smalloc.h update.h \ bondf.h ewald.h maths.h pdbio.h \ - sortwater.h utils.h buffer.h ewald_util.h \ + sortwater.h utils.h ewald_util.h \ matio.h pdebug.h split.h vcm.h \ calcgrid.h fatal.h mdatoms.h physics.h \ vec.h calch.h ffscanf.h mdebin.h \ pme.h statusio.h viewit.h calcmu.h \ fftgrid.h mdrun.h pppm.h statutil.h \ - vveclib.h callf77.h fftw_wrapper.h memdump.h \ + callf77.h fftw_wrapper.h \ princ.h wgms.h gmx_system_xdr.h \ - filenm.h memtab.h pull.h strdb.h \ - wman.h comlib.h force.h memtest.h \ + filenm.h pull.h strdb.h \ + wman.h force.h \ string2.h writeps.h gmxcomplex.h \ futil.h metacode.h random.h struc2.h \ - x86_3dnow.h comtest.h gbutil.h \ - rbin.h superb.h detectcpu.h tgroup.h \ - general.h mshift.h rdgroup.h symtab.h \ - x86_sse.h confio.h gmxfio.h mvdata.h \ - rdklib.h sync.h xdrf.h constr.h \ - grompp.h names.h readcomp.h synclib.h \ + x86_3dnow.h gbutil.h \ + rbin.h detectcpu.h tgroup.h \ + mshift.h rdgroup.h symtab.h \ + x86_sse.h confio.h gmxfio.h \ + xdrf.h constr.h \ + grompp.h names.h readcomp.h \ xtcio.h copyrite.h gstat.h network.h \ - readinp.h sysstuff.h xvgr.h delay.h \ - index.h nhash.h renum.h systest.h \ + readinp.h sysstuff.h xvgr.h \ + index.h mvdata.h \ disre.h orires.h x86_sse2.h \ init.h nr.h reorder.h \ tags.h do_fit.h nrama.h \ diff --git a/include/assert.h b/include/assert.h index 37ddddeefb..7ab60bc5ac 100644 --- a/include/assert.h +++ b/include/assert.h @@ -33,15 +33,10 @@ #ifndef _assert_h #define _assert_h -static char *SRCID_assert_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) assert.h 1.12 11/23/92" -#endif /* HAVE_IDENT */ - #include #include "sysstuff.h" diff --git a/include/atomprop.h b/include/atomprop.h index b213ccae78..3d47782504 100644 --- a/include/atomprop.h +++ b/include/atomprop.h @@ -29,7 +29,7 @@ * And Hey: * Grunge ROck MAChoS */ -static char *SRCID_atomprop_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/axp_asm.h b/include/axp_asm.h index d9d10466b7..1d75828254 100644 --- a/include/axp_asm.h +++ b/include/axp_asm.h @@ -33,7 +33,6 @@ #ifndef _axp_asm_h #define _axp_asm_h -static char *SRCID_axp_asm_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/binio.h b/include/binio.h new file mode 100644 index 0000000000..cdf1e28a6c --- /dev/null +++ b/include/binio.h @@ -0,0 +1,90 @@ +/* + * $Id$ + * + * This source code is part of + * + * G R O M A C S + * + * GROningen MAchine for Chemical Simulations + * + * VERSION 3.1 + * Copyright (c) 1991-2001, University of Groningen, The Netherlands + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * If you want to redistribute modifications, please consider that + * scientific software is very special. Version control is crucial - + * bugs must be traceable. We will be happy to consider code for + * inclusion in the official distribution, but derived work must not + * be called official GROMACS. Details are found in the README & COPYING + * files - if they are missing, get the official version at www.gromacs.org. + * + * To help us fund GROMACS development, we humbly ask that you cite + * the papers on the package - you can find them in the top README file. + * + * For more info, check our website at http://www.gromacs.org + * + * And Hey: + * Grunge ROck MAChoS + */ + +#ifndef _binio_h +#define _binio_h + +static char *SRCID_binio_h = "$Id$"; +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_IDENT +#ident "@(#) binio.h 1.5 11/23/92" +#endif /* HAVE_IDENT */ + +#include +#include "sysstuff.h" +#include "fatal.h" + +/* + * Module to binary write and read. + * + * @ + * @@@ @@ @ + * @ @ + * @ @ @ @@@ @@ @@@ @@ @@ @@@ @@ @@ @@ @@ + * @ @ @ @ @ @@ @ @@ @ @ @@ @ @ @@ + * @ @ @ @ @ @ @ @ @ @ @ @ @ + * @@ @@ @@@@@ @ @ @ @ @ @ @ @ + * @ @ @ @ @ @ @ @ @ @ @ @ + * @ @ @ @@ @ @ @ @ @ @ @ @@ + * @ @ @@@ @@ @@@@ @@@ @@@ @@@@@ @@@ @@@ @@ @ + * @ + * @ + * @@@ + * + * Use this module only to write and read simple types or array(s) + * of simple types. STRUCTURES ARE DEFINITELY NOT ALLOWED. + */ + +#define nblockwrite(fp,nelem,data) \ + _blockwrite(fp,nelem,sizeof(*data),(data),#data,__FILE__,__LINE__) +#define blockwrite(fp,data) \ + _blockwrite(fp,1,sizeof(data),&(data),#data,__FILE__,__LINE__) +#define cblockwrite(fp,ptr,nchars) \ + _blockwrite(fp,1,(nchars),(ptr),#ptr,__FILE__,__LINE__) +#define nblockread(fp,nelem,data) \ + _blockread(fp,nelem,sizeof(*data),(data),#data,__FILE__,__LINE__) +#define blockread(fp,data) \ + _blockread(fp,1,sizeof(data),&(data),#data,__FILE__,__LINE__) +#define cblockread(fp,ptr,nchars) \ + _blockread(fp,1,(nchars),(ptr),#ptr,__FILE__,__LINE__) + + +extern void _blockwrite(FILE *fp,int nelem,int size,void *data, + char *what,char *file,int line); + +extern void _blockread(FILE *fp,int nelem,int size,void *data, + char *what,char *file,int line); + +#endif /* _binio_h */ diff --git a/include/block_tx.h b/include/block_tx.h index a8958aae99..079b6fe583 100644 --- a/include/block_tx.h +++ b/include/block_tx.h @@ -29,7 +29,7 @@ * And Hey: * Grunge ROck MAChoS */ -static char *SRCID_block_tx_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/bondf.h b/include/bondf.h index 4169706aa4..844895b84e 100644 --- a/include/bondf.h +++ b/include/bondf.h @@ -33,14 +33,10 @@ #ifndef _bondf_h #define _bondf_h -static char *SRCID_bondf_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) bondf.h 1.28 2/19/97" -#endif /* HAVE_IDENT */ #ifdef CPLUSPLUS extern "C" { diff --git a/include/calcgrid.h b/include/calcgrid.h index 0a9e386fae..2bcaa4824f 100644 --- a/include/calcgrid.h +++ b/include/calcgrid.h @@ -29,7 +29,7 @@ * And Hey: * Grunge ROck MAChoS */ -static char *SRCID_calcgrid_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/calch.h b/include/calch.h index 28b8564d67..dac4c89a1b 100644 --- a/include/calch.h +++ b/include/calch.h @@ -33,14 +33,10 @@ #ifndef _calch_h #define _calch_h -static char *SRCID_calch_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) calch.h 1.8 2/2/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" extern void calc_h_pos(int nht, rvec xa[], rvec xh[]); diff --git a/include/calcmu.h b/include/calcmu.h index 68af78914f..dda5eb9770 100644 --- a/include/calcmu.h +++ b/include/calcmu.h @@ -33,7 +33,7 @@ #ifndef _calcmu_h #define _calcmu_h -static char *SRCID_calcmu_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/callf77.h b/include/callf77.h index 04f71f16c3..e2a84147b6 100644 --- a/include/callf77.h +++ b/include/callf77.h @@ -33,7 +33,6 @@ #ifndef _callf77_h #define _callf77_h -static char *SRCID_callf77_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/confio.h b/include/confio.h index 6e7dc6a787..98d914e440 100644 --- a/include/confio.h +++ b/include/confio.h @@ -33,15 +33,10 @@ #ifndef _confio_h #define _confio_h -static char *SRCID_confio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) confio.h 1.16 11/23/92" -#endif /* HAVE_IDENT */ - #include "typedefs.h" /* For reading coordinate files it is assumed that enough memory diff --git a/include/constr.h b/include/constr.h index 1e35ebe7b2..ef98a2c9f2 100644 --- a/include/constr.h +++ b/include/constr.h @@ -29,7 +29,7 @@ * And Hey: * Grunge ROck MAChoS */ -static char *SRCID_constr_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/copyrite.h b/include/copyrite.h index e5d35de0a4..ad6f58e271 100644 --- a/include/copyrite.h +++ b/include/copyrite.h @@ -33,15 +33,10 @@ #ifndef _copyrite_h #define _copyrite_h -static char *SRCID_copyrite_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) copyright.h 1.10 11/23/92" -#endif /* HAVE_IDENT */ - #ifdef CPLUSPLUS extern "C" { #endif @@ -49,14 +44,16 @@ extern "C" { #include /* Has to be a function, so we can get version number from autoconf */ -char *GromacsVersion(void); +const char *GromacsVersion(void); -static char *CopyrightText[] = { - "Copyright (c) 1991-2002, University of Groningen, The Netherlands" +static const char *CopyrightText[] = { + "Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.", + "Copyright (c) 1991-2002, University of Groningen, The Netherlands", + "Check out http://www.gromacs.org for more information.\n" }; -static char *GPLText[] = { +static const char *GPLText[] = { "This program is free software; you can redistribute it and/or", "modify it under the terms of the GNU General Public License", "as published by the Free Software Foundation; either version 2", @@ -67,10 +64,18 @@ static char *GPLText[] = { extern void pr_difftime(FILE *out,double dt); void CopyRight(FILE *out,char *szProgram); + +/* For both bromacs() and cool_quote() you have to provide a pointer to + * a string of reasonable length (say 256) and the string length. This + * is necessary to make the routines threadsafe and avoid allocating + * a new string each time. The retstring pointer will be the return value. + */ +extern char *bromacs(char *retstring, int retsize); -extern char *bromacs(void); - -extern char *cool_quote(void); +/* For cool_quote, the number of the quote used will be returned in cqnum + * if it is non-NULL + */ +extern char *cool_quote(char *retstring, int retsize, int *cqnum); extern int be_cool(void); /* Return TRUE when the user is COOL, FALSE otherwise */ diff --git a/include/detectcpu.h b/include/detectcpu.h index a0dbfbf355..8768c3685e 100644 --- a/include/detectcpu.h +++ b/include/detectcpu.h @@ -33,7 +33,7 @@ #ifndef _detectcpu_h #define _detectcpu_h -static char *SRCID_detectcpu_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -59,6 +59,8 @@ extern int cpu_capabilities; #define IA64_CPU (1 << 7) #define PPC_CPU (1 << 8) #define PPC_ALTIVEC_SUPPORT (1 << 9) +#define AMD_CPU (1 << 10) +#define INTEL_CPU (1 << 11) /* Values that are return by cpuid instructions on x86 */ #define VENDOR_AMD 0x68747541 diff --git a/include/disre.h b/include/disre.h index 4dc9296cab..ebf40b3f04 100644 --- a/include/disre.h +++ b/include/disre.h @@ -33,15 +33,10 @@ #ifndef _disre_h #define _disre_h -static char *SRCID_disre_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) disre.h 1.13 2/2/97" -#endif /* HAVE_IDENT */ - #ifdef CPLUSPLUS extern "C" { #endif diff --git a/include/do_fit.h b/include/do_fit.h index afe06ee1ac..976270188f 100644 --- a/include/do_fit.h +++ b/include/do_fit.h @@ -33,14 +33,11 @@ #ifndef _do_fit_h #define _do_fit_h -static char *SRCID_do_fit_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) do_fit.h 1.8 2/2/97" -#endif /* HAVE_IDENT */ + extern real calc_similar_ind(bool bRho,int nind,atom_id *index,real mass[], rvec x[],rvec xp[]); /* Returns RMSD or Rho (depending on bRho) over all atoms in index */ diff --git a/include/do_md.h b/include/do_md.h index 25f46aba3a..29fad3833b 100644 --- a/include/do_md.h +++ b/include/do_md.h @@ -33,14 +33,10 @@ #ifndef _do_md_h #define _do_md_h -static char *SRCID_do_md_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) do_md.h 1.16 2/2/97" -#endif /* HAVE_IDENT */ #include #include "typedefs.h" #include "network.h" diff --git a/include/dummies.h b/include/dummies.h index a34d73c492..ee14e1a570 100644 --- a/include/dummies.h +++ b/include/dummies.h @@ -33,7 +33,7 @@ #ifndef _dummies_h #define _dummies_h -static char *SRCID_dummies_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/ebin.h b/include/ebin.h index 284c412bb5..d1411645e8 100644 --- a/include/ebin.h +++ b/include/ebin.h @@ -33,14 +33,11 @@ #ifndef _ebin_h #define _ebin_h -static char *SRCID_ebin_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) ebin.h 1.10 5/2/97" -#endif /* HAVE_IDENT */ + #include "sysstuff.h" #include "typedefs.h" diff --git a/include/edsam.h b/include/edsam.h index 1581b739ca..f38d20b230 100644 --- a/include/edsam.h +++ b/include/edsam.h @@ -33,7 +33,7 @@ #ifndef _edsam_h #define _edsam_h -static char *SRCID_edsam_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/enxio.h b/include/enxio.h index 51e297d08f..4220525a20 100644 --- a/include/enxio.h +++ b/include/enxio.h @@ -33,14 +33,10 @@ #ifndef _enxio_h #define _enxio_h -static char *SRCID_enxio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) enerio.h 1.13 2/2/97" -#endif /* HAVE_IDENT */ #ifdef CPLUSPLUS external "C" { diff --git a/include/ewald.h b/include/ewald.h index 4eaa416ea3..ec51396760 100644 --- a/include/ewald.h +++ b/include/ewald.h @@ -33,7 +33,6 @@ #ifndef _ewald_h #define _ewald_h -static char *SRCID_ewald_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/ewald_util.h b/include/ewald_util.h index d004a8e115..ceadb4e551 100644 --- a/include/ewald_util.h +++ b/include/ewald_util.h @@ -33,7 +33,7 @@ #ifndef _ewald_util_h #define _ewald_util_h -static char *SRCID_ewald_util_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/fatal.h b/include/fatal.h index a610d3e604..8fedcd14e1 100644 --- a/include/fatal.h +++ b/include/fatal.h @@ -33,15 +33,10 @@ #ifndef _fatal_h #define _fatal_h -static char *SRCID_fatal_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) fatal.h 1.9 11/23/92" -#endif /* HAVE_IDENT */ - #ifdef CPLUSPLUS extern "C" { #endif diff --git a/include/ffscanf.h b/include/ffscanf.h index 2b8a7fb5bc..63409edc50 100644 --- a/include/ffscanf.h +++ b/include/ffscanf.h @@ -29,7 +29,7 @@ * And Hey: * Grunge ROck MAChoS */ -static char *SRCID_ffscanf_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/fftgrid.h b/include/fftgrid.h index 0402f533c0..7a0e885b19 100644 --- a/include/fftgrid.h +++ b/include/fftgrid.h @@ -33,7 +33,7 @@ #ifndef _fftgrid_h #define _fftgrid_h -static char *SRCID_fftgrid_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/fftw_wrapper.h b/include/fftw_wrapper.h index cb9e032341..49a1e20982 100644 --- a/include/fftw_wrapper.h +++ b/include/fftw_wrapper.h @@ -33,7 +33,7 @@ #ifndef _fftw_wrapper_h #define _fftw_wrapper_h -static char *SRCID_fftw_wrapper_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/filenm.h b/include/filenm.h index eba26d6dba..1ae6aed748 100644 --- a/include/filenm.h +++ b/include/filenm.h @@ -37,34 +37,30 @@ #ifndef _filenm_h #define _filenm_h -static char *SRCID_filenm_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) filenm.h 1.14 2/2/97" -#endif /* HAVE_IDENT */ #ifdef CPLUSPLUS extern "C" { #endif #include "futil.h" - -void set_default_file_name(char *name); + +void set_default_file_name(const char *name); /* Set the default file name for all file types to name */ -extern char *ftp2ext(int ftp); +extern const char *ftp2ext(int ftp); /* Return extension for filetype */ -extern char *ftp2desc(int ftp); +extern const char *ftp2desc(int ftp); /* Return description for file type */ -extern char *ftp2defnm(int ftp); +extern const char *ftp2defnm(int ftp); /* Return default file name for file type */ -extern char *ftp2ftype(int ftp); +extern const char *ftp2ftype(int ftp); /* Return Binary or ASCII depending on file type */ extern void pr_def(FILE *fp,int ftp); diff --git a/include/force.h b/include/force.h index de7dbc3dc4..ee11c19a11 100644 --- a/include/force.h +++ b/include/force.h @@ -33,14 +33,11 @@ #ifndef _force_h #define _force_h -static char *SRCID_force_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) force.h 1.53 5/15/97" -#endif /* HAVE_IDENT */ + #include "typedefs.h" #include "pbc.h" #include "nsb.h" diff --git a/include/futil.h b/include/futil.h index 8b2ea6ce49..8e803b36a6 100644 --- a/include/futil.h +++ b/include/futil.h @@ -33,14 +33,10 @@ #ifndef _futil_h #define _futil_h -static char *SRCID_futil_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) futil.h 1.1 11/23/92" -#endif /* HAVE_IDENT */ #include #include "typedefs.h" @@ -51,7 +47,7 @@ extern "C" { extern void no_buffers(void); /* Turn off buffering of files (which is default) for debugging purposes */ -extern bool fexist(char *fname); +extern bool fexist(const char *fname); /* Return TRUE when fname exists, FALSE otherwise */ extern bool eof(FILE *fp); @@ -60,15 +56,15 @@ extern bool eof(FILE *fp); extern bool is_pipe(FILE *fp); /* Check whether the file (opened by ffopen) is a pipe */ -extern char *backup_fn(char *file); +extern char *backup_fn(const char *file); /* Return a backup name for file (name with # before and after) */ /* Make a backup of file if necessary. Return false if there was a problem. */ -extern bool make_backup(char * file); +extern bool make_backup(const char * file); -extern FILE *ffopen(char *file,char *mode); +extern FILE *ffopen(const char *file,char *mode); /* Return a valid file pointer when succesfull, exits otherwise * If the file is in compressed format, open a pipe which uncompresses * the file! Therefore, files must be closed with ffclose (see below) diff --git a/include/gbutil.h b/include/gbutil.h index 0a1f7efe06..edd49eed56 100644 --- a/include/gbutil.h +++ b/include/gbutil.h @@ -29,7 +29,7 @@ * And Hey: * Grunge ROck MAChoS */ -static char *SRCID_gbutil_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/gmxcomplex.h b/include/gmxcomplex.h index d701c8f120..913bd25def 100644 --- a/include/gmxcomplex.h +++ b/include/gmxcomplex.h @@ -32,8 +32,6 @@ #ifndef _complex_h #define _complex_h -static char *SRCID_complex_h = "$Id$"; - #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/gmxfio.h b/include/gmxfio.h index 53d0d64cb8..46e7f8b109 100644 --- a/include/gmxfio.h +++ b/include/gmxfio.h @@ -33,7 +33,6 @@ #ifndef _gmxfio_h #define _gmxfio_h -static char *SRCID_gmxfio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include diff --git a/include/grompp.h b/include/grompp.h index b0ec9cd690..0286c6d171 100644 --- a/include/grompp.h +++ b/include/grompp.h @@ -33,16 +33,10 @@ #ifndef _grompp_h #define _grompp_h -static char *SRCID_grompp_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif - -#ifdef HAVE_IDENT -#ident "@(#) grompp.h 1.37 2/2/97" -#endif /* HAVE_IDENT */ - #include #include "typedefs.h" #include "macros.h" @@ -84,6 +78,7 @@ typedef struct { t_block cgs; /* Charge groups */ t_block mols; /* Molecules */ t_params plist[F_NRE]; /* Parameters in old style */ + } t_molinfo; typedef struct { @@ -92,6 +87,9 @@ typedef struct { char ***atomname; /* Names of the atomtypes */ t_param *nb; /* Nonbonded force default params */ int *bondatomtype; /* The bond_atomtype for each atomtype */ + real *radius; /* Radius for GBSA stuff */ + real *vol; /* Effective volume for GBSA */ + real *surftens; /* Surface tension with water, for GBSA */ } t_atomtype; typedef struct { @@ -129,6 +127,7 @@ typedef enum { d_angle_restraints_z, d_distance_restraints, d_orientation_restraints, + d_dihedral_restraints, d_maxdir, d_invalid, d_none @@ -164,9 +163,18 @@ static char *ds[d_maxdir+1] = { "angle_restraints_z", "distance_restraints", "orientation_restraints", + "dihedral_restraints", "invalid" }; extern void convert_harmonics(int nrmols,t_molinfo mols[],t_atomtype *atype); #endif /* _grompp_h */ + + + + + + + + diff --git a/include/gstat.h b/include/gstat.h index 01b7e50438..e338249a7b 100644 --- a/include/gstat.h +++ b/include/gstat.h @@ -33,7 +33,6 @@ #ifndef _gstat_h #define _gstat_h -static char *SRCID_gstat_h = "$Id$"; #ifdef HAVE_CONFIG_H #include diff --git a/include/index.h b/include/index.h index befdc5b4f5..48384712a6 100644 --- a/include/index.h +++ b/include/index.h @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_index_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -40,7 +40,7 @@ extern t_block *new_block(void); extern void write_index(char *outf, t_block *b,char **gnames); /* Writes index blocks to outf (writes an indexfile) */ -void add_grp(t_block *b,char ***gnames,int nra,atom_id a[],char *name); +void add_grp(t_block *b,char ***gnames,int nra,atom_id a[],const char *name); /* Ads group a with name name to block b and namelist gnames */ extern void analyse(t_atoms *atoms,t_block *gb,char ***gn, diff --git a/include/init.h b/include/init.h index 226a367a11..a351f7d9e9 100644 --- a/include/init.h +++ b/include/init.h @@ -33,15 +33,10 @@ #ifndef _init_h #define _init_h -static char *SRCID_init_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) init.h 1.13 11/23/92" -#endif /* HAVE_IDENT */ - #include #include "typedefs.h" #include "mvdata.h" diff --git a/include/invblock.h b/include/invblock.h index 8fb1c2f108..75b21c8ef2 100644 --- a/include/invblock.h +++ b/include/invblock.h @@ -33,14 +33,10 @@ #ifndef _invblock_h #define _invblock_h -static char *SRCID_invblock_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) invblock.h 1.8 2/2/97" -#endif /* HAVE_IDENT */ #include extern atom_id *make_invblock(t_block *block,int nr); diff --git a/include/macros.h b/include/macros.h index efb8e8664f..4cc9a7ad7a 100644 --- a/include/macros.h +++ b/include/macros.h @@ -33,15 +33,11 @@ #ifndef _macros_h #define _macros_h -static char *SRCID_macros_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) macros.h 1.8 11/23/92" -#endif /* HAVE_IDENT */ - #ifdef CPLUSPLUS extern "C" { #endif @@ -81,15 +77,15 @@ extern "C" { /* This macro calculates the size of a array */ #define asize(a) (sizeof(a)/sizeof((a)[0])) -extern real ZERO; -extern real THIRD; -extern real HALF; -extern real ONE; -extern real TWO; -extern real THREE; -extern real SIX; -extern real TEN; -extern real TWELVE; +extern const real ZERO; +extern const real THIRD; +extern const real HALF; +extern const real ONE; +extern const real TWO; +extern const real THREE; +extern const real SIX; +extern const real TEN; +extern const real TWELVE; #ifdef CPLUSPLUS } diff --git a/include/magic.h b/include/magic.h index 81024e3553..92e2a70ecf 100644 --- a/include/magic.h +++ b/include/magic.h @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_magic_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/main.h b/include/main.h index 8f90e29cfc..9d8d1a15a2 100644 --- a/include/main.h +++ b/include/main.h @@ -33,14 +33,10 @@ #ifndef _main_h #define _main_h -static char *SRCID_main_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) main.h 1.3 11/23/92" -#endif /* HAVE_IDENT */ #include #include "network.h" @@ -48,7 +44,7 @@ static char *SRCID_main_h = "$Id$"; extern FILE *stdlog; extern int gmx_parallel; /* 1 when running in parallel */ -extern char *par_fn(char *base,int ftp,t_commrec *cr); +extern char *par_fn(char *base,int ftp,t_commrec *cr, char buf[], int bufsize); /* Add processor id in the filename right before the extension */ extern void open_log(char *fn,t_commrec *cr); diff --git a/include/maths.h b/include/maths.h index ac3581668a..50877a3d09 100644 --- a/include/maths.h +++ b/include/maths.h @@ -33,15 +33,10 @@ #ifndef _maths_h #define _maths_h -static char *SRCID_maths_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) maths.h 1.11 11/24/92" -#endif /* HAVE_IDENT */ - #include #include "typedefs.h" diff --git a/include/matio.h b/include/matio.h index 72525d2347..7c9cfe5964 100644 --- a/include/matio.h +++ b/include/matio.h @@ -33,14 +33,10 @@ #ifndef _matio_h #define _matio_h -static char *SRCID_matio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) matio.h 1.11 5/20/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" extern bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2); diff --git a/include/mdatoms.h b/include/mdatoms.h index 19d453953b..cfb03cf2d5 100644 --- a/include/mdatoms.h +++ b/include/mdatoms.h @@ -33,7 +33,6 @@ #ifndef _mdatoms_h #define _mdatoms_h -static char *SRCID_mdatoms_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/mdebin.h b/include/mdebin.h index 7f6741d369..78ffc1c4bd 100644 --- a/include/mdebin.h +++ b/include/mdebin.h @@ -33,14 +33,10 @@ #ifndef _mdebin_h #define _mdebin_h -static char *SRCID_mdebin_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) mdebin.h 1.12 2/2/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" #include "sysstuff.h" #include "ebin.h" @@ -70,13 +66,12 @@ extern void upd_mdebin(t_mdebin *md,FILE *fp_dgdl, t_groups *grps, rvec mu_tot, bool bNoseHoover); -extern void print_ebin_header(FILE *log,int steps,real time, - real lamb,real SAfactor); +extern void print_ebin_header(FILE *log,int steps,real time,real lamb); -extern void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR, +extern void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR,bool bDihR, FILE *log,int steps,real time, int mode,bool bCompact, - t_mdebin *md,t_fcdata *fcd,t_atoms *atoms); + t_mdebin *md,t_fcdata *fcd,t_atoms *atoms, t_grpopts *opts); #endif /* _mdebin_h */ diff --git a/include/mdrun.h b/include/mdrun.h index 93e2fce49a..1efd2ab265 100644 --- a/include/mdrun.h +++ b/include/mdrun.h @@ -33,14 +33,10 @@ #ifndef _mdrun_h #define _mdrun_h -static char *SRCID_mdrun_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) do_md.h 1.12 03 Mar 1996" -#endif /* HAVE_IDENT */ #include #include "typedefs.h" #include "network.h" @@ -152,11 +148,12 @@ extern void write_xtc_traj(FILE *log,t_commrec *cr, extern void close_xtc_traj(void); /* ROUTINES from sim_util.c */ -extern void init_mdatoms(t_mdatoms *md,real lambda,bool bFirst); +extern void update_mdatoms(t_mdatoms *md,real lambda, bool bFirst); /* Compute fields from mdatoms struct (invmass etc.) which may change * due to lambda dependent FEP calculations. * If bFirst all values are set, this is necessary once in the * first step. + * You only have to call this routine again if lambda changes. */ extern void print_time(FILE *out,time_t start,int step,t_inputrec *ir); @@ -288,14 +285,14 @@ extern void mdrunner(t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], /* Driver routine, that calls the different methods */ extern void init_md(t_commrec *cr,t_inputrec *ir,tensor box,real *t,real *t0, - real *lambda,real *lam0,real *SAfactor, + real *lambda,real *lam0, t_nrnb *mynrnb,bool *bTYZ,t_topology *top, int nfile,t_filenm fnm[],char **traj, char **xtc_traj,int *fp_ene, FILE **fp_dgdl,t_mdebin **mdebin,t_groups *grps, tensor force_vir,tensor pme_vir, tensor shake_vir,t_mdatoms *mdatoms,rvec mu_tot, - bool *bNEMD,t_vcm **vcm,t_nsborder *nsb); + bool *bNEMD,bool *bSimAnn,t_vcm **vcm,t_nsborder *nsb); /* Routine in sim_util.c */ #endif /* _mdrun_h */ diff --git a/include/metacode.h b/include/metacode.h index 2f8962fba2..5a8c830298 100644 --- a/include/metacode.h +++ b/include/metacode.h @@ -33,7 +33,6 @@ #ifndef _metacode_h #define _metacode_h -static char *SRCID_metacode_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/mshift.h b/include/mshift.h index 66a5dbf1d8..5dab276e7b 100644 --- a/include/mshift.h +++ b/include/mshift.h @@ -33,17 +33,13 @@ #ifndef _mshift_h #define _mshift_h -static char *SRCID_mshift_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) mshift.h 1.11 2/2/97" -#endif /* HAVE_IDENT */ - #include "typedefs.h" + extern t_graph *mk_graph(t_idef *idef,int natoms,bool bShakeOnly,bool bSettle); /* Build a graph from an idef description. The graph can be used * to generate mol-shift indices. diff --git a/include/mvdata.h b/include/mvdata.h index de655309a0..d237304935 100644 --- a/include/mvdata.h +++ b/include/mvdata.h @@ -33,15 +33,10 @@ #ifndef _mvdata_h #define _mvdata_h -static char *SRCID_mvdata_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) mvdata.h 1.6 11/23/92" -#endif /* HAVE_IDENT */ - #include "typedefs.h" #include "nsb.h" diff --git a/include/names.h b/include/names.h index c5fca3c78b..ca2dc2d700 100644 --- a/include/names.h +++ b/include/names.h @@ -33,14 +33,10 @@ #ifndef _names_h #define _names_h -static char *SRCID_names_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) names.h 1.23 5/20/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" @@ -48,30 +44,33 @@ static char *SRCID_names_h = "$Id$"; * extra argument (the +1) * these should correspond to names.c and include/types/enums.h */ -extern char *eblock_names[ebNR+1]; -extern char *epbc_names[epbcNR+1]; -extern char *etcoupl_names[etcNR+1]; -extern char *epcoupl_names[epcNR+1]; -extern char *epcoupltype_names[epctNR+1]; -extern char *ens_names[ensNR+1]; -extern char *ei_names[eiNR+1]; -extern char *yesno_names[BOOL_NR+1]; -extern char *bool_names[BOOL_NR+1]; -extern char *eel_names[eelNR+1]; -extern char *eewg_names[eewgNR+1]; -extern char *evdw_names[evdwNR+1]; -extern char *eshake_names[estNR+1]; -extern char *ptype_str[eptNR+1]; -extern char *egrp_nm[egNR+1]; -extern char *edisre_names[edrNR+1]; -extern char *edisreweighting_names[edrwNR+1]; -extern char *enbf_names[eNBF_NR+1]; -extern char *ecomb_names[eCOMB_NR+1]; -extern char *gtypes[egcNR+1]; -extern char *efep_names[efepNR+1]; -extern char *esolv_names[esolNR+1]; -extern char *edispc_names[edispcNR+1]; -extern char *ecm_names[ecmNR+1]; +extern const char *eblock_names[ebNR+1]; +extern const char *epbc_names[epbcNR+1]; +extern const char *etcoupl_names[etcNR+1]; +extern const char *epcoupl_names[epcNR+1]; +extern const char *epcoupltype_names[epctNR+1]; +extern const char *ens_names[ensNR+1]; +extern const char *ei_names[eiNR+1]; +extern const char *yesno_names[BOOL_NR+1]; +extern const char *bool_names[BOOL_NR+1]; +extern const char *eel_names[eelNR+1]; +extern const char *eewg_names[eewgNR+1]; +extern const char *evdw_names[evdwNR+1]; +extern const char *eshake_names[estNR+1]; +extern const char *ptype_str[eptNR+1]; +extern const char *egrp_nm[egNR+1]; +extern const char *edisre_names[edrNR+1]; +extern const char *edisreweighting_names[edrwNR+1]; +extern const char *enbf_names[eNBF_NR+1]; +extern const char *ecomb_names[eCOMB_NR+1]; +extern const char *gtypes[egcNR+1]; +extern const char *efep_names[efepNR+1]; +extern const char *esolv_names[esolNR+1]; +extern const char *edispc_names[edispcNR+1]; +extern const char *ecm_names[ecmNR+1]; +extern const char *eann_names[eannNR+1]; +extern const char *egb_names[egbNR+1]; +extern const char *eis_names[eisNR+1]; #define UNDEFINED "UNDEFINED" #define ENUM_NAME(e,max,names) ((((e)<0)||((e)>=(max)))?UNDEFINED:(names)[e]) @@ -96,4 +95,7 @@ extern char *ecm_names[ecmNR+1]; #define ESOLVTYPE(e) ENUM_NAME(e,esolNR,esolv_names) #define EDISPCORR(e) ENUM_NAME(e,edispcNR,edispc_names) #define ECOM(e) ENUM_NAME(e,ecmNR,ecm_names) +#define EANNEAL(e) ENUM_NAME(e,eannNR,eann_names) +#define EGBALGORITHM(e) ENUM_NAME(e,egbNR,egb_names) +#define EIMPLICITSOL(e) ENUM_NAME(e,eisNR,eis_names) #endif /* _names_h */ diff --git a/include/network.h b/include/network.h index 006ee92824..4311464bf0 100644 --- a/include/network.h +++ b/include/network.h @@ -32,15 +32,11 @@ #ifndef _network_h #define _network_h -static char *SRCID_network_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) gmx_comm.h 1.9 11/23/92" -#endif /* HAVE_IDENT */ /* * This module defines the interface of the actual communication routines. diff --git a/include/nhash.h b/include/nhash.h index c844c1c154..63434dc137 100644 --- a/include/nhash.h +++ b/include/nhash.h @@ -33,15 +33,10 @@ #ifndef _nhash_h #define _nhash_h -static char *SRCID_nhash_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) nhash.h 1.3 11/23/92" -#endif /* HAVE_IDENT */ - #define MAX_LJQQ 997 typedef struct { diff --git a/include/nr.h b/include/nr.h index d258f19000..b34d31589f 100644 --- a/include/nr.h +++ b/include/nr.h @@ -33,7 +33,6 @@ #ifndef _nr_h #define _nr_h -static char *SRCID_nr_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/nrama.h b/include/nrama.h index 992e0cef99..8526a1fe46 100644 --- a/include/nrama.h +++ b/include/nrama.h @@ -33,14 +33,10 @@ #ifndef _nrama_h #define _nrama_h -static char *SRCID_nrama_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) nrama.h 1.9 2/2/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" #include "statutil.h" #include "mshift.h" @@ -72,7 +68,7 @@ typedef struct { t_idef *idef; } t_xrama; -extern void init_rama(char *infile,char *topfile,t_xrama *xr); +extern t_topology *init_rama(char *infile,char *topfile,t_xrama *xr); extern bool new_data(t_xrama *xr); diff --git a/include/nrjac.h b/include/nrjac.h index d5c7bf81f9..6a5dc30077 100644 --- a/include/nrjac.h +++ b/include/nrjac.h @@ -33,7 +33,6 @@ #ifndef _nrjac_h #define _nrjac_h -static char *SRCID_nrjac_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/nrnb.h b/include/nrnb.h index 8ab8161c96..fcc43ed940 100644 --- a/include/nrnb.h +++ b/include/nrnb.h @@ -33,14 +33,10 @@ #ifndef _nrnb_h #define _nrnb_h -static char *SRCID_nrnb_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) nrnb.h 1.9 2/2/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" extern void init_nrnb(t_nrnb *nrnb); diff --git a/include/ns.h b/include/ns.h index 4af48361de..ea2926e962 100644 --- a/include/ns.h +++ b/include/ns.h @@ -33,15 +33,10 @@ #ifndef _ns_h #define _ns_h -static char *SRCID_ns_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) ns.h 1.50 2/2/97" -#endif /* HAVE_IDENT */ - #include #include "sysstuff.h" #include "typedefs.h" diff --git a/include/nsb.h b/include/nsb.h index f0225055c0..2fdef89a7d 100644 --- a/include/nsb.h +++ b/include/nsb.h @@ -33,7 +33,6 @@ #ifndef _nsb_h #define _nsb_h -static char *SRCID_nsb_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/nsgrid.h b/include/nsgrid.h index ea36817e94..7ea7a693e5 100644 --- a/include/nsgrid.h +++ b/include/nsgrid.h @@ -33,15 +33,10 @@ #ifndef _nsgrid_h #define _nsgrid_h -static char *SRCID_nsgrid_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) nsgrid.h 1.7 11/23/92" -#endif /* HAVE_IDENT */ - #include "typedefs.h" extern void init_grid(FILE *log,t_grid *grid, diff --git a/include/orires.h b/include/orires.h index 6ce2d73940..aebb0a07a4 100644 --- a/include/orires.h +++ b/include/orires.h @@ -33,15 +33,10 @@ #ifndef _orires_h #define _orires_h -static char *SRCID_orires_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) disre.h 1.13 2/2/97" -#endif /* HAVE_IDENT */ - #ifdef CPLUSPLUS extern "C" { #endif diff --git a/include/pbc.h b/include/pbc.h index 47ca53db3f..f6d8e9973c 100644 --- a/include/pbc.h +++ b/include/pbc.h @@ -33,14 +33,10 @@ #ifndef _pbc_h #define _pbc_h -static char *SRCID_pbc_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) pbc.h 1.17 2/2/97" -#endif /* HAVE_IDENT */ #include "sysstuff.h" #include "typedefs.h" diff --git a/include/pdbio.h b/include/pdbio.h index f1fe7f06f8..33df0cd322 100644 --- a/include/pdbio.h +++ b/include/pdbio.h @@ -33,14 +33,10 @@ #ifndef _pdbio_h #define _pdbio_h -static char *SRCID_pdbio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) pdbio.h 1.12 7/28/97" -#endif /* HAVE_IDENT */ #include "sysstuff.h" #include "typedefs.h" #include "symtab.h" diff --git a/include/pdebug.h b/include/pdebug.h index de150c2a91..994664c06e 100644 --- a/include/pdebug.h +++ b/include/pdebug.h @@ -33,16 +33,10 @@ #ifndef _pdebug_h #define _pdebug_h -static char *SRCID_pdebug_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) pdebug.h 1.7 2/2/97" -#endif /* HAVE_IDENT */ -#ifdef HAVE_IDENT -#endif /* HAVE_IDENT */ extern void p_debug(char *s,char *file,int line); #ifdef DEBUG diff --git a/include/physics.h b/include/physics.h index 381c8a2952..bdee0c94a2 100644 --- a/include/physics.h +++ b/include/physics.h @@ -33,15 +33,10 @@ #ifndef _physics_h #define _physics_h -static char *SRCID_physics_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) physics.h 1.6 11/23/92" -#endif /* HAVE_IDENT */ - /* * Physical constants to be used in Gromacs. * No constants (apart from 0, 1 or 2) should diff --git a/include/pme.h b/include/pme.h index 029c6086ec..e4baeb9593 100644 --- a/include/pme.h +++ b/include/pme.h @@ -32,8 +32,6 @@ #ifndef _pme_h #define _pme_h - -static char *SRCID_pme_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/ppc_altivec.h b/include/ppc_altivec.h index 03f2ab7221..1e42019246 100644 --- a/include/ppc_altivec.h +++ b/include/ppc_altivec.h @@ -33,7 +33,6 @@ #ifndef _ppc_altivec_h #define _ppc_altivec_h -static char *SRCID_ppc_altivec_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/pppm.h b/include/pppm.h index 32a483bc24..4ef680972f 100644 --- a/include/pppm.h +++ b/include/pppm.h @@ -33,7 +33,6 @@ #ifndef _pppm_h #define _pppm_h -static char *SRCID_pppm_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/princ.h b/include/princ.h index 19b31185cb..bed8124fb2 100644 --- a/include/princ.h +++ b/include/princ.h @@ -33,7 +33,6 @@ #ifndef _princ_h #define _princ_h -static char *SRCID_princ_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/pull.h b/include/pull.h index 10f7481b1b..03bb71537c 100644 --- a/include/pull.h +++ b/include/pull.h @@ -33,7 +33,6 @@ #ifndef _pull_h #define _pull_h -static char *SRCID_pull_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/random.h b/include/random.h index 25091951f1..5e8a1beef4 100644 --- a/include/random.h +++ b/include/random.h @@ -33,30 +33,45 @@ #ifndef _random_h #define _random_h -static char *SRCID_random_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) random.h 1.5 12/16/92" -#endif /* HAVE_IDENT */ - #include -extern real gauss(real am, real sd, int *ig); -/* Generate a gaussian number with: - * am = center of the distribution - * sd = standard deviation - * ig = the random number seed. + +typedef struct t_gaussdata *t_Gaussdata; +/* Abstract data type for the internal state of + * a gaussian random number generator + */ + +t_Gaussdata init_gauss(int seed); +/* Initialize (and warm up) a gaussian random number generator + * by copying the seed. The routine returns a handle to the + * new generator. + */ + +real +gauss(t_Gaussdata data); +/* Return a new gaussian random number with expectation value + * 0.0 and standard deviation 1.0. This routine is NOT thread-safe + * for performance reasons - you will either have to do the locking + * yourself, or better: initialize one generator per thread. */ +void +finish_gauss(t_Gaussdata data); +/* Release all the resources used for the generator */ + + + + extern int make_seed(void); /* Make a random seed: (time+getpid) % 1000000 */ -extern real rando(int *ig); -/* Generate a random number 0 <= r < 1. ig is the (address of) the - * seed variable. +extern real rando(int *seed); +/* Generate a random number 0 <= r < 1. seed is the (address of) the + * random seed variable. */ extern void grp_maxwell(t_block *grp,real tempi[],int nrdf[],int seed, diff --git a/include/rbin.h b/include/rbin.h index 64b2d5d35e..6abb94ae67 100644 --- a/include/rbin.h +++ b/include/rbin.h @@ -33,14 +33,10 @@ #ifndef _rbin_h #define _rbin_h -static char *SRCID_rbin_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) rbin.h 1.8 2/2/97" -#endif /* HAVE_IDENT */ #include "sysstuff.h" #include "typedefs.h" #include "network.h" diff --git a/include/rdgroup.h b/include/rdgroup.h index a45fb654e8..00bf48bcb9 100644 --- a/include/rdgroup.h +++ b/include/rdgroup.h @@ -33,14 +33,10 @@ #ifndef _rdgroup_h #define _rdgroup_h -static char *SRCID_rdgroup_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) rdgroup.h 1.15 2/2/97" -#endif /* HAVE_IDENT */ #include #ifdef CPLUSPLUS diff --git a/include/readcomp.h b/include/readcomp.h index 8cd59f39df..9affcdd035 100644 --- a/include/readcomp.h +++ b/include/readcomp.h @@ -33,15 +33,10 @@ #ifndef _readcomp_h #define _readcomp_h -static char *SRCID_readcomp_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) readcomp.h 1.12 25 Jan 1993" -#endif /* HAVE_IDENT */ - #include "typedefs.h" /* diff --git a/include/readinp.h b/include/readinp.h index 2b26446f4b..03a7ada1e7 100644 --- a/include/readinp.h +++ b/include/readinp.h @@ -33,7 +33,6 @@ #ifndef _readinp_h #define _readinp_h -static char *SRCID_readinp_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif @@ -51,20 +50,20 @@ extern t_inpfile *read_inpfile(char *fn,int *ninp); extern void write_inpfile(char *fn,int ninp,t_inpfile inp[]); -extern int get_eint(int *ninp,t_inpfile **inp,char *name,int def); +extern int get_eint(int *ninp,t_inpfile **inp,const char *name,int def); -extern real get_ereal(int *ninp,t_inpfile **inp,char *name,real def); +extern real get_ereal(int *ninp,t_inpfile **inp,const char *name,real def); -extern char *get_estr(int *ninp,t_inpfile **inp,char *name,char *def); +extern char *get_estr(int *ninp,t_inpfile **inp,const char *name,char *def); -extern int get_eeenum(int *ninp,t_inpfile **inp,char *name,char **defs, +extern int get_eeenum(int *ninp,t_inpfile **inp,const char *name,const char **defs, int *nerror,bool bPrintError); /* defs must be NULL terminated, * Add errors to nerror * When bPrintError=TRUE and invalid enum: print "ERROR: ..." */ -extern int get_eenum(int *ninp,t_inpfile **inp,char *name,char **defs); +extern int get_eenum(int *ninp,t_inpfile **inp,const char *name,const char **defs); /* defs must be NULL terminated */ /* Here are some macros to extract data from the inp structures. @@ -115,8 +114,10 @@ extern void get_pargs(int *argc,char *argv[],int nparg,t_pargs pa[], extern bool is_hidden(t_pargs *pa); /* Return TRUE when the option is a secret one */ -extern char *pa_val(t_pargs *pa); -/* Return a pointer to a static buffer containing the value of pa */ +extern char *pa_val(t_pargs *pa,char *buf, int sz); +/* Return the value of pa in the provided buffer buf, of size sz. + * The return value is also a pointer to buf. + */ extern int opt2parg_int(char *option,int nparg,t_pargs pa[]); diff --git a/include/renum.h b/include/renum.h index 4d293b3b83..aa03ef2b3b 100644 --- a/include/renum.h +++ b/include/renum.h @@ -33,14 +33,10 @@ #ifndef _renum_h #define _renum_h -static char *SRCID_renum_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) renum.h 1.6 11/23/92" -#endif /* HAVE_IDENT */ #include "typedefs.h" diff --git a/include/reorder.h b/include/reorder.h index 10cb9d0d3c..16b0c8872c 100644 --- a/include/reorder.h +++ b/include/reorder.h @@ -33,14 +33,10 @@ #ifndef _reorder_h #define _reorder_h -static char *SRCID_reorder_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) reorder.h 1.4 11/23/92" -#endif /* HAVE_IDENT */ extern void reorder(t_topology *topin,t_topology topout[], int nnodes,int load[],int tload[]); diff --git a/include/rmpbc.h b/include/rmpbc.h index 3417b91eff..9e69888dfc 100644 --- a/include/rmpbc.h +++ b/include/rmpbc.h @@ -33,14 +33,11 @@ #ifndef _rmpbc_h #define _rmpbc_h -static char *SRCID_rmpbc_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) rmpbc.h 1.6 2/2/97" -#endif /* HAVE_IDENT */ + #include "typedefs.h" extern void rm_pbc(t_idef *idef,int natoms,matrix box,rvec x[],rvec x_s[]); diff --git a/include/rwtop.h b/include/rwtop.h deleted file mode 100644 index feb9d178dc..0000000000 --- a/include/rwtop.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id$ - * - * This source code is part of - * - * G R O M A C S - * - * GROningen MAchine for Chemical Simulations - * - * VERSION 3.1 - * Copyright (c) 1991-2001, University of Groningen, The Netherlands - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * If you want to redistribute modifications, please consider that - * scientific software is very special. Version control is crucial - - * bugs must be traceable. We will be happy to consider code for - * inclusion in the official distribution, but derived work must not - * be called official GROMACS. Details are found in the README & COPYING - * files - if they are missing, get the official version at www.gromacs.org. - * - * To help us fund GROMACS development, we humbly ask that you cite - * the papers on the package - you can find them in the top README file. - * - * For more info, check our website at http://www.gromacs.org - * - * And Hey: - * Getting the Right Output Means no Artefacts in Calculating Stuff - */ - -#ifndef _rwtop_h -#define _rwtop_h - -static char *SRCID_rwtop_h = "$Id$"; -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_IDENT -#ident "@(#) rwtop.h 1.5 12/16/92" -#endif /* HAVE_IDENT */ - -#include -#include "typedefs.h" - -/* - * This module handles topolgy manipulation, including (binary) writing - * to and reading from a file, freeing the allocated space and textual - * representation of the complete topology structure. - */ - -extern long wr_top(FILE *fp,t_topology *top); -/* - * Writes the topology to the file, specified by fp. The function - * returns the number of bytes written. The topology is not modified! - */ - -extern long rd_top(FILE *fp,t_topology *top); -/* - * Reads the topology from the file, specified by fp. This will - * include allocating the needed space. The function returns the - * number of bytes read. - */ - -extern void rm_top(t_topology *top); -/* - * Frees the space allocated by the topology. This is only - * guaranteed to work when the same allocation strategy is used as - * in rd_top(). - */ - -extern void pr_energies(FILE *fp,int indent,char *title,t_energy *e,int n); -/* - * This routine prints out a (human) readable representation of - * an array of energy structs to the file fp. Ident specifies the - * number of spaces the text should be indented. Title is used to - * print a header text. - */ - -extern void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir); -/* - * This routine prints out a (human) readable representation of - * an input record to the file fp. Ident specifies the number of spaces - * the text should be indented. Title is used to print a header text. - */ - -#endif /* _rwtop_h */ diff --git a/include/sheader.h b/include/sheader.h index 4b0396c045..040fe93579 100644 --- a/include/sheader.h +++ b/include/sheader.h @@ -33,15 +33,10 @@ #ifndef _sheader_h #define _sheader_h -static char *SRCID_sheader_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) sheader.h 1.4 11/23/92" -#endif /* HAVE_IDENT */ - #include #include "typedefs.h" #include "tpxio.h" diff --git a/include/shift.h b/include/shift.h index f9ea3a01a9..40353723ae 100644 --- a/include/shift.h +++ b/include/shift.h @@ -33,17 +33,10 @@ #ifndef _shift_h #define _shift_h -static char *SRCID_shift_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) shift.h 1.6 2/2/97" -#endif /* HAVE_IDENT */ -#ifdef HAVE_IDENT -#endif /* HAVE_IDENT */ - extern real *mk_shift_tab(int n,real r1,real rc,real dr,real *sfac); /* Return a table of length n, containing the parabolic * shift function from HJC Berendsen diff --git a/include/shift_util.h b/include/shift_util.h index 9b28717ad3..689a1527fb 100644 --- a/include/shift_util.h +++ b/include/shift_util.h @@ -33,7 +33,6 @@ #ifndef _shift_util_h #define _shift_util_h -static char *SRCID_shift_util_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/smalloc.h b/include/smalloc.h index 336ada8c8c..087a419d8a 100644 --- a/include/smalloc.h +++ b/include/smalloc.h @@ -33,15 +33,11 @@ #ifndef _smalloc_h #define _smalloc_h -static char *SRCID_smalloc_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) smalloc.h 1.14 11/23/92" -#endif /* HAVE_IDENT */ - /* * Memory allocation routines in gromacs: * @@ -91,7 +87,7 @@ static char *SRCID_smalloc_h = "$Id$"; * If ptr equals NULL, malloc is called in stead of realloc, in this way * it is possible to combine first and later allocations. * - * extern void save_free(char *name,char *file,int line,void *ptr); + * extern void save_free(char *name,char *file,int line,const void *ptr); * Like free, uses name, file and line to generate an error message when * the free failed. * @@ -129,7 +125,7 @@ void *save_calloc(char *name,char *file,int line, unsigned nelem,unsigned elsize); void *save_realloc(char *name,char *file,int line, void *ptr,unsigned size); -void save_free(char *name,char *file,int line,void *ptr); +void save_free(char *name,char *file,int line,const void *ptr); unsigned maxavail(void); unsigned memavail(void); diff --git a/include/sortwater.h b/include/sortwater.h index 56a059fdc8..2b8ef3002a 100644 --- a/include/sortwater.h +++ b/include/sortwater.h @@ -33,7 +33,7 @@ #ifndef _sortwater_h #define _sortwater_h -static char *SRCID_sortwater_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/split.h b/include/split.h index 481e6d987a..ab7fa53994 100644 --- a/include/split.h +++ b/include/split.h @@ -33,15 +33,10 @@ #ifndef _split_h #define _split_h -static char *SRCID_split_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) split.h 1.20 12/16/92" -#endif /* HAVE_IDENT */ - /* * Determine on which node a particle should reside and on which * node is also should be available. The distribution algorithm diff --git a/include/statusio.h b/include/statusio.h index df20dc69a6..c7f8c6f7ef 100644 --- a/include/statusio.h +++ b/include/statusio.h @@ -33,15 +33,10 @@ #ifndef _statusio_h #define _statusio_h -static char *SRCID_statusio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) statusio.h 1.46 2/2/97" -#endif /* HAVE_IDENT */ - #include "typedefs.h" #include "sheader.h" diff --git a/include/statutil.h b/include/statutil.h index f6650d3fa0..80fd3628e2 100644 --- a/include/statutil.h +++ b/include/statutil.h @@ -33,7 +33,6 @@ #ifndef _statutil_h #define _statutil_h -static char *SRCID_statutil_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/strdb.h b/include/strdb.h index 197f059176..ef5cd61a67 100644 --- a/include/strdb.h +++ b/include/strdb.h @@ -33,15 +33,10 @@ #ifndef _strdb_h #define _strdb_h -static char *SRCID_strdb_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) strdb.h 1.9 2/2/97" -#endif /* HAVE_IDENT */ - #include "typedefs.h" extern bool get_a_line(FILE *fp,char line[],int n); diff --git a/include/string2.h b/include/string2.h index fdd65e0df1..63f74a5b06 100644 --- a/include/string2.h +++ b/include/string2.h @@ -33,15 +33,10 @@ #ifndef _string2_h #define _string2_h -static char *SRCID_string2_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) string2.h 1.13 11/23/92" -#endif /* HAVE_IDENT */ - /* * * string2.h @@ -99,7 +94,7 @@ extern char *gmx_strdup(const char *src); #define strdup gmx_strdup #endif -extern char *wrap_lines(char *buf,int line_width, int indent); +extern char *wrap_lines(const char *buf,int line_width, int indent); /* wraps lines at 'linewidth', indenting all following * lines by 'indent' spaces. A temp buffer is allocated and returned, * which can be disposed of if no longer needed. diff --git a/include/struc2.h b/include/struc2.h index a97fe0e27b..d084640931 100644 --- a/include/struc2.h +++ b/include/struc2.h @@ -33,14 +33,10 @@ #ifndef _struc2_h #define _struc2_h -static char *SRCID_struc2_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) struc2.h 1.2 15 Sep 1993" -#endif /* HAVE_IDENT */ #include "typedefs.h" typedef struct { diff --git a/include/superb.h b/include/superb.h index a276bfc254..754b98fcb2 100644 --- a/include/superb.h +++ b/include/superb.h @@ -33,14 +33,10 @@ #ifndef _superb_h #define _superb_h -static char *SRCID_superb_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) superb.h 1.7 2/2/97" -#endif /* HAVE_IDENT */ #include #include diff --git a/include/symtab.h b/include/symtab.h index d536d70748..65e3805193 100644 --- a/include/symtab.h +++ b/include/symtab.h @@ -33,14 +33,11 @@ #ifndef _symtab_h #define _symtab_h -static char *SRCID_symtab_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) symtab.h 1.6 12/16/92" -#endif /* HAVE_IDENT */ #include #include "typedefs.h" @@ -73,7 +70,7 @@ extern void done_symtab(t_symtab *symtab); /* Frees the space allocated by the symbol table, including all * entries in it */ -extern char **put_symtab(t_symtab *symtab,char *name); +extern char **put_symtab(t_symtab *symtab,const char *name); /* Enters a string into the symbol table symtab, if it was not * available, a reference to a copy is returned else a reference * to the earlier entered value is returned. Strings are trimmed diff --git a/include/sysstuff.h b/include/sysstuff.h index b00ebbd5bf..ce597596e1 100644 --- a/include/sysstuff.h +++ b/include/sysstuff.h @@ -33,15 +33,10 @@ #ifndef _sysstuff_h #define _sysstuff_h -static char *SRCID_sysstuff_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) sysstuff.h 1.22 12/16/92" -#endif /* HAVE_IDENT */ - #ifdef CPLUSPLUS extern "C" { #endif diff --git a/include/tags.h b/include/tags.h index b85000199c..7638d09e84 100644 --- a/include/tags.h +++ b/include/tags.h @@ -33,15 +33,11 @@ #ifndef _tags_h #define _tags_h -static char *SRCID_tags_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) tags.h 1.3 11/23/92" -#endif /* HAVE_IDENT */ - #define SYSCALL_TAG 0x11 /* Tag for server system calls */ #define SEMGET_TAG 0x10 /* Server subcommand i860_semget() */ #define SEMCTL_TAG 0x11 /* Server subcommand i860_semctl() */ diff --git a/include/tgroup.h b/include/tgroup.h index 0ca4dc9390..dcb8786a4e 100644 --- a/include/tgroup.h +++ b/include/tgroup.h @@ -33,17 +33,10 @@ #ifndef _tgroup_h #define _tgroup_h -static char *SRCID_tgroup_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) tgroup.h 1.12 2/2/97" -#endif /* HAVE_IDENT */ -#ifdef HAVE_IDENT -#endif /* HAVE_IDENT */ - #include "typedefs.h" #include "network.h" diff --git a/include/tpxio.h b/include/tpxio.h index 0680d6b966..07698f231c 100644 --- a/include/tpxio.h +++ b/include/tpxio.h @@ -33,7 +33,6 @@ #ifndef _tpxio_h #define _tpxio_h -static char *SRCID_tpxio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif @@ -86,8 +85,16 @@ extern int open_tpx(char *fn,char *mode); extern void close_tpx(int fp); /* Close the file corresponding to fp */ -extern void read_tpxheader(char *fn,t_tpxheader *tpx); -/* Read the header from a tpx file and then close it again */ +extern void read_tpxheader(char *fn,t_tpxheader *tpx, bool TopOnlyOK, int *version, int *generation); +/* Read the header from a tpx file and then close it again. + * By setting TopOnlyOK to true, it is possible to read future + * versions too (we skip the changed inputrec), provided we havent + * changed the topology description. If it is possible to read + * the inputrec it will still be done even if TopOnlyOK is TRUE. + * + * The version and generation if the topology (see top of tpxio.c) + * are returned in the two last arguments. + */ extern void write_tpx(char *fn,int step,real t,real lambda, t_inputrec *ir,rvec *box,int natoms, diff --git a/include/transfer.h b/include/transfer.h index 023a7848ef..60751465ec 100644 --- a/include/transfer.h +++ b/include/transfer.h @@ -33,14 +33,11 @@ #ifndef _transfer_h #define _transfer_h -static char *SRCID_transfer_h = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) transfer.h 1.6 11/23/92" -#endif /* HAVE_IDENT */ extern void linkio_write(int linkno,int nbytes); extern void linkio_read(int linkno,int nbytes); diff --git a/include/trnio.h b/include/trnio.h index 3693f43a08..fe64fb7e0d 100644 --- a/include/trnio.h +++ b/include/trnio.h @@ -33,7 +33,6 @@ #ifndef _trnio_h #define _trnio_h -static char *SRCID_trnio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/txtdump.h b/include/txtdump.h index 1da6a4d8f4..b7af51a7ad 100644 --- a/include/txtdump.h +++ b/include/txtdump.h @@ -33,14 +33,10 @@ #ifndef _txtdump_h #define _txtdump_h -static char *SRCID_txtdump_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) txtdump.h 1.20 12/16/92" -#endif /* HAVE_IDENT */ #include #include "typedefs.h" @@ -55,22 +51,21 @@ extern char *atomname(t_atoms *a,int i); /* Return pointer to a buffer which holds the atomname in the * form resname resnr atomname. Pointer can be freed afterwards. */ -extern void pr_shownumbers(bool bShow); extern int available(FILE *fp,void *p,char *title); extern int pr_indent(FILE *fp,int n); extern int pr_title(FILE *fp,int indent,char *title); extern int pr_title_n(FILE *fp,int indent,char *title,int n); extern int pr_title_nxn(FILE *fp,int indent,char *title,int n1,int n2); -extern void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n); -extern void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n); -extern void pr_rvec(FILE *fp,int indent,char *title,real vec[],int n); +extern void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n, bool bShowNumbers); +extern void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n, bool bShowNumbers); +extern void pr_rvec(FILE *fp,int indent,char *title,real vec[],int n, bool bShowNumbers); extern void pr_rvecs(FILE *fp,int indent,char *title,rvec vec[],int n); extern void pr_rvecs_len(FILE *fp,int indent,char *title,rvec vec[],int n); -extern void pr_block(FILE *fp,int indent,char *title,t_block *block); +extern void pr_block(FILE *fp,int indent,char *title,t_block *block, bool bShowNumbers); extern void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams); -extern void pr_idef(FILE *fp,int indent,char *title,t_idef *idef); +extern void pr_idef(FILE *fp,int indent,char *title,t_idef *idef, bool bShowNumbers); extern void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir); -extern void pr_top(FILE *fp,int indent,char *title,t_topology *top); +extern void pr_top(FILE *fp,int indent,char *title,t_topology *top, bool bShowNumbers); /* * This routine prints out a (human) readable representation of * the topology to the file fp. Ident specifies the number of @@ -78,12 +73,11 @@ extern void pr_top(FILE *fp,int indent,char *title,t_topology *top); * header text. */ extern void pr_header(FILE *fp,int indent,char *title,t_tpxheader *sh); - /* + /* * This routine prints out a (human) readable representation of * a header to the file fp. Ident specifies the number of spaces * the text should be indented. Title is used to print a header text. */ - #endif /* _txtdump_h */ diff --git a/include/typedefs.h b/include/typedefs.h index b8955f30cc..aa5bdb4376 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -33,7 +33,6 @@ #ifndef _typedefs_h #define _typedefs_h -static char *SRCID_typedefs_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/types/atoms.h b/include/types/atoms.h index 4b8ad7f9a0..9d8184f2d4 100644 --- a/include/types/atoms.h +++ b/include/types/atoms.h @@ -85,12 +85,20 @@ typedef struct { /* use: (*(atomtypeB[i])) */ int nres; /* Nr of residue names */ char ***resname; /* Array of pointers to residue names */ - /* use: (*(resname[i])) */ - int ngrpname; /* Number of groupnames */ + /* use: (*(resname[i])) */ + int ngrpname; /* Number of groupnames */ char ***grpname; /* Names of the groups */ - t_block excl; /* Exclusions */ + t_block excl; /* Exclusions */ t_grps grps[egcNR]; /* Groups of things */ t_pdbinfo *pdbinfo; /* PDB Information, such as aniso. Bfac */ } t_atoms; +typedef struct { + int nr; /* number of atomtypes */ + real *radius; /* GBSA radius for each atomtype */ + real *vol; /* GBSA efective volume for each atomtype */ + real *surftens; /* implicit solvent surftens for each atomtype */ +} t_atomtypes; + + #define PERTURBED(a) (((a).mB != (a).m) || ((a).qB != (a).q) || ((a).typeB != (a).type)) diff --git a/include/types/enums.h b/include/types/enums.h index 7043b49d6a..a0a978d974 100644 --- a/include/types/enums.h +++ b/include/types/enums.h @@ -44,7 +44,7 @@ enum { }; enum { - etcNO, etcBERENDSEN, etcNOSEHOOVER, etcYES, etcNR + etcNO, etcBERENDSEN, etcNOSEHOOVER, etcYES, etcANDERSEN, etcANDERSENINTERVAL, etcNR }; /* yes is an alias for berendsen */ enum { @@ -58,7 +58,7 @@ enum { enum { eelCUT, eelRF, eelGRF, eelPME, eelEWALD, eelPPPM, - eelPOISSON, eelSWITCH, eelSHIFT, eelUSER, eelNR + eelPOISSON, eelSWITCH, eelSHIFT, eelUSER, eelGB, eelNR }; /* Ewald geometry */ @@ -127,3 +127,18 @@ enum { ecmLINEAR, ecmANGULAR, ecmNO, ecmNR }; +/* New version of simulated annealing */ +enum { + eannNO, eannSINGLE, eannPERIODIC, eannNR +}; + +/* Algorithms for calculating GB radii */ +enum { + egbSTILL, egbKARPLUS, egbNR +}; + +/* Implicit solvent algorithms */ +enum { + eisNO, eisLCPO, eisNR +}; + diff --git a/include/types/fcdata.h b/include/types/fcdata.h index 460078b8d6..e2c3c9488a 100644 --- a/include/types/fcdata.h +++ b/include/types/fcdata.h @@ -83,6 +83,23 @@ typedef struct { real ***TMP; /* An array of temporary 5x5 matrices (nex); */ } t_oriresdata; +/* Dihedral restraining stuff */ +typedef struct { + real dihre_fc; /* Force constant for dihres, + * which is multiplied by a (possibly) + * different factor for each restraint */ + real dihre_tau; /* Time constant for dihres */ + + real ETerm; /* multiplication factor for time averaging */ + real ETerm1; /* 1 - ETerm1 */ + real exp_min_t_tau; /* Factor for slowly switching on the force */ + int nr; /* The number of dihedral restraints */ + int ndih; /* The number of dihedral restraint pairs */ + real *diht; /* The calculated instantaneous dihedrals (npr) */ + real *dihav; /* The calculated time averaged dihedrals (npr) */ + real RMSviol; /* The root-mean-square of violations (degrees) */ +} t_dihresdata; + /* * Data struct used in the force calculation routines * for storing information which is needed in following steps @@ -92,4 +109,5 @@ typedef struct { typedef struct { t_disresdata disres; t_oriresdata orires; + t_dihresdata dihres; } t_fcdata; diff --git a/include/types/forcerec.h b/include/types/forcerec.h index d004a2c927..da97f685d8 100644 --- a/include/types/forcerec.h +++ b/include/types/forcerec.h @@ -146,6 +146,15 @@ typedef struct { /* xmdrun flexible constraints */ real fc_stepsize; + + /* Generalized born stuff */ + /* VdW radius for each atomtype (dim is thus ntype) */ + real *atype_radius; + /* Effective radius (derived from effective volume) for each type */ + real *atype_vol; + /* Implicit solvent - surface tension for each atomtype */ + real *atype_surftens; + } t_forcerec; #define C6(nbfp,ntp,ai,aj) (nbfp)[2*((ntp)*(ai)+(aj))] diff --git a/include/types/graph.h b/include/types/graph.h index 8e57507970..b57ef998b6 100644 --- a/include/types/graph.h +++ b/include/types/graph.h @@ -35,6 +35,8 @@ #include "fatal.h" +typedef enum { egcolWhite, egcolGrey, egcolBlack, egcolNR } egCol; + typedef struct { int maxedge; /* Max number of edges per atom */ int nnodes; /* The number of nodes */ @@ -44,6 +46,8 @@ typedef struct { int *nedge; /* For each node the number of edges */ atom_id **edge; /* For each node, the actual edges (bidirect.) */ ivec *ishift; /* Shift for each particle */ + int negc; + egCol *egc; /* color of each node */ } t_graph; diff --git a/include/types/idef.h b/include/types/idef.h index 63cecf73df..c83a07de86 100644 --- a/include/types/idef.h +++ b/include/types/idef.h @@ -41,6 +41,7 @@ #define MAXATOMLIST 5 #define MAXFORCEPARAM 12 #define NR_RBDIHS 6 +#define NR_FOURDIHS 4 typedef atom_id t_iatom; @@ -56,8 +57,10 @@ enum { F_ANGLES, F_G96ANGLES, F_PDIHS, - F_RBDIHS, + F_RBDIHS, + F_FOURDIHS, F_IDIHS, + F_PIDIHS, F_LJ14, F_COUL14, F_LJ, @@ -74,6 +77,8 @@ enum { F_ORIRESDEV, F_ANGRES, F_ANGRESZ, + F_DIHRES, + F_DIHRESVIOL, F_SHAKE, F_SHAKENC, F_SETTLE, @@ -102,32 +107,33 @@ typedef union * The harmonic type is used for all harmonic potentials: * bonds, angles and improper dihedrals */ - struct {real a,b,c; } bham; - struct {real rA,krA,rB,krB; } harmonic; - /* No free energy support for cubic bonds */ - struct {real b0,kb,kcub; } cubic; + struct {real a,b,c; } bham; + struct {real rA,krA,rB,krB; } harmonic; + /* No free energy supported for cubic bonds */ + struct {real b0,kb,kcub; } cubic; /* No free energy supported for WPOL */ - struct {real kx,ky,kz,rOH,rHH,rOD; } wpol; - struct {real c6,c12; } lj; - struct {real c6A,c12A,c6B,c12B; } lj14; + struct {real kx,ky,kz,rOH,rHH,rOD; } wpol; + struct {real c6,c12; } lj; + struct {real c6A,c12A,c6B,c12B; } lj14; /* Proper dihedrals can not have different multiplicity when * doing free energy calculations, because the potential would not * be periodic anymore. */ - struct {real phiA,cpA;int mult;real phiB,cpB; } pdihs; - struct {real dA,dB; } shake; - /* Settle can not be used for Free energy calculations. - * Use shake (or lincs) instead. - * The rest of the things cannot (yet) be used in FEP studies either. + struct {real phiA,cpA;int mult;real phiB,cpB; } pdihs; + struct {real dA,dB; } shake; + /* Settle can not be used for Free energy calculations of water bond geometry. + * Use shake (or lincs) instead if you have to change the water bonds. */ - struct {real doh,dhh; } settle; - struct {real b0,cb,beta; } morse; - struct {real pos0[DIM],fc[DIM]; } posres; - struct {real rbcA[NR_RBDIHS], rbcB[NR_RBDIHS];} rbdihs; - struct {real a,b,c,d,e,f; } dummy; - struct {real low,up1,up2,kfac;int type,label; } disres; - struct {int ex,power,label; real c,obs,kfac; } orires; - struct {real buf[MAXFORCEPARAM]; } generic; /* Conversion */ + struct {real doh,dhh; } settle; + /* No free energy supported for morse bonds */ + struct {real b0,cb,beta; } morse; + struct {real pos0[DIM],fc[DIM]; } posres; + struct {real rbcA[NR_RBDIHS], rbcB[NR_RBDIHS]; } rbdihs; + struct {real a,b,c,d,e,f; } dummy; + struct {real low,up1,up2,kfac;int type,label; } disres; + struct {real phi,dphi,kfac;int label,power; } dihres; + struct {int ex,power,label; real c,obs,kfac; } orires; + struct {real buf[MAXFORCEPARAM]; } generic; /* Conversion */ } t_iparams; typedef int t_functype; diff --git a/include/types/ifunc.h b/include/types/ifunc.h index 64aac9e66e..9c102801a6 100644 --- a/include/types/ifunc.h +++ b/include/types/ifunc.h @@ -85,7 +85,7 @@ typedef struct #define IS_CHEMBOND(ftype) (interaction_function[(ftype)].nratoms==2 && interaction_function[(ftype)].flags & IF_CHEMBOND) /* IS_CHEMBOND tells if function type ftype represents a chemical bond */ -extern t_interaction_function interaction_function[F_NRE]; +extern const t_interaction_function interaction_function[F_NRE]; /* initialised interaction functions descriptor */ #endif diff --git a/include/types/inputrec.h b/include/types/inputrec.h index 92a5bf2b1b..c41a5166c7 100644 --- a/include/types/inputrec.h +++ b/include/types/inputrec.h @@ -40,21 +40,28 @@ typedef struct { } t_cosines; typedef struct { - int ngtc; /* # T-Coupl groups */ - int ngacc; /* # Accelerate groups */ - int ngfrz; /* # Freeze groups */ - int ngener; /* # Ener groups */ - real *nrdf; /* Nr of degrees of freedom in a group */ - real *ref_t; /* Coupling temperature per group */ - real *tau_t; /* Tau coupling time */ - rvec *acc; /* Acceleration per group */ - ivec *nFreeze; /* Freeze the group in each direction ? */ - bool *eg_excl; /* Exclusions of energy group pairs */ + int ngtc; /* # T-Coupl groups */ + int ngacc; /* # Accelerate groups */ + int ngfrz; /* # Freeze groups */ + int ngener; /* # Ener groups */ + real *nrdf; /* Nr of degrees of freedom in a group */ + real *ref_t; /* Coupling temperature per group */ + int *annealing; /* No/simple/periodic SA for each group */ + int *anneal_npoints; /* Number of annealing time points per grp*/ + real **anneal_time; /* For ea. group: Time points */ + real **anneal_temp; /* For ea. grp: Temperature at these times*/ + /* Final temp after all intervals is ref_t*/ + real *tau_t; /* Tau coupling time */ + rvec *acc; /* Acceleration per group */ + ivec *nFreeze; /* Freeze the group in each direction ? */ + bool *eg_excl; /* Exclusions of energy group pairs */ } t_grpopts; + typedef struct { int eI; /* Integration method */ int nsteps; /* number of steps to be taken */ + int init_step; /* start at a stepcount >0 (used w. tpbconv) */ int ns_type; /* which ns method should we use? */ int nstlist; /* number of steps before pairlist is generated */ int ndelta; /* number of cells per rlong */ @@ -62,6 +69,7 @@ typedef struct { int decomp_dir; /* Direction of decomposition (may not be opt.) */ int nstcomm; /* number of steps after which center of mass */ /* motion is removed */ + int nstcheckpoint; /* checkpointing frequency */ int nstlog; /* number of steps after which print to logfile */ int nstxout; /* number of steps after which X is output */ int nstvout; /* id. for V */ @@ -87,16 +95,20 @@ typedef struct { real tau_p; /* pressure coupling time (ps) */ tensor ref_p; /* reference pressure (kJ/(mol nm^3)) */ tensor compress; /* compressability ((mol nm^3)/kJ) */ - bool bSimAnn; /* simulated annealing (SA) */ - real zero_temp_time; /* time at which temp becomes zero in sim. ann. */ + int andersen_seed; /* Random seed for Andersen thermostat. */ real rlist; /* short range pairlist cut-off (nm) */ int coulombtype; /* Type of electrostatics treatment */ real rcoulomb_switch; /* Coulomb switch range start (nm) */ real rcoulomb; /* Coulomb cutoff (nm) */ + real epsilon_r; /* relative dielectric constant */ + int gb_algorithm; /* Algorithm to use for calculation Born radii */ + int nstgbradii; /* Frequency of updating Generalized Born radii */ + real rgbradii; /* Cutoff for GB radii calculation */ + real gb_saltconc; /* Salt concentration (M) for GBSA models */ int vdwtype; /* Type of Van der Waals treatment */ real rvdw_switch; /* Van der Waals switch range start (nm) */ real rvdw; /* Van der Waals cutoff (nm) */ - real epsilon_r; /* relative dielectric constant */ + int implicit_solvent;/* No (=explicit water), or GBSA solvent models */ int eDispCorr; /* Perform Long range dispersion corrections */ real shake_tol; /* tolerance for shake */ real fudgeQQ; /* Id. for 1-4 coulomb interactions */ @@ -113,6 +125,9 @@ typedef struct { real orires_fc; /* force constant for orientational restraints */ real orires_tau; /* time constant for memory function in orires */ int nstorireout; /* frequency of writing tr(SD) to enx */ + int dihre_fc; /* force constant for dihedral restraints */ + int nstdihreout; /* frequency of writing dihedrals to enx */ + real dihre_tau; /* time constant for memory function in dihres */ real em_stepsize; /* The stepsize for updating */ real em_tol; /* The tolerance */ int niter; /* Number of iterations for convergence of */ @@ -124,6 +139,7 @@ typedef struct { int eConstrAlg; /* Type of constraint algorithm */ int nProjOrder; /* Order of the LINCS Projection Algorithm */ real LincsWarnAngle; /* If bond rotates more than %g degrees, warn */ + int nLincsIter; /* Number of iterations in the final Lincs step */ bool bShakeSOR; /* Use successive overrelaxation for shake */ real bd_temp; /* Temperature for Brownian Dynamics (BD) */ real bd_fric; /* Friction coefficient for BD (amu / ps) */ diff --git a/include/types/nrnb.h b/include/types/nrnb.h index cca85a6fd8..c281595d3a 100644 --- a/include/types/nrnb.h +++ b/include/types/nrnb.h @@ -75,7 +75,8 @@ enum { eNR_SHIFTX, eNR_CGCM, eNR_FSUM, eNR_BONDS, eNR_G96BONDS, eNR_ANGLES, eNR_G96ANGLES, eNR_PROPER, eNR_IMPROPER, - eNR_RB, eNR_DISRES, eNR_ORIRES, + eNR_RB, eNR_FOURDIH, eNR_DISRES, + eNR_ORIRES, eNR_DIHRES, eNR_POSRES, eNR_ANGRES, eNR_ANGRESZ, eNR_MORSE, eNR_CUBICBONDS, eNR_WPOL, eNR_VIRIAL, diff --git a/include/types/topology.h b/include/types/topology.h index fb30126bbe..666bcbe713 100644 --- a/include/types/topology.h +++ b/include/types/topology.h @@ -34,10 +34,11 @@ #endif typedef struct { - char **name; /* Name of the topology */ + char **name; /* Name of the topology */ t_idef idef; /* The interaction function definition */ - t_atoms atoms; /* The atoms */ - t_block blocks[ebNR]; /* The blocks */ + t_atoms atoms; /* The atoms */ + t_atomtypes atomtypes; /* Atomtype properties */ + t_block blocks[ebNR]; /* The blocks */ t_symtab symtab; /* The symbol table */ } t_topology; diff --git a/include/update.h b/include/update.h index 222ffd3f78..6b35227533 100644 --- a/include/update.h +++ b/include/update.h @@ -33,15 +33,10 @@ #ifndef _update_h #define _update_h -static char *SRCID_update_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) update.h 1.33 24 Jun 1996" -#endif /* HAVE_IDENT */ - #include "typedefs.h" #include "mshift.h" #include "tgroup.h" @@ -56,7 +51,6 @@ extern void update(int natoms, /* number of atoms in simulation */ real lambda, /* FEP scaling parameter */ real *dvdlambda, /* FEP stuff */ t_parm *parm, /* input record and box stuff */ - real SAfactor, /* simulated annealing factor */ t_mdatoms *md, rvec x[], /* coordinates of home particles */ t_graph *graph, @@ -121,12 +115,13 @@ extern void init_sd_consts(int ngtc,real tau_t[],real dt); */ extern real run_aver(real old,real cur,int step,int nmem); -extern void berendsen_tcoupl(t_grpopts *opts,t_groups *grps, - real dt,real SAfactor); -extern void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps, - real dt,real SAfactor); +extern void berendsen_tcoupl(t_grpopts *opts,t_groups *grps,real dt); +extern void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps,real dt); /* Compute temperature scaling. For Nose-Hoover it is done in update. */ +/* Set reference temp for simulated annealing at time t*/ +extern void update_annealing_target_temp(t_grpopts *opts,real t); + extern real calc_temp(real ekin,real nrdf); /* Calculate the temperature */ diff --git a/include/utils.h b/include/utils.h index 6cad7c1fa0..3fae9b24dc 100644 --- a/include/utils.h +++ b/include/utils.h @@ -33,15 +33,10 @@ #ifndef _utils_h #define _utils_h -static char *SRCID_utils_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) utils.h 1.11 2/2/97" -#endif /* HAVE_IDENT */ - #include #include "typedefs.h" diff --git a/include/vcm.h b/include/vcm.h index cb5fc0b4f5..bdcf14d670 100644 --- a/include/vcm.h +++ b/include/vcm.h @@ -33,14 +33,10 @@ #ifndef _vcm_h #define _vcm_h -static char *SRCID_vcm_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) vcm.h 1.9 9/29/97" -#endif /* HAVE_IDENT */ #include "sysstuff.h" #include "typedefs.h" diff --git a/include/vec.h b/include/vec.h index be505a8da8..434d9be85b 100644 --- a/include/vec.h +++ b/include/vec.h @@ -33,7 +33,6 @@ #ifndef _vec_h #define _vec_h -static char *SRCID_vec_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #define gmx_inline inline @@ -172,18 +171,22 @@ extern void vecinvsqrt(real in[],real out[],int n); /* Perform out[i]=1.0/sqrt(in[i]) for n elements */ - extern void vecrecip(real in[],real out[],int n); -/* Perform out[i]=1.0/(in[i]) for n elements - * Note that this function can be much faster than writing - * the loop yourself, even if the recip(x) is slow on your machine. - * Not only do we get better cache usage in vecrecip, but it - * might be possible to use optimized vector libraries. +/* Perform out[i]=1.0/(in[i]) for n elements */ + +/* Note: If you need a fast version of vecinvsqrt + * and/or vecrecip, call detectcpu() and run the SSE/3DNow/SSE2/Altivec + * versions if your hardware supports it. + * + * To use those routines, your memory HAS TO BE CACHE-ALIGNED. + * Start by allocating 31 bytes more than you need, put + * this in a temp variable (e.g. _buf, so you can free it later), and + * create your aligned array buf with + * + * buf=(real *) ( ( (unsigned long int)_buf + 31 ) & (~0x1f) ); */ - - static inline void rvec_add(const rvec a,const rvec b,rvec c) { real x,y,z; diff --git a/include/viewit.h b/include/viewit.h index a4c712a01b..afce5c39c8 100644 --- a/include/viewit.h +++ b/include/viewit.h @@ -33,15 +33,10 @@ #ifndef _viewit_h #define _viewit_h -static char *SRCID_viewit_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "$Id$" -#endif /* HAVE_IDENT */ - #ifdef CPLUSPLUS extern "C" { #endif diff --git a/include/wgms.h b/include/wgms.h index e94f221acb..d1f8ec7f7f 100644 --- a/include/wgms.h +++ b/include/wgms.h @@ -32,8 +32,6 @@ #ifndef _wgms_h #define _wgms_h - -static char *SRCID_wgms_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/wman.h b/include/wman.h index 86752afe8c..c218d964e8 100644 --- a/include/wman.h +++ b/include/wman.h @@ -33,15 +33,10 @@ #ifndef _wman_h #define _wman_h -static char *SRCID_wman_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) wman.h 1.11 10/2/97" -#endif /* HAVE_IDENT */ - #include "readinp.h" extern void write_java(FILE *out,char *program, @@ -57,17 +52,17 @@ extern void write_man(FILE *out,char *mantp,char *program, int nbug,char **bugs, bool bHidden); -extern char *fileopt(unsigned long flag); +extern char *fileopt(unsigned long flag,char buf[],int maxsize); /* Return a string describing the file type in flag. * flag should the flag field of a filenm struct. + * You have to provide a buffer and buffer length in which + * the result will be written. The returned pointer is just + * a pointer to this buffer. */ -extern char *check_tty(char *s); -extern char *check_tex(char *s); -extern char *check_html(char *s,char *program); -/* Check LaTeX or HTML strings for codes, and remove them - * the program variable may be NULL - */ +extern const char *check_tex(const char *s); + +extern const char *check_tty(const char *s); #endif /* _wman_h */ diff --git a/include/writeps.h b/include/writeps.h index 06b0ac7063..7704fbe62a 100644 --- a/include/writeps.h +++ b/include/writeps.h @@ -33,14 +33,10 @@ #ifndef _writeps_h #define _writeps_h -static char *SRCID_writeps_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) writeps.h 1.10 8/25/97" -#endif /* HAVE_IDENT */ #include #include "typedefs.h" @@ -58,56 +54,62 @@ enum { efontCOUR, efontCOURITALIC, efontCOURBOLD, efontCOURBOLDITALIC, efontNR }; -extern char *fontnm[efontNR]; -extern FILE *ps_open(char *fn,real x1,real y1,real x2,real y2); +typedef struct t_int_psdata *t_psdata; +/* Only use t_psdata - it is a pointer to an abstract datatype + * that maintains the state of the postscript currently written. + */ + +extern const char *fontnm[efontNR]; + +extern t_psdata ps_open(char *fn,real x1,real y1,real x2,real y2); -extern void ps_linewidth(FILE *ps,int lw); -extern void ps_color(FILE *ps,real r,real g,real b); -extern void ps_rgb(FILE *ps,t_rgb *rgb); +extern void ps_linewidth(t_psdata ps,int lw); +extern void ps_color(t_psdata ps,real r,real g,real b); +extern void ps_rgb(t_psdata ps,t_rgb *rgb); -extern void ps_rgb_box(FILE *ps,t_rgb *rgb); -extern void ps_rgb_nbox(FILE *ps,t_rgb *rgb,real n); -extern void ps_init_rgb_box(FILE *ps,real xbox, real ybox); -extern void ps_init_rgb_nbox(FILE *ps,real xbox, real ybox); +extern void ps_rgb_box(t_psdata ps,t_rgb *rgb); +extern void ps_rgb_nbox(t_psdata ps,t_rgb *rgb,real n); +extern void ps_init_rgb_box(t_psdata ps,real xbox, real ybox); +extern void ps_init_rgb_nbox(t_psdata ps,real xbox, real ybox); -extern void ps_lineto(FILE *ps,real x,real y); -extern void ps_linerel(FILE *ps,real dx,real dy); +extern void ps_lineto(t_psdata ps,real x,real y); +extern void ps_linerel(t_psdata ps,real dx,real dy); -extern void ps_moveto(FILE *ps,real x,real y); -extern void ps_moverel(FILE *ps,real dx,real dy); +extern void ps_moveto(t_psdata ps,real x,real y); +extern void ps_moverel(t_psdata ps,real dx,real dy); -extern void ps_line(FILE *ps,real x1,real y1,real x2,real y2); +extern void ps_line(t_psdata ps,real x1,real y1,real x2,real y2); -extern void ps_box(FILE *ps,real x1,real y1,real x2,real y2); -extern void ps_fillbox(FILE *ps,real x1,real y1,real x2,real y2); +extern void ps_box(t_psdata ps,real x1,real y1,real x2,real y2); +extern void ps_fillbox(t_psdata ps,real x1,real y1,real x2,real y2); -extern void ps_arc(FILE *ps,real x1,real y1,real rad,real a0,real a1); -extern void ps_fillarc(FILE *ps,real x1,real y1,real rad,real a0,real a1); -extern void ps_arcslice(FILE *ps,real xc,real yc, +extern void ps_arc(t_psdata ps,real x1,real y1,real rad,real a0,real a1); +extern void ps_fillarc(t_psdata ps,real x1,real y1,real rad,real a0,real a1); +extern void ps_arcslice(t_psdata ps,real xc,real yc, real rad1,real rad2,real a0,real a1); -extern void ps_fillarcslice(FILE *ps,real xc,real yc, +extern void ps_fillarcslice(t_psdata ps,real xc,real yc, real rad1,real rad2,real a0,real a1); -extern void ps_circle(FILE *ps,real x1,real y1,real rad); +extern void ps_circle(t_psdata ps,real x1,real y1,real rad); -extern void ps_font(FILE *ps,int font,real size); -extern void ps_strfont(FILE *ps,char *font,real size); +extern void ps_font(t_psdata ps,int font,real size); +extern void ps_strfont(t_psdata ps,char *font,real size); -extern void ps_text(FILE *ps,real x1,real y1,char *str); -extern void ps_ctext(FILE *ps,real x1,real y1,char *str,int expos); +extern void ps_text(t_psdata ps,real x1,real y1,char *str); +extern void ps_ctext(t_psdata ps,real x1,real y1,char *str,int expos); -extern void ps_close(FILE *ps); +extern void ps_close(t_psdata ps); -extern void ps_rotate(FILE *ps,bool bPlus); +extern void ps_rotate(t_psdata ps,bool bPlus); /* Rotate over 90 (bPlus) or -90 (!bPlus) degrees */ -extern void ps_translate(FILE *ps,real x,real y); +extern void ps_translate(t_psdata ps,real x,real y); -extern void ps_setorigin(FILE *ps); -extern void ps_unsetorigin(FILE *ps); +extern void ps_setorigin(t_psdata ps); +extern void ps_unsetorigin(t_psdata ps); extern void viewps(char *fn); -extern void ps_comment(FILE *ps,char *s); +extern void ps_comment(t_psdata ps,char *s); #endif /* _writeps_h */ diff --git a/include/x86_3dnow.h b/include/x86_3dnow.h index 828ba2aa5a..961b993c6d 100644 --- a/include/x86_3dnow.h +++ b/include/x86_3dnow.h @@ -33,7 +33,6 @@ #ifndef _x86_3dnow_h #define _x86_3dnow_h -static char *SRCID_x86_3dnow_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/x86_sse.h b/include/x86_sse.h index 6fc3d4e25c..67b96dd561 100644 --- a/include/x86_sse.h +++ b/include/x86_sse.h @@ -33,7 +33,6 @@ #ifndef _x86_sse_h #define _x86_sse_h -static char *SRCID_x86_sse_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/x86_sse2.h b/include/x86_sse2.h index 4b403beb8f..58e0d10cc6 100644 --- a/include/x86_sse2.h +++ b/include/x86_sse2.h @@ -33,7 +33,6 @@ #ifndef _x86_sse2_h #define _x86_sse2_h -static char *SRCID_x86_sse2_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/xdrf.h b/include/xdrf.h index b68b0bf91d..8d20237305 100644 --- a/include/xdrf.h +++ b/include/xdrf.h @@ -33,7 +33,6 @@ #ifndef _xdrf_h #define _xdrf_h -static char *SRCID_xdrf_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/xtcio.h b/include/xtcio.h index 3217d12d9c..400cb24ef4 100644 --- a/include/xtcio.h +++ b/include/xtcio.h @@ -33,7 +33,6 @@ #ifndef _xtcio_h #define _xtcio_h -static char *SRCID_xtcio_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/include/xvgr.h b/include/xvgr.h index e8d3246487..e0c8c0691f 100644 --- a/include/xvgr.h +++ b/include/xvgr.h @@ -33,15 +33,10 @@ #ifndef _xvgr_h #define _xvgr_h -static char *SRCID_xvgr_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif -#ifdef HAVE_IDENT -#ident "@(#) xvgr.h 1.8 7/28/97" -#endif /* HAVE_IDENT */ - #ifdef CPLUSPLUS extern "C" { #endif @@ -81,7 +76,7 @@ enum { * XVGR ROUTINES ***************************************************/ -extern FILE *xvgropen(char *fn,char *title,char *xaxis,char *yaxis); +extern FILE *xvgropen(const char *fn,const char *title,const char *xaxis,const char *yaxis); /* Open a file, and write a title, and axis-labels in Xvgr format */ extern void xvgr_view(FILE *out,real xmin,real ymin,real xmax,real ymax); diff --git a/share/template/Makefile.am b/share/template/Makefile.am index 216c79c2ae..e09ffdd89e 100644 --- a/share/template/Makefile.am +++ b/share/template/Makefile.am @@ -33,12 +33,6 @@ Makefile.@host@ Makefile.@host@_double: Template.mak Makefile sed 's,@CC\@,$(CC),' | \ sed 's,@host\@,@host@,' >$@ -install-data-hook: -if DOUBLE - (cd $(DESTDIR)$(templatedir) && ! (test -e Makefile) && $(LN_S) Makefile.@host@_double Makefile ; exit 0) -else - (cd $(DESTDIR)$(templatedir) && ! (test -e Makefile) && $(LN_S) Makefile.@host@ Makefile ; exit 0) -endif CLEANFILES = Makefile.@host@ Makefile.@host@_double *~ \\\#* diff --git a/share/template/README b/share/template/README index 0c72fc9147..eb6e841a47 100644 --- a/share/template/README +++ b/share/template/README @@ -3,9 +3,9 @@ a small program that you could use as a template when writing your own analysis software. A Makefile.arch is created for each architecture you install -(the first one is linked to Makefile) with the correct paths -and libraries. If there is more than one, copy the one -that corresponds best to your computer. +with the correct paths and libraries. You will have to link +(or copy) the correct makefile to "Makefile" or use the -f +option to gmake in order to select a makefile. ---------------------------------------------------------- diff --git a/share/top/ffgmxnb.itp b/share/top/ffgmxnb.itp index 4d173140cc..56131989c6 100644 --- a/share/top/ffgmxnb.itp +++ b/share/top/ffgmxnb.itp @@ -4,9 +4,9 @@ OM 15.99940 0.000 A 0.22617E-02 0.74158E-06 OA 15.99940 0.000 A 0.22617E-02 0.15062E-05 #ifdef HEAVY_H - OW 9.95140 0.000 A 0.26171E-02 0.26331E-05 + OW 9.95140 0.000 A 0.26171E-02 0.26331E-05 1 2 3 #else - OW 15.99940 0.000 A 0.26171E-02 0.26331E-05 + OW 15.99940 0.000 A 0.26171E-02 0.26331E-05 1 2 3 #endif N 14.00670 0.000 A 0.24362E-02 0.16924E-05 NT 14.00670 0.000 A 0.24362E-02 0.16924E-05 @@ -24,9 +24,9 @@ H 1.00800 0.000 A 0.00000E+00 0.00000E+00 HO 1.00800 0.000 A 0.00000E+00 0.00000E+00 #ifdef HEAVY_H - HW 4.03200 0.000 A 0.00000E+00 0.00000E+00 + HW 4.03200 0.000 A 0.00000E+00 0.00000E+00 4 5 6 #else - HW 1.00800 0.000 A 0.00000E+00 0.00000E+00 + HW 1.00800 0.000 A 0.00000E+00 0.00000E+00 4 5 6 #endif HS 1.00800 0.000 A 0.00000E+00 0.00000E+00 S 32.06000 0.000 A 0.99844E-02 0.13078E-04 diff --git a/share/top/ffoplsaa.rtp b/share/top/ffoplsaa.rtp index 9d22ebf7f9..0c376c0690 100644 --- a/share/top/ffoplsaa.rtp +++ b/share/top/ffoplsaa.rtp @@ -31,7 +31,7 @@ CH3 C C O [ impropers ] - O C +N CH3 improper_O_C_X_Y + C CH3 +N O improper_O_C_X_Y [ ALA ] [ atoms ] diff --git a/share/top/methanol.itp b/share/top/methanol.itp dissimilarity index 90% index e31e651f8c..a589c38219 100644 --- a/share/top/methanol.itp +++ b/share/top/methanol.itp @@ -1,36 +1,64 @@ -#ifndef _FF_GROMOS96 - -[ atomtypes ] -; type mass charge ptype c6 c12 - OMET 15.999 -0.69 A 2.6169e-3 2.5231e-6 - OW 15.999 -0.82 A 2.6170e-3 2.6330e-6 - CMET 15.035 0.29 A 8.8758e-3 17.8426e-6 - H 1.008 0.4 A 0.0 0.0 - HW 1.008 0.41 A 0.0 0.0 -#endif - -[ moleculetype ] -; name nrexcl -Methanol 2 - -[ atoms ] -; nr type resnr residu atom cgnr charge mass -#ifdef _FF_GROMOS96 -1 CMET 1 MeOH Me1 1 0.176 15.035 -2 OMET 1 MeOH O2 1 -0.574 15.999 -3 H 1 MeOH H3 1 0.398 1.008 -#else -1 CMET 1 MeOH Me1 1 0.29 15.035 -2 OMET 1 MeOH O2 1 -0.69 15.999 -3 H 1 MeOH H3 1 0.40 1.008 -#endif - -[ bonds ] -; ai aj funct c0 c1 -1 2 1 0.13600 376560. -2 3 1 0.10000 313800. - -[ angles ] -; ai aj ak funct c0 c1 - 1 2 3 1 108.53 397.5 - +#ifdef _FF_OPLSAA + + +[ moleculetype ] +; name nrexcl +Ethanol 3 + +[ atoms ] +; nr type resnr residu atom cgnr charge mass + 1 opls_135 1 EtOH CB 1 -0.18 12.011 + 2 opls_140 1 EtOH HB1 1 0.06 1.008 + 3 opls_140 1 EtOH HB2 1 0.06 1.008 + 4 opls_140 1 EtOH HB3 1 0.06 1.008 + 5 opls_157 1 EtOH CA 2 0.145 12.011 + 6 opls_140 1 EtOH HA1 2 0.06 1.008 + 7 opls_140 1 EtOH HA2 2 0.06 1.008 + 8 opls_154 1 EtOH OH 2 -0.683 15.994 + 9 opls_155 1 EtOH HO 2 0.418 1.008 + + +[ bonds ] +; ai aj funct + 1 2 1 + 1 3 1 + 1 4 1 + 1 5 1 + 5 6 1 + 5 7 1 + 5 8 1 + 8 9 1 + + +[ angles ] +; ai aj ak funct c0 c1 + 2 1 3 1 + 2 1 4 1 + 2 1 5 1 + 3 1 4 1 + 3 1 5 1 + 4 1 5 1 + 1 5 6 1 + 1 5 7 1 + 1 5 8 1 + 6 5 7 1 + 6 5 8 1 + 7 5 8 1 + 5 8 9 1 + + +[ dihedrals ] +; ai aj ak al func + 2 1 5 6 3 + 2 1 5 7 3 + 2 1 5 8 3 + 3 1 5 6 3 + 3 1 5 7 3 + 3 1 5 8 3 + 4 1 5 6 3 + 4 1 5 7 3 + 4 1 5 8 3 + 1 5 8 9 3 + 6 5 8 9 3 + 7 5 8 9 3 + diff --git a/src/contrib/addquote.c b/src/contrib/addquote.c index e44c38510c..7c46ace436 100644 --- a/src/contrib/addquote.c +++ b/src/contrib/addquote.c @@ -29,8 +29,9 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_addquote_c = "$Id$"; + #include +#include #include "strdb.h" #include "copyrite.h" #include "smalloc.h" diff --git a/src/contrib/anaf.c b/src/contrib/anaf.c index 076d462907..3362a5dbce 100644 --- a/src/contrib/anaf.c +++ b/src/contrib/anaf.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_anaf_c = "$Id$"; + #include #include #include @@ -56,7 +56,7 @@ static char *nm[5] = { "OW", "HW1", "HW2", "DW", "SW" }; static void list_trn(char *fn) { static real mass[5] = { 15.9994, 1.008, 1.008, 0.0, 0.0 }; - int i,j,m,fpread,fpwrite,nframe; + int i,j=0,m,fpread,fpwrite,nframe; rvec *x,*v,*f,fmol[2],xcm[2],torque[j],dx; real mmm,len; matrix box; diff --git a/src/contrib/calcfdev.c b/src/contrib/calcfdev.c index c7fe2947c3..dfcd29af39 100644 --- a/src/contrib/calcfdev.c +++ b/src/contrib/calcfdev.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_calcfdev_c = "$Id$"; + #include "typedefs.h" #include "main.h" #include "vec.h" diff --git a/src/contrib/copyrgt.c b/src/contrib/copyrgt.c index 4fa23ea3fe..d0b2fa1159 100644 --- a/src/contrib/copyrgt.c +++ b/src/contrib/copyrgt.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_copyrgt_c = "$Id$"; + #include "stdio.h" #include "stdlib.h" #include "macros.h" @@ -73,7 +73,7 @@ static char *head2[]= { #define NH2 asize(head2) #define MAXS 10240 -void head(FILE *out, char *fn_, bool bH, bool bSRCID, +void head(FILE *out, char *fn_, bool bH, char *cstart, char *ccont, char *cend) { int i; @@ -97,10 +97,6 @@ void head(FILE *out, char *fn_, bool bH, bool bSRCID, fprintf(out,"#define _%s\n",fn_); fprintf(out,"\n"); } - if (bSRCID) - fprintf(out,"static char *SRCID_%s = \"$""Id""$\";\n",fn_); - /* NOTE: the "" are to mislead CVS so it will not replace by version info */ - /*fprintf(out,"\n");*/ } void cr_c(char *fn) @@ -108,7 +104,7 @@ void cr_c(char *fn) FILE *in,*out; char ofn[1024],line[MAXS+1],cwd[1024]; char *p,*fn_; - bool bH,bSRCID; + bool bH; sprintf(ofn,"%s.bak",fn); @@ -146,16 +142,9 @@ void cr_c(char *fn) (strstr(line,"#define") != NULL) ) bH=TRUE; } while ( ( (strstr(line,fn_) != NULL) || - (strstr(line,"static char *SRCID") != NULL) || (strlen(line)==0) ) && (!feof(in) ) ); getcwd(cwd,STRLEN); - bSRCID = TRUE; - /* Do not put source id's in include/types since some filenames are - * be equal to those in include */ - if ((strlen(cwd)>strlen("types")) && - (!strcmp(cwd+strlen(cwd)-strlen("types"),"types"))) - bSRCID = FALSE; - head(out,fn_,bH,bSRCID,"/*"," *"," */"); + head(out,fn_,bH,"/*"," *"," */"); do { fprintf(out,"%s\n",line); } while (!feof(in) && fgets2(line,MAXS,in)); @@ -171,12 +160,11 @@ void cr_other(char *fn) /* FILE *in,*out; char ofn[1024],line[MAXS+1],line2[MAXS+1],cwd[1024]; char *p,*fn_,*ptr; - bool bH,bSRCID; + bool bH; sprintf(ofn,"%s.bak",fn); - fprintf(stderr,"Processing %s (backed up to %s)\n", - fn,ofn); + fprintf(stderr,"Processing %s (backed up to %s)\n",fn,ofn); if (rename(fn,ofn) != 0) { perror(ofn); @@ -186,55 +174,7 @@ void cr_other(char *fn) out=ffopen(fn,"w"); */ /* Skip over empty lines in the beginning only */ - /* - do { - if (fgets2(line,MAXS,in)) - rtrim(line); - } while ((strlen(line) == 0) && (!feof(in))); - */ - /* Now we are at end of file, or we have a non-empty string */ - /* - if (strlen(line) != 0) { - strcpy(line2,line); - trim(line2); - while ((line2[0] == ';') && (!feof(in))) { - fgets2(line,MAXS,in); - strcpy(line2,line); - trim(line2); - } - */ - /* - fn_=strdup(fn); - p=strchr(fn_,'.'); - if (p) - p[0]='_'; - bH=FALSE; - do { - fgets2(line,MAXS,in); - if ( (strstr(line,fn_) != NULL) && - (strstr(line,"#define") != NULL) ) - bH=TRUE; - } while ( ( (strstr(line,fn_) != NULL) || - (strstr(line,"static char *SRCID") != NULL) || - (strlen(line)==0) ) && (!feof(in) ) ); - getcwd(cwd,STRLEN); - bSRCID = TRUE; - */ - /* Do not put source id's in include/types since some filenames are - * be equal to those in include */ - /*if ((strlen(cwd)>strlen("types")) && - (strcmp(cwd+strlen(cwd)-strlen("types"),"types") == NULL)) - */ - /* - bSRCID = FALSE; - head(out,fn_,bH,bSRCID,";",";",";"); - do { - fprintf(out,"%s\n",line); - } while (!feof(in) && fgets2(line,MAXS,in)); - } - fclose(in); - fclose(out); - */ + } void cr_tex(char *fn) diff --git a/src/contrib/do_shift.c b/src/contrib/do_shift.c index e352da9a95..e441b6357c 100644 --- a/src/contrib/do_shift.c +++ b/src/contrib/do_shift.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_do_shift_c = "$Id$"; + #include #include "errno.h" #include "sysstuff.h" diff --git a/src/contrib/dsspcore.c b/src/contrib/dsspcore.c index c4d2b6abca..0fb8cd3d1b 100644 --- a/src/contrib/dsspcore.c +++ b/src/contrib/dsspcore.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_dsspcore_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -39,285 +39,6 @@ static char *SRCID_dsspcore_c = "$Id$"; -/* ------------------------------------------------------------------ */ -/* - -DSSP version October 1988. -This copy for Rudi Drunen at Univ_Groningen -who have agreed to the following software license agreement: - - -An academic license for the DSSP program -((c) W. Kabsch, C. Sander and MPI-MF, 1983, 1985, 1988) -is granted to in exchange for the following commitments: - -I hereby certify that - - (1) I am an academic user at an academic research institution. In - using the software, I will respect the interests of the authors - and their institutions. - - (2) I will not use the software in commercial activities without - a written commercial license agreement; commercial activities - include, in particular, work under contract from a commercial - company. - - (3) I will not redistribute the software to others outside of my - immediate research group. I will suggest to other interested - research groups to contact the authors directly. - - (4) I will not alter or suppress the run-time copyright message. - - (5) I will acknowledge the program authors on any publication of - scientific results based in part on use of the program and - cite the article in which the program was described. - - (6) I will report evidence of program bugs to the authors. - - (7) I will send the source code of any bug corrections and program - extensions, major or minor, to the original authors, for free - academic use. If I have made major extensions which are incor- - porated by the authors, I reserve the right to be appropriately - included in any future commercial license agreement. - - (8) I will not extract part of the software, e.g. modules or sub- - routines, for use in other contexts without permission by the - authors. - - (9) I will not use the program in the context of classified research. -*/ -/* PREVIOUS RELEASE: VERSION OCTOBER 1985 */ -/* PREVIOUS RELEASE: VERSION JUNE 1983 */ -/* LANGUAGE: STANDARD PASCAL WITH 128 CHARACTER ASCII SET */ -/* AUTHORS AND COPYRIGHT (1983,1985,1988): - Wolfgang Kabsch and Chris Sander, Max Planck Institut - fuer Medizinische Forschung, Jahnstr. 29, 6900 Heidelberg, Germany - Telephone: +49-6221-486 276 Telex: 461505 mpimf d - Bitnet: KABSCH@EMBL - Current address for Chris Sander: - Biocomputing, EMBL, 6900 Heidelberg, Germany - Telephone: +49-6221-387 361 Telex: 461613 embl d - Telefax: +49-6221-387 306 - Bitnet: SANDER@EMBL - Do report errors if you find any. - Reference: Kabsch,W. and Sander,C. (1983) Biopolymers 22, 2577-2637*/ -/*--------------------------------------------------------------------*/ -/* DEFINES SECONDARY STRUCTURE AND SOLVENT EXPOSURE OF PROTEINS FROM - ATOMIC COORDINATES AS GIVEN BY THE BROOKHAVEN PROTEIN DATA BANK. */ -/*--------------------------------------------------------------------*/ -/* This program including sample input and output files for dataset 1PPT - is available from the authors in exchange for an academic or - commercial license agreement. The program is no longer available - from the Brookhaven Protein Data Bank */ -/*--------------------------------------------------------------------*/ -/* CORRECTION AND MODIFICATION LOG SINCE JUNE 1983 */ -/* (1) MODIFICATIONS THAT AFFECT OUTPUT ON FILE TAPEOUT FOR AT LEAST ONE - OF THE 62 PROTEIN DATA SETS IN THE 1983 BIOPOLYMERS PAPER: - - SIDECHAIN ATOMS MORE THAN MAXDIST ANGSTROM DISTANT FROM ATOM CA ARE - DECLARED ILLEGAL AND IGNORED. OUTPUT CHANGE: ACCESSIBILITY VALUES - FOR ASN 76 OF 1SBT (ILLEGAL ATOM OD1) AND PRO 49 OF 156B (ILLEGAL - ATOM UNK). - - ANY RESIDUE WITH INCOMPLETE BACKBONE IS IGNORED. OUTPUT CHANGE: - CHAIN BREAK BETWEEN RESIDUE SER 11 AND ILE 16 IN 2GCH - (DUE TO INCOMPLETE COORDINATES FOR SER 11) IS NOW CORRECT. - (2) MODIFICATIONS THAT DO NOT AFFECT OUTPUT ON FILE TAPEOUT FOR ANY - OF THE 62 PROTEIN DATA SETS IN THE 1983 BIOPOLYMERS PAPER: - - SPELLING OF FLAGCHIRALITY AND TESTSSBOND CORRECTED. - - WARNING MESSAGE FOR RESIDUES WITH NON-STANDARD NUMBER OF - SIDECHAIN ATOMS HAS BEEN ADDED. FOR EXAMPLE, THIS ALERTS THE USER - TO BAD DATA FOR RESIDUES 8,12,21,24 AND 44 OF DATA SET 2RXN. - - WARNING MESSAGE FOR RESIDUES IGNORED DUE TO NON-STANDARD RESIDUE - NAME SUCH AS 'ACE' AND 'FOR' HAS BEEN ADDED. - - WARNING MESSAGE FOR ALTERNATE ATOM LOCATION IDENTIFIER HAS BEEN - ADDED. FOR EXAMPLE, THE USER IS NOW WARNED THAT ATOM CH2 IN ANY - TRP OF DATA SET 1APP IS IGNORED DUE TO BAD ALTERNATE LOCATION - IDENTIFIER '2'. - WE THANK STEVEN SHERIFF, FRANCOIS COLONNA AND JOHN MOULT FOR - REPORTING PROBLEMS AND STEVEN SHERIF, JANET THORNTON AND - WILLIE TAYLOR FOR RESULTS OF TEST RUNS ON VAX COMPUTERS. - - Changes after 1985: - - - program speeded up by a factor of two or three by avoiding use - of square root. - - hydrogen atoms in data set ignored on input (H of NH of backbone - is built as before) - - 18-AUG-1988: CADIST=9.0, replacing CADIST=8.0. Has affected output - for 63/300 proteins in a minor way. Thanks to Jean Richelle (Bruxelles) - for pointing out this bug. - - Output changes due to change in parameter CADIST (8 to 9 Angstrom) : - additional backbone-backbone Hbonds found with slight - adjustments in secondary structure summary. In about 300 protein - data sets from the Fall 1988 PDB release, 63 additional - Hbonds were found, i.e. 0.2 Hbonds per protein (29 of type - i,i+5; 16 of type i,i+4; 6 of type i,i+3; 10 in antiparallel beta - bridges and 2 in a parallel beta bridge). These additional - Hbonds affected the secondary structure summary of 26 of these - protein data sets in a minor way, typically joining a 4-turn to - an alpha-helix, changing a geometrical turn to a hydrogen- - bonded turn or adding an extra residue pair to a beta ladder. - The changes are (using _ for blank): - - [protein id, old secstruc summary > corrected summary] - - 1FC2_E > EE and _T > ET - 1GP1GGG > HHH - 1HBSS > T - 1HDSS > T and GGGGGG > TTHHHH - 1HFM__ > TT - 1HKGSSS > TTT - 1IG2S_ > TT - 1LDX GGG > HTT - 1MEV__ > TT and _BS > TBS and SSS > TTS - 1PFCSSS > TTS - 1PP2_E > EE and _S > ES - 1RN3E_SS_E > EEEEEE and _E > EE (>3-res beta bulge) - 1RNSsame as 1RN3 - 2ATCHH > TT - 2CABB_ > EE - 2CPPSS > TT and GGGGGG > HHHHTT - 2LYZT > H - 2MDHSSS > TTT - 3CPA TTT > HHH - 4CATTTT > HHH - 4SBVS > T - 5API_ > B - 5CPATTT > HHH - 7LYZS > H - 8CAT_ > B and _ > B - 8LYZT > H - - Note that this bugfix results in a small variation in the total - number of Hbonds, compared to the variation which would - result, say, from changing the (somewhat arbitrary) cutoff of - -0.5 kcal/mol for the Hbond electrostatic potential energy. We - cannot here solve the fundamental difficulty of arbitrary - cutoffs involved in extracting binary classifications (an Hbond - exists, yes/no) from real numbers (coordinates, energies). - However, for most purposes the secondary structure summary agrees - will with anyone's intuitive definition, especially for well-refined and - high resolution structures. For a more clearcut assignment of protein - substructure, we recommend using the detailed H-bond and other assignments - in the columns following the summary column, i.e. columns 19-38 (xxx): - - ....;....1....;....2....;....3....;....4....;....5....;....6....;....7.. - xxxxxxxxxxxxxxxxxxxx - .-- 3-turns/helix - |.-- 4-turns/helix - ||.-- 5-turns/helix - |||.-- geometrical bend - ||||.-- chirality - |||||.-- beta bridge label - ||||||.-- beta bridge label - ||||||| .-- beta bridge partner resnum - ||||||| | .-- beta bridge partner resnum - ||||||| | |.-- beta sheet label - ||||||| | || .-- solvent accessibility - ||||||| | || | - 35 47 I E + 0 0 2 - 36 48 R E > S- K 0 39C 97 - 37 49 Q T 3 S+ 0 0 86 (example from 1EST) - 38 50 N T 3 S+ 0 0 34 - 39 51 W E < -KL 36 98C 6 - */ -/*--------------------------------------------------------------------*/ -/* GENERAL PROGRAM INSTALLATION GUIDE. */ -/* (1) THE PROGRAM REQUIRES THE FULL STANDARD ASCII 128 CHARACTER SET, - IN PARTICULAR LOWER CASE LETTERS 'abcdefg....'. - (2) STANDARD PASCAL MAY NOT RECOGNIZE REAL NUMBERS SUCH AS .1, +.1, - -.1 ON INPUT. CHANGE TO 0.1,+0.1,-0.1. - (3) THE NON-STANDARD PROCEDURE 'DATE' RETURNS THE CURRENT DAY, MONTH, - AND YEAR. IF THE PROCEDURE IS NOT CALLED (LINE COMMENTED OUT) - THE PSYCHEDELIC DATE DEC 24, 2001 IS RETURNED. YOU MAY REPLACE - 'DATE' BY THE CORRESPONDING PROCEDURE FROM YOUR PASCAL - IMPLEMENTATION. THE EXAMPLE GIVEN WORKS IN DEC VAX VMS 5.0. - (4) DUE TO INCOMPATIBLE ASCII CODES, SQUARE BRACKETS '[' AND ']' - MAY APPEAR AS '!','?' ETC. USE YOUR EDITOR TO CONVERT THESE. */ -/* INSTALLATION GUIDE FOR VAX/VMS USERS. */ -/* (1) THE /OPTIMIZE OPTION OF THE PASCAL COMPILER PRODUCED - INCORRECT CODE ON THE VAX 8600 AT EMBL RUNNING UNDER VMS V4.2. - LATER VERSIONS OF VMS (E.G. VMS 5.0) PRODUCED CORRECT CODE. - IF IN DOUBT, COMPILE USING PASCAL /NOOPTIMIZE. - (2) COPY BROOKHAVEN DATA BANK COORDINATE INPUT TO A FILE NAMED - TAPEIN.DAT . OUTPUT WILL BE IN A FILE NAMED TAPEOUT.DAT */ -/* IMPLEMENTATION ON OTHER COMPUTERS */ -/* (1) NORD-500. EXECUTION TIME COMPARABLE TO VAX 780. - (2) SUN-3. EXECUTION TIME COMPARABLE TO VAX 780. - Compile using: pc -L - in ORDER to map upper case letters in keywords - and identifiers to lower case. - (3) ATARI 520 ST. RUNS FACTOR 60 SLOWER THAN NORD-500 DUE TO - SOFTWARE-EMULATED FLOATING POINT OPERATIONS ON MC68000. */ -/*--------------------------------------------------------------------*/ -/* INPUT/OUTPUT FILES. */ -/* INPUT: DEFAULT INPUT UNIT, E.G. YOUR TERMINAL - OUTPUT: DEFAULT OUTPUT UNIT, E.G. YOUR TERMINAL, - USED FOR RUN-TIME MESSAGES. WARNINGS AND ERRORS LOOK - LIKE THIS: !!! TEXT !!! - TAPEIN: FILE WITH PROTEIN DATA BANK COORDINATES, E.G. PDB3PTI.COO - TAPEOUT: DSSP OUTPUT OF LINE LENGTH 128, E.G. PAPER PRINTER */ -/*--------------------------------------------------------------------*/ -/* DESCRIPTION OF OUTPUT ON FILE TAPEOUT: - LINE LENGTH OF OUTPUT IS 128 CHARCTERS. - FOR DEFINITONS, SEE ABOVE BIOPOLYMERS ARTICLE. - IN ADDITION NOTE: - HISTOGRAMS - E.G. 2 UNDER COLUMN '8' IN LINE 'RESIDUES PER ALPHA - HELIX' MEANS: THERE ARE 2 ALPHA HELICES OF LENGTH 8 - RESIDUES IN THIS DATA SET. - # RESIDUE AA STRUCTURE BP1 BP2 ACC ..ETC..FOR EACH RESIDUE I: - # RESIDUE - TWO COLUMNS OF RESIDUE NUMBERS. FIRST COLUMN IS DSSP'S - SEQUENTIAL RESIDUE NUMBER, STARTING AT THE FIRST - RESIDUE ACTUALLY IN THE DATA SET AND INCLUDING CHAIN BREAKS; - THIS NUMBER IS USED TO REFER TO RESIDUES THROUGHOUT. SECOND - COLUMN GIVES CRYSTALLOGRAPHERS' 'RESIDUE SEQUENCE - NUMBER','INSERTION CODE' AND 'CHAIN IDENTIFIER' (SEE PROTEIN - DATA BANK FILE RECORD FORMAT MANUAL), GIVEN FOR REFERENCE - ONLY AND NOT USED FURTHER.. - AA - ONE LETTER AMINO ACID CODE, LOWER CASE FOR SS-BRIDGE CYS. - STRUCTURE - SEE BIOPOLYMERS - BP1 BP2 - RESIDUE NUMBER OF FIRST AND SECOND BRIDGE PARTNER - FOLLOWED BY ONE LETTER SHEET LABEL - ACC - NUMBER OF WATER MOLECULES IN CONTACT WITH THIS RESIDUE *10. - OR RESIDUE WATER EXPOSED SURFACE IN ANGSTROM**2. - N-H-->O ETC. - HYDROGEN BONDS. E.G. -3,-1.4 MEANS: IF THIS RESIDUE - IS RESIDUE I THEN N-H OF I IS H-BONDED TO C=O OF I-3 - WITH AN ELECTROSTATIC H-BOND ENERGY OF -1.4 KCAL/MOL. - TCO - COSINE OF ANGLE BETWEEN C=O OF RESIDUE I AND C=O OF - RESIDUE I-1. FOR ALPHA-HELICES, TCO IS NEAR +1, FOR - BETA-SHEETS TCO IS NEAR -1. NOT USED FOR STRUCTURE - DEFINITION. - KAPPA - VIRTUAL BOND ANGLE (BEND ANGLE) DEFINED BY THE THREE - C-ALPHA ATOMS OF RESIDUES I-2,I,I+2. USED TO DEFINE - BEND (STRUCTURE CODE 'S'). - ALPHA - VIRTUAL TORSION ANGLE (DIHEDRAL ANGLE) DEFINED BY THE FOUR - C-ALPHA ATOMS OF RESIDUES I-1,I,I+1,I+2. USED TO DEFINE - CHIRALITY (STRUCTURE CODE '+' OR '-'). - PHI PSI - IUPAC PEPTIDE BACKBONE TORSION ANGLES - X-CA Y-CA Z-CA - ECHO OF C-ALPHA ATOM COORDINATES */ -/*--------------------------------------------------------------------*/ -/* WORDS OF CAUTION */ -/* THE VALUES FOR SOLVENT EXPOSURE MAY NOT MEAN WHAT YOU THINK! - (A) EFFECTS LEADING TO LARGER THAN EXPECTED VALUES: - SOLVENT EXPOSURE CALCULATION IGNORES UNUSUAL RESIDUES, LIKE ACE, - OR RESIDUES WITH INCOMPLETE BACKBONE, LIKE ALA 1 OF DATA SET 1CPA. - IT ALSO IGNORES HETATOMS, LIKE A HEME OR METAL LIGANDS. - ALSO, SIDE CHAINS MAY BE INCOMPLETE (AN ERROR MESSAGE IS WRITTEN). - (B) EFFECTS LEADING TO SMALLER THAN EXPECTED VALUES: - IF YOU APPLY THIS PROGRAM TO PROTEIN DATA BANK DATA SETS - CONTAINING OLIGOMERS, SOLVENT EXPOSURE IS FOR THE ENTIRE ASSEMBLY, - NOT FOR THE MONOMER. ALSO, ATOM OXT OF C-TERMINAL RESIDUES IS - TREATED LIKE A SIDE CHAIN ATOM IF IT IS LISTED AS PART OF THE LAST - RESIDUE. ALSO, PEPTIDE SUBSTRATES, WHEN LISTED AS ATOMS RATHER THAN - HETATOMS, ARE TREATED AS PART OF THE PROTEIN, E.G. RESIDUES 499 S - AND 500 S IN 1CPA. */ -/* UNKNOWN OR UNUSUAL RESIDUES ARE NAMED X ON OUTPUT AND THEY ARE - NOT CHECKED FOR STANDARD NUMBER OF SIDECHAIN ATOMS. */ -/* ALL EXPLICIT WATER MOLECULES, LIKE OTHER HETATOMS, ARE IGNORED. */ -/* END OF INTRODUCTORY COMMENTS */ -/**********************************************************************/ - - /************************************************************ * * * p2c.h * @@ -1798,6 +1519,7 @@ int code; exit(EXIT_FAILURE); fprintf(stderr, "%s\n", _ShowEscape(buf, P_escapecode, P_ioresult, "")); exit(EXIT_FAILURE); + return 0; } int _EscIO(code) @@ -2827,8 +2549,8 @@ long i, j; backbone *WITH; WITH = &chain[i]; - return (WITH->acceptor[0].residue == j && WITH->acceptor[0].energy < HBHIGH || - WITH->acceptor[1].residue == j && WITH->acceptor[1].energy < HBHIGH); + return ((WITH->acceptor[0].residue == j && WITH->acceptor[0].energy < HBHIGH) || + (WITH->acceptor[1].residue == j && WITH->acceptor[1].energy < HBHIGH)); } /* Testbond */ @@ -3192,13 +2914,17 @@ Local Void Extendladder() switch (WITH->btyp) { case parallel: - bulge = (jb1 - WITH->je < 6 && ib1 - WITH->ie < 3 || - jb1 - WITH->je < 3) & Nochainbreak(WITH->je, jb1); + bulge = ((jb1 - WITH->je < 6 && ib1 - WITH->ie < 3) || + (jb1 - WITH->je < 3) & Nochainbreak(WITH->je, jb1)); break; case antiparallel: - bulge = (WITH->jb - je1 < 6 && ib1 - WITH->ie < 3 || - WITH->jb - je1 < 3) & Nochainbreak(je1, WITH->jb); + bulge = ((WITH->jb - je1 < 6 && ib1 - WITH->ie < 3) || + (WITH->jb - je1 < 3) & Nochainbreak(je1, WITH->jb)); + break; + default: + printf("Uh-oh.. this shouln't happen..\n"); + exit(0); break; } } @@ -3249,8 +2975,8 @@ long l1, l2; ie2 = bridgetable[l2 - 1].ie; jb2 = bridgetable[l2 - 1].jb; je2 = bridgetable[l2 - 1].je; - return (ie1 >= ib2 && ib1 <= ie2 || ie1 >= jb2 && ib1 <= je2 || - je1 >= ib2 && jb1 <= ie2 || je1 >= jb2 && jb1 <= je2); + return ((ie1 >= ib2 && ib1 <= ie2) || (ie1 >= jb2 && ib1 <= je2) || + (je1 >= ib2 && jb1 <= ie2) || (je1 >= jb2 && jb1 <= je2)); } /* Link */ /***/ diff --git a/src/contrib/ehanal.c b/src/contrib/ehanal.c index 3dad273c9c..2dccf98014 100644 --- a/src/contrib/ehanal.c +++ b/src/contrib/ehanal.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_ehanal_c = "$Id$"; + #include #include #include diff --git a/src/contrib/ehdata.c b/src/contrib/ehdata.c index 8433ef91ba..e72803d444 100644 --- a/src/contrib/ehdata.c +++ b/src/contrib/ehdata.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_ehdata_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/contrib/ehdata.h b/src/contrib/ehdata.h index 3e769346b9..8d682d73b2 100644 --- a/src/contrib/ehdata.h +++ b/src/contrib/ehdata.h @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_ehdata_h = "$Id$"; + extern real get_omega(real ekin,int *seed,FILE *fp,char *fn); diff --git a/src/contrib/ehole.c b/src/contrib/ehole.c index 2aa1dc831d..38bd5f10e7 100644 --- a/src/contrib/ehole.c +++ b/src/contrib/ehole.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_ehole_c = "$Id$"; + #include #include #include diff --git a/src/contrib/g_anavel.c b/src/contrib/g_anavel.c index e58e5ca7e8..975c2a82a1 100644 --- a/src/contrib/g_anavel.c +++ b/src/contrib/g_anavel.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_g_anavel_c = "$Id$"; + #include "sysstuff.h" #include "smalloc.h" #include "macros.h" @@ -74,27 +74,28 @@ int main(int argc,char *argv[]) FILE *fp; int *npts,nmax; int status; - int i,j,idum,step,nframe=0,natoms,index; - real t,temp,rdum,hboxx,hboxy,scale,xnorm; + int i,j,idum,step,nframe=0,index; + real temp,rdum,hboxx,hboxy,scale,xnorm=0; real **profile=NULL; real *t_x=NULL,*t_y,hi=0; - rvec *x,*v; t_topology *top; int d,m,n; matrix box; atom_id *sysindex; bool bHaveV,bReadV; t_rgb rgblo = { 0, 0, 1 },rgbhi = { 1, 0, 0 }; - + int flags = TRX_READ_X | TRX_READ_V; + t_trxframe fr; + CopyRight(stderr,argv[0]); parse_common_args(&argc,argv,PCA_CAN_TIME | PCA_BE_NICE ,NFILE,fnm, asize(pa),pa,asize(desc),desc,0,NULL); top = read_top(ftp2fn(efTPX,NFILE,fnm)); - - natoms = read_first_x_v(&status,ftp2fn(efTRN,NFILE,fnm),&t,&x,&v,box); - + + read_first_frame(&status,ftp2fn(efTRX,NFILE,fnm),&fr,flags); + if (xmax > 0) { scale = 5; nmax = xmax*scale; @@ -113,21 +114,21 @@ int main(int argc,char *argv[]) srenew(profile,++nframe); snew(profile[nframe-1],nmax+1); srenew(t_x,nframe); - t_x[nframe-1] = t*1000; + t_x[nframe-1] = fr.time*1000; hboxx = box[XX][XX]/2; hboxy = box[YY][YY]/2; - for(i=0; (iatoms.atom[i].m*iprod(v[i],v[i])/(2*BOLTZ); + temp = top->atoms.atom[i].m*iprod(fr.v[i],fr.v[i])/(2*BOLTZ); if (temp > hi) hi = temp; npts[index]++; @@ -139,8 +140,8 @@ int main(int argc,char *argv[]) profile[nframe-1][i] /= npts[i]; npts[i] = 0; } - } while (read_next_x_v(status,&t,natoms,x,v,box)); - close_trn(status); + } while (read_next_frame(status,&fr)); + close_trx(status); fp = ftp2FILE(efXPM,NFILE,fnm,"w"); write_xpm(fp,"Temp. profile","T (a.u.)", diff --git a/src/contrib/glasmd.c b/src/contrib/glasmd.c index e1c7955408..b81184f9a2 100644 --- a/src/contrib/glasmd.c +++ b/src/contrib/glasmd.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_glasmd_c = "$Id$"; + #include #include #include @@ -182,7 +182,8 @@ time_t do_md(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[], construct_dummies(log,x,&mynrnb,parm->ir.delta_t,v,&top->idef); /* Set values for invmass etc. */ - init_mdatoms(mdatoms,lambda,FALSE); + if (parm->ir.bPert) + init_mdatoms(mdatoms,lambda,FALSE); /*init_forcerec(log,fr,&(parm->ir),&(top->blocks[ebMOLS]),cr, &(top->blocks[ebCGS]),&(top->idef),mdatoms,parm->box,FALSE); diff --git a/src/contrib/hexamer.c b/src/contrib/hexamer.c index e667de06da..35703a8d92 100644 --- a/src/contrib/hexamer.c +++ b/src/contrib/hexamer.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_hexamer_c = "$Id$"; + #include #include #include diff --git a/src/contrib/hrefify.c b/src/contrib/hrefify.c index 75270cdf6b..707dc83fdc 100644 --- a/src/contrib/hrefify.c +++ b/src/contrib/hrefify.c @@ -29,9 +29,10 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_hrefify_c = "$Id$"; + #include -#include +#include +#include #include "smalloc.h" #include "typedefs.h" #include "macros.h" @@ -41,6 +42,7 @@ static char *SRCID_hrefify_c = "$Id$"; #include "statutil.h" #include "copyrite.h" #include "pdbio.h" +#include "strdb.h" bool isword(char c) { @@ -64,7 +66,7 @@ char *strncasestr(char *line,char *str) char *strstr_href(char *line,bool *bInHREF,int *i_dat,int n_dat,char **dat) { - char *start,*found,*href; + char *start,*found,*href=NULL; bool bIn; int i; @@ -88,16 +90,18 @@ char *strstr_href(char *line,bool *bInHREF,int *i_dat,int n_dat,char **dat) i=0; while((ihref)) found=NULL; - else + else { if (((found!=start) && isword(found[-1])) || isword(found[strlen(dat[i])])) found=NULL; else *i_dat=i; - i++; + } + i++; + } } } } while (strlen(start) && !found && href); @@ -133,12 +137,12 @@ int main(int argc, char *argv[]) static char *in=NULL,*out=NULL,*excl=NULL,*link_text=NULL; static bool peratom=FALSE; t_pargs pa[] = { - { "-f", FALSE, etSTR, &in, "HTML input" }, - { "-o", FALSE, etSTR, &out, "HTML output" }, - { "-e", FALSE, etSTR, &excl, "Exclude a string from HREF's, " + { "-f", FALSE, etSTR, { &in } , "HTML input" }, + { "-o", FALSE, etSTR, { &out } , "HTML output" }, + { "-e", FALSE, etSTR, { &excl } , "Exclude a string from HREF's, " "when this option is not set, the filename without path and extension " "will be excluded from HREF's"}, - { "-t", FALSE, etSTR, &link_text, "Insert a string in front of the " + { "-t", FALSE, etSTR, { &link_text } , "Insert a string in front of the " "href file name, useful for scripts" } }; @@ -196,7 +200,7 @@ int main(int argc, char *argv[]) strcpy(word,ref); word[ptr-ref+strlen(str[i_str])]='\0'; strcpy(end,ptr+strlen(str[i_str])); - sprintf(line,"%s%s%s\0", + sprintf(line,"%s%s%s", start,link_text,str[i_str],word,end); fprintf(stderr,"line %d: %s\n",l+1,str[i_str]); n_repl++; diff --git a/src/contrib/mk6_n.c b/src/contrib/mk6_n.c index 302b7262c4..df83456e1c 100644 --- a/src/contrib/mk6_n.c +++ b/src/contrib/mk6_n.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_mk6_n_c = "$Id$"; + #include #include #include diff --git a/src/contrib/mkice.c b/src/contrib/mkice.c index aa726d142f..e6f3fe8a99 100644 --- a/src/contrib/mkice.c +++ b/src/contrib/mkice.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_mkice_c = "$Id$"; + #include #include #include "typedefs.h" @@ -457,7 +457,7 @@ int main(int argc,char *argv[]) #define NFILE asize(fnm) FILE *fp; - char *fn; + char *fn,quote[256]; int i,j,k,n,nmax,m,natom,natmol; t_atoms *pdba; t_atoms atoms; @@ -564,11 +564,11 @@ int main(int argc,char *argv[]) nx,ny,nz,odist,hdist); fprintf(fp,"REMARK Density of this crystal is %g (g/l)\n", density(pdba,boxje)); - write_pdbfile(fp,bromacs(),pdba,xx,boxje,' ',-1); + write_pdbfile(fp,bromacs(quote,255),pdba,xx,boxje,' ',-1); fclose(fp); } else { - write_sto_conf(fn,bromacs(),pdba,xx,NULL,boxje); + write_sto_conf(fn,bromacs(quote,255),pdba,xx,NULL,boxje); } if (ftp2bSet(efTRN,NFILE,fnm)) diff --git a/src/contrib/mkyaw.c b/src/contrib/mkyaw.c index de62921ae2..9468811f31 100644 --- a/src/contrib/mkyaw.c +++ b/src/contrib/mkyaw.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_mkyaw_c = "$Id$"; + #include #include #include diff --git a/src/contrib/my_dssp.c b/src/contrib/my_dssp.c index 79e4ba1b71..37320b0156 100644 --- a/src/contrib/my_dssp.c +++ b/src/contrib/my_dssp.c @@ -29,6 +29,6 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_my_dssp_c = "$Id$"; + #define MY_DSSP #include "../tools/do_dssp.c" diff --git a/src/contrib/options.c b/src/contrib/options.c index d274c2ed2c..d1cb3b2f3a 100644 --- a/src/contrib/options.c +++ b/src/contrib/options.c @@ -33,7 +33,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_options_c = "$Id$"; + #include "typedefs.h" #include "macros.h" diff --git a/src/contrib/optwat.c b/src/contrib/optwat.c index 6bc3d4ec51..cace113dcf 100644 --- a/src/contrib/optwat.c +++ b/src/contrib/optwat.c @@ -29,7 +29,8 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_optwat_c = "$Id$"; + +#include #include "typedefs.h" #include "smalloc.h" #include "vec.h" @@ -70,21 +71,20 @@ void get_results(char *enx,real P[],real *epot,int pindex,int eindex) char **nms=NULL; int nre,step,ndr,i; real t; - t_energy *ener; + t_enxframe fr; fp_ene = open_enx(enx,"r"); do_enxnms(fp_ene,&nre,&nms); - snew(ener,nre); /* Read until the last frame */ - while (do_enx(fp_ene,&t,&step,&nre,ener,&ndr,NULL)); + while (do_enx(fp_ene,&fr)); close_enx(fp_ene); - *epot = ener[eindex].e; + *epot = fr.ener[eindex].e; for(i=pindex; (i #include #include "typedefs.h" diff --git a/src/contrib/test.c b/src/contrib/test.c index 7103034aba..716e7aa0d0 100644 --- a/src/contrib/test.c +++ b/src/contrib/test.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_test_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/gmxlib/3dview.c b/src/gmxlib/3dview.c index 212d055fad..389b5cede5 100644 --- a/src/gmxlib/3dview.c +++ b/src/gmxlib/3dview.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_3dview_c = "$Id$"; + #include #include "sysstuff.h" #include "smalloc.h" @@ -226,39 +226,31 @@ bool zoom_3d(t_3dview *view,real fac) return TRUE; } -void rotate_3d(t_3dview *view,int axis,bool bPositive) +void init_rotate_3d(t_3dview *view) { - static bool bFirst=TRUE; - static mat4 RotP[DIM]; - static mat4 RotM[DIM]; - int i,j; - mat4 m4; - - if (bFirst) { - real rot=DEG2RAD*15; - - for(i=0; (iRotP[i]); + rotate(i,(real)(-rot),view->RotM[i]); #ifdef DEBUG - print_m4(debug,"RotP",RotP[i]); - print_m4(debug,"RotM",RotM[i]); + print_m4(debug,"RotP",view->RotP[i]); + print_m4(debug,"RotM",view->RotM[i]); #endif - } } +} + + +void rotate_3d(t_3dview *view,int axis,bool bPositive) +{ + int i,j; + mat4 m4; - /* - if (bPositive) - m4_op(RotP[axis],view->eye,v4); - else - m4_op(RotM[axis],view->eye,v4); - for(i=0; (ieye[i]=v4[i]; - */ if (bPositive) - mult_matrix(m4,view->Rot,RotP[axis]); + mult_matrix(m4,view->Rot,view->RotP[axis]); else - mult_matrix(m4,view->Rot,RotM[axis]); + mult_matrix(m4,view->Rot,view->RotM[axis]); for(i=0; (iRot[i][j]=m4[i][j]; @@ -295,6 +287,8 @@ void reset_view(t_3dview *view) /* Initiate the matrix */ unity_m4(view->Rot); calculate_view(view); + + init_rotate_3d(view); } t_3dview *init_view(matrix box) diff --git a/src/gmxlib/Makefile.am b/src/gmxlib/Makefile.am index 66aa4d476f..065319fd98 100644 --- a/src/gmxlib/Makefile.am +++ b/src/gmxlib/Makefile.am @@ -13,13 +13,13 @@ libgmx@LIBSUFFIX@_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@ libgmx@LIBSUFFIX@_la_SOURCES = \ 3dview.c atomprop.c block_tx.c bondfree.c \ - buffer.c calcgrid.c calch.c inner.h \ + calcgrid.c calch.c inner.h \ confio.c copyrite.c disre.c do_fit.c \ enxio.c ewald_util.c fatal.c ffscanf.c \ filenm.c futil.c gbutil.c fnbf.c \ gmxfio.c ifunc.c index.c cinvsqrtdata.c \ invblock.c macros.c orires.c gmx_system_xdr.c \ - main.c maths.c matio.c memdump.c \ + main.c maths.c matio.c \ mshift.c mvdata.c mvxvf.c names.c \ network.c nrama.c nrjac.c nrnb.c \ pargs.c pbc.c pdbio.c princ.c \ @@ -30,7 +30,8 @@ libgmx@LIBSUFFIX@_la_SOURCES = \ trnio.c trxio.c txtdump.c typedefs.c \ viewit.c wgms.c wman.c writeps.c \ xdrd.c xtcio.c xvgr.c replace.h \ - detectcpu.c libxdrf.c vec.c xmlio.c + detectcpu.c libxdrf.c vec.c xmlio.c \ + dihres.c EXTRA_libgmx@LIBSUFFIX@_la_SOURCES = \ x86_sse.s x86_sse2.s x86_3dnow.s inner_altivec.c \ diff --git a/src/gmxlib/atomprop.c b/src/gmxlib/atomprop.c index b3de795380..801f452b48 100644 --- a/src/gmxlib/atomprop.c +++ b/src/gmxlib/atomprop.c @@ -1,7 +1,7 @@ /* * $Id$ * - * This source code is part of + * This source code ispart of * * G R O M A C S * @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_atomprop_c = "$Id$"; + #include #include "sysstuff.h" #include "smalloc.h" diff --git a/src/gmxlib/block_tx.c b/src/gmxlib/block_tx.c index bdaeac683f..b7634d9030 100644 --- a/src/gmxlib/block_tx.c +++ b/src/gmxlib/block_tx.c @@ -29,7 +29,8 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_block_tx_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include "network.h" #include "block_tx.h" #include "fatal.h" diff --git a/src/gmxlib/bondfree.c b/src/gmxlib/bondfree.c index 4ff8cf8da8..5ad46101b5 100644 --- a/src/gmxlib/bondfree.c +++ b/src/gmxlib/bondfree.c @@ -29,12 +29,11 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_bondfree_c = "$Id$"; + #include #include "assert.h" #include "physics.h" #include "vec.h" -#include "vveclib.h" #include "maths.h" #include "txtdump.h" #include "bondf.h" @@ -704,6 +703,8 @@ real pdihs(int nbonds, return vtot; } + + real idihs(int nbonds, t_iatom forceatoms[],t_iparams forceparams[], rvec x[],rvec f[],t_forcerec *fr,t_graph *g, @@ -712,9 +713,13 @@ real idihs(int nbonds, t_fcdata *fcd) { int i,type,ai,aj,ak,al; - real phi,cos_phi,ddphi,sign,vid,vtot; + real phi,phi0,cos_phi,ddphi,sign,vtot; rvec r_ij,r_kj,r_kl,m,n; - + real L1,kk,dp,dp2,kA,kB,pA,pB,dvdl; + + L1 = 1.0-lambda; + dvdl = 0; + vtot = 0.0; for(i=0; (i=M_PI) + dp -= 2*M_PI; + else if(dp<-M_PI) + dp += 2*M_PI; + + dp2 = dp*dp; + + vtot += 0.5*kk*dp2; + ddphi = -kk*dp; + + dvdl += 0.5*(kB-kA)*dp2 + (pA-pB)*kk*dp; - vtot += vid; do_dih_fup(ai,aj,ak,al,(real)(-ddphi),r_ij,r_kj,r_kl,m,n, f,fr,g,x); /* 112 */ /* 217 TOTAL */ @@ -741,9 +769,12 @@ real idihs(int nbonds, ai,aj,ak,al,cos_phi,phi); #endif } + + *dvdlambda += dvdl; return vtot; } + real posres(int nbonds, t_iatom forceatoms[],t_iparams forceparams[], rvec x[],rvec f[],t_forcerec *fr,t_graph *g, @@ -879,6 +910,7 @@ real angresz(int nbonds, lambda,dvdlambda,TRUE); } + real unimplemented(int nbonds, t_iatom forceatoms[],t_iparams forceparams[], rvec x[],rvec f[],t_forcerec *fr,t_graph *g, @@ -905,7 +937,7 @@ real rbdihs(int nbonds, t_mdatoms *md,int ngrp,real egnb[],real egcoul[], t_fcdata *fcd) { - static const real c0=0.0,c1=1.0,c2=2.0,c3=3.0,c4=4.0,c5=5.0; + const real c0=0.0,c1=1.0,c2=2.0,c3=3.0,c4=4.0,c5=5.0; int type,ai,aj,ak,al,i,j; rvec r_ij,r_kj,r_kl,m,n; real parmA[NR_RBDIHS]; diff --git a/src/gmxlib/calcgrid.c b/src/gmxlib/calcgrid.c index cbe6564792..c818c323d5 100644 --- a/src/gmxlib/calcgrid.c +++ b/src/gmxlib/calcgrid.c @@ -29,7 +29,6 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_calcgrid_c = "$Id$"; #include "typedefs.h" #include "smalloc.h" #include "fatal.h" diff --git a/src/gmxlib/calch.c b/src/gmxlib/calch.c index b62b923ac3..96d59fc5c4 100644 --- a/src/gmxlib/calch.c +++ b/src/gmxlib/calch.c @@ -29,7 +29,6 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_calch_c = "$Id$"; #include "macros.h" #include "calch.h" #include "maths.h" diff --git a/src/gmxlib/cinvsqrtdata.c b/src/gmxlib/cinvsqrtdata.c index fe4cd69a1d..7c346e71d1 100644 --- a/src/gmxlib/cinvsqrtdata.c +++ b/src/gmxlib/cinvsqrtdata.c @@ -29,13 +29,14 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_cinvsqrtdata_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ #ifdef HAVE_CONFIG_H #include #endif /* just put something here to avoid empty file warnings */ -int cinvsqrtdata_stub; +const int cinvsqrtdata_stub; #ifdef SOFTWARE_INVSQRT const unsigned int cinvsqrtexptab[256] = { diff --git a/src/gmxlib/confio.c b/src/gmxlib/confio.c index 150b9387f3..f3c1b3ab19 100644 --- a/src/gmxlib/confio.c +++ b/src/gmxlib/confio.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_confio_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -641,7 +641,7 @@ void write_hconf_indexed_p(FILE *out,char *title,t_atoms *atoms, char resnm[6],nm[6],format[100]; int ai,i,resnr,l,vpr; - fprintf (out,"%s\n",(title && title[0])?title:bromacs()); + fprintf (out,"%s\n",(title && title[0])?title:bromacs(format,99)); fprintf (out,"%5d\n",nx); /* build format string for printing, something like "%8.3f" for x and "%8.4f" for v */ @@ -833,7 +833,7 @@ void write_sto_conf(char *outfile, char *title,t_atoms *atoms, void get_stx_coordnum(char *infile,int *natoms) { FILE *in; - int ftp; + int ftp,tpxver,tpxgen; t_trxframe fr; ftp=fn2ftp(infile); @@ -864,7 +864,7 @@ void get_stx_coordnum(char *infile,int *natoms) case efTPR: { t_tpxheader tpx; - read_tpxheader(infile,&tpx); + read_tpxheader(infile,&tpx,TRUE,&tpxver,&tpxgen); *natoms = tpx.natoms; break; } diff --git a/src/gmxlib/copyrite.c b/src/gmxlib/copyrite.c index c1aa61357a..3887c63ea6 100644 --- a/src/gmxlib/copyrite.c +++ b/src/gmxlib/copyrite.c @@ -29,7 +29,16 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_copyrite_c = "$Id$"; + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef USE_THREADS +#include +#endif +/* This file is completely threadsafe - keep it that way! */ + #include #include #include "sysstuff.h" @@ -90,11 +99,16 @@ void pr_difftime(FILE *out,double dt) fprintf(out,"\n"); } + bool be_cool(void) { - static int cool=-1; + int cool=-1; char *envptr; - + + /* Yes, it is bad to check the environment variable every call, + * but we dont call this routine often, and it avoids using + * a mutex for locking the variable... + */ if (cool == -1) { envptr=getenv("IAMCOOL"); @@ -103,6 +117,7 @@ bool be_cool(void) else cool=1; } + return cool; } @@ -113,7 +128,7 @@ void space(FILE *out, int n) void f(char *a){int i;for(i=0;i<(int)strlen(a);i++)a[i]=~a[i]; } -static void sp_print(FILE *out,char *s) +static void sp_print(FILE *out,const char *s) { int slen; @@ -122,7 +137,7 @@ static void sp_print(FILE *out,char *s) fprintf(out,"%s\n",s); } -static void ster_print(FILE *out,char *s) +static void ster_print(FILE *out,const char *s) { int slen; char buf[128]; @@ -133,61 +148,70 @@ static void ster_print(FILE *out,char *s) fprintf(out,"%s\n",buf); } -static int nran=0; -static char *pukeit(char *db,char *defstring) +static char *pukeit(char *db,char *defstring, char *retstring, int retsize, int *cqnum) { - static char hulp[STRLEN]; FILE *fp; char **help; int i,nhlp; int seed; - + if (!be_cool()) return defstring; else if ((fp = low_libopen(db,FALSE)) != NULL) { nhlp=fget_lines(fp,&help); fclose(fp); seed=time(NULL); - nran=nhlp*rando(&seed); - if (strlen(help[nran]) >= STRLEN) - help[nran][STRLEN-1] = '\0'; - strcpy(hulp,help[nran]); - f(hulp); + *cqnum=nhlp*rando(&seed); + if (strlen(help[*cqnum]) >= STRLEN) + help[*cqnum][STRLEN-1] = '\0'; + strncpy(retstring,help[*cqnum],retsize); + f(retstring); for(i=0; (i #endif /* just put something here to avoid empty file warnings */ -int crecipdata_stub; +const int crecipdata_stub; #ifdef SOFTWARE_RECIP const unsigned int crecipexptab[256] = { diff --git a/src/gmxlib/debugb.h b/src/gmxlib/debugb.h index ccae402956..c83a958a6c 100644 --- a/src/gmxlib/debugb.h +++ b/src/gmxlib/debugb.h @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_debugb_h = "$Id$"; + #ifndef DEBUG #define DEBUG_BOND(log,x,ai,aj,dx,dr2,dr,bondparams,delta_r,vbond,fbond,fij) #define DEBUG_ANGLE_UPD(log,f_i,f_j,f_k) diff --git a/src/gmxlib/detectcpu.c b/src/gmxlib/detectcpu.c index efd0b5db80..1a56699dc0 100644 --- a/src/gmxlib/detectcpu.c +++ b/src/gmxlib/detectcpu.c @@ -29,15 +29,30 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_detectcpu_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif + +/* This file is completely threadsafe - keep it that way! */ + +#ifdef USE_THREADS +#include +#endif + #include #include #include +/* This file uses some global variables to catch illegal instruction + * signals from the operating system. To make it thread-safe, we use + * a global mutex which is locked immediately when the detect_cpu() + * routine is called (if we use threads). Do NOT call any of the + * lower-level CPU detection routines directly, since these do not + * lock the mutex. + */ + #if (defined USE_X86_SSE_AND_3DNOW || defined USE_X86_SSE2 || defined USE_PPC_ALTIVEC) /* We use some special posix-style long jumps in @@ -52,8 +67,10 @@ static char *SRCID_detectcpu_c = "$Id$"; * be clobbered by the longjmp. We get rid of this * warning by making them global... */ -static int cpuSSE,cpuSSE2,cpu3DNow,doSSE,doSSE2,do3DNow,cpuflags; -static int cpuAltivec; + +#ifdef USE_THREADS +static pthread_mutex_t detectcpu_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif static jmp_buf mainloop; static int success=1; @@ -85,7 +102,8 @@ static int detect_altivec(FILE *log) * to perform the extensive tests like for x86 to recommend * users to upgrade. Just check if an instruction works! */ - cpuflags=cpuAltivec=0; + int cpuAltivec=0; + int cpuflags=0; /* if we got here, its ppc! */ cpuflags |= PPC_CPU; @@ -117,11 +135,8 @@ static int detect_altivec(FILE *log) static int detect_sse2(FILE *log) { unsigned long eax,ebx,ecx,edx; + int cpuflags=0; - cpuSSE2=doSSE2=cpuflags=0; - - if(log) - fprintf(log,"\nTesting x86 processor CPUID...\n"); /* start by trying to issue the cpuid instruction */ success=1; signal(SIGILL,sigill_handler); @@ -139,14 +154,12 @@ static int detect_sse2(FILE *log) /* for SSE support, bit 25 of edx should be set */ x86_cpuid(1,&eax,&ebx,&ecx,&edx); if(edx & FLAGS_SUPPORT_SSE2) { - cpuSSE2=1; cpuflags |= CPU_SSE2_SUPPORT;/* CPU ok, but OS might not be */ /* try it */ success=1; setjmp(mainloop); /* return to this point if we get SIGILL */ if(success) { checksse2(); - doSSE2=1; cpuflags |= X86_SSE2_SUPPORT; } } @@ -160,10 +173,8 @@ static int detect_sse(FILE *log) { unsigned long eax,ebx,ecx,edx; - cpuSSE=doSSE=cpuflags=0; + int cpuflags=0; - if(log) - fprintf(log,"\nTesting x86 processor CPUID...\n"); /* start by trying to issue the cpuid instruction */ success=1; signal(SIGILL,sigill_handler); @@ -181,14 +192,12 @@ static int detect_sse(FILE *log) /* for SSE support, bit 25 of edx should be set */ x86_cpuid(1,&eax,&ebx,&ecx,&edx); if(edx & FLAGS_SUPPORT_SSE) { - cpuSSE=1; cpuflags |= CPU_SSE_SUPPORT;/* CPU ok, but OS might not be */ /* try it */ success=1; setjmp(mainloop); /* return to this point if we get SIGILL */ if(success) { checksse(); - doSSE=1; cpuflags |= X86_SSE_SUPPORT; } } @@ -200,10 +209,8 @@ static int detect_3dnow(FILE *log) { unsigned long eax,ebx,ecx,edx; - cpu3DNow=do3DNow=cpuflags=0; + int cpuflags=0; - if(log) - fprintf(log,"\nTesting x86 processor CPUID...\n"); /* start by trying to issue the cpuid instruction */ success=1; signal(SIGILL,sigill_handler); @@ -224,13 +231,11 @@ static int detect_3dnow(FILE *log) if(eax>=0x80000001) { x86_cpuid(0x80000001,&eax,&ebx,&ecx,&edx); if(edx & FLAGS_SUPPORT_EXT_3DNOW) { - cpu3DNow=1; /* try it */ success=1; setjmp(mainloop); /* return to this point if we get SIGILL */ if(success) { check3dnow(); - do3DNow=1; cpuflags |= X86_3DNOW_SUPPORT; } } @@ -244,7 +249,42 @@ static int detect_3dnow(FILE *log) #if (defined USE_X86_SSE_AND_3DNOW || defined USE_X86_SSE2) static int detect_x86(FILE *log) { - cpuflags=0; + unsigned long eax,ebx,ecx,edx; + + int cpuflags=0; + + /* First we check if this is an Intel or AMD cpu */ + if(log) + fprintf(log,"\nTesting x86 processor CPUID...\n"); + /* start by trying to issue the cpuid instruction */ + success=1; + signal(SIGILL,sigill_handler); + setjmp(mainloop); /* return to this point if we get SIGILL */ + + if(success) + x86_cpuid(0,&eax,&ebx,&ecx,&edx); + else if(log) + fprintf(log,"This CPU doesn't support CPUID.\n"); + + if(eax>0) { + cpuflags |= X86_CPU; + } else { + if(log) + fprintf(log,"Didn't recognize this as an x86-type CPU.\n"); + return cpuflags; + } + + if(ebx==VENDOR_INTEL) { + if(log) + fprintf(log,"CPU manufactured by Intel.\n"); + cpuflags |= INTEL_CPU; + } + else if(ebx==VENDOR_AMD) { + if(log) + fprintf(log,"CPU manufactured by AMD.\n"); + cpuflags |= AMD_CPU; + } + #ifdef USE_X86_SSE2 /* For double precision we need SSE2 */ cpuflags=detect_sse2(log); @@ -298,10 +338,17 @@ static int detect_x86(FILE *log) } #endif -int detect_cpu(FILE *log) + +int +detect_cpu(FILE *log) { int cpuflags=0; + /* Use a global lock for all CPU detection */ +#ifdef USE_THREADS + pthread_mutex_lock(&detectcpu_mutex); +#endif + #ifdef USE_PPC_ALTIVEC cpuflags=detect_altivec(log); #elif (defined USE_X86_SSE_AND_3DNOW || defined USE_X86_SSE2) @@ -311,6 +358,12 @@ int detect_cpu(FILE *log) fprintf(log,"Not checking cpu support for SSE/SSE2/3DNow/Altivec\n"); cpuflags=UNKNOWN_CPU; #endif + + /* release lock */ +#ifdef USE_THREADS + pthread_mutex_unlock(&detectcpu_mutex); +#endif + if (getenv("NOASSEMBLYLOOPS") != NULL) { cpuflags &= (~X86_SSE_SUPPORT) & (~X86_SSE2_SUPPORT) & (~X86_3DNOW_SUPPORT) & (~PPC_ALTIVEC_SUPPORT); @@ -319,7 +372,11 @@ int detect_cpu(FILE *log) "Found environment variable NOASSEMBLYLOOPS.\n" "Disabling all SSE/SSE2/3DNow/Altivec support.\n"); } + return cpuflags; } #endif /* detectcpu */ + + + diff --git a/src/gmxlib/disre.c b/src/gmxlib/disre.c index 8c9ddd6dbd..918f1840fd 100644 --- a/src/gmxlib/disre.c +++ b/src/gmxlib/disre.c @@ -29,7 +29,9 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_disre_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "typedefs.h" #include "sysstuff.h" @@ -174,8 +176,8 @@ real ta_disres(int nfa,t_iatom forceatoms[],t_iparams ip[], t_mdatoms *md,int ngrp,real egnb[],real egcoul[], t_fcdata *fcd) { - static real sixth=1.0/6.0; - static real seven_three=7.0/3.0; + const real sixth=1.0/6.0; + const real seven_three=7.0/3.0; atom_id ai,aj; int fa,res,npairs,p,pair,ki,kj,m; diff --git a/src/gmxlib/dlb.h b/src/gmxlib/dlb.h index ee83ce7379..b96c85963d 100644 --- a/src/gmxlib/dlb.h +++ b/src/gmxlib/dlb.h @@ -33,10 +33,6 @@ #ifndef _dlb_h #define _dlb_h -static char *SRCID_dlb_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) dlb.h 1.3 31 Jan 1995" -#endif /* HAVE_IDENT */ #include "typedefs.h" extern void count_nb(t_commrec *cr,t_nsborder *nsb,t_block *cgs,int nns, diff --git a/src/gmxlib/do_fit.c b/src/gmxlib/do_fit.c index 1aed63324b..a3e1c934f9 100644 --- a/src/gmxlib/do_fit.c +++ b/src/gmxlib/do_fit.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_do_fit_c = "$Id$"; + #include "maths.h" #include "sysstuff.h" #include "typedefs.h" @@ -94,22 +94,20 @@ real rhodev(int natoms,real mass[],rvec x[],rvec xp[]) void calc_fit_R(int natoms,real *w_rls,rvec *xp,rvec *x,matrix R) { int c,r,n,j,m,i,irot; - static double **omega=NULL,**om=NULL; + double **omega,**om; double d[2*DIM],xnr,xpc; matrix vh,vk,u; real mn; int index; real max_d; - if (omega == NULL) { - snew(omega,2*DIM); - snew(om,2*DIM); - for(i=0; i<2*DIM; i++) { - snew(omega[i],2*DIM); - snew(om[i],2*DIM); - } + snew(omega,2*DIM); + snew(om,2*DIM); + for(i=0; i<2*DIM; i++) { + snew(omega[i],2*DIM); + snew(om[i],2*DIM); } - + for(i=0; i<2*DIM; i++) { d[i]=0; for(j=0; j<2*DIM; j++) { @@ -182,6 +180,13 @@ void calc_fit_R(int natoms,real *w_rls,rvec *xp,rvec *x,matrix R) R[r][c] = vk[0][r]*vh[0][c] + vk[1][r]*vh[1][c] + vk[2][r]*vh[2][c]; + + for(i=0; i<2*DIM; i++) { + sfree(omega[i]); + sfree(om[i]); + } + sfree(omega); + sfree(om); } void do_fit(int natoms,real *w_rls,rvec *xp,rvec *x) diff --git a/src/gmxlib/enxio.c b/src/gmxlib/enxio.c index f68722d9f0..4dad5845fd 100644 --- a/src/gmxlib/enxio.c +++ b/src/gmxlib/enxio.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_enxio_c = "$Id$"; + #include "futil.h" #include "string2.h" #include "fatal.h" diff --git a/src/gmxlib/ewald_util.c b/src/gmxlib/ewald_util.c index b5254ece51..e78b0d6aa0 100644 --- a/src/gmxlib/ewald_util.c +++ b/src/gmxlib/ewald_util.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_ewald_util_c = "$Id$"; + #include #include #include "assert.h" @@ -78,9 +78,7 @@ real ewald_LRcorrection(FILE *fp,t_nsborder *nsb,t_commrec *cr,t_forcerec *fr, matrix box,rvec mu_tot,real qsum, int ewald_geometry, real epsilon_surface,matrix lr_vir) { - static bool bFirst=TRUE; - static real Vself; - + real Vself; int i,i1,i2,j,k,m,iv,jv; atom_id *AA; double q2sum; /* Necessary for precision */ diff --git a/src/gmxlib/f77_wrappers.c b/src/gmxlib/f77_wrappers.c index c749980e66..4291569969 100644 --- a/src/gmxlib/f77_wrappers.c +++ b/src/gmxlib/f77_wrappers.c @@ -29,7 +29,8 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_f77_wrappers_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/gmxlib/fatal.c b/src/gmxlib/fatal.c index 3519d7c60e..53d922b305 100644 --- a/src/gmxlib/fatal.c +++ b/src/gmxlib/fatal.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_fatal_c = "$Id$"; + #include #include #include @@ -44,6 +44,7 @@ static char *SRCID_fatal_c = "$Id$"; #include "string2.h" #include "smalloc.h" + static bool bDebug = FALSE; static char *fatal_tmp_file = NULL; diff --git a/src/gmxlib/ffscanf.c b/src/gmxlib/ffscanf.c index c0f5810c03..9a6f773d86 100644 --- a/src/gmxlib/ffscanf.c +++ b/src/gmxlib/ffscanf.c @@ -29,7 +29,14 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_ffscanf_c = "$Id$"; + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* This file is completely threadsafe - keep it that way! */ + + #include #include #include "typedefs.h" diff --git a/src/gmxlib/filenm.c b/src/gmxlib/filenm.c index 0a09b06b64..4d3ed7239c 100644 --- a/src/gmxlib/filenm.c +++ b/src/gmxlib/filenm.c @@ -29,7 +29,7 @@ * And Hey: * S C A M O R G */ -static char *SRCID_filenm_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -63,28 +63,28 @@ enum { eftASC, eftBIN, eftXDR, eftGEN, eftNR }; /* To support multiple file types with one general (eg TRX) we have * these arrays. */ -static int trxs[]={ +static const int trxs[]={ #ifdef USE_XDR efXTC, efTRR, #endif efTRJ, efGRO, efG96, efPDB, efG87 }; #define NTRXS asize(trxs) -static int trns[]={ +static const int trns[]={ #ifdef USE_XDR efTRR, #endif efTRJ }; #define NTRNS asize(trns) -static int stos[]={ efGRO, efG96, efPDB, efBRK, +static const int stos[]={ efGRO, efG96, efPDB, efBRK, #ifdef HAVE_XML efXML, #endif efENT}; #define NSTOS asize(stos) -static int stxs[]={ efGRO, efG96, efPDB, efBRK, efENT, +static const int stxs[]={ efGRO, efG96, efPDB, efBRK, efENT, #ifdef USE_XDR efTPR, #endif @@ -95,14 +95,14 @@ static int stxs[]={ efGRO, efG96, efPDB, efBRK, efENT, }; #define NSTXS asize(stxs) -static int enxs[]={ +static const int enxs[]={ #ifdef USE_XDR efEDR, #endif efENE }; #define NENXS asize(enxs) -static int tpxs[]={ +static const int tpxs[]={ #ifdef USE_XDR efTPR, #endif @@ -113,7 +113,7 @@ static int tpxs[]={ }; #define NTPXS asize(tpxs) -static int tpss[]={ +static const int tpss[]={ #ifdef USE_XDR efTPR, #endif @@ -129,10 +129,11 @@ typedef struct { char *ext; char *defnm; char *defopt; - char *descr; + const char *descr; int ntps; - int *tps; + const int *tps; } t_deffile; + /* this array should correspond to the enum in include/types/filenm.h */ static t_deffile deffile[efNR] = { @@ -190,9 +191,9 @@ static t_deffile deffile[efNR] = { static char *default_file_name=NULL; #define NZEXT 2 -char *z_ext[NZEXT] = { ".gz", ".Z" }; +const char *z_ext[NZEXT] = { ".gz", ".Z" }; -void set_default_file_name(char *name) +void set_default_file_name(const char *name) { int i; @@ -202,7 +203,7 @@ void set_default_file_name(char *name) deffile[i].defnm = default_file_name; } -char *ftp2ext(int ftp) +const char *ftp2ext(int ftp) { if ((0 <= ftp) && (ftp < efNR)) return deffile[ftp].ext+1; @@ -210,7 +211,7 @@ char *ftp2ext(int ftp) return "unknown"; } -char *ftp2desc(int ftp) +const char *ftp2desc(int ftp) { if ((0 <= ftp) && (ftp < efNR)) return deffile[ftp].descr; @@ -218,7 +219,7 @@ char *ftp2desc(int ftp) return "unknown filetype"; } -char *ftp2ftype(int ftp) +const char *ftp2ftype(int ftp) { if ((ftp >= 0) && (ftp < efNR)) { switch (deffile[ftp].ftype) { @@ -234,7 +235,7 @@ char *ftp2ftype(int ftp) return "unknown"; } -char *ftp2defnm(int ftp) +const char *ftp2defnm(int ftp) { static char buf[256]; @@ -248,7 +249,8 @@ char *ftp2defnm(int ftp) void pr_def(FILE *fp,int ftp) { t_deffile *df; - char *s=NULL,*ext,*desc,*flst; + char *s=NULL,*flst; + const char *ext,*desc; df=&(deffile[ftp]); /* find default file extension and \tt-ify description */ @@ -304,7 +306,7 @@ void pr_fns(FILE *fp,int nf,t_filenm tfn[]) for(i=0; (iftp].ntps; ftps = deffile[fnm->ftp].tps; @@ -705,7 +707,7 @@ char *ftp2fn_null(int ftp,int nfile,t_filenm fnm[]) return NULL; } -static void add_filters(char *filter,int *n,int nf,int ftp[]) +static void add_filters(char *filter,int *n,int nf,const int ftp[]) { char buf[8]; int i; diff --git a/src/gmxlib/fnbf.c b/src/gmxlib/fnbf.c index 91310c5834..4126ca3eb5 100644 --- a/src/gmxlib/fnbf.c +++ b/src/gmxlib/fnbf.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_fnbf_c = "$Id$"; + #ifdef USE_THREADS #include /* must come first! */ @@ -1011,7 +1011,7 @@ real do_14(int nbonds,t_iatom iatoms[],t_iparams *iparams, if (nbfp14 == NULL) { nbfp14 = mk_14parm(fr->ntype,nbonds,iatoms,iparams,md->typeA); if (debug) - pr_rvec(debug,0,"nbfp14",nbfp14,sqr(fr->ntype)); + pr_rvec(debug,0,"nbfp14",nbfp14,sqr(fr->ntype),TRUE); } shift14 = CENTRAL; diff --git a/src/gmxlib/four1.c b/src/gmxlib/four1.c index 737b81e25c..4298ad6302 100644 --- a/src/gmxlib/four1.c +++ b/src/gmxlib/four1.c @@ -29,7 +29,9 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_four1_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "typedefs.h" diff --git a/src/gmxlib/fourn.c b/src/gmxlib/fourn.c index 7d56f88dba..c4f611e414 100644 --- a/src/gmxlib/fourn.c +++ b/src/gmxlib/fourn.c @@ -29,7 +29,8 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_fourn_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ #include #include "typedefs.h" #include "nr.h" diff --git a/src/gmxlib/ftocstr.c b/src/gmxlib/ftocstr.c index 491a214a99..09d562bf57 100644 --- a/src/gmxlib/ftocstr.c +++ b/src/gmxlib/ftocstr.c @@ -29,7 +29,8 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_ftocstr_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + int ftocstr(char *ds, int dl, char *ss, int sl) /* dst, src ptrs */ /* dst max len */ diff --git a/src/gmxlib/futil.c b/src/gmxlib/futil.c index 9a079a8d1c..544468d000 100644 --- a/src/gmxlib/futil.c +++ b/src/gmxlib/futil.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_futil_c = "$Id$"; + #include #include #include @@ -193,7 +193,7 @@ FILE *gunzip(char *fn,char *mode) return fp; } -bool fexist(char *fname) +bool fexist(const char *fname) { FILE *test; @@ -222,7 +222,7 @@ bool eof(FILE *fp) } } -char *backup_fn(char *file) +char *backup_fn(const char *file) { /* Use a reasonably low value for countmax; we might * generate 4-5 files in each round, and we dont @@ -264,7 +264,7 @@ char *backup_fn(char *file) return buf; } -bool make_backup(char * name) +bool make_backup(const char * name) { char * backup; @@ -281,7 +281,7 @@ bool make_backup(char * name) return TRUE; } -FILE *ffopen(char *file,char *mode) +FILE *ffopen(const char *file,char *mode) { FILE *ff=NULL; char buf[256],*bf,*bufsize=0,*ptr; diff --git a/src/gmxlib/gbutil.c b/src/gmxlib/gbutil.c index 5394fac712..a7b1995612 100644 --- a/src/gmxlib/gbutil.c +++ b/src/gmxlib/gbutil.c @@ -29,7 +29,8 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_gbutil_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include #include "macros.h" #include "vec.h" diff --git a/src/gmxlib/gmxfio.c b/src/gmxlib/gmxfio.c index 754da74e49..e460dee6db 100644 --- a/src/gmxlib/gmxfio.c +++ b/src/gmxlib/gmxfio.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_gmxfio_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -59,14 +59,14 @@ typedef struct { } t_fileio; /* These simple lists define the I/O type for these files */ -static int ftpXDR[] = { efTPR, efTRR, efEDR, efXTC }; -static int ftpASC[] = { efTPA, efGRO, efPDB }; -static int ftpBIN[] = { efTPB, efTRJ, efMTX, efENE }; +static const int ftpXDR[] = { efTPR, efTRR, efEDR, efXTC }; +static const int ftpASC[] = { efTPA, efGRO, efPDB }; +static const int ftpBIN[] = { efTPB, efTRJ, efMTX, efENE }; #ifdef HAVE_XML -static int ftpXML[] = { efXML }; +static const int ftpXML[] = { efXML }; #endif -bool in_ftpset(int ftp,int nset,int set[]) +bool in_ftpset(int ftp,int nset,const int set[]) { int i; bool bResult; diff --git a/src/gmxlib/ifunc.c b/src/gmxlib/ifunc.c index af9fd638bf..bef63e9b0c 100644 --- a/src/gmxlib/ifunc.c +++ b/src/gmxlib/ifunc.c @@ -29,10 +29,12 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_ifunc_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include "typedefs.h" #include "bondf.h" #include "disre.h" +#include "dihre.h" #include "orires.h" #define def_bonded(str,lstr,nra,nrpa,nrpb,ind,func)\ @@ -66,44 +68,48 @@ static char *SRCID_ifunc_c = "$Id$"; {str,lstr, 0, 0, 0,IF_NULL, -1,unimplemented} /* this MUST correspond to the enum in include/types/idef.h */ -t_interaction_function interaction_function[F_NRE]= +const t_interaction_function interaction_function[F_NRE]= { - def_bond ("BONDS", "Bond", 2, 2, 2, eNR_BONDS, bonds ), - def_bond ("G96BONDS", "G96Bond", 2, 2, 2, eNR_BONDS, g96bonds ), - def_bond ("MORSE", "Morse", 2, 3, 0, eNR_MORSE, morsebonds), + def_bond ("BONDS", "Bond", 2, 2, 2, eNR_BONDS, bonds ), + def_bond ("G96BONDS", "G96Bond", 2, 2, 2, eNR_BONDS, g96bonds ), + def_bond ("MORSE", "Morse", 2, 3, 0, eNR_MORSE, morsebonds ), def_bond ("CUBICBONDS","Cubic Bonds", 2, 3, 0, eNR_CUBICBONDS, cubicbonds), - def_bondnb ("CONNBONDS","Connect Bonds", 2, 0, 0, 0, unimplemented), - def_bondedg("HARMONIC", "Harmonic Pot.", 2, 2, 2, eNR_BONDS, bonds ), - def_angle ("ANGLES", "Angle", 3, 2, 2, eNR_ANGLES, angles ), - def_angle ("G96ANGLES","G96Angle", 3, 2, 2, eNR_ANGLES, g96angles), - def_bonded ("PDIHS", "Proper Dih.", 4, 3, 3, eNR_PROPER, pdihs ), - def_bonded ("RBDIHS", "Ryckaert-Bell.", 4, 6, 6, eNR_RB, rbdihs ), - def_bonded ("IDIHS", "Improper Dih.", 4, 2, 2, eNR_IMPROPER,idihs ), - def_bonded ("LJ14", "LJ-14", 2, 2, 2, eNR_INL1100, do_14 ), - def_nofc ("COUL14", "Coulomb-14" ), - def_nb ("LJ", "LJ (SR)", 2, 2 ), - def_nb ("BHAM", "BuckingHam", 2, 3 ), - def_nofc ("LJLR", "LJ (LR)" ), - def_nofc ("DISPCORR", "Disper. corr." ), - def_nofc ("SR", "Coulomb (SR)" ), - def_nofc ("LR", "Coulomb (LR)" ), - def_bonded ("WATERPOL", "Water Pol.", 1, 6, 0, eNR_WPOL, water_pol), - def_bonded ("POSRES", "Position Rest.", 1, 3, 0, eNR_POSRES, posres ), - def_bondedg("DISRES", "Dis. Rest.", 2, 6, 0, eNR_DISRES, ta_disres), - def_nofc ("DRVIOL", "D. R. Viol. (nm)" ), - def_bondedg("ORIRES", "Orient. Rest.", 2, 6, 0, eNR_ORIRES, orires ), - def_nofc ("ORDEV", "Ori. R. RMSD" ), - def_bondedg("ANGRES", "Angle Rest.", 4, 3, 3, eNR_ANGRES, angres ), - def_bondedg("ANGRESZ", "Angle Rest. Z", 2, 3, 3, eNR_ANGRESZ,angresz ), - def_shkcb ("CONSTR", "Constraint", 2, 1, 1 ), - def_shk ("CONSTRNC", "Constr. No Conn.",2, 1, 1 ), - def_shkcb ("SETTLE", "Settle", 1, 2, 0 ), - def_dummy ("DUMMY2", "Dummy2", 3, 1 ), - def_dummy ("DUMMY3", "Dummy3", 4, 2 ), - def_dummy ("DUMMY3FD", "Dummy3fd", 4, 2 ), - def_dummy ("DUMMY3FAD","Dummy3fad", 4, 2 ), - def_dummy ("DUMMY3OUT","Dummy3out", 4, 3 ), - def_dummy ("DUMMY4FD", "Dummy4fd", 5, 3 ), + def_bondnb ("CONNBONDS","Connect Bonds", 2, 0, 0, 0, unimplemented ), + def_bondedg("HARMONIC", "Harmonic Pot.", 2, 2, 2, eNR_BONDS, bonds ), + def_angle ("ANGLES", "Angle", 3, 2, 2, eNR_ANGLES, angles ), + def_angle ("G96ANGLES","G96Angle", 3, 2, 2, eNR_ANGLES, g96angles ), + def_bonded ("PDIHS", "Proper Dih.", 4, 3, 3, eNR_PROPER, pdihs ), + def_bonded ("RBDIHS", "Ryckaert-Bell.", 4, 6, 6, eNR_RB, rbdihs ), + def_bonded ("FOURDIHS", "Fourier Dih.", 4, 4, 4, eNR_FOURDIH, rbdihs ), + def_bonded ("IDIHS", "Improper Dih.", 4, 2, 2, eNR_IMPROPER,idihs ), + def_bonded ("PIDIHS", "Improper Dih.", 4, 3, 3, eNR_PROPER, pdihs ), + def_bonded ("LJ14", "LJ-14", 2, 2, 2, eNR_INL1100, do_14 ), + def_nofc ("COUL14", "Coulomb-14" ), + def_nb ("LJ", "LJ (SR)", 2, 2 ), + def_nb ("BHAM", "BuckingHam", 2, 3 ), + def_nofc ("LJLR", "LJ (LR)" ), + def_nofc ("DISPCORR", "Disper. corr." ), + def_nofc ("SR", "Coulomb (SR)" ), + def_nofc ("LR", "Coulomb (LR)" ), + def_bonded ("WATERPOL", "Water Pol.", 1, 6, 0, eNR_WPOL, water_pol ), + def_bonded ("POSRES", "Position Rest.", 1, 3, 0, eNR_POSRES, posres ), + def_bondedg("DISRES", "Dis. Rest.", 2, 6, 0, eNR_DISRES, ta_disres ), + def_nofc ("DRVIOL", "D. R. Viol. (nm)" ), + def_bondedg("ORIRES", "Orient. Rest.", 2, 6, 0, eNR_ORIRES, orires ), + def_nofc ("ORDEV", "Ori. R. RMSD" ), + def_bondedg("ANGRES", "Angle Rest.", 4, 3, 3, eNR_ANGRES, angres ), + def_bondedg("ANGRESZ", "Angle Rest. Z", 2, 3, 3, eNR_ANGRESZ,angresz ), + def_bondedg("DIHRES", "Dih. Rest.", 4, 5, 0, eNR_DIHRES, ta_dihres ), + def_nofc ("DIHVIOL", "Dih. Rest. viol." ), + def_shkcb ("CONSTR", "Constraint", 2, 1, 1 ), + def_shk ("CONSTRNC", "Constr. No Conn.",2, 1, 1 ), + def_shkcb ("SETTLE", "Settle", 1, 2, 0 ), + def_dummy ("DUMMY2", "Dummy2", 3, 1 ), + def_dummy ("DUMMY3", "Dummy3", 4, 2 ), + def_dummy ("DUMMY3FD", "Dummy3fd", 4, 2 ), + def_dummy ("DUMMY3FAD","Dummy3fad", 4, 2 ), + def_dummy ("DUMMY3OUT","Dummy3out", 4, 3 ), + def_dummy ("DUMMY4FD", "Dummy4fd", 5, 3 ), def_nofc ("EQM", "Quantum En." ), def_nofc ("EPOT", "Potential" ), def_nofc ("EKIN", "Kinetic En." ), diff --git a/src/gmxlib/index.c b/src/gmxlib/index.c index 37f3afd2d8..b45d6f9bb8 100644 --- a/src/gmxlib/index.c +++ b/src/gmxlib/index.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_index_c = "$Id$"; + #include #include #include "sysstuff.h" @@ -46,9 +46,9 @@ static char *SRCID_index_c = "$Id$"; #include "smalloc.h" typedef enum { etOther, etProt, etDNA, erestNR } eRestp; -static char *ResTP[erestNR] = { "OTHER", "PROTEIN", "DNA" }; +static const char *ResTP[erestNR] = { "OTHER", "PROTEIN", "DNA" }; -static char *Sugars[] = { "A", "T", "G", "C", "U" }; +static const char *Sugars[] = { "A", "T", "G", "C", "U" }; #define NDNA asize(Sugars) static bool yn(bool bASK) @@ -95,7 +95,7 @@ void write_index(char *outf, t_block *b,char **gnames) fclose(out); } -void add_grp(t_block *b,char ***gnames,int nra,atom_id a[],char *name) +void add_grp(t_block *b,char ***gnames,int nra,atom_id a[],const char *name) { int i; @@ -242,35 +242,35 @@ static void analyse_prot(eRestp restp[],t_atoms *atoms, t_block *gb,char ***gn,bool bASK,bool bVerb) { /* atomnames to be used in constructing index groups: */ - static char *pnoh[] = { "H" }; - static char *pnodum[] = { "MN1", "MN2", "MCB1", "MCB2", "MCG1", "MCG2", + const char *pnoh[] = { "H" }; + const char *pnodum[] = { "MN1", "MN2", "MCB1", "MCB2", "MCG1", "MCG2", "MCD1", "MCD2", "MCE1", "MCE2", "MNZ1", "MNZ2" }; - static char *calpha[] = { "CA" }; - static char *bb[] = { "N","CA","C" }; - static char *mc[] = { "N","CA","C","O","O1","O2","OXT" }; - static char *mcb[] = { "N","CA","CB","C","O","O1","O2","OT","OXT" }; - static char *mch[] = { "N","CA","C","O","O1","O2","OT","OXT", + const char *calpha[] = { "CA" }; + const char *bb[] = { "N","CA","C" }; + const char *mc[] = { "N","CA","C","O","O1","O2","OXT" }; + const char *mcb[] = { "N","CA","CB","C","O","O1","O2","OT","OXT" }; + const char *mch[] = { "N","CA","C","O","O1","O2","OT","OXT", "H1","H2","H3","H" }; /* array of arrays of atomnames: */ - static char **chains[] = { NULL,pnoh,calpha,bb,mc,mcb,mch,mch,mch,pnodum }; + const char **chains[] = { NULL,pnoh,calpha,bb,mc,mcb,mch,mch,mch,pnodum }; #define NCH asize(chains) /* array of sizes of arrays of atomnames: */ - static int sizes[NCH] = { + const int sizes[NCH] = { 0, asize(pnoh), asize(calpha), asize(bb), asize(mc), asize(mcb), asize(mch), asize(mch), asize(mch), asize(pnodum) }; /* descriptive names of index groups */ - static char *ch_name[NCH] = { + const char *ch_name[NCH] = { "Protein", "Protein-H", "C-alpha", "Backbone", "MainChain", "MainChain+Cb", "MainChain+H", "SideChain", "SideChain-H", "Prot-Masses" }; /* construct index group containing (TRUE) or excluding (FALSE) given atom names */ - static bool complement[NCH] = { + const bool complement[NCH] = { TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE }; - static int wholename[NCH] = { -1, 0,-1,-1,-1,-1,-1,-1, 11,-1 }; + const int wholename[NCH] = { -1, 0,-1,-1,-1,-1,-1,-1, 11,-1 }; /* the index in wholename gives the first item in the arrays of * atomtypes that should be tested with 'strncasecmp' in stead of * strcasecmp, or -1 if all items should be tested with strcasecmp @@ -279,7 +279,7 @@ static void analyse_prot(eRestp restp[],t_atoms *atoms, */ /* only add index group if it differs from the specified one, specify -1 to always add group */ - static int compareto[NCH] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0 }; + const int compareto[NCH] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0 }; int i,n,j; atom_id *aid; @@ -400,15 +400,11 @@ static void analyse_dna(eRestp restp[],t_atoms *atoms, bool is_protein(char *resnm) { - static bool bRead=FALSE; - static int naa; - static char **aas; + int naa; + char **aas; int i; - if (!bRead) { - naa = get_strings("aminoacids.dat",&aas); - bRead=TRUE; - } + naa = get_strings("aminoacids.dat",&aas); for(i=0; (i #endif diff --git a/src/gmxlib/inner_altivec.c b/src/gmxlib/inner_altivec.c index 17c188313c..1d0410ac61 100644 --- a/src/gmxlib/inner_altivec.c +++ b/src/gmxlib/inner_altivec.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_inner_altivec_c = "$Id$"; + #include #include diff --git a/src/gmxlib/invblock.c b/src/gmxlib/invblock.c index 854e1f30da..ea8664c1c0 100644 --- a/src/gmxlib/invblock.c +++ b/src/gmxlib/invblock.c @@ -29,7 +29,9 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_invblock_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "typedefs.h" #include "smalloc.h" #include "invblock.h" diff --git a/src/gmxlib/libxdrf.c b/src/gmxlib/libxdrf.c index 95d4b347f6..14c3e47d06 100644 --- a/src/gmxlib/libxdrf.c +++ b/src/gmxlib/libxdrf.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_libxdrf_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -42,12 +42,15 @@ static char *SRCID_libxdrf_c = "$Id$"; #include "xdrf.h" #include -#define MAXID 20 + + +#define MAXID 256 static FILE *xdrfiles[MAXID]; static XDR *xdridptr[MAXID]; static char xdrmodes[MAXID]; static unsigned int cnt; + #ifdef USE_FORTRAN typedef void (* F77_FUNC(xdrfproc,XDRFPROC))(int *, void *, int *); diff --git a/src/gmxlib/macros.c b/src/gmxlib/macros.c index 28ece1f0b5..fa67db7c88 100644 --- a/src/gmxlib/macros.c +++ b/src/gmxlib/macros.c @@ -29,15 +29,15 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_macros_c = "$Id$"; + #include "macros.h" -real ZERO = 0.0; -real THIRD = (1.0/3.0); -real HALF = 0.5; -real ONE = 1.0; -real TWO = 2.0; -real THREE = 3.0; -real SIX = 6.0; -real TEN = 10.0; -real TWELVE = 12.0; +const real ZERO = 0.0; +const real THIRD = (1.0/3.0); +const real HALF = 0.5; +const real ONE = 1.0; +const real TWO = 2.0; +const real THREE = 3.0; +const real SIX = 6.0; +const real TEN = 10.0; +const real TWELVE = 12.0; diff --git a/src/gmxlib/main.c b/src/gmxlib/main.c index ee189852d8..9a8967b903 100644 --- a/src/gmxlib/main.c +++ b/src/gmxlib/main.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_main_c = "$Id$"; + #include #include #include @@ -44,6 +44,18 @@ static char *SRCID_main_c = "$Id$"; #define BUFSIZE 1024 + +#ifdef USE_THREADS +/* These are a couple of Global mutex variables that + * we use when writing to log files, so we avoid different + * threads printing to the same file at once. (It wont crash, + * but the print statements would be completely mixed up) + */ +pthread_mutex_t gmx_logfile_mtx = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t gmx_stdout_mtx = PTHREAD_MUTEX_INITIALIZER; + +#endif + FILE *stdlog=NULL; int gmx_parallel=0; @@ -114,13 +126,16 @@ static int get_nodeid(FILE *log,int left,int right,int *nodeid,int *nnodes) return 1; } -char *par_fn(char *base,int ftp,t_commrec *cr) +char *par_fn(char *base,int ftp,t_commrec *cr, char buf[], int bufsize) { - static char buf[256]; + int n; + if(bufsize<(strlen(base)+4)) + fatal_error(0,"Character buffer too small!\n"); + /* Copy to buf, and strip extension */ strcpy(buf,base); - buf[strlen(base)-4] = '\0'; + buf[strlen(buf)-4] = '\0'; /* Add node info */ if (PAR(cr)) @@ -164,7 +179,7 @@ void check_multi_int(FILE *log,t_commrec *mcr,int val,char *name) void open_log(char *lognm,t_commrec *cr) { int len,testlen,pid; - char *buf,*host; + char buf[256],*host; debug_gmx(); @@ -197,7 +212,7 @@ void open_log(char *lognm,t_commrec *cr) debug_gmx(); /* Since log always ends with '.log' let's use this info */ - buf = par_fn(lognm,efLOG,cr); + par_fn(lognm,efLOG,cr,buf,255); stdlog = ffopen(buf,"w"); /* Get some machine parameters */ @@ -258,7 +273,7 @@ t_commrec *init_multisystem(t_commrec *cr,int nfile,t_filenm fnm[]) { t_commrec *mcr; int i,ftp; - char *buf; + char buf[256]; snew(mcr,1); @@ -274,6 +289,19 @@ t_commrec *init_multisystem(t_commrec *cr,int nfile,t_filenm fnm[]) /* Because of possible multiple extensions per type we must look * at the actual file name */ +<<<<<<< main.c + ftp = fn2ftp(fnm[i].fn); + if (ftp != efLOG) { +#ifdef DEBUGPAR + fprintf(stderr,"Old file name: %s",fnm[i].fn); +#endif + par_fn(fnm[i].fn,ftp,mcr,buf,255); + sfree(fnm[i].fn); + fnm[i].fn = strdup(buf); +#ifdef DEBUGPAR + fprintf(stderr,", new: %s\n",fnm[i].fn); +#endif +======= ftp = fn2ftp(fnm[i].fns[0]); if (ftp != efLOG && ftp!= efTPX && ftp != efTPR && ftp != efTPS && ftp!=efTPA && ftp!=efTPB) { /* fprintf(stderr,"Old file name: %s",fnm[i].fns[0]); */ @@ -281,6 +309,7 @@ t_commrec *init_multisystem(t_commrec *cr,int nfile,t_filenm fnm[]) sfree(fnm[i].fns[0]); fnm[i].fns[0] = strdup(buf); /* fprintf(stderr,", new: %s\n",fnm[i].fns[0]); */ +>>>>>>> 1.30 } } diff --git a/src/gmxlib/maths.c b/src/gmxlib/maths.c index 6ec8fc95a1..3a38c9a10a 100644 --- a/src/gmxlib/maths.c +++ b/src/gmxlib/maths.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_maths_c = "$Id$"; + #include #include #include "maths.h" diff --git a/src/gmxlib/matio.c b/src/gmxlib/matio.c index e91cbb9b5c..3a95e88d0f 100644 --- a/src/gmxlib/matio.c +++ b/src/gmxlib/matio.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_matio_c = "$Id$"; + #include #include "sysstuff.h" #include "futil.h" @@ -42,7 +42,7 @@ static char *SRCID_matio_c = "$Id$"; #define round(a) (int)(a+0.5) -static char mapper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+{}|;:',<.>/?"; +static const char mapper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+{}|;:',<.>/?"; #define NMAP strlen(mapper) #define MAX_XPM_LINELENGTH 4096 diff --git a/src/gmxlib/metacode.c b/src/gmxlib/metacode.c index 1ab486ff69..1b7092c73b 100644 --- a/src/gmxlib/metacode.c +++ b/src/gmxlib/metacode.c @@ -29,13 +29,18 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_metacode_c = "$Id$"; + #include #include #include #include #include +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + #define MAXCODESIZE 1000000 #define MAXDECL 1000 #define F77IND 6 diff --git a/src/gmxlib/mgmx.c b/src/gmxlib/mgmx.c index 5b63b43194..d421e21e90 100644 --- a/src/gmxlib/mgmx.c +++ b/src/gmxlib/mgmx.c @@ -29,7 +29,7 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_mgmx_c = "$Id$"; + #include #include @@ -455,8 +455,9 @@ static XmString xs_str_array_to_xmstr(char *header,int ndesc,char *desc[]) { int i; XmString xmstr; - char *ptr,*cptr,*nlptr; - + char *cptr,*nlptr; + const char *ptr; + if (ndesc <= 0) return empty_str; else { @@ -533,7 +534,7 @@ static windex mk_filedlgs(int parent,int top,int nfile, char **wname; int i,j,ftp,narg,dx,www[NWC]; Widget topw; - char *fn,dbuf[256]; + char *fn,dbuf[256],buf[255]; wc[nwcTEXT] = xmTextFieldWidgetClass; wc[nwcFDLG] = xmPushButtonWidgetClass; @@ -548,7 +549,7 @@ static windex mk_filedlgs(int parent,int top,int nfile, for(i=0; (i 0) { slen=strlen(ptr); @@ -910,8 +912,7 @@ static int mk_about(Widget base) "In the fifth pane you find the usual buttons, [BB]OK[bb], [BB]Cancel[bb],", "[BB]Help[bb], and [BB]About[bb] which presumably don't need any explanation.[PAR]", "The GUI was written by David van der Spoel (comments to spoel@xray.bmc.uu.se)[PAR]", - "And hey:[BR]", - NULL + "And hey:[BR]" }; #define NABOUT asize(about) @@ -921,8 +922,9 @@ static int mk_about(Widget base) "It took about 1500 lines of pretty ugly C code to get this dialog box working" }; - about[NABOUT-1] = cool_quote(); - + char tmpstr[256]; + int dum; + return low_mk_help(base, "ABOUT THE GROMACS MOTIF USER INTERFACE",asize(about),about, "PROBLEMS IN THE GUI",asize(mbugs),mbugs, diff --git a/src/gmxlib/mgmxtest.c b/src/gmxlib/mgmxtest.c index 3551eb4b16..115a4069e8 100644 --- a/src/gmxlib/mgmxtest.c +++ b/src/gmxlib/mgmxtest.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mgmxtest_c = "$Id$"; + #include "copyrite.h" #include "statutil.h" #include "macros.h" diff --git a/src/gmxlib/minvert.c b/src/gmxlib/minvert.c index cb744f8b87..607caa7981 100644 --- a/src/gmxlib/minvert.c +++ b/src/gmxlib/minvert.c @@ -29,7 +29,9 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_minvert_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "minvert.h" #include "nr.h" #include "smalloc.h" @@ -97,19 +99,16 @@ void print_mat(FILE *fp,char *title,int n,real **a,int *indx) void invert_mat(int n,real **A,real **Ainv) { - static real *col=NULL; - static int *indx=NULL; - static int N=0; + real *col=NULL; + int *indx=NULL; real d; int i,j; - if (n > N) { - srenew(col,n+1); - srenew(indx,n+1); - N=n; - } - ludcmp(A,N,indx,&d); + snew(col,n+1); + snew(indx,n+1); + + ludcmp(A,n,indx,&d); /* A is an LU-decomposed matrix, now back substitute to get Ainv */ for(j=1; (j<=n); j++) { @@ -120,5 +119,7 @@ void invert_mat(int n,real **A,real **Ainv) for(i=1; (i<=n); i++) Ainv[i][j]=col[i]; } + sfree(col); + sfree(indx); } diff --git a/src/gmxlib/minvert.h b/src/gmxlib/minvert.h index e0a48406fb..363e6bbcfb 100644 --- a/src/gmxlib/minvert.h +++ b/src/gmxlib/minvert.h @@ -33,7 +33,7 @@ #ifndef _minvert_h #define _minvert_h -static char *SRCID_minvert_h = "$Id$"; + #include "typedefs.h" /* A bunch of routines that works on matrices that run from 1 thru n diff --git a/src/gmxlib/mkinl.c b/src/gmxlib/mkinl.c index 64e69b0c14..5fe9a488fd 100644 --- a/src/gmxlib/mkinl.c +++ b/src/gmxlib/mkinl.c @@ -29,7 +29,12 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_c = "$Id$"; + +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + #include #include "mkinl.h" #include diff --git a/src/gmxlib/mkinl.h b/src/gmxlib/mkinl.h index c32c74e3c6..8e8f16cb5f 100644 --- a/src/gmxlib/mkinl.h +++ b/src/gmxlib/mkinl.h @@ -33,7 +33,12 @@ #ifndef _mkinl_h #define _mkinl_h -static char *SRCID_mkinl_h = "$Id$"; +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + + #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/gmxlib/mkinl_calcdist.c b/src/gmxlib/mkinl_calcdist.c index c136718090..1cf7ed8c8f 100644 --- a/src/gmxlib/mkinl_calcdist.c +++ b/src/gmxlib/mkinl_calcdist.c @@ -29,7 +29,12 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_calcdist_c = "$Id$"; + +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + #include "mkinl.h" #include diff --git a/src/gmxlib/mkinl_declarations.c b/src/gmxlib/mkinl_declarations.c index b3cc44ddd5..d4d74f205a 100644 --- a/src/gmxlib/mkinl_declarations.c +++ b/src/gmxlib/mkinl_declarations.c @@ -29,7 +29,12 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_declarations_c = "$Id$"; + +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + #include "mkinl.h" #include #include diff --git a/src/gmxlib/mkinl_fortrandata.h b/src/gmxlib/mkinl_fortrandata.h index 39f3892af7..9f20660bf9 100644 --- a/src/gmxlib/mkinl_fortrandata.h +++ b/src/gmxlib/mkinl_fortrandata.h @@ -29,8 +29,10 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_fortrandata_h = "$Id$"; -static char finvsqrtdata[]={ + +/* This file is completely threadsafe - keep it that way! */ + +static const char finvsqrtdata[]={ " DATA (finvsqrtexptab(I), I= 1, 64) /\n" " $ X'5f000000', X'5e800000', X'5e800000', X'5e000000',\n" " $ X'5e000000', X'5d800000', X'5d800000', X'5d000000',\n" diff --git a/src/gmxlib/mkinl_innerloop.c b/src/gmxlib/mkinl_innerloop.c index b9a0d3da95..0722d8ef56 100644 --- a/src/gmxlib/mkinl_innerloop.c +++ b/src/gmxlib/mkinl_innerloop.c @@ -29,7 +29,12 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_innerloop_c = "$Id$"; + +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + #include "mkinl.h" void unpack_inner_data(bool calcdist,bool calcforce) diff --git a/src/gmxlib/mkinl_interactions.c b/src/gmxlib/mkinl_interactions.c index 8ea9de4f44..fe06b92fa5 100644 --- a/src/gmxlib/mkinl_interactions.c +++ b/src/gmxlib/mkinl_interactions.c @@ -29,7 +29,12 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_interactions_c = "$Id$"; + +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + #include "mkinl.h" #include diff --git a/src/gmxlib/mkinl_invsqrt.c b/src/gmxlib/mkinl_invsqrt.c index 4b8d87802d..7f6eb1a200 100644 --- a/src/gmxlib/mkinl_invsqrt.c +++ b/src/gmxlib/mkinl_invsqrt.c @@ -29,7 +29,12 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_invsqrt_c = "$Id$"; + +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + #include "mkinl.h" #include diff --git a/src/gmxlib/mkinl_outerloop.c b/src/gmxlib/mkinl_outerloop.c index c600470182..16879fd0e2 100644 --- a/src/gmxlib/mkinl_outerloop.c +++ b/src/gmxlib/mkinl_outerloop.c @@ -29,7 +29,12 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_outerloop_c = "$Id$"; + +/* This file is NOT threadsafe, but it is only used to create + * the innerloops during the build process, so it will never be + * executed by multiple threads. + */ + #include #include "mkinl.h" diff --git a/src/gmxlib/mkinl_recip.c b/src/gmxlib/mkinl_recip.c index 0c0424000e..387d4c65b1 100644 --- a/src/gmxlib/mkinl_recip.c +++ b/src/gmxlib/mkinl_recip.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mkinl_recip_c = "$Id$"; + #include "mkinl.h" #include diff --git a/src/gmxlib/mshift.c b/src/gmxlib/mshift.c index f71b9af01f..13c618b0d8 100644 --- a/src/gmxlib/mshift.c +++ b/src/gmxlib/mshift.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mshift_c = "$Id$"; + #include #include "assert.h" #include "smalloc.h" @@ -55,8 +55,6 @@ static char *SRCID_mshift_c = "$Id$"; * ************************************************************/ -typedef enum { egcolWhite, egcolGrey, egcolBlack, egcolNR } egCol; - static void add_gbond(t_graph *g,t_iatom ia[],int np) { int j,k,l; @@ -282,6 +280,10 @@ t_graph *mk_graph(t_idef *idef,int natoms,bool bShakeOnly,bool bSettle) #ifdef DEBUG p_graph(stdlog,"graph",g); #endif + + g->negc = 0; + g->egc = NULL; + return g; } @@ -293,6 +295,7 @@ void done_graph(t_graph *g) /* This is malloced in a NASTY way, see above */ sfree(g->edge[0]); sfree(g->edge); + sfree(g->egc); } } @@ -412,8 +415,6 @@ void mk_mshift(FILE *log,t_graph *g,matrix box,rvec x[]) int nW,nG,nB; /* Number of Grey, Black, White */ int fW,fG; /* First of each category */ int nerror=0; - static int negc=0; - static egCol *egc=NULL; /* The colour of each node */ /* This puts everything in the central box, that is does not move it * at all. If we return without doing this for a system without bonds @@ -427,11 +428,11 @@ void mk_mshift(FILE *log,t_graph *g,matrix box,rvec x[]) return; nnodes=g->nnodes; - if (nnodes > negc) { - negc = nnodes; - srenew(egc,negc); + if (nnodes > g->negc) { + g->negc = nnodes; + srenew(g->egc,g->negc); } - memset(egc,0,(size_t)(nnodes*sizeof(egc[0]))); + memset(g->egc,0,(size_t)(nnodes*sizeof(g->egc[0]))); nW=g->nbound; nG=0; @@ -450,11 +451,11 @@ void mk_mshift(FILE *log,t_graph *g,matrix box,rvec x[]) * number than before, because no nodes are made white * in the loop */ - if ((fW=first_colour(fW,egcolWhite,g,egc)) == -1) + if ((fW=first_colour(fW,egcolWhite,g,g->egc)) == -1) fatal_error(0,"No WHITE nodes found while nW=%d\n",nW); /* Make the first white node grey */ - egc[fW]=egcolGrey; + g->egc[fW]=egcolGrey; nG++; nW--; @@ -465,18 +466,18 @@ void mk_mshift(FILE *log,t_graph *g,matrix box,rvec x[]) nW,nG,nB,nW+nG+nB); #endif while (nG > 0) { - if ((fG=first_colour(fG,egcolGrey,g,egc)) == -1) + if ((fG=first_colour(fG,egcolGrey,g,g->egc)) == -1) fatal_error(0,"No GREY nodes found while nG=%d\n",nG); /* Make the first grey node black */ - egc[fG]=egcolBlack; + g->egc[fG]=egcolBlack; nB++; nG--; /* Make all the neighbours of this black node grey * and set their periodicity */ - ng=mk_grey(log,nnodes,egc,g,&fG,box,x,&nerror); + ng=mk_grey(log,nnodes,g->egc,g,&fG,box,x,&nerror); /* ng is the number of white nodes made grey */ nG+=ng; nW-=ng; diff --git a/src/gmxlib/mvdata.c b/src/gmxlib/mvdata.c index a9b4a976c7..45f6a35e7f 100644 --- a/src/gmxlib/mvdata.c +++ b/src/gmxlib/mvdata.c @@ -29,7 +29,8 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mvdata_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include #include #include "typedefs.h" diff --git a/src/gmxlib/mvxvf.c b/src/gmxlib/mvxvf.c index 0b999c7094..0ddc731d20 100644 --- a/src/gmxlib/mvxvf.c +++ b/src/gmxlib/mvxvf.c @@ -29,7 +29,8 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_mvxvf_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include #include #include "typedefs.h" diff --git a/src/gmxlib/names.c b/src/gmxlib/names.c index 1b65f74768..ac92bbf12e 100644 --- a/src/gmxlib/names.c +++ b/src/gmxlib/names.c @@ -29,113 +29,125 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_names_c = "$Id$"; + #include "typedefs.h" #include "names.h" /* note: these arrays should correspond to enums in include/types/enums.h */ -char *eblock_names[ebNR+1]= +const char *eblock_names[ebNR+1]= { "CGS","MOLS","SBLOCKS",NULL }; -char *epbc_names[epbcNR+1]= +const char *epbc_names[epbcNR+1]= { "xyz", "no", NULL }; -char *ens_names[ensNR+1]= +const char *ens_names[ensNR+1]= { "Grid","Simple", NULL }; -char *ei_names[eiNR+1]= +const char *ei_names[eiNR+1]= { "md", "steep", "cg", "bd", "sd", "nm", NULL }; -char *bool_names[BOOL_NR+1]= +const char *bool_names[BOOL_NR+1]= { "FALSE","TRUE", NULL }; -char *yesno_names[BOOL_NR+1]= +const char *yesno_names[BOOL_NR+1]= { "no","yes", NULL }; -char *ptype_str[eptNR+1] = { +const char *ptype_str[eptNR+1] = { "Atom", "Nucleus", "Shell", "Bond", "Dummy", NULL }; -char *eel_names[eelNR+1] = { +const char *eel_names[eelNR+1] = { "Cut-off", "Reaction-Field", "Generalized-Reaction-Field", - "PME", "Ewald", "PPPM", "Poisson", "Switch", "Shift", "User", NULL + "PME", "Ewald", "PPPM", "Poisson", "Switch", "Shift", "User", + "Generalized-Born", NULL }; -char *eewg_names[eewgNR+1] = { +const char *eewg_names[eewgNR+1] = { "3d", "3dc", NULL }; -char *evdw_names[evdwNR+1] = { +const char *evdw_names[evdwNR+1] = { "Cut-off", "Switch", "Shift", "User", NULL }; -char *eshake_names[estNR+1] = { +const char *eshake_names[estNR+1] = { "Lincs", "Shake", NULL }; -char *egrp_nm[egNR+1] = { +const char *egrp_nm[egNR+1] = { "Coul-SR","LJ","Buck", "Coul-LR", "LJ-LR", "Coul-14", "LJ-14", NULL }; -char *etcoupl_names[etcNR+1] = { - "No", "Berendsen", "Nose-Hoover", "yes", NULL +const char *etcoupl_names[etcNR+1] = { + "No", "Berendsen", "Nose-Hoover", "yes", "Andersen", "Andersen-interval", NULL }; /* yes is alias for berendsen */ -char *epcoupl_names[epcNR+1] = { +const char *epcoupl_names[epcNR+1] = { "No", "Berendsen", "Parrinello-Rahman", "Isotropic", NULL }; /* isotropic is alias for berendsen */ -char *epcoupltype_names[epctNR+1] = { +const char *epcoupltype_names[epctNR+1] = { "Isotropic", "Semiisotropic", "Anisotropic", "Surface-Tension", NULL }; -char *edisre_names[edrNR+1] = { +const char *edisre_names[edrNR+1] = { "No", "Simple", "Ensemble", NULL }; -char *edisreweighting_names[edrwNR+1] = { +const char *edisreweighting_names[edrwNR+1] = { "Conservative", "Equal", NULL }; -char *enbf_names[eNBF_NR+1] = { +const char *enbf_names[eNBF_NR+1] = { "", "LJ", "Buckingham", NULL }; -char *ecomb_names[eCOMB_NR+1] = { +const char *ecomb_names[eCOMB_NR+1] = { "", "Arithmetic", "Geometric", "ArithSigEps", NULL }; -char *gtypes[egcNR+1] = { +const char *gtypes[egcNR+1] = { "T-Coupling", "Energy Mon.", "Acceleration", "Freeze", "User1", "User2", "VCM", "XTC", "Or. Res. Fit", NULL }; -char *efep_names[efepNR+1] = { +const char *efep_names[efepNR+1] = { "no", "yes", NULL }; -char *esolv_names[esolNR+1] = { +const char *esolv_names[esolNR+1] = { "General", "MNO Solvent", "Water", "Water-Water", NULL }; -char *edispc_names[edispcNR+1] = { +const char *edispc_names[edispcNR+1] = { "No", "EnerPres", "Ener", NULL }; -char *ecm_names[ecmNR+1] = { +const char *ecm_names[ecmNR+1] = { "Linear", "Angular", "None", NULL }; - + +const char *eann_names[eannNR+1] = { + "No", "Single", "Periodic", NULL +}; + +const char *egb_names[egbNR+1] = { + "Still", "Karplus", NULL +}; + +const char *eis_names[eisNR+1] = { + "No", "LCPO", NULL +}; diff --git a/src/gmxlib/network.c b/src/gmxlib/network.c index 12c42093e9..c03d160669 100644 --- a/src/gmxlib/network.c +++ b/src/gmxlib/network.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_network_c = "$Id$"; + #include #include "fatal.h" #include "main.h" @@ -40,9 +40,6 @@ static char *SRCID_network_c = "$Id$"; #endif #ifdef USE_MPI -static int mpi_num_nodes=0; -static int mpi_my_rank=-1; -static char mpi_hostname[MPI_MAX_PROCESSOR_NAME]; static MPI_Request mpi_req_tx=MPI_REQUEST_NULL,mpi_req_rx; #else @@ -185,6 +182,9 @@ int gmx_setup(int *argc,char **argv,int *nnodes) char buf[256]; int resultlen; /* actual length of node name */ int i,flag; + int mpi_num_nodes; + int mpi_my_rank; + char mpi_hostname[MPI_MAX_PROCESSOR_NAME]; /* Call the MPI routines */ (void) MPI_Init(argc,&argv); @@ -206,7 +206,9 @@ int gmx_node_num(void) #ifndef USE_MPI return 1; #else - return mpi_num_nodes; + int i; + return MPI_Comm_size(MPI_COMM_WORLD, &i); + return i; #endif } @@ -215,7 +217,9 @@ int gmx_node_id(void) #ifndef USE_MPI return 0; #else - return mpi_my_rank; + int i; + return MPI_Comm_rank(MPI_COMM_WORLD, &i); + return i; #endif } diff --git a/src/gmxlib/nrama.c b/src/gmxlib/nrama.c index ef23e82466..f72505850d 100644 --- a/src/gmxlib/nrama.c +++ b/src/gmxlib/nrama.c @@ -29,7 +29,7 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_nrama_c = "$Id$"; + #include #include "assert.h" #include "sysstuff.h" @@ -44,7 +44,7 @@ static char *SRCID_nrama_c = "$Id$"; #include "nrama.h" #include "rmpbc.h" -static char *pp_pat[] = { "C", "N", "CA", "C", "N" }; +static const char *pp_pat[] = { "C", "N", "CA", "C", "N" }; #define NPP (sizeof(pp_pat)/sizeof(pp_pat[0])) static int d_comp(const void *a,const void *b) @@ -91,7 +91,7 @@ bool new_data(t_xrama *xr) return TRUE; } -static int find_atom(char *find,char ***names,int start,int nr) +static int find_atom(const char *find,char ***names,int start,int nr) { int i; @@ -121,7 +121,7 @@ static void add_xr(t_xrama *xr,int ff[5],t_atoms *atoms) atoms->atom[ff[1]].resnr+1); xr->pp[xr->npp].label=strdup(buf); xr->npp++; -} +} static void get_dih(t_xrama *xr,t_atoms *atoms) { @@ -288,9 +288,11 @@ static void get_dih_props(t_xrama *xr,t_idef *idef) xr->dih[i].ai[1],xr->dih[i].ai[2]); } -void init_rama(char *infile,char *topfile,t_xrama *xr) + + +t_topology *init_rama(char *infile,char *topfile,t_xrama *xr) { - static t_topology *top; + t_topology *top; real t; top=read_top(topfile); @@ -303,5 +305,7 @@ void init_rama(char *infile,char *topfile,t_xrama *xr) min_max(xr); calc_dihs(xr); + + return top; } diff --git a/src/gmxlib/nrjac.c b/src/gmxlib/nrjac.c index d9cb3758cd..8e51a40c5e 100644 --- a/src/gmxlib/nrjac.c +++ b/src/gmxlib/nrjac.c @@ -29,23 +29,18 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_nrjac_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include #include #include #include "gstat.h" #include "smalloc.h" -/* These routines were taken from NUMERICAL RECIPES */ #define ROTATE(a,i,j,k,l) g=a[i][j];h=a[k][l];a[i][j]=g-s*(h+g*tau);\ a[k][l]=h+s*(g-h*tau); -static void nrerror(char *error_text) -{ - fatal_error(0,"Numerical Recipes: %s\n",error_text); -} - void jacobi(double **a,int n,double d[],double **v,int *nrot) { int j,i; @@ -124,7 +119,7 @@ void jacobi(double **a,int n,double d[],double **v,int *nrot) z[ip] = 0.0; } } - nrerror("Too many iterations in routine JACOBI"); + fatal_error(0,"Error: Too many iterations in routine JACOBI\n"); } int m_inv_gen(real **m,int n,real **minv) diff --git a/src/gmxlib/nrnb.c b/src/gmxlib/nrnb.c index 0d400dfc24..9002e165d1 100644 --- a/src/gmxlib/nrnb.c +++ b/src/gmxlib/nrnb.c @@ -29,11 +29,10 @@ * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ -static char *SRCID_nrnb_c = "$Id$"; + #include #include "sysstuff.h" #include "fatal.h" -#include "vveclib.h" #include "names.h" #include "macros.h" #include "nrnb.h" @@ -47,7 +46,7 @@ typedef struct { } t_nrnb_data; -static t_nrnb_data nbdata[eNRNB] = { +static const t_nrnb_data nbdata[eNRNB] = { { "LJ", 31 }, /* inl0100 */ { "LJ(S)", 31 }, /* inl0110 */ { "Buckingham", 36 }, /* inl0200 */ @@ -147,8 +146,10 @@ static t_nrnb_data nbdata[eNRNB] = { { "Propers", 229 }, { "Impropers", 208 }, { "RB-Dihedrals", 247 }, + { "Four. Dihedrals", 247 }, { "Dist. Restr.", 200 }, { "Orient. Restr.", 200 }, + { "Dihedral Restr.", 200 }, { "Pos. Restr.", 50 }, { "Angle Restr.", 191 }, { "Angle Restr. Z", 164 }, @@ -300,14 +301,14 @@ char *nrnb_str(int enr) return nbdata[enr].name; } -static int force_index[]={ +static const int force_index[]={ eNR_BONDS, eNR_ANGLES, eNR_PROPER, eNR_IMPROPER, eNR_RB, eNR_DISRES, eNR_ORIRES, eNR_POSRES, eNR_NS, eNR_INL_IATOM }; #define NFORCE_INDEX asize(force_index) -static int shake_index[]={ +static const int shake_index[]={ eNR_SHAKE, eNR_SHAKE_RIJ, eNR_SETTLE, eNR_UPDATE, eNR_PCOUPL, eNR_SHAKE_VIR, eNR_SHAKE_V, eNR_PSHAKEINITLD, eNR_PSHAKEINITMD, eNR_PSHAKE }; diff --git a/src/gmxlib/orires.c b/src/gmxlib/orires.c index 25c26eed94..a0a1b02ef5 100644 --- a/src/gmxlib/orires.c +++ b/src/gmxlib/orires.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_orires_c = "$Id$"; + #include "typedefs.h" #include "smalloc.h" #include "vec.h" @@ -216,7 +216,7 @@ real calc_orires_dev(t_commrec *mcr, rvec *xref,*xtmp,com,r_unrot,r; t_oriresdata *od; bool bTAV; - static real two_thr=2.0/3.0; + const real two_thr=2.0/3.0; od = &(fcd->orires); diff --git a/src/gmxlib/pargs.c b/src/gmxlib/pargs.c index efa734e597..a98c8b4fc0 100644 --- a/src/gmxlib/pargs.c +++ b/src/gmxlib/pargs.c @@ -29,7 +29,9 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_pargs_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include #include @@ -218,11 +220,14 @@ char *opt2parg_enum(char *option,int nparg,t_pargs pa[]) return NULL; } -char *pa_val(t_pargs *pa) +char *pa_val(t_pargs *pa, char buf[], int sz) { - static char buf[256]; buf[0]='\0'; + + if(sz<255) + fatal_error(0,"Buffer must be at least 255 chars\n"); + switch(pa->type) { case etINT: sprintf(buf,"%d",*(pa->u.i)); @@ -236,7 +241,7 @@ char *pa_val(t_pargs *pa) break; case etSTR: if (*(pa->u.c)) { - if (strlen(*(pa->u.c)) >= 256) + if (strlen(*(pa->u.c)) >= sz) fatal_error(0,"Argument too long: \"%d\"\n",*(pa->u.c)); else strcpy(buf,*(pa->u.c)); @@ -255,7 +260,7 @@ char *pa_val(t_pargs *pa) void print_pargs(FILE *fp, int npargs,t_pargs pa[]) { bool bShowHidden; - char buf[32],buf2[256]; + char buf[32],buf2[256],tmp[256]; char *wdesc; int i; @@ -281,14 +286,14 @@ void print_pargs(FILE *fp, int npargs,t_pargs pa[]) if (strlen(buf)>((OPTLEN+TYPELEN)-max(strlen(argtp[pa[i].type]),4))) { fprintf(fp,"%12s\n",buf); sprintf(buf2,"%12s %6s %6s %s\n", - "",argtp[pa[i].type],pa_val(&(pa[i])),check_tty(pa[i].desc)); + "",argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),check_tty(pa[i].desc)); } else if (strlen(buf)>OPTLEN) { /* so type can be 4 or 5 char's (max(...,4)), this fits in the %5s */ sprintf(buf2,"%-14s%5s %6s %s\n", - buf,argtp[pa[i].type],pa_val(&(pa[i])),check_tty(pa[i].desc)); + buf,argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),check_tty(pa[i].desc)); } else sprintf(buf2,"%12s %6s %6s %s\n", - buf,argtp[pa[i].type],pa_val(&(pa[i])),check_tty(pa[i].desc)); + buf,argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),check_tty(pa[i].desc)); wdesc=wrap_lines(buf2,80,28); fprintf(fp,wdesc); sfree(wdesc); diff --git a/src/gmxlib/pbc.c b/src/gmxlib/pbc.c index aea677178c..e7268bfb80 100644 --- a/src/gmxlib/pbc.c +++ b/src/gmxlib/pbc.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_pbc_c = "$Id$"; + #include #include "sysstuff.h" #include "typedefs.h" diff --git a/src/gmxlib/pdbio.c b/src/gmxlib/pdbio.c index b2facc6569..805e940314 100644 --- a/src/gmxlib/pdbio.c +++ b/src/gmxlib/pdbio.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_pdbio_c = "$Id$"; + #include "sysstuff.h" #include "string2.h" #include "vec.h" @@ -44,7 +44,7 @@ static char *SRCID_pdbio_c = "$Id$"; #include "physics.h" #include "pbc.h" -static char *pdbtp[epdbNR]={ +static const char *pdbtp[epdbNR]={ "ATOM ","HETATM", "ANISOU", "CRYST1", "COMPND", "MODEL", "ENDMDL", "TER", "HEADER", "TITLE", "REMARK" }; @@ -83,14 +83,14 @@ void write_pdbfile_indexed(FILE *out,char *title, t_atoms *atoms,rvec x[],matrix box,char chain, int model_nr, atom_id nindex, atom_id index[]) { - char resnm[6],nm[6],ch,pdbform[128]; + char resnm[6],nm[6],ch,pdbform[128],pukestring[100]; atom_id i,ii; int resnr,type; real occup,bfac; real alpha,beta,gamma; bool bOccup; - fprintf(out,"HEADER %s\n",(title && title[0])?title:bromacs()); + fprintf(out,"HEADER %s\n",(title && title[0])?title:bromacs(pukestring,99)); if (bWideFormat) { fprintf(out,"REMARK This file does not adhere to the PDB standard\n"); fprintf(out,"REMARK As a result of, some programs may not like it\n"); diff --git a/src/gmxlib/princ.c b/src/gmxlib/princ.c index a5fd167dc2..db42899a87 100644 --- a/src/gmxlib/princ.c +++ b/src/gmxlib/princ.c @@ -29,7 +29,9 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_princ_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "typedefs.h" #include "vec.h" #include "smalloc.h" diff --git a/src/gmxlib/rando.c b/src/gmxlib/rando.c index c3ee90669e..48be152a2c 100644 --- a/src/gmxlib/rando.c +++ b/src/gmxlib/rando.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_rando_c = "$Id$"; + #include #include "sysstuff.h" #include "typedefs.h" diff --git a/src/gmxlib/random.c b/src/gmxlib/random.c index 4b49f2079b..e47be4bf13 100644 --- a/src/gmxlib/random.c +++ b/src/gmxlib/random.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_random_c = "$Id$"; + #include #include "sysstuff.h" #include "smalloc.h" @@ -38,57 +38,111 @@ static char *SRCID_random_c = "$Id$"; #include "vec.h" #include "random.h" -real gauss (real am, real sd, int *ig) - /* we use the boxmuller method to calculate the gaussian. */ - /* this method calculates two gaussians at a time, one of */ - /* which is stored in glgset until the next call to gauss. */ - /* see: numerical recipes p.716 */ +#define GAUSS_NXP 16 +/* The size of the data area is 2^GAUSS_NXP */ + +struct t_gaussdata { + real *x; /* Pointer to the work area */ + int seed; /* The random seed */ + int uselast; /* Is there a saved number we can use? */ + real last; /* The possibly saved number */ +}; + + +/* Initialize (and warm up) a gaussian random number generator + * by copying the seed. The routine returns a handle to the + * new generator. + */ +t_Gaussdata +init_gauss(int seed) { - /* use our own gaussian, or modified boxmuller's ? */ -#define STRAND - -#ifdef STRAND - real a; - int i; -#else - static bool gliset=FALSE; - static real glgset; - real fac,r,v1,v2; -#endif - real gval; - -#ifdef STRAND - a = 0; - for (i=0; (i<12); i++) - a = a + rando (ig); - gval = (a-6.0)*sd+am; -#else - if (!gliset) { + int size = (1 << GAUSS_NXP); + int nwarmup = GAUSS_NXP*(size-1); + int k; + real tmp; + t_Gaussdata gaussdata; + gaussdata=(t_Gaussdata)malloc(sizeof(struct t_gaussdata)); + gaussdata->x=(real *)malloc(size*sizeof(real)); + gaussdata->seed = seed; + gaussdata->last = 0; + gaussdata->uselast = 0; + + for(k=0;kx[k]=1; + + for(k=0;kuselast) { + gaussdata->uselast=0; + return gaussdata->last; + } else { do { - v1 = 2.0*rando(ig)-1.0; - v2 = 2.0*rando(ig)-1.0; - r = v1*v1 + v2*v2; - } while (r >= 1.0); - fac = sqrt (-2*log(r)/r); - glgset = v1*fac; - gval = v2*fac; + for (i=0;i<2;i++) { + intt=(gaussdata->seed)/127773; + mo=(gaussdata->seed)-intt*127773; + j1=2836*intt; + (gaussdata->seed)=16807*mo-j1; + if(gaussdata->seed<0) + gaussdata->seed+=2147483647; + if(i==0) + n1 = gaussdata->seed >> ne; + } + n2 = gaussdata->seed >> ne; + } while (n1==n2); + + isgn=2*(gaussdata->seed & 1)-1; + + gaussdata->x[n1]=isgn*(0.7071067811865475*(gaussdata->x[n1]+gaussdata->x[n2])); + gaussdata->x[n2]=-gaussdata->x[n1]+isgn*1.414213562373095*gaussdata->x[n2]; + gaussdata->last = gaussdata->x[n2]; + gaussdata->uselast = 1; + return gaussdata->x[n1]; } - else - gval = glgset; /* use the spare gaussian */ - gliset=!gliset; /* set the spare indicator */ -#endif +} - return gval; + + +/* Release all the resources used for the generator */ +void +finish_gauss(t_Gaussdata data) +{ + free(data->x); + free(data); + data=NULL; + + return; } -void low_mspeed(real tempi,int nrdf,int seed,int nat,atom_id a[], - t_atoms *atoms,rvec v[]) + + +void low_mspeed(real tempi,int nrdf,int nat,atom_id a[], + t_atoms *atoms,rvec v[], t_Gaussdata gaussdata) { - int i,j,m,ig; + int i,j,m; real boltz,sd; real ekin,temp,mass,scal; - ig=seed; boltz=BOLTZ*tempi; ekin=0.0; for (i=0; (i 0) { sd=sqrt(boltz/mass); for (m=0; (mnr); i++) { s=grp->index[i]; n=grp->index[i+1]-s; - low_mspeed(tempi[i],nrdf[i],seed,n,&(grp->a[s]),atoms,v); + low_mspeed(tempi[i],nrdf[i],n,&(grp->a[s]),atoms,v,gaussdata); } } + void maxwell_speed(real tempi,int nrdf,int seed,t_atoms *atoms, rvec v[]) { atom_id *dummy; int i; + t_Gaussdata gaussdata; + bool bFirst=TRUE; if (seed == -1) { seed = make_seed(); fprintf(stderr,"Using random seed %d for generating velocities\n",seed); } + + if(bFirst) { + bFirst=FALSE; + gaussdata = init_gauss(seed); + } + snew(dummy,atoms->nr); for(i=0; (inr); i++) dummy[i]=i; - low_mspeed(tempi,nrdf,seed,atoms->nr,dummy,atoms,v); + low_mspeed(tempi,nrdf,atoms->nr,dummy,atoms,v,gaussdata); sfree(dummy); } diff --git a/src/gmxlib/rbin.c b/src/gmxlib/rbin.c index 1ff4195487..65bbe6eb32 100644 --- a/src/gmxlib/rbin.c +++ b/src/gmxlib/rbin.c @@ -29,7 +29,9 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_rbin_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "typedefs.h" #include "main.h" #include "network.h" diff --git a/src/gmxlib/rdgroup.c b/src/gmxlib/rdgroup.c index b78a1f8d68..91247c1ab8 100644 --- a/src/gmxlib/rdgroup.c +++ b/src/gmxlib/rdgroup.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_rdgroup_c = "$Id$"; + #include "sysstuff.h" #include "smalloc.h" #include "typedefs.h" diff --git a/src/gmxlib/readinp.c b/src/gmxlib/readinp.c index 17ba5f2161..e1e3da533c 100644 --- a/src/gmxlib/readinp.c +++ b/src/gmxlib/readinp.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_readinp_c = "$Id$"; + #include #include #include "typedefs.h" @@ -140,9 +140,12 @@ void write_inpfile(char *fn,int ninp,t_inpfile inp[]) out=ffopen(fn,"w"); nice_header(out,fn); for(i=0; (i2 && inp[i].name[1]==';')) + fprintf(out,"%-24s\n",inp[i].name); + else + fprintf(out,"%-24s = %s\n",inp[i].name,inp[i].value ? inp[i].value : ""); + } else { sprintf(warn_buf,"Unknown left-hand %s in parameter file\n", inp[i].name); warning(NULL); @@ -151,7 +154,7 @@ void write_inpfile(char *fn,int ninp,t_inpfile inp[]) fclose(out); } -static int get_einp(int *ninp,t_inpfile **inp,char *name) +static int get_einp(int *ninp,t_inpfile **inp,const char *name) { int i; @@ -177,7 +180,7 @@ static int get_einp(int *ninp,t_inpfile **inp,char *name) return i; } -int get_eint(int *ninp,t_inpfile **inp,char *name,int def) +int get_eint(int *ninp,t_inpfile **inp,const char *name,int def) { char buf[32]; int ii; @@ -194,7 +197,7 @@ int get_eint(int *ninp,t_inpfile **inp,char *name,int def) return atoi((*inp)[ii].value); } -real get_ereal(int *ninp,t_inpfile **inp,char *name,real def) +real get_ereal(int *ninp,t_inpfile **inp,const char *name,real def) { char buf[32]; int ii; @@ -211,7 +214,7 @@ real get_ereal(int *ninp,t_inpfile **inp,char *name,real def) return atof((*inp)[ii].value); } -char *get_estr(int *ninp,t_inpfile **inp,char *name,char *def) +char *get_estr(int *ninp,t_inpfile **inp,const char *name,char *def) { char buf[32]; int ii; @@ -232,7 +235,7 @@ char *get_estr(int *ninp,t_inpfile **inp,char *name,char *def) return (*inp)[ii].value; } -int get_eeenum(int *ninp,t_inpfile **inp,char *name,char **defs, +int get_eeenum(int *ninp,t_inpfile **inp,const char *name,const char **defs, int *nerror,bool bPrintError) { int ii,i,j; @@ -268,7 +271,7 @@ int get_eeenum(int *ninp,t_inpfile **inp,char *name,char **defs, return i; } -int get_eenum(int *ninp,t_inpfile **inp,char *name,char **defs) +int get_eenum(int *ninp,t_inpfile **inp,const char *name,const char **defs) { int dum=0; diff --git a/src/gmxlib/repfirst.c b/src/gmxlib/repfirst.c index 76e3a18476..ca404b4935 100644 --- a/src/gmxlib/repfirst.c +++ b/src/gmxlib/repfirst.c @@ -29,7 +29,8 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_repfirst_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include "string2.h" #include "typedefs.h" #include "smalloc.h" diff --git a/src/gmxlib/replace.c b/src/gmxlib/replace.c index b8637260d8..c845e3eaec 100644 --- a/src/gmxlib/replace.c +++ b/src/gmxlib/replace.c @@ -29,14 +29,16 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_replace_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "string2.h" #include "smalloc.h" #include "macros.h" #include "replace.h" -char *replace(char *string,char *search,char *replace) +char *replace(const char *string,const char *search,const char *replace) { char *buf=NULL,*ptr=NULL,*bufptr=NULL; int blen,stringlen,slen,rlen; @@ -80,7 +82,7 @@ char *replace(char *string,char *search,char *replace) return buf; } -char *replaceww(char *string,char *search,char *replace) +char *replaceww(char *string,const char *search,const char *replace) { char *buf=NULL,*ptr=NULL,*bufptr=NULL; int buflen,stringlen,searchlen,replacelen; diff --git a/src/gmxlib/replace.h b/src/gmxlib/replace.h index 2f873978fc..4fe380898f 100644 --- a/src/gmxlib/replace.h +++ b/src/gmxlib/replace.h @@ -33,16 +33,12 @@ #ifndef _replace_h #define _replace_h -static char *SRCID_replace_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) replace.h 1.16 10/14/97" -#endif /* HAVE_IDENT */ -extern char *replace(char *string,char *search,char *replace); +extern char *replace(const char *string,const char *search,const char *replace); /* Replace all occurences of * string 'search' in string 'string' by 'replace' */ -extern char *replaceww(char *string,char *search,char *replace); +extern char *replaceww(char *string,const char *search,const char *replace); /* Replace all occurences of string 'search' delimited by non-alphanum * characters (i.e. whole words) in string 'string' by 'replace' */ diff --git a/src/gmxlib/rmpbc.c b/src/gmxlib/rmpbc.c index 431da78c8b..f47aeabed2 100644 --- a/src/gmxlib/rmpbc.c +++ b/src/gmxlib/rmpbc.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_rmpbc_c = "$Id$"; + #include "sysstuff.h" #include "typedefs.h" #include "smalloc.h" diff --git a/src/gmxlib/sheader.c b/src/gmxlib/sheader.c index b7219d5604..f5a28cfb26 100644 --- a/src/gmxlib/sheader.c +++ b/src/gmxlib/sheader.c @@ -29,13 +29,15 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_sheader_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "sheader.h" #include "txtdump.h" #include "tpxio.h" -static char *version="@(#) sheader.c 1.5 12/16/92"; + void pr_header(FILE *fp,int indent,char *title,t_tpxheader *sh) { diff --git a/src/gmxlib/shift_util.c b/src/gmxlib/shift_util.c index 3695d377d4..ea4c2e44ed 100644 --- a/src/gmxlib/shift_util.c +++ b/src/gmxlib/shift_util.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_shift_util_c = "$Id$"; + #include #include #include "typedefs.h" @@ -462,7 +462,7 @@ static real rgbset(real col) void plot_phi(char *fn,rvec box,int natoms,rvec x[],real phi[]) { - FILE *eps; + t_psdata eps; real phi_max,rr,gg,bb,fac,dx,x0,y0; real offset; int i; diff --git a/src/gmxlib/smalloc.c b/src/gmxlib/smalloc.c index 056301f0f1..2feef74582 100644 --- a/src/gmxlib/smalloc.c +++ b/src/gmxlib/smalloc.c @@ -29,7 +29,16 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_smalloc_c = "$Id$"; + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* This file is completely threadsafe - keep it that way! */ +#ifdef USE_THREADS +#include +#endif + #include #include #include @@ -48,6 +57,12 @@ static void log_action(int bMal,char *what,char *file,int line, bytes=size*nelem; if (!bMal) bytes=-bytes; + +#ifdef USE_THREADS + pthread_mutex_lock(&gmx_logfile_mtx); +#endif + + /* This static variable is protected by the mutex too... */ btot+=bytes; bytes/=1024; @@ -55,6 +70,9 @@ static void log_action(int bMal,char *what,char *file,int line, fprintf(stdlog,"%30s:%6d kb (%7d kb) [%s, line %d, nelem %d, size %d]\n", what ? what : NN,bytes,btot/1024, file ? file : NN,line,nelem,size); +#ifdef USE_THREADS + pthread_mutex_unlock(&gmx_logfile_mtx); +#endif } #endif @@ -122,7 +140,7 @@ void *save_realloc(char *name,char *file,int line,void *ptr,unsigned size) return p; } -void save_free(char *name,char *file,int line,void *ptr) +void save_free(char *name,char *file,int line,const void *ptr) { #ifdef DEBUG log_action(0,name,file,line,0,0,ptr); diff --git a/src/gmxlib/sortwater.c b/src/gmxlib/sortwater.c index 4ce363a00e..103076537c 100644 --- a/src/gmxlib/sortwater.c +++ b/src/gmxlib/sortwater.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_sortwater_c = "$Id$"; + #include "typedefs.h" #include "random.h" #include "smalloc.h" diff --git a/src/gmxlib/stat.c b/src/gmxlib/stat.c index 48e832a83c..9204d61c4a 100644 --- a/src/gmxlib/stat.c +++ b/src/gmxlib/stat.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_stat_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/gmxlib/statutil.c b/src/gmxlib/statutil.c index 042a298477..703728cf5a 100644 --- a/src/gmxlib/statutil.c +++ b/src/gmxlib/statutil.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_statutil_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/gmxlib/strdb.c b/src/gmxlib/strdb.c index ae35089e99..5b23052da3 100644 --- a/src/gmxlib/strdb.c +++ b/src/gmxlib/strdb.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_strdb_c = "$Id$"; + #include #include #include "string2.h" @@ -40,14 +40,11 @@ static char *SRCID_strdb_c = "$Id$"; bool get_a_line(FILE *fp,char line[],int n) { - static char *line0=NULL; - static int nalloc=0; + char *line0; char *dum; - if (n>nalloc) { - nalloc=n; - srenew(line0,nalloc+1); - } + snew(line0,n+1); + do { if (!fgets(line0,n+1,fp)) { return FALSE; @@ -64,11 +61,12 @@ bool get_a_line(FILE *fp,char line[],int n) dum=strchr(line0,';'); if (dum) dum[0]='\0'; - strcpy(line,line0); + strncpy(line,line0,n); dum=line0; ltrim(dum); } while (dum[0] == '\0'); - + + sfree(line0); return TRUE; } diff --git a/src/gmxlib/string2.c b/src/gmxlib/string2.c index 5555b3c8a1..4f37603a9d 100644 --- a/src/gmxlib/string2.c +++ b/src/gmxlib/string2.c @@ -29,7 +29,9 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_string2_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + + #ifdef HAVE_CONFIG_H #include #endif @@ -230,7 +232,7 @@ char *gmx_strdup(const char *src) return dest; } -char *wrap_lines(char *buf,int line_width, int indent) +char *wrap_lines(const char *buf,int line_width, int indent) { char *b2; int i,i0,i2,j,b2len,lspace=0,l2space=0; diff --git a/src/gmxlib/symtab.c b/src/gmxlib/symtab.c index 66a5748fbc..897ee4734f 100644 --- a/src/gmxlib/symtab.c +++ b/src/gmxlib/symtab.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_symtab_c = "$Id$"; + #include #include #include "sysstuff.h" @@ -45,22 +45,24 @@ static char *SRCID_symtab_c = "$Id$"; #define BUFSIZE 1024 #define TABLESIZE 5 -static char *trim_string(char *s) +static char *trim_string(char *s,char *out, int maxlen) /* * Returns a pointer to a static area which contains a copy * of s without leading or trailing spaces. Strings are * truncated to BUFSIZE positions. */ { - static char buf[BUFSIZE]; int len,i; + + if(strlen(s)>maxlen-1) + fatal_error(0,"Character buffer size too small\n"); for (; (*s)&&((*s)==' '); s++); for (len=strlen(s); (len>0); len--) if (s[len-1]!=' ') break; if (len>=BUFSIZE) len=BUFSIZE-1; - for (i=0; ibuf[0]); } -char **put_symtab(t_symtab *symtab,char *name) +char **put_symtab(t_symtab *symtab,const char *name) { - return enter_buf(symtab,trim_string(name)); + char buf[256]; + + return enter_buf(symtab,trim_string(name,buf,255)); } void open_symtab(t_symtab *symtab) diff --git a/src/gmxlib/testfft.c b/src/gmxlib/testfft.c index 2f4d2527f8..b788a95db2 100644 --- a/src/gmxlib/testfft.c +++ b/src/gmxlib/testfft.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_testfft_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/gmxlib/testlr.c b/src/gmxlib/testlr.c index 7a044f1298..2596f37e8d 100644 --- a/src/gmxlib/testlr.c +++ b/src/gmxlib/testlr.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_testlr_c = "$Id$"; + #include #include #include "typedefs.h" @@ -274,7 +274,7 @@ int main(int argc,char *argv[]) /* Read topology and coordinates */ - read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&stath); + read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&stath,FALSE); snew(x,stath.natoms); snew(f_sr,stath.natoms); snew(f_excl,stath.natoms); diff --git a/src/gmxlib/testtab.c b/src/gmxlib/testtab.c index 37c9d2a71d..5726369df2 100644 --- a/src/gmxlib/testtab.c +++ b/src/gmxlib/testtab.c @@ -29,7 +29,8 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_testtab_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include #include "typedefs.h" #include "force.h" diff --git a/src/gmxlib/testxml.c b/src/gmxlib/testxml.c index 0115f84143..7b98bfa3b5 100644 --- a/src/gmxlib/testxml.c +++ b/src/gmxlib/testxml.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_testxml_c = "$Id$"; + #include "macros.h" #include "smalloc.h" #include "xmlio.h" @@ -61,7 +61,7 @@ int main(int argc,char *argv[]) else { t_tpxheader tpx; - read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&tpx); + read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&tpx,FALSE); snew(x,tpx.natoms); snew(v,tpx.natoms); f = NULL; diff --git a/src/gmxlib/threadsync.c b/src/gmxlib/threadsync.c index 8f0a07db27..4b4a4102cb 100644 --- a/src/gmxlib/threadsync.c +++ b/src/gmxlib/threadsync.c @@ -29,7 +29,17 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_threadsync_c = "$Id$"; + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* This file is completely threadsafe - keep it that way! */ +#ifdef USE_THREADS +#include +#endif + + /* Since most fortran compilers dont support threads started * in a calling c program we call these wrapper syncronization * routines from the fortran innerloops @@ -39,11 +49,15 @@ void FUNCTION(inlsync)(int *nri,int *nthreads,int *count,int *ii0, int *ii1, pthread_mutex_t *mtx) { int t0,t1; +#ifdef USE_THREADS pthread_mutex_lock(mtx); +#endif t0=*count; t1=t0+(*nri-t0)/nthreads+1; *count=t1; +#ifdef USE_THREADS pthread_mutex_unlock(mtx); +#endif *ii0=t0; *ii1=t1; } diff --git a/src/gmxlib/tpxio.c b/src/gmxlib/tpxio.c index 56cd4db6a1..e7f21092e8 100644 --- a/src/gmxlib/tpxio.c +++ b/src/gmxlib/tpxio.c @@ -29,8 +29,16 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_tpxio_c = "$Id$"; - + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* This file is completely threadsafe - keep it that way! */ +#ifdef USE_THREADS +#include +#endif + #include #include "sysstuff.h" #include "smalloc.h" @@ -53,11 +61,25 @@ static char *SRCID_tpxio_c = "$Id$"; #endif /* This number should be increased whenever the file format changes! */ -static int tpx_version = 25; -/* This number should be the most recent incompatible version */ -static int tpx_incompatible_version = 9; -/* This is the version of the file we are reading */ -static int file_version = 0; +static const int tpx_version = 26; + +/* This number should only be increased when you edit the TOPOLOGY section + * of the tpx format. This way we can maintain forward compatibility too + * for all analysis tools and/or external programs that only need to + * know the atom/residue names, charges, and bond connectivity. + * + * It first appeared in tpx version 26, when I also moved the inputrecord + * to the end of the tpx file, so we can just skip it if we only + * want the topology. + */ +static const int tpx_generation = 1; + +/* This number should be the most recent backwards incompatible version + * I.e., if this number is 9, we cannot read tpx version 9 with this code. + */ +static const int tpx_incompatible_version = 9; + + /* Struct used to maintain tpx compatibility when function types are added */ typedef struct { @@ -70,14 +92,18 @@ typedef struct { * 1. ascending file version number * 2. ascending function type number */ -t_ftupd ftupd[] = { - { 20, F_CUBICBONDS }, - { 20, F_CONNBONDS }, - { 20, F_HARMONIC }, - { 20, F_EQM, }, - { 22, F_DISRESVIOL }, - { 22, F_ORIRES }, - { 22, F_ORIRESDEV } +static const t_ftupd ftupd[] = { + { 20, F_CUBICBONDS }, + { 20, F_CONNBONDS }, + { 20, F_HARMONIC }, + { 20, F_EQM, }, + { 22, F_DISRESVIOL }, + { 22, F_ORIRES }, + { 22, F_ORIRESDEV }, + { 26, F_FOURDIHS }, + { 26, F_PIDIHS }, + { 26, F_DIHRES }, + { 26, F_DIHRESVIOL } }; #define NFTUPD asize(ftupd) @@ -118,13 +144,15 @@ void _do_section(int fp,int key,bool bRead,char *src,int line) * Now the higer level routines that do io of the structures and arrays * **************************************************************/ -static void do_inputrec(t_inputrec *ir,bool bRead) +static void do_inputrec(t_inputrec *ir,bool bRead, int file_version) { - int i,j,*tmp,idum=0; + int i,j,k,*tmp,idum=0; bool bDum=TRUE; real rdum; rvec vdum; - + bool bSimAnn; + real zerotemptime,finish_t,init_temp,finish_temp; + if (file_version != tpx_version) { /* Give a warning about features that are not accessible */ fprintf(stderr,"Note: tpx file_version %d, software version %d\n", @@ -135,6 +163,11 @@ static void do_inputrec(t_inputrec *ir,bool bRead) /* Basic inputrec stuff */ do_int(ir->eI); do_int(ir->nsteps); + if(file_version > 25) + do_int(ir->init_step); + else + ir->init_step=0; + do_int(ir->ePBC); if (file_version <= 15 && ir->ePBC == 2) ir->ePBC = epbcNONE; @@ -144,6 +177,12 @@ static void do_inputrec(t_inputrec *ir,bool bRead) do_int(ir->bDomDecomp); do_int(ir->decomp_dir); do_int(ir->nstcomm); + + if(file_version > 25) + do_int(ir->nstcheckpoint); + else + ir->nstcheckpoint=0; + do_int(ir->nstcgsteep); do_int(ir->nstlog); do_int(ir->nstxout); @@ -169,6 +208,21 @@ static void do_inputrec(t_inputrec *ir,bool bRead) do_real(ir->rvdw); do_int(ir->eDispCorr); do_real(ir->epsilon_r); + + if(file_version > 25) { + do_int(ir->gb_algorithm); + do_int(ir->nstgbradii); + do_real(ir->rgbradii); + do_real(ir->gb_saltconc); + do_int(ir->implicit_solvent); + } else { + ir->gb_algorithm=egbSTILL; + ir->nstgbradii=0; + ir->rgbradii=0; + ir->gb_saltconc=0; + ir->implicit_solvent=eisNO; + } + do_int(ir->nkx); do_int(ir->nky); do_int(ir->nkz); @@ -239,9 +293,18 @@ static void do_inputrec(t_inputrec *ir,bool bRead) do_rvec(ir->compress[YY]); do_rvec(ir->compress[ZZ]); } - do_int(ir->bSimAnn); - do_real(ir->zero_temp_time); + if(file_version > 25) + do_int(ir->andersen_seed); + else + ir->andersen_seed=0; + + if(file_version < 26) { + do_int(bSimAnn); + do_real(zerotemptime); + } + do_real(ir->epsilon_r); + do_real(ir->shake_tol); do_real(ir->fudgeQQ); do_int(ir->efep); @@ -277,6 +340,16 @@ static void do_inputrec(t_inputrec *ir,bool bRead) ir->orires_tau = 0; ir->nstorireout = 0; } + if(file_version >=26) { + do_real(ir->dihre_fc); + do_real(ir->dihre_tau); + do_int(ir->nstdihreout); + } else { + ir->dihre_fc=0; + ir->dihre_tau=0; + ir->nstdihreout=0; + } + do_real(ir->em_stepsize); do_real(ir->em_tol); if (file_version >= 22) @@ -299,6 +372,8 @@ static void do_inputrec(t_inputrec *ir,bool bRead) do_real(ir->LincsWarnAngle); if (file_version <= 14) do_int(idum); + if (file_version >=26) + do_int(ir->nLincsIter); do_real(ir->bd_temp); do_real(ir->bd_fric); do_int(ir->ld_seed); @@ -319,10 +394,15 @@ static void do_inputrec(t_inputrec *ir,bool bRead) do_int(ir->opts.ngtc); do_int(ir->opts.ngacc); do_int(ir->opts.ngfrz); - do_int(ir->opts.ngener); + do_int(ir->opts.ngener); + if (bRead) { snew(ir->opts.nrdf, ir->opts.ngtc); snew(ir->opts.ref_t, ir->opts.ngtc); + snew(ir->opts.annealing, ir->opts.ngtc); + snew(ir->opts.anneal_npoints, ir->opts.ngtc); + snew(ir->opts.anneal_time, ir->opts.ngtc); + snew(ir->opts.anneal_temp, ir->opts.ngtc); snew(ir->opts.tau_t, ir->opts.ngtc); snew(ir->opts.nFreeze,ir->opts.ngfrz); snew(ir->opts.acc, ir->opts.ngacc); @@ -348,6 +428,41 @@ static void do_inputrec(t_inputrec *ir,bool bRead) if (file_version >= 12) ndo_int(ir->opts.eg_excl,ir->opts.ngener*ir->opts.ngener,bDum); + if(bRead && file_version < 26) { + for(i=0;iopts.ngtc;i++) { + if(bSimAnn) { + ir->opts.annealing[i] = eannSINGLE; + ir->opts.anneal_npoints[i] = 2; + snew(ir->opts.anneal_time[i],2); + snew(ir->opts.anneal_temp[i],2); + /* calculate the starting/ending temperatures from reft, zerotemptime, and nsteps */ + finish_t = ir->init_t + ir->nsteps * ir->delta_t; + init_temp = ir->opts.ref_t[i]*(1-ir->init_t/zerotemptime); + finish_temp = ir->opts.ref_t[i]*(1-finish_t/zerotemptime); + ir->opts.anneal_time[i][0] = ir->init_t; + ir->opts.anneal_time[i][1] = finish_t; + ir->opts.anneal_temp[i][0] = init_temp; + ir->opts.anneal_temp[i][1] = finish_temp; + } else { + ir->opts.annealing[i] = eannNO; + ir->opts.anneal_npoints[i] = 0; + } + } + } else { + /* file version 26 or later */ + /* First read the lists with annealing and npoints for each group */ + ndo_int(ir->opts.annealing,ir->opts.ngtc,bDum); + ndo_int(ir->opts.anneal_npoints,ir->opts.ngtc,bDum); + for(j=0;j<(ir->opts.ngtc);j++) { + k=ir->opts.anneal_npoints[j]; + if(bRead) { + snew(ir->opts.anneal_time[j],k); + snew(ir->opts.anneal_temp[j],k); + } + ndo_real(ir->opts.anneal_time[j],k,bDum); + ndo_real(ir->opts.anneal_temp[j],k,bDum); + } + } /* Cosine stuff for electric fields */ for(j=0; (jex[j].n); @@ -378,6 +493,7 @@ void do_iparams(t_functype ftype,t_iparams *iparams,bool bRead, int file_version { int i; bool bDum; + real VA[4],VB[4]; if (!bRead) set_comment(interaction_function[ftype].name); @@ -428,6 +544,7 @@ void do_iparams(t_functype ftype,t_iparams *iparams,bool bRead, int file_version do_real(iparams->lj14.c12B); break; case F_PDIHS: + case F_PIDIHS: do_real(iparams->pdihs.phiA); do_real(iparams->pdihs.cpA); do_real(iparams->pdihs.phiB); @@ -450,6 +567,13 @@ void do_iparams(t_functype ftype,t_iparams *iparams,bool bRead, int file_version do_real(iparams->orires.obs); do_real(iparams->orires.kfac); break; + case F_DIHRES: + do_int (iparams->dihres.power); + do_int (iparams->dihres.label); + do_real(iparams->dihres.phi); + do_real(iparams->dihres.dphi); + do_real(iparams->dihres.kfac); + break; case F_POSRES: do_rvec(iparams->posres.pos0); do_rvec(iparams->posres.fc); @@ -459,6 +583,13 @@ void do_iparams(t_functype ftype,t_iparams *iparams,bool bRead, int file_version if(file_version>=25) ndo_real(iparams->rbdihs.rbcB,NR_RBDIHS,bDum); break; + case F_FOURDIHS: + /* Fourier dihedrals are internally represented + * as Ryckaert-Bellemans since those are faster to compute. + */ + ndo_real(VA,NR_RBDIHS,bDum); + ndo_real(VB,NR_RBDIHS,bDum); + break; case F_SHAKE: case F_SHAKENC: do_real(iparams->shake.dA); @@ -507,7 +638,7 @@ static void do_ilist(t_ilist *ilist,bool bRead,char *name) unset_comment(); } -static void do_idef(t_idef *idef,bool bRead) +static void do_idef(t_idef *idef,bool bRead, int file_version) { int i,j,k; bool bDum=TRUE,bClear; @@ -562,7 +693,7 @@ static void do_block(t_block *block,bool bRead) ndo_int(block->a,block->nra,bDum); } -static void do_atom(t_atom *atom,int ngrp,bool bRead) +static void do_atom(t_atom *atom,int ngrp,bool bRead, int file_version) { do_real (atom->m); do_real (atom->q); @@ -579,7 +710,7 @@ static void do_atom(t_atom *atom,int ngrp,bool bRead) do_nuchar(atom->grpnr,ngrp); } -static void do_grps(int ngrp,t_grps grps[],bool bRead) +static void do_grps(int ngrp,t_grps grps[],bool bRead, int file_version) { int i,j; bool bDum=TRUE; @@ -620,7 +751,7 @@ static void do_strstr(int nstr,char ***nm,bool bRead,t_symtab *symtab) do_symstr(&(nm[j]),bRead,symtab); } -static void do_atoms(t_atoms *atoms,bool bRead,t_symtab *symtab) +static void do_atoms(t_atoms *atoms,bool bRead,t_symtab *symtab, int file_version) { int i; @@ -637,7 +768,7 @@ static void do_atoms(t_atoms *atoms,bool bRead,t_symtab *symtab) atoms->pdbinfo = NULL; } for(i=0; (inr); i++) - do_atom(&atoms->atom[i],egcNR,bRead); + do_atom(&atoms->atom[i],egcNR,bRead, file_version); do_strstr(atoms->nr,atoms->atomname,bRead,symtab); if (bRead && (file_version <= 20)) { for(i=0; inr; i++) { @@ -651,11 +782,36 @@ static void do_atoms(t_atoms *atoms,bool bRead,t_symtab *symtab) do_strstr(atoms->nres,atoms->resname,bRead,symtab); do_strstr(atoms->ngrpname,atoms->grpname,bRead,symtab); - do_grps(egcNR,atoms->grps,bRead); + do_grps(egcNR,atoms->grps,bRead,file_version); do_block(&(atoms->excl),bRead); } +static void do_atomtypes(t_atomtypes *atomtypes,bool bRead,t_symtab *symtab, int file_version) +{ + int i,j; + bool bDum = TRUE; + + if (file_version > 25) { + do_int(atomtypes->nr); + j=atomtypes->nr; + if(bRead) { + snew(atomtypes->radius,j); + snew(atomtypes->vol,j); + snew(atomtypes->surftens,j); + } + ndo_real(atomtypes->radius,j,bDum); + ndo_real(atomtypes->vol,j,bDum); + ndo_real(atomtypes->surftens,j,bDum); + } else { + /* File versions prior to 26 cannot do GBSA, so they dont use this structure */ + atomtypes->nr = 0; + atomtypes->radius = NULL; + atomtypes->vol = NULL; + atomtypes->surftens = NULL; + } +} + static void do_symtab(t_symtab *symtab,bool bRead) { int i,nr; @@ -710,14 +866,15 @@ static void make_chain_identifiers(t_atoms *atoms,t_block *mols) atoms->atom[a].chain=' '; } -static void do_top(t_topology *top,bool bRead) +static void do_top(t_topology *top,bool bRead, int file_version) { int i; do_symtab(&(top->symtab),bRead); do_symstr(&(top->name),bRead,&(top->symtab)); - do_atoms (&(top->atoms),bRead,&(top->symtab)); - do_idef (&(top->idef),bRead); + do_atoms (&(top->atoms),bRead,&(top->symtab), file_version); + do_atomtypes (&(top->atomtypes),bRead,&(top->symtab), file_version); + do_idef (&(top->idef),bRead,file_version); for(i=0; (iblocks[i]),bRead); if (bRead) { @@ -726,12 +883,22 @@ static void do_top(t_topology *top,bool bRead) } } -static void do_tpxheader(int fp,bool bRead,t_tpxheader *tpx) +/* If TopOnlyOK is TRUE then we can read even future versions + * of tpx files, provided the file_generation hasn't changed. + * If it is FALSE, we need the inputrecord too, and bail out + * if the file is newer than the program. + * + * The version and generation if the topology (see top of this file) + * are returned in the two last arguments. + * + * If possible, we will read the inputrec even when TopOnlyOK is TRUE. + */ +static void do_tpxheader(int fp,bool bRead,t_tpxheader *tpx, bool TopOnlyOK, int *file_version, int *file_generation) { char buf[STRLEN]; bool bDouble; int precision; - + int fver,fgen; fio_select(fp); fio_setdebug(fp,bDebugMode()); @@ -759,16 +926,29 @@ static void do_tpxheader(int fp,bool bRead,t_tpxheader *tpx) bDouble = (precision == sizeof(double)); fio_setprecision(fp,bDouble); do_int(precision); - file_version = tpx_version; + fver = tpx_version; } /* Check versions! */ - do_int(file_version); - if ((file_version <= tpx_incompatible_version) || - (file_version > tpx_version)) + do_int(fver); + + if(fver>=26) + do_int(fgen); + else + fgen=0; + + if(file_version!=NULL) + *file_version = fver; + if(file_version!=NULL) + *file_generation = fgen; + + + if ((fver <= tpx_incompatible_version) || + ((fver > tpx_version) && !TopOnlyOK) || + (fgen > tpx_generation)) fatal_error(0,"reading tpx file (%s) version %d with version %d program", - fio_getname(fp),file_version,tpx_version); - + fio_getname(fp),fver,tpx_version); + do_section(eitemHEADER,bRead); do_int (tpx->natoms); do_int (tpx->step); @@ -780,6 +960,11 @@ static void do_tpxheader(int fp,bool bRead,t_tpxheader *tpx) do_int (tpx->bV); do_int (tpx->bF); do_int (tpx->bBox); + + if((fgen > tpx_generation)) { + /* This can only happen if TopOnlyOK=TRUE */ + tpx->bIr=FALSE; + } } static void do_tpx(int fp,bool bRead,int *step,real *t,real *lambda, @@ -789,7 +974,9 @@ static void do_tpx(int fp,bool bRead,int *step,real *t,real *lambda, t_tpxheader tpx; t_inputrec dum_ir; t_topology dum_top; - + bool TopOnlyOK; + int file_version,file_generation; + if (!bRead) { tpx.natoms = *natoms; tpx.step = *step; @@ -803,39 +990,48 @@ static void do_tpx(int fp,bool bRead,int *step,real *t,real *lambda, tpx.bBox = (box != NULL); } - do_tpxheader(fp,bRead,&tpx); + TopOnlyOK = (ir==NULL); + do_tpxheader(fp,bRead,&tpx,TopOnlyOK,&file_version,&file_generation); + if (bRead) { *natoms = tpx.natoms; *step = tpx.step; *t = tpx.t; *lambda = tpx.lambda; } - + #define do_test(b,p) if (bRead && (p!=NULL) && !b) fatal_error(0,"No %s in %s",#p,fio_getname(fp)) - + do_test(tpx.bBox,box); do_section(eitemBOX,bRead); if (tpx.bBox) ndo_rvec(box,DIM); - do_test(tpx.bIr,ir); - do_section(eitemIR,bRead); - if (tpx.bIr) { - if (ir) - do_inputrec(ir,bRead); - else { - init_inputrec(&dum_ir); - do_inputrec (&dum_ir,bRead); - done_inputrec(&dum_ir); + /* Prior to tpx version 26, the inputrec was here. + * I moved it to enable partial forward-compatibility + * for analysis/viewer programs. + */ + if(file_version<26) { + do_test(tpx.bIr,ir); + do_section(eitemIR,bRead); + if (tpx.bIr) { + if (ir) + do_inputrec(ir,bRead,file_version); + else { + init_inputrec(&dum_ir); + do_inputrec (&dum_ir,bRead,file_version); + done_inputrec(&dum_ir); + } } } + do_test(tpx.bTop,top); do_section(eitemTOP,bRead); if (tpx.bTop) { if (top) - do_top(top,bRead); + do_top(top,bRead, file_version); else { - do_top(&dum_top,bRead); + do_top(&dum_top,bRead,file_version); done_top(&dum_top); } } @@ -850,6 +1046,20 @@ static void do_tpx(int fp,bool bRead,int *step,real *t,real *lambda, do_test(tpx.bF,f); do_section(eitemF,bRead); if (tpx.bF) ndo_rvec(f,*natoms); + + /* Starting with tpx version 26, we have the inputrec + * at the end of the file, so we can ignore it + * if the file is never than the software (but still the + * same generation - see comments at the top of this file. + * + * + */ + if((file_version>=26) && (file_generation<=tpx_generation)) { + do_test(tpx.bIr,ir); + do_section(eitemIR,bRead); + if (tpx.bIr && ir) + do_inputrec(ir,bRead,file_version); + } } /************************************************************ @@ -868,7 +1078,7 @@ void close_tpx(int fp) fio_close(fp); } -void read_tpxheader(char *fn,t_tpxheader *tpx) +void read_tpxheader(char *fn,t_tpxheader *tpx, bool TopOnlyOK,int *file_version, int *file_generation) { int fp; @@ -879,7 +1089,7 @@ void read_tpxheader(char *fn,t_tpxheader *tpx) else { #endif fp = open_tpx(fn,"r"); - do_tpxheader(fp,TRUE,tpx); + do_tpxheader(fp,TRUE,tpx,TopOnlyOK,file_version,file_generation); close_tpx(fp); #ifdef HAVE_XML } @@ -953,12 +1163,12 @@ bool read_tps_conf(char *infile,char *title,t_topology *top, { t_tpxheader header; real t,lambda; - int natoms,step,i; + int natoms,step,i,version,generation; bool bTop,bXNULL; - + bTop=fn2bTPX(infile); if (bTop) { - read_tpxheader(infile,&header); + read_tpxheader(infile,&header,TRUE,&version,&generation); if (x) snew(*x,header.natoms); if (v) diff --git a/src/gmxlib/trnio.c b/src/gmxlib/trnio.c index b61acf95cb..d4cb16b016 100644 --- a/src/gmxlib/trnio.c +++ b/src/gmxlib/trnio.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_trnio_c = "$Id$"; + #include #include "sysstuff.h" @@ -67,8 +67,8 @@ static int nFloatSize(t_trnheader *sh) static bool do_trnheader(int fp,bool bRead,t_trnheader *sh, bool *bOK) { - static int magic=GROMACS_MAGIC; - static char *version = "GMX_trn_file"; + const int magic=GROMACS_MAGIC; + const char *version = "GMX_trn_file"; static bool bFirst=TRUE; char buf[256]; bool bDouble; @@ -100,6 +100,7 @@ static bool do_trnheader(int fp,bool bRead,t_trnheader *sh, bool *bOK) if (!*bOK) return *bOK; bDouble = (nFloatSize(sh) == sizeof(double)); fio_setprecision(fp,bDouble); + if (bRead && bFirst) { fprintf(stderr,"(%s precision)\n",bDouble ? "double" : "single"); bFirst = FALSE; diff --git a/src/gmxlib/trxio.c b/src/gmxlib/trxio.c index 66e1f61f47..dabfc41978 100644 --- a/src/gmxlib/trxio.c +++ b/src/gmxlib/trxio.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_trxio_c = "$Id$"; + #include #include "sysstuff.h" #include "string2.h" diff --git a/src/gmxlib/tstsqrtc.c b/src/gmxlib/tstsqrtc.c index 3237f53c09..e8969a58bb 100644 --- a/src/gmxlib/tstsqrtc.c +++ b/src/gmxlib/tstsqrtc.c @@ -29,7 +29,9 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_tstsqrtc_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "vec.h" int main(int argc,char *argv[]) diff --git a/src/gmxlib/txtdump.c b/src/gmxlib/txtdump.c index 22213141e2..0484d65b37 100644 --- a/src/gmxlib/txtdump.c +++ b/src/gmxlib/txtdump.c @@ -29,7 +29,16 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_txtdump_c = "$Id$"; + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* This file is completely threadsafe - please keep it that way! */ +#ifdef USE_THREADS +#include +#endif + #include #include "smalloc.h" #include "typedefs.h" @@ -38,12 +47,6 @@ static char *SRCID_txtdump_c = "$Id$"; #include "string2.h" #include "vec.h" -static bool bShowNumbers=TRUE; - -void pr_shownumbers(bool bShow) -{ - bShowNumbers=bShow; -} int available(FILE *fp,void *p,char *title) { @@ -80,7 +83,7 @@ int pr_title_nxn(FILE *fp,int indent,char *title,int n1,int n2) return (indent+INDENT); } -void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n) +void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n, bool bShowNumbers) { int i; @@ -95,7 +98,7 @@ void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n) } } -void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n) +void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n, bool bShowNumbers) { int i,j; @@ -116,7 +119,7 @@ void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n) } } -void pr_rvec(FILE *fp,int indent,char *title,real vec[],int n) +void pr_rvec(FILE *fp,int indent,char *title,real vec[],int n, bool bShowNumbers) { int i; @@ -209,7 +212,7 @@ void pr_energies(FILE *fp,int indent,char *title,t_energy *e,int n) void pr_grp_opts(FILE *out,int indent,char *title,t_grpopts *opts) { - int i,m; + int i,m,j; fprintf(out,"%s:\n",title); @@ -231,6 +234,30 @@ void pr_grp_opts(FILE *out,int indent,char *title,t_grpopts *opts) fprintf(out," %10g",opts->tau_t[i]); fprintf(out,"\n"); + /* Pretty-print the imulated annealing info */ + fprintf(out,"anneal:\t\t"); + for(i=0; (ingtc); i++) + fprintf(out," %10s",EANNEAL(opts->annealing[i])); + fprintf(out,"\n"); + + fprintf(out,"ann_npoints:\t"); + for(i=0; (ingtc); i++) + fprintf(out," %10d",opts->anneal_npoints[i]); + fprintf(out,"\n"); + + for(i=0; (ingtc); i++) { + if(opts->anneal_npoints[i]>0) { + fprintf(out,"ann. times [%d]:\t",i); + for(j=0; (janneal_npoints[i]); j++) + fprintf(out," %10.1f",opts->anneal_time[i][j]); + fprintf(out,"\n"); + fprintf(out,"ann. temps [%d]:\t",i); + for(j=0; (janneal_npoints[i]); j++) + fprintf(out," %10.1f",opts->anneal_temp[i][j]); + fprintf(out,"\n"); + } + } + pr_indent(out,indent); fprintf(out,"acc:\t"); for(i=0; (ingacc); i++) @@ -245,6 +272,7 @@ void pr_grp_opts(FILE *out,int indent,char *title,t_grpopts *opts) fprintf(out," %10s",opts->nFreeze[i][m] ? "Y" : "N"); fprintf(out,"\n"); + for(i=0; (ingener); i++) { pr_indent(out,indent); fprintf(out,"energygrp_excl[%3d]:",i); @@ -289,7 +317,7 @@ static void pr_real(FILE *fp,int indent,char *title,real r) fprintf(fp,"%-20s = %g\n",title,r); } -static void pr_str(FILE *fp,int indent,char *title,char *s) +static void pr_str(FILE *fp,int indent,char *title,const char *s) { pr_indent(fp,indent); fprintf(fp,"%-20s = %s\n",title,s); @@ -306,12 +334,14 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir) #define PR(t,s) pr_real(fp,indent,t,s) PS("integrator",EI(ir->eI)); PI("nsteps",ir->nsteps); + PI("init_step",ir->init_step); PS("ns_type",ENS(ir->ns_type)); PI("nstlist",ir->nstlist); PI("ndelta",ir->ndelta); PS("bDomDecomp",BOOL(ir->bDomDecomp)); PI("decomp_dir",ir->decomp_dir); PI("nstcomm",ir->nstcomm); + PI("nstcheckpoint",ir->nstcheckpoint); PI("nstlog",ir->nstlog); PI("nstxout",ir->nstxout); PI("nstvout",ir->nstvout); @@ -338,8 +368,7 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir) PR("tau_p",ir->tau_p); pr_rvecs(fp,indent,"ref_p",ir->ref_p,DIM); pr_rvecs(fp,indent,"compress",ir->compress,DIM); - PS("bSimAnn",BOOL(ir->bSimAnn)); - PR("zero_temp_time",ir->zero_temp_time); + PI("andersen_seed",ir->andersen_seed); PR("rlist",ir->rlist); PS("coulombtype",EELTYPE(ir->coulombtype)); PR("rcoulomb_switch",ir->rcoulomb_switch); @@ -351,6 +380,11 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir) PR("epsilon_r",ir->epsilon_r); else PS("epsilon_r",infbuf); + PS("gb_algorithm",EGBALGORITHM(ir->gb_algorithm)); + PI("nstgbradii",ir->nstgbradii); + PR("rgbradii",ir->rgbradii); + PR("gb_saltconc",ir->gb_saltconc); + PS("implicit_solvent",EIMPLICITSOL(ir->implicit_solvent)); PS("DispCorr",EDISPCORR(ir->eDispCorr)); PR("fudgeQQ",ir->fudgeQQ); PS("free_energy",EFEPTYPE(ir->efep)); @@ -358,6 +392,7 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir) PR("sc_alpha",ir->sc_alpha); PR("sc_sigma",ir->sc_sigma); PR("delta_lambda",ir->delta_lambda); + PS("disre_weighting",EDISREWEIGHTING(ir->eDisreWeighting)); PS("disre_mixed",BOOL(ir->bDisreMixed)); PR("dr_fc",ir->dr_fc); @@ -366,6 +401,11 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir) PR("orires_fc",ir->orires_fc); PR("orires_tau",ir->orires_tau); PR("nstorireout",ir->nstorireout); + + PR("dihre-fc",ir->dihre_fc); + PR("dihre-tau",ir->dihre_tau); + PR("nstdihreout",ir->nstdihreout); + PR("em_stepsize",ir->em_stepsize); PR("em_tol",ir->em_tol); PI("niter",ir->niter); @@ -375,6 +415,7 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir) PR("shake_tol",ir->shake_tol); PI("lincs_order",ir->nProjOrder); PR("lincs_warnangle",ir->LincsWarnAngle); + PI("lincs_iter",ir->nLincsIter); PR("bd_temp",ir->bd_temp); PR("bd_fric",ir->bd_fric); PI("ld_seed",ir->ld_seed); @@ -410,7 +451,8 @@ static void pr_harm(FILE *fp,t_iparams *iparams,char *r,char *kr) void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams) { int i; - + real VA[4],VB[4],*rbcA,*rbcB; + switch (ftype) { case F_ANGLES: case F_G96ANGLES: @@ -471,6 +513,11 @@ void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams) iparams->orires.ex,iparams->orires.label,iparams->orires.power, iparams->orires.c,iparams->orires.obs,iparams->orires.kfac); break; + case F_DIHRES: + fprintf(fp,"label=%d, power=%4d phi=%15.8e, dphi=%15.8e, kfac=%15.8e)\n", + iparams->dihres.label,iparams->dihres.power, + iparams->dihres.phi,iparams->dihres.dphi,iparams->dihres.kfac); + break; case F_POSRES: fprintf(fp,"pos0=(%15.8e,%15.8e,%15.8e), fc=(%15.8e,%15.8e,%15.8e)\n", iparams->posres.pos0[XX],iparams->posres.pos0[YY], @@ -485,6 +532,31 @@ void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams) fprintf(fp,"%srbcB[%d]=%15.8e",i==0?"":", ",i,iparams->rbdihs.rbcB[i]); fprintf(fp,"\n"); break; + case F_FOURDIHS: + /* Use the OPLS -> Ryckaert-Bellemans formula backwards to get the + * OPLS potential constants back. + */ + rbcA = iparams->rbdihs.rbcA; + rbcB = iparams->rbdihs.rbcB; + + VA[3] = -0.25*rbcA[4]; + VA[2] = -0.5*rbcA[3]; + VA[1] = 4.0*VA[3]-rbcA[2]; + VA[0] = 3.0*VA[2]-2.0*rbcA[1]; + + VB[3] = -0.25*rbcB[4]; + VB[2] = -0.5*rbcB[3]; + VB[1] = 4.0*VB[3]-rbcB[2]; + VB[0] = 3.0*VB[2]-2.0*rbcB[1]; + + for (i=0; ishake.dA,iparams->shake.dB); @@ -513,7 +585,7 @@ void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams) } static void pr_ilist(FILE *fp,int indent,char *title, - t_idef *idef,t_ilist *ilist) + t_idef *idef,t_ilist *ilist, bool bShowNumbers) { int i,j,k,type,ftype; t_iatom *iatoms; @@ -554,7 +626,7 @@ static void pr_ilist(FILE *fp,int indent,char *title, } } -void pr_idef(FILE *fp,int indent,char *title,t_idef *idef) +void pr_idef(FILE *fp,int indent,char *title,t_idef *idef, bool bShowNumbers) { int i,j; @@ -575,7 +647,7 @@ void pr_idef(FILE *fp,int indent,char *title,t_idef *idef) } for(j=0; (jil[j]); + idef,&idef->il[j],bShowNumbers); } } @@ -599,7 +671,7 @@ static int pr_block_title(FILE *fp,int indent,char *title,t_block *block) return indent; } -static void low_pr_block(FILE *fp,int indent,char *title,t_block *block) +static void low_pr_block(FILE *fp,int indent,char *title,t_block *block, bool bShowNumbers) { int i; @@ -621,7 +693,7 @@ static void low_pr_block(FILE *fp,int indent,char *title,t_block *block) } } -void pr_block(FILE *fp,int indent,char *title,t_block *block) +void pr_block(FILE *fp,int indent,char *title,t_block *block, bool bShowNumbers) { int i,j,ok,size,start,end; @@ -660,13 +732,13 @@ void pr_block(FILE *fp,int indent,char *title,t_block *block) { (void) pr_indent(fp,indent); (void) fprintf(fp,"tables inconsistent, dumping complete tables:\n"); - low_pr_block(fp,indent,title,block); + low_pr_block(fp,indent,title,block,bShowNumbers); } } } static void pr_blocks(FILE *fp,int indent,char *title, - t_block block[],int n,char *block_names[]) + t_block block[],int n,const char *block_names[], bool bShowNumbers) { int i; char s[STRLEN]; @@ -680,7 +752,7 @@ static void pr_blocks(FILE *fp,int indent,char *title, sprintf(s,"%s[%d]",title,i); else sprintf(s,"%s[%s]",title,block_names[i]); - pr_block(fp,indent,s,&(block[i])); + pr_block(fp,indent,s,&(block[i]),bShowNumbers); } } } @@ -705,7 +777,7 @@ static void pr_atom(FILE *fp,int indent,char *title,t_atom *atom,int n) } static void pr_grps(FILE *fp,int indent,char *title,t_grps grps[],int ngrp, - char **grpname[]) + char **grpname[], bool bShowNumbers) { int i,j; @@ -717,7 +789,7 @@ static void pr_grps(FILE *fp,int indent,char *title,t_grps grps[],int ngrp, } } -static void pr_strings(FILE *fp,int indent,char *title,char ***nm,int n) +static void pr_strings(FILE *fp,int indent,char *title,char ***nm,int n, bool bShowNumbers) { int i; @@ -734,7 +806,7 @@ static void pr_strings(FILE *fp,int indent,char *title,char ***nm,int n) } static void pr_strings2(FILE *fp,int indent,char *title, - char ***nm,char ***nmB,int n) + char ***nm,char ***nmB,int n, bool bShowNumbers) { int i; @@ -750,30 +822,44 @@ static void pr_strings2(FILE *fp,int indent,char *title, } } -static void pr_atoms(FILE *fp,int indent,char *title,t_atoms *atoms) +static void pr_atoms(FILE *fp,int indent,char *title,t_atoms *atoms, bool bShownumbers) { if (available(fp,atoms,title)) { indent=pr_title(fp,indent,title); pr_atom(fp,indent,"atom",atoms->atom,atoms->nr); - pr_grps(fp,indent,"grp",atoms->grps,egcNR,atoms->grpname); - pr_strings(fp,indent,"atom",atoms->atomname,atoms->nr); - pr_strings2(fp,indent,"type",atoms->atomtype,atoms->atomtypeB,atoms->nr); - pr_strings(fp,indent,"residue",atoms->resname,atoms->nres); - pr_strings(fp,indent,"grpname",atoms->grpname,atoms->ngrpname); - pr_block(fp,indent,"excl",&atoms->excl); + pr_grps(fp,indent,"grp",atoms->grps,egcNR,atoms->grpname,bShownumbers); + pr_strings(fp,indent,"atom",atoms->atomname,atoms->nr,bShownumbers); + pr_strings2(fp,indent,"type",atoms->atomtype,atoms->atomtypeB,atoms->nr,bShownumbers); + pr_strings(fp,indent,"residue",atoms->resname,atoms->nres,bShownumbers); + pr_strings(fp,indent,"grpname",atoms->grpname,atoms->ngrpname,bShownumbers); + pr_block(fp,indent,"excl",&atoms->excl,bShownumbers); } } -void pr_top(FILE *fp,int indent,char *title,t_topology *top) +static void pr_atomtypes(FILE *fp,int indent,char *title,t_atomtypes *atomtypes, bool bShowNumbers) +{ + int i; + if (available(fp,atomtypes,title)) { + indent=pr_title(fp,indent,title); + for(i=0;inr;i++) { + pr_indent(fp,indent); + fprintf(fp,"atomtype[%3d]={radius=%12.5e, volume=%12.5e, surftens=%12.5e)}\n", + bShowNumbers?i:-1,atomtypes->radius[i],atomtypes->vol[i],atomtypes->surftens[i]); + } + } +} + +void pr_top(FILE *fp,int indent,char *title,t_topology *top, bool bShowNumbers) { if (available(fp,top,title)) { indent=pr_title(fp,indent,title); (void) pr_indent(fp,indent); (void) fprintf(fp,"name=\"%s\"\n",*(top->name)); - pr_atoms(fp,indent,"atoms",&(top->atoms)); - pr_blocks(fp,indent,"blocks",top->blocks,ebNR,eblock_names); - pr_idef(fp,indent,"idef",&top->idef); + pr_atoms(fp,indent,"atoms",&(top->atoms),bShowNumbers); + pr_atomtypes(fp,indent,"atomtypes",&(top->atomtypes),bShowNumbers); + pr_blocks(fp,indent,"blocks",top->blocks,ebNR,eblock_names, bShowNumbers); + pr_idef(fp,indent,"idef",&top->idef,bShowNumbers); } } diff --git a/src/gmxlib/typedefs.c b/src/gmxlib/typedefs.c index 8441555ccc..4f3c5020f9 100644 --- a/src/gmxlib/typedefs.c +++ b/src/gmxlib/typedefs.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_typedefs_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ #include "smalloc.h" #include "assert.h" #include "symtab.h" diff --git a/src/gmxlib/vec.c b/src/gmxlib/vec.c index 849478dc69..ca47cd0825 100644 --- a/src/gmxlib/vec.c +++ b/src/gmxlib/vec.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_vec_c = "$Id$"; + #include #include #include @@ -38,20 +38,11 @@ static char *SRCID_vec_c = "$Id$"; * Assembly routines are used for Alpha processors, AMD processors * with 3DNow. On IBM we use the MASS libraries if they are present. * - * WE ALSO HAVE AN ASSEMBLY LOOP FOR PENTIUM PROCESSORS, BUT IT CAN - * ONLY BE USED IF YOUR INPUT AND OUTPUT ARRAYS ARE ALIGNED TO - * THE CACHE LINE! - * This is not complicated to do, but you must do it when you allocate - * your memory. Start by allocating 31 bytes more than you need, put - * this in a temp variable (e.g. _buf, so you can free it later), and - * create your aligned array buf with - * - * buf=(real *) ( ( (unsigned long int)_buf + 31 ) & (~0x1f) ); - * - * And, of course, simliar for your output buffer. - * If you have an SSE-enabled CPU (pentium III and later) and OS - * (Linux 2.4 and later) you will now be able to perform 1/sqrt(x) - * in 3-4 clocks/element for long lists! + * We cannot call the SSE/3DNow/SSE2/Altivec from this general loop, + * since the CPU detection is costly and we dont want to maintain + * a separate variable for the cpu detected. Call detectcpu() + * yourself, and use the SSE/3DNow/SSE2/Altivec versions directly + * if the flags match. */ void vecinvsqrt(real in[],real out[],int n) @@ -62,17 +53,15 @@ void vecinvsqrt(real in[],real out[],int n) sqrtiv_(in,out,&n); # else /* SINGLE */ ssqrtiv_(in,out,&n); -# endif +# endif /* SINGLE/DOUBLE */ #elif defined HAVE_LIBMASSV_ANY /* On IBM we should definitely use vectorized MASS if present. */ # ifdef DOUBLE vrsqrt(out,in,&n); # else /* SINGLE */ vsrsqrt(out,in,&n); -# endif -#else /* not alpha, and not IBM with MASS */ - /* Software routines and calls to x86 assembly. */ -#ifdef SOFTWARE_INVSQRT +# endif /* SINGLE/DOUBLE */ +#elif defined SOFTWARE_INVSQRT /* gromacs software 1/sqrt*/ const real half=0.5; const real three=3.0; t_convert result,bit_pattern; @@ -81,59 +70,12 @@ void vecinvsqrt(real in[],real out[],int n) real x; #ifdef DOUBLE real y; -#endif -#endif /* VARIABLES FOR SOFTWARE_INVSQRT */ - int i; - -#if (defined USE_X86_SSE_AND_3DNOW && !defined DOUBLE) - static bool bFirst=TRUE; - static int cpu_capabilities; - - if(bFirst) { - cpu_capabilities=detect_cpu(NULL); - bFirst=FALSE; - } - - if((cpu_capabilities & X86_SSE_SUPPORT) && !((unsigned long int)in & 0x1f) && !((unsigned long int)out & 0x1f)) /* SSE data must be cache aligned */ - vecinvsqrt_sse(in,out,n); - else if(cpu_capabilities & X86_3DNOW_SUPPORT) - vecinvsqrt_3dnow(in,out,n); - else -#endif /* no x86 optimizations */ -#if (defined USE_X86_SSE2 && defined DOUBLE) - static bool bFirst=TRUE; - static int cpu_capabilities; - - if(bFirst) { - cpu_capabilities=detect_cpu(NULL); - bFirst=FALSE; - } - - if((cpu_capabilities & X86_SSE2_SUPPORT) && !((unsigned long int)in & 0x1f) && !((unsigned long int)out & 0x1f)) /* SSE2 data must be cache aligned */ - vecinvsqrt_sse2(in,out,n); - else -#endif /* no sse2 optimizations */ -#ifdef SOFTWARE_INVSQRT - for(i=0;i #include "statutil.h" #include "viewit.h" @@ -37,11 +38,11 @@ static char *SRCID_viewit_c = "$Id$"; #include "filenm.h" #include "macros.h" -static int can_view_ftp[] = { 0, +static const int can_view_ftp[] = { 0, efEPS, efXPM, efXVG, efPDB }; #define NVIEW asize(can_view_ftp) -static char* view_program[] = { NULL, - "ghostview", "xv", NULL, "xterm -e rasmol" }; +static const char* view_program[] = { NULL, + "ghostview", "display", NULL, "xterm -e rasmol" }; int can_view(int ftp) { @@ -57,7 +58,8 @@ int can_view(int ftp) void do_view(char *fn, char *opts) { #define N_EXT 3 - char buf[STRLEN], env[20], ext[N_EXT], *cmd; + char buf[STRLEN], env[20], ext[N_EXT]; + const char *cmd; int ftp, n; if (bDoView() && fn) { diff --git a/src/gmxlib/wgms.c b/src/gmxlib/wgms.c index feb1751a09..0e0f96b12a 100644 --- a/src/gmxlib/wgms.c +++ b/src/gmxlib/wgms.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_wgms_c = "$Id$"; + #include #include "gstat.h" diff --git a/src/gmxlib/widget.c b/src/gmxlib/widget.c index 25f589cf7b..0b994f7b4f 100644 --- a/src/gmxlib/widget.c +++ b/src/gmxlib/widget.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_widget_c = "$Id$"; + #include "widget.h" #include "smalloc.h" #include "fatal.h" @@ -257,7 +257,7 @@ void set_widget_other(windex win,Widget www) w[win].other = www; } -XmString char2xms(char *ptr) +XmString char2xms(const char *ptr) { return XmStringCreate(ptr,XmSTRING_DEFAULT_CHARSET); } diff --git a/src/gmxlib/widget.h b/src/gmxlib/widget.h index eaa925afb3..800a852752 100644 --- a/src/gmxlib/widget.h +++ b/src/gmxlib/widget.h @@ -33,7 +33,7 @@ #ifndef _widget_h #define _widget_h -static char *SRCID_widget_h = "$Id$"; + #include "typedefs.h" #include @@ -62,7 +62,7 @@ extern Widget get_widget_other(windex win,bool bFail); extern void set_widget_other(windex win,Widget www); extern void mk_desc_callbacks(void); -extern XmString char2xms(char *ptr); +extern XmString char2xms(const char *ptr); extern char *xms2char(XmString xms); #endif diff --git a/src/gmxlib/wman.c b/src/gmxlib/wman.c index 53eed9c4e4..b0bcccc0a4 100644 --- a/src/gmxlib/wman.c +++ b/src/gmxlib/wman.c @@ -29,7 +29,6 @@ * And Hey: * Great Red Owns Many ACres of Sand */ -static char *SRCID_wman_c = "$Id$"; #include "string2.h" #include "smalloc.h" #include "sysstuff.h" @@ -47,7 +46,7 @@ typedef struct { char *search,*replace; } t_sandr; -t_sandr sandrTeX[] = { +const t_sandr sandrTeX[] = { { "[TT]", "{\\tt " }, { "[tt]", "}" }, { "[BB]", "{\\bf " }, @@ -72,7 +71,7 @@ t_sandr sandrTeX[] = { }; #define NSRTEX asize(sandrTeX) -t_sandr sandrTty[] = { +const t_sandr sandrTty[] = { { "[TT]", "" }, { "[tt]", "" }, { "[BB]", "" }, @@ -84,7 +83,7 @@ t_sandr sandrTty[] = { }; #define NSRTTY asize(sandrTty) -t_sandr sandrNROFF[] = { +const t_sandr sandrNROFF[] = { { "[TT]", "\n.B " }, { "[tt]", "\n" }, { "[BB]", "\n.B " }, @@ -101,7 +100,7 @@ t_sandr sandrNROFF[] = { }; #define NSRNROFF asize(sandrNROFF) -t_sandr sandrHTML[] = { +const t_sandr sandrHTML[] = { { "<", "<" }, { ">", ">" }, { "[TT]", "" }, @@ -115,29 +114,30 @@ t_sandr sandrHTML[] = { }; #define NSRHTML asize(sandrHTML) -static char *mydate(void) +static char *mydate(char buf[], int maxsize) { - static char *mon[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", + const char *mon[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - static char *day[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; + const char *day[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; time_t now; - static char tbuf[128]; struct tm *tm; (void) time(&now); tm = localtime(&now); - sprintf(tbuf,"%s %d %s %d",day[tm->tm_wday],tm->tm_mday, + /* subtract one from maxsize, so we have room for \0. */ + snprintf(buf,maxsize-1,"%s %d %s %d",day[tm->tm_wday],tm->tm_mday, mon[tm->tm_mon],tm->tm_year+1900); - return tbuf; + return buf; } -static char *repall(char *s,int nsr,t_sandr sa[]) +static const char *repall(const char *s,int nsr,const t_sandr sa[]) { int i; - char *buf,*buf2; + const char *buf; + char *buf2; - buf=s; + buf=s; for(i=0; (isr=NULL; + p->nsr=0; + + return p; +} + +static void finish_linkdata(t_linkdata *p) +{ + int i; + + sfree(p->sr); + for(i=0;insr;i++) { + sfree(p->sr[i].search); + sfree(p->sr[i].replace); + } + sfree(p); +} + + +static char *html_xref(char *s,char *program, t_linkdata *links) { - static int nstr; - static char **str; - static t_sandr *sr=NULL; - char buf[256]; - int i,j; + char buf[256],**filestr; + int i,j,n; - if (sr == NULL) { - nstr=get_file("links.dat",&str); - snew(sr,nstr); - for(i=j=0; (i%s",str[i],str[i]); - sr[j].replace=strdup(buf); + if (links->sr == NULL) { + n=get_file("links.dat",&(filestr)); + links->nsr=n; + snew(links->sr,n); + for(i=0,j=0; (isr[j].search=strdup(filestr[i]); + sprintf(buf,"%s",filestr[i],filestr[i]); + links->sr[j].replace=strdup(buf); j++; } } - nstr=j; + links->nsr=j; + for(i=0;insr,links->sr); } #define FLAG_SET(flag, mask) ((flag & mask) == mask) -char *fileopt(unsigned long flag) +char *fileopt(unsigned long flag,char buf[],int maxsize) { - static char buf[32]; + char tmp[256]; if (FLAG_SET(flag, ffRW)) - strcpy(buf,"In/Out"); + sprintf(tmp,"In/Out"); else if (FLAG_SET(flag, ffREAD)) - strcpy(buf,"Input"); + sprintf(tmp,"Input"); else if (FLAG_SET(flag, ffWRITE)) - strcpy(buf,"Output"); + sprintf(tmp,"Output"); else - strcpy(buf,"Dunno"); + sprintf(tmp,"Dunno"); + if (FLAG_SET(flag, ffOPT)) { - strcat(buf,", Opt"); + strcat(tmp,", Opt"); if (FLAG_SET(flag, ffSET)) - strcat(buf,"!"); + strcat(tmp,"!"); else - strcat(buf,"."); + strcat(tmp,"."); } if (FLAG_SET(flag, ffLIB)) - strcat(buf,", Lib."); + strcat(tmp,", Lib."); if (FLAG_SET(flag, ffMULT)) - strcat(buf,", Mult."); + strcat(tmp,", Mult."); + + snprintf(buf,maxsize-1,tmp); + return buf; } @@ -232,6 +266,7 @@ static void write_texman(FILE *out,char *program, int nbug,char **bugs) { int i; + char tmp[256]; fprintf(out,"\\section{\\normindex{%s}}\n\n",check_tex(program)); @@ -248,7 +283,7 @@ static void write_texman(FILE *out,char *program, fprintf(out,"\\>{\\tt %s} \\'\\> {\\tt %s} \\' %s \\> " "\\parbox[t]{0.55\\linewidth}{%s} \\\\\n", check_tex(fnm[i].opt),check_tex(fnm[i].fns[0]), - check_tex(fileopt(fnm[i].flag)), + check_tex(fileopt(fnm[i].flag,tmp,255)), check_tex(ftp2desc(fnm[i].ftp))); fprintf(out,"\\end{tabbing}\\vspace{-4ex}\n"); } @@ -258,18 +293,18 @@ static void write_texman(FILE *out,char *program, fprintf(out,"{\\tt ~~~~~~~~~~} \\= vector \\= " "{\\tt ~~~~~~~} \\= \\nopagebreak\\kill\n"); for(i=0; (i {\\tt %s} \\'\\> %s \\'\\> {\\tt %s} \\' " "\\parbox[t]{0.68\\linewidth}{%s}\\\\\n", check_tex(pa[i].option),argtp[pa[i].type], - check_tex(pa_val(&(pa[i]))), + check_tex(pa_val(&(pa[i]),tmp,255)), check_tex(pa[i].desc)); else fprintf(out,"\\> {\\tt %s} \\'\\> %s \\'\\>\\\\\n" "\\> \\'\\> \\'\\> {\\tt %s} \\' " "\\parbox[t]{0.7\\linewidth}{%s}\\\\\n", check_tex(pa[i].option),argtp[pa[i].type], - check_tex(pa_val(&(pa[i]))), + check_tex(pa_val(&(pa[i]),tmp,255)), check_tex(pa[i].desc)); } fprintf(out,"\\end{tabbing}\\vspace{-4ex}\n"); @@ -293,8 +328,10 @@ static void write_nroffman(FILE *out, { int i; + char tmp[256]; + - fprintf(out,".TH %s 1 \"%s\"\n",program,mydate()); + fprintf(out,".TH %s 1 \"%s\"\n",program,mydate(tmp,255)); fprintf(out,".SH NAME\n"); fprintf(out,"%s\n",program); fprintf(out,".B %s\n",GromacsVersion()); @@ -329,7 +366,7 @@ static void write_nroffman(FILE *out, fprintf(out,".SH FILES\n"); for(i=0; (i 0) { fprintf(out,"DESCRIPTION:\n\n"); @@ -422,12 +461,12 @@ static void write_ttyman(FILE *out, } } -char *check_html(char *s,char *program) +static const char *check_html(const char *s,char *program, t_linkdata *links) { - char *buf; + const char *buf; buf=repall(s,NSRHTML,sandrHTML); - buf=html_xref(buf,program); + buf=html_xref(buf,program,links); return buf; } @@ -440,9 +479,12 @@ static void write_htmlman(FILE *out, int nbug,char **bugs) { int i; - char link[10]; + char link[10],tmp[255]; + t_linkdata *links; -#define NSR(s) check_html(s,program) + links=init_linkdata(); + +#define NSR(s) check_html(s,program,links) fprintf(out,"\n\n%s\n",program); fprintf(out,"\n"); @@ -456,7 +498,7 @@ static void write_htmlman(FILE *out, "

%s

",program); fprintf(out,"Main Table of Contents
"); fprintf(out,"
\n

%s
\n",GromacsVersion()); - fprintf(out,"%s
\n


\n",mydate()); + fprintf(out,"%s\n
\n",mydate(tmp,255)); if (nldesc > 0) { fprintf(out,"

Description

\n

\n"); @@ -485,7 +527,7 @@ static void write_htmlman(FILE *out, " %s " " %s " "\n", - fnm[i].opt,link,fnm[i].fns[0],fileopt(fnm[i].flag), + fnm[i].opt,link,fnm[i].fns[0],fileopt(fnm[i].flag,tmp,255), NSR(ftp2desc(fnm[i].ftp))); } fprintf(out,"\n"); @@ -510,7 +552,7 @@ static void write_htmlman(FILE *out, " %s " "\n", (pa[i].type == etBOOL)?"-[no]":"-",pa[i].option+1, - argtp[pa[i].type],pa_val(&(pa[i])),NSR(pa[i].desc)); + argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),NSR(pa[i].desc)); fprintf(out,"\n"); } if (nbug > 0) { @@ -528,6 +570,8 @@ static void write_htmlman(FILE *out, "gromacs@gromacs.org
\n"); fprintf(out,"\n"); fprintf(out,"\n"); + + finish_linkdata(links); } static void pr_opts(FILE *fp, diff --git a/src/gmxlib/writeps.c b/src/gmxlib/writeps.c index 56c8d9bc0e..915dc8ded5 100644 --- a/src/gmxlib/writeps.c +++ b/src/gmxlib/writeps.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_writeps_c = "$Id$"; + #include #include "futil.h" #include "fatal.h" @@ -37,111 +37,127 @@ static char *SRCID_writeps_c = "$Id$"; #include "writeps.h" #include "smalloc.h" -static int maxrgb=0; -static int nrgb=0; -static t_rgb *rgb=NULL; +const char *fontnm[efontNR] = { + "Times-Roman","Times-Italic", "Times-Bold", "Times-BoldItalic", + "Helvetica", "Helvetica-Oblique","Helvetica-Bold","Helvetica-BoldOblique", + "Courier", "Courier-Oblique", "Courier-Bold", "Courier-BoldOblique" +}; + + +/* Internal psdata structure (abstract datatype) + * to maintain the current state of the ps engine. + */ +struct t_int_psdata { + FILE *fp; + int maxrgb; + int nrgb; + t_rgb *rgb; + real gen_ybox; + int ostack; +}; -FILE *ps_open(char *fn,real x1,real y1,real x2,real y2) + +t_psdata ps_open(char *fn,real x1,real y1,real x2,real y2) { - FILE *ps; + t_psdata ps; + + snew(ps,1); + + ps->fp=ffopen(fn,"w"); + fprintf(ps->fp,"%%!PS-Adobe-2.0 EPSF-1.2\n"); + fprintf(ps->fp,"%%%%Creator: GROMACS\n"); + fprintf(ps->fp,"%%%%Title: %s\n",fn); + fprintf(ps->fp,"%%%%BoundingBox: %g %g %g %g\n",x1,y1,x2,y2); + fprintf(ps->fp,"%%%%EndComments\n"); + fprintf(ps->fp,"/m {moveto} bind def\n"); + fprintf(ps->fp,"/l {lineto} bind def\n"); + fprintf(ps->fp,"/rm {rmoveto} bind def\n"); + fprintf(ps->fp,"/r {rlineto} bind def\n"); + fprintf(ps->fp,"/f {fill} bind def\n"); + fprintf(ps->fp,"/s {stroke} bind def\n"); + + ps->nrgb=0; + ps->maxrgb=0; + ps->rgb=NULL; + ps->gen_ybox=0; + ps->ostack=0; - ps=ffopen(fn,"w"); - fprintf(ps,"%%!PS-Adobe-2.0 EPSF-1.2\n"); - fprintf(ps,"%%%%Creator: GROMACS\n"); - fprintf(ps,"%%%%Title: %s\n",fn); - fprintf(ps,"%%%%BoundingBox: %g %g %g %g\n",x1,y1,x2,y2); - fprintf(ps,"%%%%EndComments\n"); - fprintf(ps,"/m {moveto} bind def\n"); - fprintf(ps,"/l {lineto} bind def\n"); - fprintf(ps,"/rm {rmoveto} bind def\n"); - fprintf(ps,"/r {rlineto} bind def\n"); - fprintf(ps,"/f {fill} bind def\n"); - fprintf(ps,"/s {stroke} bind def\n"); - - if (nrgb > 0) { - fprintf(stderr,"Warning: resetting color table in %s when opening %s\n", - __FILE__,fn); - nrgb=0; - } - return ps; } -void ps_linewidth(FILE *ps, int lw) +void ps_linewidth(t_psdata ps, int lw) { - fprintf(ps,"%d setlinewidth\n",lw); + fprintf(ps->fp,"%d setlinewidth\n",lw); } -static void ps_defcolor(FILE *ps,real r,real g,real b,char *cname) +static void ps_defcolor(t_psdata ps,real r,real g,real b,char *cname) { - fprintf(ps,"/%s {%g %g %g setrgbcolor} bind def\n",cname,r,g,b); + fprintf(ps->fp,"/%s {%g %g %g setrgbcolor} bind def\n",cname,r,g,b); } -static void ps_selcolor(FILE *ps,char *cname) +static void ps_selcolor(t_psdata ps,char *cname) { - fprintf(ps,"%s\n",cname); + fprintf(ps->fp,"%s\n",cname); } -static char *i2a(int i) -{ - static char buf[12]; - - sprintf(buf,"C%d",i); - - return buf; -} - -static int search_col(FILE *ps,real r,real g,real b) +static int search_col(t_psdata ps,real r,real g,real b) { int i; + char buf[12]; - for(i=0; (inrgb); i++) + if ((ps->rgb[i].r == r) && (ps->rgb[i].g == g) && (ps->rgb[i].b == b)) return i; - if (nrgb >= maxrgb) { - maxrgb+=100; - srenew(rgb,maxrgb); + if (ps->nrgb >= ps->maxrgb) { + ps->maxrgb+=100; + srenew(ps->rgb,ps->maxrgb); } - ps_defcolor(ps,r,g,b,i2a(nrgb)); - fprintf(ps,"/B%d {%s b} bind def\n",nrgb,i2a(nrgb)); - rgb[i].r=r; - rgb[i].g=g; - rgb[i].b=b; - nrgb++; + snprintf(buf,11,"C%d",ps->nrgb); + ps_defcolor(ps,r,g,b,buf); + fprintf(ps->fp,"/B%d {%s b} bind def\n",ps->nrgb,buf); + ps->rgb[i].r=r; + ps->rgb[i].g=g; + ps->rgb[i].b=b; + ps->nrgb++; - return nrgb-1; + return (ps->nrgb-1); } -void ps_color(FILE *ps,real r,real g,real b) +void ps_color(t_psdata ps,real r,real g,real b) { - ps_selcolor(ps,i2a(search_col(ps,r,g,b))); + char buf[12]; + int i; + + i=search_col(ps,r,g,b); + + snprintf(buf,11,"C%d",i); + ps_selcolor(ps,buf); } -void ps_rgb(FILE *ps,t_rgb *rgb) +void ps_rgb(t_psdata ps,t_rgb *rgb) { ps_color(ps,rgb->r,rgb->g,rgb->b); } -static real gen_ybox=0; -void ps_init_rgb_nbox(FILE *ps,real xbox, real ybox) +void ps_init_rgb_nbox(t_psdata ps,real xbox, real ybox) { - gen_ybox=ybox; - fprintf(ps,"/by {def currentpoint " + ps->gen_ybox=ybox; + fprintf(ps->fp,"/by {def currentpoint " "%g y r %g %g r %g y neg r %g %g r f y add moveto} bind def\n", 0.0,xbox,0.0,0.0,-xbox,0.0); /* macro bn is used in ps_rgb_nbox to draw rectangular boxes */ } -void ps_rgb_nbox(FILE *ps,t_rgb *rgb,real n) +void ps_rgb_nbox(t_psdata ps,t_rgb *rgb,real n) { int i; if ( n>2 ) { ps_rgb(ps,rgb); - fprintf(ps,"/y %g by\n",n*gen_ybox); + fprintf(ps->fp,"/y %g by\n",n*ps->gen_ybox); /* macro by is defined in ps_init_rgb_nbox */ } else for (i=0; (ifp,"/b {currentpoint " "%g %g r %g %g r %g %g r %g %g r f %g add moveto} bind def\n", 0.0,ybox,xbox,0.0,0.0,-ybox,-xbox,0.0,ybox); /* macro b is used in search_col to define macro B */ } -void ps_rgb_box(FILE *ps,t_rgb *rgb) +void ps_rgb_box(t_psdata ps,t_rgb *rgb) { - fprintf(ps,"B%d\n",search_col(ps,rgb->r,rgb->g,rgb->b)); + fprintf(ps->fp,"B%d\n",search_col(ps,rgb->r,rgb->g,rgb->b)); /* macro B is defined in search_col from macro b */ } -void ps_lineto(FILE *ps,real x,real y) +void ps_lineto(t_psdata ps,real x,real y) { - fprintf(ps,"%g %g l\n",x,y); + fprintf(ps->fp,"%g %g l\n",x,y); } -void ps_linerel(FILE *ps,real dx,real dy) +void ps_linerel(t_psdata ps,real dx,real dy) { - fprintf(ps,"%g %g r\n",dx,dy); + fprintf(ps->fp,"%g %g r\n",dx,dy); } -void ps_moveto(FILE *ps,real x,real y) +void ps_moveto(t_psdata ps,real x,real y) { - fprintf(ps,"%g %g m\n",x,y); + fprintf(ps->fp,"%g %g m\n",x,y); } -void ps_moverel(FILE *ps,real dx,real dy) +void ps_moverel(t_psdata ps,real dx,real dy) { - fprintf(ps,"%g %g rm\n",dx,dy); + fprintf(ps->fp,"%g %g rm\n",dx,dy); } -void ps_line(FILE *ps,real x1,real y1,real x2,real y2) +void ps_line(t_psdata ps,real x1,real y1,real x2,real y2) { ps_moveto(ps,x1,y1); ps_lineto(ps,x2,y2); - fprintf(ps,"s\n"); + fprintf(ps->fp,"s\n"); } -static void do_box(FILE *ps,real x1,real y1,real x2,real y2) +static void do_box(t_psdata ps,real x1,real y1,real x2,real y2) { ps_moveto(ps,x1,y1); ps_linerel(ps,0,(real)(y2-y1)); @@ -199,137 +215,131 @@ static void do_box(FILE *ps,real x1,real y1,real x2,real y2) ps_linerel(ps,(real)(x1-x2),0); } -void ps_box(FILE *ps,real x1,real y1,real x2,real y2) +void ps_box(t_psdata ps,real x1,real y1,real x2,real y2) { do_box(ps,x1,y1,x2,y2); - fprintf(ps,"s\n"); + fprintf(ps->fp,"s\n"); } -void ps_fillbox(FILE *ps,real x1,real y1,real x2,real y2) +void ps_fillbox(t_psdata ps,real x1,real y1,real x2,real y2) { do_box(ps,x1,y1,x2,y2); - fprintf(ps,"f\n"); + fprintf(ps->fp,"f\n"); } -void ps_arc(FILE *ps,real x1,real y1,real rad,real a0,real a1) +void ps_arc(t_psdata ps,real x1,real y1,real rad,real a0,real a1) { - fprintf(ps,"%g %g %g %g %g arc s\n",x1,y1,rad,a0,a1); + fprintf(ps->fp,"%g %g %g %g %g arc s\n",x1,y1,rad,a0,a1); } -void ps_fillarc(FILE *ps,real x1,real y1,real rad,real a0,real a1) +void ps_fillarc(t_psdata ps,real x1,real y1,real rad,real a0,real a1) { - fprintf(ps,"%g %g %g %g %g arc f\n",x1,y1,rad,a0,a1); + fprintf(ps->fp,"%g %g %g %g %g arc f\n",x1,y1,rad,a0,a1); } -void ps_arcslice(FILE *ps,real xc,real yc, +void ps_arcslice(t_psdata ps,real xc,real yc, real rad1,real rad2,real a0,real a1) { - fprintf(ps,"newpath %g %g %g %g %g arc %g %g %g %g %g arcn closepath s\n", + fprintf(ps->fp,"newpath %g %g %g %g %g arc %g %g %g %g %g arcn closepath s\n", xc,yc,rad1,a0,a1,xc,yc,rad2,a1,a0); } -void ps_fillarcslice(FILE *ps,real xc,real yc, +void ps_fillarcslice(t_psdata ps,real xc,real yc, real rad1,real rad2,real a0,real a1) { - fprintf(ps,"newpath %g %g %g %g %g arc %g %g %g %g %g arcn closepath f\n", + fprintf(ps->fp,"newpath %g %g %g %g %g arc %g %g %g %g %g arcn closepath f\n", xc,yc,rad1,a0,a1,xc,yc,rad2,a1,a0); } -void ps_circle(FILE *ps,real x1,real y1,real rad) +void ps_circle(t_psdata ps,real x1,real y1,real rad) { ps_arc(ps,x1,y1,rad,0,360); } -char *fontnm[efontNR] = { - "Times-Roman","Times-Italic", "Times-Bold", "Times-BoldItalic", - "Helvetica", "Helvetica-Oblique","Helvetica-Bold","Helvetica-BoldOblique", - "Courier", "Courier-Oblique", "Courier-Bold", "Courier-BoldOblique" -}; - -void ps_font(FILE *ps,int font,real size) +void ps_font(t_psdata ps,int font,real size) { if ((font < 0) || (font > efontNR)) { fprintf(stderr,"Invalid Font: %d, using %s\n",font,fontnm[0]); font=0; } - fprintf(ps,"/%s findfont\n",fontnm[font]); - fprintf(ps,"%g scalefont setfont\n",size); + fprintf(ps->fp,"/%s findfont\n",fontnm[font]); + fprintf(ps->fp,"%g scalefont setfont\n",size); } -void ps_strfont(FILE *ps,char *font,real size) +void ps_strfont(t_psdata ps,char *font,real size) { - fprintf(ps,"/%s findfont\n",font); - fprintf(ps,"%g scalefont setfont\n",size); + fprintf(ps->fp,"/%s findfont\n",font); + fprintf(ps->fp,"%g scalefont setfont\n",size); } -void ps_text(FILE *ps,real x1,real y1,char *str) +void ps_text(t_psdata ps,real x1,real y1,char *str) { ps_moveto(ps,x1,y1); - fprintf(ps,"(%s) show\n",str); + fprintf(ps->fp,"(%s) show\n",str); } -void ps_rotate(FILE *ps,bool bPlus) +void ps_rotate(t_psdata ps,bool bPlus) { if (bPlus) - fprintf(ps,"612.5 0 translate 90 rotate\n"); + fprintf(ps->fp,"612.5 0 translate 90 rotate\n"); else - fprintf(ps,"-90 rotate -612.5 0 translate\n"); + fprintf(ps->fp,"-90 rotate -612.5 0 translate\n"); } -void ps_ctext(FILE *ps,real x1,real y1,char *str,int expos) +void ps_ctext(t_psdata ps,real x1,real y1,char *str,int expos) { if (expos == eXLeft) { ps_text(ps,x1,y1,str); return; } ps_moveto(ps,x1,y1); - fprintf(ps,"(%s) stringwidth\n",str); + fprintf(ps->fp,"(%s) stringwidth\n",str); switch (expos) { case eXLeft: - fprintf(ps,"exch 0 exch pop exch\n"); + fprintf(ps->fp,"exch 0 exch pop exch\n"); break; case eXCenter: - fprintf(ps,"exch 2 div neg exch\n"); + fprintf(ps->fp,"exch 2 div neg exch\n"); break; case eXRight: - fprintf(ps,"exch neg exch\n"); + fprintf(ps->fp,"exch neg exch\n"); break; default: fatal_error(0,"invalid position index (expos=%d)",expos); } - fprintf(ps,"rmoveto (%s) show\n",str); + fprintf(ps->fp,"rmoveto (%s) show\n",str); } -void ps_translate(FILE *ps,real x,real y) +void ps_translate(t_psdata ps,real x,real y) { - fprintf(ps,"%g %g translate\n",x,y); + fprintf(ps->fp,"%g %g translate\n",x,y); } -static int ostack=0; - -void ps_setorigin(FILE *ps) +void ps_setorigin(t_psdata ps) { - fprintf(ps,"currentpoint dup 3 -1 roll dup 4 1 roll exch translate\n"); - ostack++; + fprintf(ps->fp,"currentpoint dup 3 -1 roll dup 4 1 roll exch translate\n"); + ps->ostack++; } -void ps_unsetorigin(FILE *ps) +void ps_unsetorigin(t_psdata ps) { - if (ostack <= 0) + if (ps->ostack <= 0) fatal_error(0,"No origin on stack!\n"); - fprintf(ps,"neg exch neg exch translate\n"); - ostack--; + fprintf(ps->fp,"neg exch neg exch translate\n"); + ps->ostack--; } -void ps_close(FILE *ps) +void ps_close(t_psdata ps) { - fprintf(ps,"%%showpage\n"); - fprintf(ps,"%%%%EOF\n"); - fclose(ps); + fprintf(ps->fp,"%%showpage\n"); + fprintf(ps->fp,"%%%%EOF\n"); + fclose(ps->fp); + sfree(ps->rgb); + sfree(ps); } -void ps_comment(FILE *ps,char *s) +void ps_comment(t_psdata ps,char *s) { - fprintf(ps,"%%%% %s\n",s); + fprintf(ps->fp,"%%%% %s\n",s); } diff --git a/src/gmxlib/x86_sse.s b/src/gmxlib/x86_sse.s index f3a3e87219..029f64721f 100644 --- a/src/gmxlib/x86_sse.s +++ b/src/gmxlib/x86_sse.s @@ -126,7 +126,7 @@ _vecinvsqrt_sse: mov eax, [ebp + 8] mov ebx, [ebp + 12] mov ecx, [ebp + 16] - mov edx, ecx + mov edx, ecx movups xmm6,[sse_three] movups xmm7,[sse_minushalf] shr ecx, 3 diff --git a/src/gmxlib/xdrd.c b/src/gmxlib/xdrd.c index ddec4803da..0b17e24cc5 100644 --- a/src/gmxlib/xdrd.c +++ b/src/gmxlib/xdrd.c @@ -29,7 +29,6 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_xdrd_c = "$Id$"; #include "typedefs.h" #include "xdrf.h" #include "fatal.h" @@ -54,19 +53,17 @@ int xdr_real(XDR *xdrs,real *r) int xdr3drcoord(XDR *xdrs, real *fp, int *size, real *precision) { #ifdef DOUBLE - static float *ffp=NULL; + float *ffp; float fprec; int i,ret,isize; isize=*size*DIM; - if (ffp == NULL) { - if (isize > 0) { - snew(ffp,isize); - } - else - fatal_error(0,"Don't know what to malloc for ffp (file %s, line %d)", - __FILE__,__LINE__); - } + if (isize > 0) + snew(ffp,isize); + else + fatal_error(0,"Don't know what to malloc for ffp (file %s, line %d)", + __FILE__,__LINE__); + for(i=0; (i #include @@ -46,10 +46,10 @@ static char *SRCID_xmlio_c = "$Id$"; #include "symtab.h" #include "xmlio.h" -static char *xyz_names[] = { +static const char *xyz_names[] = { "x", "y", "z" }; -static char *tensor_names[] = { +static const char *tensor_names[] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz" }; @@ -68,7 +68,7 @@ typedef struct { real value; } t_masstype; -static char *xmltypes[] = { +static const char *xmltypes[] = { NULL, "XML_ELEMENT_NODE", "XML_ATTRIBUTE_NODE", @@ -106,7 +106,7 @@ enum { exmlCOORDINATES, exmlVELOCITIES, exmlFORCES, exmlNR }; -static char *exml_names[] = { +static const char *exml_names[] = { "gromacs", /* Inputrec stuff */ "parameters", "output", "coupling", "cutoff", "pmeparm", @@ -135,13 +135,13 @@ static int find_elem(char *name,int nr,char *names[]) return i; } -static char *sp(int n) +static char *sp(int n, char buf[], int maxindent) { - static char buf[80]; int i; + if(n>=maxindent) + n=maxindent-1; - /* Don't indent more than 80 characters */ - n = n % 80; + /* Don't indent more than maxindent characters */ for(i=0; (iname; @@ -193,7 +194,7 @@ static void process_attr(FILE *fp,xmlAttrPtr attr,int elem, case exmlFORCES: default: if (fp) - fprintf(fp,"%sProperty: '%s' Value: '%s'\n",sp(indent), + fprintf(fp,"%sProperty: '%s' Value: '%s'\n",sp(indent,buf,99), attrname,attrval); } attr = attr->next; @@ -204,13 +205,14 @@ static void process_attr(FILE *fp,xmlAttrPtr attr,int elem, static void process_tree(FILE *fp,xmlNodePtr tree,int indent,t_xmlrec *xml) { int elem; + char buf[100]; while (tree != NULL) { switch (tree->type) { case XML_ELEMENT_NODE: elem = find_elem((char *)tree->name,exmlNR,exml_names); if (fp) - fprintf(fp,"%sElement node name %s\n",sp(indent),(char *)tree->name); + fprintf(fp,"%sElement node name %s\n",sp(indent,buf,99),(char *)tree->name); process_attr(fp,tree->properties,elem,indent+2,xml); @@ -261,29 +263,19 @@ void read_xml(char *fn,int *step,real *t,real *lambda, sfree(xml); } -static char *itoa(int i) -{ - static char buf[32]; - sprintf(buf,"%d",i); - return buf; -} - -static char *dtoa(double d) -{ - static char buf[32]; - sprintf(buf,"%g",d); - return buf; -} - static void add_xml_int(xmlNodePtr ptr,char *name,int val) { - if (xmlSetProp(ptr,name,itoa(val)) == 0) + char buf[32]; + sprintf(buf,"%d",val); + if (xmlSetProp(ptr,name,buf) == 0) fatal_error(0,"Setting %s %d",name,val); } static void add_xml_real(xmlNodePtr ptr,char *name,real val) { - if (xmlSetProp(ptr,name,dtoa(val)) == 0) + char buf[32]; + sprintf(buf,"%g",val); + if (xmlSetProp(ptr,name,buf) == 0) fatal_error(0,"Setting %s %f",name,val); } @@ -373,6 +365,7 @@ static void add_xml_inputrec(xmlNodePtr parent,t_inputrec *ir,t_atoms *atoms) add_xml_int(outputptr,"energy",ir->nstenergy); add_xml_int(outputptr,"x-xtc",ir->nstxtcout); add_xml_int(outputptr,"xtc-precision",ir->xtcprec); + add_xml_int(outputptr,"andersen_seed",ir->andersen_seed); tcptr = add_xml_child(irptr,exmlTCOUPLING); add_xml_char(tcptr,"algorithm",etcoupl_names[ir->etc]); diff --git a/src/gmxlib/xmlio.h b/src/gmxlib/xmlio.h index 7e01b0eb40..c7f99aa5a7 100644 --- a/src/gmxlib/xmlio.h +++ b/src/gmxlib/xmlio.h @@ -29,7 +29,6 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_xmlio_h = "$Id$"; extern void read_xml(char *fn,int *step,real *t,real *lambda, t_inputrec *ir,rvec *box,int *natoms, rvec **x,rvec **v,rvec **f,t_topology *top); diff --git a/src/gmxlib/xtcio.c b/src/gmxlib/xtcio.c index cec276fbe8..0008cc41ad 100644 --- a/src/gmxlib/xtcio.c +++ b/src/gmxlib/xtcio.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_xtcio_c = "$Id$"; + #include #include "typedefs.h" #include "xdrf.h" diff --git a/src/gmxlib/xvgr.c b/src/gmxlib/xvgr.c index 82a7685060..96b75f47ba 100644 --- a/src/gmxlib/xvgr.c +++ b/src/gmxlib/xvgr.c @@ -29,7 +29,7 @@ * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ -static char *SRCID_xvgr_c = "$Id$"; + #include #include #include "sysstuff.h" @@ -52,15 +52,17 @@ static bool use_xmgr() return (env!=NULL && strcmp(env,"xmgr")==0); } -FILE *xvgropen(char *fn,char *title,char *xaxis,char *yaxis) +FILE *xvgropen(const char *fn,const char *title,const char *xaxis,const char *yaxis) { FILE *xvgr; + char pukestr[100]; + time_t t; xvgr=(FILE *)ffopen(fn,"w"); fprintf(xvgr,"# This file was created by %s\n",Program()); fprintf(xvgr,"# which is part of G R O M A C S:\n"); - fprintf(xvgr,"# %s\n",bromacs()); + fprintf(xvgr,"# %s\n",bromacs(pukestr,99)); time(&t); fprintf(xvgr,"# All this happened at: %s",ctime(&t)); fprintf(xvgr,"#\n"); @@ -114,8 +116,8 @@ void xvgr_line_props(FILE *out, int NrSet, int LineStyle, int LineColor) fprintf(out, "@ s%d color %d\n", NrSet, LineColor); } -static char *LocTypeStr[] = { "view", "world" }; -static char *BoxFillStr[] = { "none", "color", "pattern" }; +static const char *LocTypeStr[] = { "view", "world" }; +static const char *BoxFillStr[] = { "none", "color", "pattern" }; void xvgr_box(FILE *out, int LocType, @@ -174,30 +176,26 @@ real lsq_y_ax_b(int n, real x[], real y[], real *a, real *b) return 0; } -static char *fgets3(FILE *fp) +static char *fgets3(FILE *fp,char ptr[],int *len) { - static char *ptr = NULL; - static int len = STRLEN; char *p; int slen; - - if (ptr==NULL) - snew(ptr,len); - if (fgets(ptr,len-1,fp) == NULL) + if (fgets(ptr,*len-1,fp) == NULL) return NULL; p = ptr; while ((strchr(ptr,'\n') == NULL) && (!feof(fp))) { /* This line is longer than len characters, let's increase len! */ - len += STRLEN; - p += STRLEN; - srenew(ptr,len); + *len += STRLEN; + p += STRLEN; + srenew(ptr,*len); if (fgets(p-1,STRLEN,fp) == NULL) break; } slen = strlen(ptr); if (ptr[slen-1] == '\n') ptr[slen-1] = '\0'; + return ptr; } @@ -229,13 +227,17 @@ int read_xvg(char *fn,real ***y,int *ny) int k,line=0,nny,nx,maxx,rval; double lf; real **yy=NULL; - + char *tmpbuf; + int len=STRLEN; *ny = 0; nny = 0; nx = 0; maxx = 0; fp = ffopen(fn,"r"); - while ((ptr = fgets3(fp)) != NULL) { + + snew(tmpbuf,len); + + while ((ptr = fgets3(fp,tmpbuf,&len)) != NULL) { line++; trim(ptr); if ((ptr[0] != '@') && (ptr[0] != '#')) { @@ -283,7 +285,8 @@ int read_xvg(char *fn,real ***y,int *ny) ffclose(fp); *y = yy; - + sfree(tmpbuf); + return nx; } diff --git a/src/kernel/add_par.c b/src/kernel/add_par.c index 4ddab07acd..0ce57f92dd 100644 --- a/src/kernel/add_par.c +++ b/src/kernel/add_par.c @@ -29,7 +29,9 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_add_par_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "typedefs.h" #include "smalloc.h" diff --git a/src/kernel/add_par.h b/src/kernel/add_par.h index d563f0f3a4..206b0b2470 100644 --- a/src/kernel/add_par.h +++ b/src/kernel/add_par.h @@ -33,7 +33,7 @@ #ifndef _add_par_h #define _add_par_h -static char *SRCID_add_par_h = "$Id$"; + #include "typedefs.h" #include "pdb2top.h" diff --git a/src/kernel/convparm.c b/src/kernel/convparm.c index 552c3ccb39..e79f1c5c6d 100644 --- a/src/kernel/convparm.c +++ b/src/kernel/convparm.c @@ -29,7 +29,9 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_convparm_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "sysstuff.h" #include "physics.h" @@ -47,7 +49,7 @@ static void assign_param(t_functype ftype,t_iparams *new, real old[MAXFORCEPARAM]) { int i,j; - + /* Set to zero */ for(j=0; (jgeneric.buf[j]=0.0; @@ -146,12 +148,39 @@ static void assign_param(t_functype ftype,t_iparams *new, new->orires.obs = old[4]; new->orires.kfac = old[5]; break; + case F_DIHRES: + new->dihres.label = old[0]; + new->dihres.phi = old[1]; + new->dihres.dphi = old[2]; + new->dihres.kfac = old[3]; + new->dihres.power = old[4]; + break; case F_RBDIHS: for (i=0; (irbdihs.rbcA[i]=old[i]; new->rbdihs.rbcB[i]=old[NR_RBDIHS+i]; } break; + case F_FOURDIHS: + /* Read the dihedral parameters to temporary arrays, + * and convert them to the computationally faster + * Ryckaert-Bellemans form. + */ + /* Use conversion formula for OPLS to Ryckaert-Bellemans: */ + new->rbdihs.rbcA[0]=old[1]+0.5*(old[0]+old[2]); + new->rbdihs.rbcA[1]=0.5*(3.0*old[2]-old[0]); + new->rbdihs.rbcA[2]=4.0*old[3]-old[1]; + new->rbdihs.rbcA[3]=-2.0*old[2]; + new->rbdihs.rbcA[4]=-4.0*old[3]; + new->rbdihs.rbcA[5]=0.0; + + new->rbdihs.rbcB[0]=old[NR_FOURDIHS+1]+0.5*(old[NR_FOURDIHS+0]+old[NR_FOURDIHS+2]); + new->rbdihs.rbcB[1]=0.5*(3.0*old[NR_FOURDIHS+2]-old[NR_FOURDIHS+0]); + new->rbdihs.rbcB[2]=4.0*old[NR_FOURDIHS+3]-old[NR_FOURDIHS+1]; + new->rbdihs.rbcB[3]=-2.0*old[NR_FOURDIHS+2]; + new->rbdihs.rbcB[4]=-4.0*old[NR_FOURDIHS+3]; + new->rbdihs.rbcB[5]=0.0; + break; case F_SHAKE: case F_SHAKENC: new->shake.dA = old[0]; @@ -289,7 +318,7 @@ void convert_params(int atnr,t_params nbtypes[], &maxtypes,TRUE,TRUE); enter_function(&(plist[F_POSRES]),(t_functype)F_POSRES,idef, &maxtypes,FALSE,TRUE); - + for(i=0; (i #endif diff --git a/src/kernel/dum_parm.h b/src/kernel/dum_parm.h index 1c6725038f..1db336ba80 100644 --- a/src/kernel/dum_parm.h +++ b/src/kernel/dum_parm.h @@ -33,7 +33,7 @@ #ifndef _dum_parm_h #define _dum_parm_h -static char *SRCID_dum_parm_h = "$Id$"; + #include "typedefs.h" #include "grompp.h" diff --git a/src/kernel/ffscan.c b/src/kernel/ffscan.c index 4067fc700f..bc0ad02594 100644 --- a/src/kernel/ffscan.c +++ b/src/kernel/ffscan.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_ffscan_c = "$Id$"; + #include #include "typedefs.h" #include "macros.h" diff --git a/src/kernel/gctio.c b/src/kernel/gctio.c index d6f3385c3c..d4faafc62f 100644 --- a/src/kernel/gctio.c +++ b/src/kernel/gctio.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_gctio_c = "$Id$"; + #include "typedefs.h" #include "xmdrun.h" #include "block_tx.h" @@ -66,7 +66,7 @@ static int Name2eo(char *s) return res; } -static char *NoYes[] = { "No", "Yes" }; +static const char *NoYes[] = { "No", "Yes" }; static void send_tcr(int dest,t_coupl_rec *tcr) { diff --git a/src/kernel/gen_ad.c b/src/kernel/gen_ad.c index 8530c79ecd..3ce0c84175 100644 --- a/src/kernel/gen_ad.c +++ b/src/kernel/gen_ad.c @@ -29,7 +29,9 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_gen_ad_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include #include "sysstuff.h" @@ -340,9 +342,10 @@ static void clean_dih(t_param *dih, int *ndih,t_param idih[],int nidih, snew(index,*ndih+1); if (bAlldih) { fprintf(stderr,"Keeping all generated dihedrals\n"); - nind = *ndih+1; + nind = *ndih; for(i=0; i 1) qsort(ang,nang,(size_t)sizeof(ang[0]),acomp); - + /* Sort dihedrals with respect to j-k-i-l (middle atoms first) */ if (ndih > 1) qsort(dih,ndih,(size_t)sizeof(dih[0]),dcomp); - + /* Sort the pairs */ if (npai > 1) qsort(pai,npai,(size_t)sizeof(pai[0]),pcomp); @@ -798,7 +802,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, int nrexcl, bool bH14, /* Sort the impropers */ sort_id(nidih,idih); - + if (ndih > 0) { /* Remove dihedrals which are impropers and when bAlldih is not set remove multiple dihedrals over one bond. @@ -806,7 +810,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, int nrexcl, bool bH14, fprintf(stderr,"Before cleaning: %d dihedrals\n",ndih); clean_dih(dih,&ndih,idih,nidih,atoms,bAlldih); } - + /* Now we have unique lists of angles and dihedrals * Copy them into the destination struct */ diff --git a/src/kernel/gen_ad.h b/src/kernel/gen_ad.h index 23026e11da..9e2bd31710 100644 --- a/src/kernel/gen_ad.h +++ b/src/kernel/gen_ad.h @@ -33,10 +33,7 @@ #ifndef _gen_ad_h #define _gen_ad_h -static char *SRCID_gen_ad_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) gen_ad.h 1.17 9/30/97" -#endif /* HAVE_IDENT */ + #include "typedefs.h" #include "toputil.h" #include "topio.h" diff --git a/src/kernel/gen_dum.c b/src/kernel/gen_dum.c index b60b5f3a8a..4f8b5d724a 100644 --- a/src/kernel/gen_dum.c +++ b/src/kernel/gen_dum.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_gen_dum_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -93,7 +93,7 @@ enum { DDB_CH3, DDB_NH3, DDB_NH2, DDB_PHE, DDB_TYR, typedef char t_dirname[STRLEN]; -static t_dirname ddb_dirnames[DDB_DIR_NR] = { +static const t_dirname ddb_dirnames[DDB_DIR_NR] = { "CH3", "NH3", "NH2", diff --git a/src/kernel/gen_dum.h b/src/kernel/gen_dum.h index 8a40401ffe..df0e509f2a 100644 --- a/src/kernel/gen_dum.h +++ b/src/kernel/gen_dum.h @@ -33,7 +33,7 @@ #ifndef _gen_dum_h #define _gen_dum_h -static char *SRCID_gen_dum_h = "$Id$"; + #include "typedefs.h" #include "grompp.h" #include "hackblock.h" diff --git a/src/kernel/genhydro.c b/src/kernel/genhydro.c index 850bbc2815..46a5f170e9 100644 --- a/src/kernel/genhydro.c +++ b/src/kernel/genhydro.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_genhydro_c = "$Id$"; + #include #include #include "assert.h" @@ -140,19 +140,15 @@ static t_hackblock *get_hackblocks(t_atoms *pdba, int nah, t_hackblock ah[], return hb; } -static char Hnum[] = "123456"; +static const char Hnum[] = "123456"; static void expand_hackblocks_one(t_hackblock *hbr, char *atomname, int *nabi, t_hack **abi, bool bN, bool bC) { int j, k, l, d; bool bIgnore; - /* recursion depth is recorded for debug purposes only: */ - static int depth=-1; - depth++; /* we'll recursively add atoms to atoms */ - if (debug) fprintf(debug,"\n[%d] %s:",depth,atomname); for(j=0; j < hbr->nhack; j++) { /* first check if we're in the N- or C-terminus, then we should ignore all hacks involving atoms from resp. previous or next residue @@ -209,7 +205,6 @@ static void expand_hackblocks_one(t_hackblock *hbr, char *atomname, nabi, abi, bN, bC); } } - depth--; } static void expand_hackblocks(t_atoms *pdba, t_hackblock hb[], diff --git a/src/kernel/genhydro.h b/src/kernel/genhydro.h index 9d66a46483..9eac97aa55 100644 --- a/src/kernel/genhydro.h +++ b/src/kernel/genhydro.h @@ -33,7 +33,7 @@ #ifndef _genhydro_h #define _genhydro_h -static char *SRCID_genhydro_h = "$Id$"; + #include "pdbio.h" #include "hackblock.h" diff --git a/src/kernel/glaasje.c b/src/kernel/glaasje.c index 7419119529..259495c9f8 100644 --- a/src/kernel/glaasje.c +++ b/src/kernel/glaasje.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_glaasje_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/kernel/glaasje.h b/src/kernel/glaasje.h index d07de406df..6dcf5b39da 100644 --- a/src/kernel/glaasje.h +++ b/src/kernel/glaasje.h @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_glaasje_h = "$Id$"; + extern void do_glas(FILE *log,int start,int homenr,rvec x[],rvec f[], t_forcerec *fr,t_mdatoms *md,int atnr,t_inputrec *ir, real ener[]); diff --git a/src/kernel/gmxcheck.c b/src/kernel/gmxcheck.c index beeeac7bed..7e708dac2c 100644 --- a/src/kernel/gmxcheck.c +++ b/src/kernel/gmxcheck.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_gmxcheck_c = "$Id$"; + #include #include #include diff --git a/src/kernel/gmxdump.c b/src/kernel/gmxdump.c index 9b7360c067..c0db3b7c0b 100644 --- a/src/kernel/gmxdump.c +++ b/src/kernel/gmxdump.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_gmxdump_c = "$Id$"; + #include #include #include @@ -51,7 +51,7 @@ static char *SRCID_gmxdump_c = "$Id$"; #include "trnio.h" #include "txtdump.h" -static void list_tpx(char *fn) +static void list_tpx(char *fn, bool bShowNumbers) { int step,natoms,fp,indent,i,j,**gcount,atot; real t,lambda; @@ -60,11 +60,11 @@ static void list_tpx(char *fn) t_inputrec ir; t_tpxheader tpx; t_topology top; - - read_tpxheader(fn,&tpx); + read_tpxheader(fn,&tpx,TRUE,NULL,NULL); snew(x,tpx.natoms); snew(v,tpx.natoms); snew(f,tpx.natoms); + read_tpx(fn,&step,&t,&lambda, tpx.bIr ? &ir : NULL, tpx.bBox ? box : NULL, @@ -83,7 +83,7 @@ static void list_tpx(char *fn) pr_rvecs(stdout,indent,"x",x,natoms); pr_rvecs(stdout,indent,"v",v,natoms); pr_rvecs(stdout,indent,"f",f,natoms); - pr_top(stdout,indent,"topology",&(top)); + pr_top(stdout,indent,"topology",&(top),bShowNumbers); } snew(gcount,egcNR); @@ -301,10 +301,10 @@ int main(int argc,char *argv[]) CopyRight(stderr,argv[0]); parse_common_args(&argc,argv,0,NFILE,fnm,asize(pa),pa, asize(desc),desc,0,NULL); - - pr_shownumbers(bShowNumbers); + + if (ftp2bSet(efTPX,NFILE,fnm)) - list_tpx(ftp2fn(efTPX,NFILE,fnm)); + list_tpx(ftp2fn(efTPX,NFILE,fnm),bShowNumbers); if (ftp2bSet(efTRX,NFILE,fnm)) list_trx(ftp2fn(efTRX,NFILE,fnm),bXVG); diff --git a/src/kernel/grompp.c b/src/kernel/grompp.c index fee02aee4e..0ba66fd077 100644 --- a/src/kernel/grompp.c +++ b/src/kernel/grompp.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_grompp_c = "$Id$"; + #include #include #include @@ -398,6 +398,11 @@ static int *new_status(char *topfile,char *topppfile,char *confin, if (bVerbose && i) fprintf(stderr,"removed %d orientation restraints\n",i); } + if (opts->eDihre == edrNone) { + i = rm_interactions(F_DIHRES,nrmols,molinfo); + if (bVerbose && i) + fprintf(stderr,"removed %d dihedral restraints\n",i); + } topcat(msys,nrmols,molinfo,ntab,tab,Nsim,Sims,bEnsemble); @@ -546,8 +551,9 @@ static void gen_posres(t_params *pr,char *fn) sfree(v); } -static int search_array(int atnr,int *n,int map[],int key, - t_param param[],int ftype) +static int +search_atomtypes(t_atomtype *at,int *n,int typelist[],int thistype, + t_param param[],int ftype) { int i,nn,nrfp,j,k,found; @@ -555,13 +561,18 @@ static int search_array(int atnr,int *n,int map[],int key, nrfp = NRFP(ftype); for(i=0; (inr && found;j++) { + /* Check nonbonded parameters */ + for(k=0;knr*typelist[i]+j].c[k]==param[at->nr*thistype+j].c[k]); + /* Check radius, volume, surftens */ + found = found && ((at->radius[typelist[i]] == at->radius[thistype]) && + (at->vol[typelist[i]] == at->vol[thistype]) && + (at->surftens[typelist[i]] == at->surftens[thistype])); } if(found) break; @@ -569,10 +580,10 @@ static int search_array(int atnr,int *n,int map[],int key, if (i == nn) { if (debug) - fprintf(debug,"Renumbering atomtype %d to %d\n",key,nn); - if (nn == atnr) + fprintf(debug,"Renumbering atomtype %d to %d\n",thistype,nn); + if (nn == at->nr) fatal_error(0,"Atomtype horror n = %d, %s, %d",nn,__FILE__,__LINE__); - map[nn]=key; + typelist[nn]=thistype; nn++; } *n = nn; @@ -581,14 +592,14 @@ static int search_array(int atnr,int *n,int map[],int key, } static int renum_atype(t_params plist[],t_topology *top, - int atnr,t_inputrec *ir,bool bVerbose) + t_atomtype *at,bool bVerbose) { int i,j,k,l,mi,mj,nat,nrfp,ftype; t_param *nbsnew; - int *map; + int *typelist; - snew(map,atnr); + snew(typelist,at->nr); if (bVerbose) fprintf(stderr,"renumbering atomtypes...\n"); @@ -597,6 +608,10 @@ static int renum_atype(t_params plist[],t_topology *top, * we want to reduce the number of atom types by merging * ones with identical nonbonded interactions, in addition * to removing unused ones. + * + * With Generalized-Born electrostatics, or implicit solvent + * we also check that the atomtype radius, effective_volume + * and surface tension match. */ /* Get nonbonded interaction type */ @@ -605,43 +620,56 @@ static int renum_atype(t_params plist[],t_topology *top, else ftype=F_BHAM; - /* Renumber atomtypes and meanwhile make a list of atomtypes. - * We provide the list of nonbonded parameters so search_array + /* Renumber atomtypes by first making a list of which ones are actually used. + * We provide the list of nonbonded parameters so search_atomtypes * can determine if two types should be merged. */ nat=0; for(i=0; (iatoms.nr); i++) { top->atoms.atom[i].type= - search_array(atnr,&nat,map,top->atoms.atom[i].type,plist[ftype].param,ftype); + search_atomtypes(at,&nat,typelist,top->atoms.atom[i].type, + plist[ftype].param,ftype); top->atoms.atom[i].typeB= - search_array(atnr,&nat,map,top->atoms.atom[i].typeB,plist[ftype].param,ftype); + search_atomtypes(at,&nat,typelist,top->atoms.atom[i].typeB, + plist[ftype].param,ftype); } + /* We now have a list of unique atomtypes in typelist */ + if (debug) - pr_ivec(debug,0,"map",map,nat); - - /* Renumber nlist */ + pr_ivec(debug,0,"typelist",typelist,nat,TRUE); + /* Renumber nlist */ nbsnew = NULL; snew(nbsnew,plist[ftype].nr); + nrfp = NRFP(ftype); for(i=k=0; (inr*mi+mj].c[l]; } + at->radius[i] = at->radius[mi]; + at->vol[i] = at->vol[mi]; + at->surftens[i] = at->surftens[mi]; } + for(i=0; (iradius,nat); + srenew(at->vol,nat); + srenew(at->surftens,nat); + + at->nr=nat; + sfree(nbsnew); - sfree(map); + sfree(typelist); return nat; } @@ -805,7 +833,8 @@ int main (int argc, char *argv[]) char fn[STRLEN],*mdparin; int nerror; bool bNeedVel,bGenVel; - + bool have_radius,have_vol,have_surftens; + t_filenm fnm[] = { { efMDP, NULL, NULL, ffOPTRD }, { efMDP, "-po", "mdout", ffWRITE }, @@ -823,7 +852,7 @@ int main (int argc, char *argv[]) /* Command line options */ static bool bVerbose=TRUE,bRenum=TRUE,bShuffle=FALSE; static bool bRmDumBds=TRUE,bSort=FALSE,bCheckPairs=FALSE; - static int nnodes=1,maxwarn=10; + static int i,nnodes=1,maxwarn=10; static real fr_time=-1; static char *cap=NULL; t_pargs pa[] = { @@ -929,6 +958,29 @@ int main (int argc, char *argv[]) } } + /* If we are doing GBSA, check that we got the parameters we need */ + have_radius=have_vol=have_surftens=TRUE; + for(i=0;i0); + have_vol=have_vol && (atype.vol[i]>0); + have_surftens=have_surftens && (atype.surftens[i]>=0); + } + if(!have_radius && ir->coulombtype==eelGB) { + fprintf(stderr,"Can't do GB electrostatics; the forcefield is missing values for\n" + "atomtype radii, or they might be zero."); + nerror++; + } + if(!have_vol && ir->gb_algorithm==egbKARPLUS) { + fprintf(stderr,"Can't calculate Karplus Born radii; the forcefield is missing values\n" + " for atomtype effective volumes, or they might be zero."); + nerror++; + } + if(!have_surftens && ir->implicit_solvent!=eisNO) { + fprintf(stderr,"Can't do implicit solvent; the forcefield is missing values\n" + " for atomtype surface tension."); + nerror++; + } + if (nerror) { print_warn_num(); if (nerror==1) @@ -955,8 +1007,20 @@ int main (int argc, char *argv[]) clean_dum_bondeds(msys.plist,sys->atoms.nr,bRmDumBds); if (bRenum) - atype.nr=renum_atype(plist, sys, atype.nr, ir, bVerbose); + atype.nr=renum_atype(plist, sys, &atype, bVerbose); + /* Copy the atomtype data to the topology atomtype list */ + sys->atomtypes.nr=atype.nr; + snew(sys->atomtypes.radius,atype.nr); + snew(sys->atomtypes.vol,atype.nr); + snew(sys->atomtypes.surftens,atype.nr); + + for(i=0;iatomtypes.radius[i]=atype.radius[i]; + sys->atomtypes.vol[i]=atype.vol[i]; + sys->atomtypes.surftens[i]=atype.surftens[i]; + } + if (debug) pr_symtab(debug,0,"After renum_atype",&sys->symtab); diff --git a/src/kernel/h_db.c b/src/kernel/h_db.c index 5d9d005bcc..0cc4603b4e 100644 --- a/src/kernel/h_db.c +++ b/src/kernel/h_db.c @@ -29,7 +29,9 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_h_db_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "string2.h" #include "sysstuff.h" @@ -44,8 +46,8 @@ static char *SRCID_h_db_c = "$Id$"; * Here these number are given. Because arrays start at 0 an * extra dummy for index 0 is added */ -/* 1 2 3 4 5 6 7 8 9 */ -int ncontrol[12] = { -1, 3, 3, 3, 3, 4, 3, 1, 3, 3 }; +/* 1 2 3 4 5 6 7 8 9 */ +const int ncontrol[12] = { -1, 3, 3, 3, 3, 4, 3, 1, 3, 3 }; int compaddh(const void *a,const void *b) { diff --git a/src/kernel/h_db.h b/src/kernel/h_db.h index 8d4cffc7d4..a6772d244f 100644 --- a/src/kernel/h_db.h +++ b/src/kernel/h_db.h @@ -33,15 +33,11 @@ #ifndef _h_db_h #define _h_db_h -static char *SRCID_h_db_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) h_db.h 1.10 2/2/97" -#endif /* HAVE_IDENT */ #include "sysstuff.h" #include "hackblock.h" /* number of control atoms for each 'add' type */ -extern int ncontrol[]; +extern const int ncontrol[]; /* functions for the h-database */ diff --git a/src/kernel/hackblock.c b/src/kernel/hackblock.c index 5e29eb5165..8e6990f010 100644 --- a/src/kernel/hackblock.c +++ b/src/kernel/hackblock.c @@ -29,7 +29,9 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_hackblock_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "hackblock.h" #include "smalloc.h" @@ -37,8 +39,8 @@ static char *SRCID_hackblock_c = "$Id$"; #include "string2.h" /* these MUST correspond to the enum in hackblock.h */ -char *btsNames[ebtsNR] = { "bonds", "angles", "dihedrals", "impropers", "exclusions" }; -int btsNiatoms[ebtsNR] = { 2, 3, 4, 4, 2 }; +const char *btsNames[ebtsNR] = { "bonds", "angles", "dihedrals", "impropers", "exclusions" }; +const int btsNiatoms[ebtsNR] = { 2, 3, 4, 4, 2 }; static void free_t_bonded(t_rbonded *rb) { diff --git a/src/kernel/hackblock.h b/src/kernel/hackblock.h index 4ab33c5f77..baf035c9fa 100644 --- a/src/kernel/hackblock.h +++ b/src/kernel/hackblock.h @@ -33,7 +33,7 @@ #ifndef _hackblock_h #define _hackblock_h -static char *SRCID_hackblock_h = "$Id$"; + #include "typedefs.h" #include "pdbio.h" #include "grompp.h" @@ -42,8 +42,8 @@ static char *SRCID_hackblock_h = "$Id$"; /* ebtsBONDS must be the first, new types can be added to the end */ /* these *MUST* correspond to the arrays in hackblock.c */ enum { ebtsBONDS, ebtsANGLES, ebtsPDIHS, ebtsIDIHS, ebtsEXCLS, ebtsNR }; -extern char *btsNames[ebtsNR]; -extern int btsNiatoms[ebtsNR]; +extern const char *btsNames[ebtsNR]; +extern const int btsNiatoms[ebtsNR]; /* if changing any of these structs, make sure that all of the free/clear/copy/merge_t_* functions stay updated */ diff --git a/src/kernel/hizzie.c b/src/kernel/hizzie.c index b265ec29db..b1e7a327b4 100644 --- a/src/kernel/hizzie.c +++ b/src/kernel/hizzie.c @@ -29,7 +29,9 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_hizzie_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include #include "typedefs.h" @@ -41,7 +43,7 @@ static char *SRCID_hizzie_c = "$Id$"; #include "pdb2top.h" #include "string2.h" -static int in_strings(char *key,int nstr,char **str) +static int in_strings(char *key,int nstr,const char **str) { int j; @@ -167,11 +169,11 @@ static void calc_ringh(rvec xattach,rvec xb,rvec xc,rvec xh) } void set_histp(t_atoms *pdba,rvec *x,real angle,real dist){ - static char *prot_acc[] = { + static const char *prot_acc[] = { "O", "OD1", "OD2", "OE1", "OE2", "OG", "OG1", "OH", "OW" }; #define NPA asize(prot_acc) - static char *prot_don[] = { + static const char *prot_don[] = { "N", "NH1", "NH2", "NE", "ND1", "ND2", "NE2", "NZ", "OG", "OG1", "OH", "NE1", "OW" }; #define NPD asize(prot_don) diff --git a/src/kernel/hizzie.h b/src/kernel/hizzie.h index 3e105f532c..85a4431659 100644 --- a/src/kernel/hizzie.h +++ b/src/kernel/hizzie.h @@ -33,7 +33,7 @@ #ifndef _hizzie_h #define _hizzie_h -static char *SRCID_hizzie_h = "$Id$"; + extern void set_histp(t_atoms *pdba,rvec *x,real angle,real distance); /* calculate HIStidine protonation state */ diff --git a/src/kernel/init_sh.c b/src/kernel/init_sh.c index 7c820189f4..23a6a7fadc 100644 --- a/src/kernel/init_sh.c +++ b/src/kernel/init_sh.c @@ -29,7 +29,8 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_init_sh_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ #include "xmdrun.h" #include "smalloc.h" #include "assert.h" diff --git a/src/kernel/ion_data.h b/src/kernel/ion_data.h index 4f1d333678..f78cef8372 100644 --- a/src/kernel/ion_data.h +++ b/src/kernel/ion_data.h @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_ion_data_h = "$Id$"; + typedef struct { real photo,coh,incoh,incoh_abs; diff --git a/src/kernel/ionize.c b/src/kernel/ionize.c index d4f118ce12..15a281ecca 100644 --- a/src/kernel/ionize.c +++ b/src/kernel/ionize.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_ionize_c = "$Id$"; + #include #include "smalloc.h" #include "typedefs.h" @@ -56,7 +56,7 @@ typedef struct { /* Units are barn. They are converted to nm^2 by multiplying */ /* by 1e-10, which is done in Imax (ionize.c) */ -static t_cross cross_sec_h[] = { +static const t_cross cross_sec_h[] = { { 2.63e-2, 1.01e-1, 5.49e-1, 7.12e-3 }, { 9.79e-3, 6.18e-2, 5.83e-1, 9.60e-3 }, { 4.55e-3, 4.16e-2, 5.99e-1, 1.19e-2 }, @@ -64,7 +64,7 @@ static t_cross cross_sec_h[] = { { 1.12e-3, 1.96e-2, 6.09e-1, 1.73e-2 }, { 4.16e-4, 1.13e-2, 6.07e-1, 2.23e-2 } }; -static t_cross cross_sec_c[] = { +static const t_cross cross_sec_c[] = { { 1.99e+2, 5.88e+0, 2.29e+0, 3.06e-2 }, { 8.01e+1, 4.22e+0, 2.56e+0, 4.38e-2 }, { 3.92e+1, 3.26e+0, 2.74e+0, 5.72e-2 }, @@ -72,7 +72,7 @@ static t_cross cross_sec_c[] = { { 1.06e+1, 1.97e+0, 3.04e+0, 9.15e-2 }, { 4.15e+0, 1.30e+0, 3.20e+0, 1.24e-1 } }; -static t_cross cross_sec_n[] = { +static const t_cross cross_sec_n[] = { { 3.91e+2, 8.99e+0, 2.49e+0, 3.43e-2 }, { 1.59e+2, 6.29e+0, 2.86e+0, 5.01e-2 }, { 7.88e+1, 4.76e+0, 3.10e+0, 6.57e-2 }, @@ -80,7 +80,7 @@ static t_cross cross_sec_n[] = { { 2.16e+1, 2.82e+0, 3.46e+0, 1.05e-1 }, { 8.52e+0, 1.88e+0, 3.65e+0, 1.43e-1 } }; -static t_cross cross_sec_o[] = { +static const t_cross cross_sec_o[] = { { 6.90e+2, 1.33e+1, 2.66e+0, 3.75e-2 }, { 2.84e+2, 9.21e+0, 3.14e+0, 5.62e-2 }, { 1.42e+2, 6.85e+0, 3.44e+0, 7.43e-2 }, @@ -88,7 +88,7 @@ static t_cross cross_sec_o[] = { { 3.95e+1, 3.97e+0, 3.87e+0, 1.18e-1 }, { 1.57e+1, 2.64e+0, 4.10e+0, 1.61e-1 } }; -static t_cross cross_sec_s[] = { +static const t_cross cross_sec_s[] = { { 1.10e+4, 5.54e+1, 3.98e+0, 5.42e-2 }, { 4.91e+3, 4.29e+1, 4.71e+0, 8.38e-2 }, { 2.58e+3, 3.36e+1, 5.32e+0, 1.16e-1 }, @@ -100,10 +100,10 @@ static t_cross cross_sec_s[] = { typedef struct { char *name; int nel; - t_cross *cross; + const t_cross *cross; } t_element; -static t_element element[] = { +static const t_element element[] = { { "H", 1, cross_sec_h }, { "C", 6, cross_sec_c }, { "N", 7, cross_sec_n }, @@ -129,7 +129,7 @@ typedef struct { real E_K,E_L,Prob_K,tau; } t_recoil; -t_recoil recoil[] = { +const t_recoil recoil[] = { { 0.0, 0.0, 0.0, 0}, { 0.0136, 0.0, 0.0, 0}, { 0.0246, 0.0, 0.0, 0}, @@ -483,7 +483,8 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir, static int dq_tot,nkd_tot,ephot,mode; static t_cross_atom *ca; static int Eindex=-1; - + static t_Gaussdata gaussrand=NULL; + real factor,E_lost=0; real pt,ptot,pphot,pcoll[ecollNR],tmax; real hboxx,hboxy,rho2; @@ -498,11 +499,12 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir, nphot = ir->userreal2; /* Intensity */ width = ir->userreal3; /* Width of the peak (in time) */ rho = ir->userreal4; /* Diameter of the focal spot (nm) */ - ionize_seed = ir->userint1; /* Random seed for stochastic ionization */ + ionize_seed= ir->userint1; /* Random seed for stochastic ionization */ ephot = ir->userint2; /* Energy of the photons */ mode = ir->userint3; /* Mode of ionizing */ interval = 0.001*ir->userint4; /* Interval between pulses (ps) */ - + gaussrand=init_gauss(ionize_seed); + if ((width <= 0) || (nphot <= 0)) fatal_error(0,"Your parameters for ionization are not set properly\n" "width (userreal3) = %f, nphot (userreal2) = %f", @@ -640,7 +642,8 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir, /* Get parameters for photoelestic effect */ /* Note that in the article this is called 2 theta */ - theta = DEG2RAD*gauss(70.0,26.0,&ionize_seed); + theta = DEG2RAD*gauss(gaussrand)*26.0+70.0; + phi = 2*M_PI*rando(&ionize_seed); if (bL) @@ -669,7 +672,7 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir, dv[m] -= factor*ddv[m]; if (debug) - pr_rvec(debug,0,"ELL",dv,DIM); + pr_rvec(debug,0,"ELL",dv,DIM,TRUE); bIonize = TRUE; } @@ -701,7 +704,7 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir, dv[ZZ] -= factor*cos(theta); */ if (debug) - pr_rvec(debug,0,"INELL",dv,DIM); + pr_rvec(debug,0,"INELL",dv,DIM,TRUE); } break; } diff --git a/src/kernel/ionize.h b/src/kernel/ionize.h index 3af2a82efc..f7ba11c209 100644 --- a/src/kernel/ionize.h +++ b/src/kernel/ionize.h @@ -33,7 +33,7 @@ #ifndef _ionize_h #define _ionize_h -static char *SRCID_ionize_h = "$Id$"; + #include #include "typedefs.h" diff --git a/src/kernel/luck.c b/src/kernel/luck.c index bfea153bc3..2f2c6816ab 100644 --- a/src/kernel/luck.c +++ b/src/kernel/luck.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_luck_c = "$Id$"; + #include #include "copyrite.h" #include "string.h" @@ -37,14 +37,15 @@ static char *SRCID_luck_c = "$Id$"; int main(int argc,char *argv[]) { - + char quote[256]; + /* Necessary to find the library directory before installation */ set_program_name(argv[0]); if ( argc == 2 ) if ( strcmp(argv[1],"-c")==0) CopyRight(stdout,argv[0]); - printf("%s\n",cool_quote()); + printf("%s\n",cool_quote(quote,255,NULL)); return 0; } diff --git a/src/kernel/md.c b/src/kernel/md.c index 30b81ffdeb..17263d2a12 100644 --- a/src/kernel/md.c +++ b/src/kernel/md.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_md_c = "$Id$"; + #include #include #include "typedefs.h" @@ -56,6 +56,7 @@ static char *SRCID_md_c = "$Id$"; #include "xmdrun.h" #include "disre.h" #include "orires.h" +#include "dihre.h" #include "pppm.h" #include "pme.h" #include "mdatoms.h" @@ -160,6 +161,10 @@ void mdrunner(t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], init_orires(stdlog,top->idef.il[F_ORIRES].nr,top->idef.il[F_ORIRES].iatoms, top->idef.iparams,x,mdatoms,&(parm->ir),mcr,fcd); + /* Dihedral Restraints */ + init_dihres(stdlog,top->idef.il[F_DIHRES].nr,top->idef.il[F_DIHRES].iatoms, + top->idef.iparams,&(parm->ir),mcr,fcd); + /* check if there are dummies */ bDummies=FALSE; for(i=0; (iir,parm->box,&t,&t0,&lambda,&lam0,&SAfactor, + init_md(cr,&parm->ir,parm->box,&t,&t0,&lambda,&lam0, &mynrnb,&bTYZ,top, nfile,fnm,&traj,&xtc_traj,&fp_ene,&fp_dgdl,&mdebin,grps, - force_vir,pme_vir,shake_vir,mdatoms,mu_tot,&bNEMD,&vcm,nsb); + force_vir,pme_vir,shake_vir,mdatoms,mu_tot,&bNEMD,&bSimAnn,&vcm,nsb); debug_gmx(); /* Check for polarizable models */ @@ -360,10 +365,10 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], ener[F_TEMP] = sum_ekin(&(parm->ir.opts),grps,parm->ekin,bTYZ); if(parm->ir.etc==etcBERENDSEN) berendsen_tcoupl(&(parm->ir.opts),grps, - parm->ir.delta_t,SAfactor); + parm->ir.delta_t); else if(parm->ir.etc==etcNOSEHOOVER) nosehoover_tcoupl(&(parm->ir.opts),grps, - parm->ir.delta_t,SAfactor); + parm->ir.delta_t); debug_gmx(); /* Initiate data for the special cases */ @@ -390,6 +395,10 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], fprintf(stderr,"starting mdrun '%s'\n%d steps, %8.1f ps.\n\n", *(top->name),parm->ir.nsteps,parm->ir.nsteps*parm->ir.delta_t); } + + /* Initialize values for invmass, etc. */ + update_mdatoms(mdatoms,lambda,TRUE); + /* Set the node time counter to 0 after initialisation */ start_time(); debug_gmx(); @@ -472,7 +481,8 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], /* Set values for invmass etc. This routine not parallellized, but hardly * ever used, only when doing free energy calculations. */ - init_mdatoms(mdatoms,lambda,bFirstStep); + if(parm->ir.efep != efepNO) + update_mdatoms(mdatoms,lambda,FALSE); clear_mat(force_vir); @@ -535,14 +545,11 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], else lambda = lam0 + step*parm->ir.delta_lambda; } - if (parm->ir.bSimAnn) { - SAfactor = 1.0 - t/parm->ir.zero_temp_time; - if (SAfactor < 0) - SAfactor = 0; - } + if (bSimAnn) + update_annealing_target_temp(&(parm->ir.opts),t); if (MASTER(cr) && do_log && !bFFscan) - print_ebin_header(log,step,t,lambda,SAfactor); + print_ebin_header(log,step,t,lambda); if (bDummies) spread_dummy_f(log,x,f,&mynrnb,&top->idef,dummycomm,cr); @@ -597,7 +604,7 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], /* bOK = update(nsb->natoms,START(nsb),HOMENR(nsb),step,lambda,&ener[F_DVDL], */ bOK = TRUE; update(nsb->natoms,START(nsb),HOMENR(nsb),step,lambda,&ener[F_DVDL], - parm,SAfactor,mdatoms,x,graph,f,buf,vold,vt,v, + parm,mdatoms,x,graph,f,buf,vold,vt,v, top,grps,shake_vir,cr,&mynrnb,bTYZ,TRUE,edyn,&pulldata,bNEMD); if (!bOK && !bFFscan) fatal_error(0,"Constraint error: Shake, Lincs or Settle could not solve the constrains"); @@ -694,7 +701,7 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], /* erase the terminate signal */ terminate = 0; } - + /* Do center of mass motion removal */ if (bStopCM && !bFFscan) { check_cm_grp(log,vcm); @@ -732,9 +739,9 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], * target temp when doing simulated annealing */ if(parm->ir.etc==etcBERENDSEN) - berendsen_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t,SAfactor); + berendsen_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t); else if(parm->ir.etc==etcNOSEHOOVER) - nosehoover_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t,SAfactor); + nosehoover_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t); /* Calculate pressure and apply LR correction if PPPM is used */ calc_pres(fr->ePBC,parm->box,parm->ekin,parm->vir,parm->pres, @@ -769,7 +776,7 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], /* Output stuff */ if (MASTER(cr) && !bFFscan) { - bool do_ene,do_dr,do_or; + bool do_ene,do_dr,do_or,do_dihr; upd_mdebin(mdebin,fp_dgdl,mdatoms->tmass,step,t,ener,parm->box,shake_vir, force_vir,parm->vir,parm->pres,grps,mu_tot, @@ -777,8 +784,9 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], do_ene = do_per_step(step,parm->ir.nstenergy) || bLastStep; do_dr = do_per_step(step,parm->ir.nstdisreout) || bLastStep; do_or = do_per_step(step,parm->ir.nstorireout) || bLastStep; - print_ebin(fp_ene,do_ene,do_dr,do_or,do_log?log:NULL,step,t, - eprNORMAL,bCompact,mdebin,fcd,&(top->atoms)); + do_dihr= do_per_step(step,parm->ir.nstdihreout) || bLastStep; + print_ebin(fp_ene,do_ene,do_dr,do_or,do_dihr,do_log?log:NULL,step,t, + eprNORMAL,bCompact,mdebin,fcd,&(top->atoms),&(parm->ir.opts)); if (bVerbose) fflush(log); } @@ -824,10 +832,10 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[], sfree(ct); } if (MASTER(cr)) { - print_ebin(fp_ene,FALSE,FALSE,FALSE,log,step,t, - eprAVER,FALSE,mdebin,fcd,&(top->atoms)); - print_ebin(fp_ene,FALSE,FALSE,FALSE,log,step,t, - eprRMS,FALSE,mdebin,fcd,&(top->atoms)); + print_ebin(fp_ene,FALSE,FALSE,FALSE,FALSE,log,step,t, + eprAVER,FALSE,mdebin,fcd,&(top->atoms),&(parm->ir.opts)); + print_ebin(fp_ene,FALSE,FALSE,FALSE,FALSE,log,step,t, + eprRMS,FALSE,mdebin,fcd,&(top->atoms),&(parm->ir.opts)); close_enx(fp_ene); if (!bRerunMD && parm->ir.nstxtcout) close_xtc_traj(); diff --git a/src/kernel/mdrun.c b/src/kernel/mdrun.c index 4d996da8f2..be1e1cc167 100644 --- a/src/kernel/mdrun.c +++ b/src/kernel/mdrun.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_mdrun_c = "$Id$"; + #include "typedefs.h" #include "macros.h" #include "copyrite.h" @@ -148,9 +148,13 @@ int main(int argc,char *argv[]) static int nDLB=0; static int nnodes=1; static int nstepout=10; + static int nthreads=1; + static t_pargs pa[] = { { "-np", FALSE, etINT, {&nnodes}, "Number of nodes, must be the same as used for grompp" }, + { "-nt", FALSE, etINT, {&nthreads}, + "Number of threads to start on each node" }, { "-v", FALSE, etBOOL,{&bVerbose}, "Be loud and noisy" }, { "-compact", FALSE, etBOOL,{&bCompact}, @@ -185,6 +189,10 @@ int main(int argc,char *argv[]) if (nnodes > 1) fatal_error(0,"GROMACS compiled without MPI support - can't do parallel runs"); #endif +#ifndef USE_THREADS + if(nthreads > 1) + fatal_error(0,"GROMACS compiled without threads support - can only use one thread"); +#endif open_log(ftp2fn(efLOG,NFILE,fnm),cr); diff --git a/src/kernel/mk_ghat.c b/src/kernel/mk_ghat.c index a5cb934063..81351d0ef3 100644 --- a/src/kernel/mk_ghat.c +++ b/src/kernel/mk_ghat.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_mk_ghat_c = "$Id$"; + #include #include #include "copyrite.h" diff --git a/src/kernel/nm2type.c b/src/kernel/nm2type.c index 27b82d913b..85653bdeb9 100644 --- a/src/kernel/nm2type.c +++ b/src/kernel/nm2type.c @@ -29,7 +29,9 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_nm2type_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "maths.h" #include "macros.h" #include "copyrite.h" diff --git a/src/kernel/pdb2gmx.c b/src/kernel/pdb2gmx.c index 8924977a0c..455ba83c69 100644 --- a/src/kernel/pdb2gmx.c +++ b/src/kernel/pdb2gmx.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_pdb2gmx_c = "$Id$"; + #include #include #include "assert.h" @@ -63,7 +63,7 @@ static char *SRCID_pdb2gmx_c = "$Id$"; #include "hizzie.h" -static char *select_res(int nr,int resnr,char *name[],char *expl[],char *title) +static const char *select_res(int nr,int resnr,const char *name[],const char *expl[],char *title) { int sel=0; @@ -78,11 +78,11 @@ static char *select_res(int nr,int resnr,char *name[],char *expl[],char *title) return name[sel]; } -static char *get_asptp(int resnr) +static const char *get_asptp(int resnr) { enum { easp, easpH, easpNR }; - static char *lh[easpNR] = { "ASP", "ASPH" }; - static char *expl[easpNR] = { + const char *lh[easpNR] = { "ASP", "ASPH" }; + const char *expl[easpNR] = { "Not protonated (charge -1)", "Protonated (charge 0)" }; @@ -90,11 +90,11 @@ static char *get_asptp(int resnr) return select_res(easpNR,resnr,lh,expl,"ASPARTIC ACID"); } -static char *get_glutp(int resnr) +static const char *get_glutp(int resnr) { enum { eglu, egluH, egluNR }; - static char *lh[egluNR] = { "GLU", "GLUH" }; - static char *expl[egluNR] = { + const char *lh[egluNR] = { "GLU", "GLUH" }; + const char *expl[egluNR] = { "Not protonated (charge -1)", "Protonated (charge 0)" }; @@ -102,11 +102,11 @@ static char *get_glutp(int resnr) return select_res(egluNR,resnr,lh,expl,"GLUTAMIC ACID"); } -static char *get_lystp(int resnr) +static const char *get_lystp(int resnr) { enum { elys, elysH, elysNR }; - static char *lh[elysNR] = { "LYS", "LYSH" }; - static char *expl[elysNR] = { + const char *lh[elysNR] = { "LYS", "LYSH" }; + const char *expl[elysNR] = { "Not protonated (charge 0)", "Protonated (charge +1)" }; @@ -114,11 +114,11 @@ static char *get_lystp(int resnr) return select_res(elysNR,resnr,lh,expl,"LYSINE"); } -static char *get_cystp(int resnr) +static const char *get_cystp(int resnr) { enum { ecys, ecysH, ecysNR }; - static char *lh[ecysNR] = { "CYS", "CYSH" }; - static char *expl[ecysNR] = { + const char *lh[ecysNR] = { "CYS", "CYSH" }; + const char *expl[ecysNR] = { "Cysteine in disulfide bridge", "Protonated" }; @@ -127,9 +127,9 @@ static char *get_cystp(int resnr) } -static char *get_histp(int resnr) +static const char *get_histp(int resnr) { - static char *expl[ehisNR] = { + const char *expl[ehisNR] = { "H on ND1 only", "H on NE2 only", "H on ND1 and NE2", @@ -155,11 +155,12 @@ static void rename_pdbres(t_atoms *pdba,char *oldnm,char *newnm, } static void rename_pdbresint(t_atoms *pdba,char *oldnm, - char *gettp(int),bool bFullCompare, + const char *gettp(int),bool bFullCompare, t_symtab *symtab) { int i; - char *ptr,*resnm; + const char *ptr; + char *resnm; for(i=0; inres; i++) { resnm=*pdba->resname[i]; @@ -588,7 +589,7 @@ int main(int argc, char *argv[]) char **gnames; matrix box; rvec box_space; - char *ff; + char ff[256]; int i,j,k,l,nrtp; int *swap_index,si; int bts[ebtsNR]; @@ -597,7 +598,7 @@ int main(int argc, char *argv[]) t_symtab symtab; t_atomtype *atype; char fn[256],*top_fn,itp_fn[STRLEN],posre_fn[STRLEN],buf_fn[STRLEN]; - char molname[STRLEN],title[STRLEN],resname[STRLEN]; + char molname[STRLEN],title[STRLEN],resname[STRLEN],quote[256]; char *c; int nah,nNtdb,nCtdb,ntdblist; t_hackblock *ntdb,*ctdb,**tdblist; @@ -873,7 +874,7 @@ int main(int argc, char *argv[]) check_occupancy(&pdba_all,opt2fn("-f",NFILE,fnm)); - ff=choose_ff(); + choose_ff(ff,255); printf("Using %s force field\n",ff); /* Read atomtypes... */ @@ -1089,7 +1090,7 @@ int main(int argc, char *argv[]) sprintf(fn,"chain.pdb"); else sprintf(fn,"chain_%c.pdb",cc->chain); - write_sto_conf(fn,cool_quote(),pdba,x,NULL,box); + write_sto_conf(fn,cool_quote(quote,255,NULL),pdba,x,NULL,box); } } diff --git a/src/kernel/pdb2top.c b/src/kernel/pdb2top.c index 162a8ea4ed..73d08aa311 100644 --- a/src/kernel/pdb2top.c +++ b/src/kernel/pdb2top.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_pdb2top_c = "$Id$"; + #include #include #include @@ -59,7 +59,7 @@ static char *SRCID_pdb2top_c = "$Id$"; #include "add_par.h" /* this must correspond to enum in pdb2top.h */ -char *hh[ehisNR] = { "HISA", "HISB", "HISH", "HIS1" }; +const char *hh[ehisNR] = { "HISA", "HISB", "HISH", "HIS1" }; static int missing_atoms(t_restp *rp, int resnr, t_atoms *at, int i0, int i, bool bCTer) @@ -104,10 +104,9 @@ bool is_int(double x) return (fabs(x-ix) < tol); } -char *choose_ff(void) +char *choose_ff(char ffbuf[],int size) { typedef struct { char *desc,*fn; } t_fff; - static char *fnsel; FILE *in; t_fff *fff; int i,nff,sel; @@ -140,7 +139,7 @@ char *choose_ff(void) else sel=0; - fnsel=strdup(fff[sel].fn); + strncpy(ffbuf,fff[sel].fn,size-1); for(i=0; (i #endif diff --git a/src/kernel/pgutil.h b/src/kernel/pgutil.h index c793d8d88d..20a56085f6 100644 --- a/src/kernel/pgutil.h +++ b/src/kernel/pgutil.h @@ -33,10 +33,6 @@ #ifndef _pgutil_h #define _pgutil_h -static char *SRCID_pgutil_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) pgutil.h 1.14 9/30/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" extern atom_id search_atom(char *type,int start, diff --git a/src/kernel/protonate.c b/src/kernel/protonate.c index 6f6b5e2d39..7e694a9a83 100644 --- a/src/kernel/protonate.c +++ b/src/kernel/protonate.c @@ -29,7 +29,6 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_protonate_c = "$Id$"; #include #include "typedefs.h" #include "macros.h" diff --git a/src/kernel/readir.c b/src/kernel/readir.c index 69d1066191..e667e265ad 100644 --- a/src/kernel/readir.c +++ b/src/kernel/readir.c @@ -29,9 +29,10 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_readir_c = "$Id$"; + #include #include +#include #include "sysstuff.h" #include "smalloc.h" #include "typedefs.h" @@ -43,7 +44,7 @@ static char *SRCID_readir_c = "$Id$"; #include "symtab.h" #include "string2.h" #include "readinp.h" -#include "readir.h" +#include "readir.h" #include "toputil.h" #include "index.h" #include "network.h" @@ -64,6 +65,8 @@ static char tcgrps[STRLEN],tau_t[STRLEN],ref_t[STRLEN], acc[STRLEN],accgrps[STRLEN],freeze[STRLEN],frdim[STRLEN], energy[STRLEN],user1[STRLEN],user2[STRLEN],vcm[STRLEN],xtc_grps[STRLEN], orirefitgrp[STRLEN],egexcl[STRLEN]; +static char anneal[STRLEN],anneal_npoints[STRLEN], + anneal_time[STRLEN],anneal_temp[STRLEN]; static char efield_x[STRLEN],efield_xt[STRLEN],efield_y[STRLEN], efield_yt[STRLEN],efield_z[STRLEN],efield_zt[STRLEN]; @@ -196,11 +199,13 @@ void check_ir(t_inputrec *ir, t_gromppopts *opts,int *nerror) "changing \"yes\" to \"Berendsen\"\n"); } - if(ir->etc==etcNOSEHOOVER && ir->epc==epcBERENDSEN) { + if((ir->etc==etcNOSEHOOVER || ir->etc==etcANDERSEN || ir->etc==etcANDERSENINTERVAL ) + && ir->epc==epcBERENDSEN) { sprintf(warn_buf,"Using Berendsen pressure coupling invalidates the " - "true ensemble for the Nose-Hoover thermostat"); + "true ensemble for the thermostat"); warning(NULL); } + /* ELECTROSTATICS */ /* More checks are in triple check (grompp.c) */ sprintf(err_buf,"epsilon_r must be >= 0 instead of %g\n",ir->epsilon_r); @@ -258,11 +263,21 @@ void check_ir(t_inputrec *ir, t_gromppopts *opts,int *nerror) if((ir->coulombtype == eelSHIFT) || (ir->coulombtype == eelSWITCH) || (ir->vdwtype == evdwSWITCH) || (ir->vdwtype == evdwSHIFT)) if((ir->rlist == ir->rcoulomb) || (ir->rlist == ir->rvdw)) { - sprintf(warn_buf,"For strict energy conservation with switch/shift potentials, rlist should be 0.1 to 0.3 nm larger than rcoulomb/rvdw."); + sprintf(warn_buf,"For energy conservation with switch/shift potentials, rlist should be 0.1 to 0.3 nm larger than rcoulomb/rvdw."); warning(NULL); } - + /* CONSTRAINTS */ + if(ir->etc==etcNO && ir->eConstrAlg==estLINCS && ir->nLincsIter==1) { + sprintf(warn_buf,"For energy conservation with LINCS, lincs_iter should be 2 or larger.\n" + "You can safely ignore this if your system doesn't have any LINCS-constrained bonds;\n" + "for water molecules we normally use the analytical SETTLE algorithm instead."); + warning(NULL); + } + if(((ir->eI == eiSteep) || (ir->eI == eiCG)) && (ir->nLincsIter<4)) { + sprintf(warn_buf,"For energy minimization with constraints, lincs_iter should be 4 to 8."); + warning(NULL); + } } static int str_nelem(char *str,int maxptr,char *ptr[]) @@ -311,6 +326,7 @@ void get_ir(char *mdparin,char *mdparout, snew(dumstr[0],STRLEN); snew(dumstr[1],STRLEN); + CCTYPE ("VARIOUS PREPROCESSING OPTIONS"); STYPE ("title", opts->title, NULL); STYPE ("cpp", opts->cpp, "/lib/cpp"); @@ -323,6 +339,8 @@ void get_ir(char *mdparin,char *mdparout, RTYPE ("tinit", ir->init_t, 0.0); RTYPE ("dt", ir->delta_t, 0.001); ITYPE ("nsteps", ir->nsteps, 0); + CTYPE ("after checkpoint or tpbconv restart we can start on step > 0"); + ITYPE ("init_step", ir->init_step, 0); CTYPE ("mode for center of mass motion removal"); EETYPE("comm-mode", ecm_mode, ecm_names, nerror, TRUE); CTYPE ("number of steps for center of mass motion removal"); @@ -354,6 +372,8 @@ void get_ir(char *mdparin,char *mdparout, ITYPE ("nstxout", ir->nstxout, 100); ITYPE ("nstvout", ir->nstvout, 100); ITYPE ("nstfout", ir->nstfout, 0); + CTYPE ("Checkpointing helps you continue after crashes"); + ITYPE ("nstcheckpoint", ir->nstcheckpoint, 1000); CTYPE ("Output frequency for energies to log file and energy file"); ITYPE ("nstlog", ir->nstlog, 100); ITYPE ("nstenergy", ir->nstenergy, 100); @@ -394,7 +414,8 @@ void get_ir(char *mdparin,char *mdparout, CTYPE ("cut-off lengths"); RTYPE ("rvdw-switch", ir->rvdw_switch, 0.0); RTYPE ("rvdw", ir->rvdw, 1.0); - + + CTYPE ("Apply long range dispersion corrections for Energy and Pressure"); EETYPE("DispCorr", ir->eDispCorr, edispc_names, nerror, TRUE); CTYPE ("Spacing for the PME/PPPM FFT grid"); @@ -410,6 +431,20 @@ void get_ir(char *mdparin,char *mdparout, RTYPE ("epsilon_surface", ir->epsilon_surface, 0.0); EETYPE("optimize_fft",ir->bOptFFT, yesno_names, nerror, TRUE); + CCTYPE ("GENERALIZED BORN ELECTROSTATICS"); + CTYPE ("Algorithm for calculating Born radii"); + EETYPE("gb_algorithm", ir->gb_algorithm, egb_names, nerror, TRUE); + CTYPE ("Frequency of calculating the Born radii inside rlist"); + ITYPE ("nstgbradii", ir->nstgbradii, 1); + CTYPE ("Cutoff for Born radii calculation; the contribution from atoms"); + CTYPE ("between rlist and rgbradii is updated every nstlist steps"); + RTYPE ("rgbradii", ir->rgbradii, 2.0); + CTYPE ("Salt concentration in M for Generalized Born models"); + RTYPE ("gb_saltconc", ir->gb_saltconc, 0.0); + + CCTYPE("IMPLICIT SOLVENT (for use with Generalized Born electrostatics)"); + EETYPE("implicit_solvent", ir->implicit_solvent, eis_names, nerror, TRUE); + /* Coupling stuff */ CCTYPE ("OPTIONS FOR WEAK COUPLING ALGORITHMS"); CTYPE ("Temperature coupling"); @@ -427,11 +462,19 @@ void get_ir(char *mdparin,char *mdparout, STYPE ("compressibility", dumstr[0], NULL); STYPE ("ref-p", dumstr[1], NULL); + CTYPE ("Random seed for Andersen thermostat"); + ITYPE ("andersen_seed", ir->andersen_seed, 815131); + /* Simulated annealing */ - CCTYPE ("SIMULATED ANNEALING CONTROL"); - EETYPE("annealing", ir->bSimAnn, yesno_names, nerror, TRUE); - CTYPE ("Time at which temperature should be zero (ps)"); - RTYPE ("zero-temp_time",ir->zero_temp_time,0.0); + CCTYPE("SIMULATED ANNEALING"); + CTYPE ("Type of annealing for each temperature group (no/single/periodic)"); + STYPE ("annealing", anneal, NULL); + CTYPE ("Number of time points to use for specifying annealing in each group"); + STYPE ("annealing_npoints", anneal_npoints, NULL); + CTYPE ("List of times at the annealing points for each group"); + STYPE ("annealing_time", anneal_time, NULL); + CTYPE ("Temp. at each annealing point, for each group."); + STYPE ("annealing_temp", anneal_temp, NULL); /* Startup run */ CCTYPE ("GENERATE VELOCITIES FOR STARTUP RUN"); @@ -452,6 +495,10 @@ void get_ir(char *mdparin,char *mdparout, RTYPE ("shake-tol", ir->shake_tol, 0.0001); CTYPE ("Highest order in the expansion of the constraint coupling matrix"); ITYPE ("lincs-order", ir->nProjOrder, 4); + CTYPE ("Number of iterations in the final step of LINCS. 1 is fine for"); + CTYPE ("normal simulations, but use 2 to conserve energy in NVE runs."); + CTYPE ("For energy minimization with constraints it should be 4 to 8."); + ITYPE ("lincs-iter", ir->nLincsIter, 1); CTYPE ("Lincs will write a warning to the stderr if in one step a bond"); CTYPE ("rotates over more degrees than"); RTYPE ("lincs-warnangle", ir->LincsWarnAngle, 30.0); @@ -483,6 +530,12 @@ void get_ir(char *mdparin,char *mdparout, STYPE ("orire-fitgrp",orirefitgrp, NULL); CTYPE ("Output frequency for trace(SD) to energy file"); ITYPE ("nstorireout", ir->nstorireout, 100); + CTYPE ("Dihedral angle restraints: No, Simple or Ensemble"); + EETYPE("dihre", opts->eDihre, edisre_names, nerror, TRUE); + RTYPE ("dihre-fc", ir->dihre_fc, 1000.0); + RTYPE ("dihre-tau", ir->dihre_tau, 0.0); + CTYPE ("Output frequency for dihedral values to energy file"); + ITYPE ("nstdihreout", ir->nstdihreout, 100); /* Free energy stuff */ CCTYPE ("Free energy control stuff"); @@ -653,7 +706,7 @@ static void do_numbering(t_atoms *atoms,int ng,char *ptrs[], unsigned short *cbuf; t_grps *groups=&(atoms->grps[gtype]); int i,j,gid,aj,ognr,ntot=0; - char *title; + const char *title; if (debug) fprintf(debug,"Starting numbering %d groups of type %d\n",ng,gtype); @@ -895,11 +948,12 @@ void do_index(char *ndx, { t_block *grps; char warnbuf[STRLEN],**gnames; - int nr,ntcg,ntau_t,nref_t,nacc,nofg; + int nr,ntcg,ntau_t,nref_t,nacc,nofg,nSA,nSA_points,nSA_time,nSA_temp; int nacg,nfreeze,nfrdim,nenergy,nuser,negexcl; char *ptr1[MAXPTR],*ptr2[MAXPTR],*ptr3[MAXPTR]; int i,j,k,restnm; - bool bExcl,bSetTCpar; + real SAtime; + bool bExcl,bSetTCpar,bAnneal; if (bVerbose) fprintf(stderr,"processing index file...\n"); @@ -927,14 +981,6 @@ void do_index(char *ndx, for(i=0; (inr); i++) for(j=0; (jatom[i].grpnr[j]=NOGID; - - if (ir->bSimAnn) { - if (ir->eI==eiMD && ir->etc==etcNO) - fatal_error(0,"You must select a temperature coupling algorithm " - "for simulated annealing"); - if (ir->zero_temp_time == 0) - fatal_error(0,"Cannot anneal to zero temp at t=0"); - } ntau_t = str_nelem(tau_t,MAXPTR,ptr1); nref_t = str_nelem(ref_t,MAXPTR,ptr2); @@ -972,14 +1018,105 @@ void do_index(char *ndx, } } + /* Simulated annealing for each group. There are nr groups */ + nSA = str_nelem(anneal,MAXPTR,ptr1); + if(nSA>0 && nSA != nr) + fatal_error(0,"Not enough annealing values: %d (for %d groups)\n",nSA,nr); + else { + snew(ir->opts.annealing,nr); + snew(ir->opts.anneal_npoints,nr); + snew(ir->opts.anneal_time,nr); + snew(ir->opts.anneal_temp,nr); + if(nSA==0) { + fprintf(stderr,"Not using any simulated annealing\n"); + for(i=0;iopts.annealing[i]=eannNO; + ir->opts.anneal_npoints[i]=0; + ir->opts.anneal_time[i]=NULL; + ir->opts.anneal_temp[i]=NULL; + } + } else { + bAnneal=FALSE; + for(i=0;iopts.annealing[i]=eannNO; + } else if(ptr1[i][0]=='s'|| ptr1[i][0]=='S') { + ir->opts.annealing[i]=eannSINGLE; + bAnneal=TRUE; + } else if(ptr1[i][0]=='p'|| ptr1[i][0]=='P') { + ir->opts.annealing[i]=eannPERIODIC; + bAnneal=TRUE; + } + } + if(bAnneal) { + /* Read the other fields too */ + nSA_points = str_nelem(anneal_npoints,MAXPTR,ptr1); + if(nSA_points!=nSA) + fatal_error(0,"Found %d annealing_npoints values for %d groups\n",nSA_points,nSA); + for(k=0,i=0;iopts.anneal_npoints[i]=strtol(ptr1[i],NULL,10); + if(ir->opts.anneal_npoints[i]==1) + fatal_error(0,"It doesn't make sense to use only one point for annealing!\n"); + snew(ir->opts.anneal_time[i],ir->opts.anneal_npoints[i]); + snew(ir->opts.anneal_temp[i],ir->opts.anneal_npoints[i]); + k += ir->opts.anneal_npoints[i]; + } + + nSA_time = str_nelem(anneal_time,MAXPTR,ptr1); + if(nSA_time!=k) + fatal_error(0,"Found %d annealing_time values, wanter %d\n",nSA_time,k); + nSA_temp = str_nelem(anneal_temp,MAXPTR,ptr2); + if(nSA_temp!=k) + fatal_error(0,"Found %d annealing_temp values, wanted %d\n",nSA_temp,k); + for(i=0,k=0;iopts.anneal_time[i][0] > (ir->init_t+GMX_REAL_EPS)) + fatal_error(0,"First time point for annealing > init_t.\n"); + + for(j=0;jopts.anneal_npoints[i];j++) { + ir->opts.anneal_time[i][j]=atof(ptr1[k]); + ir->opts.anneal_temp[i][j]=atof(ptr2[k]); + if(j>0 && (ir->opts.anneal_time[i][j]opts.anneal_time[i][j-1])) + fatal_error(0,"Annealing timepoints out of order: t=%f comes after t=%f\n", + ir->opts.anneal_time[i][j],ir->opts.anneal_time[i][j-1]); + if(ir->opts.anneal_temp[i][j]<0) + fatal_error(0,"Found negative temperature in annealing: %f\n",ir->opts.anneal_temp[i][j]); + k++; + } + } + /* Print out some summary information, to make sure we got it right */ + for(i=0,k=0;iopts.annealing[i]!=eannNO) { + j=atoms->grps[egcTC].nm_ind[i]; + fprintf(stderr,"Simulated annealing for group %s: %s, %d timepoints\n", + *(atoms->grpname[j]),eann_names[ir->opts.annealing[i]], + ir->opts.anneal_npoints[i]); + fprintf(stderr,"Time (ps) Temperature (K)\n"); + /* All terms except the last one */ + for(j=0;j<(ir->opts.anneal_npoints[i]-1);j++) + fprintf(stderr,"%9.1f %5.1f\n",ir->opts.anneal_time[i][j],ir->opts.anneal_temp[i][j]); + + /* Finally the last one */ + j = ir->opts.anneal_npoints[i]-1; + if(ir->opts.annealing[i]==eannSINGLE) + fprintf(stderr,"%9.1f- %5.1f\n",ir->opts.anneal_time[i][j],ir->opts.anneal_temp[i][j]); + else { + fprintf(stderr,"%9.1f %5.1f\n",ir->opts.anneal_time[i][j],ir->opts.anneal_temp[i][j]); + if(fabs(ir->opts.anneal_temp[i][j]-ir->opts.anneal_temp[i][0])>GMX_REAL_EPS) + fprintf(stderr,"Note: There is a temperature jump when your annealing loops back.\n"); + } + } + } + } + } + } + nacc = str_nelem(acc,MAXPTR,ptr1); nacg = str_nelem(accgrps,MAXPTR,ptr2); if (nacg*DIM != nacc) fatal_error(0,"Invalid Acceleration input: %d groups and %d acc. values", nacg,nacc); do_numbering(atoms,nacg,ptr2,grps,gnames,egcACC, - restnm,forward,FALSE,bVerbose); - nr=atoms->grps[egcACC].nr; + restnm,forward,FALSE,bVerbose); nr=atoms->grps[egcACC].nr; snew(ir->opts.acc,nr); ir->opts.ngacc=nr; @@ -1104,9 +1241,9 @@ void do_index(char *ndx, sfree(gnames); done_block(grps); sfree(grps); -} + } - static void check_disre(t_topology *sys) + static void check_disre(t_topology *sys) { t_functype *functype; t_iparams *ip; @@ -1220,7 +1357,6 @@ void double_check(t_inputrec *ir,matrix box,t_molinfo *mol,int *nerror) if (TRICLINIC(box)) fprintf(stderr,"Grid search might allow larger cut-off's than simple search with triclinic boxes."); } - } } } diff --git a/src/kernel/readir.h b/src/kernel/readir.h index d3c5cd9c8a..ba95378afe 100644 --- a/src/kernel/readir.h +++ b/src/kernel/readir.h @@ -33,10 +33,6 @@ #ifndef _readir_h #define _readir_h -static char *SRCID_readir_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) readir.h 1.20 9/30/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" #include "string2.h" @@ -44,7 +40,7 @@ static char *SRCID_readir_h = "$Id$"; enum { eshNONE, eshHBONDS, eshALLBONDS, eshHANGLES, eshALLANGLES, eshNR }; -static char *constraints[eshNR+1] = { +static const char *constraints[eshNR+1] = { "none", "h-bonds", "all-bonds", "h-angles", "all-angles", NULL }; @@ -65,6 +61,7 @@ typedef struct { int seed; int eDisre; bool bOrire; + int eDihre; bool bMorse; } t_gromppopts; diff --git a/src/kernel/relax_sh.c b/src/kernel/relax_sh.c index e86c062d6c..fa22462c2c 100644 --- a/src/kernel/relax_sh.c +++ b/src/kernel/relax_sh.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_relax_sh_c = "$Id$"; + #include #include "assert.h" #include "typedefs.h" @@ -85,9 +85,9 @@ static void shell_pos_sd(FILE *log,real step,rvec xold[],rvec xnew[],rvec f[], k_1 = s[i].k_1; do_1pos(xnew[shell],xold[shell],f[shell],k_1,step); if (debug && 0) { - pr_rvec(debug,0,"fshell",f[shell],DIM); - pr_rvec(debug,0,"xold",xold[shell],DIM); - pr_rvec(debug,0,"xnew",xnew[shell],DIM); + pr_rvec(debug,0,"fshell",f[shell],DIM,TRUE); + pr_rvec(debug,0,"xold",xold[shell],DIM,TRUE); + pr_rvec(debug,0,"xnew",xnew[shell],DIM,TRUE); } } } diff --git a/src/kernel/resall.c b/src/kernel/resall.c index b9638a5af0..75a7dc8a55 100644 --- a/src/kernel/resall.c +++ b/src/kernel/resall.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_resall_c = "$Id$"; + #include "sysstuff.h" #include #include "assert.h" diff --git a/src/kernel/resall.h b/src/kernel/resall.h index e8173e5386..6b1722322a 100644 --- a/src/kernel/resall.h +++ b/src/kernel/resall.h @@ -33,11 +33,6 @@ #ifndef _resall_h #define _resall_h -static char *SRCID_resall_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) resall.h 1.16 9/30/97" -#endif /* HAVE_IDENT */ - #include "typedefs.h" #include "hackblock.h" #include "grompp.h" diff --git a/src/kernel/rtp2xml.c b/src/kernel/rtp2xml.c index 5284f7c538..d23743c2e9 100644 --- a/src/kernel/rtp2xml.c +++ b/src/kernel/rtp2xml.c @@ -29,7 +29,7 @@ * And Hey: * GROningen Mixture of Alchemy and Childrens' Stories */ -static char *SRCID_pdb2gmx_c = "$Id$"; + #include #include #include "assert.h" diff --git a/src/kernel/sorting.c b/src/kernel/sorting.c index aa8c14546e..fa72b85f03 100644 --- a/src/kernel/sorting.c +++ b/src/kernel/sorting.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_sorting_c = "$Id$"; + #include #include "sysstuff.h" #include "smalloc.h" diff --git a/src/kernel/sorting.h b/src/kernel/sorting.h index ad35706748..e25dcf1848 100644 --- a/src/kernel/sorting.h +++ b/src/kernel/sorting.h @@ -33,10 +33,6 @@ #ifndef _sorting_h #define _sorting_h -static char *SRCID_sorting_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) sorting.h 1.21 9/30/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" typedef atom_id t_bond[2]; diff --git a/src/kernel/specbond.c b/src/kernel/specbond.c index 1ddc7d4343..05de66ddd1 100644 --- a/src/kernel/specbond.c +++ b/src/kernel/specbond.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_specbond_c = "$Id$"; + #include #include #include "typedefs.h" @@ -54,7 +54,7 @@ bool yesno(void) t_specbond *get_specbonds(int *nspecbond) { - static char *sbfile="specbond.dat"; + const char *sbfile="specbond.dat"; t_specbond *sb=NULL; char r1buf[32],r2buf[32],a1buf[32],a2buf[32],nr1buf[32],nr2buf[32]; diff --git a/src/kernel/specbond.h b/src/kernel/specbond.h index 7a07a98cc1..c901e5347a 100644 --- a/src/kernel/specbond.h +++ b/src/kernel/specbond.h @@ -33,7 +33,6 @@ #ifndef _specbond_h #define _specbond_h -static char *SRCID_specbond_h = "$Id$"; #include "pdb2top.h" extern int mk_specbonds(t_atoms *pdba,rvec x[],bool bInteractive, diff --git a/src/kernel/splitter.c b/src/kernel/splitter.c index e8399c1ed9..90a4a91f71 100644 --- a/src/kernel/splitter.c +++ b/src/kernel/splitter.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_splitter_c = "$Id$"; + #include #include "sysstuff.h" #include "assert.h" @@ -332,8 +332,8 @@ static void split_blocks(bool bVerbose,int nnodes, atom_id *shknum,*cgsnum; if (debug) { - pr_block(debug,0,"cgs",cgs); - pr_block(debug,0,"sblock",sblock); + pr_block(debug,0,"cgs",cgs,TRUE); + pr_block(debug,0,"sblock",sblock,TRUE); } shknum = make_invblock(sblock,cgs->nra+1); @@ -423,8 +423,6 @@ static int sid_comp(const void *a,const void *b) return dd; } -typedef enum { egcolWhite, egcolGrey, egcolBlack, egcolNR } egCol; - static int mk_grey(int nnodes,egCol egc[],t_graph *g,int *AtomI, t_sid sid[]) { @@ -476,7 +474,7 @@ static int mk_sblocks(bool bVerbose,t_graph *g,t_sid sid[]) int ng,nnodes; int nW,nG,nB; /* Number of Grey, Black, White */ int fW,fG; /* First of each category */ - static egCol *egc=NULL; /* The colour of each node */ + egCol *egc=NULL; /* The colour of each node */ int g0,nblock; if (!g->nbound) diff --git a/src/kernel/splitter.h b/src/kernel/splitter.h index cd77598d3c..c3a0f0bea4 100644 --- a/src/kernel/splitter.h +++ b/src/kernel/splitter.h @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_splitter_h = "$Id$"; + extern void split_top(bool bVerbose,int nnodes,t_topology *top,real *capacity); /* Split the topology (blocks and forces, based on charge groups * and shake blocks. diff --git a/src/kernel/ter_db.c b/src/kernel/ter_db.c index 938a486a60..d778199fc3 100644 --- a/src/kernel/ter_db.c +++ b/src/kernel/ter_db.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_ter_db_c = "$Id$"; + #include "sysstuff.h" #include "smalloc.h" #include "typedefs.h" diff --git a/src/kernel/ter_db.h b/src/kernel/ter_db.h index bbe8e3b714..bdb715734c 100644 --- a/src/kernel/ter_db.h +++ b/src/kernel/ter_db.h @@ -33,10 +33,6 @@ #ifndef _ter_db_h #define _ter_db_h -static char *SRCID_ter_db_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) ter_db.h 1.16 9/30/97" -#endif /* HAVE_IDENT */ #include "sysstuff.h" #include "hackblock.h" diff --git a/src/kernel/tomorse.c b/src/kernel/tomorse.c index 5757cadf7c..f2bd2c39cb 100644 --- a/src/kernel/tomorse.c +++ b/src/kernel/tomorse.c @@ -29,7 +29,8 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_tomorse_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ #include #include #include diff --git a/src/kernel/topcat.c b/src/kernel/topcat.c index 9b19a73d9a..13e9aff8df 100644 --- a/src/kernel/topcat.c +++ b/src/kernel/topcat.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_topcat_c = "$Id$"; + #include #include "sysstuff.h" #include "smalloc.h" diff --git a/src/kernel/topcat.h b/src/kernel/topcat.h index 5e2264b231..fa04fe35ee 100644 --- a/src/kernel/topcat.h +++ b/src/kernel/topcat.h @@ -33,11 +33,6 @@ #ifndef _topcat_h #define _topcat_h -static char *SRCID_topcat_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) topcat.h 1.23 9/30/97" -#endif /* HAVE_IDENT */ - #include "typedefs.h" extern void topcat(t_molinfo *dest,int nsrc,t_molinfo src[], diff --git a/src/kernel/topdef.h b/src/kernel/topdef.h index a16b057317..e217c1166f 100644 --- a/src/kernel/topdef.h +++ b/src/kernel/topdef.h @@ -33,10 +33,6 @@ #ifndef _topdef_h #define _topdef_h -static char *SRCID_topdef_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) topdef.h 1.9 11/23/92" -#endif /* HAVE_IDENT */ /* These are the indices for combination rule selection */ #define COMB_GROMOS 1 /* Gromos rules */ diff --git a/src/kernel/topdirs.c b/src/kernel/topdirs.c index d5338a78da..1c7fdadfd2 100644 --- a/src/kernel/topdirs.c +++ b/src/kernel/topdirs.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_topdirs_c = "$Id$"; + #include #include @@ -78,6 +78,10 @@ int ifunc_index(directive d,int type) return F_IDIHS; case 3: return F_RBDIHS; + case 4: + return F_PIDIHS; + case 5: + return F_FOURDIHS; default: fatal_error(0,"Invalid dihedral type %d",type); } @@ -133,6 +137,8 @@ int ifunc_index(directive d,int type) return F_DISRES; case d_orientation_restraints: return F_ORIRES; + case d_dihedral_restraints: + return F_DIHRES; default: fatal_error(0,"invalid directive %s in ifunc_index (%s:%s)", dir2str(d),__FILE__,__LINE__); @@ -211,6 +217,7 @@ void DS_Init(DirStack **DS) set_nec(&(necessary[d_angle_restraints_z]),d_atoms,d_none); set_nec(&(necessary[d_distance_restraints]),d_atoms,d_none); set_nec(&(necessary[d_orientation_restraints]),d_atoms,d_none); + set_nec(&(necessary[d_dihedral_restraints]),d_atoms,d_none); for(i=0; (i #include #include @@ -182,24 +177,20 @@ void preprocess(char *infile,char *outfile, char *cpp,char *define, char *include) { - static char libdir[1024]; - static bool bFirst=TRUE; + char libdir[1024]; char *lib; char command[2048]; int error; - if (bFirst) { - lib=getenv("GMXLIB"); - if (lib!=NULL) { - strcpy(libdir,lib); - } - else { - if(!get_libdir(libdir)) - strcpy(libdir,GMXLIBDIR); - } - bFirst=FALSE; + lib=getenv("GMXLIB"); + if (lib!=NULL) { + strcpy(libdir,lib); + } + else { + if(!get_libdir(libdir)) + strcpy(libdir,GMXLIBDIR); } - + /* build the command line. Second output name is not supported * on OS X it seems, so we use redirection instead in that case. */ @@ -213,7 +204,7 @@ void preprocess(char *infile,char *outfile, if (debug) fprintf(debug,"Command line for cpp:\n\t%s\n",command); - + /* execute preprocessor */ error=system(command); if (error) { @@ -294,6 +285,7 @@ static char **read_topol(char *infile, bool bReadDefaults,bReadMolType,bGenPairs; double qt=0,qBt=0; /* total charge */ t_bond_atomtype *batype; + int lastcg=-1; /* open input and output file */ if ((in = fopen(infile,"r")) == NULL) @@ -460,14 +452,15 @@ static char **read_topol(char *infile, atype->nr); fprintf(stderr,"Generated %d of the %d non-bonded parameter combinations\n",ncombs-ncopy,ncombs); free_nbparam(nbparam,atype->nr); - - if (bGenPairs) { + if (bGenPairs) { gen_pairs(&(plist[nb_funct]),&(plist[F_LJ14]),fudgeLJ,bVerbose); ncopy = copy_nbparams(pair,nb_funct,&(plist[F_LJ14]), atype->nr); fprintf(stderr,"Generated %d of the %d 1-4 parameter combinations\n",ncombs-ncopy,ncombs); free_nbparam(pair,atype->nr); } + /* Copy GBSA parameters to atomtype array */ + bReadMolType = TRUE; } @@ -482,7 +475,7 @@ static char **read_topol(char *infile, break; } case d_atoms: - push_atom(symtab,&(mi0->cgs),&(mi0->atoms),atype,pline); + push_atom(symtab,&(mi0->cgs),&(mi0->atoms),atype,pline,&lastcg); break; case d_pairs: @@ -501,6 +494,7 @@ static char **read_topol(char *infile, case d_angle_restraints_z: case d_distance_restraints: case d_orientation_restraints: + case d_dihedral_restraints: case d_dihedrals: push_bond(d,plist,mi0->plist,&(mi0->atoms),atype,pline,TRUE,bGenPairs); break; diff --git a/src/kernel/topio.h b/src/kernel/topio.h index ddb89c3b3c..8701b5ff4e 100644 --- a/src/kernel/topio.h +++ b/src/kernel/topio.h @@ -33,10 +33,6 @@ #ifndef _topio_h #define _topio_h -static char *SRCID_topio_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) topio.h 1.46 9/30/97" -#endif /* HAVE_IDENT */ #include "typedefs.h" #include "readir.h" diff --git a/src/kernel/toppush.c b/src/kernel/toppush.c index 724f6f5ea3..b74bc229db 100644 --- a/src/kernel/toppush.c +++ b/src/kernel/toppush.c @@ -29,10 +29,6 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_toppush_c = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) toppush.c 1.72 9/30/97" -#endif #include @@ -48,7 +44,6 @@ static char *SRCID_toppush_c = "$Id$"; #include "symtab.h" #include "fatal.h" -static char errbuf[256]; void generate_nbparams(int comb,int ftype,t_params *plist,t_atomtype *atype, real npow) @@ -56,6 +51,7 @@ void generate_nbparams(int comb,int ftype,t_params *plist,t_atomtype *atype, int i,j,k=-1,nf; int nr,nrfp; real c,sig6,sigma_ij,eps_ij,bi,bj; + char errbuf[256]; /* Lean mean shortcuts */ nr = atype->nr; @@ -147,42 +143,75 @@ void push_at (t_symtab *symtab, t_atomtype *at, t_bond_atomtype *bat,char *line, }; int nr,i,nfields,j,pt,nfp0=-1; - int batype_nr; + int batype_nr,nread; char type[STRLEN],btype[STRLEN],ptype[STRLEN]; double m,q; double c[MAXFORCEPARAM]; - char tmpfield[10][100]; /* Max 10 fields of width 100 */ - + double radius,vol,surftens; + char tmpfield[12][100]; /* Max 12 fields of width 100 */ + char errbuf[256]; + /* First assign input line to temporary array */ - nfields=sscanf(line,"%s%s%s%s%s%s%s%s%s%s", - tmpfield[0],tmpfield[1],tmpfield[2],tmpfield[3],tmpfield[4], - tmpfield[5],tmpfield[6],tmpfield[7],tmpfield[8],tmpfield[9]); - + nfields=sscanf(line,"%s%s%s%s%s%s%s%s%s%s%s%s", + tmpfield[0],tmpfield[1],tmpfield[2],tmpfield[3],tmpfield[4],tmpfield[5], + tmpfield[6],tmpfield[7],tmpfield[8],tmpfield[9],tmpfield[10],tmpfield[11]); + switch (nb_funct) { case F_LJ: nfp0 = 2; - /* If the 5th field is a particletype and we have 7 fields in total there - * is a bond_atomtype in field 2, otherwise not (set it identical to atomtype then) */ - if(nfields==7 && strlen(tmpfield[4])==1 && isalpha(tmpfield[4][0])) - sscanf (line,"%s%s%lf%lf%s%lf%lf",type,btype,&m,&q,ptype,&c[0],&c[1]); - else if (nfields==6) { - sscanf (line,"%s%lf%lf%s%lf%lf",type,&m,&q,ptype,&c[0],&c[1]); + /* If the 5th field is a particletype, then there is a bond_atomtype + *iin field 2, otherwise not (set it identical to atomtype then) */ + if(nfields>=7 && strlen(tmpfield[4])==1 && isalpha(tmpfield[4][0])) { + nread = sscanf (line,"%s%s%lf%lf%s%lf%lf%lf%lf%lf", + type,btype,&m,&q,ptype,&c[0],&c[1],&radius,&vol,&surftens); + if(nread<10) + surftens = -1; + if(nread<9) + vol = 0; + if(nread<8) + radius = 0; + } + else if (nfields>=6) { + nread = sscanf (line,"%s%lf%lf%s%lf%lf%lf%lf%lf", + type,&m,&q,ptype,&c[0],&c[1],&radius,&vol,&surftens); + if(nread<9) + surftens = -1; + if(nread<8) + vol = 0; + if(nread<7) + radius = 0; strcpy(btype,type); + } else { too_few(); return; - } + } break; case F_BHAM: nfp0 = 3; /* If the 5th field is a particletype and we have 8 fields in total there * is a bond_atomtype in field 2, otherwise not (set it identical to atomtype then) */ - if(nfields==8 && strlen(tmpfield[4])==1 && isalpha(tmpfield[4][0])) - sscanf (line,"%s%s%lf%lf%s%lf%lf%lf",type,btype,&m,&q,ptype,&c[0],&c[1],&c[2]); - else if (nfields==7) { - sscanf (line,"%s%lf%lf%s%lf%lf%lf",type,&m,&q,ptype,&c[0],&c[1],&c[2]); + if(nfields>=8 && strlen(tmpfield[4])==1 && isalpha(tmpfield[4][0])) { + nread = sscanf (line,"%s%s%lf%lf%s%lf%lf%lf%lf%lf%lf", + type,btype,&m,&q,ptype,&c[0],&c[1],&c[2],&radius,&vol,&surftens); + if(nread<11) + surftens = -1; + if(nread<10) + vol = 0; + if(nread<9) + radius = 0; + } + else if (nfields>=7) { + nread = sscanf (line,"%s%lf%lf%s%lf%lf%lf%lf%lf%lf", + type,&m,&q,ptype,&c[0],&c[1],&c[2],&radius,&vol,&surftens); strcpy(btype,type); + if(nread<10) + surftens = -1; + if(nread<9) + vol = 0; + if(nread<8) + radius = 0; } else { too_few(); return; @@ -235,6 +264,9 @@ void push_at (t_symtab *symtab, t_atomtype *at, t_bond_atomtype *bat,char *line, srenew(at->atomname,nr+1); srenew(at->bondatomtype,nr+1); srenew(at->nb,nr+1); + srenew(at->radius,nr+1); + srenew(at->vol,nr+1); + srenew(at->surftens,nr+1); at->nr++; /* Add space in the non-bonded parameters matrix */ srenew(*nbparam,at->nr); @@ -248,14 +280,18 @@ void push_at (t_symtab *symtab, t_atomtype *at, t_bond_atomtype *bat,char *line, sprintf(errbuf,"Overriding atomtype %s",type); warning(errbuf); nr = i; - } + } + /* fill the arrays */ at->atomname[nr] = put_symtab(symtab,type); at->bondatomtype[nr] = batype_nr; at->atom[nr].ptype = pt; at->atom[nr].m = m; at->atom[nr].q = q; - + at->radius[nr] = radius; + at->vol[nr] = vol; + at->surftens[nr] = surftens; + for (i=0; (inb[nr].c[i] = c[i]; } @@ -267,6 +303,7 @@ static void push_bondtype(t_params *bt,t_param *b,int nral,int ftype, bool bTest,bFound,bId; int nr = bt->nr; int nrfp = NRFP(ftype); + char errbuf[256]; /* Check if this entry overwrites another */ bFound=FALSE; @@ -317,7 +354,7 @@ static void push_bondtype(t_params *bt,t_param *b,int nral,int ftype, void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,char *line) { - static char *formal[MAXATOMLIST+1] = { + const char *formal[MAXATOMLIST+1] = { "%s", "%s%s", "%s%s%s", @@ -325,7 +362,7 @@ void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,ch "%s%s%s%s%s", "%s%s%s%s%s%s" }; - static char *formnl[MAXATOMLIST+1] = { + const char *formnl[MAXATOMLIST+1] = { "%*s", "%*s%*s", "%*s%*s%*s", @@ -333,7 +370,7 @@ void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,ch "%*s%*s%*s%*s%*s", "%*s%*s%*s%*s%*s%*s" }; - static char *formlf[MAXFORCEPARAM] = { + const char *formlf[MAXFORCEPARAM] = { "%lf", "%lf%lf", "%lf%lf%lf", @@ -352,7 +389,8 @@ void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,ch char alc[MAXATOMLIST+1][20]; double c[MAXFORCEPARAM]; t_param p; - + char errbuf[256]; + /* Make format string (nral ints+functype) */ if ((nn=sscanf(line,formal[nral], alc[0],alc[1],alc[2],alc[3],alc[4],alc[5])) != nral+1) { @@ -381,7 +419,7 @@ void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,ch void push_dihedraltype(directive d,t_params bt[],char ***typenames,int ntypes,char *line) { - static char *formal[MAXATOMLIST+1] = { + const char *formal[MAXATOMLIST+1] = { "%s", "%s%s", "%s%s%s", @@ -389,7 +427,7 @@ void push_dihedraltype(directive d,t_params bt[],char ***typenames,int ntypes,ch "%s%s%s%s%s", "%s%s%s%s%s%s" }; - static char *formnl[MAXATOMLIST+1] = { + const char *formnl[MAXATOMLIST+1] = { "%*s", "%*s%*s", "%*s%*s%*s", @@ -397,7 +435,7 @@ void push_dihedraltype(directive d,t_params bt[],char ***typenames,int ntypes,ch "%*s%*s%*s%*s%*s", "%*s%*s%*s%*s%*s%*s" }; - static char *formlf[MAXFORCEPARAM] = { + const char *formlf[MAXFORCEPARAM] = { "%lf", "%lf%lf", "%lf%lf%lf", @@ -416,6 +454,7 @@ void push_dihedraltype(directive d,t_params bt[],char ***typenames,int ntypes,ch char alc[MAXATOMLIST+1][20]; double c[MAXFORCEPARAM]; t_param p; + char errbuf[256]; /* This routine accepts dihedraltypes defined from either 2 or 4 atoms. * @@ -481,8 +520,8 @@ void push_nbt(directive d,t_nbparam **nbt,t_atomtype *atype, char *pline,int nb_funct) { /* swap the atoms */ - static char *form2="%*s%*s%*s%lf%lf"; - static char *form3="%*s%*s%*s%lf%lf%lf"; + const char *form2="%*s%*s%*s%lf%lf"; + const char *form3="%*s%*s%*s%lf%lf%lf"; char a0[80],a1[80]; int i,f,k,ftype,atnr,nrfp; double c[3]; @@ -490,7 +529,8 @@ void push_nbt(directive d,t_nbparam **nbt,t_atomtype *atype, atom_id ai,aj; t_nbparam *nbp; bool bId; - + char errbuf[256]; + if (sscanf (pline,"%s%s%d",a0,a1,&f) != 3) { too_few(); return; @@ -615,10 +655,9 @@ void push_cg(t_block *block, int *lastindex, int index, int a) } void push_atom(t_symtab *symtab,t_block *cgs, - t_atoms *at,t_atomtype *atype,char *line) + t_atoms *at,t_atomtype *atype,char *line,int *lastcg) { int nr,ptype; - static int lastcg; int resnumber,cgnumber,atomnr,type,typeB,nscan; char id[STRLEN],ctype[STRLEN],ctypeB[STRLEN], resname[STRLEN],name[STRLEN]; @@ -669,7 +708,7 @@ void push_atom(t_symtab *symtab,t_block *cgs, if (debug) fprintf(debug,"mB=%g, qB=%g, typeB=%d\n",mB,qB,typeB); - push_cg(cgs,&lastcg,cgnumber,nr); + push_cg(cgs,lastcg,cgnumber,nr); push_atom_now(symtab,at,atomnr,type,ctype,ptype,resnumber,cgnumber, resname,name,m0,q0,typeB, @@ -839,21 +878,21 @@ void push_bondnow(t_params *bond, t_param *b) void push_bond(directive d,t_params bondtype[],t_params bond[], t_atoms *at,t_atomtype *atype,char *line,bool bBonded,bool bGenPairs) { - static char *aaformat[MAXATOMLIST]= { + const char *aaformat[MAXATOMLIST]= { "%d%d", "%d%d%d", "%d%d%d%d", "%d%d%d%d%d", "%d%d%d%d%d%d" }; - static char *asformat[MAXATOMLIST]= { + const char *asformat[MAXATOMLIST]= { "%*s%*s", "%*s%*s%*s", "%*s%*s%*s%*s", "%*s%*s%*s%*s%*s", "%*s%*s%*s%*s%*s%*s" }; - static char *ccformat[MAXFORCEPARAM+1]= { + const char *ccformat[MAXFORCEPARAM+1]= { "", "%lf", "%lf%lf", @@ -874,7 +913,8 @@ void push_bond(directive d,t_params bondtype[],t_params bond[], int aa[MAXATOMLIST+1]; t_param param,paramB; bool bFoundA,bFoundB,bDef,bPert,bSwapParity=FALSE; - + char errbuf[256]; + ftype = ifunc_index(d,1); nral = NRAL(ftype); for(j=0; j #include "sysstuff.h" diff --git a/src/kernel/topshake.h b/src/kernel/topshake.h index 97067b63b5..63772f4b45 100644 --- a/src/kernel/topshake.h +++ b/src/kernel/topshake.h @@ -33,10 +33,6 @@ #ifndef _topshake_h #define _topshake_h -static char *SRCID_topshake_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) topshake.h 1.19 9/30/97" -#endif /* HAVE_IDENT */ #include "topio.h" diff --git a/src/kernel/toputil.c b/src/kernel/toputil.c index 3f715ec64e..e81b6d0b4f 100644 --- a/src/kernel/toputil.c +++ b/src/kernel/toputil.c @@ -29,10 +29,6 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_toputil_c = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) toputil.c 1.68 9/30/97" -#endif #include "assert.h" #include "smalloc.h" @@ -130,6 +126,10 @@ void init_atomtype (t_atomtype *at) at->atomname = NULL; at->nb = NULL; at->bondatomtype = NULL; + at->radius = NULL; + at->vol = NULL; + at->surftens = NULL; + } void init_bond_atomtype (t_bond_atomtype *bat) @@ -238,7 +238,7 @@ void print_bt(FILE *out, directive d, t_atomtype *at, /* This dihp is a DIRTY patch because the dih-types do not use * all four atoms to determine the type. */ - static int dihp[2][2] = { { 1,2 }, { 0,3 } }; + const int dihp[2][2] = { { 1,2 }, { 0,3 } }; t_params *bt; int i,j,f,nral,nrfp; bool bDih=FALSE,bSwapParity; @@ -268,6 +268,7 @@ void print_bt(FILE *out, directive d, t_atomtype *at, break; case F_PDIHS: case F_RBDIHS: + case F_FOURDIHS: bDih=TRUE; break; case F_IDIHS: diff --git a/src/kernel/toputil.h b/src/kernel/toputil.h index 03fa46f98d..b97ba642ab 100644 --- a/src/kernel/toputil.h +++ b/src/kernel/toputil.h @@ -33,10 +33,6 @@ #ifndef _toputil_h #define _toputil_h -static char *SRCID_toputil_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) toputil.h 1.25 19 Nov 1995" -#endif /* HAVE_IDENT */ #include "grompp.h" diff --git a/src/kernel/tpbcmp.c b/src/kernel/tpbcmp.c index 7795168e69..e417be516e 100644 --- a/src/kernel/tpbcmp.c +++ b/src/kernel/tpbcmp.c @@ -29,7 +29,8 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_tpbcmp_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ #include #include #include @@ -195,7 +196,7 @@ static void cmp_idef(FILE *fp,t_idef *id1,t_idef *id2,real ftol) cmp_ilist(fp,i,&(id1->il[i]),&(id2->il[i])); } -static void cmp_block(FILE *fp,t_block *b1,t_block *b2,char *s) +static void cmp_block(FILE *fp,t_block *b1,t_block *b2,const char *s) { int i,j,k; char buf[32]; @@ -261,7 +262,8 @@ static void cmp_rvecs(FILE *fp,char *title,int n,rvec x1[],rvec x2[],real ftol) static void cmp_grpopts(FILE *fp,t_grpopts *opt1,t_grpopts *opt2,real ftol) { - int i; + int i,j; + char buf1[256],buf2[256]; cmp_int(fp,"inputrec->grpopts.ngtc",0, opt1->ngtc,opt2->ngtc); cmp_int(fp,"inputrec->grpopts.ngacc",0, opt1->ngacc,opt2->ngacc); @@ -271,6 +273,17 @@ static void cmp_grpopts(FILE *fp,t_grpopts *opt1,t_grpopts *opt2,real ftol) cmp_real(fp,"inputrec->grpopts.nrdf",i,opt1->nrdf[i],opt2->nrdf[i],ftol); cmp_real(fp,"inputrec->grpopts.ref_t",i,opt1->ref_t[i],opt2->ref_t[i],ftol); cmp_real(fp,"inputrec->grpopts.tau_t",i,opt1->tau_t[i],opt2->tau_t[i],ftol); + cmp_int(fp,"inputrec->grpopts.annealing",i,opt1->annealing[i],opt2->annealing[i]); + cmp_int(fp,"inputrec->grpopts.anneal_npoints",i, + opt1->anneal_npoints[i],opt2->anneal_npoints[i]); + if(opt1->anneal_npoints[i]==opt2->anneal_npoints[i]) { + sprintf(buf1,"inputrec->grpopts.anneal_time[%d]",i); + sprintf(buf2,"inputrec->grpopts.anneal_temp[%d]",i); + for(j=0;janneal_npoints[i];j++) { + cmp_real(fp,buf1,j,opt1->anneal_time[i][j],opt2->anneal_time[i][j],ftol); + cmp_real(fp,buf2,j,opt1->anneal_temp[i][j],opt2->anneal_temp[i][j],ftol); + } + } } for(i=0; (ingacc,opt2->ngacc)); i++) cmp_rvec(fp,"inputrec->grpopts.acc",i,opt1->acc[i],opt2->acc[i],ftol); @@ -306,6 +319,7 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol) */ cmp_int(fp,"inputrec->eI",0,ir1->eI,ir2->eI); cmp_int(fp,"inputrec->nsteps",0,ir1->nsteps,ir2->nsteps); + cmp_int(fp,"inputrec->init_step",0,ir1->init_step,ir2->init_step); cmp_int(fp,"inputrec->ePBC",0,ir1->ePBC,ir2->ePBC); cmp_int(fp,"inputrec->ns_type",0,ir1->ns_type,ir2->ns_type); cmp_int(fp,"inputrec->nstlist",0,ir1->nstlist,ir2->nstlist); @@ -313,6 +327,7 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol) cmp_int(fp,"inputrec->bDomDecomp",0,ir1->bDomDecomp,ir2->bDomDecomp); cmp_int(fp,"inputrec->decomp_dir",0,ir1->decomp_dir,ir2->decomp_dir); cmp_int(fp,"inputrec->nstcomm",0,ir1->nstcomm,ir2->nstcomm); + cmp_int(fp,"inputrec->nstcheckpoint",0,ir1->nstcheckpoint,ir2->nstcheckpoint); cmp_int(fp,"inputrec->nstlog",0,ir1->nstlog,ir2->nstlog); cmp_int(fp,"inputrec->nstxout",0,ir1->nstxout,ir2->nstxout); cmp_int(fp,"inputrec->nstvout",0,ir1->nstvout,ir2->nstvout); @@ -342,8 +357,7 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol) cmp_rvec(fp,"inputrec->compress(x)",0,ir1->compress[XX],ir2->compress[XX],ftol); cmp_rvec(fp,"inputrec->compress(y)",0,ir1->compress[YY],ir2->compress[YY],ftol); cmp_rvec(fp,"inputrec->compress(z)",0,ir1->compress[ZZ],ir2->compress[ZZ],ftol); - cmp_int(fp,"inputrec->bSimAnn",0,ir1->bSimAnn,ir2->bSimAnn); - cmp_real(fp,"inputrec->zero_temp_time",0,ir1->zero_temp_time,ir2->zero_temp_time,ftol); + cmp_int(fp,"inputrec->andersen_seed",0,ir1->andersen_seed,ir2->andersen_seed); cmp_real(fp,"inputrec->rlist",0,ir1->rlist,ir2->rlist,ftol); cmp_int(fp,"inputrec->coulombtype",0,ir1->coulombtype,ir2->coulombtype); cmp_real(fp,"inputrec->rcoulomb_switch",0,ir1->rcoulomb_switch,ir2->rcoulomb_switch,ftol); @@ -352,6 +366,11 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol) cmp_real(fp,"inputrec->rvdw_switch",0,ir1->rvdw_switch,ir2->rvdw_switch,ftol); cmp_real(fp,"inputrec->rvdw",0,ir1->rvdw,ir2->rvdw,ftol); cmp_real(fp,"inputrec->epsilon_r",0,ir1->epsilon_r,ir2->epsilon_r,ftol); + cmp_int(fp,"inputrec->gb_algorithm",0,ir1->gb_algorithm,ir2->gb_algorithm); + cmp_int(fp,"inputrec->nstgbradii",0,ir1->nstgbradii,ir2->nstgbradii); + cmp_real(fp,"inputrec->rgbradii",0,ir1->rgbradii,ir2->rgbradii,ftol); + cmp_real(fp,"inputrec->gb_saltconc",0,ir1->gb_saltconc,ir2->gb_saltconc,ftol); + cmp_int(fp,"inputrec->implicit_solvent",0,ir1->implicit_solvent,ir2->implicit_solvent); cmp_int(fp,"inputrec->eDispCorr",0,ir1->eDispCorr,ir2->eDispCorr); cmp_real(fp,"inputrec->shake_tol",0,ir1->shake_tol,ir2->shake_tol,ftol); cmp_real(fp,"inputrec->fudgeQQ",0,ir1->fudgeQQ,ir2->fudgeQQ,ftol); @@ -368,6 +387,9 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol) cmp_real(fp,"inputrec->orires_fc",0,ir1->orires_fc,ir2->orires_fc,ftol); cmp_real(fp,"inputrec->orires_tau",0,ir1->orires_tau,ir2->orires_tau,ftol); cmp_int(fp,"inputrec->nstorireout",0,ir1->nstorireout,ir2->nstorireout); + cmp_real(fp,"inputrec->dihre_fc",0,ir1->dihre_fc,ir2->dihre_fc,ftol); + cmp_int(fp,"inputrec->nstdihreout",0,ir1->nstdihreout,ir2->nstdihreout); + cmp_real(fp,"inputrec->dihre_tau",0,ir1->dihre_tau,ir2->dihre_tau,ftol); cmp_real(fp,"inputrec->em_stepsize",0,ir1->em_stepsize,ir2->em_stepsize,ftol); cmp_real(fp,"inputrec->em_tol",0,ir1->em_tol,ir2->em_tol,ftol); cmp_int(fp,"inputrec->niter",0,ir1->niter,ir2->niter); @@ -376,6 +398,7 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol) cmp_int(fp,"inputrec->eConstrAlg",0,ir1->eConstrAlg,ir2->eConstrAlg); cmp_int(fp,"inputrec->nProjOrder",0,ir1->nProjOrder,ir2->nProjOrder); cmp_real(fp,"inputrec->LincsWarnAngle",0,ir1->LincsWarnAngle,ir2->LincsWarnAngle,ftol); + cmp_int(fp,"inputrec->nLincsIter",0,ir1->nLincsIter,ir2->nLincsIter); cmp_real(fp,"inputrec->bd_temp",0,ir1->bd_temp,ir2->bd_temp,ftol); cmp_real(fp,"inputrec->bd_fric",0,ir1->bd_fric,ir2->bd_fric,ftol); cmp_int(fp,"inputrec->ld_seed",0,ir1->ld_seed,ir2->ld_seed); @@ -407,7 +430,7 @@ void comp_tpx(char *fn1,char *fn2,real ftol) ff[0]=fn1; ff[1]=fn2; for(i=0; (i<2); i++) { - read_tpxheader(ff[i],&(sh[i])); + read_tpxheader(ff[i],&(sh[i]),FALSE,NULL,NULL); snew(xx[i],sh[i].natoms); snew(vv[i],sh[i].natoms); read_tpx(ff[i],&step,&t,&lambda,&(ir[i]),box[i],&natoms, diff --git a/src/kernel/tpbcmp.h b/src/kernel/tpbcmp.h index 727d3b0334..e94a6470cb 100644 --- a/src/kernel/tpbcmp.h +++ b/src/kernel/tpbcmp.h @@ -33,7 +33,7 @@ #ifndef _tpbcmp_h #define _tpbcmp_h -static char *SRCID_tpbcmp_h = "$Id$"; + extern void comp_tpx(char *fn1,char *fn2,real ftol); /* Compare two binary topology files */ diff --git a/src/kernel/tpbconv.c b/src/kernel/tpbconv.c index 1246fb4e51..09c61e4c3b 100644 --- a/src/kernel/tpbconv.c +++ b/src/kernel/tpbconv.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_tpbconv_c = "$Id$"; + #include #include "rdgroup.h" #include "fatal.h" @@ -78,7 +78,7 @@ static atom_id *invind(int gnx,int natoms,atom_id index[]) } static void reduce_block(atom_id invindex[],bool bKeep[],t_block *block, - char *name,bool bExcl) + const char *name,bool bExcl) { atom_id *index,*a; int i,j,k,newi,newj; @@ -301,7 +301,7 @@ int main (int argc, char *argv[]) top_fn = ftp2fn(efTPX,NFILE,fnm); fprintf(stderr,"Reading toplogy and shit from %s\n",top_fn); - read_tpxheader(top_fn,&tpx); + read_tpxheader(top_fn,&tpx,FALSE,NULL,NULL); snew(x,tpx.natoms); snew(v,tpx.natoms); snew(ir,1); diff --git a/src/kernel/x2top.c b/src/kernel/x2top.c index bb76fa2ece..23bc64d2d7 100644 --- a/src/kernel/x2top.c +++ b/src/kernel/x2top.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_x2top_c = "$Id$"; + #include "maths.h" #include "macros.h" #include "copyrite.h" @@ -394,7 +394,7 @@ int main(int argc, char *argv[]) t_nextnb nnb; t_nm2type *nm2t; t_mols mymol; - char *ff; + char ff[256]; int nnm; char title[STRLEN]; rvec *x; /* coordinates? */ @@ -475,7 +475,7 @@ int main(int argc, char *argv[]) read_stx_conf(opt2fn("-f",NFILE,fnm),title,atoms,x,NULL,box); - ff = choose_ff(); + choose_ff(ff,255); snew(nbonds,atoms->nr); diff --git a/src/kernel/x2top.h b/src/kernel/x2top.h index 91563d69c1..ef49ddd15c 100644 --- a/src/kernel/x2top.h +++ b/src/kernel/x2top.h @@ -33,7 +33,6 @@ #ifndef _x2top_h #define _x2top_h -static char *SRCID_x2top_h = "$Id$"; #include diff --git a/src/kernel/xlate.c b/src/kernel/xlate.c index 3ea0d7f93c..a996c7bc85 100644 --- a/src/kernel/xlate.c +++ b/src/kernel/xlate.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_xlate_c = "$Id$"; + #include #include #include "typedefs.h" @@ -47,7 +47,7 @@ typedef struct { static t_xlate_atom *get_xlatoms(int *nxlatom) { - static char *xlfile="xlateat.dat"; + const char *xlfile="xlateat.dat"; t_xlate_atom *xl=NULL; char rbuf[32],abuf[32],repbuf[32]; diff --git a/src/kernel/xlate.h b/src/kernel/xlate.h index 4cef053b07..a43662dc51 100644 --- a/src/kernel/xlate.h +++ b/src/kernel/xlate.h @@ -33,7 +33,7 @@ #ifndef _xlate_h #define _xlate_h -static char *SRCID_xlate_h = "$Id$"; + extern void rename_atoms(t_atoms *atoms,t_symtab *symtab); #endif diff --git a/src/kernel/xmdrun.h b/src/kernel/xmdrun.h index c8f7cc5fa0..dd6e767ef7 100644 --- a/src/kernel/xmdrun.h +++ b/src/kernel/xmdrun.h @@ -33,7 +33,6 @@ #ifndef _xmdrun_h #define _xmdrun_h -static char *SRCID_xmdrun_h = "$Id$"; #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/kernel/xutils.c b/src/kernel/xutils.c index a525b94b07..e301e73c1b 100644 --- a/src/kernel/xutils.c +++ b/src/kernel/xutils.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_xutils_c = "$Id$"; + #include "typedefs.h" #include "smalloc.h" diff --git a/src/mdlib/Makefile.am b/src/mdlib/Makefile.am index fe02298bae..c702a9b63d 100644 --- a/src/mdlib/Makefile.am +++ b/src/mdlib/Makefile.am @@ -17,13 +17,13 @@ libmd@LIBSUFFIX@_la_SOURCES = \ force.c ghat.c init.c \ mdatom.c mdebin.c minimize.c \ ns.c nsb.c nsgrid.c \ - pme.c poisson.c pppm.c \ - psgather.c pull.c pullinit.c \ - pullio.c pullutil.c pssolve.c \ - psspread.c shakef.c sim_util.c \ + pme.c pppm.c \ + pull.c pullinit.c \ + pullio.c pullutil.c \ + shakef.c sim_util.c \ splittop.c tables.c tgroup.c \ update.c vcm.c wnblist.c \ - poisson.h splittop.h wnblist.h \ + splittop.h wnblist.h \ pull_internal.h EXTRA_libmd@LIBSUFFIX@_la_SOURCES = \ diff --git a/src/mdlib/calcmu.c b/src/mdlib/calcmu.c index 007a87a10a..c3d29bebb1 100644 --- a/src/mdlib/calcmu.c +++ b/src/mdlib/calcmu.c @@ -29,7 +29,9 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_calcmu_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include #include "typedefs.h" diff --git a/src/mdlib/calcvir.c b/src/mdlib/calcvir.c index fbf6aa2567..3fbd6400b9 100644 --- a/src/mdlib/calcvir.c +++ b/src/mdlib/calcvir.c @@ -29,7 +29,9 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_calcvir_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "sysstuff.h" #include "force.h" #include "assert.h" diff --git a/src/mdlib/callf77.c b/src/mdlib/callf77.c index 06216499fd..39225700bd 100644 --- a/src/mdlib/callf77.c +++ b/src/mdlib/callf77.c @@ -29,7 +29,9 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_callf77_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "callf77.h" #include "fatal.h" diff --git a/src/mdlib/clincs.c b/src/mdlib/clincs.c index ec1bc85bf7..289c5eb26b 100644 --- a/src/mdlib/clincs.c +++ b/src/mdlib/clincs.c @@ -29,7 +29,9 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_clincs_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "main.h" #include "constr.h" diff --git a/src/mdlib/compnl.c b/src/mdlib/compnl.c index 8f2f936a1c..3dbad75dea 100644 --- a/src/mdlib/compnl.c +++ b/src/mdlib/compnl.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_compnl_c = "$Id$"; + #include "ns.h" #include "smalloc.h" #include "wnblist.h" diff --git a/src/mdlib/constr.c b/src/mdlib/constr.c index cf8c70debb..4eacfa3bb2 100644 --- a/src/mdlib/constr.c +++ b/src/mdlib/constr.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_constr_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -268,7 +268,6 @@ static bool constrain_lincs(FILE *log,t_topology *top,t_inputrec *ir, static real *bllen,*blc,*blcc,*blm,*tmp1,*tmp2,*tmp3,*lincslam, *bllen0,*ddist; static int nc; - static bool bItEqOrder; char buf[STRLEN]; int b,i,j,nit,warn,p_imax,error; @@ -284,7 +283,6 @@ static bool constrain_lincs(FILE *log,t_topology *top,t_inputrec *ir, &r,&bla1,&bla2,&blnr,&blbnb, &bllen,&blc,&blcc,&blm,&tmp1,&tmp2,&tmp3,&lincslam, &bllen0,&ddist); - bItEqOrder = (getenv("GMX_ACCURATE_LINCS") != NULL); } else if (nc != 0) { /* If there are any constraints */ @@ -311,13 +309,8 @@ static bool constrain_lincs(FILE *log,t_topology *top,t_inputrec *ir, if (do_per_step(step,ir->nstlog) || step<0) cconerr(&p_max,&p_rms,&p_imax,xprime,nc,bla1,bla2,bllen); - - if ((ir->eI == eiSteep) || (ir->eI == eiCG) || bItEqOrder) - /* Use more iterations when doing energy minimization, * - * because we need very accurate positions and forces. */ - nit = ir->nProjOrder; - else - nit = 1; + + nit = ir->nLincsIter; #ifdef USE_FORTRAN F77_FUNC(flincs,FLINCS)(x[0],xprime[0],&nc,bla1,bla2,blnr,blbnb, diff --git a/src/mdlib/coupling.c b/src/mdlib/coupling.c index c8b46eb5d3..74dd0b181f 100644 --- a/src/mdlib/coupling.c +++ b/src/mdlib/coupling.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_coupling_c = "$Id$"; + #include "typedefs.h" #include "smalloc.h" #include "update.h" @@ -124,22 +124,19 @@ void parrinellorahman_pcoupl(t_inputrec *ir,int step,tensor pres, */ int d,n; - static tensor winv; - static bool bFirst=TRUE; + tensor winv; real vol=box[XX][XX]*box[YY][YY]*box[ZZ][ZZ]; real fac=vol/PRESFAC; real atot,arel,change,maxchange,xy_pressure; tensor invbox,pdiff,t1,t2; - if(bFirst) { - real maxl; - maxl=max(box[XX][XX],box[YY][YY]); - maxl=max(maxl,box[ZZ][ZZ]); - for(d=0;dcompress[d][n])/(3*ir->tau_p*ir->tau_p*maxl); - bFirst=FALSE; - } + real maxl; + maxl=max(box[XX][XX],box[YY][YY]); + maxl=max(maxl,box[ZZ][ZZ]); + for(d=0;dcompress[d][n])/(3*ir->tau_p*ir->tau_p*maxl); + m_inv(box,invbox); m_sub(pres,ir->ref_p,pdiff); @@ -337,17 +334,18 @@ void berendsen_pcoupl(t_inputrec *ir,int step,tensor pres, } } -void berendsen_tcoupl(t_grpopts *opts,t_groups *grps, - real dt,real SAfactor) +void berendsen_tcoupl(t_grpopts *opts,t_groups *grps,real dt) { int i; + real T,reft=0,lll; for(i=0; (ingtc); i++) { T = grps->tcstat[i].T; if ((opts->tau_t[i] > 0) && (T > 0.0)) { - reft = max(0.0,opts->ref_t[i]*SAfactor); + + reft = max(0.0,opts->ref_t[i]); lll = sqrt(1.0 + (dt/opts->tau_t[i])*(reft/T-1.0)); grps->tcstat[i].lambda = max(min(lll,1.25),0.8); } @@ -360,28 +358,58 @@ void berendsen_tcoupl(t_grpopts *opts,t_groups *grps, } } -void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps, - real dt,real SAfactor) +void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps,real dt) { - static real *Qinv=NULL; - int i; - real reft=0,xit,oldxi; - - if (Qinv == NULL) { - snew(Qinv,opts->ngtc); - - /* Use inputrec ref_t - Q shouldnt change during the run. */ - for(i=0;ingtc;i++) { - if ((opts->tau_t[i] > 0) && (opts->ref_t[i] > 0)) - Qinv[i]=1.0/(opts->tau_t[i]*opts->tau_t[i]*opts->ref_t[i])/(4*M_PI*M_PI); - else - Qinv[i]=0.0; - } - } + real Qinv; + int i; + real reft=0,xit,oldxi; for(i=0; (ingtc); i++) { - reft = max(0.0,opts->ref_t[i]*SAfactor); - grps->tcstat[i].xi += dt*Qinv[i]*(grps->tcstat[i].T-reft); + if ((opts->tau_t[i] > 0) && (opts->ref_t[i] > 0)) + Qinv=1.0/(opts->tau_t[i]*opts->tau_t[i]*opts->ref_t[i])/(4*M_PI*M_PI); + else + Qinv=0.0; + reft = max(0.0,opts->ref_t[i]); + grps->tcstat[i].xi += dt*Qinv*(grps->tcstat[i].T-reft); } } +/* set target temperatures if we are annealing */ +void +update_annealing_target_temp(t_grpopts *opts,real t) +{ + int i,j,n; + real pert,thist,x; + + for(i=0;ingtc;i++) { + if(opts->annealing[i] == eannNO) + continue; + else if(opts->annealing[i] == eannPERIODIC) { + /* calculate time modulo the period */ + pert = opts->anneal_time[i][opts->anneal_npoints[i]-1]; + n = t / pert; + thist = t - n*pert; /* modulo time */ + /* Make sure rounding didn't get us outside the interval */ + if(fabs(thist-pert)(opts->anneal_time[i][j+1])) + j++; + /* Found our position between points j and j+1. + * Interpolate: x is the amount from j+1, (1-x) from point j + * First treat possible jumps in temperature as a special case. + */ + if((opts->anneal_time[i][j+1]-opts->anneal_time[i][j])ref_t[i]=opts->anneal_temp[i][j+1]; + else { + x=(thist-opts->anneal_time[i][j])/(opts->anneal_time[i][j+1]-opts->anneal_time[i][j]); + opts->ref_t[i]=x*opts->anneal_temp[i][j+1]+(1-x)*opts->anneal_temp[i][j]; + } + } +} diff --git a/src/mdlib/csettle.c b/src/mdlib/csettle.c index 1e1064c00b..0014d1f08c 100644 --- a/src/mdlib/csettle.c +++ b/src/mdlib/csettle.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_csettle_c = "$Id$"; + #include #include #include "vec.h" @@ -52,6 +52,91 @@ static void check_cons(FILE *fp,char *title,real x[],int OW1,int HW2,int HW3) } #endif + +/* Our local shake routine to be used when settle breaks down due to a zero determinant */ +static int xshake(real b4[], real after[], real dOH, real dHH, real mO, real mH) +{ + real bondsq[3]; + real bond[9]; + real invmass[3]; + real M2[3]; + int iconv; + int iatom[3]={0,0,1}; + int jatom[3]={1,2,2}; + real rijx,rijy,rijz,tx,ty,tz,im,jm,acor,rp,diff; + int i,ll,ii,jj,l3,ix,iy,iz,jx,jy,jz,conv; + + invmass[0]=1.0/mO; + invmass[1]=1.0/mH; + invmass[2]=1.0/mH; + + bondsq[0]=dOH*dOH; + bondsq[1]=bondsq[0]; + bondsq[2]=dHH*dHH; + + M2[0]=1.0/(2.0*(invmass[0]+invmass[1])); + M2[1]=M2[0]; + M2[2]=1.0/(2.0*(invmass[1]+invmass[2])); + + for(ll=0;ll<3;ll++) { + l3=3*ll; + ix=3*iatom[ll]; + jx=3*jatom[ll]; + for(i=0;i<3;i++) + bond[l3+i]= b4[ix+i] - b4[jx+i]; + } + + for(i=0,iconv=0;i<1000 && iconv<3; i++) { + for(ll=0;ll<3;ll++) { + ii = iatom[ll]; + jj = jatom[ll]; + l3 = 3*ll; + ix = 3*ii; + jx = 3*jj; + iy = ix+1; + jy = jx+1; + iz = ix+2; + jz = jx+2; + + rijx = bond[l3]; + rijy = bond[l3+1]; + rijz = bond[l3+2]; + + + tx = after[ix]-after[jx]; + ty = after[iy]-after[jy]; + tz = after[iz]-after[jz]; + + rp = tx*tx+ty*ty+tz*tz; + diff = bondsq[ll] - rp; + + if(fabs(diff)<1e-8) { + iconv++; + } else { + rp = rijx*tx+rijy*ty+rijz*tz; + if(rp<1e-8) { + printf("SHITSHITSHIT\n"); + return -1; + } + acor = diff*M2[ll]/rp; + im = invmass[ii]; + jm = invmass[jj]; + tx = rijx*acor; + ty = rijy*acor; + tz = rijz*acor; + after[ix] += tx*im; + after[iy] += ty*im; + after[iz] += tz*im; + after[jx] -= tx*jm; + after[jy] -= ty*jm; + after[jz] -= tz*jm; + } + } + } + return 0; +} + + void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[], real dOH,real dHH,real mO,real mH,int *error) { @@ -87,8 +172,10 @@ void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[], za1d, xb1d, yb1d, zb1d, xc1d, yc1d, zc1d, ya2d, xb2d, yb2d, yc2d, xa3d, ya3d, za3d, xb3d, yb3d, zb3d, xc3d, yc3d, zc3d; real t1,t2; + + int doshake; - int i, ow1, hw2, hw3; + int i, shakeret, ow1, hw2, hw3; *error=-1; if (bFirst) { @@ -116,6 +203,7 @@ void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[], #pragma ivdep #endif for (i = 0; i < nshake; ++i) { + doshake = 0; /* --- Step1 A1' --- */ ow1 = owptr[i] * 3; hw2 = ow1 + 3; @@ -191,6 +279,7 @@ void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[], tmp = rone - sinphi * sinphi; if (tmp <= 0) { *error = i; + doshake = 1; cosphi = 0; } else @@ -199,65 +288,71 @@ void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[], tmp2 = rone - sinpsi * sinpsi; if (tmp2 <= 0) { *error = i; + doshake = 1; cospsi = 0; } else cospsi = tmp2*invsqrt(tmp2); /* 46 flops */ - ya2d = ra * cosphi; - xb2d = -rc * cospsi; - t1 = -rb * cosphi; - t2 = rc * sinpsi * sinphi; - yb2d = t1 - t2; - yc2d = t1 + t2; - /* 7 flops */ - - /* --- Step3 al,be,ga --- */ - alpa = xb2d * (xb0d - xc0d) + yb0d * yb2d + yc0d * yc2d; - beta = xb2d * (yc0d - yb0d) + xb0d * yb2d + xc0d * yc2d; - gama = xb0d * yb1d - xb1d * yb0d + xc0d * yc1d - xc1d * yc0d; - al2be2 = alpa * alpa + beta * beta; - tmp2 = (al2be2 - gama * gama); - sinthe = (alpa * gama - beta * tmp2*invsqrt(tmp2)) / al2be2; - /* 47 flops */ - - /* --- Step4 A3' --- */ - tmp2 = rone - sinthe *sinthe; - costhe = tmp2*invsqrt(tmp2); - xa3d = -ya2d * sinthe; - ya3d = ya2d * costhe; - za3d = za1d; - xb3d = xb2d * costhe - yb2d * sinthe; - yb3d = xb2d * sinthe + yb2d * costhe; - zb3d = zb1d; - xc3d = -xb2d * costhe - yc2d * sinthe; - yc3d = -xb2d * sinthe + yc2d * costhe; - zc3d = zc1d; - /* 26 flops */ - - /* --- Step5 A3 --- */ - xa3 = trns11 * xa3d + trns12 * ya3d + trns13 * za3d; - ya3 = trns21 * xa3d + trns22 * ya3d + trns23 * za3d; - za3 = trns31 * xa3d + trns32 * ya3d + trns33 * za3d; - xb3 = trns11 * xb3d + trns12 * yb3d + trns13 * zb3d; - yb3 = trns21 * xb3d + trns22 * yb3d + trns23 * zb3d; - zb3 = trns31 * xb3d + trns32 * yb3d + trns33 * zb3d; - xc3 = trns11 * xc3d + trns12 * yc3d + trns13 * zc3d; - yc3 = trns21 * xc3d + trns22 * yc3d + trns23 * zc3d; - zc3 = trns31 * xc3d + trns32 * yc3d + trns33 * zc3d; - /* 45 flops */ - - after[ow1] = xcom + xa3; - after[ow1 + 1] = ycom + ya3; - after[ow1 + 2] = zcom + za3; - after[hw2] = xcom + xb3; - after[hw2 + 1] = ycom + yb3; - after[hw2 + 2] = zcom + zb3; - after[hw3] = xcom + xc3; - after[hw3 + 1] = ycom + yc3; - after[hw3 + 2] = zcom + zc3; + if(!doshake) { + ya2d = ra * cosphi; + xb2d = -rc * cospsi; + t1 = -rb * cosphi; + t2 = rc * sinpsi * sinphi; + yb2d = t1 - t2; + yc2d = t1 + t2; + /* 7 flops */ + + /* --- Step3 al,be,ga --- */ + alpa = xb2d * (xb0d - xc0d) + yb0d * yb2d + yc0d * yc2d; + beta = xb2d * (yc0d - yb0d) + xb0d * yb2d + xc0d * yc2d; + gama = xb0d * yb1d - xb1d * yb0d + xc0d * yc1d - xc1d * yc0d; + al2be2 = alpa * alpa + beta * beta; + tmp2 = (al2be2 - gama * gama); + sinthe = (alpa * gama - beta * tmp2*invsqrt(tmp2)) / al2be2; + /* 47 flops */ + + /* --- Step4 A3' --- */ + tmp2 = rone - sinthe *sinthe; + costhe = tmp2*invsqrt(tmp2); + xa3d = -ya2d * sinthe; + ya3d = ya2d * costhe; + za3d = za1d; + xb3d = xb2d * costhe - yb2d * sinthe; + yb3d = xb2d * sinthe + yb2d * costhe; + zb3d = zb1d; + xc3d = -xb2d * costhe - yc2d * sinthe; + yc3d = -xb2d * sinthe + yc2d * costhe; + zc3d = zc1d; + /* 26 flops */ + + /* --- Step5 A3 --- */ + xa3 = trns11 * xa3d + trns12 * ya3d + trns13 * za3d; + ya3 = trns21 * xa3d + trns22 * ya3d + trns23 * za3d; + za3 = trns31 * xa3d + trns32 * ya3d + trns33 * za3d; + xb3 = trns11 * xb3d + trns12 * yb3d + trns13 * zb3d; + yb3 = trns21 * xb3d + trns22 * yb3d + trns23 * zb3d; + zb3 = trns31 * xb3d + trns32 * yb3d + trns33 * zb3d; + xc3 = trns11 * xc3d + trns12 * yc3d + trns13 * zc3d; + yc3 = trns21 * xc3d + trns22 * yc3d + trns23 * zc3d; + zc3 = trns31 * xc3d + trns32 * yc3d + trns33 * zc3d; + /* 45 flops */ + after[ow1] = xcom + xa3; + after[ow1 + 1] = ycom + ya3; + after[ow1 + 2] = zcom + za3; + after[hw2] = xcom + xb3; + after[hw2 + 1] = ycom + yb3; + after[hw2 + 2] = zcom + zb3; + after[hw3] = xcom + xc3; + after[hw3 + 1] = ycom + yc3; + after[hw3 + 2] = zcom + zc3; /* 9 flops */ + } else { + /* If we couldn't settle this water, try a simplified iterative shake instead */ + if(xshake(b4+ow1,after+ow1,dOH,dHH,mO,mH)!=0) + *error=i; + } #ifdef DEBUG check_cons(fp,"settle",after,ow1,hw2,hw3); #endif diff --git a/src/mdlib/dummies.c b/src/mdlib/dummies.c index 205116ee2d..95068e4f79 100644 --- a/src/mdlib/dummies.c +++ b/src/mdlib/dummies.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_dummies_c = "$Id$"; + #include #include "typedefs.h" #include "assert.h" diff --git a/src/mdlib/ebin.c b/src/mdlib/ebin.c index 4c1964d39d..28f57d8cc7 100644 --- a/src/mdlib/ebin.c +++ b/src/mdlib/ebin.c @@ -29,7 +29,9 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_ebin_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include #include "sysstuff.h" diff --git a/src/mdlib/edsam.c b/src/mdlib/edsam.c index 69b51a09ce..88ce280686 100644 --- a/src/mdlib/edsam.c +++ b/src/mdlib/edsam.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_edsam_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/mdlib/ewald.c b/src/mdlib/ewald.c index e65b069065..9b52e83c8b 100644 --- a/src/mdlib/ewald.c +++ b/src/mdlib/ewald.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_ewald_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/mdlib/fftgrid.c b/src/mdlib/fftgrid.c index d0a232638a..60c8065ac4 100644 --- a/src/mdlib/fftgrid.c +++ b/src/mdlib/fftgrid.c @@ -29,7 +29,9 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_fftgrid_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "assert.h" #include "typedefs.h" #include "futil.h" diff --git a/src/mdlib/force.c b/src/mdlib/force.c index 552f7f67f7..4aa08272c2 100644 --- a/src/mdlib/force.c +++ b/src/mdlib/force.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_force_c = "$Id$"; + #include #include "sysstuff.h" #include "typedefs.h" @@ -55,7 +55,6 @@ static char *SRCID_force_c = "$Id$"; #include "ewald_util.h" #include "shift_util.h" #include "pppm.h" -#include "poisson.h" #include "ewald.h" #include "pme.h" #include "mdrun.h" @@ -677,7 +676,20 @@ void init_forcerec(FILE *fp, set_avcsix(fp,fr,mdatoms); if (fr->bBHAM) set_bham_b_max(fp,fr,mdatoms); - + + /* Copy the GBSA data (radius, volume and surftens for each + * atomtype) from the topology atomtype section to forcerec. + */ + snew(fr->atype_radius,fr->ntype); + snew(fr->atype_vol,fr->ntype); + snew(fr->atype_surftens,fr->ntype); + for(i=0;intype;i++) + fr->atype_radius[i]=top->atomtypes.radius[i]; + for(i=0;intype;i++) + fr->atype_vol[i]=top->atomtypes.vol[i]; + for(i=0;intype;i++) + fr->atype_surftens[i]=top->atomtypes.surftens[i]; + /* Now update the rest of the vars */ update_forcerec(fp,fr,box); /* if we are using LR electrostatics, and they are tabulated, @@ -922,10 +934,6 @@ void force(FILE *fp, int step, Vlr = do_pppm(fp,FALSE,x,fr->f_pme,md->chargeT, box_size,fr->phi,cr,nsb,nrnb); break; - case eelPOISSON: - Vlr = do_poisson(fp,FALSE,ir,md->nr,x,fr->f_pme,md->chargeT, - box_size,fr->phi,cr,nrnb,&nit,TRUE); - break; case eelPME: Vlr = do_pme(fp,FALSE,ir,x,fr->f_pme,md->chargeT, box,cr,nsb,nrnb,lr_vir,fr->ewaldcoeff,bGatherOnly); diff --git a/src/mdlib/ghat.c b/src/mdlib/ghat.c index 95fca674f9..fa367a91e2 100644 --- a/src/mdlib/ghat.c +++ b/src/mdlib/ghat.c @@ -29,7 +29,9 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_ghat_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include #include "typedefs.h" #include "futil.h" diff --git a/src/mdlib/init.c b/src/mdlib/init.c index ec5166e799..bd48b4894f 100644 --- a/src/mdlib/init.c +++ b/src/mdlib/init.c @@ -29,13 +29,12 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_init_c = "$Id$"; + #include #include "typedefs.h" #include "tpxio.h" #include "smalloc.h" #include "vec.h" -#include "vveclib.h" #include "main.h" #include "mvdata.h" #include "fatal.h" @@ -65,11 +64,9 @@ void check_nnodes_top(char *fn,t_topology *top,int nnodes) fn,np,ShortProgram(),nnodes); } -static char *int_title(char *title,int nodeid) +static char *int_title(char *title,int nodeid,char buf[], int size) { - static char buf[BUFSIZE]; - - sprintf(buf,"%s (%d)",title,nodeid); + snprintf(buf,size-1,"%s (%d)",title,nodeid); return buf; } @@ -109,7 +106,7 @@ void init_single(FILE *log,t_parm *parm, snew(tpx,1); - read_tpxheader(tpxfile,tpx); + read_tpxheader(tpxfile,tpx,FALSE,NULL,NULL); snew(*x,tpx->natoms); snew(*v,tpx->natoms); @@ -139,7 +136,7 @@ void distribute_parts(int left,int right,int nodeid,int nnodes,t_parm *parm, t_nsborder nsb; rvec *x,*v; - read_tpxheader(tpxfile,&tpx); + read_tpxheader(tpxfile,&tpx,FALSE,NULL,NULL); snew(x,tpx.natoms); snew(v,tpx.natoms); read_tpx(tpxfile,&step,&t,&lambda,&parm->ir,parm->box, @@ -159,6 +156,8 @@ void init_parts(FILE *log,t_commrec *cr, t_nsborder *nsb,int list, bool *bParallelDummies, t_comm_dummies *dummycomm) { + char buf[256]; + ld_data(cr->left,cr->right,parm,nsb,top,x,v); if (cr->nodeid != 0) mv_data(cr->left,cr->right,parm,nsb,top,*x,*v); @@ -174,11 +173,11 @@ void init_parts(FILE *log,t_commrec *cr, if (list&LIST_PARM) write_parm(log,"parameters of the run",cr->nodeid,parm); if (list&LIST_X) - pr_rvecs(log,0,int_title("x",0),*x,nsb->natoms); + pr_rvecs(log,0,int_title("x",0,buf,255),*x,nsb->natoms); if (list&LIST_V) - pr_rvecs(log,0,int_title("v",0),*v,nsb->natoms); + pr_rvecs(log,0,int_title("v",0,buf,255),*v,nsb->natoms); if (list&LIST_TOP) - pr_top(log,0,int_title("topology",cr->nodeid),top); + pr_top(log,0,int_title("topology",cr->nodeid,buf,255),top,TRUE); fflush(log); } *mdatoms=atoms2md(log,&(top->atoms),parm->ir.opts.nFreeze, diff --git a/src/mdlib/mdatom.c b/src/mdlib/mdatom.c index c6d5c2c967..cdf5aeba63 100644 --- a/src/mdlib/mdatom.c +++ b/src/mdlib/mdatom.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_mdatom_c = "$Id$"; + #include "typedefs.h" #include "mdatoms.h" #include "smalloc.h" @@ -187,35 +187,21 @@ void md2atoms(t_mdatoms *md,t_atoms *atoms,bool bFree) } } -void init_mdatoms(t_mdatoms *md,real lambda,bool bFirst) +void update_mdatoms(t_mdatoms *md,real lambda, bool bFirst) { - static real lambda0; int i,end; real L1=1.0-lambda; - if (bFirst) - lambda0 = lambda; end=md->nr; - - /* Only do this loop the first time, or when lambda has changed. - * One could also check whether there is any perturbed atom at all, - * but if you don't have perturbed atoms, it does not make sense to modify lambda. - * In principle this has to be parallellized, although it would mean extra - * communication. Basically only the charges are used on other nodes... - */ - if (bFirst || (lambda0 != lambda)) { - for(i=0; (ibPerturbed[i] || bFirst) { - md->massT[i]=L1*md->massA[i]+lambda*md->massB[i]; - if (md->invmass[i] > 1.1*ALMOST_ZERO) - md->invmass[i]=1.0/md->massT[i]; - md->chargeT[i]=L1*md->chargeA[i]+lambda*md->chargeB[i]; - } + + for(i=0; (ibPerturbed[i] || bFirst) { + md->massT[i]=L1*md->massA[i]+lambda*md->massB[i]; + if (md->invmass[i] > 1.1*ALMOST_ZERO) + md->invmass[i]=1.0/md->massT[i]; + md->chargeT[i]=L1*md->chargeA[i]+lambda*md->chargeB[i]; } } - lambda0 = lambda; } - - diff --git a/src/mdlib/mdebin.c b/src/mdlib/mdebin.c index 050f2b36b8..d43a4cfba1 100644 --- a/src/mdlib/mdebin.c +++ b/src/mdlib/mdebin.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_mdebin_c = "$Id$"; + #include #include "typedefs.h" #include "string2.h" @@ -403,16 +403,16 @@ static void pprint(FILE *log,char *s) fprintf(log," ======>\n\n"); } -void print_ebin_header(FILE *log,int steps,real time,real lamb,real SAfactor) +void print_ebin_header(FILE *log,int steps,real time,real lamb) { - fprintf(log," %12s %12s %12s %12s\n" - " %12d %12.5f %12.5f %12.5f\n\n", - "Step","Time","Lambda","Annealing",steps,time,lamb,SAfactor); + fprintf(log," %12s %12s %12s\n" + " %12d %12.5f %12.5f\n\n", + "Step","Time","Lambda",steps,time,lamb); } -void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR, +void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR,bool bDihR, FILE *log,int steps,real time,int mode,bool bCompact, - t_mdebin *md,t_fcdata *fcd,t_atoms *atoms) + t_mdebin *md,t_fcdata *fcd,t_atoms *atoms, t_grpopts *opts) { static char **grpnms=NULL; static char *kjm="(kJ/mol)"; @@ -421,7 +421,7 @@ void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR, int nr[enxNR]; real *block[enxNR]; t_enxframe fr; - + switch (mode) { case eprNORMAL: fr.t = time; @@ -456,6 +456,11 @@ void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR, } if (log) { + for(i=0;ingtc;i++) + if(opts->annealing[i]!=eannNO) + fprintf(log,"Current ref_t for group %s: %8.1f\n", + *(atoms->grpname[atoms->grps[egcTC].nm_ind[i]]),opts->ref_t[i]); + if (mode==eprNORMAL && fcd->orires.nr>0) print_orires_log(log,fcd); diff --git a/src/mdlib/minimize.c b/src/mdlib/minimize.c index 06cdccea98..1c519e836f 100644 --- a/src/mdlib/minimize.c +++ b/src/mdlib/minimize.c @@ -24,12 +24,13 @@ * To help us fund GROMACS development, we humbly ask that you cite * the papers on the package - you can find them in the top README file. * + * For more info, check our website at http://www.gromacs.org * * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_minimize_c = "$Id$"; + #include #include #include @@ -60,7 +61,7 @@ static char *SRCID_minimize_c = "$Id$"; #include "dummies.h" #include "mdrun.h" -static void sp_header(FILE *out,char *minimizer,real ftol,int nsteps) +static void sp_header(FILE *out,const char *minimizer,real ftol,int nsteps) { fprintf(out,"%s:\n",minimizer); fprintf(out," Tolerance = %12.5e\n",ftol); @@ -78,7 +79,7 @@ static void warn_step(FILE *fp,real ustep,real ftol,bool bConstrain) "off constraints alltogether (set constraints = none in mdp file)\n"); } -static void print_converged(FILE *fp,char *alg,real ftol,int count,bool bDone, +static void print_converged(FILE *fp,const char *alg,real ftol,int count,bool bDone, int nsteps,real epot,real fmax) { if (bDone) @@ -154,7 +155,7 @@ static real f_norm(t_commrec *cr, return sqrt(fnorm2); } -static void init_em(FILE *log,char *title, +static void init_em(FILE *log,const char *title, t_parm *parm,real *lambda,t_nrnb *mynrnb,rvec mu_tot,rvec box_size, t_forcerec *fr,t_mdatoms *mdatoms,t_topology *top,t_nsborder *nsb, t_commrec *cr,t_vcm **vcm,int *start,int *end) @@ -176,7 +177,7 @@ static void init_em(FILE *log,char *title, *end = nsb->homenr[cr->nodeid] + *start; /* Set initial values for invmass etc. */ - init_mdatoms(mdatoms,*lambda,TRUE); + update_mdatoms(mdatoms,*lambda,TRUE); *vcm = init_vcm(log,top,cr,mdatoms, *start,HOMENR(nsb),parm->ir.nstcomm); @@ -191,7 +192,7 @@ time_t do_cg(FILE *log,int nfile,t_filenm fnm[], t_commrec *cr,t_commrec *mcr,t_graph *graph, t_forcerec *fr,rvec box_size) { - static char *CG="Conjugate Gradients"; + const char *CG="Conjugate Gradients"; double gpa,gpb; double EpotA=0.0,EpotB=0.0,a=0.0,b,beta=0.0,zet,w; real lambda,fmax,testf,smin; @@ -289,9 +290,9 @@ time_t do_cg(FILE *log,int nfile,t_filenm fnm[], force_vir,parm->vir,parm->pres,grps,mu_tot, (parm->ir.etc==etcNOSEHOOVER)); - print_ebin_header(log,count,count,lambda,0.0); - print_ebin(fp_ene,TRUE,FALSE,FALSE,log,count,count,eprNORMAL, - TRUE,mdebin,fcd,&(top->atoms)); + print_ebin_header(log,count,count,lambda); + print_ebin(fp_ene,TRUE,FALSE,FALSE,FALSE,log,count,count,eprNORMAL, + TRUE,mdebin,fcd,&(top->atoms),&(parm->ir.opts)); } where(); @@ -492,9 +493,9 @@ time_t do_cg(FILE *log,int nfile,t_filenm fnm[], force_vir,parm->vir,parm->pres,grps,mu_tot, (parm->ir.etc==etcNOSEHOOVER)); /* Print the energies allways when we should be verbose */ - print_ebin_header(log,count,count,lambda,0.0); - print_ebin(fp_ene,TRUE,FALSE,FALSE,log,count,count,eprNORMAL, - TRUE,mdebin,fcd,&(top->atoms)); + print_ebin_header(log,count,count,lambda); + print_ebin(fp_ene,TRUE,FALSE,FALSE,FALSE,log,count,count,eprNORMAL, + TRUE,mdebin,fcd,&(top->atoms),&(parm->ir.opts)); } /* Stop when the maximum force lies below tolerance */ @@ -538,7 +539,7 @@ time_t do_steep(FILE *log,int nfile,t_filenm fnm[], t_commrec *cr,t_commrec *mcr,t_graph *graph, t_forcerec *fr,rvec box_size) { - static char *SD="Steepest Descents"; + const char *SD="Steepest Descents"; real stepsize,constepsize,lambda,fmax; rvec *pos[2],*force[2],*xcf=NULL; rvec *xx,*ff; @@ -678,7 +679,7 @@ time_t do_steep(FILE *log,int nfile,t_filenm fnm[], sum_epot(&(parm->ir.opts),grps,ener); if (MASTER(cr)) - print_ebin_header(log,count,count,lambda,0.0); + print_ebin_header(log,count,count,lambda); if (bConstrain) { fmax=f_max(cr->left,cr->right,nsb->nnodes,&(parm->ir.opts),mdatoms,start,end, @@ -729,7 +730,8 @@ time_t do_steep(FILE *log,int nfile,t_filenm fnm[], print_ebin(fp_ene,TRUE, do_per_step(steps_accepted,parm->ir.nstdisreout), do_per_step(steps_accepted,parm->ir.nstorireout), - log,count,count,eprNORMAL,TRUE,mdebin,fcd,&(top->atoms)); + do_per_step(steps_accepted,parm->ir.nstdihreout), + log,count,count,eprNORMAL,TRUE,mdebin,fcd,&(top->atoms),&(parm->ir.opts)); fflush(log); } } @@ -881,12 +883,11 @@ time_t do_nm(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[], bBHAM,b14,parm->ir.efep!=efepNO,parm->ir.epc, parm->ir.eDispCorr,TRICLINIC(parm->ir.compress),(parm->ir.etc==etcNOSEHOOVER),cr); - /* Calculate Temperature coupling parameters lambda */ - ener[F_TEMP]=sum_ekin(&(parm->ir.opts),grps,parm->ekin,bTYZ); + ener[F_TEMP]=sum_ekin(&(parm->ir.opts),grps,parm->ekin,bTYZ); if(parm->ir.etc==etcBERENDSEN) - berendsen_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t,lam0); + berendsen_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t); else if(parm->ir.etc==etcNOSEHOOVER) - nosehoover_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t,lam0); + nosehoover_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t); where(); @@ -998,10 +999,10 @@ time_t do_nm(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[], lambda=lam0+step*parm->ir.delta_lambda; if (MASTER(cr)) { - print_ebin(-1,FALSE,FALSE,FALSE,log,step,t,eprAVER, - FALSE,mdebin,fcd,&(top->atoms)); - print_ebin(-1,FALSE,FALSE,FALSE,log,step,t,eprRMS, - FALSE,mdebin,fcd,&(top->atoms)); + print_ebin(-1,FALSE,FALSE,FALSE,FALSE,log,step,t,eprAVER, + FALSE,mdebin,fcd,&(top->atoms),&(parm->ir.opts)); + print_ebin(-1,FALSE,FALSE,FALSE,FALSE,log,step,t,eprRMS, + FALSE,mdebin,fcd,&(top->atoms),&(parm->ir.opts)); } /* Construct dummy particles, for last output frame */ diff --git a/src/mdlib/ns.c b/src/mdlib/ns.c index 290a258746..4acc1daf6a 100644 --- a/src/mdlib/ns.c +++ b/src/mdlib/ns.c @@ -29,7 +29,7 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_ns_c = "$Id$"; + #ifdef USE_THREADS #include /* must come first */ #endif @@ -1754,7 +1754,7 @@ int search_neighbours(FILE *log,t_forcerec *fr, } } if (debug) - pr_ivec(debug,0,"bHaveLJ",bHaveLJ,fr->ntype); + pr_ivec(debug,0,"bHaveLJ",bHaveLJ,fr->ntype,TRUE); bFirst=FALSE; } diff --git a/src/mdlib/nsb.c b/src/mdlib/nsb.c index faf1e5baf6..8ccb2645da 100644 --- a/src/mdlib/nsb.c +++ b/src/mdlib/nsb.c @@ -29,7 +29,9 @@ * And Hey: * Getting the Right Output Means no Artefacts in Calculating Stuff */ -static char *SRCID_nsb_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "sysstuff.h" #include "assert.h" #include "typedefs.h" diff --git a/src/mdlib/nsgrid.c b/src/mdlib/nsgrid.c index 15e4161b32..2ad572e721 100644 --- a/src/mdlib/nsgrid.c +++ b/src/mdlib/nsgrid.c @@ -29,7 +29,8 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_nsgrid_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include "assert.h" #include "sysstuff.h" #include "typedefs.h" diff --git a/src/mdlib/pme.c b/src/mdlib/pme.c index aa296c5019..bbda084cc4 100644 --- a/src/mdlib/pme.c +++ b/src/mdlib/pme.c @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_pme_c = "$Id$"; + /* IMPORTANT FOR DEVELOPERS: * * Triclinic pme stuff isn't entirely trivial, and we've experienced diff --git a/src/mdlib/pppm.c b/src/mdlib/pppm.c index 32e751545c..7d3ae02fc6 100644 --- a/src/mdlib/pppm.c +++ b/src/mdlib/pppm.c @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_pppm_c = "$Id$"; + #include #include #include "assert.h" @@ -521,9 +521,9 @@ void init_pppm(FILE *log,t_commrec *cr,t_nsborder *nsb, /* Check whether boxes correspond */ for(m=0; (m tol) { - pr_rvec(log,0,"box",box,DIM); - pr_rvec(log,0,"grid-spacing",spacing,DIM); - pr_ivec(log,0,"grid size",grids,DIM); + pr_rvec(log,0,"box",box,DIM,TRUE); + pr_rvec(log,0,"grid-spacing",spacing,DIM,TRUE); + pr_ivec(log,0,"grid size",grids,DIM,TRUE); fflush(log); fatal_error(0,"Box sizes in tpb file and Ghat file %s do not match\n" "Check your log file!",ghatfn); diff --git a/src/mdlib/pull.c b/src/mdlib/pull.c index f730d1feb2..a94a08c6fe 100644 --- a/src/mdlib/pull.c +++ b/src/mdlib/pull.c @@ -33,7 +33,7 @@ * And Hey: * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon */ -static char *SRCID_pull_c = "$Id$"; + #include "futil.h" #include "rdgroup.h" #include "statutil.h" diff --git a/src/mdlib/pull_internal.h b/src/mdlib/pull_internal.h index 39955d775c..fce3933c10 100644 --- a/src/mdlib/pull_internal.h +++ b/src/mdlib/pull_internal.h @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_pull_internal_h = "$Id$"; + #ifndef _pull_internal_h #define _pull_internal_h diff --git a/src/mdlib/pullinit.c b/src/mdlib/pullinit.c index 3fd3335ce4..644330c884 100644 --- a/src/mdlib/pullinit.c +++ b/src/mdlib/pullinit.c @@ -33,7 +33,9 @@ * And Hey: * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon */ -static char *SRCID_pullinit_c = "$Id$"; + +/* This file is threadsafe - keep it that way */ + #include #include "princ.h" #include diff --git a/src/mdlib/pullio.c b/src/mdlib/pullio.c index fb37da0591..9311b5ecd0 100644 --- a/src/mdlib/pullio.c +++ b/src/mdlib/pullio.c @@ -33,7 +33,7 @@ * And Hey: * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon */ -static char *SRCID_pullio_c = "$Id$"; + #include #include #include "sysstuff.h" @@ -196,25 +196,25 @@ void read_pullparams(t_pull *pull, char *infile, char *outfile) enum { erunSTART, erunAFM, erunConstraint, erunUmbrella, erunTest, erunNR }; - static char *runtypes[erunNR+1] = { + static const char *runtypes[erunNR+1] = { "start", "afm", "constraint", "umbrella", "test", NULL }; enum { erefCom, erefComT0, erefDyn, erefDynT0, erefNR }; - static char *reftypes[erefNR+1] = { + static const char *reftypes[erefNR+1] = { "com", "com_t0", "dynamic", "dynamic_t0", NULL }; enum { ereverseTO_REF, ereverseFROM_REF, ereverseNR }; - static char *reversetypes[ereverseNR+1] = { + static const char *reversetypes[ereverseNR+1] = { "from_reference", "to_reference", NULL }; enum { everboseYES, everboseNO, everboseNR }; - static char *verbosetypes[erefNR+1] = { + static const char *verbosetypes[erefNR+1] = { "no", "yes", NULL }; int nerror = 0; diff --git a/src/mdlib/pullutil.c b/src/mdlib/pullutil.c index a4378747bc..6198a12313 100644 --- a/src/mdlib/pullutil.c +++ b/src/mdlib/pullutil.c @@ -33,7 +33,7 @@ * And Hey: * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon */ -static char *SRCID_pullutil_c = "$Id$"; + #include #include "sysstuff.h" #include "princ.h" diff --git a/src/mdlib/shakef.c b/src/mdlib/shakef.c index 168a41ce60..65e2494ef7 100644 --- a/src/mdlib/shakef.c +++ b/src/mdlib/shakef.c @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_shakef_c = "$Id$"; + #include #include "sysstuff.h" #include "typedefs.h" diff --git a/src/mdlib/sim_util.c b/src/mdlib/sim_util.c index 0f470bb5a0..fb05cf7ec9 100644 --- a/src/mdlib/sim_util.c +++ b/src/mdlib/sim_util.c @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_sim_util_c = "$Id$"; + #include #include #include "typedefs.h" @@ -414,7 +414,7 @@ void do_shakefirst(FILE *log,bool bTYZ,real lambda,real ener[], fprintf(log,"\nConstraining the starting coordinates (step %d)\n",step); clear_mat(shake_vir); update(nsb->natoms,start,homenr,step,lambda,&ener[F_DVDL], - parm,1.0,md,x,graph, + parm,md,x,graph, NULL,NULL,vold,NULL,x,top,grps,shake_vir,cr,nrnb,bTYZ, FALSE,edyn,pulldata,FALSE); /* Compute coordinates at t=-dt, store them in buf */ @@ -433,7 +433,7 @@ void do_shakefirst(FILE *log,bool bTYZ,real lambda,real ener[], fprintf(log,"\nConstraining the coordinates at t0-dt (step %d)\n",step); clear_mat(shake_vir); update(nsb->natoms,start,homenr, - step,lambda,&ener[F_DVDL],parm,1.0,md,f,graph, + step,lambda,&ener[F_DVDL],parm,md,f,graph, NULL,NULL,vold,NULL,buf,top,grps,shake_vir,cr,nrnb,bTYZ,FALSE, edyn,pulldata,FALSE); @@ -569,18 +569,19 @@ void finish_run(FILE *log,t_commrec *cr,char *confout, } void init_md(t_commrec *cr,t_inputrec *ir,tensor box,real *t,real *t0, - real *lambda,real *lam0,real *SAfactor, + real *lambda,real *lam0, t_nrnb *mynrnb,bool *bTYZ,t_topology *top, int nfile,t_filenm fnm[],char **traj, char **xtc_traj,int *fp_ene, FILE **fp_dgdl,t_mdebin **mdebin,t_groups *grps, tensor force_vir,tensor pme_vir, tensor shake_vir,t_mdatoms *mdatoms,rvec mu_tot, - bool *bNEMD,t_vcm **vcm,t_nsborder *nsb) + bool *bNEMD,bool *bSimAnn,t_vcm **vcm,t_nsborder *nsb) { bool bBHAM,b14,bLR,bLJLR; - int i; - + int i,j,n; + real tmpt,mod; + /* Initial values */ *t = *t0 = ir->init_t; if (ir->efep != efepNO) { @@ -589,13 +590,16 @@ void init_md(t_commrec *cr,t_inputrec *ir,tensor box,real *t,real *t0, else { *lambda = *lam0 = 0.0; } - if (ir->bSimAnn) { - *SAfactor = 1.0 - *t0/ir->zero_temp_time; - if (*SAfactor < 0) - *SAfactor = 0; - } else - *SAfactor = 1.0; - + + *bSimAnn=FALSE; + for(i=0;iopts.ngtc;i++) { + /* set bSimAnn if any group is being annealed */ + if(ir->opts.annealing[i]!=eannNO) + *bSimAnn = *bSimAnn || TRUE; + } + if(*bSimAnn) + update_annealing_target_temp(&(ir->opts),ir->init_t); + init_nrnb(mynrnb); /* Check Environment variables & other booleans */ @@ -630,7 +634,7 @@ void init_md(t_commrec *cr,t_inputrec *ir,tensor box,real *t,real *t0, clear_rvec(mu_tot); /* Set initial values for invmass etc. */ - init_mdatoms(mdatoms,*lambda,TRUE); + update_mdatoms(mdatoms,*lambda,TRUE); *vcm = init_vcm(stdlog,top,cr,mdatoms,START(nsb),HOMENR(nsb),ir->nstcomm); diff --git a/src/mdlib/splittop.c b/src/mdlib/splittop.c index 8c7e0eb326..3f3ec73527 100644 --- a/src/mdlib/splittop.c +++ b/src/mdlib/splittop.c @@ -29,7 +29,8 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_splittop_c = "$Id$"; +/* This file is completely threadsafe - keep it that way! */ + #include "sysstuff.h" #include "typedefs.h" #include "splittop.h" diff --git a/src/mdlib/splittop.h b/src/mdlib/splittop.h index f4aabab57e..2b7db728cc 100644 --- a/src/mdlib/splittop.h +++ b/src/mdlib/splittop.h @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_splittop_h = "$Id$"; + #include "dummies.h" extern void mdsplit_top(FILE *log,t_topology *top,t_commrec *cr, diff --git a/src/mdlib/tables.c b/src/mdlib/tables.c index b4d9f20fab..87bb452af0 100644 --- a/src/mdlib/tables.c +++ b/src/mdlib/tables.c @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_tables_c = "$Id$"; + #include #include "typedefs.h" #include "names.h" @@ -47,7 +47,7 @@ enum { etabRF, etabCOUL, etabEwald, etabLJ6Switch, etabLJ12Switch,etabCOULSwitch, etabEXPMIN,etabUSER, etabNR }; -static char *tabnm[etabNR] = { +static const char *tabnm[etabNR] = { "LJ6", "LJ12", "LJ6Shift", "LJ12Shift", "Shift", "RF", "COUL", "Ewald", "LJ6Switch", "LJ12Switch","COULSwitch", "EXPMIN","USER" @@ -540,7 +540,7 @@ static void set_table_type(int tabsel[],t_forcerec *fr) void make_tables(FILE *out,t_forcerec *fr,bool bVerbose,char *fn) { - static char *fns[3] = { "ctab.xvg", "dtab.xvg", "rtab.xvg" }; + const char *fns[3] = { "ctab.xvg", "dtab.xvg", "rtab.xvg" }; FILE *fp; t_tabledata *td; bool bReadTab,bGenTab; diff --git a/src/mdlib/tgroup.c b/src/mdlib/tgroup.c index 83eb9ce388..2ab354ee69 100644 --- a/src/mdlib/tgroup.c +++ b/src/mdlib/tgroup.c @@ -29,7 +29,8 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_tgroup_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ #include #include "macros.h" #include "main.h" @@ -39,7 +40,6 @@ static char *SRCID_tgroup_c = "$Id$"; #include "vec.h" #include "network.h" #include "smalloc.h" -#include "vveclib.h" #include "update.h" #include "rbin.h" #include "assert.h" diff --git a/src/mdlib/timefft.c b/src/mdlib/timefft.c index b3dbf44d5b..9ed5f6b51b 100644 --- a/src/mdlib/timefft.c +++ b/src/mdlib/timefft.c @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_timefft_c = "$Id$"; + #include #include #include diff --git a/src/mdlib/update.c b/src/mdlib/update.c index bbe95f6acb..093ff2bc73 100644 --- a/src/mdlib/update.c +++ b/src/mdlib/update.c @@ -29,7 +29,7 @@ * And Hey: * GROup of MAchos and Cynical Suckers */ -static char *SRCID_update_c = "$Id$"; + #include #include @@ -40,7 +40,6 @@ static char *SRCID_update_c = "$Id$"; #include "nrnb.h" #include "physics.h" #include "macros.h" -#include "vveclib.h" #include "vec.h" #include "main.h" #include "confio.h" @@ -68,11 +67,9 @@ typedef struct { real d; } t_sdconst; -/* constants for a (bad) random number generator */ -const unsigned long im = 0xffff; -const unsigned long ia = 1093; -const unsigned long ic = 18257; -const real inv_im = 1.0/(0xffff); + + + static t_sdconst *sdc; @@ -233,22 +230,6 @@ static void do_update_visc(int start,int homenr,double dt, } } -static real fgauss(unsigned long *jran) -{ - static real sqrt3 = 1.7320508075688772; - real jr; - - *jran = (*jran*ia+ic) & im; - jr = (real)*jran; - *jran = (*jran*ia+ic) & im; - jr += (real)*jran; - *jran = (*jran*ia+ic) & im; - jr += (real)*jran; - *jran = (*jran*ia+ic) & im; - jr += (real)*jran; - - return sqrt3*(jr*inv_im-2); -} void init_sd_consts(int ngtc,real tau_t[],real dt) { @@ -283,10 +264,10 @@ static void do_update_sd(int start,int homenr, rvec accel[],ivec nFreeze[], real invmass[],unsigned short ptype[], unsigned short cFREEZE[],unsigned short cACC[], - unsigned short cTC[],real SAfactor, + unsigned short cTC[], rvec x[],rvec xprime[],rvec v[],rvec vold[],rvec f[], int ngtc,real tau_t[],real ref_t[], - int *seed, bool bFirstHalf) + t_Gaussdata gaussrand, bool bFirstHalf) { typedef struct { real V; @@ -313,7 +294,7 @@ static void do_update_sd(int start,int homenr, if(bFirstHalf) { for(n=0; nir); - + t_Gaussdata sd_gaussrand=NULL; + if(bFirst) { bHaveConstr = init_constraints(stdlog,top,&(parm->ir),md,start,homenr, ir->eI!=eiSteep,cr); @@ -623,6 +600,10 @@ void update(int natoms, /* number of atoms in simulation */ init_edsam(stdlog,top,md,start,homenr,x,parm->box, edyn,&edpar); + /* Initiate random number generator for stochastic and brownian dynamic integrators */ + if(ir->eI==eiSD || ir->eI==eiBD) + sd_gaussrand=init_gauss(ir->ld_seed); + /* Allocate memory for xold, original atomic positions * and for xprime. */ @@ -631,7 +612,6 @@ void update(int natoms, /* number of atoms in simulation */ /* Copy the pointer to the external acceleration in the opts */ ngacc=ir->opts.ngacc; ngtc=ir->opts.ngtc; - snew(lamb,ngtc); /* done with initializing */ @@ -683,10 +663,10 @@ void update(int natoms, /* number of atoms in simulation */ do_update_sd(start,homenr, ir->opts.acc,ir->opts.nFreeze, md->invmass,md->ptype, - md->cFREEZE,md->cACC,md->cTC,SAfactor, + md->cFREEZE,md->cACC,md->cTC, x,xprime,v,vold,force, ir->opts.ngtc,ir->opts.tau_t,ir->opts.ref_t, - &ir->ld_seed,TRUE); + sd_gaussrand,TRUE); if(bHaveConstr) { for(n=start; nopts.acc,ir->opts.nFreeze, md->invmass,md->ptype, - md->cFREEZE,md->cACC,md->cTC,SAfactor, + md->cFREEZE,md->cACC,md->cTC, x,xprime,v,vold,force, ir->opts.ngtc,ir->opts.tau_t,ir->opts.ref_t, - &ir->ld_seed,FALSE); + sd_gaussrand,FALSE); } else if(ir->eI==eiBD) do_update_bd(start,homenr,dt, ir->opts.nFreeze,md->invmass,md->ptype, @@ -715,7 +695,7 @@ void update(int natoms, /* number of atoms in simulation */ x,xprime,v,vold,force, ir->bd_temp,ir->bd_fric, ir->opts.ngtc,ir->opts.tau_t,ir->opts.ref_t, - &ir->ld_seed); + sd_gaussrand); else fatal_error(0,"Don't know how to update coordinates"); diff --git a/src/mdlib/vcm.c b/src/mdlib/vcm.c index e16898a7c0..450761df21 100644 --- a/src/mdlib/vcm.c +++ b/src/mdlib/vcm.c @@ -29,7 +29,9 @@ * And Hey: * Gromacs Runs On Most of All Computer Systems */ -static char *SRCID_vcm_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ + #include "macros.h" #include "vcm.h" #include "vec.h" diff --git a/src/mdlib/wnblist.c b/src/mdlib/wnblist.c index 0de17fb597..eb89df2b8f 100644 --- a/src/mdlib/wnblist.c +++ b/src/mdlib/wnblist.c @@ -29,7 +29,8 @@ * And Hey: * Gromacs Runs On Most of All Computer Systems */ -static char *SRCID_wnblist_c = "$Id$"; + +/* This file is completely threadsafe - keep it that way! */ #include #include #include "string2.h" diff --git a/src/mdlib/wnblist.h b/src/mdlib/wnblist.h index 3b63cf313c..d39a1e7afa 100644 --- a/src/mdlib/wnblist.h +++ b/src/mdlib/wnblist.h @@ -33,10 +33,7 @@ #ifndef _wnblist_h #define _wnblist_h -static char *SRCID_wnblist_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) wnblist.h 1.1 23 Oct 1994" -#endif /* HAVE_IDENT */ + #include "stdio.h" #include "typedefs.h" diff --git a/src/ngmx/Xstuff.h b/src/ngmx/Xstuff.h index c230b3f985..1a67d48999 100644 --- a/src/ngmx/Xstuff.h +++ b/src/ngmx/Xstuff.h @@ -33,11 +33,6 @@ #ifndef _Xstuff_h #define _Xstuff_h -static char *SRCID_Xstuff_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) Xstuff.h 1.16 11/23/92" -#endif /* HAVE_IDENT */ - /* The altivec extensions for ppc define some stupid overlapping * macros like pixel and vector - turn them off here, we only * need them in the inner loops. diff --git a/src/ngmx/alert.bm b/src/ngmx/alert.bm index 9f3d5cc549..77456df039 100644 --- a/src/ngmx/alert.bm +++ b/src/ngmx/alert.bm @@ -37,9 +37,6 @@ #ifndef _alert_bm #define _alert_bm -#ifdef HAVE_IDENT -#ident "@(#) alert.bm 1.4 9/29/92" -#endif /* HAVE_IDENT */ #define alert_width 48 #define alert_height 42 diff --git a/src/ngmx/buttons.c b/src/ngmx/buttons.c index 40bc982922..12348e7758 100644 --- a/src/ngmx/buttons.c +++ b/src/ngmx/buttons.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs On Most of All Computer Systems */ -static char *SRCID_buttons_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/buttons.h b/src/ngmx/buttons.h index d996ea7dee..0c4621c9e1 100644 --- a/src/ngmx/buttons.h +++ b/src/ngmx/buttons.h @@ -33,7 +33,7 @@ #ifndef _buttons_h #define _buttons_h -static char *SRCID_buttons_h = "$Id$"; + #include enum { diff --git a/src/ngmx/dialogs.c b/src/ngmx/dialogs.c index 7412555865..bff83913e1 100644 --- a/src/ngmx/dialogs.c +++ b/src/ngmx/dialogs.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs On Most of All Computer Systems */ -static char *SRCID_dialogs_c = "$Id$"; + #include "smalloc.h" #include "sysstuff.h" #include "macros.h" diff --git a/src/ngmx/dialogs.h b/src/ngmx/dialogs.h index cbd99b5daa..55f915db3d 100644 --- a/src/ngmx/dialogs.h +++ b/src/ngmx/dialogs.h @@ -33,7 +33,7 @@ #ifndef _dialogs_h #define _dialogs_h -static char *SRCID_dialogs_h = "$Id$"; + #include "xdlg.h" #include "pulldown.h" #include "manager.h" diff --git a/src/ngmx/dlg.c b/src/ngmx/dlg.c index 93b0c97181..e660953db0 100644 --- a/src/ngmx/dlg.c +++ b/src/ngmx/dlg.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs On Most of All Computer Systems */ -static char *SRCID_dlg_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/ff.bm b/src/ngmx/ff.bm index 9989ac3850..ee22199e27 100644 --- a/src/ngmx/ff.bm +++ b/src/ngmx/ff.bm @@ -37,9 +37,6 @@ #ifndef _ff_bm #define _ff_bm -#ifdef HAVE_IDENT -#ident "@(#) ff.bm 1.2 11/23/92" -#endif /* HAVE_IDENT */ #define ff_width 40 #define ff_height 32 static unsigned char ff_bits[] = { diff --git a/src/ngmx/fgrid.c b/src/ngmx/fgrid.c index b71a3953db..0342954515 100644 --- a/src/ngmx/fgrid.c +++ b/src/ngmx/fgrid.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs On Most of All Computer Systems */ -static char *SRCID_fgrid_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/fgrid.h b/src/ngmx/fgrid.h index e6d03ce310..e5de2e7be1 100644 --- a/src/ngmx/fgrid.h +++ b/src/ngmx/fgrid.h @@ -33,11 +33,6 @@ #ifndef _fgrid_h #define _fgrid_h -static char *SRCID_fgrid_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) fgrid.h 1.3 9/29/92" -#endif /* HAVE_IDENT */ - #include #include diff --git a/src/ngmx/filter.c b/src/ngmx/filter.c index 222b5eee61..2239090260 100644 --- a/src/ngmx/filter.c +++ b/src/ngmx/filter.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_filter_c = "$Id$"; + #include #include "sysstuff.h" #include "futil.h" diff --git a/src/ngmx/gmxlogo.c b/src/ngmx/gmxlogo.c index 36f00c3a5e..658a428954 100644 --- a/src/ngmx/gmxlogo.c +++ b/src/ngmx/gmxlogo.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_gmxlogo_c = "$Id$"; + #include "logo.h" void main(int argc, char *argv[]) diff --git a/src/ngmx/gromacs.bm b/src/ngmx/gromacs.bm index f680b1c299..b60f3e84b7 100644 --- a/src/ngmx/gromacs.bm +++ b/src/ngmx/gromacs.bm @@ -38,9 +38,6 @@ #ifndef _gromacs_bm #define _gromacs_bm -#ifdef HAVE_IDENT -#ident "@(#) gromacs.bm 1.9 9/29/92" -#endif /* HAVE_IDENT */ #define gromacs_width 48 #define gromacs_height 48 diff --git a/src/ngmx/highway.c b/src/ngmx/highway.c index dbec885342..9f1ef9c3b2 100644 --- a/src/ngmx/highway.c +++ b/src/ngmx/highway.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_highway_c = "$Id$"; + #include #include #include "futil.h" diff --git a/src/ngmx/info.bm b/src/ngmx/info.bm index bfbc878146..ab6c44a738 100644 --- a/src/ngmx/info.bm +++ b/src/ngmx/info.bm @@ -37,10 +37,6 @@ #ifndef _info_bm #define _info_bm -#ifdef HAVE_IDENT -#ident "@(#) info.bm 1.4 9/29/92" -#endif /* HAVE_IDENT */ - #define info_width 48 #define info_height 48 static unsigned char info_bits[] = { diff --git a/src/ngmx/logo.c b/src/ngmx/logo.c index e27a00aa65..9b6329d85e 100644 --- a/src/ngmx/logo.c +++ b/src/ngmx/logo.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_logo_c = "$Id$"; + #include "sysstuff.h" #include "Xstuff.h" #include "xutil.h" diff --git a/src/ngmx/logo.h b/src/ngmx/logo.h index db408e9e31..817a717fad 100644 --- a/src/ngmx/logo.h +++ b/src/ngmx/logo.h @@ -33,10 +33,6 @@ #ifndef _logo_h #define _logo_h -static char *SRCID_logo_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) logo.h 1.15 9/30/97" -#endif /* HAVE_IDENT */ #include #include diff --git a/src/ngmx/manager.c b/src/ngmx/manager.c index c8c13460ae..edaa8792e9 100644 --- a/src/ngmx/manager.c +++ b/src/ngmx/manager.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_manager_c = "$Id$"; + #include #include #include @@ -167,14 +167,14 @@ static void hide_label(t_x11 *x11,t_manager *man,int x,int y) void set_file(t_x11 *x11,t_manager *man,char *trajectory,char *status) { - char buf[256]; + char buf[256],quote[256]; t_tpxheader sh; t_atoms *at; bool *bB; int i,idum; real rdum; - read_tpxheader(status,&sh); + read_tpxheader(status,&sh,TRUE,NULL,NULL); snew(man->ix,sh.natoms); snew(man->zz,sh.natoms); snew(man->col,sh.natoms); @@ -201,7 +201,7 @@ void set_file(t_x11 *x11,t_manager *man,char *trajectory,char *status) "do not match",status,man->top.atoms.nr, trajectory,man->natom); - sprintf(buf,"%s: %s",*man->top.name,cool_quote()); + sprintf(buf,"%s: %s",*man->top.name,cool_quote(quote,255,NULL)); man->title.text = strdup(buf); man->view = init_view(man->box); at=&(man->top.atoms); diff --git a/src/ngmx/manager.h b/src/ngmx/manager.h index 8d733d41a4..9891b9d455 100644 --- a/src/ngmx/manager.h +++ b/src/ngmx/manager.h @@ -33,7 +33,6 @@ #ifndef _manager_h #define _manager_h -static char *SRCID_manager_h = "$Id$"; #include #include "typedefs.h" #include "x11.h" diff --git a/src/ngmx/molps.c b/src/ngmx/molps.c index e682985196..932e017946 100644 --- a/src/ngmx/molps.c +++ b/src/ngmx/molps.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_molps_c = "$Id$"; + #include #include "sysstuff.h" #include "string.h" @@ -46,7 +46,7 @@ static char *SRCID_molps_c = "$Id$"; #define MSIZE 4 -static void ps_draw_atom(FILE *ps,atom_id ai,iv2 vec2[],char **atomnm[]) +static void ps_draw_atom(t_psdata ps,atom_id ai,iv2 vec2[],char **atomnm[]) { int xi,yi; @@ -86,7 +86,7 @@ static bool local_pbc_dx(rvec x1, rvec x2) return TRUE; } -static void ps_draw_bond(FILE *ps, +static void ps_draw_bond(t_psdata ps, atom_id ai,atom_id aj,iv2 vec2[], rvec x[],char **atomnm[],int size[],bool bBalls) { @@ -124,7 +124,7 @@ static void ps_draw_bond(FILE *ps, } } -void ps_draw_objects(FILE *ps,int nobj,t_object objs[],iv2 vec2[],rvec x[], +void ps_draw_objects(t_psdata ps,int nobj,t_object objs[],iv2 vec2[],rvec x[], char **atomnm[],int size[],bool bShowHydro,int bond_type, bool bPlus) { @@ -161,7 +161,7 @@ static void v4_to_iv2(vec4 x4,iv2 v2,int x0,int y0,real sx,real sy) v2[YY]=y0-sy*x4[YY]*inv_z; } -static void draw_box(FILE *ps,t_3dview *view,matrix box, +static void draw_box(t_psdata ps,t_3dview *view,matrix box, int x0,int y0,real sx,real sy) { int ivec[8][4] = { @@ -191,7 +191,7 @@ static void draw_box(FILE *ps,t_3dview *view,matrix box, vec2[bonds[i][1]][XX],vec2[bonds[i][1]][YY]); } -void ps_draw_mol(FILE *ps,t_manager *man) +void ps_draw_mol(t_psdata ps,t_manager *man) { static char tstr[2][20]; static int ntime=0; diff --git a/src/ngmx/molps.h b/src/ngmx/molps.h index e52ac4ca11..9afe0c597b 100644 --- a/src/ngmx/molps.h +++ b/src/ngmx/molps.h @@ -33,10 +33,6 @@ #ifndef _molps_h #define _molps_h -static char *SRCID_molps_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) molps.h 1.10 9/30/97" -#endif /* HAVE_IDENT */ #include "sysstuff.h" #include "manager.h" diff --git a/src/ngmx/nener.c b/src/ngmx/nener.c index b84d3a1ae0..8d56efbaf1 100644 --- a/src/ngmx/nener.c +++ b/src/ngmx/nener.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_nener_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/nener.h b/src/ngmx/nener.h index f09fcbed18..2e40de370b 100644 --- a/src/ngmx/nener.h +++ b/src/ngmx/nener.h @@ -33,10 +33,6 @@ #ifndef _nener_h #define _nener_h -static char *SRCID_nener_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) nener.h 1.19 9/30/97" -#endif /* HAVE_IDENT */ #include "x11.h" #include "xutil.h" #include "popup.h" diff --git a/src/ngmx/ngmx.c b/src/ngmx/ngmx.c index 3a97f22f77..36abbaddaf 100644 --- a/src/ngmx/ngmx.c +++ b/src/ngmx/ngmx.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_ngmx_c = "$Id$"; + #include #include @@ -65,7 +65,7 @@ static void dump_xw(char *dispname,Window w,char *fn) static void dump_it(t_manager *man) { - FILE *ps; + t_psdata ps; ps=ps_open("ngmx.ps",0,0,man->molw->wd.width,man->molw->wd.height); ps_draw_mol(ps,man); @@ -343,7 +343,8 @@ void init_gmx(t_x11 *x11,char *program,int nfile,t_filenm fnm[]) matrix box; t_trxframe fr; int status; - + char quote[256]; + snew(gmx,1); snew(gmx->wd,1); @@ -357,7 +358,7 @@ void init_gmx(t_x11 *x11,char *program,int nfile,t_filenm fnm[]) /* Creates a simple window */ w0=DisplayWidth(x11->disp,x11->screen)-132; h0=DisplayHeight(x11->disp,x11->screen)-140; - InitWin(gmx->wd,0,0,w0,h0,3,bromacs()); + InitWin(gmx->wd,0,0,w0,h0,3,bromacs(quote,255)); gmx->wd->self=XCreateSimpleWindow(x11->disp,x11->root, gmx->wd->x, gmx->wd->y, gmx->wd->width,gmx->wd->height, diff --git a/src/ngmx/nleg.c b/src/ngmx/nleg.c index c904b548a9..d5ad371717 100644 --- a/src/ngmx/nleg.c +++ b/src/ngmx/nleg.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_nleg_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/nleg.h b/src/ngmx/nleg.h index b26c6ae231..de1ffb1045 100644 --- a/src/ngmx/nleg.h +++ b/src/ngmx/nleg.h @@ -33,10 +33,6 @@ #ifndef _nleg_h #define _nleg_h -static char *SRCID_nleg_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) nleg.h 1.19 9/30/97" -#endif /* HAVE_IDENT */ #include "x11.h" #include "xutil.h" #include "writeps.h" diff --git a/src/ngmx/nload.c b/src/ngmx/nload.c index 41c121dff2..68a95e9f02 100644 --- a/src/ngmx/nload.c +++ b/src/ngmx/nload.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_nload_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/nload.h b/src/ngmx/nload.h index 19da6ec16a..26bfb75361 100644 --- a/src/ngmx/nload.h +++ b/src/ngmx/nload.h @@ -33,10 +33,6 @@ #ifndef _nload_h #define _nload_h -static char *SRCID_nload_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) nload.h 1.19 9/30/97" -#endif /* HAVE_IDENT */ #include "x11.h" #include "xutil.h" diff --git a/src/ngmx/nmol.c b/src/ngmx/nmol.c index 5a967b8579..61c556ffb6 100644 --- a/src/ngmx/nmol.c +++ b/src/ngmx/nmol.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_nmol_c = "$Id$"; + #include #include "sysstuff.h" #include "string.h" diff --git a/src/ngmx/nmol.h b/src/ngmx/nmol.h index 5876d46370..d68af231d1 100644 --- a/src/ngmx/nmol.h +++ b/src/ngmx/nmol.h @@ -33,10 +33,6 @@ #ifndef _nmol_h #define _nmol_h -static char *SRCID_nmol_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) nmol.h 1.1 11/19/92" -#endif /* HAVE_IDENT */ #include "x11.h" #include "xutil.h" diff --git a/src/ngmx/play.bm b/src/ngmx/play.bm index 81191b22b0..a3d0390f71 100644 --- a/src/ngmx/play.bm +++ b/src/ngmx/play.bm @@ -37,9 +37,6 @@ #ifndef _play_bm #define _play_bm -#ifdef HAVE_IDENT -#ident "@(#) play.bm 1.2 11/23/92" -#endif /* HAVE_IDENT */ #define play_width 40 #define play_height 32 static unsigned char play_bits[] = { diff --git a/src/ngmx/popup.c b/src/ngmx/popup.c index 96be044edb..ba8ef010bd 100644 --- a/src/ngmx/popup.c +++ b/src/ngmx/popup.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_popup_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/popup.h b/src/ngmx/popup.h index 7c80d3b9e5..eafd26acf3 100644 --- a/src/ngmx/popup.h +++ b/src/ngmx/popup.h @@ -33,10 +33,6 @@ #ifndef _popup_h #define _popup_h -static char *SRCID_popup_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) popup.h 1.3 11/23/92" -#endif /* HAVE_IDENT */ #include "x11.h" #include "xutil.h" diff --git a/src/ngmx/pulldown.c b/src/ngmx/pulldown.c index e3c482214a..8ab022d808 100644 --- a/src/ngmx/pulldown.c +++ b/src/ngmx/pulldown.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_pulldown_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/pulldown.h b/src/ngmx/pulldown.h index 4ce0f8e790..0f33c3e4ba 100644 --- a/src/ngmx/pulldown.h +++ b/src/ngmx/pulldown.h @@ -33,10 +33,7 @@ #ifndef _pulldown_h #define _pulldown_h -static char *SRCID_pulldown_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) pulldown.h 1.4 11/23/92" -#endif /* HAVE_IDENT */ + #include "popup.h" typedef struct { diff --git a/src/ngmx/rewind.bm b/src/ngmx/rewind.bm index aef848ede6..1dd21981fa 100644 --- a/src/ngmx/rewind.bm +++ b/src/ngmx/rewind.bm @@ -36,9 +36,6 @@ #ifndef _rewind_bm #define _rewind_bm -#ifdef HAVE_IDENT -#ident "@(#) rewind.bm 1.2 11/23/92" -#endif /* HAVE_IDENT */ #define rewind_width 40 #define rewind_height 32 static unsigned char rewind_bits[] = { diff --git a/src/ngmx/scrollw.c b/src/ngmx/scrollw.c index cc6c6c8331..4a3a3f9cb9 100644 --- a/src/ngmx/scrollw.c +++ b/src/ngmx/scrollw.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_scrollw_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/showcol.c b/src/ngmx/showcol.c index 49c664d895..9700851f2e 100644 --- a/src/ngmx/showcol.c +++ b/src/ngmx/showcol.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_showcol_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/stop.bm b/src/ngmx/stop.bm index 91872a75a0..c651500528 100644 --- a/src/ngmx/stop.bm +++ b/src/ngmx/stop.bm @@ -37,9 +37,6 @@ #ifndef _stop_bm #define _stop_bm -#ifdef HAVE_IDENT -#ident "@(#) stop.bm 1.4 9/29/92" -#endif /* HAVE_IDENT */ #define stop_width 48 #define stop_height 48 diff --git a/src/ngmx/stop_ani.bm b/src/ngmx/stop_ani.bm index 011249231d..a9123a34b6 100644 --- a/src/ngmx/stop_ani.bm +++ b/src/ngmx/stop_ani.bm @@ -37,9 +37,7 @@ #ifndef _stop_ani_bm #define _stop_ani_bm -#ifdef HAVE_IDENT -#ident "@(#) stop_ani.bm 1.2 11/23/92" -#endif /* HAVE_IDENT */ + #define stop_ani_width 40 #define stop_ani_height 32 static unsigned char stop_ani_bits[] = { diff --git a/src/ngmx/vbox.c b/src/ngmx/vbox.c index 6e6be67cc0..f2ca6047d6 100644 --- a/src/ngmx/vbox.c +++ b/src/ngmx/vbox.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_vbox_c = "$Id$"; + #include "x11.h" #include "nmol.h" diff --git a/src/ngmx/x11.c b/src/ngmx/x11.c index 8968613b59..e8f475fd36 100644 --- a/src/ngmx/x11.c +++ b/src/ngmx/x11.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_x11_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/ngmx/x11.h b/src/ngmx/x11.h index 3bb100621f..d7c37d3fe5 100644 --- a/src/ngmx/x11.h +++ b/src/ngmx/x11.h @@ -33,11 +33,6 @@ #ifndef _x11_h #define _x11_h -static char *SRCID_x11_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) x11.h 1.6 12/16/92" -#endif /* HAVE_IDENT */ - #include #include "typedefs.h" #include "Xstuff.h" diff --git a/src/ngmx/xdlg.c b/src/ngmx/xdlg.c index f9d7d81b4c..7a03acb1cb 100644 --- a/src/ngmx/xdlg.c +++ b/src/ngmx/xdlg.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_xdlg_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/xdlg.h b/src/ngmx/xdlg.h index 666697b7bc..b9c7abbed3 100644 --- a/src/ngmx/xdlg.h +++ b/src/ngmx/xdlg.h @@ -33,10 +33,6 @@ #ifndef _xdlg_h #define _xdlg_h -static char *SRCID_xdlg_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) xdlg.h 1.3 9/29/92" -#endif /* HAVE_IDENT */ #include diff --git a/src/ngmx/xdlghi.c b/src/ngmx/xdlghi.c index c4726d9b18..c25b3d8a7b 100644 --- a/src/ngmx/xdlghi.c +++ b/src/ngmx/xdlghi.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_xdlghi_c = "$Id$"; + #include #include diff --git a/src/ngmx/xdlghi.h b/src/ngmx/xdlghi.h index 388cf11b5d..9091f275db 100644 --- a/src/ngmx/xdlghi.h +++ b/src/ngmx/xdlghi.h @@ -33,10 +33,6 @@ #ifndef _xdlghi_h #define _xdlghi_h -static char *SRCID_xdlghi_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) xdlghi.h 1.2 9/29/92" -#endif /* HAVE_IDENT */ #include #include "Xstuff.h" diff --git a/src/ngmx/xdlgitem.c b/src/ngmx/xdlgitem.c index 1b98237e1a..6987a1d754 100644 --- a/src/ngmx/xdlgitem.c +++ b/src/ngmx/xdlgitem.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_xdlgitem_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/xdlgitem.h b/src/ngmx/xdlgitem.h index fcbb55fbca..04cf1fca55 100644 --- a/src/ngmx/xdlgitem.h +++ b/src/ngmx/xdlgitem.h @@ -33,11 +33,6 @@ #ifndef _xdlgitem_h #define _xdlgitem_h -static char *SRCID_xdlgitem_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) xdlgitem.h 1.4 9/29/92" -#endif /* HAVE_IDENT */ - #include #include #include diff --git a/src/ngmx/xmb.c b/src/ngmx/xmb.c index eebfc73f55..c07726adac 100644 --- a/src/ngmx/xmb.c +++ b/src/ngmx/xmb.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_xmb_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/xmb.h b/src/ngmx/xmb.h index 62b2d15fc0..3af1b45d2e 100644 --- a/src/ngmx/xmb.h +++ b/src/ngmx/xmb.h @@ -33,11 +33,6 @@ #ifndef _xmb_h #define _xmb_h -static char *SRCID_xmb_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) xmb.h 1.3 9/29/92" -#endif /* HAVE_IDENT */ - #include #define MB_OK 1 diff --git a/src/ngmx/xrama.c b/src/ngmx/xrama.c index 5f3716635c..df3a5db6ce 100644 --- a/src/ngmx/xrama.c +++ b/src/ngmx/xrama.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_xrama_c = "$Id$"; + #include #include #include @@ -309,6 +309,7 @@ int main(int argc,char *argv[]) }; t_x11 *x11; + t_topology *ramatop; t_app *app; t_filenm fnm[] = { { efTRX, "-f", NULL, ffREAD }, @@ -328,15 +329,16 @@ int main(int argc,char *argv[]) XSetForeground(x11->disp,x11->gc,x11->fg); app=init_app(x11,argc,argv); - init_rama(ftp2fn(efTRX,NFILE,fnm),ftp2fn(efTPX,NFILE,fnm),app->xr); + ramatop = init_rama(ftp2fn(efTRX,NFILE,fnm),ftp2fn(efTPX,NFILE,fnm),app->xr); mk_gly(app); XMapWindow(x11->disp,app->wd.self); XMapSubwindows(x11->disp,app->wd.self); x11->MainLoop(x11); x11->CleanUp(x11); - + thanx(stderr); return 0; } + diff --git a/src/ngmx/xstat.c b/src/ngmx/xstat.c index 2e76e16a68..ab063a9dfe 100644 --- a/src/ngmx/xstat.c +++ b/src/ngmx/xstat.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_xstat_c = "$Id$"; + #include "sysstuff.h" #include "smalloc.h" #include "x11.h" diff --git a/src/ngmx/xutil.c b/src/ngmx/xutil.c index e7146b6fb8..566c947cd8 100644 --- a/src/ngmx/xutil.c +++ b/src/ngmx/xutil.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_xutil_c = "$Id$"; + #include #include #include diff --git a/src/ngmx/xutil.h b/src/ngmx/xutil.h index 89e3f408c5..40cbb7a7c9 100644 --- a/src/ngmx/xutil.h +++ b/src/ngmx/xutil.h @@ -33,10 +33,6 @@ #ifndef _xutil_h #define _xutil_h -static char *SRCID_xutil_h = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) xutil.h 1.5 11/11/92" -#endif /* HAVE_IDENT */ #include "typedefs.h" #include "writeps.h" diff --git a/src/tools/addconf.c b/src/tools/addconf.c index bab5d1dce6..c9d5db7408 100644 --- a/src/tools/addconf.c +++ b/src/tools/addconf.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_addconf_c = "$Id$"; + #include #include #include "vec.h" diff --git a/src/tools/addconf.h b/src/tools/addconf.h index 83e3696d4c..ad676825ef 100644 --- a/src/tools/addconf.h +++ b/src/tools/addconf.h @@ -29,7 +29,6 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_addconf_h = "$Id$"; #include "typedefs.h" extern diff --git a/src/tools/anadih.c b/src/tools/anadih.c index fe964711e6..85544b9de7 100644 --- a/src/tools/anadih.c +++ b/src/tools/anadih.c @@ -29,9 +29,10 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_anadih_c = "$Id$"; + #include #include +#include #include "physics.h" #include "smalloc.h" #include "macros.h" @@ -363,8 +364,8 @@ void get_chi_product_traj (real **dih,int nframes,int nangles, int nlist, real core_frac, bool bAll, char *fnall) { - bool bRotZero, bHaveChi; - int accum, index, i,j,k,Xi,n,b ; + bool bRotZero, bHaveChi=FALSE; + int accum=0, index, i,j,k,Xi,n,b ; real *chi_prtrj; int *chi_prhist; int nbin ; @@ -549,8 +550,8 @@ static void calc_angles(FILE *log,matrix box, if (debug) { fprintf(debug,"Angle[0]=%g, costh=%g, index0 = %d, %d, %d\n", ang[0],costh,index[0],index[1],index[2]); - pr_rvec(debug,0,"rij",r_ij,DIM); - pr_rvec(debug,0,"rkj",r_kj,DIM); + pr_rvec(debug,0,"rij",r_ij,DIM,TRUE); + pr_rvec(debug,0,"rkj",r_kj,DIM,TRUE); pr_rvecs(debug,0,"box",box,DIM); } } diff --git a/src/tools/angstat.h b/src/tools/angstat.h index 07edad4a7d..109a3ae9ee 100644 --- a/src/tools/angstat.h +++ b/src/tools/angstat.h @@ -33,7 +33,6 @@ #ifndef _angstat_h #define _angstat_h -static char *SRCID_angstat_h = "$Id$"; #include #include diff --git a/src/tools/autocorr.c b/src/tools/autocorr.c index 7b8e5709bd..d9201f752a 100644 --- a/src/tools/autocorr.c +++ b/src/tools/autocorr.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_autocorr_c = "$Id$"; + #include #include #include "macros.h" diff --git a/src/tools/average.c b/src/tools/average.c index e70679d435..3e9979f378 100644 --- a/src/tools/average.c +++ b/src/tools/average.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_average_c = "$Id$"; + #include #include #include "string2.h" diff --git a/src/tools/bondlist.c b/src/tools/bondlist.c index 050743d0ad..0da9535b44 100644 --- a/src/tools/bondlist.c +++ b/src/tools/bondlist.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_bondlist_c = "$Id$"; + #include "cdist.h" typedef struct list { diff --git a/src/tools/calcpot.c b/src/tools/calcpot.c index fa115d87c5..bc6d38c3c4 100644 --- a/src/tools/calcpot.c +++ b/src/tools/calcpot.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_calcpot_c = "$Id$"; + #include "vec.h" #include "calcpot.h" #include "nrnb.h" @@ -211,8 +211,8 @@ void init_calcpot(int nfile,t_filenm fnm[],t_topology *top, t_forcerec **fr,real **pot, matrix box) { - real t,t0,lam,lam0,SAfac; - bool bTYZ,bNEMD; + real t,t0,lam,lam0; + bool bTYZ,bNEMD,bSA; char *traj,*xtc_traj; rvec *v,mutot; t_nrnb nrnb; @@ -234,10 +234,10 @@ void init_calcpot(int nfile,t_filenm fnm[],t_topology *top, init_nrnb(&nrnb); init_single(stdlog,parm,ftp2fn(efTPX,nfile,fnm),top,x,&v,mdatoms,nsb); - init_md(cr,&(parm->ir),parm->box,&t,&t0,&lam,&lam0,&SAfac, + init_md(cr,&(parm->ir),parm->box,&t,&t0,&lam,&lam0, &nrnb,&bTYZ,top,-1,NULL,&traj,&xtc_traj,&fp_ene,NULL, &mdebin,grps,force_vir,pme_vir, - shake_vir,*mdatoms,mutot,&bNEMD,&vcm,nsb); + shake_vir,*mdatoms,mutot,&bNEMD,&bSA,&vcm,nsb); init_groups(stdlog,*mdatoms,&(parm->ir.opts),grps); /* Calculate intramolecular shift vectors to make molecules whole again */ diff --git a/src/tools/calcpot.h b/src/tools/calcpot.h index fd864b4f4c..435c173aab 100644 --- a/src/tools/calcpot.h +++ b/src/tools/calcpot.h @@ -29,7 +29,6 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_calcpot_h = "$Id$"; extern void init_calcpot(int nfile,t_filenm fnm[],t_topology *top, rvec **x,t_parm *parm,t_commrec *cr, diff --git a/src/tools/cdist.c b/src/tools/cdist.c index 3414491330..efd516e07e 100644 --- a/src/tools/cdist.c +++ b/src/tools/cdist.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_cdist_c = "$Id$"; + #include #include #include "assert.h" diff --git a/src/tools/cdist.h b/src/tools/cdist.h index 23be7469a1..621686a7da 100644 --- a/src/tools/cdist.h +++ b/src/tools/cdist.h @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_cdist_h = "$Id$"; + #define HEAD_LOADED #include #include diff --git a/src/tools/cmat.c b/src/tools/cmat.c index 39921b2bec..8de7426139 100644 --- a/src/tools/cmat.c +++ b/src/tools/cmat.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_cmat_c = "$Id$"; + #include "cmat.h" #include "smalloc.h" #include "macros.h" diff --git a/src/tools/cmat.h b/src/tools/cmat.h index b60e4046b0..aa4285bf04 100644 --- a/src/tools/cmat.h +++ b/src/tools/cmat.h @@ -33,7 +33,6 @@ #ifndef _cmat_h #define _cmat_h -static char *SRCID_cmat_h = "$Id$"; #include "typedefs.h" typedef struct { diff --git a/src/tools/correct.c b/src/tools/correct.c index 7c837dd048..f2feeb8b72 100644 --- a/src/tools/correct.c +++ b/src/tools/correct.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_correct_c = "$Id$"; + #include #include "assert.h" #include "vec.h" diff --git a/src/tools/disco.c b/src/tools/disco.c index 77b279ff34..8690bdcdbf 100644 --- a/src/tools/disco.c +++ b/src/tools/disco.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_disco_c = "$Id$"; + #include "macros.h" #include "statutil.h" #include "pdbio.h" diff --git a/src/tools/disco.h b/src/tools/disco.h index b7b2bdc773..d411f29ff2 100644 --- a/src/tools/disco.h +++ b/src/tools/disco.h @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_disco_h = "$Id$"; + #define _correct_h #include diff --git a/src/tools/discopar.c b/src/tools/discopar.c index 8033267803..bffc2651d5 100644 --- a/src/tools/discopar.c +++ b/src/tools/discopar.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_discopar_c = "$Id$"; + #include "typedefs.h" #include "network.h" #include "smalloc.h" diff --git a/src/tools/dlist.c b/src/tools/dlist.c index 9325b11368..7b675c7ecb 100644 --- a/src/tools/dlist.c +++ b/src/tools/dlist.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_dlist_c = "$Id$"; + #include #include "string2.h" #include "smalloc.h" diff --git a/src/tools/do_dssp.c b/src/tools/do_dssp.c index 7fab1eb31a..e1b5b0ea84 100644 --- a/src/tools/do_dssp.c +++ b/src/tools/do_dssp.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_do_dssp_c = "$Id$"; + #include "sysstuff.h" #include "typedefs.h" #include "string2.h" diff --git a/src/tools/dtools.c b/src/tools/dtools.c index c502ab5afe..3825081ac4 100644 --- a/src/tools/dtools.c +++ b/src/tools/dtools.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_dtools_c = "$Id$"; + #include "smalloc.h" #include "strdb.h" #include "futil.h" diff --git a/src/tools/editconf.c b/src/tools/editconf.c index 8123a18b2b..cb997e4617 100644 --- a/src/tools/editconf.c +++ b/src/tools/editconf.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_editconf_c = "$Id$"; + #include #include #include diff --git a/src/tools/edittop.c b/src/tools/edittop.c index c883e4e587..4a4acbf4db 100644 --- a/src/tools/edittop.c +++ b/src/tools/edittop.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_edittop_c = "$Id$"; + #include "smalloc.h" #include "string2.h" #include "fatal.h" diff --git a/src/tools/eigio.c b/src/tools/eigio.c index 02466019cd..a97cabbeca 100644 --- a/src/tools/eigio.c +++ b/src/tools/eigio.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_eigio_c = "$Id$"; + #include "smalloc.h" #include "vec.h" #include "eigio.h" diff --git a/src/tools/eigio.h b/src/tools/eigio.h index 98a0ea0cb8..f11c757990 100644 --- a/src/tools/eigio.h +++ b/src/tools/eigio.h @@ -33,7 +33,7 @@ #ifndef _eigio_h #define _eigio_h -static char *SRCID_eigio_h = "$Id$"; + #include "typedefs.h" enum { eWXR_NO, eWXR_YES, eWXR_NOFIT }; diff --git a/src/tools/eneconv.c b/src/tools/eneconv.c index 451fd243f4..61e02ffdb8 100644 --- a/src/tools/eneconv.c +++ b/src/tools/eneconv.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_eneconv_c = "$Id$"; + #include #include #include "string2.h" diff --git a/src/tools/expfit.c b/src/tools/expfit.c index b9b389dc4e..8eb2cbff88 100644 --- a/src/tools/expfit.c +++ b/src/tools/expfit.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_expfit_c = "$Id$"; + #include #include #include diff --git a/src/tools/fitahx.c b/src/tools/fitahx.c index 885ec0468d..02342b8863 100644 --- a/src/tools/fitahx.c +++ b/src/tools/fitahx.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_fitahx_c = "$Id$"; + #include "fitahx.h" #include "vec.h" #include "do_fit.h" diff --git a/src/tools/fitahx.h b/src/tools/fitahx.h index 57370a1995..76cccef023 100644 --- a/src/tools/fitahx.h +++ b/src/tools/fitahx.h @@ -33,7 +33,6 @@ #ifndef _fitahx_h #define _fitahx_h -static char *SRCID_fitahx_h = "$Id$"; #include "typedefs.h" #include "hxprops.h" diff --git a/src/tools/g_anaeig.c b/src/tools/g_anaeig.c index 902cd49539..fc27b251cc 100644 --- a/src/tools/g_anaeig.c +++ b/src/tools/g_anaeig.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_anaeig_c = "$Id$"; + #include #include #include "statutil.h" diff --git a/src/tools/g_analyze.c b/src/tools/g_analyze.c index 0ecec5c564..310d5585de 100644 --- a/src/tools/g_analyze.c +++ b/src/tools/g_analyze.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_analyze_c = "$Id$"; + #include #include #include "statutil.h" diff --git a/src/tools/g_angle.c b/src/tools/g_angle.c index c84bd3b519..94aa8b099b 100644 --- a/src/tools/g_angle.c +++ b/src/tools/g_angle.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_angle_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/tools/g_bond.c b/src/tools/g_bond.c index e3ba270f8c..0c3961c3bf 100644 --- a/src/tools/g_bond.c +++ b/src/tools/g_bond.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_bond_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/tools/g_bundle.c b/src/tools/g_bundle.c index 13801ad675..3df827dae7 100644 --- a/src/tools/g_bundle.c +++ b/src/tools/g_bundle.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_bundle_c = "$Id$"; + #include #include #include "statutil.h" diff --git a/src/tools/g_chi.c b/src/tools/g_chi.c index adbb546f51..e960a0bdd3 100644 --- a/src/tools/g_chi.c +++ b/src/tools/g_chi.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_chi_c = "$Id$"; + #include #include #include "confio.h" diff --git a/src/tools/g_cluster.c b/src/tools/g_cluster.c index 7d4e52997e..8661d6404b 100644 --- a/src/tools/g_cluster.c +++ b/src/tools/g_cluster.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_cluster_c = "$Id$"; + #include #include #include diff --git a/src/tools/g_clustsize.c b/src/tools/g_clustsize.c index 65ab7ce0d6..37b5ca3890 100644 --- a/src/tools/g_clustsize.c +++ b/src/tools/g_clustsize.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_clustsize_c = "$Id$"; + #include #include #include "string2.h" diff --git a/src/tools/g_com.c b/src/tools/g_com.c index 7fd330bcfe..a49d025a44 100644 --- a/src/tools/g_com.c +++ b/src/tools/g_com.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_com_c = "$Id$"; + #include "sysstuff.h" #include "smalloc.h" #include "macros.h" diff --git a/src/tools/g_confrms.c b/src/tools/g_confrms.c index ae25c9ac9a..2f0102e323 100644 --- a/src/tools/g_confrms.c +++ b/src/tools/g_confrms.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_confrms_c = "$Id$"; + #include "filenm.h" #include "smalloc.h" #include "macros.h" diff --git a/src/tools/g_covar.c b/src/tools/g_covar.c index e229aecdbc..68bf34ebb4 100644 --- a/src/tools/g_covar.c +++ b/src/tools/g_covar.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_covar_c = "$Id$"; + #include #include #include diff --git a/src/tools/g_density.c b/src/tools/g_density.c index e9f7dfae2b..93e5db016e 100644 --- a/src/tools/g_density.c +++ b/src/tools/g_density.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_density_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/tools/g_dielectric.c b/src/tools/g_dielectric.c index 22da5ad132..7190a07675 100644 --- a/src/tools/g_dielectric.c +++ b/src/tools/g_dielectric.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_dielectric_c = "$Id$"; + #include #include #include diff --git a/src/tools/g_dih.c b/src/tools/g_dih.c index 78b224eb10..3e51b04678 100644 --- a/src/tools/g_dih.c +++ b/src/tools/g_dih.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_dih_c = "$Id$"; + #include #include "sysstuff.h" #include "string2.h" diff --git a/src/tools/g_dipoles.c b/src/tools/g_dipoles.c index 7faa856241..7785693500 100644 --- a/src/tools/g_dipoles.c +++ b/src/tools/g_dipoles.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_dipoles_c = "$Id$"; + #include #include #include "macros.h" @@ -331,7 +331,7 @@ void mol_quad(int k0,int k1,atom_id ma[],rvec x[],t_atom atom[],rvec quad) } if (debug) - pr_rvec(debug,0,"Quadrupole",quad,DIM); + pr_rvec(debug,0,"Quadrupole",quad,DIM,TRUE); /* clean-up */ for(i=0; (i #include #include @@ -383,7 +383,7 @@ int main (int argc,char *argv[]) if (ntop) init5(ntop); - read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&header); + read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&header,FALSE,NULL,NULL); snew(xtop,header.natoms); read_tpx(ftp2fn(efTPX,NFILE,fnm),&step,&t,&lambda,&ir, box,&ntopatoms,xtop,NULL,NULL,&top); diff --git a/src/tools/g_dist.c b/src/tools/g_dist.c index afe06c9ce9..a1ca521d7b 100644 --- a/src/tools/g_dist.c +++ b/src/tools/g_dist.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_dist_c = "$Id$"; + #include #include "smalloc.h" #include "macros.h" diff --git a/src/tools/g_dyndom.c b/src/tools/g_dyndom.c index 238f15b582..cbbe89ee62 100644 --- a/src/tools/g_dyndom.c +++ b/src/tools/g_dyndom.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_dyndom_c = "$Id$"; + #include "3dview.h" #include "statutil.h" #include "smalloc.h" diff --git a/src/tools/g_enemat.c b/src/tools/g_enemat.c index bf5f6bfaf9..86e0d1a388 100644 --- a/src/tools/g_enemat.c +++ b/src/tools/g_enemat.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_enemat_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/tools/g_energy.c b/src/tools/g_energy.c index 389c649375..00ffa2aa2c 100644 --- a/src/tools/g_energy.c +++ b/src/tools/g_energy.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_energy_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/tools/g_gyrate.c b/src/tools/g_gyrate.c index e87b389369..a4606ec217 100644 --- a/src/tools/g_gyrate.c +++ b/src/tools/g_gyrate.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_gyrate_c = "$Id$"; + #include #include #include "statutil.h" diff --git a/src/tools/g_h2order.c b/src/tools/g_h2order.c index 024f8be220..f1820da0a6 100644 --- a/src/tools/g_h2order.c +++ b/src/tools/g_h2order.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_h2order_c = "$Id$"; + #include #include "sysstuff.h" #include "string.h" diff --git a/src/tools/g_hbond.c b/src/tools/g_hbond.c index c3a901f87e..02c1904fc0 100644 --- a/src/tools/g_hbond.c +++ b/src/tools/g_hbond.c @@ -29,10 +29,6 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_hbond_c = "$Id$"; -#ifdef HAVE_IDENT -#ident "@(#) g_hbond.cc 1.29 9/30/97" -#endif /* HAVE_IDENT */ #include "statutil.h" #include "copyrite.h" diff --git a/src/tools/g_helix.c b/src/tools/g_helix.c index 1a7ca76e14..baa945cb66 100644 --- a/src/tools/g_helix.c +++ b/src/tools/g_helix.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_helix_c = "$Id$"; + #include #include "confio.h" #include "copyrite.h" diff --git a/src/tools/g_lie.c b/src/tools/g_lie.c index 00c71611c6..18beaf3c85 100644 --- a/src/tools/g_lie.c +++ b/src/tools/g_lie.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_lie_c = "$Id$"; + #include #include #include diff --git a/src/tools/g_mdmat.c b/src/tools/g_mdmat.c index f04387ccc3..b4b619964a 100644 --- a/src/tools/g_mdmat.c +++ b/src/tools/g_mdmat.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_mdmat_c = "$Id$"; + #include #include #include "macros.h" diff --git a/src/tools/g_mindist.c b/src/tools/g_mindist.c index 26f4c9a010..49344bc8c5 100644 --- a/src/tools/g_mindist.c +++ b/src/tools/g_mindist.c @@ -29,7 +29,8 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_mindist_c = "$Id$"; + + #include #include #include "sysstuff.h" @@ -210,8 +211,13 @@ void dist_plot(char *fn,char *afile,char *dfile, int trxout; char buf[256]; char **leg; +<<<<<<< g_mindist.c + real t,md,**mdist=NULL; + int nd,status; +======= real t,dmin,dmax,**mindres,**maxdres; int nmin,nmax,status; +>>>>>>> 1.29 int i,j,k,natoms; int min1,min2,max1,max2; atom_id oindex[2]; @@ -359,7 +365,7 @@ void dist_plot(char *fn,char *afile,char *dfile, int find_residues(t_atoms *atoms, int n, atom_id index[], atom_id **resindex) { int i; - int nres,resnr, presnr; + int nres=0,resnr, presnr; int *residx; /* build index of first atom numbers for each residue */ diff --git a/src/tools/g_morph.c b/src/tools/g_morph.c index 4eb140bade..3598399178 100644 --- a/src/tools/g_morph.c +++ b/src/tools/g_morph.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_morph_c = "$Id$"; + #include "confio.h" #include "statutil.h" #include "smalloc.h" diff --git a/src/tools/g_msd.c b/src/tools/g_msd.c index ee0fce8dd4..3ccc8609e4 100644 --- a/src/tools/g_msd.c +++ b/src/tools/g_msd.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_msd_c = "$Id$"; + #include #include diff --git a/src/tools/g_multipoles.c b/src/tools/g_multipoles.c index e6122176cf..eef647b4d5 100644 --- a/src/tools/g_multipoles.c +++ b/src/tools/g_multipoles.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_g_multipoles_c = "$Id$"; + #include #include "statutil.h" #include "macros.h" diff --git a/src/tools/g_nmeig.c b/src/tools/g_nmeig.c index 7dcfc49380..14d122bc35 100644 --- a/src/tools/g_nmeig.c +++ b/src/tools/g_nmeig.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_nmeig_c = "$Id$"; + #include #include #include "statutil.h" diff --git a/src/tools/g_nmens.c b/src/tools/g_nmens.c index 7d50ef5de9..b87bd193f3 100644 --- a/src/tools/g_nmens.c +++ b/src/tools/g_nmens.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_nmens_c = "$Id$"; + #include #include #include "statutil.h" diff --git a/src/tools/g_order.c b/src/tools/g_order.c index d9d9c0e46e..87cc7a855a 100644 --- a/src/tools/g_order.c +++ b/src/tools/g_order.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_order_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/tools/g_potential.c b/src/tools/g_potential.c index 07036cdbae..78bc0ca13b 100644 --- a/src/tools/g_potential.c +++ b/src/tools/g_potential.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_potential_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/tools/g_rama.c b/src/tools/g_rama.c index d7b7047f62..5463f4661b 100644 --- a/src/tools/g_rama.c +++ b/src/tools/g_rama.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_rama_c = "$Id$"; + #include #include "sysstuff.h" #include "string.h" diff --git a/src/tools/g_rdf.c b/src/tools/g_rdf.c index c7ebdbd16c..a962f11497 100644 --- a/src/tools/g_rdf.c +++ b/src/tools/g_rdf.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_rdf_c = "$Id$"; + #include #include #include "string2.h" diff --git a/src/tools/g_relax.c b/src/tools/g_relax.c index dadae21d2d..b26514749a 100644 --- a/src/tools/g_relax.c +++ b/src/tools/g_relax.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_relax_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/tools/g_rms.c b/src/tools/g_rms.c index 96c124541d..837312ac09 100644 --- a/src/tools/g_rms.c +++ b/src/tools/g_rms.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_rms_c = "$Id$"; + #include "smalloc.h" #include "math.h" #include "macros.h" @@ -177,7 +177,7 @@ int main (int argc,char *argv[]) int maxframe=NFRAME,maxframe2=NFRAME; real t,lambda,*w_rls,*w_rms,tmas,*w_rls_m=NULL,*w_rms_m=NULL; bool bTruncOct,bNorm,bAv,bFreq2,bFile2,bMat,bBond,bDelta,bMirror,bMass; - bool bFit,bReset; + bool bFit=FALSE,bReset=FALSE; t_topology top; t_iatom *iatom=NULL; diff --git a/src/tools/g_rmsdist.c b/src/tools/g_rmsdist.c index 63f5a5c1fd..723b21f33d 100644 --- a/src/tools/g_rmsdist.c +++ b/src/tools/g_rmsdist.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_rmsdist_c = "$Id$"; + #include #include #include "macros.h" diff --git a/src/tools/g_rmsf.c b/src/tools/g_rmsf.c index c9d6a2c5ee..64bbbe75e9 100644 --- a/src/tools/g_rmsf.c +++ b/src/tools/g_rmsf.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_rmsf_c = "$Id$"; + #include "smalloc.h" #include "math.h" #include "macros.h" diff --git a/src/tools/g_rotacf.c b/src/tools/g_rotacf.c index e09014d67d..79692722ed 100644 --- a/src/tools/g_rotacf.c +++ b/src/tools/g_rotacf.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_rotacf_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/tools/g_run_rms.c b/src/tools/g_run_rms.c index 6d150c76d2..e8cfd297a0 100644 --- a/src/tools/g_run_rms.c +++ b/src/tools/g_run_rms.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_run_rms_c = "$Id$"; + #include #include "smalloc.h" #include "typedefs.h" @@ -80,7 +80,6 @@ int main (int argc,char *argv[]) real t,lambda,*w_rls,*w_rms,tmas; int status; t_tpxheader header; - t_inputrec ir; t_topology top; matrix box; rvec **x,*xp,*v,xcm,*temp; @@ -104,7 +103,7 @@ int main (int argc,char *argv[]) NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL); snew(x,run_time+1); - read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&header); + read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&header,TRUE); snew(xp,header.natoms); for(i=0;(i #include #include "macros.h" diff --git a/src/tools/g_sas.c b/src/tools/g_sas.c index be2b9b0158..01d9a19180 100644 --- a/src/tools/g_sas.c +++ b/src/tools/g_sas.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_sas_c = "$Id$"; + #include #include #include "sysstuff.h" diff --git a/src/tools/g_sgangle.c b/src/tools/g_sgangle.c index 362e2c0971..f45e7b9531 100644 --- a/src/tools/g_sgangle.c +++ b/src/tools/g_sgangle.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_sgangle_c = "$Id$"; + #include #include "sysstuff.h" #include "string.h" diff --git a/src/tools/g_sorient.c b/src/tools/g_sorient.c index 72b7eccbcf..745dfcbd09 100644 --- a/src/tools/g_sorient.c +++ b/src/tools/g_sorient.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_sorient_c = "$Id$"; + #include "macros.h" #include "statutil.h" #include "smalloc.h" diff --git a/src/tools/g_tcaf.c b/src/tools/g_tcaf.c index caa8b67d5d..fe2b9bda80 100644 --- a/src/tools/g_tcaf.c +++ b/src/tools/g_tcaf.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_tcaf_c = "$Id$"; + #include #include #include "confio.h" diff --git a/src/tools/g_traj.c b/src/tools/g_traj.c index 4bf9b1d5d4..ebe2b069f1 100644 --- a/src/tools/g_traj.c +++ b/src/tools/g_traj.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_traj_c = "$Id$"; + #include #include #include "statutil.h" diff --git a/src/tools/g_velacc.c b/src/tools/g_velacc.c index 550193cb17..dc45205396 100644 --- a/src/tools/g_velacc.c +++ b/src/tools/g_velacc.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_g_velacc_c = "$Id$"; + #include #include #include "confio.h" diff --git a/src/tools/g_wham.c b/src/tools/g_wham.c index 86f8759d77..ec7aa72fc5 100644 --- a/src/tools/g_wham.c +++ b/src/tools/g_wham.c @@ -35,7 +35,7 @@ */ /* This line is only for CVS version info */ -static char *SRCID_template_c = "$Id$"; + static float Temperature=298.0; #include "statutil.h" #include "typedefs.h" diff --git a/src/tools/genbox.c b/src/tools/genbox.c index b5de0c99d4..2d1b72c88b 100644 --- a/src/tools/genbox.c +++ b/src/tools/genbox.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_genbox_c = "$Id$"; + #include "sysstuff.h" #include "typedefs.h" #include "smalloc.h" diff --git a/src/tools/genconf.c b/src/tools/genconf.c index 9b60aa731e..bec1324a04 100644 --- a/src/tools/genconf.c +++ b/src/tools/genconf.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_genconf_c = "$Id$"; + #include "maths.h" #include "macros.h" #include "copyrite.h" diff --git a/src/tools/gendr.c b/src/tools/gendr.c index 91075e7fe7..5362d2f2fc 100644 --- a/src/tools/gendr.c +++ b/src/tools/gendr.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_gendr_c = "$Id$"; + #include #include #include diff --git a/src/tools/genion.c b/src/tools/genion.c index acee58bf88..f1d1ad21a0 100644 --- a/src/tools/genion.c +++ b/src/tools/genion.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_genion_c = "$Id$"; + #include #include "copyrite.h" #include "string2.h" diff --git a/src/tools/genpr.c b/src/tools/genpr.c index 1e092f2646..9a16633840 100644 --- a/src/tools/genpr.c +++ b/src/tools/genpr.c @@ -29,7 +29,7 @@ * And Hey: * Gromacs Runs One Microsecond At Cannonball Speeds */ -static char *SRCID_genpr_c = "$Id$"; + #include #include "sysstuff.h" #include "statutil.h" diff --git a/src/tools/hxprops.c b/src/tools/hxprops.c index 29d60e8b5c..caf9f8737f 100644 --- a/src/tools/hxprops.c +++ b/src/tools/hxprops.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_hxprops_c = "$Id$"; + #include #include #include "macros.h" diff --git a/src/tools/hxprops.h b/src/tools/hxprops.h index b90e4f8f36..6aced223d6 100644 --- a/src/tools/hxprops.h +++ b/src/tools/hxprops.h @@ -33,7 +33,7 @@ #ifndef _hxprops_h #define _hxprops_h -static char *SRCID_hxprops_h = "$Id$"; + #include #include "typedefs.h" diff --git a/src/tools/levenmar.c b/src/tools/levenmar.c index 6348a4d5cf..0e60351559 100644 --- a/src/tools/levenmar.c +++ b/src/tools/levenmar.c @@ -29,7 +29,7 @@ * And Hey: * GROtesk MACabre and Sinister */ -static char *SRCID_levenmar_c = "$Id$"; + #include #include #include diff --git a/src/tools/lsq.c b/src/tools/lsq.c index 3f68392bd5..e3a92e9116 100644 --- a/src/tools/lsq.c +++ b/src/tools/lsq.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_lsq_c = "$Id$"; + #include "typedefs.h" #include "gstat.h" #include "vec.h" diff --git a/src/tools/luck.c b/src/tools/luck.c index 5ce98f14ff..766d5ed16a 100644 --- a/src/tools/luck.c +++ b/src/tools/luck.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_luck_c = "$Id$"; + #include #include "copyrite.h" #include "string.h" diff --git a/src/tools/make_ndx.c b/src/tools/make_ndx.c index bbcfc15cda..3eb4d287bb 100644 --- a/src/tools/make_ndx.c +++ b/src/tools/make_ndx.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_make_ndx_c = "$Id$"; + #include #include "sysstuff.h" #include "strdb.h" diff --git a/src/tools/mcprop.c b/src/tools/mcprop.c index a0f9471153..b153ad6f99 100644 --- a/src/tools/mcprop.c +++ b/src/tools/mcprop.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_mcprop_c = "$Id$"; + #include #include "typedefs.h" #include "random.h" diff --git a/src/tools/mcprop.h b/src/tools/mcprop.h index 804aa3ae6f..2fe575dace 100644 --- a/src/tools/mcprop.h +++ b/src/tools/mcprop.h @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_mcprop_h = "$Id$"; + #include "typedefs.h" typedef real t_propfunc(int nx,real x[]); diff --git a/src/tools/mk_angndx.c b/src/tools/mk_angndx.c index 3e3242086e..4defb9120e 100644 --- a/src/tools/mk_angndx.c +++ b/src/tools/mk_angndx.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_mk_angndx_c = "$Id$"; + #include "typedefs.h" #include "smalloc.h" #include "copyrite.h" diff --git a/src/tools/my_rdf.c b/src/tools/my_rdf.c index 5455afa111..e23f2de3ef 100644 --- a/src/tools/my_rdf.c +++ b/src/tools/my_rdf.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_my_rdf_c = "$Id$"; + #include #include "sysstuff.h" #include "string.h" diff --git a/src/tools/nsc.c b/src/tools/nsc.c index f0e0f64cca..33df29630d 100644 --- a/src/tools/nsc.c +++ b/src/tools/nsc.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_nsc_c = "$Id$"; + #include #include #include diff --git a/src/tools/nsc.h b/src/tools/nsc.h index 989aae68c4..47e1442d8e 100644 --- a/src/tools/nsc.h +++ b/src/tools/nsc.h @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_nsc_h = "$Id$"; + #include "typedefs.h" #define FLAG_DOTS 01 diff --git a/src/tools/orise.c b/src/tools/orise.c index fc5921f139..d3d8e90621 100644 --- a/src/tools/orise.c +++ b/src/tools/orise.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_orise_c = "$Id$"; + #include "typedefs.h" #include "maths.h" #include "string2.h" diff --git a/src/tools/orise.h b/src/tools/orise.h index 469db0b599..82b1e5ecc4 100644 --- a/src/tools/orise.h +++ b/src/tools/orise.h @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_orise_h = "$Id$"; + #include "typedefs.h" #include "pinput.h" diff --git a/src/tools/pinput.c b/src/tools/pinput.c index 712a604ac6..f100ac6b45 100644 --- a/src/tools/pinput.c +++ b/src/tools/pinput.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_pinput_c = "$Id$"; + #include "paramio.h" #include "pinput.h" diff --git a/src/tools/pinput.h b/src/tools/pinput.h index 78d4cadb9a..546523715d 100644 --- a/src/tools/pinput.h +++ b/src/tools/pinput.h @@ -33,7 +33,6 @@ #ifndef _pinput_h #define _pinput_h -static char *SRCID_pinput_h = "$Id$"; #include "typedefs.h" #include "string2.h" diff --git a/src/tools/polynomials.c b/src/tools/polynomials.c index cca6a7eac7..312b4903ef 100644 --- a/src/tools/polynomials.c +++ b/src/tools/polynomials.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_polynomials_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/tools/pp2shift.c b/src/tools/pp2shift.c index a0f555e524..7866eb0da3 100644 --- a/src/tools/pp2shift.c +++ b/src/tools/pp2shift.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_pp2shift_c = "$Id$"; + #include #include #include "typedefs.h" diff --git a/src/tools/proptim.c b/src/tools/proptim.c index 6ec63629d3..c3e53694f5 100644 --- a/src/tools/proptim.c +++ b/src/tools/proptim.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_proptim_c = "$Id$"; + #include "typedefs.h" #include "maths.h" #include "string2.h" diff --git a/src/tools/ql77.c b/src/tools/ql77.c index eea72e91d7..7bef8f03a0 100644 --- a/src/tools/ql77.c +++ b/src/tools/ql77.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_ql77_c = "$Id$"; + #include #include "typedefs.h" #include "vec.h" diff --git a/src/tools/ql77.h b/src/tools/ql77.h index 409e23e406..d01e11ba70 100644 --- a/src/tools/ql77.h +++ b/src/tools/ql77.h @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_ql77_h = "$Id$"; + extern void ql77 (int n,real *x,real *d); /* Determine the eigenvalues d[n] and eigenvectors * * of the symmetric n x n matrix x. The eigenvectors * diff --git a/src/tools/readev.c b/src/tools/readev.c index e76298582b..b3835a49b3 100644 --- a/src/tools/readev.c +++ b/src/tools/readev.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_readev_c = "$Id$"; + #include "readev.h" #include "futil.h" #include "smalloc.h" diff --git a/src/tools/readev.h b/src/tools/readev.h index de2d772200..9074687301 100644 --- a/src/tools/readev.h +++ b/src/tools/readev.h @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_readev_h = "$Id$"; + #include "typedefs.h" #ifndef _readev_h diff --git a/src/tools/recomb.c b/src/tools/recomb.c index ce827e3951..51e35a89fd 100644 --- a/src/tools/recomb.c +++ b/src/tools/recomb.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_recomb_c = "$Id$"; + #include "recomb.h" #include "futil.h" #include "wgms.h" diff --git a/src/tools/recomb.h b/src/tools/recomb.h index 3e8e58fd98..890fe3d9e9 100644 --- a/src/tools/recomb.h +++ b/src/tools/recomb.h @@ -33,7 +33,6 @@ #ifndef _recomb_h #define _recomb_h -static char *SRCID_recomb_h = "$Id$"; #include "typedefs.h" diff --git a/src/tools/residues.c b/src/tools/residues.c index c600692360..0235001286 100644 --- a/src/tools/residues.c +++ b/src/tools/residues.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_residues_c = "$Id$"; + #include #include "assert.h" #include "cdist.h" diff --git a/src/tools/sas2mat.c b/src/tools/sas2mat.c index 62416114b8..25b497f835 100644 --- a/src/tools/sas2mat.c +++ b/src/tools/sas2mat.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_sas2mat_c = "$Id$"; + #include #include "sysstuff.h" #include "matio.h" diff --git a/src/tools/smooth.c b/src/tools/smooth.c index 8b9c1c78f3..a1305d481c 100644 --- a/src/tools/smooth.c +++ b/src/tools/smooth.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_smooth_c = "$Id$"; + #include "cdist.h" #define NMRLEN 99.9 diff --git a/src/tools/testacf.c b/src/tools/testacf.c index 9930e652a4..056443477a 100644 --- a/src/tools/testacf.c +++ b/src/tools/testacf.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_testacf_c = "$Id$"; + #include #include "typedefs.h" #include "xvgr.h" diff --git a/src/tools/trjcat.c b/src/tools/trjcat.c index 6802612685..79c1edbc6c 100644 --- a/src/tools/trjcat.c +++ b/src/tools/trjcat.c @@ -29,7 +29,7 @@ * And Hey: * Glycine aRginine prOline Methionine Alanine Cystine Serine */ -static char *SRCID_trjcat_c = "$Id$"; + #include #include #include "macros.h" @@ -52,7 +52,6 @@ static char *SRCID_trjcat_c = "$Id$"; #include "rmpbc.h" #include "wgms.h" #include "magic.h" -#include "binio.h" #include "pbc.h" #define TIME_EXPLICIT 0 diff --git a/src/tools/trjconv.c b/src/tools/trjconv.c index 4bae0ff014..77f6312548 100644 --- a/src/tools/trjconv.c +++ b/src/tools/trjconv.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_trjconv_c = "$Id$"; + #ifdef HAVE_CONFIG_H #include #endif @@ -56,7 +56,6 @@ static char *SRCID_trjconv_c = "$Id$"; #include "rmpbc.h" #include "wgms.h" #include "magic.h" -#include "binio.h" #include "pbc.h" #include "viewit.h" @@ -377,7 +376,7 @@ int main(int argc,char *argv[]) "Start writing new file when t MOD split = first time (%t)" }, { "-sep", FALSE, etBOOL, {&bSeparate}, "Write each frame to a separate .gro, .g96 or .pdb file"}, - { "-ter", FALSE, etBOOL, &bTer, + { "-ter", FALSE, etBOOL, {&bTer}, "Use 'TER' in pdb file as end of frame in stead of default 'ENDMDL'" } }; diff --git a/src/tools/trjorder.c b/src/tools/trjorder.c index c69dfc8476..1068fc5afd 100644 --- a/src/tools/trjorder.c +++ b/src/tools/trjorder.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_trjorder_c = "$Id$"; + #include #include #include "statutil.h" diff --git a/src/tools/wheel.c b/src/tools/wheel.c index 85b21c5b98..2cc918c621 100644 --- a/src/tools/wheel.c +++ b/src/tools/wheel.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_wheel_c = "$Id$"; + #include #include "sysstuff.h" #include "physics.h" @@ -74,7 +74,7 @@ void wheel(char *fn,int nres,char *resnm[],int r0,real rot0,char *title) const real fontasp = 0.6; const real fontwidth = fontsize*fontasp; - FILE *out; + t_psdata out; int i,sl,slen; real ring,inner,outer; real xc,yc,box; diff --git a/src/tools/xpm2ps.c b/src/tools/xpm2ps.c index 60c0ab807a..534e382ed4 100644 --- a/src/tools/xpm2ps.c +++ b/src/tools/xpm2ps.c @@ -29,7 +29,7 @@ * And Hey: * Green Red Orange Magenta Azure Cyan Skyblue */ -static char *SRCID_xpm2ps_c = "$Id$"; + #include #include "string2.h" #include "copyrite.h" @@ -93,9 +93,9 @@ enum { ecSel, ecHalves, ecAdd, ecSub, ecMult, ecDiv, ecNR }; void get_params(char *mpin,char *mpout,t_psrec *psr) { - static char *bools[BOOL_NR+1] = { "no", "yes", NULL }; + static const char *bools[BOOL_NR+1] = { "no", "yes", NULL }; /* this must correspond to t_rgb *linecolors[] below */ - static char *colors[] = { "none", "black", "white", NULL }; + static const char *colors[] = { "none", "black", "white", NULL }; t_inpfile *inp; char *tmp; int ninp; @@ -181,7 +181,7 @@ bool diff_maps(int nmap1,t_mapping *map1,int nmap2,t_mapping *map2) return bDiff; } -void leg_discrete(FILE *ps,real x0,real y0,char *label, +void leg_discrete(t_psdata ps,real x0,real y0,char *label, real fontsize,char *font,int nmap,t_mapping map[]) { int i; @@ -208,7 +208,7 @@ void leg_discrete(FILE *ps,real x0,real y0,char *label, } } -void leg_continuous(FILE *ps,real x0,real x,real y0,char *label, +void leg_continuous(t_psdata ps,real x0,real x,real y0,char *label, real fontsize,char *font, int nmap,t_mapping map[]) { @@ -241,7 +241,7 @@ void leg_continuous(FILE *ps,real x0,real x,real y0,char *label, ps_ctext(ps,xx0+(nmap*boxxh)-boxxh/2,yhh,map[nmap-1].desc,eXCenter); } -void leg_bicontinuous(FILE *ps,real x0,real x,real y0,char *label1,char *label2, +void leg_bicontinuous(t_psdata ps,real x0,real x,real y0,char *label1,char *label2, real fontsize,char *font, int nmap1,t_mapping map1[],int nmap2,t_mapping map2[]) { @@ -290,7 +290,7 @@ static bool box_do_all_x_min_ticks(t_psrec *psr) return (psr->boxspacing>(1.5*psr->X.minorticklen)); } -static void draw_boxes(FILE *out,real x0,real y0,real w, +static void draw_boxes(t_psdata ps,real x0,real y0,real w, int nmat,t_matrix mat[],t_psrec *psr) { char buf[12]; @@ -304,17 +304,17 @@ static void draw_boxes(FILE *out,real x0,real y0,real w, strlength = 0; /* Draw the box */ - ps_rgb(out,BLACK); - ps_linewidth(out,psr->boxlinewidth); + ps_rgb(ps,BLACK); + ps_linewidth(ps,psr->boxlinewidth); yy00=y0; for(i=0; (iticklinewidth); + ps_linewidth(ps,psr->ticklinewidth); xx00=x0-1; yy00=y0-1; for (i=0; (iX.tickfont,psr->X.tickfontsize); + ps_strfont(ps,psr->X.tickfont,psr->X.tickfontsize); for(x=0; (xxboxsize; if ( ( bRmod(mat[i].axis_x[x] - psr->X.offset, psr->X.major) || (psr->X.first && (x==0))) && ( (i == 0) || box_do_all_x_maj_ticks(psr) ) ) { /* Longer tick marks */ - ps_line (out,xx,yy00,xx,yy00-psr->X.majorticklen); + ps_line (ps,xx,yy00,xx,yy00-psr->X.majorticklen); /* Plot label on lowest graph only */ if (i == 0) - ps_ctext(out,xx, + ps_ctext(ps,xx, yy00-DDD-psr->X.majorticklen-psr->X.tickfontsize*0.8, xtick[x],eXCenter); } else if ( bRmod(mat[i].axis_x[x] - psr->X.offset, psr->X.minor) && ( (i == 0) || box_do_all_x_min_ticks(psr) ) ){ /* Shorter tick marks */ - ps_line(out,xx,yy00,xx,yy00-psr->X.minorticklen); + ps_line(ps,xx,yy00,xx,yy00-psr->X.minorticklen); } else if ( bRmod(mat[i].axis_x[x] - psr->X.offset, psr->X.major) ) { /* Even shorter marks, only each X.major */ - ps_line(out,xx,yy00,xx,yy00-(psr->boxspacing/2)); + ps_line(ps,xx,yy00,xx,yy00-(psr->boxspacing/2)); } } - ps_strfont(out,psr->Y.tickfont,psr->Y.tickfontsize); + ps_strfont(ps,psr->Y.tickfont,psr->Y.tickfontsize); snew(ytick,mat[i].ny); for(j=0; (jY.first && (y==0))) { /* Major ticks */ strlength=max(strlength,(int)strlen(ytick[y])); - ps_line (out,xx00,yy,xx00-psr->Y.majorticklen,yy); - ps_ctext(out,xx00-psr->Y.majorticklen-DDD, + ps_line (ps,xx00,yy,xx00-psr->Y.majorticklen,yy); + ps_ctext(ps,xx00-psr->Y.majorticklen-DDD, yy-psr->Y.tickfontsize/3.0,ytick[y],eXRight); } else if ( bRmod(mat[i].axis_y[y] - psr->Y.offset, psr->Y.minor) ) { /* Minor ticks */ - ps_line(out,xx00,yy,xx00-psr->Y.minorticklen,yy); + ps_line(ps,xx00,yy,xx00-psr->Y.minorticklen,yy); } } sfree(xtick); @@ -377,13 +377,12 @@ static void draw_boxes(FILE *out,real x0,real y0,real w, else mylab = mat[i].label_y; if (strlen(mylab) > 0) { - fprintf(out,"%%%% Printing Y-label\n"); - ps_strfont(out,psr->Y.font,psr->Y.fontsize); - ps_rotate(out,TRUE); + ps_strfont(ps,psr->Y.font,psr->Y.fontsize); + ps_rotate(ps,TRUE); xxx=x0-psr->X.majorticklen-psr->X.tickfontsize*strlength-DDD; - ps_ctext(out,yy00+box_height(&mat[i],psr)/2.0,612.5-xxx, + ps_ctext(ps,yy00+box_height(&mat[i],psr)/2.0,612.5-xxx, mylab,eXCenter); - ps_rotate(out,FALSE); + ps_rotate(ps,FALSE); } } @@ -395,14 +394,13 @@ static void draw_boxes(FILE *out,real x0,real y0,real w, else mylab = mat[0].label_x; if (strlen(mylab) > 0) { - fprintf(out,"%%%% Printing X-label\n"); - ps_strfont(out,psr->X.font,psr->X.fontsize); - ps_ctext(out,x0+w/2,y0-DDD-psr->X.majorticklen-psr->X.tickfontsize*FUDGE- + ps_strfont(ps,psr->X.font,psr->X.fontsize); + ps_ctext(ps,x0+w/2,y0-DDD-psr->X.majorticklen-psr->X.tickfontsize*FUDGE- psr->X.fontsize,mylab,eXCenter); } } -static void draw_zerolines(FILE *out,real x0,real y0,real w, +static void draw_zerolines(t_psdata out,real x0,real y0,real w, int nmat,t_matrix mat[],t_psrec *psr) { real xx,yy,dy,xx00,yy00; @@ -615,7 +613,7 @@ void ps_mat(char *outf,int nmat,t_matrix mat[],t_matrix mat2[], int elegend,real boxx,real boxy,char *m2p,char *m2pout) { char *libm2p,buf[256],*legend; - FILE *out; + t_psdata out; t_psrec psrec,*psr; int W,H; int i,j,x,y,col,leg=0; -- 2.11.4.GIT