From 5fb87d63ce5df628bfca85f1cebdbc845ec89b40 Mon Sep 17 00:00:00 2001 From: Roland Schulz Date: Tue, 10 Jan 2017 15:01:23 -0500 Subject: [PATCH] Tidy: modernize-use-nullptr Result of: run-clang-tidy.py -checks=modernize-use-nullptr -header-filter=.* -fix -j80 git checkout src/external src/gromacs/selection/scanner.cpp src/gromacs/selection/parser.cpp Fixed in fft5d that MPI_COMM_NULL is used. Details of check: http://llvm.org/releases/3.9.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-use-nullptr.html Change-Id: If9f5c6c553659b0ddcc44ac9399d141b21f6f22f --- src/gromacs/analysisdata/analysisdata.cpp | 40 +-- src/gromacs/analysisdata/analysisdata.h | 4 +- src/gromacs/analysisdata/dataproxy.cpp | 4 +- src/gromacs/analysisdata/datastorage.cpp | 14 +- .../analysisdata/modules/displacement.cpp | 8 +- src/gromacs/analysisdata/modules/plot.cpp | 18 +- .../analysisdata/tests/mock_datamodule.cpp | 8 +- .../commandline/cmdlinehelpcontext.cpp | 16 +- src/gromacs/commandline/cmdlinehelpmodule.cpp | 28 +- src/gromacs/commandline/cmdlinehelpwriter.cpp | 24 +- src/gromacs/commandline/cmdlineinit.cpp | 6 +- src/gromacs/commandline/cmdlinemodule.cpp | 4 +- .../commandline/cmdlinemodulemanager.cpp | 30 +- .../commandline/cmdlineoptionsmodule.cpp | 6 +- src/gromacs/commandline/cmdlineparser.cpp | 10 +- .../commandline/cmdlineprogramcontext.cpp | 4 +- src/gromacs/commandline/filenm.cpp | 22 +- src/gromacs/commandline/pargs.cpp | 22 +- src/gromacs/commandline/shellcompletions.cpp | 8 +- .../commandline/tests/cmdlinehelpwriter.cpp | 4 +- .../tests/cmdlinemodulemanager.cpp | 4 +- .../commandline/tests/cmdlineparser.cpp | 4 +- .../tests/cmdlineprogramcontext.cpp | 4 +- src/gromacs/commandline/tests/pargs.cpp | 64 ++-- src/gromacs/commandline/viewit.cpp | 10 +- src/gromacs/correlationfunctions/autocorr.cpp | 18 +- src/gromacs/correlationfunctions/expfit.cpp | 20 +- .../correlationfunctions/tests/autocorr.cpp | 8 +- .../tests/correlationdataset.cpp | 6 +- .../correlationfunctions/tests/expfit.cpp | 12 +- src/gromacs/domdec/domdec.cpp | 118 +++---- src/gromacs/domdec/domdec_box.cpp | 10 +- src/gromacs/domdec/domdec_constraints.cpp | 16 +- src/gromacs/domdec/domdec_setup.cpp | 4 +- src/gromacs/domdec/domdec_specatomcomm.cpp | 6 +- src/gromacs/domdec/domdec_topology.cpp | 54 +-- src/gromacs/domdec/domdec_vsite.cpp | 4 +- src/gromacs/domdec/hash.h | 8 +- src/gromacs/essentialdynamics/edsam.cpp | 56 +-- src/gromacs/ewald/ewald.cpp | 10 +- src/gromacs/ewald/pme-grid.cpp | 16 +- src/gromacs/ewald/pme-load-balancing.cpp | 26 +- src/gromacs/ewald/pme-only.cpp | 12 +- src/gromacs/ewald/pme-pp.cpp | 10 +- src/gromacs/ewald/pme-solve.cpp | 4 +- src/gromacs/ewald/pme-spread.cpp | 18 +- src/gromacs/ewald/pme.cpp | 38 +-- src/gromacs/fft/calcgrid.cpp | 6 +- src/gromacs/fft/fft.cpp | 18 +- src/gromacs/fft/fft5d.cpp | 26 +- src/gromacs/fft/fft_fftpack.cpp | 34 +- src/gromacs/fft/fft_fftw3.cpp | 60 ++-- src/gromacs/fft/parallel_3dfft.cpp | 4 +- src/gromacs/fft/tests/fft.cpp | 12 +- src/gromacs/fileio/checkpoint.cpp | 146 ++++---- src/gromacs/fileio/confio.cpp | 42 +-- src/gromacs/fileio/enxio.cpp | 58 ++-- src/gromacs/fileio/espio.cpp | 6 +- src/gromacs/fileio/filetypes.cpp | 50 +-- src/gromacs/fileio/g96io.cpp | 8 +- src/gromacs/fileio/gmxfio-xdr.cpp | 10 +- src/gromacs/fileio/gmxfio.cpp | 30 +- src/gromacs/fileio/groio.cpp | 16 +- src/gromacs/fileio/libxdrf.cpp | 10 +- src/gromacs/fileio/matio.cpp | 46 +-- src/gromacs/fileio/mtxio.cpp | 10 +- src/gromacs/fileio/oenv.cpp | 10 +- src/gromacs/fileio/pdbio.cpp | 50 +-- src/gromacs/fileio/readinp.cpp | 18 +- src/gromacs/fileio/tests/confio.cpp | 14 +- src/gromacs/fileio/tests/readinp.cpp | 4 +- src/gromacs/fileio/tests/tngio.cpp | 4 +- src/gromacs/fileio/tngio.cpp | 16 +- src/gromacs/fileio/tpxio.cpp | 42 +-- src/gromacs/fileio/trxio.cpp | 58 ++-- src/gromacs/fileio/vmdio.cpp | 18 +- src/gromacs/fileio/warninp.cpp | 6 +- src/gromacs/fileio/writeps.cpp | 4 +- src/gromacs/fileio/xvgr.cpp | 56 +-- src/gromacs/gmxana/anadih.cpp | 30 +- src/gromacs/gmxana/cmat.cpp | 4 +- src/gromacs/gmxana/eigio.cpp | 20 +- src/gromacs/gmxana/fitahx.cpp | 8 +- src/gromacs/gmxana/gmx_anadock.cpp | 22 +- src/gromacs/gmxana/gmx_anaeig.cpp | 84 ++--- src/gromacs/gmxana/gmx_analyze.cpp | 42 +-- src/gromacs/gmxana/gmx_angle.cpp | 18 +- src/gromacs/gmxana/gmx_bar.cpp | 156 ++++----- src/gromacs/gmxana/gmx_bundle.cpp | 24 +- src/gromacs/gmxana/gmx_chi.cpp | 30 +- src/gromacs/gmxana/gmx_cluster.cpp | 74 ++-- src/gromacs/gmxana/gmx_clustsize.cpp | 30 +- src/gromacs/gmxana/gmx_confrms.cpp | 12 +- src/gromacs/gmxana/gmx_covar.cpp | 30 +- src/gromacs/gmxana/gmx_current.cpp | 60 ++-- src/gromacs/gmxana/gmx_density.cpp | 30 +- src/gromacs/gmxana/gmx_densmap.cpp | 26 +- src/gromacs/gmxana/gmx_densorder.cpp | 36 +- src/gromacs/gmxana/gmx_dielectric.cpp | 14 +- src/gromacs/gmxana/gmx_dipoles.cpp | 52 +-- src/gromacs/gmxana/gmx_disre.cpp | 54 +-- src/gromacs/gmxana/gmx_do_dssp.cpp | 48 +-- src/gromacs/gmxana/gmx_dos.cpp | 20 +- src/gromacs/gmxana/gmx_dyecoupl.cpp | 20 +- src/gromacs/gmxana/gmx_dyndom.cpp | 12 +- src/gromacs/gmxana/gmx_editconf.cpp | 44 +-- src/gromacs/gmxana/gmx_eneconv.cpp | 22 +- src/gromacs/gmxana/gmx_enemat.cpp | 20 +- src/gromacs/gmxana/gmx_energy.cpp | 100 +++--- src/gromacs/gmxana/gmx_filter.cpp | 28 +- src/gromacs/gmxana/gmx_genion.cpp | 20 +- src/gromacs/gmxana/gmx_genpr.cpp | 22 +- src/gromacs/gmxana/gmx_gyrate.cpp | 24 +- src/gromacs/gmxana/gmx_h2order.cpp | 34 +- src/gromacs/gmxana/gmx_hbond.cpp | 64 ++-- src/gromacs/gmxana/gmx_helix.cpp | 50 +-- src/gromacs/gmxana/gmx_helixorient.cpp | 16 +- src/gromacs/gmxana/gmx_hydorder.cpp | 34 +- src/gromacs/gmxana/gmx_lie.cpp | 14 +- src/gromacs/gmxana/gmx_make_edi.cpp | 62 ++-- src/gromacs/gmxana/gmx_make_ndx.cpp | 30 +- src/gromacs/gmxana/gmx_mdmat.cpp | 20 +- src/gromacs/gmxana/gmx_mindist.cpp | 48 +-- src/gromacs/gmxana/gmx_mk_angndx.cpp | 16 +- src/gromacs/gmxana/gmx_morph.cpp | 12 +- src/gromacs/gmxana/gmx_msd.cpp | 84 ++--- src/gromacs/gmxana/gmx_nmeig.cpp | 44 +-- src/gromacs/gmxana/gmx_nmens.cpp | 18 +- src/gromacs/gmxana/gmx_nmtraj.cpp | 14 +- src/gromacs/gmxana/gmx_order.cpp | 62 ++-- src/gromacs/gmxana/gmx_pme_error.cpp | 40 +-- src/gromacs/gmxana/gmx_polystat.cpp | 28 +- src/gromacs/gmxana/gmx_potential.cpp | 16 +- src/gromacs/gmxana/gmx_principal.cpp | 14 +- src/gromacs/gmxana/gmx_rama.cpp | 12 +- src/gromacs/gmxana/gmx_rms.cpp | 74 ++-- src/gromacs/gmxana/gmx_rmsdist.cpp | 34 +- src/gromacs/gmxana/gmx_rmsf.cpp | 36 +- src/gromacs/gmxana/gmx_rotacf.cpp | 16 +- src/gromacs/gmxana/gmx_rotmat.cpp | 28 +- src/gromacs/gmxana/gmx_saltbr.cpp | 12 +- src/gromacs/gmxana/gmx_sans.cpp | 42 +-- src/gromacs/gmxana/gmx_saxs.cpp | 12 +- src/gromacs/gmxana/gmx_sham.cpp | 14 +- src/gromacs/gmxana/gmx_sigeps.cpp | 6 +- src/gromacs/gmxana/gmx_sorient.cpp | 22 +- src/gromacs/gmxana/gmx_spatial.cpp | 14 +- src/gromacs/gmxana/gmx_spol.cpp | 18 +- src/gromacs/gmxana/gmx_tcaf.cpp | 26 +- src/gromacs/gmxana/gmx_traj.cpp | 64 ++-- src/gromacs/gmxana/gmx_trjcat.cpp | 32 +- src/gromacs/gmxana/gmx_trjconv.cpp | 102 +++--- src/gromacs/gmxana/gmx_trjorder.cpp | 20 +- src/gromacs/gmxana/gmx_tune_pme.cpp | 76 ++--- src/gromacs/gmxana/gmx_vanhove.cpp | 32 +- src/gromacs/gmxana/gmx_velacc.cpp | 16 +- src/gromacs/gmxana/gmx_wham.cpp | 132 ++++---- src/gromacs/gmxana/gmx_wheel.cpp | 14 +- src/gromacs/gmxana/gmx_xpm2ps.cpp | 72 ++-- src/gromacs/gmxana/hxprops.cpp | 8 +- src/gromacs/gmxana/nrama.cpp | 6 +- src/gromacs/gmxana/nsfactor.cpp | 10 +- src/gromacs/gmxana/princ.cpp | 6 +- src/gromacs/gmxana/sfactor.cpp | 6 +- src/gromacs/gmxlib/network.cpp | 26 +- .../gmxlib/nonbonded/nb_free_energy.cpp | 6 +- src/gromacs/gmxlib/nonbonded/nb_generic.cpp | 4 +- .../gmxlib/nonbonded/nb_generic_cg.cpp | 4 +- src/gromacs/gmxlib/nonbonded/nb_kernel.cpp | 16 +- src/gromacs/gmxlib/nonbonded/nonbonded.cpp | 30 +- src/gromacs/gmxlib/nrnb.cpp | 16 +- src/gromacs/gmxpreprocess/add_par.cpp | 4 +- src/gromacs/gmxpreprocess/convparm.cpp | 16 +- src/gromacs/gmxpreprocess/fflibutil.cpp | 8 +- src/gromacs/gmxpreprocess/gen_ad.cpp | 6 +- src/gromacs/gmxpreprocess/gen_vsite.cpp | 36 +- src/gromacs/gmxpreprocess/genconf.cpp | 4 +- src/gromacs/gmxpreprocess/genhydro.cpp | 46 +-- src/gromacs/gmxpreprocess/gmxcpp.cpp | 86 ++--- src/gromacs/gmxpreprocess/gpp_atomtype.cpp | 28 +- .../gmxpreprocess/gpp_bond_atomtype.cpp | 6 +- src/gromacs/gmxpreprocess/grompp.cpp | 44 +-- src/gromacs/gmxpreprocess/h_db.cpp | 14 +- src/gromacs/gmxpreprocess/hackblock.cpp | 28 +- .../gmxpreprocess/insert-molecules.cpp | 20 +- src/gromacs/gmxpreprocess/nm2type.cpp | 12 +- src/gromacs/gmxpreprocess/pdb2gmx.cpp | 106 +++--- src/gromacs/gmxpreprocess/pdb2top.cpp | 88 ++--- src/gromacs/gmxpreprocess/pgutil.cpp | 6 +- .../gmxpreprocess/read-conformation.cpp | 10 +- src/gromacs/gmxpreprocess/readir.cpp | 138 ++++---- src/gromacs/gmxpreprocess/readpull.cpp | 12 +- src/gromacs/gmxpreprocess/readrot.cpp | 6 +- src/gromacs/gmxpreprocess/resall.cpp | 18 +- src/gromacs/gmxpreprocess/solvate.cpp | 22 +- src/gromacs/gmxpreprocess/specbond.cpp | 8 +- src/gromacs/gmxpreprocess/ter_db.cpp | 40 +-- src/gromacs/gmxpreprocess/tomorse.cpp | 4 +- src/gromacs/gmxpreprocess/topdirs.cpp | 14 +- src/gromacs/gmxpreprocess/topio.cpp | 58 ++-- src/gromacs/gmxpreprocess/toppush.cpp | 36 +- src/gromacs/gmxpreprocess/toputil.cpp | 14 +- src/gromacs/gmxpreprocess/vsite_parm.cpp | 16 +- src/gromacs/gmxpreprocess/x2top.cpp | 20 +- src/gromacs/gmxpreprocess/xlate.cpp | 16 +- src/gromacs/gpu_utils/gpu_utils.cpp | 6 +- src/gromacs/hardware/cpuinfo.cpp | 8 +- src/gromacs/hardware/detecthardware.cpp | 18 +- src/gromacs/hardware/hardwareassign.cpp | 4 +- src/gromacs/hardware/hardwaretopology.cpp | 16 +- src/gromacs/imd/imd.cpp | 10 +- src/gromacs/imd/imdsocket.cpp | 16 +- src/gromacs/linearalgebra/eigensolver.cpp | 10 +- src/gromacs/linearalgebra/matrix.cpp | 4 +- src/gromacs/linearalgebra/sparsematrix.cpp | 8 +- src/gromacs/listed-forces/bonded.cpp | 4 +- src/gromacs/listed-forces/disre.cpp | 4 +- src/gromacs/listed-forces/listed-forces.cpp | 6 +- src/gromacs/listed-forces/listed-internal.cpp | 4 +- .../listed-forces/manage-threading.cpp | 12 +- src/gromacs/listed-forces/orires.cpp | 20 +- src/gromacs/listed-forces/pairs.cpp | 10 +- .../listed-forces/position-restraints.cpp | 12 +- src/gromacs/listed-forces/tests/bonded.cpp | 8 +- src/gromacs/math/do_fit.cpp | 10 +- src/gromacs/math/units.cpp | 4 +- src/gromacs/math/vecdump.cpp | 6 +- src/gromacs/mdlib/broadcaststructs.cpp | 12 +- src/gromacs/mdlib/calc_verletbuf.cpp | 12 +- src/gromacs/mdlib/clincs.cpp | 30 +- src/gromacs/mdlib/compute_io.cpp | 6 +- src/gromacs/mdlib/constr.cpp | 54 +-- src/gromacs/mdlib/coupling.cpp | 18 +- src/gromacs/mdlib/csettle.cpp | 24 +- src/gromacs/mdlib/ebin.cpp | 4 +- src/gromacs/mdlib/expanded.cpp | 4 +- src/gromacs/mdlib/force.cpp | 4 +- src/gromacs/mdlib/forcerec.cpp | 102 +++--- src/gromacs/mdlib/genborn.cpp | 32 +- src/gromacs/mdlib/genborn_allvsall.cpp | 6 +- src/gromacs/mdlib/gmx_omp_nthreads.cpp | 10 +- src/gromacs/mdlib/groupcoord.cpp | 12 +- src/gromacs/mdlib/main.cpp | 20 +- src/gromacs/mdlib/md_support.cpp | 6 +- src/gromacs/mdlib/mdatoms.cpp | 10 +- src/gromacs/mdlib/mdebin.cpp | 16 +- src/gromacs/mdlib/mdebin_bar.cpp | 34 +- src/gromacs/mdlib/mdoutf.cpp | 34 +- src/gromacs/mdlib/mdsetup.cpp | 10 +- src/gromacs/mdlib/minimize.cpp | 100 +++--- src/gromacs/mdlib/nbnxn_atomdata.cpp | 32 +- src/gromacs/mdlib/nbnxn_grid.cpp | 18 +- .../nbnxn_kernels/nbnxn_kernel_gpu_ref.cpp | 4 +- .../nbnxn_kernels/nbnxn_kernel_ref_outer.h | 4 +- .../simd_4xn/nbnxn_kernel_simd_4xn_outer.h | 4 +- src/gromacs/mdlib/nbnxn_search.cpp | 56 +-- src/gromacs/mdlib/ns.cpp | 58 ++-- src/gromacs/mdlib/nsgrid.cpp | 14 +- src/gromacs/mdlib/perf_est.cpp | 6 +- src/gromacs/mdlib/qm_orca.cpp | 24 +- src/gromacs/mdlib/qmmm.cpp | 22 +- src/gromacs/mdlib/shakef.cpp | 12 +- src/gromacs/mdlib/shellfc.cpp | 30 +- src/gromacs/mdlib/sighandler.cpp | 10 +- src/gromacs/mdlib/sim_util.cpp | 44 +-- src/gromacs/mdlib/splitter.cpp | 10 +- src/gromacs/mdlib/stat.cpp | 4 +- src/gromacs/mdlib/tpi.cpp | 18 +- src/gromacs/mdlib/trajectory_writing.cpp | 4 +- src/gromacs/mdlib/update.cpp | 36 +- src/gromacs/mdlib/vsite.cpp | 54 +-- src/gromacs/mdrunutility/handlerestart.cpp | 8 +- src/gromacs/mdrunutility/threadaffinity.cpp | 6 +- src/gromacs/mdtypes/state.cpp | 30 +- src/gromacs/onlinehelp/helpformat.cpp | 6 +- src/gromacs/onlinehelp/helpmanager.cpp | 6 +- src/gromacs/onlinehelp/helptopic.cpp | 10 +- src/gromacs/onlinehelp/helpwritercontext.cpp | 16 +- src/gromacs/onlinehelp/tests/helpformat.cpp | 6 +- src/gromacs/onlinehelp/tests/helpmanager.cpp | 16 +- .../onlinehelp/tests/helpwritercontext.cpp | 10 +- .../onlinehelp/tests/mock_helptopic.cpp | 4 +- src/gromacs/options/abstractoption.cpp | 12 +- src/gromacs/options/abstractoption.h | 10 +- src/gromacs/options/basicoptions.cpp | 18 +- src/gromacs/options/basicoptions.h | 8 +- src/gromacs/options/filenameoption.cpp | 14 +- src/gromacs/options/filenameoption.h | 4 +- src/gromacs/options/optionmanagercontainer.h | 8 +- src/gromacs/options/options.cpp | 4 +- src/gromacs/options/optionsassigner.cpp | 26 +- src/gromacs/options/optionstoragetemplate.h | 14 +- src/gromacs/options/optionsvisitor.h | 2 +- src/gromacs/options/tests/optionsassigner.cpp | 4 +- src/gromacs/options/timeunitmanager.cpp | 10 +- src/gromacs/pbcutil/boxutilities.cpp | 4 +- src/gromacs/pbcutil/mshift.cpp | 12 +- src/gromacs/pbcutil/pbc-simd.cpp | 4 +- src/gromacs/pbcutil/pbc.cpp | 18 +- src/gromacs/pbcutil/rmpbc.cpp | 26 +- src/gromacs/pulling/pull.cpp | 54 +-- src/gromacs/pulling/pull_rotation.cpp | 58 ++-- src/gromacs/pulling/pullutil.cpp | 26 +- src/gromacs/selection/compiler.cpp | 42 +-- src/gromacs/selection/evaluate.cpp | 22 +- src/gromacs/selection/indexutil.cpp | 34 +- src/gromacs/selection/mempool.cpp | 14 +- src/gromacs/selection/nbsearch.cpp | 42 +-- src/gromacs/selection/nbsearch.h | 8 +- src/gromacs/selection/params.cpp | 46 +-- src/gromacs/selection/parser_internal.h | 4 +- src/gromacs/selection/parsetree.cpp | 32 +- src/gromacs/selection/poscalc.cpp | 26 +- src/gromacs/selection/position.cpp | 10 +- src/gromacs/selection/scanner_internal.cpp | 26 +- src/gromacs/selection/selection.cpp | 6 +- src/gromacs/selection/selection.h | 12 +- src/gromacs/selection/selectioncollection.cpp | 50 +-- src/gromacs/selection/selectionoption.cpp | 6 +- .../selection/selectionoptionbehavior.cpp | 20 +- src/gromacs/selection/selelem.cpp | 42 +-- src/gromacs/selection/selelem.h | 4 +- src/gromacs/selection/selhelp.cpp | 18 +- src/gromacs/selection/selmethod.cpp | 76 ++--- src/gromacs/selection/selvalue.cpp | 12 +- src/gromacs/selection/sm_compare.cpp | 32 +- src/gromacs/selection/sm_distance.cpp | 32 +- src/gromacs/selection/sm_insolidangle.cpp | 20 +- src/gromacs/selection/sm_keywords.cpp | 80 ++--- src/gromacs/selection/sm_merge.cpp | 22 +- src/gromacs/selection/sm_permute.cpp | 18 +- src/gromacs/selection/sm_position.cpp | 32 +- src/gromacs/selection/sm_same.cpp | 28 +- src/gromacs/selection/sm_simple.cpp | 318 +++++++++--------- src/gromacs/selection/symrec.cpp | 10 +- src/gromacs/selection/tests/indexutil.cpp | 36 +- src/gromacs/selection/tests/nbsearch.cpp | 20 +- src/gromacs/selection/tests/poscalc.cpp | 20 +- .../selection/tests/selectioncollection.cpp | 38 +-- .../selection/tests/selectionoption.cpp | 4 +- src/gromacs/selection/tests/toputils.cpp | 26 +- src/gromacs/statistics/statistics.cpp | 52 +-- src/gromacs/swap/swapcoords.cpp | 60 ++-- src/gromacs/tables/forcetable.cpp | 12 +- src/gromacs/timing/cyclecounter.cpp | 8 +- src/gromacs/timing/wallcycle.cpp | 48 +-- src/gromacs/tools/check.cpp | 30 +- src/gromacs/tools/convert_tpr.cpp | 10 +- src/gromacs/tools/dump.cpp | 60 ++-- src/gromacs/topology/atomprop.cpp | 12 +- src/gromacs/topology/atoms.cpp | 70 ++-- src/gromacs/topology/atomsbuilder.cpp | 6 +- src/gromacs/topology/block.cpp | 8 +- src/gromacs/topology/index.cpp | 28 +- src/gromacs/topology/mtop_lookup.h | 8 +- src/gromacs/topology/mtop_util.cpp | 18 +- src/gromacs/topology/residuetypes.cpp | 10 +- src/gromacs/topology/symtab.cpp | 28 +- src/gromacs/topology/topology.cpp | 36 +- src/gromacs/topology/topsort.cpp | 6 +- .../trajectoryanalysis/analysismodule.cpp | 4 +- .../trajectoryanalysis/analysissettings.cpp | 6 +- .../trajectoryanalysis/analysissettings.h | 4 +- .../trajectoryanalysis/cmdlinerunner.cpp | 10 +- .../trajectoryanalysis/modules/angle.cpp | 4 +- .../trajectoryanalysis/modules/distance.cpp | 4 +- .../trajectoryanalysis/modules/freevolume.cpp | 4 +- .../trajectoryanalysis/modules/sasa.cpp | 16 +- .../trajectoryanalysis/modules/select.cpp | 20 +- .../modules/surfacearea.cpp | 16 +- .../trajectoryanalysis/runnercommon.cpp | 18 +- .../trajectoryanalysis/tests/moduletest.cpp | 4 +- .../trajectoryanalysis/tests/surfacearea.cpp | 14 +- src/gromacs/utility/alignedallocator.h | 4 +- src/gromacs/utility/arrayref.h | 20 +- src/gromacs/utility/coolstuff.cpp | 4 +- src/gromacs/utility/cstringutil.cpp | 34 +- src/gromacs/utility/datafilefinder.cpp | 8 +- src/gromacs/utility/directoryenumerator.cpp | 10 +- src/gromacs/utility/errorformat.cpp | 6 +- src/gromacs/utility/exceptions.cpp | 36 +- src/gromacs/utility/fatalerror.cpp | 20 +- src/gromacs/utility/filestream.cpp | 18 +- src/gromacs/utility/futil.cpp | 64 ++-- src/gromacs/utility/gmxomp.cpp | 6 +- src/gromacs/utility/gmxregex.cpp | 4 +- src/gromacs/utility/int64_to_int.cpp | 4 +- src/gromacs/utility/logger.h | 6 +- src/gromacs/utility/path.cpp | 10 +- src/gromacs/utility/pleasecite.cpp | 4 +- src/gromacs/utility/programcontext.cpp | 4 +- src/gromacs/utility/qsort_threadsafe.cpp | 4 +- src/gromacs/utility/smalloc.cpp | 24 +- src/gromacs/utility/strdb.cpp | 8 +- src/gromacs/utility/stringutil.cpp | 8 +- src/gromacs/utility/stringutil.h | 4 +- src/gromacs/utility/sysinfo.cpp | 4 +- src/gromacs/utility/tests/stringutil.cpp | 6 +- src/gromacs/utility/txtdump.cpp | 6 +- src/programs/legacymodules.cpp | 4 +- src/programs/mdrun/md.cpp | 62 ++-- src/programs/mdrun/mdrun.cpp | 34 +- src/programs/mdrun/membed.cpp | 18 +- src/programs/mdrun/repl_ex.cpp | 12 +- src/programs/mdrun/resource-division.cpp | 6 +- src/programs/mdrun/runner.cpp | 66 ++-- src/programs/view/fgrid.cpp | 20 +- src/programs/view/filter.cpp | 4 +- src/programs/view/logo.cpp | 24 +- src/programs/view/manager.cpp | 8 +- src/programs/view/nleg.cpp | 4 +- src/programs/view/nmol.cpp | 6 +- src/programs/view/popup.cpp | 4 +- src/programs/view/view.cpp | 18 +- src/programs/view/x11.cpp | 34 +- src/programs/view/xdlg.cpp | 52 +-- src/programs/view/xdlghi.cpp | 6 +- src/programs/view/xdlgitem.cpp | 8 +- src/programs/view/xmb.cpp | 4 +- src/programs/view/xutil.cpp | 8 +- src/testutils/cmdlinetest.cpp | 14 +- src/testutils/integrationtests.cpp | 4 +- src/testutils/refdata-impl.h | 12 +- src/testutils/refdata.cpp | 20 +- src/testutils/refdata.h | 4 +- src/testutils/testfilemanager.cpp | 6 +- src/testutils/testfileredirector.cpp | 4 +- src/testutils/testinit.cpp | 12 +- src/testutils/tests/refdata_tests.cpp | 44 +-- src/testutils/xvgtest.cpp | 4 +- 430 files changed, 5097 insertions(+), 5097 deletions(-) diff --git a/src/gromacs/analysisdata/analysisdata.cpp b/src/gromacs/analysisdata/analysisdata.cpp index be081ad765..9ad7136a43 100644 --- a/src/gromacs/analysisdata/analysisdata.cpp +++ b/src/gromacs/analysisdata/analysisdata.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -71,7 +71,7 @@ class AnalysisDataHandleImpl public: //! Creates a handle associated with the given data object. explicit AnalysisDataHandleImpl(AnalysisData *data) - : data_(*data), currentFrame_(NULL) + : data_(*data), currentFrame_(nullptr) { } @@ -227,7 +227,7 @@ AnalysisData::requestStorageInternal(int nframes) */ AnalysisDataHandle::AnalysisDataHandle() - : impl_(NULL) + : impl_(nullptr) { } @@ -241,8 +241,8 @@ AnalysisDataHandle::AnalysisDataHandle(internal::AnalysisDataHandleImpl *impl) void AnalysisDataHandle::startFrame(int index, real x, real dx) { - GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used"); - GMX_RELEASE_ASSERT(impl_->currentFrame_ == NULL, + GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used"); + GMX_RELEASE_ASSERT(impl_->currentFrame_ == nullptr, "startFrame() called twice without calling finishFrame()"); impl_->currentFrame_ = &impl_->data_.impl_->storage_.startFrame(index, x, dx); @@ -252,8 +252,8 @@ AnalysisDataHandle::startFrame(int index, real x, real dx) void AnalysisDataHandle::selectDataSet(int index) { - GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used"); - GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL, + GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used"); + GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr, "selectDataSet() called without calling startFrame()"); impl_->currentFrame_->selectDataSet(index); } @@ -262,8 +262,8 @@ AnalysisDataHandle::selectDataSet(int index) void AnalysisDataHandle::setPoint(int column, real value, bool bPresent) { - GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used"); - GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL, + GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used"); + GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr, "setPoint() called without calling startFrame()"); impl_->currentFrame_->setValue(column, value, bPresent); } @@ -272,8 +272,8 @@ AnalysisDataHandle::setPoint(int column, real value, bool bPresent) void AnalysisDataHandle::setPoint(int column, real value, real error, bool bPresent) { - GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used"); - GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL, + GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used"); + GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr, "setPoint() called without calling startFrame()"); impl_->currentFrame_->setValue(column, value, error, bPresent); } @@ -283,8 +283,8 @@ void AnalysisDataHandle::setPoints(int firstColumn, int count, const real *values, bool bPresent) { - GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used"); - GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL, + GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used"); + GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr, "setPoints() called without calling startFrame()"); for (int i = 0; i < count; ++i) { @@ -296,10 +296,10 @@ AnalysisDataHandle::setPoints(int firstColumn, int count, const real *values, void AnalysisDataHandle::finishPointSet() { - GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used"); + GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used"); GMX_RELEASE_ASSERT(impl_->data_.isMultipoint(), "finishPointSet() called for non-multipoint data"); - GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL, + GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr, "finishPointSet() called without calling startFrame()"); impl_->currentFrame_->finishPointSet(); } @@ -308,11 +308,11 @@ AnalysisDataHandle::finishPointSet() void AnalysisDataHandle::finishFrame() { - GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used"); - GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL, + GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used"); + GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr, "finishFrame() called without calling startFrame()"); AnalysisDataStorageFrame *frame = impl_->currentFrame_; - impl_->currentFrame_ = NULL; + impl_->currentFrame_ = nullptr; frame->finishFrame(); } @@ -320,10 +320,10 @@ AnalysisDataHandle::finishFrame() void AnalysisDataHandle::finishData() { - GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used"); + GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used"); // Deletes the implementation pointer. impl_->data_.finishData(*this); - impl_ = NULL; + impl_ = nullptr; } } // namespace gmx diff --git a/src/gromacs/analysisdata/analysisdata.h b/src/gromacs/analysisdata/analysisdata.h index bb135990e1..09e8733da1 100644 --- a/src/gromacs/analysisdata/analysisdata.h +++ b/src/gromacs/analysisdata/analysisdata.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -260,7 +260,7 @@ class AnalysisDataHandle AnalysisDataHandle(); //! Returns whether this data handle is valid. - bool isValid() const { return impl_ != NULL; } + bool isValid() const { return impl_ != nullptr; } /*! \brief * Start data for a new frame. diff --git a/src/gromacs/analysisdata/dataproxy.cpp b/src/gromacs/analysisdata/dataproxy.cpp index c495aa9398..614f84d00e 100644 --- a/src/gromacs/analysisdata/dataproxy.cpp +++ b/src/gromacs/analysisdata/dataproxy.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -55,7 +55,7 @@ AnalysisDataProxy::AnalysisDataProxy(int firstColumn, int columnSpan, : source_(*data), firstColumn_(firstColumn), columnSpan_(columnSpan), bParallel_(false) { - GMX_RELEASE_ASSERT(data != NULL, "Source data must not be NULL"); + GMX_RELEASE_ASSERT(data != nullptr, "Source data must not be NULL"); GMX_RELEASE_ASSERT(firstColumn >= 0 && columnSpan > 0, "Invalid proxy column"); setMultipoint(source_.isMultipoint()); } diff --git a/src/gromacs/analysisdata/datastorage.cpp b/src/gromacs/analysisdata/datastorage.cpp index 8eb79be988..dc3db91b02 100644 --- a/src/gromacs/analysisdata/datastorage.cpp +++ b/src/gromacs/analysisdata/datastorage.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -399,7 +399,7 @@ class AnalysisDataStorageFrameData */ AnalysisDataStorageImpl::AnalysisDataStorageImpl() - : data_(NULL), modules_(NULL), + : data_(nullptr), modules_(nullptr), storageLimit_(0), pendingLimit_(1), firstFrameLocation_(0), firstUnnotifiedIndex_(0), nextIndex_(0) { @@ -564,7 +564,7 @@ AnalysisDataStorageFrameData::AnalysisDataStorageFrameData( int index) : storageImpl_(*storageImpl), header_(index, 0.0, 0.0), status_(eMissing) { - GMX_RELEASE_ASSERT(storageImpl->data_ != NULL, + GMX_RELEASE_ASSERT(storageImpl->data_ != nullptr, "Storage frame constructed before data started"); // With non-multipoint data, the point set structure is static, // so initialize it only once here. @@ -675,7 +675,7 @@ AnalysisDataStorageFrameData::pointSet(int index) const AnalysisDataStorageFrame::AnalysisDataStorageFrame( const AbstractAnalysisData &data) - : data_(NULL), currentDataSet_(0), currentOffset_(0), + : data_(nullptr), currentDataSet_(0), currentOffset_(0), columnCount_(data.columnCount(0)), bPointSetInProgress_(false) { int totalColumnCount = 0; @@ -710,7 +710,7 @@ AnalysisDataStorageFrame::clearValues() void AnalysisDataStorageFrame::selectDataSet(int index) { - GMX_RELEASE_ASSERT(data_ != NULL, "Invalid frame accessed"); + GMX_RELEASE_ASSERT(data_ != nullptr, "Invalid frame accessed"); const AbstractAnalysisData &baseData = data_->baseData(); GMX_RELEASE_ASSERT(index >= 0 && index < baseData.dataSetCount(), "Out of range data set index"); @@ -730,7 +730,7 @@ AnalysisDataStorageFrame::selectDataSet(int index) void AnalysisDataStorageFrame::finishPointSet() { - GMX_RELEASE_ASSERT(data_ != NULL, "Invalid frame accessed"); + GMX_RELEASE_ASSERT(data_ != nullptr, "Invalid frame accessed"); GMX_RELEASE_ASSERT(data_->baseData().isMultipoint(), "Should not be called for non-multipoint data"); if (bPointSetInProgress_) @@ -762,7 +762,7 @@ AnalysisDataStorageFrame::finishPointSet() void AnalysisDataStorageFrame::finishFrame() { - GMX_RELEASE_ASSERT(data_ != NULL, "Invalid frame accessed"); + GMX_RELEASE_ASSERT(data_ != nullptr, "Invalid frame accessed"); data_->storageImpl().finishFrame(data_->frameIndex()); } diff --git a/src/gromacs/analysisdata/modules/displacement.cpp b/src/gromacs/analysisdata/modules/displacement.cpp index 586357097d..d8db1660c3 100644 --- a/src/gromacs/analysisdata/modules/displacement.cpp +++ b/src/gromacs/analysisdata/modules/displacement.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -103,8 +103,8 @@ class AnalysisDataDisplacementModule::Impl AnalysisDataDisplacementModule::Impl::Impl() : nmax(0), tmax(0.0), ndim(3), bFirst(true), t0(0.0), dt(0.0), t(0.0), ci(0), - max_store(-1), nstored(0), oldval(NULL), - histm(NULL) + max_store(-1), nstored(0), oldval(nullptr), + histm(nullptr) { } @@ -140,7 +140,7 @@ void AnalysisDataDisplacementModule::setMSDHistogram( AnalysisDataBinAverageModulePointer histm) { - GMX_RELEASE_ASSERT(_impl->histm == NULL, "Can only set MSD histogram once"); + GMX_RELEASE_ASSERT(_impl->histm == nullptr, "Can only set MSD histogram once"); _impl->histm = histm.get(); addModule(histm); } diff --git a/src/gromacs/analysisdata/modules/plot.cpp b/src/gromacs/analysisdata/modules/plot.cpp index d44a240479..f61b34e366 100644 --- a/src/gromacs/analysisdata/modules/plot.cpp +++ b/src/gromacs/analysisdata/modules/plot.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -82,7 +82,7 @@ namespace gmx */ AnalysisDataPlotSettings::AnalysisDataPlotSettings() - : selections_(NULL), timeUnit_(TimeUnit_Default), plotFormat_(1) + : selections_(nullptr), timeUnit_(TimeUnit_Default), plotFormat_(1) { } @@ -132,7 +132,7 @@ class AbstractPlotModule::Impl }; AbstractPlotModule::Impl::Impl(const AnalysisDataPlotSettings &settings) - : settings_(settings), fp_(NULL), bPlain_(false), bOmitX_(false), + : settings_(settings), fp_(nullptr), bPlain_(false), bOmitX_(false), bErrorsAsSeparateColumn_(false), xscale_(1.0) { strcpy(xformat_, "%11.3f"); @@ -148,7 +148,7 @@ AbstractPlotModule::Impl::~Impl() void AbstractPlotModule::Impl::closeFile() { - if (fp_ != NULL) + if (fp_ != nullptr) { if (bPlain_) { @@ -158,7 +158,7 @@ AbstractPlotModule::Impl::closeFile() { xvgrclose(fp_); } - fp_ = NULL; + fp_ = nullptr; } } @@ -299,7 +299,7 @@ AbstractPlotModule::setXFormat(int width, int precision, char format) GMX_RELEASE_ASSERT(width >= 0 && precision >= 0 && width <= 99 && precision <= 99, "Invalid width or precision"); - GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != NULL, + GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != nullptr, "Invalid format specifier"); sprintf(impl_->xformat_, "%%%d.%d%c", width, precision, format); } @@ -311,7 +311,7 @@ AbstractPlotModule::setYFormat(int width, int precision, char format) GMX_RELEASE_ASSERT(width >= 0 && precision >= 0 && width <= 99 && precision <= 99, "Invalid width or precision"); - GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != NULL, + GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != nullptr, "Invalid format specifier"); sprintf(impl_->yformat_, " %%%d.%d%c", width, precision, format); } @@ -350,7 +350,7 @@ AbstractPlotModule::dataStarted(AbstractAnalysisData * /* data */) oenv); const SelectionCollection *selections = impl_->settings_.selectionCollection(); - if (selections != NULL && output_env_get_xvg_format(oenv) != exvgNONE) + if (selections != nullptr && output_env_get_xvg_format(oenv) != exvgNONE) { selections->printXvgrInfo(impl_->fp_); } @@ -409,7 +409,7 @@ AbstractPlotModule::dataFinished() bool AbstractPlotModule::isFileOpen() const { - return impl_->fp_ != NULL; + return impl_->fp_ != nullptr; } diff --git a/src/gromacs/analysisdata/tests/mock_datamodule.cpp b/src/gromacs/analysisdata/tests/mock_datamodule.cpp index 1871e05370..7fdd647eb6 100644 --- a/src/gromacs/analysisdata/tests/mock_datamodule.cpp +++ b/src/gromacs/analysisdata/tests/mock_datamodule.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -143,7 +143,7 @@ namespace void checkReferenceDataPoint(TestReferenceChecker *checker, const AnalysisDataValue &value) { - TestReferenceChecker compound(checker->checkCompound("DataValue", NULL)); + TestReferenceChecker compound(checker->checkCompound("DataValue", nullptr)); compound.checkReal(value.value(), "Value"); if (compound.checkPresent(value.hasError(), "Error")) { @@ -158,7 +158,7 @@ void checkReferenceDataPoint(TestReferenceChecker *checker, } // namespace MockAnalysisDataModule::Impl::Impl(int flags) - : source_(NULL), flags_(flags), frameIndex_(0) + : source_(nullptr), flags_(flags), frameIndex_(0) { } @@ -192,7 +192,7 @@ MockAnalysisDataModule::Impl::checkReferencePoints( if (frameChecker_) { TestReferenceChecker checker( - frameChecker_.checkCompound("DataValues", NULL)); + frameChecker_.checkCompound("DataValues", nullptr)); checker.checkInteger(points.columnCount(), "Count"); if (checker.checkPresent(source_->dataSetCount() > 1, "DataSet")) { diff --git a/src/gromacs/commandline/cmdlinehelpcontext.cpp b/src/gromacs/commandline/cmdlinehelpcontext.cpp index 59d776e4d1..5d81d9a878 100644 --- a/src/gromacs/commandline/cmdlinehelpcontext.cpp +++ b/src/gromacs/commandline/cmdlinehelpcontext.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -61,7 +61,7 @@ namespace * * \ingroup module_commandline */ -const CommandLineHelpContext *g_globalContext = NULL; +const CommandLineHelpContext *g_globalContext = nullptr; } // namespace @@ -77,13 +77,13 @@ class CommandLineHelpContext::Impl Impl(TextWriter *writer, HelpOutputFormat format, const HelpLinks *links) : writerContext_(writer, format, links), moduleDisplayName_("gmx"), - completionWriter_(NULL), bHidden_(false) + completionWriter_(nullptr), bHidden_(false) { } //! Creates an implementation class from a low-level context. explicit Impl(const HelpWriterContext &writerContext) : writerContext_(writerContext), - completionWriter_(NULL), bHidden_(false) + completionWriter_(nullptr), bHidden_(false) { } @@ -113,7 +113,7 @@ CommandLineHelpContext::CommandLineHelpContext( CommandLineHelpContext::CommandLineHelpContext( ShellCompletionWriter *writer) - : impl_(new Impl(&writer->outputWriter(), eHelpOutputFormat_Other, NULL)) + : impl_(new Impl(&writer->outputWriter(), eHelpOutputFormat_Other, nullptr)) { impl_->completionWriter_ = writer; } @@ -173,7 +173,7 @@ bool CommandLineHelpContext::showHidden() const bool CommandLineHelpContext::isCompletionExport() const { - return impl_->completionWriter_ != NULL; + return impl_->completionWriter_ != nullptr; } ShellCompletionWriter &CommandLineHelpContext::shellCompletionWriter() const @@ -196,14 +196,14 @@ const CommandLineHelpContext *GlobalCommandLineHelpContext::get() GlobalCommandLineHelpContext::GlobalCommandLineHelpContext( const CommandLineHelpContext &context) { - GMX_RELEASE_ASSERT(g_globalContext == NULL, + GMX_RELEASE_ASSERT(g_globalContext == nullptr, "Global context set more than once"); g_globalContext = &context; } GlobalCommandLineHelpContext::~GlobalCommandLineHelpContext() { - g_globalContext = NULL; + g_globalContext = nullptr; } } // namespace gmx diff --git a/src/gromacs/commandline/cmdlinehelpmodule.cpp b/src/gromacs/commandline/cmdlinehelpmodule.cpp index 0a2ceac2ec..3341491f4b 100644 --- a/src/gromacs/commandline/cmdlinehelpmodule.cpp +++ b/src/gromacs/commandline/cmdlinehelpmodule.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -277,7 +277,7 @@ void RootHelpTopic::exportHelp(IHelpExport *exporter) ++topicName) { const IHelpTopic *topic = findSubTopic(topicName->c_str()); - GMX_RELEASE_ASSERT(topic != NULL, "Exported help topic no longer found"); + GMX_RELEASE_ASSERT(topic != nullptr, "Exported help topic no longer found"); exporter->exportTopic(*topic); } // For now, the title is only set for the export to make it not appear in @@ -331,7 +331,7 @@ void RootHelpTopic::writeHelp(const HelpWriterContext &context) const CommandLineHelpContext RootHelpTopic::createContext(const HelpWriterContext &context) const { - if (helpModule_.context_ != NULL) + if (helpModule_.context_ != nullptr) { return CommandLineHelpContext(*helpModule_.context_); } @@ -370,7 +370,7 @@ class CommandsHelpTopic : public IHelpTopic virtual bool hasSubTopics() const { return false; } virtual const IHelpTopic *findSubTopic(const char * /*name*/) const { - return NULL; + return nullptr; } virtual void writeHelp(const HelpWriterContext &context) const; @@ -394,7 +394,7 @@ void CommandsHelpTopic::writeHelp(const HelpWriterContext &context) const for (module = modules.begin(); module != modules.end(); ++module) { int nameLength = static_cast(module->first.length()); - if (module->second->shortDescription() != NULL + if (module->second->shortDescription() != nullptr && nameLength > maxNameLength) { maxNameLength = nameLength; @@ -405,14 +405,14 @@ void CommandsHelpTopic::writeHelp(const HelpWriterContext &context) const "Available commands:"); TextWriter &file = context.outputFile(); TextTableFormatter formatter; - formatter.addColumn(NULL, maxNameLength + 1, false); - formatter.addColumn(NULL, 72 - maxNameLength, true); + formatter.addColumn(nullptr, maxNameLength + 1, false); + formatter.addColumn(nullptr, 72 - maxNameLength, true); formatter.setFirstColumnIndent(4); for (module = modules.begin(); module != modules.end(); ++module) { const char *name = module->first.c_str(); const char *description = module->second->shortDescription(); - if (description != NULL) + if (description != nullptr) { formatter.clear(); formatter.addColumnLine(0, name); @@ -448,11 +448,11 @@ class ModuleHelpTopic : public IHelpTopic } virtual const char *name() const { return module_.name(); } - virtual const char *title() const { return NULL; } + virtual const char *title() const { return nullptr; } virtual bool hasSubTopics() const { return false; } virtual const IHelpTopic *findSubTopic(const char * /*name*/) const { - return NULL; + return nullptr; } virtual void writeHelp(const HelpWriterContext &context) const; @@ -495,7 +495,7 @@ void initProgramLinks(HelpLinks *links, const CommandLineHelpModuleImpl &helpMod module != helpModule.modules_.end(); ++module) { - if (module->second->shortDescription() != NULL) + if (module->second->shortDescription() != nullptr) { std::string linkName("[gmx-" + module->first + "]"); const char *name = module->first.c_str(); @@ -774,7 +774,7 @@ CommandLineHelpModuleImpl::CommandLineHelpModuleImpl( const CommandLineModuleGroupList &groups) : rootTopic_(*this), programContext_(programContext), binaryName_(binaryName), modules_(modules), groups_(groups), - context_(NULL), moduleOverride_(NULL), bHidden_(false), + context_(nullptr), moduleOverride_(nullptr), bHidden_(false), outputRedirector_(&defaultFileOutputRedirector()) { } @@ -806,7 +806,7 @@ void CommandLineHelpModuleImpl::exportHelp(IHelpExport *exporter) CommandLineModuleMap::const_iterator module; for (module = modules_.begin(); module != modules_.end(); ++module) { - if (module->second->shortDescription() != NULL) + if (module->second->shortDescription() != nullptr) { const char *const moduleName = module->first.c_str(); std::string tag(formatString("%s-%s", program, moduleName)); @@ -969,7 +969,7 @@ int CommandLineHelpModule::run(int argc, char *argv[]) CommandLineHelpContext context(&writer, eHelpOutputFormat_Console, &links, impl_->binaryName_); context.setShowHidden(impl_->bHidden_); - if (impl_->moduleOverride_ != NULL) + if (impl_->moduleOverride_ != nullptr) { context.setModuleDisplayName(impl_->programContext_.displayName()); impl_->moduleOverride_->writeHelp(context); diff --git a/src/gromacs/commandline/cmdlinehelpwriter.cpp b/src/gromacs/commandline/cmdlinehelpwriter.cpp index 4756ebe4a8..43151ce5fc 100644 --- a/src/gromacs/commandline/cmdlinehelpwriter.cpp +++ b/src/gromacs/commandline/cmdlinehelpwriter.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -120,7 +120,7 @@ class OptionsFilter : public OptionsVisitor * Does not throw. */ OptionsFilter() - : formatter_(NULL), filterType_(eSelectOtherOptions), + : formatter_(nullptr), filterType_(eSelectOtherOptions), bShowHidden_(false) { } @@ -170,7 +170,7 @@ void OptionsFilter::visitOption(const OptionInfo &option) return; } const FileNameOptionInfo *const fileOption = option.toType(); - if (fileOption != NULL && fileOption->isInputFile()) + if (fileOption != nullptr && fileOption->isInputFile()) { if (filterType_ == eSelectInputFileOptions) { @@ -178,7 +178,7 @@ void OptionsFilter::visitOption(const OptionInfo &option) } return; } - if (fileOption != NULL && fileOption->isInputOutputFile()) + if (fileOption != nullptr && fileOption->isInputOutputFile()) { if (filterType_ == eSelectInputOutputFileOptions) { @@ -186,7 +186,7 @@ void OptionsFilter::visitOption(const OptionInfo &option) } return; } - if (fileOption != NULL && fileOption->isOutputFile()) + if (fileOption != nullptr && fileOption->isOutputFile()) { if (filterType_ == eSelectOutputFileOptions) { @@ -282,8 +282,8 @@ descriptionWithOptionDetails(const CommonFormatterData &common, const FloatOptionInfo *floatOption = option.toType(); const DoubleOptionInfo *doubleOption = option.toType(); - if ((floatOption != NULL && floatOption->isTime()) - || (doubleOption != NULL && doubleOption->isTime())) + if ((floatOption != nullptr && floatOption->isTime()) + || (doubleOption != nullptr && doubleOption->isTime())) { // TODO: It could be nicer to have this in basicoptions.cpp. description = replaceAll(description, "%t", common.timeUnit); @@ -416,14 +416,14 @@ class OptionsListFormatter : public IOptionsFormatter private: void writeSectionStartIfNecessary() { - if (title_ != NULL) + if (title_ != nullptr) { context_.writeTitle(title_); - title_ = NULL; + title_ = nullptr; } if (!bDidOutput_) { - if (header_ != NULL) + if (header_ != nullptr) { context_.paragraphBreak(); context_.writeTextBlock(header_); @@ -448,7 +448,7 @@ OptionsListFormatter::OptionsListFormatter( const CommonFormatterData &common, const char *title) : context_(context), common_(common), - title_(title), header_(NULL), bDidOutput_(false) + title_(title), header_(nullptr), bDidOutput_(false) { } @@ -460,7 +460,7 @@ void OptionsListFormatter::formatOption(const OptionInfo &option) std::string defaultValue(defaultOptionValue(option)); std::string info; const FileNameOptionInfo *fileOption = option.toType(); - if (fileOption != NULL) + if (fileOption != nullptr) { const bool bAbbrev = (context_.outputFormat() == eHelpOutputFormat_Console); info = fileOptionFlagsAsString(*fileOption, bAbbrev); diff --git a/src/gromacs/commandline/cmdlineinit.cpp b/src/gromacs/commandline/cmdlineinit.cpp index 2915f0aacb..e59cb86624 100644 --- a/src/gromacs/commandline/cmdlineinit.cpp +++ b/src/gromacs/commandline/cmdlineinit.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -141,9 +141,9 @@ CommandLineProgramContext &initForCommandLine(int *argc, char ***argv) void finalizeForCommandLine() { gmx::finalize(); - setLibraryFileFinder(NULL); + setLibraryFileFinder(nullptr); g_libFileFinder.reset(); - setProgramContext(NULL); + setProgramContext(nullptr); g_commandLineContext.reset(); } diff --git a/src/gromacs/commandline/cmdlinemodule.cpp b/src/gromacs/commandline/cmdlinemodule.cpp index 0019a324da..9050a5a690 100644 --- a/src/gromacs/commandline/cmdlinemodule.cpp +++ b/src/gromacs/commandline/cmdlinemodule.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014, by the GROMACS development team, led by + * Copyright (c) 2014,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -84,7 +84,7 @@ void writeCommandLineHelpCMain( int argc = 1; // TODO: The constness should not be cast away. argv[0] = const_cast(name); - argv[1] = NULL; + argv[1] = nullptr; GlobalCommandLineHelpContext global(context); mainFunction(argc, argv); } diff --git a/src/gromacs/commandline/cmdlinemodulemanager.cpp b/src/gromacs/commandline/cmdlinemodulemanager.cpp index 82b14fe19c..45a06cef72 100644 --- a/src/gromacs/commandline/cmdlinemodulemanager.cpp +++ b/src/gromacs/commandline/cmdlinemodulemanager.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -316,8 +316,8 @@ class CommandLineModuleManager::Impl CommandLineModuleManager::Impl::Impl(const char *binaryName, CommandLineProgramContext *programContext) : programContext_(*programContext), - binaryName_(binaryName != NULL ? binaryName : ""), - helpModule_(NULL), singleModule_(NULL), + binaryName_(binaryName != nullptr ? binaryName : ""), + helpModule_(nullptr), singleModule_(nullptr), bQuiet_(false) { GMX_RELEASE_ASSERT(binaryName_.find('-') == std::string::npos, @@ -337,7 +337,7 @@ void CommandLineModuleManager::Impl::addModule(CommandLineModulePointer module) void CommandLineModuleManager::Impl::ensureHelpModuleExists() { - if (helpModule_ == NULL) + if (helpModule_ == nullptr) { helpModule_ = new CommandLineHelpModule(programContext_, binaryName_, modules_, moduleGroups_); @@ -362,7 +362,7 @@ CommandLineModuleManager::Impl::processCommonOptions( // TODO: It would be nice to propagate at least the -quiet option to // the modules so that they can also be quiet in response to this. - if (module == NULL) + if (module == nullptr) { // If not in single-module mode, process options to the wrapper binary. // TODO: Ideally, this could be done by CommandLineParser. @@ -395,9 +395,9 @@ CommandLineModuleManager::Impl::processCommonOptions( // which path is taken: (*argv)[0] is the module name. } } - if (module != NULL) + if (module != nullptr) { - if (singleModule_ == NULL) + if (singleModule_ == nullptr) { programContext_.setDisplayName(binaryName_ + " " + module->name()); } @@ -409,14 +409,14 @@ CommandLineModuleManager::Impl::processCommonOptions( } if (!optionsHolder->finishOptions()) { - return NULL; + return nullptr; } // If no module specified and no other action, show the help. // Also explicitly specifying -h for the wrapper binary goes here. - if (module == NULL || optionsHolder->shouldShowHelp()) + if (module == nullptr || optionsHolder->shouldShowHelp()) { ensureHelpModuleExists(); - if (module != NULL) + if (module != nullptr) { helpModule_->setModuleOverride(*module); } @@ -536,7 +536,7 @@ int CommandLineModuleManager::run(int argc, char *argv[]) optionsHolder.binaryInfoSettings()); fprintf(out, "\n"); } - if (module == NULL) + if (module == nullptr) { return 0; } @@ -596,7 +596,7 @@ int CommandLineModuleManager::runAsMainSingleModule( CommandLineProgramContext &programContext = gmx::initForCommandLine(&argc, &argv); try { - CommandLineModuleManager manager(NULL, &programContext); + CommandLineModuleManager manager(nullptr, &programContext); manager.setSingleModule(module); int rc = manager.run(argc, argv); gmx::finalizeForCommandLine(); @@ -636,10 +636,10 @@ void CommandLineModuleGroupData::addModule(const char *name, CommandLineModuleMap::const_iterator moduleIter = allModules_.find(name); GMX_RELEASE_ASSERT(moduleIter != allModules_.end(), "Non-existent module added to a group"); - if (description == NULL) + if (description == nullptr) { description = moduleIter->second->shortDescription(); - GMX_RELEASE_ASSERT(description != NULL, + GMX_RELEASE_ASSERT(description != nullptr, "Module without a description added to a group"); } std::string tag(formatString("%s-%s", binaryName_, name)); @@ -652,7 +652,7 @@ void CommandLineModuleGroupData::addModule(const char *name, void CommandLineModuleGroup::addModule(const char *name) { - impl_->addModule(name, NULL); + impl_->addModule(name, nullptr); } void CommandLineModuleGroup::addModuleWithDescription(const char *name, diff --git a/src/gromacs/commandline/cmdlineoptionsmodule.cpp b/src/gromacs/commandline/cmdlineoptionsmodule.cpp index b4d45d3755..f0e6db73a3 100644 --- a/src/gromacs/commandline/cmdlineoptionsmodule.cpp +++ b/src/gromacs/commandline/cmdlineoptionsmodule.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -131,7 +131,7 @@ void CommandLineOptionsModule::init(CommandLineModuleSettings *settings) { if (!module_) { - GMX_RELEASE_ASSERT(factory_ != NULL, "Neither factory nor module provided"); + GMX_RELEASE_ASSERT(factory_ != nullptr, "Neither factory nor module provided"); module_ = factory_(); } module_->init(settings); @@ -150,7 +150,7 @@ void CommandLineOptionsModule::writeHelp(const CommandLineHelpContext &context) ICommandLineOptionsModule *module = module_.get(); if (!module) { - GMX_RELEASE_ASSERT(factory_ != NULL, "Neither factory nor module provided"); + GMX_RELEASE_ASSERT(factory_ != nullptr, "Neither factory nor module provided"); moduleGuard = factory_(); module = moduleGuard.get(); } diff --git a/src/gromacs/commandline/cmdlineparser.cpp b/src/gromacs/commandline/cmdlineparser.cpp index 2db9afd016..9ba3cac180 100644 --- a/src/gromacs/commandline/cmdlineparser.cpp +++ b/src/gromacs/commandline/cmdlineparser.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -97,7 +97,7 @@ const char *CommandLineParser::Impl::toOptionName(const char *arg) const // Lone '-' or '--' is not an option. if (arg[0] != '-' || arg[1] == '\0' || (arg[1] == '-' && arg[2] == '\0')) { - return NULL; + return nullptr; } // Something starting with '--' is always an option. if (arg[1] == '-') @@ -110,7 +110,7 @@ const char *CommandLineParser::Impl::toOptionName(const char *arg) const GMX_IGNORE_RETURN_VALUE(std::strtod(arg, &endptr)); if (*endptr == '\0') { - return NULL; + return nullptr; } return arg + 1; } @@ -146,7 +146,7 @@ void CommandLineParser::parse(int *argc, char *argv[]) { const char *const arg = argv[i]; const char *const optionName = impl_->toOptionName(arg); - if (optionName != NULL) + if (optionName != nullptr) { if (bInOption) { @@ -213,7 +213,7 @@ void CommandLineParser::parse(int *argc, char *argv[]) if (impl_->bSkipUnknown_) { *argc = newi; - argv[newi] = NULL; + argv[newi] = nullptr; } // Finish the last option. if (bInOption) diff --git a/src/gromacs/commandline/cmdlineprogramcontext.cpp b/src/gromacs/commandline/cmdlineprogramcontext.cpp index 7d61b0c071..dc15cd2df7 100644 --- a/src/gromacs/commandline/cmdlineprogramcontext.cpp +++ b/src/gromacs/commandline/cmdlineprogramcontext.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -75,7 +75,7 @@ namespace */ std::string quoteIfNecessary(const char *str) { - const bool bSpaces = (std::strchr(str, ' ') != NULL); + const bool bSpaces = (std::strchr(str, ' ') != nullptr); if (bSpaces) { return formatString("'%s'", str); diff --git a/src/gromacs/commandline/filenm.cpp b/src/gromacs/commandline/filenm.cpp index f8b5e55282..cbda55311f 100644 --- a/src/gromacs/commandline/filenm.cpp +++ b/src/gromacs/commandline/filenm.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -62,7 +62,7 @@ const t_filenm *getFilenm(const char *opt, int nfile, const t_filenm fnm[]) } } - return NULL; + return nullptr; } const char *opt2fn(const char *opt, int nfile, const t_filenm fnm[]) @@ -79,7 +79,7 @@ const char *opt2fn(const char *opt, int nfile, const t_filenm fnm[]) fprintf(stderr, "No option %s\n", opt); - return NULL; + return nullptr; } int opt2fns(char **fns[], const char *opt, int nfile, const t_filenm fnm[]) @@ -112,7 +112,7 @@ const char *ftp2fn(int ftp, int nfile, const t_filenm fnm[]) } fprintf(stderr, "ftp2fn: No filetype %s\n", ftp2ext_with_dot(ftp)); - return NULL; + return nullptr; } int ftp2fns(char **fns[], int ftp, int nfile, const t_filenm fnm[]) @@ -176,7 +176,7 @@ const char *opt2fn_null(const char *opt, int nfile, const t_filenm fnm[]) { if (IS_OPT(fnm[i]) && !IS_SET(fnm[i])) { - return NULL; + return nullptr; } else { @@ -185,7 +185,7 @@ const char *opt2fn_null(const char *opt, int nfile, const t_filenm fnm[]) } } fprintf(stderr, "No option %s\n", opt); - return NULL; + return nullptr; } const char *ftp2fn_null(int ftp, int nfile, const t_filenm fnm[]) @@ -198,7 +198,7 @@ const char *ftp2fn_null(int ftp, int nfile, const t_filenm fnm[]) { if (IS_OPT(fnm[i]) && !IS_SET(fnm[i])) { - return NULL; + return nullptr; } else { @@ -207,7 +207,7 @@ const char *ftp2fn_null(int ftp, int nfile, const t_filenm fnm[]) } } fprintf(stderr, "ftp2fn: No filetype %s\n", ftp2ext_with_dot(ftp)); - return NULL; + return nullptr; } gmx_bool is_optional(const t_filenm *fnm) @@ -266,7 +266,7 @@ t_filenm *dup_tfn(int nf, const t_filenm tfn[]) } else { - ret[i].opt = NULL; + ret[i].opt = nullptr; } if (tfn[i].fn) @@ -275,7 +275,7 @@ t_filenm *dup_tfn(int nf, const t_filenm tfn[]) } else { - ret[i].fn = NULL; + ret[i].fn = nullptr; } if (tfn[i].nfiles > 0) @@ -301,6 +301,6 @@ void done_filenms(int nf, t_filenm fnm[]) sfree(fnm[i].fns[j]); } sfree(fnm[i].fns); - fnm[i].fns = NULL; + fnm[i].fns = nullptr; } } diff --git a/src/gromacs/commandline/pargs.cpp b/src/gromacs/commandline/pargs.cpp index dcbb501dc2..0ceb6a777f 100644 --- a/src/gromacs/commandline/pargs.cpp +++ b/src/gromacs/commandline/pargs.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -149,7 +149,7 @@ const char *opt2parg_str(const char *option, int nparg, t_pargs pa[]) gmx_fatal(FARGS, "No string option %s in pargs", option); - return NULL; + return nullptr; } gmx_bool opt2parg_bSet(const char *option, int nparg, t_pargs pa[]) @@ -183,7 +183,7 @@ const char *opt2parg_enum(const char *option, int nparg, t_pargs pa[]) gmx_fatal(FARGS, "No such option %s in pargs", option); - return NULL; + return nullptr; } /******************************************************************** @@ -204,7 +204,7 @@ namespace int getDefaultXvgFormat(gmx::ConstArrayRef xvgFormats) { const char *const select = getenv("GMX_VIEW_XVG"); - if (select != NULL) + if (select != nullptr) { ConstArrayRef::const_iterator i = std::find(xvgFormats.begin(), xvgFormats.end(), std::string(select)); @@ -272,7 +272,7 @@ class OptionsAdapter struct FileNameData { //! Creates a conversion helper for a given `t_filenm` struct. - explicit FileNameData(t_filenm *fnm) : fnm(fnm), optionInfo(NULL) + explicit FileNameData(t_filenm *fnm) : fnm(fnm), optionInfo(nullptr) { } @@ -287,7 +287,7 @@ class OptionsAdapter { //! Creates a conversion helper for a given `t_pargs` struct. explicit ProgramArgData(t_pargs *pa) - : pa(pa), optionInfo(NULL), enumIndex(0), boolValue(false) + : pa(pa), optionInfo(nullptr), enumIndex(0), boolValue(false) { } @@ -316,7 +316,7 @@ class OptionsAdapter void OptionsAdapter::filenmToOptions(Options *options, t_filenm *fnm) { - if (fnm->opt == NULL) + if (fnm->opt == nullptr) { // Existing code may use opt2fn() instead of ftp2fn() for // options that use the default option name, so we need to @@ -334,7 +334,7 @@ void OptionsAdapter::filenmToOptions(Options *options, t_filenm *fnm) const char *const name = &fnm->opt[1]; const char * defName = fnm->fn; int defType = -1; - if (defName == NULL) + if (defName == nullptr) { defName = ftp2defnm(fnm->ftp); } @@ -387,7 +387,7 @@ void OptionsAdapter::pargsToOptions(Options *options, t_pargs *pa) return; case etSTR: { - const char *const defValue = (*pa->u.c != NULL ? *pa->u.c : ""); + const char *const defValue = (*pa->u.c != nullptr ? *pa->u.c : ""); data.optionInfo = options->addOption( StringOption(name).store(&data.stringValue) .defaultValue(defValue) @@ -407,7 +407,7 @@ void OptionsAdapter::pargsToOptions(Options *options, t_pargs *pa) return; case etENUM: { - const int defaultIndex = (pa->u.c[0] != NULL ? nenum(pa->u.c) - 1 : 0); + const int defaultIndex = (pa->u.c[0] != nullptr ? nenum(pa->u.c) - 1 : 0); data.optionInfo = options->addOption( EnumIntOption(name).store(&data.enumIndex) .defaultValue(defaultIndex) @@ -571,7 +571,7 @@ gmx_bool parse_common_args(int *argc, char *argv[], unsigned long Flags, const gmx::CommandLineHelpContext *context = gmx::GlobalCommandLineHelpContext::get(); - if (context != NULL) + if (context != nullptr) { GMX_RELEASE_ASSERT(gmx_node_rank() == 0, "Help output should be handled higher up and " diff --git a/src/gromacs/commandline/shellcompletions.cpp b/src/gromacs/commandline/shellcompletions.cpp index 88d64ab8c6..7a8e23da57 100644 --- a/src/gromacs/commandline/shellcompletions.cpp +++ b/src/gromacs/commandline/shellcompletions.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -94,7 +94,7 @@ class OptionsListWriter : public OptionsVisitor optionList_.append("-"); const BooleanOptionInfo *booleanOption = option.toType(); - if (booleanOption != NULL && booleanOption->defaultValue()) + if (booleanOption != nullptr && booleanOption->defaultValue()) { optionList_.append("no"); } @@ -132,7 +132,7 @@ void OptionCompletionWriter::visitOption(const OptionInfo &option) return; } const FileNameOptionInfo *fileOption = option.toType(); - if (fileOption != NULL) + if (fileOption != nullptr) { if (fileOption->isDirectoryOption()) { @@ -157,7 +157,7 @@ void OptionCompletionWriter::visitOption(const OptionInfo &option) return; } const StringOptionInfo *stringOption = option.toType(); - if (stringOption != NULL && stringOption->isEnumerated()) + if (stringOption != nullptr && stringOption->isEnumerated()) { std::string completion("compgen -S ' ' -W $'"); completion.append(joinStrings(stringOption->allowedValues(), "\\n")); diff --git a/src/gromacs/commandline/tests/cmdlinehelpwriter.cpp b/src/gromacs/commandline/tests/cmdlinehelpwriter.cpp index 84f70e7891..055be24bcb 100644 --- a/src/gromacs/commandline/tests/cmdlinehelpwriter.cpp +++ b/src/gromacs/commandline/tests/cmdlinehelpwriter.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -80,7 +80,7 @@ void CommandLineHelpWriterTest::checkHelp(gmx::CommandLineHelpWriter *writer) gmx::StringOutputStream stream; gmx::TextWriter streamWriter(&stream); gmx::CommandLineHelpContext context(&streamWriter, gmx::eHelpOutputFormat_Console, - NULL, "test"); + nullptr, "test"); context.setShowHidden(bHidden_); writer->writeHelp(context); stream.close(); diff --git a/src/gromacs/commandline/tests/cmdlinemodulemanager.cpp b/src/gromacs/commandline/tests/cmdlinemodulemanager.cpp index b32791630b..6e619dc68d 100644 --- a/src/gromacs/commandline/tests/cmdlinemodulemanager.cpp +++ b/src/gromacs/commandline/tests/cmdlinemodulemanager.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -120,7 +120,7 @@ TEST_F(CommandLineModuleManagerTest, RunsModuleHelpWithDashHWithSingleModule) }; CommandLine args(cmdline); initManager(args, "g_module"); - MockModule mod(NULL, NULL); + MockModule mod(nullptr, nullptr); manager().setSingleModule(&mod); using ::testing::_; EXPECT_CALL(mod, writeHelp(_)); diff --git a/src/gromacs/commandline/tests/cmdlineparser.cpp b/src/gromacs/commandline/tests/cmdlineparser.cpp index d9f973d011..a1ad8871a0 100644 --- a/src/gromacs/commandline/tests/cmdlineparser.cpp +++ b/src/gromacs/commandline/tests/cmdlineparser.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -165,7 +165,7 @@ TEST_F(CommandLineParserTest, HandlesSkipUnknown) EXPECT_STREQ("-opt2", args.arg(2)); EXPECT_STREQ("value", args.arg(3)); EXPECT_STREQ("-opt3", args.arg(4)); - EXPECT_TRUE(args.arg(5) == NULL); + EXPECT_TRUE(args.arg(5) == nullptr); EXPECT_TRUE(flag_); ASSERT_EQ(1U, ivalues_.size()); diff --git a/src/gromacs/commandline/tests/cmdlineprogramcontext.cpp b/src/gromacs/commandline/tests/cmdlineprogramcontext.cpp index 4308ac80e7..0bb6864c6e 100644 --- a/src/gromacs/commandline/tests/cmdlineprogramcontext.cpp +++ b/src/gromacs/commandline/tests/cmdlineprogramcontext.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -114,7 +114,7 @@ class CommandLineProgramContextTest : public ::testing::Test void testBinaryPathSearch(const char *argv0) { - ASSERT_TRUE(env_.get() != NULL); + ASSERT_TRUE(env_.get() != nullptr); gmx::CommandLineProgramContext info(1, &argv0, move(env_)); EXPECT_EQ(expectedExecutable_, info.fullBinaryPath()); } diff --git a/src/gromacs/commandline/tests/pargs.cpp b/src/gromacs/commandline/tests/pargs.cpp index 28cb5ad88d..876862acf9 100644 --- a/src/gromacs/commandline/tests/pargs.cpp +++ b/src/gromacs/commandline/tests/pargs.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -75,7 +75,7 @@ class ParseCommonArgsTest : public ::testing::Test }; ParseCommonArgsTest() - : oenv_(NULL), fileCount_(0) + : oenv_(nullptr), fileCount_(0) { } virtual ~ParseCommonArgsTest() @@ -93,7 +93,7 @@ class ParseCommonArgsTest : public ::testing::Test bool bOk = parse_common_args(&args_.argc(), args_.argv(), flags, fnm.size(), fnm.data(), pa.size(), pa.data(), - 0, NULL, 0, NULL, &oenv_); + 0, nullptr, 0, nullptr, &oenv_); EXPECT_TRUE(bOk); } void parseFromArray(gmx::ConstArrayRef cmdline, @@ -109,7 +109,7 @@ class ParseCommonArgsTest : public ::testing::Test { std::string filename(tempFiles_.getTemporaryFilePath(extension)); gmx::TextWriter::writeFileFromString(filename, "Dummy file"); - if (name != NULL) + if (name != nullptr) { args_.append(name); switch (type) @@ -285,9 +285,9 @@ TEST_F(ParseCommonArgsTest, ParsesTimeArgsWithTimeUnit) TEST_F(ParseCommonArgsTest, ParsesEnumArgs) { - const char *value1[] = {NULL, "none", "on", "off", NULL }; - const char *value2[] = {NULL, "def", "value", "value_other", NULL }; - const char *value3[] = {NULL, "default", "value", NULL }; + const char *value1[] = {nullptr, "none", "on", "off", nullptr }; + const char *value2[] = {nullptr, "def", "value", "value_other", nullptr }; + const char *value3[] = {nullptr, "default", "value", nullptr }; t_pargs pa[] = { { "-s1", FALSE, etENUM, {value1}, "Description" }, { "-s2", FALSE, etENUM, {value2}, "Description" }, @@ -325,8 +325,8 @@ TEST_F(ParseCommonArgsTest, ParsesFileArgs) EXPECT_STREQ("test.xvg", opt2fn_null("-o2", nfile(), fnm)); char **files; EXPECT_EQ(2, opt2fns(&files, "-om", nfile(), fnm)); - EXPECT_TRUE(files != NULL); - if (files != NULL) + EXPECT_TRUE(files != nullptr); + if (files != nullptr) { EXPECT_STREQ("test1.xvg", files[0]); EXPECT_STREQ("test2.xvg", files[1]); @@ -338,8 +338,8 @@ TEST_F(ParseCommonArgsTest, ParsesFileArgs) TEST_F(ParseCommonArgsTest, ParsesFileArgsWithDefaults) { t_filenm fnm[] = { - { efTPS, NULL, NULL, ffWRITE }, - { efTRX, "-f2", NULL, ffOPTWR }, + { efTPS, nullptr, nullptr, ffWRITE }, + { efTRX, "-f2", nullptr, ffOPTWR }, { efTRX, "-f3", "trj3", ffWRITE }, { efXVG, "-o", "out", ffWRITE }, { efXVG, "-om", "outm", ffWRMULT } @@ -360,8 +360,8 @@ TEST_F(ParseCommonArgsTest, ParsesFileArgsWithDefaults) TEST_F(ParseCommonArgsTest, ParsesFileArgsWithDefaultFileName) { t_filenm fnm[] = { - { efTPS, "-s", NULL, ffWRITE }, - { efTRX, "-f2", NULL, ffWRITE }, + { efTPS, "-s", nullptr, ffWRITE }, + { efTRX, "-f2", nullptr, ffWRITE }, { efTRX, "-f3", "trj3", ffWRITE }, { efXVG, "-o", "out", ffWRITE }, { efXVG, "-om", "outm", ffWRMULT } @@ -402,7 +402,7 @@ TEST_F(ParseCommonArgsTest, ParseFileArgsWithCustomDefaultExtension) TEST_F(ParseCommonArgsTest, HandlesNonExistentInputFiles) { t_filenm fnm[] = { - { efTPS, "-s", NULL, ffREAD }, + { efTPS, "-s", nullptr, ffREAD }, { efTRX, "-f", "trj", ffREAD }, { efTRX, "-f2", "trj2", ffREAD }, { efTRX, "-f3", "trj3", ffREAD }, @@ -427,7 +427,7 @@ TEST_F(ParseCommonArgsTest, HandlesNonExistentInputFiles) TEST_F(ParseCommonArgsTest, HandlesNonExistentOptionalInputFiles) { t_filenm fnm[] = { - { efTPS, "-s", NULL, ffOPTRD }, + { efTPS, "-s", nullptr, ffOPTRD }, { efTRX, "-f", "trj", ffOPTRD } }; const char *const cmdline[] = { @@ -463,8 +463,8 @@ TEST_F(ParseCommonArgsTest, AcceptsNonExistentInputFilesIfSpecified) TEST_F(ParseCommonArgsTest, HandlesCompressedFiles) { t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efGRO, "-g", NULL, ffREAD } + { efTRX, "-f", nullptr, ffREAD }, + { efGRO, "-g", nullptr, ffREAD } }; args_.append("test"); std::string expectedF = addFileArg("-f", ".pdb.gz", efFull); @@ -480,7 +480,7 @@ TEST_F(ParseCommonArgsTest, HandlesCompressedFiles) TEST_F(ParseCommonArgsTest, AcceptsUnknownTrajectoryExtension) { t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD } + { efTRX, "-f", nullptr, ffREAD } }; args_.append("test"); std::string expected = addFileArg("-f", ".foo", efFull); @@ -492,10 +492,10 @@ TEST_F(ParseCommonArgsTest, AcceptsUnknownTrajectoryExtension) TEST_F(ParseCommonArgsTest, CompletesExtensionFromExistingFile) { t_filenm fnm[] = { - { efTRX, "-f1", NULL, ffREAD }, - { efTRX, "-f2", NULL, ffREAD }, - { efTRX, "-f3", NULL, ffREAD }, - { efTRX, "-f4", NULL, ffREAD } + { efTRX, "-f1", nullptr, ffREAD }, + { efTRX, "-f2", nullptr, ffREAD }, + { efTRX, "-f3", nullptr, ffREAD }, + { efTRX, "-f4", nullptr, ffREAD } }; args_.append("test"); std::string expected1 = addFileArg("-f1", "1.xtc", efNoExtension); @@ -515,16 +515,16 @@ TEST_F(ParseCommonArgsTest, CompletesExtensionFromExistingFile) TEST_F(ParseCommonArgsTest, CompletesExtensionFromExistingFileWithDefaultFileName) { t_filenm fnm[] = { - { efTRX, "-f1", NULL, ffREAD }, + { efTRX, "-f1", nullptr, ffREAD }, { efSTO, "-f2", "foo", ffREAD }, - { efTRX, "-f3", NULL, ffREAD }, - { efSTX, "-f4", NULL, ffREAD } + { efTRX, "-f3", nullptr, ffREAD }, + { efSTX, "-f4", nullptr, ffREAD } }; args_.append("test"); std::string expected1 = addFileArg("-f1", "1.trr", efNoExtension); std::string expected2 = addFileArg("-f2", ".pdb", efEmptyValue); std::string expected3 = addFileArg("-f3", ".trr", efEmptyValue); - std::string expected4 = addFileArg(NULL, ".pdb", efEmptyValue); + std::string expected4 = addFileArg(nullptr, ".pdb", efEmptyValue); std::string deffnm = gmx::Path::stripExtension(expected3); args_.append("-deffnm"); args_.append(deffnm); @@ -543,9 +543,9 @@ TEST_F(ParseCommonArgsTest, CompletesExtensionFromExistingFileWithDefaultFileNam TEST_F(ParseCommonArgsTest, HandlesNonReadNode) { t_filenm fnm[] = { - { efTPS, "-s", NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, - { efTRX, "-f2", NULL, ffREAD } + { efTPS, "-s", nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTRX, "-f2", nullptr, ffREAD } }; const char *const cmdline[] = { "test", "-f", "-f2", "other" @@ -560,9 +560,9 @@ TEST_F(ParseCommonArgsTest, HandlesNonReadNode) TEST_F(ParseCommonArgsTest, HandlesNonReadNodeWithDefaultFileName) { t_filenm fnm[] = { - { efTPS, "-s", NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, - { efTRX, "-f2", NULL, ffREAD } + { efTPS, "-s", nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTRX, "-f2", nullptr, ffREAD } }; const char *const cmdline[] = { "test", "-deffnm", "def", "-f", "-f2", "other" diff --git a/src/gromacs/commandline/viewit.cpp b/src/gromacs/commandline/viewit.cpp index 6ba6c60e85..87a8ebf769 100644 --- a/src/gromacs/commandline/viewit.cpp +++ b/src/gromacs/commandline/viewit.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -54,8 +54,8 @@ static const int can_view_ftp[] = { }; #define NVIEW asize(can_view_ftp) static const char* view_program[] = { - NULL, - "ghostview", "display", NULL, "xterm -e rasmol" + nullptr, + "ghostview", "display", nullptr, "xterm -e rasmol" }; static int can_view(int ftp) @@ -81,7 +81,7 @@ void do_view(const gmx_output_env_t *oenv, const char *fn, const char *opts) if (output_env_get_view(oenv) && fn) { - if (getenv("DISPLAY") == NULL) + if (getenv("DISPLAY") == nullptr) { fprintf(stderr, "Can not view %s, no DISPLAY environment variable.\n", fn); } @@ -141,7 +141,7 @@ void view_all(const gmx_output_env_t *oenv, int nf, t_filenm fnm[]) if (can_view(fnm[i].ftp) && is_output(&(fnm[i])) && ( !is_optional(&(fnm[i])) || is_set(&(fnm[i])) ) ) { - do_view(oenv, fnm[i].fns[0], NULL); + do_view(oenv, fnm[i].fns[0], nullptr); } } } diff --git a/src/gromacs/correlationfunctions/autocorr.cpp b/src/gromacs/correlationfunctions/autocorr.cpp index acc01a2495..d851184d3b 100644 --- a/src/gromacs/correlationfunctions/autocorr.cpp +++ b/src/gromacs/correlationfunctions/autocorr.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -536,7 +536,7 @@ void low_do_autocorr(const char *fn, const gmx_output_env_t *oenv, const char *t gmx_bool bVerbose, real tbeginfit, real tendfit, int eFitFn) { - FILE *fp, *gp = NULL; + FILE *fp, *gp = nullptr; int i; real *csum; real *ctmp, *fit; @@ -621,8 +621,8 @@ void low_do_autocorr(const char *fn, const gmx_output_env_t *oenv, const char *t } else { - fit = NULL; - fp = NULL; + fit = nullptr; + fp = nullptr; } if (bAver) { @@ -638,12 +638,12 @@ void low_do_autocorr(const char *fn, const gmx_output_env_t *oenv, const char *t if (eFitFn != effnNONE) { - fit_acf(nout, eFitFn, oenv, fn != NULL, tbeginfit, tendfit, dt, c1[0], fit); + fit_acf(nout, eFitFn, oenv, fn != nullptr, tbeginfit, tendfit, dt, c1[0], fit); sum = print_and_integrate(fp, nout, dt, c1[0], fit, 1); } else { - sum = print_and_integrate(fp, nout, dt, c1[0], NULL, 1); + sum = print_and_integrate(fp, nout, dt, c1[0], nullptr, 1); } if (bVerbose) { @@ -666,12 +666,12 @@ void low_do_autocorr(const char *fn, const gmx_output_env_t *oenv, const char *t } if (eFitFn != effnNONE) { - fit_acf(nout, eFitFn, oenv, fn != NULL, tbeginfit, tendfit, dt, c1[i], fit); + fit_acf(nout, eFitFn, oenv, fn != nullptr, tbeginfit, tendfit, dt, c1[i], fit); sum = print_and_integrate(fp, nout, dt, c1[i], fit, 1); } else { - sum = print_and_integrate(fp, nout, dt, c1[i], NULL, 1); + sum = print_and_integrate(fp, nout, dt, c1[i], nullptr, 1); if (debug) { fprintf(debug, @@ -707,7 +707,7 @@ void low_do_autocorr(const char *fn, const gmx_output_env_t *oenv, const char *t } /*! \brief Legend for selecting Legendre polynomials. */ -static const char *Leg[] = { NULL, "0", "1", "2", "3", NULL }; +static const char *Leg[] = { nullptr, "0", "1", "2", "3", nullptr }; t_pargs *add_acf_pargs(int *npargs, t_pargs *pa) { diff --git a/src/gromacs/correlationfunctions/expfit.cpp b/src/gromacs/correlationfunctions/expfit.cpp index 9eac51beae..4fc9fd425e 100644 --- a/src/gromacs/correlationfunctions/expfit.cpp +++ b/src/gromacs/correlationfunctions/expfit.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -75,9 +75,9 @@ static const int nfp_ffn[effnNR] = { 0, 1, 2, 3, 5, 7, 9, 2, 4, 3, 6 }; * the array). */ const char *s_ffn[effnNR+2] = { - NULL, "none", "exp", "aexp", "exp_exp", + nullptr, "none", "exp", "aexp", "exp_exp", "exp5", "exp7", "exp9", - NULL, NULL, NULL, NULL, NULL + nullptr, nullptr, nullptr, nullptr, nullptr }; /*! \brief Long description for each fitting function type */ @@ -115,7 +115,7 @@ const char *effnDescription(int effn) } else { - return NULL; + return nullptr; } } @@ -725,7 +725,7 @@ real do_lmfit(int ndata, real c1[], real sig[], real dt, real *x0, { x[j] = ttt; y[j] = c1[i]; - if (NULL == sig) + if (nullptr == sig) { // No weighting if all values are divided by 1. dy[j] = 1; @@ -814,7 +814,7 @@ real do_lmfit(int ndata, real c1[], real sig[], real dt, real *x0, } } /* Generate debug output */ - if (NULL != fn_fitted) + if (nullptr != fn_fitted) { fp = xvgropen(fn_fitted, "Data + Fit", "Time (ps)", "Data (t)", oenv); @@ -861,7 +861,7 @@ real fit_acf(int ncorr, int fitfn, const gmx_output_env_t *oenv, gmx_bool bVerbo tendfit = ncorr*dt; } nf_int = std::min(ncorr, (int)(tendfit/dt)); - sum = print_and_integrate(debug, nf_int, dt, c1, NULL, 1); + sum = print_and_integrate(debug, nf_int, dt, c1, nullptr, 1); if (bPrint) { @@ -946,9 +946,9 @@ real fit_acf(int ncorr, int fitfn, const gmx_output_env_t *oenv, gmx_bool bVerbo } nf_int = std::min(ncorr, (int)((tStart+1e-4)/dt)); - sum = print_and_integrate(debug, nf_int, dt, c1, NULL, 1); - tail_corr = do_lmfit(ncorr, c1, sig, dt, NULL, tStart, tendfit, oenv, - bDebugMode(), fitfn, fitparm, 0, NULL); + sum = print_and_integrate(debug, nf_int, dt, c1, nullptr, 1); + tail_corr = do_lmfit(ncorr, c1, sig, dt, nullptr, tStart, tendfit, oenv, + bDebugMode(), fitfn, fitparm, 0, nullptr); sumtot = sum+tail_corr; if (fit && ((jmax == 1) || (j == 1))) { diff --git a/src/gromacs/correlationfunctions/tests/autocorr.cpp b/src/gromacs/correlationfunctions/tests/autocorr.cpp index 561ecb99e6..2d7053b4d9 100644 --- a/src/gromacs/correlationfunctions/tests/autocorr.cpp +++ b/src/gromacs/correlationfunctions/tests/autocorr.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -99,13 +99,13 @@ class AutocorrTest : public ::testing::Test std::string fileName = "testCOS3.xvg"; data_ = CorrelationDataSetPointer(new CorrelationDataSet(fileName)); nrFrames_ = data_->getNrLines(); - tempArgs_ = add_acf_pargs(&n, NULL); + tempArgs_ = add_acf_pargs(&n, nullptr); } static void TearDownTestCase() { sfree(tempArgs_); - tempArgs_ = NULL; + tempArgs_ = nullptr; gmx_fft_cleanup(); } @@ -125,7 +125,7 @@ class AutocorrTest : public ::testing::Test } } real *ptr = result.data(); - low_do_autocorr(0, 0, 0, nrFrames_, 1, + low_do_autocorr(nullptr, nullptr, nullptr, nrFrames_, 1, get_acfnout(), &ptr, data_->getDt(), mode, nrRestart, bAverage, bNormalize, bVerbose, data_->getStartTime(), data_->getEndTime(), diff --git a/src/gromacs/correlationfunctions/tests/correlationdataset.cpp b/src/gromacs/correlationfunctions/tests/correlationdataset.cpp index 8eb2636015..593b606443 100644 --- a/src/gromacs/correlationfunctions/tests/correlationdataset.cpp +++ b/src/gromacs/correlationfunctions/tests/correlationdataset.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -68,10 +68,10 @@ CorrelationDataSet::~CorrelationDataSet() for (int i = 0; i < nrColumns_; i++) { sfree(tempValues_[i]); - tempValues_[i] = NULL; + tempValues_[i] = nullptr; } sfree(tempValues_); - tempValues_ = NULL; + tempValues_ = nullptr; } real CorrelationDataSet::getValue(int set, int time) const diff --git a/src/gromacs/correlationfunctions/tests/expfit.cpp b/src/gromacs/correlationfunctions/tests/expfit.cpp index a4e66a578d..eb93463fd9 100644 --- a/src/gromacs/correlationfunctions/tests/expfit.cpp +++ b/src/gromacs/correlationfunctions/tests/expfit.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -85,7 +85,7 @@ class ExpfitTest : public ::testing::Test // Static initiation, only run once every test. static void SetUpTestCase() { - double ** tempValues = NULL; + double ** tempValues = nullptr; std::vector fileName; fileName.push_back(test::TestFileManager::getInputFilePath("testINVEXP.xvg")); fileName.push_back(test::TestFileManager::getInputFilePath("testPRES.xvg")); @@ -112,10 +112,10 @@ class ExpfitTest : public ::testing::Test for (int j = 0; j < nrColumns; j++) { sfree(tempValues[j]); - tempValues[j] = NULL; + tempValues[j] = nullptr; } sfree(tempValues); - tempValues = NULL; + tempValues = nullptr; } } @@ -136,12 +136,12 @@ class ExpfitTest : public ::testing::Test output_env_init_default(&oenv); do_lmfit(data_[testType].nrLines_, &(data_[testType].y_[0]), - NULL, + nullptr, data_[testType].dt_, &(data_[testType].x_[0]), data_[testType].startTime_, data_[testType].endTime_, - oenv, false, type, result, 0, NULL); + oenv, false, type, result, 0, nullptr); output_env_done(oenv); checker_.setDefaultTolerance(test::relativeToleranceAsFloatingPoint(1, tolerance)); checker_.checkSequenceArray(nfitparm, result, "result"); diff --git a/src/gromacs/domdec/domdec.cpp b/src/gromacs/domdec/domdec.cpp index 93a685edce..e7a9b2160d 100644 --- a/src/gromacs/domdec/domdec.cpp +++ b/src/gromacs/domdec/domdec.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -252,7 +252,7 @@ int ddglatnr(const gmx_domdec_t *dd, int i) { int atnr; - if (dd == NULL) + if (dd == nullptr) { atnr = i + 1; } @@ -282,7 +282,7 @@ static bool dlbIsOn(const gmx_domdec_comm_t *comm) static void vec_rvec_init(vec_rvec_t *v) { v->nalloc = 0; - v->v = NULL; + v->v = nullptr; } static void vec_rvec_check_alloc(vec_rvec_t *v, int n) @@ -517,7 +517,7 @@ void dd_move_f(gmx_domdec_t *dd, rvec f[], rvec *fshift) consider PBC in the treatment of fshift */ bShiftForcesNeedPbc = (dd->ci[dd->dim[d]] == 0); bScrew = (bShiftForcesNeedPbc && dd->bScrewPBC && dd->dim[d] == XX); - if (fshift == NULL && !bScrew) + if (fshift == nullptr && !bScrew) { bShiftForcesNeedPbc = FALSE; } @@ -1056,8 +1056,8 @@ static void dd_move_cellx(gmx_domdec_t *dd, gmx_ddbox_t *ddbox, static void dd_collect_cg(gmx_domdec_t *dd, t_state *state_local) { - gmx_domdec_master_t *ma = NULL; - int buf2[2], *ibuf, i, ncg_home = 0, *cg = NULL, nat_home = 0; + gmx_domdec_master_t *ma = nullptr; + int buf2[2], *ibuf, i, ncg_home = 0, *cg = nullptr, nat_home = 0; if (state_local->ddp_count == dd->comm->master_cg_ddp_count) { @@ -1103,7 +1103,7 @@ static void dd_collect_cg(gmx_domdec_t *dd, } else { - ibuf = NULL; + ibuf = nullptr; } /* Collect the charge group and atom counts on the master */ dd_gather(dd, 2*sizeof(int), buf2, ibuf); @@ -1138,9 +1138,9 @@ static void dd_collect_cg(gmx_domdec_t *dd, /* Collect the charge group indices on the master */ dd_gatherv(dd, ncg_home*sizeof(int), cg, - DDMASTER(dd) ? ma->ibuf : NULL, - DDMASTER(dd) ? ma->ibuf+dd->nnodes : NULL, - DDMASTER(dd) ? ma->cg : NULL); + DDMASTER(dd) ? ma->ibuf : nullptr, + DDMASTER(dd) ? ma->ibuf+dd->nnodes : nullptr, + DDMASTER(dd) ? ma->cg : nullptr); dd->comm->master_cg_ddp_count = state_local->ddp_count; } @@ -1150,7 +1150,7 @@ static void dd_collect_vec_sendrecv(gmx_domdec_t *dd, { gmx_domdec_master_t *ma; int n, i, c, a, nalloc = 0; - rvec *buf = NULL; + rvec *buf = nullptr; t_block *cgs_gl; ma = dd->ma; @@ -1226,9 +1226,9 @@ static void dd_collect_vec_gatherv(gmx_domdec_t *dd, const rvec *lv, rvec *v) { gmx_domdec_master_t *ma; - int *rcounts = NULL, *disps = NULL; + int *rcounts = nullptr, *disps = nullptr; int n, i, c, a; - rvec *buf = NULL; + rvec *buf = nullptr; t_block *cgs_gl; ma = dd->ma; @@ -1398,7 +1398,7 @@ static void dd_resize_state(t_state *state, PaddedRVecVector *f, int natoms) } } - if (f != NULL) + if (f != nullptr) { (*f).resize(natoms + 1); } @@ -1436,7 +1436,7 @@ static void dd_distribute_vec_sendrecv(gmx_domdec_t *dd, t_block *cgs, { gmx_domdec_master_t *ma; int n, i, c, a, nalloc = 0; - rvec *buf = NULL; + rvec *buf = nullptr; if (DDMASTER(dd)) { @@ -1496,9 +1496,9 @@ static void dd_distribute_vec_scatterv(gmx_domdec_t *dd, t_block *cgs, rvec *v, rvec *lv) { gmx_domdec_master_t *ma; - int *scounts = NULL, *disps = NULL; + int *scounts = nullptr, *disps = nullptr; int n, i, c, a; - rvec *buf = NULL; + rvec *buf = nullptr; if (DDMASTER(dd)) { @@ -1537,7 +1537,7 @@ static void dd_distribute_vec(gmx_domdec_t *dd, t_block *cgs, rvec *v, rvec *lv) static void dd_distribute_dfhist(gmx_domdec_t *dd, df_history_t *dfhist) { - if (dfhist == NULL) + if (dfhist == nullptr) { return; } @@ -1590,7 +1590,7 @@ static void dd_distribute_state(gmx_domdec_t *dd, t_block *cgs, copy_mat(state->boxv, state_local->boxv); copy_mat(state->svir_prev, state_local->svir_prev); copy_mat(state->fvir_prev, state_local->fvir_prev); - if (state->dfhist != NULL) + if (state->dfhist != nullptr) { copy_df_history(state_local->dfhist, state->dfhist); } @@ -1680,7 +1680,7 @@ static char dim2char(int dim) static void write_dd_grid_pdb(const char *fn, gmx_int64_t step, gmx_domdec_t *dd, matrix box, gmx_ddbox_t *ddbox) { - rvec grid_s[2], *grid_r = NULL, cx, r; + rvec grid_s[2], *grid_r = nullptr, cx, r; char fname[STRLEN], buf[22]; FILE *out; int a, i, d, z, y, x; @@ -1695,7 +1695,7 @@ static void write_dd_grid_pdb(const char *fn, gmx_int64_t step, snew(grid_r, 2*dd->nnodes); } - dd_gather(dd, 2*sizeof(rvec), grid_s, DDMASTER(dd) ? grid_r : NULL); + dd_gather(dd, 2*sizeof(rvec), grid_s, DDMASTER(dd) ? grid_r : nullptr); if (DDMASTER(dd)) { @@ -2018,7 +2018,7 @@ static int dd_simnode2pmenode(const gmx_domdec_t *dd, /* This assumes DD cells with identical x coordinates * are numbered sequentially. */ - if (dd->comm->pmenodes == NULL) + if (dd->comm->pmenodes == nullptr) { if (sim_nodeid < dd->nnodes) { @@ -2046,7 +2046,7 @@ static int dd_simnode2pmenode(const gmx_domdec_t *dd, void get_pme_nnodes(const gmx_domdec_t *dd, int *npmenodes_x, int *npmenodes_y) { - if (dd != NULL) + if (dd != nullptr) { *npmenodes_x = dd->comm->npmenodes_x; *npmenodes_y = dd->comm->npmenodes_y; @@ -2217,7 +2217,7 @@ static void dd_set_cginfo(int *index_gl, int cg0, int cg1, int *cginfo; int cg; - if (fr != NULL) + if (fr != nullptr) { cginfo_mb = fr->cginfo_mb; cginfo = fr->cginfo; @@ -2228,7 +2228,7 @@ static void dd_set_cginfo(int *index_gl, int cg0, int cg1, } } - if (bLocalCG != NULL) + if (bLocalCG != nullptr) { for (cg = cg0; cg < cg1; cg++) { @@ -2311,7 +2311,7 @@ static int check_bLocalCG(gmx_domdec_t *dd, int ncg_sys, const char *bLocalCG, int i, ngl, nerr; nerr = 0; - if (bLocalCG == NULL) + if (bLocalCG == nullptr) { return nerr; } @@ -2837,7 +2837,7 @@ static void set_dd_cell_sizes_slb(gmx_domdec_t *dd, const gmx_ddbox_t *ddbox, { cellsize_min[d] = ddbox->box_size[d]*ddbox->skew_fac[d]; npulse[d] = 1; - if (dd->nc[d] == 1 || comm->slb_frac[d] == NULL) + if (dd->nc[d] == 1 || comm->slb_frac[d] == nullptr) { /* Uniform grid */ cell_dx = ddbox->box_size[d]/dd->nc[d]; @@ -2937,7 +2937,7 @@ static void set_dd_cell_sizes_slb(gmx_domdec_t *dd, const gmx_ddbox_t *ddbox, for (d = 0; d < comm->npmedecompdim; d++) { set_pme_maxshift(dd, &comm->ddpme[d], - comm->slb_frac[dd->dim[d]] == NULL, ddbox, + comm->slb_frac[dd->dim[d]] == nullptr, ddbox, comm->ddpme[d].slb_dim_f); } } @@ -3504,7 +3504,7 @@ static void realloc_comm_ind(gmx_domdec_t *dd, ivec npulse) srenew(cd->ind, np); for (i = cd->np_nalloc; i < np; i++) { - cd->ind[i].index = NULL; + cd->ind[i].index = nullptr; cd->ind[i].nalloc = 0; } cd->np_nalloc = np; @@ -3637,7 +3637,7 @@ static void distribute_cg(FILE *fplog, gmx_domdec_t *dd) { gmx_domdec_master_t *ma; - int **tmp_ind = NULL, *tmp_nalloc = NULL; + int **tmp_ind = nullptr, *tmp_nalloc = nullptr; int i, icg, j, k, k0, k1, d; matrix tcm; rvec cg_cm; @@ -3815,7 +3815,7 @@ static void get_cg_distribution(FILE *fplog, gmx_domdec_t *dd, t_block *cgs, matrix box, gmx_ddbox_t *ddbox, rvec pos[]) { - gmx_domdec_master_t *ma = NULL; + gmx_domdec_master_t *ma = nullptr; ivec npulse; int i, cg_gl; int *ibuf, buf2[2] = { 0, 0 }; @@ -3842,7 +3842,7 @@ static void get_cg_distribution(FILE *fplog, gmx_domdec_t *dd, } else { - ibuf = NULL; + ibuf = nullptr; } dd_scatter(dd, 2*sizeof(int), ibuf, buf2); @@ -3866,9 +3866,9 @@ static void get_cg_distribution(FILE *fplog, gmx_domdec_t *dd, } dd_scatterv(dd, - bMaster ? ma->ibuf : NULL, - bMaster ? ma->ibuf+dd->nnodes : NULL, - bMaster ? ma->cg : NULL, + bMaster ? ma->ibuf : nullptr, + bMaster ? ma->ibuf+dd->nnodes : nullptr, + bMaster ? ma->cg : nullptr, dd->ncg_home*sizeof(int), dd->index_gl); /* Determine the home charge group sizes */ @@ -4386,7 +4386,7 @@ static void dd_redistribute_cg(FILE *fplog, gmx_int64_t step, gmx_bool bV = FALSE, bCGP = FALSE; real pos_d; matrix tcm; - rvec *cg_cm = NULL, cell_x0, cell_x1, limitd, limit0, limit1; + rvec *cg_cm = nullptr, cell_x0, cell_x1, limitd, limit0, limit1; int *cgindex; cginfo_mb_t *cginfo_mb; gmx_domdec_comm_t *comm; @@ -4928,7 +4928,7 @@ static double force_flop_count(t_nrnb *nrnb) * for the normal loops and again half it for water loops. */ name = nrnb_str(i); - if (strstr(name, "W3") != NULL || strstr(name, "W4") != NULL) + if (strstr(name, "W3") != nullptr || strstr(name, "W4") != nullptr) { sum += nrnb->n[i]*0.25*cost_nrnb(i); } @@ -4940,7 +4940,7 @@ static double force_flop_count(t_nrnb *nrnb) for (i = eNR_NBKERNEL_FREE_ENERGY; i <= eNR_NB14; i++) { name = nrnb_str(i); - if (strstr(name, "W3") != NULL || strstr(name, "W4") != NULL) + if (strstr(name, "W3") != nullptr || strstr(name, "W4") != nullptr) { sum += nrnb->n[i]*cost_nrnb(i); } @@ -4987,7 +4987,7 @@ static void get_load_distribution(gmx_domdec_t *dd, gmx_wallcycle_t wcycle) { gmx_domdec_comm_t *comm; domdec_load_t *load; - domdec_root_t *root = NULL; + domdec_root_t *root = nullptr; int d, dim, i, pos; float cell_frac = 0, sbuf[DD_NLOAD_MAX]; gmx_bool bSepPME; @@ -5819,7 +5819,7 @@ static gmx_domdec_master_t *init_gmx_domdec_master_t(gmx_domdec_t *dd, if (dd->nnodes <= GMX_DD_NNODES_SENDRECV) { - ma->vbuf = NULL; + ma->vbuf = nullptr; } else { @@ -5999,7 +5999,7 @@ static void make_dd_communicators(FILE *fplog, t_commrec *cr, * Real reordering is only supported on very few architectures, * Blue Gene is one of them. */ - CartReorder = (getenv("GMX_NO_CART_REORDER") == NULL); + CartReorder = (getenv("GMX_NO_CART_REORDER") == nullptr); if (cr->npmenodes > 0) { @@ -6062,8 +6062,8 @@ static real *get_slb_frac(FILE *fplog, const char *dir, int nc, const char *size int i, n; double dbl; - slb_frac = NULL; - if (nc > 1 && size_string != NULL) + slb_frac = nullptr; + if (nc > 1 && size_string != nullptr) { if (fplog) { @@ -6270,7 +6270,7 @@ static void set_dd_dim(FILE *fplog, gmx_domdec_t *dd) int dim; dd->ndim = 0; - if (getenv("GMX_DD_ORDER_ZYX") != NULL) + if (getenv("GMX_DD_ORDER_ZYX") != nullptr) { /* Decomposition order z,y,x */ if (fplog) @@ -6313,7 +6313,7 @@ static gmx_domdec_comm_t *init_dd_comm() } comm->nalloc_int = 0; - comm->buf_int = NULL; + comm->buf_int = nullptr; vec_rvec_init(&comm->vbuf); @@ -6361,7 +6361,7 @@ static void set_dd_limits_and_grid(FILE *fplog, t_commrec *cr, gmx_domdec_t *dd, dd->bScrewPBC = (ir->ePBC == epbcSCREW); dd->pme_recv_f_alloc = 0; - dd->pme_recv_f_buf = NULL; + dd->pme_recv_f_buf = nullptr; /* Initialize to GPU share count to 0, might change later */ comm->nrank_gpu_shared = 0; @@ -6556,7 +6556,7 @@ static void set_dd_limits_and_grid(FILE *fplog, t_commrec *cr, gmx_domdec_t *dd, } else { - set_ddbox_cr(cr, NULL, ir, box, &comm->cgs_gl, x, ddbox); + set_ddbox_cr(cr, nullptr, ir, box, &comm->cgs_gl, x, ddbox); /* We need to choose the optimal DD grid and possibly PME nodes */ real limit = @@ -6624,7 +6624,7 @@ static void set_dd_limits_and_grid(FILE *fplog, t_commrec *cr, gmx_domdec_t *dd, */ if (dd->ndim >= 2 && dd->dim[0] == XX && dd->dim[1] == YY && comm->npmenodes > dd->nc[XX] && comm->npmenodes % dd->nc[XX] == 0 && - getenv("GMX_PMEONEDD") == NULL) + getenv("GMX_PMEONEDD") == nullptr) { comm->npmedecompdim = 2; comm->npmenodes_x = dd->nc[XX]; @@ -6867,8 +6867,8 @@ void dd_init_bondeds(FILE *fplog, else { /* Only communicate atoms based on cut-off */ - comm->cglink = NULL; - comm->bLocalCG = NULL; + comm->cglink = nullptr; + comm->bLocalCG = nullptr; } } @@ -6883,7 +6883,7 @@ static void print_dd_settings(FILE *fplog, gmx_domdec_t *dd, real limit, shrink; char buf[64]; - if (fplog == NULL) + if (fplog == nullptr) { return; } @@ -7983,7 +7983,7 @@ static void setup_dd_communication(gmx_domdec_t *dd, real r_comm2, r_bcomm2; dd_corners_t corners; ivec tric_dist; - rvec *cg_cm, *normal, *v_d, *v_0 = NULL, *v_1 = NULL, *recv_vr; + rvec *cg_cm, *normal, *v_d, *v_0 = nullptr, *v_1 = nullptr, *recv_vr; real skew_fac2_d, skew_fac_01; rvec sf2_round; int nsend, nat; @@ -8019,7 +8019,7 @@ static void setup_dd_communication(gmx_domdec_t *dd, break; default: gmx_incons("unimplemented"); - cg_cm = NULL; + cg_cm = nullptr; } for (dim_ind = 0; dim_ind < dd->ndim; dim_ind++) @@ -8431,7 +8431,7 @@ static void setup_dd_communication(gmx_domdec_t *dd, * So we pass NULL for the forcerec. */ dd_set_cginfo(dd->index_gl, dd->ncg_home, dd->ncg_tot, - NULL, comm->bLocalCG); + nullptr, comm->bLocalCG); } if (debug) @@ -8757,7 +8757,7 @@ static void order_vec_atom(int ncg, const int *cgindex, const gmx_cgsort_t *sort { int a, atot, cg, cg0, cg1, i; - if (cgindex == NULL) + if (cgindex == nullptr) { /* Avoid the useless loop of the atoms within a cg */ order_vec_cg(ncg, sort, v, buf); @@ -8976,7 +8976,7 @@ static void dd_sort_state(gmx_domdec_t *dd, rvec *cgcm, t_forcerec *fr, t_state } else { - cgindex = NULL; + cgindex = nullptr; } /* Remove the charge groups which are no longer at home here */ @@ -9122,7 +9122,7 @@ void print_dd_statistics(t_commrec *cr, t_inputrec *ir, FILE *fplog) gmx_sumd(ddnatNR-ddnatZONE, comm->sum_nat, cr); - if (fplog == NULL) + if (fplog == nullptr) { return; } @@ -9571,7 +9571,7 @@ void dd_partition_system(FILE *fplog, comm->zones.dens_zone0, fr->cginfo, as_rvec_array(state_local->x.data()), - ncg_moved, bRedist ? comm->moved : NULL, + ncg_moved, bRedist ? comm->moved : nullptr, fr->nbv->grp[eintLocal].kernel_type, fr->nbv->grp[eintLocal].nbat); @@ -9730,7 +9730,7 @@ void dd_partition_system(FILE *fplog, /* Update atom data for mdatoms and several algorithms */ mdAlgorithmsSetupAtomData(cr, ir, top_global, top_local, fr, - NULL, mdatoms, vsite, NULL); + nullptr, mdatoms, vsite, nullptr); if (ir->implicit_solvent) { diff --git a/src/gromacs/domdec/domdec_box.cpp b/src/gromacs/domdec/domdec_box.cpp index 684509aabd..43baf19953 100644 --- a/src/gromacs/domdec/domdec_box.cpp +++ b/src/gromacs/domdec/domdec_box.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -102,7 +102,7 @@ static void calc_cgcm_av_stddev(const t_block *cgs, int n, const rvec *x, } } - if (cr_sum != NULL) + if (cr_sum != nullptr) { for (d = 0; d < DIM; d++) { @@ -146,7 +146,7 @@ static void set_tric_dir(const ivec *dd_nc, gmx_ddbox_t *ddbox, const matrix box if (box[j][d] != 0) { ddbox->tric_dir[d] = 1; - if (dd_nc != NULL && (*dd_nc)[j] > 1 && (*dd_nc)[d] == 1) + if (dd_nc != nullptr && (*dd_nc)[j] > 1 && (*dd_nc)[d] == 1) { gmx_fatal(FARGS, "Domain decomposition has not been implemented for box vectors that have non-zero components in directions that do not use domain decomposition: ncells = %d %d %d, box vector[%d] = %f %f %f", (*dd_nc)[XX], (*dd_nc)[YY], (*dd_nc)[ZZ], @@ -292,7 +292,7 @@ void set_ddbox(gmx_domdec_t *dd, gmx_bool bMasterState, t_commrec *cr_sum, { low_set_ddbox(ir, &dd->nc, box, bCalcUnboundedSize, bMasterState ? cgs->nr : dd->ncg_home, cgs, x, - bMasterState ? NULL : cr_sum, + bMasterState ? nullptr : cr_sum, ddbox); } @@ -309,7 +309,7 @@ void set_ddbox_cr(t_commrec *cr, const ivec *dd_nc, { if (MASTER(cr)) { - low_set_ddbox(ir, dd_nc, box, TRUE, cgs->nr, cgs, x, NULL, ddbox); + low_set_ddbox(ir, dd_nc, box, TRUE, cgs->nr, cgs, x, nullptr, ddbox); } gmx_bcast(sizeof(gmx_ddbox_t), ddbox, cr); diff --git a/src/gromacs/domdec/domdec_constraints.cpp b/src/gromacs/domdec/domdec_constraints.cpp index 91565d6711..f22e8e8e7b 100644 --- a/src/gromacs/domdec/domdec_constraints.cpp +++ b/src/gromacs/domdec/domdec_constraints.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -105,7 +105,7 @@ int *dd_constraints_nlocalatoms(gmx_domdec_t *dd) } else { - return NULL; + return nullptr; } } @@ -254,7 +254,7 @@ static void atoms_to_settles(gmx_domdec_t *dd, { int a_gl = dd->gatindex[a]; int a_mol; - mtopGetMolblockIndex(mtop, a_gl, &mb, NULL, &a_mol); + mtopGetMolblockIndex(mtop, a_gl, &mb, nullptr, &a_mol); const gmx_molblock_t *molb = &mtop->molblock[mb]; int settle = at2settle_mt[molb->type][a_mol]; @@ -474,8 +474,8 @@ int dd_make_local_constraints(gmx_domdec_t *dd, int at_start, else { // Currently unreachable - at2con_mt = NULL; - ireq = NULL; + at2con_mt = nullptr; + ireq = nullptr; } if (dd->bInterCGsettles) @@ -486,10 +486,10 @@ int dd_make_local_constraints(gmx_domdec_t *dd, int at_start, else { /* Settle works inside charge groups, we assigned them already */ - at2settle_mt = NULL; + at2settle_mt = nullptr; } - if (at2settle_mt == NULL) + if (at2settle_mt == nullptr) { atoms_to_constraints(dd, mtop, cginfo, at2con_mt, nrec, ilc_local, ireq); @@ -502,7 +502,7 @@ int dd_make_local_constraints(gmx_domdec_t *dd, int at_start, /* Do the constraints, if present, on the first thread. * Do the settles on all other threads. */ - t0_set = ((at2con_mt != NULL && dc->nthread > 1) ? 1 : 0); + t0_set = ((at2con_mt != nullptr && dc->nthread > 1) ? 1 : 0); #pragma omp parallel for num_threads(dc->nthread) schedule(static) for (thread = 0; thread < dc->nthread; thread++) diff --git a/src/gromacs/domdec/domdec_setup.cpp b/src/gromacs/domdec/domdec_setup.cpp index 7f3ccc5cc5..2b810056ac 100644 --- a/src/gromacs/domdec/domdec_setup.cpp +++ b/src/gromacs/domdec/domdec_setup.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -631,7 +631,7 @@ static real optimize_ncells(FILE *fplog, * we can save some time (e.g. 3D DD with pbc=xyz). * Here we ignore SIMD bondeds as they always do (fast) PBC. */ - count_bonded_distances(mtop, ir, &pbcdxr, NULL); + count_bonded_distances(mtop, ir, &pbcdxr, nullptr); pbcdxr /= (double)mtop->natoms; } else diff --git a/src/gromacs/domdec/domdec_specatomcomm.cpp b/src/gromacs/domdec/domdec_specatomcomm.cpp index 8d86f5f156..f7c143a9cb 100644 --- a/src/gromacs/domdec/domdec_specatomcomm.cpp +++ b/src/gromacs/domdec/domdec_specatomcomm.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -97,7 +97,7 @@ void dd_move_f_specat(gmx_domdec_t *dd, gmx_domdec_specat_comm_t *spac, spas = &spac->spas[d][dir]; /* Sum the buffer into the required forces */ - if (!bPBC || (!bScrew && fshift == NULL)) + if (!bPBC || (!bScrew && fshift == nullptr)) { for (i = 0; i < spas->nsend; i++) { @@ -182,7 +182,7 @@ void dd_move_x_specat(gmx_domdec_t *dd, gmx_domdec_specat_comm_t *spac, rvec shift = {0, 0, 0}; nvec = 1; - if (x1 != NULL) + if (x1 != nullptr) { nvec++; } diff --git a/src/gromacs/domdec/domdec_topology.cpp b/src/gromacs/domdec/domdec_topology.cpp index 79062a8122..d9950c7eb5 100644 --- a/src/gromacs/domdec/domdec_topology.cpp +++ b/src/gromacs/domdec/domdec_topology.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -626,7 +626,7 @@ static int make_reverse_ilist(const t_ilist *ilist, snew(count, nat_mt); low_make_reverse_ilist(ilist, atoms->atom, vsite_pbc, count, - bConstr, bSettle, bBCheck, NULL, NULL, + bConstr, bSettle, bBCheck, nullptr, nullptr, bLinkToAllAtoms, FALSE); snew(ril_mt->index, nat_mt+1); @@ -692,7 +692,7 @@ static gmx_reverse_top_t *make_reverse_top(const gmx_mtop_t *mtop, gmx_bool bFE, /* Make the atom to interaction list for this molecule type */ nint_mt[mt] = make_reverse_ilist(molt->ilist, &molt->atoms, - vsite_pbc_molt ? vsite_pbc_molt[mt] : NULL, + vsite_pbc_molt ? vsite_pbc_molt[mt] : nullptr, rt->bConstr, rt->bSettle, rt->bBCheck, FALSE, &rt->ril_mt[mt]); @@ -716,15 +716,15 @@ static gmx_reverse_top_t *make_reverse_top(const gmx_mtop_t *mtop, gmx_bool bFE, { t_atoms atoms_global; - rt->ril_intermol.index = NULL; - rt->ril_intermol.il = NULL; + rt->ril_intermol.index = nullptr; + rt->ril_intermol.il = nullptr; atoms_global.nr = mtop->natoms; - atoms_global.atom = NULL; /* Only used with virtual sites */ + atoms_global.atom = nullptr; /* Only used with virtual sites */ *nint += make_reverse_ilist(mtop->intermolecular_ilist, &atoms_global, - NULL, + nullptr, rt->bConstr, rt->bSettle, rt->bBCheck, FALSE, &rt->ril_intermol); } @@ -753,7 +753,7 @@ static gmx_reverse_top_t *make_reverse_top(const gmx_mtop_t *mtop, gmx_bool bFE, rt->nthread = gmx_omp_nthreads_get(emntDomdec); snew(rt->th_work, rt->nthread); - if (vsite_pbc_molt != NULL) + if (vsite_pbc_molt != nullptr) { for (thread = 0; thread < rt->nthread; thread++) { @@ -782,7 +782,7 @@ void dd_make_reverse_top(FILE *fplog, */ dd->reverse_top = make_reverse_top(mtop, ir->efep != efepNO, - vsite ? vsite->vsite_pbc_molt : NULL, + vsite ? vsite->vsite_pbc_molt : nullptr, !dd->bInterCGcons, !dd->bInterCGsettles, bBCheck, &dd->nbonded_global); @@ -1227,7 +1227,7 @@ static void combine_idef(t_idef *dest, const thread_work_t *src, int nsrc, int nral1 = 0, ftv = 0; vpbc = ((interaction_function[ftype].flags & IF_VSITE) && - vsite->vsite_pbc_loc != NULL); + vsite->vsite_pbc_loc != nullptr); if (vpbc) { nral1 = 1 + NRAL(ftype); @@ -2032,8 +2032,8 @@ static int make_local_bondeds_excls(gmx_domdec_t *dd, } else { - vsite_pbc = NULL; - vsite_pbc_nalloc = NULL; + vsite_pbc = nullptr; + vsite_pbc_nalloc = nullptr; } rt->th_work[thread].nbonded = @@ -2144,7 +2144,7 @@ void dd_make_local_top(gmx_domdec_t *dd, gmx_domdec_zones_t *zones, real rc = -1; ivec rcheck; int d, nexcl; - t_pbc pbc, *pbc_null = NULL; + t_pbc pbc, *pbc_null = nullptr; if (debug) { @@ -2202,7 +2202,7 @@ void dd_make_local_top(gmx_domdec_t *dd, gmx_domdec_zones_t *zones, } else { - pbc_null = NULL; + pbc_null = nullptr; } } } @@ -2257,7 +2257,7 @@ gmx_localtop_t *dd_init_local_top(const gmx_mtop_t *top_global) for (i = 0; i < F_NRE; i++) { - top->idef.il[i].iatoms = NULL; + top->idef.il[i].iatoms = nullptr; top->idef.il[i].nalloc = 0; } top->idef.ilsort = ilsortUNKNOWN; @@ -2362,16 +2362,16 @@ t_blocka *make_charge_group_links(const gmx_mtop_t *mtop, gmx_domdec_t *dd, t_atoms atoms; atoms.nr = mtop->natoms; - atoms.atom = NULL; + atoms.atom = nullptr; make_reverse_ilist(mtop->intermolecular_ilist, &atoms, - NULL, FALSE, FALSE, FALSE, TRUE, &ril_intermol); + nullptr, FALSE, FALSE, FALSE, TRUE, &ril_intermol); } snew(link, 1); snew(link->index, ncg_mtop(mtop)+1); link->nalloc_a = 0; - link->a = NULL; + link->a = nullptr; link->index[0] = 0; cg_offset = 0; @@ -2392,7 +2392,7 @@ t_blocka *make_charge_group_links(const gmx_mtop_t *mtop, gmx_domdec_t *dd, * The constraints are discarded here. */ make_reverse_ilist(molt->ilist, &molt->atoms, - NULL, FALSE, FALSE, FALSE, TRUE, &ril); + nullptr, FALSE, FALSE, FALSE, TRUE, &ril); cgi_mb = &cginfo_mb[mb]; @@ -2652,7 +2652,7 @@ static void get_cgcm_mol(const gmx_moltype_t *molt, if (ePBC != epbcNONE) { - mk_mshift(NULL, graph, ePBC, box, x); + mk_mshift(nullptr, graph, ePBC, box, x); shift_x(graph, box, x, xs); /* By doing an extra mk_mshift the molecules that are broken @@ -2660,7 +2660,7 @@ static void get_cgcm_mol(const gmx_moltype_t *molt, * will be made whole again. Such are the healing powers * of GROMACS. */ - mk_mshift(NULL, graph, ePBC, box, xs); + mk_mshift(nullptr, graph, ePBC, box, xs); } else { @@ -2677,12 +2677,12 @@ static void get_cgcm_mol(const gmx_moltype_t *molt, if (vsite) { - construct_vsites(vsite, xs, 0.0, NULL, + construct_vsites(vsite, xs, 0.0, nullptr, ffparams->iparams, molt->ilist, - epbcNONE, TRUE, NULL, NULL); + epbcNONE, TRUE, nullptr, nullptr); } - calc_cgcm(NULL, 0, molt->cgs.nr, &molt->cgs, xs, cg_cm); + calc_cgcm(nullptr, 0, molt->cgs.nr, &molt->cgs, xs, cg_cm); } //! Returns whether \p molt has a virtual site @@ -2723,7 +2723,7 @@ void dd_bonded_cg_distance(FILE *fplog, bExclRequired = inputrecExclForces(ir); - vsite = init_vsite(mtop, NULL, TRUE); + vsite = init_vsite(mtop, nullptr, TRUE); *r_2b = 0; *r_mb = 0; @@ -2740,7 +2740,7 @@ void dd_bonded_cg_distance(FILE *fplog, { if (ir->ePBC != epbcNONE) { - mk_graph_ilist(NULL, molt->ilist, 0, molt->atoms.nr, FALSE, FALSE, + mk_graph_ilist(nullptr, molt->ilist, 0, molt->atoms.nr, FALSE, FALSE, &graph); } @@ -2750,7 +2750,7 @@ void dd_bonded_cg_distance(FILE *fplog, for (mol = 0; mol < molb->nmol; mol++) { get_cgcm_mol(molt, &mtop->ffparams, ir->ePBC, &graph, box, - have_vsite_molt(molt) ? vsite : NULL, + have_vsite_molt(molt) ? vsite : nullptr, x+at_offset, xs, cg_cm); bonded_distance_t bd_mol_2b = { 0, -1, -1, -1 }; diff --git a/src/gromacs/domdec/domdec_vsite.cpp b/src/gromacs/domdec/domdec_vsite.cpp index d984850535..7d9fc36ef0 100644 --- a/src/gromacs/domdec/domdec_vsite.cpp +++ b/src/gromacs/domdec/domdec_vsite.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -89,7 +89,7 @@ void dd_move_x_vsites(gmx_domdec_t *dd, matrix box, rvec *x) { if (dd->vsite_comm) { - dd_move_x_specat(dd, dd->vsite_comm, box, x, NULL, FALSE); + dd_move_x_specat(dd, dd->vsite_comm, box, x, nullptr, FALSE); } } diff --git a/src/gromacs/domdec/hash.h b/src/gromacs/domdec/hash.h index 9aa0b2c54c..0f6b54c64f 100644 --- a/src/gromacs/domdec/hash.h +++ b/src/gromacs/domdec/hash.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -124,7 +124,7 @@ static void gmx_hash_realloc(gmx_hash_t *hash, int nkey_used_estimate) hash->nalloc = over_alloc_dd(hash->mod); srenew(hash->hash, hash->nalloc); - if (debug != NULL) + if (debug != nullptr) { fprintf(debug, "Hash table mod %d nalloc %d\n", hash->mod, hash->nalloc); } @@ -141,7 +141,7 @@ static void gmx_hash_clear_and_optimize(gmx_hash_t *hash) if (hash->nkey > 0 && (4*hash->nkey < hash->mod || 3*hash->nkey > 2*hash->mod)) { - if (debug != NULL) + if (debug != nullptr) { fprintf(debug, "Hash table size %d #key %d: resizing\n", hash->mod, hash->nkey); @@ -158,7 +158,7 @@ static gmx_hash_t *gmx_hash_init(int nkey_used_estimate) gmx_hash_t *hash; snew(hash, 1); - hash->hash = NULL; + hash->hash = nullptr; gmx_hash_realloc(hash, nkey_used_estimate); diff --git a/src/gromacs/essentialdynamics/edsam.cpp b/src/gromacs/essentialdynamics/edsam.cpp index df8e76e445..2f14c359ab 100644 --- a/src/gromacs/essentialdynamics/edsam.cpp +++ b/src/gromacs/essentialdynamics/edsam.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -573,7 +573,7 @@ static void do_edfit(int natoms, rvec *xp, rvec *x, matrix R, t_edpar *edi) struct t_do_edfit *loc; gmx_bool bFirst; - if (edi->buf->do_edfit != NULL) + if (edi->buf->do_edfit != nullptr) { bFirst = FALSE; } @@ -1189,7 +1189,7 @@ gmx_edsam_t ed_open(int natoms, edsamstate_t **EDstatePtr, int nfile, const t_fi /* Allocate space for the ED data structure */ snew(ed, 1); - if (*EDstatePtr == NULL) + if (*EDstatePtr == nullptr) { snew(*EDstatePtr, 1); } @@ -1465,13 +1465,13 @@ static int read_edint(FILE *file, gmx_bool *bEOF) eof = fgets2 (line, STRLEN, file); - if (eof == NULL) + if (eof == nullptr) { *bEOF = TRUE; return -1; } eof = fgets2 (line, STRLEN, file); - if (eof == NULL) + if (eof == nullptr) { *bEOF = TRUE; return -1; @@ -1720,7 +1720,7 @@ static int read_edi(FILE* in, t_edpar *edi, int nr_mdatoms, const char *fn) snew(edi->sref.anrs, edi->sref.nr); snew(edi->sref.x, edi->sref.nr); snew(edi->sref.x_old, edi->sref.nr); - edi->sref.sqrtm = NULL; + edi->sref.sqrtm = nullptr; read_edx(in, edi->sref.nr, edi->sref.anrs, edi->sref.x); /* average positions. they define which atoms will be used for ED sampling */ @@ -1743,7 +1743,7 @@ static int read_edi(FILE* in, t_edpar *edi, int nr_mdatoms, const char *fn) { snew(edi->star.anrs, edi->star.nr); snew(edi->star.x, edi->star.nr); - edi->star.sqrtm = NULL; + edi->star.sqrtm = nullptr; read_edx(in, edi->star.nr, edi->star.anrs, edi->star.x); } @@ -1760,7 +1760,7 @@ static int read_edi(FILE* in, t_edpar *edi, int nr_mdatoms, const char *fn) } snew(edi->sori.anrs, edi->sori.nr); snew(edi->sori.x, edi->sori.nr); - edi->sori.sqrtm = NULL; + edi->sori.sqrtm = nullptr; read_edx(in, edi->sori.nr, edi->sori.anrs, edi->sori.x); } @@ -1810,7 +1810,7 @@ static int read_edi_file(const char *fn, t_edpar *edi, int nr_mdatoms) } /* Terminate the edi group list with a NULL pointer: */ - last_edi->next_edi = NULL; + last_edi->next_edi = nullptr; fprintf(stderr, "ED: Found %d ED group%s.\n", edi_nr, edi_nr > 1 ? "s" : ""); @@ -1840,7 +1840,7 @@ static void fit_to_reference(rvec *xcoll, /* The positions to be fitted /* Allocate memory the first time this routine is called for each edi group */ - if (NULL == edi->buf->fit_to_ref) + if (nullptr == edi->buf->fit_to_ref) { snew(edi->buf->fit_to_ref, 1); snew(edi->buf->fit_to_ref->xcopy, edi->sref.nr); @@ -2140,7 +2140,7 @@ static void do_radcon(rvec *xcoll, t_edpar *edi) rvec vec_dum; - if (edi->buf->do_radcon != NULL) + if (edi->buf->do_radcon != nullptr) { bFirst = FALSE; } @@ -2303,7 +2303,7 @@ static void copyEvecReference(t_eigvec* floodvecs) int i; - if (NULL == floodvecs->refproj0) + if (nullptr == floodvecs->refproj0) { snew(floodvecs->refproj0, floodvecs->neig); } @@ -2319,11 +2319,11 @@ static void copyEvecReference(t_eigvec* floodvecs) * groups of the checkpoint file are consistent with the provided .edi file. */ static void crosscheck_edi_file_vs_checkpoint(gmx_edsam_t ed, edsamstate_t *EDstate) { - t_edpar *edi = NULL; /* points to a single edi data set */ + t_edpar *edi = nullptr; /* points to a single edi data set */ int edinum; - if (NULL == EDstate->nref || NULL == EDstate->nav) + if (nullptr == EDstate->nref || nullptr == EDstate->nav) { gmx_fatal(FARGS, "Essential dynamics and flooding can only be switched on (or off) at the\n" "start of a new simulation. If a simulation runs with/without ED constraints,\n" @@ -2334,7 +2334,7 @@ static void crosscheck_edi_file_vs_checkpoint(gmx_edsam_t ed, edsamstate_t *EDst edi = ed->edpar; edinum = 0; - while (edi != NULL) + while (edi != nullptr) { /* Check number of atoms in the reference and average structures */ if (EDstate->nref[edinum] != edi->sref.nr) @@ -2470,12 +2470,12 @@ static void nice_legend_evec(const char ***setname, int *nsets, char **LegendStr /* Makes a legend for the xvg output file. Call on MASTER only! */ static void write_edo_legend(gmx_edsam_t ed, int nED, const gmx_output_env_t *oenv) { - t_edpar *edi = NULL; + t_edpar *edi = nullptr; int i; int nr_edi, nsets, n_flood, n_edsam; const char **setname; char buf[STRLEN]; - char *LegendStr = NULL; + char *LegendStr = nullptr; edi = ed->edpar; @@ -2653,19 +2653,19 @@ void init_edsam(const gmx_mtop_t *mtop, matrix box, edsamstate_t *EDstate) { - t_edpar *edi = NULL; /* points to a single edi data set */ + t_edpar *edi = nullptr; /* points to a single edi data set */ int i, nr_edi, avindex; - rvec *x_pbc = NULL; /* positions of the whole MD system with pbc removed */ - rvec *xfit = NULL, *xstart = NULL; /* dummy arrays to determine initial RMSDs */ - rvec fit_transvec; /* translation ... */ - matrix fit_rotmat; /* ... and rotation from fit to reference structure */ - rvec *ref_x_old = NULL; /* helper pointer */ + rvec *x_pbc = nullptr; /* positions of the whole MD system with pbc removed */ + rvec *xfit = nullptr, *xstart = nullptr; /* dummy arrays to determine initial RMSDs */ + rvec fit_transvec; /* translation ... */ + matrix fit_rotmat; /* ... and rotation from fit to reference structure */ + rvec *ref_x_old = nullptr; /* helper pointer */ if (MASTER(cr)) { fprintf(stderr, "ED: Initializing essential dynamics constraints.\n"); - if (NULL == ed) + if (nullptr == ed) { gmx_fatal(FARGS, "The checkpoint file you provided is from an essential dynamics or\n" "flooding simulation. Please also provide the correct .edi file with -ei.\n"); @@ -2685,7 +2685,7 @@ void init_edsam(const gmx_mtop_t *mtop, * as well, but will be done in the order given in the edi file, so * expect different results for different order of edi file concatenation! */ edi = ed->edpar; - while (edi != NULL) + while (edi != nullptr) { init_edi(mtop, edi); init_flood(edi, ed, ir->delta_t); @@ -2702,7 +2702,7 @@ void init_edsam(const gmx_mtop_t *mtop, /* Remove PBC, make molecule(s) subject to ED whole. */ snew(x_pbc, mtop->natoms); copy_rvecn(x, x_pbc, 0, mtop->natoms); - do_pbc_first_mtop(NULL, ir->ePBC, box, mtop, x_pbc); + do_pbc_first_mtop(nullptr, ir->ePBC, box, mtop, x_pbc); } /* Reset pointer to first ED data set which contains the actual ED data */ edi = ed->edpar; @@ -3025,7 +3025,7 @@ void do_edsam(const t_inputrec *ir, /* Loop over all ED groups (usually one) */ edi = ed->edpar; edinr = 0; - while (edi != NULL) + while (edi != nullptr) { edinr++; if (bNeedDoEdsam(edi)) @@ -3156,7 +3156,7 @@ void do_edsam(const t_inputrec *ir, /* dx is the ED correction to the positions: */ rvec_sub(x_unsh, xs[edi->sav.anrs_loc[i]], dx); - if (v != NULL) + if (v != nullptr) { /* dv is the ED correction to the velocity: */ svmul(dt_1, dx, dv); diff --git a/src/gromacs/ewald/ewald.cpp b/src/gromacs/ewald/ewald.cpp index 1f508cddc9..ce3521a16f 100644 --- a/src/gromacs/ewald/ewald.cpp +++ b/src/gromacs/ewald/ewald.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -87,9 +87,9 @@ void init_ewald_tab(struct gmx_ewald_tab_t **et, const t_inputrec *ir, FILE *fp) (*et)->ny = ir->nky+1; (*et)->nz = ir->nkz+1; (*et)->kmax = std::max((*et)->nx, std::max((*et)->ny, (*et)->nz)); - (*et)->eir = NULL; - (*et)->tab_xy = NULL; - (*et)->tab_qxyz = NULL; + (*et)->eir = nullptr; + (*et)->tab_xy = nullptr; + (*et)->tab_qxyz = nullptr; } //! Calculates wave vectors. @@ -151,7 +151,7 @@ real do_ewald(t_inputrec *ir, real tmp, cs, ss, ak, akv, mx, my, mz, m2, scale; gmx_bool bFreeEnergy; - if (cr != NULL) + if (cr != nullptr) { if (PAR(cr)) { diff --git a/src/gromacs/ewald/pme-grid.cpp b/src/gromacs/ewald/pme-grid.cpp index 2e0b5b6cf9..4958b8f561 100644 --- a/src/gromacs/ewald/pme-grid.cpp +++ b/src/gromacs/ewald/pme-grid.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -568,7 +568,7 @@ void pmegrid_init(pmegrid_t *grid, } grid->order = pme_order; - if (ptr == NULL) + if (ptr == nullptr) { gridsize = grid->s[XX]*grid->s[YY]*grid->s[ZZ]; set_gridsize_alignment(&gridsize, pme_order); @@ -628,7 +628,7 @@ static void make_subgrid_division(const ivec n, int ovl, int nthread, } env = getenv("GMX_PME_THREAD_DIVISION"); - if (env != NULL) + if (env != nullptr) { sscanf(env, "%20d %20d %20d", &nsub[XX], &nsub[YY], &nsub[ZZ]); } @@ -659,7 +659,7 @@ void pmegrids_init(pmegrids_t *grids, n_base[ZZ] = nz_base; pmegrid_init(&grids->grid, 0, 0, 0, 0, 0, 0, n[XX], n[YY], n[ZZ], FALSE, pme_order, - NULL); + nullptr); grids->nthread = nthread; @@ -717,7 +717,7 @@ void pmegrids_init(pmegrids_t *grids, } else { - grids->grid_th = NULL; + grids->grid_th = nullptr; } snew(grids->g2t, DIM); @@ -752,7 +752,7 @@ void pmegrids_init(pmegrids_t *grids, { grids->nthread_comm[d]++; } - if (debug != NULL) + if (debug != nullptr) { fprintf(debug, "pmegrid thread grid communication range in %c: %d\n", 'x'+d, grids->nthread_comm[d]); @@ -769,7 +769,7 @@ void pmegrids_init(pmegrids_t *grids, void pmegrids_destroy(pmegrids_t *grids) { - if (grids->grid.grid != NULL) + if (grids->grid.grid != nullptr) { sfree_aligned(grids->grid.grid); @@ -857,7 +857,7 @@ void reuse_pmegrids(const pmegrids_t *oldgrid, pmegrids_t *newgrid) sfree_aligned(newgrid->grid.grid); newgrid->grid.grid = oldgrid->grid.grid; - if (newgrid->grid_th != NULL && newgrid->nthread == oldgrid->nthread) + if (newgrid->grid_th != nullptr && newgrid->nthread == oldgrid->nthread) { sfree_aligned(newgrid->grid_all); newgrid->grid_all = oldgrid->grid_all; diff --git a/src/gromacs/ewald/pme-load-balancing.cpp b/src/gromacs/ewald/pme-load-balancing.cpp index ed4e6e038d..a559a454fe 100644 --- a/src/gromacs/ewald/pme-load-balancing.cpp +++ b/src/gromacs/ewald/pme-load-balancing.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -150,7 +150,7 @@ struct pme_load_balancing_t { * read bActive anywhere */ bool pme_loadbal_is_active(const pme_load_balancing_t *pme_lb) { - return pme_lb != NULL && pme_lb->bActive; + return pme_lb != nullptr && pme_lb->bActive; } void pme_loadbal_init(pme_load_balancing_t **pme_lb_p, @@ -299,7 +299,7 @@ static gmx_bool pme_loadbal_increase_cutoff(pme_load_balancing_t *pme_lb, pme_lb->n++; srenew(pme_lb->setup, pme_lb->n); set = &pme_lb->setup[pme_lb->n-1]; - set->pmedata = NULL; + set->pmedata = nullptr; get_pme_nnodes(dd, &npmeranks_x, &npmeranks_y); @@ -320,7 +320,7 @@ static gmx_bool pme_loadbal_increase_cutoff(pme_load_balancing_t *pme_lb, fac *= 1.01; clear_ivec(set->grid); - sp = calc_grid(NULL, pme_lb->box_start, + sp = calc_grid(nullptr, pme_lb->box_start, fac*pme_lb->setup[pme_lb->cur].spacing, &set->grid[XX], &set->grid[YY], @@ -410,12 +410,12 @@ static void print_grid(FILE *fp_err, FILE *fp_log, pre, desc, set->grid[XX], set->grid[YY], set->grid[ZZ], set->rcut_coulomb, buft); - if (fp_err != NULL) + if (fp_err != nullptr) { fprintf(fp_err, "\r%s\n", buf); fflush(fp_err); } - if (fp_log != NULL) + if (fp_log != nullptr) { fprintf(fp_log, "%s\n", buf); } @@ -446,12 +446,12 @@ static void print_loadbal_limited(FILE *fp_err, FILE *fp_log, gmx_step_str(step, sbuf), pmelblim_str[pme_lb->elimited], pme_lb->setup[pme_loadbal_end(pme_lb)-1].rcut_coulomb); - if (fp_err != NULL) + if (fp_err != nullptr) { fprintf(fp_err, "\r%s\n", buf); fflush(fp_err); } - if (fp_log != NULL) + if (fp_log != nullptr) { fprintf(fp_log, "%s\n", buf); } @@ -790,7 +790,7 @@ pme_load_balance(pme_load_balancing_t *pme_lb, } /* We always re-initialize the tables whether they are used or not */ - init_interaction_const_tables(NULL, ic, rtab); + init_interaction_const_tables(nullptr, ic, rtab); nbnxn_gpu_pme_loadbal_update_param(nbv, ic); @@ -815,7 +815,7 @@ pme_load_balance(pme_load_balancing_t *pme_lb, if (!pme_lb->bSepPMERanks) { - if (pme_lb->setup[pme_lb->cur].pmedata == NULL) + if (pme_lb->setup[pme_lb->cur].pmedata == nullptr) { /* Generate a new PME data structure, * copying part of the old pointers. @@ -834,7 +834,7 @@ pme_load_balance(pme_load_balancing_t *pme_lb, if (debug) { - print_grid(NULL, debug, "", "switched to", set, -1); + print_grid(nullptr, debug, "", "switched to", set, -1); } if (pme_lb->stage == pme_lb->nstage) @@ -1001,7 +1001,7 @@ void pme_loadbal_do(pme_load_balancing_t *pme_lb, if (ir->eDispCorr != edispcNO) { - calc_enervirdiff(NULL, ir->eDispCorr, fr); + calc_enervirdiff(nullptr, ir->eDispCorr, fr); } } @@ -1100,7 +1100,7 @@ void pme_loadbal_done(pme_load_balancing_t *pme_lb, const gmx::MDLogger &mdlog, gmx_bool bNonBondedOnGPU) { - if (fplog != NULL && (pme_lb->cur > 0 || pme_lb->elimited != epmelblimNO)) + if (fplog != nullptr && (pme_lb->cur > 0 || pme_lb->elimited != epmelblimNO)) { print_pme_loadbal_settings(pme_lb, fplog, mdlog, bNonBondedOnGPU); } diff --git a/src/gromacs/ewald/pme-only.cpp b/src/gromacs/ewald/pme-only.cpp index 6d8c098435..66a7728b24 100644 --- a/src/gromacs/ewald/pme-only.cpp +++ b/src/gromacs/ewald/pme-only.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -112,7 +112,7 @@ static void gmx_pmeonly_switch(int *npmedata, struct gmx_pme_t ***pmedata, struct gmx_pme_t **pme_ret) { int ind; - struct gmx_pme_t *pme = NULL; + struct gmx_pme_t *pme = nullptr; ind = 0; while (ind < *npmedata) @@ -152,10 +152,10 @@ int gmx_pmeonly(struct gmx_pme_t *pme, int ret; int natoms; matrix box; - rvec *x_pp = NULL, *f_pp = NULL; - real *chargeA = NULL, *chargeB = NULL; - real *c6A = NULL, *c6B = NULL; - real *sigmaA = NULL, *sigmaB = NULL; + rvec *x_pp = nullptr, *f_pp = nullptr; + real *chargeA = nullptr, *chargeB = nullptr; + real *c6A = nullptr, *c6B = nullptr; + real *sigmaA = nullptr, *sigmaB = nullptr; real lambda_q = 0; real lambda_lj = 0; int maxshift_x = 0, maxshift_y = 0; diff --git a/src/gromacs/ewald/pme-pp.cpp b/src/gromacs/ewald/pme-pp.cpp index daa937b571..24819755e2 100644 --- a/src/gromacs/ewald/pme-pp.cpp +++ b/src/gromacs/ewald/pme-pp.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -234,7 +234,7 @@ static void gmx_pme_send_coeffs_coords(t_commrec *cr, unsigned int flags, if (dd->pme_receive_vir_ener) { /* Peer PP node: communicate all data */ - if (dd->cnb == NULL) + if (dd->cnb == nullptr) { snew(dd->cnb, 1); } @@ -352,7 +352,7 @@ void gmx_pme_send_parameters(t_commrec *cr, gmx_pme_send_coeffs_coords(cr, flags, chargeA, chargeB, sqrt_c6A, sqrt_c6B, sigmaA, sigmaB, - NULL, NULL, 0, 0, maxshift_x, maxshift_y, -1); + nullptr, nullptr, 0, 0, maxshift_x, maxshift_y, -1); } void gmx_pme_send_coordinates(t_commrec *cr, matrix box, rvec *x, @@ -365,7 +365,7 @@ void gmx_pme_send_coordinates(t_commrec *cr, matrix box, rvec *x, { flags |= PP_PME_ENER_VIR; } - gmx_pme_send_coeffs_coords(cr, flags, NULL, NULL, NULL, NULL, NULL, NULL, + gmx_pme_send_coeffs_coords(cr, flags, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, box, x, lambda_q, lambda_lj, 0, 0, step); } @@ -373,7 +373,7 @@ void gmx_pme_send_finish(t_commrec *cr) { unsigned int flags = PP_PME_FINISH; - gmx_pme_send_coeffs_coords(cr, flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, -1); + gmx_pme_send_coeffs_coords(cr, flags, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0, 0, -1); } void gmx_pme_send_switchgrid(t_commrec gmx_unused *cr, diff --git a/src/gromacs/ewald/pme-solve.cpp b/src/gromacs/ewald/pme-solve.cpp index 71553ad7a2..1df26a8aab 100644 --- a/src/gromacs/ewald/pme-solve.cpp +++ b/src/gromacs/ewald/pme-solve.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -160,7 +160,7 @@ void pme_free_all_work(struct pme_solve_work_t **work, int nthread) free_work(&(*work)[thread]); } sfree(*work); - *work = NULL; + *work = nullptr; } void get_pme_ener_vir_q(struct pme_solve_work_t *work, int nthread, diff --git a/src/gromacs/ewald/pme-spread.cpp b/src/gromacs/ewald/pme-spread.cpp index 5bb4be177b..477a249378 100644 --- a/src/gromacs/ewald/pme-spread.cpp +++ b/src/gromacs/ewald/pme-spread.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -69,9 +69,9 @@ static void calc_interpolation_idx(struct gmx_pme_t *pme, pme_atomcomm_t *atc, int nx, ny, nz; int *g2tx, *g2ty, *g2tz; gmx_bool bThreads; - int *thread_idx = NULL; - thread_plist_t *tpl = NULL; - int *tpl_n = NULL; + int *thread_idx = nullptr; + thread_plist_t *tpl = nullptr; + int *tpl_n = nullptr; int thread_i; nx = pme->nkx; @@ -466,7 +466,7 @@ reduce_threadgrid_overlap(struct gmx_pme_t *pme, int thread_f; const pmegrid_t *pmegrid, *pmegrid_g, *pmegrid_f; const real *grid_th; - real *commbuf = NULL; + real *commbuf = nullptr; gmx_parallel_3dfft_real_limits(pme->pfft_setup[grid_index], local_fft_ndata, @@ -755,7 +755,7 @@ static void sum_fftgrid_dd(struct gmx_pme_t *pme, real *fftgrid, int grid_index) sendptr = overlap->sendbuf + send_index0*local_fft_ndata[ZZ]; recvptr = overlap->recvbuf; - if (debug != NULL) + if (debug != nullptr) { fprintf(debug, "PME fftgrid comm y %2d x %2d x %2d\n", local_fft_ndata[XX], send_nindex, local_fft_ndata[ZZ]); @@ -821,7 +821,7 @@ static void sum_fftgrid_dd(struct gmx_pme_t *pme, real *fftgrid, int grid_index) recvptr = overlap->recvbuf; - if (debug != NULL) + if (debug != nullptr) { fprintf(debug, "PME fftgrid comm x %2d x %2d x %2d\n", send_nindex, local_fft_ndata[YY], local_fft_ndata[ZZ]); @@ -907,10 +907,10 @@ void spread_on_grid(struct gmx_pme_t *pme, try { splinedata_t *spline; - pmegrid_t *grid = NULL; + pmegrid_t *grid = nullptr; /* make local bsplines */ - if (grids == NULL || !pme->bUseThreads) + if (grids == nullptr || !pme->bUseThreads) { spline = &atc->spline[0]; diff --git a/src/gromacs/ewald/pme.cpp b/src/gromacs/ewald/pme.cpp index e5dea7d8c4..b66892b8f5 100644 --- a/src/gromacs/ewald/pme.cpp +++ b/src/gromacs/ewald/pme.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -466,7 +466,7 @@ void gmx_pme_check_restrictions(int pme_order, nkx/(double)nnodes_major, pme_order); } - if (bValidSettings != NULL) + if (bValidSettings != nullptr) { *bValidSettings = TRUE; } @@ -493,7 +493,7 @@ int gmx_pme_init(struct gmx_pme_t **pmedata, real ewaldcoeff_lj, int nthread) { - struct gmx_pme_t *pme = NULL; + struct gmx_pme_t *pme = nullptr; int use_threads, sum_use_threads, i; ivec ndata; @@ -504,8 +504,8 @@ int gmx_pme_init(struct gmx_pme_t **pmedata, } snew(pme, 1); - pme->sum_qgrid_tmp = NULL; - pme->sum_qgrid_dd_tmp = NULL; + pme->sum_qgrid_tmp = nullptr; + pme->sum_qgrid_dd_tmp = nullptr; pme->buf_nalloc = 0; pme->nnodes = 1; @@ -629,7 +629,7 @@ int gmx_pme_init(struct gmx_pme_t **pmedata, pme->nkx = ir->nkx; pme->nky = ir->nky; pme->nkz = ir->nkz; - pme->bP3M = (ir->coulombtype == eelP3M_AD || getenv("GMX_PME_P3M") != NULL); + pme->bP3M = (ir->coulombtype == eelP3M_AD || getenv("GMX_PME_P3M") != nullptr); pme->pme_order = ir->pme_order; pme->ewaldcoeff_q = ewaldcoeff_q; pme->ewaldcoeff_lj = ewaldcoeff_lj; @@ -647,7 +647,7 @@ int gmx_pme_init(struct gmx_pme_t **pmedata, pme->nnodes_minor, pme->bUseThreads, TRUE, - NULL); + nullptr); if (pme->nnodes > 1) { @@ -814,8 +814,8 @@ int gmx_pme_init(struct gmx_pme_t **pmedata, pme_realloc_atomcomm_things(&pme->atc[0]); } - pme->lb_buf1 = NULL; - pme->lb_buf2 = NULL; + pme->lb_buf1 = nullptr; + pme->lb_buf2 = nullptr; pme->lb_buf_nalloc = 0; pme_init_all_work(&pme->solve_work, pme->nthread, pme->nkx); @@ -880,7 +880,7 @@ void gmx_pme_calc_energy(struct gmx_pme_t *pme, int n, rvec *x, real *q, real *V atc = &pme->atc_energy; atc->nthread = 1; - if (atc->spline == NULL) + if (atc->spline == nullptr) { snew(atc->spline, atc->nthread); } @@ -896,7 +896,7 @@ void gmx_pme_calc_energy(struct gmx_pme_t *pme, int n, rvec *x, real *q, real *V grid = &pme->pmegrid[PME_GRID_QA]; /* Only calculate the spline coefficients, don't actually spread */ - spread_on_grid(pme, atc, NULL, TRUE, FALSE, pme->fftgrid[PME_GRID_QA], FALSE, PME_GRID_QA); + spread_on_grid(pme, atc, nullptr, TRUE, FALSE, pme->fftgrid[PME_GRID_QA], FALSE, PME_GRID_QA); *V = gather_energy_bsplines(pme, grid->grid.grid, atc); } @@ -945,11 +945,11 @@ int gmx_pme_do(struct gmx_pme_t *pme, { int d, i, j, npme, grid_index, max_grid_index; int n_d; - pme_atomcomm_t *atc = NULL; - pmegrids_t *pmegrid = NULL; - real *grid = NULL; + pme_atomcomm_t *atc = nullptr; + pmegrids_t *pmegrid = nullptr; + real *grid = nullptr; rvec *f_d; - real *coefficient = NULL; + real *coefficient = nullptr; real energy_AB[4]; matrix vir_AB[4]; real scale, lambda; @@ -1054,7 +1054,7 @@ int gmx_pme_do(struct gmx_pme_t *pme, fprintf(debug, "PME: number of ranks = %d, rank = %d\n", cr->nnodes, cr->nodeid); fprintf(debug, "Grid = %p\n", (void*)grid); - if (grid == NULL) + if (grid == nullptr) { gmx_fatal(FARGS, "No grid!"); } @@ -1285,10 +1285,10 @@ int gmx_pme_do(struct gmx_pme_t *pme, /* Loop over A- and B-state if we are doing FEP */ for (fep_state = 0; fep_state < fep_states_lj; ++fep_state) { - real *local_c6 = NULL, *local_sigma = NULL, *RedistC6 = NULL, *RedistSigma = NULL; + real *local_c6 = nullptr, *local_sigma = nullptr, *RedistC6 = nullptr, *RedistSigma = nullptr; if (pme->nnodes == 1) { - if (pme->lb_buf1 == NULL) + if (pme->lb_buf1 == nullptr) { pme->lb_buf_nalloc = pme->atc[0].n; snew(pme->lb_buf1, pme->lb_buf_nalloc); @@ -1675,7 +1675,7 @@ int gmx_pme_destroy(struct gmx_pme_t **pmedata) sfree(pme->sum_qgrid_dd_tmp); sfree(*pmedata); - *pmedata = NULL; + *pmedata = nullptr; return 0; } diff --git a/src/gromacs/fft/calcgrid.cpp b/src/gromacs/fft/calcgrid.cpp index 8a32f6ef52..5e826ada89 100644 --- a/src/gromacs/fft/calcgrid.cpp +++ b/src/gromacs/fft/calcgrid.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -107,7 +107,7 @@ real calc_grid(FILE *fp, const matrix box, real gr_sp, if ((*nx <= 0) || (*ny <= 0) || (*nz <= 0)) { - if (NULL != fp) + if (nullptr != fp) { fprintf(fp, "Calculating fourier grid dimensions for%s%s%s\n", *nx > 0 ? "" : " X", *ny > 0 ? "" : " Y", *nz > 0 ? "" : " Z"); @@ -162,7 +162,7 @@ real calc_grid(FILE *fp, const matrix box, real gr_sp, *nx = n[XX]; *ny = n[YY]; *nz = n[ZZ]; - if (NULL != fp) + if (nullptr != fp) { fprintf(fp, "Using a fourier grid of %dx%dx%d, spacing %.3f %.3f %.3f\n", *nx, *ny, *nz, spacing[XX], spacing[YY], spacing[ZZ]); diff --git a/src/gromacs/fft/fft.cpp b/src/gromacs/fft/fft.cpp index 9ead1601ff..53434e6453 100644 --- a/src/gromacs/fft/fft.cpp +++ b/src/gromacs/fft/fft.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2003 Erik Lindahl, David van der Spoel, University of Groningen. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -70,14 +70,14 @@ gmx_fft_init_many_1d(gmx_fft_t * pfft, gmx_fft_flag flags) { gmx_many_fft_t fft; - if (pfft == NULL) + if (pfft == nullptr) { gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer."); return EINVAL; } - *pfft = NULL; + *pfft = nullptr; - if ( (fft = (gmx_many_fft_t)malloc(sizeof(struct gmx_many_fft))) == NULL) + if ( (fft = (gmx_many_fft_t)malloc(sizeof(struct gmx_many_fft))) == nullptr) { return ENOMEM; } @@ -97,14 +97,14 @@ gmx_fft_init_many_1d_real(gmx_fft_t * pfft, gmx_fft_flag flags) { gmx_many_fft_t fft; - if (pfft == NULL) + if (pfft == nullptr) { gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer."); return EINVAL; } - *pfft = NULL; + *pfft = nullptr; - if ( (fft = (gmx_many_fft_t)malloc(sizeof(struct gmx_many_fft))) == NULL) + if ( (fft = (gmx_many_fft_t)malloc(sizeof(struct gmx_many_fft))) == nullptr) { return ENOMEM; } @@ -164,9 +164,9 @@ void gmx_many_fft_destroy(gmx_fft_t fft) { gmx_many_fft_t mfft = (gmx_many_fft_t)fft; - if (mfft != NULL) + if (mfft != nullptr) { - if (mfft->fft != NULL) + if (mfft->fft != nullptr) { gmx_fft_destroy(mfft->fft); } diff --git a/src/gromacs/fft/fft5d.cpp b/src/gromacs/fft/fft5d.cpp index 471f57c25b..d57cc2cc8e 100644 --- a/src/gromacs/fft/fft5d.cpp +++ b/src/gromacs/fft/fft5d.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -174,11 +174,11 @@ fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_ int P[2], bMaster, prank[2], i, t; int rNG, rMG, rKG; - int *N0 = 0, *N1 = 0, *M0 = 0, *M1 = 0, *K0 = 0, *K1 = 0, *oN0 = 0, *oN1 = 0, *oM0 = 0, *oM1 = 0, *oK0 = 0, *oK1 = 0; - int N[3], M[3], K[3], pN[3], pM[3], pK[3], oM[3], oK[3], *iNin[3] = {0}, *oNin[3] = {0}, *iNout[3] = {0}, *oNout[3] = {0}; + int *N0 = nullptr, *N1 = nullptr, *M0 = nullptr, *M1 = nullptr, *K0 = nullptr, *K1 = nullptr, *oN0 = nullptr, *oN1 = nullptr, *oM0 = nullptr, *oM1 = nullptr, *oK0 = nullptr, *oK1 = nullptr; + int N[3], M[3], K[3], pN[3], pM[3], pK[3], oM[3], oK[3], *iNin[3] = {nullptr}, *oNin[3] = {nullptr}, *iNout[3] = {nullptr}, *oNout[3] = {nullptr}; int C[3], rC[3], nP[2]; int lsize; - t_complex *lin = 0, *lout = 0, *lout2 = 0, *lout3 = 0; + t_complex *lin = nullptr, *lout = nullptr, *lout2 = nullptr, *lout3 = nullptr; fft5d_plan plan; int s; @@ -239,7 +239,7 @@ fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_ { printf("FFT5D: FATAL: Datasize cannot be zero in any dimension\n"); } - return 0; + return nullptr; } rNG = NG; rMG = MG; rKG = KG; @@ -556,21 +556,21 @@ fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_ if ((flags&FFT5D_REALCOMPLEX) && !(flags&FFT5D_BACKWARD)) { plan->p3d = FFTW(plan_guru_dft_r2c)(/*rank*/ 3, dims, - /*howmany*/ 0, /*howmany_dims*/ 0, + /*howmany*/ 0, /*howmany_dims*/ nullptr, (real*)lin, (FFTW(complex) *) lout, /*flags*/ fftwflags); } else if ((flags&FFT5D_REALCOMPLEX) && (flags&FFT5D_BACKWARD)) { plan->p3d = FFTW(plan_guru_dft_c2r)(/*rank*/ 3, dims, - /*howmany*/ 0, /*howmany_dims*/ 0, + /*howmany*/ 0, /*howmany_dims*/ nullptr, (FFTW(complex) *) lin, (real*)lout, /*flags*/ fftwflags); } else { plan->p3d = FFTW(plan_guru_dft)(/*rank*/ 3, dims, - /*howmany*/ 0, /*howmany_dims*/ 0, + /*howmany*/ 0, /*howmany_dims*/ nullptr, (FFTW(complex) *) lin, (FFTW(complex) *) lout, /*sign*/ (flags&FFT5D_BACKWARD) ? 1 : -1, /*flags*/ fftwflags); } @@ -1264,22 +1264,22 @@ void fft5d_destroy(fft5d_plan plan) if (plan->iNin[s]) { free(plan->iNin[s]); - plan->iNin[s] = 0; + plan->iNin[s] = nullptr; } if (plan->oNin[s]) { free(plan->oNin[s]); - plan->oNin[s] = 0; + plan->oNin[s] = nullptr; } if (plan->iNout[s]) { free(plan->iNout[s]); - plan->iNout[s] = 0; + plan->iNout[s] = nullptr; } if (plan->oNout[s]) { free(plan->oNout[s]); - plan->oNout[s] = 0; + plan->oNout[s] = nullptr; } } #if GMX_FFT_FFTW3 @@ -1334,7 +1334,7 @@ void fft5d_local_size(fft5d_plan plan, int* N1, int* M0, int* K0, int* K1, int** of processor dimensions*/ fft5d_plan fft5d_plan_3d_cart(int NG, int MG, int KG, MPI_Comm comm, int P0, int flags, t_complex** rlin, t_complex** rlout, t_complex** rlout2, t_complex** rlout3, int nthreads) { - MPI_Comm cart[2] = {0}; + MPI_Comm cart[2] = {MPI_COMM_NULL, MPI_COMM_NULL}; #if GMX_MPI int size = 1, prank = 0; int P[2]; diff --git a/src/gromacs/fft/fft_fftpack.cpp b/src/gromacs/fft/fft_fftpack.cpp index 9a55150b6f..9f4ab9ec53 100644 --- a/src/gromacs/fft/fft_fftpack.cpp +++ b/src/gromacs/fft/fft_fftpack.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2003 David van der Spoel, Erik Lindahl, University of Groningen. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -81,23 +81,23 @@ gmx_fft_init_1d(gmx_fft_t * pfft, { gmx_fft_t fft; - if (pfft == NULL) + if (pfft == nullptr) { gmx_fatal(FARGS, "Invalid FFT opaque type pointer."); return EINVAL; } - *pfft = NULL; + *pfft = nullptr; - if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == NULL) + if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr) { return ENOMEM; } - fft->next = NULL; + fft->next = nullptr; fft->n = nx; /* Need 4*n storage for 1D complex FFT */ - if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx))) == NULL) + if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx))) == nullptr) { free(fft); return ENOMEM; @@ -121,23 +121,23 @@ gmx_fft_init_1d_real(gmx_fft_t * pfft, { gmx_fft_t fft; - if (pfft == NULL) + if (pfft == nullptr) { gmx_fatal(FARGS, "Invalid FFT opaque type pointer."); return EINVAL; } - *pfft = NULL; + *pfft = nullptr; - if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == NULL) + if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr) { return ENOMEM; } - fft->next = NULL; + fft->next = nullptr; fft->n = nx; /* Need 2*n storage for 1D real FFT */ - if ((fft->work = (real *)malloc(sizeof(real)*(2*nx))) == NULL) + if ((fft->work = (real *)malloc(sizeof(real)*(2*nx))) == nullptr) { free(fft); return ENOMEM; @@ -162,15 +162,15 @@ gmx_fft_init_2d_real(gmx_fft_t * pfft, int nyc = (ny/2 + 1); int rc; - if (pfft == NULL) + if (pfft == nullptr) { gmx_fatal(FARGS, "Invalid FFT opaque type pointer."); return EINVAL; } - *pfft = NULL; + *pfft = nullptr; /* Create the X transform */ - if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == NULL) + if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr) { return ENOMEM; } @@ -180,7 +180,7 @@ gmx_fft_init_2d_real(gmx_fft_t * pfft, /* Need 4*nx storage for 1D complex FFT, and another * 2*nx*nyc elements for complex-to-real storage in our high-level routine. */ - if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx+2*nx*nyc))) == NULL) + if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx+2*nx*nyc))) == nullptr) { free(fft); return ENOMEM; @@ -480,10 +480,10 @@ gmx_fft_2d_real (gmx_fft_t fft, void gmx_fft_destroy(gmx_fft_t fft) { - if (fft != NULL) + if (fft != nullptr) { free(fft->work); - if (fft->next != NULL) + if (fft->next != nullptr) { gmx_fft_destroy(fft->next); } diff --git a/src/gromacs/fft/fft_fftw3.cpp b/src/gromacs/fft/fft_fftw3.cpp index e1087d0360..b8eceda133 100644 --- a/src/gromacs/fft/fft_fftw3.cpp +++ b/src/gromacs/fft/fft_fftw3.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2003 David van der Spoel, Erik Lindahl, University of Groningen. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -120,15 +120,15 @@ gmx_fft_init_many_1d(gmx_fft_t * pfft, fftw_flags = (flags & GMX_FFT_FLAG_CONSERVATIVE) ? FFTW_ESTIMATE : FFTW_MEASURE; - if (pfft == NULL) + if (pfft == nullptr) { gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer."); return EINVAL; } - *pfft = NULL; + *pfft = nullptr; FFTW_LOCK; - if ( (fft = (gmx_fft_t)FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == NULL) + if ( (fft = (gmx_fft_t)FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == nullptr) { FFTW_UNLOCK; return ENOMEM; @@ -136,7 +136,7 @@ gmx_fft_init_many_1d(gmx_fft_t * pfft, /* allocate aligned, and extra memory to make it unaligned */ p1 = (FFTWPREFIX(complex) *) FFTWPREFIX(malloc)(sizeof(FFTWPREFIX(complex))*(nx+2)*howmany); - if (p1 == NULL) + if (p1 == nullptr) { FFTWPREFIX(free)(fft); FFTW_UNLOCK; @@ -144,7 +144,7 @@ gmx_fft_init_many_1d(gmx_fft_t * pfft, } p2 = (FFTWPREFIX(complex) *) FFTWPREFIX(malloc)(sizeof(FFTWPREFIX(complex))*(nx+2)*howmany); - if (p2 == NULL) + if (p2 == nullptr) { FFTWPREFIX(free)(p1); FFTWPREFIX(free)(fft); @@ -185,7 +185,7 @@ gmx_fft_init_many_1d(gmx_fft_t * pfft, { for (k = 0; k < 2; k++) { - if (fft->plan[i][j][k] == NULL) + if (fft->plan[i][j][k] == nullptr) { gmx_fatal(FARGS, "Error initializing FFTW3 plan."); FFTW_UNLOCK; @@ -237,15 +237,15 @@ gmx_fft_init_many_1d_real(gmx_fft_t * pfft, fftw_flags = (flags & GMX_FFT_FLAG_CONSERVATIVE) ? FFTW_ESTIMATE : FFTW_MEASURE; - if (pfft == NULL) + if (pfft == nullptr) { gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer."); return EINVAL; } - *pfft = NULL; + *pfft = nullptr; FFTW_LOCK; - if ( (fft = (gmx_fft_t) FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == NULL) + if ( (fft = (gmx_fft_t) FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == nullptr) { FFTW_UNLOCK; return ENOMEM; @@ -253,7 +253,7 @@ gmx_fft_init_many_1d_real(gmx_fft_t * pfft, /* allocate aligned, and extra memory to make it unaligned */ p1 = (real *) FFTWPREFIX(malloc)(sizeof(real)*(nx/2+1)*2*howmany + 8); - if (p1 == NULL) + if (p1 == nullptr) { FFTWPREFIX(free)(fft); FFTW_UNLOCK; @@ -261,7 +261,7 @@ gmx_fft_init_many_1d_real(gmx_fft_t * pfft, } p2 = (real *) FFTWPREFIX(malloc)(sizeof(real)*(nx/2+1)*2*howmany + 8); - if (p2 == NULL) + if (p2 == nullptr) { FFTWPREFIX(free)(p1); FFTWPREFIX(free)(fft); @@ -287,15 +287,15 @@ gmx_fft_init_many_1d_real(gmx_fft_t * pfft, fftw_complex *out, const int *onembed, int ostride, int odist, unsigned flag */ - fft->plan[0][0][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, up1, 0, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) up2, 0, 1, (nx/2+1), fftw_flags); - fft->plan[0][1][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, up1, 0, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) up1, 0, 1, (nx/2+1), fftw_flags); - fft->plan[1][0][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, p1, 0, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) p2, 0, 1, (nx/2+1), fftw_flags); - fft->plan[1][1][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, p1, 0, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) p1, 0, 1, (nx/2+1), fftw_flags); + fft->plan[0][0][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, up1, nullptr, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) up2, nullptr, 1, (nx/2+1), fftw_flags); + fft->plan[0][1][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, up1, nullptr, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) up1, nullptr, 1, (nx/2+1), fftw_flags); + fft->plan[1][0][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, p1, nullptr, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) p2, nullptr, 1, (nx/2+1), fftw_flags); + fft->plan[1][1][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, p1, nullptr, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) p1, nullptr, 1, (nx/2+1), fftw_flags); - fft->plan[0][0][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) up1, 0, 1, (nx/2+1), up2, 0, 1, (nx/2+1) *2, fftw_flags); - fft->plan[0][1][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) up1, 0, 1, (nx/2+1), up1, 0, 1, (nx/2+1) *2, fftw_flags); - fft->plan[1][0][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) p1, 0, 1, (nx/2+1), p2, 0, 1, (nx/2+1) *2, fftw_flags); - fft->plan[1][1][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) p1, 0, 1, (nx/2+1), p1, 0, 1, (nx/2+1) *2, fftw_flags); + fft->plan[0][0][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) up1, nullptr, 1, (nx/2+1), up2, nullptr, 1, (nx/2+1) *2, fftw_flags); + fft->plan[0][1][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) up1, nullptr, 1, (nx/2+1), up1, nullptr, 1, (nx/2+1) *2, fftw_flags); + fft->plan[1][0][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) p1, nullptr, 1, (nx/2+1), p2, nullptr, 1, (nx/2+1) *2, fftw_flags); + fft->plan[1][1][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) p1, nullptr, 1, (nx/2+1), p1, nullptr, 1, (nx/2+1) *2, fftw_flags); for (i = 0; i < 2; i++) { @@ -303,7 +303,7 @@ gmx_fft_init_many_1d_real(gmx_fft_t * pfft, { for (k = 0; k < 2; k++) { - if (fft->plan[i][j][k] == NULL) + if (fft->plan[i][j][k] == nullptr) { gmx_fatal(FARGS, "Error initializing FFTW3 plan."); FFTW_UNLOCK; @@ -348,15 +348,15 @@ gmx_fft_init_2d_real(gmx_fft_t * pfft, fftw_flags = (flags & GMX_FFT_FLAG_CONSERVATIVE) ? FFTW_ESTIMATE : FFTW_MEASURE; - if (pfft == NULL) + if (pfft == nullptr) { gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer."); return EINVAL; } - *pfft = NULL; + *pfft = nullptr; FFTW_LOCK; - if ( (fft = (gmx_fft_t) FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == NULL) + if ( (fft = (gmx_fft_t) FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == nullptr) { FFTW_UNLOCK; return ENOMEM; @@ -364,7 +364,7 @@ gmx_fft_init_2d_real(gmx_fft_t * pfft, /* allocate aligned, and extra memory to make it unaligned */ p1 = (real *) FFTWPREFIX(malloc)(sizeof(real) *( nx*(ny/2+1)*2 + 2) ); - if (p1 == NULL) + if (p1 == nullptr) { FFTWPREFIX(free)(fft); FFTW_UNLOCK; @@ -372,7 +372,7 @@ gmx_fft_init_2d_real(gmx_fft_t * pfft, } p2 = (real *) FFTWPREFIX(malloc)(sizeof(real) *( nx*(ny/2+1)*2 + 2) ); - if (p2 == NULL) + if (p2 == nullptr) { FFTWPREFIX(free)(p1); FFTWPREFIX(free)(fft); @@ -410,7 +410,7 @@ gmx_fft_init_2d_real(gmx_fft_t * pfft, { for (k = 0; k < 2; k++) { - if (fft->plan[i][j][k] == NULL) + if (fft->plan[i][j][k] == nullptr) { gmx_fatal(FARGS, "Error initializing FFTW3 plan."); FFTW_UNLOCK; @@ -551,7 +551,7 @@ gmx_fft_destroy(gmx_fft_t fft) { int i, j, k; - if (fft != NULL) + if (fft != nullptr) { for (i = 0; i < 2; i++) { @@ -559,12 +559,12 @@ gmx_fft_destroy(gmx_fft_t fft) { for (k = 0; k < 2; k++) { - if (fft->plan[i][j][k] != NULL) + if (fft->plan[i][j][k] != nullptr) { FFTW_LOCK; FFTWPREFIX(destroy_plan)(fft->plan[i][j][k]); FFTW_UNLOCK; - fft->plan[i][j][k] = NULL; + fft->plan[i][j][k] = nullptr; } } } diff --git a/src/gromacs/fft/parallel_3dfft.cpp b/src/gromacs/fft/parallel_3dfft.cpp index 3c04fb24fc..618be1c3aa 100644 --- a/src/gromacs/fft/parallel_3dfft.cpp +++ b/src/gromacs/fft/parallel_3dfft.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2005 David van der Spoel, Erik Lindahl, University of Groningen. - * Copyright (c) 2013,2014, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -87,7 +87,7 @@ gmx_parallel_3dfft_init (gmx_parallel_3dfft_t * pfft_setup, (*pfft_setup)->p2 = fft5d_plan_3d(Nb, Mb, Kb, rcomm, (flags|FFT5D_BACKWARD|FFT5D_NOMALLOC)^FFT5D_ORDER_YZ, complex_data, (t_complex**)real_data, &buf1, &buf2, nthreads); - return (*pfft_setup)->p1 != 0 && (*pfft_setup)->p2 != 0; + return (*pfft_setup)->p1 != nullptr && (*pfft_setup)->p2 != nullptr; } diff --git a/src/gromacs/fft/tests/fft.cpp b/src/gromacs/fft/tests/fft.cpp index ca0b6d273b..3b9dd87ee2 100644 --- a/src/gromacs/fft/tests/fft.cpp +++ b/src/gromacs/fft/tests/fft.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -118,7 +118,7 @@ class BaseFFTTest : public ::testing::Test class FFTTest : public BaseFFTTest { public: - FFTTest() : fft_(NULL) + FFTTest() : fft_(nullptr) { } ~FFTTest() @@ -134,7 +134,7 @@ class FFTTest : public BaseFFTTest class ManyFFTTest : public BaseFFTTest { public: - ManyFFTTest() : fft_(NULL) + ManyFFTTest() : fft_(nullptr) { } ~ManyFFTTest() @@ -158,7 +158,7 @@ class FFTTest1D : public FFTTest, public ::testing::WithParamInterface class FFFTest3D : public BaseFFTTest { public: - FFFTest3D() : fft_(NULL) + FFFTest3D() : fft_(nullptr) { } ~FFFTest3D() @@ -301,7 +301,7 @@ TEST_F(FFFTest3D, Real5_6_9) std::copy(inputdata, inputdata+sizeInReals, in_.begin()); // Use memcpy to convert to t_complex easily memcpy(rdata, in_.data(), sizeInBytes); - gmx_parallel_3dfft_execute(fft_, GMX_FFT_REAL_TO_COMPLEX, 0, NULL); + gmx_parallel_3dfft_execute(fft_, GMX_FFT_REAL_TO_COMPLEX, 0, nullptr); //TODO use std::complex and add checkComplex for it checker_.checkSequenceArray(size*2, reinterpret_cast(cdata), "forward"); @@ -310,7 +310,7 @@ TEST_F(FFFTest3D, Real5_6_9) std::copy(inputdata, inputdata+sizeInReals, in_.begin()); // Use memcpy to convert to t_complex easily memcpy(cdata, in_.data(), sizeInBytes); - gmx_parallel_3dfft_execute(fft_, GMX_FFT_COMPLEX_TO_REAL, 0, NULL); + gmx_parallel_3dfft_execute(fft_, GMX_FFT_COMPLEX_TO_REAL, 0, nullptr); for (int i = 0; i < ndata[0]*ndata[1]; i++) //check sequence but skip unused data { checker_.checkSequenceArray(ndata[2], rdata+i*rsize[2], diff --git a/src/gromacs/fileio/checkpoint.cpp b/src/gromacs/fileio/checkpoint.cpp index 4530329127..23f037fcad 100644 --- a/src/gromacs/fileio/checkpoint.cpp +++ b/src/gromacs/fileio/checkpoint.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -180,7 +180,7 @@ static const char *entryName(StatePart part, int ecpt) case StatePart::freeEnergyHistory: return edfh_names[ecpt]; } - return NULL; + return nullptr; } static void cp_warning(FILE *fp) @@ -376,7 +376,7 @@ static inline xdrproc_t xdrProc(int xdrType) default: GMX_RELEASE_ASSERT(false, "XDR data type not implemented"); } - return NULL; + return nullptr; } /*! \brief Lists or only reads an xdr vector from checkpoint file @@ -395,7 +395,7 @@ static bool_t listXdrVector(XDR *xd, StatePart part, int ecpt, int nf, int xdrTy std::vector data(nf*elemSize); res = xdr_vector(xd, data.data(), nf, elemSize, xdrProc(xdrType)); - if (list != NULL) + if (list != nullptr) { switch (xdrType) { @@ -485,23 +485,23 @@ static int doVectorLow(XDR *xd, StatePart part, int ecpt, int sflags, T **v, std::vector *vector, FILE *list, CptElementType cptElementType) { - GMX_RELEASE_ASSERT(list != NULL || (v != NULL && vector == NULL) || (v == NULL && vector != NULL), "Without list, we should have exactly one of v and vector != NULL"); + GMX_RELEASE_ASSERT(list != nullptr || (v != nullptr && vector == nullptr) || (v == nullptr && vector != nullptr), "Without list, we should have exactly one of v and vector != NULL"); bool_t res = 0; int numElemInTheFile; - if (list == NULL) + if (list == nullptr) { if (nval >= 0) { - GMX_RELEASE_ASSERT(nptr == NULL, "With nval>=0 we should have nptr==NULL"); + GMX_RELEASE_ASSERT(nptr == nullptr, "With nval>=0 we should have nptr==NULL"); numElemInTheFile = nval; } else { - if (v != NULL) + if (v != nullptr) { - GMX_RELEASE_ASSERT(nptr != NULL, "With nval<0 we should have nptr!=NULL"); + GMX_RELEASE_ASSERT(nptr != nullptr, "With nval<0 we should have nptr!=NULL"); // cppcheck-suppress nullPointer numElemInTheFile = *nptr; } @@ -526,7 +526,7 @@ static int doVectorLow(XDR *xd, StatePart part, int ecpt, int sflags, return -1; } - if (list == NULL && (sflags & (1 << ecpt))) + if (list == nullptr && (sflags & (1 << ecpt))) { if (nval >= 0) { @@ -535,7 +535,7 @@ static int doVectorLow(XDR *xd, StatePart part, int ecpt, int sflags, gmx_fatal(FARGS, "Count mismatch for state entry %s, code count is %d, file count is %d\n", entryName(part, ecpt), nval, numElemInTheFile); } } - else if (nptr != NULL) + else if (nptr != nullptr) { *nptr = numElemInTheFile; } @@ -559,9 +559,9 @@ static int doVectorLow(XDR *xd, StatePart part, int ecpt, int sflags, } T *vp; - if (v != NULL) + if (v != nullptr) { - if (*v == NULL) + if (*v == nullptr) { snew(*v, numElemInTheFile); } @@ -623,7 +623,7 @@ template static int doVector(XDR *xd, StatePart part, int ecpt, int sflags, std::vector *vector, FILE *list) { - return doVectorLow(xd, part, ecpt, sflags, -1, NULL, NULL, vector, list, CptElementType::real); + return doVectorLow(xd, part, ecpt, sflags, -1, nullptr, nullptr, vector, list, CptElementType::real); } //! \brief Read/Write an std::vector, on read checks the number of elements matches \p numElements @@ -631,7 +631,7 @@ template static int doVector(XDR *xd, StatePart part, int ecpt, int sflags, int numElements, std::vector *vector, FILE *list) { - return doVectorLow(xd, part, ecpt, sflags, numElements, NULL, NULL, vector, list, CptElementType::real); + return doVectorLow(xd, part, ecpt, sflags, numElements, nullptr, nullptr, vector, list, CptElementType::real); } //! \brief Read/Write a PaddedRVecVector, on read checks the number of elements matches \p numElements @@ -640,7 +640,7 @@ static int doPaddedVector(XDR *xd, StatePart part, int ecpt, int sflags, { rvec *v_rvec; - if (list == NULL && (sflags & (1 << ecpt))) + if (list == nullptr && (sflags & (1 << ecpt))) { /* We resize the vector here to avoid pointer reallocation in * do_cpte_reals_low. Note the we allocate 1 element extra for SIMD. @@ -650,11 +650,11 @@ static int doPaddedVector(XDR *xd, StatePart part, int ecpt, int sflags, } else { - v_rvec = NULL; + v_rvec = nullptr; } return doVectorLow(xd, part, ecpt, sflags, - numElements*DIM, NULL, (real **)(&v_rvec), NULL, + numElements*DIM, nullptr, (real **)(&v_rvec), nullptr, list, CptElementType::real3); } @@ -665,7 +665,7 @@ static int doPaddedVector(XDR *xd, StatePart part, int ecpt, int sflags, static int do_cpte_reals(XDR *xd, StatePart part, int ecpt, int sflags, int n, real **v, FILE *list) { - return doVectorLow(xd, part, ecpt, sflags, n, NULL, v, NULL, list, CptElementType::real); + return doVectorLow(xd, part, ecpt, sflags, n, nullptr, v, nullptr, list, CptElementType::real); } /* This function does the same as do_cpte_reals, @@ -675,19 +675,19 @@ static int do_cpte_reals(XDR *xd, StatePart part, int ecpt, int sflags, static int do_cpte_n_reals(XDR *xd, StatePart part, int ecpt, int sflags, int *n, real **v, FILE *list) { - return doVectorLow(xd, part, ecpt, sflags, -1, n, v, NULL, list, CptElementType::real); + return doVectorLow(xd, part, ecpt, sflags, -1, n, v, nullptr, list, CptElementType::real); } static int do_cpte_real(XDR *xd, StatePart part, int ecpt, int sflags, real *r, FILE *list) { - return doVectorLow(xd, part, ecpt, sflags, 1, NULL, &r, NULL, list, CptElementType::real); + return doVectorLow(xd, part, ecpt, sflags, 1, nullptr, &r, nullptr, list, CptElementType::real); } static int do_cpte_ints(XDR *xd, StatePart part, int ecpt, int sflags, int n, int **v, FILE *list) { - return doVectorLow(xd, part, ecpt, sflags, n, NULL, v, NULL, list, CptElementType::integer); + return doVectorLow(xd, part, ecpt, sflags, n, nullptr, v, nullptr, list, CptElementType::integer); } static int do_cpte_int(XDR *xd, StatePart part, int ecpt, int sflags, @@ -699,7 +699,7 @@ static int do_cpte_int(XDR *xd, StatePart part, int ecpt, int sflags, static int do_cpte_doubles(XDR *xd, StatePart part, int ecpt, int sflags, int n, double **v, FILE *list) { - return doVectorLow(xd, part, ecpt, sflags, n, NULL, v, NULL, list, CptElementType::real); + return doVectorLow(xd, part, ecpt, sflags, n, nullptr, v, nullptr, list, CptElementType::real); } static int do_cpte_double(XDR *xd, StatePart part, int ecpt, int sflags, @@ -716,7 +716,7 @@ static int do_cpte_matrix(XDR *xd, StatePart part, int ecpt, int sflags, vr = &(v[0][0]); ret = doVectorLow(xd, part, ecpt, sflags, - DIM*DIM, NULL, &vr, NULL, NULL, CptElementType::matrix3x3); + DIM*DIM, nullptr, &vr, nullptr, nullptr, CptElementType::matrix3x3); if (list && ret == 0) { @@ -735,13 +735,13 @@ static int do_cpte_nmatrix(XDR *xd, StatePart part, int ecpt, int sflags, char name[CPTSTRLEN]; ret = 0; - if (v == NULL) + if (v == nullptr) { snew(v, n); } for (i = 0; i < n; i++) { - reti = doVectorLow(xd, part, ecpt, sflags, n, NULL, &(v[i]), NULL, NULL, CptElementType::matrix3x3); + reti = doVectorLow(xd, part, ecpt, sflags, n, nullptr, &(v[i]), nullptr, nullptr, CptElementType::matrix3x3); if (list && reti == 0) { sprintf(name, "%s[%d]", entryName(part, ecpt), i); @@ -759,7 +759,7 @@ static int do_cpte_matrices(XDR *xd, StatePart part, int ecpt, int sflags, int n, matrix **v, FILE *list) { bool_t res = 0; - matrix *vp, *va = NULL; + matrix *vp, *va = nullptr; real *vr; int nf, i, j, k; int ret; @@ -770,7 +770,7 @@ static int do_cpte_matrices(XDR *xd, StatePart part, int ecpt, int sflags, { return -1; } - if (list == NULL && nf != n) + if (list == nullptr && nf != n) { gmx_fatal(FARGS, "Count mismatch for state entry %s, code count is %d, file count is %d\n", entryName(part, ecpt), n, nf); } @@ -781,7 +781,7 @@ static int do_cpte_matrices(XDR *xd, StatePart part, int ecpt, int sflags, } else { - if (*v == NULL) + if (*v == nullptr) { snew(*v, nf); } @@ -799,7 +799,7 @@ static int do_cpte_matrices(XDR *xd, StatePart part, int ecpt, int sflags, } } ret = doVectorLow(xd, part, ecpt, sflags, - nf*DIM*DIM, NULL, &vr, NULL, NULL, + nf*DIM*DIM, nullptr, &vr, nullptr, nullptr, CptElementType::matrix3x3); for (i = 0; i < nf; i++) { @@ -893,7 +893,7 @@ static void do_cpt_header(XDR *xd, gmx_bool bRead, int *file_version, if (*file_version >= 12) { do_cpt_string_err(xd, bRead, "generating host", &fhost, list); - if (list == NULL) + if (list == nullptr) { sfree(fhost); } @@ -1049,10 +1049,10 @@ static int do_cpt_state(XDR *xd, /* The RNG entries are no longer written, * the next 4 lines are only for reading old files. */ - case estLD_RNG: ret = do_cpte_ints(xd, part, i, sflags, 0, NULL, list); break; - case estLD_RNGI: ret = do_cpte_ints(xd, part, i, sflags, 0, NULL, list); break; - case estMC_RNG: ret = do_cpte_ints(xd, part, i, sflags, 0, NULL, list); break; - case estMC_RNGI: ret = do_cpte_ints(xd, part, i, sflags, 0, NULL, list); break; + case estLD_RNG: ret = do_cpte_ints(xd, part, i, sflags, 0, nullptr, list); break; + case estLD_RNGI: ret = do_cpte_ints(xd, part, i, sflags, 0, nullptr, list); break; + case estMC_RNG: ret = do_cpte_ints(xd, part, i, sflags, 0, nullptr, list); break; + case estMC_RNGI: ret = do_cpte_ints(xd, part, i, sflags, 0, nullptr, list); break; case estDISRE_INITF: ret = do_cpte_real (xd, part, i, sflags, &state->hist.disre_initf, list); break; case estDISRE_RM3TAV: ret = do_cpte_n_reals(xd, part, i, sflags, &state->hist.ndisrepairs, &state->hist.disre_rm3tav, list); break; case estORIRE_INITF: ret = do_cpte_real (xd, part, i, sflags, &state->hist.orire_initf, list); break; @@ -1111,7 +1111,7 @@ static int do_cpt_swapstate(XDR *xd, gmx_bool bRead, return 0; } - if (*swapstatePtr == NULL) + if (*swapstatePtr == nullptr) { snew(*swapstatePtr, 1); } @@ -1160,7 +1160,7 @@ static int do_cpt_swapstate(XDR *xd, gmx_bool bRead, do_cpt_int_err(xd, "swap influx net p", gs->inflow_net_p[ic], list); } - if (bRead && (NULL == gs->nMolPast[ic]) ) + if (bRead && (nullptr == gs->nMolPast[ic]) ) { snew(gs->nMolPast[ic], swapstate->nAverage); } @@ -1349,7 +1349,7 @@ static int do_cpt_df_hist(XDR *xd, int fflags, int nlambda, df_history_t **dfhis return 0; } - if (*dfhistPtr == NULL) + if (*dfhistPtr == nullptr) { snew(*dfhistPtr, 1); (*dfhistPtr)->nlambda = nlambda; @@ -1401,7 +1401,7 @@ static int do_cpt_EDstate(XDR *xd, gmx_bool bRead, return 0; } - if (*EDstatePtr == NULL) + if (*EDstatePtr == nullptr) { snew(*EDstatePtr, 1); } @@ -1488,7 +1488,7 @@ static int do_cpt_files(XDR *xd, gmx_bool bRead, { do_cpt_string_err(xd, bRead, "output filename", &buf, list); std::strncpy(outputfiles[i].filename, buf, CPTSTRLEN-1); - if (list == NULL) + if (list == nullptr) { sfree(buf); } @@ -1687,11 +1687,11 @@ void write_checkpoint(const char *fn, gmx_bool bNumberAndKeep, do_cpt_header(gmx_fio_getxdr(fp), FALSE, &file_version, &version, &btime, &buser, &bhost, &double_prec, &fprog, &ftime, &eIntegrator, &simulation_part, &step, &t, &nppnodes, - DOMAINDECOMP(cr) ? domdecCells : NULL, &npmenodes, + DOMAINDECOMP(cr) ? domdecCells : nullptr, &npmenodes, &state->natoms, &state->ngtc, &state->nnhpres, &state->nhchainlength, &nlambda, &state->flags, &flags_eks, &flags_enh, &flags_dfh, &nED, &eSwapCoords, - NULL); + nullptr); sfree(version); sfree(btime); @@ -1699,13 +1699,13 @@ void write_checkpoint(const char *fn, gmx_bool bNumberAndKeep, sfree(bhost); sfree(fprog); - if ((do_cpt_state(gmx_fio_getxdr(fp), state->flags, state, NULL) < 0) || - (do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, NULL) < 0) || - (do_cpt_enerhist(gmx_fio_getxdr(fp), FALSE, flags_enh, enerhist, NULL) < 0) || - (do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, NULL) < 0) || - (do_cpt_EDstate(gmx_fio_getxdr(fp), FALSE, nED, &state->edsamstate, NULL) < 0) || - (do_cpt_swapstate(gmx_fio_getxdr(fp), FALSE, eSwapCoords, &state->swapstate, NULL) < 0) || - (do_cpt_files(gmx_fio_getxdr(fp), FALSE, &outputfiles, &noutputfiles, NULL, + if ((do_cpt_state(gmx_fio_getxdr(fp), state->flags, state, nullptr) < 0) || + (do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, nullptr) < 0) || + (do_cpt_enerhist(gmx_fio_getxdr(fp), FALSE, flags_enh, enerhist, nullptr) < 0) || + (do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, nullptr) < 0) || + (do_cpt_EDstate(gmx_fio_getxdr(fp), FALSE, nED, &state->edsamstate, nullptr) < 0) || + (do_cpt_swapstate(gmx_fio_getxdr(fp), FALSE, eSwapCoords, &state->swapstate, nullptr) < 0) || + (do_cpt_files(gmx_fio_getxdr(fp), FALSE, &outputfiles, &noutputfiles, nullptr, file_version) < 0)) { gmx_file("Cannot read/write checkpoint; corrupt file, or maybe you are out of disk space?"); @@ -1726,7 +1726,7 @@ void write_checkpoint(const char *fn, gmx_bool bNumberAndKeep, "Cannot fsync '%s'; maybe you are out of disk space?", gmx_fio_getname(ret)); - if (getenv(GMX_IGNORE_FSYNC_FAILURE_ENV) == NULL) + if (getenv(GMX_IGNORE_FSYNC_FAILURE_ENV) == nullptr) { gmx_file(buf); } @@ -1994,7 +1994,7 @@ static void read_checkpoint(const char *fn, FILE **pfplog, &nppnodes_f, dd_nc_f, &npmenodes_f, &natoms, &ngtc, &nnhpres, &nhchainlength, &nlambda, &fflags, &flags_eks, &flags_enh, &flags_dfh, - &nED, &eSwapCoords, NULL); + &nED, &eSwapCoords, nullptr); if (bAppendOutputFiles && file_version >= 13 && double_prec != GMX_DOUBLE) @@ -2002,7 +2002,7 @@ static void read_checkpoint(const char *fn, FILE **pfplog, gmx_fatal(FARGS, "Output file appending requested, but the code and checkpoint file precision (single/double) don't match"); } - if (cr == NULL || MASTER(cr)) + if (cr == nullptr || MASTER(cr)) { fprintf(stderr, "\nReading checkpoint file %s generated: %s\n\n", fn, ftime); @@ -2102,7 +2102,7 @@ static void read_checkpoint(const char *fn, FILE **pfplog, "You can try with the -noappend option, and get more info in the log file.\n"); } - if (getenv("GMX_ALLOW_CPT_MISMATCH") == NULL) + if (getenv("GMX_ALLOW_CPT_MISMATCH") == nullptr) { gmx_fatal(FARGS, "You seem to have switched ensemble, integrator, T and/or P-coupling algorithm between the cpt and tpr file. The recommended way of doing this is passing the cpt file to grompp (with option -t) instead of to mdrun. If you know what you are doing, you can override this error by setting the env.var. GMX_ALLOW_CPT_MISMATCH"); } @@ -2128,14 +2128,14 @@ static void read_checkpoint(const char *fn, FILE **pfplog, reproducibilityRequested); } } - ret = do_cpt_state(gmx_fio_getxdr(fp), fflags, state, NULL); + ret = do_cpt_state(gmx_fio_getxdr(fp), fflags, state, nullptr); *init_fep_state = state->fep_state; /* there should be a better way to do this than setting it here. Investigate for 5.0. */ if (ret) { cp_error(); } - ret = do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, NULL); + ret = do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, nullptr); if (ret) { cp_error(); @@ -2144,7 +2144,7 @@ static void read_checkpoint(const char *fn, FILE **pfplog, ((flags_eks & (1<nsum_sim = *step; } - ret = do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, NULL); + ret = do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, nullptr); if (ret) { cp_error(); } - ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, nED, &state->edsamstate, NULL); + ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, nED, &state->edsamstate, nullptr); if (ret) { cp_error(); } - ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, eSwapCoords, &state->swapstate, NULL); + ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, eSwapCoords, &state->swapstate, nullptr); if (ret) { cp_error(); } - ret = do_cpt_files(gmx_fio_getxdr(fp), TRUE, &outputfiles, &nfiles, NULL, file_version); + ret = do_cpt_files(gmx_fio_getxdr(fp), TRUE, &outputfiles, &nfiles, nullptr, file_version); if (ret) { cp_error(); @@ -2401,7 +2401,7 @@ void read_checkpoint_part_and_step(const char *filename, int nED, eSwapCoords; t_fileio *fp; - if (filename == NULL || + if (filename == nullptr || !gmx_fexist(filename) || (!(fp = gmx_fio_open(filename, "r")))) { @@ -2419,7 +2419,7 @@ void read_checkpoint_part_and_step(const char *filename, &eIntegrator, simulation_part, step, &t, &nppnodes, dd_nc, &npme, &state.natoms, &state.ngtc, &state.nnhpres, &state.nhchainlength, &nlambda, &state.flags, &flags_eks, &flags_enh, &flags_dfh, - &nED, &eSwapCoords, NULL); + &nED, &eSwapCoords, nullptr); gmx_fio_close(fp); } @@ -2438,7 +2438,7 @@ static void read_checkpoint_data(t_fileio *fp, int *simulation_part, int flags_eks, flags_enh, flags_dfh; int nED, eSwapCoords; int nfiles_loc; - gmx_file_position_t *files_loc = NULL; + gmx_file_position_t *files_loc = nullptr; int ret; do_cpt_header(gmx_fio_getxdr(fp), TRUE, &file_version, @@ -2446,14 +2446,14 @@ static void read_checkpoint_data(t_fileio *fp, int *simulation_part, &eIntegrator, simulation_part, step, t, &nppnodes, dd_nc, &npme, &state->natoms, &state->ngtc, &state->nnhpres, &state->nhchainlength, &nlambda, &state->flags, &flags_eks, &flags_enh, &flags_dfh, - &nED, &eSwapCoords, NULL); + &nED, &eSwapCoords, nullptr); ret = - do_cpt_state(gmx_fio_getxdr(fp), state->flags, state, NULL); + do_cpt_state(gmx_fio_getxdr(fp), state->flags, state, nullptr); if (ret) { cp_error(); } - ret = do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, NULL); + ret = do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, nullptr); if (ret) { cp_error(); @@ -2461,24 +2461,24 @@ static void read_checkpoint_data(t_fileio *fp, int *simulation_part, energyhistory_t enerhist; ret = do_cpt_enerhist(gmx_fio_getxdr(fp), TRUE, - flags_enh, &enerhist, NULL); + flags_enh, &enerhist, nullptr); if (ret) { cp_error(); } - ret = do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, NULL); + ret = do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, nullptr); if (ret) { cp_error(); } - ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, nED, &state->edsamstate, NULL); + ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, nED, &state->edsamstate, nullptr); if (ret) { cp_error(); } - ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, eSwapCoords, &state->swapstate, NULL); + ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, eSwapCoords, &state->swapstate, nullptr); if (ret) { cp_error(); @@ -2487,7 +2487,7 @@ static void read_checkpoint_data(t_fileio *fp, int *simulation_part, ret = do_cpt_files(gmx_fio_getxdr(fp), TRUE, &files_loc, &nfiles_loc, - NULL, file_version); + nullptr, file_version); if (outputfiles != nullptr) { *outputfiles = files_loc; @@ -2526,7 +2526,7 @@ read_checkpoint_state(const char *fn, int *simulation_part, t_fileio *fp; fp = gmx_fio_open(fn, "r"); - read_checkpoint_data(fp, simulation_part, step, t, state, NULL, NULL); + read_checkpoint_data(fp, simulation_part, step, t, state, nullptr, nullptr); if (gmx_fio_close(fp) != 0) { gmx_file("Cannot read/write checkpoint; corrupt file, or maybe you are out of disk space?"); @@ -2546,7 +2546,7 @@ void read_checkpoint_trxframe(t_fileio *fp, t_trxframe *fr) init_state(&state, 0, 0, 0, 0, 0); - read_checkpoint_data(fp, &simulation_part, &step, &t, &state, NULL, NULL); + read_checkpoint_data(fp, &simulation_part, &step, &t, &state, nullptr, nullptr); fr->natoms = state.natoms; fr->bTitle = FALSE; diff --git a/src/gromacs/fileio/confio.cpp b/src/gromacs/fileio/confio.cpp index 7735957498..9888e6407a 100644 --- a/src/gromacs/fileio/confio.cpp +++ b/src/gromacs/fileio/confio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -103,7 +103,7 @@ void write_sto_conf_indexed(const char *outfile, const char *title, case efENT: case efPQR: out = gmx_fio_fopen(outfile, "w"); - write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, NULL, TRUE); + write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, nullptr, TRUE); gmx_fio_fclose(out); break; case efESP: @@ -149,19 +149,19 @@ void write_sto_conf(const char *outfile, const char *title, const t_atoms *atoms fr.bBox = TRUE; copy_mat(box, fr.box); out = gmx_fio_fopen(outfile, "w"); - write_g96_conf(out, &fr, -1, NULL); + write_g96_conf(out, &fr, -1, nullptr); gmx_fio_fclose(out); break; case efPDB: case efBRK: case efENT: out = gmx_fio_fopen(outfile, "w"); - write_pdbfile(out, title, atoms, x, ePBC, box, ' ', -1, NULL, TRUE); + write_pdbfile(out, title, atoms, x, ePBC, box, ' ', -1, nullptr, TRUE); gmx_fio_fclose(out); break; case efESP: out = gmx_fio_fopen(outfile, "w"); - write_espresso_conf_indexed(out, title, atoms, atoms->nr, NULL, x, v, box); + write_espresso_conf_indexed(out, title, atoms, atoms->nr, nullptr, x, v, box); gmx_fio_fclose(out); break; case efTPR: @@ -218,13 +218,13 @@ static void get_stx_coordnum(const char *infile, int *natoms) case efG96: { in = gmx_fio_fopen(infile, "r"); - fr.title = NULL; + fr.title = nullptr; fr.natoms = -1; - fr.atoms = NULL; - fr.x = NULL; - fr.v = NULL; - fr.f = NULL; - *natoms = read_g96_conf(in, infile, &fr, NULL, g96_line); + fr.atoms = nullptr; + fr.x = nullptr; + fr.v = nullptr; + fr.f = nullptr; + *natoms = read_g96_conf(in, infile, &fr, nullptr, g96_line); sfree(const_cast(fr.title)); gmx_fio_fclose(in); break; @@ -317,7 +317,7 @@ static void read_stx_conf(const char *infile, { fprintf(stderr, "Warning: Number of atoms in %s is 0\n", infile); } - else if (atoms->atom == NULL) + else if (atoms->atom == nullptr) { gmx_mem("Uninitialized array atom"); } @@ -334,12 +334,12 @@ static void read_stx_conf(const char *infile, gmx_gro_read_conf(infile, symtab, name, atoms, x, v, box); break; case efG96: - fr.title = NULL; + fr.title = nullptr; fr.natoms = atoms->nr; fr.atoms = atoms; fr.x = x; fr.v = v; - fr.f = NULL; + fr.f = nullptr; in = gmx_fio_fopen(infile, "r"); read_g96_conf(in, infile, &fr, symtab, g96_line); gmx_fio_fclose(in); @@ -371,7 +371,7 @@ static void readConfAndAtoms(const char *infile, init_t_atoms(atoms, natoms, (fn2ftp(infile) == efPDB)); bool xIsNull = false; - if (x == NULL) + if (x == nullptr) { snew(x, 1); xIsNull = true; @@ -383,7 +383,7 @@ static void readConfAndAtoms(const char *infile, } read_stx_conf(infile, symtab, name, atoms, - *x, (v == NULL) ? NULL : *v, ePBC, box); + *x, (v == nullptr) ? nullptr : *v, ePBC, box); if (xIsNull) { sfree(*x); @@ -396,9 +396,9 @@ void readConfAndTopology(const char *infile, int *ePBC, rvec **x, rvec **v, matrix box) { - GMX_RELEASE_ASSERT(mtop != NULL, "readConfAndTopology requires mtop!=NULL"); + GMX_RELEASE_ASSERT(mtop != nullptr, "readConfAndTopology requires mtop!=NULL"); - if (ePBC != NULL) + if (ePBC != nullptr) { *ePBC = -1; } @@ -418,9 +418,9 @@ void readConfAndTopology(const char *infile, } int natoms; int ePBC_tmp - = read_tpx(infile, NULL, box, &natoms, - (x == NULL) ? NULL : *x, (v == NULL) ? NULL : *v, mtop); - if (ePBC != NULL) + = read_tpx(infile, nullptr, box, &natoms, + (x == nullptr) ? nullptr : *x, (v == nullptr) ? nullptr : *v, mtop); + if (ePBC != nullptr) { *ePBC = ePBC_tmp; } diff --git a/src/gromacs/fileio/enxio.cpp b/src/gromacs/fileio/enxio.cpp index 6dc3619ffc..964b35e805 100644 --- a/src/gromacs/fileio/enxio.cpp +++ b/src/gromacs/fileio/enxio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -101,12 +101,12 @@ static void enxsubblock_init(t_enxsubblock *sb) #else sb->type = xdr_datatype_float; #endif - sb->fval = NULL; - sb->dval = NULL; - sb->ival = NULL; - sb->lval = NULL; - sb->cval = NULL; - sb->sval = NULL; + sb->fval = nullptr; + sb->dval = nullptr; + sb->ival = nullptr; + sb->lval = nullptr; + sb->cval = nullptr; + sb->sval = nullptr; sb->fval_alloc = 0; sb->dval_alloc = 0; sb->ival_alloc = 0; @@ -121,31 +121,31 @@ static void enxsubblock_free(t_enxsubblock *sb) { sfree(sb->fval); sb->fval_alloc = 0; - sb->fval = NULL; + sb->fval = nullptr; } if (sb->dval_alloc) { sfree(sb->dval); sb->dval_alloc = 0; - sb->dval = NULL; + sb->dval = nullptr; } if (sb->ival_alloc) { sfree(sb->ival); sb->ival_alloc = 0; - sb->ival = NULL; + sb->ival = nullptr; } if (sb->lval_alloc) { sfree(sb->lval); sb->lval_alloc = 0; - sb->lval = NULL; + sb->lval = nullptr; } if (sb->cval_alloc) { sfree(sb->cval); sb->cval_alloc = 0; - sb->cval = NULL; + sb->cval = nullptr; } if (sb->sval_alloc) { @@ -160,7 +160,7 @@ static void enxsubblock_free(t_enxsubblock *sb) } sfree(sb->sval); sb->sval_alloc = 0; - sb->sval = NULL; + sb->sval = nullptr; } } @@ -213,7 +213,7 @@ static void enxsubblock_alloc(t_enxsubblock *sb) srenew(sb->sval, sb->nr); for (i = sb->sval_alloc; i < sb->nr; i++) { - sb->sval[i] = NULL; + sb->sval[i] = nullptr; } sb->sval_alloc = sb->nr; } @@ -227,7 +227,7 @@ static void enxblock_init(t_enxblock *eb) { eb->id = enxOR; eb->nsub = 0; - eb->sub = NULL; + eb->sub = nullptr; eb->nsub_alloc = 0; } @@ -242,21 +242,21 @@ static void enxblock_free(t_enxblock *eb) } sfree(eb->sub); eb->nsub_alloc = 0; - eb->sub = NULL; + eb->sub = nullptr; } } void init_enxframe(t_enxframe *fr) { fr->e_alloc = 0; - fr->ener = NULL; + fr->ener = nullptr; /*fr->d_alloc=0;*/ /*fr->ndisre=0;*/ fr->nblock = 0; fr->nblock_alloc = 0; - fr->block = NULL; + fr->block = nullptr; } @@ -307,7 +307,7 @@ t_enxblock *find_block_id_enxframe(t_enxframe *ef, int id, t_enxblock *prev) return &(ef->block[i]); } } - return NULL; + return nullptr; } void add_subblocks_enxblock(t_enxblock *eb, int n) @@ -328,7 +328,7 @@ void add_subblocks_enxblock(t_enxblock *eb, int n) static void enx_warning(const char *msg) { - if (getenv("GMX_ENX_NO_FATAL") != NULL) + if (getenv("GMX_ENX_NO_FATAL") != nullptr) { gmx_warning(msg); } @@ -346,7 +346,7 @@ static void edr_strings(XDR *xdr, gmx_bool bRead, int file_version, int i; gmx_enxnm_t *nm; - if (*nms == NULL) + if (*nms == nullptr) { snew(*nms, n); } @@ -358,12 +358,12 @@ static void edr_strings(XDR *xdr, gmx_bool bRead, int file_version, if (nm->name) { sfree(nm->name); - nm->name = NULL; + nm->name = nullptr; } if (nm->unit) { sfree(nm->unit); - nm->unit = NULL; + nm->unit = nullptr; } } if (!xdr_string(xdr, &(nm->name), STRLEN)) @@ -746,7 +746,7 @@ void free_enxnms(int n, gmx_enxnm_t *nms) void close_enx(ener_file_t ef) { - if (ef == NULL) + if (ef == nullptr) { // Nothing to do return; @@ -795,7 +795,7 @@ empty_file(const char *fn) ener_file_t open_enx(const char *fn, const char *mode) { int nre; - gmx_enxnm_t *nms = NULL; + gmx_enxnm_t *nms = nullptr; int file_version = -1; t_enxframe *fr; gmx_bool bWrongPrecision, bOK = TRUE; @@ -959,7 +959,7 @@ gmx_bool do_enx(ener_file_t ef, t_enxframe *fr) /*d_size = fr->ndisre*(sizeof(real)*2);*/ } - if (!do_eheader(ef, &file_version, fr, -1, NULL, &bOK)) + if (!do_eheader(ef, &file_version, fr, -1, nullptr, &bOK)) { if (bRead) { @@ -1168,7 +1168,7 @@ void get_enx_state(const char *fn, real t, const gmx_groups_t *groups, t_inputre int nre, nfr, i, j, ni, npcoupl; char buf[STRLEN]; const char *bufi; - gmx_enxnm_t *enm = NULL; + gmx_enxnm_t *enm = nullptr; t_enxframe *fr; ener_file_t in; @@ -1496,7 +1496,7 @@ void comp_enx(const char *fn1, const char *fn2, real ftol, real abstol, const ch int nre, nre1, nre2; ener_file_t in1, in2; int i, j, maxener, *ind1, *ind2, *have; - gmx_enxnm_t *enm1 = NULL, *enm2 = NULL; + gmx_enxnm_t *enm1 = nullptr, *enm2 = nullptr; t_enxframe *fr1, *fr2; gmx_bool b1, b2; @@ -1549,7 +1549,7 @@ void comp_enx(const char *fn1, const char *fn2, real ftol, real abstol, const ch maxener = nre; for (i = 0; i < nre; i++) { - if ((lastener != NULL) && (std::strstr(enm1[i].name, lastener) != NULL)) + if ((lastener != nullptr) && (std::strstr(enm1[i].name, lastener) != nullptr)) { maxener = i+1; break; diff --git a/src/gromacs/fileio/espio.cpp b/src/gromacs/fileio/espio.cpp index 8ea7da8905..f7ee9fea2c 100644 --- a/src/gromacs/fileio/espio.cpp +++ b/src/gromacs/fileio/espio.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 2005, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -263,7 +263,7 @@ void gmx_espresso_read_conf(const char *infile, break; case espTYPE: r = get_espresso_word(fp, word); - atoms->atom[i].type = std::strtol(word, NULL, 10); + atoms->atom[i].type = std::strtol(word, nullptr, 10); break; case espQ: r = get_espresso_word(fp, word); @@ -287,7 +287,7 @@ void gmx_espresso_read_conf(const char *infile, break; case espMOLECULE: r = get_espresso_word(fp, word); - molnr = std::strtol(word, NULL, 10); + molnr = std::strtol(word, nullptr, 10); if (i == 0 || atoms->resinfo[atoms->atom[i-1].resind].nr != molnr) { diff --git a/src/gromacs/fileio/filetypes.cpp b/src/gromacs/fileio/filetypes.cpp index 2002498f34..f558370d0d 100644 --- a/src/gromacs/fileio/filetypes.cpp +++ b/src/gromacs/fileio/filetypes.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -114,16 +114,16 @@ static const t_deffile deffile[efNR] = { eftASC, ".mdp", "grompp", "-f", "grompp input file with MD parameters" }, { eftGEN, ".???", "traj", "-f", "Trajectory", NTRXS, trxs }, { eftGEN, ".???", "trajout", "-f", "Trajectory", NTROS, tros }, - { eftGEN, ".???", "traj", NULL, + { eftGEN, ".???", "traj", nullptr, "Full precision trajectory", NTRNS, trns }, - { eftXDR, ".trr", "traj", NULL, "Trajectory in portable xdr format" }, - { eftGEN, ".???", "traj_comp", NULL, + { eftXDR, ".trr", "traj", nullptr, "Trajectory in portable xdr format" }, + { eftGEN, ".???", "traj_comp", nullptr, "Compressed trajectory (tng format or portable xdr format)", NTRCOMPRESSED, trcompressed}, - { eftXDR, ".xtc", "traj", NULL, + { eftXDR, ".xtc", "traj", nullptr, "Compressed trajectory (portable xdr format): xtc" }, - { eftTNG, ".tng", "traj", NULL, + { eftTNG, ".tng", "traj", nullptr, "Trajectory file (tng format)" }, - { eftXDR, ".edr", "ener", NULL, "Energy file"}, + { eftXDR, ".edr", "ener", nullptr, "Energy file"}, { eftGEN, ".???", "conf", "-c", "Structure file", NSTXS, stxs }, { eftGEN, ".???", "out", "-o", "Structure file", NSTOS, stos }, { eftASC, ".gro", "conf", "-c", "Coordinate file in Gromos-87 format" }, @@ -139,24 +139,24 @@ static const t_deffile deffile[efNR] = { eftASC, ".out", "hello", "-o", "Generic output file"}, { eftASC, ".ndx", "index", "-n", "Index file", }, { eftASC, ".top", "topol", "-p", "Topology file"}, - { eftASC, ".itp", "topinc", NULL, "Include file for topology"}, + { eftASC, ".itp", "topinc", nullptr, "Include file for topology"}, { eftGEN, ".???", "topol", "-s", "Structure+mass(db)", NTPSS, tpss }, { eftXDR, ".tpr", "topol", "-s", "Portable xdr run input file"}, { eftASC, ".tex", "doc", "-o", "LaTeX file"}, - { eftASC, ".rtp", "residue", NULL, "Residue Type file used by pdb2gmx" }, - { eftASC, ".atp", "atomtp", NULL, "Atomtype file used by pdb2gmx" }, - { eftASC, ".hdb", "polar", NULL, "Hydrogen data base"}, - { eftASC, ".dat", "nnnice", NULL, "Generic data file"}, - { eftASC, ".dlg", "user", NULL, "Dialog Box data for ngmx"}, - { eftASC, ".map", "ss", NULL, "File that maps matrix data to colors" }, - { eftASC, ".eps", "plot", NULL, "Encapsulated PostScript (tm) file" }, - { eftASC, ".mat", "ss", NULL, "Matrix Data file"}, - { eftASC, ".m2p", "ps", NULL, "Input file for mat2ps"}, + { eftASC, ".rtp", "residue", nullptr, "Residue Type file used by pdb2gmx" }, + { eftASC, ".atp", "atomtp", nullptr, "Atomtype file used by pdb2gmx" }, + { eftASC, ".hdb", "polar", nullptr, "Hydrogen data base"}, + { eftASC, ".dat", "nnnice", nullptr, "Generic data file"}, + { eftASC, ".dlg", "user", nullptr, "Dialog Box data for ngmx"}, + { eftASC, ".map", "ss", nullptr, "File that maps matrix data to colors" }, + { eftASC, ".eps", "plot", nullptr, "Encapsulated PostScript (tm) file" }, + { eftASC, ".mat", "ss", nullptr, "Matrix Data file"}, + { eftASC, ".m2p", "ps", nullptr, "Input file for mat2ps"}, { eftXDR, ".mtx", "hessian", "-m", "Hessian matrix"}, - { eftASC, ".edi", "sam", NULL, "ED sampling input"}, - { eftASC, ".cub", "pot", NULL, "Gaussian cube file" }, - { eftASC, ".xpm", "root", NULL, "X PixMap compatible matrix file" }, - { eftASC, "", "rundir", NULL, "Run directory" } + { eftASC, ".edi", "sam", nullptr, "ED sampling input"}, + { eftASC, ".cub", "pot", nullptr, "Gaussian cube file" }, + { eftASC, ".xpm", "root", nullptr, "X PixMap compatible matrix file" }, + { eftASC, "", "rundir", nullptr, "Run directory" } }; const char *ftp2ext(int ftp) @@ -229,7 +229,7 @@ const int *ftp2generic_list(int ftp) } else { - return 0; + return nullptr; } } @@ -271,7 +271,7 @@ const char *ftp2defnm(int ftp) } else { - return NULL; + return nullptr; } } @@ -283,7 +283,7 @@ const char *ftp2defopt(int ftp) } else { - return NULL; + return nullptr; } } @@ -310,7 +310,7 @@ int fn2ftp(const char *fn) for (i = 0; (i < efNR); i++) { - if ((eptr = deffile[i].ext) != NULL) + if ((eptr = deffile[i].ext) != nullptr) { if (gmx_strcasecmp(feptr, eptr) == 0) { diff --git a/src/gromacs/fileio/g96io.cpp b/src/gromacs/fileio/g96io.cpp index bfaf13309e..b1dd3f6326 100644 --- a/src/gromacs/fileio/g96io.cpp +++ b/src/gromacs/fileio/g96io.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -66,7 +66,7 @@ static int read_g96_pos(char line[], t_symtab *symtab, nwanted = fr->natoms; atoms = fr->atoms; - if (atoms != NULL) + if (atoms != nullptr) { atoms->haveMass = FALSE; atoms->haveCharge = FALSE; @@ -242,7 +242,7 @@ int read_g96_conf(FILE *fp, const char *infile, t_trxframe *fr, { fr->bTitle = (std::strcmp(line, "TITLE") == 0); } - if (fr->title == NULL) + if (fr->title == nullptr) { fgets2(line, STRLEN, fp); fr->title = gmx_strdup(line); @@ -275,7 +275,7 @@ int read_g96_conf(FILE *fp, const char *infile, t_trxframe *fr, fr->bTime = bTime; do { - bFinished = (fgets2(line, STRLEN, fp) == NULL); + bFinished = (fgets2(line, STRLEN, fp) == nullptr); } while (!bFinished && (line[0] == '#')); sscanf(line, "%15" GMX_SCNd64 "%15lf", &(fr->step), &db1); diff --git a/src/gromacs/fileio/gmxfio-xdr.cpp b/src/gromacs/fileio/gmxfio-xdr.cpp index 1da46d4f52..16eb311b58 100644 --- a/src/gromacs/fileio/gmxfio-xdr.cpp +++ b/src/gromacs/fileio/gmxfio-xdr.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -71,9 +71,9 @@ void gmx_fio_setprecision(t_fileio *fio, gmx_bool bDouble) XDR *gmx_fio_getxdr(t_fileio *fio) { - XDR *ret = NULL; + XDR *ret = nullptr; gmx_fio_lock(fio); - GMX_RELEASE_ASSERT( fio->xdr != NULL, "Implementation error: NULL XDR pointers"); + GMX_RELEASE_ASSERT( fio->xdr != nullptr, "Implementation error: NULL XDR pointers"); ret = fio->xdr; gmx_fio_unlock(fio); return ret; @@ -117,7 +117,7 @@ static gmx_bool do_xdr(t_fileio *fio, void *item, int nitem, int eio, double d = 0; float f = 0; - GMX_RELEASE_ASSERT( fio->xdr != NULL, "Implementation error: NULL XDR pointers"); + GMX_RELEASE_ASSERT( fio->xdr != nullptr, "Implementation error: NULL XDR pointers"); gmx_fio_check_nitem(eio, nitem, srcfile, line); switch (eio) { @@ -264,7 +264,7 @@ static gmx_bool do_xdr(t_fileio *fio, void *item, int nitem, int eio, } break; case eioNRVEC: - ptr = NULL; + ptr = nullptr; res = 1; for (j = 0; (j < nitem) && res; j++) { diff --git a/src/gromacs/fileio/gmxfio.cpp b/src/gromacs/fileio/gmxfio.cpp index e632956a8d..ae439a5c50 100644 --- a/src/gromacs/fileio/gmxfio.cpp +++ b/src/gromacs/fileio/gmxfio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -67,7 +67,7 @@ /* the list of open files is a linked list, with a dummy element at its head; it is initialized when the first file is opened. */ -static t_fileio *open_files = NULL; +static t_fileio *open_files = nullptr; /* this mutex locks the open_files structure so that no two threads can @@ -117,8 +117,8 @@ static void gmx_fio_make_dummy(void) if (!open_files) { snew(open_files, 1); - open_files->fp = NULL; - open_files->fn = NULL; + open_files->fp = nullptr; + open_files->fn = nullptr; open_files->next = open_files; open_files->prev = open_files; tMPI_Lock_init(&(open_files->mtx)); @@ -217,7 +217,7 @@ static t_fileio *gmx_fio_get_first(void) if (ret == open_files) { /* after this, the open_file pointer should never change */ - ret = NULL; + ret = nullptr; } else { @@ -239,7 +239,7 @@ static t_fileio *gmx_fio_get_next(t_fileio *fio) /* check if that was the last one */ if (fio->next == open_files) { - ret = NULL; + ret = nullptr; tMPI_Thread_mutex_unlock(&open_file_mutex); } else @@ -268,7 +268,7 @@ static void gmx_fio_stop_getting_next(t_fileio *fio) *****************************************************************/ t_fileio *gmx_fio_open(const char *fn, const char *mode) { - t_fileio *fio = NULL; + t_fileio *fio = nullptr; char newmode[5]; gmx_bool bRead, bReadWrite; @@ -312,8 +312,8 @@ t_fileio *gmx_fio_open(const char *fn, const char *mode) tMPI_Lock_init(&(fio->mtx)); bRead = (newmode[0] == 'r' && newmode[1] != '+'); bReadWrite = (newmode[1] == '+'); - fio->fp = NULL; - fio->xdr = NULL; + fio->fp = nullptr; + fio->xdr = nullptr; if (fn) { if (fn2ftp(fn) == efTNG) @@ -365,13 +365,13 @@ static int gmx_fio_close_locked(t_fileio *fio) { int rc = 0; - if (fio->xdr != NULL) + if (fio->xdr != nullptr) { xdr_destroy(fio->xdr); sfree(fio->xdr); } - if (fio->fp != NULL) + if (fio->fp != nullptr) { rc = gmx_ffclose(fio->fp); /* fclose returns 0 if happy */ @@ -407,10 +407,10 @@ int gmx_fio_fp_close(t_fileio *fio) { int rc = 0; gmx_fio_lock(fio); - if (fio->xdr == NULL) + if (fio->xdr == nullptr) { rc = gmx_ffclose(fio->fp); /* fclose returns 0 if happy */ - fio->fp = NULL; + fio->fp = nullptr; } gmx_fio_unlock(fio); @@ -712,7 +712,7 @@ int gmx_fio_fsync(t_fileio *fio) t_fileio *gmx_fio_all_output_fsync(void) { - t_fileio *ret = NULL; + t_fileio *ret = nullptr; t_fileio *cur; cur = gmx_fio_get_first(); @@ -778,7 +778,7 @@ int gmx_fio_seek(t_fileio* fio, gmx_off_t fpos) FILE *gmx_fio_getfp(t_fileio *fio) { - FILE *ret = NULL; + FILE *ret = nullptr; gmx_fio_lock(fio); if (fio->fp) diff --git a/src/gromacs/fileio/groio.cpp b/src/gromacs/fileio/groio.cpp index 0aa130216c..c0f041c28e 100644 --- a/src/gromacs/fileio/groio.cpp +++ b/src/gromacs/fileio/groio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -132,7 +132,7 @@ static gmx_bool get_w_conf(FILE *in, const char *infile, char *title, /* just pray the arrays are big enough */ for (i = 0; (i < natoms); i++) { - if ((fgets2(line, STRLEN, in)) == NULL) + if ((fgets2(line, STRLEN, in)) == nullptr) { gmx_fatal(FARGS, "Unexpected end of file in file %s at line %d", infile, i+2); @@ -148,12 +148,12 @@ static gmx_bool get_w_conf(FILE *in, const char *infile, char *title, { bFirst = FALSE; p1 = strchr(line, '.'); - if (p1 == NULL) + if (p1 == nullptr) { gmx_fatal(FARGS, "A coordinate in file %s does not contain a '.'", infile); } p2 = strchr(&p1[1], '.'); - if (p2 == NULL) + if (p2 == nullptr) { gmx_fatal(FARGS, "A coordinate in file %s does not contain a '.'", infile); } @@ -161,7 +161,7 @@ static gmx_bool get_w_conf(FILE *in, const char *infile, char *title, *ndec = ddist - 5; p3 = strchr(&p2[1], '.'); - if (p3 == NULL) + if (p3 == nullptr) { gmx_fatal(FARGS, "A coordinate in file %s does not contain a '.'", infile); } @@ -369,7 +369,7 @@ gmx_bool gro_next_x_or_v(FILE *status, t_trxframe *fr) sfree(atoms.atomname); done_symtab(&symtab); - if ((p = strstr(title, "t=")) != NULL) + if ((p = strstr(title, "t=")) != nullptr) { p += 2; if (sscanf(p, "%lf", &tt) == 1) @@ -455,7 +455,7 @@ void write_hconf_indexed_p(FILE *out, const char *title, const t_atoms *atoms, fprintf(out, "%s\n", (title && title[0]) ? title : gmx::bromacs().c_str()); fprintf(out, "%5d\n", nx); - const char *format = get_hconf_format(v != NULL); + const char *format = get_hconf_format(v != nullptr); for (i = 0; (i < nx); i++) { @@ -513,7 +513,7 @@ void write_hconf_mtop(FILE *out, const char *title, gmx_mtop_t *mtop, fprintf(out, "%s\n", (title && title[0]) ? title : gmx::bromacs().c_str()); fprintf(out, "%5d\n", mtop->natoms); - const char *format = get_hconf_format(v != NULL); + const char *format = get_hconf_format(v != nullptr); aloop = gmx_mtop_atomloop_all_init(mtop); while (gmx_mtop_atomloop_all_next(aloop, &i, &atom)) diff --git a/src/gromacs/fileio/libxdrf.cpp b/src/gromacs/fileio/libxdrf.cpp index ceabe761ec..b6d17c649a 100644 --- a/src/gromacs/fileio/libxdrf.cpp +++ b/src/gromacs/fileio/libxdrf.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -396,8 +396,8 @@ static void receiveints(int buf[], const int num_of_ints, int num_of_bits, int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) { - int *ip = NULL; - int *buf = NULL; + int *ip = nullptr; + int *buf = nullptr; gmx_bool bRead; /* preallocate a small buffer and ip on the stack - if we need more @@ -468,7 +468,7 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) bufsize = static_cast(size3 * 1.2); ip = reinterpret_cast(malloc(size3 * sizeof(*ip))); buf = reinterpret_cast(malloc(bufsize * sizeof(*buf))); - if (ip == NULL || buf == NULL) + if (ip == nullptr || buf == nullptr) { fprintf(stderr, "malloc failed\n"); exit(1); @@ -814,7 +814,7 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) bufsize = static_cast(size3 * 1.2); ip = reinterpret_cast(malloc(size3 * sizeof(*ip))); buf = reinterpret_cast(malloc(bufsize * sizeof(*buf))); - if (ip == NULL || buf == NULL) + if (ip == nullptr || buf == nullptr) { fprintf(stderr, "malloc failed\n"); exit(1); diff --git a/src/gromacs/fileio/matio.cpp b/src/gromacs/fileio/matio.cpp index 4fb86f27f1..0fb307ca73 100644 --- a/src/gromacs/fileio/matio.cpp +++ b/src/gromacs/fileio/matio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -95,7 +95,7 @@ void done_matrix(int nx, real ***m) sfree((*m)[i]); } sfree(*m); - *m = NULL; + *m = nullptr; } gmx_bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2) @@ -126,7 +126,7 @@ int getcmap(FILE *in, const char *fn, t_mapping **map) double r, g, b; t_mapping *m; - if (fgets2(line, STRLEN-1, in) == NULL) + if (fgets2(line, STRLEN-1, in) == nullptr) { gmx_fatal(FARGS, "Not enough lines in colormap file %s" "(just wanted to read number of entries)", fn); @@ -135,7 +135,7 @@ int getcmap(FILE *in, const char *fn, t_mapping **map) snew(m, n); for (i = 0; (i < n); i++) { - if (fgets2(line, STRLEN-1, in) == NULL) + if (fgets2(line, STRLEN-1, in) == nullptr) { gmx_fatal(FARGS, "Not enough lines in colormap file %s" "(should be %d, found only %d)", fn, n+1, i); @@ -226,7 +226,7 @@ static char *line2string(char **line) { int i; - if (*line != NULL) + if (*line != nullptr) { while (((*line)[0] != '\"' ) && ( (*line)[0] != '\0' )) { @@ -235,7 +235,7 @@ static char *line2string(char **line) if ((*line)[0] != '\"') { - return NULL; + return nullptr; } (*line)++; @@ -247,7 +247,7 @@ static char *line2string(char **line) if ((*line)[i] != '\"') { - *line = NULL; + *line = nullptr; } else { @@ -273,7 +273,7 @@ static void parsestring(char *line, const char *label, char *string) static void read_xpm_entry(FILE *in, t_matrix *mm) { t_mapping *map; - char *line_buf = NULL, *line = NULL, *str, buf[256] = {0}; + char *line_buf = nullptr, *line = nullptr, *str, buf[256] = {0}; int i, m, col_len, nch = 0, n_axis_x, n_axis_y, llmax; int llalloc = 0; unsigned int r, g, b; @@ -286,14 +286,14 @@ static void read_xpm_entry(FILE *in, t_matrix *mm) mm->legend[0] = 0; mm->label_x[0] = 0; mm->label_y[0] = 0; - mm->matrix = NULL; - mm->axis_x = NULL; - mm->axis_y = NULL; + mm->matrix = nullptr; + mm->axis_x = nullptr; + mm->axis_y = nullptr; mm->bDiscrete = FALSE; llmax = STRLEN; - while ((NULL != fgetline(&line_buf, llmax, &llalloc, in)) && + while ((nullptr != fgetline(&line_buf, llmax, &llalloc, in)) && (std::strncmp(line_buf, "static", 6) != 0)) { line = line_buf; @@ -322,7 +322,7 @@ static void read_xpm_entry(FILE *in, t_matrix *mm) /* Read sizes */ bGetOnWithIt = FALSE; - while (!bGetOnWithIt && (NULL != fgetline(&line_buf, llmax, &llalloc, in))) + while (!bGetOnWithIt && (nullptr != fgetline(&line_buf, llmax, &llalloc, in))) { line = line_buf; while (( line[0] != '\"' ) && ( line[0] != '\0' )) @@ -359,7 +359,7 @@ static void read_xpm_entry(FILE *in, t_matrix *mm) /* Read color map */ snew(map, mm->nmap); m = 0; - while ((m < mm->nmap) && (NULL != fgetline(&line_buf, llmax, &llalloc, in))) + while ((m < mm->nmap) && (nullptr != fgetline(&line_buf, llmax, &llalloc, in))) { line = std::strchr(line_buf, '\"'); if (line) @@ -448,7 +448,7 @@ static void read_xpm_entry(FILE *in, t_matrix *mm) { line = std::strstr(line, "x-axis"); skipstr(line); - if (mm->axis_x == NULL) + if (mm->axis_x == nullptr) { snew(mm->axis_x, mm->nx + 1); } @@ -471,7 +471,7 @@ static void read_xpm_entry(FILE *in, t_matrix *mm) { line = std::strstr(line, "y-axis"); skipstr(line); - if (mm->axis_y == NULL) + if (mm->axis_y == nullptr) { snew(mm->axis_y, mm->ny + 1); } @@ -491,7 +491,7 @@ static void read_xpm_entry(FILE *in, t_matrix *mm) } } } - while ((line[0] != '\"') && (NULL != fgetline(&line_buf, llmax, &llalloc, in))); + while ((line[0] != '\"') && (nullptr != fgetline(&line_buf, llmax, &llalloc, in))); /* Read matrix */ snew(mm->matrix, mm->nx); @@ -539,7 +539,7 @@ static void read_xpm_entry(FILE *in, t_matrix *mm) m--; } } - while ((m >= 0) && (NULL != fgetline(&line_buf, llmax, &llalloc, in))); + while ((m >= 0) && (nullptr != fgetline(&line_buf, llmax, &llalloc, in))); if (m >= 0) { gmx_incons("Not enough rows in the matrix"); @@ -551,14 +551,14 @@ static void read_xpm_entry(FILE *in, t_matrix *mm) int read_xpm_matrix(const char *fnm, t_matrix **mat) { FILE *in; - char *line = NULL; + char *line = nullptr; int nmat; int llalloc = 0; in = gmx_fio_fopen(fnm, "r"); nmat = 0; - while (NULL != fgetline(&line, STRLEN, &llalloc, in)) + while (nullptr != fgetline(&line, STRLEN, &llalloc, in)) { if (std::strstr(line, "/* XPM */")) { @@ -592,18 +592,18 @@ real **matrix2real(t_matrix *in, real **out) for (i = 0; i < nmap; i++) { - if ((map[i].desc == NULL) || (sscanf(map[i].desc, "%lf", &tmp) != 1)) + if ((map[i].desc == nullptr) || (sscanf(map[i].desc, "%lf", &tmp) != 1)) { fprintf(stderr, "Could not convert matrix to reals,\n" "color map entry %d has a non-real description: \"%s\"\n", i, map[i].desc); sfree(rmap); - return NULL; + return nullptr; } rmap[i] = tmp; } - if (out == NULL) + if (out == nullptr) { snew(out, in->nx); for (i = 0; i < in->nx; i++) diff --git a/src/gromacs/fileio/mtxio.cpp b/src/gromacs/fileio/mtxio.cpp index 827452131c..7a48bc64ff 100644 --- a/src/gromacs/fileio/mtxio.cpp +++ b/src/gromacs/fileio/mtxio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -89,7 +89,7 @@ void gmx_mtxio_write(const char * filename, int i, j, prec; size_t sz; - if (full_matrix != NULL && sparse_matrix != NULL) + if (full_matrix != nullptr && sparse_matrix != nullptr) { gmx_fatal(FARGS, "Both full AND sparse matrix specified to gmx_mtxio_write().\n"); } @@ -117,7 +117,7 @@ void gmx_mtxio_write(const char * filename, gmx_fio_do_int(fio, nrow); gmx_fio_do_int(fio, ncol); - if (full_matrix != NULL) + if (full_matrix != nullptr) { /* Full matrix storage format */ i = GMX_MTXIO_FULL_MATRIX; @@ -200,7 +200,7 @@ gmx_mtxio_read (const char * filename, gmx_fio_do_int(fio, i); - if (i == GMX_MTXIO_FULL_MATRIX && NULL != full_matrix) + if (i == GMX_MTXIO_FULL_MATRIX && nullptr != full_matrix) { printf("Full matrix storage format, nrow=%d, ncols=%d\n", *nrow, *ncol); @@ -208,7 +208,7 @@ gmx_mtxio_read (const char * filename, snew((*full_matrix), sz); gmx_fio_ndo_real(fio, (*full_matrix), sz); } - else if (NULL != sparse_matrix) + else if (nullptr != sparse_matrix) { /* Sparse storage */ printf("Sparse matrix storage format, nrow=%d, ncols=%d\n", *nrow, *ncol); diff --git a/src/gromacs/fileio/oenv.cpp b/src/gromacs/fileio/oenv.cpp index fcc648f576..4c1f5fbf25 100644 --- a/src/gromacs/fileio/oenv.cpp +++ b/src/gromacs/fileio/oenv.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -77,12 +77,12 @@ struct gmx_output_env_t static const real timefactors[] = { real(0), real(1e3), real(1), real(1e-3), real(1e-6), real(1e-9), real(1e-12), real(0) }; static const real timeinvfactors[] = { real(0), real(1e-3), real(1), real(1e3), real(1e6), real(1e9), real(1e12), real(0) }; static const char *time_units_str[] = { - NULL, "fs", "ps", "ns", "us", + nullptr, "fs", "ps", "ns", "us", "\\mus", "ms", "s" }; static const char *time_units_xvgr[] = { - NULL, "fs", "ps", "ns", - "ms", "s", NULL + nullptr, "fs", "ps", "ns", + "ms", "s", nullptr }; @@ -194,7 +194,7 @@ xvg_format_t output_env_get_xvg_format(const gmx_output_env_t *oenv) const char *output_env_get_program_display_name(const gmx_output_env_t *oenv) { - const char *displayName = NULL; + const char *displayName = nullptr; try { diff --git a/src/gromacs/fileio/pdbio.cpp b/src/gromacs/fileio/pdbio.cpp index 7824afd521..cab5fa06aa 100644 --- a/src/gromacs/fileio/pdbio.cpp +++ b/src/gromacs/fileio/pdbio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -192,7 +192,7 @@ static void read_cryst1(char *line, int *ePBC, matrix box) sscanf(sg, "%c %d %d %d", &ident, &syma, &symb, &symc); if (ident == 'P' && syma == 1 && symb <= 1 && symc <= 1) { - fc = strtod(sc, NULL)*0.1; + fc = strtod(sc, nullptr)*0.1; ePBC_file = (fc > 0 ? epbcXYZ : epbcXY); } if (ident == 'P' && syma == 21 && symb == 1 && symc == 1) @@ -207,9 +207,9 @@ static void read_cryst1(char *line, int *ePBC, matrix box) if (box) { - fa = strtod(sa, NULL)*0.1; - fb = strtod(sb, NULL)*0.1; - fc = strtod(sc, NULL)*0.1; + fa = strtod(sa, nullptr)*0.1; + fb = strtod(sb, nullptr)*0.1; + fc = strtod(sc, nullptr)*0.1; if (ePBC_file == epbcSCREW) { fa *= 0.5; @@ -306,7 +306,7 @@ void write_pdbfile_indexed(FILE *out, const char *title, fprintf(out, "MODEL %8d\n", model_nr > 0 ? model_nr : 1); lastchainnum = -1; - p_restype = NULL; + p_restype = nullptr; for (ii = 0; ii < nindex; ii++) { @@ -399,7 +399,7 @@ void write_pdbfile_indexed(FILE *out, const char *title, fprintf(out, "TER\n"); fprintf(out, "ENDMDL\n"); - if (NULL != gc) + if (nullptr != gc) { /* Write conect records */ for (i = 0; (i < gc->nconect); i++) @@ -473,7 +473,7 @@ static void read_anisou(char line[], int natom, t_atoms *atoms) trim(anm); /* Search backwards for number and name only */ - atomnr = std::strtol(anr, NULL, 10); + atomnr = std::strtol(anr, nullptr, 10); for (i = natom-1; (i >= 0); i--) { if ((std::strcmp(anm, *(atoms->atomname[i])) == 0) && @@ -568,9 +568,9 @@ void get_pdb_atomnumber(const t_atoms *atoms, gmx_atomprop_t aps) } else { - ptr = NULL; + ptr = nullptr; } - std::strncpy(atoms->atom[i].elem, ptr == NULL ? "" : ptr, 4); + std::strncpy(atoms->atom[i].elem, ptr == nullptr ? "" : ptr, 4); } } @@ -629,7 +629,7 @@ static int read_atom(t_symtab *symtab, } rnr[k] = nc; trim(rnr); - resnr = std::strtol(rnr, NULL, 10); + resnr = std::strtol(rnr, nullptr, 10); resic = line[j]; j += 4; @@ -708,17 +708,17 @@ static int read_atom(t_symtab *symtab, atomn->atomnumber = atomnumber; strncpy(atomn->elem, elem, 4); } - x[natom][XX] = strtod(xc, NULL)*0.1; - x[natom][YY] = strtod(yc, NULL)*0.1; - x[natom][ZZ] = strtod(zc, NULL)*0.1; + x[natom][XX] = strtod(xc, nullptr)*0.1; + x[natom][YY] = strtod(yc, nullptr)*0.1; + x[natom][ZZ] = strtod(zc, nullptr)*0.1; if (atoms->pdbinfo) { atoms->pdbinfo[natom].type = type; - atoms->pdbinfo[natom].atomnr = strtol(anr, NULL, 10); + atoms->pdbinfo[natom].atomnr = strtol(anr, nullptr, 10); atoms->pdbinfo[natom].altloc = altloc; strcpy(atoms->pdbinfo[natom].atomnm, anm_copy); - atoms->pdbinfo[natom].bfac = strtod(bfac, NULL); - atoms->pdbinfo[natom].occup = strtod(occup, NULL); + atoms->pdbinfo[natom].bfac = strtod(bfac, nullptr); + atoms->pdbinfo[natom].occup = strtod(occup, nullptr); } natom++; @@ -865,7 +865,7 @@ int read_pdbfile(FILE *in, char *title, int *model_nr, /* Only assume pbc when there is a CRYST1 entry */ *ePBC = epbcNONE; } - if (box != NULL) + if (box != nullptr) { clear_mat(box); } @@ -874,13 +874,13 @@ int read_pdbfile(FILE *in, char *title, int *model_nr, atoms->haveCharge = FALSE; atoms->haveType = FALSE; atoms->haveBState = FALSE; - atoms->havePdbInfo = (atoms->pdbinfo != NULL); + atoms->havePdbInfo = (atoms->pdbinfo != nullptr); bCOMPND = FALSE; title[0] = '\0'; natom = 0; chainnum = 0; - while (!bStop && (fgets2(line, STRLEN, in) != NULL)) + while (!bStop && (fgets2(line, STRLEN, in) != nullptr)) { line_type = line2type(line); @@ -1029,7 +1029,7 @@ void gmx_pdb_read_conf(const char *infile, { FILE *in = gmx_fio_fopen(infile, "r"); char title[STRLEN]; - read_pdbfile(in, title, NULL, atoms, symtab, x, ePBC, box, TRUE, NULL); + read_pdbfile(in, title, nullptr, atoms, symtab, x, ePBC, box, TRUE, nullptr); *name = put_symtab(symtab, title); gmx_fio_fclose(in); } @@ -1083,12 +1083,12 @@ gmx_fprintf_pdb_atomline(FILE * fp, } /* Format atom name */ - if (atom_name != NULL) + if (atom_name != nullptr) { /* If the atom name is an element name with two chars, it should start already in column 13. * Otherwise it should start in column 14, unless the name length is 4 chars. */ - if ( (element != NULL) && (std::strlen(element) >= 2) && (gmx_strncasecmp(atom_name, element, 2) == 0) ) + if ( (element != nullptr) && (std::strlen(element) >= 2) && (gmx_strncasecmp(atom_name, element, 2) == 0) ) { start_name_in_col13 = TRUE; } @@ -1106,7 +1106,7 @@ gmx_fprintf_pdb_atomline(FILE * fp, } /* Format residue name */ - std::strncpy(tmp_resname, (res_name != NULL) ? res_name : "", 4); + std::strncpy(tmp_resname, (res_name != nullptr) ? res_name : "", 4); /* Make sure the string is terminated if strlen was > 4 */ tmp_resname[4] = '\0'; /* String is properly terminated, so now we can use strcat. By adding a @@ -1132,7 +1132,7 @@ gmx_fprintf_pdb_atomline(FILE * fp, x, y, z, occupancy, b_factor, - (element != NULL) ? element : ""); + (element != nullptr) ? element : ""); return n; } diff --git a/src/gromacs/fileio/readinp.cpp b/src/gromacs/fileio/readinp.cpp index cc99641485..e2d139ab05 100644 --- a/src/gromacs/fileio/readinp.cpp +++ b/src/gromacs/fileio/readinp.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -62,7 +62,7 @@ t_inpfile *read_inpfile(const char *fn, int *ninp, FILE *in; char buf[STRLEN], lbuf[STRLEN], rbuf[STRLEN], warn_buf[STRLEN]; char *ptr, *cptr; - t_inpfile *inp = NULL; + t_inpfile *inp = nullptr; int nin, lc, i, j, k; @@ -85,7 +85,7 @@ t_inpfile *read_inpfile(const char *fn, int *ninp, // strchr, etc. rather than re-inventing wheels. /* Strip comment */ - if ((cptr = std::strchr(buf, COMMENTSIGN)) != NULL) + if ((cptr = std::strchr(buf, COMMENTSIGN)) != nullptr) { *cptr = '\0'; } @@ -296,7 +296,7 @@ int search_einp(int ninp, const t_inpfile *inp, const char *name) { int i; - if (inp == NULL) + if (inp == nullptr) { return -1; } @@ -460,7 +460,7 @@ const char *get_estr(int *ninp, t_inpfile **inp, const char *name, const char *d } else { - (*inp)[(*ninp)-1].value = NULL; + (*inp)[(*ninp)-1].value = nullptr; } return def; @@ -488,7 +488,7 @@ int get_eeenum(int *ninp, t_inpfile **inp, const char *name, const char **defs, return 0; } - for (i = 0; (defs[i] != NULL); i++) + for (i = 0; (defs[i] != nullptr); i++) { if (gmx_strcasecmp_min(defs[i], (*inp)[ii].value) == 0) { @@ -496,7 +496,7 @@ int get_eeenum(int *ninp, t_inpfile **inp, const char *name, const char **defs, } } - if (defs[i] == NULL) + if (defs[i] == nullptr) { n += sprintf(buf, "Invalid enum '%s' for variable %s, using '%s'\n", (*inp)[ii].value, name, defs[0]); @@ -507,7 +507,7 @@ int get_eeenum(int *ninp, t_inpfile **inp, const char *name, const char **defs, n += sprintf(buf+n, " '%s'", defs[j]); j++; } - if (wi != NULL) + if (wi != nullptr) { warning_error(wi, buf); } @@ -526,5 +526,5 @@ int get_eeenum(int *ninp, t_inpfile **inp, const char *name, const char **defs, int get_eenum(int *ninp, t_inpfile **inp, const char *name, const char **defs) { - return get_eeenum(ninp, inp, name, defs, NULL); + return get_eeenum(ninp, inp, name, defs, nullptr); } diff --git a/src/gromacs/fileio/tests/confio.cpp b/src/gromacs/fileio/tests/confio.cpp index aff4ee969b..c544689f71 100644 --- a/src/gromacs/fileio/tests/confio.cpp +++ b/src/gromacs/fileio/tests/confio.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -81,8 +81,8 @@ class StructureIORoundtripTest : public gmx::test::StringTestBase, { generateReferenceTopology(); generateReferenceCoordinates(); - testTop_ = NULL; - testX_ = NULL; + testTop_ = nullptr; + testX_ = nullptr; clear_mat(testBox_); referenceFilename_ = fileManager_.getTemporaryFilePath(getFileSuffix("ref")); @@ -91,7 +91,7 @@ class StructureIORoundtripTest : public gmx::test::StringTestBase, } ~StructureIORoundtripTest() { - if (testTop_ != NULL) + if (testTop_ != nullptr) { done_top(testTop_); sfree(testTop_); @@ -104,7 +104,7 @@ class StructureIORoundtripTest : public gmx::test::StringTestBase, void writeReferenceFile() { write_sto_conf(referenceFilename_.c_str(), *refTop_->name, - &refTop_->atoms, as_rvec_array(refX_.data()), NULL, -1, + &refTop_->atoms, as_rvec_array(refX_.data()), nullptr, -1, refBox_); } @@ -113,7 +113,7 @@ class StructureIORoundtripTest : public gmx::test::StringTestBase, snew(testTop_, 1); int ePBC = -2; read_tps_conf(referenceFilename_.c_str(), testTop_, - &ePBC, &testX_, NULL, testBox_, FALSE); + &ePBC, &testX_, nullptr, testBox_, FALSE); } void testTopologies() @@ -124,7 +124,7 @@ class StructureIORoundtripTest : public gmx::test::StringTestBase, void writeTestFileAndTest() { write_sto_conf(testFilename_.c_str(), *testTop_->name, - &testTop_->atoms, testX_, NULL, -1, testBox_); + &testTop_->atoms, testX_, nullptr, -1, testBox_); testFilesEqual(referenceFilename_, testFilename_); } diff --git a/src/gromacs/fileio/tests/readinp.cpp b/src/gromacs/fileio/tests/readinp.cpp index f32c0c0fb1..61f8d27998 100644 --- a/src/gromacs/fileio/tests/readinp.cpp +++ b/src/gromacs/fileio/tests/readinp.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016, by the GROMACS development team, led by + * Copyright (c) 2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -57,7 +57,7 @@ class ReadTest : public ::testing::Test { public: ReadTest() : numInputs_(1), - inputField_(0), + inputField_(nullptr), inpGuard_(), wi_(), wiGuard_() diff --git a/src/gromacs/fileio/tests/tngio.cpp b/src/gromacs/fileio/tests/tngio.cpp index 2b19f25c33..4d2e7b68ee 100644 --- a/src/gromacs/fileio/tests/tngio.cpp +++ b/src/gromacs/fileio/tests/tngio.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -74,7 +74,7 @@ TEST_F(TngTest, CanOpenTngFile) TEST_F(TngTest, CloseBeforeOpenIsNotFatal) { - tng_trajectory_t tng = NULL; + tng_trajectory_t tng = nullptr; gmx_tng_close(&tng); } diff --git a/src/gromacs/fileio/tngio.cpp b/src/gromacs/fileio/tngio.cpp index 8c4052a210..9b0f4a9ba6 100644 --- a/src/gromacs/fileio/tngio.cpp +++ b/src/gromacs/fileio/tngio.cpp @@ -184,8 +184,8 @@ static void addTngMoleculeFromTopology(tng_trajectory_t tng, gmx_int64_t numMolecules, tng_molecule_t *tngMol) { - tng_chain_t tngChain = NULL; - tng_residue_t tngRes = NULL; + tng_chain_t tngChain = nullptr; + tng_residue_t tngRes = nullptr; if (tng_molecule_add(tng, moleculeName, tngMol) != TNG_SUCCESS) { @@ -203,7 +203,7 @@ static void addTngMoleculeFromTopology(tng_trajectory_t tng, { const t_resinfo *resInfo = &atoms->resinfo[at->resind]; char chainName[2] = {resInfo->chainid, 0}; - tng_atom_t tngAtom = NULL; + tng_atom_t tngAtom = nullptr; t_atom *prevAtom; if (atomIndex > 0) @@ -212,7 +212,7 @@ static void addTngMoleculeFromTopology(tng_trajectory_t tng, } else { - prevAtom = 0; + prevAtom = nullptr; } /* If this is the first atom or if the residue changed add the @@ -252,7 +252,7 @@ void gmx_tng_add_mtop(tng_trajectory_t tng, for (int molIndex = 0; molIndex < mtop->nmolblock; molIndex++) { - tng_molecule_t tngMol = NULL; + tng_molecule_t tngMol = nullptr; const gmx_moltype_t *molType = &mtop->moltype[mtop->molblock[molIndex].type]; @@ -1265,9 +1265,9 @@ gmx_bool gmx_read_next_tng_frame(tng_trajectory_t input, gmx_bool bOK = TRUE; tng_function_status stat; gmx_int64_t numberOfAtoms = -1, frameNumber = -1; - gmx_int64_t nBlocks, blockId, *blockIds = NULL, codecId; + gmx_int64_t nBlocks, blockId, *blockIds = nullptr, codecId; char datatype = -1; - void *values = NULL; + void *values = nullptr; double frameTime = -1.0; int size, blockDependency; double prec; @@ -1620,7 +1620,7 @@ gmx_bool gmx_get_tng_data_next_frame_of_block_type(tng_trajectory_t input, char datatype = -1; gmx_int64_t codecId; int blockDependency; - void *data = 0; + void *data = nullptr; double localPrec; stat = tng_data_block_name_get(input, blockId, name, maxLen); diff --git a/src/gromacs/fileio/tpxio.cpp b/src/gromacs/fileio/tpxio.cpp index c85e1530dd..24d71f8e6d 100644 --- a/src/gromacs/fileio/tpxio.cpp +++ b/src/gromacs/fileio/tpxio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -292,14 +292,14 @@ static void do_pull_coord(t_fileio *fio, t_pull_coord *pcrd, } else { - pcrd->externalPotentialProvider = NULL; + pcrd->externalPotentialProvider = nullptr; } } else { if (bRead) { - pcrd->externalPotentialProvider = NULL; + pcrd->externalPotentialProvider = nullptr; } } /* Note that we try to support adding new geometries without @@ -538,7 +538,7 @@ static void do_fepvals(t_fileio *fio, t_lambda *fepvals, gmx_bool bRead, int fil else { fepvals->n_lambda = 0; - fepvals->all_lambda = NULL; + fepvals->all_lambda = nullptr; if (fepvals->init_lambda >= 0) { fepvals->separate_dvdl[efptFEP] = TRUE; @@ -2118,7 +2118,7 @@ static void do_ilists(t_fileio *fio, t_ilist *ilist, gmx_bool bRead, if (bClear) { ilist[j].nr = 0; - ilist[j].iatoms = NULL; + ilist[j].iatoms = nullptr; } else { @@ -2162,7 +2162,7 @@ static void do_block(t_fileio *fio, t_block *block, gmx_bool bRead, int file_ver } if (bRead) { - if ((block->nalloc_index > 0) && (NULL != block->index)) + if ((block->nalloc_index > 0) && (nullptr != block->index)) { sfree(block->index); } @@ -2419,7 +2419,7 @@ static void do_atoms(t_fileio *fio, t_atoms *atoms, gmx_bool bRead, t_symtab *sy { snew(groups->grpname, groups->ngrpname); } - atoms->pdbinfo = NULL; + atoms->pdbinfo = nullptr; } else { @@ -2463,7 +2463,7 @@ static void do_groups(t_fileio *fio, gmx_groups_t *groups, { if (bRead) { - groups->grpnr[g] = NULL; + groups->grpnr[g] = nullptr; } } else @@ -2530,7 +2530,7 @@ static void do_symtab(t_fileio *fio, t_symtab *symtab, gmx_bool bRead) else { symbuf = symtab->symbuf; - while (symbuf != NULL) + while (symbuf != nullptr) { for (i = 0; (i < symbuf->bufsize) && (i < nr); i++) { @@ -2877,7 +2877,7 @@ static void do_mtop(t_fileio *fio, gmx_mtop_t *mtop, gmx_bool bRead, { mtop->ffparams.cmap_grid.ngrid = 0; mtop->ffparams.cmap_grid.grid_spacing = 0; - mtop->ffparams.cmap_grid.cmapdata = NULL; + mtop->ffparams.cmap_grid.cmapdata = nullptr; } if (file_version >= 57) @@ -3080,14 +3080,14 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead, if (!bRead) { - GMX_RELEASE_ASSERT(x == NULL && v == NULL, "Passing separate x and v pointers to do_tpx() is not supported when writing"); + GMX_RELEASE_ASSERT(x == nullptr && v == nullptr, "Passing separate x and v pointers to do_tpx() is not supported when writing"); tpx.natoms = state->natoms; tpx.ngtc = state->ngtc; tpx.fep_state = state->fep_state; tpx.lambda = state->lambda[efptFEP]; - tpx.bIr = (ir != NULL); - tpx.bTop = (mtop != NULL); + tpx.bIr = (ir != nullptr); + tpx.bTop = (mtop != nullptr); tpx.bX = (state->flags & (1 << estX)); tpx.bV = (state->flags & (1 << estV)); tpx.bF = FALSE; @@ -3095,10 +3095,10 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead, } else { - GMX_RELEASE_ASSERT(!(x == NULL && v != NULL), "Passing x==NULL and v!=NULL is not supported"); + GMX_RELEASE_ASSERT(!(x == nullptr && v != nullptr), "Passing x==NULL and v!=NULL is not supported"); } - TopOnlyOK = (ir == NULL); + TopOnlyOK = (ir == nullptr); int fileVersion; /* Version number of the code that wrote the file */ int fileGeneration; /* Generation version number of the code that wrote the file */ @@ -3107,7 +3107,7 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead, if (bRead) { state->flags = 0; - if (x != NULL) + if (x != nullptr) { init_state(state, 0, tpx.ngtc, 0, 0, 0); } @@ -3117,7 +3117,7 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead, } } - if (x == NULL) + if (x == nullptr) { x = as_rvec_array(state->x.data()); v = as_rvec_array(state->v.data()); @@ -3227,7 +3227,7 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead, } if (fileGeneration <= tpx_generation && ir) { - do_inputrec(fio, ir, bRead, fileVersion, mtop ? &mtop->ffparams.fudgeQQ : NULL); + do_inputrec(fio, ir, bRead, fileVersion, mtop ? &mtop->ffparams.fudgeQQ : nullptr); if (fileVersion < 51) { set_box_rel(ir, state); @@ -3302,7 +3302,7 @@ void read_tpxheader(const char *fn, t_tpxheader *tpx, gmx_bool TopOnlyOK) t_fileio *fio; fio = open_tpx(fn, "r"); - do_tpxheader(fio, TRUE, tpx, TopOnlyOK, NULL, NULL); + do_tpxheader(fio, TRUE, tpx, TopOnlyOK, nullptr, nullptr); close_tpx(fio); } @@ -3314,7 +3314,7 @@ void write_tpx_state(const char *fn, fio = open_tpx(fn, "w"); do_tpx(fio, FALSE, const_cast(ir), - const_cast(state), NULL, NULL, + const_cast(state), nullptr, nullptr, const_cast(mtop)); close_tpx(fio); } @@ -3325,7 +3325,7 @@ void read_tpx_state(const char *fn, t_fileio *fio; fio = open_tpx(fn, "r"); - do_tpx(fio, TRUE, ir, state, NULL, NULL, mtop); + do_tpx(fio, TRUE, ir, state, nullptr, nullptr, mtop); close_tpx(fio); } diff --git a/src/gromacs/fileio/trxio.cpp b/src/gromacs/fileio/trxio.cpp index ec6ee9c04e..f17b508846 100644 --- a/src/gromacs/fileio/trxio.cpp +++ b/src/gromacs/fileio/trxio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -168,13 +168,13 @@ static void initcount(t_trxstatus *status) static void status_init(t_trxstatus *status) { status->flags = 0; - status->xframe = NULL; - status->fio = NULL; + status->xframe = nullptr; + status->fio = nullptr; status->__frame = -1; status->t0 = 0; status->tf = 0; - status->persistent_line = NULL; - status->tng = NULL; + status->persistent_line = nullptr; + status->tng = nullptr; } @@ -297,16 +297,16 @@ void clear_trxframe(t_trxframe *fr, gmx_bool bFirst) { fr->bDouble = FALSE; fr->natoms = -1; - fr->title = NULL; + fr->title = nullptr; fr->step = 0; fr->time = 0; fr->lambda = 0; fr->fep_state = 0; - fr->atoms = NULL; + fr->atoms = nullptr; fr->prec = 0; - fr->x = NULL; - fr->v = NULL; - fr->f = NULL; + fr->x = nullptr; + fr->v = nullptr; + fr->f = nullptr; clear_mat(fr->box); fr->bPBC = FALSE; fr->ePBC = -1; @@ -323,7 +323,7 @@ int write_trxframe_indexed(t_trxstatus *status, const t_trxframe *fr, int nind, const int *ind, gmx_conect gc) { char title[STRLEN]; - rvec *xout = NULL, *vout = NULL, *fout = NULL; + rvec *xout = nullptr, *vout = nullptr, *fout = nullptr; int i, ftp = -1; real prec; @@ -423,7 +423,7 @@ int write_trxframe_indexed(t_trxstatus *status, const t_trxframe *fr, int nind, if (ftp == efGRO) { write_hconf_indexed_p(gmx_fio_getfp(status->fio), title, fr->atoms, nind, ind, - fr->x, fr->bV ? fr->v : NULL, fr->box); + fr->x, fr->bV ? fr->v : nullptr, fr->box); } else { @@ -478,13 +478,13 @@ void trjtools_gmx_prepare_tng_writing(const char *filename, gmx_incons("Sorry, can only prepare for TNG output."); } - if (*out == NULL) + if (*out == nullptr) { snew((*out), 1); } status_init(*out); - if (in != NULL) + if (in != nullptr) { gmx_prepare_tng_writing(filename, filemode, @@ -559,7 +559,7 @@ int write_trxframe(t_trxstatus *status, t_trxframe *fr, gmx_conect gc) break; case efTRR: gmx_trr_write_frame(status->fio, fr->step, fr->time, fr->lambda, fr->box, fr->natoms, - fr->bX ? fr->x : NULL, fr->bV ? fr->v : NULL, fr->bF ? fr->f : NULL); + fr->bX ? fr->x : nullptr, fr->bV ? fr->v : nullptr, fr->bF ? fr->f : nullptr); break; case efGRO: case efPDB: @@ -574,7 +574,7 @@ int write_trxframe(t_trxstatus *status, t_trxframe *fr, gmx_conect gc) if (gmx_fio_getftp(status->fio) == efGRO) { write_hconf_p(gmx_fio_getfp(status->fio), title, fr->atoms, - fr->x, fr->bV ? fr->v : NULL, fr->box); + fr->x, fr->bV ? fr->v : nullptr, fr->box); } else { @@ -584,7 +584,7 @@ int write_trxframe(t_trxstatus *status, t_trxframe *fr, gmx_conect gc) } break; case efG96: - write_g96_conf(gmx_fio_getfp(status->fio), fr, -1, NULL); + write_g96_conf(gmx_fio_getfp(status->fio), fr, -1, nullptr); break; default: gmx_fatal(FARGS, "Sorry, write_trxframe can not write %s", @@ -606,11 +606,11 @@ int write_trx(t_trxstatus *status, int nind, const int *ind, const t_atoms *atom fr.step = step; fr.bTime = TRUE; fr.time = time; - fr.bAtoms = atoms != NULL; + fr.bAtoms = atoms != nullptr; fr.atoms = const_cast(atoms); fr.bX = TRUE; fr.x = x; - fr.bV = v != NULL; + fr.bV = v != nullptr; fr.v = v; fr.bBox = TRUE; copy_mat(box, fr.box); @@ -668,7 +668,7 @@ static gmx_bool gmx_next_frame(t_trxstatus *status, t_trxframe *fr) fr->bBox = sh.box_size > 0; if (status->flags & (TRX_READ_X | TRX_NEED_X)) { - if (fr->x == NULL) + if (fr->x == nullptr) { snew(fr->x, sh.natoms); } @@ -676,7 +676,7 @@ static gmx_bool gmx_next_frame(t_trxstatus *status, t_trxframe *fr) } if (status->flags & (TRX_READ_V | TRX_NEED_V)) { - if (fr->v == NULL) + if (fr->v == nullptr) { snew(fr->v, sh.natoms); } @@ -684,7 +684,7 @@ static gmx_bool gmx_next_frame(t_trxstatus *status, t_trxframe *fr) } if (status->flags & (TRX_READ_F | TRX_NEED_F)) { - if (fr->f == NULL) + if (fr->f == nullptr) { snew(fr->f, sh.natoms); } @@ -721,12 +721,12 @@ static gmx_bool pdb_next_x(t_trxstatus *status, FILE *fp, t_trxframe *fr) double dbl; atoms.nr = fr->natoms; - atoms.atom = NULL; - atoms.pdbinfo = NULL; + atoms.atom = nullptr; + atoms.pdbinfo = nullptr; /* the other pointers in atoms should not be accessed if these are NULL */ snew(symtab, 1); open_symtab(symtab); - na = read_pdbfile(fp, title, &model_nr, &atoms, symtab, fr->x, &ePBC, boxpdb, TRUE, NULL); + na = read_pdbfile(fp, title, &model_nr, &atoms, symtab, fr->x, &ePBC, boxpdb, TRUE, nullptr); free_symtab(symtab); sfree(symtab); set_trxframe_ePBC(fr, ePBC); @@ -838,7 +838,7 @@ gmx_bool read_next_frame(const gmx_output_env_t *oenv, t_trxstatus *status, t_tr t_symtab *symtab; snew(symtab, 1); open_symtab(symtab); - read_g96_conf(gmx_fio_getfp(status->fio), NULL, fr, + read_g96_conf(gmx_fio_getfp(status->fio), nullptr, fr, symtab, status->persistent_line); free_symtab(symtab); bRet = (fr->natoms > 0); @@ -869,7 +869,7 @@ gmx_bool read_next_frame(const gmx_output_env_t *oenv, t_trxstatus *status, t_tr } break; case efTNG: - bRet = gmx_read_next_tng_frame(status->tng, fr, NULL, 0); + bRet = gmx_read_next_tng_frame(status->tng, fr, nullptr, 0); break; case efPDB: bRet = pdb_next_x(status, gmx_fio_getfp(status->fio), fr); @@ -1013,7 +1013,7 @@ int read_first_frame(const gmx_output_env_t *oenv, t_trxstatus **status, break; case efTNG: fr->step = -1; - if (!gmx_read_next_tng_frame((*status)->tng, fr, NULL, 0)) + if (!gmx_read_next_tng_frame((*status)->tng, fr, nullptr, 0)) { fr->not_ok = DATA_NOT_OK; fr->natoms = 0; @@ -1152,7 +1152,7 @@ t_topology *read_top(const char *fn, int *ePBC) t_topology *top; snew(top, 1); - epbc = read_tpx_top(fn, NULL, NULL, &natoms, NULL, NULL, top); + epbc = read_tpx_top(fn, nullptr, nullptr, &natoms, nullptr, nullptr, top); if (ePBC) { *ePBC = epbc; diff --git a/src/gromacs/fileio/vmdio.cpp b/src/gromacs/fileio/vmdio.cpp index 27760147cd..cc42a28af7 100644 --- a/src/gromacs/fileio/vmdio.cpp +++ b/src/gromacs/fileio/vmdio.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -170,7 +170,7 @@ static int load_sharedlibrary_plugins(const char *fullpath, gmx_vmdplugin_t *vmd } /* in case this library does not support the filetype, close it */ - if (vmdplugin->api == NULL) + if (vmdplugin->api == nullptr) { vmddlclose(handle); } @@ -283,7 +283,7 @@ static int load_vmd_library(const char *fn, gmx_vmdplugin_t *vmdplugin) sprintf(defpathenv, "%s\\University of Illinois\\VMD\\plugins\\WIN32\\molfile", progfolder); #endif - vmdplugin->api = NULL; + vmdplugin->api = nullptr; vmdplugin->filetype = strrchr(fn, '.'); if (!vmdplugin->filetype) { @@ -296,10 +296,10 @@ static int load_vmd_library(const char *fn, gmx_vmdplugin_t *vmdplugin) * given at configure time. This last might be hard-coded to the * default for VMD installs. */ pathenv = getenv("VMD_PLUGIN_PATH"); - if (pathenv == NULL) + if (pathenv == nullptr) { pathenv = getenv("VMDDIR"); - if (NULL == pathenv) + if (nullptr == pathenv) { printf("\nNeither VMD_PLUGIN_PATH or VMDDIR set. "); printf("Using default location:\n%s\n", defpathenv); @@ -320,7 +320,7 @@ static int load_vmd_library(const char *fn, gmx_vmdplugin_t *vmdplugin) strncpy(pathname, pathenv, sizeof(pathname)); #if !GMX_NATIVE_WINDOWS strcat(pathname, "/*.so"); - glob(pathname, 0, NULL, &globbuf); + glob(pathname, 0, nullptr, &globbuf); if (globbuf.gl_pathc == 0) { printf("\nNo VMD Plugins found\n" @@ -329,7 +329,7 @@ static int load_vmd_library(const char *fn, gmx_vmdplugin_t *vmdplugin) "The architecture (e.g. 32bit versus 64bit) of GROMACS and VMD has to match.\n"); return 0; } - for (size_t i = 0; i < globbuf.gl_pathc && vmdplugin->api == NULL; i++) + for (size_t i = 0; i < globbuf.gl_pathc && vmdplugin->api == nullptr; i++) { /* FIXME: Undefined which plugin is chosen if more than one plugin can read a certain file ending. Requires some additional command @@ -372,7 +372,7 @@ static int load_vmd_library(const char *fn, gmx_vmdplugin_t *vmdplugin) return 0; } - if (vmdplugin->api == NULL) + if (vmdplugin->api == nullptr) { printf("\nNo plugin for %s found\n", vmdplugin->filetype); return 0; @@ -392,7 +392,7 @@ static int load_vmd_library(const char *fn, gmx_vmdplugin_t *vmdplugin) int read_first_vmd_frame(const char *fn, gmx_vmdplugin_t **vmdpluginp, t_trxframe *fr) { - molfile_timestep_metadata_t *metadata = NULL; + molfile_timestep_metadata_t *metadata = nullptr; gmx_vmdplugin_t *vmdplugin; snew(vmdplugin, 1); diff --git a/src/gromacs/fileio/warninp.cpp b/src/gromacs/fileio/warninp.cpp index a91f300a2e..27f049114c 100644 --- a/src/gromacs/fileio/warninp.cpp +++ b/src/gromacs/fileio/warninp.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -73,7 +73,7 @@ warninp_t init_warning(gmx_bool bAllowWarnings, int maxwarning) void set_warning_line(warninp_t wi, const char *s, int line) { - if (s != NULL) + if (s != nullptr) { std::strcpy(wi->filenm, s); } @@ -96,7 +96,7 @@ static void low_warning(warninp_t wi, const char *wtype, int n, const char *s) char *temp, *temp2; int i; - if (s == NULL) + if (s == nullptr) { s = "Empty error message."; } diff --git a/src/gromacs/fileio/writeps.cpp b/src/gromacs/fileio/writeps.cpp index 7f9f6229f5..761036da75 100644 --- a/src/gromacs/fileio/writeps.cpp +++ b/src/gromacs/fileio/writeps.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -86,7 +86,7 @@ t_psdata ps_open(const char *fn, real x1, real y1, real x2, real y2) ps->nrgb = 0; ps->maxrgb = 0; - ps->rgb = NULL; + ps->rgb = nullptr; ps->gen_ybox = 0; ps->ostack = 0; diff --git a/src/gromacs/fileio/xvgr.cpp b/src/gromacs/fileio/xvgr.cpp index db6e22421d..226d9d242b 100644 --- a/src/gromacs/fileio/xvgr.cpp +++ b/src/gromacs/fileio/xvgr.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -69,7 +69,7 @@ static char *xvgrstr(const char *gmx, const gmx_output_env_t *oenv, char *buf, int buflen) { /* Supported greek letter names and corresponding xmgrace/xmgr symbols */ - const char *sym[] = { "beta", "chi", "delta", "eta", "lambda", "mu", "omega", "phi", "psi", "rho", "theta", NULL }; + const char *sym[] = { "beta", "chi", "delta", "eta", "lambda", "mu", "omega", "phi", "psi", "rho", "theta", nullptr }; const char symc[] = { 'b', 'c', 'd', 'h', 'l', 'm', 'w', 'f', 'y', 'r', 'q', '\0' }; int xvgf; gmx_bool bXVGR; @@ -176,12 +176,12 @@ static char *xvgrstr(const char *gmx, const gmx_output_env_t *oenv, { /* Check for special symbol */ i = 0; - while (sym[i] != NULL && + while (sym[i] != nullptr && gmx_strncasecmp(sym[i], gmx+g, std::strlen(sym[i])) != 0) { i++; } - if (sym[i] != NULL) + if (sym[i] != nullptr) { c = symc[i]; if (std::isupper(gmx[g])) @@ -462,25 +462,25 @@ static char *fgets3(FILE *fp, char **ptr, int *len, int maxlen) curp = 0; } } - if (fgets(*ptr + curp, len_remaining, fp) == NULL) + if (fgets(*ptr + curp, len_remaining, fp) == nullptr) { /* if last line, skip */ - return NULL; + return nullptr; } curp += len_remaining-1; /* overwrite the nul char in next iteration */ len_remaining = 1; } - while ((std::strchr(*ptr, '\n') == NULL) && (!feof(fp))); + while ((std::strchr(*ptr, '\n') == nullptr) && (!feof(fp))); if (*len + STRLEN >= maxlen) { - return NULL; /* this line was too long */ + return nullptr; /* this line was too long */ } if (feof(fp)) { /* We reached EOF before '\n', skip this last line. */ - return NULL; + return nullptr; } { /* now remove newline */ @@ -500,7 +500,7 @@ static int wordcount(char *ptr) int cur = 0; #define prev (1-cur) - if (NULL != ptr) + if (nullptr != ptr) { for (i = 0; (ptr[i] != '\0'); i++) { @@ -525,11 +525,11 @@ static char *read_xvgr_string(const char *line) char *str; ptr0 = std::strchr(line, '"'); - if (ptr0 != NULL) + if (ptr0 != nullptr) { ptr0++; ptr1 = std::strchr(ptr0, '"'); - if (ptr1 != NULL) + if (ptr1 != nullptr) { str = gmx_strdup(ptr0); str[ptr1-ptr0] = '\0'; @@ -552,11 +552,11 @@ int read_xvg_legend(const char *fn, double ***y, int *ny, { FILE *fp; char *ptr; - char *base = NULL; - char *fmt = NULL; + char *base = nullptr; + char *fmt = nullptr; int k, line = 0, nny, nx, maxx, rval, legend_nalloc, set, nchar; double lf; - double **yy = NULL; + double **yy = nullptr; char *tmpbuf; int len = STRLEN; *ny = 0; @@ -566,23 +566,23 @@ int read_xvg_legend(const char *fn, double ***y, int *ny, fp = gmx_fio_fopen(fn, "r"); snew(tmpbuf, len); - if (subtitle != NULL) + if (subtitle != nullptr) { - *subtitle = NULL; + *subtitle = nullptr; } legend_nalloc = 0; - if (legend != NULL) + if (legend != nullptr) { - *legend = NULL; + *legend = nullptr; } - while ((ptr = fgets3(fp, &tmpbuf, &len, 10*STRLEN)) != NULL && ptr[0] != '&') + while ((ptr = fgets3(fp, &tmpbuf, &len, 10*STRLEN)) != nullptr && ptr[0] != '&') { line++; trim(ptr); if (ptr[0] == '@') { - if (legend != NULL) + if (legend != nullptr) { ptr++; trim(ptr); @@ -590,7 +590,7 @@ int read_xvg_legend(const char *fn, double ***y, int *ny, if (std::strncmp(ptr, "subtitle", 8) == 0) { ptr += 8; - if (subtitle != NULL) + if (subtitle != nullptr) { *subtitle = read_xvgr_string(ptr); } @@ -697,7 +697,7 @@ int read_xvg_legend(const char *fn, double ***y, int *ny, srenew(*legend, *ny-1); for (set = legend_nalloc; set < *ny-1; set++) { - (*legend)[set] = NULL; + (*legend)[set] = nullptr; } } } @@ -707,7 +707,7 @@ int read_xvg_legend(const char *fn, double ***y, int *ny, int read_xvg(const char *fn, double ***y, int *ny) { - return read_xvg_legend(fn, y, ny, NULL, NULL); + return read_xvg_legend(fn, y, ny, nullptr, nullptr); } void write_xvg(const char *fn, const char *title, int nx, int ny, real **y, @@ -746,9 +746,9 @@ real **read_xvg_time(const char *fn, real **val; t_nalloc = 0; - *t = NULL; - val = NULL; - val_nalloc = NULL; + *t = nullptr; + val = nullptr; + val_nalloc = nullptr; *nset = 0; *dt = 0; fp = gmx_fio_fopen(fn, "r"); @@ -842,7 +842,7 @@ real **read_xvg_time(const char *fn, srenew(val, *nset); srenew(val_nalloc, *nset); val_nalloc[set] = 0; - val[set] = NULL; + val[set] = nullptr; } } if (set == -1) diff --git a/src/gromacs/gmxana/anadih.cpp b/src/gromacs/gmxana/anadih.cpp index 21ce527ed1..15759e5376 100644 --- a/src/gromacs/gmxana/anadih.cpp +++ b/src/gromacs/gmxana/anadih.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -377,16 +377,16 @@ void mk_multiplicity_lookup (int *multiplicity, int maxchi, /* dihedrals to aromatic rings, COO, CONH2 or guanidinium are 2fold*/ if (Dih > edOmega && (dlist[i].atm.Cn[Dih-NONCHI+3] != -1)) { - if ( ((std::strstr(name, "PHE") != NULL) && (Dih == edChi2)) || - ((std::strstr(name, "TYR") != NULL) && (Dih == edChi2)) || - ((std::strstr(name, "PTR") != NULL) && (Dih == edChi2)) || - ((std::strstr(name, "TRP") != NULL) && (Dih == edChi2)) || - ((std::strstr(name, "HIS") != NULL) && (Dih == edChi2)) || - ((std::strstr(name, "GLU") != NULL) && (Dih == edChi3)) || - ((std::strstr(name, "ASP") != NULL) && (Dih == edChi2)) || - ((std::strstr(name, "GLN") != NULL) && (Dih == edChi3)) || - ((std::strstr(name, "ASN") != NULL) && (Dih == edChi2)) || - ((std::strstr(name, "ARG") != NULL) && (Dih == edChi4)) ) + if ( ((std::strstr(name, "PHE") != nullptr) && (Dih == edChi2)) || + ((std::strstr(name, "TYR") != nullptr) && (Dih == edChi2)) || + ((std::strstr(name, "PTR") != nullptr) && (Dih == edChi2)) || + ((std::strstr(name, "TRP") != nullptr) && (Dih == edChi2)) || + ((std::strstr(name, "HIS") != nullptr) && (Dih == edChi2)) || + ((std::strstr(name, "GLU") != nullptr) && (Dih == edChi3)) || + ((std::strstr(name, "ASP") != nullptr) && (Dih == edChi2)) || + ((std::strstr(name, "GLN") != nullptr) && (Dih == edChi3)) || + ((std::strstr(name, "ASN") != nullptr) && (Dih == edChi2)) || + ((std::strstr(name, "ARG") != nullptr) && (Dih == edChi4)) ) { multiplicity[j] = 2; } @@ -564,7 +564,7 @@ void get_chi_product_traj (real **dih, int nframes, int nlist, /* make a histogram pf culm. rotamer occupancy too */ snew(chi_prhist, nbin); - make_histo(NULL, nframes, chi_prtrj, nbin, chi_prhist, 0, nbin); + make_histo(nullptr, nframes, chi_prtrj, nbin, chi_prhist, 0, nbin); if (bAll) { sprintf(hisfile, "histo-chiprod%s.xvg", dlist[i].name); @@ -848,9 +848,9 @@ void read_ang_dih(const char *trj_fn, total = 0; teller = 0; n_alloc = 0; - *time = NULL; - *trans_frac = NULL; - *aver_angle = NULL; + *time = nullptr; + *trans_frac = nullptr; + *aver_angle = nullptr; do { diff --git a/src/gromacs/gmxana/cmat.cpp b/src/gromacs/gmxana/cmat.cpp index 6fddb2674e..d19601cff2 100644 --- a/src/gromacs/gmxana/cmat.cpp +++ b/src/gromacs/gmxana/cmat.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -144,7 +144,7 @@ void done_mat(t_mat **m) sfree((*m)->m_ind); sfree((*m)->erow); sfree(*m); - *m = NULL; + *m = nullptr; } real mat_energy(t_mat *m) diff --git a/src/gromacs/gmxana/eigio.cpp b/src/gromacs/gmxana/eigio.cpp index 8b34c82ba5..416b9b4ca2 100644 --- a/src/gromacs/gmxana/eigio.cpp +++ b/src/gromacs/gmxana/eigio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -64,7 +64,7 @@ void read_eigenvectors(const char *file, int *natoms, gmx_bool *bFit, gmx_trr_read_frame_header(status, &head, &bOK); *natoms = head.natoms; snew(*xav, *natoms); - gmx_trr_read_frame_data(status, &head, box, *xav, NULL, NULL); + gmx_trr_read_frame_data(status, &head, box, *xav, nullptr, nullptr); if ((head.t >= -1.1) && (head.t <= -0.9)) { @@ -83,15 +83,15 @@ void read_eigenvectors(const char *file, int *natoms, gmx_bool *bFit, { fprintf(stderr, "Eigenvectors in %s were determined without fitting\n", file); sfree(*xref); - *xref = NULL; + *xref = nullptr; } gmx_trr_read_frame_header(status, &head, &bOK); - gmx_trr_read_frame_data(status, &head, box, *xav, NULL, NULL); + gmx_trr_read_frame_data(status, &head, box, *xav, nullptr, nullptr); } else { *bFit = TRUE; - *xref = NULL; + *xref = nullptr; } *bDMA = (head.lambda > 0.5); if ((head.t <= -0.01) || (head.t >= 0.01)) @@ -117,7 +117,7 @@ void read_eigenvectors(const char *file, int *natoms, gmx_bool *bFit, *nvec = 0; while (gmx_trr_read_frame_header(status, &head, &bOK)) { - gmx_trr_read_frame_data(status, &head, box, x, NULL, NULL); + gmx_trr_read_frame_data(status, &head, box, x, nullptr, nullptr); if (*nvec >= snew_size) { snew_size += 10; @@ -164,16 +164,16 @@ void write_eigenvectors(const char *trrname, int natoms, const real mat[], if (WriteXref == eWXR_YES) { /* misuse lambda: 0/1 mass weighted fit no/yes */ - gmx_trr_write_frame(trrout, -1, -1, bDMR ? 1.0 : 0.0, zerobox, natoms, xref, NULL, NULL); + gmx_trr_write_frame(trrout, -1, -1, bDMR ? 1.0 : 0.0, zerobox, natoms, xref, nullptr, nullptr); } else if (WriteXref == eWXR_NOFIT) { /* misuse lambda: -1 no fit */ - gmx_trr_write_frame(trrout, -1, -1, -1.0, zerobox, natoms, x, NULL, NULL); + gmx_trr_write_frame(trrout, -1, -1, -1.0, zerobox, natoms, x, nullptr, nullptr); } /* misuse lambda: 0/1 mass weighted analysis no/yes */ - gmx_trr_write_frame(trrout, 0, 0, bDMA ? 1.0 : 0.0, zerobox, natoms, xav, NULL, NULL); + gmx_trr_write_frame(trrout, 0, 0, bDMA ? 1.0 : 0.0, zerobox, natoms, xav, nullptr, nullptr); for (i = 0; i <= (end-begin); i++) { @@ -196,7 +196,7 @@ void write_eigenvectors(const char *trrname, int natoms, const real mat[], } /* Store the eigenvalue in the time field */ - gmx_trr_write_frame(trrout, begin+i, eigval[vec], 0, zerobox, natoms, x, NULL, NULL); + gmx_trr_write_frame(trrout, begin+i, eigval[vec], 0, zerobox, natoms, x, nullptr, nullptr); } gmx_trr_close(trrout); diff --git a/src/gromacs/gmxana/fitahx.cpp b/src/gromacs/gmxana/fitahx.cpp index 780d82ee1e..dc6f581d07 100644 --- a/src/gromacs/gmxana/fitahx.cpp +++ b/src/gromacs/gmxana/fitahx.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -76,8 +76,8 @@ real fit_ahx(int nres, t_bb bb[], int natoms, int nall, int allindex[], rvec x[], int nca, int caindex[], gmx_bool bFit) { - static rvec *xref = NULL; - static real *mass = NULL; + static rvec *xref = nullptr; + static real *mass = nullptr; const real d = 0.15; /* Rise per residue (nm) */ const real tw = 1.745; /* Twist per residue (rad) */ const real rad = 0.23; /* Radius of the helix (nm) */ @@ -90,7 +90,7 @@ real fit_ahx(int nres, t_bb bb[], int natoms, int nall, int allindex[], gmx_fatal(FARGS, "Need at least 3 Calphas to fit to, (now %d)...\n", nca); } - if (xref == NULL) + if (xref == nullptr) { snew(xref, natoms); snew(mass, natoms); diff --git a/src/gromacs/gmxana/gmx_anadock.cpp b/src/gromacs/gmxana/gmx_anadock.cpp index f1f3e6a6cc..d9f1fcede9 100644 --- a/src/gromacs/gmxana/gmx_anadock.cpp +++ b/src/gromacs/gmxana/gmx_anadock.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -73,19 +73,19 @@ static t_pdbfile *read_pdbf(const char *fn) snew(pdbf, 1); t_topology top; - read_tps_conf(fn, &top, &pdbf->ePBC, &pdbf->x, NULL, pdbf->box, FALSE); + read_tps_conf(fn, &top, &pdbf->ePBC, &pdbf->x, nullptr, pdbf->box, FALSE); pdbf->atoms = top.atoms; fp = gmx_ffopen(fn, "r"); char buf[256], *ptr; - while ((ptr = fgets2(buf, 255, fp)) != NULL) + while ((ptr = fgets2(buf, 255, fp)) != nullptr) { - if (std::strstr(buf, "Intermolecular") != NULL) + if (std::strstr(buf, "Intermolecular") != nullptr) { ptr = std::strchr(buf, '='); sscanf(ptr+1, "%lf", &e); pdbf->edocked = e; } - else if (std::strstr(buf, "Estimated Free") != NULL) + else if (std::strstr(buf, "Estimated Free") != nullptr) { ptr = std::strchr(buf, '='); sscanf(ptr+1, "%lf", &e); @@ -99,7 +99,7 @@ static t_pdbfile *read_pdbf(const char *fn) static t_pdbfile **read_em_all(const char *fn, int *npdbf) { - t_pdbfile **pdbf = 0; + t_pdbfile **pdbf = nullptr; int i, maxpdbf; char buf[256], name[256]; gmx_bool bExist; @@ -208,9 +208,9 @@ static void clust_stat(FILE *fp, int start, int end, t_pdbfile *pdbf[]) gmx_stats_add_point(ed, i-start, pdbf[i]->edocked, 0, 0); gmx_stats_add_point(ef, i-start, pdbf[i]->efree, 0, 0); } - gmx_stats_get_ase(ed, &aver, &sigma, NULL); + gmx_stats_get_ase(ed, &aver, &sigma, nullptr); fprintf(fp, " <%12s> = %8.3f (+/- %6.3f)\n", etitles[FALSE], aver, sigma); - gmx_stats_get_ase(ef, &aver, &sigma, NULL); + gmx_stats_get_ase(ef, &aver, &sigma, nullptr); fprintf(fp, " <%12s> = %8.3f (+/- %6.3f)\n", etitles[TRUE], aver, sigma); gmx_stats_free(ed); gmx_stats_free(ef); @@ -344,7 +344,7 @@ int gmx_anadock(int argc, char *argv[]) "energy or average energy." }; t_filenm fnm[] = { - { efPDB, "-f", NULL, ffREAD }, + { efPDB, "-f", nullptr, ffREAD }, { efXVG, "-od", "edocked", ffWRITE }, { efXVG, "-of", "efree", ffWRITE }, { efLOG, "-g", "anadock", ffWRITE } @@ -364,11 +364,11 @@ int gmx_anadock(int argc, char *argv[]) #define NPA asize(pa) FILE *fp; - t_pdbfile **pdbf = NULL; + t_pdbfile **pdbf = nullptr; int npdbf; if (!parse_common_args(&argc, argv, 0, NFILE, fnm, NPA, pa, asize(desc), desc, 0, - NULL, &oenv)) + nullptr, &oenv)) { return 0; } diff --git a/src/gromacs/gmxana/gmx_anaeig.cpp b/src/gromacs/gmxana/gmx_anaeig.cpp index 2897147615..23251a08c6 100644 --- a/src/gromacs/gmxana/gmx_anaeig.cpp +++ b/src/gromacs/gmxana/gmx_anaeig.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -318,7 +318,7 @@ compare(int natoms, int n1, rvec **eigvec1, int n2, rvec **eigvec2, // better to be safe than sorry, so we check it with an assert. // If we are in this comparison routine in the first place, neig2 should not be 0, // so eigval2 should always be a valid pointer. - GMX_RELEASE_ASSERT(eigval2 != NULL, "NULL pointer provided for eigval2"); + GMX_RELEASE_ASSERT(eigval2 != nullptr, "NULL pointer provided for eigval2"); for (i = n; i < neig2; i++) { @@ -511,19 +511,19 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri int noutvec, int *outvec, gmx_bool bSplit, const gmx_output_env_t *oenv) { - FILE *xvgrout = NULL; + FILE *xvgrout = nullptr; int nat, i, j, d, v, vec, nfr, nframes = 0, snew_size, frame; - t_trxstatus *out = NULL; + t_trxstatus *out = nullptr; t_trxstatus *status; int noutvec_extr, imin, imax; real *pmin, *pmax; int *all_at; matrix box; rvec *xread, *x; - real t, inp, **inprod = NULL; + real t, inp, **inprod = nullptr; char str[STRLEN], str2[STRLEN], **ylabel, *c; real fact; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; snew(x, natoms); @@ -591,7 +591,7 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri /* calculate x: a fitted struture of the selected atoms */ if (bFit) { - reset_x(nfit, ifit, nat, NULL, xread, w_rls); + reset_x(nfit, ifit, nat, nullptr, xread, w_rls); do_fit(nat, w_rls, xref, xread); } for (i = 0; i < natoms; i++) @@ -627,7 +627,7 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri } } } - write_trx(out, natoms, index, atoms, 0, t, box, xread, NULL, NULL); + write_trx(out, natoms, index, atoms, 0, t, box, xread, nullptr, nullptr); } nframes++; } @@ -654,7 +654,7 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri if (projfile) { - GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL if projfile is non-NULL"); + GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL if projfile is non-NULL"); snew(ylabel, noutvec); for (v = 0; v < noutvec; v++) { @@ -662,9 +662,9 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri ylabel[v] = gmx_strdup(str); } sprintf(str, "projection on eigenvectors (%s)", proj_unit); - write_xvgr_graphs(projfile, noutvec, 1, str, NULL, output_env_get_xvgr_tlabel(oenv), + write_xvgr_graphs(projfile, noutvec, 1, str, nullptr, output_env_get_xvgr_tlabel(oenv), (const char **)ylabel, - nframes, inprod[noutvec], inprod, NULL, + nframes, inprod[noutvec], inprod, nullptr, output_env_get_time_factor(oenv), FALSE, bSplit, oenv); } @@ -691,7 +691,7 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri { t_atoms atoms; rvec *x; - real *b = NULL; + real *b = nullptr; matrix box; char *resnm, *atnm; gmx_bool bPDB, b4D; @@ -754,7 +754,7 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri } if ( ( b4D || bSplit ) && bPDB) { - GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL with 4D or split PDB output options"); + GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL with 4D or split PDB output options"); out = gmx_ffopen(threedplotfile, "w"); fprintf(out, "HEADER %s\n", str); @@ -783,7 +783,7 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri } else { - write_sto_conf(threedplotfile, str, &atoms, x, NULL, ePBC, box); + write_sto_conf(threedplotfile, str, &atoms, x, nullptr, ePBC, box); } done_atom(&atoms); } @@ -794,7 +794,7 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri snew(pmax, noutvec_extr); if (extreme == 0) { - GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL"); + GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL"); fprintf(stderr, "%11s %17s %17s\n", "eigenvector", "Minimum", "Maximum"); fprintf(stderr, "%11s %10s %10s %10s %10s\n", "", "value", "frame", "value", "frame"); @@ -862,7 +862,7 @@ static void project(const char *trajfile, const t_topology *top, int ePBC, matri *eigvec[outvec[v]][i][d]/sqrtm[i]); } } - write_trx(out, natoms, index, atoms, 0, frame, topbox, xread, NULL, NULL); + write_trx(out, natoms, index, atoms, 0, frame, topbox, xread, nullptr, nullptr); } close_trx(out); } @@ -912,7 +912,7 @@ static void components(const char *outfile, int natoms, write_xvgr_graphs(outfile, noutvec, 4, "Eigenvector components", "black: total, red: x, green: y, blue: z", "Atom number", (const char **)ylabel, - natoms, x, NULL, y, 1, FALSE, FALSE, oenv); + natoms, x, nullptr, y, 1, FALSE, FALSE, oenv); fprintf(stderr, "\n"); } @@ -958,9 +958,9 @@ static void rmsf(const char *outfile, int natoms, real *sqrtm, y[g][i] = std::sqrt(eigval[eignr[v]]*norm2(eigvec[v][i]))/sqrtm[i]; } } - write_xvgr_graphs(outfile, noutvec, 1, "RMS fluctuation (nm) ", NULL, + write_xvgr_graphs(outfile, noutvec, 1, "RMS fluctuation (nm) ", nullptr, "Atom number", (const char **)ylabel, - natoms, x, y, NULL, 1, TRUE, FALSE, oenv); + natoms, x, y, nullptr, 1, TRUE, FALSE, oenv); fprintf(stderr, "\n"); } @@ -1071,11 +1071,11 @@ int gmx_anaeig(int argc, char *argv[]) t_topology top; int ePBC = -1; - const t_atoms *atoms = NULL; - rvec *xtop, *xref1, *xref2, *xrefp = NULL; + const t_atoms *atoms = nullptr; + rvec *xtop, *xref1, *xref2, *xrefp = nullptr; gmx_bool bDMR1, bDMA1, bDMR2, bDMA2; - int nvec1, nvec2, *eignr1 = NULL, *eignr2 = NULL; - rvec *xav1, *xav2, **eigvec1 = NULL, **eigvec2 = NULL; + int nvec1, nvec2, *eignr1 = nullptr, *eignr2 = nullptr; + rvec *xav1, *xav2, **eigvec1 = nullptr, **eigvec2 = nullptr; matrix topbox; real totmass, *sqrtm, *w_rls, t; int natoms; @@ -1083,7 +1083,7 @@ int gmx_anaeig(int argc, char *argv[]) const char *indexfile; int i, j, d; int nout, *iout, noutvec, *outvec, nfit; - int *index = NULL, *ifit = NULL; + int *index = nullptr, *ifit = nullptr; const char *VecFile, *Vec2File, *topfile; const char *EigFile, *Eig2File; const char *CompFile, *RmsfFile, *ProjOnVecFile; @@ -1092,7 +1092,7 @@ int gmx_anaeig(int argc, char *argv[]) const char *OverlapFile, *InpMatFile; gmx_bool bFit1, bFit2, bM, bIndex, bTPS, bTop, bVec2, bProj; gmx_bool bFirstToLast, bFirstLastSet, bTraj, bCompare, bPDB3D; - real *eigval1 = NULL, *eigval2 = NULL; + real *eigval1 = nullptr, *eigval2 = nullptr; int neig1, neig2; double **xvgdata; gmx_output_env_t *oenv; @@ -1101,9 +1101,9 @@ int gmx_anaeig(int argc, char *argv[]) t_filenm fnm[] = { { efTRN, "-v", "eigenvec", ffREAD }, { efTRN, "-v2", "eigenvec2", ffOPTRD }, - { efTRX, "-f", NULL, ffOPTRD }, - { efTPS, NULL, NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffOPTRD }, + { efTPS, nullptr, nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-eig", "eigenval", ffOPTRD }, { efXVG, "-eig2", "eigenval2", ffOPTRD }, { efXVG, "-comp", "eigcomp", ffOPTWR }, @@ -1120,7 +1120,7 @@ int gmx_anaeig(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -1164,7 +1164,7 @@ int gmx_anaeig(int argc, char *argv[]) neig1 = DIM*natoms; /* Overwrite eigenvalues from separate files if the user provides them */ - if (EigFile != NULL) + if (EigFile != nullptr) { int neig_tmp = read_xvg(EigFile, &xvgdata, &i); if (neig_tmp != neig1) @@ -1222,7 +1222,7 @@ int gmx_anaeig(int argc, char *argv[]) neig2 = 0; } - if (Eig2File != NULL) + if (Eig2File != nullptr) { neig2 = read_xvg(Eig2File, &xvgdata, &i); srenew(eigval2, neig2); @@ -1243,15 +1243,15 @@ int gmx_anaeig(int argc, char *argv[]) { bM = FALSE; } - if ((xref1 == NULL) && (bM || bTraj)) + if ((xref1 == nullptr) && (bM || bTraj)) { bTPS = TRUE; } - xtop = NULL; + xtop = nullptr; nfit = 0; - ifit = NULL; - w_rls = NULL; + ifit = nullptr; + w_rls = nullptr; if (!bTPS) { @@ -1260,14 +1260,14 @@ int gmx_anaeig(int argc, char *argv[]) else { bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), - &top, &ePBC, &xtop, NULL, topbox, bM); + &top, &ePBC, &xtop, nullptr, topbox, bM); atoms = &top.atoms; gpbc = gmx_rmpbc_init(&top.idef, ePBC, atoms->nr); gmx_rmpbc(gpbc, atoms->nr, topbox, xtop); /* Fitting is only required for the projection */ if (bProj && bFit1) { - if (xref1 == NULL) + if (xref1 == nullptr) { printf("\nNote: the structure in %s should be the same\n" " as the one used for the fit in g_covar\n", topfile); @@ -1289,7 +1289,7 @@ int gmx_anaeig(int argc, char *argv[]) } snew(xrefp, atoms->nr); - if (xref1 != NULL) + if (xref1 != nullptr) { /* Safety check between selected fit-group and reference structure read from the eigenvector file */ if (natoms != nfit) @@ -1308,7 +1308,7 @@ int gmx_anaeig(int argc, char *argv[]) { copy_rvec(xtop[ifit[i]], xrefp[ifit[i]]); } - reset_x(nfit, ifit, atoms->nr, NULL, xrefp, w_rls); + reset_x(nfit, ifit, atoms->nr, nullptr, xrefp, w_rls); } } gmx_rmpbc_done(gpbc); @@ -1402,7 +1402,7 @@ int gmx_anaeig(int argc, char *argv[]) { printf("Select eigenvectors for output, end your selection with 0\n"); nout = -1; - iout = NULL; + iout = nullptr; do { @@ -1458,8 +1458,8 @@ int gmx_anaeig(int argc, char *argv[]) if (bProj) { - project(bTraj ? opt2fn("-f", NFILE, fnm) : NULL, - bTop ? &top : NULL, ePBC, topbox, + project(bTraj ? opt2fn("-f", NFILE, fnm) : nullptr, + bTop ? &top : nullptr, ePBC, topbox, ProjOnVecFile, TwoDPlotFile, ThreeDPlotFile, FilterFile, skip, ExtremeFile, bFirstLastSet, max, nextr, atoms, natoms, index, bFit1, xrefp, nfit, ifit, w_rls, diff --git a/src/gromacs/gmxana/gmx_analyze.cpp b/src/gromacs/gmxana/gmx_analyze.cpp index c7b477f4d1..36ad1e0940 100644 --- a/src/gromacs/gmxana/gmx_analyze.cpp +++ b/src/gromacs/gmxana/gmx_analyze.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -221,7 +221,7 @@ static void regression_analysis(int n, gmx_bool bXYdy, } } snew(a, nset-1); - chi2 = multi_regression(NULL, n, y, nset-1, xx, a); + chi2 = multi_regression(nullptr, n, y, nset-1, xx, a); printf("Fitting %d data points in %d sets\n", n, nset-1); printf("chi2 = %g\n", chi2); printf("A ="); @@ -321,7 +321,7 @@ static void average(const char *avfile, int avbar_opt, FILE *fp; int i, s, edge = 0; double av, var, err; - real *tmp = NULL; + real *tmp = nullptr; fp = gmx_ffopen(avfile, "w"); if ((avbar_opt == avbarERROR) && (nset == 1)) @@ -563,7 +563,7 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n, fitparm[2] = std::sqrt(tau1_est*(n-1)*dt); do_lmfit(nbs, ybs, fitsig, 0, tbs, 0, dt*n, oenv, bDebugMode(), effnERREST, fitparm, 0, - NULL); + nullptr); } if (bSingleExpFit || fitparm[0] < 0 || fitparm[2] < 0 || fitparm[1] < 0 || (fitparm[1] > 1 && !bAllowNegLTCorr) || fitparm[2] > (n-1)*dt) @@ -592,7 +592,7 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n, fitparm[2] = (n-1)*dt; fprintf(stdout, "Will fix tau2 at the total time: %g\n", fitparm[2]); do_lmfit(nbs, ybs, fitsig, 0, tbs, 0, dt*n, oenv, bDebugMode(), - effnERREST, fitparm, 4, NULL); + effnERREST, fitparm, 4, nullptr); } if (bSingleExpFit || fitparm[0] < 0 || fitparm[1] < 0 || (fitparm[1] > 1 && !bAllowNegLTCorr)) @@ -610,7 +610,7 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n, fitparm[1] = 1.0; fitparm[2] = 0.0; do_lmfit(nbs, ybs, fitsig, 0, tbs, 0, dt*n, oenv, bDebugMode(), - effnERREST, fitparm, 6, NULL); + effnERREST, fitparm, 6, nullptr); } } ee = optimal_error_estimate(sig[s], fitparm, n*dt); @@ -657,7 +657,7 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n, fitsig[i] = 1; } } - low_do_autocorr(NULL, oenv, NULL, n, 1, -1, &ac, + low_do_autocorr(nullptr, oenv, nullptr, n, 1, -1, &ac, dt, eacNormal, 1, FALSE, TRUE, FALSE, 0, 0, effnNONE); @@ -680,8 +680,8 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n, ac_fit[0] = 0.5*acint; ac_fit[1] = 0.95; ac_fit[2] = 10*acint; - do_lmfit(n/nb_min, ac, fitsig, dt, 0, 0, fitlen*dt, oenv, - bDebugMode(), effnEXPEXP, ac_fit, 0, NULL); + do_lmfit(n/nb_min, ac, fitsig, dt, nullptr, 0, fitlen*dt, oenv, + bDebugMode(), effnEXPEXP, ac_fit, 0, nullptr); ac_fit[3] = 1 - ac_fit[1]; fprintf(stdout, "Set %3d: ac erest %g a %g tau1 %g tau2 %g\n", @@ -735,7 +735,7 @@ static void luzar_correl(int nn, real *time, int nset, real **val, real temp, } fprintf(debug, "RMS difference in derivatives is %g\n", std::sqrt(d2/nn)); } - analyse_corr(nn, time, val[0], val[2], kt, NULL, NULL, NULL, fit_start, + analyse_corr(nn, time, val[0], val[2], kt, nullptr, nullptr, nullptr, fit_start, temp); sfree(kt); } @@ -799,7 +799,7 @@ static void do_fit(FILE *out, int n, gmx_bool bYdy, int npargs, t_pargs *ppa, const gmx_output_env_t *oenv, const char *fn_fitted) { - real *c1 = NULL, *sig = NULL; + real *c1 = nullptr, *sig = nullptr; double *fitparm; real tendfit, tbeginfit; int i, efitfn, nparm; @@ -918,9 +918,9 @@ static void print_fitted_function(const char *fitfile, } else { - char *buf2 = NULL; + char *buf2 = nullptr; int s, buflen = 0; - if (NULL != fn_fitted) + if (nullptr != fn_fitted) { buflen = std::strlen(fn_fitted)+32; snew(buf2, buflen); @@ -929,8 +929,8 @@ static void print_fitted_function(const char *fitfile, } for (s = 0; s < nset; s++) { - char *buf = NULL; - if (NULL != fn_fitted) + char *buf = nullptr; + if (nullptr != fn_fitted) { snew(buf, buflen); snprintf(buf, n, "%s_%d.xvg", buf2, s); @@ -1041,7 +1041,7 @@ int gmx_analyze(int argc, char *argv[]) /* must correspond to enum avbar* declared at beginning of file */ static const char *avbar_opt[avbarNR+1] = { - NULL, "none", "stddev", "error", "90", NULL + nullptr, "none", "stddev", "error", "90", nullptr }; t_pargs pa[] = { @@ -1129,7 +1129,7 @@ int gmx_analyze(int argc, char *argv[]) ppa = add_acf_pargs(&npargs, pa); if (!parse_common_args(&argc, argv, PCA_CAN_VIEW, - NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv)) { sfree(ppa); return 0; @@ -1141,7 +1141,7 @@ int gmx_analyze(int argc, char *argv[]) distfile = opt2fn_null("-dist", NFILE, fnm); avfile = opt2fn_null("-av", NFILE, fnm); eefile = opt2fn_null("-ee", NFILE, fnm); - if (opt2parg_bSet("-fitfn", npargs, ppa) && acfile == NULL) + if (opt2parg_bSet("-fitfn", npargs, ppa) && acfile == nullptr) { fitfile = opt2fn("-g", NFILE, fnm); } @@ -1185,13 +1185,13 @@ int gmx_analyze(int argc, char *argv[]) { for (s = 0; s < nset; s++) { - sum = evaluate_integral(n, t, val[s], NULL, aver_start, &stddev); + sum = evaluate_integral(n, t, val[s], nullptr, aver_start, &stddev); printf("Integral %d %10.5f +/- %10.5f\n", s+1, sum, stddev); } } } - if (fitfile != NULL) + if (fitfile != nullptr) { print_fitted_function(fitfile, opt2fn_null("-fitted", NFILE, fnm), @@ -1304,7 +1304,7 @@ int gmx_analyze(int argc, char *argv[]) power_fit(n, nset, val, t); } - if (acfile != NULL) + if (acfile != nullptr) { if (bSubAv) { diff --git a/src/gromacs/gmxana/gmx_angle.cpp b/src/gromacs/gmxana/gmx_angle.cpp index 5ebdeb124a..295b9be41b 100644 --- a/src/gromacs/gmxana/gmx_angle.cpp +++ b/src/gromacs/gmxana/gmx_angle.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -101,7 +101,7 @@ static void dump_dih_trr(int nframes, int nangles, real **dih, const char *fn, } } } - gmx_trr_write_frame(fio, i, time[i], 0, box, na, x, NULL, NULL); + gmx_trr_write_frame(fio, i, time[i], 0, box, na, x, nullptr, nullptr); } gmx_trr_close(fio); sfree(x); @@ -130,7 +130,7 @@ int gmx_g_angle(int argc, char *argv[]) "records a histogram of the times between such transitions,", "assuming the input trajectory frames are equally spaced in time." }; - static const char *opt[] = { NULL, "angle", "dihedral", "improper", "ryckaert-bellemans", NULL }; + static const char *opt[] = { nullptr, "angle", "dihedral", "improper", "ryckaert-bellemans", nullptr }; static gmx_bool bALL = FALSE, bChandler = FALSE, bAverCorr = FALSE, bPBC = TRUE; static real binwidth = 1; t_pargs pa[] = { @@ -167,18 +167,18 @@ int gmx_g_angle(int argc, char *argv[]) real aver, aver2, aversig; /* fraction trans dihedrals */ double tfrac = 0; char title[256]; - real **dih = NULL; /* mega array with all dih. angles at all times*/ + real **dih = nullptr; /* mega array with all dih. angles at all times*/ real *time, *trans_frac, *aver_angle; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efNDX, NULL, "angle", ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efNDX, nullptr, "angle", ffREAD }, { efXVG, "-od", "angdist", ffWRITE }, { efXVG, "-ov", "angaver", ffOPTWR }, { efXVG, "-of", "dihfrac", ffOPTWR }, { efXVG, "-ot", "dihtrans", ffOPTWR }, { efXVG, "-oh", "trhisto", ffOPTWR }, { efXVG, "-oc", "dihcorr", ffOPTWR }, - { efTRR, "-or", NULL, ffOPTWR } + { efTRR, "-or", nullptr, ffOPTWR } }; #define NFILE asize(fnm) int npargs; @@ -199,7 +199,7 @@ int gmx_g_angle(int argc, char *argv[]) maxang = 360.0; bRb = FALSE; - GMX_RELEASE_ASSERT(opt[0] != NULL, "Internal option inconsistency; opt[0]==NULL after processing"); + GMX_RELEASE_ASSERT(opt[0] != nullptr, "Internal option inconsistency; opt[0]==NULL after processing"); switch (opt[0][0]) { @@ -434,7 +434,7 @@ int gmx_g_angle(int argc, char *argv[]) { sprintf(title, "Dihedral Distribution: %s", grpname); - calc_distribution_props(maxangstat, angstat, -180.0, 0, NULL, &S2); + calc_distribution_props(maxangstat, angstat, -180.0, 0, nullptr, &S2); fprintf(stderr, "Order parameter S^2 = %g\n", S2); } diff --git a/src/gromacs/gmxana/gmx_bar.cpp b/src/gromacs/gmxana/gmx_bar.cpp index 14a7895856..4755864f06 100644 --- a/src/gromacs/gmxana/gmx_bar.cpp +++ b/src/gromacs/gmxana/gmx_bar.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -255,11 +255,11 @@ static gmx_bool lambda_components_check(const lambda_components_t *lc, { return FALSE; } - if (name == NULL && lc->names[index] == NULL) + if (name == nullptr && lc->names[index] == nullptr) { return TRUE; } - if ((name == NULL) != (lc->names[index] == NULL)) + if ((name == nullptr) != (lc->names[index] == nullptr)) { return FALSE; } @@ -566,11 +566,11 @@ static void hist_init(hist_t *h, int nhist, int *nbin) static void xvg_init(xvg_t *ba) { - ba->filename = NULL; + ba->filename = nullptr; ba->nset = 0; ba->np_alloc = 0; - ba->np = NULL; - ba->y = NULL; + ba->np = nullptr; + ba->y = nullptr; } static void samples_init(samples_t *s, lambda_vec_t *native_lambda, @@ -583,13 +583,13 @@ static void samples_init(samples_t *s, lambda_vec_t *native_lambda, s->derivative = derivative; s->ndu = 0; - s->du = NULL; - s->t = NULL; + s->du = nullptr; + s->t = nullptr; s->start_time = s->delta_time = 0; - s->hist = NULL; - s->du_alloc = NULL; - s->t_alloc = NULL; - s->hist_alloc = NULL; + s->hist = nullptr; + s->du_alloc = nullptr; + s->t_alloc = nullptr; + s->hist_alloc = nullptr; s->ndu_alloc = 0; s->nt_alloc = 0; @@ -602,7 +602,7 @@ static void sample_range_init(sample_range_t *r, samples_t *s) r->start = 0; r->end = s->ndu; r->use = TRUE; - r->s = NULL; + r->s = nullptr; } static void sample_coll_init(sample_coll_t *sc, lambda_vec_t *native_lambda, @@ -613,12 +613,12 @@ static void sample_coll_init(sample_coll_t *sc, lambda_vec_t *native_lambda, sc->temp = temp; sc->nsamples = 0; - sc->s = NULL; - sc->r = NULL; + sc->s = nullptr; + sc->r = nullptr; sc->nsamples_alloc = 0; sc->ntot = 0; - sc->next = sc->prev = NULL; + sc->next = sc->prev = nullptr; } static void sample_coll_destroy(sample_coll_t *sc) @@ -635,12 +635,12 @@ static void lambda_data_init(lambda_data_t *l, lambda_vec_t *native_lambda, l->lambda = native_lambda; l->temp = temp; - l->next = NULL; - l->prev = NULL; + l->next = nullptr; + l->prev = nullptr; l->sc = &(l->sc_head); - sample_coll_init(l->sc, native_lambda, NULL, 0.); + sample_coll_init(l->sc, native_lambda, nullptr, 0.); l->sc->next = l->sc; l->sc->prev = l->sc; } @@ -656,8 +656,8 @@ static void barres_init(barres_t *br) br->dg_stddev = 0; br->dg_stddev_err = 0; - br->a = NULL; - br->b = NULL; + br->a = nullptr; + br->b = nullptr; } @@ -700,7 +700,7 @@ static sample_coll_t *lambda_data_find_sample_coll(lambda_data_t *l, sc = sc->next; } - return NULL; + return nullptr; } /* insert li into an ordered list of lambda_colls */ @@ -995,10 +995,10 @@ void sim_data_histogram(sim_data_t *sd, const char *filename, FILE *fp; lambda_data_t *bl; int nsets = 0; - char **setnames = NULL; + char **setnames = nullptr; gmx_bool first_set = FALSE; /* histogram data: */ - int *hist = NULL; + int *hist = nullptr; int nbin = 0; int nbin_alloc = 0; double dx = 0; @@ -1059,7 +1059,7 @@ void sim_data_histogram(sim_data_t *sd, const char *filename, { if (!first_set) { - xvgr_new_dataset(fp, 0, 0, NULL, oenv); + xvgr_new_dataset(fp, 0, 0, nullptr, oenv); } sample_coll_make_hist(sc, &hist, &nbin_alloc, &nbin, &dx, &minval, @@ -2213,9 +2213,9 @@ static const char *find_value(const char *str) gmx_bool name_end_found = FALSE; /* if the string is a NULL pointer, return a NULL pointer. */ - if (str == NULL) + if (str == nullptr) { - return NULL; + return nullptr; } while (*str != '\0') { @@ -2236,7 +2236,7 @@ static const char *find_value(const char *str) } str++; } - return NULL; + return nullptr; } @@ -2248,14 +2248,14 @@ static gmx_bool read_lambda_compvec(const char *str, const char **end, const char *fn) { - gmx_bool initialize_lc = FALSE; /* whether to initialize the lambda - components, or to check them */ - gmx_bool start_reached = FALSE; /* whether the start of component names - has been reached */ - gmx_bool vector = FALSE; /* whether there are multiple components */ - int n = 0; /* current component number */ - const char *val_start = NULL; /* start of the component name, or NULL - if not in a value */ + gmx_bool initialize_lc = FALSE; /* whether to initialize the lambda + components, or to check them */ + gmx_bool start_reached = FALSE; /* whether the start of component names + has been reached */ + gmx_bool vector = FALSE; /* whether there are multiple components */ + int n = 0; /* current component number */ + const char *val_start = nullptr; /* start of the component name, or NULL + if not in a value */ char *strtod_end; gmx_bool OK = TRUE; @@ -2270,7 +2270,7 @@ static gmx_bool read_lambda_compvec(const char *str, initialize_lc = TRUE; } - if (lc_in == NULL) + if (lc_in == nullptr) { lc_in = lc_out; } @@ -2302,7 +2302,7 @@ static gmx_bool read_lambda_compvec(const char *str, if (std::isspace(*str) || *str == ')' || *str == ',' || *str == '\0') { /* end of value */ - if (lv == NULL) + if (lv == nullptr) { if (initialize_lc) { @@ -2329,7 +2329,7 @@ static gmx_bool read_lambda_compvec(const char *str, } } /* reset for the next identifier */ - val_start = NULL; + val_start = nullptr; n++; if (!vector) { @@ -2354,12 +2354,12 @@ static gmx_bool read_lambda_compvec(const char *str, } else { - GMX_RELEASE_ASSERT(lc_in != NULL, "Internal inconsistency? lc_in==NULL"); + GMX_RELEASE_ASSERT(lc_in != nullptr, "Internal inconsistency? lc_in==NULL"); if (n == lc_in->N) { return OK; } - else if (lv == NULL) + else if (lv == nullptr) { return FALSE; } @@ -2397,7 +2397,7 @@ static gmx_bool read_lambda_components(const char *str, const char **end, const char *fn) { - return read_lambda_compvec(str, NULL, NULL, lc, end, fn); + return read_lambda_compvec(str, nullptr, nullptr, lc, end, fn); } /* read an initialized lambda vector from a string */ @@ -2406,7 +2406,7 @@ static gmx_bool read_lambda_vector(const char *str, const char **end, const char *fn) { - return read_lambda_compvec(str, lv, lv->lc, NULL, end, fn); + return read_lambda_compvec(str, lv, lv->lc, nullptr, end, fn); } @@ -2422,12 +2422,12 @@ static gmx_bool legend2lambda(const char *fn, const char *legend, lambda_vec_t *lam) { - const char *ptr = NULL, *ptr2 = NULL; + const char *ptr = nullptr, *ptr2 = nullptr; gmx_bool ok = FALSE; gmx_bool bdhdl = FALSE; const char *tostr = " to "; - if (legend == NULL) + if (legend == nullptr) { gmx_fatal(FARGS, "There is no legend in file '%s', can not deduce lambda", fn); } @@ -2437,13 +2437,13 @@ static gmx_bool legend2lambda(const char *fn, do { ptr2 = std::strstr(ptr2, tostr); - if (ptr2 != NULL) + if (ptr2 != nullptr) { ptr = ptr2; ptr2++; } } - while (ptr2 != NULL && *ptr2 != '\0'); + while (ptr2 != nullptr && *ptr2 != '\0'); if (ptr) { @@ -2465,7 +2465,7 @@ static gmx_bool legend2lambda(const char *fn, ok = TRUE; bdhdl = TRUE; } - else if (std::strchr(legend, 'D') != NULL && std::strchr(legend, 'H') != NULL) + else if (std::strchr(legend, 'D') != nullptr && std::strchr(legend, 'H') != nullptr) { ok = TRUE; bdhdl = FALSE; @@ -2486,7 +2486,7 @@ static gmx_bool legend2lambda(const char *fn, if (!bdhdl) { ptr = find_value(ptr); - if (!ptr || !read_lambda_vector(ptr, lam, NULL, fn)) + if (!ptr || !read_lambda_vector(ptr, lam, nullptr, fn)) { gmx_fatal(FARGS, "lambda vector '%s' %s faulty", legend, fn); } @@ -2610,7 +2610,7 @@ static gmx_bool subtitle2lambda(const char *subtitle, xvg_t *ba, const char *fn, return FALSE; } lambda_vec_init(&(ba->native_lambda), lc); - if (!read_lambda_vector(ptr, &(ba->native_lambda), NULL, fn)) + if (!read_lambda_vector(ptr, &(ba->native_lambda), nullptr, fn)) { gmx_fatal(FARGS, "lambda vector in %s faulty", fn); } @@ -2622,21 +2622,21 @@ static gmx_bool subtitle2lambda(const char *subtitle, xvg_t *ba, const char *fn, /* compatibility mode: check for lambda in other ways. */ /* plain text lambda string */ ptr = std::strstr(subtitle, "lambda"); - if (ptr == NULL) + if (ptr == nullptr) { /* xmgrace formatted lambda string */ ptr = std::strstr(subtitle, "\\xl\\f{}"); } - if (ptr == NULL) + if (ptr == nullptr) { /* xmgr formatted lambda string */ ptr = std::strstr(subtitle, "\\8l\\4"); } - if (ptr != NULL) + if (ptr != nullptr) { ptr = std::strstr(ptr, "="); } - if (ptr != NULL) + if (ptr != nullptr) { bFound = (sscanf(ptr+1, "%lf", &(native_lambda)) == 1); /* add the lambda component name as an empty string */ @@ -2677,7 +2677,7 @@ static double filename2lambda(const char *fn) } /* searching backward to find the second directory separator */ dirsep = 0; - digitptr = NULL; + digitptr = nullptr; while (ptr >= fn) { if (ptr[0] != DIR_SEPARATOR && ptr[1] == DIR_SEPARATOR) @@ -2746,11 +2746,11 @@ static void read_bar_xvg_lowlevel(const char *fn, real *temp, xvg_t *ba, } ba->temp = -1; - if (subtitle != NULL) + if (subtitle != nullptr) { /* try to extract temperature */ ptr = std::strstr(subtitle, "T ="); - if (ptr != NULL) + if (ptr != nullptr) { ptr += 3; if (sscanf(ptr, "%lf", &ba->temp) == 1) @@ -2781,7 +2781,7 @@ static void read_bar_xvg_lowlevel(const char *fn, real *temp, xvg_t *ba, } } snew(ba->lambda, ba->nset); - if (legend == NULL) + if (legend == nullptr) { /* Check if we have a single set, no legend, nset=1 means t and dH/dl */ if (ba->nset == 1) @@ -2835,7 +2835,7 @@ static void read_bar_xvg_lowlevel(const char *fn, real *temp, xvg_t *ba, gmx_fatal(FARGS, "File %s contains multiple sets but no indication of the native lambda", fn); } - if (legend != NULL) + if (legend != nullptr) { for (i = 0; i < ba->nset-1; i++) { @@ -3027,7 +3027,7 @@ static samples_t *read_edr_hist_block(int *nsamples, t_enxblock *blk, nhist = blk->nsub-2; if (nhist == 0) { - return NULL; + return nullptr; } if (nhist > 2) { @@ -3151,13 +3151,13 @@ static void read_barsim_edr(char *fn, real *temp, sim_data_t *sd) ener_file_t fp; t_enxframe *fr; int nre; - gmx_enxnm_t *enm = NULL; + gmx_enxnm_t *enm = nullptr; double first_t = -1; double last_t = -1; - samples_t **samples_rawdh = NULL; /* contains samples for raw delta_h */ - int *nhists = NULL; /* array to keep count & print at end */ - int *npts = NULL; /* array to keep count & print at end */ - lambda_vec_t **lambdas = NULL; /* array to keep count & print at end */ + samples_t **samples_rawdh = nullptr; /* contains samples for raw delta_h */ + int *nhists = nullptr; /* array to keep count & print at end */ + int *npts = nullptr; /* array to keep count & print at end */ + lambda_vec_t **lambdas = nullptr; /* array to keep count & print at end */ lambda_vec_t *native_lambda; int nsamples = 0; lambda_vec_t start_lambda; @@ -3167,7 +3167,7 @@ static void read_barsim_edr(char *fn, real *temp, sim_data_t *sd) snew(fr, 1); snew(native_lambda, 1); - start_lambda.lc = NULL; + start_lambda.lc = nullptr; while (do_enx(fp, fr)) { @@ -3306,9 +3306,9 @@ static void read_barsim_edr(char *fn, real *temp, sim_data_t *sd) { nhists[i] = 0; npts[i] = 0; - lambdas[i] = NULL; - samples_rawdh[i] = NULL; /* init to NULL so we know which - ones contain values */ + lambdas[i] = nullptr; + samples_rawdh[i] = nullptr; /* init to NULL so we know which + ones contain values */ } } else @@ -3338,7 +3338,7 @@ static void read_barsim_edr(char *fn, real *temp, sim_data_t *sd) // nsamples is always >0 here, so samples_rawdh must be a valid pointer. Unfortunately // cppcheck does not understand the logic unless the assert is inside the loop, but // this is not performance-sensitive code. - GMX_RELEASE_ASSERT(samples_rawdh != NULL, "samples_rawdh==NULL with nsamples>0"); + GMX_RELEASE_ASSERT(samples_rawdh != nullptr, "samples_rawdh==NULL with nsamples>0"); if (samples_rawdh[i]) { /* insert it into the existing list */ @@ -3346,7 +3346,7 @@ static void read_barsim_edr(char *fn, real *temp, sim_data_t *sd) samples_rawdh[i]); /* and make sure we'll allocate a new one this time around */ - samples_rawdh[i] = NULL; + samples_rawdh[i] = nullptr; } } } @@ -3603,7 +3603,7 @@ int gmx_bar(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -3696,7 +3696,7 @@ int gmx_bar(int argc, char *argv[]) - fpb = NULL; + fpb = nullptr; if (opt2bSet("-o", NFILE, fnm)) { sprintf(buf, "%s (%s)", "\\DeltaG", "kT"); @@ -3704,7 +3704,7 @@ int gmx_bar(int argc, char *argv[]) "\\lambda", buf, exvggtXYDY, oenv); } - fpi = NULL; + fpi = nullptr; if (opt2bSet("-oi", NFILE, fnm)) { sprintf(buf, "%s (%s)", "\\DeltaG", "kT"); @@ -3846,14 +3846,14 @@ int gmx_bar(int argc, char *argv[]) for (f = 0; f < nresults; f++) { - if (fpi != NULL) + if (fpi != nullptr) { lambda_vec_print_short(results[f].a->native_lambda, buf); fprintf(fpi, xvg2format, buf, dg_tot); } - if (fpb != NULL) + if (fpb != nullptr) { lambda_vec_print_intermediate(results[f].a->native_lambda, results[f].b->native_lambda, @@ -3922,13 +3922,13 @@ int gmx_bar(int argc, char *argv[]) printf("\n"); - if (fpi != NULL) + if (fpi != nullptr) { lambda_vec_print_short(results[nresults-1].b->native_lambda, buf); fprintf(fpi, xvg2format, buf, dg_tot); xvgrclose(fpi); } - if (fpb != NULL) + if (fpb != nullptr) { xvgrclose(fpb); } diff --git a/src/gromacs/gmxana/gmx_bundle.cpp b/src/gromacs/gmxana/gmx_bundle.cpp index 17c8167279..286e67a57d 100644 --- a/src/gromacs/gmxana/gmx_bundle.cpp +++ b/src/gromacs/gmxana/gmx_bundle.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -157,10 +157,10 @@ static void dump_axes(t_trxstatus *status, t_trxframe *fr, t_atoms *outat, t_bundle *bun) { t_trxframe frout; - static rvec *xout = NULL; + static rvec *xout = nullptr; int i; - if (xout == NULL) + if (xout == nullptr) { snew(xout, outat->nr); } @@ -186,7 +186,7 @@ static void dump_axes(t_trxstatus *status, t_trxframe *fr, t_atoms *outat, frout.natoms = outat->nr; frout.atoms = outat; frout.x = xout; - write_trxframe(status, &frout, NULL); + write_trxframe(status, &frout, nullptr); } int gmx_bundle(int argc, char *argv[]) @@ -223,7 +223,7 @@ int gmx_bundle(int argc, char *argv[]) "Use the [IT]z[it]-axis as reference instead of the average axis" } }; FILE *flen, *fdist, *fz, *ftilt, *ftiltr, *ftiltl; - FILE *fkink = NULL, *fkinkr = NULL, *fkinkl = NULL; + FILE *fkink = nullptr, *fkinkr = nullptr, *fkinkl = nullptr; t_trxstatus *status; t_trxstatus *fpdb; t_topology top; @@ -242,13 +242,13 @@ int gmx_bundle(int argc, char *argv[]) gmx_bool bKink; rvec va, vb, vc, vr, vl; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; #define NLEG asize(leg) t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-ol", "bun_len", ffWRITE }, { efXVG, "-od", "bun_dist", ffWRITE }, { efXVG, "-oz", "bun_z", ffWRITE }, @@ -263,12 +263,12 @@ int gmx_bundle(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, TRUE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, TRUE); bKink = opt2bSet("-ok", NFILE, fnm) || opt2bSet("-okr", NFILE, fnm) || opt2bSet("-okl", NFILE, fnm); @@ -349,7 +349,7 @@ int gmx_bundle(int argc, char *argv[]) } else { - fpdb = NULL; + fpdb = nullptr; } read_first_frame(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &fr, TRX_NEED_X); diff --git a/src/gromacs/gmxana/gmx_chi.cpp b/src/gromacs/gmxana/gmx_chi.cpp index f3412fcb5f..1ce9b2645f 100644 --- a/src/gromacs/gmxana/gmx_chi.cpp +++ b/src/gromacs/gmxana/gmx_chi.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -479,16 +479,16 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t *rt, #define NKKKCHI asize(kkkchi1) #define NJC (NKKKPHI+NKKKPSI+NKKKCHI) - FILE *fp, *ssfp[3] = {NULL, NULL, NULL}; + FILE *fp, *ssfp[3] = {nullptr, nullptr, nullptr}; const char *sss[3] = { "sheet", "helix", "coil" }; real S2; real *normhisto; real **Jc, **Jcsig; - int ****his_aa_ss = NULL; + int ****his_aa_ss = nullptr; int ***his_aa, *histmp; int i, j, k, m, n, nn, Dih, nres, hindex, angle; gmx_bool bBfac, bOccup; - char hisfile[256], hhisfile[256], sshisfile[256], title[256], *ss_str = NULL; + char hisfile[256], hhisfile[256], sshisfile[256], title[256], *ss_str = nullptr; char **leg; const char *residue_name; int rt_size; @@ -630,7 +630,7 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t *rt, } break; default: /* covers edOmega and higher Chis than Chi1 */ - calc_distribution_props(nbin, histmp, -M_PI, 0, NULL, &S2); + calc_distribution_props(nbin, histmp, -M_PI, 0, nullptr, &S2); break; } dlist[i].S2[Dih] = S2; @@ -892,12 +892,12 @@ static FILE *rama_file(const char *fn, const char *title, const char *xaxis, static void do_rama(int nf, int nlist, t_dlist dlist[], real **dih, gmx_bool bViol, gmx_bool bRamOmega, const gmx_output_env_t *oenv) { - FILE *fp, *gp = NULL; + FILE *fp, *gp = nullptr; gmx_bool bOm; char fn[256]; int i, j, k, Xi1, Xi2, Phi, Psi, Om = 0, nlevels; #define NMAT 120 - real **mat = NULL, phi, psi, omega, axis[NMAT], lo, hi; + real **mat = nullptr, phi, psi, omega, axis[NMAT], lo, hi; t_rgb rlo = { 1.0, 0.0, 0.0 }; t_rgb rmid = { 1.0, 1.0, 1.0 }; t_rgb rhi = { 0.0, 0.0, 1.0 }; @@ -1140,13 +1140,13 @@ static void order_params(FILE *log, } xvgrclose(fp); - if (NULL != pdbfn) + if (nullptr != pdbfn) { real x0, y0, z0; atoms->havePdbInfo = TRUE; - if (NULL == atoms->pdbinfo) + if (nullptr == atoms->pdbinfo) { snew(atoms->pdbinfo, atoms->nr); } @@ -1174,7 +1174,7 @@ static void order_params(FILE *log, fprintf(fp, "REMARK generated by g_chi\n"); fprintf(fp, "REMARK " "B-factor field contains negative of dihedral order parameters\n"); - write_pdbfile(fp, NULL, atoms, x, ePBC, box, ' ', 0, NULL, TRUE); + write_pdbfile(fp, nullptr, atoms, x, ePBC, box, ' ', 0, nullptr, TRUE); x0 = y0 = z0 = 1000.0; for (i = 0; (i < atoms->nr); i++) { @@ -1312,7 +1312,7 @@ int gmx_chi(int argc, char *argv[]) static gmx_bool bAll = FALSE; static gmx_bool bPhi = FALSE, bPsi = FALSE, bOmega = FALSE; static real bfac_init = -1.0, bfac_max = 0; - static const char *maxchistr[] = { NULL, "0", "1", "2", "3", "4", "5", "6", NULL }; + static const char *maxchistr[] = { nullptr, "0", "1", "2", "3", "4", "5", "6", nullptr }; static gmx_bool bRama = FALSE, bShift = FALSE, bViol = FALSE, bRamOmega = FALSE; static gmx_bool bNormHisto = TRUE, bChiProduct = FALSE, bHChi = FALSE, bRAD = FALSE, bPBC = TRUE; static real core_frac = 0.5; @@ -1376,8 +1376,8 @@ int gmx_chi(int argc, char *argv[]) int i, **chi_lookup, *multiplicity; t_filenm fnm[] = { - { efSTX, "-s", NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, + { efSTX, "-s", nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, { efXVG, "-o", "order", ffWRITE }, { efPDB, "-p", "order", ffOPTWR }, { efDAT, "-ss", "ssdump", ffOPTRD }, @@ -1452,9 +1452,9 @@ int gmx_chi(int argc, char *argv[]) /* Find the chi angles using atoms struct and a list of amino acids */ t_topology *top; snew(top, 1); - read_tps_conf(ftp2fn(efSTX, NFILE, fnm), top, &ePBC, &x, NULL, box, FALSE); + read_tps_conf(ftp2fn(efSTX, NFILE, fnm), top, &ePBC, &x, nullptr, box, FALSE); t_atoms &atoms = top->atoms; - if (atoms.pdbinfo == NULL) + if (atoms.pdbinfo == nullptr) { snew(atoms.pdbinfo, atoms.nr); } diff --git a/src/gromacs/gmxana/gmx_cluster.cpp b/src/gromacs/gmxana/gmx_cluster.cpp index f8a9047323..6dd4946104 100644 --- a/src/gromacs/gmxana/gmx_cluster.cpp +++ b/src/gromacs/gmxana/gmx_cluster.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -154,7 +154,7 @@ void mc_optimize(FILE *log, t_mat *m, real *time, int seed, real kT, const char *conv, gmx_output_env_t *oenv) { - FILE *fp = NULL; + FILE *fp = nullptr; real ecur, enext, emin, prob, enorm; int i, j, iswap, jswap, nn, nuphill = 0; t_mat *minimum; @@ -207,7 +207,7 @@ void mc_optimize(FILE *log, t_mat *m, real *time, minimum->nn = nn; copy_t_mat(minimum, m); - if (NULL != conv) + if (nullptr != conv) { fp = xvgropen(conv, "Convergence of the MC optimization", "Energy", "Step", oenv); @@ -257,7 +257,7 @@ void mc_optimize(FILE *log, t_mat *m, real *time, fprintf(log, "Iter: %d Swapped %4d and %4d (energy: %g prob: %g)\n", i, iswap, jswap, enext, prob); - if (NULL != fp) + if (nullptr != fp) { fprintf(fp, "%6d %10g\n", i, enext); } @@ -285,7 +285,7 @@ void mc_optimize(FILE *log, t_mat *m, real *time, (i < m->nn-1) ? m->mat[m->m_ind[i]][m->m_ind[i+1]] : 0); } - if (NULL != fp) + if (nullptr != fp) { xvgrclose(fp); } @@ -484,7 +484,7 @@ static void jarvis_patrick(int n1, real **mat, int M, int P, int **nnb; int i, j, k, cid, diff, maxval; gmx_bool bChange; - real **mcpy = NULL; + real **mcpy = nullptr; if (rmsdcut < 0) { @@ -773,8 +773,8 @@ rvec **read_whole_trj(const char *fn, int isize, int index[], int skip, max_nf = 0; - xx = NULL; - *time = NULL; + xx = nullptr; + *time = nullptr; natom = read_first_x(oenv, &status, fn, &t, &x, box); i = 0; i0 = 0; @@ -993,20 +993,20 @@ static void analyze_clusters(int nf, t_clusters *clust, real **rmsd, gmx_bool bFit, FILE *log, t_rgb rlo, t_rgb rhi, const gmx_output_env_t *oenv) { - FILE *size_fp = NULL; + FILE *size_fp = nullptr; char buf[STRLEN], buf1[40], buf2[40], buf3[40], *trxsfn; - t_trxstatus *trxout = NULL; - t_trxstatus *trxsout = NULL; + t_trxstatus *trxout = nullptr; + t_trxstatus *trxsout = nullptr; int i, i1, cl, nstr, *structure, first = 0, midstr; - gmx_bool *bWrite = NULL; + gmx_bool *bWrite = nullptr; real r, clrmsd, midrmsd; - rvec *xav = NULL; + rvec *xav = nullptr; matrix zerobox; clear_mat(zerobox); ffprintf_d(stderr, log, buf, "\nFound %d clusters\n\n", clust->ncl); - trxsfn = NULL; + trxsfn = nullptr; if (trxfn) { /* do we write all structures? */ @@ -1053,7 +1053,7 @@ static void analyze_clusters(int nf, t_clusters *clust, real **rmsd, /* Prepare a reference structure for the orientation of the clusters */ if (bFit) { - reset_x(ifsize, fitidx, natom, NULL, xtps, mass); + reset_x(ifsize, fitidx, natom, nullptr, xtps, mass); } trxout = open_trx(trxfn, "w"); /* Calculate the average structure in each cluster, * @@ -1113,7 +1113,7 @@ static void analyze_clusters(int nf, t_clusters *clust, real **rmsd, { if (bFit) { - reset_x(ifsize, fitidx, natom, NULL, xx[i1], mass); + reset_x(ifsize, fitidx, natom, nullptr, xx[i1], mass); } if (nstr == 1) { @@ -1234,7 +1234,7 @@ static void analyze_clusters(int nf, t_clusters *clust, real **rmsd, if (bWrite[i]) { write_trx(trxsout, iosize, outidx, atoms, i, time[structure[i]], zerobox, - xx[structure[i]], NULL, NULL); + xx[structure[i]], nullptr, nullptr); } } close_trx(trxsout); @@ -1255,14 +1255,14 @@ static void analyze_clusters(int nf, t_clusters *clust, real **rmsd, } if (bFit) { - reset_x(ifsize, fitidx, natom, NULL, xav, mass); + reset_x(ifsize, fitidx, natom, nullptr, xav, mass); } } if (bFit) { do_fit(natom, mass, xtps, xav); } - write_trx(trxout, iosize, outidx, atoms, cl, time[midstr], zerobox, xav, NULL, NULL); + write_trx(trxout, iosize, outidx, atoms, cl, time[midstr], zerobox, xav, nullptr, nullptr); } } /* clean up */ @@ -1397,28 +1397,28 @@ int gmx_cluster(int argc, char *argv[]) gmx_int64_t nrms = 0; matrix box; - rvec *xtps, *usextps, *x1, **xx = NULL; + rvec *xtps, *usextps, *x1, **xx = nullptr; const char *fn, *trx_out_fn; t_clusters clust; - t_mat *rms, *orig = NULL; + t_mat *rms, *orig = nullptr; real *eigenvalues; t_topology top; int ePBC; t_atoms useatoms; - t_matrix *readmat = NULL; + t_matrix *readmat = nullptr; real *eigenvectors; int isize = 0, ifsize = 0, iosize = 0; - int *index = NULL, *fitidx = NULL, *outidx = NULL; + int *index = nullptr, *fitidx = nullptr, *outidx = nullptr; char *grpname; - real rmsd, **d1, **d2, *time = NULL, time_invfac, *mass = NULL; + real rmsd, **d1, **d2, *time = nullptr, time_invfac, *mass = nullptr; char buf[STRLEN], buf1[80], title[STRLEN]; gmx_bool bAnalyze, bUseRmsdCut, bJP_RMSD = FALSE, bReadMat, bReadTraj, bPBC = TRUE; int method, ncluster = 0; static const char *methodname[] = { - NULL, "linkage", "jarvis-patrick", "monte-carlo", - "diagonalization", "gromos", NULL + nullptr, "linkage", "jarvis-patrick", "monte-carlo", + "diagonalization", "gromos", nullptr }; enum { m_null, m_linkage, m_jarvis_patrick, @@ -1436,7 +1436,7 @@ int gmx_cluster(int argc, char *argv[]) static real kT = 1e-3; static int M = 10, P = 3; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; t_pargs pa[] = { { "-dista", FALSE, etBOOL, {&bRMSdist}, @@ -1484,9 +1484,9 @@ int gmx_cluster(int argc, char *argv[]) { &bPBC }, "PBC check" } }; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffOPTRD }, - { efTPS, "-s", NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffOPTRD }, + { efTPS, "-s", nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXPM, "-dm", "rmsd", ffOPTRD }, { efXPM, "-om", "rmsd-raw", ffWRITE }, { efXPM, "-o", "rmsd-clust", ffWRITE }, @@ -1504,7 +1504,7 @@ int gmx_cluster(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME | PCA_TIME_UNIT, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; @@ -1523,7 +1523,7 @@ int gmx_cluster(int argc, char *argv[]) } else { - trx_out_fn = NULL; + trx_out_fn = nullptr; } if (bReadMat && output_env_get_time_factor(oenv) != 1) { @@ -1611,7 +1611,7 @@ int gmx_cluster(int argc, char *argv[]) if (bReadTraj) { /* don't read mass-database as masses (and top) are not used */ - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtps, NULL, box, + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtps, nullptr, box, TRUE); if (bPBC) { @@ -1686,7 +1686,7 @@ int gmx_cluster(int argc, char *argv[]) { for (i = 0; i < nf; i++) { - reset_x(ifsize, fitidx, isize, NULL, xx[i], mass); + reset_x(ifsize, fitidx, isize, nullptr, xx[i], mass); } } } @@ -1902,7 +1902,7 @@ int gmx_cluster(int argc, char *argv[]) useatoms.nr = isize; analyze_clusters(nf, &clust, rms->mat, isize, &useatoms, usextps, mass, xx, time, ifsize, fitidx, iosize, outidx, - bReadTraj ? trx_out_fn : NULL, + bReadTraj ? trx_out_fn : nullptr, opt2fn_null("-sz", NFILE, fnm), opt2fn_null("-tr", NFILE, fnm), opt2fn_null("-ntr", NFILE, fnm), @@ -1956,7 +1956,7 @@ int gmx_cluster(int argc, char *argv[]) } fprintf(stderr, "\n"); gmx_ffclose(fp); - if (NULL != orig) + if (nullptr != orig) { fp = opt2FILE("-om", NFILE, fnm, "w"); sprintf(buf, "Time (%s)", output_env_get_time_unit(oenv)); @@ -1982,7 +1982,7 @@ int gmx_cluster(int argc, char *argv[]) do_view(oenv, opt2fn_null("-ntr", NFILE, fnm), "-nxy"); do_view(oenv, opt2fn_null("-clid", NFILE, fnm), "-nxy"); } - do_view(oenv, opt2fn_null("-conv", NFILE, fnm), NULL); + do_view(oenv, opt2fn_null("-conv", NFILE, fnm), nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_clustsize.cpp b/src/gromacs/gmxana/gmx_clustsize.cpp index d432d47cbe..8ba0c0ad94 100644 --- a/src/gromacs/gmxana/gmx_clustsize.cpp +++ b/src/gromacs/gmxana/gmx_clustsize.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2007, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -71,10 +71,10 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, const gmx_output_env_t *oenv) { FILE *fp, *gp, *hp, *tp; - int *index = NULL; + int *index = nullptr; int nindex, natoms; t_trxstatus *status; - rvec *x = NULL, *v = NULL, dx; + rvec *x = nullptr, *v = nullptr, dx; t_pbc pbc; char *gname; char timebuf[32]; @@ -82,14 +82,14 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, /* Topology stuff */ t_trxframe fr; t_tpxheader tpxh; - gmx_mtop_t *mtop = NULL; + gmx_mtop_t *mtop = nullptr; int ePBC = -1; - t_block *mols = NULL; + t_block *mols = nullptr; int ii, jj; real temp, tfac; /* Cluster size distribution (matrix) */ - real **cs_dist = NULL; - real tf, dx2, cut2, *t_x = NULL, *t_y, cmid, cmax, cav, ekin; + real **cs_dist = nullptr; + real tf, dx2, cut2, *t_x = nullptr, *t_y, cmid, cmax, cav, ekin; int i, j, k, ai, aj, ci, cj, nframe, nclust, n_x, max_size = 0; int *clust_index, *clust_size, max_clust_size, max_clust_ind, nav, nhisto; t_rgb rlo = { 1.0, 1.0, 1.0 }; @@ -120,7 +120,7 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, gmx_fatal(FARGS, "tpr (%d atoms) and trajectory (%d atoms) do not match!", tpxh.natoms, natoms); } - ePBC = read_tpx(tpr, NULL, NULL, &natoms, NULL, NULL, mtop); + ePBC = read_tpx(tpr, nullptr, nullptr, &natoms, nullptr, nullptr, mtop); } if (ndf <= -1) { @@ -138,7 +138,7 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, printf("Using molecules rather than atoms. Not reading index file %s\n", ndx); } - GMX_RELEASE_ASSERT(mtop != NULL, "Trying to access mtop->mols from NULL mtop pointer"); + GMX_RELEASE_ASSERT(mtop != nullptr, "Trying to access mtop->mols from NULL mtop pointer"); mols = &(mtop->mols); /* Make dummy index */ @@ -207,7 +207,7 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, /* Compute distance */ if (bMol) { - GMX_RELEASE_ASSERT(mols != NULL, "Cannot access index[] from NULL mols pointer"); + GMX_RELEASE_ASSERT(mols != nullptr, "Cannot access index[] from NULL mols pointer"); bSame = FALSE; for (ii = mols->index[ai]; !bSame && (ii < mols->index[ai+1]); ii++) { @@ -349,7 +349,7 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, { if (bMol) { - GMX_RELEASE_ASSERT(mols != NULL, "Cannot access index[] from NULL mols pointer"); + GMX_RELEASE_ASSERT(mols != nullptr, "Cannot access index[] from NULL mols pointer"); for (j = mols->index[i]; (j < mols->index[i+1]); j++) { fprintf(fp, "%d\n", j+1); @@ -487,9 +487,9 @@ int gmx_clustsize(int argc, char *argv[]) t_rgb rgblo, rgbhi; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPR, NULL, NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPR, nullptr, nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXPM, "-o", "csize", ffWRITE }, { efXPM, "-ow", "csizew", ffWRITE }, { efXVG, "-nc", "nclust", ffWRITE }, @@ -503,7 +503,7 @@ int gmx_clustsize(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME | PCA_TIME_UNIT, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } diff --git a/src/gromacs/gmxana/gmx_confrms.cpp b/src/gromacs/gmxana/gmx_confrms.cpp index a5ed70c7ea..d037276756 100644 --- a/src/gromacs/gmxana/gmx_confrms.cpp +++ b/src/gromacs/gmxana/gmx_confrms.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -554,7 +554,7 @@ int gmx_confrms(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -673,13 +673,13 @@ int gmx_confrms(int argc, char *argv[]) sfree(fit_x); sfree(w_rls); - w_rls = NULL; + w_rls = nullptr; } else { clear_rvec(xcm1); clear_rvec(xcm2); - w_rls = NULL; + w_rls = nullptr; } /* calculate the rms deviation */ @@ -801,9 +801,9 @@ int gmx_confrms(int argc, char *argv[]) fp = gmx_ffopen(outfile, "w"); if (!bOne) { - write_pdbfile(fp, *top1->name, atoms1, x1, ePBC1, box1, ' ', 1, NULL, TRUE); + write_pdbfile(fp, *top1->name, atoms1, x1, ePBC1, box1, ' ', 1, nullptr, TRUE); } - write_pdbfile(fp, *top2->name, atoms2, x2, ePBC2, box2, ' ', bOne ? -1 : 2, NULL, TRUE); + write_pdbfile(fp, *top2->name, atoms2, x2, ePBC2, box2, ' ', bOne ? -1 : 2, nullptr, TRUE); gmx_ffclose(fp); break; case efGRO: diff --git a/src/gromacs/gmxana/gmx_covar.cpp b/src/gromacs/gmxana/gmx_covar.cpp index b7ee514a56..1234232ef5 100644 --- a/src/gromacs/gmxana/gmx_covar.cpp +++ b/src/gromacs/gmxana/gmx_covar.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -109,7 +109,7 @@ int gmx_covar(int argc, char *argv[]) { "-pbc", FALSE, etBOOL, {&bPBC}, "Apply corrections for periodic boundary conditions" } }; - FILE *out = NULL; /* initialization makes all compilers happy */ + FILE *out = nullptr; /* initialization makes all compilers happy */ t_trxstatus *status; t_topology top; int ePBC; @@ -118,7 +118,7 @@ int gmx_covar(int argc, char *argv[]) matrix box, zerobox; real *sqrtm, *mat, *eigenvalues, sum, trace, inv_nframes; real t, tstart, tend, **mat2; - real xj, *w_rls = NULL; + real xj, *w_rls = nullptr; real min, max, *axis; int natoms, nat, nframes0, nframes, nlevels; gmx_int64_t ndim, i, j, k, l; @@ -134,16 +134,16 @@ int gmx_covar(int argc, char *argv[]) t_rgb rlo, rmi, rhi; real *eigenvectors; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efXVG, NULL, "eigenval", ffWRITE }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efXVG, nullptr, "eigenval", ffWRITE }, { efTRN, "-v", "eigenvec", ffWRITE }, { efSTO, "-av", "average.pdb", ffWRITE }, - { efLOG, NULL, "covar", ffWRITE }, + { efLOG, nullptr, "covar", ffWRITE }, { efDAT, "-ascii", "covar", ffOPTWR }, { efXPM, "-xpm", "covar", ffOPTWR }, { efXPM, "-xpma", "covara", ffOPTWR } @@ -151,7 +151,7 @@ int gmx_covar(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -169,7 +169,7 @@ int gmx_covar(int argc, char *argv[]) xpmfile = opt2fn_null("-xpm", NFILE, fnm); xpmafile = opt2fn_null("-xpma", NFILE, fnm); - read_tps_conf(fitfile, &top, &ePBC, &xref, NULL, box, TRUE); + read_tps_conf(fitfile, &top, &ePBC, &xref, nullptr, box, TRUE); atoms = &top.atoms; if (bFit) @@ -247,7 +247,7 @@ int gmx_covar(int argc, char *argv[]) } if (bFit) { - reset_x(nfit, ifit, atoms->nr, NULL, xref, w_rls); + reset_x(nfit, ifit, atoms->nr, nullptr, xref, w_rls); } snew(x, natoms); @@ -276,7 +276,7 @@ int gmx_covar(int argc, char *argv[]) } if (bFit) { - reset_x(nfit, ifit, nat, NULL, xread, w_rls); + reset_x(nfit, ifit, nat, nullptr, xread, w_rls); do_fit(nat, w_rls, xref, xread); } for (i = 0; i < natoms; i++) @@ -297,7 +297,7 @@ int gmx_covar(int argc, char *argv[]) } } write_sto_conf_indexed(opt2fn("-av", NFILE, fnm), "Average structure", - atoms, xread, NULL, epbcNONE, zerobox, natoms, index); + atoms, xread, nullptr, epbcNONE, zerobox, natoms, index); sfree(xread); fprintf(stderr, "Constructing covariance matrix (%dx%d) ...\n", static_cast(ndim), static_cast(ndim)); @@ -315,7 +315,7 @@ int gmx_covar(int argc, char *argv[]) } if (bFit) { - reset_x(nfit, ifit, nat, NULL, xread, w_rls); + reset_x(nfit, ifit, nat, nullptr, xread, w_rls); do_fit(nat, w_rls, xref, xread); } if (bRef) diff --git a/src/gromacs/gmxana/gmx_current.cpp b/src/gromacs/gmxana/gmx_current.cpp index e767a03239..44be7f8111 100644 --- a/src/gromacs/gmxana/gmx_current.cpp +++ b/src/gromacs/gmxana/gmx_current.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -356,12 +356,12 @@ static void dielectric(FILE *fmj, FILE *fmd, FILE *outf, FILE *fcur, FILE *mcor, int i, j; int valloc, nalloc, nfr, nvfr; int vshfr; - real *xshfr = NULL; - int *vfr = NULL; + real *xshfr = nullptr; + int *vfr = nullptr; real refr = 0.0; - real *cacf = NULL; - real *time = NULL; - real *djc = NULL; + real *cacf = nullptr; + real *time = nullptr; + real *djc = nullptr; real corint = 0.0; real prefactorav = 0.0; real prefactor = 0.0; @@ -378,16 +378,16 @@ static void dielectric(FILE *fmj, FILE *fmd, FILE *outf, FILE *fcur, FILE *mcor, rvec mja_tmp; rvec mjd_tmp; rvec mdvec; - rvec *mu = NULL; - rvec *xp = NULL; - rvec *v0 = NULL; - rvec *mjdsp = NULL; - real *dsp2 = NULL; + rvec *mu = nullptr; + rvec *xp = nullptr; + rvec *v0 = nullptr; + rvec *mjdsp = nullptr; + real *dsp2 = nullptr; real t0; real rtmp; rvec tmp; - rvec *mtrans = NULL; + rvec *mtrans = nullptr; /* * Variables for the least-squares fit for Einstein-Helfand and Green-Kubo @@ -400,7 +400,7 @@ static void dielectric(FILE *fmj, FILE *fmd, FILE *outf, FILE *fcur, FILE *mcor, real err = 0.0; real *xfit; real *yfit; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; /* * indices for EH @@ -460,7 +460,7 @@ static void dielectric(FILE *fmj, FILE *fmd, FILE *outf, FILE *fcur, FILE *mcor, xshfr[i] = 0.0; } } - GMX_RELEASE_ASSERT(time != NULL, "Memory not allocated correctly - time array is NULL"); + GMX_RELEASE_ASSERT(time != nullptr, "Memory not allocated correctly - time array is NULL"); if (nfr == 0) { @@ -639,7 +639,7 @@ static void dielectric(FILE *fmj, FILE *fmd, FILE *outf, FILE *fcur, FILE *mcor, printf("\n\nAverage translational dipole moment M_J [enm] after %d frames (|M|^2): %f %f %f (%f)\n", nfr, mja_tmp[XX], mja_tmp[YY], mja_tmp[ZZ], mj2); printf("\n\nAverage molecular dipole moment M_D [enm] after %d frames (|M|^2): %f %f %f (%f)\n", nfr, mdvec[XX], mdvec[YY], mdvec[ZZ], md2); - if (v0 != NULL) + if (v0 != nullptr) { if (bINT) { @@ -751,7 +751,7 @@ static void dielectric(FILE *fmj, FILE *fmd, FILE *outf, FILE *fcur, FILE *mcor, } - if (v0 != NULL) + if (v0 != nullptr) { sfree(v0); } @@ -805,13 +805,13 @@ int gmx_current(int argc, char *argv[]) gmx_output_env_t *oenv; t_topology top; - char **grpname = NULL; + char **grpname = nullptr; const char *indexfn; t_trxframe fr; - real *mass2 = NULL; + real *mass2 = nullptr; matrix box; int *index0; - int *indexm = NULL; + int *indexm = nullptr; int isize; t_trxstatus *status; int flags = 0; @@ -821,16 +821,16 @@ int gmx_current(int argc, char *argv[]) int nmols; int i; real *qmol; - FILE *outf = NULL; - FILE *mcor = NULL; - FILE *fmj = NULL; - FILE *fmd = NULL; - FILE *fmjdsp = NULL; - FILE *fcur = NULL; + FILE *outf = nullptr; + FILE *mcor = nullptr; + FILE *fmj = nullptr; + FILE *fmd = nullptr; + FILE *fmjdsp = nullptr; + FILE *fcur = nullptr; t_filenm fnm[] = { - { efTPS, NULL, NULL, ffREAD }, /* this is for the topology */ - { efNDX, NULL, NULL, ffOPTRD }, - { efTRX, "-f", NULL, ffREAD }, /* and this for the trajectory */ + { efTPS, nullptr, nullptr, ffREAD }, /* this is for the topology */ + { efNDX, nullptr, nullptr, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, /* and this for the trajectory */ { efXVG, "-o", "current", ffWRITE }, { efXVG, "-caf", "caf", ffOPTWR }, { efXVG, "-dsp", "dsp", ffWRITE }, @@ -880,7 +880,7 @@ int gmx_current(int argc, char *argv[]) /* At first the arguments will be parsed and the system information processed */ if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -888,7 +888,7 @@ int gmx_current(int argc, char *argv[]) bACF = opt2bSet("-caf", NFILE, fnm); bINT = opt2bSet("-mc", NFILE, fnm); - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE); indexfn = ftp2fn_null(efNDX, NFILE, fnm); snew(grpname, 1); diff --git a/src/gromacs/gmxana/gmx_density.cpp b/src/gromacs/gmxana/gmx_density.cpp index ad9b231fea..e92661be9f 100644 --- a/src/gromacs/gmxana/gmx_density.cpp +++ b/src/gromacs/gmxana/gmx_density.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -94,7 +94,7 @@ int get_electrons(t_electron **eltab, const char *fn) gmx_fatal(FARGS, "Couldn't open %s. Exiting.\n", fn); } - if (NULL == fgets(buffer, 255, in)) + if (nullptr == fgets(buffer, 255, in)) { gmx_fatal(FARGS, "Error reading from file %s", fn); } @@ -108,7 +108,7 @@ int get_electrons(t_electron **eltab, const char *fn) for (i = 0; i < nr; i++) { - if (fgets(buffer, 255, in) == NULL) + if (fgets(buffer, 255, in) == nullptr) { gmx_fatal(FARGS, "reading datafile. Check your datafile.\n"); } @@ -186,7 +186,7 @@ void calc_electron_density(const char *fn, int **index, int gnx[], t_electron *found; /* found by bsearch */ t_electron sought; /* thingie thought by bsearch */ real boxSz, aveBox; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; real t, z; @@ -281,7 +281,7 @@ void calc_electron_density(const char *fn, int **index, int gnx[], (const void *)eltab, nr, sizeof(t_electron), (int(*)(const void*, const void*))compare); - if (found == NULL) + if (found == nullptr) { fprintf(stderr, "Couldn't find %s. Add it to the .dat file\n", *(top->atoms.atomname[index[n][i]])); @@ -343,7 +343,7 @@ void calc_density(const char *fn, int **index, int gnx[], real t, z; real boxSz, aveBox; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; if (axis < 0 || axis >= DIM) { @@ -482,9 +482,9 @@ void plot_density(double *slDensity[], const char *afile, int nslices, const gmx_output_env_t *oenv) { FILE *den; - const char *title = NULL; - const char *xlabel = NULL; - const char *ylabel = NULL; + const char *title = nullptr; + const char *xlabel = nullptr; + const char *ylabel = nullptr; int slice, n; real ddd; real axispos; @@ -621,7 +621,7 @@ int gmx_density(int argc, char *argv[]) gmx_output_env_t *oenv; static const char *dens_opt[] = - { NULL, "mass", "number", "charge", "electron", NULL }; + { nullptr, "mass", "number", "charge", "electron", nullptr }; static int axis = 2; /* normal to memb. default z */ static const char *axtitle = "Z"; static int nslices = 50; /* nr of slices defined */ @@ -666,9 +666,9 @@ int gmx_density(int argc, char *argv[]) int i; t_filenm fnm[] = { /* files for g_density */ - { efTRX, "-f", NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efTPR, NULL, NULL, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efTPR, nullptr, nullptr, ffREAD }, { efDAT, "-ei", "electrons", ffOPTRD }, /* file with nr. of electrons */ { efXVG, "-o", "density", ffWRITE }, }; @@ -682,7 +682,7 @@ int gmx_density(int argc, char *argv[]) return 0; } - GMX_RELEASE_ASSERT(dens_opt[0] != NULL, "Option setting inconsistency; dens_opt[0] is NULL"); + GMX_RELEASE_ASSERT(dens_opt[0] != nullptr, "Option setting inconsistency; dens_opt[0] is NULL"); if (bSymmetrize && !bCenter) { @@ -725,7 +725,7 @@ int gmx_density(int argc, char *argv[]) else { ncenter = 0; - index_center = NULL; + index_center = nullptr; } fprintf(stderr, "\nSelect %d group%s to calculate density for:\n", ngrps, (ngrps > 1) ? "s" : ""); diff --git a/src/gromacs/gmxana/gmx_densmap.cpp b/src/gromacs/gmxana/gmx_densmap.cpp index 45d09ee9c2..84784621f4 100644 --- a/src/gromacs/gmxana/gmx_densmap.cpp +++ b/src/gromacs/gmxana/gmx_densmap.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -97,8 +97,8 @@ int gmx_densmap(int argc, char *argv[]) static int n1 = 0, n2 = 0; static real xmin = -1, xmax = -1, bin = 0.02, dmin = 0, dmax = 0, amax = 0, rmax = 0; static gmx_bool bMirror = FALSE, bSums = FALSE; - static const char *eaver[] = { NULL, "z", "y", "x", NULL }; - static const char *eunit[] = { NULL, "nm-3", "nm-2", "count", NULL }; + static const char *eaver[] = { nullptr, "z", "y", "x", nullptr }; + static const char *eunit[] = { nullptr, "nm-3", "nm-2", "count", nullptr }; t_pargs pa[] = { { "-bin", FALSE, etREAL, {&bin}, @@ -140,8 +140,8 @@ int gmx_densmap(int argc, char *argv[]) int cav = 0, c1 = 0, c2 = 0; char **grpname, buf[STRLEN]; const char *unit; - int i, j, k, l, ngrps, anagrp, *gnx = NULL, nindex, nradial = 0, nfr, nmpower; - int **ind = NULL, *index; + int i, j, k, l, ngrps, anagrp, *gnx = nullptr, nindex, nradial = 0, nfr, nmpower; + int **ind = nullptr, *index; real **grid, maxgrid, m1, m2, box1, box2, *tickx, *tickz, invcellvol; real invspa = 0, invspz = 0, axial, r, vol_old, vol, rowsum; int nlev = 51; @@ -149,9 +149,9 @@ int gmx_densmap(int argc, char *argv[]) gmx_output_env_t *oenv; const char *label[] = { "x (nm)", "y (nm)", "z (nm)" }; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efDAT, "-od", "densmap", ffOPTWR }, { efXPM, "-o", "densmap", ffWRITE } }; @@ -161,7 +161,7 @@ int gmx_densmap(int argc, char *argv[]) npargs = asize(pa); if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, npargs, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -177,7 +177,7 @@ int gmx_densmap(int argc, char *argv[]) } } - GMX_RELEASE_ASSERT(eunit[0] != NULL, "Option setting inconsistency; eunit[0] is NULL"); + GMX_RELEASE_ASSERT(eunit[0] != nullptr, "Option setting inconsistency; eunit[0] is NULL"); if (std::strcmp(eunit[0], "nm-3") == 0) { @@ -197,7 +197,7 @@ int gmx_densmap(int argc, char *argv[]) if (ftp2bSet(efTPS, NFILE, fnm) || !ftp2bSet(efNDX, NFILE, fnm)) { - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, bRadial); } if (!bRadial) @@ -226,7 +226,7 @@ int gmx_densmap(int argc, char *argv[]) } } - GMX_RELEASE_ASSERT(eaver[0] != NULL, "Option setting inconsistency; eaver[0] is NULL"); + GMX_RELEASE_ASSERT(eaver[0] != nullptr, "Option setting inconsistency; eaver[0] is NULL"); switch (eaver[0][0]) { @@ -527,7 +527,7 @@ int gmx_densmap(int argc, char *argv[]) gmx_ffclose(fp); } - do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); + do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_densorder.cpp b/src/gromacs/gmxana/gmx_densorder.cpp index 57bc3e9527..6aaf4b291d 100644 --- a/src/gromacs/gmxana/gmx_densorder.cpp +++ b/src/gromacs/gmxana/gmx_densorder.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -115,14 +115,14 @@ static void density_in_time (const char *fn, int **index, int gnx[], real bw, re * grpn - group number in index */ t_trxstatus *status; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; matrix box; /* Box - 3x3 -each step*/ rvec *x0; /* List of Coord without PBC*/ int i, j, /* loop indices, checks etc*/ ax1 = 0, ax2 = 0, /* tangent directions */ framenr = 0, /* frame number in trajectory*/ slicex, slicey, slicez; /*slice # of x y z position */ - real ***Densslice = NULL; /* Density-slice in one frame*/ + real ***Densslice = nullptr; /* Density-slice in one frame*/ real dscale; /*physical scaling factor*/ real t, x, y, z; /* time and coordinates*/ rvec bbww; @@ -173,7 +173,7 @@ static void density_in_time (const char *fn, int **index, int gnx[], real bw, re /*Initialize Densdevel and PBC-remove*/ gpbc = gmx_rmpbc_init(&top->idef, ePBC, top->atoms.nr); - *Densdevel = NULL; + *Densdevel = nullptr; do { @@ -184,7 +184,7 @@ static void density_in_time (const char *fn, int **index, int gnx[], real bw, re /*Reset Densslice every nsttblock steps*/ /* The first conditional is for clang to understand that this branch is * always taken the first time. */ - if (Densslice == NULL || framenr % nsttblock == 0) + if (Densslice == nullptr || framenr % nsttblock == 0) { snew(Densslice, *xslices); for (i = 0; i < *xslices; i++) @@ -360,11 +360,11 @@ static void interfaces_txy (real ****Densmap, int xslices, int yslices, int zsli real *sigma1, *sigma2; double beginfit1[4]; double beginfit2[4]; - double *fit1 = NULL, *fit2 = NULL; + double *fit1 = nullptr, *fit2 = nullptr; const double *avgfit1; const double *avgfit2; const real onehalf = 1.00/2.00; - t_interf ***int1 = NULL, ***int2 = NULL; /*Interface matrices [t][x,y] - last index in row-major order*/ + t_interf ***int1 = nullptr, ***int2 = nullptr; /*Interface matrices [t][x,y] - last index in row-major order*/ /*Create int1(t,xy) and int2(t,xy) arrays with correct number of interf_t elements*/ xysize = xslices*yslices; snew(int1, tblocks); @@ -487,9 +487,9 @@ static void interfaces_txy (real ****Densmap, int xslices, int yslices, int zsli /*Fit average density in z over whole trajectory to obtain tentative fit-parameters in fit1 and fit2*/ /*Fit 1st half of box*/ - do_lmfit(zslices, zDensavg, sigma1, binwidth, NULL, startpoint, splitpoint, oenv, FALSE, effnERF, beginfit1, 8, NULL); + do_lmfit(zslices, zDensavg, sigma1, binwidth, nullptr, startpoint, splitpoint, oenv, FALSE, effnERF, beginfit1, 8, nullptr); /*Fit 2nd half of box*/ - do_lmfit(zslices, zDensavg, sigma2, binwidth, NULL, splitpoint, endpoint, oenv, FALSE, effnERF, beginfit2, 8, NULL); + do_lmfit(zslices, zDensavg, sigma2, binwidth, nullptr, splitpoint, endpoint, oenv, FALSE, effnERF, beginfit2, 8, nullptr); /*Initialise the const arrays for storing the average fit parameters*/ avgfit1 = beginfit1; @@ -513,10 +513,10 @@ static void interfaces_txy (real ****Densmap, int xslices, int yslices, int zsli fit2[k] = avgfit2[k]; } /*Now fit and store in structures in row-major order int[n][i][j]*/ - do_lmfit(zslices, Densmap[n][i][j], sigma1, binwidth, NULL, startpoint, splitpoint, oenv, FALSE, effnERF, fit1, 0, NULL); + do_lmfit(zslices, Densmap[n][i][j], sigma1, binwidth, nullptr, startpoint, splitpoint, oenv, FALSE, effnERF, fit1, 0, nullptr); int1[n][j+(yslices*i)]->Z = fit1[2]; int1[n][j+(yslices*i)]->t = fit1[3]; - do_lmfit(zslices, Densmap[n][i][j], sigma2, binwidth, NULL, splitpoint, endpoint, oenv, FALSE, effnERF, fit2, 0, NULL); + do_lmfit(zslices, Densmap[n][i][j], sigma2, binwidth, nullptr, splitpoint, endpoint, oenv, FALSE, effnERF, fit2, 0, nullptr); int2[n][j+(yslices*i)]->Z = fit2[2]; int2[n][j+(yslices*i)]->t = fit2[3]; } @@ -687,11 +687,11 @@ int gmx_densorder(int argc, char *argv[]) static gmx_bool b1d = FALSE; static int nlevels = 100; /*Densitymap - Densmap[t][x][y][z]*/ - real ****Densmap = NULL; + real ****Densmap = nullptr; /* Surfaces surf[t][surf_x,surf_y]*/ t_interf ***surf1, ***surf2; - static const char *meth[] = {NULL, "bisect", "functional", NULL}; + static const char *meth[] = {nullptr, "bisect", "functional", nullptr}; int eMeth; char **graphfiles, **rawfiles, **spectra; /* Filenames for xpm-surface maps, rawdata and powerspectra */ @@ -722,11 +722,11 @@ int gmx_densorder(int argc, char *argv[]) t_filenm fnm[] = { - { efTPR, "-s", NULL, ffREAD }, /* this is for the topology */ - { efTRX, "-f", NULL, ffREAD }, /* and this for the trajectory */ - { efNDX, "-n", NULL, ffREAD}, /* this is to select groups */ + { efTPR, "-s", nullptr, ffREAD }, /* this is for the topology */ + { efTRX, "-f", nullptr, ffREAD }, /* and this for the trajectory */ + { efNDX, "-n", nullptr, ffREAD}, /* this is to select groups */ { efDAT, "-o", "Density4D", ffOPTWR}, /* This is for outputting the entire 4D densityfield in binary format */ - { efOUT, "-or", NULL, ffOPTWRMULT}, /* This is for writing out the entire information in the t_interf arrays */ + { efOUT, "-or", nullptr, ffOPTWRMULT}, /* This is for writing out the entire information in the t_interf arrays */ { efXPM, "-og", "interface", ffOPTWRMULT}, /* This is for writing out the interface meshes - one xpm-file per tblock*/ { efOUT, "-Spect", "intfspect", ffOPTWRMULT}, /* This is for the trajectory averaged Fourier-spectra*/ }; @@ -736,7 +736,7 @@ int gmx_densorder(int argc, char *argv[]) /* This is the routine responsible for adding default options, * calling the X/motif interface, etc. */ if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } diff --git a/src/gromacs/gmxana/gmx_dielectric.cpp b/src/gromacs/gmxana/gmx_dielectric.cpp index c9d4bb53de..11cd32e5f9 100644 --- a/src/gromacs/gmxana/gmx_dielectric.cpp +++ b/src/gromacs/gmxana/gmx_dielectric.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -133,7 +133,7 @@ real numerical_deriv(int nx, real x[], real y[], real fity[], real combined[], r } tmpfp = gmx_ffopen("integral_smth.xvg", "w"); - integralSmth = print_and_integrate(tmpfp, nx, x[1]-x[0], combined, NULL, 1); + integralSmth = print_and_integrate(tmpfp, nx, x[1]-x[0], combined, nullptr, 1); printf("SMOOTH integral = %10.5e\n", integralSmth); dy[0] = (combined[1]-combined[0])/(x[1]-x[0]); @@ -314,7 +314,7 @@ int gmx_dielectric(int argc, char *argv[]) }; if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -389,10 +389,10 @@ int gmx_dielectric(int argc, char *argv[]) snew(y[4], nx); snew(y[5], nx); - integral = print_and_integrate(NULL, calc_nbegin(nx, y[0], tbegin), - dt, y[1], NULL, 1); + integral = print_and_integrate(nullptr, calc_nbegin(nx, y[0], tbegin), + dt, y[1], nullptr, 1); integral += do_lmfit(nx, y[1], y[2], dt, y[0], tbegin, tend, - oenv, TRUE, eFitFn, fitparms, fix, NULL); + oenv, TRUE, eFitFn, fitparms, fix, nullptr); for (i = 0; i < nx; i++) { y[3][i] = fit_function(eFitFn, fitparms, y[0][i]); @@ -429,7 +429,7 @@ int gmx_dielectric(int argc, char *argv[]) nx-1, y[0], y[5], eps0, epsRF, oenv); do_view(oenv, opt2fn("-o", NFILE, fnm), "-nxy"); - do_view(oenv, opt2fn("-c", NFILE, fnm), NULL); + do_view(oenv, opt2fn("-c", NFILE, fnm), nullptr); do_view(oenv, opt2fn("-d", NFILE, fnm), "-nxy"); return 0; diff --git a/src/gromacs/gmxana/gmx_dipoles.cpp b/src/gromacs/gmxana/gmx_dipoles.cpp index f6654953db..fc19a482e9 100644 --- a/src/gromacs/gmxana/gmx_dipoles.cpp +++ b/src/gromacs/gmxana/gmx_dipoles.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -93,9 +93,9 @@ static t_gkrbin *mk_gkrbin(real radius, real rcmax, gmx_bool bPhi, int ndegrees) snew(gb, 1); - if ((ptr = getenv("GMX_DIPOLE_SPACING")) != NULL) + if ((ptr = getenv("GMX_DIPOLE_SPACING")) != nullptr) { - double bw = strtod(ptr, NULL); + double bw = strtod(ptr, nullptr); gb->spacing = bw; } else @@ -131,7 +131,7 @@ static void done_gkrbin(t_gkrbin **gb) sfree((*gb)->elem); sfree((*gb)->count); sfree((*gb)); - *gb = NULL; + *gb = nullptr; } static void add2gkr(t_gkrbin *gb, real r, real cosa, real phi) @@ -178,7 +178,7 @@ static void do_gkr(t_gkrbin *gb, int ncos, int *ngrp, int *molindex[], int mindex[], rvec x[], rvec mu[], int ePBC, const matrix box, const t_atom *atom, const int *nAtom) { - static rvec *xcm[2] = { NULL, NULL}; + static rvec *xcm[2] = { nullptr, nullptr}; int gi, gj, j0, j1, i, j, k, n, grp0, grp1; real qtot, q, cosa, rr, phi; rvec dx; @@ -779,14 +779,14 @@ static void do_dip(const t_topology *top, int ePBC, real volume, }; #define NLEGADIP asize(leg_adip) - FILE *outdd, *outmtot, *outaver, *outeps, *caver = NULL; - FILE *dip3d = NULL, *adip = NULL; - rvec *x, *dipole = NULL, mu_t, quad, *dipsp = NULL; - t_gkrbin *gkrbin = NULL; - gmx_enxnm_t *enm = NULL; + FILE *outdd, *outmtot, *outaver, *outeps, *caver = nullptr; + FILE *dip3d = nullptr, *adip = nullptr; + rvec *x, *dipole = nullptr, mu_t, quad, *dipsp = nullptr; + t_gkrbin *gkrbin = nullptr; + gmx_enxnm_t *enm = nullptr; t_enxframe *fr; int nframes = 1000, nre, timecheck = 0, ncolour = 0; - ener_file_t fmu = NULL; + ener_file_t fmu = nullptr; int i, n, m, natom = 0, gnx_tot, teller, tel3; t_trxstatus *status; int *dipole_bin, ndipbin, ibin, iVol, idim = -1; @@ -798,13 +798,13 @@ static void do_dip(const t_topology *top, int ePBC, real volume, double M_diff = 0, epsilon, invtel, vol_aver; double mu_ave, mu_mol, M2_ave = 0, M_ave2 = 0, M_av[DIM], M_av2[DIM]; double M[3], M2[3], M4[3], Gk = 0, g_k = 0; - gmx_stats_t *Qlsq, mulsq, muframelsq = NULL; + gmx_stats_t *Qlsq, mulsq, muframelsq = nullptr; ivec iMu; - real **muall = NULL; - rvec *slab_dipoles = NULL; - const t_atom *atom = NULL; - const t_block *mols = NULL; - gmx_rmpbc_t gpbc = NULL; + real **muall = nullptr; + rvec *slab_dipoles = nullptr; + const t_atom *atom = nullptr; + const t_block *mols = nullptr; + gmx_rmpbc_t gpbc = nullptr; gnx_tot = gnx[0]; if (ncos > 1) @@ -1543,7 +1543,7 @@ int gmx_dipoles(int argc, char *argv[]) real mu_max = 5, mu_aver = -1, rcmax = 0; real epsilonRF = 0.0, temp = 300; gmx_bool bPairs = TRUE, bPhi = FALSE, bQuad = FALSE; - const char *corrtype[] = {NULL, "none", "mol", "molsep", "total", NULL}; + const char *corrtype[] = {nullptr, "none", "mol", "molsep", "total", nullptr}; const char *axtitle = "Z"; int nslices = 10; /* nr of slices defined */ int skip = 0, nFA = 0, nFB = 0, ncos = 1; @@ -1588,13 +1588,13 @@ int gmx_dipoles(int argc, char *argv[]) int *gnx; int nFF[2]; int **grpindex; - char **grpname = NULL; + char **grpname = nullptr; gmx_bool bGkr, bMU, bSlab; t_filenm fnm[] = { - { efEDR, "-en", NULL, ffOPTRD }, - { efTRX, "-f", NULL, ffREAD }, - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efEDR, "-en", nullptr, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-o", "Mtot", ffWRITE }, { efXVG, "-eps", "epsilon", ffWRITE }, { efXVG, "-a", "aver", ffWRITE }, @@ -1618,7 +1618,7 @@ int gmx_dipoles(int argc, char *argv[]) npargs = asize(pa); ppa = add_acf_pargs(&npargs, pa); if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv)) { sfree(ppa); return 0; @@ -1668,8 +1668,8 @@ int gmx_dipoles(int argc, char *argv[]) } snew(top, 1); - ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), NULL, box, - &natoms, NULL, NULL, top); + ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), nullptr, box, + &natoms, nullptr, nullptr, top); snew(gnx, ncos); snew(grpname, ncos); diff --git a/src/gromacs/gmxana/gmx_disre.cpp b/src/gromacs/gmxana/gmx_disre.cpp index 1248084f35..31c04743be 100644 --- a/src/gromacs/gmxana/gmx_disre.cpp +++ b/src/gromacs/gmxana/gmx_disre.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -81,7 +81,7 @@ typedef struct { real v; } t_toppop; -t_toppop *top = NULL; +t_toppop *top = nullptr; int ntop = 0; typedef struct { @@ -205,8 +205,8 @@ static void check_viol(FILE *log, while (((i+n) < disres->nr) && (forceparams[forceatoms[i+n]].disres.label == label)); - calc_disres_R_6(NULL, n, &forceatoms[i], - (const rvec*)x, pbc, fcd, NULL); + calc_disres_R_6(nullptr, n, &forceatoms[i], + (const rvec*)x, pbc, fcd, nullptr); if (fcd->disres.Rt_6[0] <= 0) { @@ -223,7 +223,7 @@ static void check_viol(FILE *log, snew(fshift, SHIFTS); interaction_function[F_DISRES].ifunc(n, &forceatoms[i], forceparams, (const rvec*)x, f, fshift, - pbc, g, lam, &dvdl, NULL, fcd, NULL); + pbc, g, lam, &dvdl, nullptr, fcd, nullptr); sfree(fshift); viol = fcd->disres.sumviol; @@ -540,7 +540,7 @@ static void dump_disre_matrix(const char *fn, t_dr_result *dr, int ndr, real **matrix, *t_res, hi, *w_dr, rav, rviol; t_rgb rlo = { 1, 1, 1 }; t_rgb rhi = { 0, 0, 0 }; - if (fn == NULL) + if (fn == nullptr) { return; } @@ -689,46 +689,46 @@ int gmx_disre(int argc, char *argv[]) "Use inverse third power averaging or linear for matrix output" } }; - FILE *out = NULL, *aver = NULL, *numv = NULL, *maxxv = NULL, *xvg = NULL; + FILE *out = nullptr, *aver = nullptr, *numv = nullptr, *maxxv = nullptr, *xvg = nullptr; t_tpxheader header; gmx_mtop_t mtop; rvec *xtop; gmx_localtop_t *top; - t_atoms *atoms = NULL; + t_atoms *atoms = nullptr; t_fcdata fcd; t_nrnb nrnb; t_graph *g; int ntopatoms, natoms, i, j, kkk; t_trxstatus *status; real t; - rvec *x, *xav = NULL; + rvec *x, *xav = nullptr; rvec4 *f; matrix box; gmx_bool bPDB; int isize; - int *index = NULL, *ind_fit = NULL; + int *index = nullptr, *ind_fit = nullptr; char *grpname; - t_cluster_ndx *clust = NULL; - t_dr_result dr, *dr_clust = NULL; + t_cluster_ndx *clust = nullptr; + t_dr_result dr, *dr_clust = nullptr; char **leg; - real *vvindex = NULL, *w_rls = NULL; + real *vvindex = nullptr, *w_rls = nullptr; t_mdatoms *mdatoms; t_pbc pbc, *pbc_null; int my_clust; FILE *fplog; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; t_filenm fnm[] = { - { efTPR, NULL, NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, { efXVG, "-ds", "drsum", ffWRITE }, { efXVG, "-da", "draver", ffWRITE }, { efXVG, "-dn", "drnum", ffWRITE }, { efXVG, "-dm", "drmax", ffWRITE }, { efXVG, "-dr", "restr", ffWRITE }, { efLOG, "-l", "disres", ffWRITE }, - { efNDX, NULL, "viol", ffOPTRD }, + { efNDX, nullptr, "viol", ffOPTRD }, { efPDB, "-q", "viol", ffOPTWR }, { efNDX, "-c", "clust", ffOPTRD }, { efXPM, "-x", "matrix", ffOPTWR } @@ -736,7 +736,7 @@ int gmx_disre(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -753,7 +753,7 @@ int gmx_disre(int argc, char *argv[]) read_tpxheader(ftp2fn(efTPR, NFILE, fnm), &header, FALSE); snew(xtop, header.natoms); - read_tpx(ftp2fn(efTPR, NFILE, fnm), ir, box, &ntopatoms, xtop, NULL, &mtop); + read_tpx(ftp2fn(efTPR, NFILE, fnm), ir, box, &ntopatoms, xtop, nullptr, &mtop); bPDB = opt2bSet("-q", NFILE, fnm); if (bPDB) { @@ -769,7 +769,7 @@ int gmx_disre(int argc, char *argv[]) snew(atoms, 1); *atoms = gmx_mtop_global_atoms(&mtop); - if (atoms->pdbinfo == NULL) + if (atoms->pdbinfo == nullptr) { snew(atoms->pdbinfo, atoms->nr); } @@ -778,8 +778,8 @@ int gmx_disre(int argc, char *argv[]) top = gmx_mtop_generate_local_top(&mtop, ir->efep != efepNO); - g = NULL; - pbc_null = NULL; + g = nullptr; + pbc_null = nullptr; if (ir->ePBC != epbcNONE) { if (ir->bPeriodicMols) @@ -815,7 +815,7 @@ int gmx_disre(int argc, char *argv[]) } ir->dr_tau = 0.0; - init_disres(fplog, &mtop, ir, NULL, &fcd, NULL, FALSE); + init_disres(fplog, &mtop, ir, nullptr, &fcd, nullptr, FALSE); natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box); snew(f, 5*natoms); @@ -843,7 +843,7 @@ int gmx_disre(int argc, char *argv[]) } mdatoms = init_mdatoms(fplog, &mtop, ir->efep != efepNO); - atoms2md(&mtop, ir, -1, NULL, mtop.natoms, mdatoms); + atoms2md(&mtop, ir, -1, nullptr, mtop.natoms, mdatoms); update_mdatoms(mdatoms, ir->fepvals->init_lambda); init_nrnb(&nrnb); if (ir->ePBC != epbcNONE) @@ -886,7 +886,7 @@ int gmx_disre(int argc, char *argv[]) } if (bPDB) { - reset_x(atoms->nr, ind_fit, atoms->nr, NULL, x, w_rls); + reset_x(atoms->nr, ind_fit, atoms->nr, nullptr, x, w_rls); do_fit(atoms->nr, w_rls, x, x); if (j == 0) { @@ -934,12 +934,12 @@ int gmx_disre(int argc, char *argv[]) { dump_stats(fplog, j, fcd.disres.nres, &(top->idef.il[F_DISRES]), top->idef.iparams, &dr, isize, index, - bPDB ? atoms : NULL); + bPDB ? atoms : nullptr); if (bPDB) { write_sto_conf(opt2fn("-q", NFILE, fnm), "Coloured by average violation in Angstrom", - atoms, xav, NULL, ir->ePBC, box); + atoms, xav, nullptr, ir->ePBC, box); } dump_disre_matrix(opt2fn_null("-x", NFILE, fnm), &dr, fcd.disres.nres, j, &top->idef, &mtop, max_dr, nlevels, bThird); diff --git a/src/gromacs/gmxana/gmx_do_dssp.cpp b/src/gromacs/gmxana/gmx_do_dssp.cpp index f41182e48a..f10286b142 100644 --- a/src/gromacs/gmxana/gmx_do_dssp.cpp +++ b/src/gromacs/gmxana/gmx_do_dssp.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -85,7 +85,7 @@ static int strip_dssp(char *dsspfile, int nres, { fgets2(buf, STRLEN, tapeout); } - while (std::strstr(buf, "KAPPA") == NULL); + while (std::strstr(buf, "KAPPA") == nullptr); if (bFirst) { /* Since we also have empty lines in the dssp output (temp) file, @@ -101,7 +101,7 @@ static int strip_dssp(char *dsspfile, int nres, nresidues = 0; naccf = 0; naccb = 0; - for (nr = 0; (fgets2(buf, STRLEN, tapeout) != NULL); nr++) + for (nr = 0; (fgets2(buf, STRLEN, tapeout) != nullptr); nr++) { if (buf[13] == '!') /* Chain separator line has '!' at pos. 13 */ { @@ -116,7 +116,7 @@ static int strip_dssp(char *dsspfile, int nres, buf[39] = '\0'; /* Only calculate solvent accessible area if needed */ - if ((NULL != acc) && (buf[13] != '!')) + if ((nullptr != acc) && (buf[13] != '!')) { sscanf(&(buf[34]), "%d", &iacc); acc[nr] = iacc; @@ -140,7 +140,7 @@ static int strip_dssp(char *dsspfile, int nres, if (bFirst) { - if (0 != acc) + if (nullptr != acc) { fprintf(stderr, "%d residues were classified as hydrophobic and %d as hydrophilic.\n", naccb, naccf); } @@ -156,8 +156,8 @@ static int strip_dssp(char *dsspfile, int nres, { mat->axis_y[i] = i+1; } - mat->axis_x = NULL; - mat->matrix = NULL; + mat->axis_x = nullptr; + mat->matrix = nullptr; xsize = 0; frame = 0; bFirst = FALSE; @@ -288,7 +288,7 @@ void prune_ss_legend(t_matrix *mat) } newnmap = 0; - newmap = NULL; + newmap = nullptr; for (i = 0; i < mat->nmap; i++) { newnum[i] = -1; @@ -505,17 +505,17 @@ int gmx_do_dssp(int argc, char *argv[]) int *index; rvec *xp, *x; int *average_area; - real **accr, *accr_ptr = NULL, *av_area, *norm_av_area; + real **accr, *accr_ptr = nullptr, *av_area, *norm_av_area; char pdbfile[32], tmpfile[32]; char dssp[256]; const char *dptr; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efDAT, "-ssdump", "ssdump", ffOPTWR }, { efMAP, "-map", "ss", ffLIBRD }, { efXPM, "-o", "ss", ffWRITE }, @@ -528,7 +528,7 @@ int gmx_do_dssp(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW | PCA_TIME_UNIT, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -538,7 +538,7 @@ int gmx_do_dssp(int argc, char *argv[]) fnAArea = opt2fn_null("-aa", NFILE, fnm); bDoAccSurf = (fnArea || fnTArea || fnAArea); - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, NULL, box, FALSE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, nullptr, box, FALSE); atoms = &(top.atoms); check_oo(atoms); bPhbres = bPhobics(atoms); @@ -558,11 +558,11 @@ int gmx_do_dssp(int argc, char *argv[]) std::strcpy(pdbfile, "ddXXXXXX"); gmx_tmpnam(pdbfile); - if ((tmpf = fopen(pdbfile, "w")) == NULL) + if ((tmpf = fopen(pdbfile, "w")) == nullptr) { sprintf(pdbfile, "%ctmp%cfilterXXXXXX", DIR_SEPARATOR, DIR_SEPARATOR); gmx_tmpnam(pdbfile); - if ((tmpf = fopen(pdbfile, "w")) == NULL) + if ((tmpf = fopen(pdbfile, "w")) == nullptr) { gmx_fatal(FARGS, "Can not open tmp file %s", pdbfile); } @@ -574,11 +574,11 @@ int gmx_do_dssp(int argc, char *argv[]) std::strcpy(tmpfile, "ddXXXXXX"); gmx_tmpnam(tmpfile); - if ((tmpf = fopen(tmpfile, "w")) == NULL) + if ((tmpf = fopen(tmpfile, "w")) == nullptr) { sprintf(tmpfile, "%ctmp%cfilterXXXXXX", DIR_SEPARATOR, DIR_SEPARATOR); gmx_tmpnam(tmpfile); - if ((tmpf = fopen(tmpfile, "w")) == NULL) + if ((tmpf = fopen(tmpfile, "w")) == nullptr) { gmx_fatal(FARGS, "Can not open tmp file %s", tmpfile); } @@ -588,7 +588,7 @@ int gmx_do_dssp(int argc, char *argv[]) fclose(tmpf); } - if ((dptr = getenv("DSSP")) == NULL) + if ((dptr = getenv("DSSP")) == nullptr) { dptr = "/usr/local/bin/dssp"; } @@ -623,10 +623,10 @@ int gmx_do_dssp(int argc, char *argv[]) } else { - fTArea = NULL; + fTArea = nullptr; } - mat.map = NULL; + mat.map = nullptr; mat.nmap = readcmap(opt2fn("-map", NFILE, fnm), &(mat.map)); natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box); @@ -642,7 +642,7 @@ int gmx_do_dssp(int argc, char *argv[]) snew(average_area, atoms->nres); snew(av_area, atoms->nres); snew(norm_av_area, atoms->nres); - accr = NULL; + accr = nullptr; naccr = 0; gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms); @@ -660,7 +660,7 @@ int gmx_do_dssp(int argc, char *argv[]) } gmx_rmpbc(gpbc, natoms, box, x); tapein = gmx_ffopen(pdbfile, "w"); - write_pdbfile_indexed(tapein, NULL, atoms, x, ePBC, box, ' ', -1, gnx, index, NULL, TRUE); + write_pdbfile_indexed(tapein, nullptr, atoms, x, ePBC, box, ' ', -1, gnx, index, nullptr, TRUE); gmx_ffclose(tapein); if (0 != system(dssp)) diff --git a/src/gromacs/gmxana/gmx_dos.cpp b/src/gromacs/gmxana/gmx_dos.cpp index 3845ba98ca..072999b613 100644 --- a/src/gromacs/gmxana/gmx_dos.cpp +++ b/src/gromacs/gmxana/gmx_dos.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -307,9 +307,9 @@ int gmx_dos(int argc, char *argv[]) }; t_filenm fnm[] = { - { efTRN, "-f", NULL, ffREAD }, - { efTPR, "-s", NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRN, "-f", nullptr, ffREAD }, + { efTPR, "-s", nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-vacf", "vacf", ffWRITE }, { efXVG, "-mvacf", "mvacf", ffWRITE }, { efXVG, "-dos", "dos", ffWRITE }, @@ -339,7 +339,7 @@ int gmx_dos(int argc, char *argv[]) please_cite(fplog, "Pascal2011a"); please_cite(fplog, "Caleman2011b"); - read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE); + read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE); /* Handle index groups */ get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &grpNatoms, &index, &grpname); @@ -359,7 +359,7 @@ int gmx_dos(int argc, char *argv[]) snew(c1, gnx); for (i = 0; (i < gnx); i++) { - c1[i] = NULL; + c1[i] = nullptr; } read_first_frame(oenv, &status, ftp2fn(efTRN, NFILE, fnm), &fr, TRX_NEED_V); @@ -429,7 +429,7 @@ int gmx_dos(int argc, char *argv[]) normalizeAutocorrelation = opt2parg_bool("-normalize", npargs, ppa); /* Note that we always disable normalization here, regardless of user settings */ - low_do_autocorr(NULL, oenv, NULL, nframes, gnx, nframes, c1, dt, eacNormal, 0, FALSE, + low_do_autocorr(nullptr, oenv, nullptr, nframes, gnx, nframes, c1, dt, eacNormal, 0, FALSE, FALSE, FALSE, -1, -1, 0); snew(dos, DOS_NR); for (j = 0; (j < DOS_NR); j++) @@ -506,7 +506,7 @@ int gmx_dos(int argc, char *argv[]) } } /* Normalize it */ - dostot = evaluate_integral(nframes/4, nu, dos[DOS], NULL, nframes/4, &stddev); + dostot = evaluate_integral(nframes/4, nu, dos[DOS], nullptr, nframes/4, &stddev); if (bNormalizeDos) { for (j = 0; (j < nframes/4); j++) @@ -585,14 +585,14 @@ int gmx_dos(int argc, char *argv[]) dos[DOS_E][j] = (dos[DOS_DIFF][j]*wEdiff + dos[DOS_SOLID][j]*wEsolid(nu[j], beta)); } - DiffCoeff = evaluate_integral(nframes/2, tt, dos[VACF], NULL, nframes/2, &stddev); + DiffCoeff = evaluate_integral(nframes/2, tt, dos[VACF], nullptr, nframes/2, &stddev); DiffCoeff = 1000*DiffCoeff/3.0; fprintf(fplog, "Diffusion coefficient from VACF %g 10^-5 cm^2/s\n", DiffCoeff); fprintf(fplog, "Diffusion coefficient from DoS %g 10^-5 cm^2/s\n", 1000*DoS0/(12*tmass*beta)); - cP = BOLTZ * evaluate_integral(nframes/4, nu, dos[DOS_CP], NULL, + cP = BOLTZ * evaluate_integral(nframes/4, nu, dos[DOS_CP], nullptr, nframes/4, &stddev); fprintf(fplog, "Heat capacity %g J/mol K\n", 1000*cP/Nmol); fprintf(fplog, "\nArrivederci!\n"); diff --git a/src/gromacs/gmxana/gmx_dyecoupl.cpp b/src/gromacs/gmxana/gmx_dyecoupl.cpp index b7af6b5352..e9c28c7194 100644 --- a/src/gromacs/gmxana/gmx_dyecoupl.cpp +++ b/src/gromacs/gmxana/gmx_dyecoupl.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -87,8 +87,8 @@ int gmx_dyecoupl(int argc, char *argv[]) t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efNDX, NULL, NULL, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffREAD }, { efXVG, "-ot", "rkappa", ffOPTWR }, { efXVG, "-oe", "insteff", ffOPTWR }, { efDAT, "-o", "rkappa", ffOPTWR }, @@ -98,7 +98,7 @@ int gmx_dyecoupl(int argc, char *argv[]) #define NFILE asize(fnm) - const char *in_trajfile, *out_xvgrkfile = NULL, *out_xvginstefffile = NULL, *out_xvgrhistfile = NULL, *out_xvgkhistfile = NULL, *out_datfile = NULL; + const char *in_trajfile, *out_xvgrkfile = nullptr, *out_xvginstefffile = nullptr, *out_xvgrhistfile = nullptr, *out_xvgkhistfile = nullptr, *out_datfile = nullptr; gmx_bool bHaveFirstFrame, bHaveNextFrame, indexOK = TRUE; int ndon, nacc; int *donindex, *accindex; @@ -115,10 +115,10 @@ int gmx_dyecoupl(int argc, char *argv[]) /*we rely on PBC autodetection (...currently)*/ int ePBC = -1; - real *rvalues = NULL, *kappa2values = NULL, *rhist = NULL, *khist = NULL; - t_pbc *pbc = NULL; + real *rvalues = nullptr, *kappa2values = nullptr, *rhist = nullptr, *khist = nullptr; + t_pbc *pbc = nullptr; int i, bin; - FILE *rkfp = NULL, *rhfp = NULL, *khfp = NULL, *datfp = NULL, *iefp = NULL; + FILE *rkfp = nullptr, *rhfp = nullptr, *khfp = nullptr, *datfp = nullptr, *iefp = nullptr; gmx_bool bRKout, bRhistout, bKhistout, bDatout, bInstEffout, grident; const char *rkleg[2] = { "R", "\\f{Symbol}k\\f{}\\S2\\N" }; @@ -131,7 +131,7 @@ int gmx_dyecoupl(int argc, char *argv[]) int rkcount = 0, rblocksallocated = 0, kblocksallocated = 0; if (!parse_common_args(&argc, argv, PCA_CAN_BEGIN | PCA_CAN_END | PCA_CAN_VIEW | PCA_TIME_UNIT, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -166,10 +166,10 @@ int gmx_dyecoupl(int argc, char *argv[]) } printf("Select group with donor atom pairs defining the transition moment\n"); - get_index(NULL, ftp2fn_null(efNDX, NFILE, fnm), 1, &ndon, &donindex, &grpnm); + get_index(nullptr, ftp2fn_null(efNDX, NFILE, fnm), 1, &ndon, &donindex, &grpnm); printf("Select group with acceptor atom pairs defining the transition moment\n"); - get_index(NULL, ftp2fn_null(efNDX, NFILE, fnm), 1, &nacc, &accindex, &grpnm); + get_index(nullptr, ftp2fn_null(efNDX, NFILE, fnm), 1, &nacc, &accindex, &grpnm); /*check if groups are identical*/ grident = TRUE; diff --git a/src/gromacs/gmxana/gmx_dyndom.cpp b/src/gromacs/gmxana/gmx_dyndom.cpp index 362a783db1..720496b637 100644 --- a/src/gromacs/gmxana/gmx_dyndom.cpp +++ b/src/gromacs/gmxana/gmx_dyndom.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -190,7 +190,7 @@ int gmx_dyndom(int argc, char *argv[]) }; int i, j, natoms, isize; t_trxstatus *status; - int *index = NULL, *index_all; + int *index = nullptr, *index_all; char *grpname; real angle, trans; rvec *x, *v, *xout, *vout; @@ -205,7 +205,7 @@ int gmx_dyndom(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -217,9 +217,9 @@ int gmx_dyndom(int argc, char *argv[]) t_topology *top; snew(top, 1); - read_tps_conf(opt2fn("-f", NFILE, fnm), top, NULL, &x, &v, box, FALSE); + read_tps_conf(opt2fn("-f", NFILE, fnm), top, nullptr, &x, &v, box, FALSE); t_atoms &atoms = top->atoms; - if (atoms.pdbinfo == NULL) + if (atoms.pdbinfo == nullptr) { snew(atoms.pdbinfo, atoms.nr); } @@ -258,7 +258,7 @@ int gmx_dyndom(int argc, char *argv[]) atoms.resinfo[atoms.atom[j].resind].chainid = label; } - write_trx(status, atoms.nr, index_all, &atoms, i, angle, box, xout, vout, NULL); + write_trx(status, atoms.nr, index_all, &atoms, i, angle, box, xout, vout, nullptr); } close_trx(status); diff --git a/src/gromacs/gmxana/gmx_editconf.cpp b/src/gromacs/gmxana/gmx_editconf.cpp index 7973df30fd..6eb46c47f2 100644 --- a/src/gromacs/gmxana/gmx_editconf.cpp +++ b/src/gromacs/gmxana/gmx_editconf.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -359,7 +359,7 @@ void visualize_images(const char *fn, int ePBC, matrix box) } calc_triclinic_images(box, img + 1); - write_sto_conf(fn, "Images", &atoms, img, NULL, ePBC, box); + write_sto_conf(fn, "Images", &atoms, img, nullptr, ePBC, box); done_atom(&atoms); sfree(img); @@ -492,7 +492,7 @@ static void renum_resnr(t_atoms *atoms, int isize, const int *index, resind_prev = -1; for (i = 0; i < isize; i++) { - resind = atoms->atom[index == NULL ? i : index[i]].resind; + resind = atoms->atom[index == nullptr ? i : index[i]].resind; if (resind != resind_prev) { atoms->resinfo[resind].nr = resnr_start; @@ -616,7 +616,7 @@ int gmx_editconf(int argc, char *argv[]) { 0, 0, 0 }, targetvec = { 0, 0, 0 }; static const char *btype[] = - { NULL, "triclinic", "cubic", "dodecahedron", "octahedron", NULL }, + { nullptr, "triclinic", "cubic", "dodecahedron", "octahedron", nullptr }, *label = "A"; static rvec visbox = { 0, 0, 0 }; @@ -699,9 +699,9 @@ int gmx_editconf(int argc, char *argv[]) FILE *out; const char *infile, *outfile; int outftp, inftp, natom, i, j, n_bfac, itype, ntype; - double *bfac = NULL, c6, c12; - int *bfac_nr = NULL; - t_topology *top = NULL; + double *bfac = nullptr, c6, c12; + int *bfac_nr = nullptr; + t_topology *top = nullptr; char *grpname, *sgrpname, *agrpname; int isize, ssize, asize; int *index, *sindex, *aindex; @@ -717,9 +717,9 @@ int gmx_editconf(int argc, char *argv[]) gmx_output_env_t *oenv; t_filenm fnm[] = { - { efSTX, "-f", NULL, ffREAD }, - { efNDX, "-n", NULL, ffOPTRD }, - { efSTO, NULL, NULL, ffOPTWR }, + { efSTX, "-f", nullptr, ffREAD }, + { efNDX, "-n", nullptr, ffOPTRD }, + { efSTO, nullptr, nullptr, ffOPTWR }, { efPQR, "-mead", "mead", ffOPTWR }, { efDAT, "-bf", "bfact", ffOPTRD } }; @@ -754,7 +754,7 @@ int gmx_editconf(int argc, char *argv[]) bScale = bScale || bRho; bCalcGeom = bCenter || bRotate || bOrient || bScale; - GMX_RELEASE_ASSERT(btype[0] != NULL, "Option setting inconsistency; btype[0] is NULL"); + GMX_RELEASE_ASSERT(btype[0] != nullptr, "Option setting inconsistency; btype[0] is NULL"); bCalcDiam = (btype[0][0] == 'c' || btype[0][0] == 'd' || btype[0][0] == 'o'); @@ -793,7 +793,7 @@ int gmx_editconf(int argc, char *argv[]) read_tps_conf(infile, top_tmp, &ePBC, &x, &v, box, FALSE); t_atoms &atoms = top_tmp->atoms; natom = atoms.nr; - if (atoms.pdbinfo == NULL) + if (atoms.pdbinfo == nullptr) { snew(atoms.pdbinfo, atoms.nr); } @@ -820,7 +820,7 @@ int gmx_editconf(int argc, char *argv[]) if (bMead || bGrasp || bCONECT) { - top = read_top(infile, NULL); + top = read_top(infile, nullptr); } if (bMead || bGrasp) @@ -924,7 +924,7 @@ int gmx_editconf(int argc, char *argv[]) else { ssize = atoms.nr; - sindex = NULL; + sindex = nullptr; } diam = calc_geom(ssize, sindex, x, gc, rmin, rmax, bCalcDiam); rvec_sub(rmax, rmin, size); @@ -962,7 +962,7 @@ int gmx_editconf(int argc, char *argv[]) get_index(&atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpnames); /* Orient the principal axes along the coordinate axes */ - orient_princ(&atoms, isize, index, natom, x, bHaveV ? v : NULL, NULL); + orient_princ(&atoms, isize, index, natom, x, bHaveV ? v : nullptr, nullptr); sfree(index); sfree(grpnames); } @@ -1055,7 +1055,7 @@ int gmx_editconf(int argc, char *argv[]) else { ssize = atoms.nr; - sindex = NULL; + sindex = nullptr; } printf("Translating %d atoms (out of %d) by %g %g %g nm\n", ssize, natom, translation[XX], translation[YY], translation[ZZ]); @@ -1097,7 +1097,7 @@ int gmx_editconf(int argc, char *argv[]) } } - if ((btype[0] != NULL) && (bSetSize || bDist || (btype[0][0] == 't' && bSetAng))) + if ((btype[0] != nullptr) && (bSetSize || bDist || (btype[0][0] == 't' && bSetAng))) { ePBC = epbcXYZ; if (!(bSetSize || bDist)) @@ -1231,7 +1231,7 @@ int gmx_editconf(int argc, char *argv[]) } else { - conect = NULL; + conect = nullptr; } if (bIndex) @@ -1266,14 +1266,14 @@ int gmx_editconf(int argc, char *argv[]) } else { - write_sto_conf_indexed(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : NULL, ePBC, box, isize, index); + write_sto_conf_indexed(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : nullptr, ePBC, box, isize, index); } } else { if (resnr_start >= 0) { - renum_resnr(&atoms, atoms.nr, NULL, resnr_start); + renum_resnr(&atoms, atoms.nr, nullptr, resnr_start); } if ((outftp == efPDB) || (outftp == efPQR)) @@ -1321,12 +1321,12 @@ int gmx_editconf(int argc, char *argv[]) } else { - write_sto_conf(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : NULL, ePBC, box); + write_sto_conf(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : nullptr, ePBC, box); } } gmx_atomprop_destroy(aps); - do_view(oenv, outfile, NULL); + do_view(oenv, outfile, nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_eneconv.cpp b/src/gromacs/gmxana/gmx_eneconv.cpp index 5c27bcb1c7..6d47833172 100644 --- a/src/gromacs/gmxana/gmx_eneconv.cpp +++ b/src/gromacs/gmxana/gmx_eneconv.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -70,7 +70,7 @@ static int *select_it(int nre, gmx_enxnm_t *nm, int *nset) int *set; gmx_bool bVerbose = TRUE; - if ((getenv("GMX_ENER_VERBOSE")) != NULL) + if ((getenv("GMX_ENER_VERBOSE")) != nullptr) { bVerbose = FALSE; } @@ -163,7 +163,7 @@ static int scan_ene_files(char **fnms, int nfiles, for (f = 0; f < nfiles; f++) { in = open_enx(fnms[f], "r"); - enm = NULL; + enm = nullptr; do_enxnms(in, &nre, &enm); if (f == 0) @@ -191,7 +191,7 @@ static int scan_ene_files(char **fnms, int nfiles, fprintf(stderr, "\nContinue conversion using only the first %d terms (n/y)?\n" "(you should be sure that the energy terms match)\n", nremin); - if (NULL == fgets(inputstring, STRLEN-1, stdin)) + if (nullptr == fgets(inputstring, STRLEN-1, stdin)) { gmx_fatal(FARGS, "Error reading user input"); } @@ -252,7 +252,7 @@ static void edit_files(char **fnms, int nfiles, real *readtime, ok = FALSE; do { - if (NULL == fgets(inputstring, STRLEN-1, stdin)) + if (nullptr == fgets(inputstring, STRLEN-1, stdin)) { gmx_fatal(FARGS, "Error reading user input"); } @@ -444,8 +444,8 @@ int gmx_eneconv(int argc, char *argv[]) const char *bugs[] = { "When combining trajectories the sigma and E^2 (necessary for statistics) are not updated correctly. Only the actual energy is correct. One thus has to compute statistics in another way." }; - ener_file_t in = NULL, out = NULL; - gmx_enxnm_t *enm = NULL; + ener_file_t in = nullptr, out = nullptr; + gmx_enxnm_t *enm = nullptr; #if 0 ener_file_t in, out = NULL; gmx_enxnm_t *enm = NULL; @@ -455,7 +455,7 @@ int gmx_eneconv(int argc, char *argv[]) t_energy *ee_sum; gmx_int64_t lastfilestep, laststep, startstep_file = 0; int noutfr; - int nre, nremax, this_nre, nfile, f, i, kkk, nset, *set = NULL; + int nre, nremax, this_nre, nfile, f, i, kkk, nset, *set = nullptr; double last_t; char **fnms; real *readtime, *settime, timestep, tadjust; @@ -464,12 +464,12 @@ int gmx_eneconv(int argc, char *argv[]) gmx_bool bNewFile, bFirst, bNewOutput; gmx_output_env_t *oenv; gmx_bool warned_about_dh = FALSE; - t_enxblock *blocks = NULL; + t_enxblock *blocks = nullptr; int nblocks = 0; int nblocks_alloc = 0; t_filenm fnm[] = { - { efEDR, "-f", NULL, ffRDMULT }, + { efEDR, "-f", nullptr, ffRDMULT }, { efEDR, "-o", "fixed", ffWRITE }, }; @@ -549,7 +549,7 @@ int gmx_eneconv(int argc, char *argv[]) bNewFile = TRUE; bNewOutput = TRUE; in = open_enx(fnms[f], "r"); - enm = NULL; + enm = nullptr; do_enxnms(in, &this_nre, &enm); if (f == 0) { diff --git a/src/gromacs/gmxana/gmx_enemat.cpp b/src/gromacs/gmxana/gmx_enemat.cpp index 6c10e09aa2..23fd17953a 100644 --- a/src/gromacs/gmxana/gmx_enemat.cpp +++ b/src/gromacs/gmxana/gmx_enemat.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -150,29 +150,29 @@ int gmx_enemat(int argc, char *argv[]) ener_file_t in; FILE *out; int timecheck = 0; - gmx_enxnm_t *enm = NULL; + gmx_enxnm_t *enm = nullptr; t_enxframe *fr; int teller = 0; real sum; gmx_bool bCont, bRef; gmx_bool bCutmax, bCutmin; - real **eneset, *time = NULL; + real **eneset, *time = nullptr; int *set, i, j, k, prevk, m = 0, n, nre, nset, nenergy; - char **groups = NULL; + char **groups = nullptr; char groupname[255], fn[255]; int ngroups; t_rgb rlo, rhi, rmid; real emax, emid, emin; real ***emat, **etot, *groupnr; - double beta, expE, **e, *eaver, *efree = NULL, edum; + double beta, expE, **e, *eaver, *efree = nullptr, edum; char label[234]; - char **ereflines, **erefres = NULL; - real *eref = NULL, *edif = NULL; + char **ereflines, **erefres = nullptr; + real *eref = nullptr, *edif = nullptr; int neref = 0; gmx_output_env_t *oenv; t_filenm fnm[] = { - { efEDR, "-f", NULL, ffOPTRD }, + { efEDR, "-f", nullptr, ffOPTRD }, { efDAT, "-groups", "groups", ffREAD }, { efDAT, "-eref", "eref", ffOPTRD }, { efXPM, "-emat", "emat", ffWRITE }, @@ -181,7 +181,7 @@ int gmx_enemat(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -511,7 +511,7 @@ int gmx_enemat(int argc, char *argv[]) out = xvgropen(ftp2fn(efXVG, NFILE, fnm), "Mean Energy", "Residue", "kJ/mol", oenv); - xvgr_legend(out, 0, NULL, oenv); + xvgr_legend(out, 0, nullptr, oenv); j = 0; if (output_env_get_print_xvgr_codes(oenv)) { diff --git a/src/gromacs/gmxana/gmx_energy.cpp b/src/gromacs/gmxana/gmx_energy.cpp index d507bac7ef..a55123d77c 100644 --- a/src/gromacs/gmxana/gmx_energy.cpp +++ b/src/gromacs/gmxana/gmx_energy.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -118,7 +118,7 @@ static int *select_it(int nre, char *nm[], int *nset) int *set; gmx_bool bVerbose = TRUE; - if ((getenv("GMX_ENER_VERBOSE")) != NULL) + if ((getenv("GMX_ENER_VERBOSE")) != nullptr) { bVerbose = FALSE; } @@ -186,9 +186,9 @@ static int *select_by_name(int nre, gmx_enxnm_t *nm, int *nset) char *ptr, buf[STRLEN]; const char *fm4 = "%3d %-14s"; const char *fm2 = "%3d %-34s"; - char **newnm = NULL; + char **newnm = nullptr; - if ((getenv("GMX_ENER_VERBOSE")) != NULL) + if ((getenv("GMX_ENER_VERBOSE")) != nullptr) { bVerbose = FALSE; } @@ -205,7 +205,7 @@ static int *select_by_name(int nre, gmx_enxnm_t *nm, int *nset) { newnm[k] = gmx_strdup(nm[k].name); /* Insert dashes in all the names */ - while ((ptr = std::strchr(newnm[k], ' ')) != NULL) + while ((ptr = std::strchr(newnm[k], ' ')) != nullptr) { *ptr = '-'; } @@ -325,7 +325,7 @@ static int *select_by_name(int nre, gmx_enxnm_t *nm, int *nset) } } /* Look for the first space, and remove spaces from there */ - if ((ptr = std::strchr(ptr, ' ')) != NULL) + if ((ptr = std::strchr(ptr, ' ')) != nullptr) { trim(ptr); } @@ -366,7 +366,7 @@ static void get_dhdl_parms(const char *topnm, t_inputrec *ir) matrix box; /* all we need is the ir to be able to write the label */ - read_tpx(topnm, ir, box, &natoms, NULL, NULL, &mtop); + read_tpx(topnm, ir, box, &natoms, nullptr, nullptr, &mtop); } static void get_orires_parms(const char *topnm, t_inputrec *ir, @@ -380,7 +380,7 @@ static void get_orires_parms(const char *topnm, t_inputrec *ir, int nb; matrix box; - read_tpx(topnm, ir, box, &natoms, NULL, NULL, &mtop); + read_tpx(topnm, ir, box, &natoms, nullptr, nullptr, &mtop); top = gmx_mtop_generate_local_top(&mtop, ir->efep != efepNO); ip = top->idef.iparams; @@ -425,7 +425,7 @@ static int get_bounds(const char *topnm, int nb, label1; matrix box; - read_tpx(topnm, ir, box, &natoms, NULL, NULL, mtop); + read_tpx(topnm, ir, box, &natoms, nullptr, nullptr, mtop); snew(*ltop, 1); top = gmx_mtop_generate_local_top(mtop, ir->efep != efepNO); *ltop = top; @@ -535,7 +535,7 @@ static void analyse_disre(const char *voutfn, int nframes, /* Subtract bounds from distances, to calculate violations */ calc_violations(violaver, violaver, - nbounds, pair, bounds, NULL, &sumt, &sumaver); + nbounds, pair, bounds, nullptr, &sumt, &sumaver); #ifdef DEBUG fprintf(stdout, "\nSum of violations averaged over simulation: %g nm\n", @@ -957,7 +957,7 @@ static void remove_drift(int nset, int nbmin, int nbmax, real dt, enerdata_t *ed { delta = edat->s[i].slope*dt; - if (NULL != debug) + if (nullptr != debug) { fprintf(debug, "slope for set %d is %g\n", i, edat->s[i].slope); } @@ -1077,7 +1077,7 @@ static void calc_fluctuation_props(FILE *fp, fprintf(fp, "WARNING: Please verify that your simulations are converged and perform\n" "a block-averaging error analysis (not implemented in g_energy yet)\n"); - if (debug != NULL) + if (debug != nullptr) { if (varv != NOTSET) { @@ -1145,10 +1145,10 @@ static void analyse_ener(gmx_bool bCorr, const char *corrfn, FILE *fp; /* Check out the printed manual for equations! */ double Dt, aver, stddev, errest, delta_t, totaldrift; - enerdata_t *esum = NULL; + enerdata_t *esum = nullptr; real integral, intBulk, Temp = 0, Pres = 0; real pr_aver, pr_stddev, pr_errest; - double beta = 0, expE, expEtot, *fee = NULL; + double beta = 0, expE, expEtot, *fee = nullptr; gmx_int64_t nsteps; int nexact, nnotexact; int i, j, nout; @@ -1263,15 +1263,15 @@ static void analyse_ener(gmx_bool bCorr, const char *corrfn, fee[i] = std::log(expE/edat->nframes)/beta + aver/nmol; } - if (std::strstr(leg[i], "empera") != NULL) + if (std::strstr(leg[i], "empera") != nullptr) { Temp = aver; } - else if (std::strstr(leg[i], "olum") != NULL) + else if (std::strstr(leg[i], "olum") != nullptr) { Vaver = aver; } - else if (std::strstr(leg[i], "essure") != NULL) + else if (std::strstr(leg[i], "essure") != nullptr) { Pres = aver; } @@ -1486,13 +1486,13 @@ static void fec(const char *ene2fn, const char *runavgfn, real aver, beta; real **eneset2; double dE, sum; - gmx_enxnm_t *enm = NULL; + gmx_enxnm_t *enm = nullptr; t_enxframe *fr; char buf[22]; /* read second energy file */ snew(fr, 1); - enm = NULL; + enm = nullptr; enx = open_enx(ene2fn, "r"); do_enxnms(enx, &(fr->nre), &enm); @@ -1530,7 +1530,7 @@ static void fec(const char *ene2fn, const char *runavgfn, srenew(eneset2[i], maxenergy); } } - GMX_RELEASE_ASSERT(time != NULL, "trying to dereference NULL time pointer"); + GMX_RELEASE_ASSERT(time != nullptr, "trying to dereference NULL time pointer"); if (fr->t != time[nenergy2]) { @@ -1556,7 +1556,7 @@ static void fec(const char *ene2fn, const char *runavgfn, nenergy = std::min(edat->nframes, nenergy2); /* calculate fe difference dF = -kT ln < exp(-(E_B-E_A)/kT) >_A */ - fp = NULL; + fp = nullptr; if (runavgfn) { fp = xvgropen(runavgfn, "Running average free energy difference", @@ -1608,8 +1608,8 @@ static void do_dhdl(t_enxframe *fr, const t_inputrec *ir, FILE **fp_dhdl, /* coll data */ double temp = 0, start_time = 0, delta_time = 0, start_lambda = 0; static int setnr = 0; - double *native_lambda_vec = NULL; - const char **lambda_components = NULL; + double *native_lambda_vec = nullptr; + const char **lambda_components = nullptr; int n_lambda_vec = 0; bool firstPass = true; @@ -1987,47 +1987,47 @@ int gmx_energy(int argc, char *argv[]) "Volume", "Pressure" }; - FILE *out = NULL, *fp_pairs = NULL, *fort = NULL, *fodt = NULL, *foten = NULL; - FILE *fp_dhdl = NULL; + FILE *out = nullptr, *fp_pairs = nullptr, *fort = nullptr, *fodt = nullptr, *foten = nullptr; + FILE *fp_dhdl = nullptr; ener_file_t fp; int timecheck = 0; gmx_mtop_t mtop; - gmx_localtop_t *top = NULL; + gmx_localtop_t *top = nullptr; enerdata_t edat; - gmx_enxnm_t *enm = NULL; - t_enxframe *frame, *fr = NULL; + gmx_enxnm_t *enm = nullptr; + t_enxframe *frame, *fr = nullptr; int cur = 0; #define NEXT (1-cur) int nre, teller, teller_disre, nfr; gmx_int64_t start_step; int nor = 0, nex = 0, norfr = 0, enx_i = 0; real start_t; - real *bounds = NULL, *violaver = NULL, *oobs = NULL, *orient = NULL, *odrms = NULL; - int *index = NULL, *pair = NULL, norsel = 0, *orsel = NULL, *or_label = NULL; + real *bounds = nullptr, *violaver = nullptr, *oobs = nullptr, *orient = nullptr, *odrms = nullptr; + int *index = nullptr, *pair = nullptr, norsel = 0, *orsel = nullptr, *or_label = nullptr; int nbounds = 0, npairs; gmx_bool bDisRe, bDRAll, bORA, bORT, bODA, bODR, bODT, bORIRE, bOTEN, bDHDL; gmx_bool bFoundStart, bCont, bVisco; double sum, sumaver, sumt, dbl; - double *time = NULL; + double *time = nullptr; real Vaver; - int *set = NULL, i, j, k, nset, sss; - gmx_bool *bIsEner = NULL; + int *set = nullptr, i, j, k, nset, sss; + gmx_bool *bIsEner = nullptr; char **pairleg, **odtleg, **otenleg; - char **leg = NULL; + char **leg = nullptr; const char *anm_j, *anm_k, *resnm_j, *resnm_k; int resnr_j, resnr_k; const char *orinst_sub = "@ subtitle \"instantaneous\"\n"; char buf[256]; gmx_output_env_t *oenv; - t_enxblock *blk = NULL; - t_enxblock *blk_disre = NULL; + t_enxblock *blk = nullptr; + t_enxblock *blk_disre = nullptr; int ndisre = 0; int dh_blocks = 0, dh_hists = 0, dh_samples = 0, dh_lambdas = 0; t_filenm fnm[] = { - { efEDR, "-f", NULL, ffREAD }, - { efEDR, "-f2", NULL, ffOPTRD }, - { efTPR, "-s", NULL, ffOPTRD }, + { efEDR, "-f", nullptr, ffREAD }, + { efEDR, "-f2", nullptr, ffOPTRD }, + { efTPR, "-s", nullptr, ffOPTRD }, { efXVG, "-o", "energy", ffWRITE }, { efXVG, "-viol", "violaver", ffOPTWR }, { efXVG, "-pairs", "pairs", ffOPTWR }, @@ -2050,7 +2050,7 @@ int gmx_energy(int argc, char *argv[]) ppa = add_acf_pargs(&npargs, pa); if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_BEGIN | PCA_CAN_END, - NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv)) { sfree(ppa); return 0; @@ -2172,7 +2172,7 @@ int gmx_energy(int argc, char *argv[]) gmx_fatal(FARGS, "Printing averages can only be done when a single set is selected"); } - time = NULL; + time = nullptr; if (bORIRE || bOTEN) { @@ -2204,7 +2204,7 @@ int gmx_energy(int argc, char *argv[]) fprintf(stderr, "Select the orientation restraint labels you want (-1 is all)\n"); fprintf(stderr, "End your selection with 0\n"); j = -1; - orsel = NULL; + orsel = nullptr; do { j++; @@ -2328,9 +2328,9 @@ int gmx_energy(int argc, char *argv[]) edat.nsteps = 0; edat.npoints = 0; edat.nframes = 0; - edat.step = NULL; - edat.steps = NULL; - edat.points = NULL; + edat.step = nullptr; + edat.steps = nullptr; + edat.points = nullptr; edat.bHaveSums = TRUE; snew(edat.s, nset); @@ -2456,7 +2456,7 @@ int gmx_energy(int argc, char *argv[]) * Define distance restraint legends. Can only be done after * the first frame has been read... (Then we know how many there are) */ - blk_disre = find_block_id_enxframe(fr, enxDISRE, NULL); + blk_disre = find_block_id_enxframe(fr, enxDISRE, nullptr); if (bDisRe && bDRAll && !leg && blk_disre) { t_iatom *fa; @@ -2525,7 +2525,7 @@ int gmx_energy(int argc, char *argv[]) *******************************************/ if (ndisre > 0) { - GMX_RELEASE_ASSERT(blk_disre != NULL, "Trying to dereference NULL blk_disre pointer"); + GMX_RELEASE_ASSERT(blk_disre != nullptr, "Trying to dereference NULL blk_disre pointer"); #if !GMX_DOUBLE float *disre_rt = blk_disre->sub[0].fval; float *disre_rm3tav = blk_disre->sub[1].fval; @@ -2535,7 +2535,7 @@ int gmx_energy(int argc, char *argv[]) #endif print_time(out, fr->t); - if (violaver == NULL) + if (violaver == nullptr) { snew(violaver, ndisre); } @@ -2614,7 +2614,7 @@ int gmx_energy(int argc, char *argv[]) fprintf(out, "\n"); } } - blk = find_block_id_enxframe(fr, enx_i, NULL); + blk = find_block_id_enxframe(fr, enx_i, nullptr); if (bORIRE && blk) { #if !GMX_DOUBLE @@ -2672,7 +2672,7 @@ int gmx_energy(int argc, char *argv[]) } norfr++; } - blk = find_block_id_enxframe(fr, enxORT, NULL); + blk = find_block_id_enxframe(fr, enxORT, nullptr); if (bOTEN && blk) { #if !GMX_DOUBLE diff --git a/src/gromacs/gmxana/gmx_filter.cpp b/src/gromacs/gmxana/gmx_filter.cpp index ed353329e0..ca7d7c41fd 100644 --- a/src/gromacs/gmxana/gmx_filter.cpp +++ b/src/gromacs/gmxana/gmx_filter.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -100,7 +100,7 @@ int gmx_filter(int argc, char *argv[]) char *grpname; int isize; int *index; - real *w_rls = NULL; + real *w_rls = nullptr; t_trxstatus *in; t_trxstatus *outl, *outh; int nffr, i, fr, nat, j, d, m; @@ -108,20 +108,20 @@ int gmx_filter(int argc, char *argv[]) real flen, *filt, sum, *t; rvec xcmtop, xcm, **x, *ptr, *xf, *xn, *xp, hbox; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; #define NLEG asize(leg) t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efTRO, "-ol", "lowpass", ffOPTWR }, { efTRO, "-oh", "highpass", ffOPTWR } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -140,7 +140,7 @@ int gmx_filter(int argc, char *argv[]) if (topfile) { bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, - &xtop, NULL, topbox, TRUE); + &xtop, nullptr, topbox, TRUE); if (bTop) { gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr); @@ -208,7 +208,7 @@ int gmx_filter(int argc, char *argv[]) } else { - outl = 0; + outl = nullptr; } if (highfile) { @@ -216,7 +216,7 @@ int gmx_filter(int argc, char *argv[]) } else { - outh = 0; + outh = nullptr; } fr = 0; @@ -301,8 +301,8 @@ int gmx_filter(int argc, char *argv[]) } if (outl && (bLowAll || fr % nf == nf - 1)) { - write_trx(outl, nat, ind, topfile ? &(top.atoms) : NULL, - 0, t[nf - 1], bFit ? topbox : boxf, xf, NULL, NULL); + write_trx(outl, nat, ind, topfile ? &(top.atoms) : nullptr, + 0, t[nf - 1], bFit ? topbox : boxf, xf, nullptr, nullptr); } if (outh) { @@ -328,8 +328,8 @@ int gmx_filter(int argc, char *argv[]) boxf[j][d] = topbox[j][d] + box[nf - 1][j][d] - boxf[j][d]; } } - write_trx(outh, nat, ind, topfile ? &(top.atoms) : NULL, - 0, t[nf - 1], bFit ? topbox : boxf, xf, NULL, NULL); + write_trx(outh, nat, ind, topfile ? &(top.atoms) : nullptr, + 0, t[nf - 1], bFit ? topbox : boxf, xf, nullptr, nullptr); } } /* Cycle all the pointer and the box by one */ diff --git a/src/gromacs/gmxana/gmx_genion.cpp b/src/gromacs/gmxana/gmx_genion.cpp index fb15635a25..3a88b6a8f1 100644 --- a/src/gromacs/gmxana/gmx_genion.cpp +++ b/src/gromacs/gmxana/gmx_genion.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -143,7 +143,7 @@ void sort_ions(int nsa, int nw, int repl[], int index[], { int i, j, k, r, np, nn, starta, startr, npi, nni; rvec *xt; - char **pptr = NULL, **nptr = NULL, **paptr = NULL, **naptr = NULL; + char **pptr = nullptr, **nptr = nullptr, **paptr = nullptr, **naptr = nullptr; snew(xt, atoms->nr); @@ -239,7 +239,7 @@ static void update_topol(const char *topinout, int p_num, int n_num, const char *p_name, const char *n_name, char *grpname) { FILE *fpin, *fpout; - char buf[STRLEN], buf2[STRLEN], *temp, **mol_line = NULL; + char buf[STRLEN], buf2[STRLEN], *temp, **mol_line = nullptr; int line, i, nmol_line, sol_line, nsol_last; gmx_bool bMolecules; char temporary_filename[STRLEN]; @@ -258,7 +258,7 @@ static void update_topol(const char *topinout, int p_num, int n_num, { line++; std::strcpy(buf2, buf); - if ((temp = std::strchr(buf2, '\n')) != NULL) + if ((temp = std::strchr(buf2, '\n')) != nullptr) { temp[0] = '\0'; } @@ -266,7 +266,7 @@ static void update_topol(const char *topinout, int p_num, int n_num, if (buf2[0] == '[') { buf2[0] = ' '; - if ((temp = std::strchr(buf2, '\n')) != NULL) + if ((temp = std::strchr(buf2, '\n')) != nullptr) { temp[0] = '\0'; } @@ -396,9 +396,9 @@ int gmx_genion(int argc, char *argv[]) int i, nw, nwa, nsa, nsalt, iqtot; gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efSTO, "-o", NULL, ffWRITE }, + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efSTO, "-o", nullptr, ffWRITE }, { efTOP, "-p", "topol", ffOPTRW } }; #define NFILE asize(fnm) @@ -549,9 +549,9 @@ int gmx_genion(int argc, char *argv[]) } sfree(atoms.pdbinfo); - atoms.pdbinfo = NULL; + atoms.pdbinfo = nullptr; } - write_sto_conf(ftp2fn(efSTO, NFILE, fnm), *top.name, &atoms, x, NULL, ePBC, box); + write_sto_conf(ftp2fn(efSTO, NFILE, fnm), *top.name, &atoms, x, nullptr, ePBC, box); return 0; } diff --git a/src/gromacs/gmxana/gmx_genpr.cpp b/src/gromacs/gmxana/gmx_genpr.cpp index 17641a07dd..ff988d408c 100644 --- a/src/gromacs/gmxana/gmx_genpr.cpp +++ b/src/gromacs/gmxana/gmx_genpr.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -110,7 +110,7 @@ int gmx_genpr(int argc, char *argv[]) #define npargs asize(pa) gmx_output_env_t *oenv; - t_atoms *atoms = NULL; + t_atoms *atoms = nullptr; int i, j, k; FILE *out; int igrp; @@ -120,18 +120,18 @@ int gmx_genpr(int argc, char *argv[]) char *gn_grp; matrix box; gmx_bool bFreeze; - rvec dx, *x = NULL, *v = NULL; + rvec dx, *x = nullptr, *v = nullptr; t_filenm fnm[] = { - { efSTX, "-f", NULL, ffREAD }, - { efNDX, "-n", NULL, ffOPTRD }, + { efSTX, "-f", nullptr, ffREAD }, + { efNDX, "-n", nullptr, ffOPTRD }, { efITP, "-o", "posre", ffWRITE }, { efNDX, "-of", "freeze", ffOPTWR } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, 0, NFILE, fnm, npargs, pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -141,7 +141,7 @@ int gmx_genpr(int argc, char *argv[]) xfn = opt2fn_null("-f", NFILE, fnm); nfn = opt2fn_null("-n", NFILE, fnm); - if (( nfn == NULL ) && ( xfn == NULL)) + if (( nfn == nullptr ) && ( xfn == nullptr)) { gmx_fatal(FARGS, "no index file and no structure file supplied"); } @@ -156,15 +156,15 @@ int gmx_genpr(int argc, char *argv[]) } const char *title = ""; - if (xfn != NULL) + if (xfn != nullptr) { fprintf(stderr, "\nReading structure file\n"); - t_topology *top = NULL; + t_topology *top = nullptr; snew(top, 1); - read_tps_conf(xfn, top, NULL, &x, &v, box, FALSE); + read_tps_conf(xfn, top, nullptr, &x, &v, box, FALSE); title = *top->name; atoms = &top->atoms; - if (atoms->pdbinfo == NULL) + if (atoms->pdbinfo == nullptr) { snew(atoms->pdbinfo, atoms->nr); } diff --git a/src/gromacs/gmxana/gmx_gyrate.cpp b/src/gromacs/gmxana/gmx_gyrate.cpp index 0d7248f8a8..ed2f590921 100644 --- a/src/gromacs/gmxana/gmx_gyrate.cpp +++ b/src/gromacs/gmxana/gmx_gyrate.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -112,12 +112,12 @@ void calc_gyro_z(rvec x[], matrix box, int gnx, int index[], t_atom atom[], int nz, real time, FILE *out) { - static dvec *inertia = NULL; - static double *tm = NULL; + static dvec *inertia = nullptr; + static double *tm = nullptr; int i, ii, j, zi; real zf, w, sdet, e1, e2; - if (inertia == NULL) + if (inertia == nullptr) { snew(inertia, nz); snew(tm, nz); @@ -208,7 +208,7 @@ int gmx_gyrate(int argc, char *argv[]) rvec xcm, gvec, gvec1; matrix box, trans; gmx_bool bACF; - real **moi_trans = NULL; + real **moi_trans = nullptr; int max_moi = 0, delta_moi = 100; rvec d, d1; /* eigenvalues of inertia tensor */ real t, t0, tm, gyro; @@ -217,15 +217,15 @@ int gmx_gyrate(int argc, char *argv[]) int j, m, gnx, nam, mol; int *index; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; const char *leg[] = { "Rg", "Rg\\sX\\N", "Rg\\sY\\N", "Rg\\sZ\\N" }; const char *legI[] = { "Itot", "I1", "I2", "I3" }; #define NLEG asize(leg) t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efXVG, NULL, "gyrate", ffWRITE }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efXVG, nullptr, "gyrate", ffWRITE }, { efXVG, "-acf", "moi-acf", ffOPTWR }, }; #define NFILE asize(fnm) @@ -236,7 +236,7 @@ int gmx_gyrate(int argc, char *argv[]) ppa = add_acf_pargs(&npargs, pa); if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv)) { sfree(ppa); return 0; @@ -266,7 +266,7 @@ int gmx_gyrate(int argc, char *argv[]) printf("Will print radius normalised by charge\n"); } - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, TRUE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, TRUE); get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname); if (nmol > gnx || gnx % nmol != 0) diff --git a/src/gromacs/gmxana/gmx_h2order.cpp b/src/gromacs/gmxana/gmx_h2order.cpp index 615245e667..498d30aa7d 100644 --- a/src/gromacs/gmxana/gmx_h2order.cpp +++ b/src/gromacs/gmxana/gmx_h2order.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -83,7 +83,7 @@ void calc_h2order(const char *fn, int index[], int ngx, rvec **slDipole, i, j, teller = 0, slice = 0, /* current slice number */ *count; /* nr. of atoms in one slice */ - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; if ((natoms = read_first_x(oenv, &status, fn, &t, &x0, box)) == 0) { @@ -287,24 +287,24 @@ int gmx_h2order(int argc, char *argv[]) }; gmx_output_env_t *oenv; - real *slOrder, /* av. cosine, per slice */ - slWidth = 0.0; /* width of a slice */ + real *slOrder, /* av. cosine, per slice */ + slWidth = 0.0; /* width of a slice */ rvec *slDipole; - char *grpname, /* groupnames */ + char *grpname, /* groupnames */ *micname; - int ngx, /* nr. of atomsin sol group */ - nmic = 0; /* nr. of atoms in micelle */ - t_topology *top; /* topology */ + int ngx, /* nr. of atomsin sol group */ + nmic = 0; /* nr. of atoms in micelle */ + t_topology *top; /* topology */ int ePBC; - int *index, /* indices for solvent group */ - *micelle = NULL; - gmx_bool bMicel = FALSE; /* think we're a micel */ - t_filenm fnm[] = { /* files for g_order */ - { efTRX, "-f", NULL, ffREAD }, /* trajectory file */ - { efNDX, NULL, NULL, ffREAD }, /* index file */ - { efNDX, "-nm", NULL, ffOPTRD }, /* index with micelle atoms */ - { efTPR, NULL, NULL, ffREAD }, /* topology file */ - { efXVG, "-o", "order", ffWRITE }, /* xvgr output file */ + int *index, /* indices for solvent group */ + *micelle = nullptr; + gmx_bool bMicel = FALSE; /* think we're a micel */ + t_filenm fnm[] = { /* files for g_order */ + { efTRX, "-f", nullptr, ffREAD }, /* trajectory file */ + { efNDX, nullptr, nullptr, ffREAD }, /* index file */ + { efNDX, "-nm", nullptr, ffOPTRD }, /* index with micelle atoms */ + { efTPR, nullptr, nullptr, ffREAD }, /* topology file */ + { efXVG, "-o", "order", ffWRITE }, /* xvgr output file */ }; #define NFILE asize(fnm) diff --git a/src/gromacs/gmxana/gmx_hbond.cpp b/src/gromacs/gmxana/gmx_hbond.cpp index 076ebb4616..941f942a73 100644 --- a/src/gromacs/gmxana/gmx_hbond.cpp +++ b/src/gromacs/gmxana/gmx_hbond.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -217,13 +217,13 @@ static void mk_hbmap(t_hbdata *hb) for (i = 0; (i < hb->d.nrd); i++) { snew(hb->hbmap[i], hb->a.nra); - if (hb->hbmap[i] == NULL) + if (hb->hbmap[i] == nullptr) { gmx_fatal(FARGS, "Could not allocate enough memory for hbmap"); } for (j = 0; (j > hb->a.nra); j++) { - hb->hbmap[i][j] = NULL; + hb->hbmap[i][j] = nullptr; } } } @@ -268,7 +268,7 @@ static gmx_bool is_hb(unsigned int hbexist[], int frame) static void set_hb(t_hbdata *hb, int id, int ih, int ia, int frame, int ihb) { - unsigned int *ghptr = NULL; + unsigned int *ghptr = nullptr; if (ihb == hbHB) { @@ -503,7 +503,7 @@ static void add_hbond(t_hbdata *hb, int d, int a, int h, int grpd, int grpa, { try { - if (hb->hbmap[id][ia] == NULL) + if (hb->hbmap[id][ia] == nullptr) { snew(hb->hbmap[id][ia], 1); snew(hb->hbmap[id][ia]->h, hb->maxhydro); @@ -1184,7 +1184,7 @@ static void free_grid(ivec ngrid, t_gridcell ****grid) sfree(g[z]); } sfree(g); - g = NULL; + g = nullptr; } static void pbc_correct_gem(rvec dx, matrix box, rvec hbox) @@ -1470,8 +1470,8 @@ static void merge_hb(t_hbdata *hb, gmx_bool bTwo, gmx_bool bContact) } sfree(hb1->h[0]); sfree(hb1->g[0]); - hb1->h[0] = NULL; - hb1->g[0] = NULL; + hb1->h[0] = nullptr; + hb1->g[0] = nullptr; hb1->history[0] = hbNo; } } @@ -1768,7 +1768,7 @@ void analyse_corr(int n, real t[], real ct[], real nt[], real kt[], real k = 1, kp = 1, kow = 1; real Q = 0, chi2, tau_hb, dtau, tau_rlx, e_1, sigma_k, sigma_kp, ddg; double tmp, sn2 = 0, sc2 = 0, sk2 = 0, scn = 0, sck = 0, snk = 0; - gmx_bool bError = (sigma_ct != NULL) && (sigma_nt != NULL) && (sigma_kt != NULL); + gmx_bool bError = (sigma_ct != nullptr) && (sigma_nt != nullptr) && (sigma_kt != nullptr); for (i0 = 0; (i0 < n-2) && ((t[i0]-t[0]) < fit_start); i0++) { @@ -1844,7 +1844,7 @@ void analyse_corr(int n, real t[], real ct[], real nt[], real kt[], sc2, sn2, sk2, sck, snk, scn); } /* Determine integral of the correlation function */ - tau_hb = evaluate_integral(n, t, ct, NULL, (t[n-1]-t[0])/2, &dtau); + tau_hb = evaluate_integral(n, t, ct, nullptr, (t[n-1]-t[0])/2, &dtau); printf("Integral %10.3f %s%8.3f %10.3f\n", 1/tau_hb, bError ? " " : "", tau_hb, calc_dg(tau_hb, temp)); e_1 = std::exp(-1.0); @@ -1901,7 +1901,7 @@ static void normalizeACF(real *ct, real *gt, int nhb, int len) for (i = 0; i < len; i++) { ct[i] *= ct_fac; - if (gt != NULL) + if (gt != nullptr) { gt[i] *= gt_fac; } @@ -1924,15 +1924,15 @@ static void do_hbac(const char *fn, t_hbdata *hb, }; gmx_bool bNorm = FALSE; double nhb = 0; - real *rhbex = NULL, *ht, *gt, *ght, *dght, *kt; + real *rhbex = nullptr, *ht, *gt, *ght, *dght, *kt; real *ct, tail, tail2, dtail, *cct; const real tol = 1e-3; int nframes = hb->nframes; - unsigned int **h = NULL, **g = NULL; + unsigned int **h = nullptr, **g = nullptr; int nh, nhbonds, nhydro; t_hbond *hbh; int acType; - int *dondata = NULL; + int *dondata = nullptr; enum { AC_NONE, AC_NN, AC_GEM, AC_LUZAR @@ -2073,7 +2073,7 @@ static void do_hbac(const char *fn, t_hbdata *hb, } /* The autocorrelation function is normalized after summation only */ - low_do_autocorr(NULL, oenv, NULL, nframes, 1, -1, &rhbex, hb->time[1]-hb->time[0], + low_do_autocorr(nullptr, oenv, nullptr, nframes, 1, -1, &rhbex, hb->time[1]-hb->time[0], eacNormal, 1, FALSE, bNorm, FALSE, 0, -1, 0); /* Cross correlation analysis for thermodynamics */ @@ -2150,10 +2150,10 @@ static void do_hbac(const char *fn, t_hbdata *hb, } xvgrclose(fp); - analyse_corr(nn, hb->time, ct, ght, kt, NULL, NULL, NULL, + analyse_corr(nn, hb->time, ct, ght, kt, nullptr, nullptr, nullptr, fit_start, temp); - do_view(oenv, fn, NULL); + do_view(oenv, fn, nullptr); sfree(rhbex); sfree(ct); sfree(gt); @@ -2181,12 +2181,12 @@ static FILE *open_donor_properties_file(const char *fn, t_hbdata *hb, const gmx_output_env_t *oenv) { - FILE *fp = NULL; + FILE *fp = nullptr; const char *leg[] = { "Nbound", "Nfree" }; if (!fn || !hb) { - return NULL; + return nullptr; } fp = xvgropen(fn, "Donor properties", output_env_get_xvgr_tlabel(oenv), "Number", oenv); @@ -2243,7 +2243,7 @@ static void dump_hbmap(t_hbdata *hb, } else { - fplog = NULL; + fplog = nullptr; } for (grp = gr0; grp <= (bTwo ? gr1 : gr0); grp++) { @@ -2483,9 +2483,9 @@ int gmx_hbond(int argc, char *argv[]) "The option [TT]-sel[tt] that used to work on selected hbonds is out of order, and therefore not available for the time being." }; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, /* { efNDX, "-sel", "select", ffOPTRD },*/ { efXVG, "-num", "hbnum", ffWRITE }, { efLOG, "-g", "hbond", ffOPTWR }, @@ -2527,7 +2527,7 @@ int gmx_hbond(int argc, char *argv[]) int grp, nabin, nrbin, resdist, ihb; char **leg; t_hbdata *hb; - FILE *fp, *fpnhb = NULL, *donor_properties = NULL; + FILE *fp, *fpnhb = nullptr, *donor_properties = nullptr; t_gridcell ***grid; t_ncell *icell, *jcell; ivec ngrid; @@ -2538,8 +2538,8 @@ int gmx_hbond(int argc, char *argv[]) gmx_bool bParallel; gmx_bool bEdge_yjj, bEdge_xjj; - t_hbdata **p_hb = NULL; /* one per thread, then merge after the frame loop */ - int **p_adist = NULL, **p_rdist = NULL; /* a histogram for each thread. */ + t_hbdata **p_hb = nullptr; /* one per thread, then merge after the frame loop */ + int **p_adist = nullptr, **p_rdist = nullptr; /* a histogram for each thread. */ const bool bOMP = GMX_OPENMP; @@ -2588,7 +2588,7 @@ int gmx_hbond(int argc, char *argv[]) /* get topology */ gmx::MDModules mdModules; t_inputrec *ir = mdModules.inputrec(); - read_tpx_top(ftp2fn(efTPR, NFILE, fnm), ir, box, &natoms, NULL, NULL, &top); + read_tpx_top(ftp2fn(efTPR, NFILE, fnm), ir, box, &natoms, nullptr, nullptr, &top); snew(grpnames, grNR); snew(index, grNR); @@ -2813,11 +2813,11 @@ int gmx_hbond(int argc, char *argv[]) snew(p_rdist[i], nrbin+1); p_hb[i]->max_frames = 0; - p_hb[i]->nhb = NULL; - p_hb[i]->ndist = NULL; - p_hb[i]->n_bound = NULL; - p_hb[i]->time = NULL; - p_hb[i]->nhx = NULL; + p_hb[i]->nhb = nullptr; + p_hb[i]->ndist = nullptr; + p_hb[i]->n_bound = nullptr; + p_hb[i]->time = nullptr; + p_hb[i]->nhx = nullptr; p_hb[i]->bHBmap = hb->bHBmap; p_hb[i]->bDAnr = hb->bDAnr; diff --git a/src/gromacs/gmxana/gmx_helix.cpp b/src/gromacs/gmxana/gmx_helix.cpp index e3a10d9018..71657455a2 100644 --- a/src/gromacs/gmxana/gmx_helix.cpp +++ b/src/gromacs/gmxana/gmx_helix.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -120,23 +120,23 @@ int gmx_helix(int argc, char *argv[]) } t_xvgrfile; t_xvgrfile xf[efhNR] = { - { NULL, NULL, TRUE, "radius", "Helix radius", NULL, "r (nm)", 0.0 }, - { NULL, NULL, TRUE, "twist", "Twist per residue", NULL, "Angle (deg)", 0.0 }, - { NULL, NULL, TRUE, "rise", "Rise per residue", NULL, "Rise (nm)", 0.0 }, - { NULL, NULL, FALSE, "len-ahx", "Length of the Helix", NULL, "Length (nm)", 0.0 }, - { NULL, NULL, FALSE, "dip-ahx", "Helix Backbone Dipole", NULL, "rq (nm e)", 0.0 }, - { NULL, NULL, TRUE, "rms-ahx", "RMS Deviation from Ideal Helix", NULL, "RMS (nm)", 0.0 }, - { NULL, NULL, FALSE, "rmsa-ahx", "Average RMSD per Residue", "Residue", "RMS (nm)", 0.0 }, - { NULL, NULL, FALSE, "cd222", "Ellipticity at 222 nm", NULL, "nm", 0.0 }, - { NULL, NULL, TRUE, "pprms", "RMS Distance from \\8a\\4-helix", NULL, "deg", 0.0 }, - { NULL, NULL, TRUE, "caphi", "Average Ca-Ca Dihedral", NULL, "\\8F\\4(deg)", 0.0 }, - { NULL, NULL, TRUE, "phi", "Average \\8F\\4 angles", NULL, "deg", 0.0 }, - { NULL, NULL, TRUE, "psi", "Average \\8Y\\4 angles", NULL, "deg", 0.0 }, - { NULL, NULL, TRUE, "hb3", "Average n-n+3 hbond length", NULL, "nm", 0.0 }, - { NULL, NULL, TRUE, "hb4", "Average n-n+4 hbond length", NULL, "nm", 0.0 }, - { NULL, NULL, TRUE, "hb5", "Average n-n+5 hbond length", NULL, "nm", 0.0 }, - { NULL, NULL, FALSE, "JCaHa", "J-Coupling Values", "Residue", "Hz", 0.0 }, - { NULL, NULL, FALSE, "helicity", "Helicity per Residue", "Residue", "% of time", 0.0 } + { nullptr, nullptr, TRUE, "radius", "Helix radius", nullptr, "r (nm)", 0.0 }, + { nullptr, nullptr, TRUE, "twist", "Twist per residue", nullptr, "Angle (deg)", 0.0 }, + { nullptr, nullptr, TRUE, "rise", "Rise per residue", nullptr, "Rise (nm)", 0.0 }, + { nullptr, nullptr, FALSE, "len-ahx", "Length of the Helix", nullptr, "Length (nm)", 0.0 }, + { nullptr, nullptr, FALSE, "dip-ahx", "Helix Backbone Dipole", nullptr, "rq (nm e)", 0.0 }, + { nullptr, nullptr, TRUE, "rms-ahx", "RMS Deviation from Ideal Helix", nullptr, "RMS (nm)", 0.0 }, + { nullptr, nullptr, FALSE, "rmsa-ahx", "Average RMSD per Residue", "Residue", "RMS (nm)", 0.0 }, + { nullptr, nullptr, FALSE, "cd222", "Ellipticity at 222 nm", nullptr, "nm", 0.0 }, + { nullptr, nullptr, TRUE, "pprms", "RMS Distance from \\8a\\4-helix", nullptr, "deg", 0.0 }, + { nullptr, nullptr, TRUE, "caphi", "Average Ca-Ca Dihedral", nullptr, "\\8F\\4(deg)", 0.0 }, + { nullptr, nullptr, TRUE, "phi", "Average \\8F\\4 angles", nullptr, "deg", 0.0 }, + { nullptr, nullptr, TRUE, "psi", "Average \\8Y\\4 angles", nullptr, "deg", 0.0 }, + { nullptr, nullptr, TRUE, "hb3", "Average n-n+3 hbond length", nullptr, "nm", 0.0 }, + { nullptr, nullptr, TRUE, "hb4", "Average n-n+4 hbond length", nullptr, "nm", 0.0 }, + { nullptr, nullptr, TRUE, "hb5", "Average n-n+5 hbond length", nullptr, "nm", 0.0 }, + { nullptr, nullptr, FALSE, "JCaHa", "J-Coupling Values", "Residue", "Hz", 0.0 }, + { nullptr, nullptr, FALSE, "helicity", "Helicity per Residue", "Residue", "% of time", 0.0 } }; gmx_output_env_t *oenv; @@ -152,18 +152,18 @@ int gmx_helix(int argc, char *argv[]) real t; real rms; matrix box; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; gmx_bool bRange; t_filenm fnm[] = { - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, { efSTO, "-cz", "zconf", ffWRITE }, }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -207,7 +207,7 @@ int gmx_helix(int argc, char *argv[]) /* Read reference frame from tpx file to compute helix length */ snew(xref, top->atoms.nr); read_tpx(ftp2fn(efTPR, NFILE, fnm), - NULL, NULL, &natoms, xref, NULL, NULL); + nullptr, nullptr, &natoms, xref, nullptr, nullptr); calc_hxprops(nres, bb, xref); do_start_end(nres, bb, &nbb, bbindex, &nca, caindex, bRange, rStart, rEnd); sfree(xref); @@ -243,7 +243,7 @@ int gmx_helix(int argc, char *argv[]) if (teller == 1) { write_sto_conf(opt2fn("-cz", NFILE, fnm), "Helix fitted to Z-Axis", - &(top->atoms), x, NULL, ePBC, box); + &(top->atoms), x, nullptr, ePBC, box); } xf[efhRAD].val = radius(xf[efhRAD].fp2, nca, caindex, x); diff --git a/src/gromacs/gmxana/gmx_helixorient.cpp b/src/gromacs/gmxana/gmx_helixorient.cpp index 7f40ea3697..89c0901a88 100644 --- a/src/gromacs/gmxana/gmx_helixorient.cpp +++ b/src/gromacs/gmxana/gmx_helixorient.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -76,9 +76,9 @@ int gmx_helixorient(int argc, char *argv[]) "purposes, we also write out the actual Euler rotation angles as [TT]theta[1-3].xvg[tt]" }; - t_topology *top = NULL; + t_topology *top = nullptr; real t; - rvec *x = NULL; + rvec *x = nullptr; matrix box; t_trxstatus *status; int natoms; @@ -132,7 +132,7 @@ int gmx_helixorient(int argc, char *argv[]) int ePBC; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; static gmx_bool bSC = FALSE; static gmx_bool bIncremental = FALSE; @@ -146,9 +146,9 @@ int gmx_helixorient(int argc, char *argv[]) #define NPA asize(pa) t_filenm fnm[] = { - { efTPR, NULL, NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efDAT, "-oaxis", "helixaxis", ffWRITE }, { efDAT, "-ocenter", "center", ffWRITE }, { efXVG, "-orise", "rise", ffWRITE }, @@ -161,7 +161,7 @@ int gmx_helixorient(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } diff --git a/src/gromacs/gmxana/gmx_hydorder.cpp b/src/gromacs/gmxana/gmx_hydorder.cpp index 2b3bafbfd2..a1ad9703cd 100644 --- a/src/gromacs/gmxana/gmx_hydorder.cpp +++ b/src/gromacs/gmxana/gmx_hydorder.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -251,7 +251,7 @@ static void calc_tetra_order_interface(const char *fnNDX, const char *fnTPS, con real sgang1, real sgang2, real ****intfpos, gmx_output_env_t *oenv) { - FILE *fpsg = NULL, *fpsk = NULL; + FILE *fpsg = nullptr, *fpsk = nullptr; t_topology top; int ePBC; t_trxstatus *status; @@ -260,10 +260,10 @@ static void calc_tetra_order_interface(const char *fnNDX, const char *fnTPS, con rvec *xtop, *x; matrix box; real sg, sk, sgintf; - int **index = NULL; - char **grpname = NULL; + int **index = nullptr; + char **grpname = nullptr; int i, j, k, n, *isize, ng, nslicez, framenr; - real ***sg_grid = NULL, ***sk_grid = NULL, ***sg_fravg = NULL, ***sk_fravg = NULL, ****sk_4d = NULL, ****sg_4d = NULL; + real ***sg_grid = nullptr, ***sk_grid = nullptr, ***sg_fravg = nullptr, ***sk_fravg = nullptr, ****sk_4d = nullptr, ****sg_4d = nullptr; int *perm; int ndx1, ndx2; int bins; @@ -272,7 +272,7 @@ static void calc_tetra_order_interface(const char *fnNDX, const char *fnTPS, con * i.e 1D Row-major order in (t,x,y) */ - read_tps_conf(fnTPS, &top, &ePBC, &xtop, NULL, box, FALSE); + read_tps_conf(fnTPS, &top, &ePBC, &xtop, nullptr, box, FALSE); *nslicex = static_cast(box[XX][XX]/binw + onehalf); /*Calculate slicenr from binwidth*/ *nslicey = static_cast(box[YY][YY]/binw + onehalf); @@ -295,7 +295,7 @@ static void calc_tetra_order_interface(const char *fnNDX, const char *fnTPS, con gmx_fatal(FARGS, "Topology (%d atoms) does not match trajectory (%d atoms)", top.atoms.nr, natoms); } - check_index(NULL, ng, index[0], NULL, natoms); + check_index(nullptr, ng, index[0], nullptr, natoms); /*Prepare structures for temporary storage of frame info*/ @@ -312,8 +312,8 @@ static void calc_tetra_order_interface(const char *fnNDX, const char *fnTPS, con } } - sg_4d = NULL; - sk_4d = NULL; + sg_4d = nullptr; + sk_4d = nullptr; *nframes = 0; framenr = 0; @@ -341,7 +341,7 @@ static void calc_tetra_order_interface(const char *fnNDX, const char *fnTPS, con find_tetra_order_grid(top, ePBC, natoms, box, x, isize[0], index[0], &sg, &sk, *nslicex, *nslicey, nslicez, sg_grid, sk_grid); - GMX_RELEASE_ASSERT(sk_fravg != NULL, "Trying to dereference NULL sk_fravg pointer"); + GMX_RELEASE_ASSERT(sk_fravg != nullptr, "Trying to dereference NULL sk_fravg pointer"); for (i = 0; i < *nslicex; i++) { for (j = 0; j < *nslicey; j++) @@ -358,7 +358,7 @@ static void calc_tetra_order_interface(const char *fnNDX, const char *fnTPS, con if (framenr%tblock == 0) { - GMX_RELEASE_ASSERT(sk_4d != NULL, "Trying to dereference NULL sk_4d pointer"); + GMX_RELEASE_ASSERT(sk_4d != nullptr, "Trying to dereference NULL sk_4d pointer"); sk_4d[*nframes] = sk_fravg; sg_4d[*nframes] = sg_fravg; (*nframes)++; @@ -579,7 +579,7 @@ int gmx_hydorder(int argc, char *argv[]) static gmx_bool bRawOut = FALSE; int frames, xslices, yslices; /* Dimensions of interface arrays*/ real ***intfpos; /* Interface arrays (intfnr,t,xy) -potentially large */ - static const char *normal_axis[] = { NULL, "z", "x", "y", NULL }; + static const char *normal_axis[] = { nullptr, "z", "x", "y", nullptr }; t_pargs pa[] = { { "-d", FALSE, etENUM, {normal_axis}, @@ -597,9 +597,9 @@ int gmx_hydorder(int argc, char *argv[]) }; t_filenm fnm[] = { /* files for g_order */ - { efTRX, "-f", NULL, ffREAD }, /* trajectory file */ - { efNDX, "-n", NULL, ffREAD }, /* index file */ - { efTPR, "-s", NULL, ffREAD }, /* topology file */ + { efTRX, "-f", nullptr, ffREAD }, /* trajectory file */ + { efNDX, "-n", nullptr, ffREAD }, /* index file */ + { efTPR, "-s", nullptr, ffREAD }, /* topology file */ { efXPM, "-o", "intf", ffWRMULT}, /* XPM- surface maps */ { efOUT, "-or", "raw", ffOPTWRMULT }, /* xvgr output file */ { efOUT, "-Spect", "intfspect", ffOPTWRMULT}, /* Fourier spectrum interfaces */ @@ -613,7 +613,7 @@ int gmx_hydorder(int argc, char *argv[]) gmx_output_env_t *oenv; if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -630,7 +630,7 @@ int gmx_hydorder(int argc, char *argv[]) trxfnm = ftp2fn(efTRX, NFILE, fnm); /* Calculate axis */ - GMX_RELEASE_ASSERT(normal_axis[0] != NULL, "Option setting inconsistency; normal_axis[0] is NULL"); + GMX_RELEASE_ASSERT(normal_axis[0] != nullptr, "Option setting inconsistency; normal_axis[0] is NULL"); if (std::strcmp(normal_axis[0], "x") == 0) { axis = XX; diff --git a/src/gromacs/gmxana/gmx_lie.cpp b/src/gromacs/gmxana/gmx_lie.cpp index efb299333e..25ef0044d5 100644 --- a/src/gromacs/gmxana/gmx_lie.cpp +++ b/src/gromacs/gmxana/gmx_lie.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -81,16 +81,16 @@ static t_liedata *analyze_names(int nre, gmx_enxnm_t *names, const char *ligand) snew(ld, 1); for (; (i < nre); i++) { - if ((std::strstr(names[i].name, ligand) != NULL) && - (std::strstr(names[i].name, self) == NULL)) + if ((std::strstr(names[i].name, ligand) != nullptr) && + (std::strstr(names[i].name, self) == nullptr)) { - if (std::strstr(names[i].name, "LJ") != NULL) + if (std::strstr(names[i].name, "LJ") != nullptr) { ld->nlj++; srenew(ld->lj, ld->nlj); ld->lj[ld->nlj-1] = i; } - else if (std::strstr(names[i].name, "Coul") != NULL) + else if (std::strstr(names[i].name, "Coul") != nullptr) { ld->nqq++; srenew(ld->qq, ld->nqq); @@ -167,7 +167,7 @@ int gmx_lie(int argc, char *argv[]) int nre, nframes = 0, ct = 0; ener_file_t fp; t_liedata *ld; - gmx_enxnm_t *enm = NULL; + gmx_enxnm_t *enm = nullptr; t_enxframe *fr; real lie; double lieaver = 0, lieav2 = 0; @@ -180,7 +180,7 @@ int gmx_lie(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } diff --git a/src/gromacs/gmxana/gmx_make_edi.cpp b/src/gromacs/gmxana/gmx_make_edi.cpp index ad3d4530b0..41c836aa3c 100644 --- a/src/gromacs/gmxana/gmx_make_edi.cpp +++ b/src/gromacs/gmxana/gmx_make_edi.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -148,12 +148,12 @@ int sscan_list(int *list[], const char *str, const char *listname) int number = 0; int end_number = 0; - char *start = NULL; /*holds the string of the number behind a ','*/ - char *end = NULL; /*holds the string of the number behind a '-' */ + char *start = nullptr; /*holds the string of the number behind a ','*/ + char *end = nullptr; /*holds the string of the number behind a '-' */ - int nvecs = 0; /* counts the number of vectors in the list*/ + int nvecs = 0; /* counts the number of vectors in the list*/ - step = NULL; + step = nullptr; snew(pos, n+4); startpos = pos; std::strcpy(pos, str); @@ -161,7 +161,7 @@ int sscan_list(int *list[], const char *str, const char *listname) pos[n+1] = '1'; pos[n+2] = '\0'; - *list = NULL; + *list = nullptr; while ((c = *pos) != 0) { @@ -184,7 +184,7 @@ int sscan_list(int *list[], const char *str, const char *listname) { /*store number*/ srenew(*list, nvecs+1); - (*list)[nvecs++] = number = std::strtol(start, NULL, 10); + (*list)[nvecs++] = number = std::strtol(start, nullptr, 10); status = sBefore; if (number == 0) { @@ -241,8 +241,8 @@ int sscan_list(int *list[], const char *str, const char *listname) if (c == ',') { /*store numbers*/ - end_number = std::strtol(end, NULL, 10); - number = std::strtol(start, NULL, 10); + end_number = std::strtol(end, nullptr, 10); + number = std::strtol(start, nullptr, 10); status = sBefore; if (number == 0) { @@ -255,8 +255,8 @@ int sscan_list(int *list[], const char *str, const char *listname) srenew(*list, nvecs+end_number-number+1); if (step) { - istep = strtol(step, NULL, 10); - step = NULL; + istep = strtol(step, nullptr, 10); + step = nullptr; } else { @@ -379,12 +379,12 @@ void write_the_whole_thing(FILE* fp, t_edipar *edpars, rvec** eigvecs, /*Eigenvectors */ - write_eigvec(fp, edpars->ned, eig_listen[evMON], eigvecs, nvec, "COMPONENTS GROUP 1", NULL); + write_eigvec(fp, edpars->ned, eig_listen[evMON], eigvecs, nvec, "COMPONENTS GROUP 1", nullptr); write_eigvec(fp, edpars->ned, eig_listen[evLINFIX], eigvecs, nvec, "COMPONENTS GROUP 2", evStepList[evLINFIX]); write_eigvec(fp, edpars->ned, eig_listen[evLINACC], eigvecs, nvec, "COMPONENTS GROUP 3", evStepList[evLINACC]); write_eigvec(fp, edpars->ned, eig_listen[evRADFIX], eigvecs, nvec, "COMPONENTS GROUP 4", evStepList[evRADFIX]); - write_eigvec(fp, edpars->ned, eig_listen[evRADACC], eigvecs, nvec, "COMPONENTS GROUP 5", NULL); - write_eigvec(fp, edpars->ned, eig_listen[evRADCON], eigvecs, nvec, "COMPONENTS GROUP 6", NULL); + write_eigvec(fp, edpars->ned, eig_listen[evRADACC], eigvecs, nvec, "COMPONENTS GROUP 5", nullptr); + write_eigvec(fp, edpars->ned, eig_listen[evRADCON], eigvecs, nvec, "COMPONENTS GROUP 6", nullptr); write_eigvec(fp, edpars->ned, eig_listen[evFLOOD], eigvecs, nvec, "COMPONENTS GROUP 7", evStepList[evFLOOD]); @@ -398,7 +398,7 @@ int read_conffile(const char *confin, rvec **x) t_topology top; matrix box; printf("read coordnumber from file %s\n", confin); - read_tps_conf(confin, &top, NULL, x, NULL, box, FALSE); + read_tps_conf(confin, &top, nullptr, x, nullptr, box, FALSE); printf("number of coordinates in file %d\n", top.atoms.nr); return top.atoms.nr; } @@ -649,9 +649,9 @@ int gmx_make_edi(int argc, char *argv[]) enum { evStepNr = evRADFIX + 1 }; - static const char* evSelections[evNr] = {NULL, NULL, NULL, NULL, NULL, NULL}; + static const char* evSelections[evNr] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; static const char* evOptions[evNr] = {"-linfix", "-linacc", "-flood", "-radfix", "-radacc", "-radcon", "-mon"}; - static const char* evParams[evStepNr] = {NULL, NULL}; + static const char* evParams[evStepNr] = {nullptr, nullptr}; static const char* evStepOptions[evStepNr] = {"-linstep", "-accdir", "-not_used", "-radstep"}; static const char* ConstForceStr; static real * evStepList[evStepNr]; @@ -723,18 +723,18 @@ int gmx_make_edi(int argc, char *argv[]) #define NPA asize(pa) rvec *xref1; - int nvec1, *eignr1 = NULL; - rvec *xav1, **eigvec1 = NULL; - t_atoms *atoms = NULL; + int nvec1, *eignr1 = nullptr; + rvec *xav1, **eigvec1 = nullptr; + t_atoms *atoms = nullptr; int nav; /* Number of atoms in the average structure */ char *grpname; const char *indexfile; int i; int *index, *ifit; - int nfit; /* Number of atoms in the reference/fit structure */ - int ev_class; /* parameter _class i.e. evMON, evRADFIX etc. */ + int nfit; /* Number of atoms in the reference/fit structure */ + int ev_class; /* parameter _class i.e. evMON, evRADFIX etc. */ int nvecs; - real *eigval1 = NULL; /* in V3.3 this is parameter of read_eigenvectors */ + real *eigval1 = nullptr; /* in V3.3 this is parameter of read_eigenvectors */ const char *EdiFile; const char *TargetFile; @@ -753,8 +753,8 @@ int gmx_make_edi(int argc, char *argv[]) t_filenm fnm[] = { { efTRN, "-f", "eigenvec", ffREAD }, { efXVG, "-eig", "eigenval", ffOPTRD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efSTX, "-tar", "target", ffOPTRD}, { efSTX, "-ori", "origin", ffOPTRD}, { efEDI, "-o", "sam", ffWRITE } @@ -762,7 +762,7 @@ int gmx_make_edi(int argc, char *argv[]) #define NFILE asize(fnm) edi_params.outfrq = 100; edi_params.slope = 0.0; edi_params.maxedsteps = 0; if (!parse_common_args(&argc, argv, 0, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -821,7 +821,7 @@ int gmx_make_edi(int argc, char *argv[]) } else /* if there are no eigenvectors for this option set list to zero */ { - listen[ev_class] = NULL; + listen[ev_class] = nullptr; snew(listen[ev_class], 1); listen[ev_class][0] = 0; } @@ -846,7 +846,7 @@ int gmx_make_edi(int argc, char *argv[]) &xref1, &edi_params.fitmas, &xav1, &edi_params.pcamas, &nvec1, &eignr1, &eigvec1, &eigval1); read_tps_conf(ftp2fn(efTPS, NFILE, fnm), - &top, &ePBC, &xtop, NULL, topbox, 0); + &top, &ePBC, &xtop, nullptr, topbox, 0); atoms = &top.atoms; @@ -860,7 +860,7 @@ int gmx_make_edi(int argc, char *argv[]) printf("\n"); - if (xref1 == NULL) + if (xref1 == nullptr) { if (bFit1) { @@ -944,7 +944,7 @@ int gmx_make_edi(int argc, char *argv[]) } else { - make_t_edx(&edi_params.star, 0, NULL, index); + make_t_edx(&edi_params.star, 0, nullptr, index); } /* Store origin positions */ @@ -954,7 +954,7 @@ int gmx_make_edi(int argc, char *argv[]) } else { - make_t_edx(&edi_params.sori, 0, NULL, index); + make_t_edx(&edi_params.sori, 0, nullptr, index); } /* Write edi-file */ diff --git a/src/gromacs/gmxana/gmx_make_ndx.cpp b/src/gromacs/gmxana/gmx_make_ndx.cpp index f777dcd162..eb7552ad08 100644 --- a/src/gromacs/gmxana/gmx_make_ndx.cpp +++ b/src/gromacs/gmxana/gmx_make_ndx.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -153,7 +153,7 @@ static gmx_bool is_name_char(char c) */ const char *spec = " !&|"; - return (c != '\0' && std::strchr(spec, c) == NULL); + return (c != '\0' && std::strchr(spec, c) == nullptr); } static int parse_names(char **string, int *n_names, char **names) @@ -283,7 +283,7 @@ static gmx_bool parse_string(char **string, int *nr, int ngrps, char **grpname) (*string)++; s = gmx_strdup((*string)); sp = std::strchr(s, c); - if (sp != NULL) + if (sp != nullptr) { (*string) += sp-s + 1; sp[0] = '\0'; @@ -816,7 +816,7 @@ static int split_chain(const t_atoms *atoms, const rvec *x, { char buf[STRLEN]; int j, nchain; - int i, a, natoms, *start = NULL, *end = NULL, ca_start, ca_end; + int i, a, natoms, *start = nullptr, *end = nullptr, ca_start, ca_end; rvec vec; natoms = atoms->nr; @@ -919,7 +919,7 @@ static int split_chain(const t_atoms *atoms, const rvec *x, static gmx_bool check_have_atoms(const t_atoms *atoms, char *string) { - if (atoms == NULL) + if (atoms == nullptr) { printf("Can not process '%s' without atom info, use option -f\n", string); return FALSE; @@ -1180,7 +1180,7 @@ static void edit_index(int natoms, const t_atoms *atoms, const rvec *x, t_blocka } } - string = NULL; + string = nullptr; snew(index, natoms); snew(index1, natoms); @@ -1225,7 +1225,7 @@ static void edit_index(int natoms, const t_atoms *atoms, const rvec *x, t_blocka } printf("\n"); printf("> "); - if (NULL == fgets(inp_string, STRLEN, stdin)) + if (nullptr == fgets(inp_string, STRLEN, stdin)) { gmx_fatal(FARGS, "Error reading user input"); } @@ -1566,14 +1566,14 @@ int gmx_make_ndx(int argc, char *argv[]) t_blocka *block, *block2; char **gnames, **gnames2; t_filenm fnm[] = { - { efSTX, "-f", NULL, ffOPTRD }, - { efNDX, "-n", NULL, ffOPTRDMULT }, - { efNDX, "-o", NULL, ffWRITE } + { efSTX, "-f", nullptr, ffOPTRD }, + { efNDX, "-n", nullptr, ffOPTRDMULT }, + { efNDX, "-o", nullptr, ffWRITE } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, 0, NFILE, fnm, NPA, pa, asize(desc), desc, - 0, NULL, &oenv)) + 0, nullptr, &oenv)) { return 0; } @@ -1602,7 +1602,7 @@ int gmx_make_ndx(int argc, char *argv[]) fprintf(stderr, "\nReading structure file\n"); read_tps_conf(stxfile, top, &ePBC, &x, &v, box, FALSE); atoms = &top->atoms; - if (atoms->pdbinfo == NULL) + if (atoms->pdbinfo == nullptr) { snew(atoms->pdbinfo, atoms->nr); } @@ -1611,13 +1611,13 @@ int gmx_make_ndx(int argc, char *argv[]) } else { - atoms = NULL; - x = NULL; + atoms = nullptr; + x = nullptr; } /* read input file(s) */ block = new_blocka(); - gnames = NULL; + gnames = nullptr; printf("Going to read %d old index file(s)\n", nndxin); if (nndxin) { diff --git a/src/gromacs/gmxana/gmx_mdmat.cpp b/src/gromacs/gmxana/gmx_mdmat.cpp index f727fe9c26..56ee263c29 100644 --- a/src/gromacs/gmxana/gmx_mdmat.cpp +++ b/src/gromacs/gmxana/gmx_mdmat.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -70,7 +70,7 @@ int *res_ndx(t_atoms *atoms) if (atoms->nr <= 0) { - return NULL; + return nullptr; } snew(rndx, atoms->nr); r0 = atoms->atom[0].resind; @@ -89,7 +89,7 @@ int *res_natm(t_atoms *atoms) if (atoms->nr <= 0) { - return NULL; + return nullptr; } snew(natm, atoms->nres); r0 = atoms->atom[0].resind; @@ -194,16 +194,16 @@ int gmx_mdmat(int argc, char *argv[]) "Discretize distance in this number of levels" } }; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXPM, "-mean", "dm", ffWRITE }, { efXPM, "-frames", "dmf", ffOPTWR }, { efXVG, "-no", "num", ffOPTWR }, }; #define NFILE asize(fnm) - FILE *out = NULL, *fp; + FILE *out = nullptr, *fp; t_topology top; int ePBC; t_atoms useatoms; @@ -225,10 +225,10 @@ int gmx_mdmat(int argc, char *argv[]) int *tot_n; matrix box = {{0}}; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; if (!parse_common_args(&argc, argv, PCA_CAN_TIME, NFILE, fnm, - asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -241,7 +241,7 @@ int gmx_mdmat(int argc, char *argv[]) fprintf(stderr, "Will calculate number of different contacts\n"); } - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, FALSE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, FALSE); fprintf(stderr, "Select group for analysis\n"); get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname); diff --git a/src/gromacs/gmxana/gmx_mindist.cpp b/src/gromacs/gmxana/gmx_mindist.cpp index 078da36b54..f19124b1f2 100644 --- a/src/gromacs/gmxana/gmx_mindist.cpp +++ b/src/gromacs/gmxana/gmx_mindist.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -154,11 +154,11 @@ static void periodic_mindist_plot(const char *trxfn, const char *outfn, int natoms, ind_min[2] = {0, 0}, ind_mini = 0, ind_minj = 0; real rmin, rmax, rmint, tmint; gmx_bool bFirst; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; natoms = read_first_x(oenv, &status, trxfn, &t, &x, box); - check_index(NULL, n, index, NULL, natoms); + check_index(nullptr, n, index, nullptr, natoms); out = xvgropen(outfn, "Minimum distance to periodic image", output_env_get_time_label(oenv), "Distance (nm)", oenv); @@ -171,7 +171,7 @@ static void periodic_mindist_plot(const char *trxfn, const char *outfn, rmint = box[XX][XX]; tmint = 0; - if (NULL != top) + if (nullptr != top) { gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms); } @@ -179,7 +179,7 @@ static void periodic_mindist_plot(const char *trxfn, const char *outfn, bFirst = TRUE; do { - if (NULL != top) + if (nullptr != top) { gmx_rmpbc(gpbc, natoms, box, x); } @@ -202,7 +202,7 @@ static void periodic_mindist_plot(const char *trxfn, const char *outfn, } while (read_next_x(oenv, status, &t, x, box)); - if (NULL != top) + if (nullptr != top) { gmx_rmpbc_done(gpbc); } @@ -262,7 +262,7 @@ static void calc_dist(real rcut, gmx_bool bPBC, int ePBC, matrix box, rvec x[], for (j = 0; (j < j1); j++) { jx = index3[j]; - if (index2 == NULL) + if (index2 == nullptr) { i0 = j + 1; } @@ -337,7 +337,7 @@ void dist_plot(const char *fn, const char *afile, const char *dfile, t_trxstatus *trxout; char buf[256]; char **leg; - real t, dmin, dmax, **mindres = NULL, **maxdres = NULL; + real t, dmin, dmax, **mindres = nullptr, **maxdres = nullptr; int nmin, nmax; t_trxstatus *status; int i = -1, j, k; @@ -348,7 +348,7 @@ void dist_plot(const char *fn, const char *afile, const char *dfile, rvec *x0; matrix box; gmx_bool bFirst; - FILE *respertime = NULL; + FILE *respertime = nullptr; if (read_first_x(oenv, &status, fn, &t, &x0, box) == 0) { @@ -358,9 +358,9 @@ void dist_plot(const char *fn, const char *afile, const char *dfile, sprintf(buf, "%simum Distance", bMin ? "Min" : "Max"); dist = xvgropen(dfile, buf, output_env_get_time_label(oenv), "Distance (nm)", oenv); sprintf(buf, "Number of Contacts %s %g nm", bMin ? "<" : ">", rcut); - num = nfile ? xvgropen(nfile, buf, output_env_get_time_label(oenv), "Number", oenv) : NULL; - atm = afile ? gmx_ffopen(afile, "w") : NULL; - trxout = xfile ? open_trx(xfile, "w") : NULL; + num = nfile ? xvgropen(nfile, buf, output_env_get_time_label(oenv), "Number", oenv) : nullptr; + atm = afile ? gmx_ffopen(afile, "w") : nullptr; + trxout = xfile ? open_trx(xfile, "w") : nullptr; if (bMat) { @@ -533,7 +533,7 @@ void dist_plot(const char *fn, const char *afile, const char *dfile, { oindex[0] = bMin ? min1 : max1; oindex[1] = bMin ? min2 : max2; - write_trx(trxout, 2, oindex, atoms, i, t, box, x0, NULL, NULL); + write_trx(trxout, 2, oindex, atoms, i, t, box, x0, nullptr, nullptr); } bFirst = FALSE; /*dmin should be minimum distance for residue and group*/ @@ -693,7 +693,7 @@ int gmx_mindist(int argc, char *argv[]) "Write residue names" } }; gmx_output_env_t *oenv; - t_topology *top = NULL; + t_topology *top = nullptr; int ePBC = -1; rvec *x; matrix box; @@ -703,11 +703,11 @@ int gmx_mindist(int argc, char *argv[]) const char *trxfnm, *tpsfnm, *ndxfnm, *distfnm, *numfnm, *atmfnm, *oxfnm, *resfnm; char **grpname; int *gnx; - int **index, *residues = NULL; + int **index, *residues = nullptr; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-od", "mindist", ffWRITE }, { efXVG, "-on", "numcont", ffOPTWR }, { efOUT, "-o", "atm-pair", ffOPTWR }, @@ -718,7 +718,7 @@ int gmx_mindist(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME | PCA_TIME_UNIT, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -730,7 +730,7 @@ int gmx_mindist(int argc, char *argv[]) atmfnm = ftp2fn_null(efOUT, NFILE, fnm); oxfnm = opt2fn_null("-ox", NFILE, fnm); resfnm = opt2fn_null("-or", NFILE, fnm); - if (bPI || resfnm != NULL) + if (bPI || resfnm != nullptr) { /* We need a tps file */ tpsfnm = ftp2fn(efTPS, NFILE, fnm); @@ -762,13 +762,13 @@ int gmx_mindist(int argc, char *argv[]) if (tpsfnm || resfnm || !ndxfnm) { snew(top, 1); - bTop = read_tps_conf(tpsfnm, top, &ePBC, &x, NULL, box, FALSE); + bTop = read_tps_conf(tpsfnm, top, &ePBC, &x, nullptr, box, FALSE); if (bPI && !bTop) { printf("\nWARNING: Without a run input file a trajectory with broken molecules will not give the correct periodic image distance\n\n"); } } - get_index(top ? &(top->atoms) : NULL, ndxfnm, ng, gnx, index, grpname); + get_index(top ? &(top->atoms) : nullptr, ndxfnm, ng, gnx, index, grpname); if (bMat && (ng == 1)) { @@ -790,7 +790,7 @@ int gmx_mindist(int argc, char *argv[]) if (resfnm) { - GMX_RELEASE_ASSERT(top != NULL, "top pointer cannot be NULL when finding residues"); + GMX_RELEASE_ASSERT(top != nullptr, "top pointer cannot be NULL when finding residues"); nres = find_residues(&(top->atoms), gnx[0], index[0], &residues); if (debug) @@ -806,7 +806,7 @@ int gmx_mindist(int argc, char *argv[]) else { dist_plot(trxfnm, atmfnm, distfnm, numfnm, resfnm, oxfnm, - rcutoff, bMat, top ? &(top->atoms) : NULL, + rcutoff, bMat, top ? &(top->atoms) : nullptr, ng, index, gnx, grpname, bSplit, !bMax, nres, residues, bPBC, ePBC, bGroup, bEachResEachTime, bPrintResName, oenv); } diff --git a/src/gromacs/gmxana/gmx_mk_angndx.cpp b/src/gromacs/gmxana/gmx_mk_angndx.cpp index 133c39d11c..0609897bd2 100644 --- a/src/gromacs/gmxana/gmx_mk_angndx.cpp +++ b/src/gromacs/gmxana/gmx_mk_angndx.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -208,7 +208,7 @@ static void fill_ang(int nft, int *ft, int fac, static int *select_ftype(const char *opt, int *nft, int *mult) { - int *ft = NULL, ftype; + int *ft = nullptr, ftype; if (opt[0] == 'a') { @@ -255,7 +255,7 @@ int gmx_mk_angndx(int argc, char *argv[]) "angle distributions etc. It uses a run input file ([REF].tpx[ref]) for the", "definitions of the angles, dihedrals etc." }; - static const char *opt[] = { NULL, "angle", "dihedral", "improper", "ryckaert-bellemans", NULL }; + static const char *opt[] = { nullptr, "angle", "dihedral", "improper", "ryckaert-bellemans", nullptr }; static gmx_bool bH = TRUE; static real hq = -1; t_pargs pa[] = { @@ -277,22 +277,22 @@ int gmx_mk_angndx(int argc, char *argv[]) int *nr; char **grpnames; t_filenm fnm[] = { - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, "angle", ffWRITE } + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, "angle", ffWRITE } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { return 0; } - GMX_RELEASE_ASSERT(opt[0] != 0, "Options inconsistency; opt[0] is NULL"); + GMX_RELEASE_ASSERT(opt[0] != nullptr, "Options inconsistency; opt[0] is NULL"); ft = select_ftype(opt[0], &nft, &mult); - top = read_top(ftp2fn(efTPR, NFILE, fnm), NULL); + top = read_top(ftp2fn(efTPR, NFILE, fnm), nullptr); ntype = calc_ntype(nft, ft, &(top->idef)); snew(grpnames, ntype); diff --git a/src/gromacs/gmxana/gmx_morph.cpp b/src/gromacs/gmxana/gmx_morph.cpp index 9378205c5c..20618e09ad 100644 --- a/src/gromacs/gmxana/gmx_morph.cpp +++ b/src/gromacs/gmxana/gmx_morph.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -112,7 +112,7 @@ int gmx_morph(int argc, char *argv[]) "Do a least squares fit of the second to the first structure before interpolating" } }; const char *leg[] = { "Ref = 1\\Sst\\N conf", "Ref = 2\\Snd\\N conf" }; - FILE *fp = NULL; + FILE *fp = nullptr; int i, isize, is_lsq, nat1, nat2; t_trxstatus *status; int *index, *index_lsq, *index_all, *dummy; @@ -125,16 +125,16 @@ int gmx_morph(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW, NFILE, fnm, asize(pa), pa, asize(desc), desc, - 0, NULL, &oenv)) + 0, nullptr, &oenv)) { return 0; } t_topology *top; snew(top, 1); - read_tps_conf(opt2fn("-f1", NFILE, fnm), top, NULL, &x1, NULL, box, FALSE); + read_tps_conf(opt2fn("-f1", NFILE, fnm), top, nullptr, &x1, nullptr, box, FALSE); nat1 = top->atoms.nr; - read_tps_conf(opt2fn("-f2", NFILE, fnm), top, NULL, &x2, NULL, box, FALSE); + read_tps_conf(opt2fn("-f2", NFILE, fnm), top, nullptr, &x2, nullptr, box, FALSE); nat2 = top->atoms.nr; if (nat1 != nat2) { @@ -183,7 +183,7 @@ int gmx_morph(int argc, char *argv[]) for (i = 0; (i < ninterm); i++) { fac = dointerp(nat1, x1, x2, xx, i, ninterm, first, last); - write_trx(status, nat1, dummy, &atoms, i, fac, box, xx, NULL, NULL); + write_trx(status, nat1, dummy, &atoms, i, fac, box, xx, nullptr, nullptr); if (bRMS) { rms1 = rmsdev_ind(isize, index, mass, x1, xx); diff --git a/src/gromacs/gmxana/gmx_msd.cpp b/src/gromacs/gmxana/gmx_msd.cpp index baba4a16cd..c654f2a60c 100644 --- a/src/gromacs/gmxana/gmx_msd.cpp +++ b/src/gromacs/gmxana/gmx_msd.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -124,8 +124,8 @@ t_corr *init_corr(int nrgrp, int type, int axis, real dim_factor, curr->delta_t = dt; curr->beginfit = (1 - 2*GMX_REAL_EPS)*beginfit; curr->endfit = (1 + 2*GMX_REAL_EPS)*endfit; - curr->x0 = NULL; - curr->n_offs = NULL; + curr->x0 = nullptr; + curr->n_offs = nullptr; curr->nframes = 0; curr->nlast = 0; curr->dim_factor = dim_factor; @@ -138,15 +138,15 @@ t_corr *init_corr(int nrgrp, int type, int axis, real dim_factor, } for (i = 0; (i < nrgrp); i++) { - curr->ndata[i] = NULL; - curr->data[i] = NULL; + curr->ndata[i] = nullptr; + curr->data[i] = nullptr; if (bTen) { - curr->datam[i] = NULL; + curr->datam[i] = nullptr; } } - curr->time = NULL; - curr->lsq = NULL; + curr->time = nullptr; + curr->lsq = nullptr; curr->nmol = nmol; if (curr->nmol > 0) { @@ -553,8 +553,8 @@ static void printmol(t_corr *curr, const char *fn, gmx_stats_t lsq1; int i, j; real a, b, D, Dav, D2av, VarD, sqrtD, sqrtD_max, scale; - t_pdbinfo *pdbinfo = NULL; - const int *mol2a = NULL; + t_pdbinfo *pdbinfo = nullptr; + const int *mol2a = nullptr; out = xvgropen(fn, "Diffusion Coefficients / Molecule", "Molecule", "D", oenv); @@ -578,7 +578,7 @@ static void printmol(t_corr *curr, const char *fn, gmx_stats_add_point(lsq1, xx, yy, dx, dy); } } - gmx_stats_get_ab(lsq1, elsqWEIGHT_NONE, &a, &b, NULL, NULL, NULL, NULL); + gmx_stats_get_ab(lsq1, elsqWEIGHT_NONE, &a, &b, nullptr, nullptr, nullptr, nullptr); gmx_stats_free(lsq1); D = a*FACTOR/curr->dim_factor; if (D < 0) @@ -622,12 +622,12 @@ static void printmol(t_corr *curr, const char *fn, { scale *= 10; } - GMX_RELEASE_ASSERT(pdbinfo != NULL, "Internal error - pdbinfo not set for PDB input"); + GMX_RELEASE_ASSERT(pdbinfo != nullptr, "Internal error - pdbinfo not set for PDB input"); for (i = 0; i < top->atoms.nr; i++) { pdbinfo[i].bfac *= scale; } - write_sto_conf(fn_pdb, "molecular MSD", &top->atoms, x, NULL, ePBC, box); + write_sto_conf(fn_pdb, "molecular MSD", &top->atoms, x, nullptr, ePBC, box); } } @@ -650,13 +650,13 @@ int corr_loop(t_corr *curr, const char *fn, const t_topology *top, int ePBC, #define prev (1-cur) matrix box; gmx_bool bFirst; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; natoms = read_first_x(oenv, &status, fn, &curr->t0, &(x[cur]), box); #ifdef DEBUG fprintf(stderr, "Read %d atoms for first frame\n", natoms); #endif - if ((gnx_com != NULL) && natoms < top->atoms.nr) + if ((gnx_com != nullptr) && natoms < top->atoms.nr) { fprintf(stderr, "WARNING: The trajectory only contains part of the system (%d of %d atoms) and therefore the COM motion of only this part of the system will be removed\n", natoms, top->atoms.nr); } @@ -680,7 +680,7 @@ int corr_loop(t_corr *curr, const char *fn, const t_topology *top, int ePBC, t = curr->t0; if (x_pdb) { - *x_pdb = NULL; + *x_pdb = nullptr; } if (bMol) @@ -696,7 +696,7 @@ int corr_loop(t_corr *curr, const char *fn, const t_topology *top, int ePBC, t_pdb > t - 0.5*(t - t_prev) && t_pdb < t + 0.5*(t - t_prev)))) { - if (*x_pdb == NULL) + if (*x_pdb == nullptr) { snew(*x_pdb, natoms); } @@ -737,14 +737,14 @@ int corr_loop(t_corr *curr, const char *fn, const t_topology *top, int ePBC, { for (i = 0; (i < curr->ngrp); i++) { - curr->ndata[i] = NULL; - curr->data[i] = NULL; + curr->ndata[i] = nullptr; + curr->data[i] = nullptr; if (bTen) { - curr->datam[i] = NULL; + curr->datam[i] = nullptr; } } - curr->time = NULL; + curr->time = nullptr; } maxframes += 10; for (i = 0; (i < curr->ngrp); i++) @@ -808,7 +808,7 @@ int corr_loop(t_corr *curr, const char *fn, const t_topology *top, int ePBC, for (i = 0; (i < curr->ngrp); i++) { /* calculate something useful, like mean square displacements */ - calc_corr(curr, i, gnx[i], index[i], xa[cur], (gnx_com != NULL), com, + calc_corr(curr, i, gnx[i], index[i], xa[cur], (gnx_com != nullptr), com, calc1, bTen); } cur = prev; @@ -882,9 +882,9 @@ void do_corr(const char *trx_file, const char *ndx_file, const char *msd_file, real *DD, *SigmaD, a, a2, b, r, chi2; rvec *x; matrix box; - int *gnx_com = NULL; /* the COM removal group size */ - int **index_com = NULL; /* the COM removal group atom indices */ - char **grpname_com = NULL; /* the COM removal group name */ + int *gnx_com = nullptr; /* the COM removal group size */ + int **index_com = nullptr; /* the COM removal group atom indices */ + char **grpname_com = nullptr; /* the COM removal group name */ snew(gnx, nrgrp); snew(index, nrgrp); @@ -909,14 +909,14 @@ void do_corr(const char *trx_file, const char *ndx_file, const char *msd_file, } msd = init_corr(nrgrp, type, axis, dim_factor, - mol_file == NULL ? 0 : gnx[0], bTen, bMW, dt, top, + mol_file == nullptr ? 0 : gnx[0], bTen, bMW, dt, top, beginfit, endfit); nat_trx = corr_loop(msd, trx_file, top, ePBC, mol_file ? gnx[0] : 0, gnx, index, - (mol_file != NULL) ? calc1_mol : (bMW ? calc1_mw : calc1_norm), + (mol_file != nullptr) ? calc1_mol : (bMW ? calc1_mw : calc1_norm), bTen, gnx_com, index_com, dt, t_pdb, - pdb_file ? &x : NULL, box, oenv); + pdb_file ? &x : nullptr, box, oenv); /* Correct for the number of points */ for (j = 0; (j < msd->ngrp); j++) @@ -933,14 +933,14 @@ void do_corr(const char *trx_file, const char *ndx_file, const char *msd_file, if (mol_file) { - if (pdb_file && x == NULL) + if (pdb_file && x == nullptr) { fprintf(stderr, "\nNo frame found need time tpdb = %g ps\n" "Can not write %s\n\n", t_pdb, pdb_file); } i = top->atoms.nr; top->atoms.nr = nat_trx; - if (pdb_file && top->atoms.pdbinfo == NULL) + if (pdb_file && top->atoms.pdbinfo == nullptr) { snew(top->atoms.pdbinfo, top->atoms.nr); } @@ -948,8 +948,8 @@ void do_corr(const char *trx_file, const char *ndx_file, const char *msd_file, top->atoms.nr = i; } - DD = NULL; - SigmaD = NULL; + DD = nullptr; + SigmaD = nullptr; if (beginfit == -1) { @@ -1069,8 +1069,8 @@ int gmx_msd(int argc, char *argv[]) "the diffusion coefficient of the molecule.", "This option implies option [TT]-mol[tt]." }; - static const char *normtype[] = { NULL, "no", "x", "y", "z", NULL }; - static const char *axtitle[] = { NULL, "no", "x", "y", "z", NULL }; + static const char *normtype[] = { nullptr, "no", "x", "y", "z", nullptr }; + static const char *axtitle[] = { nullptr, "no", "x", "y", "z", nullptr }; static int ngroup = 1; static real dt = 10; static real t_pdb = 0; @@ -1103,10 +1103,10 @@ int gmx_msd(int argc, char *argv[]) }; t_filenm fnm[] = { - { efTRX, NULL, NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efXVG, NULL, "msd", ffWRITE }, + { efTRX, nullptr, nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efXVG, nullptr, "msd", ffWRITE }, { efXVG, "-mol", "diff_mol", ffOPTWR }, { efPDB, "-pdb", "diff_mol", ffOPTWR } }; @@ -1124,7 +1124,7 @@ int gmx_msd(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_BEGIN | PCA_CAN_END | PCA_TIME_UNIT, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -1159,8 +1159,8 @@ int gmx_msd(int argc, char *argv[]) fprintf(stderr, "Calculating diffusion coefficients for molecules.\n"); } - GMX_RELEASE_ASSERT(normtype[0] != 0, "Options inconsistency; normtype[0] is NULL"); - GMX_RELEASE_ASSERT(axtitle[0] != 0, "Options inconsistency; axtitle[0] is NULL"); + GMX_RELEASE_ASSERT(normtype[0] != nullptr, "Options inconsistency; normtype[0] is NULL"); + GMX_RELEASE_ASSERT(axtitle[0] != nullptr, "Options inconsistency; axtitle[0] is NULL"); if (normtype[0][0] != 'n') { @@ -1188,7 +1188,7 @@ int gmx_msd(int argc, char *argv[]) gmx_fatal(FARGS, "Can only calculate the full tensor for 3D msd"); } - bTop = read_tps_conf(tps_file, &top, &ePBC, &xdum, NULL, box, bMW || bRmCOMM); + bTop = read_tps_conf(tps_file, &top, &ePBC, &xdum, nullptr, box, bMW || bRmCOMM); if (mol_file && !bTop) { gmx_fatal(FARGS, diff --git a/src/gromacs/gmxana/gmx_nmeig.cpp b/src/gromacs/gmxana/gmx_nmeig.cpp index 61f3bd6889..c818723932 100644 --- a/src/gromacs/gmxana/gmx_nmeig.cpp +++ b/src/gromacs/gmxana/gmx_nmeig.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -179,7 +179,7 @@ nma_full_hessian(real *hess, eigensolver(hess, ndim, begin-1, end-1, eigenvalues, eigenvectors); /* And scale the output eigenvectors */ - if (bM && eigenvectors != NULL) + if (bM && eigenvectors != nullptr) { for (int i = 0; i < (end-begin+1); i++) { @@ -218,7 +218,7 @@ nma_sparse_hessian(gmx_sparsematrix_t *sparse_hessian, /* Cannot check symmetry since we only store half matrix */ /* divide elements hess[i][j] by sqrt(mas[i])*sqrt(mas[j]) when required */ - GMX_RELEASE_ASSERT(sparse_hessian != NULL, "NULL matrix pointer provided to nma_sparse_hessian"); + GMX_RELEASE_ASSERT(sparse_hessian != nullptr, "NULL matrix pointer provided to nma_sparse_hessian"); if (bM) { @@ -245,7 +245,7 @@ nma_sparse_hessian(gmx_sparsematrix_t *sparse_hessian, sparse_eigensolver(sparse_hessian, neig, eigenvalues, eigenvectors, 10000000); /* Scale output eigenvectors */ - if (bM && eigenvectors != NULL) + if (bM && eigenvectors != nullptr) { for (i = 0; i < neig; i++) { @@ -361,19 +361,19 @@ int gmx_nmeig(int argc, char *argv[]) real value, omega, nu; real factor_gmx_to_omega2; real factor_omega_to_wavenumber; - real *spectrum = NULL; + real *spectrum = nullptr; real wfac; gmx_output_env_t *oenv; const char *qcleg[] = { "Heat Capacity cV (J/mol K)", "Enthalpy H (kJ/mol)" }; - real * full_hessian = NULL; - gmx_sparsematrix_t * sparse_hessian = NULL; + real * full_hessian = nullptr; + gmx_sparsematrix_t * sparse_hessian = nullptr; t_filenm fnm[] = { { efMTX, "-f", "hessian", ffREAD }, - { efTPR, NULL, NULL, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, { efXVG, "-of", "eigenfreq", ffWRITE }, { efXVG, "-ol", "eigenval", ffWRITE }, { efXVG, "-os", "spectrum", ffOPTWR }, @@ -383,7 +383,7 @@ int gmx_nmeig(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, 0, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -393,8 +393,8 @@ int gmx_nmeig(int argc, char *argv[]) snew(top_x, tpx.natoms); int natoms_tpx; - read_tpx(ftp2fn(efTPR, NFILE, fnm), NULL, box, &natoms_tpx, - top_x, NULL, &mtop); + read_tpx(ftp2fn(efTPR, NFILE, fnm), nullptr, box, &natoms_tpx, + top_x, nullptr, &mtop); int nharm = 0; if (bCons) { @@ -430,7 +430,7 @@ int gmx_nmeig(int argc, char *argv[]) * If this is not valid we convert to full matrix storage, * but warn the user that we might run out of memory... */ - if ((sparse_hessian != NULL) && (end == ndim)) + if ((sparse_hessian != nullptr) && (end == ndim)) { fprintf(stderr, "Cannot use sparse Hessian to calculate all eigenvectors.\n"); @@ -463,13 +463,13 @@ int gmx_nmeig(int argc, char *argv[]) } } gmx_sparsematrix_destroy(sparse_hessian); - sparse_hessian = NULL; + sparse_hessian = nullptr; fprintf(stderr, "Converted sparse to full matrix storage.\n"); } snew(eigenvalues, nrow); - if (full_hessian != NULL) + if (full_hessian != nullptr) { /* Using full matrix storage */ eigenvectors = allocateEigenvectors(nrow, begin, end, false); @@ -534,7 +534,7 @@ int gmx_nmeig(int argc, char *argv[]) } else { - qc = NULL; + qc = nullptr; } printf("Writing eigenfrequencies - negative eigenvalues will be set to zero.\n"); @@ -553,7 +553,7 @@ int gmx_nmeig(int argc, char *argv[]) } } /* Spectrum ? */ - spec = NULL; + spec = nullptr; if (opt2bSet("-os", NFILE, fnm) && (maxspec > 0)) { snew(spectrum, maxspec); @@ -590,7 +590,7 @@ int gmx_nmeig(int argc, char *argv[]) nu = 1e-12*omega/(2*M_PI); value = omega*factor_omega_to_wavenumber; fprintf (out, "%6d %15g\n", i, value); - if (NULL != spec) + if (nullptr != spec) { wfac = eigenvalues[i-begin]/(width*std::sqrt(2*M_PI)); for (j = 0; (j < maxspec); j++) @@ -598,7 +598,7 @@ int gmx_nmeig(int argc, char *argv[]) spectrum[j] += wfac*std::exp(-gmx::square(j-value)/(2*gmx::square(width))); } } - if (NULL != qc) + if (nullptr != qc) { qcv = cv_corr(nu, T); qu = u_corr(nu, T); @@ -613,7 +613,7 @@ int gmx_nmeig(int argc, char *argv[]) } } xvgrclose(out); - if (NULL != spec) + if (nullptr != spec) { for (j = 0; (j < maxspec); j++) { @@ -621,7 +621,7 @@ int gmx_nmeig(int argc, char *argv[]) } xvgrclose(spec); } - if (NULL != qc) + if (nullptr != qc) { printf("Quantum corrections for harmonic degrees of freedom\n"); printf("Use appropriate -first and -last options to get reliable results.\n"); @@ -637,7 +637,7 @@ int gmx_nmeig(int argc, char *argv[]) * will not be strictly orthogonal in plain cartesian scalar products. */ const real *eigenvectorPtr; - if (full_hessian != NULL) + if (full_hessian != nullptr) { eigenvectorPtr = eigenvectors; } @@ -647,7 +647,7 @@ int gmx_nmeig(int argc, char *argv[]) eigenvectorPtr = eigenvectors + (begin - 1)*atom_index.size(); } write_eigenvectors(opt2fn("-v", NFILE, fnm), atom_index.size(), eigenvectorPtr, FALSE, begin, end, - eWXR_NO, NULL, FALSE, top_x, bM, eigenvalues); + eWXR_NO, nullptr, FALSE, top_x, bM, eigenvalues); return 0; } diff --git a/src/gromacs/gmxana/gmx_nmens.cpp b/src/gromacs/gmxana/gmx_nmens.cpp index 235f1b20ba..0157f7d132 100644 --- a/src/gromacs/gmxana/gmx_nmens.cpp +++ b/src/gromacs/gmxana/gmx_nmens.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -92,8 +92,8 @@ int gmx_nmens(int argc, char *argv[]) t_atoms *atoms; rvec *xtop, *xref, *xav, *xout1, *xout2; gmx_bool bDMR, bDMA, bFit; - int nvec, *eignr = NULL; - rvec **eigvec = NULL; + int nvec, *eignr = nullptr; + rvec **eigvec = nullptr; matrix box; real *eigval, *invsqrtm, t, disp; int natoms; @@ -113,14 +113,14 @@ int gmx_nmens(int argc, char *argv[]) t_filenm fnm[] = { { efTRN, "-v", "eigenvec", ffREAD }, { efXVG, "-e", "eigenval", ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efTRO, "-o", "ensemble", ffWRITE } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, 0, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -130,7 +130,7 @@ int gmx_nmens(int argc, char *argv[]) read_eigenvectors(opt2fn("-v", NFILE, fnm), &natoms, &bFit, &xref, &bDMR, &xav, &bDMA, &nvec, &eignr, &eigvec, &eigval); - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, bDMA); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, bDMA); atoms = &top.atoms; printf("\nSelect an index group of %d elements that corresponds to the eigenvectors\n", natoms); @@ -176,7 +176,7 @@ int gmx_nmens(int argc, char *argv[]) { printf("Select eigenvectors for output, end your selection with 0\n"); nout = -1; - iout = NULL; + iout = nullptr; do { nout++; @@ -268,7 +268,7 @@ int gmx_nmens(int argc, char *argv[]) copy_rvec(xout1[i], xout2[index[i]]); } t = s+1; - write_trx(out, natoms, index, atoms, 0, t, box, xout2, NULL, NULL); + write_trx(out, natoms, index, atoms, 0, t, box, xout2, nullptr, nullptr); fprintf(stderr, "\rGenerated %d structures", s+1); fflush(stderr); } diff --git a/src/gromacs/gmxana/gmx_nmtraj.cpp b/src/gromacs/gmxana/gmx_nmtraj.cpp index 3870a10745..63354ff9e0 100644 --- a/src/gromacs/gmxana/gmx_nmtraj.cpp +++ b/src/gromacs/gmxana/gmx_nmtraj.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -100,8 +100,8 @@ int gmx_nmtraj(int argc, char *argv[]) int ePBC; t_atoms *atoms; rvec *xtop, *xref, *xav, *xout; - int nvec, *eignr = NULL; - rvec **eigvec = NULL; + int nvec, *eignr = nullptr; + rvec **eigvec = nullptr; matrix box; int natoms; int i, j, k, kmode, d; @@ -124,7 +124,7 @@ int gmx_nmtraj(int argc, char *argv[]) t_filenm fnm[] = { - { efTPS, NULL, NULL, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, { efTRN, "-v", "eigenvec", ffREAD }, { efTRO, "-o", "nmtraj", ffWRITE } }; @@ -132,7 +132,7 @@ int gmx_nmtraj(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, 0, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -140,7 +140,7 @@ int gmx_nmtraj(int argc, char *argv[]) read_eigenvectors(opt2fn("-v", NFILE, fnm), &natoms, &bFit, &xref, &bDMR, &xav, &bDMA, &nvec, &eignr, &eigvec, &eigval); - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, bDMA); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, bDMA); /* Find vectors and phases */ @@ -322,7 +322,7 @@ int gmx_nmtraj(int argc, char *argv[]) } } } - write_trx(out, natoms, dummy, atoms, i, static_cast(i)/nframes, box, xout, NULL, NULL); + write_trx(out, natoms, dummy, atoms, i, static_cast(i)/nframes, box, xout, nullptr, nullptr); } fprintf(stderr, "\n"); diff --git a/src/gromacs/gmxana/gmx_order.cpp b/src/gromacs/gmxana/gmx_order.cpp index d48e5d4f90..1d89971cda 100644 --- a/src/gromacs/gmxana/gmx_order.cpp +++ b/src/gromacs/gmxana/gmx_order.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -258,7 +258,7 @@ static void calc_tetra_order_parm(const char *fnNDX, const char *fnTPS, const char *sgslfn, const char *skslfn, const gmx_output_env_t *oenv) { - FILE *fpsg = NULL, *fpsk = NULL; + FILE *fpsg = nullptr, *fpsk = nullptr; t_topology top; int ePBC; t_trxstatus *status; @@ -271,10 +271,10 @@ static void calc_tetra_order_parm(const char *fnNDX, const char *fnTPS, char **grpname; int i, *isize, ng, nframes; real *sg_slice, *sg_slice_tot, *sk_slice, *sk_slice_tot; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; - read_tps_conf(fnTPS, &top, &ePBC, &xtop, NULL, box, FALSE); + read_tps_conf(fnTPS, &top, &ePBC, &xtop, nullptr, box, FALSE); snew(sg_slice, nslice); snew(sk_slice, nslice); @@ -295,7 +295,7 @@ static void calc_tetra_order_parm(const char *fnNDX, const char *fnTPS, gmx_fatal(FARGS, "Topology (%d atoms) does not match trajectory (%d atoms)", top.atoms.nr, natoms); } - check_index(NULL, ng, index[0], NULL, natoms); + check_index(nullptr, ng, index[0], nullptr, natoms); fpsg = xvgropen(sgfn, "S\\sg\\N Angle Order Parameter", "Time (ps)", "S\\sg\\N", oenv); @@ -405,11 +405,11 @@ void calc_order(const char *fn, int *index, int *a, rvec **order, gmx_bool use_unitvector = FALSE; /* use a specified unit vector instead of axis to specify unit normal*/ rvec direction, com, dref, dvec; int comsize, distsize; - int *comidx = NULL, *distidx = NULL; - char *grpname = NULL; + int *comidx = nullptr, *distidx = nullptr; + char *grpname = nullptr; t_pbc pbc; real arcdist, tmpdist; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; /* PBC added for center-of-mass vector*/ /* Initiate the pbc structure */ @@ -440,7 +440,7 @@ void calc_order(const char *fn, int *index, int *a, rvec **order, } if (distcalc) { - if (grpname != NULL) + if (grpname != nullptr) { sfree(grpname); } @@ -739,15 +739,15 @@ void calc_order(const char *fn, int *index, int *a, rvec **order, sfree(x0); /* free memory used by coordinate arrays */ sfree(x1); - if (comidx != NULL) + if (comidx != nullptr) { sfree(comidx); } - if (distidx != NULL) + if (distidx != nullptr) { sfree(distidx); } - if (grpname != NULL) + if (grpname != nullptr) { sfree(grpname); } @@ -854,7 +854,7 @@ void write_bfactors(t_filenm *fnm, int nfile, int *index, int *a, int nslices, frout.natoms = nout; frout.bF = FALSE; frout.bV = FALSE; - frout.x = 0; + frout.x = nullptr; snew(frout.x, nout); init_t_atoms(&useatoms, nout, TRUE); @@ -887,7 +887,7 @@ void write_bfactors(t_filenm *fnm, int nfile, int *index, int *a, int nslices, } } - write_sto_conf(opt2fn("-ob", nfile, fnm), "Order parameters", &useatoms, frout.x, NULL, frout.ePBC, frout.box); + write_sto_conf(opt2fn("-ob", nfile, fnm), "Order parameters", &useatoms, frout.x, nullptr, frout.ePBC, frout.box); sfree(frout.x); done_atom(&useatoms); @@ -919,7 +919,7 @@ int gmx_order(int argc, char *argv[]) static int nslices = 1; /* nr of slices defined */ static gmx_bool bSzonly = FALSE; /* True if only Sz is wanted */ static gmx_bool bUnsat = FALSE; /* True if carbons are unsat. */ - static const char *normal_axis[] = { NULL, "z", "x", "y", NULL }; + static const char *normal_axis[] = { nullptr, "z", "x", "y", nullptr }; static gmx_bool permolecule = FALSE; /*compute on a per-molecule basis */ static gmx_bool radial = FALSE; /*compute a radial membrane normal */ static gmx_bool distcalc = FALSE; /*calculate distance from a reference group */ @@ -955,13 +955,13 @@ int gmx_order(int argc, char *argv[]) *a; /* atom numbers in each group */ t_blocka *block; /* data from index file */ t_filenm fnm[] = { /* files for g_order */ - { efTRX, "-f", NULL, ffREAD }, /* trajectory file */ - { efNDX, "-n", NULL, ffREAD }, /* index file */ - { efNDX, "-nr", NULL, ffOPTRD }, /* index for radial axis calculation */ - { efTPR, NULL, NULL, ffREAD }, /* topology file */ + { efTRX, "-f", nullptr, ffREAD }, /* trajectory file */ + { efNDX, "-n", nullptr, ffREAD }, /* index file */ + { efNDX, "-nr", nullptr, ffOPTRD }, /* index for radial axis calculation */ + { efTPR, nullptr, nullptr, ffREAD }, /* topology file */ { efXVG, "-o", "order", ffWRITE }, /* xvgr output file */ { efXVG, "-od", "deuter", ffWRITE }, /* xvgr output file */ - { efPDB, "-ob", NULL, ffOPTWR }, /* write Scd as B factors to PDB if permolecule */ + { efPDB, "-ob", nullptr, ffOPTWR }, /* write Scd as B factors to PDB if permolecule */ { efXVG, "-os", "sliced", ffWRITE }, /* xvgr output file */ { efXVG, "-Sg", "sg-ang", ffOPTWR }, /* xvgr output file */ { efXVG, "-Sk", "sk-dist", ffOPTWR }, /* xvgr output file */ @@ -970,12 +970,12 @@ int gmx_order(int argc, char *argv[]) }; gmx_bool bSliced = FALSE; /* True if box is sliced */ #define NFILE asize(fnm) - real **distvals = NULL; + real **distvals = nullptr; const char *sgfnm, *skfnm, *ndxfnm, *tpsfnm, *trxfnm; gmx_output_env_t *oenv; if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -990,7 +990,7 @@ int gmx_order(int argc, char *argv[]) trxfnm = ftp2fn(efTRX, NFILE, fnm); /* Calculate axis */ - GMX_RELEASE_ASSERT(normal_axis[0] != NULL, "Options inconsistency; normal_axis[0] is NULL"); + GMX_RELEASE_ASSERT(normal_axis[0] != nullptr, "Options inconsistency; normal_axis[0] is NULL"); if (std::strcmp(normal_axis[0], "x") == 0) { axis = XX; @@ -1031,12 +1031,12 @@ int gmx_order(int argc, char *argv[]) opt2fn("-Sgsl", NFILE, fnm), opt2fn("-Sksl", NFILE, fnm), oenv); /* view xvgr files */ - do_view(oenv, opt2fn("-Sg", NFILE, fnm), NULL); - do_view(oenv, opt2fn("-Sk", NFILE, fnm), NULL); + do_view(oenv, opt2fn("-Sg", NFILE, fnm), nullptr); + do_view(oenv, opt2fn("-Sk", NFILE, fnm), nullptr); if (nslices > 1) { - do_view(oenv, opt2fn("-Sgsl", NFILE, fnm), NULL); - do_view(oenv, opt2fn("-Sksl", NFILE, fnm), NULL); + do_view(oenv, opt2fn("-Sgsl", NFILE, fnm), nullptr); + do_view(oenv, opt2fn("-Sksl", NFILE, fnm), nullptr); } } else @@ -1110,12 +1110,12 @@ int gmx_order(int argc, char *argv[]) } - do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); /* view xvgr file */ - do_view(oenv, opt2fn("-os", NFILE, fnm), NULL); /* view xvgr file */ - do_view(oenv, opt2fn("-od", NFILE, fnm), NULL); /* view xvgr file */ + do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); /* view xvgr file */ + do_view(oenv, opt2fn("-os", NFILE, fnm), nullptr); /* view xvgr file */ + do_view(oenv, opt2fn("-od", NFILE, fnm), nullptr); /* view xvgr file */ } - if (distvals != NULL) + if (distvals != nullptr) { for (i = 0; i < nslices; ++i) { diff --git a/src/gromacs/gmxana/gmx_pme_error.cpp b/src/gromacs/gmxana/gmx_pme_error.cpp index e647bf04b0..46373cff09 100644 --- a/src/gromacs/gmxana/gmx_pme_error.cpp +++ b/src/gromacs/gmxana/gmx_pme_error.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -454,7 +454,7 @@ static real estimate_reciprocal( real tmp2 = 0; gmx_bool bFraction; - int *numbers = NULL; + int *numbers = nullptr; /* Index variables for parallel work distribution */ int startglobal, stopglobal; @@ -922,17 +922,17 @@ static void estimate_PME_error(t_inputinfo *info, const t_state *state, const gmx_mtop_t *mtop, FILE *fp_out, gmx_bool bVerbose, unsigned int seed, t_commrec *cr) { - rvec *x = NULL; /* The coordinates */ - real *q = NULL; /* The charges */ - real edir = 0.0; /* real space error */ - real erec = 0.0; /* reciprocal space error */ - real derr = 0.0; /* difference of real and reciprocal space error */ - real derr0 = 0.0; /* difference of real and reciprocal space error */ - real beta = 0.0; /* splitting parameter beta */ - real beta0 = 0.0; /* splitting parameter beta */ - int ncharges; /* The number of atoms with charges */ - int nsamples; /* The number of samples used for the calculation of the - * self-energy error term */ + rvec *x = nullptr; /* The coordinates */ + real *q = nullptr; /* The charges */ + real edir = 0.0; /* real space error */ + real erec = 0.0; /* reciprocal space error */ + real derr = 0.0; /* difference of real and reciprocal space error */ + real derr0 = 0.0; /* difference of real and reciprocal space error */ + real beta = 0.0; /* splitting parameter beta */ + real beta0 = 0.0; /* splitting parameter beta */ + int ncharges; /* The number of atoms with charges */ + int nsamples; /* The number of samples used for the calculation of the + * self-energy error term */ int i = 0; if (MASTER(cr)) @@ -1090,10 +1090,10 @@ int gmx_pme_error(int argc, char *argv[]) real user_beta = -1.0; real fracself = 1.0; t_inputinfo info; - t_state state; /* The state from the tpr input file */ - gmx_mtop_t mtop; /* The topology from the tpr input file */ - t_inputrec *ir = NULL; /* The inputrec from the tpr file */ - FILE *fp = NULL; + t_state state; /* The state from the tpr input file */ + gmx_mtop_t mtop; /* The topology from the tpr input file */ + t_inputrec *ir = nullptr; /* The inputrec from the tpr file */ + FILE *fp = nullptr; t_commrec *cr; unsigned long PCA_Flags; gmx_bool bTUNE = FALSE; @@ -1102,12 +1102,12 @@ int gmx_pme_error(int argc, char *argv[]) static t_filenm fnm[] = { - { efTPR, "-s", NULL, ffREAD }, + { efTPR, "-s", nullptr, ffREAD }, { efOUT, "-o", "error", ffWRITE }, { efTPR, "-so", "tuned", ffOPTWR } }; - gmx_output_env_t *oenv = NULL; + gmx_output_env_t *oenv = nullptr; t_pargs pa[] = { { "-beta", FALSE, etREAL, {&user_beta}, @@ -1130,7 +1130,7 @@ int gmx_pme_error(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_Flags, NFILE, fnm, asize(pa), pa, asize(desc), desc, - 0, NULL, &oenv)) + 0, nullptr, &oenv)) { sfree(cr); return 0; diff --git a/src/gromacs/gmxana/gmx_polystat.cpp b/src/gromacs/gmxana/gmx_polystat.cpp index affd359d04..f371846364 100644 --- a/src/gromacs/gmxana/gmx_polystat.cpp +++ b/src/gromacs/gmxana/gmx_polystat.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -141,9 +141,9 @@ int gmx_polystat(int argc, char *argv[]) }; t_filenm fnm[] = { - { efTPR, NULL, NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-o", "polystat", ffWRITE }, { efXVG, "-v", "polyvec", ffOPTWR }, { efXVG, "-p", "persist", ffOPTWR }, @@ -158,14 +158,14 @@ int gmx_polystat(int argc, char *argv[]) char *grpname; t_trxstatus *status; real t; - rvec *x, *bond = NULL; + rvec *x, *bond = nullptr; matrix box; int natoms, i, j, frame, ind0, ind1, a, d, d2, ord[DIM] = {0}; dvec cm, sum_eig = {0, 0, 0}; double **gyr, **gyr_all, eig[DIM], **eigv; double sum_eed2, sum_eed2_tot, sum_gyro, sum_gyro_tot, sum_pers_tot; - int *ninp = NULL; - double *sum_inp = NULL, pers; + int *ninp = nullptr; + double *sum_inp = nullptr, pers; double *intd, ymax, ymin; double mmol, m; char title[STRLEN]; @@ -176,18 +176,18 @@ int gmx_polystat(int argc, char *argv[]) "", "", "" }; char **legp, buf[STRLEN]; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME | PCA_TIME_UNIT, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } snew(top, 1); ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), - NULL, box, &natoms, NULL, NULL, top); + nullptr, box, &natoms, nullptr, nullptr, top); fprintf(stderr, "Select a group of polymer mainchain atoms:\n"); get_index(&top->atoms, ftp2fn_null(efNDX, NFILE, fnm), @@ -242,7 +242,7 @@ int gmx_polystat(int argc, char *argv[]) } else { - outv = NULL; + outv = nullptr; } if (opt2bSet("-p", NFILE, fnm)) @@ -255,7 +255,7 @@ int gmx_polystat(int argc, char *argv[]) } else { - outp = NULL; + outp = nullptr; } if (opt2bSet("-i", NFILE, fnm)) @@ -267,8 +267,8 @@ int gmx_polystat(int argc, char *argv[]) } else { - intd = NULL; - outi = NULL; + intd = nullptr; + outi = nullptr; } natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box); diff --git a/src/gromacs/gmxana/gmx_potential.cpp b/src/gromacs/gmxana/gmx_potential.cpp index a8258f0360..034ac993b8 100644 --- a/src/gromacs/gmxana/gmx_potential.cpp +++ b/src/gromacs/gmxana/gmx_potential.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -122,7 +122,7 @@ void calc_potential(const char *fn, int **index, int gnx[], real t; double z; rvec xcm; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; switch (axis) { @@ -457,9 +457,9 @@ int gmx_potential(int argc, char *argv[]) int ePBC; int **index; /* indices for all groups */ t_filenm fnm[] = { /* files for g_order */ - { efTRX, "-f", NULL, ffREAD }, /* trajectory file */ - { efNDX, NULL, NULL, ffREAD }, /* index file */ - { efTPR, NULL, NULL, ffREAD }, /* topology file */ + { efTRX, "-f", nullptr, ffREAD }, /* trajectory file */ + { efNDX, nullptr, nullptr, ffREAD }, /* index file */ + { efTPR, nullptr, nullptr, ffREAD }, /* topology file */ { efXVG, "-o", "potential", ffWRITE }, /* xvgr output file */ { efXVG, "-oc", "charge", ffWRITE }, /* xvgr output file */ { efXVG, "-of", "field", ffWRITE }, /* xvgr output file */ @@ -495,9 +495,9 @@ int gmx_potential(int argc, char *argv[]) opt2fn("-oc", NFILE, fnm), opt2fn("-of", NFILE, fnm), nslices, ngrps, (const char**)grpname, slWidth, oenv); - do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); /* view xvgr file */ - do_view(oenv, opt2fn("-oc", NFILE, fnm), NULL); /* view xvgr file */ - do_view(oenv, opt2fn("-of", NFILE, fnm), NULL); /* view xvgr file */ + do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); /* view xvgr file */ + do_view(oenv, opt2fn("-oc", NFILE, fnm), nullptr); /* view xvgr file */ + do_view(oenv, opt2fn("-of", NFILE, fnm), nullptr); /* view xvgr file */ return 0; } diff --git a/src/gromacs/gmxana/gmx_principal.cpp b/src/gromacs/gmxana/gmx_principal.cpp index a6a8a8fb71..149b228b6b 100644 --- a/src/gromacs/gmxana/gmx_principal.cpp +++ b/src/gromacs/gmxana/gmx_principal.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -102,13 +102,13 @@ int gmx_principal(int argc, char *argv[]) FILE * fmoi; matrix axes, box; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; char ** legend; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-a1", "paxis1", ffWRITE }, { efXVG, "-a2", "paxis2", ffWRITE }, { efXVG, "-a3", "paxis3", ffWRITE }, @@ -118,7 +118,7 @@ int gmx_principal(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -156,7 +156,7 @@ int gmx_principal(int argc, char *argv[]) } sfree(legend); - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE); get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname); diff --git a/src/gromacs/gmxana/gmx_rama.cpp b/src/gromacs/gmxana/gmx_rama.cpp index d17df2149f..7aa63cbddd 100644 --- a/src/gromacs/gmxana/gmx_rama.cpp +++ b/src/gromacs/gmxana/gmx_rama.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -78,14 +78,14 @@ int gmx_rama(int argc, char *argv[]) int j; gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPR, NULL, NULL, ffREAD }, - { efXVG, NULL, "rama", ffWRITE } + { efTRX, "-f", nullptr, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efXVG, nullptr, "rama", ffWRITE } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, 0, NULL, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, 0, nullptr, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -114,7 +114,7 @@ int gmx_rama(int argc, char *argv[]) fprintf(stderr, "\n"); xvgrclose(out); - do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL); + do_view(oenv, ftp2fn(efXVG, NFILE, fnm), nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_rms.cpp b/src/gromacs/gmxana/gmx_rms.cpp index 7d090a335c..8b0eb99be0 100644 --- a/src/gromacs/gmxana/gmx_rms.cpp +++ b/src/gromacs/gmxana/gmx_rms.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -72,7 +72,7 @@ static void norm_princ(const t_atoms *atoms, int isize, int *index, int natoms, /* equalize principal components: */ /* orient principal axes, get principal components */ - orient_princ(atoms, isize, index, natoms, x, NULL, princ); + orient_princ(atoms, isize, index, natoms, x, nullptr, princ); /* calc our own principal components */ clear_rvec(vec); @@ -159,15 +159,15 @@ int gmx_rms(int argc, char *argv[]) }; int ewhat; const char *what[ewNR + 1] = - { NULL, "rmsd", "rho", "rhosc", NULL }; + { nullptr, "rmsd", "rho", "rhosc", nullptr }; const char *whatname[ewNR] = - { NULL, "RMSD", "Rho", "Rho sc" }; + { nullptr, "RMSD", "Rho", "Rho sc" }; const char *whatlabel[ewNR] = - { NULL, "RMSD (nm)", "Rho", "Rho sc" }; + { nullptr, "RMSD (nm)", "Rho", "Rho sc" }; const char *whatxvgname[ewNR] = - { NULL, "RMSD", "\\8r\\4", "\\8r\\4\\ssc\\N" }; + { nullptr, "RMSD", "\\8r\\4", "\\8r\\4\\ssc\\N" }; const char *whatxvglabel[ewNR] = - { NULL, "RMSD (nm)", "\\8r\\4", "\\8r\\4\\ssc\\N" }; + { nullptr, "RMSD (nm)", "\\8r\\4", "\\8r\\4\\ssc\\N" }; /* strings and things for fitting methods */ enum { @@ -175,9 +175,9 @@ int gmx_rms(int argc, char *argv[]) }; int efit; const char *fit[efNR + 1] = - { NULL, "rot+trans", "translation", "none", NULL }; + { nullptr, "rot+trans", "translation", "none", nullptr }; const char *fitgraphlabel[efNR + 1] = - { NULL, "lsq fit", "translational fit", "no fit" }; + { nullptr, "lsq fit", "translational fit", "no fit" }; static int nrms = 1; static gmx_bool bMassWeighted = TRUE; t_pargs pa[] = @@ -225,44 +225,44 @@ int gmx_rms(int argc, char *argv[]) int i, j, k, m, teller, teller2, tel_mat, tel_mat2; #define NFRAME 5000 int maxframe = NFRAME, maxframe2 = NFRAME; - real t, *w_rls, *w_rms, *w_rls_m = NULL, *w_rms_m = NULL; + real t, *w_rls, *w_rms, *w_rls_m = nullptr, *w_rms_m = nullptr; gmx_bool bNorm, bAv, bFreq2, bFile2, bMat, bBond, bDelta, bMirror, bMass; gmx_bool bFit, bReset; t_topology top; int ePBC; - t_iatom *iatom = NULL; + t_iatom *iatom = nullptr; matrix box = {{0}}; - rvec *x, *xp, *xm = NULL, **mat_x = NULL, **mat_x2, *mat_x2_j = NULL, vec1, + rvec *x, *xp, *xm = nullptr, **mat_x = nullptr, **mat_x2, *mat_x2_j = nullptr, vec1, vec2; t_trxstatus *status; char buf[256], buf2[256]; int ncons = 0; FILE *fp; - real rlstot = 0, **rls, **rlsm = NULL, *time, *time2, *rlsnorm = NULL, - **rmsd_mat = NULL, **bond_mat = NULL, *axis, *axis2, *del_xaxis, + real rlstot = 0, **rls, **rlsm = nullptr, *time, *time2, *rlsnorm = nullptr, + **rmsd_mat = nullptr, **bond_mat = nullptr, *axis, *axis2, *del_xaxis, *del_yaxis, rmsd_max, rmsd_min, rmsd_avg, bond_max, bond_min, ang; - real **rmsdav_mat = NULL, av_tot, weight, weight_tot; - real **delta = NULL, delta_max, delta_scalex = 0, delta_scaley = 0, + real **rmsdav_mat = nullptr, av_tot, weight, weight_tot; + real **delta = nullptr, delta_max, delta_scalex = 0, delta_scaley = 0, *delta_tot; int delta_xsize = 0, del_lev = 100, mx, my, abs_my; - gmx_bool bA1, bA2, bPrev, bTop, *bInMat = NULL; - int ifit, *irms, ibond = 0, *ind_bond1 = NULL, *ind_bond2 = NULL, n_ind_m = + gmx_bool bA1, bA2, bPrev, bTop, *bInMat = nullptr; + int ifit, *irms, ibond = 0, *ind_bond1 = nullptr, *ind_bond2 = nullptr, n_ind_m = 0; - int *ind_fit, **ind_rms, *ind_m = NULL, *rev_ind_m = NULL, *ind_rms_m = - NULL; + int *ind_fit, **ind_rms, *ind_m = nullptr, *rev_ind_m = nullptr, *ind_rms_m = + nullptr; char *gn_fit, **gn_rms; t_rgb rlo, rhi; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; t_filenm fnm[] = { - { efTPS, NULL, NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, - { efTRX, "-f2", NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efXVG, NULL, "rmsd", ffWRITE }, + { efTPS, nullptr, nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTRX, "-f2", nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efXVG, nullptr, "rmsd", ffWRITE }, { efXVG, "-mir", "rmsdmir", ffOPTWR }, { efXVG, "-a", "avgrp", ffOPTWR }, { efXVG, "-dist", "rmsd-dist", ffOPTWR }, @@ -273,7 +273,7 @@ int gmx_rms(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; @@ -359,7 +359,7 @@ int gmx_rms(int argc, char *argv[]) } bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, - NULL, box, TRUE); + nullptr, box, TRUE); snew(w_rls, top.atoms.nr); snew(w_rms, top.atoms.nr); @@ -477,7 +477,7 @@ int gmx_rms(int argc, char *argv[]) } if (bReset) { - reset_x(ifit, ind_fit, top.atoms.nr, NULL, xp, w_rls); + reset_x(ifit, ind_fit, top.atoms.nr, nullptr, xp, w_rls); } if (bMirror) { @@ -621,7 +621,7 @@ int gmx_rms(int argc, char *argv[]) if (bReset) { - reset_x(ifit, ind_fit, natoms, NULL, x, w_rls); + reset_x(ifit, ind_fit, natoms, nullptr, x, w_rls); } if (ewhat == ewRhoSc) { @@ -666,7 +666,7 @@ int gmx_rms(int argc, char *argv[]) } if (bReset) { - reset_x(ifit, ind_fit, natoms, NULL, xp, w_rls); + reset_x(ifit, ind_fit, natoms, nullptr, xp, w_rls); } if (bFit) { @@ -749,7 +749,7 @@ int gmx_rms(int argc, char *argv[]) if (bReset) { - reset_x(ifit, ind_fit, natoms, NULL, x, w_rls); + reset_x(ifit, ind_fit, natoms, nullptr, x, w_rls); } if (ewhat == ewRhoSc) { @@ -1219,11 +1219,11 @@ int gmx_rms(int argc, char *argv[]) xvgrclose(fp); } do_view(oenv, opt2fn_null("-a", NFILE, fnm), "-graphtype bar"); - do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); - do_view(oenv, opt2fn_null("-mir", NFILE, fnm), NULL); - do_view(oenv, opt2fn_null("-m", NFILE, fnm), NULL); - do_view(oenv, opt2fn_null("-bm", NFILE, fnm), NULL); - do_view(oenv, opt2fn_null("-dist", NFILE, fnm), NULL); + do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); + do_view(oenv, opt2fn_null("-mir", NFILE, fnm), nullptr); + do_view(oenv, opt2fn_null("-m", NFILE, fnm), nullptr); + do_view(oenv, opt2fn_null("-bm", NFILE, fnm), nullptr); + do_view(oenv, opt2fn_null("-dist", NFILE, fnm), nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_rmsdist.cpp b/src/gromacs/gmxana/gmx_rmsdist.cpp index ddf5a24f44..f12bee4b17 100644 --- a/src/gromacs/gmxana/gmx_rmsdist.cpp +++ b/src/gromacs/gmxana/gmx_rmsdist.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -179,13 +179,13 @@ static int read_equiv(const char *eq_fn, t_equiv ***equivptr) fp = gmx_ffopen(eq_fn, "r"); neq = 0; - equiv = NULL; + equiv = nullptr; while (get_a_line(fp, line, STRLEN)) { lp = line; /* this is not efficient, but I'm lazy */ srenew(equiv, neq+1); - equiv[neq] = NULL; + equiv[neq] = nullptr; na = 0; if (sscanf(lp, "%s %n", atomname, &n) == 1) { @@ -202,7 +202,7 @@ static int read_equiv(const char *eq_fn, t_equiv ***equivptr) equiv[neq][na].aname = gmx_strdup(atomname); if (na > 0) { - equiv[neq][na].nname = NULL; + equiv[neq][na].nname = nullptr; } na++; lp += n; @@ -212,8 +212,8 @@ static int read_equiv(const char *eq_fn, t_equiv ***equivptr) srenew(equiv[neq], na+1); equiv[neq][na].set = false; equiv[neq][na].rnr = 0; - equiv[neq][na].rname = NULL; - equiv[neq][na].aname = NULL; + equiv[neq][na].rname = nullptr; + equiv[neq][na].aname = nullptr; /* next */ neq++; @@ -304,7 +304,7 @@ static int analyze_noe_equivalent(const char *eq_fn, else { neq = 0; - equiv = NULL; + equiv = nullptr; } groupnr = 0; @@ -671,11 +671,11 @@ int gmx_rmsdist(int argc, char *argv[]) int *index, *noe_index; char *grpname; real **d_r, **d, **dtot, **dtot2, **mean, **rms, **rmsc, *resnr; - real **dtot1_3 = NULL, **dtot1_6 = NULL; + real **dtot1_3 = nullptr, **dtot1_6 = nullptr; real rmsnow, meanmax, rmsmax, rmscmax; real max1_3, max1_6; - t_noe_gr *noe_gr = NULL; - t_noe **noe = NULL; + t_noe_gr *noe_gr = nullptr; + t_noe **noe = nullptr; t_rgb rlo, rhi; gmx_bool bRMS, bScale, bMean, bNOE, bNMR3, bNMR6, bNMR; @@ -696,11 +696,11 @@ int gmx_rmsdist(int argc, char *argv[]) "Use periodic boundary conditions when computing distances" } }; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efDAT, "-equiv", "equiv", ffOPTRD }, - { efXVG, NULL, "distrmsd", ffWRITE }, + { efXVG, nullptr, "distrmsd", ffWRITE }, { efXPM, "-rms", "rmsdist", ffOPTWR }, { efXPM, "-scl", "rmsscale", ffOPTWR }, { efXPM, "-mean", "rmsmean", ffOPTWR }, @@ -711,7 +711,7 @@ int gmx_rmsdist(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -736,7 +736,7 @@ int gmx_rmsdist(int argc, char *argv[]) } /* get topology and index */ - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, FALSE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, FALSE); if (!bPBC) { @@ -885,7 +885,7 @@ int gmx_rmsdist(int argc, char *argv[]) write_noe(opt2FILE("-noe", NFILE, fnm, "w"), gnr, noe, noe_gr, scalemax); } - do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL); + do_view(oenv, ftp2fn(efXVG, NFILE, fnm), nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_rmsf.cpp b/src/gromacs/gmxana/gmx_rmsf.cpp index 3a7f4eaa2a..9c3989a279 100644 --- a/src/gromacs/gmxana/gmx_rmsf.cpp +++ b/src/gromacs/gmxana/gmx_rmsf.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -73,7 +73,7 @@ static real find_pdb_bfac(const t_atoms *atoms, t_resinfo *ri, char *atomnm) if ((ri->nr == atoms->resinfo[atoms->atom[i].resind].nr) && (ri->ic == atoms->resinfo[atoms->atom[i].resind].ic) && (std::strcmp(*atoms->resinfo[atoms->atom[i].resind].name, rresnm) == 0) && - (std::strstr(*atoms->atomname[i], atomnm) != NULL)) + (std::strstr(*atoms->atomname[i], atomnm) != nullptr)) { break; } @@ -126,13 +126,13 @@ static void average_residues(double f[], double **U, int uind, } for (i = 0; i < isize; i++) { - av += w_rls[index[i]]*(f != NULL ? f[i] : U[i][uind]); + av += w_rls[index[i]]*(f != nullptr ? f[i] : U[i][uind]); m += w_rls[index[i]]; if (i+1 == isize || atoms->atom[index[i]].resind != atoms->atom[index[i+1]].resind) { av /= m; - if (f != NULL) + if (f != nullptr) { for (j = start; j <= i; j++) { @@ -254,22 +254,22 @@ int gmx_rmsf(int argc, char *argv[]) real bfac, pdb_bfac, *Uaver; double **U, *xav; int aid; - rvec *rmsd_x = NULL; + rvec *rmsd_x = nullptr; double *rmsf, invcount, totmass; int d; real count = 0; rvec xcm; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; gmx_output_env_t *oenv; const char *leg[2] = { "MD", "X-Ray" }; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efPDB, "-q", NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efPDB, "-q", nullptr, ffOPTRD }, { efPDB, "-oq", "bfac", ffOPTWR }, { efPDB, "-ox", "xaver", ffOPTWR }, { efXVG, "-o", "rmsf", ffWRITE }, @@ -280,7 +280,7 @@ int gmx_rmsf(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pargs), pargs, asize(desc), desc, 0, NULL, + NFILE, fnm, asize(pargs), pargs, asize(desc), desc, 0, nullptr, &oenv)) { return 0; @@ -290,7 +290,7 @@ int gmx_rmsf(int argc, char *argv[]) devfn = opt2fn_null("-od", NFILE, fnm); dirfn = opt2fn_null("-dir", NFILE, fnm); - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xref, NULL, box, TRUE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xref, nullptr, box, TRUE); const char *title = *top.name; snew(w_rls, top.atoms.nr); @@ -321,10 +321,10 @@ int gmx_rmsf(int argc, char *argv[]) t_topology *top_pdb; snew(top_pdb, 1); /* Read coordinates twice */ - read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, NULL, NULL, pdbbox, FALSE); + read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, nullptr, nullptr, nullptr, pdbbox, FALSE); snew(pdbatoms, 1); *pdbatoms = top_pdb->atoms; - read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, &pdbx, NULL, pdbbox, FALSE); + read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, nullptr, &pdbx, nullptr, pdbbox, FALSE); title = *top_pdb->name; snew(refatoms, 1); *refatoms = top_pdb->atoms; @@ -435,7 +435,7 @@ int gmx_rmsf(int argc, char *argv[]) { for (d = 0; d < DIM*DIM; d++) { - average_residues(NULL, U, d, isize, index, w_rls, &top.atoms); + average_residues(nullptr, U, d, isize, index, w_rls, &top.atoms); } } @@ -533,7 +533,7 @@ int gmx_rmsf(int argc, char *argv[]) } if (bRes) { - average_residues(rmsf, NULL, 0, isize, index, w_rls, &top.atoms); + average_residues(rmsf, nullptr, 0, isize, index, w_rls, &top.atoms); } /* Write RMSD output */ fp = xvgropen(devfn, "RMS Deviation", label, "(nm)", oenv); @@ -557,7 +557,7 @@ int gmx_rmsf(int argc, char *argv[]) rvec_inc(xref[index[i]], xcm); } write_sto_conf_indexed(opt2fn("-oq", NFILE, fnm), title, pdbatoms, pdbx, - NULL, ePBC, pdbbox, isize, index); + nullptr, ePBC, pdbbox, isize, index); } if (opt2bSet("-ox", NFILE, fnm)) { @@ -570,7 +570,7 @@ int gmx_rmsf(int argc, char *argv[]) } } /* Write a .pdb file with B-factors and optionally anisou records */ - write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, xref, NULL, + write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, xref, nullptr, ePBC, pdbbox, isize, index); } if (bAniso) diff --git a/src/gromacs/gmxana/gmx_rotacf.cpp b/src/gromacs/gmxana/gmx_rotacf.cpp index a3c14129d2..c429143af5 100644 --- a/src/gromacs/gmxana/gmx_rotacf.cpp +++ b/src/gromacs/gmxana/gmx_rotacf.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -94,13 +94,13 @@ int gmx_rotacf(int argc, char *argv[]) int i, m, teller, n_alloc, natoms, nvec, ai, aj, ak; unsigned long mode; real t, t0, t1, dt; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; t_topology *top; int ePBC; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffREAD }, { efXVG, "-o", "rotacf", ffWRITE } }; #define NFILE asize(fnm) @@ -113,7 +113,7 @@ int gmx_rotacf(int argc, char *argv[]) ppa = add_acf_pargs(&npargs, pa); if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv)) { sfree(ppa); return 0; @@ -146,7 +146,7 @@ int gmx_rotacf(int argc, char *argv[]) snew(c1, nvec); for (i = 0; (i < nvec); i++) { - c1[i] = NULL; + c1[i] = nullptr; } n_alloc = 0; @@ -230,7 +230,7 @@ int gmx_rotacf(int argc, char *argv[]) teller, nvec, c1, dt, mode, bAver); } - do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL); + do_view(oenv, ftp2fn(efXVG, NFILE, fnm), nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_rotmat.cpp b/src/gromacs/gmxana/gmx_rotmat.cpp index a1d48990c2..a37b4781b1 100644 --- a/src/gromacs/gmxana/gmx_rotmat.cpp +++ b/src/gromacs/gmxana/gmx_rotmat.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -67,7 +67,7 @@ static void get_refx(gmx_output_env_t *oenv, const char *trxfn, int nfitdim, int real xf; matrix box, R; real *w_rls; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; nfr_all = 0; @@ -99,7 +99,7 @@ static void get_refx(gmx_output_env_t *oenv, const char *trxfn, int nfitdim, int { copy_rvec(x[index[i]], xi[nfr][i]); } - reset_x(gnx, NULL, gnx, NULL, xi[nfr], w_rls); + reset_x(gnx, nullptr, gnx, nullptr, xi[nfr], w_rls); nfr++; if (nfr % 100 == 0) { @@ -204,7 +204,7 @@ int gmx_rotmat(int argc, char *argv[]) "the rotation matrix." }; const char *reffit[] = - { NULL, "none", "xyz", "xy", NULL }; + { nullptr, "none", "xyz", "xy", nullptr }; static int skip = 1; static gmx_bool bFitXY = FALSE, bMW = TRUE; t_pargs pa[] = { @@ -227,27 +227,27 @@ int gmx_rotmat(int argc, char *argv[]) int natoms, i; char *grpname; int gnx; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; int *index; gmx_output_env_t *oenv; real *w_rls; const char *leg[] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz" }; #define NLEG asize(leg) t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efXVG, NULL, "rotmat", ffWRITE } + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efXVG, nullptr, "rotmat", ffWRITE } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x_ref, NULL, box, bMW); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x_ref, nullptr, box, bMW); gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr); @@ -255,7 +255,7 @@ int gmx_rotmat(int argc, char *argv[]) get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname); - GMX_RELEASE_ASSERT(reffit[0] != NULL, "Options inconsistency; reffit[0] is NULL"); + GMX_RELEASE_ASSERT(reffit[0] != nullptr, "Options inconsistency; reffit[0] is NULL"); if (reffit[0][0] != 'n') { get_refx(oenv, ftp2fn(efTRX, NFILE, fnm), reffit[0][2] == 'z' ? 3 : 2, skip, @@ -276,7 +276,7 @@ int gmx_rotmat(int argc, char *argv[]) if (reffit[0][0] == 'n') { - reset_x(gnx, index, natoms, NULL, x_ref, w_rls); + reset_x(gnx, index, natoms, nullptr, x_ref, w_rls); } out = xvgropen(ftp2fn(efXVG, NFILE, fnm), @@ -287,7 +287,7 @@ int gmx_rotmat(int argc, char *argv[]) { gmx_rmpbc(gpbc, natoms, box, x); - reset_x(gnx, index, natoms, NULL, x, w_rls); + reset_x(gnx, index, natoms, nullptr, x, w_rls); if (bFitXY) { diff --git a/src/gromacs/gmxana/gmx_saltbr.cpp b/src/gromacs/gmxana/gmx_saltbr.cpp index d3099a577c..b3e3333171 100644 --- a/src/gromacs/gmxana/gmx_saltbr.cpp +++ b/src/gromacs/gmxana/gmx_saltbr.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -61,7 +61,7 @@ typedef struct { static t_charge *mk_charge(const t_atoms *atoms, const t_block *cgs, int *nncg) { - t_charge *cg = NULL; + t_charge *cg = nullptr; char buf[32]; int i, j, ncg, resnr, anr; real qq; @@ -148,8 +148,8 @@ int gmx_saltbr(int argc, char *argv[]) "Use separate files for each interaction (may be MANY)" } }; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPR, NULL, NULL, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, }; #define NFILE asize(fnm) @@ -182,7 +182,7 @@ int gmx_saltbr(int argc, char *argv[]) gmx_output_env_t *oenv; if (!parse_common_args(&argc, argv, PCA_CAN_TIME, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -200,7 +200,7 @@ int gmx_saltbr(int argc, char *argv[]) read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box); teller = 0; - time = NULL; + time = nullptr; do { srenew(time, teller+1); diff --git a/src/gromacs/gmxana/gmx_sans.cpp b/src/gromacs/gmxana/gmx_sans.cpp index b8c523d562..93a8fa4cd2 100644 --- a/src/gromacs/gmxana/gmx_sans.cpp +++ b/src/gromacs/gmxana/gmx_sans.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -84,8 +84,8 @@ int gmx_sans(int argc, char *argv[]) static unsigned int seed = 0; static int nthreads = -1; - static const char *emode[] = { NULL, "direct", "mc", NULL }; - static const char *emethod[] = { NULL, "debye", "fft", NULL }; + static const char *emode[] = { nullptr, "direct", "mc", nullptr }; + static const char *emethod[] = { nullptr, "debye", "fft", nullptr }; gmx_neutron_atomic_structurefactors_t *gnsf; gmx_sans_t *gsans; @@ -119,10 +119,10 @@ int gmx_sans(int argc, char *argv[]) #endif }; FILE *fp; - const char *fnTPX, *fnTRX, *fnDAT = NULL; + const char *fnTPX, *fnTRX, *fnDAT = nullptr; t_trxstatus *status; - t_topology *top = NULL; - gmx_rmpbc_t gpbc = NULL; + t_topology *top = nullptr; + gmx_rmpbc_t gpbc = nullptr; gmx_bool bFFT = FALSE, bDEBYE = FALSE; gmx_bool bMC = FALSE; int ePBC = -1; @@ -130,23 +130,23 @@ int gmx_sans(int argc, char *argv[]) rvec *x; int natoms; real t; - char **grpname = NULL; - int *index = NULL; + char **grpname = nullptr; + int *index = nullptr; int isize; int i; - char *hdr = NULL; - char *suffix = NULL; - t_filenm *fnmdup = NULL; - gmx_radial_distribution_histogram_t *prframecurrent = NULL, *pr = NULL; - gmx_static_structurefactor_t *sqframecurrent = NULL, *sq = NULL; + char *hdr = nullptr; + char *suffix = nullptr; + t_filenm *fnmdup = nullptr; + gmx_radial_distribution_histogram_t *prframecurrent = nullptr, *pr = nullptr; + gmx_static_structurefactor_t *sqframecurrent = nullptr, *sq = nullptr; gmx_output_env_t *oenv; #define NFILE asize(fnm) t_filenm fnm[] = { - { efTPR, "-s", NULL, ffREAD }, - { efTRX, "-f", NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTPR, "-s", nullptr, ffREAD }, + { efTRX, "-f", nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efDAT, "-d", "nsfactor", ffOPTRD }, { efXVG, "-pr", "pr", ffWRITE }, { efXVG, "-sq", "sq", ffWRITE }, @@ -157,7 +157,7 @@ int gmx_sans(int argc, char *argv[]) nthreads = gmx_omp_get_max_threads(); if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -170,7 +170,7 @@ int gmx_sans(int argc, char *argv[]) gmx_omp_set_num_threads(nthreads); /* Now try to parse opts for modes */ - GMX_RELEASE_ASSERT(emethod[0] != NULL, "Options inconsistency; emethod[0] is NULL"); + GMX_RELEASE_ASSERT(emethod[0] != nullptr, "Options inconsistency; emethod[0] is NULL"); switch (emethod[0][0]) { case 'd': @@ -226,7 +226,7 @@ int gmx_sans(int argc, char *argv[]) snew(grpname, 1); snew(index, 1); - read_tps_conf(fnTPX, top, &ePBC, &x, NULL, box, TRUE); + read_tps_conf(fnTPX, top, &ePBC, &x, nullptr, box, TRUE); printf("\nPlease select group for SANS spectra calculation:\n"); get_index(&(top->atoms), ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, grpname); @@ -253,7 +253,7 @@ int gmx_sans(int argc, char *argv[]) gmx_rmpbc(gpbc, top->atoms.nr, box, x); } /* allocate memory for pr */ - if (pr == NULL) + if (pr == nullptr) { /* in case its first frame to read */ snew(pr, 1); @@ -262,7 +262,7 @@ int gmx_sans(int argc, char *argv[]) prframecurrent = calc_radial_distribution_histogram(gsans, x, box, index, isize, binwidth, bMC, bNORM, mcover, seed); /* copy prframecurrent -> pr and summ up pr->gr[i] */ /* allocate and/or resize memory for pr->gr[i] and pr->r[i] */ - if (pr->gr == NULL) + if (pr->gr == nullptr) { /* check if we use pr->gr first time */ snew(pr->gr, prframecurrent->grn); diff --git a/src/gromacs/gmxana/gmx_saxs.cpp b/src/gromacs/gmxana/gmx_saxs.cpp index 61581d7882..6a7000bf45 100644 --- a/src/gromacs/gmxana/gmx_saxs.cpp +++ b/src/gromacs/gmxana/gmx_saxs.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -68,19 +68,19 @@ int gmx_saxs(int argc, char *argv[]) "Energy of the incoming X-ray (keV) "} }; #define NPA asize(pa) - const char *fnTPS, *fnTRX, *fnNDX, *fnDAT = NULL; + const char *fnTPS, *fnTRX, *fnNDX, *fnDAT = nullptr; gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efDAT, "-d", "sfactor", ffOPTRD }, { efXVG, "-sq", "sq", ffWRITE }, }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME, - NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } diff --git a/src/gromacs/gmxana/gmx_sham.cpp b/src/gromacs/gmxana/gmx_sham.cpp index e8e8146dda..14f8d1fb69 100644 --- a/src/gromacs/gmxana/gmx_sham.cpp +++ b/src/gromacs/gmxana/gmx_sham.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -425,7 +425,7 @@ static void do_sham(const char *fn, const char *ndx, { FILE *fp; real *min_eig, *max_eig; - real *axis_x, *axis_y, *axis_z, *axis = NULL; + real *axis_x, *axis_y, *axis_z, *axis = nullptr; double *P; real **PP, *W, *E, **WW, **EE, *S, **SS, *M, *bE; rvec xxx; @@ -989,7 +989,7 @@ int gmx_sham(int argc, char *argv[]) npargs = asize(pa); if (!parse_common_args(&argc, argv, PCA_CAN_VIEW, - NFILE, fnm, npargs, pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -1037,7 +1037,7 @@ int gmx_sham(int argc, char *argv[]) } else { - et_val = NULL; + et_val = nullptr; } if (fn_ene && et_val) @@ -1083,10 +1083,10 @@ int gmx_sham(int argc, char *argv[]) opt2fn("-ls", NFILE, fnm), opt2fn("-lsh", NFILE, fnm), opt2fn("-lss", NFILE, fnm), opt2fn("-ls3", NFILE, fnm), opt2fn("-g", NFILE, fnm), - n, nset, val, fn_ge != NULL, e_nset, et_val, Tref, + n, nset, val, fn_ge != nullptr, e_nset, et_val, Tref, pmax, gmax, - opt2parg_bSet("-emin", NPA, pa) ? &emin : NULL, - opt2parg_bSet("-emax", NPA, pa) ? &emax : NULL, + opt2parg_bSet("-emin", NPA, pa) ? &emin : nullptr, + opt2parg_bSet("-emax", NPA, pa) ? &emax : nullptr, nlevels, pmin, idim, ibox, opt2parg_bSet("-xmin", NPA, pa), rmin, diff --git a/src/gromacs/gmxana/gmx_sigeps.cpp b/src/gromacs/gmxana/gmx_sigeps.cpp index 8b466aa1e7..a74cb7b922 100644 --- a/src/gromacs/gmxana/gmx_sigeps.cpp +++ b/src/gromacs/gmxana/gmx_sigeps.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -104,7 +104,7 @@ int gmx_sigeps(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW, NFILE, fnm, asize(pa), pa, asize(desc), - desc, 0, NULL, &oenv)) + desc, 0, nullptr, &oenv)) { return 0; } @@ -184,7 +184,7 @@ int gmx_sigeps(int argc, char *argv[]) } xvgrclose(fp); - do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL); + do_view(oenv, ftp2fn(efXVG, NFILE, fnm), nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_sorient.cpp b/src/gromacs/gmxana/gmx_sorient.cpp index 968b57d2cd..757d9e0c8f 100644 --- a/src/gromacs/gmxana/gmx_sorient.cpp +++ b/src/gromacs/gmxana/gmx_sorient.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -135,7 +135,7 @@ int gmx_sorient(int argc, char *argv[]) char str[STRLEN]; gmx_bool bTPS; rvec xref, dx, dxh1, dxh2, outer; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; t_pbc pbc; const char *legr[] = { "", @@ -187,10 +187,10 @@ int gmx_sorient(int argc, char *argv[]) }; t_filenm fnm[] = { - { efTRX, NULL, NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efXVG, NULL, "sori", ffWRITE }, + { efTRX, nullptr, nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efXVG, nullptr, "sori", ffWRITE }, { efXVG, "-no", "snor", ffWRITE }, { efXVG, "-ro", "sord", ffWRITE }, { efXVG, "-co", "scum", ffWRITE }, @@ -199,7 +199,7 @@ int gmx_sorient(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -207,7 +207,7 @@ int gmx_sorient(int argc, char *argv[]) bTPS = (opt2bSet("-s", NFILE, fnm) || !opt2bSet("-n", NFILE, fnm) || bCom); if (bTPS) { - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, bCom); } @@ -222,7 +222,7 @@ int gmx_sorient(int argc, char *argv[]) } else { - get_index(NULL, ftp2fn(efNDX, NFILE, fnm), 2, isize, index, grpname); + get_index(nullptr, ftp2fn(efNDX, NFILE, fnm), 2, isize, index, grpname); } if (bCom) @@ -462,8 +462,8 @@ int gmx_sorient(int argc, char *argv[]) } xvgrclose(fp); - do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); - do_view(oenv, opt2fn("-no", NFILE, fnm), NULL); + do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); + do_view(oenv, opt2fn("-no", NFILE, fnm), nullptr); do_view(oenv, opt2fn("-ro", NFILE, fnm), "-nxy"); do_view(oenv, opt2fn("-co", NFILE, fnm), "-nxy"); diff --git a/src/gromacs/gmxana/gmx_spatial.cpp b/src/gromacs/gmxana/gmx_spatial.cpp index 40f6299fa0..1badcc8d64 100644 --- a/src/gromacs/gmxana/gmx_spatial.cpp +++ b/src/gromacs/gmxana/gmx_spatial.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -145,7 +145,7 @@ int gmx_spatial(int argc, char *argv[]) int i, nidx, nidxp; int v; int j, k; - int ***bin = NULL; + int ***bin = nullptr; int nbin[3]; FILE *flp; int x, y, z, minx, miny, minz, maxx, maxy, maxz; @@ -153,12 +153,12 @@ int gmx_spatial(int argc, char *argv[]) int tot, maxval, minval; double norm; gmx_output_env_t *oenv; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; t_filenm fnm[] = { - { efTPS, NULL, NULL, ffREAD }, /* this is for the topology */ - { efTRX, "-f", NULL, ffREAD }, /* and this for the trajectory */ - { efNDX, NULL, NULL, ffOPTRD } + { efTPS, nullptr, nullptr, ffREAD }, /* this is for the topology */ + { efTRX, "-f", nullptr, ffREAD }, /* and this for the trajectory */ + { efNDX, nullptr, nullptr, ffOPTRD } }; #define NFILE asize(fnm) @@ -171,7 +171,7 @@ int gmx_spatial(int argc, char *argv[]) return 0; } - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, TRUE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, TRUE); sfree(xtop); atoms = &(top.atoms); diff --git a/src/gromacs/gmxana/gmx_spol.cpp b/src/gromacs/gmxana/gmx_spol.cpp index 0009d3ecb0..8baa73fa7c 100644 --- a/src/gromacs/gmxana/gmx_spol.cpp +++ b/src/gromacs/gmxana/gmx_spol.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -169,7 +169,7 @@ int gmx_spol(int argc, char *argv[]) double sdip, sdip2, sinp, sdinp, nmol; int *hist; t_pbc pbc; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; const char *desc[] = { @@ -209,15 +209,15 @@ int gmx_spol(int argc, char *argv[]) }; t_filenm fnm[] = { - { efTRX, NULL, NULL, ffREAD }, - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efXVG, NULL, "scdist", ffWRITE } + { efTRX, nullptr, nullptr, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efXVG, nullptr, "scdist", ffWRITE } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -227,7 +227,7 @@ int gmx_spol(int argc, char *argv[]) gmx::MDModules mdModules; ir = mdModules.inputrec(); read_tpx_top(ftp2fn(efTPR, NFILE, fnm), - ir, box, &natoms, NULL, NULL, top); + ir, box, &natoms, nullptr, nullptr, top); /* get index groups */ printf("Select a group of reference particles and a solvent group:\n"); @@ -390,7 +390,7 @@ int gmx_spol(int argc, char *argv[]) } xvgrclose(fp); - do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); + do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_tcaf.cpp b/src/gromacs/gmxana/gmx_tcaf.cpp index 5d3dd8bf32..140be7d22c 100644 --- a/src/gromacs/gmxana/gmx_tcaf.cpp +++ b/src/gromacs/gmxana/gmx_tcaf.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -79,9 +79,9 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac, const char *fn_tcf, const char *fn_cub, const char *fn_vk, const gmx_output_env_t *oenv) { - FILE *fp, *fp_vk, *fp_cub = NULL; + FILE *fp, *fp_vk, *fp_cub = nullptr; int nk, ntc; - real **tcaf, **tcafc = NULL, eta, *sig; + real **tcaf, **tcafc = nullptr, eta, *sig; int i, j, k, kc; int ncorr; double fitparms[3]; @@ -208,8 +208,8 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac, tcaf[k][0] = 1.0; fitparms[0] = 1; fitparms[1] = 1; - do_lmfit(ncorr, tcaf[k], sig, dt, 0, 0, ncorr*dt, - oenv, bDebugMode(), effnVAC, fitparms, 0, NULL); + do_lmfit(ncorr, tcaf[k], sig, dt, nullptr, 0, ncorr*dt, + oenv, bDebugMode(), effnVAC, fitparms, 0, nullptr); eta = 1000*fitparms[1]*rho/ (4*fitparms[0]*PICO*norm2(kfac[k])/(NANO*NANO)); fprintf(stdout, "k %6.3f tau %6.3f eta %8.5f 10^-3 kg/(m s)\n", @@ -233,8 +233,8 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac, tcafc[k][0] = 1.0; fitparms[0] = 1; fitparms[1] = 1; - do_lmfit(ncorr, tcafc[k], sig, dt, 0, 0, ncorr*dt, - oenv, bDebugMode(), effnVAC, fitparms, 0, NULL); + do_lmfit(ncorr, tcafc[k], sig, dt, nullptr, 0, ncorr*dt, + oenv, bDebugMode(), effnVAC, fitparms, 0, nullptr); eta = 1000*fitparms[1]*rho/ (4*fitparms[0]*PICO*norm2(kfac[kset_c[k]])/(NANO*NANO)); fprintf(stdout, @@ -309,7 +309,7 @@ int gmx_tcaf(int argc, char *argv[]) matrix box; gmx_bool bTop; int gnx; - int *index, *atndx = NULL, at; + int *index, *atndx = nullptr, at; char *grpname; char title[256]; real t0, t1, dt, m, mtot, sysmass, rho, sx, cx; @@ -323,9 +323,9 @@ int gmx_tcaf(int argc, char *argv[]) #define NHISTO 360 t_filenm fnm[] = { - { efTRN, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRN, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-ot", "transcur", ffOPTWR }, { efXVG, "-oa", "tcaf_all", ffWRITE }, { efXVG, "-o", "tcaf", ffWRITE }, @@ -341,13 +341,13 @@ int gmx_tcaf(int argc, char *argv[]) ppa = add_acf_pargs(&npargs, pa); if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv)) { sfree(ppa); return 0; } - bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box, + bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE); get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname); diff --git a/src/gromacs/gmxana/gmx_traj.cpp b/src/gromacs/gmxana/gmx_traj.cpp index 352ce4fd2b..0d273adb5f 100644 --- a/src/gromacs/gmxana/gmx_traj.cpp +++ b/src/gromacs/gmxana/gmx_traj.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -72,7 +72,7 @@ static void low_print_data(FILE *fp, real time, rvec x[], int n, int *index, fprintf(fp, " %g", time); for (i = 0; i < n; i++) { - if (index != NULL) + if (index != nullptr) { ii = index[i]; } @@ -111,7 +111,7 @@ static void average_data(rvec x[], rvec xav[], real *mass, for (i = 0; i < isize[g]; i++) { ind = index[g][i]; - if (mass != NULL) + if (mass != nullptr) { m = mass[ind]; svmul(m, x[ind], tmp); @@ -129,7 +129,7 @@ static void average_data(rvec x[], rvec xav[], real *mass, } } } - if (mass != NULL) + if (mass != nullptr) { for (d = 0; d < DIM; d++) { @@ -151,16 +151,16 @@ static void print_data(FILE *fp, real time, rvec x[], real *mass, gmx_bool bCom, int ngrps, int isize[], int **index, gmx_bool bDim[], const char *sffmt) { - static rvec *xav = NULL; + static rvec *xav = nullptr; if (bCom) { - if (xav == NULL) + if (xav == nullptr) { snew(xav, ngrps); } average_data(x, xav, mass, ngrps, isize, index); - low_print_data(fp, time, xav, ngrps, NULL, bDim, sffmt); + low_print_data(fp, time, xav, ngrps, nullptr, bDim, sffmt); } else { @@ -171,14 +171,14 @@ static void print_data(FILE *fp, real time, rvec x[], real *mass, gmx_bool bCom, static void write_trx_x(t_trxstatus *status, const t_trxframe *fr, real *mass, gmx_bool bCom, int ngrps, int isize[], int **index) { - static rvec *xav = NULL; - static t_atoms *atoms = NULL; + static rvec *xav = nullptr; + static t_atoms *atoms = nullptr; t_trxframe fr_av; int i; if (bCom) { - if (xav == NULL) + if (xav == nullptr) { snew(xav, ngrps); snew(atoms, 1); @@ -199,11 +199,11 @@ static void write_trx_x(t_trxstatus *status, const t_trxframe *fr, real *mass, g fr_av.natoms = ngrps; fr_av.atoms = atoms; fr_av.x = xav; - write_trxframe(status, &fr_av, NULL); + write_trxframe(status, &fr_av, nullptr); } else { - write_trxframe_indexed(status, fr, isize[0], index[0], NULL); + write_trxframe_indexed(status, fr, isize[0], index[0], nullptr); } } @@ -260,14 +260,14 @@ static void make_legend(FILE *fp, int ngrps, int isize, int index[], static real ekrot(rvec x[], rvec v[], real mass[], int isize, int index[]) { - static real **TCM = NULL, **L; + static real **TCM = nullptr, **L; double tm, m0, lxx, lxy, lxz, lyy, lyz, lzz, ekrot; rvec a0, ocm; dvec dx, b0; dvec xcm, vcm, acm; int i, j, m, n; - if (TCM == NULL) + if (TCM == nullptr) { snew(TCM, DIM); for (i = 0; i < DIM; i++) @@ -507,7 +507,7 @@ static void write_pdb_bfac(const char *fname, const char *xname, *(atoms->resinfo[atoms->atom[maxi].resind].name), atoms->resinfo[atoms->atom[maxi].resind].nr); - if (atoms->pdbinfo == NULL) + if (atoms->pdbinfo == nullptr) { snew(atoms->pdbinfo, atoms->nr); } @@ -535,7 +535,7 @@ static void write_pdb_bfac(const char *fname, const char *xname, atoms->pdbinfo[index[i]].bfac = sum[index[i]][onedim]*scale; } } - write_sto_conf_indexed(fname, title, atoms, x, NULL, ePBC, box, isize, index); + write_sto_conf_indexed(fname, title, atoms, x, nullptr, ePBC, box, isize, index); } } @@ -545,7 +545,7 @@ static void update_histo(int gnx, int index[], rvec v[], int i, m, in, nnn; real vn, vnmax; - if (*histo == NULL) + if (*histo == nullptr) { vnmax = 0; for (i = 0; (i < gnx); i++) @@ -659,20 +659,20 @@ int gmx_traj(int argc, char *argv[]) { "-scale", FALSE, etREAL, {&scale}, "Scale factor for [REF].pdb[ref] output, 0 is autoscale" } }; - FILE *outx = NULL, *outv = NULL, *outf = NULL, *outb = NULL, *outt = NULL; - FILE *outekt = NULL, *outekr = NULL; + FILE *outx = nullptr, *outv = nullptr, *outf = nullptr, *outb = nullptr, *outt = nullptr; + FILE *outekt = nullptr, *outekr = nullptr; t_topology top; int ePBC; real *mass, time; const char *indexfn; t_trxframe fr; - int flags, nvhisto = 0, *vhisto = NULL; - rvec *xtop, *xp = NULL; - rvec *sumx = NULL, *sumv = NULL, *sumf = NULL; + int flags, nvhisto = 0, *vhisto = nullptr; + rvec *xtop, *xp = nullptr; + rvec *sumx = nullptr, *sumv = nullptr, *sumf = nullptr; matrix topbox; t_trxstatus *status; - t_trxstatus *status_out = NULL; - gmx_rmpbc_t gpbc = NULL; + t_trxstatus *status_out = nullptr; + gmx_rmpbc_t gpbc = nullptr; int i, j; int nr_xfr, nr_vfr, nr_ffr; char **grpname; @@ -687,9 +687,9 @@ int gmx_traj(int argc, char *argv[]) gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-ox", "coord", ffOPTWR }, { efTRX, "-oxt", "coord", ffOPTWR }, { efXVG, "-ov", "veloc", ffOPTWR }, @@ -708,7 +708,7 @@ int gmx_traj(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -751,7 +751,7 @@ int gmx_traj(int argc, char *argv[]) sprintf(sffmt6, "%s%s%s%s%s%s", sffmt, sffmt, sffmt, sffmt, sffmt, sffmt); bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, - &xtop, NULL, topbox, + &xtop, nullptr, topbox, bCom && (bOX || bOXT || bOV || bOT || bEKT || bEKR)); sfree(xtop); if ((bMol || bCV || bCF) && !bTop) @@ -814,7 +814,7 @@ int gmx_traj(int argc, char *argv[]) } else { - mass = NULL; + mass = nullptr; } flags = 0; @@ -986,7 +986,7 @@ int gmx_traj(int argc, char *argv[]) } if (bOF && fr.bF) { - print_data(outf, time, fr.f, NULL, bCom, ngroups, isize, index, bDim, sffmt); + print_data(outf, time, fr.f, nullptr, bCom, ngroups, isize, index, bDim, sffmt); } if (bOB && fr.bBox) { @@ -1053,7 +1053,7 @@ int gmx_traj(int argc, char *argv[]) } while (read_next_frame(oenv, status, &fr)); - if (gpbc != NULL) + if (gpbc != nullptr) { gmx_rmpbc_done(gpbc); } diff --git a/src/gromacs/gmxana/gmx_trjcat.cpp b/src/gromacs/gmxana/gmx_trjcat.cpp index 3b5427d5f3..9c9bdc6fd3 100644 --- a/src/gromacs/gmxana/gmx_trjcat.cpp +++ b/src/gromacs/gmxana/gmx_trjcat.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -209,7 +209,7 @@ static void edit_files(char **fnms, int nfiles, real *readtime, real *timestep, ok = FALSE; do { - if (NULL == fgets(inputstring, STRLEN - 1, stdin)) + if (nullptr == fgets(inputstring, STRLEN - 1, stdin)) { gmx_fatal(FARGS, "Error reading user input" ); } @@ -383,11 +383,11 @@ static void do_demux(int nset, char *fnms[], char *fnms_out[], int nval, { if (index) { - write_trxframe_indexed(fp_out[j], &trx[i], isize, index, NULL); + write_trxframe_indexed(fp_out[j], &trx[i], isize, index, nullptr); } else { - write_trxframe(fp_out[j], &trx[i], NULL); + write_trxframe(fp_out[j], &trx[i], nullptr); } } } @@ -470,7 +470,7 @@ int gmx_trjcat(int argc, char *argv[]) }; #define npargs asize(pa) int ftpin, i, frame, frame_out; - t_trxstatus *status, *trxout = NULL; + t_trxstatus *status, *trxout = nullptr; real t_corr; t_trxframe fr, frout; char **fnms, **fnms_out, *out_file; @@ -482,16 +482,16 @@ int gmx_trjcat(int argc, char *argv[]) gmx_bool lastTimeSet = FALSE; real last_frame_time, searchtime; int isize = 0, j; - int *index = NULL, imax; + int *index = nullptr, imax; char *grpname; - real **val = NULL, *t = NULL, dt_remd; + real **val = nullptr, *t = nullptr, dt_remd; int n, nset, ftpout = -1, prevEndStep = 0, filetype; gmx_off_t fpos; gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffRDMULT }, - { efTRO, "-o", NULL, ffWRMULT }, + { efTRX, "-f", nullptr, ffRDMULT }, + { efTRO, "-o", nullptr, ffWRMULT }, { efNDX, "-n", "index", ffOPTRD }, { efXVG, "-demux", "remd", ffOPTRD } }; @@ -499,7 +499,7 @@ int gmx_trjcat(int argc, char *argv[]) #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_TIME_UNIT, NFILE, fnm, - asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -648,13 +648,13 @@ int gmx_trjcat(int argc, char *argv[]) } if (bIndex) { - trjtools_gmx_prepare_tng_writing(out_file, 'w', NULL, &trxout, - fnms[0], isize, NULL, index, grpname); + trjtools_gmx_prepare_tng_writing(out_file, 'w', nullptr, &trxout, + fnms[0], isize, nullptr, index, grpname); } else { - trjtools_gmx_prepare_tng_writing(out_file, 'w', NULL, &trxout, - fnms[0], -1, NULL, NULL, NULL); + trjtools_gmx_prepare_tng_writing(out_file, 'w', nullptr, &trxout, + fnms[0], -1, nullptr, nullptr, nullptr); } } else @@ -894,11 +894,11 @@ int gmx_trjcat(int argc, char *argv[]) if (bIndex) { write_trxframe_indexed(trxout, &frout, isize, index, - NULL); + nullptr); } else { - write_trxframe(trxout, &frout, NULL); + write_trxframe(trxout, &frout, nullptr); } if ( ((frame % 10) == 0) || (frame < 10) ) { diff --git a/src/gromacs/gmxana/gmx_trjconv.cpp b/src/gromacs/gmxana/gmx_trjconv.cpp index f5781ed25c..92cae1eff5 100644 --- a/src/gromacs/gmxana/gmx_trjconv.cpp +++ b/src/gromacs/gmxana/gmx_trjconv.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -492,7 +492,7 @@ void do_trunc(const char *fn, real t0) in = gmx_trr_open(fn, "r"); fp = gmx_fio_getfp(in); - if (fp == NULL) + if (fp == nullptr) { fprintf(stderr, "Sorry, can not trunc %s, truncation of this filetype is not supported\n", fn); gmx_trr_close(in); @@ -504,7 +504,7 @@ void do_trunc(const char *fn, real t0) bStop = FALSE; while (!bStop && gmx_trr_read_frame_header(in, &sh, &bOK)) { - gmx_trr_read_frame_data(in, &sh, NULL, NULL, NULL, NULL); + gmx_trr_read_frame_data(in, &sh, nullptr, nullptr, nullptr, nullptr); fpos = gmx_ftell(fp); t = sh.t; if (t >= t0) @@ -568,7 +568,7 @@ static gmx_mtop_t *read_mtop_for_tng(const char *tps_file, const char *input_file, const char *output_file) { - gmx_mtop_t *mtop = NULL; + gmx_mtop_t *mtop = nullptr; if (fn2bTPX(tps_file) && efTNG != fn2ftp(input_file) && @@ -576,8 +576,8 @@ static gmx_mtop_t *read_mtop_for_tng(const char *tps_file, { int temp_natoms = -1; snew(mtop, 1); - read_tpx(tps_file, NULL, NULL, &temp_natoms, - NULL, NULL, mtop); + read_tpx(tps_file, nullptr, nullptr, &temp_natoms, + nullptr, nullptr, mtop); } return mtop; @@ -742,20 +742,20 @@ int gmx_trjconv(int argc, char *argv[]) }; const char *pbc_opt[epNR + 1] = { - NULL, "none", "mol", "res", "atom", "nojump", "cluster", "whole", - NULL + nullptr, "none", "mol", "res", "atom", "nojump", "cluster", "whole", + nullptr }; int unitcell_enum; const char *unitcell_opt[euNR+1] = - { NULL, "rect", "tric", "compact", NULL }; + { nullptr, "rect", "tric", "compact", nullptr }; enum { ecSel, ecTric, ecRect, ecZero, ecNR }; const char *center_opt[ecNR+1] = - { NULL, "tric", "rect", "zero", NULL }; + { nullptr, "tric", "rect", "zero", nullptr }; int ecenter; int fit_enum; @@ -765,8 +765,8 @@ int gmx_trjconv(int argc, char *argv[]) }; const char *fit[efNR + 1] = { - NULL, "none", "rot+trans", "rotxy+transxy", "translation", "transxy", - "progressive", NULL + nullptr, "none", "rot+trans", "rotxy+transxy", "translation", "transxy", + "progressive", nullptr }; static gmx_bool bSeparate = FALSE, bVels = TRUE, bForce = FALSE, bCONECT = FALSE; @@ -774,7 +774,7 @@ int gmx_trjconv(int argc, char *argv[]) static int skip_nr = 1, ndec = 3, nzero = 0; static real tzero = 0, delta_t = 0, timestep = 0, ttrunc = -1, tdump = -1, split_t = 0; static rvec newbox = {0, 0, 0}, shift = {0, 0, 0}, trans = {0, 0, 0}; - static char *exec_command = NULL; + static char *exec_command = nullptr; static real dropunder = 0, dropover = 0; static gmx_bool bRound = FALSE; @@ -858,22 +858,22 @@ int gmx_trjconv(int argc, char *argv[]) }; #define NPA asize(pa) - FILE *out = NULL; - t_trxstatus *trxout = NULL; + FILE *out = nullptr; + t_trxstatus *trxout = nullptr; t_trxstatus *trxin; int file_nr; t_trxframe fr, frout; int flags; - rvec *xmem = NULL, *vmem = NULL, *fmem = NULL; - rvec *xp = NULL, x_shift, hbox; - real *w_rls = NULL; + rvec *xmem = nullptr, *vmem = nullptr, *fmem = nullptr; + rvec *xp = nullptr, x_shift, hbox; + real *w_rls = nullptr; int m, i, d, frame, outframe, natoms, nout, ncent, newstep = 0, model_nr; #define SKIP 10 t_topology top; - gmx_mtop_t *mtop = NULL; - gmx_conect gc = NULL; + gmx_mtop_t *mtop = nullptr; + gmx_conect gc = nullptr; int ePBC = -1; - t_atoms *atoms = NULL, useatoms; + t_atoms *atoms = nullptr, useatoms; matrix top_box; int *index, *cindex; char *grpnm; @@ -882,35 +882,35 @@ int gmx_trjconv(int argc, char *argv[]) int ifit, my_clust = -1; int *ind_fit; char *gn_fit; - t_cluster_ndx *clust = NULL; - t_trxstatus **clust_status = NULL; - int *clust_status_id = NULL; + t_cluster_ndx *clust = nullptr; + t_trxstatus **clust_status = nullptr; + int *clust_status_id = nullptr; int ntrxopen = 0; - int *nfwritten = NULL; + int *nfwritten = nullptr; int ndrop = 0, ncol, drop0 = 0, drop1 = 0, dropuse = 0; double **dropval; real tshift = 0, t0 = -1, dt = 0.001, prec; gmx_bool bFit, bPFit, bReset; int nfitdim; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; gmx_bool bRmPBC, bPBCWhole, bPBCcomRes, bPBCcomMol, bPBCcomAtom, bPBC, bNoJump, bCluster; gmx_bool bCopy, bDoIt, bIndex, bTDump, bSetTime, bTPS = FALSE, bDTset = FALSE; gmx_bool bExec, bTimeStep = FALSE, bDumpFrame = FALSE, bSetPrec, bNeedPrec; gmx_bool bHaveFirstFrame, bHaveNextFrame, bSetBox, bSetUR, bSplit = FALSE; gmx_bool bSubTraj = FALSE, bDropUnder = FALSE, bDropOver = FALSE, bTrans = FALSE; gmx_bool bWriteFrame, bSplitHere; - const char *top_file, *in_file, *out_file = NULL; + const char *top_file, *in_file, *out_file = nullptr; char out_file2[256], *charpt; - char *outf_base = NULL; - const char *outf_ext = NULL; + char *outf_base = nullptr; + const char *outf_ext = nullptr; char top_title[256], title[256], filemode[5]; gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTRO, "-o", NULL, ffWRITE }, - { efTPS, NULL, NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTRO, "-o", nullptr, ffWRITE }, + { efTPS, nullptr, nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efNDX, "-fr", "frames", ffOPTRD }, { efNDX, "-sub", "cluster", ffOPTRD }, { efXVG, "-drop", "drop", ffOPTRD } @@ -921,7 +921,7 @@ int gmx_trjconv(int argc, char *argv[]) PCA_CAN_BEGIN | PCA_CAN_END | PCA_CAN_VIEW | PCA_TIME_UNIT, NFILE, fnm, NPA, pa, asize(desc), desc, - 0, NULL, &oenv)) + 0, nullptr, &oenv)) { return 0; } @@ -1030,7 +1030,7 @@ int gmx_trjconv(int argc, char *argv[]) if (bSeparate || bSplit) { outf_ext = std::strrchr(out_file, '.'); - if (outf_ext == NULL) + if (outf_ext == nullptr) { gmx_fatal(FARGS, "Output file name '%s' does not contain a '.'", out_file); } @@ -1048,7 +1048,7 @@ int gmx_trjconv(int argc, char *argv[]) gmx_fatal(FARGS, "Can only use the sub option with output file types " "xtc and trr"); } - clust = cluster_index(NULL, opt2fn("-sub", NFILE, fnm)); + clust = cluster_index(nullptr, opt2fn("-sub", NFILE, fnm)); /* Check for number of files disabled, as FOPEN_MAX is not the correct * number to check for. In my linux box it is only 16. @@ -1071,7 +1071,7 @@ int gmx_trjconv(int argc, char *argv[]) snew(nfwritten, clust->clust->nr); for (i = 0; (i < clust->clust->nr); i++) { - clust_status[i] = NULL; + clust_status[i] = nullptr; clust_status_id[i] = -1; } bSeparate = bSplit = FALSE; @@ -1093,7 +1093,7 @@ int gmx_trjconv(int argc, char *argv[]) if (bTPS) { - read_tps_conf(top_file, &top, &ePBC, &xp, NULL, top_box, + read_tps_conf(top_file, &top, &ePBC, &xp, nullptr, top_box, bReset || bPBCcomRes); std::strncpy(top_title, *top.name, 255); top_title[255] = '\0'; @@ -1124,7 +1124,7 @@ int gmx_trjconv(int argc, char *argv[]) } /* get frame number index */ - frindex = NULL; + frindex = nullptr; if (opt2bSet("-fr", NFILE, fnm)) { printf("Select groups of frame number indices:\n"); @@ -1215,7 +1215,7 @@ int gmx_trjconv(int argc, char *argv[]) gmx_rmpbc(gpbc, top.atoms.nr, top_box, xp); } copy_rvec(xp[index[0]], x_shift); - reset_x_ndim(nfitdim, ifit, ind_fit, atoms->nr, NULL, xp, w_rls); + reset_x_ndim(nfitdim, ifit, ind_fit, atoms->nr, nullptr, xp, w_rls); rvec_dec(x_shift, xp[index[0]]); } else @@ -1336,7 +1336,7 @@ int gmx_trjconv(int argc, char *argv[]) filemode[0], trxin, &trxout, - NULL, + nullptr, nout, mtop, index, @@ -1344,7 +1344,7 @@ int gmx_trjconv(int argc, char *argv[]) break; case efXTC: case efTRR: - out = NULL; + out = nullptr; if (!bSplit && !bSubTraj) { trxout = open_trx(out_file, filemode); @@ -1514,14 +1514,14 @@ int gmx_trjconv(int argc, char *argv[]) gmx_rmpbc_trxfr(gpbc, &fr); } - reset_x_ndim(nfitdim, ifit, ind_fit, natoms, NULL, fr.x, w_rls); + reset_x_ndim(nfitdim, ifit, ind_fit, natoms, nullptr, fr.x, w_rls); do_fit(natoms, w_rls, xp, fr.x); } /* store this set of coordinates for future use */ if (bPFit || bNoJump) { - if (xp == NULL) + if (xp == nullptr) { snew(xp, natoms); } @@ -1636,7 +1636,7 @@ int gmx_trjconv(int argc, char *argv[]) if (bReset) { - reset_x_ndim(nfitdim, ifit, ind_fit, natoms, NULL, fr.x, w_rls); + reset_x_ndim(nfitdim, ifit, ind_fit, natoms, nullptr, fr.x, w_rls); if (bFit) { do_fit_ndim(nfitdim, natoms, w_rls, xp, fr.x); @@ -1787,7 +1787,7 @@ int gmx_trjconv(int argc, char *argv[]) clust->clust->index[my_clust])) { close_trx(clust_status[my_clust]); - clust_status[my_clust] = NULL; + clust_status[my_clust] = nullptr; clust_status_id[my_clust] = -2; ntrxopen--; if (ntrxopen < 0) @@ -1815,7 +1815,7 @@ int gmx_trjconv(int argc, char *argv[]) { case efGRO: write_hconf_p(out, title, &useatoms, - frout.x, frout.bV ? frout.v : NULL, frout.box); + frout.x, frout.bV ? frout.v : nullptr, frout.box); break; case efPDB: fprintf(out, "REMARK GENERATED BY TRJCONV\n"); @@ -1854,12 +1854,12 @@ int gmx_trjconv(int argc, char *argv[]) frout.bStep = TRUE; frout.bTime = TRUE; } - write_g96_conf(out, &frout, -1, NULL); + write_g96_conf(out, &frout, -1, nullptr); } if (bSeparate || bSplitHere) { gmx_ffclose(out); - out = NULL; + out = nullptr; } break; default: @@ -1909,7 +1909,7 @@ int gmx_trjconv(int argc, char *argv[]) { close_trx(trxout); } - else if (out != NULL) + else if (out != nullptr) { gmx_ffclose(out); } @@ -1927,7 +1927,7 @@ int gmx_trjconv(int argc, char *argv[]) sfree(mtop); - do_view(oenv, out_file, NULL); + do_view(oenv, out_file, nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_trjorder.cpp b/src/gromacs/gmxana/gmx_trjorder.cpp index d432126791..9f1bd408ed 100644 --- a/src/gromacs/gmxana/gmx_trjorder.cpp +++ b/src/gromacs/gmxana/gmx_trjorder.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -136,24 +136,24 @@ int gmx_trjorder(int argc, char *argv[]) int natoms, nwat, ncut; char **grpname; int i, j, d, *isize, isize_ref = 0, isize_sol; - int sa, sr, *swi, **index, *ind_ref = NULL, *ind_sol; + int sa, sr, *swi, **index, *ind_ref = nullptr, *ind_sol; gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efTRO, "-o", "ordered", ffOPTWR }, { efXVG, "-nshell", "nshell", ffOPTWR } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_TIME, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, TRUE); + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, TRUE); sfree(x); /* get index groups */ @@ -214,8 +214,8 @@ int gmx_trjorder(int argc, char *argv[]) swi[i] = i; } - out = NULL; - fp = NULL; + out = nullptr; + fp = nullptr; bNShell = ((opt2bSet("-nshell", NFILE, fnm)) || (opt2parg_bSet("-r", asize(pa), pa))); bPDBout = FALSE; @@ -362,7 +362,7 @@ int gmx_trjorder(int argc, char *argv[]) } } } - write_trx(out, natoms, swi, &top.atoms, 0, t, box, x, NULL, NULL); + write_trx(out, natoms, swi, &top.atoms, 0, t, box, x, nullptr, nullptr); } } while (read_next_x(oenv, status, &t, x, box)); diff --git a/src/gromacs/gmxana/gmx_tune_pme.cpp b/src/gromacs/gmxana/gmx_tune_pme.cpp index 695f199c52..251d81a5ea 100644 --- a/src/gromacs/gmxana/gmx_tune_pme.cpp +++ b/src/gromacs/gmxana/gmx_tune_pme.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -168,7 +168,7 @@ static void finalize(const char *fn_out) fp = fopen(fn_out, "r"); fprintf(stdout, "\n\n"); - while (fgets(buf, STRLEN-1, fp) != NULL) + while (fgets(buf, STRLEN-1, fp) != nullptr) { fprintf(stdout, "%s", buf); } @@ -218,13 +218,13 @@ static int parse_logfile(const char *logfile, const char *errfile, iFound = eFoundDDStr; /* Skip some case statements */ } - while (fgets(line, STRLEN, fp) != NULL) + while (fgets(line, STRLEN, fp) != nullptr) { /* Remove leading spaces */ ltrim(line); /* Check for TERM and INT signals from user: */ - if (std::strstr(line, errSIG) != NULL) + if (std::strstr(line, errSIG) != nullptr) { fclose(fp); cleandata(perfdata, test_nr); @@ -234,7 +234,7 @@ static int parse_logfile(const char *logfile, const char *errfile, /* Check whether cycle resetting worked */ if (presteps > 0 && !bFoundResetStr) { - if (std::strstr(line, matchstrcr) != NULL) + if (std::strstr(line, matchstrcr) != nullptr) { sprintf(dumstring, "step %s", "%" GMX_SCNd64); sscanf(line, dumstring, &resetsteps); @@ -356,11 +356,11 @@ static int parse_logfile(const char *logfile, const char *errfile, if (gmx_fexist(errfile)) { fp = fopen(errfile, "r"); - while (fgets(line, STRLEN, fp) != NULL) + while (fgets(line, STRLEN, fp) != nullptr) { if (str_starts(line, "Fatal error:") ) { - if (fgets(line, STRLEN, fp) != NULL) + if (fgets(line, STRLEN, fp) != nullptr) { fprintf(stderr, "\nWARNING: An error occurred during this benchmark:\n" "%s\n", line); @@ -607,7 +607,7 @@ static void get_program_paths(gmx_bool bThreads, char *cmd_mpirun[], char *cmd_m /* Get the commands we need to set up the runs from environment variables */ if (!bThreads) { - if ( (cp = getenv("MPIRUN")) != NULL) + if ( (cp = getenv("MPIRUN")) != nullptr) { *cmd_mpirun = gmx_strdup(cp); } @@ -621,12 +621,12 @@ static void get_program_paths(gmx_bool bThreads, char *cmd_mpirun[], char *cmd_m *cmd_mpirun = gmx_strdup(empty_mpirun); } - if (*cmd_mdrun == NULL) + if (*cmd_mdrun == nullptr) { /* The use of MDRUN is deprecated, but made available in 5.1 for backward compatibility. It may be removed in a future version. */ - if ( (cp = getenv("MDRUN" )) != NULL) + if ( (cp = getenv("MDRUN" )) != nullptr) { *cmd_mdrun = gmx_strdup(cp); } @@ -649,7 +649,7 @@ static void check_mdrun_works(gmx_bool bThreads, const char *cmd_mdrun, gmx_bool bNeedGpuSupport) { - char *command = NULL; + char *command = nullptr; char *cp; char line[STRLEN]; FILE *fp; @@ -692,7 +692,7 @@ static void check_mdrun_works(gmx_bool bThreads, while (!feof(fp) ) { cp = fgets(line, STRLEN, fp); - if (cp != NULL) + if (cp != nullptr) { if (str_starts(line, match_mdrun) ) { @@ -1078,7 +1078,7 @@ static void make_benchmark_tprs( /* Scale the Fourier grid spacing */ ir->nkx = ir->nky = ir->nkz = 0; - calc_grid(NULL, state.box, fourierspacing*fac, &ir->nkx, &ir->nky, &ir->nkz); + calc_grid(nullptr, state.box, fourierspacing*fac, &ir->nkx, &ir->nky, &ir->nkz); /* Adjust other radii since various conditions need to be fulfilled */ if (eelPME == ir->coulombtype) @@ -1178,7 +1178,7 @@ static void cleanup(const t_filenm *fnm, int nfile, int k, int nnodes, { char numstring[STRLEN]; char newfilename[STRLEN]; - const char *fn = NULL; + const char *fn = nullptr; int i; const char *opt; @@ -1447,8 +1447,8 @@ static void do_the_tests( * constructing mdrun command lines */ { int i, nr, k, ret, count = 0, totaltests; - int *nPMEnodes = NULL; - t_perf *pd = NULL; + int *nPMEnodes = nullptr; + t_perf *pd = nullptr; int cmdline_length; char *command, *cmd_stub; char buf[STRLEN]; @@ -1530,7 +1530,7 @@ static void do_the_tests( /* Loop over various numbers of PME nodes: */ for (i = 0; i < *pmeentries; i++) { - char *cmd_gpu_ids = NULL; + char *cmd_gpu_ids = nullptr; pd = &perfdata[k][i]; @@ -2207,25 +2207,25 @@ int gmx_tune_pme(int argc, char *argv[]) int presteps = 100; /* Do a full cycle reset after presteps steps */ gmx_bool bOverwrite = FALSE, bKeepTPR; gmx_bool bLaunch = FALSE; - char *ExtraArgs = NULL; - char **tpr_names = NULL; - const char *simulation_tpr = NULL; - char *deffnm = NULL; + char *ExtraArgs = nullptr; + char **tpr_names = nullptr; + const char *simulation_tpr = nullptr; + char *deffnm = nullptr; int best_npme, best_tpr; int sim_part = 1; /* For benchmarks with checkpoint files */ char bbuf[STRLEN]; /* Default program names if nothing else is found */ - char *cmd_mpirun = NULL, *cmd_mdrun = NULL; + char *cmd_mpirun = nullptr, *cmd_mdrun = nullptr; char *cmd_args_bench, *cmd_args_launch; - char *cmd_np = NULL; + char *cmd_np = nullptr; /* IDs of GPUs that are eligible for computation */ - char *eligible_gpu_ids = NULL; - t_eligible_gpu_ids *gpu_ids = NULL; + char *eligible_gpu_ids = nullptr; + t_eligible_gpu_ids *gpu_ids = nullptr; - t_perf **perfdata = NULL; + t_perf **perfdata = nullptr; t_inputinfo *info; int i; FILE *fp; @@ -2239,11 +2239,11 @@ int gmx_tune_pme(int argc, char *argv[]) { efLOG, "-err", "bencherr", ffWRITE }, { efTPR, "-so", "tuned", ffWRITE }, /* mdrun: */ - { efTPR, NULL, NULL, ffREAD }, - { efTRN, "-o", NULL, ffWRITE }, - { efCOMPRESSED, "-x", NULL, ffOPTWR }, - { efCPT, "-cpi", NULL, ffOPTRD }, - { efCPT, "-cpo", NULL, ffOPTWR }, + { efTPR, nullptr, nullptr, ffREAD }, + { efTRN, "-o", nullptr, ffWRITE }, + { efCOMPRESSED, "-x", nullptr, ffOPTWR }, + { efCPT, "-cpi", nullptr, ffOPTRD }, + { efCPT, "-cpo", nullptr, ffOPTWR }, { efSTO, "-c", "confout", ffWRITE }, { efEDR, "-e", "ener", ffWRITE }, { efLOG, "-g", "md", ffWRITE }, @@ -2297,9 +2297,9 @@ int gmx_tune_pme(int argc, char *argv[]) int nthreads = 1; const char *procstring[] = - { NULL, "np", "n", "none", NULL }; + { nullptr, "np", "n", "none", nullptr }; const char *npmevalues_opt[] = - { NULL, "auto", "all", "subset", NULL }; + { nullptr, "auto", "all", "subset", nullptr }; gmx_bool bAppendFiles = TRUE; gmx_bool bKeepAndNumCPT = FALSE; @@ -2307,7 +2307,7 @@ int gmx_tune_pme(int argc, char *argv[]) gmx_bool bBenchmark = TRUE; gmx_bool bCheck = TRUE; - gmx_output_env_t *oenv = NULL; + gmx_output_env_t *oenv = nullptr; t_pargs pa[] = { /***********************/ @@ -2376,13 +2376,13 @@ int gmx_tune_pme(int argc, char *argv[]) if (!parse_common_args(&argc, argv, PCA_NOEXIT_ON_ARGS, NFILE, fnm, asize(pa), pa, asize(desc), desc, - 0, NULL, &oenv)) + 0, nullptr, &oenv)) { return 0; } // procstring[0] is used inside two different conditionals further down - GMX_RELEASE_ASSERT(procstring[0] != NULL, "Options inconsistency; procstring[0] is NULL"); + GMX_RELEASE_ASSERT(procstring[0] != nullptr, "Options inconsistency; procstring[0] is NULL"); /* Store the remaining unparsed command line entries in a string which * is then attached to the mdrun command line */ @@ -2513,7 +2513,7 @@ int gmx_tune_pme(int argc, char *argv[]) get_program_paths(bThreads, &cmd_mpirun, &cmd_mdrun); if (bBenchmark && repeats > 0) { - check_mdrun_works(bThreads, cmd_mpirun, cmd_np, cmd_mdrun, NULL != eligible_gpu_ids); + check_mdrun_works(bThreads, cmd_mpirun, cmd_np, cmd_mdrun, nullptr != eligible_gpu_ids); } /* Print some header info to file */ @@ -2610,7 +2610,7 @@ int gmx_tune_pme(int argc, char *argv[]) snew(perfdata, ntprs); if (bBenchmark) { - GMX_RELEASE_ASSERT(npmevalues_opt[0] != NULL, "Options inconsistency; npmevalues_opt[0] is NULL"); + GMX_RELEASE_ASSERT(npmevalues_opt[0] != nullptr, "Options inconsistency; npmevalues_opt[0] is NULL"); do_the_tests(fp, tpr_names, maxPMEnodes, minPMEnodes, npme_fixed, npmevalues_opt[0], perfdata, &pmeentries, repeats, nnodes, ntprs, bThreads, cmd_mpirun, cmd_np, cmd_mdrun, cmd_args_bench, fnm, NFILE, presteps, cpt_steps, bCheck, gpu_ids); diff --git a/src/gromacs/gmxana/gmx_vanhove.cpp b/src/gromacs/gmxana/gmx_vanhove.cpp index 0c660cc4b3..5d7b248a78 100644 --- a/src/gromacs/gmxana/gmx_vanhove.cpp +++ b/src/gromacs/gmxana/gmx_vanhove.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -122,9 +122,9 @@ int gmx_vanhove(int argc, char *argv[]) #define NPA asize(pa) t_filenm fnm[] = { - { efTRX, NULL, NULL, ffREAD }, - { efTPS, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRX, nullptr, nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXPM, "-om", "vanhove", ffOPTWR }, { efXVG, "-or", "vanhove_r", ffOPTWR }, { efXVG, "-ot", "vanhove_t", ffOPTWR } @@ -145,13 +145,13 @@ int gmx_vanhove(int argc, char *argv[]) real *time, t, invbin = 0, rmax2 = 0, rint2 = 0, d2; real invsbin = 0, matmax, normfac, dt, *tickx, *ticky; char buf[STRLEN], **legend; - real **mat = NULL; - int *pt = NULL, **pr = NULL, *mcount = NULL, *tcount = NULL, *rcount = NULL; + real **mat = nullptr; + int *pt = nullptr, **pr = nullptr, *mcount = nullptr, *tcount = nullptr, *rcount = nullptr; FILE *fp; t_rgb rlo = {1, 1, 1}, rhi = {0, 0, 0}; if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -181,14 +181,14 @@ int gmx_vanhove(int argc, char *argv[]) exit(0); } - read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, boxtop, + read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, boxtop, FALSE); get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname); nalloc = 0; - time = NULL; - sbox = NULL; - sx = NULL; + time = nullptr; + sbox = nullptr; + sx = nullptr; clear_mat(avbox); read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box); @@ -202,8 +202,8 @@ int gmx_vanhove(int argc, char *argv[]) srenew(sbox, nalloc); srenew(sx, nalloc); } - GMX_RELEASE_ASSERT(time != NULL, "Memory allocation failure; time array is NULL"); - GMX_RELEASE_ASSERT(sbox != NULL, "Memory allocation failure; sbox array is NULL"); + GMX_RELEASE_ASSERT(time != nullptr, "Memory allocation failure; time array is NULL"); + GMX_RELEASE_ASSERT(sbox != nullptr, "Memory allocation failure; sbox array is NULL"); time[nfr] = t; copy_mat(box, sbox[nfr]); @@ -481,9 +481,9 @@ int gmx_vanhove(int argc, char *argv[]) xvgrclose(fp); } - do_view(oenv, matfile, NULL); - do_view(oenv, orfile, NULL); - do_view(oenv, otfile, NULL); + do_view(oenv, matfile, nullptr); + do_view(oenv, orfile, nullptr); + do_view(oenv, otfile, nullptr); return 0; } diff --git a/src/gromacs/gmxana/gmx_velacc.cpp b/src/gromacs/gmxana/gmx_velacc.cpp index 6ed7e737f9..1b0c0f41f8 100644 --- a/src/gromacs/gmxana/gmx_velacc.cpp +++ b/src/gromacs/gmxana/gmx_velacc.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -218,15 +218,15 @@ int gmx_velacc(int argc, char *argv[]) rvec mv_mol; /* Array for the correlation function */ real **c1; - real *normm = NULL; + real *normm = nullptr; gmx_output_env_t *oenv; #define NHISTO 360 t_filenm fnm[] = { - { efTRN, "-f", NULL, ffREAD }, - { efTPS, NULL, NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTRN, "-f", nullptr, ffREAD }, + { efTPS, nullptr, nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-o", "vac", ffWRITE }, { efXVG, "-os", "spectrum", ffOPTWR } }; @@ -237,7 +237,7 @@ int gmx_velacc(int argc, char *argv[]) npargs = asize(pa); ppa = add_acf_pargs(&npargs, pa); if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, - NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv)) + NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv)) { sfree(ppa); return 0; @@ -250,7 +250,7 @@ int gmx_velacc(int argc, char *argv[]) if (bTPS) { - bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box, + bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE); get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname); } @@ -274,7 +274,7 @@ int gmx_velacc(int argc, char *argv[]) snew(c1, gnx); for (i = 0; (i < gnx); i++) { - c1[i] = NULL; + c1[i] = nullptr; } read_first_frame(oenv, &status, ftp2fn(efTRN, NFILE, fnm), &fr, TRX_NEED_V); diff --git a/src/gromacs/gmxana/gmx_wham.cpp b/src/gromacs/gmxana/gmx_wham.cpp index 3c20dfe16d..9748824baa 100644 --- a/src/gromacs/gmxana/gmx_wham.cpp +++ b/src/gromacs/gmxana/gmx_wham.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -330,15 +330,15 @@ t_UmbrellaWindow * initUmbrellaWindows(int nwin) snew(win, nwin); for (i = 0; i < nwin; i++) { - win[i].Histo = win[i].cum = 0; - win[i].k = win[i].pos = win[i].z = 0; - win[i].N = win[i].Ntot = 0; - win[i].g = win[i].tau = win[i].tausmooth = 0; - win[i].bContrib = 0; - win[i].ztime = 0; - win[i].forceAv = 0; - win[i].aver = win[i].sigma = 0; - win[i].bsWeight = 0; + win[i].Histo = win[i].cum = nullptr; + win[i].k = win[i].pos = win[i].z = nullptr; + win[i].N = win[i].Ntot = nullptr; + win[i].g = win[i].tau = win[i].tausmooth = nullptr; + win[i].bContrib = nullptr; + win[i].ztime = nullptr; + win[i].forceAv = nullptr; + win[i].aver = win[i].sigma = nullptr; + win[i].bsWeight = nullptr; } return win; } @@ -440,7 +440,7 @@ void read_pdo_header(FILE * file, t_UmbrellaHeader * header, t_UmbrellaOptions * std::istringstream ist; /* line 1 */ - if (fgets(line, 2048, file) == NULL) + if (fgets(line, 2048, file) == nullptr) { gmx_fatal(FARGS, "Error reading header from pdo file\n"); } @@ -458,7 +458,7 @@ void read_pdo_header(FILE * file, t_UmbrellaHeader * header, t_UmbrellaOptions * } /* line 2 */ - if (fgets(line, 2048, file) == NULL) + if (fgets(line, 2048, file) == nullptr) { gmx_fatal(FARGS, "Error reading header from pdo file\n"); } @@ -473,7 +473,7 @@ void read_pdo_header(FILE * file, t_UmbrellaHeader * header, t_UmbrellaOptions * } /* line3 */ - if (fgets(line, 2048, file) == NULL) + if (fgets(line, 2048, file) == nullptr) { gmx_fatal(FARGS, "Error reading header from pdo file\n"); } @@ -481,7 +481,7 @@ void read_pdo_header(FILE * file, t_UmbrellaHeader * header, t_UmbrellaOptions * ist >> Buffer0 >> Buffer1 >> header->nSkip; /* line 4 */ - if (fgets(line, 2048, file) == NULL) + if (fgets(line, 2048, file) == nullptr) { gmx_fatal(FARGS, "Error reading header from pdo file\n"); } @@ -489,7 +489,7 @@ void read_pdo_header(FILE * file, t_UmbrellaHeader * header, t_UmbrellaOptions * ist >> Buffer0 >> Buffer1 >> Buffer2 >> header->Reference; /* line 5 */ - if (fgets(line, 2048, file) == NULL) + if (fgets(line, 2048, file) == nullptr) { gmx_fatal(FARGS, "Error reading header from pdo file\n"); } @@ -504,7 +504,7 @@ void read_pdo_header(FILE * file, t_UmbrellaHeader * header, t_UmbrellaOptions * for (i = 0; i < header->nPull; ++i) { - if (fgets(line, 2048, file) == NULL) + if (fgets(line, 2048, file) == nullptr) { gmx_fatal(FARGS, "Error reading header from pdo file\n"); } @@ -520,7 +520,7 @@ void read_pdo_header(FILE * file, t_UmbrellaHeader * header, t_UmbrellaOptions * } } - if (fgets(line, 2048, file) == NULL) + if (fgets(line, 2048, file) == nullptr) { gmx_fatal(FARGS, "Cannot read from file\n"); } @@ -538,18 +538,18 @@ static char *fgets3(FILE *fp, char ptr[], int *len) char *p; int slen; - if (fgets(ptr, *len-1, fp) == NULL) + if (fgets(ptr, *len-1, fp) == nullptr) { - return NULL; + return nullptr; } p = ptr; - while ((std::strchr(ptr, '\n') == NULL) && (!feof(fp))) + while ((std::strchr(ptr, '\n') == nullptr) && (!feof(fp))) { /* This line is longer than len characters, let's increase len! */ *len += STRLEN; p += STRLEN; srenew(ptr, *len); - if (fgets(p-1, STRLEN, fp) == NULL) + if (fgets(p-1, STRLEN, fp) == nullptr) { break; } @@ -577,13 +577,13 @@ void read_pdo_data(FILE * file, t_UmbrellaHeader * header, int i, inttemp, bins, count, ntot; real minval, maxval, minfound = 1e20, maxfound = -1e20; double temp, time, time0 = 0, dt; - char *ptr = 0; - t_UmbrellaWindow * window = 0; + char *ptr = nullptr; + t_UmbrellaWindow * window = nullptr; gmx_bool timeok, dt_ok = 1; - char *tmpbuf = 0, fmt[256], fmtign[256], fmtlf[5] = "%lf"; + char *tmpbuf = nullptr, fmt[256], fmtign[256], fmtlf[5] = "%lf"; int len = STRLEN, dstep = 1; const int blocklen = 4096; - int *lennow = 0; + int *lennow = nullptr; if (!bGetMinMax) { @@ -605,7 +605,7 @@ void read_pdo_data(FILE * file, t_UmbrellaHeader * header, snew(window->g, window->nPull); snew(window->bsWeight, window->nPull); - window->bContrib = 0; + window->bContrib = nullptr; if (opt->bCalcTauInt) { @@ -613,7 +613,7 @@ void read_pdo_data(FILE * file, t_UmbrellaHeader * header, } else { - window->ztime = 0; + window->ztime = nullptr; } snew(lennow, window->nPull); @@ -629,7 +629,7 @@ void read_pdo_data(FILE * file, t_UmbrellaHeader * header, window->g[i] = 1.; if (opt->bCalcTauInt) { - window->ztime[i] = 0; + window->ztime[i] = nullptr; } } @@ -644,7 +644,7 @@ void read_pdo_data(FILE * file, t_UmbrellaHeader * header, count = 0; snew(tmpbuf, len); - while ( (ptr = fgets3(file, tmpbuf, &len)) != NULL) + while ( (ptr = fgets3(file, tmpbuf, &len)) != nullptr) { trim(ptr); @@ -1264,8 +1264,8 @@ void calc_cumulatives(t_UmbrellaWindow *window, int nWindows, { int i, j, k, nbin; double last; - char *fn = 0, *buf = 0; - FILE *fp = 0; + char *fn = nullptr, *buf = nullptr; + FILE *fp = nullptr; if (opt->bs_verbose) { @@ -1505,7 +1505,7 @@ void create_synthetic_histo(t_UmbrellaWindow *synthWindow, t_UmbrellaWindow *thi void print_histograms(const char *fnhist, t_UmbrellaWindow * window, int nWindows, int bs_index, t_UmbrellaOptions *opt, const char *xlabel) { - char *fn = 0, *buf = 0, title[256]; + char *fn = nullptr, *buf = nullptr, title[256]; FILE *fp; int bins, l, i, j; @@ -1610,7 +1610,7 @@ void do_bootstrapping(const char *fnres, const char* fnprof, const char *fnhist, { t_UmbrellaWindow * synthWindow; double *bsProfile, *bsProfiles_av, *bsProfiles_av2, maxchange = 1e20, tmp, stddev; - int i, j, *randomArray = 0, winid, pullid, ib; + int i, j, *randomArray = nullptr, winid, pullid, ib; int iAllPull, nAllPull, *allPull_winId, *allPull_pullId; FILE *fp; gmx_bool bExact = FALSE; @@ -1829,14 +1829,14 @@ int whaminFileType(char *fn) void read_wham_in(const char *fn, char ***filenamesRet, int *nfilesRet, t_UmbrellaOptions *opt) { - char **filename = 0, tmp[WHAM_MAXFILELEN+2]; + char **filename = nullptr, tmp[WHAM_MAXFILELEN+2]; int nread, sizenow, i, block = 1; FILE *fp; fp = gmx_ffopen(fn, "r"); nread = 0; sizenow = 0; - while (fgets(tmp, sizeof(tmp), fp) != NULL) + while (fgets(tmp, sizeof(tmp), fp) != nullptr) { if (std::strlen(tmp) >= WHAM_MAXFILELEN) { @@ -1870,8 +1870,8 @@ void read_wham_in(const char *fn, char ***filenamesRet, int *nfilesRet, //! Open a file or a pipe to a gzipped file FILE *open_pdo_pipe(const char *fn, t_UmbrellaOptions *opt, gmx_bool *bPipeOpen) { - char Buffer[1024], gunzip[1024], *Path = 0; - FILE *pipe = 0; + char Buffer[1024], gunzip[1024], *Path = nullptr; + FILE *pipe = nullptr; static gmx_bool bFirst = 1; /* gzipped pdo file? */ @@ -1919,7 +1919,7 @@ FILE *open_pdo_pipe(const char *fn, t_UmbrellaOptions *opt, gmx_bool *bPipeOpen) printf("Executing command '%s'\n", Buffer); } #if HAVE_PIPES - if ((pipe = popen(Buffer, "r")) == NULL) + if ((pipe = popen(Buffer, "r")) == nullptr) { gmx_fatal(FARGS, "Unable to open pipe to `%s'\n", Buffer); } @@ -1981,7 +1981,7 @@ void read_pdo_files(char **fn, int nfiles, t_UmbrellaHeader* header, } read_pdo_header(file, header, opt); /* here only determine min and max of this window */ - read_pdo_data(file, header, i, NULL, opt, TRUE, &mintmp, &maxtmp); + read_pdo_data(file, header, i, nullptr, opt, TRUE, &mintmp, &maxtmp); if (maxtmp > opt->max) { opt->max = maxtmp; @@ -2023,7 +2023,7 @@ void read_pdo_files(char **fn, int nfiles, t_UmbrellaHeader* header, file = open_pdo_pipe(fn[i], opt, &bPipeOpen); read_pdo_header(file, header, opt); /* load data into window */ - read_pdo_data(file, header, i, window, opt, FALSE, NULL, NULL); + read_pdo_data(file, header, i, window, opt, FALSE, nullptr, nullptr); if ((window+i)->Ntot[0] == 0) { fprintf(stderr, "\nWARNING, no data points read from file %s (check -b option)\n", fn[i]); @@ -2057,7 +2057,7 @@ void read_tpr_header(const char *fn, t_UmbrellaHeader* header, t_UmbrellaOptions static int first = 1; /* printf("Reading %s \n",fn); */ - read_tpx_state(fn, ir, &state, NULL); + read_tpx_state(fn, ir, &state, nullptr); if (!ir->bPull) { @@ -2108,7 +2108,7 @@ void read_tpr_header(const char *fn, t_UmbrellaHeader* header, t_UmbrellaOptions bool geometryIsSet = false; for (int i = 0; i < ir->pull->ncoord; i++) { - if (coordsel == NULL || coordsel->bUse[i]) + if (coordsel == nullptr || coordsel->bUse[i]) { if (header->pcrd[i].pull_type != epullUMBRELLA) { @@ -2168,7 +2168,7 @@ void read_tpr_header(const char *fn, t_UmbrellaHeader* header, t_UmbrellaOptions maxlen+1); for (int i = 0; i < ir->pull->ncoord; i++) { - bool use = (coordsel == NULL || coordsel->bUse[i]); + bool use = (coordsel == nullptr || coordsel->bUse[i]); printf(fmt, epullg_names[header->pcrd[i].geometry], header->pcrd[i].k, header->pcrd[i].init_dist, int2YN(header->pcrd[i].dim[XX]), int2YN(header->pcrd[i].dim[YY]), int2YN(header->pcrd[i].dim[ZZ]), @@ -2205,14 +2205,14 @@ void read_pull_xf(const char *fn, t_UmbrellaHeader * header, gmx_bool bGetMinMax, real *mintmp, real *maxtmp, t_coordselection *coordsel) { - double **y = 0, pos = 0., t, force, time0 = 0., dt; + double **y = nullptr, pos = 0., t, force, time0 = 0., dt; int ny, nt, bins, ibin, i, g, gUsed, dstep = 1; int nColExpect, ntot, column; real min, max, minfound = 1e20, maxfound = -1e20; gmx_bool dt_ok, timeok; const char *quantity; const int blocklen = 4096; - int *lennow = 0; + int *lennow = nullptr; static gmx_bool bFirst = TRUE; /* @@ -2334,7 +2334,7 @@ void read_pull_xf(const char *fn, t_UmbrellaHeader * header, snew(window->Ntot, window->nPull); snew(window->g, window->nPull); snew(window->bsWeight, window->nPull); - window->bContrib = 0; + window->bContrib = nullptr; if (opt->bCalcTauInt) { @@ -2342,7 +2342,7 @@ void read_pull_xf(const char *fn, t_UmbrellaHeader * header, } else { - window->ztime = NULL; + window->ztime = nullptr; } snew(lennow, window->nPull); @@ -2357,7 +2357,7 @@ void read_pull_xf(const char *fn, t_UmbrellaHeader * header, if (opt->bCalcTauInt) { - window->ztime[g] = NULL; + window->ztime[g] = nullptr; } } @@ -2554,13 +2554,13 @@ void read_tpr_pullxf_files(char **fnTprs, char **fnPull, int nfiles, { gmx_fatal(FARGS, "Expected the %d'th file in input file to be a tpr file\n", i); } - read_tpr_header(fnTprs[i], header, opt, (opt->nCoordsel > 0) ? &opt->coordsel[i] : NULL); + read_tpr_header(fnTprs[i], header, opt, (opt->nCoordsel > 0) ? &opt->coordsel[i] : nullptr); if (whaminFileType(fnPull[i]) != whamin_pullxf) { gmx_fatal(FARGS, "Expected the %d'th file in input file to be a xvg (pullx/pullf) file\n", i); } - read_pull_xf(fnPull[i], header, NULL, opt, TRUE, &mintmp, &maxtmp, - (opt->nCoordsel > 0) ? &opt->coordsel[i] : NULL); + read_pull_xf(fnPull[i], header, nullptr, opt, TRUE, &mintmp, &maxtmp, + (opt->nCoordsel > 0) ? &opt->coordsel[i] : nullptr); if (maxtmp > opt->max) { opt->max = maxtmp; @@ -2587,13 +2587,13 @@ void read_tpr_pullxf_files(char **fnTprs, char **fnPull, int nfiles, { gmx_fatal(FARGS, "Expected the %d'th file in input file to be a tpr file\n", i); } - read_tpr_header(fnTprs[i], header, opt, (opt->nCoordsel > 0) ? &opt->coordsel[i] : NULL); + read_tpr_header(fnTprs[i], header, opt, (opt->nCoordsel > 0) ? &opt->coordsel[i] : nullptr); if (whaminFileType(fnPull[i]) != whamin_pullxf) { gmx_fatal(FARGS, "Expected the %d'th file in input file to be a xvg (pullx/pullf) file\n", i); } - read_pull_xf(fnPull[i], header, window+i, opt, FALSE, NULL, NULL, - (opt->nCoordsel > 0) ? &opt->coordsel[i] : NULL); + read_pull_xf(fnPull[i], header, window+i, opt, FALSE, nullptr, nullptr, + (opt->nCoordsel > 0) ? &opt->coordsel[i] : nullptr); if (window[i].Ntot[0] == 0) { fprintf(stderr, "\nWARNING, no data points read from file %s (check -b option)\n", fnPull[i]); @@ -2725,7 +2725,7 @@ void calcIntegratedAutocorrelationTimes(t_UmbrellaWindow *window, int nwins, int i, ig, ncorr, ntot, j, k, *count, restart; real *corr, c0, dt, tmp; real *ztime, av, tausteps; - FILE *fp, *fpcorr = 0; + FILE *fp, *fpcorr = nullptr; if (opt->verbose) { @@ -3169,17 +3169,17 @@ void readPullCoordSelection(t_UmbrellaOptions *opt, char **fnTpr, int nTpr) { FILE *fp; int i, iline, n, len = STRLEN, temp; - char *ptr = 0, *tmpbuf = 0; + char *ptr = nullptr, *tmpbuf = nullptr; char fmt[1024], fmtign[1024]; int block = 1, sizenow; fp = gmx_ffopen(opt->fnCoordSel, "r"); - opt->coordsel = NULL; + opt->coordsel = nullptr; snew(tmpbuf, len); sizenow = 0; iline = 0; - while ( (ptr = fgets3(fp, tmpbuf, &len)) != NULL) + while ( (ptr = fgets3(fp, tmpbuf, &len)) != nullptr) { trim(ptr); n = wordcount(ptr); @@ -3406,9 +3406,9 @@ int gmx_wham(int argc, char *argv[]) "the histograms." }; - const char *en_unit[] = {NULL, "kJ", "kCal", "kT", NULL}; - const char *en_unit_label[] = {"", "E (kJ mol\\S-1\\N)", "E (kcal mol\\S-1\\N)", "E (kT)", NULL}; - const char *en_bsMethod[] = { NULL, "b-hist", "hist", "traj", "traj-gauss", NULL }; + const char *en_unit[] = {nullptr, "kJ", "kCal", "kT", nullptr}; + const char *en_unit_label[] = {"", "E (kJ mol\\S-1\\N)", "E (kcal mol\\S-1\\N)", "E (kT)", nullptr}; + const char *en_bsMethod[] = { nullptr, "b-hist", "hist", "traj", "traj-gauss", nullptr }; static t_UmbrellaOptions opt; t_pargs pa[] = { @@ -3492,7 +3492,7 @@ int gmx_wham(int argc, char *argv[]) int i, j, l, nfiles, nwins, nfiles2; t_UmbrellaHeader header; - t_UmbrellaWindow * window = NULL; + t_UmbrellaWindow * window = nullptr; double *profile, maxchange = 1e20; gmx_bool bMinSet, bMaxSet, bAutoSet, bExact = FALSE; char **fninTpr, **fninPull, **fninPdo; @@ -3511,7 +3511,7 @@ int gmx_wham(int argc, char *argv[]) opt.max = 0; opt.bAuto = TRUE; opt.nCoordsel = 0; - opt.coordsel = NULL; + opt.coordsel = nullptr; /* bootstrapping stuff */ opt.nBootStrap = 0; @@ -3537,7 +3537,7 @@ int gmx_wham(int argc, char *argv[]) opt.stepUpdateContrib = 100; if (!parse_common_args(&argc, argv, 0, - NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &opt.oenv)) + NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &opt.oenv)) { return 0; } @@ -3627,7 +3627,7 @@ int gmx_wham(int argc, char *argv[]) } /* Read file that selects the pull group to be used */ - if (opt.fnCoordSel != NULL) + if (opt.fnCoordSel != nullptr) { readPullCoordSelection(&opt, fninTpr, nfiles); } @@ -3637,7 +3637,7 @@ int gmx_wham(int argc, char *argv[]) } else { /* reading pdo files */ - if (opt.fnCoordSel != NULL) + if (opt.fnCoordSel != nullptr) { gmx_fatal(FARGS, "Reading a -is file is not supported with PDO input files.\n" "Use awk or a similar tool to pick the required pull groups from your PDO files\n"); diff --git a/src/gromacs/gmxana/gmx_wheel.cpp b/src/gromacs/gmxana/gmx_wheel.cpp index 90d497be97..669b75eb7a 100644 --- a/src/gromacs/gmxana/gmx_wheel.cpp +++ b/src/gromacs/gmxana/gmx_wheel.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -224,7 +224,7 @@ int gmx_wheel(int argc, char *argv[]) gmx_output_env_t *oenv; static real rot0 = 0; static gmx_bool bNum = TRUE; - static char *title = NULL; + static char *title = nullptr; static int r0 = 1; t_pargs pa [] = { { "-r0", FALSE, etINT, {&r0}, @@ -237,8 +237,8 @@ int gmx_wheel(int argc, char *argv[]) "Toggle numbers" } }; t_filenm fnm[] = { - { efDAT, "-f", NULL, ffREAD }, - { efEPS, "-o", NULL, ffWRITE } + { efDAT, "-f", nullptr, ffREAD }, + { efEPS, "-o", nullptr, ffWRITE } }; #define NFILE asize(fnm) @@ -246,7 +246,7 @@ int gmx_wheel(int argc, char *argv[]) char **resnm; if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -255,12 +255,12 @@ int gmx_wheel(int argc, char *argv[]) { if (std::strcmp(argv[i], "-r0") == 0) { - r0 = std::strtol(argv[++i], NULL, 10); + r0 = std::strtol(argv[++i], nullptr, 10); fprintf(stderr, "First residue is %d\n", r0); } else if (std::strcmp(argv[i], "-rot0") == 0) { - rot0 = strtod(argv[++i], NULL); + rot0 = strtod(argv[++i], nullptr); fprintf(stderr, "Initial rotation is %g\n", rot0); } else if (std::strcmp(argv[i], "-T") == 0) diff --git a/src/gromacs/gmxana/gmx_xpm2ps.cpp b/src/gromacs/gmxana/gmx_xpm2ps.cpp index 49c46ba775..cacfcce28b 100644 --- a/src/gromacs/gmxana/gmx_xpm2ps.cpp +++ b/src/gromacs/gmxana/gmx_xpm2ps.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -112,9 +112,9 @@ enum { void get_params(const char *mpin, const char *mpout, t_psrec *psr) { - static const char *gmx_bools[BOOL_NR+1] = { "no", "yes", NULL }; + static const char *gmx_bools[BOOL_NR+1] = { "no", "yes", nullptr }; /* this must correspond to t_rgb *linecolors[] below */ - static const char *colors[] = { "none", "black", "white", NULL }; + static const char *colors[] = { "none", "black", "white", nullptr }; warninp_t wi; t_inpfile *inp; const char *tmp; @@ -122,13 +122,13 @@ void get_params(const char *mpin, const char *mpout, t_psrec *psr) wi = init_warning(FALSE, 0); - if (mpin != NULL) + if (mpin != nullptr) { inp = read_inpfile(mpin, &ninp, wi); } else { - inp = NULL; + inp = nullptr; } ETYPE("black&white", psr->bw, gmx_bools); RTYPE("linewidth", psr->linewidth, 1.0); @@ -174,7 +174,7 @@ void get_params(const char *mpin, const char *mpout, t_psrec *psr) check_warning_error(wi, FARGS); - if (mpout != NULL) + if (mpout != nullptr) { write_inpfile(mpout, ninp, inp, TRUE, wi); } @@ -188,7 +188,7 @@ t_rgb red = { 1, 0, 0 }; t_rgb blue = { 0, 0, 1 }; #define BLACK (&black) /* this must correspond to *colors[] in get_params */ -t_rgb *linecolors[] = { NULL, &black, &white, NULL }; +t_rgb *linecolors[] = { nullptr, &black, &white, nullptr }; gmx_bool diff_maps(int nmap1, t_mapping *map1, int nmap2, t_mapping *map2) { @@ -278,7 +278,7 @@ void leg_continuous(t_psdata ps, real x0, real x, real y0, char *label, boxxh = fontsize; } - GMX_RELEASE_ASSERT(map != NULL, "NULL map array provided to leg_continuous()"); + GMX_RELEASE_ASSERT(map != nullptr, "NULL map array provided to leg_continuous()"); /* LANDSCAPE */ xx0 = x0-((nmap-mapoffset)*boxxh)/2.0; @@ -682,7 +682,7 @@ void xpm_mat(const char *outf, int nmat, t_matrix *mat, t_matrix *mat2, FILE *out; int i, x, y, col; int nmap; - t_mapping *map = NULL; + t_mapping *map = nullptr; out = gmx_ffopen(outf, "w"); @@ -794,7 +794,7 @@ void ps_mat(const char *outf, int nmat, t_matrix mat[], t_matrix mat2[], real x0, y0, xx; real w, h, dw, dh; int nmap1 = 0, nmap2 = 0, leg_nmap; - t_mapping *map1 = NULL, *map2 = NULL, *leg_map; + t_mapping *map1 = nullptr, *map2 = nullptr, *leg_map; gmx_bool bMap1, bNextMap1, bDiscrete; /* memory leak: */ @@ -1005,7 +1005,7 @@ void ps_mat(const char *outf, int nmat, t_matrix mat[], t_matrix mat2[], { ps_comment(out, "Now it's legend time!"); ps_linewidth(out, static_cast(psr->linewidth)); - if (mat2 == NULL || elegend != elSecond) + if (mat2 == nullptr || elegend != elSecond) { bDiscrete = mat[0].bDiscrete; legend = mat[0].legend; @@ -1052,7 +1052,7 @@ void make_axis_labels(int nmat, t_matrix *mat) for (i = 0; (i < nmat); i++) { /* Make labels for x axis */ - if (mat[i].axis_x == NULL) + if (mat[i].axis_x == nullptr) { snew(mat[i].axis_x, mat[i].nx); for (j = 0; (j < mat[i].nx); j++) @@ -1061,7 +1061,7 @@ void make_axis_labels(int nmat, t_matrix *mat) } } /* Make labels for y axis */ - if (mat[i].axis_y == NULL) + if (mat[i].axis_y == nullptr) { snew(mat[i].axis_y, mat[i].ny); for (j = 0; (j < mat[i].ny); j++) @@ -1186,13 +1186,13 @@ void write_combined_matrix(int ecombine, const char *fn, " not match.\n", k, mat1[k].nx, mat1[k].ny, mat2[k].nx, mat2[k].ny); } printf("Combining two %dx%d matrices\n", mat1[k].nx, mat1[k].ny); - rmat1 = matrix2real(&mat1[k], NULL); - rmat2 = matrix2real(&mat2[k], NULL); - if (NULL == rmat1 || NULL == rmat2) + rmat1 = matrix2real(&mat1[k], nullptr); + rmat2 = matrix2real(&mat2[k], nullptr); + if (nullptr == rmat1 || nullptr == rmat2) { gmx_fatal(FARGS, "Could not extract real data from %s xpm matrices. Note that, e.g.,\n" "g_rms and g_mdmat provide such data, but not do_dssp.\n", - (NULL == rmat1 && NULL == rmat2) ? "both" : "one of the" ); + (nullptr == rmat1 && nullptr == rmat2) ? "both" : "one of the" ); } rlo = 1e38; rhi = -1e38; @@ -1295,13 +1295,13 @@ void do_mat(int nmat, t_matrix *mat, t_matrix *mat2, zero_lines(nmat, mat, mat); } - if (epsfile != NULL) + if (epsfile != nullptr) { ps_mat(epsfile, nmat, mat, mat2, bFrame, bDiag, bFirstDiag, bTitle, bTitleOnce, bYonce, elegend, size, boxx, boxy, m2p, m2pout, mapoffset); } - if (xpmfile != NULL) + if (xpmfile != nullptr) { xpm_mat(xpmfile, nmat, mat, mat2, bDiag, bFirstDiag); } @@ -1433,9 +1433,9 @@ int gmx_xpm2ps(int argc, char *argv[]) }; gmx_output_env_t *oenv; - const char *fn, *epsfile = NULL, *xpmfile = NULL; + const char *fn, *epsfile = nullptr, *xpmfile = nullptr; int i, nmat, nmat2, etitle, elegend, ediag, erainbow, ecombine; - t_matrix *mat = NULL, *mat2 = NULL; + t_matrix *mat = nullptr, *mat2 = nullptr; gmx_bool bTitle, bTitleOnce, bDiag, bFirstDiag, bGrad; static gmx_bool bFrame = TRUE, bZeroLine = FALSE, bYonce = FALSE; static real size = 400, boxx = 0, boxy = 0, cmin = 0, cmax = 0; @@ -1443,20 +1443,20 @@ int gmx_xpm2ps(int argc, char *argv[]) enum { etSel, etTop, etOnce, etYlabel, etNone, etNR }; - const char *title[] = { NULL, "top", "once", "ylabel", "none", NULL }; + const char *title[] = { nullptr, "top", "once", "ylabel", "none", nullptr }; /* MUST correspond to enum elXxx as defined at top of file */ - const char *legend[] = { NULL, "both", "first", "second", "none", NULL }; + const char *legend[] = { nullptr, "both", "first", "second", "none", nullptr }; enum { edSel, edFirst, edSecond, edNone, edNR }; - const char *diag[] = { NULL, "first", "second", "none", NULL }; + const char *diag[] = { nullptr, "first", "second", "none", nullptr }; enum { erSel, erNo, erBlue, erRed, erNR }; - const char *rainbow[] = { NULL, "no", "blue", "red", NULL }; + const char *rainbow[] = { nullptr, "no", "blue", "red", nullptr }; /* MUST correspond to enum ecXxx as defined at top of file */ const char *combine[] = { - NULL, "halves", "add", "sub", "mult", "div", NULL + nullptr, "halves", "add", "sub", "mult", "div", nullptr }; static int skip = 1, mapoffset = 0; t_pargs pa[] = { @@ -1487,18 +1487,18 @@ int gmx_xpm2ps(int argc, char *argv[]) }; #define NPA asize(pa) t_filenm fnm[] = { - { efXPM, "-f", NULL, ffREAD }, + { efXPM, "-f", nullptr, ffREAD }, { efXPM, "-f2", "root2", ffOPTRD }, - { efM2P, "-di", NULL, ffLIBOPTRD }, + { efM2P, "-di", nullptr, ffLIBOPTRD }, { efM2P, "-do", "out", ffOPTWR }, - { efEPS, "-o", NULL, ffOPTWR }, - { efXPM, "-xpm", NULL, ffOPTWR } + { efEPS, "-o", nullptr, ffOPTWR }, + { efXPM, "-xpm", nullptr, ffOPTWR } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW, NFILE, fnm, NPA, pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -1524,7 +1524,7 @@ int gmx_xpm2ps(int argc, char *argv[]) epsfile = ftp2fn_null(efEPS, NFILE, fnm); xpmfile = opt2fn_null("-xpm", NFILE, fnm); - if (epsfile == NULL && xpmfile == NULL) + if (epsfile == nullptr && xpmfile == nullptr) { if (ecombine != ecHalves) { @@ -1541,7 +1541,7 @@ int gmx_xpm2ps(int argc, char *argv[]) "WARNING: can only write result of arithmetic combination " "of two matrices to .xpm file\n" " file %s will not be written\n", epsfile); - epsfile = NULL; + epsfile = nullptr; } bDiag = ediag != edNone; @@ -1603,7 +1603,7 @@ int gmx_xpm2ps(int argc, char *argv[]) } } - if ((mat2 == NULL) && (elegend != elNone)) + if ((mat2 == nullptr) && (elegend != elNone)) { elegend = elFirst; } @@ -1611,8 +1611,8 @@ int gmx_xpm2ps(int argc, char *argv[]) if (ecombine && ecombine != ecHalves) { write_combined_matrix(ecombine, xpmfile, nmat, mat, mat2, - opt2parg_bSet("-cmin", NPA, pa) ? &cmin : NULL, - opt2parg_bSet("-cmax", NPA, pa) ? &cmax : NULL); + opt2parg_bSet("-cmin", NPA, pa) ? &cmin : nullptr, + opt2parg_bSet("-cmax", NPA, pa) ? &cmax : nullptr); } else { diff --git a/src/gromacs/gmxana/hxprops.cpp b/src/gromacs/gmxana/hxprops.cpp index 2d09699aee..497281d13b 100644 --- a/src/gromacs/gmxana/hxprops.cpp +++ b/src/gromacs/gmxana/hxprops.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -200,7 +200,7 @@ real ca_phi(int gnx, int index[], rvec x[]) ak = index[i+2]; al = index[i+3]; phi = RAD2DEG* - dih_angle(x[ai], x[aj], x[ak], x[al], NULL, + dih_angle(x[ai], x[aj], x[ak], x[al], nullptr, r_ij, r_kj, r_kl, m, n, &sign, &t1, &t2, &t3); phitot += phi; @@ -513,11 +513,11 @@ void calc_hxprops(int nres, t_bb bb[], const rvec x[]) } bb[i].phi = RAD2DEG* - dih_angle(x[bb[i].Cprev], x[bb[i].N], x[bb[i].CA], x[bb[i].C], NULL, + dih_angle(x[bb[i].Cprev], x[bb[i].N], x[bb[i].CA], x[bb[i].C], nullptr, r_ij, r_kj, r_kl, m, n, &sign, &t1, &t2, &t3); bb[i].psi = RAD2DEG* - dih_angle(x[bb[i].N], x[bb[i].CA], x[bb[i].C], x[bb[i].Nnext], NULL, + dih_angle(x[bb[i].N], x[bb[i].CA], x[bb[i].C], x[bb[i].Nnext], nullptr, r_ij, r_kj, r_kl, m, n, &sign, &t1, &t2, &t3); bb[i].pprms2 = gmx::square(bb[i].phi-PHI_AHX)+gmx::square(bb[i].psi-PSI_AHX); diff --git a/src/gromacs/gmxana/nrama.cpp b/src/gromacs/gmxana/nrama.cpp index 5759488a54..7a95fe66a4 100644 --- a/src/gromacs/gmxana/nrama.cpp +++ b/src/gromacs/gmxana/nrama.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -76,7 +76,7 @@ static void calc_dihs(t_xrama *xr) rvec r_ij, r_kj, r_kl, m, n; real sign; t_dih *dd; - gmx_rmpbc_t gpbc = NULL; + gmx_rmpbc_t gpbc = nullptr; gpbc = gmx_rmpbc_init(xr->idef, xr->ePBC, xr->natoms); gmx_rmpbc(gpbc, xr->natoms, xr->box, xr->x); @@ -87,7 +87,7 @@ static void calc_dihs(t_xrama *xr) dd = &(xr->dih[i]); dd->ang = dih_angle(xr->x[dd->ai[0]], xr->x[dd->ai[1]], xr->x[dd->ai[2]], xr->x[dd->ai[3]], - NULL, + nullptr, r_ij, r_kj, r_kl, m, n, &sign, &t1, &t2, &t3); } } diff --git a/src/gromacs/gmxana/nsfactor.cpp b/src/gromacs/gmxana/nsfactor.cpp index 4b7e7356ca..d05c9b6162 100644 --- a/src/gromacs/gmxana/nsfactor.cpp +++ b/src/gromacs/gmxana/nsfactor.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -153,7 +153,7 @@ gmx_neutron_atomic_structurefactors_t *gmx_neutronstructurefactors_init(const ch gmx_sans_t *gmx_sans_init (const t_topology *top, gmx_neutron_atomic_structurefactors_t *gnsf) { - gmx_sans_t *gsans = NULL; + gmx_sans_t *gsans = nullptr; int i, j; /* Try to assing scattering length from nsfactor.dat */ snew(gsans, 1); @@ -201,7 +201,7 @@ gmx_radial_distribution_histogram_t *calc_radial_distribution_histogram ( real mcover, unsigned int seed) { - gmx_radial_distribution_histogram_t *pr = NULL; + gmx_radial_distribution_histogram_t *pr = nullptr; rvec dist; double rmax; int i, j; @@ -209,7 +209,7 @@ gmx_radial_distribution_histogram_t *calc_radial_distribution_histogram ( double **tgr; int tid; int nthreads; - gmx::DefaultRandomEngine *trng = NULL; + gmx::DefaultRandomEngine *trng = nullptr; #endif gmx_int64_t mc = 0, mc_max; gmx::DefaultRandomEngine rng(seed); @@ -369,7 +369,7 @@ gmx_radial_distribution_histogram_t *calc_radial_distribution_histogram ( gmx_static_structurefactor_t *convert_histogram_to_intensity_curve (gmx_radial_distribution_histogram_t *pr, double start_q, double end_q, double q_step) { - gmx_static_structurefactor_t *sq = NULL; + gmx_static_structurefactor_t *sq = nullptr; int i, j; /* init data */ snew(sq, 1); diff --git a/src/gromacs/gmxana/princ.cpp b/src/gromacs/gmxana/princ.cpp index 7972fe364b..e7da5b98ef 100644 --- a/src/gromacs/gmxana/princ.cpp +++ b/src/gromacs/gmxana/princ.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -306,10 +306,10 @@ void orient_princ(const t_atoms *atoms, int isize, const int *index, trans[ZZ][m] = -trans[ZZ][m]; } } - rotate_atoms(natoms, NULL, x, trans); + rotate_atoms(natoms, nullptr, x, trans); if (v) { - rotate_atoms(natoms, NULL, v, trans); + rotate_atoms(natoms, nullptr, v, trans); } for (i = 0; i < natoms; i++) diff --git a/src/gromacs/gmxana/sfactor.cpp b/src/gromacs/gmxana/sfactor.cpp index f7d5c314d3..c0f7e44ee0 100644 --- a/src/gromacs/gmxana/sfactor.cpp +++ b/src/gromacs/gmxana/sfactor.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -282,7 +282,7 @@ extern gmx_structurefactors_t *gmx_structurefactors_init(const char *datfn) snew(gsf->b, nralloc); snew(gsf->c, nralloc); snew(gsf->p, nralloc); - gsf->n = NULL; + gsf->n = nullptr; gsf->nratoms = line_no; while (get_a_line(fp, line, STRLEN)) { @@ -475,7 +475,7 @@ extern int do_scattering_intensity (const char* fnTPS, const char* fnNDX, sf->energy = energy; /* Read the topology informations */ - read_tps_conf (fnTPS, &top, &ePBC, &xtop, NULL, box, TRUE); + read_tps_conf (fnTPS, &top, &ePBC, &xtop, nullptr, box, TRUE); sfree (xtop); /* groups stuff... */ diff --git a/src/gromacs/gmxlib/network.cpp b/src/gromacs/gmxlib/network.cpp index f6ddd9a1f0..920f3fd7e1 100644 --- a/src/gromacs/gmxlib/network.cpp +++ b/src/gromacs/gmxlib/network.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -85,8 +85,8 @@ t_commrec *init_commrec() #if GMX_LIB_MPI gmx_fill_commrec_from_mpi(cr); #else - cr->mpi_comm_mysim = NULL; - cr->mpi_comm_mygroup = NULL; + cr->mpi_comm_mysim = nullptr; + cr->mpi_comm_mygroup = nullptr; cr->nnodes = 1; cr->sim_nodeid = 0; cr->nodeid = cr->sim_nodeid; @@ -113,7 +113,7 @@ t_commrec *init_commrec() static void done_mpi_in_place_buf(mpi_in_place_buf_t *buf) { - if (NULL != buf) + if (nullptr != buf) { sfree(buf->ibuf); sfree(buf->libuf); @@ -125,12 +125,12 @@ static void done_mpi_in_place_buf(mpi_in_place_buf_t *buf) void done_commrec(t_commrec *cr) { - if (NULL != cr->dd) + if (nullptr != cr->dd) { // TODO: implement // done_domdec(cr->dd); } - if (NULL != cr->ms) + if (nullptr != cr->ms) { done_mpi_in_place_buf(cr->ms->mpb); sfree(cr->ms); @@ -158,7 +158,7 @@ t_commrec *reinitialize_commrec_for_this_thread(const t_commrec gmx_unused *cro) return cr; #else - return NULL; + return nullptr; #endif } @@ -219,7 +219,7 @@ void gmx_setup_nodecomm(FILE gmx_unused *fplog, t_commrec *cr) ng, ni); } - if (getenv("GMX_NO_NODECOMM") == NULL && + if (getenv("GMX_NO_NODECOMM") == nullptr && ((ng > 1 && ng < n) || (ni > 1 && ni < n))) { nc->bUse = TRUE; @@ -386,7 +386,7 @@ void gmx_sumd(int gmx_unused nr, double gmx_unused r[], const t_commrec gmx_unus { /* This is here because of the silly MPI specification that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */ - MPI_Reduce(r, NULL, nr, MPI_DOUBLE, MPI_SUM, 0, cr->nc.comm_intra); + MPI_Reduce(r, nullptr, nr, MPI_DOUBLE, MPI_SUM, 0, cr->nc.comm_intra); } MPI_Bcast(r, nr, MPI_DOUBLE, 0, cr->nc.comm_intra); } @@ -449,7 +449,7 @@ void gmx_sumf(int gmx_unused nr, float gmx_unused r[], const t_commrec gmx_unuse { /* This is here because of the silly MPI specification that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */ - MPI_Reduce(r, NULL, nr, MPI_FLOAT, MPI_SUM, 0, cr->nc.comm_intra); + MPI_Reduce(r, nullptr, nr, MPI_FLOAT, MPI_SUM, 0, cr->nc.comm_intra); } MPI_Bcast(r, nr, MPI_FLOAT, 0, cr->nc.comm_intra); } @@ -509,7 +509,7 @@ void gmx_sumi(int gmx_unused nr, int gmx_unused r[], const t_commrec gmx_unused { /* This is here because of the silly MPI specification that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */ - MPI_Reduce(r, NULL, nr, MPI_INT, MPI_SUM, 0, cr->nc.comm_intra); + MPI_Reduce(r, nullptr, nr, MPI_INT, MPI_SUM, 0, cr->nc.comm_intra); } MPI_Bcast(r, nr, MPI_INT, 0, cr->nc.comm_intra); } @@ -569,7 +569,7 @@ void gmx_sumli(int gmx_unused nr, gmx_int64_t gmx_unused r[], const t_commrec gm { /* This is here because of the silly MPI specification that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */ - MPI_Reduce(r, NULL, nr, MPI_INT64_T, MPI_SUM, 0, cr->nc.comm_intra); + MPI_Reduce(r, nullptr, nr, MPI_INT64_T, MPI_SUM, 0, cr->nc.comm_intra); } MPI_Bcast(r, nr, MPI_INT64_T, 0, cr->nc.comm_intra); } @@ -732,7 +732,7 @@ void gmx_sumli_sim(int gmx_unused nr, gmx_int64_t gmx_unused r[], const gmx_mult const char *opt2fn_master(const char *opt, int nfile, const t_filenm fnm[], t_commrec *cr) { - return SIMMASTER(cr) ? opt2fn(opt, nfile, fnm) : NULL; + return SIMMASTER(cr) ? opt2fn(opt, nfile, fnm) : nullptr; } void gmx_fatal_collective(int f_errno, const char *file, int line, diff --git a/src/gromacs/gmxlib/nonbonded/nb_free_energy.cpp b/src/gromacs/gmxlib/nonbonded/nb_free_energy.cpp index 97d1e7e081..db50f9b3c5 100644 --- a/src/gromacs/gmxlib/nonbonded/nb_free_energy.cpp +++ b/src/gromacs/gmxlib/nonbonded/nb_free_energy.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -99,7 +99,7 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict nlist, const real * shiftvec; real * fshift; real tabscale = 0; - const real * VFtab = NULL; + const real * VFtab = nullptr; const real * x; real * f; real facel, krf, crf; @@ -436,7 +436,7 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict nlist, tj[STATE_A] = ntiA+2*typeA[jnr]; tj[STATE_B] = ntiB+2*typeB[jnr]; - if (nlist->excl_fep == NULL || nlist->excl_fep[k]) + if (nlist->excl_fep == nullptr || nlist->excl_fep[k]) { c6[STATE_A] = nbfp[tj[STATE_A]]; c6[STATE_B] = nbfp[tj[STATE_B]]; diff --git a/src/gromacs/gmxlib/nonbonded/nb_generic.cpp b/src/gromacs/gmxlib/nonbonded/nb_generic.cpp index ffcfe55499..70244a9f68 100644 --- a/src/gromacs/gmxlib/nonbonded/nb_generic.cpp +++ b/src/gromacs/gmxlib/nonbonded/nb_generic.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -117,7 +117,7 @@ gmx_nb_generic_kernel(t_nblist * nlist, else { tabscale = 0; - VFtab = NULL; + VFtab = nullptr; } ewtab = fr->ic->tabq_coul_FDV0; ewtabscale = fr->ic->tabq_scale; diff --git a/src/gromacs/gmxlib/nonbonded/nb_generic_cg.cpp b/src/gromacs/gmxlib/nonbonded/nb_generic_cg.cpp index b93f586136..9bddb02823 100644 --- a/src/gromacs/gmxlib/nonbonded/nb_generic_cg.cpp +++ b/src/gromacs/gmxlib/nonbonded/nb_generic_cg.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -108,7 +108,7 @@ gmx_nb_generic_cg_kernel(t_nblist * nlist, else { tabscale = 0; - VFtab = NULL; + VFtab = nullptr; } /* avoid compiler warnings for cases that cannot happen */ diff --git a/src/gromacs/gmxlib/nonbonded/nb_kernel.cpp b/src/gromacs/gmxlib/nonbonded/nb_kernel.cpp index 073711d295..2ee2c6b845 100644 --- a/src/gromacs/gmxlib/nonbonded/nb_kernel.cpp +++ b/src/gromacs/gmxlib/nonbonded/nb_kernel.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -45,9 +45,9 @@ /* Static data structures to find kernels */ -static nb_kernel_info_t * kernel_list = NULL; +static nb_kernel_info_t * kernel_list = nullptr; static unsigned int kernel_list_size = 0; -static int * kernel_list_hash = NULL; +static int * kernel_list_hash = nullptr; static unsigned int kernel_list_hash_size = 0; static unsigned int @@ -123,7 +123,7 @@ void nb_kernel_list_hash_destroy() { sfree(kernel_list_hash); - kernel_list_hash = NULL; + kernel_list_hash = nullptr; kernel_list_hash_size = 0; } @@ -145,7 +145,7 @@ nb_kernel_list_findkernel(FILE gmx_unused * log, if (kernel_list_hash_size == 0) { - return NULL; + return nullptr; } index = nb_kernel_hash_func(arch, @@ -157,7 +157,7 @@ nb_kernel_list_findkernel(FILE gmx_unused * log, other, vf) % kernel_list_hash_size; - kernelinfo_ptr = NULL; + kernelinfo_ptr = nullptr; while ( (i = kernel_list_hash[index]) != -1) { if (!gmx_strcasecmp_min(kernel_list[i].architecture, arch) && @@ -175,7 +175,7 @@ nb_kernel_list_findkernel(FILE gmx_unused * log, index = (index+1) % kernel_list_hash_size; } - if (debug && kernelinfo_ptr != NULL) + if (debug && kernelinfo_ptr != nullptr) { fprintf(debug, "NB kernel %s() with architecture '%s' used for neighborlist with\n" @@ -187,5 +187,5 @@ nb_kernel_list_findkernel(FILE gmx_unused * log, } /* If we did not find any kernel the pointer will still be NULL */ - return (kernelinfo_ptr != NULL) ? kernelinfo_ptr->kernelptr : NULL; + return (kernelinfo_ptr != nullptr) ? kernelinfo_ptr->kernelptr : nullptr; } diff --git a/src/gromacs/gmxlib/nonbonded/nonbonded.cpp b/src/gromacs/gmxlib/nonbonded/nonbonded.cpp index 90814968c8..2d683c34cb 100644 --- a/src/gromacs/gmxlib/nonbonded/nonbonded.cpp +++ b/src/gromacs/gmxlib/nonbonded/nonbonded.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -117,7 +117,7 @@ gmx_nonbonded_setup(t_forcerec * fr, /* Add the generic kernels to the structure stored statically in nb_kernel.c */ nb_kernel_list_add_kernels(kernellist_c, kernellist_c_size); - if (!(fr != NULL && fr->use_simd_kernels == FALSE)) + if (!(fr != nullptr && fr->use_simd_kernels == FALSE)) { /* Add interaction-specific kernels for different architectures */ /* Single precision */ @@ -225,15 +225,15 @@ gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl, gmx_bool bElecAndVdwS /* We typically call this setup routine before starting timers, * but if that has not been done for whatever reason we do it now. */ - gmx_nonbonded_setup(NULL, FALSE); + gmx_nonbonded_setup(nullptr, FALSE); } /* Not used yet */ other = ""; - nl->kernelptr_vf = NULL; - nl->kernelptr_v = NULL; - nl->kernelptr_f = NULL; + nl->kernelptr_vf = nullptr; + nl->kernelptr_v = nullptr; + nl->kernelptr_f = nullptr; elec = gmx_nbkernel_elec_names[nl->ielec]; elec_mod = eintmod_names[nl->ielecmod]; @@ -257,20 +257,20 @@ gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl, gmx_bool bElecAndVdwS { /* Try to find a specific kernel first */ - for (i = 0; i < narch && nl->kernelptr_vf == NULL; i++) + for (i = 0; i < narch && nl->kernelptr_vf == nullptr; i++) { nl->kernelptr_vf = (void *) nb_kernel_list_findkernel(log, arch_and_padding[i].arch, elec, elec_mod, vdw, vdw_mod, geom, other, "PotentialAndForce"); nl->simd_padding_width = arch_and_padding[i].simd_padding_width; } - for (i = 0; i < narch && nl->kernelptr_f == NULL; i++) + for (i = 0; i < narch && nl->kernelptr_f == nullptr; i++) { nl->kernelptr_f = (void *) nb_kernel_list_findkernel(log, arch_and_padding[i].arch, elec, elec_mod, vdw, vdw_mod, geom, other, "Force"); nl->simd_padding_width = arch_and_padding[i].simd_padding_width; /* If there is not force-only optimized kernel, is there a potential & force one? */ - if (nl->kernelptr_f == NULL) + if (nl->kernelptr_f == nullptr) { - nl->kernelptr_f = (void *) nb_kernel_list_findkernel(NULL, arch_and_padding[i].arch, elec, elec_mod, vdw, vdw_mod, geom, other, "PotentialAndForce"); + nl->kernelptr_f = (void *) nb_kernel_list_findkernel(nullptr, arch_and_padding[i].arch, elec, elec_mod, vdw, vdw_mod, geom, other, "PotentialAndForce"); nl->simd_padding_width = arch_and_padding[i].simd_padding_width; } } @@ -290,15 +290,15 @@ gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl, gmx_bool bElecAndVdwS (nl->ivdw != GMX_NBKERNEL_VDW_NONE) && (nl->ivdwmod == eintmodPOTSWITCH) && bElecAndVdwSwitchDiffers) { - nl->kernelptr_vf = NULL; - nl->kernelptr_f = NULL; + nl->kernelptr_vf = nullptr; + nl->kernelptr_f = nullptr; } /* Give up, pick a generic one instead. * We only do this for particle-particle kernels; by leaving the water-optimized kernel * pointers to NULL, the water optimization will automatically be disabled for this interaction. */ - if (nl->kernelptr_vf == NULL && !gmx_strcasecmp_min(geom, "Particle-Particle")) + if (nl->kernelptr_vf == nullptr && !gmx_strcasecmp_min(geom, "Particle-Particle")) { nl->kernelptr_vf = (void *) gmx_nb_generic_kernel; nl->kernelptr_f = (void *) gmx_nb_generic_kernel; @@ -326,7 +326,7 @@ void do_nonbonded(t_forcerec *fr, int n, n0, n1, i, i0, i1; t_nblists * nblists; nb_kernel_data_t kernel_data; - nb_kernel_t * kernelptr = NULL; + nb_kernel_t * kernelptr = nullptr; rvec * f; kernel_data.flags = flags; @@ -414,7 +414,7 @@ void do_nonbonded(t_forcerec *fr, continue; } /* Neighborlists whose kernelptr==NULL will always be empty */ - if (kernelptr != NULL) + if (kernelptr != nullptr) { (*kernelptr)(&(nlist[i]), x, f, fr, mdatoms, &kernel_data, nrnb); } diff --git a/src/gromacs/gmxlib/nrnb.cpp b/src/gromacs/gmxlib/nrnb.cpp index 4509ac24a8..c0509feb60 100644 --- a/src/gromacs/gmxlib/nrnb.cpp +++ b/src/gromacs/gmxlib/nrnb.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -332,19 +332,19 @@ void print_flop(FILE *out, t_nrnb *nrnb, double *nbfs, double *mflop) *nbfs = 0.0; for (i = 0; (i < eNR_NBKERNEL_ALLVSALLGB); i++) { - if (std::strstr(nbdata[i].name, "W3-W3") != NULL) + if (std::strstr(nbdata[i].name, "W3-W3") != nullptr) { *nbfs += 9e-6*nrnb->n[i]; } - else if (std::strstr(nbdata[i].name, "W3") != NULL) + else if (std::strstr(nbdata[i].name, "W3") != nullptr) { *nbfs += 3e-6*nrnb->n[i]; } - else if (std::strstr(nbdata[i].name, "W4-W4") != NULL) + else if (std::strstr(nbdata[i].name, "W4-W4") != nullptr) { *nbfs += 10e-6*nrnb->n[i]; } - else if (std::strstr(nbdata[i].name, "W4") != NULL) + else if (std::strstr(nbdata[i].name, "W4") != nullptr) { *nbfs += 4e-6*nrnb->n[i]; } @@ -412,7 +412,7 @@ void print_flop(FILE *out, t_nrnb *nrnb, double *nbfs, double *mflop) *mflop += mni*flop; frac = 100.0*mni*flop/tflop; tfrac += frac; - if (out != NULL) + if (out != nullptr) { fprintf(out, " %-32s %16.6f %15.3f %6.1f\n", nbdata[i].name, mni, mni*flop, frac); @@ -461,7 +461,7 @@ void print_perf(FILE *out, double time_per_thread, double time_per_node, mflop = mflop/time_per_node; wallclocktime = nsteps*delta_t; - if (getenv("GMX_DETAILED_PERF_STATS") == NULL) + if (getenv("GMX_DETAILED_PERF_STATS") == nullptr) { fprintf(out, "%12s %12s %12s\n", "", "(ns/day)", "(hour/ns)"); @@ -480,7 +480,7 @@ void print_perf(FILE *out, double time_per_thread, double time_per_node, } else { - if (getenv("GMX_DETAILED_PERF_STATS") == NULL) + if (getenv("GMX_DETAILED_PERF_STATS") == nullptr) { fprintf(out, "%12s %14s\n", "", "(steps/hour)"); diff --git a/src/gromacs/gmxpreprocess/add_par.cpp b/src/gromacs/gmxpreprocess/add_par.cpp index dd8586a89c..d2c2f2c667 100644 --- a/src/gromacs/gmxpreprocess/add_par.cpp +++ b/src/gromacs/gmxpreprocess/add_par.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -81,7 +81,7 @@ void add_param(t_params *ps, int ai, int aj, real *c, char *s) ps->param[ps->nr].ai() = ai; ps->param[ps->nr].aj() = aj; clear_atom_list(2, ps->param[ps->nr].a); - if (c == NULL) + if (c == nullptr) { clear_force_param(0, ps->param[ps->nr].c); } diff --git a/src/gromacs/gmxpreprocess/convparm.cpp b/src/gromacs/gmxpreprocess/convparm.cpp index d2660bc772..0a2f123d11 100644 --- a/src/gromacs/gmxpreprocess/convparm.cpp +++ b/src/gromacs/gmxpreprocess/convparm.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -586,13 +586,13 @@ void convert_params(int atnr, t_params nbtypes[], ffp = &mtop->ffparams; ffp->ntypes = 0; ffp->atnr = atnr; - ffp->functype = NULL; - ffp->iparams = NULL; + ffp->functype = nullptr; + ffp->iparams = nullptr; ffp->reppow = reppow; - enter_function(&(nbtypes[F_LJ]), (t_functype)F_LJ, comb, reppow, ffp, NULL, + enter_function(&(nbtypes[F_LJ]), (t_functype)F_LJ, comb, reppow, ffp, nullptr, &maxtypes, TRUE, TRUE); - enter_function(&(nbtypes[F_BHAM]), (t_functype)F_BHAM, comb, reppow, ffp, NULL, + enter_function(&(nbtypes[F_BHAM]), (t_functype)F_BHAM, comb, reppow, ffp, nullptr, &maxtypes, TRUE, TRUE); for (mt = 0; mt < mtop->nmoltype; mt++) @@ -601,7 +601,7 @@ void convert_params(int atnr, t_params nbtypes[], for (i = 0; (i < F_NRE); i++) { molt->ilist[i].nr = 0; - molt->ilist[i].iatoms = NULL; + molt->ilist[i].iatoms = nullptr; plist = mi[mt].plist; @@ -618,7 +618,7 @@ void convert_params(int atnr, t_params nbtypes[], } mtop->bIntermolecularInteractions = FALSE; - if (intermolecular_interactions != NULL) + if (intermolecular_interactions != nullptr) { /* Process the intermolecular interaction list */ snew(mtop->intermolecular_ilist, F_NRE); @@ -626,7 +626,7 @@ void convert_params(int atnr, t_params nbtypes[], for (i = 0; (i < F_NRE); i++) { mtop->intermolecular_ilist[i].nr = 0; - mtop->intermolecular_ilist[i].iatoms = NULL; + mtop->intermolecular_ilist[i].iatoms = nullptr; plist = intermolecular_interactions->plist; diff --git a/src/gromacs/gmxpreprocess/fflibutil.cpp b/src/gromacs/gmxpreprocess/fflibutil.cpp index 23285ed8ce..c906fea25e 100644 --- a/src/gromacs/gmxpreprocess/fflibutil.cpp +++ b/src/gromacs/gmxpreprocess/fflibutil.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2010,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -73,7 +73,7 @@ void fflib_filename_base(const char *filename, char *filebase, int maxlen) char *ptr; cptr = strrchr(filename, DIR_SEPARATOR); - if (cptr != NULL) + if (cptr != nullptr) { /* Skip the separator */ cptr += 1; @@ -90,7 +90,7 @@ void fflib_filename_base(const char *filename, char *filebase, int maxlen) strcpy(filebase, cptr); /* Remove the extension */ ptr = strrchr(filebase, '.'); - if (ptr != NULL) + if (ptr != nullptr) { ptr[0] = '\0'; } @@ -173,7 +173,7 @@ gmx_bool fflib_fexist(const char *file) file_fullpath = low_gmxlibfn(file, TRUE, FALSE); - if (file_fullpath == NULL) + if (file_fullpath == nullptr) { return FALSE; } diff --git a/src/gromacs/gmxpreprocess/gen_ad.cpp b/src/gromacs/gmxpreprocess/gen_ad.cpp index ed7ccdec71..0396424d43 100644 --- a/src/gromacs/gmxpreprocess/gen_ad.cpp +++ b/src/gromacs/gmxpreprocess/gen_ad.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -497,7 +497,7 @@ static int get_impropers(t_atoms *atoms, t_hackblock hb[], t_param **improper, /* Add all the impropers from the residue database to the list. */ nimproper = 0; start = 0; - if (hb != NULL) + if (hb != nullptr) { for (i = 0; (i < atoms->nres); i++) { @@ -523,7 +523,7 @@ static int get_impropers(t_atoms *atoms, t_hackblock hb[], t_param **improper, srenew(*improper, nalloc); } /* Not broken out */ - set_p(&((*improper)[nimproper]), ai, NULL, impropers->b[j].s); + set_p(&((*improper)[nimproper]), ai, nullptr, impropers->b[j].s); nimproper++; } } diff --git a/src/gromacs/gmxpreprocess/gen_vsite.cpp b/src/gromacs/gmxpreprocess/gen_vsite.cpp index 8c4bed2ee4..ca209eb4e6 100644 --- a/src/gromacs/gmxpreprocess/gen_vsite.cpp +++ b/src/gromacs/gmxpreprocess/gen_vsite.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -183,7 +183,7 @@ static void read_vsite_database(const char *ddbname, snew(vsiteconflist, 1); snew(vsitetoplist, 1); - while (fgets2(pline, STRLEN-2, ddb) != NULL) + while (fgets2(pline, STRLEN-2, ddb) != nullptr) { strip_comment(pline); trim(pline); @@ -192,7 +192,7 @@ static void read_vsite_database(const char *ddbname, if (pline[0] == OPENDIR) { strncpy(dirstr, pline+1, STRLEN-2); - if ((ch = strchr (dirstr, CLOSEDIR)) != NULL) + if ((ch = strchr (dirstr, CLOSEDIR)) != nullptr) { (*ch) = 0; } @@ -292,7 +292,7 @@ static void read_vsite_database(const char *ddbname, srenew(vsitetoplist[i].bond, k+1); strncpy(vsitetoplist[i].bond[k].atom1, s1, MAXNAME-1); strncpy(vsitetoplist[i].bond[k].atom2, s2, MAXNAME-1); - vsitetoplist[i].bond[k].value = strtod(s3, NULL); + vsitetoplist[i].bond[k].value = strtod(s3, nullptr); } else if (n == 4) { @@ -302,7 +302,7 @@ static void read_vsite_database(const char *ddbname, strncpy(vsitetoplist[i].angle[k].atom1, s1, MAXNAME-1); strncpy(vsitetoplist[i].angle[k].atom2, s2, MAXNAME-1); strncpy(vsitetoplist[i].angle[k].atom3, s3, MAXNAME-1); - vsitetoplist[i].angle[k].value = strtod(s4, NULL); + vsitetoplist[i].angle[k].value = strtod(s4, nullptr); } else { @@ -363,7 +363,7 @@ static char *get_dummymass_name(t_vsiteconf vsiteconflist[], int nvsiteconf, cha } else { - return NULL; + return nullptr; } } @@ -582,7 +582,7 @@ static void my_add_param(t_params *plist, int ai, int aj, real b) { NOTSET, NOTSET, NOTSET, NOTSET, NOTSET, NOTSET }; c[0] = b; - add_param(plist, ai, aj, c, NULL); + add_param(plist, ai, aj, c, nullptr); } static void add_vsites(t_params plist[], int vsite_type[], @@ -1030,7 +1030,7 @@ static int gen_vsites_trp(gpp_atomtype_t atype, rvec *newx[], srenew(*newcgnr, at->nr+*nadd); for (j = 0; j < NMASS; j++) { - (*newatomname)[at->nr+*nadd-1-j] = NULL; + (*newatomname)[at->nr+*nadd-1-j] = nullptr; } /* Dummy masses will be placed at the center-of-mass in each ring. */ @@ -1225,7 +1225,7 @@ static int gen_vsites_tyr(gpp_atomtype_t atype, rvec *newx[], srenew(*newatomname, at->nr+*nadd); srenew(*newvsite_type, at->nr+*nadd); srenew(*newcgnr, at->nr+*nadd); - (*newatomname)[at->nr+*nadd-1] = NULL; + (*newatomname)[at->nr+*nadd-1] = nullptr; /* Calc the dummy mass initial position */ rvec_sub(x[ats[atHH]], x[ats[atOH]], r1); @@ -1536,7 +1536,7 @@ void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, t_atom *newatom; t_params *params; char ***newatomname; - char *resnm = NULL; + char *resnm = nullptr; int ndb, f; char **db; int nvsiteconf, nvsitetop, cmplength; @@ -1576,20 +1576,20 @@ void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, { "CG", /* PHE */ "CD1", "HD1", "CD2", "HD2", "CE1", "HE1", "CE2", "HE2", - "CZ", "HZ", NULL }, + "CZ", "HZ", nullptr }, { "CB", /* TRP */ "CG", "CD1", "HD1", "CD2", "NE1", "HE1", "CE2", "CE3", "HE3", "CZ2", "HZ2", "CZ3", "HZ3", - "CH2", "HH2", NULL }, + "CH2", "HH2", nullptr }, { "CG", /* TYR */ "CD1", "HD1", "CD2", "HD2", "CE1", "HE1", "CE2", "HE2", - "CZ", "OH", "HH", NULL }, + "CZ", "OH", "HH", nullptr }, { "CG", /* HIS */ "ND1", "HD1", "CD2", "HD2", - "CE1", "HE1", "NE2", "HE2", NULL } + "CE1", "HE1", "NE2", "HE2", nullptr } }; if (debug) @@ -1600,9 +1600,9 @@ void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, ndb = fflib_search_file_end(ffdir, ".vsd", FALSE, &db); nvsiteconf = 0; - vsiteconflist = NULL; + vsiteconflist = nullptr; nvsitetop = 0; - vsitetop = NULL; + vsitetop = nullptr; for (f = 0; f < ndb; f++) { read_vsite_database(db[f], &vsiteconflist, &nvsiteconf, &vsitetop, &nvsitetop); @@ -1873,7 +1873,7 @@ void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, strcpy(nexttpname, get_atomtype_name(get_atype(heavies[0], at, nrtp, rtp, rt), atype)); ch = get_dummymass_name(vsiteconflist, nvsiteconf, tpname, nexttpname); - if (ch == NULL) + if (ch == nullptr) { if (ndb > 0) { @@ -1912,7 +1912,7 @@ void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, for (j = 0; j < NMASS; j++) { - newatomname[at->nr+nadd-1-j] = NULL; + newatomname[at->nr+nadd-1-j] = nullptr; } /* calculate starting position for the masses */ diff --git a/src/gromacs/gmxpreprocess/genconf.cpp b/src/gromacs/gmxpreprocess/genconf.cpp index 84587a391e..e652b34dc1 100644 --- a/src/gromacs/gmxpreprocess/genconf.cpp +++ b/src/gromacs/gmxpreprocess/genconf.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -137,7 +137,7 @@ int gmx_genconf(int argc, char *argv[]) t_filenm fnm[] = { { efSTX, "-f", "conf", ffREAD }, { efSTO, "-o", "out", ffWRITE }, - { efTRX, "-trj", NULL, ffOPTRD } + { efTRX, "-trj", nullptr, ffOPTRD } }; #define NFILE asize(fnm) static rvec nrbox = {1, 1, 1}; diff --git a/src/gromacs/gmxpreprocess/genhydro.cpp b/src/gromacs/gmxpreprocess/genhydro.cpp index 88fd8dd49a..4d58b30b82 100644 --- a/src/gromacs/gmxpreprocess/genhydro.cpp +++ b/src/gromacs/gmxpreprocess/genhydro.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -149,11 +149,11 @@ static t_hackblock *get_hackblocks(t_atoms *pdba, int nah, t_hackblock ah[], /* first the termini */ for (i = 0; i < nterpairs; i++) { - if (ntdb[i] != NULL) + if (ntdb[i] != nullptr) { copy_t_hackblock(ntdb[i], &hb[rN[i]]); } - if (ctdb[i] != NULL) + if (ctdb[i] != nullptr) { merge_t_hackblock(ctdb[i], &hb[rC[i]]); } @@ -164,7 +164,7 @@ static t_hackblock *get_hackblocks(t_atoms *pdba, int nah, t_hackblock ah[], ahptr = search_h_db(nah, ah, *pdba->resinfo[rnr].rtp); if (ahptr) { - if (hb[rnr].name == NULL) + if (hb[rnr].name == nullptr) { hb[rnr].name = gmx_strdup(ahptr->name); } @@ -210,9 +210,9 @@ static void expand_hackblocks_one(t_hackblock *hbr, char *atomname, } if (!bIgnore && - ( ( ( hbr->hack[j].tp > 0 || hbr->hack[j].oname == NULL ) && + ( ( ( hbr->hack[j].tp > 0 || hbr->hack[j].oname == nullptr ) && strcmp(atomname, hbr->hack[j].ai()) == 0 ) || - ( hbr->hack[j].oname != NULL && + ( hbr->hack[j].oname != nullptr && strcmp(atomname, hbr->hack[j].oname) == 0) ) ) { /* now expand all hacks for this atom */ @@ -227,9 +227,9 @@ static void expand_hackblocks_one(t_hackblock *hbr, char *atomname, (*abi)[*nabi + k].bXSet = FALSE; /* if we're adding (oname==NULL) and don't have a new name (nname) yet, build it from atomname */ - if ( (*abi)[*nabi + k].nname == NULL) + if ( (*abi)[*nabi + k].nname == nullptr) { - if ( (*abi)[*nabi + k].oname == NULL) + if ( (*abi)[*nabi + k].oname == nullptr) { (*abi)[*nabi + k].nname = gmx_strdup(atomname); (*abi)[*nabi + k].nname[0] = 'H'; @@ -276,7 +276,7 @@ static void expand_hackblocks_one(t_hackblock *hbr, char *atomname, (*nabi) += hbr->hack[j].nr; /* add hacks to atoms we've just added */ - if (hbr->hack[j].tp > 0 || hbr->hack[j].oname == NULL) + if (hbr->hack[j].tp > 0 || hbr->hack[j].oname == nullptr) { for (k = 0; k < hbr->hack[j].nr; k++) { @@ -328,10 +328,10 @@ static int check_atoms_present(t_atoms *pdba, int nab[], t_hack *ab[]) rnr = pdba->atom[i].resind; for (j = 0; j < nab[i]; j++) { - if (ab[i][j].oname == NULL) + if (ab[i][j].oname == nullptr) { /* we're adding */ - if (ab[i][j].nname == NULL) + if (ab[i][j].nname == nullptr) { gmx_incons("ab[i][j].nname not allocated"); } @@ -355,7 +355,7 @@ static int check_atoms_present(t_atoms *pdba, int nab[], t_hack *ab[]) nadd++; } } - else if (ab[i][j].nname == NULL) + else if (ab[i][j].nname == nullptr) { /* we're deleting */ nadd--; @@ -383,7 +383,7 @@ static void calc_all_pos(t_atoms *pdba, rvec x[], int nab[], t_hack *ab[], for (j = 0; j < nab[i]; j += ab[i][j].nr) { /* check if we're adding: */ - if (ab[i][j].oname == NULL && ab[i][j].tp > 0) + if (ab[i][j].oname == nullptr && ab[i][j].tp > 0) { bFoundAll = TRUE; for (m = 0; (m < ab[i][j].nctl && bFoundAll); m++) @@ -466,11 +466,11 @@ static int add_h_low(t_atoms **pdbaptr, rvec *xptr[], int **nabptr, t_hack ***abptr, gmx_bool bUpdate_pdba, gmx_bool bKeep_old_pdba) { - t_atoms *newpdba = NULL, *pdba = NULL; + t_atoms *newpdba = nullptr, *pdba = nullptr; int nadd; int i, newi, j, natoms, nalreadypresent; - int *nab = NULL; - t_hack **ab = NULL; + int *nab = nullptr; + t_hack **ab = nullptr; t_hackblock *hb; rvec *xn; gmx_bool bKeep_ab; @@ -584,7 +584,7 @@ static int add_h_low(t_atoms **pdbaptr, rvec *xptr[], for (i = 0; (i < natoms); i++) { /* check if this atom wasn't scheduled for deletion */ - if (nab[i] == 0 || (ab[i][0].nname != NULL) ) + if (nab[i] == 0 || (ab[i][0].nname != nullptr) ) { if (newi >= natoms+nadd) { @@ -613,7 +613,7 @@ static int add_h_low(t_atoms **pdbaptr, rvec *xptr[], nalreadypresent = 0; for (j = 0; j < nab[i]; j++) { - if (ab[i][j].oname == NULL) /* add */ + if (ab[i][j].oname == nullptr) /* add */ { newi++; if (newi >= natoms+nadd) @@ -636,12 +636,12 @@ static int add_h_low(t_atoms **pdbaptr, rvec *xptr[], fprintf(debug, " + %d", newi+1); } } - if (ab[i][j].nname != NULL && - (ab[i][j].oname == NULL || + if (ab[i][j].nname != nullptr && + (ab[i][j].oname == nullptr || strcmp(ab[i][j].oname, *newpdba->atomname[newi]) == 0)) { /* add or replace */ - if (ab[i][j].oname == NULL && ab[i][j].bAlreadyPresent) + if (ab[i][j].oname == nullptr && ab[i][j].bAlreadyPresent) { /* This atom is already present, copy it from the input. */ nalreadypresent++; @@ -665,8 +665,8 @@ static int add_h_low(t_atoms **pdbaptr, rvec *xptr[], } snew(newpdba->atomname[newi], 1); *newpdba->atomname[newi] = gmx_strdup(ab[i][j].nname); - if (ab[i][j].oname != NULL && ab[i][j].atom) /* replace */ - { /* newpdba->atom[newi].m = ab[i][j].atom->m; */ + if (ab[i][j].oname != nullptr && ab[i][j].atom) /* replace */ + { /* newpdba->atom[newi].m = ab[i][j].atom->m; */ /* newpdba->atom[newi].q = ab[i][j].atom->q; */ /* newpdba->atom[newi].type = ab[i][j].atom->type; */ } diff --git a/src/gromacs/gmxpreprocess/gmxcpp.cpp b/src/gromacs/gmxpreprocess/gmxcpp.cpp index 6ab3934624..2ce02ee6cd 100644 --- a/src/gromacs/gmxpreprocess/gmxcpp.cpp +++ b/src/gromacs/gmxpreprocess/gmxcpp.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -63,9 +63,9 @@ typedef struct { } t_define; static int ndef = 0; -static t_define *defs = NULL; +static t_define *defs = nullptr; static int nincl = 0; -static char **incl = 0; +static char **incl = nullptr; /* enum used for handling ifdefs */ enum { @@ -93,7 +93,7 @@ static const char *strstrw(const char *buf, const char *word) { const char *ptr; - while ((ptr = strstr(buf, word)) != NULL) + while ((ptr = strstr(buf, word)) != nullptr) { /* Check if we did not find part of a longer word */ if (ptr && @@ -105,7 +105,7 @@ static const char *strstrw(const char *buf, const char *word) buf = ptr + strlen(word); } - return NULL; + return nullptr; } static gmx_bool find_directive(char *buf, char **name, char **val) @@ -143,7 +143,7 @@ static gmx_bool find_directive(char *buf, char **name, char **val) } } /* Check if anything is remaining */ - *val = (*buf != 0) ? buf : NULL; + *val = (*buf != 0) ? buf : nullptr; return TRUE; } @@ -156,7 +156,7 @@ static void add_include(const char *include) { int i; - if (include == NULL) + if (include == nullptr) { return; } @@ -184,7 +184,7 @@ static void done_includes() sfree(incl[i]); } sfree(incl); - incl = NULL; + incl = nullptr; nincl = 0; } @@ -220,7 +220,7 @@ static void add_define(const char *name, const char *value) } else { - defs[i].def = NULL; + defs[i].def = nullptr; } } @@ -233,7 +233,7 @@ static void done_defines() sfree(defs[i].def); } sfree(defs); - defs = NULL; + defs = nullptr; ndef = 0; } @@ -269,7 +269,7 @@ int cpp_open_file(const char *filenm, gmx_cpp_t *handle, char **cppopts) } else { - add_define(cppopts[i] + 2, NULL); + add_define(cppopts[i] + 2, nullptr); } } i++; @@ -282,7 +282,7 @@ int cpp_open_file(const char *filenm, gmx_cpp_t *handle, char **cppopts) snew(cpp, 1); *handle = cpp; - cpp->fn = NULL; + cpp->fn = nullptr; /* Find the file. First check whether it is in the current directory. */ if (gmx_fexist(filenm)) { @@ -312,7 +312,7 @@ int cpp_open_file(const char *filenm, gmx_cpp_t *handle, char **cppopts) { gmx_fatal(FARGS, "Topology include file \"%s\" not found", filenm); } - if (NULL != debug) + if (nullptr != debug) { fprintf(debug, "GMXCPP: cpp file open %s\n", cpp->fn); } @@ -323,14 +323,14 @@ int cpp_open_file(const char *filenm, gmx_cpp_t *handle, char **cppopts) ptr = strrchr(cpp->fn, '/'); ptr2 = strrchr(cpp->fn, DIR_SEPARATOR); - if (ptr == NULL || (ptr2 != NULL && ptr2 > ptr)) + if (ptr == nullptr || (ptr2 != nullptr && ptr2 > ptr)) { ptr = ptr2; } - if (ptr == NULL) + if (ptr == nullptr) { - cpp->path = NULL; - cpp->cwd = NULL; + cpp->path = nullptr; + cpp->cwd = nullptr; } else { @@ -340,33 +340,33 @@ int cpp_open_file(const char *filenm, gmx_cpp_t *handle, char **cppopts) snew(cpp->cwd, STRLEN); gmx_getcwd(cpp->cwd, STRLEN); - if (NULL != debug) + if (nullptr != debug) { fprintf(debug, "GMXCPP: cwd %s\n", cpp->cwd); } gmx_chdir(cpp->path); - if (NULL != debug) + if (nullptr != debug) { fprintf(debug, "GMXCPP: chdir to %s\n", cpp->path); } } cpp->line_len = 0; - cpp->line = NULL; + cpp->line = nullptr; cpp->line_nr = 0; cpp->nifdef = 0; - cpp->ifdefs = NULL; - cpp->child = NULL; - cpp->parent = NULL; - if (cpp->fp == NULL) + cpp->ifdefs = nullptr; + cpp->child = nullptr; + cpp->parent = nullptr; + if (cpp->fp == nullptr) { - if (NULL != debug) + if (nullptr != debug) { fprintf(debug, "GMXCPP: opening file %s\n", cpp->fn); } cpp->fp = fopen(cpp->fn, "r"); } - if (cpp->fp == NULL) + if (cpp->fp == nullptr) { switch (errno) { @@ -500,11 +500,11 @@ process_directive(gmx_cpp_t *handlep, const char *dname, const char *dval) inc_fn, i0, len); } /* Open include file and store it as a child in the handle structure */ - status = cpp_open_file(inc_fn, &(handle->child), NULL); + status = cpp_open_file(inc_fn, &(handle->child), nullptr); sfree(inc_fn); if (status != eCPP_OK) { - handle->child = NULL; + handle->child = nullptr; return status; } /* Make a linked list of open files and move on to the include file */ @@ -590,7 +590,7 @@ int cpp_read_line(gmx_cpp_t *handlep, int n, char buf[]) if (!bEOF) { /* Read the actual line now. */ - if (fgets2(buf, n-1, handle->fp) == NULL) + if (fgets2(buf, n-1, handle->fp) == nullptr) { /* Recheck EOF, since we could have been at the end before * the fgets2 call, but we need to read past the end to know. @@ -608,13 +608,13 @@ int cpp_read_line(gmx_cpp_t *handlep, int n, char buf[]) if (bEOF) { - if (handle->parent == NULL) + if (handle->parent == nullptr) { return eCPP_EOF; } cpp_close_file(handlep); *handlep = handle->parent; - handle->child = NULL; + handle->child = nullptr; return cpp_read_line(handlep, n, buf); } else @@ -663,7 +663,7 @@ int cpp_read_line(gmx_cpp_t *handlep, int n, char buf[]) { nn = 0; ptr = buf; - while ((ptr = strstrw(ptr, defs[i].name)) != NULL) + while ((ptr = strstrw(ptr, defs[i].name)) != nullptr) { nn++; ptr += strlen(defs[i].name); @@ -675,7 +675,7 @@ int cpp_read_line(gmx_cpp_t *handlep, int n, char buf[]) len = strlen(buf) + nn*std::max(four, four+strlen(defs[i].def)-strlen(defs[i].name)); snew(name, len); ptr = buf; - while ((ptr2 = strstrw(ptr, defs[i].name)) != NULL) + while ((ptr2 = strstrw(ptr, defs[i].name)) != nullptr) { strncat(name, ptr, (int)(ptr2-ptr)); strcat(name, defs[i].def); @@ -719,9 +719,9 @@ int cpp_close_file(gmx_cpp_t *handlep) fprintf(debug, "GMXCPP: closing file %s\n", handle->fn); } fclose(handle->fp); - if (NULL != handle->cwd) + if (nullptr != handle->cwd) { - if (NULL != debug) + if (nullptr != debug) { fprintf(debug, "GMXCPP: chdir to %s\n", handle->cwd); } @@ -748,28 +748,28 @@ int cpp_close_file(gmx_cpp_t *handlep) return eCPP_UNKNOWN; } } - handle->fp = NULL; + handle->fp = nullptr; handle->line_nr = 0; - if (NULL != handle->fn) + if (nullptr != handle->fn) { sfree(handle->fn); - handle->fn = NULL; + handle->fn = nullptr; } - if (NULL != handle->line) + if (nullptr != handle->line) { sfree(handle->line); - handle->line = NULL; + handle->line = nullptr; } - if (NULL != handle->ifdefs) + if (nullptr != handle->ifdefs) { sfree(handle->ifdefs); } handle->nifdef = 0; - if (NULL != handle->path) + if (nullptr != handle->path) { sfree(handle->path); } - if (NULL != handle->cwd) + if (nullptr != handle->cwd) { sfree(handle->cwd); } diff --git a/src/gromacs/gmxpreprocess/gpp_atomtype.cpp b/src/gromacs/gmxpreprocess/gpp_atomtype.cpp index 858e36d7b0..68538e8426 100644 --- a/src/gromacs/gmxpreprocess/gpp_atomtype.cpp +++ b/src/gromacs/gmxpreprocess/gpp_atomtype.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -92,7 +92,7 @@ char *get_atomtype_name(int nt, gpp_atomtype_t ga) { if ((nt < 0) || (nt >= ga->nr)) { - return NULL; + return nullptr; } return *(ga->atomname[nt]); @@ -238,16 +238,16 @@ gpp_atomtype_t init_atomtype(void) snew(ga, 1); ga->nr = 0; - ga->atom = NULL; - ga->atomname = NULL; - ga->nb = NULL; - ga->bondatomtype = NULL; - ga->radius = NULL; - ga->vol = NULL; - ga->surftens = NULL; - ga->atomnumber = NULL; - ga->gb_radius = NULL; - ga->S_hct = NULL; + ga->atom = nullptr; + ga->atomname = nullptr; + ga->nb = nullptr; + ga->bondatomtype = nullptr; + ga->radius = nullptr; + ga->vol = nullptr; + ga->surftens = nullptr; + ga->atomnumber = nullptr; + ga->gb_radius = nullptr; + ga->S_hct = nullptr; return ga; } @@ -309,7 +309,7 @@ int add_atomtype(gpp_atomtype_t ga, t_symtab *tab, { if (strcmp(*ga->atomname[i], name) == 0) { - if (NULL != debug) + if (nullptr != debug) { fprintf(debug, "Trying to add atomtype %s again. Skipping it.\n", name); } @@ -528,7 +528,7 @@ void renum_atype(t_params plist[], gmx_mtop_t *mtop, } /* Renumber nlist */ - nbsnew = NULL; + nbsnew = nullptr; snew(nbsnew, plist[ftype].nr); nrfp = NRFP(ftype); diff --git a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp index 0b26182b75..2d79963270 100644 --- a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp +++ b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -74,7 +74,7 @@ char *get_bond_atomtype_name(int nt, t_bond_atomtype at) if ((nt < 0) || (nt >= ga->nr)) { - return NULL; + return nullptr; } return *(ga->atomname[nt]); @@ -107,5 +107,5 @@ void done_bond_atomtype(t_bond_atomtype *at) ga->nr = 0; sfree(ga); - *at = NULL; + *at = nullptr; } diff --git a/src/gromacs/gmxpreprocess/grompp.cpp b/src/gromacs/gmxpreprocess/grompp.cpp index e5ab2360cd..e088d43be7 100644 --- a/src/gromacs/gmxpreprocess/grompp.cpp +++ b/src/gromacs/gmxpreprocess/grompp.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -260,7 +260,7 @@ static void check_bonds_timestep(gmx_mtop_t *mtop, double dt, warninp_t wi) w_a1 = w_a2 = -1; w_period2 = -1.0; - w_moltype = NULL; + w_moltype = nullptr; for (molt = 0; molt < mtop->nmoltype; molt++) { moltype = &mtop->moltype[molt]; @@ -322,7 +322,7 @@ static void check_bonds_timestep(gmx_mtop_t *mtop, double dt, warninp_t wi) } } if (!bFound && - (w_moltype == NULL || period2 < w_period2)) + (w_moltype == nullptr || period2 < w_period2)) { w_moltype = moltype; w_a1 = a1; @@ -334,7 +334,7 @@ static void check_bonds_timestep(gmx_mtop_t *mtop, double dt, warninp_t wi) } } - if (w_moltype != NULL) + if (w_moltype != nullptr) { bWarn = (w_period2 < gmx::square(min_steps_warn*dt)); /* A check that would recognize most water models */ @@ -509,7 +509,7 @@ new_status(const char *topfile, const char *topppfile, const char *confin, gmx_bool bMorse, warninp_t wi) { - t_molinfo *molinfo = NULL; + t_molinfo *molinfo = nullptr; int nmolblock; gmx_molblock_t *molblock, *molbs; int mb, i, nrmols, nmismatch; @@ -603,11 +603,11 @@ new_status(const char *topfile, const char *topppfile, const char *confin, } t_topology *conftop; - rvec *x = NULL; - rvec *v = NULL; + rvec *x = nullptr; + rvec *v = nullptr; snew(conftop, 1); init_state(state, 0, 0, 0, 0, 0); - read_tps_conf(confin, conftop, NULL, &x, &v, state->box, FALSE); + read_tps_conf(confin, conftop, nullptr, &x, &v, state->box, FALSE); state->natoms = conftop->atoms.nr; if (state->natoms != sys->natoms) { @@ -625,7 +625,7 @@ new_status(const char *topfile, const char *topppfile, const char *confin, copy_rvec(x[i], state->x[i]); } sfree(x); - if (v != NULL) + if (v != nullptr) { state->flags |= (1 << estV); state->v.resize(state->natoms); @@ -844,7 +844,7 @@ static void read_posres(gmx_mtop_t *mtop, t_molinfo *molinfo, gmx_bool bTopB, t_atom *atom; snew(top, 1); - read_tps_conf(fn, top, NULL, &x, &v, box, FALSE); + read_tps_conf(fn, top, nullptr, &x, &v, box, FALSE); natoms = top->atoms.nr; done_top(top); sfree(top); @@ -1613,17 +1613,17 @@ int gmx_grompp(int argc, char *argv[]) char warn_buf[STRLEN]; t_filenm fnm[] = { - { efMDP, NULL, NULL, ffREAD }, + { efMDP, nullptr, nullptr, ffREAD }, { efMDP, "-po", "mdout", ffWRITE }, - { efSTX, "-c", NULL, ffREAD }, - { efSTX, "-r", NULL, ffOPTRD }, - { efSTX, "-rb", NULL, ffOPTRD }, - { efNDX, NULL, NULL, ffOPTRD }, - { efTOP, NULL, NULL, ffREAD }, + { efSTX, "-c", nullptr, ffREAD }, + { efSTX, "-r", nullptr, ffOPTRD }, + { efSTX, "-rb", nullptr, ffOPTRD }, + { efNDX, nullptr, nullptr, ffOPTRD }, + { efTOP, nullptr, nullptr, ffREAD }, { efTOP, "-pp", "processed", ffOPTWR }, - { efTPR, "-o", NULL, ffWRITE }, - { efTRN, "-t", NULL, ffOPTRD }, - { efEDR, "-e", NULL, ffOPTRD }, + { efTPR, "-o", nullptr, ffWRITE }, + { efTRN, "-t", nullptr, ffOPTRD }, + { efEDR, "-e", nullptr, ffOPTRD }, /* This group is needed by the VMD viewer as the start configuration for IMD sessions: */ { efGRO, "-imd", "imdgroup", ffOPTWR }, { efTRN, "-ref", "rotref", ffOPTRW } @@ -1652,7 +1652,7 @@ int gmx_grompp(int argc, char *argv[]) /* Parse the command line */ if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -2095,7 +2095,7 @@ int gmx_grompp(int argc, char *argv[]) } else { - if (ir->fepvals->all_lambda[i] == NULL) + if (ir->fepvals->all_lambda[i] == nullptr) { gmx_fatal(FARGS, "Values of lambda not set for a free energy calculation!"); } @@ -2107,7 +2107,7 @@ int gmx_grompp(int argc, char *argv[]) } } - struct pull_t *pull = NULL; + struct pull_t *pull = nullptr; if (ir->bPull) { diff --git a/src/gromacs/gmxpreprocess/h_db.cpp b/src/gromacs/gmxpreprocess/h_db.cpp index 50dee9d5e0..e1b93ec749 100644 --- a/src/gromacs/gmxpreprocess/h_db.cpp +++ b/src/gromacs/gmxpreprocess/h_db.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -113,11 +113,11 @@ void read_ab(char *line, const char *fn, t_hack *hack) } for (; i < 4; i++) { - hack->a[i] = NULL; + hack->a[i] = nullptr; } - hack->oname = NULL; + hack->oname = nullptr; hack->nname = gmx_strdup(hn); - hack->atom = NULL; + hack->atom = nullptr; hack->cgnr = NOTSET; hack->bXSet = FALSE; for (i = 0; i < DIM; i++) @@ -181,7 +181,7 @@ static void read_h_db_file(const char *hfn, int *nahptr, t_hackblock **ah) "while reading Hydrogen Database %s residue %s", nab, i-1, aah[nah].name, hfn); } - if (NULL == fgets(buf, STRLEN, in)) + if (nullptr == fgets(buf, STRLEN, in)) { gmx_fatal(FARGS, "Error reading from file %s", hfn); } @@ -218,7 +218,7 @@ int read_h_db(const char *ffdir, t_hackblock **ah) */ nhdbf = fflib_search_file_end(ffdir, ".hdb", FALSE, &hdbf); nah = 0; - *ah = NULL; + *ah = nullptr; for (f = 0; f < nhdbf; f++) { read_h_db_file(hdbf[f], &nah, ah); @@ -235,7 +235,7 @@ t_hackblock *search_h_db(int nh, t_hackblock ah[], char *key) if (nh <= 0) { - return NULL; + return nullptr; } ahkey.name = key; diff --git a/src/gromacs/gmxpreprocess/hackblock.cpp b/src/gromacs/gmxpreprocess/hackblock.cpp index 6e8026e922..d9d3daf849 100644 --- a/src/gromacs/gmxpreprocess/hackblock.cpp +++ b/src/gromacs/gmxpreprocess/hackblock.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -72,7 +72,7 @@ static void free_t_bondeds(t_rbondeds *rbs) free_t_bonded(&rbs->b[i]); } sfree(rbs->b); - rbs->b = NULL; + rbs->b = nullptr; rbs->nb = 0; } @@ -114,7 +114,7 @@ void free_t_hack(int nh, t_hack **h) } } sfree(*h); - *h = NULL; + *h = nullptr; } void free_t_hackblock(int nhb, t_hackblock **hb) @@ -137,14 +137,14 @@ void clear_t_hackblock(t_hackblock *hb) { int i; - hb->name = NULL; + hb->name = nullptr; hb->nhack = 0; hb->maxhack = 0; - hb->hack = NULL; + hb->hack = nullptr; for (i = 0; i < ebtsNR; i++) { hb->rb[i].nb = 0; - hb->rb[i].b = NULL; + hb->rb[i].b = nullptr; } } @@ -153,15 +153,15 @@ void clear_t_hack(t_hack *hack) int i; hack->nr = 0; - hack->oname = NULL; - hack->nname = NULL; - hack->atom = NULL; + hack->oname = nullptr; + hack->nname = nullptr; + hack->atom = nullptr; hack->cgnr = NOTSET; hack->tp = 0; hack->nctl = 0; for (i = 0; i < 4; i++) { - hack->a[i] = NULL; + hack->a[i] = nullptr; } for (i = 0; i < DIM; i++) { @@ -346,7 +346,7 @@ void copy_t_restp(t_restp *s, t_restp *d) { d->rb[i].type = s->rb[i].type; d->rb[i].nb = 0; - d->rb[i].b = NULL; + d->rb[i].b = nullptr; } merge_t_bondeds(s->rb, d->rb, FALSE, FALSE); } @@ -365,7 +365,7 @@ void copy_t_hack(t_hack *s, t_hack *d) } else { - d->atom = NULL; + d->atom = nullptr; } for (i = 0; i < 4; i++) { @@ -407,11 +407,11 @@ void copy_t_hackblock(t_hackblock *s, t_hackblock *d) *d = *s; d->name = safe_strdup(s->name); d->nhack = 0; - d->hack = NULL; + d->hack = nullptr; for (i = 0; i < ebtsNR; i++) { d->rb[i].nb = 0; - d->rb[i].b = NULL; + d->rb[i].b = nullptr; } merge_t_hackblock(s, d); } diff --git a/src/gromacs/gmxpreprocess/insert-molecules.cpp b/src/gromacs/gmxpreprocess/insert-molecules.cpp index 936dd144db..204ecb711d 100644 --- a/src/gromacs/gmxpreprocess/insert-molecules.cpp +++ b/src/gromacs/gmxpreprocess/insert-molecules.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -125,7 +125,7 @@ static void generate_trial_conf(const std::vector &xin, } if (enum_rot == en_rotXYZ || enum_rot == en_rotZ) { - rotate_conf(xout->size(), as_rvec_array(xout->data()), NULL, alfa, beta, gamma); + rotate_conf(xout->size(), as_rvec_array(xout->data()), nullptr, alfa, beta, gamma); } for (size_t i = 0; i < xout->size(); ++i) { @@ -208,7 +208,7 @@ static void insert_mols(int nmol_insrt, int ntry, int seed, set_pbc(&pbc, ePBC, box); /* With -ip, take nmol_insrt from file posfn */ - double **rpos = NULL; + double **rpos = nullptr; const bool insertAtPositions = !posfn.empty(); if (insertAtPositions) { @@ -307,7 +307,7 @@ static void insert_mols(int nmol_insrt, int ntry, int seed, originalAtomCount - atoms->nr); } - if (rpos != NULL) + if (rpos != nullptr) { for (int i = 0; i < DIM; ++i) { @@ -329,7 +329,7 @@ class InsertMolecules : public ICommandLineOptionsModule, public ITopologyProvid InsertMolecules() : bBox_(false), nmolIns_(0), nmolTry_(10), seed_(0), defaultDistance_(0.105), scaleFactor_(0.57), enumRot_(en_rotXYZ), - top_(NULL), ePBC_(-1) + top_(nullptr), ePBC_(-1) { clear_rvec(newBox_); clear_rvec(deltaR_); @@ -337,7 +337,7 @@ class InsertMolecules : public ICommandLineOptionsModule, public ITopologyProvid } virtual ~InsertMolecules() { - if (top_ != NULL) + if (top_ != nullptr) { done_mtop(top_); sfree(top_); @@ -509,7 +509,7 @@ void InsertMolecules::optionsFinished() snew(top_, 1); if (!inputConfFile_.empty()) { - readConformation(inputConfFile_.c_str(), top_, &x_, NULL, + readConformation(inputConfFile_.c_str(), top_, &x_, nullptr, &ePBC_, box_, "solute"); if (top_->natoms == 0) { @@ -560,13 +560,13 @@ int InsertMolecules::run() int ePBC_dummy; matrix box_dummy; readConformation(insertConfFile_.c_str(), top_insrt, &x_insrt, - NULL, &ePBC_dummy, box_dummy, "molecule"); + nullptr, &ePBC_dummy, box_dummy, "molecule"); if (top_insrt->atoms.nr == 0) { gmx_fatal(FARGS, "No molecule in %s, please check your input", insertConfFile_.c_str()); } - if (top_->name == NULL) + if (top_->name == nullptr) { top_->name = top_insrt->name; } @@ -589,7 +589,7 @@ int InsertMolecules::run() fprintf(stderr, "Writing generated configuration to %s\n", outputConfFile_.c_str()); write_sto_conf(outputConfFile_.c_str(), *top_->name, &atoms, - as_rvec_array(x_.data()), NULL, ePBC_, box_); + as_rvec_array(x_.data()), nullptr, ePBC_, box_); /* print size of generated configuration */ fprintf(stderr, "\nOutput configuration contains %d atoms in %d residues\n", diff --git a/src/gromacs/gmxpreprocess/nm2type.cpp b/src/gromacs/gmxpreprocess/nm2type.cpp index a68da1fd54..25f770f7f0 100644 --- a/src/gromacs/gmxpreprocess/nm2type.cpp +++ b/src/gromacs/gmxpreprocess/nm2type.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -67,10 +67,10 @@ static void rd_nm2type_file(const char *fn, int *nnm, t_nm2type **nmp) char buf[1024], elem[16], type[16], nbbuf[16], **newbuf; int i, nb, nnnm, line = 1; double qq, mm; - t_nm2type *nm2t = NULL; + t_nm2type *nm2t = nullptr; fp = fflib_open(fn); - if (NULL == fp) + if (nullptr == fp) { gmx_fatal(FARGS, "Can not find %s in library directory", fn); } @@ -80,7 +80,7 @@ static void rd_nm2type_file(const char *fn, int *nnm, t_nm2type **nmp) do { /* Read a line from the file */ - bCont = (fgets2(buf, 1023, fp) != NULL); + bCont = (fgets2(buf, 1023, fp) != nullptr); if (bCont) { @@ -110,7 +110,7 @@ static void rd_nm2type_file(const char *fn, int *nnm, t_nm2type **nmp) } else { - newbuf = NULL; + newbuf = nullptr; } nm2t[nnnm].elem = gmx_strdup(elem); nm2t[nnnm].type = gmx_strdup(type); @@ -138,7 +138,7 @@ t_nm2type *rd_nm2type(const char *ffdir, int *nnm) nff = fflib_search_file_end(ffdir, ".n2t", FALSE, &ff); *nnm = 0; - nm = NULL; + nm = nullptr; for (f = 0; f < nff; f++) { rd_nm2type_file(ff[f], nnm, &nm); diff --git a/src/gromacs/gmxpreprocess/pdb2gmx.cpp b/src/gromacs/gmxpreprocess/pdb2gmx.cpp index 516a4cd6a2..bc2b891a7f 100644 --- a/src/gromacs/gmxpreprocess/pdb2gmx.cpp +++ b/src/gromacs/gmxpreprocess/pdb2gmx.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -276,7 +276,7 @@ static char *search_resrename(int nrr, rtprename_t *rr, char *nn; int i; - nn = NULL; + nn = nullptr; i = 0; while (i < nrr && ((!bCompareFFRTPname && strcmp(name, rr[i].gmx) != 0) || @@ -326,7 +326,7 @@ static void rename_resrtp(t_atoms *pdba, int nterpairs, int *r_start, int *r_end char *nn; gmx_bool bFFRTPTERRNM; - bFFRTPTERRNM = (getenv("GMX_NO_FFRTP_TER_RENAME") == NULL); + bFFRTPTERRNM = (getenv("GMX_NO_FFRTP_TER_RENAME") == nullptr); for (r = 0; r < pdba->nres; r++) { @@ -349,7 +349,7 @@ static void rename_resrtp(t_atoms *pdba, int nterpairs, int *r_start, int *r_end nn = search_resrename(nrr, rr, *pdba->resinfo[r].rtp, bStart, bEnd, FALSE); - if (bFFRTPTERRNM && nn == NULL && (bStart || bEnd)) + if (bFFRTPTERRNM && nn == nullptr && (bStart || bEnd)) { /* This is a terminal residue, but the residue name, * currently stored in .rtp, is not a standard residue name, @@ -360,7 +360,7 @@ static void rename_resrtp(t_atoms *pdba, int nterpairs, int *r_start, int *r_end *pdba->resinfo[r].rtp, bStart, bEnd, TRUE); } - if (nn != NULL && strcmp(*pdba->resinfo[r].rtp, nn) != 0) + if (nn != nullptr && strcmp(*pdba->resinfo[r].rtp, nn) != 0) { if (bVerbose) { @@ -378,7 +378,7 @@ static void pdbres_to_gmxrtp(t_atoms *pdba) for (i = 0; (i < pdba->nres); i++) { - if (pdba->resinfo[i].rtp == NULL) + if (pdba->resinfo[i].rtp == nullptr) { pdba->resinfo[i].rtp = pdba->resinfo[i].name; } @@ -395,7 +395,7 @@ static void rename_pdbres(t_atoms *pdba, const char *oldnm, const char *newnm, { resnm = *pdba->resinfo[i].name; if ((bFullCompare && (gmx_strcasecmp(resnm, oldnm) == 0)) || - (!bFullCompare && strstr(resnm, oldnm) != NULL)) + (!bFullCompare && strstr(resnm, oldnm) != nullptr)) { /* Rename the residue name (not the rtp name) */ pdba->resinfo[i].name = put_symtab(symtab, newnm); @@ -414,7 +414,7 @@ static void rename_bb(t_atoms *pdba, const char *oldnm, const char *newnm, /* We have not set the rtp name yes, use the residue name */ bbnm = *pdba->resinfo[i].name; if ((bFullCompare && (gmx_strcasecmp(bbnm, oldnm) == 0)) || - (!bFullCompare && strstr(bbnm, oldnm) != NULL)) + (!bFullCompare && strstr(bbnm, oldnm) != nullptr)) { /* Change the rtp builing block name */ pdba->resinfo[i].rtp = put_symtab(symtab, newnm); @@ -437,7 +437,7 @@ static void rename_bbint(t_atoms *pdba, const char *oldnm, /* We have not set the rtp name yes, use the residue name */ bbnm = *pdba->resinfo[i].name; if ((bFullCompare && (strcmp(bbnm, oldnm) == 0)) || - (!bFullCompare && strstr(bbnm, oldnm) != NULL)) + (!bFullCompare && strstr(bbnm, oldnm) != nullptr)) { ptr = gettp(i, nrr, rr); pdba->resinfo[i].rtp = put_symtab(symtab, ptr); @@ -538,13 +538,13 @@ static int read_pdball(const char *inf, const char *outf, char *title, printf("Reading %s...\n", inf); t_topology *top; snew(top, 1); - read_tps_conf(inf, top, ePBC, x, NULL, box, FALSE); + read_tps_conf(inf, top, ePBC, x, nullptr, box, FALSE); strncpy(title, *top->name, STRLEN); title[STRLEN-1] = '\0'; *atoms = top->atoms; sfree(top); natom = atoms->nr; - if (atoms->pdbinfo == NULL) + if (atoms->pdbinfo == nullptr) { snew(atoms->pdbinfo, atoms->nr); } @@ -582,8 +582,8 @@ static int read_pdball(const char *inf, const char *outf, char *title, rename_pdbres(atoms, "SOL", watres, FALSE, symtab); rename_pdbres(atoms, "WAT", watres, FALSE, symtab); - rename_atoms("xlateat.dat", NULL, - atoms, symtab, NULL, TRUE, rt, TRUE, bVerbose); + rename_atoms("xlateat.dat", nullptr, + atoms, symtab, nullptr, TRUE, rt, TRUE, bVerbose); if (natom == 0) { @@ -592,7 +592,7 @@ static int read_pdball(const char *inf, const char *outf, char *title, if (outf) { - write_sto_conf(outf, title, atoms, *x, NULL, *ePBC, box); + write_sto_conf(outf, title, atoms, *x, nullptr, *ePBC, box); } return natom; @@ -716,7 +716,7 @@ static void sort_pdbatoms(t_restp restp[], pdba = *pdbaptr; natoms = pdba->nr; - pdbnew = NULL; + pdbnew = nullptr; snew(xnew, 1); snew(pdbi, natoms); @@ -1009,9 +1009,9 @@ modify_chain_numbers(t_atoms * pdba, old_prev_chainnum = -1; new_chainnum = -1; - this_atomname = NULL; + this_atomname = nullptr; this_atomnum = -1; - this_resname = NULL; + this_resname = nullptr; this_resnum = -1; this_chainid = '?'; @@ -1028,7 +1028,7 @@ modify_chain_numbers(t_atoms * pdba, prev_chainid = this_chainid; this_atomname = *(pdba->atomname[i]); - this_atomnum = (pdba->pdbinfo != NULL) ? pdba->pdbinfo[i].atomnr : i+1; + this_atomnum = (pdba->pdbinfo != nullptr) ? pdba->pdbinfo[i].atomnr : i+1; this_resname = *ri->name; this_resnum = ri->nr; this_chainid = ri->chainid; @@ -1072,7 +1072,7 @@ modify_chain_numbers(t_atoms * pdba, prev_resname, prev_resnum, prev_chainid, prev_atomnum, prev_atomname, this_resname, this_resnum, this_chainid, this_atomnum, this_atomname); - if (NULL == fgets(select, STRLEN-1, stdin)) + if (nullptr == fgets(select, STRLEN-1, stdin)) { gmx_fatal(FARGS, "Error reading from stdin"); } @@ -1233,7 +1233,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) }; - FILE *fp, *top_file, *top_file2, *itp_file = NULL; + FILE *fp, *top_file, *top_file2, *itp_file = nullptr; int natom, nres; t_atoms pdba_all, *pdba; t_atoms *atoms; @@ -1269,7 +1269,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) int nrrn; char **rrn; int nrtprename; - rtprename_t *rtprename = NULL; + rtprename_t *rtprename = nullptr; int nah, nNtdb, nCtdb, ntdblist; t_hackblock *ntdb, *ctdb, **tdblist; int nssbonds; @@ -1305,7 +1305,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) t_filenm fnm[] = { { efSTX, "-f", "eiwit.pdb", ffREAD }, { efSTO, "-o", "conf", ffWRITE }, - { efTOP, NULL, NULL, ffWRITE }, + { efTOP, nullptr, nullptr, ffWRITE }, { efITP, "-i", "posre", ffWRITE }, { efNDX, "-n", "clean", ffOPTWR }, { efSTO, "-q", "clean.pdb", ffOPTWR } @@ -1324,10 +1324,10 @@ int gmx_pdb2gmx(int argc, char *argv[]) static gmx_bool bRenumRes = FALSE, bRTPresname = FALSE; static real angle = 135.0, distance = 0.3, posre_fc = 1000; static real long_bond_dist = 0.25, short_bond_dist = 0.05; - static const char *vsitestr[] = { NULL, "none", "hydrogens", "aromatics", NULL }; - static const char *watstr[] = { NULL, "select", "none", "spc", "spce", "tip3p", "tip4p", "tip5p", NULL }; - static const char *chainsep[] = { NULL, "id_or_ter", "id_and_ter", "ter", "id", "interactive", NULL }; - static const char *merge[] = {NULL, "no", "all", "interactive", NULL }; + static const char *vsitestr[] = { nullptr, "none", "hydrogens", "aromatics", nullptr }; + static const char *watstr[] = { nullptr, "select", "none", "spc", "spce", "tip3p", "tip4p", "tip5p", nullptr }; + static const char *chainsep[] = { nullptr, "id_or_ter", "id_and_ter", "ter", "id", "interactive", nullptr }; + static const char *merge[] = {nullptr, "no", "all", "interactive", nullptr }; static const char *ff = "select"; t_pargs pa[] = { @@ -1398,13 +1398,13 @@ int gmx_pdb2gmx(int argc, char *argv[]) #define NPARGS asize(pa) if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa, asize(desc), desc, - 0, NULL, &oenv)) + 0, nullptr, &oenv)) { return 0; } /* Force field selection, interactive or direct */ - choose_ff(strcmp(ff, "select") == 0 ? NULL : ff, + choose_ff(strcmp(ff, "select") == 0 ? nullptr : ff, forcefield, sizeof(forcefield), ffdir, sizeof(ffdir)); @@ -1481,7 +1481,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) nrrn = fflib_search_file_end(ffdir, ".r2b", FALSE, &rrn); nrtprename = 0; - rtprename = NULL; + rtprename = nullptr; for (i = 0; i < nrrn; i++) { fp = fflib_open(rrn[i]); @@ -1507,13 +1507,13 @@ int gmx_pdb2gmx(int argc, char *argv[]) } clear_mat(box); - if (watermodel != NULL && (strstr(watermodel, "4p") || - strstr(watermodel, "4P"))) + if (watermodel != nullptr && (strstr(watermodel, "4p") || + strstr(watermodel, "4P"))) { watres = "HO4"; } - else if (watermodel != NULL && (strstr(watermodel, "5p") || - strstr(watermodel, "5P"))) + else if (watermodel != nullptr && (strstr(watermodel, "5p") || + strstr(watermodel, "5P"))) { watres = "HO5"; } @@ -1539,9 +1539,9 @@ int gmx_pdb2gmx(int argc, char *argv[]) nchainmerges = 0; - this_atomname = NULL; + this_atomname = nullptr; this_atomnum = -1; - this_resname = NULL; + this_resname = nullptr; this_resnum = -1; this_chainid = '?'; this_chainnumber = -1; @@ -1572,7 +1572,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) } this_atomname = *pdba_all.atomname[i]; - this_atomnum = (pdba_all.pdbinfo != NULL) ? pdba_all.pdbinfo[i].atomnr : i+1; + this_atomnum = (pdba_all.pdbinfo != nullptr) ? pdba_all.pdbinfo[i].atomnr : i+1; this_resname = *ri->name; this_resnum = ri->nr; this_chainid = ri->chainid; @@ -1593,7 +1593,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) prev_resname, prev_resnum, prev_chainid, prev_atomnum, prev_atomname, this_resname, this_resnum, this_chainid, this_atomnum, this_atomname); - if (NULL == fgets(select, STRLEN-1, stdin)) + if (nullptr == fgets(select, STRLEN-1, stdin)) { gmx_fatal(FARGS, "Error reading from stdin"); } @@ -1763,7 +1763,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) printf("Reading residue database... (%s)\n", forcefield); nrtpf = fflib_search_file_end(ffdir, ".rtp", TRUE, &rtpf); nrtp = 0; - restp = NULL; + restp = nullptr; for (i = 0; i < nrtpf; i++) { read_resall(rtpf[i], &nrtp, &restp, atype, &symtab, FALSE); @@ -1792,8 +1792,8 @@ int gmx_pdb2gmx(int argc, char *argv[]) nincl = 0; nmol = 0; - incls = NULL; - mols = NULL; + incls = nullptr; + mols = nullptr; for (chain = 0; (chain < nch); chain++) { cc = &(chains[chain]); @@ -1858,7 +1858,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) { sprintf(fn, "chain_%c%d.pdb", cc->chainid, cc->chainnum); } - write_sto_conf(fn, title, pdba, x, NULL, ePBC, box); + write_sto_conf(fn, title, pdba, x, nullptr, ePBC, box); } @@ -1881,7 +1881,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) { printf("No suitable end (N or 5') terminus found in database - assuming this residue\n" "is already in a terminus-specific form and skipping terminus selection.\n"); - cc->ntdb[i] = NULL; + cc->ntdb[i] = nullptr; } else { @@ -1906,7 +1906,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) } else { - cc->ntdb[i] = NULL; + cc->ntdb[i] = nullptr; } /* And the C terminus */ @@ -1920,7 +1920,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) { printf("No suitable end (C or 3') terminus found in database - assuming this residue\n" "is already in a terminus-specific form and skipping terminus selection.\n"); - cc->ctdb[i] = NULL; + cc->ctdb[i] = nullptr; } else { @@ -1944,7 +1944,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) } else { - cc->ctdb[i] = NULL; + cc->ctdb[i] = nullptr; } } /* lookup hackblocks and rtp for all residues */ @@ -1956,7 +1956,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) requires some re-thinking of code in gen_vsite.c, which I won't do now :( AF 26-7-99 */ - rename_atoms(NULL, ffdir, + rename_atoms(nullptr, ffdir, pdba, &symtab, restp_chain, FALSE, rt, FALSE, bVerbose); match_atomnames_with_rtp(restp_chain, hb_chain, pdba, x, bVerbose); @@ -1995,12 +1995,12 @@ int gmx_pdb2gmx(int argc, char *argv[]) printf("Generating any missing hydrogen atoms and/or adding termini.\n"); natom = add_h(&pdba, &x, nah, ah, cc->nterpairs, cc->ntdb, cc->ctdb, cc->r_start, cc->r_end, bAllowMissing, - NULL, NULL, TRUE, FALSE); + nullptr, nullptr, TRUE, FALSE); printf("Now there are %d residues with %d atoms\n", pdba->nres, pdba->nr); if (debug) { - write_pdbfile(debug, title, pdba, x, ePBC, box, ' ', 0, NULL, TRUE); + write_pdbfile(debug, title, pdba, x, ePBC, box, ' ', 0, nullptr, TRUE); } if (debug) @@ -2112,7 +2112,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) if (cc->bAllWat) { - top_file2 = NULL; + top_file2 = nullptr; } else if (bITP) @@ -2157,11 +2157,11 @@ int gmx_pdb2gmx(int argc, char *argv[]) { sprintf(fn, "chain_%c.pdb", cc->chainid); } - write_sto_conf(fn, "", pdba, x, NULL, ePBC, box); + write_sto_conf(fn, "", pdba, x, nullptr, ePBC, box); } } - if (watermodel == NULL) + if (watermodel == nullptr) { for (chain = 0; chain < nch; chain++) { @@ -2245,12 +2245,12 @@ int gmx_pdb2gmx(int argc, char *argv[]) { make_new_box(atoms->nr, x, box, box_space, FALSE); } - write_sto_conf(ftp2fn(efSTO, NFILE, fnm), title, atoms, x, NULL, ePBC, box); + write_sto_conf(ftp2fn(efSTO, NFILE, fnm), title, atoms, x, nullptr, ePBC, box); printf("\t\t--------- PLEASE NOTE ------------\n"); printf("You have successfully generated a topology from: %s.\n", opt2fn("-f", NFILE, fnm)); - if (watermodel != NULL) + if (watermodel != nullptr) { printf("The %s force field and the %s water model are used.\n", ffname, watermodel); diff --git a/src/gromacs/gmxpreprocess/pdb2top.cpp b/src/gromacs/gmxpreprocess/pdb2top.cpp index 9943fe4cc2..81ab04fc9f 100644 --- a/src/gromacs/gmxpreprocess/pdb2top.cpp +++ b/src/gromacs/gmxpreprocess/pdb2top.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -155,7 +155,7 @@ choose_ff_impl(const char *ffsel, } int sel; - if (ffsel != NULL) + if (ffsel != nullptr) { sel = -1; int cwdsel = -1; @@ -277,13 +277,13 @@ choose_ff_impl(const char *ffsel, { pret = fgets(buf, STRLEN, stdin); - if (pret != NULL) + if (pret != nullptr) { - sel = strtol(buf, NULL, 10); + sel = strtol(buf, nullptr, 10); sel--; } } - while (pret == NULL || (sel < 0) || (sel >= nff)); + while (pret == nullptr || (sel < 0) || (sel >= nff)); /* Check for a current limitation of the fflib code. * It will always read from the first ff directory in the list. @@ -365,7 +365,7 @@ void choose_watermodel(const char *wmsel, const char *ffdir, if (strcmp(wmsel, "none") == 0) { - *watermodel = NULL; + *watermodel = nullptr; return; } @@ -382,7 +382,7 @@ void choose_watermodel(const char *wmsel, const char *ffdir, { fprintf(stderr, "No file '%s' found, will not include a water model\n", fn_watermodels); - *watermodel = NULL; + *watermodel = nullptr; return; } @@ -390,7 +390,7 @@ void choose_watermodel(const char *wmsel, const char *ffdir, fp = fflib_open(fn_list); printf("\nSelect the Water Model:\n"); nwm = 0; - model = NULL; + model = nullptr; while (get_a_line(fp, buf, STRLEN)) { srenew(model, nwm+1); @@ -415,17 +415,17 @@ void choose_watermodel(const char *wmsel, const char *ffdir, { pret = fgets(buf, STRLEN, stdin); - if (pret != NULL) + if (pret != nullptr) { - sel = strtol(buf, NULL, 10); + sel = strtol(buf, nullptr, 10); sel--; } } - while (pret == NULL || sel < 0 || sel > nwm); + while (pret == nullptr || sel < 0 || sel > nwm); if (sel == nwm) { - *watermodel = NULL; + *watermodel = nullptr; } else { @@ -560,7 +560,7 @@ void print_top_comment(FILE *out, } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; - if (strchr(ffdir, '/') == NULL) + if (strchr(ffdir, '/') == nullptr) { fprintf(out, ";\tForce field was read from the standard GROMACS share directory.\n;\n\n"); } @@ -599,7 +599,7 @@ void print_top_header(FILE *out, const char *filename, fprintf(out, "; Include forcefield parameters\n"); p = strrchr(ffdir, '/'); - p = (ffdir[0] == '.' || p == NULL) ? ffdir : p+1; + p = (ffdir[0] == '.' || p == nullptr) ? ffdir : p+1; fprintf(out, "#include \"%s/%s\"\n\n", p, fflib_forcefield_itp()); } @@ -620,7 +620,7 @@ static void print_top_water(FILE *out, const char *ffdir, const char *water) fprintf(out, "; Include water topology\n"); p = strrchr(ffdir, '/'); - p = (ffdir[0] == '.' || p == NULL) ? ffdir : p+1; + p = (ffdir[0] == '.' || p == nullptr) ? ffdir : p+1; fprintf(out, "#include \"%s/%s.itp\"\n", p, water); fprintf(out, "\n"); @@ -662,7 +662,7 @@ void print_top_mols(FILE *out, for (i = 0; (i < nincl); i++) { incl = strrchr(incls[i], DIR_SEPARATOR); - if (incl == NULL) + if (incl == nullptr) { incl = incls[i]; } @@ -753,7 +753,7 @@ static void do_ssbonds(t_params *ps, t_atoms *atoms, gmx_fatal(FARGS, "Trying to make impossible special bond (%s-%s)!", ssbonds[i].a1, ssbonds[i].a2); } - add_param(ps, ai, aj, NULL, NULL); + add_param(ps, ai, aj, nullptr, nullptr); } } @@ -808,7 +808,7 @@ static void at2bonds(t_params *psb, t_hackblock *hb, fprintf(stderr, "Warning: Short Bond (%d-%d = %g nm)\n", ai+1, aj+1, std::sqrt(dist2)); } - add_param(psb, ai, aj, NULL, hb[resind].rb[ebtsBONDS].b[j].s); + add_param(psb, ai, aj, nullptr, hb[resind].rb[ebtsBONDS].b[j].s); } } /* add bonds from list of hacks (each added atom gets a bond) */ @@ -817,20 +817,20 @@ static void at2bonds(t_params *psb, t_hackblock *hb, for (j = 0; j < hb[resind].nhack; j++) { if ( ( hb[resind].hack[j].tp > 0 || - hb[resind].hack[j].oname == NULL ) && + hb[resind].hack[j].oname == nullptr ) && strcmp(hb[resind].hack[j].a[0], *(atoms->atomname[i])) == 0) { switch (hb[resind].hack[j].tp) { - case 9: /* COOH terminus */ - add_param(psb, i, i+1, NULL, NULL); /* C-O */ - add_param(psb, i, i+2, NULL, NULL); /* C-OA */ - add_param(psb, i+2, i+3, NULL, NULL); /* OA-H */ + case 9: /* COOH terminus */ + add_param(psb, i, i+1, nullptr, nullptr); /* C-O */ + add_param(psb, i, i+2, nullptr, nullptr); /* C-OA */ + add_param(psb, i+2, i+3, nullptr, nullptr); /* OA-H */ break; default: for (k = 0; (k < hb[resind].hack[j].nr); k++) { - add_param(psb, i, i+k+1, NULL, NULL); + add_param(psb, i, i+k+1, nullptr, nullptr); } } } @@ -1030,11 +1030,11 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp, /* first the termini */ for (i = 0; i < nterpairs; i++) { - if (rn[i] >= 0 && ntdb[i] != NULL) + if (rn[i] >= 0 && ntdb[i] != nullptr) { copy_t_hackblock(ntdb[i], &(*hb)[rn[i]]); } - if (rc[i] >= 0 && ctdb[i] != NULL) + if (rc[i] >= 0 && ctdb[i] != nullptr) { merge_t_hackblock(ctdb[i], &(*hb)[rc[i]]); } @@ -1077,8 +1077,8 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp, } bRM = merge_t_bondeds(res->rb, (*hb)[i].rb, tern >= 0, terc >= 0); - if (bRM && ((tern >= 0 && ntdb[tern] == NULL) || - (terc >= 0 && ctdb[terc] == NULL))) + if (bRM && ((tern >= 0 && ntdb[tern] == nullptr) || + (terc >= 0 && ctdb[terc] == nullptr))) { gmx_fatal(FARGS, "There is a dangling bond at at least one of the terminal ends and the force field does not provide terminal entries or files. Fix your terminal residues so that they match the residue database (.rtp) entries, or provide terminal database entries (.tdb)."); } @@ -1102,9 +1102,9 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp, /* find atom in restp */ for (l = 0; l < (*restp)[i].natom; l++) { - if ( ( (*hb)[i].hack[j].oname == NULL && + if ( ( (*hb)[i].hack[j].oname == nullptr && strcmp((*hb)[i].hack[j].a[0], *(*restp)[i].atomname[l]) == 0 ) || - ( (*hb)[i].hack[j].oname != NULL && + ( (*hb)[i].hack[j].oname != nullptr && strcmp((*hb)[i].hack[j].oname, *(*restp)[i].atomname[l]) == 0 ) ) { break; @@ -1119,22 +1119,22 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp, /* Deleting can happen also only on the input atoms, * not necessarily always on the rtp entry. */ - if (!((*hb)[i].hack[j].oname != NULL && - (*hb)[i].hack[j].nname != NULL) && - !((*hb)[i].hack[j].oname != NULL && - (*hb)[i].hack[j].nname == NULL)) + if (!((*hb)[i].hack[j].oname != nullptr && + (*hb)[i].hack[j].nname != nullptr) && + !((*hb)[i].hack[j].oname != nullptr && + (*hb)[i].hack[j].nname == nullptr)) { gmx_fatal(FARGS, "atom %s not found in buiding block %d%s " "while combining tdb and rtp", - (*hb)[i].hack[j].oname != NULL ? + (*hb)[i].hack[j].oname != nullptr ? (*hb)[i].hack[j].oname : (*hb)[i].hack[j].a[0], i+1, *resinfo[i].rtp); } } else { - if ( (*hb)[i].hack[j].oname == NULL) + if ( (*hb)[i].hack[j].oname == nullptr) { /* we're adding: */ add_atom_to_restp(&(*restp)[i], l, &(*hb)[i].hack[j]); @@ -1142,7 +1142,7 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp, else { /* oname != NULL */ - if ( (*hb)[i].hack[j].nname == NULL) + if ( (*hb)[i].hack[j].nname == nullptr) { /* we're deleting */ if (debug) @@ -1237,7 +1237,7 @@ static gmx_bool match_atomnames_with_rtp_atom(t_atoms *pdba, rvec *x, int atind, bDeleted = FALSE; for (j = 0; j < hbr->nhack; j++) { - if (hbr->hack[j].oname != NULL && hbr->hack[j].nname != NULL && + if (hbr->hack[j].oname != nullptr && hbr->hack[j].nname != nullptr && gmx_strcasecmp(oldnm, hbr->hack[j].oname) == 0) { /* This is a replace entry. */ @@ -1246,7 +1246,7 @@ static gmx_bool match_atomnames_with_rtp_atom(t_atoms *pdba, rvec *x, int atind, for (k = 0; k < hbr->nhack; k++) { if (k != j && - hbr->hack[k].oname != NULL && hbr->hack[k].nname != NULL && + hbr->hack[k].oname != nullptr && hbr->hack[k].nname != nullptr && gmx_strcasecmp(hbr->hack[k].nname, hbr->hack[j].oname) == 0) { /* The replace in hack[j] replaces an atom that @@ -1283,8 +1283,8 @@ static gmx_bool match_atomnames_with_rtp_atom(t_atoms *pdba, rvec *x, int atind, bFoundInAdd = FALSE; for (k = 0; k < hbr->nhack; k++) { - if (hbr->hack[k].oname == NULL && - hbr->hack[k].nname != NULL && + if (hbr->hack[k].oname == nullptr && + hbr->hack[k].nname != nullptr && atomname_cmp_nr(newnm, &hbr->hack[k], &anmnr)) { if (anmnr <= 1) @@ -1333,7 +1333,7 @@ static gmx_bool match_atomnames_with_rtp_atom(t_atoms *pdba, rvec *x, int atind, snew(pdba->atomname[atind], 1); *pdba->atomname[atind] = gmx_strdup(newnm); } - else if (hbr->hack[j].oname != NULL && hbr->hack[j].nname == NULL && + else if (hbr->hack[j].oname != nullptr && hbr->hack[j].nname == nullptr && gmx_strcasecmp(oldnm, hbr->hack[j].oname) == 0) { /* This is a delete entry, check if this atom is present @@ -1454,8 +1454,8 @@ static void gen_cmap(t_params *psb, t_restp *restp, t_atoms *atoms) /* Skip this CMAP entry if it refers to residues before the * first or after the last residue. */ - if (((strchr(pname, '-') != NULL) && (residx == 0)) || - ((strchr(pname, '+') != NULL) && (residx == nres-1))) + if (((strchr(pname, '-') != nullptr) && (residx == 0)) || + ((strchr(pname, '+') != nullptr) && (residx == nres-1))) { bAddCMAP = FALSE; break; diff --git a/src/gromacs/gmxpreprocess/pgutil.cpp b/src/gromacs/gmxpreprocess/pgutil.cpp index 7a187208a2..a4418abf9a 100644 --- a/src/gromacs/gmxpreprocess/pgutil.cpp +++ b/src/gromacs/gmxpreprocess/pgutil.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -96,8 +96,8 @@ int search_atom(const char *type, int start, t_atom *at = atoms->atom; char ** const * anm = atoms->atomname; - bPrevious = (strchr(type, '-') != NULL); - bNext = (strchr(type, '+') != NULL); + bPrevious = (strchr(type, '-') != nullptr); + bNext = (strchr(type, '+') != nullptr); if (!bPrevious) { diff --git a/src/gromacs/gmxpreprocess/read-conformation.cpp b/src/gromacs/gmxpreprocess/read-conformation.cpp index e391d2141c..950f751acb 100644 --- a/src/gromacs/gmxpreprocess/read-conformation.cpp +++ b/src/gromacs/gmxpreprocess/read-conformation.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -80,9 +80,9 @@ void readConformation(const char *confin, gmx_mtop_t *top, { fprintf(stderr, "Reading %s configuration%s\n", statusTitle, v ? " and velocities" : ""); - rvec *x_tmp = NULL, *v_tmp = NULL; + rvec *x_tmp = nullptr, *v_tmp = nullptr; bool dummy; - readConfAndTopology(confin, &dummy, top, ePBC, x ? &x_tmp : NULL, v ? &v_tmp : NULL, box); + readConfAndTopology(confin, &dummy, top, ePBC, x ? &x_tmp : nullptr, v ? &v_tmp : nullptr, box); const gmx::sfree_guard xguard(x_tmp); const gmx::sfree_guard vguard(v_tmp); if (x && x_tmp) @@ -103,8 +103,8 @@ void readConformation(const char *confin, t_topology *top, { fprintf(stderr, "Reading %s configuration%s\n", statusTitle, v ? " and velocities" : ""); - rvec *x_tmp = NULL, *v_tmp = NULL; - read_tps_conf(confin, top, ePBC, x ? &x_tmp : NULL, v ? &v_tmp : NULL, box, FALSE); + rvec *x_tmp = nullptr, *v_tmp = nullptr; + read_tps_conf(confin, top, ePBC, x ? &x_tmp : nullptr, v ? &v_tmp : nullptr, box, FALSE); const gmx::sfree_guard xguard(x_tmp); const gmx::sfree_guard vguard(v_tmp); if (x && x_tmp) diff --git a/src/gromacs/gmxpreprocess/readir.cpp b/src/gromacs/gmxpreprocess/readir.cpp index aac04e776a..1c27eb5860 100644 --- a/src/gromacs/gmxpreprocess/readir.cpp +++ b/src/gromacs/gmxpreprocess/readir.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -108,7 +108,7 @@ typedef struct t_inputrec_strings } gmx_inputrec_strings; -static gmx_inputrec_strings *is = NULL; +static gmx_inputrec_strings *is = nullptr; void init_inputrec_strings() { @@ -122,7 +122,7 @@ void init_inputrec_strings() void done_inputrec_strings() { sfree(is); - is = NULL; + is = nullptr; } @@ -137,11 +137,11 @@ enum { }; static const char *constraints[eshNR+1] = { - "none", "h-bonds", "all-bonds", "h-angles", "all-angles", NULL + "none", "h-bonds", "all-bonds", "h-angles", "all-angles", nullptr }; static const char *couple_lam[ecouplamNR+1] = { - "vdw-q", "vdw", "q", "none", NULL + "vdw-q", "vdw", "q", "none", nullptr }; void init_ir(t_inputrec *ir, t_gromppopts *opts) @@ -1067,7 +1067,7 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts, CHECK(EEL_FULL(ir->coulombtype) || ir->implicit_solvent == eisGBSA); } - if (getenv("GMX_DO_GALACTIC_DYNAMICS") == NULL) + if (getenv("GMX_DO_GALACTIC_DYNAMICS") == nullptr) { sprintf(err_buf, "epsilon-r must be >= 0 instead of %g\n", ir->epsilon_r); CHECK(ir->epsilon_r < 0); @@ -1432,7 +1432,7 @@ int str_nelem(const char *str, int maxptr, char *ptr[]) } ltrim(copy); } - if (ptr == NULL) + if (ptr == nullptr) { sfree(copy0); } @@ -1649,8 +1649,8 @@ static void do_wall_params(t_inputrec *ir, char *names[MAXPTR]; double dbl; - opts->wall_atomtype[0] = NULL; - opts->wall_atomtype[1] = NULL; + opts->wall_atomtype[0] = nullptr; + opts->wall_atomtype[1] = nullptr; ir->wall_atomtype[0] = -1; ir->wall_atomtype[1] = -1; @@ -1879,9 +1879,9 @@ void get_ir(const char *mdparin, const char *mdparout, CCTYPE ("VARIOUS PREPROCESSING OPTIONS"); CTYPE ("Preprocessor information: use cpp syntax."); CTYPE ("e.g.: -I/home/joe/doe -I/home/mary/roe"); - STYPE ("include", opts->include, NULL); + STYPE ("include", opts->include, nullptr); CTYPE ("e.g.: -DPOSRES -DFLEXIBLE (note these variable names are case sensitive)"); - STYPE ("define", opts->define, NULL); + STYPE ("define", opts->define, nullptr); CCTYPE ("RUN CONTROL PARAMETERS"); EETYPE("integrator", ir->eI, ei_names); @@ -1898,7 +1898,7 @@ void get_ir(const char *mdparin, const char *mdparout, CTYPE ("number of steps for center of mass motion removal"); ITYPE ("nstcomm", ir->nstcomm, 100); CTYPE ("group(s) for center of mass motion removal"); - STYPE ("comm-grps", is->vcm, NULL); + STYPE ("comm-grps", is->vcm, nullptr); CCTYPE ("LANGEVIN DYNAMICS OPTIONS"); CTYPE ("Friction coefficient (amu/ps) and random seed"); @@ -1937,9 +1937,9 @@ void get_ir(const char *mdparin, const char *mdparout, CTYPE ("This selects the subset of atoms for the compressed"); CTYPE ("trajectory file. You can select multiple groups. By"); CTYPE ("default, all atoms will be written."); - STYPE ("compressed-x-grps", is->x_compressed_groups, NULL); + STYPE ("compressed-x-grps", is->x_compressed_groups, nullptr); CTYPE ("Selection of energy groups"); - STYPE ("energygrps", is->energy, NULL); + STYPE ("energygrps", is->energy, nullptr); /* Neighbor searching */ CCTYPE ("NEIGHBORSEARCHING PARAMETERS"); @@ -1981,7 +1981,7 @@ void get_ir(const char *mdparin, const char *mdparout, CTYPE ("Extension of the potential lookup tables beyond the cut-off"); RTYPE ("table-extension", ir->tabext, 1.0); CTYPE ("Separate tables between energy group pairs"); - STYPE ("energygrp-table", is->egptable, NULL); + STYPE ("energygrp-table", is->egptable, nullptr); CTYPE ("Spacing for the PME/PPPM FFT grid"); RTYPE ("fourierspacing", ir->fourier_spacing, 0.12); CTYPE ("FFT grid size, when a value is 0 fourierspacing will be used"); @@ -2029,18 +2029,18 @@ void get_ir(const char *mdparin, const char *mdparout, ITYPE("nh-chain-length", ir->opts.nhchainlength, 10); EETYPE("print-nose-hoover-chain-variables", ir->bPrintNHChains, yesno_names); CTYPE ("Groups to couple separately"); - STYPE ("tc-grps", is->tcgrps, NULL); + STYPE ("tc-grps", is->tcgrps, nullptr); CTYPE ("Time constant (ps) and reference temperature (K)"); - STYPE ("tau-t", is->tau_t, NULL); - STYPE ("ref-t", is->ref_t, NULL); + STYPE ("tau-t", is->tau_t, nullptr); + STYPE ("ref-t", is->ref_t, nullptr); CTYPE ("pressure coupling"); EETYPE("pcoupl", ir->epc, epcoupl_names); EETYPE("pcoupltype", ir->epct, epcoupltype_names); ITYPE ("nstpcouple", ir->nstpcouple, -1); CTYPE ("Time constant (ps), compressibility (1/bar) and reference P (bar)"); RTYPE ("tau-p", ir->tau_p, 1.0); - STYPE ("compressibility", dumstr[0], NULL); - STYPE ("ref-p", dumstr[1], NULL); + STYPE ("compressibility", dumstr[0], nullptr); + STYPE ("ref-p", dumstr[1], nullptr); CTYPE ("Scaling of reference coordinates, No, All or COM"); EETYPE ("refcoord-scaling", ir->refcoord_scaling, erefscaling_names); @@ -2048,41 +2048,41 @@ void get_ir(const char *mdparin, const char *mdparout, CCTYPE ("OPTIONS FOR QMMM calculations"); EETYPE("QMMM", ir->bQMMM, yesno_names); CTYPE ("Groups treated Quantum Mechanically"); - STYPE ("QMMM-grps", is->QMMM, NULL); + STYPE ("QMMM-grps", is->QMMM, nullptr); CTYPE ("QM method"); - STYPE("QMmethod", is->QMmethod, NULL); + STYPE("QMmethod", is->QMmethod, nullptr); CTYPE ("QMMM scheme"); EETYPE("QMMMscheme", ir->QMMMscheme, eQMMMscheme_names); CTYPE ("QM basisset"); - STYPE("QMbasis", is->QMbasis, NULL); + STYPE("QMbasis", is->QMbasis, nullptr); CTYPE ("QM charge"); - STYPE ("QMcharge", is->QMcharge, NULL); + STYPE ("QMcharge", is->QMcharge, nullptr); CTYPE ("QM multiplicity"); - STYPE ("QMmult", is->QMmult, NULL); + STYPE ("QMmult", is->QMmult, nullptr); CTYPE ("Surface Hopping"); - STYPE ("SH", is->bSH, NULL); + STYPE ("SH", is->bSH, nullptr); CTYPE ("CAS space options"); - STYPE ("CASorbitals", is->CASorbitals, NULL); - STYPE ("CASelectrons", is->CASelectrons, NULL); - STYPE ("SAon", is->SAon, NULL); - STYPE ("SAoff", is->SAoff, NULL); - STYPE ("SAsteps", is->SAsteps, NULL); + STYPE ("CASorbitals", is->CASorbitals, nullptr); + STYPE ("CASelectrons", is->CASelectrons, nullptr); + STYPE ("SAon", is->SAon, nullptr); + STYPE ("SAoff", is->SAoff, nullptr); + STYPE ("SAsteps", is->SAsteps, nullptr); CTYPE ("Scale factor for MM charges"); RTYPE ("MMChargeScaleFactor", ir->scalefactor, 1.0); CTYPE ("Optimization of QM subsystem"); - STYPE ("bOPT", is->bOPT, NULL); - STYPE ("bTS", is->bTS, NULL); + STYPE ("bOPT", is->bOPT, nullptr); + STYPE ("bTS", is->bTS, nullptr); /* Simulated annealing */ CCTYPE("SIMULATED ANNEALING"); CTYPE ("Type of annealing for each temperature group (no/single/periodic)"); - STYPE ("annealing", is->anneal, NULL); + STYPE ("annealing", is->anneal, nullptr); CTYPE ("Number of time points to use for specifying annealing in each group"); - STYPE ("annealing-npoints", is->anneal_npoints, NULL); + STYPE ("annealing-npoints", is->anneal_npoints, nullptr); CTYPE ("List of times at the annealing points for each group"); - STYPE ("annealing-time", is->anneal_time, NULL); + STYPE ("annealing-time", is->anneal_time, nullptr); CTYPE ("Temp. at each annealing point, for each group."); - STYPE ("annealing-temp", is->anneal_temp, NULL); + STYPE ("annealing-temp", is->anneal_temp, nullptr); /* Startup run */ CCTYPE ("GENERATE VELOCITIES FOR STARTUP RUN"); @@ -2116,7 +2116,7 @@ void get_ir(const char *mdparin, const char *mdparout, /* Energy group exclusions */ CCTYPE ("ENERGY GROUP EXCLUSIONS"); CTYPE ("Pairs of energy groups for which all non-bonded interactions are excluded"); - STYPE ("energygrp-excl", is->egpexcl, NULL); + STYPE ("energygrp-excl", is->egpexcl, nullptr); /* Walls */ CCTYPE ("WALLS"); @@ -2124,8 +2124,8 @@ void get_ir(const char *mdparin, const char *mdparout, ITYPE ("nwall", ir->nwall, 0); EETYPE("wall-type", ir->wall_type, ewt_names); RTYPE ("wall-r-linpot", ir->wall_r_linpot, -1); - STYPE ("wall-atomtype", is->wall_atomtype, NULL); - STYPE ("wall-density", is->wall_density, NULL); + STYPE ("wall-atomtype", is->wall_atomtype, nullptr); + STYPE ("wall-density", is->wall_density, nullptr); RTYPE ("wall-ewald-zfac", ir->wall_ewald_zfac, 3); /* COM pulling */ @@ -2150,7 +2150,7 @@ void get_ir(const char *mdparin, const char *mdparout, /* Interactive MD */ ir->bIMD = FALSE; CCTYPE("Group to display and/or manipulate in interactive MD session"); - STYPE ("IMD-group", is->imd_grp, NULL); + STYPE ("IMD-group", is->imd_grp, nullptr); if (is->imd_grp[0] != '\0') { snew(ir->imd, 1); @@ -2174,14 +2174,14 @@ void get_ir(const char *mdparin, const char *mdparout, CTYPE ("Orientation restraints force constant and tau for time averaging"); RTYPE ("orire-fc", ir->orires_fc, 0.0); RTYPE ("orire-tau", ir->orires_tau, 0.0); - STYPE ("orire-fitgrp", is->orirefitgrp, NULL); + STYPE ("orire-fitgrp", is->orirefitgrp, nullptr); CTYPE ("Output frequency for trace(SD) and S to energy file"); ITYPE ("nstorireout", ir->nstorireout, 100); /* free energy variables */ CCTYPE ("Free energy variables"); EETYPE("free-energy", ir->efep, efep_names); - STYPE ("couple-moltype", is->couple_moltype, NULL); + STYPE ("couple-moltype", is->couple_moltype, nullptr); EETYPE("couple-lambda0", opts->couple_lam0, couple_lam); EETYPE("couple-lambda1", opts->couple_lam1, couple_lam); EETYPE("couple-intramol", opts->bCoupleIntra, yesno_names); @@ -2192,15 +2192,15 @@ void get_ir(const char *mdparin, const char *mdparout, ITYPE ("init-lambda-state", fep->init_fep_state, -1); RTYPE ("delta-lambda", fep->delta_lambda, 0.0); ITYPE ("nstdhdl", fep->nstdhdl, 50); - STYPE ("fep-lambdas", is->fep_lambda[efptFEP], NULL); - STYPE ("mass-lambdas", is->fep_lambda[efptMASS], NULL); - STYPE ("coul-lambdas", is->fep_lambda[efptCOUL], NULL); - STYPE ("vdw-lambdas", is->fep_lambda[efptVDW], NULL); - STYPE ("bonded-lambdas", is->fep_lambda[efptBONDED], NULL); - STYPE ("restraint-lambdas", is->fep_lambda[efptRESTRAINT], NULL); - STYPE ("temperature-lambdas", is->fep_lambda[efptTEMPERATURE], NULL); + STYPE ("fep-lambdas", is->fep_lambda[efptFEP], nullptr); + STYPE ("mass-lambdas", is->fep_lambda[efptMASS], nullptr); + STYPE ("coul-lambdas", is->fep_lambda[efptCOUL], nullptr); + STYPE ("vdw-lambdas", is->fep_lambda[efptVDW], nullptr); + STYPE ("bonded-lambdas", is->fep_lambda[efptBONDED], nullptr); + STYPE ("restraint-lambdas", is->fep_lambda[efptRESTRAINT], nullptr); + STYPE ("temperature-lambdas", is->fep_lambda[efptTEMPERATURE], nullptr); ITYPE ("calc-lambda-neighbors", fep->lambda_neighbors, 1); - STYPE ("init-lambda-weights", is->lambda_weights, NULL); + STYPE ("init-lambda-weights", is->lambda_weights, nullptr); EETYPE("dhdl-print-energy", fep->edHdLPrintEnergy, edHdLPrintEnergy_names); RTYPE ("sc-alpha", fep->sc_alpha, 0.0); ITYPE ("sc-power", fep->sc_power, 1); @@ -2217,12 +2217,12 @@ void get_ir(const char *mdparin, const char *mdparout, /* Non-equilibrium MD stuff */ CCTYPE("Non-equilibrium MD stuff"); - STYPE ("acc-grps", is->accgrps, NULL); - STYPE ("accelerate", is->acc, NULL); - STYPE ("freezegrps", is->freeze, NULL); - STYPE ("freezedim", is->frdim, NULL); + STYPE ("acc-grps", is->accgrps, nullptr); + STYPE ("accelerate", is->acc, nullptr); + STYPE ("freezegrps", is->freeze, nullptr); + STYPE ("freezedim", is->frdim, nullptr); RTYPE ("cos-acceleration", ir->cos_accel, 0); - STYPE ("deform", is->deform, NULL); + STYPE ("deform", is->deform, nullptr); /* simulated tempering variables */ CCTYPE("simulated tempering variables"); @@ -2285,14 +2285,14 @@ void get_ir(const char *mdparin, const char *mdparout, snew(ir->swap->grp[i].molname, STRLEN); } CTYPE("Two index groups that contain the compartment-partitioning atoms"); - STYPE("split-group0", ir->swap->grp[eGrpSplit0].molname, NULL); - STYPE("split-group1", ir->swap->grp[eGrpSplit1].molname, NULL); + STYPE("split-group0", ir->swap->grp[eGrpSplit0].molname, nullptr); + STYPE("split-group1", ir->swap->grp[eGrpSplit1].molname, nullptr); CTYPE("Use center of mass of split groups (yes/no), otherwise center of geometry is used"); EETYPE("massw-split0", ir->swap->massw_split[0], yesno_names); EETYPE("massw-split1", ir->swap->massw_split[1], yesno_names); CTYPE("Name of solvent molecules"); - STYPE("solvent-group", ir->swap->grp[eGrpSolvent].molname, NULL); + STYPE("solvent-group", ir->swap->grp[eGrpSolvent].molname, nullptr); CTYPE("Split cylinder: radius, upper and lower extension (nm) (this will define the channels)"); CTYPE("Note that the split cylinder settings do not have an influence on the swapping protocol,"); @@ -2315,7 +2315,7 @@ void get_ir(const char *mdparin, const char *mdparout, int ig = eSwapFixedGrpNR + i; sprintf(buf, "iontype%d-name", i); - STYPE(buf, ir->swap->grp[ig].molname, NULL); + STYPE(buf, ir->swap->grp[ig].molname, nullptr); sprintf(buf, "iontype%d-in-A", i); ITYPE(buf, ir->swap->grp[ig].nmolReq[0], -1); sprintf(buf, "iontype%d-in-B", i); @@ -2343,8 +2343,8 @@ void get_ir(const char *mdparin, const char *mdparout, /* User defined thingies */ CCTYPE ("User defined thingies"); - STYPE ("user1-grps", is->user1, NULL); - STYPE ("user2-grps", is->user2, NULL); + STYPE ("user1-grps", is->user1, nullptr); + STYPE ("user2-grps", is->user2, nullptr); ITYPE ("userint1", ir->userint1, 0); ITYPE ("userint2", ir->userint2, 0); ITYPE ("userint3", ir->userint3, 0); @@ -2437,7 +2437,7 @@ void get_ir(const char *mdparin, const char *mdparout, ir->nstcomm = 0; } - opts->couple_moltype = NULL; + opts->couple_moltype = nullptr; if (strlen(is->couple_moltype) > 0) { if (ir->efep != efepNO) @@ -2526,7 +2526,7 @@ void get_ir(const char *mdparin, const char *mdparout, /* ORIENTATION RESTRAINT PARAMETERS */ - if (opts->bOrire && str_nelem(is->orirefitgrp, MAXPTR, NULL) != 1) + if (opts->bOrire && str_nelem(is->orirefitgrp, MAXPTR, nullptr) != 1) { warning_error(wi, "ERROR: Need one orientation restraint fit group\n"); } @@ -2779,7 +2779,7 @@ static gmx_bool do_numbering(int natoms, gmx_groups_t *groups, int ng, char *ptr { /* All atoms are part of one (or no) group, no index required */ groups->ngrpnr[gtype] = 0; - groups->grpnr[gtype] = NULL; + groups->grpnr[gtype] = nullptr; } else { @@ -3229,7 +3229,7 @@ void do_index(const char* mdparin, const char *ndx, { fprintf(stderr, "processing index file...\n"); } - if (ndx == NULL) + if (ndx == nullptr) { snew(grps, 1); snew(grps->index, 1); @@ -3407,8 +3407,8 @@ void do_index(const char* mdparin, const char *ndx, { ir->opts.annealing[i] = eannNO; ir->opts.anneal_npoints[i] = 0; - ir->opts.anneal_time[i] = NULL; - ir->opts.anneal_temp[i] = NULL; + ir->opts.anneal_time[i] = nullptr; + ir->opts.anneal_temp[i] = nullptr; } if (nSA > 0) { @@ -3961,7 +3961,7 @@ check_combination_rule_differences(const gmx_mtop_t *mtop, int state, */ tol = 1e-5; ptr = getenv("GMX_LJCOMB_TOL"); - if (ptr != NULL) + if (ptr != nullptr) { double dbl; double gmx_unused canary; diff --git a/src/gromacs/gmxpreprocess/readpull.cpp b/src/gromacs/gmxpreprocess/readpull.cpp index 4c407ef30e..161674e1be 100644 --- a/src/gromacs/gmxpreprocess/readpull.cpp +++ b/src/gromacs/gmxpreprocess/readpull.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -363,7 +363,7 @@ char **read_pullparams(int *ninp_p, t_inpfile **inp_p, { sprintf(wbuf, "%s should contain %d pull group indices with geometry %s", buf, pcrd->ngroup, epullg_names[pcrd->eGeom]); - set_warning_line(wi, NULL, -1); + set_warning_line(wi, nullptr, -1); warning_error(wi, wbuf); } for (int g = 0; g < pcrd->ngroup; g++) @@ -513,9 +513,9 @@ pull_t *set_pull_init(t_inputrec *ir, const gmx_mtop_t *mtop, double t_start; pull = ir->pull; - pull_work = init_pull(NULL, pull, ir, 0, NULL, mtop, NULL, oenv, lambda, FALSE, 0); - md = init_mdatoms(NULL, mtop, ir->efep); - atoms2md(mtop, ir, -1, NULL, mtop->natoms, md); + pull_work = init_pull(nullptr, pull, ir, 0, nullptr, mtop, nullptr, oenv, lambda, FALSE, 0); + md = init_mdatoms(nullptr, mtop, ir->efep); + atoms2md(mtop, ir, -1, nullptr, mtop->natoms, md); if (ir->efep) { update_mdatoms(md, lambda); @@ -525,7 +525,7 @@ pull_t *set_pull_init(t_inputrec *ir, const gmx_mtop_t *mtop, t_start = ir->init_t + ir->init_step*ir->delta_t; - pull_calc_coms(NULL, pull_work, md, &pbc, t_start, x, NULL); + pull_calc_coms(nullptr, pull_work, md, &pbc, t_start, x, nullptr); fprintf(stderr, "Pull group natoms pbc atom distance at start reference at t=0\n"); for (c = 0; c < pull->ncoord; c++) diff --git a/src/gromacs/gmxpreprocess/readrot.cpp b/src/gromacs/gmxpreprocess/readrot.cpp index 91404be809..e92b8e45a3 100644 --- a/src/gromacs/gmxpreprocess/readrot.cpp +++ b/src/gromacs/gmxpreprocess/readrot.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -286,7 +286,7 @@ extern void set_reference_positions( gmx_fatal(FARGS, "Number of atoms in file %s (%d) does not match the number of atoms in rotation group (%d)!\n", reffile, header.natoms, rotg->nat); } - gmx_trr_read_single_frame(reffile, &header.step, &header.t, &header.lambda, f_box, &header.natoms, rotg->x_ref, NULL, NULL); + gmx_trr_read_single_frame(reffile, &header.step, &header.t, &header.lambda, f_box, &header.natoms, rotg->x_ref, nullptr, nullptr); /* Check whether the box is unchanged and output a warning if not: */ check_box_unchanged(f_box, box, reffile, wi); @@ -299,7 +299,7 @@ extern void set_reference_positions( ii = rotg->ind[i]; copy_rvec(x[ii], rotg->x_ref[i]); } - gmx_trr_write_single_frame(reffile, g, 0.0, 0.0, box, rotg->nat, rotg->x_ref, NULL, NULL); + gmx_trr_write_single_frame(reffile, g, 0.0, 0.0, box, rotg->nat, rotg->x_ref, nullptr, nullptr); } } } diff --git a/src/gromacs/gmxpreprocess/resall.cpp b/src/gromacs/gmxpreprocess/resall.cpp index 44dcc5f4b6..a821f64617 100644 --- a/src/gromacs/gmxpreprocess/resall.cpp +++ b/src/gromacs/gmxpreprocess/resall.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -79,7 +79,7 @@ gpp_atomtype_t read_atype(const char *ffdir, t_symtab *tab) /* Skip blank or comment-only lines */ do { - if (fgets2(buf, STRLEN, in) != NULL) + if (fgets2(buf, STRLEN, in) != nullptr) { strip_comment(buf); trim(buf); @@ -122,7 +122,7 @@ static void print_resatoms(FILE *out, gpp_atomtype_t atype, t_restp *rtp) { tp = rtp->atom[j].type; tpnm = get_atomtype_name(tp, atype); - if (tpnm == NULL) + if (tpnm == nullptr) { gmx_fatal(FARGS, "Incorrect atomtype (%d)", tp); } @@ -140,11 +140,11 @@ static gmx_bool read_atoms(FILE *in, char *line, /* Read Atoms */ maxentries = 0; - r0->atom = NULL; - r0->atomname = NULL; - r0->cgnr = NULL; + r0->atom = nullptr; + r0->atomname = nullptr; + r0->cgnr = nullptr; i = 0; - while (get_a_line(in, line, STRLEN) && (strchr(line, '[') == NULL)) + while (get_a_line(in, line, STRLEN) && (strchr(line, '[') == nullptr)) { if (sscanf(line, "%s%s%lf%d", buf, buf1, &q, &cg) != 4) { @@ -184,7 +184,7 @@ gmx_bool read_bondeds(int bt, FILE *in, char *line, t_restp *rtp) int j, n, ni, maxrb; maxrb = rtp->rb[bt].nb; - while (get_a_line(in, line, STRLEN) && (strchr(line, '[') == NULL)) + while (get_a_line(in, line, STRLEN) && (strchr(line, '[') == nullptr)) { if (rtp->rb[bt].nb >= maxrb) { @@ -206,7 +206,7 @@ gmx_bool read_bondeds(int bt, FILE *in, char *line, t_restp *rtp) } for (; j < MAXATOMLIST; j++) { - rtp->rb[bt].b[rtp->rb[bt].nb].a[j] = NULL; + rtp->rb[bt].b[rtp->rb[bt].nb].a[j] = nullptr; } while (isspace(line[n])) { diff --git a/src/gromacs/gmxpreprocess/solvate.cpp b/src/gromacs/gmxpreprocess/solvate.cpp index 93f9ba6c49..f576d62ac1 100644 --- a/src/gromacs/gmxpreprocess/solvate.cpp +++ b/src/gromacs/gmxpreprocess/solvate.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -86,7 +86,7 @@ static void sort_molecule(t_atoms **atoms_solvt, std::vector *x, atoms = *atoms_solvt; /* copy each residue from *atoms to a molecule in *molecule */ - moltypes = NULL; + moltypes = nullptr; nrmoltypes = 0; for (i = 0; i < atoms->nr; i++) { @@ -311,7 +311,7 @@ static void replicateSolventBox(t_atoms *atoms, std::vector *x, // but not in all). t_atoms newAtoms; init_t_atoms(&newAtoms, 0, FALSE); - gmx::AtomsBuilder builder(&newAtoms, NULL); + gmx::AtomsBuilder builder(&newAtoms, nullptr); builder.reserve(atoms->nr * nmol, atoms->nres * nmol); std::vector newX(atoms->nr * nmol); std::vector newV(!v->empty() ? atoms->nr * nmol : 0); @@ -615,7 +615,7 @@ static void add_solv(const char *fn, t_topology *top, char *filename = gmxlibfn(fn); snew(top_solvt, 1); - readConformation(filename, top_solvt, &x_solvt, !v->empty() ? &v_solvt : NULL, + readConformation(filename, top_solvt, &x_solvt, !v->empty() ? &v_solvt : nullptr, &ePBC_solvt, box_solvt, "solvent"); t_atoms *atoms_solvt = &top_solvt->atoms; if (0 == atoms_solvt->nr) @@ -732,7 +732,7 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[], bSkip = FALSE; line++; strcpy(buf2, buf); - if ((temp = strchr(buf2, '\n')) != NULL) + if ((temp = strchr(buf2, '\n')) != nullptr) { temp[0] = '\0'; } @@ -740,7 +740,7 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[], if (buf2[0] == '[') { buf2[0] = ' '; - if ((temp = strchr(buf2, '\n')) != NULL) + if ((temp = strchr(buf2, '\n')) != nullptr) { temp[0] = '\0'; } @@ -781,7 +781,7 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[], } if (bSkip) { - if ((temp = strchr(buf, '\n')) != NULL) + if ((temp = strchr(buf, '\n')) != nullptr) { temp[0] = '\0'; } @@ -876,8 +876,8 @@ int gmx_solvate(int argc, char *argv[]) t_filenm fnm[] = { { efSTX, "-cp", "protein", ffOPTRD }, { efSTX, "-cs", "spc216", ffLIBRD}, - { efSTO, NULL, NULL, ffWRITE}, - { efTOP, NULL, NULL, ffOPTRW}, + { efSTO, nullptr, nullptr, ffWRITE}, + { efTOP, nullptr, nullptr, ffOPTRW}, }; #define NFILE asize(fnm) @@ -928,7 +928,7 @@ int gmx_solvate(int argc, char *argv[]) /* Generate a solute configuration */ conf_prot = opt2fn("-cp", NFILE, fnm); readConformation(conf_prot, top, &x, - bReadV ? &v : NULL, &ePBC, box, "solute"); + bReadV ? &v : nullptr, &ePBC, box, "solute"); if (bReadV && v.empty()) { fprintf(stderr, "Note: no velocities found\n"); @@ -961,7 +961,7 @@ int gmx_solvate(int argc, char *argv[]) fprintf(stderr, "Writing generated configuration to %s\n", confout); const char *outputTitle = (bProt ? *top->name : "Generated by gmx solvate"); write_sto_conf(confout, outputTitle, &top->atoms, as_rvec_array(x.data()), - !v.empty() ? as_rvec_array(v.data()) : NULL, ePBC, box); + !v.empty() ? as_rvec_array(v.data()) : nullptr, ePBC, box); /* print size of generated configuration */ fprintf(stderr, "\nOutput configuration contains %d atoms in %d residues\n", diff --git a/src/gromacs/gmxpreprocess/specbond.cpp b/src/gromacs/gmxpreprocess/specbond.cpp index 74145c5cd2..912c9e38be 100644 --- a/src/gromacs/gmxpreprocess/specbond.cpp +++ b/src/gromacs/gmxpreprocess/specbond.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -70,7 +70,7 @@ t_specbond *get_specbonds(int *nspecbond) { const char *sbfile = "specbond.dat"; - t_specbond *sb = NULL; + t_specbond *sb = nullptr; char r1buf[32], r2buf[32], a1buf[32], a2buf[32], nr1buf[32], nr2buf[32]; double length; int nb1, nb2; @@ -226,8 +226,8 @@ static void rename_1res(t_atoms *pdba, int resind, char *newres, gmx_bool bVerbo int mk_specbonds(t_atoms *pdba, rvec x[], gmx_bool bInteractive, t_ssbond **specbonds, gmx_bool bVerbose) { - t_specbond *sb = NULL; - t_ssbond *bonds = NULL; + t_specbond *sb = nullptr; + t_ssbond *bonds = nullptr; int nsb; int nspec, nbonds; int *specp, *sgp; diff --git a/src/gromacs/gmxpreprocess/ter_db.cpp b/src/gromacs/gmxpreprocess/ter_db.cpp index 0864324551..1af82e44ce 100644 --- a/src/gromacs/gmxpreprocess/ter_db.cpp +++ b/src/gromacs/gmxpreprocess/ter_db.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -122,7 +122,7 @@ static void read_atom(char *line, gmx_bool bAdd, } else { - *nname = NULL; + *nname = nullptr; } } a->type = get_atomtype_type(buf[i++], atype); @@ -166,19 +166,19 @@ static void print_ter_db(const char *ff, char C, int nb, t_hackblock tb[], ndel = 0; for (j = 0; j < tb[i].nhack; j++) { - if (tb[i].hack[j].oname != NULL && tb[i].hack[j].nname != NULL) + if (tb[i].hack[j].oname != nullptr && tb[i].hack[j].nname != nullptr) { nrepl++; } - else if (tb[i].hack[j].oname == NULL && tb[i].hack[j].nname != NULL) + else if (tb[i].hack[j].oname == nullptr && tb[i].hack[j].nname != nullptr) { nadd++; } - else if (tb[i].hack[j].oname != NULL && tb[i].hack[j].nname == NULL) + else if (tb[i].hack[j].oname != nullptr && tb[i].hack[j].nname == nullptr) { ndel++; } - else if (tb[i].hack[j].oname == NULL && tb[i].hack[j].nname == NULL) + else if (tb[i].hack[j].oname == nullptr && tb[i].hack[j].nname == nullptr) { gmx_fatal(FARGS, "invalid hack (%s) in termini database", tb[i].name); } @@ -188,7 +188,7 @@ static void print_ter_db(const char *ff, char C, int nb, t_hackblock tb[], fprintf(out, "[ %s ]\n", kw_names[ekwRepl-ebtsNR-1]); for (j = 0; j < tb[i].nhack; j++) { - if (tb[i].hack[j].oname != NULL && tb[i].hack[j].nname != NULL) + if (tb[i].hack[j].oname != nullptr && tb[i].hack[j].nname != nullptr) { fprintf(out, "%s\t", tb[i].hack[j].oname); print_atom(out, tb[i].hack[j].atom, atype); @@ -200,7 +200,7 @@ static void print_ter_db(const char *ff, char C, int nb, t_hackblock tb[], fprintf(out, "[ %s ]\n", kw_names[ekwAdd-ebtsNR-1]); for (j = 0; j < tb[i].nhack; j++) { - if (tb[i].hack[j].oname == NULL && tb[i].hack[j].nname != NULL) + if (tb[i].hack[j].oname == nullptr && tb[i].hack[j].nname != nullptr) { print_ab(out, &(tb[i].hack[j]), tb[i].hack[j].nname); print_atom(out, tb[i].hack[j].atom, atype); @@ -212,7 +212,7 @@ static void print_ter_db(const char *ff, char C, int nb, t_hackblock tb[], fprintf(out, "[ %s ]\n", kw_names[ekwDel-ebtsNR-1]); for (j = 0; j < tb[i].nhack; j++) { - if (tb[i].hack[j].oname != NULL && tb[i].hack[j].nname == NULL) + if (tb[i].hack[j].oname != nullptr && tb[i].hack[j].nname == nullptr) { fprintf(out, "%s\n", tb[i].hack[j].oname); } @@ -255,7 +255,7 @@ static void read_ter_db_file(char *fn, fflib_filename_base(fn, filebase, STRLEN); /* Remove the C/N termini extension */ ptr = strrchr(filebase, '.'); - if (ptr != NULL) + if (ptr != nullptr) { ptr[0] = '\0'; } @@ -314,7 +314,7 @@ static void read_ter_db_file(char *fn, clear_t_hack(&(tb[nb].hack[nh])); for (i = 0; i < 4; i++) { - tb[nb].hack[nh].a[i] = NULL; + tb[nb].hack[nh].a[i] = nullptr; } tb[nb].nhack++; @@ -347,9 +347,9 @@ static void read_ter_db_file(char *fn, read_atom(line+n, kwnr == ekwAdd, &tb[nb].hack[nh].nname, tb[nb].hack[nh].atom, atype, &tb[nb].hack[nh].cgnr); - if (tb[nb].hack[nh].nname == NULL) + if (tb[nb].hack[nh].nname == nullptr) { - if (tb[nb].hack[nh].oname != NULL) + if (tb[nb].hack[nh].oname != nullptr) { tb[nb].hack[nh].nname = gmx_strdup(tb[nb].hack[nh].oname); } @@ -379,7 +379,7 @@ static void read_ter_db_file(char *fn, } for (; j < MAXATOMLIST; j++) { - tb[nb].rb[kwnr].b[tb[nb].rb[kwnr].nb].a[j] = NULL; + tb[nb].rb[kwnr].b[tb[nb].rb[kwnr].nb].a[j] = nullptr; } strcpy(buf, ""); sscanf(line+n, "%s", buf); @@ -418,7 +418,7 @@ int read_ter_db(const char *ffdir, char ter, */ ntdbf = fflib_search_file_end(ffdir, ext, FALSE, &tdbf); ntb = 0; - *tbptr = NULL; + *tbptr = nullptr; for (f = 0; f < ntdbf; f++) { read_ter_db_file(tdbf[f], &ntb, tbptr, atype); @@ -472,7 +472,7 @@ t_hackblock **filter_ter(int nrtp, t_restp rtp[], restp = get_restp(rtpname_match, nrtp, rtp); n = 0; - list = NULL; + list = nullptr; for (i = 0; i < nb; i++) { @@ -497,13 +497,13 @@ t_hackblock **filter_ter(int nrtp, t_restp rtp[], { /* advance to next |-separated field */ s = strchr(s, '|'); - if (s != NULL) + if (s != nullptr) { s++; } } } - while (!found && s != NULL); + while (!found && s != nullptr); } /* All residue-specific termini have been added. We might have to fall @@ -536,7 +536,7 @@ t_hackblock **filter_ter(int nrtp, t_restp rtp[], /* A conjunction hyphen normally indicates a residue-specific terminus, which is named like "GLY-COOH". A generic terminus won't have a hyphen. */ - bool bFoundAnyHyphen = (c != NULL); + bool bFoundAnyHyphen = (c != nullptr); /* '-' as the last character indicates charge, so if that's the only one found e.g. "COO-", then it was not a conjunction hyphen, so this is a generic terminus */ @@ -549,7 +549,7 @@ t_hackblock **filter_ter(int nrtp, t_restp rtp[], /* Check that we haven't already added a residue-specific version * of this terminus. */ - for (j = 0; j < n && strstr((*list[j]).name, s) == NULL; j++) + for (j = 0; j < n && strstr((*list[j]).name, s) == nullptr; j++) { ; } diff --git a/src/gromacs/gmxpreprocess/tomorse.cpp b/src/gromacs/gmxpreprocess/tomorse.cpp index c2e1ebe4b4..97523622ec 100644 --- a/src/gromacs/gmxpreprocess/tomorse.cpp +++ b/src/gromacs/gmxpreprocess/tomorse.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -65,7 +65,7 @@ static t_2morse *read_dissociation_energies(int *n2morse) char ai[32], aj[32]; double e_diss; const char *fn = "edissoc.dat"; - t_2morse *t2m = NULL; + t_2morse *t2m = nullptr; int maxn2m = 0, n2m = 0; int nread; diff --git a/src/gromacs/gmxpreprocess/topdirs.cpp b/src/gromacs/gmxpreprocess/topdirs.cpp index 6120e2d155..b955ba2d91 100644 --- a/src/gromacs/gmxpreprocess/topdirs.cpp +++ b/src/gromacs/gmxpreprocess/topdirs.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -331,7 +331,7 @@ directive str2dir (char *dstr) return d_invalid; } -static directive **necessary = NULL; +static directive **necessary = nullptr; static void set_nec(directive **n, ...) /* Must always have at least one extra argument */ @@ -353,7 +353,7 @@ static void set_nec(directive **n, ...) void DS_Init(DirStack **DS) { - if (necessary == NULL) + if (necessary == nullptr) { int i; @@ -423,7 +423,7 @@ void DS_Init(DirStack **DS) } } } - *DS = NULL; + *DS = nullptr; } @@ -431,7 +431,7 @@ void DS_Done (DirStack **DS) { DirStack *D; - while (*DS != NULL) + while (*DS != nullptr) { D = *DS; *DS = (*DS)->prev; @@ -454,12 +454,12 @@ int DS_Search(DirStack *DS, directive d) DirStack *D; D = DS; - while ((D != NULL) && (D->d != d)) + while ((D != nullptr) && (D->d != d)) { D = D->prev; } - return (D != NULL); + return (D != nullptr); } int DS_Check_Order(DirStack *DS, directive d) diff --git a/src/gromacs/gmxpreprocess/topio.cpp b/src/gromacs/gmxpreprocess/topio.cpp index 0b2cd30e6d..be75d31152 100644 --- a/src/gromacs/gmxpreprocess/topio.cpp +++ b/src/gromacs/gmxpreprocess/topio.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -272,7 +272,7 @@ static void get_nbparm(char *nb_str, char *comb_str, int *nb, int *comb, } if (*nb == -1) { - *nb = strtol(nb_str, NULL, 10); + *nb = strtol(nb_str, nullptr, 10); } if ((*nb < 1) || (*nb >= eNBF_NR)) { @@ -291,7 +291,7 @@ static void get_nbparm(char *nb_str, char *comb_str, int *nb, int *comb, } if (*comb == -1) { - *comb = strtol(comb_str, NULL, 10); + *comb = strtol(comb_str, nullptr, 10); } if ((*comb < 1) || (*comb >= eCOMB_NR)) { @@ -308,7 +308,7 @@ static char ** cpp_opts(const char *define, const char *include, int n, len; int ncppopts = 0; const char *cppadds[2]; - char **cppopts = NULL; + char **cppopts = nullptr; const char *option[2] = { "-D", "-I" }; const char *nopt[2] = { "define", "include" }; const char *ptr; @@ -357,7 +357,7 @@ static char ** cpp_opts(const char *define, const char *include, } } srenew(cppopts, ++ncppopts); - cppopts[ncppopts-1] = NULL; + cppopts[ncppopts-1] = nullptr; return cppopts; } @@ -547,7 +547,7 @@ static void make_atoms_sys(int nmolb, const gmx_molblock_t *molb, const t_atoms *mol_atoms; atoms->nr = 0; - atoms->atom = NULL; + atoms->atom = nullptr; for (mb = 0; mb < nmolb; mb++) { @@ -589,14 +589,14 @@ static char **read_topol(const char *infile, const char *outfile, { FILE *out; int i, sl, nb_funct; - char *pline = NULL, **title = NULL; + char *pline = nullptr, **title = nullptr; char line[STRLEN], errbuf[256], comb_str[256], nb_str[256]; char genpairs[32]; char *dirstr, *dummy2; int nrcopies, nmol, nmolb = 0, nscan, ncombs, ncopy; double fLJ, fQQ, fPOW; - gmx_molblock_t *molb = NULL; - t_molinfo *mi0 = NULL; + gmx_molblock_t *molb = nullptr; + t_molinfo *mi0 = nullptr; DirStack *DS; directive d, newd; t_nbparam **nbparam, **pair; @@ -610,7 +610,7 @@ static char **read_topol(const char *infile, const char *outfile, /* File handling variables */ int status, done; gmx_cpp_t handle; - char *tmp_line = NULL; + char *tmp_line = nullptr; char warn_buf[STRLEN]; const char *floating_point_arithmetic_tip = "Total charge should normally be an integer. See\n" @@ -625,7 +625,7 @@ static char **read_topol(const char *infile, const char *outfile, } else { - out = NULL; + out = nullptr; } /* open input file */ @@ -639,14 +639,14 @@ static char **read_topol(const char *infile, const char *outfile, DS_Init(&DS); /* directive stack */ nmol = 0; /* no molecules yet... */ d = d_invalid; /* first thing should be a directive */ - nbparam = NULL; /* The temporary non-bonded matrix */ - pair = NULL; /* The temporary pair interaction matrix */ - block2 = NULL; /* the extra exclusions */ + nbparam = nullptr; /* The temporary non-bonded matrix */ + pair = nullptr; /* The temporary pair interaction matrix */ + block2 = nullptr; /* the extra exclusions */ nb_funct = F_LJ; *reppow = 12.0; /* Default value for repulsion power */ - *intermolecular_interactions = NULL; + *intermolecular_interactions = nullptr; /* Init the number of CMAP torsion angles and grid spacing */ plist[F_CMAP].grid_spacing = 0; @@ -736,7 +736,7 @@ static char **read_topol(const char *infile, const char *outfile, * skip spaces and tabs on either side of directive */ dirstr = gmx_strdup((pline+1)); - if ((dummy2 = strchr (dirstr, CLOSEDIR)) != NULL) + if ((dummy2 = strchr (dirstr, CLOSEDIR)) != nullptr) { (*dummy2) = 0; } @@ -770,7 +770,7 @@ static char **read_topol(const char *infile, const char *outfile, if (d == d_intermolecular_interactions) { - if (*intermolecular_interactions == NULL) + if (*intermolecular_interactions == nullptr) { /* We (mis)use the moleculetype processing * to process the intermolecular interactions @@ -840,14 +840,14 @@ static char **read_topol(const char *infile, const char *outfile, break; case d_atomtypes: push_at(symtab, atype, batype, pline, nb_funct, - &nbparam, bGenPairs ? &pair : NULL, wi); + &nbparam, bGenPairs ? &pair : nullptr, wi); break; case d_bondtypes: - push_bt(d, plist, 2, NULL, batype, pline, wi); + push_bt(d, plist, 2, nullptr, batype, pline, wi); break; case d_constrainttypes: - push_bt(d, plist, 2, NULL, batype, pline, wi); + push_bt(d, plist, 2, nullptr, batype, pline, wi); break; case d_pairtypes: if (bGenPairs) @@ -856,11 +856,11 @@ static char **read_topol(const char *infile, const char *outfile, } else { - push_bt(d, plist, 2, atype, NULL, pline, wi); + push_bt(d, plist, 2, atype, nullptr, pline, wi); } break; case d_angletypes: - push_bt(d, plist, 3, NULL, batype, pline, wi); + push_bt(d, plist, 3, nullptr, batype, pline, wi); break; case d_dihedraltypes: /* Special routine that can read both 2 and 4 atom dihedral definitions. */ @@ -900,14 +900,14 @@ static char **read_topol(const char *infile, const char *outfile, if (!bReadMolType) { int ntype; - if (opts->couple_moltype != NULL && + if (opts->couple_moltype != nullptr && (opts->couple_lam0 == ecouplamNONE || opts->couple_lam0 == ecouplamQ || opts->couple_lam1 == ecouplamNONE || opts->couple_lam1 == ecouplamQ)) { dcatt = add_atomtype_decoupled(symtab, atype, - &nbparam, bGenPairs ? &pair : NULL); + &nbparam, bGenPairs ? &pair : nullptr); } ntype = get_atomtype_ntypes(atype); ncombs = (ntype*(ntype+1))/2; @@ -1004,7 +1004,7 @@ static char **read_topol(const char *infile, const char *outfile, molb[nmolb].nmol = nrcopies; nmolb++; - bCouple = (opts->couple_moltype != NULL && + bCouple = (opts->couple_moltype != nullptr && (gmx_strcasecmp("system", opts->couple_moltype) == 0 || strcmp(*(mi0->name), opts->couple_moltype) == 0)); if (bCouple) @@ -1064,7 +1064,7 @@ static char **read_topol(const char *infile, const char *outfile, } } sfree(pline); - pline = NULL; + pline = nullptr; } } while (!done); @@ -1121,7 +1121,7 @@ static char **read_topol(const char *infile, const char *outfile, done_bond_atomtype(&batype); - if (*intermolecular_interactions != NULL) + if (*intermolecular_interactions != nullptr) { sfree(mi0->atoms.atom); } @@ -1164,7 +1164,7 @@ char **do_top(gmx_bool bVerbose, } else { - tmpfile = NULL; + tmpfile = nullptr; } if (bVerbose) @@ -1201,7 +1201,7 @@ static void generate_qmexcl_moltype(gmx_moltype_t *molt, unsigned char *grpnr, * not by the gromacs routines */ int qm_max = 0, qm_nr = 0, link_nr = 0, link_max = 0; - int *qm_arr = NULL, *link_arr = NULL; + int *qm_arr = nullptr, *link_arr = nullptr; gmx_bool *bQMMM, *blink; /* First we search and select the QM atoms in an qm_arr array that diff --git a/src/gromacs/gmxpreprocess/toppush.cpp b/src/gromacs/gmxpreprocess/toppush.cpp index 6b4f40f119..8301865531 100644 --- a/src/gromacs/gmxpreprocess/toppush.cpp +++ b/src/gromacs/gmxpreprocess/toppush.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -703,7 +703,7 @@ void push_bt(directive d, t_params bt[], int nral, return; } - ft = strtol(alc[nral], NULL, 10); + ft = strtol(alc[nral], nullptr, 10); ftype = ifunc_index(d, ft); nrfp = NRFP(ftype); nrfpA = interaction_function[ftype].nrfpA; @@ -812,7 +812,7 @@ void push_dihedraltype(directive d, t_params bt[], if (nn >= 3 && strlen(alc[2]) == 1 && isdigit(alc[2][0])) { nral = 2; - ft = strtol(alc[nral], NULL, 10); + ft = strtol(alc[nral], nullptr, 10); /* Move atom types around a bit and use 'X' for wildcard atoms * to create a 4-atom dihedral definition with arbitrary atoms in * position 1 and 4. @@ -837,7 +837,7 @@ void push_dihedraltype(directive d, t_params bt[], else if (nn == 5 && strlen(alc[4]) == 1 && isdigit(alc[4][0])) { nral = 4; - ft = strtol(alc[nral], NULL, 10); + ft = strtol(alc[nral], nullptr, 10); } else { @@ -1111,9 +1111,9 @@ push_cmaptype(directive d, t_params bt[], int nral, gpp_atomtype_t at, } start += nchar_consumed; - ft = strtol(alc[nral], NULL, 10); - nxcmap = strtol(alc[nral+1], NULL, 10); - nycmap = strtol(alc[nral+2], NULL, 10); + ft = strtol(alc[nral], nullptr, 10); + nxcmap = strtol(alc[nral+1], nullptr, 10); + nycmap = strtol(alc[nral+2], nullptr, 10); /* Check for equal grid spacing in x and y dims */ if (nxcmap != nycmap) @@ -1124,8 +1124,8 @@ push_cmaptype(directive d, t_params bt[], int nral, gpp_atomtype_t at, ncmap = nxcmap*nycmap; ftype = ifunc_index(d, ft); - nrfpA = strtol(alc[6], NULL, 10)*strtol(alc[6], NULL, 10); - nrfpB = strtol(alc[7], NULL, 10)*strtol(alc[7], NULL, 10); + nrfpA = strtol(alc[6], nullptr, 10)*strtol(alc[6], nullptr, 10); + nrfpB = strtol(alc[7], nullptr, 10)*strtol(alc[7], nullptr, 10); nrfp = nrfpA+nrfpB; /* Allocate memory for the CMAP grid */ @@ -1142,7 +1142,7 @@ push_cmaptype(directive d, t_params bt[], int nral, gpp_atomtype_t at, } nn = sscanf(line+start+sl, " %s ", s); sl += strlen(s); - bt[F_CMAP].cmap[i+(bt[F_CMAP].ncmap)-nrfp] = strtod(s, NULL); + bt[F_CMAP].cmap[i+(bt[F_CMAP].ncmap)-nrfp] = strtod(s, nullptr); if (nn == 1) { @@ -1263,7 +1263,7 @@ static void push_atom_now(t_symtab *symtab, t_atoms *at, int atomnr, warning_error_and_exit(wi, errbuf, FARGS); } } - resnr = strtol(resnumberic, NULL, 10); + resnr = strtol(resnumberic, nullptr, 10); if (nr > 0) { @@ -1460,7 +1460,7 @@ static gmx_bool default_nb_params(int ftype, t_params bt[], t_atoms *at, { int i, j, ti, tj, ntype; gmx_bool bFound; - t_param *pi = NULL; + t_param *pi = nullptr; int nr = bt[ftype].nr; int nral = NRAL(ftype); int nrfp = interaction_function[ftype].nrfpA; @@ -1634,8 +1634,8 @@ static gmx_bool default_params(int ftype, t_params bt[], { int nparam_found; gmx_bool bFound, bSame; - t_param *pi = NULL; - t_param *pj = NULL; + t_param *pi = nullptr; + t_param *pj = nullptr; int nr = bt[ftype].nr; int nral = NRAL(ftype); int nrfpA = interaction_function[ftype].nrfpA; @@ -2237,8 +2237,8 @@ void push_vsitesn(directive d, t_params bond[], { char *ptr; int type, ftype, j, n, ret, nj, a; - int *atc = NULL; - double *weight = NULL, weight_tot; + int *atc = nullptr; + double *weight = nullptr, weight_tot; t_param param; char errbuf[STRLEN]; @@ -2411,7 +2411,7 @@ void init_block2(t_block2 *b2, int natom) snew(b2->a, b2->nr); for (i = 0; (i < b2->nr); i++) { - b2->a[i] = NULL; + b2->a[i] = nullptr; } } @@ -2664,7 +2664,7 @@ static void convert_pairs_to_pairsQ(t_params *plist, /* Empty the LJ14 pairlist */ plist[F_LJ14].nr = 0; - plist[F_LJ14].param = NULL; + plist[F_LJ14].param = nullptr; } static void generate_LJCpairsNB(t_molinfo *mol, int nb_funct, t_params *nbp, warninp_t wi) diff --git a/src/gromacs/gmxpreprocess/toputil.cpp b/src/gromacs/gmxpreprocess/toputil.cpp index ddd2bd95d8..1574962e56 100644 --- a/src/gromacs/gmxpreprocess/toputil.cpp +++ b/src/gromacs/gmxpreprocess/toputil.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -119,15 +119,15 @@ void init_plist(t_params plist[]) { plist[i].nr = 0; plist[i].maxnr = 0; - plist[i].param = NULL; + plist[i].param = nullptr; /* CMAP */ plist[i].ncmap = 0; - plist[i].cmap = NULL; + plist[i].cmap = nullptr; plist[i].grid_spacing = 0; plist[i].nc = 0; plist[i].nct = 0; - plist[i].cmap_types = NULL; + plist[i].cmap_types = nullptr; } } @@ -459,7 +459,7 @@ void print_atoms(FILE *out, gpp_atomtype_t atype, t_atoms *at, int *cgnr, { ri = at->atom[i].resind; if ((i == 0 || ri != at->atom[i-1].resind) && - at->resinfo[ri].rtp != NULL) + at->resinfo[ri].rtp != nullptr) { qres = get_residue_charge(at, i); fprintf(out, "; residue %3d %-3s rtp %-4s q ", @@ -477,7 +477,7 @@ void print_atoms(FILE *out, gpp_atomtype_t atype, t_atoms *at, int *cgnr, fprintf(out, "\n"); } tpA = at->atom[i].type; - if ((tpnmA = get_atomtype_name(tpA, atype)) == NULL) + if ((tpnmA = get_atomtype_name(tpA, atype)) == nullptr) { gmx_fatal(FARGS, "tpA = %d, i= %d in print_atoms", tpA, i); } @@ -496,7 +496,7 @@ void print_atoms(FILE *out, gpp_atomtype_t atype, t_atoms *at, int *cgnr, if (PERTURBED(at->atom[i])) { tpB = at->atom[i].typeB; - if ((tpnmB = get_atomtype_name(tpB, atype)) == NULL) + if ((tpnmB = get_atomtype_name(tpB, atype)) == nullptr) { gmx_fatal(FARGS, "tpB = %d, i= %d in print_atoms", tpB, i); } diff --git a/src/gromacs/gmxpreprocess/vsite_parm.cpp b/src/gromacs/gmxpreprocess/vsite_parm.cpp index bd8d37a190..47aa1f1b45 100644 --- a/src/gromacs/gmxpreprocess/vsite_parm.cpp +++ b/src/gromacs/gmxpreprocess/vsite_parm.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -873,9 +873,9 @@ int set_vsites(gmx_bool bVerbose, t_atoms *atoms, gpp_atomtype_t atype, } nrbond = nrang = nridih = 0; - bonds = NULL; - angles = NULL; - idihs = NULL; + bonds = nullptr; + angles = nullptr; + idihs = nullptr; nrset++; /* now set the vsite parameters: */ get_bondeds(NRAL(ftype), plist[ftype].param[i].a, at2vb, @@ -1050,7 +1050,7 @@ static void clean_vsite_bonds(t_params *plist, t_pindex pindex[], for (i = 0; (i < ps->nr); i++) /* for all bonds in the plist */ { int vsnral = 0; - const int *first_atoms = NULL; + const int *first_atoms = nullptr; bKeep = FALSE; bRemove = FALSE; @@ -1307,7 +1307,7 @@ static void clean_vsite_angles(t_params *plist, t_pindex pindex[], for (i = 0; (i < ps->nr); i++) /* for all angles in the plist */ { int vsnral = 0; - const int *first_atoms = NULL; + const int *first_atoms = nullptr; bKeep = FALSE; bAll3FAD = TRUE; @@ -1443,7 +1443,7 @@ static void clean_vsite_dihs(t_params *plist, t_pindex pindex[], { int k, m, n, nvsite; int vsnral = 0; - const int *first_atoms = NULL; + const int *first_atoms = nullptr; int atom; gmx_bool bKeep, bUsed, bPresent; @@ -1561,7 +1561,7 @@ void clean_vsite_bondeds(t_params *plist, int natoms, gmx_bool bRmVSiteBds) t_pindex *pindex; at2vsitecon_t *at2vc; - pindex = 0; /* avoid warnings */ + pindex = nullptr; /* avoid warnings */ /* make vsite_type array */ snew(vsite_type, natoms); for (i = 0; i < natoms; i++) diff --git a/src/gromacs/gmxpreprocess/x2top.cpp b/src/gromacs/gmxpreprocess/x2top.cpp index 6a189d2842..4f81fb3e5a 100644 --- a/src/gromacs/gmxpreprocess/x2top.cpp +++ b/src/gromacs/gmxpreprocess/x2top.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -298,7 +298,7 @@ void calc_angles_dihs(t_params *ang, t_params *dih, const rvec x[], gmx_bool bPB ai = ang->param[i].ai(); aj = ang->param[i].aj(); ak = ang->param[i].ak(); - th = RAD2DEG*bond_angle(x[ai], x[aj], x[ak], bPBC ? &pbc : NULL, + th = RAD2DEG*bond_angle(x[ai], x[aj], x[ak], bPBC ? &pbc : nullptr, r_ij, r_kj, &costh, &t1, &t2); if (debug) { @@ -313,7 +313,7 @@ void calc_angles_dihs(t_params *ang, t_params *dih, const rvec x[], gmx_bool bPB aj = dih->param[i].aj(); ak = dih->param[i].ak(); al = dih->param[i].al(); - ph = RAD2DEG*dih_angle(x[ai], x[aj], x[ak], x[al], bPBC ? &pbc : NULL, + ph = RAD2DEG*dih_angle(x[ai], x[aj], x[ak], x[al], bPBC ? &pbc : nullptr, r_ij, r_kj, r_kl, m, n, &sign, &t1, &t2, &t3); if (debug) { @@ -379,7 +379,7 @@ static void print_rtp(const char *filenm, const char *title, t_atoms *atoms, for (i = 0; (i < atoms->nr); i++) { tp = atoms->atom[i].type; - if ((tpnm = get_atomtype_name(tp, atype)) == NULL) + if ((tpnm = get_atomtype_name(tp, atype)) == nullptr) { gmx_fatal(FARGS, "tp = %d, i = %d in print_rtp", tp, i); } @@ -515,7 +515,7 @@ int gmx_x2top(int argc, char *argv[]) } /* Force field selection, interactive or direct */ - choose_ff(strcmp(ff, "select") == 0 ? NULL : ff, + choose_ff(strcmp(ff, "select") == 0 ? nullptr : ff, forcefield, sizeof(forcefield), ffdir, sizeof(ffdir)); @@ -531,10 +531,10 @@ int gmx_x2top(int argc, char *argv[]) /* Read coordinates */ t_topology *top; snew(top, 1); - read_tps_conf(opt2fn("-f", NFILE, fnm), top, &epbc, &x, NULL, box, FALSE); + read_tps_conf(opt2fn("-f", NFILE, fnm), top, &epbc, &x, nullptr, box, FALSE); t_atoms *atoms = &top->atoms; natoms = atoms->nr; - if (atoms->pdbinfo == NULL) + if (atoms->pdbinfo == nullptr) { snew(atoms->pdbinfo, natoms); } @@ -567,7 +567,7 @@ int gmx_x2top(int argc, char *argv[]) init_nnb(&nnb, atoms->nr, 4); gen_nnb(&nnb, plist); print_nnb(&nnb, "NNB"); - gen_pad(&nnb, atoms, &rtp_header_settings, plist, excls, NULL, TRUE); + gen_pad(&nnb, atoms, &rtp_header_settings, plist, excls, nullptr, TRUE); done_nnb(&nnb); if (!bPairs) @@ -599,9 +599,9 @@ int gmx_x2top(int argc, char *argv[]) fp = ftp2FILE(efTOP, NFILE, fnm, "w"); print_top_header(fp, ftp2fn(efTOP, NFILE, fnm), TRUE, ffdir, 1.0); - write_top(fp, NULL, mymol.name, atoms, FALSE, bts, plist, excls, atype, + write_top(fp, nullptr, mymol.name, atoms, FALSE, bts, plist, excls, atype, cgnr, rtp_header_settings.nrexcl); - print_top_mols(fp, mymol.name, ffdir, NULL, 0, NULL, 1, &mymol); + print_top_mols(fp, mymol.name, ffdir, nullptr, 0, nullptr, 1, &mymol); gmx_ffclose(fp); } diff --git a/src/gromacs/gmxpreprocess/xlate.cpp b/src/gromacs/gmxpreprocess/xlate.cpp index c89244bff6..760fd0c1d7 100644 --- a/src/gromacs/gmxpreprocess/xlate.cpp +++ b/src/gromacs/gmxpreprocess/xlate.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -98,11 +98,11 @@ static void get_xlatoms(const char *fn, FILE *fp, } else { - xl[n].res = NULL; + xl[n].res = nullptr; } /* Replace underscores in the string by spaces */ - while ((_ptr = strchr(abuf, '_')) != 0) + while ((_ptr = strchr(abuf, '_')) != nullptr) { *_ptr = ' '; } @@ -123,7 +123,7 @@ static void done_xlatom(int nxlate, t_xlate_atom *xlatom) for (i = 0; (i < nxlate); i++) { sfree(xlatom[i].filebase); - if (xlatom[i].res != NULL) + if (xlatom[i].res != nullptr) { sfree(xlatom[i].res); } @@ -148,8 +148,8 @@ void rename_atoms(const char *xlfile, const char *ffdir, gmx_bool bStartTerm, bEndTerm; nxlate = 0; - xlatom = NULL; - if (xlfile != NULL) + xlatom = nullptr; + if (xlfile != nullptr) { fp = libopen(xlfile); get_xlatoms(xlfile, fp, &nxlate, &xlatom); @@ -203,11 +203,11 @@ void rename_atoms(const char *xlfile, const char *ffdir, for (i = 0; (i < nxlate) && !bRenamed; i++) { /* Check if the base file name of the rtp and arn entry match */ - if (restp == NULL || + if (restp == nullptr || gmx_strcasecmp(restp[resind].filebase, xlatom[i].filebase) == 0) { /* Match the residue name */ - bMatch = (xlatom[i].res == NULL || + bMatch = (xlatom[i].res == nullptr || (gmx_strcasecmp("protein-nterm", xlatom[i].res) == 0 && gmx_residuetype_is_protein(rt, rnm) && bStartTerm) || (gmx_strcasecmp("protein-cterm", xlatom[i].res) == 0 && diff --git a/src/gromacs/gpu_utils/gpu_utils.cpp b/src/gromacs/gpu_utils/gpu_utils.cpp index f2e423edfb..fcaed80d22 100644 --- a/src/gromacs/gpu_utils/gpu_utils.cpp +++ b/src/gromacs/gpu_utils/gpu_utils.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -49,6 +49,6 @@ void gpu_set_host_malloc_and_free(bool, gmx_host_alloc_t **nb_alloc, gmx_host_free_t **nb_free) { - *nb_alloc = NULL; - *nb_free = NULL; + *nb_alloc = nullptr; + *nb_free = nullptr; } diff --git a/src/gromacs/hardware/cpuinfo.cpp b/src/gromacs/hardware/cpuinfo.cpp index b2ec55a668..cdb3ae7ffb 100644 --- a/src/gromacs/hardware/cpuinfo.cpp +++ b/src/gromacs/hardware/cpuinfo.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -776,7 +776,7 @@ detectProcCpuInfoArm(const std::map &cpuInfo, } if (cpuInfo.count("CPU architecture")) { - *family = std::strtol(cpuInfo.at("CPU architecture").c_str(), NULL, 10); + *family = std::strtol(cpuInfo.at("CPU architecture").c_str(), nullptr, 10); // For some 64-bit CPUs it appears to say 'AArch64' instead if (*family == 0 && cpuInfo.at("CPU architecture").find("AArch64") != std::string::npos) { @@ -785,11 +785,11 @@ detectProcCpuInfoArm(const std::map &cpuInfo, } if (cpuInfo.count("CPU variant")) { - *model = std::strtol(cpuInfo.at("CPU variant").c_str(), NULL, 16); + *model = std::strtol(cpuInfo.at("CPU variant").c_str(), nullptr, 16); } if (cpuInfo.count("CPU revision")) { - *stepping = std::strtol(cpuInfo.at("CPU revision").c_str(), NULL, 10); + *stepping = std::strtol(cpuInfo.at("CPU revision").c_str(), nullptr, 10); } if (cpuInfo.count("Features")) diff --git a/src/gromacs/hardware/detecthardware.cpp b/src/gromacs/hardware/detecthardware.cpp index 5a17e09256..910021a6bd 100644 --- a/src/gromacs/hardware/detecthardware.cpp +++ b/src/gromacs/hardware/detecthardware.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -334,7 +334,7 @@ void gmx_check_hw_runconf_consistency(const gmx::MDLogger &mdlog, /* GPU emulation detection is done later, but we need here as well * -- uncool, but there's no elegant workaround */ - bEmulateGPU = (getenv("GMX_EMULATE_GPU") != NULL); + bEmulateGPU = (getenv("GMX_EMULATE_GPU") != nullptr); if (hwinfo->gpu_info.n_dev_compatible > 0) { @@ -958,14 +958,14 @@ gmx_hw_info_t *gmx_detect_hardware(const gmx::MDLogger &mdlog, const t_commrec * /* detect GPUs */ hwinfo_g->gpu_info.n_dev = 0; hwinfo_g->gpu_info.n_dev_compatible = 0; - hwinfo_g->gpu_info.gpu_dev = NULL; + hwinfo_g->gpu_info.gpu_dev = nullptr; /* Run the detection if the binary was compiled with GPU support * and we requested detection. */ hwinfo_g->gpu_info.bDetectGPUs = (bGPUBinary && bDetectGPUs && - getenv("GMX_DISABLE_GPU_DETECTION") == NULL); + getenv("GMX_DISABLE_GPU_DETECTION") == nullptr); if (hwinfo_g->gpu_info.bDetectGPUs) { gmx_detect_gpus(mdlog, cr); @@ -1220,7 +1220,7 @@ void gmx_print_detected_hardware(FILE *fplog, const t_commrec *cr, { const gmx::CpuInfo &cpuInfo = *hwinfo_g->cpuInfo; - if (fplog != NULL) + if (fplog != nullptr) { std::string detected; @@ -1275,24 +1275,24 @@ void gmx_parse_gpu_ids(gmx_gpu_opt_t *gpu_opt) { char *env; - if (gpu_opt->gpu_id != NULL && !bGPUBinary) + if (gpu_opt->gpu_id != nullptr && !bGPUBinary) { gmx_fatal(FARGS, "GPU ID string set, but %s was compiled without GPU support!", gmx::getProgramContext().displayName()); } env = getenv("GMX_GPU_ID"); - if (env != NULL && gpu_opt->gpu_id != NULL) + if (env != nullptr && gpu_opt->gpu_id != nullptr) { gmx_fatal(FARGS, "GMX_GPU_ID and -gpu_id can not be used at the same time"); } - if (env == NULL) + if (env == nullptr) { env = gpu_opt->gpu_id; } /* parse GPU IDs if the user passed any */ - if (env != NULL) + if (env != nullptr) { /* Parse a "plain" or comma-separated GPU ID string which contains a * sequence of digits corresponding to GPU IDs; the order will diff --git a/src/gromacs/hardware/hardwareassign.cpp b/src/gromacs/hardware/hardwareassign.cpp index 7efeeddf09..fecd297757 100644 --- a/src/gromacs/hardware/hardwareassign.cpp +++ b/src/gromacs/hardware/hardwareassign.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016, by the GROMACS development team, led by + * Copyright (c) 2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -223,7 +223,7 @@ void gmx_select_rank_gpu_ids(const gmx::MDLogger &mdlog, const t_commrec *cr, sfree(checkres); } - else if (getenv("GMX_EMULATE_GPU") == NULL) + else if (getenv("GMX_EMULATE_GPU") == nullptr) { pick_compatible_gpus(gpu_info, gpu_opt); assign_rank_gpu_ids(gpu_opt, cr->nrank_pp_intranode, cr->rank_pp_intranode); diff --git a/src/gromacs/hardware/hardwaretopology.cpp b/src/gromacs/hardware/hardwaretopology.cpp index dfe5dbaec0..44a8a12038 100644 --- a/src/gromacs/hardware/hardwaretopology.cpp +++ b/src/gromacs/hardware/hardwaretopology.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -299,8 +299,8 @@ parseHwLocCache(const hwloc_topology_t topo, if (depth >= 0) { - hwloc_obj_t cache = hwloc_get_next_obj_by_depth(topo, depth, NULL); - if (cache != NULL) + hwloc_obj_t cache = hwloc_get_next_obj_by_depth(topo, depth, nullptr); + if (cache != nullptr) { std::vector hwThreads = getHwLocDescendantsByType(cache, HWLOC_OBJ_PU); @@ -376,7 +376,7 @@ parseHwLocNuma(const hwloc_topology_t topo, int depth = hwloc_get_type_depth(topo, HWLOC_OBJ_NUMANODE); const struct hwloc_distances_s * dist = hwloc_get_whole_distance_matrix_by_depth(topo, depth); - if (dist != NULL && dist->nbobjs == hwlocNumaNodes.size()) + if (dist != nullptr && dist->nbobjs == hwlocNumaNodes.size()) { machine->numa.baseLatency = dist->latency_base; machine->numa.maxRelativeLatency = dist->latency_max; @@ -398,9 +398,9 @@ parseHwLocNuma(const hwloc_topology_t topo, else { // No numa nodes found. Use the entire machine as a numa node. - const hwloc_obj_t hwlocMachine = hwloc_get_next_obj_by_type(topo, HWLOC_OBJ_MACHINE, NULL); + const hwloc_obj_t hwlocMachine = hwloc_get_next_obj_by_type(topo, HWLOC_OBJ_MACHINE, nullptr); - if (hwlocMachine != NULL) + if (hwlocMachine != nullptr) { machine->numa.nodes.resize(1); machine->numa.nodes[0].id = 0; @@ -462,7 +462,7 @@ parseHwLocDevices(const hwloc_topology_t topo, { const hwloc_obj_t ancestor = hwloc_get_ancestor_obj_by_type(topo, HWLOC_OBJ_NUMANODE, p); int numaId; - if (ancestor != NULL) + if (ancestor != nullptr) { numaId = ancestor->logical_index; } @@ -506,7 +506,7 @@ parseHwLoc(HardwareTopology::Machine * machine, hwloc_topology_set_flags(topo, HWLOC_TOPOLOGY_FLAG_IO_DEVICES); - if (hwloc_topology_load(topo) != 0 || hwloc_get_root_obj(topo) == NULL) + if (hwloc_topology_load(topo) != 0 || hwloc_get_root_obj(topo) == nullptr) { hwloc_topology_destroy(topo); return; // SupportLevel::None. diff --git a/src/gromacs/imd/imd.cpp b/src/gromacs/imd/imd.cpp index 7848a959ac..1faf0b1560 100644 --- a/src/gromacs/imd/imd.cpp +++ b/src/gromacs/imd/imd.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -234,7 +234,7 @@ const char *eIMDType_names[IMD_NR + 1] = { "IMD_PAUSE", "IMD_TRATE", "IMD_IOERROR", - NULL + nullptr }; @@ -492,7 +492,7 @@ static int imd_send_rvecs(IMDSocket *socket, int nat, rvec *x, char *buffer) /*! \brief Initializes the IMD private data. */ static t_gmx_IMD_setup* imd_create(int imdatoms, int nstimddef, int imdport) { - t_gmx_IMD_setup *IMDsetup = NULL; + t_gmx_IMD_setup *IMDsetup = nullptr; snew(IMDsetup, 1); @@ -582,7 +582,7 @@ static void imd_disconnect(t_gmx_IMD_setup *IMDsetup) /* then we reset the IMD step to its default, and reset the connection boolean */ IMDsetup->nstimd_new = IMDsetup->nstimd_def; - IMDsetup->clientsocket = NULL; + IMDsetup->clientsocket = nullptr; IMDsetup->bConnected = FALSE; } @@ -1051,7 +1051,7 @@ static FILE *open_imd_out(const char *fn, fprintf(stdout, "%s For a log of the IMD pull forces explicitly specify '-if' on the command line.\n" "%s (Not possible with energy minimization.)\n", IMDstr, IMDstr); - return NULL; + return nullptr; } #endif diff --git a/src/gromacs/imd/imdsocket.cpp b/src/gromacs/imd/imdsocket.cpp index 0f3905b084..06008c35bb 100644 --- a/src/gromacs/imd/imdsocket.cpp +++ b/src/gromacs/imd/imdsocket.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -106,7 +106,7 @@ static void print_IMD_error(const char *file, int line, char *msg) { fprintf(stderr, "%s Error in file %s on line %d.\n", IMDstr, file, line); - if (NULL != msg) + if (nullptr != msg) { fprintf(stderr, "%s\n", msg); } @@ -141,7 +141,7 @@ static uint16_t gmx_ntohs(uint16_t src) extern IMDSocket* imdsock_create() { - IMDSocket *sock = NULL; + IMDSocket *sock = nullptr; #ifdef GMX_IMD @@ -152,7 +152,7 @@ extern IMDSocket* imdsock_create() print_IMD_error(ERR_ARGS); sfree(sock); - return NULL; + return nullptr; } else #endif @@ -235,7 +235,7 @@ extern IMDSocket* imdsock_accept(IMDSocket *sock) { print_IMD_error(ERR_ARGS); - return NULL; + return nullptr; } } @@ -303,7 +303,7 @@ extern void imdsock_shutdown(IMDSocket *sock) /* is the socket already NULL? */ - if (sock == NULL) + if (sock == nullptr) { return; } @@ -326,7 +326,7 @@ extern int imdsock_destroy(IMDSocket *sock) int ret = -1; - if (sock == NULL) + if (sock == nullptr) { return 1; } @@ -376,7 +376,7 @@ extern int imdsock_tryread(IMDSocket *sock, int timeoutsec, int timeoutusec) do { /* check the set for read readiness. */ - ret = select(sock->sockfd + 1, &readfds, NULL, NULL, tval); + ret = select(sock->sockfd + 1, &readfds, nullptr, nullptr, tval); /* redo on system interrupt */ } while (ret < 0 && errno == EINTR); diff --git a/src/gromacs/linearalgebra/eigensolver.cpp b/src/gromacs/linearalgebra/eigensolver.cpp index 85e625cdf4..2195e5e8ad 100644 --- a/src/gromacs/linearalgebra/eigensolver.cpp +++ b/src/gromacs/linearalgebra/eigensolver.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -76,7 +76,7 @@ eigensolver(real * a, /* Make jobz point to the character "V" if eigenvectors * should be calculated, otherwise "N" (only eigenvalues). */ - jobz = (eigenvectors != NULL) ? "V" : "N"; + jobz = (eigenvectors != nullptr) ? "V" : "N"; /* allocate lapack stuff */ snew(isuppz, 2*n); @@ -293,7 +293,7 @@ sparse_eigensolver(gmx_sparsematrix_t * A, } #endif - if (eigenvectors != NULL) + if (eigenvectors != nullptr) { dovec = 1; } @@ -373,12 +373,12 @@ sparse_eigensolver(gmx_sparsematrix_t * A, #if GMX_DOUBLE F77_FUNC(dseupd, DSEUPD) (&dovec, "A", select, eigenvalues, eigenvectors, - &n, NULL, "I", &n, "SA", &neig, &abstol, + &n, nullptr, "I", &n, "SA", &neig, &abstol, resid, &ncv, v, &n, iparam, ipntr, workd, workl, &lworkl, &info); #else F77_FUNC(sseupd, SSEUPD) (&dovec, "A", select, eigenvalues, eigenvectors, - &n, NULL, "I", &n, "SA", &neig, &abstol, + &n, nullptr, "I", &n, "SA", &neig, &abstol, resid, &ncv, v, &n, iparam, ipntr, workd, workl, &lworkl, &info); #endif diff --git a/src/gromacs/linearalgebra/matrix.cpp b/src/gromacs/linearalgebra/matrix.cpp index 3673fd0bbb..bd1b9510a7 100644 --- a/src/gromacs/linearalgebra/matrix.cpp +++ b/src/gromacs/linearalgebra/matrix.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -126,7 +126,7 @@ static void dump_matrix(FILE *fp, const char *title, int n, double **a) int matrix_invert(FILE *fp, int n, double **a) { int i, j, m, lda, *ipiv, lwork, info; - double **test = NULL, **id, *work; + double **test = nullptr, **id, *work; #ifdef DEBUG_MATRIX if (fp) diff --git a/src/gromacs/linearalgebra/sparsematrix.cpp b/src/gromacs/linearalgebra/sparsematrix.cpp index 5dea002f70..79ec5912f0 100644 --- a/src/gromacs/linearalgebra/sparsematrix.cpp +++ b/src/gromacs/linearalgebra/sparsematrix.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -62,7 +62,7 @@ gmx_sparsematrix_init(int nrow) { A->ndata[i] = 0; A->nalloc[i] = 0; - A->data[i] = NULL; + A->data[i] = nullptr; } return A; } @@ -77,7 +77,7 @@ gmx_sparsematrix_destroy(gmx_sparsematrix_t * A) /* Release each row */ for (i = 0; i < A->nrow; i++) { - if (A->data[i] != NULL) + if (A->data[i] != nullptr) { sfree(A->data[i]); } @@ -186,7 +186,7 @@ gmx_sparsematrix_increment_value(gmx_sparsematrix_t * A, if (A->ndata[row] == A->nalloc[row]) { A->nalloc[row] += 100; - if (A->data[row] == NULL) + if (A->data[row] == nullptr) { snew(A->data[row], A->nalloc[row]); } diff --git a/src/gromacs/listed-forces/bonded.cpp b/src/gromacs/listed-forces/bonded.cpp index fd46ab180a..0bcb39212a 100644 --- a/src/gromacs/listed-forces/bonded.cpp +++ b/src/gromacs/listed-forces/bonded.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -947,7 +947,7 @@ real angles(int nbonds, f[aj][m] += f_j[m]; f[ak][m] += f_k[m]; } - if (g != NULL) + if (g != nullptr) { copy_ivec(SHIFT_IVEC(g, aj), jt); diff --git a/src/gromacs/listed-forces/disre.cpp b/src/gromacs/listed-forces/disre.cpp index 46ba975842..2a27f7f192 100644 --- a/src/gromacs/listed-forces/disre.cpp +++ b/src/gromacs/listed-forces/disre.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -201,7 +201,7 @@ void init_disres(FILE *fplog, const gmx_mtop_t *mtop, dd->Rtav_6 = &(dd->Rt_6[dd->nres]); ptr = getenv("GMX_DISRE_ENSEMBLE_SIZE"); - if (cr && cr->ms != NULL && ptr != NULL && !bIsREMD) + if (cr && cr->ms != nullptr && ptr != nullptr && !bIsREMD) { #if GMX_MPI dd->nsystems = 0; diff --git a/src/gromacs/listed-forces/listed-forces.cpp b/src/gromacs/listed-forces/listed-forces.cpp index 47d20f44d3..8113493caf 100644 --- a/src/gromacs/listed-forces/listed-forces.cpp +++ b/src/gromacs/listed-forces/listed-forces.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -439,7 +439,7 @@ void calc_listed(const t_commrec *cr, } else { - pbc_null = NULL; + pbc_null = nullptr; } #ifdef DEBUG @@ -592,7 +592,7 @@ void calc_listed_lambda(const t_idef *idef, } else { - pbc_null = NULL; + pbc_null = nullptr; } /* Copy the whole idef, so we can modify the contents locally */ diff --git a/src/gromacs/listed-forces/listed-internal.cpp b/src/gromacs/listed-forces/listed-internal.cpp index fd69378866..ce1dc30038 100644 --- a/src/gromacs/listed-forces/listed-internal.cpp +++ b/src/gromacs/listed-forces/listed-internal.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014, by the GROMACS development team, led by + * Copyright (c) 2014,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -49,7 +49,7 @@ int glatnr(int *global_atom_index, int i) { int atnr; - if (global_atom_index == NULL) + if (global_atom_index == nullptr) { atnr = i + 1; } diff --git a/src/gromacs/listed-forces/manage-threading.cpp b/src/gromacs/listed-forces/manage-threading.cpp index afc7e84c73..9ad61308d6 100644 --- a/src/gromacs/listed-forces/manage-threading.cpp +++ b/src/gromacs/listed-forces/manage-threading.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -504,7 +504,7 @@ void init_bonded_threading(FILE *fplog, int nenergrp, /* Note that thread 0 uses the global fshift and energy arrays, * but to keep the code simple, we initialize all data here. */ - bt->f_t[t].f = NULL; + bt->f_t[t].f = nullptr; bt->f_t[t].f_nalloc = 0; snew(bt->f_t[t].fshift, SHIFTS); bt->f_t[t].grpp.nener = nenergrp*nenergrp; @@ -517,8 +517,8 @@ void init_bonded_threading(FILE *fplog, int nenergrp, } bt->nblock_used = 0; - bt->block_index = NULL; - bt->mask = NULL; + bt->block_index = nullptr; + bt->mask = nullptr; bt->block_nalloc = 0; /* The optimal value after which to switch from uniform to localized @@ -528,10 +528,10 @@ void init_bonded_threading(FILE *fplog, int nenergrp, const int max_nthread_uniform = 4; char * ptr; - if ((ptr = getenv("GMX_BONDED_NTHREAD_UNIFORM")) != NULL) + if ((ptr = getenv("GMX_BONDED_NTHREAD_UNIFORM")) != nullptr) { sscanf(ptr, "%d", &bt->bonded_max_nthread_uniform); - if (fplog != NULL) + if (fplog != nullptr) { fprintf(fplog, "\nMax threads for uniform bonded distribution set to %d by env.var.\n", bt->bonded_max_nthread_uniform); diff --git a/src/gromacs/listed-forces/orires.cpp b/src/gromacs/listed-forces/orires.cpp index 93be131e79..b48ea8a930 100644 --- a/src/gromacs/listed-forces/orires.cpp +++ b/src/gromacs/listed-forces/orires.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -99,12 +99,12 @@ void init_orires(FILE *fplog, const gmx_mtop_t *mtop, od->fc = ir->orires_fc; od->nex = 0; - od->S = NULL; - od->M = NULL; - od->eig = NULL; - od->v = NULL; + od->S = nullptr; + od->M = nullptr; + od->eig = nullptr; + od->v = nullptr; - nr_ex = NULL; + nr_ex = nullptr; iloop = gmx_mtop_ilistloop_init(mtop); while (gmx_mtop_ilistloop_next(iloop, &il, &nmol)) @@ -211,12 +211,12 @@ void init_orires(FILE *fplog, const gmx_mtop_t *mtop, const t_atom *atom; while (gmx_mtop_atomloop_all_next(aloop, &i, &atom)) { - if (mtop->groups.grpnr[egcORFIT] == NULL || + if (mtop->groups.grpnr[egcORFIT] == nullptr || mtop->groups.grpnr[egcORFIT][i] == 0) { /* Not correct for free-energy with changing masses */ od->mref[j] = atom->m; - if (ms == NULL || MASTERSIM(ms)) + if (ms == nullptr || MASTERSIM(ms)) { copy_rvec(xref[i], od->xref[j]); for (d = 0; d < DIM; d++) @@ -229,7 +229,7 @@ void init_orires(FILE *fplog, const gmx_mtop_t *mtop, } } svmul(1.0/mtot, com, com); - if (ms == NULL || MASTERSIM(ms)) + if (ms == nullptr || MASTERSIM(ms)) { for (j = 0; j < od->nref; j++) { @@ -271,7 +271,7 @@ void diagonalize_orires_tensors(t_oriresdata *od) int ex, i, j, nrot, ord[DIM], t; matrix S, TMP; - if (od->M == NULL) + if (od->M == nullptr) { snew(od->M, DIM); for (i = 0; i < DIM; i++) diff --git a/src/gromacs/listed-forces/pairs.cpp b/src/gromacs/listed-forces/pairs.cpp index 8a930ccd6a..3f32f74463 100644 --- a/src/gromacs/listed-forces/pairs.cpp +++ b/src/gromacs/listed-forces/pairs.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -374,8 +374,8 @@ do_pairs_general(int ftype, int nbonds, energygrp_vdw = grppener->ener[egLJSR]; break; default: - energygrp_elec = NULL; /* Keep compiler happy */ - energygrp_vdw = NULL; /* Keep compiler happy */ + energygrp_elec = nullptr; /* Keep compiler happy */ + energygrp_vdw = nullptr; /* Keep compiler happy */ gmx_fatal(FARGS, "Unknown function type %d in do_nonbonded14", ftype); break; } @@ -668,13 +668,13 @@ do_pairs(int ftype, int nbonds, t_pbc pbc_no; const t_pbc *pbc_nonnull; - if (pbc != NULL) + if (pbc != nullptr) { pbc_nonnull = pbc; } else { - set_pbc(&pbc_no, epbcNONE, NULL); + set_pbc(&pbc_no, epbcNONE, nullptr); pbc_nonnull = &pbc_no; } diff --git a/src/gromacs/listed-forces/position-restraints.cpp b/src/gromacs/listed-forces/position-restraints.cpp index 28084ebf68..3706f4016e 100644 --- a/src/gromacs/listed-forces/position-restraints.cpp +++ b/src/gromacs/listed-forces/position-restraints.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -323,7 +323,7 @@ real posres(int nbonds, rvec comA_sc, comB_sc, rdist, dpdl, dx; gmx_bool bForceValid = TRUE; - if ((f == NULL) || (vir_diag == NULL)) /* should both be null together! */ + if ((f == nullptr) || (vir_diag == nullptr)) /* should both be null together! */ { bForceValid = FALSE; } @@ -398,7 +398,7 @@ posres_wrapper(t_nrnb *nrnb, v = posres(idef->il[F_POSRES].nr, idef->il[F_POSRES].iatoms, idef->iparams_posres, x, as_rvec_array(fr->f_novirsum->data()), fr->vir_diag_posres, - fr->ePBC == epbcNONE ? NULL : pbc, + fr->ePBC == epbcNONE ? nullptr : pbc, lambda[efptRESTRAINT], &dvdl, fr->rc_scaling, fr->ePBC, fr->posres_com, fr->posres_comB); enerd->term[F_POSRES] += v; @@ -435,8 +435,8 @@ posres_wrapper_lambda(struct gmx_wallcycle *wcycle, lambda_dum = (i == 0 ? lambda[efptRESTRAINT] : fepvals->all_lambda[efptRESTRAINT][i-1]); v = posres(idef->il[F_POSRES].nr, idef->il[F_POSRES].iatoms, idef->iparams_posres, - x, NULL, NULL, - fr->ePBC == epbcNONE ? NULL : pbc, lambda_dum, &dvdl_dum, + x, nullptr, nullptr, + fr->ePBC == epbcNONE ? nullptr : pbc, lambda_dum, &dvdl_dum, fr->rc_scaling, fr->ePBC, fr->posres_com, fr->posres_comB); enerd->enerpart_lambda[i] += v; } @@ -457,7 +457,7 @@ void fbposres_wrapper(t_nrnb *nrnb, v = fbposres(idef->il[F_FBPOSRES].nr, idef->il[F_FBPOSRES].iatoms, idef->iparams_fbposres, x, as_rvec_array(fr->f_novirsum->data()), fr->vir_diag_posres, - fr->ePBC == epbcNONE ? NULL : pbc, + fr->ePBC == epbcNONE ? nullptr : pbc, fr->rc_scaling, fr->ePBC, fr->posres_com); enerd->term[F_FBPOSRES] += v; inc_nrnb(nrnb, eNR_FBPOSRES, idef->il[F_FBPOSRES].nr/2); diff --git a/src/gromacs/listed-forces/tests/bonded.cpp b/src/gromacs/listed-forces/tests/bonded.cpp index e49f2a2683..65482bb861 100644 --- a/src/gromacs/listed-forces/tests/bonded.cpp +++ b/src/gromacs/listed-forces/tests/bonded.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016, by the GROMACS development team, led by + * Copyright (c) 2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -147,10 +147,10 @@ class BondedTest : public ::testing::Test iparams, x, f, fshift, &pbc, - /* const struct t_graph *g */ NULL, + /* const struct t_graph *g */ nullptr, lambda, &dvdlambda, - /* const struct t_mdatoms *md */ NULL, - /* struct t_fcdata *fcd */ NULL, + /* const struct t_mdatoms *md */ nullptr, + /* struct t_fcdata *fcd */ nullptr, &ddgatindex); checker_.checkReal(energy, interaction_function[ftype].longname); } diff --git a/src/gromacs/math/do_fit.cpp b/src/gromacs/math/do_fit.cpp index 83cd9dc5b4..64eb87d16d 100644 --- a/src/gromacs/math/do_fit.cpp +++ b/src/gromacs/math/do_fit.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -97,7 +97,7 @@ real rmsdev_ind(int nind, int index[], real mass[], rvec x[], rvec xp[]) real rmsdev(int natoms, real mass[], rvec x[], rvec xp[]) { - return calc_similar_ind(FALSE, natoms, NULL, mass, x, xp); + return calc_similar_ind(FALSE, natoms, nullptr, mass, x, xp); } real rhodev_ind(int nind, int index[], real mass[], rvec x[], rvec xp[]) @@ -107,7 +107,7 @@ real rhodev_ind(int nind, int index[], real mass[], rvec x[], rvec xp[]) real rhodev(int natoms, real mass[], rvec x[], rvec xp[]) { - return calc_similar_ind(TRUE, natoms, NULL, mass, x, xp); + return calc_similar_ind(TRUE, natoms, nullptr, mass, x, xp); } void calc_fit_R(int ndim, int natoms, real *w_rls, const rvec *xp, rvec *x, matrix R) @@ -305,7 +305,7 @@ void reset_x_ndim(int ndim, int ncm, const int *ind_cm, } tm = 0.0; clear_rvec(xcm); - if (ind_cm != NULL) + if (ind_cm != nullptr) { for (i = 0; i < ncm; i++) { @@ -335,7 +335,7 @@ void reset_x_ndim(int ndim, int ncm, const int *ind_cm, xcm[m] /= tm; } - if (ind_reset != NULL) + if (ind_reset != nullptr) { for (i = 0; i < nreset; i++) { diff --git a/src/gromacs/math/units.cpp b/src/gromacs/math/units.cpp index 13c34786a3..c4fb43ed07 100644 --- a/src/gromacs/math/units.cpp +++ b/src/gromacs/math/units.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -132,5 +132,5 @@ const char *unit2string(int unit) return eg2c_names[unit]; } - return NULL; + return nullptr; } diff --git a/src/gromacs/math/vecdump.cpp b/src/gromacs/math/vecdump.cpp index b44e42f979..ea70c75805 100644 --- a/src/gromacs/math/vecdump.cpp +++ b/src/gromacs/math/vecdump.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -201,7 +201,7 @@ void pr_rvecs(FILE *fp, int indent, const char *title, const rvec vec[], int n) const char *format; int i, j; - if (getenv("GMX_PRINT_LONGFORMAT") != NULL) + if (getenv("GMX_PRINT_LONGFORMAT") != nullptr) { format = flong; } @@ -238,7 +238,7 @@ void pr_rvecs_of_dim(FILE *fp, int indent, const char *title, const rvec vec[], const char *format; int i, j; - if (getenv("GMX_PRINT_LONGFORMAT") != NULL) + if (getenv("GMX_PRINT_LONGFORMAT") != nullptr) { format = flong; } diff --git a/src/gromacs/mdlib/broadcaststructs.cpp b/src/gromacs/mdlib/broadcaststructs.cpp index 876a8ea454..c2a09715f5 100644 --- a/src/gromacs/mdlib/broadcaststructs.cpp +++ b/src/gromacs/mdlib/broadcaststructs.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -59,7 +59,7 @@ static void bc_cstring(const t_commrec *cr, char **s) { int size = 0; - if (MASTER(cr) && *s != NULL) + if (MASTER(cr) && *s != nullptr) { /* Size of the char buffer is string length + 1 for '\0' */ size = strlen(*s) + 1; @@ -73,10 +73,10 @@ static void bc_cstring(const t_commrec *cr, char **s) } nblock_bc(cr, size, *s); } - else if (!MASTER(cr) && *s != NULL) + else if (!MASTER(cr) && *s != nullptr) { sfree(*s); - *s = NULL; + *s = nullptr; } } @@ -241,7 +241,7 @@ static void bc_groups(const t_commrec *cr, t_symtab *symtab, block_bc(cr, n); if (n == 0) { - groups->grpnr[g] = NULL; + groups->grpnr[g] = nullptr; } else { @@ -511,7 +511,7 @@ static void bc_pull(const t_commrec *cr, pull_params_t *pull) { if (!MASTER(cr)) { - pull->coord[c].externalPotentialProvider = NULL; + pull->coord[c].externalPotentialProvider = nullptr; } if (pull->coord[c].eType == epullEXTERNAL) { diff --git a/src/gromacs/mdlib/calc_verletbuf.cpp b/src/gromacs/mdlib/calc_verletbuf.cpp index ae929e3d2f..19f8ee73ed 100644 --- a/src/gromacs/mdlib/calc_verletbuf.cpp +++ b/src/gromacs/mdlib/calc_verletbuf.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -351,10 +351,10 @@ static void get_verlet_buffer_atomtypes(const gmx_mtop_t *mtop, real *vsite_m; int n_nonlin_vsite_mol; - att = NULL; + att = nullptr; natt = 0; - if (n_nonlin_vsite != NULL) + if (n_nonlin_vsite != nullptr) { *n_nonlin_vsite = 0; } @@ -420,7 +420,7 @@ static void get_verlet_buffer_atomtypes(const gmx_mtop_t *mtop, &mtop->ffparams, vsite_m, &n_nonlin_vsite_mol); - if (n_nonlin_vsite != NULL) + if (n_nonlin_vsite != nullptr) { *n_nonlin_vsite += nmol*n_nonlin_vsite_mol; } @@ -832,7 +832,7 @@ void calc_verlet_buffer_size(const gmx_mtop_t *mtop, real boxvol, real particle_distance; real nb_clust_frac_pairs_not_in_list_at_cutoff; - verletbuf_atomtype_t *att = NULL; + verletbuf_atomtype_t *att = nullptr; int natt = -1, i; real elfac; real kT_fac, mass_min; @@ -876,7 +876,7 @@ void calc_verlet_buffer_size(const gmx_mtop_t *mtop, real boxvol, resolution = 0.001; env = getenv("GMX_VERLET_BUFFER_RES"); - if (env != NULL) + if (env != nullptr) { sscanf(env, "%lf", &resolution); } diff --git a/src/gromacs/mdlib/clincs.cpp b/src/gromacs/mdlib/clincs.cpp index 7a47c46910..687a9bc432 100644 --- a/src/gromacs/mdlib/clincs.cpp +++ b/src/gromacs/mdlib/clincs.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -293,7 +293,7 @@ static void lincs_update_atoms_noind(int ncons, const int *bla, int b, i, j; real mvb, im1, im2, tmp0, tmp1, tmp2; - if (invmass != NULL) + if (invmass != nullptr) { for (b = 0; b < ncons; b++) { @@ -342,7 +342,7 @@ static void lincs_update_atoms_ind(int ncons, const int *ind, const int *bla, int bi, b, i, j; real mvb, im1, im2, tmp0, tmp1, tmp2; - if (invmass != NULL) + if (invmass != nullptr) { for (bi = 0; bi < ncons; bi++) { @@ -637,7 +637,7 @@ static void do_lincsp(rvec *x, rvec *f, rvec *fp, t_pbc *pbc, * so we pass invmass=NULL, which results in the use of 1 for all atoms. */ lincs_update_atoms(lincsd, th, 1.0, sol, r, - (econq != econqForce) ? invmass : NULL, fp); + (econq != econqForce) ? invmass : nullptr, fp); if (bCalcDHDL) { @@ -1042,7 +1042,7 @@ static void do_lincs(rvec *x, rvec *xp, matrix box, t_pbc *pbc, /* Communicate the corrected non-local coordinates */ if (DOMAINDECOMP(cr)) { - dd_move_x_constraints(cr->dd, box, xp, NULL, FALSE); + dd_move_x_constraints(cr->dd, box, xp, nullptr, FALSE); } } #pragma omp barrier @@ -1089,14 +1089,14 @@ static void do_lincs(rvec *x, rvec *xp, matrix box, t_pbc *pbc, } /* nit*ncons*(37+9*nrec) flops */ - if (v != NULL) + if (v != nullptr) { /* Update the velocities */ lincs_update_atoms(lincsd, th, invdt, mlambda, r, invmass, v); /* 16 ncons flops */ } - if (nlocat != NULL && (bCalcDHDL || bCalcVir)) + if (nlocat != nullptr && (bCalcDHDL || bCalcVir)) { if (lincsd->bTaskDep) { @@ -2153,7 +2153,7 @@ void set_lincs(const t_idef *idef, done_blocka(&at2con); - if (cr->dd == NULL) + if (cr->dd == nullptr) { /* Since the matrix is static, we should free some memory */ li->ncc_alloc = li->ncc; @@ -2167,7 +2167,7 @@ void set_lincs(const t_idef *idef, srenew(li->tmpncc, li->ncc_alloc); } - if (DOMAINDECOMP(cr) && dd_constraints_nlocalatoms(cr->dd) != NULL) + if (DOMAINDECOMP(cr) && dd_constraints_nlocalatoms(cr->dd) != nullptr) { int *nlocat_dd; @@ -2181,7 +2181,7 @@ void set_lincs(const t_idef *idef, } else { - li->nlocat = NULL; + li->nlocat = nullptr; } if (debug) @@ -2297,12 +2297,12 @@ static void cconerr(const struct gmx_lincsdata *lincsd, r2 = norm2(dx); len = r2*gmx::invsqrt(r2); d = std::abs(len/bllen[b]-1); - if (d > ma && (nlocat == NULL || nlocat[b])) + if (d > ma && (nlocat == nullptr || nlocat[b])) { ma = d; im = b; } - if (nlocat == NULL) + if (nlocat == nullptr) { ssd2 += d*d; count++; @@ -2348,9 +2348,9 @@ gmx_bool constrain_lincs(FILE *fplog, gmx_bool bLog, gmx_bool bEner, * We can also easily check if any constraint length is changed, * if not dH/dlambda=0 and we can also set the boolean to FALSE. */ - bCalcDHDL = (ir->efep != efepNO && dvdlambda != NULL); + bCalcDHDL = (ir->efep != efepNO && dvdlambda != nullptr); - if (lincsd->nc == 0 && cr->dd == NULL) + if (lincsd->nc == 0 && cr->dd == nullptr) { if (bLog || bEner) { @@ -2382,7 +2382,7 @@ gmx_bool constrain_lincs(FILE *fplog, gmx_bool bLog, gmx_bool bEner, if (lincsd->ncg_flex) { /* Set the flexible constraint lengths to the old lengths */ - if (pbc != NULL) + if (pbc != nullptr) { for (i = 0; i < lincsd->nc; i++) { diff --git a/src/gromacs/mdlib/compute_io.cpp b/src/gromacs/mdlib/compute_io.cpp index acbcf6db6d..f3df0b4f2e 100644 --- a/src/gromacs/mdlib/compute_io.cpp +++ b/src/gromacs/mdlib/compute_io.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -75,7 +75,7 @@ double compute_io(t_inputrec *ir, int natoms, gmx_groups_t *groups, { for (i = 0; i < natoms; i++) { - if (groups->grpnr[egcCompressedX] == NULL || groups->grpnr[egcCompressedX][i] == 0) + if (groups->grpnr[egcCompressedX] == nullptr || groups->grpnr[egcCompressedX][i] == 0) { nxtcatoms++; } @@ -145,7 +145,7 @@ double compute_io(t_inputrec *ir, int natoms, gmx_groups_t *groups, } } } - if (ir->pull != NULL) + if (ir->pull != nullptr) { cio += div_nsteps(nsteps, ir->pull->nstxout)*20; /* roughly 20 chars per line */ cio += div_nsteps(nsteps, ir->pull->nstfout)*20; /* roughly 20 chars per line */ diff --git a/src/gromacs/mdlib/constr.cpp b/src/gromacs/mdlib/constr.cpp index 630e190248..bdae1014e0 100644 --- a/src/gromacs/mdlib/constr.cpp +++ b/src/gromacs/mdlib/constr.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -186,7 +186,7 @@ static void write_constr_pdb(const char *fn, const char *title, gmx_domdec_t *dd; const char *anm, *resnm; - dd = NULL; + dd = nullptr; if (DOMAINDECOMP(cr)) { dd = cr->dd; @@ -211,7 +211,7 @@ static void write_constr_pdb(const char *fn, const char *title, int molb = 0; for (i = start; i < start+homenr; i++) { - if (dd != NULL) + if (dd != nullptr) { if (i >= dd->nat_home && i < dd_ac0) { @@ -326,7 +326,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, lambda += delta_step*ir->fepvals->delta_lambda; } - if (vir != NULL) + if (vir != nullptr) { clear_mat(vir_r_m_dr); } @@ -351,7 +351,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, * For constraints there is both forward and backward communication. */ if (ir->ePBC != epbcNONE && - (cr->dd || bMolPBC) && !(cr->dd && cr->dd->constraint_comm == NULL)) + (cr->dd || bMolPBC) && !(cr->dd && cr->dd->constraint_comm == nullptr)) { /* With pbc=screw the screw has been changed to a shift * by the constraint coordinate communication routine, @@ -363,7 +363,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, } else { - pbc_null = NULL; + pbc_null = nullptr; } /* Communicate the coordinates required for the non-local constraints @@ -373,7 +373,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, { dd_move_x_constraints(cr->dd, box, x, xprime, econq == econqCoord); - if (v != NULL) + if (v != nullptr) { /* We need to initialize the non-local components of v. * We never actually use these values, but we do increment them, @@ -383,17 +383,17 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, } } - if (constr->lincsd != NULL) + if (constr->lincsd != nullptr) { bOK = constrain_lincs(fplog, bLog, bEner, ir, step, constr->lincsd, md, cr, x, xprime, min_proj, box, pbc_null, lambda, dvdlambda, - invdt, v, vir != NULL, vir_r_m_dr, + invdt, v, vir != nullptr, vir_r_m_dr, econq, nrnb, constr->maxwarn, &constr->warncount_lincs); if (!bOK && constr->maxwarn < INT_MAX) { - if (fplog != NULL) + if (fplog != nullptr) { fprintf(fplog, "Constraint error in algorithm %s at step %s\n", econstr_names[econtLINCS], gmx_step_str(step, buf)); @@ -411,7 +411,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, md->invmass, constr->nblocks, constr->sblock, idef, ir, x, xprime, nrnb, constr->lagr, lambda, dvdlambda, - invdt, v, vir != NULL, vir_r_m_dr, + invdt, v, vir != nullptr, vir_r_m_dr, constr->maxwarn < INT_MAX, econq); break; case (econqVeloc): @@ -419,7 +419,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, md->invmass, constr->nblocks, constr->sblock, idef, ir, x, min_proj, nrnb, constr->lagr, lambda, dvdlambda, - invdt, NULL, vir != NULL, vir_r_m_dr, + invdt, nullptr, vir != nullptr, vir_r_m_dr, constr->maxwarn < INT_MAX, econq); break; default: @@ -429,7 +429,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, if (!bOK && constr->maxwarn < INT_MAX) { - if (fplog != NULL) + if (fplog != nullptr) { fprintf(fplog, "Constraint error in algorithm %s at step %s\n", econstr_names[econtSHAKE], gmx_step_str(step, buf)); @@ -459,19 +459,19 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, nth, th, pbc_null, x[0], xprime[0], - invdt, v ? v[0] : NULL, - vir != NULL, + invdt, v ? v[0] : nullptr, + vir != nullptr, th == 0 ? vir_r_m_dr : constr->vir_r_m_dr_th[th], th == 0 ? &bSettleErrorHasOccurred : &constr->bSettleErrorHasOccurred[th]); } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; } inc_nrnb(nrnb, eNR_SETTLE, nsettle); - if (v != NULL) + if (v != nullptr) { inc_nrnb(nrnb, eNR_CONSTR_V, nsettle*3); } - if (vir != NULL) + if (vir != nullptr) { inc_nrnb(nrnb, eNR_CONSTR_VIR, nsettle*3); } @@ -487,7 +487,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, { int calcvir_atom_end; - if (vir == NULL) + if (vir == nullptr) { calcvir_atom_end = 0; } @@ -527,7 +527,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, gmx_incons("Unknown constraint quantity for settle"); } - if (vir != NULL) + if (vir != nullptr) { /* Reduce the virial contributions over the threads */ for (int th = 1; th < nth; th++) @@ -567,7 +567,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, } } - if (vir != NULL) + if (vir != nullptr) { /* The normal uses of constrain() pass step_scaling = 1.0. * The call to constrain() for SD1 that passes step_scaling = @@ -644,7 +644,7 @@ real *constr_rmsd_data(struct gmx_constr *constr) } else { - return NULL; + return nullptr; } } @@ -676,7 +676,7 @@ static void make_shake_sblock_serial(struct gmx_constr *constr, ncons = idef->il[F_CONSTR].nr/3; init_blocka(&sblocks); - gen_sblocks(NULL, 0, md->homenr, idef, &sblocks, FALSE); + gen_sblocks(nullptr, 0, md->homenr, idef, &sblocks, FALSE); /* bstart=(idef->nodeid > 0) ? blocks->multinr[idef->nodeid-1] : 0; @@ -1156,13 +1156,13 @@ gmx_constr_t init_constraints(FILE *fplog, int nsettles = gmx_mtop_ftype_count(mtop, F_SETTLE); - GMX_RELEASE_ASSERT(!ir->bPull || ir->pull_work != NULL, "init_constraints called with COM pulling before/without initializing the pull code"); + GMX_RELEASE_ASSERT(!ir->bPull || ir->pull_work != nullptr, "init_constraints called with COM pulling before/without initializing the pull code"); if (nconstraints + nsettles == 0 && !(ir->bPull && pull_have_constraint(ir->pull_work)) && - ed == NULL) + ed == nullptr) { - return NULL; + return nullptr; } struct gmx_constr *constr; @@ -1261,7 +1261,7 @@ gmx_constr_t init_constraints(FILE *fplog, /* Allocate thread-local work arrays */ int nthreads = gmx_omp_nthreads_get(emntSETTLE); - if (nthreads > 1 && constr->vir_r_m_dr_th == NULL) + if (nthreads > 1 && constr->vir_r_m_dr_th == nullptr) { snew(constr->vir_r_m_dr_th, nthreads); snew(constr->bSettleErrorHasOccurred, nthreads); @@ -1302,7 +1302,7 @@ gmx_constr_t init_constraints(FILE *fplog, /* Initialize the essential dynamics sampling. * Put the pointer to the ED struct in constr */ constr->ed = ed; - if (ed != NULL || state->edsamstate != NULL) + if (ed != nullptr || state->edsamstate != nullptr) { init_edsam(mtop, ir, cr, ed, as_rvec_array(state->x.data()), state->box, state->edsamstate); } diff --git a/src/gromacs/mdlib/coupling.cpp b/src/gromacs/mdlib/coupling.cpp index 970b53a21d..8e8eb8b018 100644 --- a/src/gromacs/mdlib/coupling.cpp +++ b/src/gromacs/mdlib/coupling.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -82,11 +82,11 @@ static const double sy_const_3[] = { 0.828981543588751, -0.657963087177502, 0.8 static const double sy_const_5[] = { 0.2967324292201065, 0.2967324292201065, -0.186929716880426, 0.2967324292201065, 0.2967324292201065 }; static const double* sy_const[] = { - NULL, + nullptr, sy_const_1, - NULL, + nullptr, sy_const_3, - NULL, + nullptr, sy_const_5 }; @@ -125,7 +125,7 @@ static void NHC_trotter(t_grpopts *opts, int nvar, gmx_ekindata_t *ekind, real d /* if scalefac is NULL, we are doing the NHC of the barostat */ bBarostat = FALSE; - if (scalefac == NULL) + if (scalefac == nullptr) { bBarostat = TRUE; } @@ -675,7 +675,7 @@ void berendsen_pscale(const t_inputrec *ir, const matrix mu, // Trivial OpenMP region that does not throw int g; - if (cFREEZE == NULL) + if (cFREEZE == nullptr) { g = 0; } @@ -754,7 +754,7 @@ void berendsen_tcoupl(t_inputrec *ir, gmx_ekindata_t *ekind, real dt) void andersen_tcoupl(t_inputrec *ir, gmx_int64_t step, const t_commrec *cr, const t_mdatoms *md, t_state *state, real rate, const gmx_bool *randomize, const real *boltzfac) { - const int *gatindex = (DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL); + const int *gatindex = (DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr); int i; int gc = 0; gmx::ThreeFry2x64<0> rng(ir->andersen_seed, gmx::RandomDomain::Thermostat); @@ -893,12 +893,12 @@ void trotter_update(t_inputrec *ir, gmx_int64_t step, gmx_ekindata_t *ekind, case etrtBARONHC: case etrtBARONHC2: NHC_trotter(opts, state->nnhpres, ekind, dt, state->nhpres_xi.data(), - state->nhpres_vxi.data(), NULL, &(state->veta), MassQ, FALSE); + state->nhpres_vxi.data(), nullptr, &(state->veta), MassQ, FALSE); break; case etrtNHC: case etrtNHC2: NHC_trotter(opts, opts->ngtc, ekind, dt, state->nosehoover_xi.data(), - state->nosehoover_vxi.data(), scalefac, NULL, MassQ, (ir->eI == eiVV)); + state->nosehoover_vxi.data(), scalefac, nullptr, MassQ, (ir->eI == eiVV)); /* need to rescale the kinetic energies and velocities here. Could scale the velocities later, but we need them scaled in order to produce the correct outputs, so we'll scale them here. */ diff --git a/src/gromacs/mdlib/csettle.cpp b/src/gromacs/mdlib/csettle.cpp index 74e9d498c3..1dbaff73fa 100644 --- a/src/gromacs/mdlib/csettle.cpp +++ b/src/gromacs/mdlib/csettle.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -208,14 +208,14 @@ gmx_settledata_t settle_init(const gmx_mtop_t *mtop) real dHH = mtop->ffparams.iparams[settle_type].settle.dhh; settleparam_init(&settled->mass1, 1.0, 1.0, 1.0, 1.0, dOH, dHH); - settled->ow1 = NULL; - settled->hw2 = NULL; - settled->hw3 = NULL; - settled->virfac = NULL; + settled->ow1 = nullptr; + settled->hw2 = nullptr; + settled->hw3 = nullptr; + settled->virfac = nullptr; settled->nalloc = 0; /* Without SIMD configured, this bool is not used */ - settled->bUseSimd = (getenv("GMX_DISABLE_SIMD_KERNELS") == NULL); + settled->bUseSimd = (getenv("GMX_DISABLE_SIMD_KERNELS") == nullptr); return settled; } @@ -348,7 +348,7 @@ void settle_proj(gmx_settledata_t settled, int econq, hw2 = iatoms[i*nral1 + 2]; hw3 = iatoms[i*nral1 + 3]; - if (pbc == NULL) + if (pbc == nullptr) { rvec_sub(x[ow1], x[hw2], roh2); rvec_sub(x[ow1], x[hw3], roh3); @@ -777,7 +777,7 @@ static void settleTemplateWrapper(gmx_settledata_t settled, int settleStart = ((numSettlePacks* thread + nthread - 1)/nthread)*packSize; int settleEnd = ((numSettlePacks*(thread + 1) + nthread - 1)/nthread)*packSize; - if (v != NULL) + if (v != nullptr) { if (!bCalcVirial) { @@ -789,7 +789,7 @@ static void settleTemplateWrapper(gmx_settledata_t settled, pbc, x, xprime, invdt, v, - NULL, + nullptr, bErrorHasOccurred); } else @@ -818,7 +818,7 @@ static void settleTemplateWrapper(gmx_settledata_t settled, pbc, x, xprime, invdt, v, - NULL, + nullptr, bErrorHasOccurred); } else @@ -869,13 +869,13 @@ void csettle(gmx_settledata_t settled, t_pbc pbcNo; const t_pbc *pbcNonNull; - if (pbc != NULL) + if (pbc != nullptr) { pbcNonNull = pbc; } else { - set_pbc(&pbcNo, epbcNONE, NULL); + set_pbc(&pbcNo, epbcNONE, nullptr); pbcNonNull = &pbcNo; } diff --git a/src/gromacs/mdlib/ebin.cpp b/src/gromacs/mdlib/ebin.cpp index 9777c3e142..e882f75eb5 100644 --- a/src/gromacs/mdlib/ebin.cpp +++ b/src/gromacs/mdlib/ebin.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -79,7 +79,7 @@ int get_ebin_space(t_ebin *eb, int nener, const char *enm[], const char *unit) eb->e_sim[i].eav = 0; eb->e_sim[i].esum = 0; eb->enm[i].name = gmx_strdup(enm[i-index]); - if (unit != NULL) + if (unit != nullptr) { eb->enm[i].unit = gmx_strdup(unit); } diff --git a/src/gromacs/mdlib/expanded.cpp b/src/gromacs/mdlib/expanded.cpp index 3136c480a0..0a6c248e63 100644 --- a/src/gromacs/mdlib/expanded.cpp +++ b/src/gromacs/mdlib/expanded.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -1024,7 +1024,7 @@ extern void PrintFreeEnergyInfoToFile(FILE *outfile, t_lambda *fep, t_expanded * gmx_bool bSimTemp = FALSE; nlim = fep->n_lambda; - if (simtemp != NULL) + if (simtemp != nullptr) { bSimTemp = TRUE; } diff --git a/src/gromacs/mdlib/force.cpp b/src/gromacs/mdlib/force.cpp index 238b5e160b..c8361b951e 100644 --- a/src/gromacs/mdlib/force.cpp +++ b/src/gromacs/mdlib/force.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -362,7 +362,7 @@ void do_force_lowlevel(t_forcerec *fr, t_inputrec *ir, do_force_listed(wcycle, box, ir->fepvals, cr, idef, (const rvec *) x, hist, f, fr, &pbc, graph, enerd, nrnb, lambda, md, fcd, - DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL, + DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr, flags); where(); diff --git a/src/gromacs/mdlib/forcerec.cpp b/src/gromacs/mdlib/forcerec.cpp index ae662ec467..2b208cf32b 100644 --- a/src/gromacs/mdlib/forcerec.cpp +++ b/src/gromacs/mdlib/forcerec.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -101,7 +101,7 @@ const char *egrp_nm[egNR+1] = { "Coul-SR", "LJ-SR", "Buck-SR", - "Coul-14", "LJ-14", NULL + "Coul-14", "LJ-14", nullptr }; t_forcerec *mk_forcerec(void) @@ -349,7 +349,7 @@ check_solvent_cg(const gmx_moltype_t *molt, /* Check if we are doing QM on this group */ qm = FALSE; - if (qm_grpnr != NULL) + if (qm_grpnr != nullptr) { for (j = j0; j < j1 && !qm; j++) { @@ -543,7 +543,7 @@ check_solvent(FILE * fp, } n_solvent_parameters = 0; - solvent_parameters = NULL; + solvent_parameters = nullptr; /* Allocate temporary array for solvent type */ snew(cg_sp, mtop->nmolblock); @@ -566,7 +566,7 @@ check_solvent(FILE * fp, { check_solvent_cg(molt, cg_mol, nmol, mtop->groups.grpnr[egcQMMM] ? - mtop->groups.grpnr[egcQMMM]+at_offset+am : 0, + mtop->groups.grpnr[egcQMMM]+at_offset+am : nullptr, &mtop->groups.grps[egcQMMM], fr, &n_solvent_parameters, &solvent_parameters, @@ -622,7 +622,7 @@ check_solvent(FILE * fp, } sfree(cg_sp); - if (bestsol != esolNO && fp != NULL) + if (bestsol != esolNO && fp != nullptr) { fprintf(fp, "\nEnabling %s-like water optimization for %d molecules.\n\n", esol_names[bestsol], @@ -702,7 +702,7 @@ static cginfo_mb_t *init_cginfo_mb(FILE *fplog, const gmx_mtop_t *mtop, { bId = FALSE; } - if (mtop->groups.grpnr[egcQMMM] != NULL) + if (mtop->groups.grpnr[egcQMMM] != nullptr) { for (ai = a0; ai < a1; ai++) { @@ -991,7 +991,7 @@ void update_forcerec(t_forcerec *fr, matrix box) { if (fr->eeltype == eelGRF) { - calc_rffac(NULL, fr->eeltype, fr->epsilon_r, fr->epsilon_rf, + calc_rffac(nullptr, fr->eeltype, fr->epsilon_r, fr->epsilon_rf, fr->rcoulomb, fr->temp, fr->zsquare, box, &fr->kappa, &fr->k_rf, &fr->c_rf); } @@ -1007,7 +1007,7 @@ void set_avcsixtwelve(FILE *fplog, t_forcerec *fr, const gmx_mtop_t *mtop) int ntp, *typecount; gmx_bool bBHAM; real *nbfp; - real *nbfp_comb = NULL; + real *nbfp_comb = nullptr; ntp = fr->ntype; bBHAM = fr->bBHAM; @@ -1214,7 +1214,7 @@ void set_avcsixtwelve(FILE *fplog, t_forcerec *fr, const gmx_mtop_t *mtop) sfree(nbfp_comb); } - if (fplog != NULL) + if (fplog != nullptr) { if (fr->eDispCorr == edispcAllEner || fr->eDispCorr == edispcAllEnerPres) @@ -1296,7 +1296,7 @@ static void make_nbf_tables(FILE *fp, char buf[STRLEN]; int i, j; - if (tabfn == NULL) + if (tabfn == nullptr) { if (debug) { @@ -1433,10 +1433,10 @@ static bondedtable_t *make_bonded_tables(FILE *fplog, int ncount, *count; bondedtable_t *tab; - tab = NULL; + tab = nullptr; ncount = 0; - count = NULL; + count = nullptr; count_tables(ftype1, ftype2, mtop, &ncount, &count); // Are there any relevant tabulated bond interactions? @@ -1536,7 +1536,7 @@ gmx_bool can_use_allvsall(const t_inputrec *ir, gmx_bool bPrintNote, t_commrec * (ir->implicit_solvent == eisGBSA && (ir->gb_algorithm == egbSTILL || ir->gb_algorithm == egbHCT || ir->gb_algorithm == egbOBC))) && - getenv("GMX_NO_ALLVSALL") == NULL + getenv("GMX_NO_ALLVSALL") == nullptr ); if (bAllvsAll && ir->opts.ngener > 1) @@ -1545,7 +1545,7 @@ gmx_bool can_use_allvsall(const t_inputrec *ir, gmx_bool bPrintNote, t_commrec * if (bPrintNote) { - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "\n%s\n", note); } @@ -1647,7 +1647,7 @@ static void pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused *ir, #endif /* GMX_NBNXN_SIMD_2XNN && GMX_NBNXN_SIMD_4XN */ - if (getenv("GMX_NBNXN_SIMD_4XN") != NULL) + if (getenv("GMX_NBNXN_SIMD_4XN") != nullptr) { #ifdef GMX_NBNXN_SIMD_4XN *kernel_type = nbnxnk4xN_SIMD_4xN; @@ -1655,7 +1655,7 @@ static void pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused *ir, gmx_fatal(FARGS, "SIMD 4xN kernels requested, but GROMACS has been compiled without support for these kernels"); #endif } - if (getenv("GMX_NBNXN_SIMD_2XNN") != NULL) + if (getenv("GMX_NBNXN_SIMD_2XNN") != nullptr) { #ifdef GMX_NBNXN_SIMD_2XNN *kernel_type = nbnxnk4xN_SIMD_2xNN; @@ -1676,11 +1676,11 @@ static void pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused *ir, (GMX_SIMD_REAL_WIDTH >= 4 && GMX_SIMD_HAVE_FMA && !GMX_DOUBLE) || GMX_SIMD_IBM_QPX *ewald_excl = ewaldexclAnalytical; #endif - if (getenv("GMX_NBNXN_EWALD_TABLE") != NULL) + if (getenv("GMX_NBNXN_EWALD_TABLE") != nullptr) { *ewald_excl = ewaldexclTable; } - if (getenv("GMX_NBNXN_EWALD_ANALYTICAL") != NULL) + if (getenv("GMX_NBNXN_EWALD_ANALYTICAL") != nullptr) { *ewald_excl = ewaldexclAnalytical; } @@ -1692,7 +1692,7 @@ static void pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused *ir, const char *lookup_nbnxn_kernel_name(int kernel_type) { - const char *returnvalue = NULL; + const char *returnvalue = nullptr; switch (kernel_type) { case nbnxnkNotSet: @@ -1715,7 +1715,7 @@ const char *lookup_nbnxn_kernel_name(int kernel_type) case nbnxnkNR: default: gmx_fatal(FARGS, "Illegal kernel type selected"); - returnvalue = NULL; + returnvalue = nullptr; break; } return returnvalue; @@ -1763,7 +1763,7 @@ static void pick_nbnxn_kernel(FILE *fp, } } - if (bDoNonbonded && fp != NULL) + if (bDoNonbonded && fp != nullptr) { fprintf(fp, "\nUsing %s %dx%d non-bonded kernels\n\n", lookup_nbnxn_kernel_name(*kernel_type), @@ -1794,7 +1794,7 @@ static void pick_nbnxn_resources(const gmx::MDLogger &mdlog, *bUseGPU = FALSE; - bEmulateGPUEnvVarSet = (getenv("GMX_EMULATE_GPU") != NULL); + bEmulateGPUEnvVarSet = (getenv("GMX_EMULATE_GPU") != nullptr); /* Run GPU emulation mode if GMX_EMULATE_GPU is defined. Because * GPUs (currently) only handle non-bonded calculations, we will @@ -1915,7 +1915,7 @@ void init_interaction_const_tables(FILE *fp, { init_ewald_f_table(ic, rtab); - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "Initialized non-bonded Ewald correction tables, spacing: %.2e size: %d\n\n", 1/ic->tabq_scale, ic->tabq_size); @@ -2073,7 +2073,7 @@ init_interaction_const(FILE *fp, } } - if (fp != NULL) + if (fp != nullptr) { real dispersion_shift; @@ -2124,14 +2124,14 @@ static void init_nb_verlet(FILE *fp, &bEmulateGPU, fr->gpu_opt); - nbv->nbs = NULL; + nbv->nbs = nullptr; nbv->min_ci_balanced = 0; nbv->ngrp = (DOMAINDECOMP(cr) ? 2 : 1); for (i = 0; i < nbv->ngrp; i++) { nbv->grp[i].nbl_lists.nnbl = 0; - nbv->grp[i].nbat = NULL; + nbv->grp[i].nbat = nullptr; nbv->grp[i].kernel_type = nbnxnkNotSet; if (i == 0) /* local */ @@ -2144,7 +2144,7 @@ static void init_nb_verlet(FILE *fp, } else /* non-local */ { - if (nbpu_opt != NULL && strcmp(nbpu_opt, "gpu_cpu") == 0) + if (nbpu_opt != nullptr && strcmp(nbpu_opt, "gpu_cpu") == 0) { /* Use GPU for local, select a CPU kernel for non-local */ pick_nbnxn_kernel(fp, mdlog, fr->use_simd_kernels, @@ -2165,8 +2165,8 @@ static void init_nb_verlet(FILE *fp, } nbnxn_init_search(&nbv->nbs, - DOMAINDECOMP(cr) ? &cr->dd->nc : NULL, - DOMAINDECOMP(cr) ? domdec_zones(cr->dd) : NULL, + DOMAINDECOMP(cr) ? &cr->dd->nc : nullptr, + DOMAINDECOMP(cr) ? domdec_zones(cr->dd) : nullptr, bFEP_NonBonded, gmx_omp_nthreads_get(emntPairsearch)); @@ -2192,7 +2192,7 @@ static void init_nb_verlet(FILE *fp, if (fr->vdwtype == evdwCUT && (fr->vdw_modifier == eintmodNONE || fr->vdw_modifier == eintmodPOTSHIFT) && - getenv("GMX_NO_LJ_COMB_RULE") == NULL) + getenv("GMX_NO_LJ_COMB_RULE") == nullptr) { /* Plain LJ cut-off: we can optimize with combination rules */ enbnxninitcombrule = enbnxninitcombruleDETECT; @@ -2264,7 +2264,7 @@ static void init_nb_verlet(FILE *fp, } #endif /* GMX_THREAD_MPI */ - if ((env = getenv("GMX_NB_MIN_CI")) != NULL) + if ((env = getenv("GMX_NB_MIN_CI")) != nullptr) { char *end; @@ -2297,7 +2297,7 @@ static void init_nb_verlet(FILE *fp, gmx_bool usingGpu(nonbonded_verlet_t *nbv) { - return nbv != NULL && nbv->bUseGPU; + return nbv != nullptr && nbv->bUseGPU; } void init_forcerec(FILE *fp, @@ -2325,7 +2325,7 @@ void init_forcerec(FILE *fp, gmx_bool bFEP_NonBonded; int *nm_ind, egp_flags; - if (fr->hwinfo == NULL) + if (fr->hwinfo == nullptr) { /* Detect hardware, gather information. * In mdrun, hwinfo has already been set before calling init_forcerec. @@ -2408,7 +2408,7 @@ void init_forcerec(FILE *fp, fr->sc_sigma6_def = gmx::power6(ir->fepvals->sc_sigma); env = getenv("GMX_SCSIGMA_MIN"); - if (env != NULL) + if (env != nullptr) { dbl = 0; sscanf(env, "%20lf", &dbl); @@ -2420,7 +2420,7 @@ void init_forcerec(FILE *fp, } fr->bNonbonded = TRUE; - if (getenv("GMX_NO_NONBONDED") != NULL) + if (getenv("GMX_NO_NONBONDED") != nullptr) { /* turn off non-bonded calculations */ fr->bNonbonded = FALSE; @@ -2435,9 +2435,9 @@ void init_forcerec(FILE *fp, * can be used with water optimization, and disable it if that is not the case. */ - if (getenv("GMX_NB_GENERIC") != NULL) + if (getenv("GMX_NB_GENERIC") != nullptr) { - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "Found environment variable GMX_NB_GENERIC.\n" @@ -2452,10 +2452,10 @@ void init_forcerec(FILE *fp, bNoSolvOpt = TRUE; } - if ( (getenv("GMX_DISABLE_SIMD_KERNELS") != NULL) || (getenv("GMX_NOOPTIMIZEDKERNELS") != NULL) ) + if ( (getenv("GMX_DISABLE_SIMD_KERNELS") != nullptr) || (getenv("GMX_NOOPTIMIZEDKERNELS") != nullptr) ) { fr->use_simd_kernels = FALSE; - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "\nFound environment variable GMX_DISABLE_SIMD_KERNELS.\n" @@ -2467,16 +2467,16 @@ void init_forcerec(FILE *fp, fr->bBHAM = (mtop->ffparams.functype[0] == F_BHAM); /* Check if we can/should do all-vs-all kernels */ - fr->bAllvsAll = can_use_allvsall(ir, FALSE, NULL, NULL); - fr->AllvsAll_work = NULL; - fr->AllvsAll_workgb = NULL; + fr->bAllvsAll = can_use_allvsall(ir, FALSE, nullptr, nullptr); + fr->AllvsAll_work = nullptr; + fr->AllvsAll_workgb = nullptr; /* All-vs-all kernels have not been implemented in 4.6 and later. * See Redmine #1249. */ if (fr->bAllvsAll) { fr->bAllvsAll = FALSE; - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "\nYour simulation settings would have triggered the efficient all-vs-all\n" @@ -2500,7 +2500,7 @@ void init_forcerec(FILE *fp, { fprintf(stderr, "\n%s\n", note); } - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "\n%s\n", note); } @@ -2540,7 +2540,7 @@ void init_forcerec(FILE *fp, { fr->bMolPBC = TRUE; - if (getenv("GMX_USE_GRAPH") != NULL) + if (getenv("GMX_USE_GRAPH") != nullptr) { fr->bMolPBC = FALSE; if (fp) @@ -2838,17 +2838,17 @@ void init_forcerec(FILE *fp, fr->cg_nalloc = ncg_mtop(mtop); srenew(fr->cg_cm, fr->cg_nalloc); } - if (fr->shift_vec == NULL) + if (fr->shift_vec == nullptr) { snew(fr->shift_vec, SHIFTS); } - if (fr->fshift == NULL) + if (fr->fshift == nullptr) { snew(fr->fshift, SHIFTS); } - if (fr->nbfp == NULL) + if (fr->nbfp == nullptr) { fr->ntype = mtop->ffparams.atnr; fr->nbfp = mk_nbfp(&mtop->ffparams, fr->bBHAM); @@ -3047,7 +3047,7 @@ void init_forcerec(FILE *fp, /* make tables for ordinary interactions */ if (bSomeNormalNbListsAreInUse) { - make_nbf_tables(fp, fr, rtab, tabfn, NULL, NULL, &fr->nblists[0]); + make_nbf_tables(fp, fr, rtab, tabfn, nullptr, nullptr, &fr->nblists[0]); m = 1; } else @@ -3153,7 +3153,7 @@ void init_forcerec(FILE *fp, &fr->bExcl_IntraCGAll_InterCGNone); if (DOMAINDECOMP(cr)) { - fr->cginfo = NULL; + fr->cginfo = nullptr; } else { diff --git a/src/gromacs/mdlib/genborn.cpp b/src/gromacs/mdlib/genborn.cpp index bc43ba9076..38ee8a833f 100644 --- a/src/gromacs/mdlib/genborn.cpp +++ b/src/gromacs/mdlib/genborn.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -103,11 +103,11 @@ static int init_gb_nblist(int natoms, t_nblist *nl) nl->maxnrj = 0; nl->nri = 0; nl->nrj = 0; - nl->iinr = NULL; - nl->gid = NULL; - nl->shift = NULL; - nl->jindex = NULL; - nl->jjnr = NULL; + nl->iinr = nullptr; + nl->gid = nullptr; + nl->shift = nullptr; + nl->jindex = nullptr; + nl->jjnr = nullptr; /*nl->nltype = nltype;*/ srenew(nl->iinr, nl->maxnri); @@ -265,11 +265,11 @@ int init_gb(gmx_genborn_t **p_born, snew(fr->invsqrta, natoms); snew(fr->dvda, natoms); - fr->dadx = NULL; - fr->dadx_rawptr = NULL; + fr->dadx = nullptr; + fr->dadx_rawptr = nullptr; fr->nalloc_dadx = 0; - born->gpol_still_work = NULL; - born->gpol_hct_work = NULL; + born->gpol_still_work = nullptr; + born->gpol_hct_work = nullptr; /* snew(born->asurf,natoms); */ /* snew(born->dasurf,natoms); */ @@ -927,7 +927,7 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t int cnt; int ndadx; - if (fr->bAllvsAll && fr->dadx == NULL) + if (fr->bAllvsAll && fr->dadx == nullptr) { /* We might need up to 8 atoms of padding before and after, * and another 4 units to guarantee SSE alignment. @@ -1355,7 +1355,7 @@ calc_gb_forces(t_commrec *cr, t_mdatoms *md, gmx_genborn_t *born, gmx_localtop_t } else { - pbc_null = NULL; + pbc_null = nullptr; } if (sa_algorithm == esaAPPROX) @@ -1426,7 +1426,7 @@ static gbtmpnbl_t *find_gbtmplist(struct gbtmpnbls *lists, int shift) srenew(lists->list, lists->list_nalloc); for (i = lists->nlist; i < lists->list_nalloc; i++) { - lists->list[i].aj = NULL; + lists->list[i].aj = nullptr; lists->list[i].aj_nalloc = 0; } @@ -1455,7 +1455,7 @@ static void add_bondeds_to_gblist(t_ilist *il, aj = il->iatoms[ind+2]; int shift = CENTRAL; - if (g != NULL) + if (g != nullptr) { rvec_sub(x[ai], x[aj], dx); ivec_sub(SHIFT_IVEC(g, ai), SHIFT_IVEC(g, aj), dt); @@ -1504,7 +1504,7 @@ int make_gb_nblist(t_commrec *cr, int gb_algorithm, t_pbc pbc; struct gbtmpnbls *nls; - gbtmpnbl_t *list = NULL; + gbtmpnbl_t *list = nullptr; set_pbc(&pbc, fr->ePBC, box); nls = born->nblist_work; @@ -1620,7 +1620,7 @@ int make_gb_nblist(t_commrec *cr, int gb_algorithm, void make_local_gb(const t_commrec *cr, gmx_genborn_t *born, int gb_algorithm) { int i, at0, at1; - gmx_domdec_t *dd = NULL; + gmx_domdec_t *dd = nullptr; if (DOMAINDECOMP(cr)) { diff --git a/src/gromacs/mdlib/genborn_allvsall.cpp b/src/gromacs/mdlib/genborn_allvsall.cpp index e459f597f2..1d96860895 100644 --- a/src/gromacs/mdlib/genborn_allvsall.cpp +++ b/src/gromacs/mdlib/genborn_allvsall.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2009, The GROMACS Development Team. - * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2010,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -377,7 +377,7 @@ genborn_allvsall_calc_still_radii(t_forcerec * fr, aadata = *((gmx_allvsallgb2_data_t **)work); - if (aadata == NULL) + if (aadata == nullptr) { genborn_allvsall_setup(&aadata, top->idef.il, mdatoms->nr, FALSE, FALSE, TRUE); @@ -590,7 +590,7 @@ genborn_allvsall_calc_hct_obc_radii(t_forcerec * fr, aadata = *((gmx_allvsallgb2_data_t **)work); - if (aadata == NULL) + if (aadata == nullptr) { genborn_allvsall_setup(&aadata, top->idef.il, mdatoms->nr, TRUE, TRUE, TRUE); diff --git a/src/gromacs/mdlib/gmx_omp_nthreads.cpp b/src/gromacs/mdlib/gmx_omp_nthreads.cpp index f4aa5a919c..211bc2b951 100644 --- a/src/gromacs/mdlib/gmx_omp_nthreads.cpp +++ b/src/gromacs/mdlib/gmx_omp_nthreads.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -124,7 +124,7 @@ static void pick_module_nthreads(const gmx::MDLogger &mdlog, int m, } /* check the environment variable */ - if ((env = getenv(modth_env_var[m])) != NULL) + if ((env = getenv(modth_env_var[m])) != nullptr) { sscanf(env, "%d", &nth); @@ -138,7 +138,7 @@ static void pick_module_nthreads(const gmx::MDLogger &mdlog, int m, /* with the verlet codepath, when any GMX_*_NUM_THREADS env var is set, * OMP_NUM_THREADS also has to be set */ - if (bFullOmpSupport && getenv("OMP_NUM_THREADS") == NULL) + if (bFullOmpSupport && getenv("OMP_NUM_THREADS") == nullptr) { gmx_warning("%s=%d is set, the default number of threads also " "needs to be set with OMP_NUM_THREADS!", @@ -184,7 +184,7 @@ void gmx_omp_nthreads_read_env(int *nthreads_omp, GMX_RELEASE_ASSERT(nthreads_omp, "nthreads_omp must be a non-NULL pointer"); - if ((env = getenv("OMP_NUM_THREADS")) != NULL) + if ((env = getenv("OMP_NUM_THREADS")) != nullptr) { int nt_omp; @@ -283,7 +283,7 @@ static void manage_number_of_openmp_threads(const gmx::MDLogger &mdlog, * - 1 */ nth = 1; - if ((env = getenv("OMP_NUM_THREADS")) != NULL) + if ((env = getenv("OMP_NUM_THREADS")) != nullptr) { if (!bOMP && (std::strncmp(env, "1", 1) != 0)) { diff --git a/src/gromacs/mdlib/groupcoord.cpp b/src/gromacs/mdlib/groupcoord.cpp index 72da572369..f12d6f49c5 100644 --- a/src/gromacs/mdlib/groupcoord.cpp +++ b/src/gromacs/mdlib/groupcoord.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -84,7 +84,7 @@ void dd_make_local_group_indices(gmx_ga2la_t *ga2la, /* Save the atoms index in the local atom numbers array */ (*anrs_loc)[localnr] = ii; - if (coll_ind != NULL) + if (coll_ind != nullptr) { /* Keep track of where this local atom belongs in the collective index array. * This is needed when reducing the local arrays to a collective/global array @@ -233,7 +233,7 @@ extern void communicate_group_positions( * The rest of the code is for making the group whole again in case atoms changed * their PBC representation / crossed a box boundary. We only do that if the * shifts array is allocated. */ - if (NULL != shifts) + if (nullptr != shifts) { /* To make the group whole, start with a whole group and each * step move the assembled positions at closest distance to the positions @@ -281,7 +281,7 @@ extern double get_sum_of_positions(rvec x[], real weight[], const int nat, dvec clear_dvec(dsumvec); /* Loop over all atoms and add their weighted position vectors */ - if (weight != NULL) + if (weight != nullptr) { for (i = 0; i < nat; i++) { @@ -314,7 +314,7 @@ extern void get_center(rvec x[], real weight[], const int nr, rvec rcenter) weight_sum = get_sum_of_positions(x, weight, nr, dcenter); - if (weight != NULL) + if (weight != nullptr) { denom = weight_sum; /* Divide by the sum of weight */ } @@ -367,7 +367,7 @@ extern void get_center_comm( weight_sum = buf[3]; } - if (weight_loc != NULL) + if (weight_loc != nullptr) { denom = 1.0/weight_sum; /* Divide by the sum of weight to get center of mass e.g. */ } diff --git a/src/gromacs/mdlib/main.cpp b/src/gromacs/mdlib/main.cpp index bc812c25c2..06fef9dbf8 100644 --- a/src/gromacs/mdlib/main.cpp +++ b/src/gromacs/mdlib/main.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -74,12 +74,12 @@ void check_multi_int(FILE *log, const gmx_multisim_t *ms, int val, int *ibuf, p; gmx_bool bCompatible; - if (NULL != log && !bQuiet) + if (nullptr != log && !bQuiet) { fprintf(log, "Multi-checking %s ... ", name); } - if (ms == NULL) + if (ms == nullptr) { gmx_fatal(FARGS, "check_multi_int called with a NULL communication pointer"); @@ -97,14 +97,14 @@ void check_multi_int(FILE *log, const gmx_multisim_t *ms, int val, if (bCompatible) { - if (NULL != log && !bQuiet) + if (nullptr != log && !bQuiet) { fprintf(log, "OK\n"); } } else { - if (NULL != log) + if (nullptr != log) { fprintf(log, "\n%s is not equal for all subsystems\n", name); for (p = 0; p < ms->nsim; p++) @@ -127,12 +127,12 @@ void check_multi_int64(FILE *log, const gmx_multisim_t *ms, int p; gmx_bool bCompatible; - if (NULL != log && !bQuiet) + if (nullptr != log && !bQuiet) { fprintf(log, "Multi-checking %s ... ", name); } - if (ms == NULL) + if (ms == nullptr) { gmx_fatal(FARGS, "check_multi_int called with a NULL communication pointer"); @@ -150,7 +150,7 @@ void check_multi_int64(FILE *log, const gmx_multisim_t *ms, if (bCompatible) { - if (NULL != log && !bQuiet) + if (nullptr != log && !bQuiet) { fprintf(log, "OK\n"); } @@ -159,7 +159,7 @@ void check_multi_int64(FILE *log, const gmx_multisim_t *ms, { // TODO Part of this error message would also be good to go to // stderr (from one rank of one sim only) - if (NULL != log) + if (nullptr != log) { fprintf(log, "\n%s is not equal for all subsystems\n", name); for (p = 0; p < ms->nsim; p++) @@ -232,7 +232,7 @@ void gmx_log_close(FILE *fp) { if (fp) { - gmx_fatal_set_log_file(NULL); + gmx_fatal_set_log_file(nullptr); gmx_fio_fclose(fp); } } diff --git a/src/gromacs/mdlib/md_support.cpp b/src/gromacs/mdlib/md_support.cpp index 5ef335d81b..af7db38b2d 100644 --- a/src/gromacs/mdlib/md_support.cpp +++ b/src/gromacs/mdlib/md_support.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -224,7 +224,7 @@ void compute_globals(FILE *fplog, gmx_global_stat *gstat, t_commrec *cr, t_input { wallcycle_start(wcycle, ewcMoveE); global_stat(gstat, cr, enerd, force_vir, shake_vir, mu_tot, - ir, ekind, constr, bStopCM ? vcm : NULL, + ir, ekind, constr, bStopCM ? vcm : nullptr, signalBuffer.size(), signalBuffer.data(), totalNumberOfBondedInteractions, *bSumEkinhOld, flags); @@ -631,7 +631,7 @@ void set_state_entries(t_state *state, const t_inputrec *ir) } if (ir->eSwapCoords != eswapNO) { - if (state->swapstate == NULL) + if (state->swapstate == nullptr) { snew(state->swapstate, 1); } diff --git a/src/gromacs/mdlib/mdatoms.cpp b/src/gromacs/mdlib/mdatoms.cpp index bbcba4bfae..15cca135cb 100644 --- a/src/gromacs/mdlib/mdatoms.cpp +++ b/src/gromacs/mdlib/mdatoms.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -204,11 +204,11 @@ void atoms2md(const gmx_mtop_t *mtop, const t_inputrec *ir, * Therefore, when adding code, the user should use something like: * gprnrU1 = (md->cU1==NULL ? 0 : md->cU1[localatindex]) */ - if (mtop->groups.grpnr[egcUser1] != NULL) + if (mtop->groups.grpnr[egcUser1] != nullptr) { srenew(md->cU1, md->nalloc); } - if (mtop->groups.grpnr[egcUser2] != NULL) + if (mtop->groups.grpnr[egcUser2] != nullptr) { srenew(md->cU2, md->nalloc); } @@ -232,7 +232,7 @@ void atoms2md(const gmx_mtop_t *mtop, const t_inputrec *ir, real mA, mB, fac; real c6, c12; - if (index == NULL) + if (index == nullptr) { ag = i; } @@ -397,7 +397,7 @@ void atoms2md(const gmx_mtop_t *mtop, const t_inputrec *ir, if (ir->bQMMM) { - if (groups->grpnr[egcQMMM] == 0 || + if (groups->grpnr[egcQMMM] == nullptr || groups->grpnr[egcQMMM][ag] < groups->grps[egcQMMM].nr-1) { md->bQM[i] = TRUE; diff --git a/src/gromacs/mdlib/mdebin.cpp b/src/gromacs/mdlib/mdebin.cpp index e654ae5c49..1c6308ca4a 100644 --- a/src/gromacs/mdlib/mdebin.cpp +++ b/src/gromacs/mdlib/mdebin.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -169,7 +169,7 @@ t_mdebin *init_mdebin(ener_file_t fp_ene, { md->nCrmsd = 1; } - md->bConstrVir = (getenv("GMX_CONSTRAINTVIR") != NULL); + md->bConstrVir = (getenv("GMX_CONSTRAINTVIR") != nullptr); } else { @@ -311,7 +311,7 @@ t_mdebin *init_mdebin(ener_file_t fp_ene, /* Pass NULL for unit to let get_ebin_space determine the units * for interaction_function[i].longname */ - md->ie = get_ebin_space(md->ebin, md->f_nre, ener_nm, NULL); + md->ie = get_ebin_space(md->ebin, md->f_nre, ener_nm, nullptr); if (md->nCrmsd) { /* This should be called directly after the call for md->ie, @@ -567,10 +567,10 @@ t_mdebin *init_mdebin(ener_file_t fp_ene, do_enxnms(fp_ene, &md->ebin->nener, &md->ebin->enm); } - md->print_grpnms = NULL; + md->print_grpnms = nullptr; /* check whether we're going to write dh histograms */ - md->dhc = NULL; + md->dhc = nullptr; if (ir->fepvals->separate_dhdl_file == esepdhdlfileNO) { /* Currently dh histograms are only written with dynamics */ @@ -580,7 +580,7 @@ t_mdebin *init_mdebin(ener_file_t fp_ene, mde_delta_h_coll_init(md->dhc, ir); } - md->fp_dhdl = NULL; + md->fp_dhdl = nullptr; snew(md->dE, ir->fepvals->n_lambda); } else @@ -1105,7 +1105,7 @@ void upd_mdebin(t_mdebin *md, { /* zero for simulated tempering */ md->dE[i] = enerd->enerpart_lambda[i+1]-enerd->enerpart_lambda[0]; - if (md->temperatures != NULL) + if (md->temperatures != nullptr) { /* MRS: is this right, given the way we have defined the exchange probabilities? */ /* is this even useful to have at all? */ @@ -1437,7 +1437,7 @@ void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR, if (md->nE > 1) { - if (md->print_grpnms == NULL) + if (md->print_grpnms == nullptr) { snew(md->print_grpnms, md->nE); n = 0; diff --git a/src/gromacs/mdlib/mdebin_bar.cpp b/src/gromacs/mdlib/mdebin_bar.cpp index 00835be260..f50e0c61dc 100644 --- a/src/gromacs/mdlib/mdebin_bar.cpp +++ b/src/gromacs/mdlib/mdebin_bar.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -85,7 +85,7 @@ static void mde_delta_h_init(t_mde_delta_h *dh, int nbins, dh->ndhmax = ndhmax+2; for (i = 0; i < 2; i++) { - dh->bin[i] = NULL; + dh->bin[i] = nullptr; } snew(dh->dh, dh->ndhmax); @@ -265,7 +265,7 @@ void mde_delta_h_handle_block(t_mde_delta_h *dh, t_enxblock *blk) { blk->sub[2].nr = 0; blk->sub[2].type = xdr_datatype_float; - blk->sub[2].fval = NULL; + blk->sub[2].fval = nullptr; } } else @@ -410,9 +410,9 @@ void mde_delta_h_coll_init(t_mde_delta_h_coll *dhc, const t_inputrec *ir) else { /* don't allocate the meta-data subblocks for lambda vectors */ - dhc->native_lambda_vec = NULL; + dhc->native_lambda_vec = nullptr; dhc->n_lambda_vec = 0; - dhc->native_lambda_components = 0; + dhc->native_lambda_components = nullptr; dhc->lambda_index = -1; } /* allocate metadata subblocks */ @@ -422,9 +422,9 @@ void mde_delta_h_coll_init(t_mde_delta_h_coll *dhc, const t_inputrec *ir) /* now decide which data to write out */ dhc->nlambda = 0; dhc->ndhdl = 0; - dhc->dh_expanded = NULL; - dhc->dh_energy = NULL; - dhc->dh_pv = NULL; + dhc->dh_expanded = nullptr; + dhc->dh_energy = nullptr; + dhc->dh_pv = nullptr; /* total number of raw data point collections in the sample */ dhc->ndh = 0; @@ -486,7 +486,7 @@ void mde_delta_h_coll_init(t_mde_delta_h_coll *dhc, const t_inputrec *ir) dhc->dh_expanded = dhc->dh+n; mde_delta_h_init(dhc->dh+n, ir->fepvals->dh_hist_size, ir->fepvals->dh_hist_spacing, ndhmax, - dhbtEXPANDED, 0, 0, NULL); + dhbtEXPANDED, 0, 0, nullptr); n++; } if (bEnergy) @@ -494,7 +494,7 @@ void mde_delta_h_coll_init(t_mde_delta_h_coll *dhc, const t_inputrec *ir) dhc->dh_energy = dhc->dh+n; mde_delta_h_init(dhc->dh+n, ir->fepvals->dh_hist_size, ir->fepvals->dh_hist_spacing, ndhmax, - dhbtEN, 0, 0, NULL); + dhbtEN, 0, 0, nullptr); n++; } /* add the dhdl's */ @@ -553,7 +553,7 @@ void mde_delta_h_coll_init(t_mde_delta_h_coll *dhc, const t_inputrec *ir) dhc->dh_pv = dhc->dh+n; mde_delta_h_init(dhc->dh+n, ir->fepvals->dh_hist_size, ir->fepvals->dh_hist_spacing, ndhmax, - dhbtPV, 0, 0, NULL); + dhbtPV, 0, 0, nullptr); n++; } } @@ -584,15 +584,15 @@ void mde_delta_h_coll_add_dh(t_mde_delta_h_coll *dhc, { mde_delta_h_add_dh(dhc->dh_du+i, foreign_dU[i]); } - if (dhc->dh_pv != NULL) + if (dhc->dh_pv != nullptr) { mde_delta_h_add_dh(dhc->dh_pv, pV); } - if (dhc->dh_energy != NULL) + if (dhc->dh_energy != nullptr) { mde_delta_h_add_dh(dhc->dh_energy, energy); } - if (dhc->dh_expanded != NULL) + if (dhc->dh_expanded != nullptr) { mde_delta_h_add_dh(dhc->dh_expanded, fep_state); } @@ -614,7 +614,7 @@ void mde_delta_h_coll_handle_block(t_mde_delta_h_coll *dhc, /* only allocate lambda vector component blocks if they must be written out for backward compatibility */ - if (dhc->native_lambda_components != NULL) + if (dhc->native_lambda_components != nullptr) { add_subblocks_enxblock(blk, 2); } @@ -629,7 +629,7 @@ void mde_delta_h_coll_handle_block(t_mde_delta_h_coll *dhc, dhc->subblock_d[3] = dhc->start_lambda; /* old-style lambda at starttime */ dhc->subblock_d[4] = dhc->delta_lambda; /* lambda diff. between samples */ /* set the lambda vector components if they exist */ - if (dhc->native_lambda_components != NULL) + if (dhc->native_lambda_components != nullptr) { for (i = 0; i < dhc->n_lambda_vec; i++) { @@ -641,7 +641,7 @@ void mde_delta_h_coll_handle_block(t_mde_delta_h_coll *dhc, blk->sub[0].type = xdr_datatype_double; blk->sub[0].dval = dhc->subblock_d; - if (dhc->native_lambda_components != NULL) + if (dhc->native_lambda_components != nullptr) { dhc->subblock_i[0] = dhc->lambda_index; /* set the lambda vector component IDs if they exist */ diff --git a/src/gromacs/mdlib/mdoutf.cpp b/src/gromacs/mdlib/mdoutf.cpp index 80f2d5d407..cd6767c769 100644 --- a/src/gromacs/mdlib/mdoutf.cpp +++ b/src/gromacs/mdlib/mdoutf.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -90,12 +90,12 @@ gmx_mdoutf_t init_mdoutf(FILE *fplog, int nfile, const t_filenm fnm[], snew(of, 1); - of->fp_trn = NULL; - of->fp_ene = NULL; - of->fp_xtc = NULL; - of->tng = NULL; - of->tng_low_prec = NULL; - of->fp_dhdl = NULL; + of->fp_trn = nullptr; + of->fp_ene = nullptr; + of->fp_xtc = nullptr; + of->tng = nullptr; + of->tng_low_prec = nullptr; + of->fp_dhdl = nullptr; of->eIntegrator = ir->eI; of->bExpanded = ir->bExpanded; @@ -103,7 +103,7 @@ gmx_mdoutf_t init_mdoutf(FILE *fplog, int nfile, const t_filenm fnm[], of->simulation_part = ir->simulation_part; of->x_compression_precision = static_cast(ir->x_compression_precision); of->wcycle = wcycle; - of->f_global = NULL; + of->f_global = nullptr; if (MASTER(cr)) { @@ -300,9 +300,9 @@ void mdoutf_write_to_trajectory_files(FILE *fplog, t_commrec *cr, if (mdof_flags & (MDOF_X | MDOF_V | MDOF_F)) { - const rvec *x = (mdof_flags & MDOF_X) ? as_rvec_array(state_global->x.data()) : NULL; - const rvec *v = (mdof_flags & MDOF_V) ? as_rvec_array(state_global->v.data()) : NULL; - const rvec *f = (mdof_flags & MDOF_F) ? f_global : NULL; + const rvec *x = (mdof_flags & MDOF_X) ? as_rvec_array(state_global->x.data()) : nullptr; + const rvec *v = (mdof_flags & MDOF_V) ? as_rvec_array(state_global->v.data()) : nullptr; + const rvec *f = (mdof_flags & MDOF_F) ? f_global : nullptr; if (of->fp_trn) { @@ -336,7 +336,7 @@ void mdoutf_write_to_trajectory_files(FILE *fplog, t_commrec *cr, } if (mdof_flags & MDOF_X_COMPRESSED) { - rvec *xxtc = NULL; + rvec *xxtc = nullptr; if (of->natoms_x_compressed == of->natoms_global) { @@ -373,8 +373,8 @@ void mdoutf_write_to_trajectory_files(FILE *fplog, t_commrec *cr, state_local->box, of->natoms_x_compressed, xxtc, - NULL, - NULL); + nullptr, + nullptr); if (of->natoms_x_compressed != of->natoms_global) { sfree(xxtc); @@ -396,7 +396,7 @@ void mdoutf_tng_close(gmx_mdoutf_t of) void done_mdoutf(gmx_mdoutf_t of, const t_inputrec *ir) { - if (of->fp_ene != NULL) + if (of->fp_ene != nullptr) { close_enx(of->fp_ene); } @@ -408,12 +408,12 @@ void done_mdoutf(gmx_mdoutf_t of, const t_inputrec *ir) { gmx_trr_close(of->fp_trn); } - if (of->fp_dhdl != NULL) + if (of->fp_dhdl != nullptr) { gmx_fio_fclose(of->fp_dhdl); } ir->efield->finishOutput(); - if (of->f_global != NULL) + if (of->f_global != nullptr) { sfree(of->f_global); } diff --git a/src/gromacs/mdlib/mdsetup.cpp b/src/gromacs/mdlib/mdsetup.cpp index 3636544d43..bbc42e5762 100644 --- a/src/gromacs/mdlib/mdsetup.cpp +++ b/src/gromacs/mdlib/mdsetup.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016, by the GROMACS development team, led by + * Copyright (c) 2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -82,7 +82,7 @@ void mdAlgorithmsSetupAtomData(t_commrec *cr, else { numAtomIndex = -1; - atomIndex = NULL; + atomIndex = nullptr; numHomeAtoms = top_global->natoms; } atoms2md(top_global, ir, numAtomIndex, atomIndex, numHomeAtoms, mdatoms); @@ -123,11 +123,11 @@ void mdAlgorithmsSetupAtomData(t_commrec *cr, { GMX_ASSERT(graph != NULL, "We use a graph with PBC (no periodic mols) and without DD"); - *graph = mk_graph(NULL, &(top->idef), 0, top_global->natoms, FALSE, FALSE); + *graph = mk_graph(nullptr, &(top->idef), 0, top_global->natoms, FALSE, FALSE); } - else if (graph != NULL) + else if (graph != nullptr) { - *graph = NULL; + *graph = nullptr; } /* Note that with DD only flexible constraints, not shells, are supported diff --git a/src/gromacs/mdlib/minimize.cpp b/src/gromacs/mdlib/minimize.cpp index 2dcdc2e228..b3529be7ca 100644 --- a/src/gromacs/mdlib/minimize.cpp +++ b/src/gromacs/mdlib/minimize.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -343,13 +343,13 @@ void init_em(FILE *fplog, const char *title, state_global->ngtc = 0; /* Initialize lambda variables */ - initialize_lambdas(fplog, ir, &(state_global->fep_state), &state_global->lambda, NULL); + initialize_lambdas(fplog, ir, &(state_global->fep_state), &state_global->lambda, nullptr); init_nrnb(nrnb); /* Interactive molecular dynamics */ init_IMD(ir, cr, top_global, fplog, 1, as_rvec_array(state_global->x.data()), - nfile, fnm, NULL, imdport, Flags); + nfile, fnm, nullptr, imdport, Flags); if (ir->eI == eiNM) { @@ -368,9 +368,9 @@ void init_em(FILE *fplog, const char *title, /* With energy minimization, shells and flexible constraints are * automatically minimized when treated like normal DOFS. */ - if (shellfc != NULL) + if (shellfc != nullptr) { - *shellfc = NULL; + *shellfc = nullptr; } } @@ -385,10 +385,10 @@ void init_em(FILE *fplog, const char *title, state_global, top_global, ir, &ems->s, &ems->f, mdatoms, *top, fr, vsite, constr, - nrnb, NULL, FALSE); + nrnb, nullptr, FALSE); dd_store_state(cr->dd, &ems->s); - *graph = NULL; + *graph = nullptr; } else { @@ -403,7 +403,7 @@ void init_em(FILE *fplog, const char *title, snew(*top, 1); mdAlgorithmsSetupAtomData(cr, ir, top_global, *top, fr, graph, mdatoms, - vsite, shellfc ? *shellfc : NULL); + vsite, shellfc ? *shellfc : nullptr); update_mdatoms(mdatoms, state_global->lambda[efptFEP]); @@ -431,14 +431,14 @@ void init_em(FILE *fplog, const char *title, { /* Constrain the starting coordinates */ dvdl_constr = 0; - constrain(PAR(cr) ? NULL : fplog, TRUE, TRUE, constr, &(*top)->idef, + constrain(PAR(cr) ? nullptr : fplog, TRUE, TRUE, constr, &(*top)->idef, ir, cr, -1, 0, 1.0, mdatoms, as_rvec_array(ems->s.x.data()), as_rvec_array(ems->s.x.data()), - NULL, + nullptr, fr->bMolPBC, ems->s.box, ems->s.lambda[efptFEP], &dvdl_constr, - NULL, NULL, nrnb, econqCoord); + nullptr, nullptr, nrnb, econqCoord); } } @@ -448,19 +448,19 @@ void init_em(FILE *fplog, const char *title, } else { - *gstat = NULL; + *gstat = nullptr; } - *outf = init_mdoutf(fplog, nfile, fnm, 0, cr, ir, top_global, NULL, wcycle); + *outf = init_mdoutf(fplog, nfile, fnm, 0, cr, ir, top_global, nullptr, wcycle); snew(*enerd, 1); init_enerdata(top_global->groups.grps[egcENER].nr, ir->fepvals->n_lambda, *enerd); - if (mdebin != NULL) + if (mdebin != nullptr) { /* Init bin for energy stuff */ - *mdebin = init_mdebin(mdoutf_get_fp_ene(*outf), top_global, ir, NULL); + *mdebin = init_mdebin(mdoutf_get_fp_ene(*outf), top_global, ir, nullptr); } clear_rvec(mu_tot); @@ -525,7 +525,7 @@ static void write_em_traj(FILE *fplog, t_commrec *cr, &state->s, state_global, energyHistory, &state->f); - if (confout != NULL && MASTER(cr)) + if (confout != nullptr && MASTER(cr)) { if (ir->ePBC != epbcNONE && !ir->bPeriodicMols && DOMAINDECOMP(cr)) { @@ -536,7 +536,7 @@ static void write_em_traj(FILE *fplog, t_commrec *cr, write_sto_conf_mtop(confout, *top_global->name, top_global, - as_rvec_array(state_global->x.data()), NULL, ir->ePBC, state_global->box); + as_rvec_array(state_global->x.data()), nullptr, ir->ePBC, state_global->box); } } @@ -661,12 +661,12 @@ static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md, wallcycle_start(wcycle, ewcCONSTR); dvdl_constr = 0; validStep = - constrain(NULL, TRUE, TRUE, constr, &top->idef, + constrain(nullptr, TRUE, TRUE, constr, &top->idef, ir, cr, count, 0, 1.0, md, as_rvec_array(s1->x.data()), as_rvec_array(s2->x.data()), - NULL, bMolPBC, s2->box, + nullptr, bMolPBC, s2->box, s2->lambda[efptBONDED], &dvdl_constr, - NULL, NULL, nrnb, econqCoord); + nullptr, nullptr, nrnb, econqCoord); wallcycle_stop(wcycle, ewcCONSTR); // We should move this check to the different minimizers @@ -690,7 +690,7 @@ static void em_dd_partition_system(FILE *fplog, int step, t_commrec *cr, { /* Repartition the domain decomposition */ dd_partition_system(fplog, step, cr, FALSE, 1, - NULL, top_global, ir, + nullptr, top_global, ir, &ems->s, &ems->f, mdatoms, top, fr, vsite, constr, nrnb, wcycle, FALSE); @@ -737,7 +737,7 @@ static void evaluate_energy(FILE *fplog, t_commrec *cr, if (vsite) { - construct_vsites(vsite, as_rvec_array(ems->s.x.data()), 1, NULL, + construct_vsites(vsite, as_rvec_array(ems->s.x.data()), 1, nullptr, top->idef.iparams, top->idef.il, fr->ePBC, fr->bMolPBC, cr, ems->s.box); } @@ -758,7 +758,7 @@ static void evaluate_energy(FILE *fplog, t_commrec *cr, count, nrnb, wcycle, top, &top_global->groups, ems->s.box, &ems->s.x, &ems->s.hist, &ems->f, force_vir, mdatoms, enerd, fcd, - &ems->s.lambda, graph, fr, vsite, mu_tot, t, NULL, TRUE, + &ems->s.lambda, graph, fr, vsite, mu_tot, t, nullptr, TRUE, GMX_FORCE_STATECHANGED | GMX_FORCE_ALLFORCES | GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY | (bNS ? GMX_FORCE_NS : 0)); @@ -773,8 +773,8 @@ static void evaluate_energy(FILE *fplog, t_commrec *cr, wallcycle_start(wcycle, ewcMoveE); global_stat(gstat, cr, enerd, force_vir, shake_vir, mu_tot, - inputrec, NULL, NULL, NULL, 1, &terminate, - NULL, FALSE, + inputrec, nullptr, nullptr, nullptr, 1, &terminate, + nullptr, FALSE, CGLO_ENERGY | CGLO_PRESSURE | CGLO_CONSTRAINT); @@ -798,12 +798,12 @@ static void evaluate_energy(FILE *fplog, t_commrec *cr, wallcycle_start(wcycle, ewcCONSTR); dvdl_constr = 0; rvec *f_rvec = as_rvec_array(ems->f.data()); - constrain(NULL, FALSE, FALSE, constr, &top->idef, + constrain(nullptr, FALSE, FALSE, constr, &top->idef, inputrec, cr, count, 0, 1.0, mdatoms, as_rvec_array(ems->s.x.data()), f_rvec, f_rvec, fr->bMolPBC, ems->s.box, ems->s.lambda[efptBONDED], &dvdl_constr, - NULL, &shake_vir, nrnb, econqForceDispl); + nullptr, &shake_vir, nrnb, econqForceDispl); enerd->term[F_DVDL_CONSTR] += dvdl_constr; m_add(force_vir, shake_vir, vir); wallcycle_stop(wcycle, ewcCONSTR); @@ -1032,7 +1032,7 @@ double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, init_em(fplog, CG, cr, inputrec, state_global, top_global, s_min, &top, nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, - vsite, constr, NULL, + vsite, constr, nullptr, nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle); /* Print to log file */ @@ -1066,7 +1066,7 @@ double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, /* Copy stuff to the energy bin for easy printing etc. */ upd_mdebin(mdebin, FALSE, FALSE, (double)step, mdatoms->tmass, enerd, &s_min->s, inputrec->fepvals, inputrec->expandedvals, s_min->s.box, - NULL, NULL, vir, pres, NULL, mu_tot, constr); + nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); print_ebin_header(fplog, step, step); print_ebin(mdoutf_get_fp_ene(outf), TRUE, FALSE, FALSE, fplog, step, step, eprNORMAL, @@ -1138,7 +1138,7 @@ double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, } /* Calculate the norm of the search vector */ - get_f_norm_max(cr, &(inputrec->opts), mdatoms, pm, &pnorm, NULL, NULL); + get_f_norm_max(cr, &(inputrec->opts), mdatoms, pm, &pnorm, nullptr, nullptr); /* Just in case stepsize reaches zero due to numerical precision... */ if (stepsize <= 0) @@ -1194,7 +1194,7 @@ double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, do_x = do_per_step(step, inputrec->nstxout); do_f = do_per_step(step, inputrec->nstfout); - write_em_traj(fplog, cr, outf, do_x, do_f, NULL, + write_em_traj(fplog, cr, outf, do_x, do_f, nullptr, top_global, inputrec, step, s_min, state_global, energyHistory); @@ -1497,7 +1497,7 @@ double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, /* Store the new (lower) energies */ upd_mdebin(mdebin, FALSE, FALSE, (double)step, mdatoms->tmass, enerd, &s_min->s, inputrec->fepvals, inputrec->expandedvals, s_min->s.box, - NULL, NULL, vir, pres, NULL, mu_tot, constr); + nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); do_log = do_per_step(step, inputrec->nstlog); do_ene = do_per_step(step, inputrec->nstenergy); @@ -1510,7 +1510,7 @@ double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, print_ebin_header(fplog, step, step); } print_ebin(mdoutf_get_fp_ene(outf), do_ene, FALSE, FALSE, - do_log ? fplog : NULL, step, step, eprNORMAL, + do_log ? fplog : nullptr, step, step, eprNORMAL, mdebin, fcd, &(top_global->groups), &(inputrec->opts)); } @@ -1559,7 +1559,7 @@ double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, { /* Write final energy file entries */ print_ebin(mdoutf_get_fp_ene(outf), !do_ene, FALSE, FALSE, - !do_log ? fplog : NULL, step, step, eprNORMAL, + !do_log ? fplog : nullptr, step, step, eprNORMAL, mdebin, fcd, &(top_global->groups), &(inputrec->opts)); } } @@ -1673,7 +1673,7 @@ double do_lbfgs(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo gmx_fatal(FARGS, "Cannot do parallel L-BFGS Minimization - yet.\n"); } - if (NULL != constr) + if (nullptr != constr) { gmx_fatal(FARGS, "The combination of constraints and L-BFGS minimization is not implemented. Either do not use constraints, or use another minimizer (e.g. steepest descent)."); } @@ -1706,7 +1706,7 @@ double do_lbfgs(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo init_em(fplog, LBFGS, cr, inputrec, state_global, top_global, &ems, &top, nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, - vsite, constr, NULL, + vsite, constr, nullptr, nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle); start = 0; @@ -1755,7 +1755,7 @@ double do_lbfgs(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo if (vsite) { - construct_vsites(vsite, as_rvec_array(state_global->x.data()), 1, NULL, + construct_vsites(vsite, as_rvec_array(state_global->x.data()), 1, nullptr, top->idef.iparams, top->idef.il, fr->ePBC, fr->bMolPBC, cr, state_global->box); } @@ -1777,7 +1777,7 @@ double do_lbfgs(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo /* Copy stuff to the energy bin for easy printing etc. */ upd_mdebin(mdebin, FALSE, FALSE, (double)step, mdatoms->tmass, enerd, state_global, inputrec->fepvals, inputrec->expandedvals, state_global->box, - NULL, NULL, vir, pres, NULL, mu_tot, constr); + nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); print_ebin_header(fplog, step, step); print_ebin(mdoutf_get_fp_ene(outf), TRUE, FALSE, FALSE, fplog, step, step, eprNORMAL, @@ -2278,7 +2278,7 @@ double do_lbfgs(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo /* Store the new (lower) energies */ upd_mdebin(mdebin, FALSE, FALSE, (double)step, mdatoms->tmass, enerd, state_global, inputrec->fepvals, inputrec->expandedvals, state_global->box, - NULL, NULL, vir, pres, NULL, mu_tot, constr); + nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); do_log = do_per_step(step, inputrec->nstlog); do_ene = do_per_step(step, inputrec->nstenergy); if (do_log) @@ -2286,7 +2286,7 @@ double do_lbfgs(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo print_ebin_header(fplog, step, step); } print_ebin(mdoutf_get_fp_ene(outf), do_ene, FALSE, FALSE, - do_log ? fplog : NULL, step, step, eprNORMAL, + do_log ? fplog : nullptr, step, step, eprNORMAL, mdebin, fcd, &(top_global->groups), &(inputrec->opts)); } @@ -2334,7 +2334,7 @@ double do_lbfgs(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo if (!do_ene || !do_log) /* Write final energy file entries */ { print_ebin(mdoutf_get_fp_ene(outf), !do_ene, FALSE, FALSE, - !do_log ? fplog : NULL, step, step, eprNORMAL, + !do_log ? fplog : nullptr, step, step, eprNORMAL, mdebin, fcd, &(top_global->groups), &(inputrec->opts)); } @@ -2442,7 +2442,7 @@ double do_steep(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo init_em(fplog, SD, cr, inputrec, state_global, top_global, s_try, &top, nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, - vsite, constr, NULL, + vsite, constr, nullptr, nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle); /* Print to log file */ @@ -2530,7 +2530,7 @@ double do_steep(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo /* Store the new (lower) energies */ upd_mdebin(mdebin, FALSE, FALSE, (double)count, mdatoms->tmass, enerd, &s_try->s, inputrec->fepvals, inputrec->expandedvals, - s_try->s.box, NULL, NULL, vir, pres, NULL, mu_tot, constr); + s_try->s.box, nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); /* Prepare IMD energy record, if bIMD is TRUE. */ IMD_fill_energy_record(inputrec->bIMD, inputrec->imd, enerd, count, TRUE); @@ -2568,7 +2568,7 @@ double do_steep(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo /* Write to trn, if necessary */ do_x = do_per_step(steps_accepted, inputrec->nstxout); do_f = do_per_step(steps_accepted, inputrec->nstfout); - write_em_traj(fplog, cr, outf, do_x, do_f, NULL, + write_em_traj(fplog, cr, outf, do_x, do_f, nullptr, top_global, inputrec, count, s_min, state_global, energyHistory); } @@ -2598,8 +2598,8 @@ double do_steep(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlo { if (MASTER(cr)) { - warn_step(stderr, inputrec->em_tol, count == nsteps, constr != NULL); - warn_step(fplog, inputrec->em_tol, count == nsteps, constr != NULL); + warn_step(stderr, inputrec->em_tol, count == nsteps, constr != nullptr); + warn_step(fplog, inputrec->em_tol, count == nsteps, constr != nullptr); } bAbort = TRUE; } @@ -2698,8 +2698,8 @@ double do_nm(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, rvec *fneg, *dfdx; gmx_bool bSparse; /* use sparse matrix storage format */ size_t sz; - gmx_sparsematrix_t * sparse_matrix = NULL; - real * full_matrix = NULL; + gmx_sparsematrix_t * sparse_matrix = nullptr; + real * full_matrix = nullptr; /* added with respect to mdrun */ int row, col; @@ -2707,7 +2707,7 @@ double do_nm(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, real x_min; bool bIsMaster = MASTER(cr); - if (constr != NULL) + if (constr != nullptr) { gmx_fatal(FARGS, "Constraints present with Normal Mode Analysis, this combination is not supported"); } @@ -2721,7 +2721,7 @@ double do_nm(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, state_global, top_global, &state_work, &top, nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr, &shellfc, - nfile, fnm, &outf, NULL, imdport, Flags, wcycle); + nfile, fnm, &outf, nullptr, imdport, Flags, wcycle); std::vector atom_index = get_atom_index(top_global); snew(fneg, atom_index.size()); diff --git a/src/gromacs/mdlib/nbnxn_atomdata.cpp b/src/gromacs/mdlib/nbnxn_atomdata.cpp index 39a84ed576..d4e1a6dab8 100644 --- a/src/gromacs/mdlib/nbnxn_atomdata.cpp +++ b/src/gromacs/mdlib/nbnxn_atomdata.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -89,7 +89,7 @@ void nbnxn_realloc_void(void **ptr, ma(&ptr_new, nbytes_new); - if (nbytes_new > 0 && ptr_new == NULL) + if (nbytes_new > 0 && ptr_new == nullptr) { gmx_fatal(FARGS, "Allocation of %d bytes failed", nbytes_new); } @@ -102,7 +102,7 @@ void nbnxn_realloc_void(void **ptr, } memcpy(ptr_new, *ptr, nbytes_copy); } - if (*ptr != NULL) + if (*ptr != nullptr) { mf(*ptr); } @@ -157,7 +157,7 @@ static void nbnxn_atomdata_output_init(nbnxn_atomdata_output_t *out, int nenergrp, int stride, nbnxn_alloc_t *ma) { - out->f = NULL; + out->f = nullptr; ma((void **)&out->fshift, SHIFTS*DIM*sizeof(*out->fshift)); out->nV = nenergrp*nenergrp; ma((void **)&out->Vvdw, out->nV*sizeof(*out->Vvdw)); @@ -557,7 +557,7 @@ void nbnxn_atomdata_init(FILE *fp, char *ptr; gmx_bool simple, bCombGeom, bCombLB, bSIMD; - if (alloc == NULL) + if (alloc == nullptr) { nbat->alloc = nbnxn_alloc_aligned; } @@ -565,7 +565,7 @@ void nbnxn_atomdata_init(FILE *fp, { nbat->alloc = alloc; } - if (free == NULL) + if (free == nullptr) { nbat->free = nbnxn_free_aligned; } @@ -588,7 +588,7 @@ void nbnxn_atomdata_init(FILE *fp, */ tol = 1e-5; ptr = getenv("GMX_LJCOMB_TOL"); - if (ptr != NULL) + if (ptr != nullptr) { double dbl; @@ -723,8 +723,8 @@ void nbnxn_atomdata_init(FILE *fp, set_lj_parameter_data(nbat, bSIMD); nbat->natoms = 0; - nbat->type = NULL; - nbat->lj_comb = NULL; + nbat->type = nullptr; + nbat->lj_comb = nullptr; if (simple) { int pack_x; @@ -757,12 +757,12 @@ void nbnxn_atomdata_init(FILE *fp, nbat->XFormat = nbatXYZQ; nbat->FFormat = nbatXYZ; } - nbat->q = NULL; + nbat->q = nullptr; nbat->nenergrp = n_energygroups; if (!simple) { /* Energy groups not supported yet for super-sub lists */ - if (n_energygroups > 1 && fp != NULL) + if (n_energygroups > 1 && fp != nullptr) { fprintf(fp, "\nNOTE: With GPUs, reporting energy group contributions is not supported\n\n"); } @@ -778,11 +778,11 @@ void nbnxn_atomdata_init(FILE *fp, { nbat->neg_2log++; } - nbat->energrp = NULL; + nbat->energrp = nullptr; nbat->alloc((void **)&nbat->shift_vec, SHIFTS*sizeof(*nbat->shift_vec)); nbat->xstride = (nbat->XFormat == nbatXYZQ ? STRIDE_XYZQ : DIM); nbat->fstride = (nbat->FFormat == nbatXYZQ ? STRIDE_XYZQ : DIM); - nbat->x = NULL; + nbat->x = nullptr; #if GMX_SIMD if (simple) @@ -802,15 +802,15 @@ void nbnxn_atomdata_init(FILE *fp, nbat->nenergrp, 1<neg_2log, nbat->alloc); } - nbat->buffer_flags.flag = NULL; + nbat->buffer_flags.flag = nullptr; nbat->buffer_flags.flag_nalloc = 0; nth = gmx_omp_nthreads_get(emntNonbonded); ptr = getenv("GMX_USE_TREEREDUCE"); - if (ptr != NULL) + if (ptr != nullptr) { - nbat->bUseTreeReduce = strtol(ptr, 0, 10); + nbat->bUseTreeReduce = strtol(ptr, nullptr, 10); } #if defined __MIC__ else if (nth > 8) /*on the CPU we currently don't benefit even at 32*/ diff --git a/src/gromacs/mdlib/nbnxn_grid.cpp b/src/gromacs/mdlib/nbnxn_grid.cpp index 2727b06c98..3919800015 100644 --- a/src/gromacs/mdlib/nbnxn_grid.cpp +++ b/src/gromacs/mdlib/nbnxn_grid.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -65,11 +65,11 @@ struct gmx_domdec_zones_t; static void nbnxn_grid_init(nbnxn_grid_t * grid) { - grid->cxy_na = NULL; - grid->cxy_ind = NULL; + grid->cxy_na = nullptr; + grid->cxy_ind = nullptr; grid->cxy_nalloc = 0; - grid->bb = NULL; - grid->bbj = NULL; + grid->bb = nullptr; + grid->bbj = nullptr; grid->nc_nalloc = 0; } @@ -1008,7 +1008,7 @@ static void sort_columns_simple(const nbnxn_search_t nbs, fill_cell(nbs, grid, nbat, ash_c, ash_c+na_c, atinfo, x, - NULL); + nullptr); /* This copy to bbcz is not really necessary. * But it allows to use the same grid search code @@ -1162,7 +1162,7 @@ static void calc_column_indices(nbnxn_grid_t *grid, /* Home zone */ for (int i = n0; i < n1; i++) { - if (move == NULL || move[i] >= 0) + if (move == nullptr || move[i] >= 0) { /* We need to be careful with rounding, * particles might be a few bits outside the local zone. @@ -1562,14 +1562,14 @@ void nbnxn_put_on_grid_nonlocal(nbnxn_search_t nbs, c1[d] = zones->size[zone].bb_x1[d]; } - nbnxn_put_on_grid(nbs, nbs->ePBC, NULL, + nbnxn_put_on_grid(nbs, nbs->ePBC, nullptr, zone, c0, c1, zones->cg_range[zone], zones->cg_range[zone+1], -1, atinfo, x, - 0, NULL, + 0, nullptr, nb_kernel_type, nbat); } diff --git a/src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.cpp b/src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.cpp index 92946aeea5..818982c539 100644 --- a/src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.cpp +++ b/src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -72,7 +72,7 @@ nbnxn_kernel_gpu_ref(const nbnxn_pairlist_t *nbl, const real *x; gmx_bool bEner; gmx_bool bEwald; - const real *Ftab = NULL; + const real *Ftab = nullptr; real rcut2, rvdw2, rlist2; int ntype; real facel; diff --git a/src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref_outer.h b/src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref_outer.h index 1173f432fa..9e956ec223 100644 --- a/src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref_outer.h +++ b/src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref_outer.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -380,7 +380,7 @@ NBK_FUNC_NAME(_VgrpF) } } #ifdef CALC_SHIFTFORCES - if (fshift != NULL) + if (fshift != nullptr) { /* Add i forces to shifted force list */ for (i = 0; i < UNROLLI; i++) diff --git a/src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h b/src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h index 86bf7e8897..e7e5842086 100644 --- a/src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h +++ b/src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -563,7 +563,7 @@ #else const real *nbfp0 = nbfp_ptr + type[sci ]*nbat->ntype*c_simdBestPairAlignment; const real *nbfp1 = nbfp_ptr + type[sci+1]*nbat->ntype*c_simdBestPairAlignment; - const real *nbfp2 = NULL, *nbfp3 = NULL; + const real *nbfp2 = nullptr, *nbfp3 = nullptr; if (!half_LJ) { nbfp2 = nbfp_ptr + type[sci+2]*nbat->ntype*c_simdBestPairAlignment; diff --git a/src/gromacs/mdlib/nbnxn_search.cpp b/src/gromacs/mdlib/nbnxn_search.cpp index 99a30929e3..739a19432d 100644 --- a/src/gromacs/mdlib/nbnxn_search.cpp +++ b/src/gromacs/mdlib/nbnxn_search.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -275,12 +275,12 @@ static void nbnxn_init_pairlist_fep(t_nblist *nl) nl->maxnrj = 0; nl->nri = 0; nl->nrj = 0; - nl->iinr = NULL; - nl->gid = NULL; - nl->shift = NULL; - nl->jindex = NULL; - nl->jjnr = NULL; - nl->excl_fep = NULL; + nl->iinr = nullptr; + nl->gid = nullptr; + nl->shift = nullptr; + nl->jindex = nullptr; + nl->jjnr = nullptr; + nl->excl_fep = nullptr; } @@ -298,7 +298,7 @@ void nbnxn_init_search(nbnxn_search_t * nbs_ptr, nbs->bFEP = bFEP; - nbs->DomDec = (n_dd_cells != NULL); + nbs->DomDec = (n_dd_cells != nullptr); clear_ivec(nbs->dd_dim); ngrid = 1; @@ -319,9 +319,9 @@ void nbnxn_init_search(nbnxn_search_t * nbs_ptr, nbnxn_grids_init(nbs, ngrid); - nbs->cell = NULL; + nbs->cell = nullptr; nbs->cell_nalloc = 0; - nbs->a = NULL; + nbs->a = nullptr; nbs->a_nalloc = 0; nbs->nthread_max = nthread_max; @@ -330,9 +330,9 @@ void nbnxn_init_search(nbnxn_search_t * nbs_ptr, snew(nbs->work, nbs->nthread_max); for (int t = 0; t < nbs->nthread_max; t++) { - nbs->work[t].cxy_na = NULL; + nbs->work[t].cxy_na = nullptr; nbs->work[t].cxy_na_nalloc = 0; - nbs->work[t].sort_work = NULL; + nbs->work[t].sort_work = nullptr; nbs->work[t].sort_work_nalloc = 0; snew(nbs->work[t].nbl_fep, 1); @@ -340,7 +340,7 @@ void nbnxn_init_search(nbnxn_search_t * nbs_ptr, } /* Initialize detailed nbsearch cycle counting */ - nbs->print_cycles = (getenv("GMX_NBNXN_CYCLE") != 0); + nbs->print_cycles = (getenv("GMX_NBNXN_CYCLE") != nullptr); nbs->search_count = 0; nbs_cycle_clear(nbs->cc); for (int t = 0; t < nbs->nthread_max; t++) @@ -793,7 +793,7 @@ static void nbnxn_init_pairlist(nbnxn_pairlist_t *nbl, nbnxn_alloc_t *alloc, nbnxn_free_t *free) { - if (alloc == NULL) + if (alloc == nullptr) { nbl->alloc = nbnxn_alloc_aligned; } @@ -801,7 +801,7 @@ static void nbnxn_init_pairlist(nbnxn_pairlist_t *nbl, { nbl->alloc = alloc; } - if (free == NULL) + if (free == nullptr) { nbl->free = nbnxn_free_aligned; } @@ -815,19 +815,19 @@ static void nbnxn_init_pairlist(nbnxn_pairlist_t *nbl, nbl->na_ci = 0; nbl->na_cj = 0; nbl->nci = 0; - nbl->ci = NULL; + nbl->ci = nullptr; nbl->ci_nalloc = 0; nbl->nsci = 0; - nbl->sci = NULL; + nbl->sci = nullptr; nbl->sci_nalloc = 0; nbl->ncj = 0; nbl->ncjInUse = 0; - nbl->cj = NULL; + nbl->cj = nullptr; nbl->cj_nalloc = 0; nbl->ncj4 = 0; /* We need one element extra in sj, so alloc initially with 1 */ nbl->cj4_nalloc = 0; - nbl->cj4 = NULL; + nbl->cj4 = nullptr; nbl->nci_tot = 0; if (!nbl->bSimple) @@ -837,7 +837,7 @@ static void nbnxn_init_pairlist(nbnxn_pairlist_t *nbl, GMX_ASSERT(sizeof(nbl->cj4[0].imei[0].imask)*8 >= c_nbnxnGpuJgroupSize*c_gpuNumClusterPerCell, "The i super-cluster cluster interaction mask does not contain a sufficient number of bits"); GMX_ASSERT(sizeof(nbl->excl[0])*8 >= c_nbnxnGpuJgroupSize*c_gpuNumClusterPerCell, "The GPU exclusion mask does not contain a sufficient number of bits"); - nbl->excl = NULL; + nbl->excl = nullptr; nbl->excl_nalloc = 0; nbl->nexcl = 0; check_excl_space(nbl, 1); @@ -868,9 +868,9 @@ static void nbnxn_init_pairlist(nbnxn_pairlist_t *nbl, #endif snew_aligned(nbl->work->d2, c_gpuNumClusterPerCell, NBNXN_SEARCH_BB_MEM_ALIGN); - nbl->work->sort = NULL; + nbl->work->sort = nullptr; nbl->work->sort_nalloc = 0; - nbl->work->sci_sort = NULL; + nbl->work->sci_sort = nullptr; nbl->work->sci_sort_nalloc = 0; } @@ -915,11 +915,11 @@ void nbnxn_init_pairlist_set(nbnxn_pairlist_set_t *nbl_list, } else { - nbnxn_init_pairlist(nbl_list->nbl[i], nbl_list->bSimple, NULL, NULL); + nbnxn_init_pairlist(nbl_list->nbl[i], nbl_list->bSimple, nullptr, nullptr); if (bSimple && nbl_list->nnbl > 1) { snew(nbl_list->nbl_work[i], 1); - nbnxn_init_pairlist(nbl_list->nbl_work[i], nbl_list->bSimple, NULL, NULL); + nbnxn_init_pairlist(nbl_list->nbl_work[i], nbl_list->bSimple, nullptr, nullptr); } } @@ -2401,7 +2401,7 @@ static void clear_pairlist_fep(t_nblist *nl) { nl->nri = 0; nl->nrj = 0; - if (nl->jindex == NULL) + if (nl->jindex == nullptr) { snew(nl->jindex, 1); } @@ -3173,9 +3173,9 @@ static void nbnxn_make_pairlist_part(const nbnxn_search_t nbs, int shift; real shx, shy, shz; int conv_i, cell0_i; - const nbnxn_bb_t *bb_i = NULL; + const nbnxn_bb_t *bb_i = nullptr; #if NBNXN_BBXXXX - const float *pbb_i = NULL; + const float *pbb_i = nullptr; #endif const float *bbcz_i, *bbcz_j; const int *flags_i; @@ -3187,7 +3187,7 @@ static void nbnxn_make_pairlist_part(const nbnxn_search_t nbs, int ndistc; int ncpcheck; int gridi_flag_shift = 0, gridj_flag_shift = 0; - gmx_bitmask_t *gridj_flag = NULL; + gmx_bitmask_t *gridj_flag = nullptr; int ncj_old_i, ncj_old_j; nbs_cycle_start(&work->cc[enbsCCsearch]); diff --git a/src/gromacs/mdlib/ns.cpp b/src/gromacs/mdlib/ns.cpp index 9615331d46..9cca369a9a 100644 --- a/src/gromacs/mdlib/ns.cpp +++ b/src/gromacs/mdlib/ns.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -143,7 +143,7 @@ static void init_nblist(FILE *log, t_nblist *nl_sr, nl = nl_sr; homenr = maxsr; - if (nl == NULL) + if (nl == nullptr) { return; } @@ -177,12 +177,12 @@ static void init_nblist(FILE *log, t_nblist *nl_sr, nl->maxnrj = 0; nl->nri = -1; nl->nrj = 0; - nl->iinr = NULL; - nl->gid = NULL; - nl->shift = NULL; - nl->jindex = NULL; - nl->jjnr = NULL; - nl->excl_fep = NULL; + nl->iinr = nullptr; + nl->gid = nullptr; + nl->shift = nullptr; + nl->jindex = nullptr; + nl->jjnr = nullptr; + nl->excl_fep = nullptr; reallocate_nblist(nl); nl->jindex[0] = 0; @@ -225,7 +225,7 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr) type = GMX_NBLIST_INTERACTION_STANDARD; bElecAndVdwSwitchDiffers = ( (fr->rcoulomb_switch != fr->rvdw_switch) || (fr->rcoulomb != fr->rvdw)); - fr->ns->bCGlist = (getenv("GMX_NBLISTCG") != 0); + fr->ns->bCGlist = (getenv("GMX_NBLISTCG") != nullptr); if (!fr->ns->bCGlist) { igeometry_def = GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE; @@ -233,7 +233,7 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr) else { igeometry_def = GMX_NBLIST_GEOMETRY_CG_CG; - if (log != NULL) + if (log != nullptr) { fprintf(log, "\nUsing charge-group - charge-group neighbor lists and kernels\n\n"); } @@ -270,13 +270,13 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr) maxsr_wat, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, igeometry_ww, type, bElecAndVdwSwitchDiffers); /* Did we get the solvent loops so we can use optimized water kernels? */ - if (nbl->nlist_sr[eNL_VDWQQ_WATER].kernelptr_vf == NULL - || nbl->nlist_sr[eNL_QQ_WATER].kernelptr_vf == NULL - || nbl->nlist_sr[eNL_VDWQQ_WATERWATER].kernelptr_vf == NULL - || nbl->nlist_sr[eNL_QQ_WATERWATER].kernelptr_vf == NULL) + if (nbl->nlist_sr[eNL_VDWQQ_WATER].kernelptr_vf == nullptr + || nbl->nlist_sr[eNL_QQ_WATER].kernelptr_vf == nullptr + || nbl->nlist_sr[eNL_VDWQQ_WATERWATER].kernelptr_vf == nullptr + || nbl->nlist_sr[eNL_QQ_WATERWATER].kernelptr_vf == nullptr) { fr->solvent_opt = esolNO; - if (log != NULL) + if (log != nullptr) { fprintf(log, "Note: The available nonbonded kernels do not support water optimization - disabling.\n"); } @@ -295,7 +295,7 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr) /* QMMM MM list */ if (fr->bQMMM && fr->qr->QMMMscheme != eQMMMschemeoniom) { - if (NULL == fr->QMMMlist) + if (nullptr == fr->QMMMlist) { snew(fr->QMMMlist, 1); } @@ -303,7 +303,7 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr) maxsr, 0, 0, ielec, ielecmod, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_STANDARD, bElecAndVdwSwitchDiffers); } - if (log != NULL) + if (log != nullptr) { fprintf(log, "\n"); } @@ -564,11 +564,11 @@ put_in_list_at(gmx_bool bHaveVdW[], t_nblist * vdwc; t_nblist * vdw; t_nblist * coul; - t_nblist * vdwc_free = NULL; - t_nblist * vdw_free = NULL; - t_nblist * coul_free = NULL; - t_nblist * vdwc_ww = NULL; - t_nblist * coul_ww = NULL; + t_nblist * vdwc_free = nullptr; + t_nblist * vdw_free = nullptr; + t_nblist * coul_free = nullptr; + t_nblist * vdwc_ww = nullptr; + t_nblist * coul_ww = nullptr; int i, j, jcg, igid, gid, nbl_ind; int jj, jj0, jj1, i_atom; @@ -2132,7 +2132,7 @@ void init_ns(FILE *fplog, const t_commrec *cr, } ns->nra_alloc = 0; - ns->bexcl = NULL; + ns->bexcl = nullptr; if (!DOMAINDECOMP(cr)) { ns_realloc_natoms(ns, mtop->natoms); @@ -2145,7 +2145,7 @@ void init_ns(FILE *fplog, const t_commrec *cr, char *ptr = getenv("GMX_DUMP_NL"); if (ptr) { - ns->dump_nl = strtol(ptr, NULL, 10); + ns->dump_nl = strtol(ptr, nullptr, 10); if (fplog) { fprintf(fplog, "GMX_DUMP_NL = %d", ns->dump_nl); @@ -2224,12 +2224,12 @@ int search_neighbours(FILE *log, t_forcerec *fr, } else { - dd_zones = NULL; + dd_zones = nullptr; - get_nsgrid_boundaries(grid->nboundeddim, box, NULL, NULL, NULL, NULL, + get_nsgrid_boundaries(grid->nboundeddim, box, nullptr, nullptr, nullptr, nullptr, cgs->nr, fr->cg_cm, grid_x0, grid_x1, &grid_dens); - grid_first(log, grid, NULL, NULL, box, grid_x0, grid_x1, + grid_first(log, grid, nullptr, nullptr, box, grid_x0, grid_x1, fr->rlist, grid_dens); } @@ -2245,7 +2245,7 @@ int search_neighbours(FILE *log, t_forcerec *fr, } else { - fill_grid(NULL, grid, cgs->nr, fr->cg0, fr->hcg, fr->cg_cm); + fill_grid(nullptr, grid, cgs->nr, fr->cg0, fr->hcg, fr->cg_cm); grid->icg0 = fr->cg0; grid->icg1 = fr->hcg; } @@ -2265,7 +2265,7 @@ int search_neighbours(FILE *log, t_forcerec *fr, /* Set the grid cell index for the test particle only. * The cell to cg index is not corrected, but that does not matter. */ - fill_grid(NULL, ns->grid, fr->hcg, fr->hcg-1, fr->hcg, fr->cg_cm); + fill_grid(nullptr, ns->grid, fr->hcg, fr->hcg-1, fr->hcg, fr->cg_cm); } if (!fr->ns->bCGlist) diff --git a/src/gromacs/mdlib/nsgrid.cpp b/src/gromacs/mdlib/nsgrid.cpp index 94e43163d4..8b6b40f0a9 100644 --- a/src/gromacs/mdlib/nsgrid.cpp +++ b/src/gromacs/mdlib/nsgrid.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -148,13 +148,13 @@ void get_nsgrid_boundaries(int nboundeddim, matrix box, { if (d < nboundeddim) { - grid_x0[d] = (gr0 != NULL ? (*gr0)[d] : 0); - grid_x1[d] = (gr1 != NULL ? (*gr1)[d] : box[d][d]); + grid_x0[d] = (gr0 != nullptr ? (*gr0)[d] : 0); + grid_x1[d] = (gr1 != nullptr ? (*gr1)[d] : box[d][d]); vol *= (grid_x1[d] - grid_x0[d]); } else { - if (ddbox == NULL) + if (ddbox == nullptr) { get_nsgrid_boundaries_vac(av[d], stddev[d], &grid_x0[d], &grid_x1[d], @@ -173,13 +173,13 @@ void get_nsgrid_boundaries(int nboundeddim, matrix box, bdens1 = grid_x1[d]; } /* Check for a DD cell not at a lower edge */ - if (dd != NULL && gr0 != NULL && dd->ci[d] > 0) + if (dd != nullptr && gr0 != nullptr && dd->ci[d] > 0) { grid_x0[d] = (*gr0)[d]; bdens0 = (*gr0)[d]; } /* Check for a DD cell not at a higher edge */ - if (dd != NULL && gr1 != NULL && dd->ci[d] < dd->nc[d]-1) + if (dd != nullptr && gr1 != nullptr && dd->ci[d] < dd->nc[d]-1) { grid_x1[d] = (*gr1)[d]; bdens1 = (*gr1)[d]; @@ -683,7 +683,7 @@ void fill_grid(gmx_domdec_zones_t *dd_zones, fprintf(debug, "Filling grid from %d to %d\n", cg0, cg1); } - if (dd_zones == NULL) + if (dd_zones == nullptr) { for (cg = cg0; cg < cg1; cg++) { diff --git a/src/gromacs/mdlib/perf_est.cpp b/src/gromacs/mdlib/perf_est.cpp index d6140720d6..ea4549eaf2 100644 --- a/src/gromacs/mdlib/perf_est.cpp +++ b/src/gromacs/mdlib/perf_est.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -267,11 +267,11 @@ void count_bonded_distances(const gmx_mtop_t *mtop, const t_inputrec *ir, fprintf(debug, "nr. of distance calculations in bondeds: C %.1f SIMD %.1f\n", ndtot_c, ndtot_simd); } - if (ndistance_c != NULL) + if (ndistance_c != nullptr) { *ndistance_c = ndtot_c; } - if (ndistance_simd != NULL) + if (ndistance_simd != nullptr) { *ndistance_simd = ndtot_simd; } diff --git a/src/gromacs/mdlib/qm_orca.cpp b/src/gromacs/mdlib/qm_orca.cpp index fb4bc9dd62..57d5e9fd1c 100644 --- a/src/gromacs/mdlib/qm_orca.cpp +++ b/src/gromacs/mdlib/qm_orca.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -131,11 +131,11 @@ void write_orca_input(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm) /* here we include the insertion of the additional orca-input */ snew(buf, 200); - if (addInputFile != NULL) + if (addInputFile != nullptr) { while (!feof(addInputFile)) { - if (fgets(buf, 200, addInputFile) != NULL) + if (fgets(buf, 200, addInputFile) != nullptr) { fputs(buf, out); } @@ -278,17 +278,17 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr, { sprintf(orca_xyzFilename, "%s.xyz", qm->orca_basename); xyz = fopen(orca_xyzFilename, "r"); - if (fgets(buf, 300, xyz) == NULL) + if (fgets(buf, 300, xyz) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } - if (fgets(buf, 300, xyz) == NULL) + if (fgets(buf, 300, xyz) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } for (i = 0; i < qm->nrQMatoms; i++) { - if (fgets(buf, 300, xyz) == NULL) + if (fgets(buf, 300, xyz) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } @@ -320,14 +320,14 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr, */ for (j = 0; j < 7; j++) { - if (fgets(buf, 300, engrad) == NULL) + if (fgets(buf, 300, engrad) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } } /* now comes the energy */ - if (fgets(buf, 300, engrad) == NULL) + if (fgets(buf, 300, engrad) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } @@ -340,7 +340,7 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr, */ for (j = 0; j < 3; j++) { - if (fgets(buf, 300, engrad) == NULL) + if (fgets(buf, 300, engrad) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } @@ -353,7 +353,7 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr, for (i = 0; i < 3*qm->nrQMatoms; i++) { k = i/3; - if (fgets(buf, 300, engrad) == NULL) + if (fgets(buf, 300, engrad) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } @@ -397,13 +397,13 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr, */ /* we can skip the first line */ - if (fgets(buf, 300, pcgrad) == NULL) + if (fgets(buf, 300, pcgrad) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } for (i = 0; i < mm->nrMMatoms; i++) { - if (fgets(buf, 300, pcgrad) == NULL) + if (fgets(buf, 300, pcgrad) == nullptr) { gmx_fatal(FARGS, "Unexpected end of ORCA output"); } diff --git a/src/gromacs/mdlib/qmmm.cpp b/src/gromacs/mdlib/qmmm.cpp index a5ad681b18..7342b77999 100644 --- a/src/gromacs/mdlib/qmmm.cpp +++ b/src/gromacs/mdlib/qmmm.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -250,9 +250,9 @@ static void punch_QMMM_excl(t_QMrec *qm, t_MMrec *mm, t_blocka *excls) * Only needed in case of QM/MM optimizations */ FILE - *out = NULL; + *out = nullptr; int - i, j, k, nrexcl = 0, *excluded = NULL, max_excl = 0; + i, j, k, nrexcl = 0, *excluded = nullptr, max_excl = 0; out = fopen("QMMMexcl.dat", "w"); @@ -455,7 +455,7 @@ void init_QMMMrec(t_commrec *cr, */ gmx_groups_t *groups; - int *qm_arr = NULL, vsite, ai, aj; + int *qm_arr = nullptr, vsite, ai, aj; int qm_max = 0, qm_nr = 0, i, j, jmax, k, l, nrvsite2 = 0; t_QMMMrec *qr; t_MMrec *mm; @@ -663,7 +663,7 @@ void init_QMMMrec(t_commrec *cr, for (k = 0; k < qm_nr; k++) { int indexInMolecule; - mtopGetMolblockIndex(mtop, qm_arr[k], &molb, NULL, &indexInMolecule); + mtopGetMolblockIndex(mtop, qm_arr[k], &molb, nullptr, &indexInMolecule); t_atom *atom = &mtop->moltype[mtop->molblock[molb].type].atoms.atom[indexInMolecule]; atom->q = 0.0; atom->qB = 0.0; @@ -687,7 +687,7 @@ void init_QMMMrec(t_commrec *cr, */ for (i = 0; i < qm_nr; i++) { - mtopGetMolblockIndex(mtop, qm_arr[i], &molb, NULL, &a_offset); + mtopGetMolblockIndex(mtop, qm_arr[i], &molb, nullptr, &a_offset); ilist_mol = mtop->moltype[mtop->molblock[molb].type].ilist; nrvsite2 = ilist_mol[F_VSITE2].nr; iatoms = ilist_mol[F_VSITE2].iatoms; @@ -782,7 +782,7 @@ void update_QMMMrec(t_commrec *cr, int mm_max = 0, mm_nr = 0, mm_nr_new, i, j, is, k, shift; t_j_particle - *mm_j_particles = NULL, *qm_i_particles = NULL; + *mm_j_particles = nullptr, *qm_i_particles = nullptr; t_QMMMrec *qr; t_nblist @@ -796,7 +796,7 @@ void update_QMMMrec(t_commrec *cr, t_pbc pbc; int - *parallelMMarray = NULL; + *parallelMMarray = nullptr; real c12au, c6au; @@ -1087,10 +1087,10 @@ real calculate_QMMM(t_commrec *cr, t_QMrec *qm, *qm2; t_MMrec - *mm = NULL; + *mm = nullptr; rvec - *forces = NULL, *fshift = NULL, - *forces2 = NULL, *fshift2 = NULL; /* needed for multilayer ONIOM */ + *forces = nullptr, *fshift = nullptr, + *forces2 = nullptr, *fshift2 = nullptr; /* needed for multilayer ONIOM */ int i, j, k; /* make a local copy the QMMMrec pointer diff --git a/src/gromacs/mdlib/shakef.cpp b/src/gromacs/mdlib/shakef.cpp index d5b320b821..adeb79f394 100644 --- a/src/gromacs/mdlib/shakef.cpp +++ b/src/gromacs/mdlib/shakef.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -66,10 +66,10 @@ gmx_shakedata_t shake_init() snew(d, 1); d->nalloc = 0; - d->rij = NULL; - d->half_of_reduced_mass = NULL; - d->distance_squared_tolerance = NULL; - d->constraint_distance_squared = NULL; + d->rij = nullptr; + d->half_of_reduced_mass = nullptr; + d->distance_squared_tolerance = nullptr; + d->constraint_distance_squared = nullptr; /* SOR initialization */ d->delta = 0.1; @@ -301,7 +301,7 @@ int vec_shakef(FILE *fplog, gmx_shakedata_t shaked, i = ia[1]; j = ia[2]; - if ((econq == econqCoord) && v != NULL) + if ((econq == econqCoord) && v != nullptr) { /* Correct the velocities */ mm = scaled_lagrange_multiplier[ll]*invmass[i]*invdt; diff --git a/src/gromacs/mdlib/shellfc.cpp b/src/gromacs/mdlib/shellfc.cpp index a92d32503f..3b76afe5dc 100644 --- a/src/gromacs/mdlib/shellfc.cpp +++ b/src/gromacs/mdlib/shellfc.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -297,7 +297,7 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog, { gmx_shellfc_t *shfc; t_shell *shell; - int *shell_index = NULL, *at2cg; + int *shell_index = nullptr, *at2cg; const t_atom *atom; int ns, nshell, nsi; @@ -319,7 +319,7 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog, if (nshell == 0 && nflexcon == 0) { /* We're not doing shells or flexible constraints */ - return NULL; + return nullptr; } snew(shfc, 1); @@ -550,7 +550,7 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog, shfc->shell_gl = shell; shfc->shell_index_gl = shell_index; - shfc->bPredict = (getenv("GMX_NOPREDICT") == NULL); + shfc->bPredict = (getenv("GMX_NOPREDICT") == nullptr); shfc->bRequireInit = FALSE; if (!shfc->bPredict) { @@ -561,7 +561,7 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog, } else { - shfc->bRequireInit = (getenv("GMX_REQUIRE_SHELL_INIT") != NULL); + shfc->bRequireInit = (getenv("GMX_REQUIRE_SHELL_INIT") != nullptr); if (shfc->bRequireInit && fplog) { fprintf(fplog, "\nWill always initiate shell positions\n"); @@ -594,7 +594,7 @@ void make_local_shells(t_commrec *cr, t_mdatoms *md, { t_shell *shell; int a0, a1, *ind, nshell, i; - gmx_domdec_t *dd = NULL; + gmx_domdec_t *dd = nullptr; if (DOMAINDECOMP(cr)) { @@ -943,13 +943,13 @@ static void init_adir(FILE *log, gmx_shellfc_t *shfc, } } constrain(log, FALSE, FALSE, constr, idef, ir, cr, step, 0, 1.0, md, - x, xnold, NULL, bMolPBC, box, + x, xnold, nullptr, bMolPBC, box, (*lambda)[efptBONDED], &(dvdlambda[efptBONDED]), - NULL, NULL, nrnb, econqCoord); + nullptr, nullptr, nrnb, econqCoord); constrain(log, FALSE, FALSE, constr, idef, ir, cr, step, 0, 1.0, md, - x, xnew, NULL, bMolPBC, box, + x, xnew, nullptr, bMolPBC, box, (*lambda)[efptBONDED], &(dvdlambda[efptBONDED]), - NULL, NULL, nrnb, econqCoord); + nullptr, nullptr, nrnb, econqCoord); for (n = 0; n < end; n++) { @@ -966,7 +966,7 @@ static void init_adir(FILE *log, gmx_shellfc_t *shfc, constrain(log, FALSE, FALSE, constr, idef, ir, cr, step, 0, 1.0, md, x_old, xnew, acc_dir, bMolPBC, box, (*lambda)[efptBONDED], &(dvdlambda[efptBONDED]), - NULL, NULL, nrnb, econqDeriv_FlexCon); + nullptr, nullptr, nrnb, econqDeriv_FlexCon); } void relax_shell_flexcon(FILE *fplog, t_commrec *cr, gmx_bool bVerbose, @@ -990,7 +990,7 @@ void relax_shell_flexcon(FILE *fplog, t_commrec *cr, gmx_bool bVerbose, int nshell; t_shell *shell; t_idef *idef; - rvec *acc_dir = NULL, *x_old = NULL; + rvec *acc_dir = nullptr, *x_old = nullptr; real Epot[2], df[2]; real sf_dir, invdt; real ftol, dum = 0; @@ -1094,7 +1094,7 @@ void relax_shell_flexcon(FILE *fplog, t_commrec *cr, gmx_bool bVerbose, if (shfc->bPredict && !bCont) { predict_shells(fplog, as_rvec_array(state->x.data()), as_rvec_array(state->v.data()), inputrec->delta_t, nshell, shell, - md->massT, NULL, bInit); + md->massT, nullptr, bInit); } /* do_force expected the charge groups to be in the box */ @@ -1112,7 +1112,7 @@ void relax_shell_flexcon(FILE *fplog, t_commrec *cr, gmx_bool bVerbose, state->box, &state->x, &state->hist, force[Min], force_vir, md, enerd, fcd, &state->lambda, graph, - fr, vsite, mu_tot, t, NULL, bBornRadii, + fr, vsite, mu_tot, t, nullptr, bBornRadii, (bDoNS ? GMX_FORCE_NS : 0) | force_flags); sf_dir = 0; @@ -1214,7 +1214,7 @@ void relax_shell_flexcon(FILE *fplog, t_commrec *cr, gmx_bool bVerbose, top, groups, state->box, pos[Try], &state->hist, force[Try], force_vir, md, enerd, fcd, &state->lambda, graph, - fr, vsite, mu_tot, t, NULL, bBornRadii, + fr, vsite, mu_tot, t, nullptr, bBornRadii, force_flags); if (gmx_debug_at) diff --git a/src/gromacs/mdlib/sighandler.cpp b/src/gromacs/mdlib/sighandler.cpp index ae5a06d66b..abf37009cc 100644 --- a/src/gromacs/mdlib/sighandler.cpp +++ b/src/gromacs/mdlib/sighandler.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -117,7 +117,7 @@ static void gmx_signal(int signum) act.sa_handler = signal_handler; sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; - sigaction(signum, &act, NULL); + sigaction(signum, &act, nullptr); #else signal(signum, signal_handler); #endif @@ -125,7 +125,7 @@ static void gmx_signal(int signum) void signal_handler_install(void) { - if (getenv("GMX_NO_TERM") == NULL) + if (getenv("GMX_NO_TERM") == nullptr) { if (debug) { @@ -133,7 +133,7 @@ void signal_handler_install(void) } gmx_signal(SIGTERM); } - if (getenv("GMX_NO_INT") == NULL) + if (getenv("GMX_NO_INT") == nullptr) { if (debug) { @@ -142,7 +142,7 @@ void signal_handler_install(void) gmx_signal(SIGINT); } #if HAVE_SIGUSR1 - if (getenv("GMX_NO_USR1") == NULL) + if (getenv("GMX_NO_USR1") == nullptr) { if (debug) { diff --git a/src/gromacs/mdlib/sim_util.cpp b/src/gromacs/mdlib/sim_util.cpp index 7353e0d7d5..e026136e56 100644 --- a/src/gromacs/mdlib/sim_util.cpp +++ b/src/gromacs/mdlib/sim_util.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -368,7 +368,7 @@ static void post_process_forces(t_commrec *cr, * if the constructing atoms aren't local. */ wallcycle_start(wcycle, ewcVSITESPREAD); - spread_vsite_f(vsite, x, as_rvec_array(fr->f_novirsum->data()), NULL, + spread_vsite_f(vsite, x, as_rvec_array(fr->f_novirsum->data()), nullptr, (flags & GMX_FORCE_VIRIAL), fr->vir_el_recip, nrnb, &top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr); @@ -666,7 +666,7 @@ static void do_nb_verlet_fep(nbnxn_pairlist_set_t *nbl_lists, gmx_bool use_GPU(const nonbonded_verlet_t *nbv) { - return nbv != NULL && nbv->bUseGPU; + return nbv != nullptr && nbv->bUseGPU; } static gmx_inline void clear_rvecs_omp(int n, rvec v[]) @@ -864,7 +864,7 @@ void do_force_cutsVERLET(FILE *fplog, t_commrec *cr, nbnxn_put_on_grid(nbv->nbs, fr->ePBC, box, 0, vzero, box_diag, 0, mdatoms->homenr, -1, fr->cginfo, x, - 0, NULL, + 0, nullptr, nbv->grp[eintLocal].kernel_type, nbv->grp[eintLocal].nbat); wallcycle_sub_stop(wcycle, ewcsNBS_GRID_LOCAL); @@ -1395,7 +1395,7 @@ void do_force_cutsVERLET(FILE *fplog, t_commrec *cr, if (vsite && !(fr->bF_NoVirSum && !(flags & GMX_FORCE_VIRIAL))) { wallcycle_start(wcycle, ewcVSITESPREAD); - spread_vsite_f(vsite, x, f, fr->fshift, FALSE, NULL, nrnb, + spread_vsite_f(vsite, x, f, fr->fshift, FALSE, nullptr, nrnb, &top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr); wallcycle_stop(wcycle, ewcVSITESPREAD); } @@ -1762,7 +1762,7 @@ void do_force_cutsGROUP(FILE *fplog, t_commrec *cr, if (EEL_FULL(fr->eeltype) && cr->dd->n_intercg_excl && (flags & GMX_FORCE_VIRIAL)) { - dd_move_f(cr->dd, as_rvec_array(fr->f_novirsum->data()), NULL); + dd_move_f(cr->dd, as_rvec_array(fr->f_novirsum->data()), nullptr); } wallcycle_stop(wcycle, ewcMOVEF); } @@ -1773,7 +1773,7 @@ void do_force_cutsGROUP(FILE *fplog, t_commrec *cr, if (vsite && !(fr->bF_NoVirSum && !(flags & GMX_FORCE_VIRIAL))) { wallcycle_start(wcycle, ewcVSITESPREAD); - spread_vsite_f(vsite, x, f, fr->fshift, FALSE, NULL, nrnb, + spread_vsite_f(vsite, x, f, fr->fshift, FALSE, nullptr, nrnb, &top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr); wallcycle_stop(wcycle, ewcVSITESPREAD); } @@ -1934,22 +1934,22 @@ void do_constrain_first(FILE *fplog, gmx_constr_t constr, dvdl_dum = 0; /* constrain the current position */ - constrain(NULL, TRUE, FALSE, constr, &(top->idef), + constrain(nullptr, TRUE, FALSE, constr, &(top->idef), ir, cr, step, 0, 1.0, md, - as_rvec_array(state->x.data()), as_rvec_array(state->x.data()), NULL, + as_rvec_array(state->x.data()), as_rvec_array(state->x.data()), nullptr, fr->bMolPBC, state->box, state->lambda[efptBONDED], &dvdl_dum, - NULL, NULL, nrnb, econqCoord); + nullptr, nullptr, nrnb, econqCoord); if (EI_VV(ir->eI)) { /* constrain the inital velocity, and save it */ /* also may be useful if we need the ekin from the halfstep for velocity verlet */ - constrain(NULL, TRUE, FALSE, constr, &(top->idef), + constrain(nullptr, TRUE, FALSE, constr, &(top->idef), ir, cr, step, 0, 1.0, md, as_rvec_array(state->x.data()), as_rvec_array(state->v.data()), as_rvec_array(state->v.data()), fr->bMolPBC, state->box, state->lambda[efptBONDED], &dvdl_dum, - NULL, NULL, nrnb, econqVeloc); + nullptr, nullptr, nrnb, econqVeloc); } /* constrain the inital velocities at t-dt/2 */ if (EI_STATE_VELOCITY(ir->eI) && ir->eI != eiVV) @@ -1974,12 +1974,12 @@ void do_constrain_first(FILE *fplog, gmx_constr_t constr, gmx_step_str(step, buf)); } dvdl_dum = 0; - constrain(NULL, TRUE, FALSE, constr, &(top->idef), + constrain(nullptr, TRUE, FALSE, constr, &(top->idef), ir, cr, step, -1, 1.0, md, - as_rvec_array(state->x.data()), savex, NULL, + as_rvec_array(state->x.data()), savex, nullptr, fr->bMolPBC, state->box, state->lambda[efptBONDED], &dvdl_dum, - as_rvec_array(state->v.data()), NULL, nrnb, econqCoord); + as_rvec_array(state->v.data()), nullptr, nrnb, econqCoord); for (i = start; i < end; i++) { @@ -2410,7 +2410,7 @@ static void low_do_pbc_mtop(FILE *fplog, int ePBC, matrix box, else { /* Pass NULL iso fplog to avoid graph prints for each molecule type */ - mk_graph_ilist(NULL, mtop->moltype[molb->type].ilist, + mk_graph_ilist(nullptr, mtop->moltype[molb->type].ilist, 0, molb->natoms_mol, FALSE, FALSE, graph); for (mol = 0; mol < molb->nmol; mol++) @@ -2471,7 +2471,7 @@ void finish_run(FILE *fplog, const gmx::MDLogger &mdlog, t_commrec *cr, nonbonded_verlet_t *nbv, gmx_bool bWriteStat) { - t_nrnb *nrnb_tot = NULL; + t_nrnb *nrnb_tot = nullptr; double delta_t = 0; double nbfs = 0, mflop = 0; double elapsed_time, @@ -2539,7 +2539,7 @@ void finish_run(FILE *fplog, const gmx::MDLogger &mdlog, t_commrec *cr, if (SIMMASTER(cr)) { - struct gmx_wallclock_gpu_t* gputimes = use_GPU(nbv) ? nbnxn_gpu_get_timings(nbv->gpu_nbv) : NULL; + struct gmx_wallclock_gpu_t* gputimes = use_GPU(nbv) ? nbnxn_gpu_get_timings(nbv->gpu_nbv) : nullptr; wallcycle_print(fplog, mdlog, cr->nnodes, cr->npmenodes, nthreads_pp, nthreads_pme, elapsed_time_over_all_ranks, @@ -2617,7 +2617,7 @@ extern void initialize_lambdas(FILE *fplog, t_inputrec *ir, int *fep_state, std: } /* Send to the log the information on the current lambdas */ - if (fplog != NULL) + if (fplog != nullptr) { fprintf(fplog, "Initial vector of lambda components:[ "); for (int i = 0; i < efptNR; i++) @@ -2667,10 +2667,10 @@ void init_md(FILE *fplog, } if (*bSimAnn) { - update_annealing_target_temp(ir, ir->init_t, upd ? *upd : NULL); + update_annealing_target_temp(ir, ir->init_t, upd ? *upd : nullptr); } - if (vcm != NULL) + if (vcm != nullptr) { *vcm = init_vcm(fplog, &mtop->groups, ir); } @@ -2696,7 +2696,7 @@ void init_md(FILE *fplog, { *outf = init_mdoutf(fplog, nfile, fnm, Flags, cr, ir, mtop, oenv, wcycle); - *mdebin = init_mdebin((Flags & MD_APPENDFILES) ? NULL : mdoutf_get_fp_ene(*outf), + *mdebin = init_mdebin((Flags & MD_APPENDFILES) ? nullptr : mdoutf_get_fp_ene(*outf), mtop, ir, mdoutf_get_fp_dhdl(*outf)); } diff --git a/src/gromacs/mdlib/splitter.cpp b/src/gromacs/mdlib/splitter.cpp index 1bbbd9ed09..c8d55bf8da 100644 --- a/src/gromacs/mdlib/splitter.cpp +++ b/src/gromacs/mdlib/splitter.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -135,9 +135,9 @@ static int first_colour(int fC, egCol Col, t_graph *g, egCol egc[]) static int mk_sblocks(FILE *fp, t_graph *g, int maxsid, t_sid sid[]) { int ng, nnodes; - int nW, nG, nB; /* Number of Grey, Black, White */ - int fW, fG; /* First of each category */ - egCol *egc = NULL; /* The colour of each node */ + int nW, nG, nB; /* Number of Grey, Black, White */ + int fW, fG; /* First of each category */ + egCol *egc = nullptr; /* The colour of each node */ int g0, nblock; if (!g->nbound) @@ -363,7 +363,7 @@ void gen_sblocks(FILE *fp, int at_start, int at_end, t_sid *sid; int nsid; - g = mk_graph(NULL, idef, at_start, at_end, TRUE, bSettle); + g = mk_graph(nullptr, idef, at_start, at_end, TRUE, bSettle); if (debug) { p_graph(debug, "Graaf Dracula", g); diff --git a/src/gromacs/mdlib/stat.cpp b/src/gromacs/mdlib/stat.cpp index 7c6de83ec4..0db91f37e4 100644 --- a/src/gromacs/mdlib/stat.cpp +++ b/src/gromacs/mdlib/stat.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -156,7 +156,7 @@ void global_stat(gmx_global_stat_t gs, int inn[egNR]; real copyenerd[F_NRE]; int nener, j; - real *rmsd_data = NULL; + real *rmsd_data = nullptr; double nb; gmx_bool bVV, bTemp, bEner, bPres, bConstrVir, bEkinAveVel, bReadEkin; bool checkNumberOfBondedInteractions = flags & CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS; diff --git a/src/gromacs/mdlib/tpi.cpp b/src/gromacs/mdlib/tpi.cpp index b35c713802..bced9d71f7 100644 --- a/src/gromacs/mdlib/tpi.cpp +++ b/src/gromacs/mdlib/tpi.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -184,12 +184,12 @@ double do_tpi(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, gmx_int64_t nsteps, stepblocksize = 0, step; gmx_int64_t seed; int i; - FILE *fp_tpi = NULL; + FILE *fp_tpi = nullptr; char *ptr, *dump_pdb, **leg, str[STRLEN], str2[STRLEN]; double dbl, dump_ener; gmx_bool bCavity; int nat_cavity = 0, d; - real *mass_cavity = NULL, mass_tot; + real *mass_cavity = nullptr, mass_tot; int nbin; double invbinw, *bin, refvolshift, logV, bUlogV; real prescorr, enercorr, dvdlcorr; @@ -217,7 +217,7 @@ double do_tpi(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, if (bCavity) { ptr = getenv("GMX_TPIC_MASSES"); - if (ptr == NULL) + if (ptr == nullptr) { nat_cavity = 1; } @@ -285,7 +285,7 @@ double do_tpi(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, sscanf(dump_pdb, "%20lf", &dump_ener); } - atoms2md(top_global, inputrec, -1, NULL, top_global->natoms, mdatoms); + atoms2md(top_global, inputrec, -1, nullptr, top_global->natoms, mdatoms); update_mdatoms(mdatoms, inputrec->fepvals->init_lambda); snew(enerd, 1); @@ -630,7 +630,7 @@ double do_tpi(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, copy_rvec(x_mol[i-a_tp0], state_global->x[i]); } /* Rotate the molecule randomly */ - rotate_conf(a_tp1-a_tp0, as_rvec_array(state_global->x.data())+a_tp0, NULL, + rotate_conf(a_tp1-a_tp0, as_rvec_array(state_global->x.data())+a_tp0, nullptr, 2*M_PI*dist(rng), 2*M_PI*dist(rng), 2*M_PI*dist(rng)); @@ -663,7 +663,7 @@ double do_tpi(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, state_global->box, &state_global->x, &state_global->hist, &f, force_vir, mdatoms, enerd, fcd, &state_global->lambda, - NULL, fr, NULL, mu_tot, t, NULL, FALSE, + nullptr, fr, nullptr, mu_tot, t, nullptr, FALSE, GMX_FORCE_NONBONDED | GMX_FORCE_ENERGY | (bNS ? GMX_FORCE_DYNAMICBOX | GMX_FORCE_NS : 0) | (bStateChanged ? GMX_FORCE_STATECHANGED : 0)); @@ -833,12 +833,12 @@ double do_tpi(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog, close_trj(status); - if (fp_tpi != NULL) + if (fp_tpi != nullptr) { xvgrclose(fp_tpi); } - if (fplog != NULL) + if (fplog != nullptr) { fprintf(fplog, "\n"); fprintf(fplog, " = %12.5e nm^3\n", V_all/frame); diff --git a/src/gromacs/mdlib/trajectory_writing.cpp b/src/gromacs/mdlib/trajectory_writing.cpp index 93025b5bdd..740b761654 100644 --- a/src/gromacs/mdlib/trajectory_writing.cpp +++ b/src/gromacs/mdlib/trajectory_writing.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -77,7 +77,7 @@ do_md_trajectory_writing(FILE *fplog, ) { int mdof_flags; - rvec *x_for_confout = NULL; + rvec *x_for_confout = nullptr; mdof_flags = 0; if (do_per_step(step, ir->nstxout)) diff --git a/src/gromacs/mdlib/update.cpp b/src/gromacs/mdlib/update.cpp index c7c9556ddf..079e3d992d 100644 --- a/src/gromacs/mdlib/update.cpp +++ b/src/gromacs/mdlib/update.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -471,7 +471,7 @@ static void do_update_md(int start, (start, nrend, dt, dtPressureCouple, - invMassPerDim, tcstat, cTC, NULL, x, xprime, v, f); + invMassPerDim, tcstat, cTC, nullptr, x, xprime, v, f); } else { @@ -479,7 +479,7 @@ static void do_update_md(int start, (start, nrend, dt, dtPressureCouple, - invMassPerDim, tcstat, cTC, NULL, x, xprime, v, f); + invMassPerDim, tcstat, cTC, nullptr, x, xprime, v, f); } } } @@ -1413,21 +1413,21 @@ void update_constraints(FILE *fplog, wallcycle_start(wcycle, ewcCONSTR); if (EI_VV(inputrec->eI) && bFirstHalf) { - constrain(NULL, bLog, bEner, constr, idef, + constrain(nullptr, bLog, bEner, constr, idef, inputrec, cr, step, 1, 1.0, md, as_rvec_array(state->x.data()), as_rvec_array(state->v.data()), as_rvec_array(state->v.data()), bMolPBC, state->box, state->lambda[efptBONDED], dvdlambda, - NULL, bCalcVir ? &vir_con : NULL, nrnb, econqVeloc); + nullptr, bCalcVir ? &vir_con : nullptr, nrnb, econqVeloc); } else { - constrain(NULL, bLog, bEner, constr, idef, + constrain(nullptr, bLog, bEner, constr, idef, inputrec, cr, step, 1, 1.0, md, - as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), NULL, + as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), nullptr, bMolPBC, state->box, state->lambda[efptBONDED], dvdlambda, - as_rvec_array(state->v.data()), bCalcVir ? &vir_con : NULL, nrnb, econqCoord); + as_rvec_array(state->v.data()), bCalcVir ? &vir_con : nullptr, nrnb, econqCoord); } wallcycle_stop(wcycle, ewcCONSTR); @@ -1473,7 +1473,7 @@ void update_constraints(FILE *fplog, as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), as_rvec_array(state->v.data()), as_rvec_array(force->data()), bDoConstr, FALSE, step, inputrec->ld_seed, - DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL); + DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr); } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; } @@ -1485,12 +1485,12 @@ void update_constraints(FILE *fplog, /* Constrain the coordinates upd->xp for half a time step */ wallcycle_start(wcycle, ewcCONSTR); - constrain(NULL, bLog, bEner, constr, idef, + constrain(nullptr, bLog, bEner, constr, idef, inputrec, cr, step, 1, 0.5, md, - as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), NULL, + as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), nullptr, bMolPBC, state->box, state->lambda[efptBONDED], dvdlambda, - as_rvec_array(state->v.data()), NULL, nrnb, econqCoord); + as_rvec_array(state->v.data()), nullptr, nrnb, econqCoord); wallcycle_stop(wcycle, ewcCONSTR); } @@ -1508,7 +1508,7 @@ void update_constraints(FILE *fplog, */ wallcycle_start_nocount(wcycle, ewcUPDATE); - if (md->cFREEZE != NULL && constr != NULL) + if (md->cFREEZE != nullptr && constr != nullptr) { /* If we have atoms that are frozen along some, but not all * dimensions, the constraints will have moved them also along @@ -1673,7 +1673,7 @@ void update_pcouple_after_coordinates(FILE *fplog, } where(); dump_it_all(fplog, "After update", - state->natoms, &state->x, &upd->xp, &state->v, NULL); + state->natoms, &state->x, &upd->xp, &state->v, nullptr); } void update_coords(FILE *fplog, @@ -1690,7 +1690,7 @@ void update_coords(FILE *fplog, t_commrec *cr, /* these shouldn't be here -- need to think about it */ gmx_constr_t constr) { - gmx_bool bDoConstr = (NULL != constr); + gmx_bool bDoConstr = (nullptr != constr); /* Running the velocity half does nothing except for velocity verlet */ if ((UpdatePart == etrtVELOCITY1 || UpdatePart == etrtVELOCITY2) && @@ -1755,7 +1755,7 @@ void update_coords(FILE *fplog, md->cFREEZE, md->cACC, md->cTC, x_rvec, xp_rvec, v_rvec, f_rvec, bDoConstr, TRUE, - step, inputrec->ld_seed, DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL); + step, inputrec->ld_seed, DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr); break; case (eiBD): do_update_bd(start_th, end_th, dt, @@ -1764,7 +1764,7 @@ void update_coords(FILE *fplog, x_rvec, xp_rvec, v_rvec, f_rvec, inputrec->bd_fric, upd->sd->bd_rf, - step, inputrec->ld_seed, DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL); + step, inputrec->ld_seed, DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr); break; case (eiVV): case (eiVVAK): @@ -1867,7 +1867,7 @@ extern gmx_bool update_randomize_velocities(t_inputrec *ir, gmx_int64_t step, co real rate = (ir->delta_t)/ir->opts.tau_t[0]; - if (ir->etc == etcANDERSEN && constr != NULL) + if (ir->etc == etcANDERSEN && constr != nullptr) { /* Currently, Andersen thermostat does not support constrained systems. Functionality exists in the andersen_tcoupl diff --git a/src/gromacs/mdlib/vsite.cpp b/src/gromacs/mdlib/vsite.cpp index c776d3011d..800a5c8067 100644 --- a/src/gromacs/mdlib/vsite.cpp +++ b/src/gromacs/mdlib/vsite.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -90,7 +90,7 @@ static void init_ilist(t_ilist *ilist) { ilist[i].nr = 0; ilist[i].nalloc = 0; - ilist[i].iatoms = NULL; + ilist[i].iatoms = nullptr; } } @@ -432,7 +432,7 @@ static void construct_vsites_thread(const gmx_vsite_t *vsite, const t_pbc *pbc_null2; int *vsite_pbc; - if (v != NULL) + if (v != nullptr) { inv_dt = 1.0/dt; } @@ -441,10 +441,10 @@ static void construct_vsites_thread(const gmx_vsite_t *vsite, inv_dt = 1.0; } - bPBCAll = (pbc_null != NULL && !vsite->bHaveChargeGroups); + bPBCAll = (pbc_null != nullptr && !vsite->bHaveChargeGroups); - pbc_null2 = NULL; - vsite_pbc = NULL; + pbc_null2 = nullptr; + vsite_pbc = nullptr; for (int ftype = c_ftypeVsiteStart; ftype < c_ftypeVsiteEnd; ftype++) { if (ilist[ftype].nr == 0) @@ -463,7 +463,7 @@ static void construct_vsites_thread(const gmx_vsite_t *vsite, { pbc_null2 = pbc_null; } - else if (pbc_null != NULL) + else if (pbc_null != nullptr) { vsite_pbc = vsite->vsite_pbc_loc[ftype - c_ftypeVsiteStart]; } @@ -485,7 +485,7 @@ static void construct_vsites_thread(const gmx_vsite_t *vsite, pbc_atom = avsite; copy_rvec(x[avsite], xpbc); } - else if (vsite_pbc != NULL) + else if (vsite_pbc != nullptr) { pbc_atom = vsite_pbc[i/(1 + nra)]; if (pbc_atom > -2) @@ -502,7 +502,7 @@ static void construct_vsites_thread(const gmx_vsite_t *vsite, } else { - pbc_null2 = NULL; + pbc_null2 = nullptr; } } else @@ -583,7 +583,7 @@ static void construct_vsites_thread(const gmx_vsite_t *vsite, rvec_add(xpbc, dx, x[avsite]); } } - if (v != NULL) + if (v != nullptr) { /* Calculate velocity of vsite... */ rvec vv; @@ -624,7 +624,7 @@ void construct_vsites(const gmx_vsite_t *vsite, } else { - pbc_null = NULL; + pbc_null = nullptr; } if (bDomDec) @@ -732,9 +732,9 @@ void construct_vsites_mtop(gmx_vsite_t *vsite, const gmx_moltype_t *molt = &mtop->moltype[molb->type]; for (int mol = 0; mol < molb->nmol; mol++) { - construct_vsites(vsite, x+as, 0.0, NULL, + construct_vsites(vsite, x+as, 0.0, nullptr, mtop->ffparams.iparams, molt->ilist, - epbcNONE, TRUE, NULL, NULL); + epbcNONE, TRUE, nullptr, nullptr); as += molt->atoms.nr; } } @@ -1452,12 +1452,12 @@ static void spread_vsite_f_thread(const gmx_vsite_t *vsite, const t_pbc *pbc_null2; const int *vsite_pbc; - bPBCAll = (pbc_null != NULL && !vsite->bHaveChargeGroups); + bPBCAll = (pbc_null != nullptr && !vsite->bHaveChargeGroups); /* this loop goes backwards to be able to build * * higher type vsites from lower types */ - pbc_null2 = NULL; - vsite_pbc = NULL; + pbc_null2 = nullptr; + vsite_pbc = nullptr; for (int ftype = c_ftypeVsiteEnd - 1; ftype >= c_ftypeVsiteStart; ftype--) { if (ilist[ftype].nr == 0) @@ -1476,14 +1476,14 @@ static void spread_vsite_f_thread(const gmx_vsite_t *vsite, { pbc_null2 = pbc_null; } - else if (pbc_null != NULL) + else if (pbc_null != nullptr) { vsite_pbc = vsite->vsite_pbc_loc[ftype - c_ftypeVsiteStart]; } for (int i = 0; i < nr; ) { - if (vsite_pbc != NULL) + if (vsite_pbc != nullptr) { if (vsite_pbc[i/(1 + nra)] > -2) { @@ -1491,7 +1491,7 @@ static void spread_vsite_f_thread(const gmx_vsite_t *vsite, } else { - pbc_null2 = NULL; + pbc_null2 = nullptr; } } @@ -1582,11 +1582,11 @@ void spread_vsite_f(const gmx_vsite_t *vsite, /* This is wasting some CPU time as we now do this multiple times * per MD step. */ - pbc_null = set_pbc_dd(&pbc, ePBC, cr->dd ? cr->dd->nc : NULL, FALSE, box); + pbc_null = set_pbc_dd(&pbc, ePBC, cr->dd ? cr->dd->nc : nullptr, FALSE, box); } else { - pbc_null = NULL; + pbc_null = nullptr; } if (DOMAINDECOMP(cr)) @@ -1628,7 +1628,7 @@ void spread_vsite_f(const gmx_vsite_t *vsite, VsiteThread *tData = vsite->tData[thread]; rvec *fshift_t; - if (thread == 0 || fshift == NULL) + if (thread == 0 || fshift == nullptr) { fshift_t = fshift; } @@ -1717,7 +1717,7 @@ void spread_vsite_f(const gmx_vsite_t *vsite, GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; } - if (fshift != NULL) + if (fshift != nullptr) { for (int th = 1; th < vsite->nthreads; th++) { @@ -1974,7 +1974,7 @@ gmx_vsite_t *init_vsite(const gmx_mtop_t *mtop, t_commrec *cr, if (nvsite == 0) { - return NULL; + return nullptr; } snew(vsite, 1); @@ -1997,7 +1997,7 @@ gmx_vsite_t *init_vsite(const gmx_mtop_t *mtop, t_commrec *cr, int *a2cg = atom2cg(&molt->cgs); vsite->vsite_pbc_molt[mt] = get_vsite_pbc(mtop->ffparams.iparams, molt->ilist, - molt->atoms.atom, NULL, + molt->atoms.atom, nullptr, &molt->cgs, a2cg); sfree(a2cg); } @@ -2037,7 +2037,7 @@ gmx_vsite_t *init_vsite(const gmx_mtop_t *mtop, t_commrec *cr, } } - vsite->taskIndex = NULL; + vsite->taskIndex = nullptr; vsite->taskIndexNalloc = 0; return vsite; @@ -2539,7 +2539,7 @@ void set_vsite_top(gmx_vsite_t *vsite, gmx_localtop_t *top, t_mdatoms *md, /* Make an atom to charge group index */ int *a2cg = atom2cg(&top->cgs); vsite->vsite_pbc_loc = get_vsite_pbc(top->idef.iparams, - top->idef.il, NULL, md, + top->idef.il, nullptr, md, &top->cgs, a2cg); sfree(a2cg); } diff --git a/src/gromacs/mdrunutility/handlerestart.cpp b/src/gromacs/mdrunutility/handlerestart.cpp index c434fff327..f35b36d2e9 100644 --- a/src/gromacs/mdrunutility/handlerestart.cpp +++ b/src/gromacs/mdrunutility/handlerestart.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -205,8 +205,8 @@ read_checkpoint_data(const char *filename, int *simulation_part, */ strcpy(suf_up, part_suffix); upstring(suf_up); - *bAddPart = (strstr(fn, part_suffix) != NULL || - strstr(fn, suf_up) != NULL); + *bAddPart = (strstr(fn, part_suffix) != nullptr || + strstr(fn, suf_up) != nullptr); } sfree(outputfiles); @@ -270,7 +270,7 @@ handleRestart(t_commrec *cr, } else { - fpmulti = NULL; + fpmulti = nullptr; } check_multi_int(fpmulti, cr->ms, sim_part, "simulation part", TRUE); } diff --git a/src/gromacs/mdrunutility/threadaffinity.cpp b/src/gromacs/mdrunutility/threadaffinity.cpp index 83bee6730c..a65d8997a9 100644 --- a/src/gromacs/mdrunutility/threadaffinity.cpp +++ b/src/gromacs/mdrunutility/threadaffinity.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -154,7 +154,7 @@ get_thread_affinity_layout(FILE *fplog, const gmx::MDLogger &mdlog, { /* topology information not available or invalid, ignore it */ hwThreads = hwTop.machine().logicalProcessorCount; - *localityOrder = NULL; + *localityOrder = nullptr; } // Only warn about the first problem per node. Otherwise, the first test // failing would essentially always cause also the other problems get @@ -246,7 +246,7 @@ get_thread_affinity_layout(FILE *fplog, const gmx::MDLogger &mdlog, } validLayout = validLayout && !invalidValue; - if (validLayout && fplog != NULL) + if (validLayout && fplog != nullptr) { fprintf(fplog, "Pinning threads with a%s logical core stride of %d\n", bPickPinStride ? "n auto-selected" : " user-specified", diff --git a/src/gromacs/mdtypes/state.cpp b/src/gromacs/mdtypes/state.cpp index e77586e157..c6a5242954 100644 --- a/src/gromacs/mdtypes/state.cpp +++ b/src/gromacs/mdtypes/state.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -59,18 +59,18 @@ static void zero_history(history_t *hist) { hist->disre_initf = 0; hist->ndisrepairs = 0; - hist->disre_rm3tav = NULL; + hist->disre_rm3tav = nullptr; hist->orire_initf = 0; hist->norire_Dtav = 0; - hist->orire_Dtav = NULL; + hist->orire_Dtav = nullptr; } static void zero_ekinstate(ekinstate_t *eks) { eks->ekin_n = 0; - eks->ekinh = NULL; - eks->ekinf = NULL; - eks->ekinh_old = NULL; + eks->ekinh = nullptr; + eks->ekinf = nullptr; + eks->ekinh_old = nullptr; eks->ekinscalef_nhc.resize(0); eks->ekinscaleh_nhc.resize(0); eks->vscale_nhc.resize(0); @@ -85,15 +85,15 @@ static void init_swapstate(swapstate_t *swapstate) swapstate->nIonTypes = 0; swapstate->nAverage = 0; swapstate->fluxleak = 0; - swapstate->fluxleak_p = NULL; + swapstate->fluxleak_p = nullptr; swapstate->bFromCpt = 0; swapstate->nat[eChan0] = 0; swapstate->nat[eChan1] = 0; - swapstate->xc_old_whole[eChan0] = NULL; - swapstate->xc_old_whole[eChan1] = NULL; - swapstate->xc_old_whole_p[eChan0] = NULL; - swapstate->xc_old_whole_p[eChan1] = NULL; - swapstate->ionType = NULL; + swapstate->xc_old_whole[eChan0] = nullptr; + swapstate->xc_old_whole[eChan1] = nullptr; + swapstate->xc_old_whole_p[eChan0] = nullptr; + swapstate->xc_old_whole_p[eChan1] = nullptr; + swapstate->ionType = nullptr; } void init_gtc_state(t_state *state, int ngtc, int nnhpres, int nhchainlength) @@ -146,10 +146,10 @@ void init_state(t_state *state, int natoms, int ngtc, int nnhpres, int nhchainle } else { - state->dfhist = NULL; + state->dfhist = nullptr; } - state->swapstate = NULL; - state->edsamstate = NULL; + state->swapstate = nullptr; + state->edsamstate = nullptr; state->ddp_count = 0; state->ddp_count_cg_gl = 0; state->cg_gl.resize(0); diff --git a/src/gromacs/onlinehelp/helpformat.cpp b/src/gromacs/onlinehelp/helpformat.cpp index 2648150a59..777ad247dd 100644 --- a/src/gromacs/onlinehelp/helpformat.cpp +++ b/src/gromacs/onlinehelp/helpformat.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -75,7 +75,7 @@ class TextTableFormatter::Impl { //! Initializes a text table column with given values. ColumnData(const char *title, int width, bool bWrap) - : title_(title != NULL ? title : ""), + : title_(title != nullptr ? title : ""), width_(width), bWrap_(bWrap), firstLine_(0), nextLineIndex_(0), nextLineOffset_(0) { @@ -225,7 +225,7 @@ TextTableFormatter::~TextTableFormatter() void TextTableFormatter::addColumn(const char *title, int width, bool bWrap) { - if (title != NULL && title[0] != '\0') + if (title != nullptr && title[0] != '\0') { impl_->bPrintHeader_ = true; } diff --git a/src/gromacs/onlinehelp/helpmanager.cpp b/src/gromacs/onlinehelp/helpmanager.cpp index 60a8b7f48e..cc4c9d75f4 100644 --- a/src/gromacs/onlinehelp/helpmanager.cpp +++ b/src/gromacs/onlinehelp/helpmanager.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -136,7 +136,7 @@ void HelpManager::enterTopic(const char *name) impl_->currentTopicAsString().c_str()))); } const IHelpTopic *newTopic = topic.findSubTopic(name); - if (newTopic == NULL) + if (newTopic == nullptr) { if (impl_->isAtRootTopic()) { @@ -163,7 +163,7 @@ void HelpManager::writeCurrentTopic() const const IHelpTopic &topic = impl_->currentTopic(); const char *title = topic.title(); HelpWriterContext context(impl_->rootContext_); - context.enterSubSection(title != NULL ? title : ""); + context.enterSubSection(title != nullptr ? title : ""); topic.writeHelp(context); } diff --git a/src/gromacs/onlinehelp/helptopic.cpp b/src/gromacs/onlinehelp/helptopic.cpp index 167e8214fa..6126171739 100644 --- a/src/gromacs/onlinehelp/helptopic.cpp +++ b/src/gromacs/onlinehelp/helptopic.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -68,7 +68,7 @@ bool AbstractSimpleHelpTopic::hasSubTopics() const const IHelpTopic * AbstractSimpleHelpTopic::findSubTopic(const char * /* name */) const { - return NULL; + return nullptr; } void AbstractSimpleHelpTopic::writeHelp(const HelpWriterContext &context) const @@ -131,7 +131,7 @@ AbstractCompositeHelpTopic::findSubTopic(const char *name) const Impl::SubTopicMap::const_iterator topic = impl_->subTopicMap_.find(name); if (topic == impl_->subTopicMap_.end()) { - return NULL; + return nullptr; } return topic->second; } @@ -182,8 +182,8 @@ AbstractCompositeHelpTopic::writeSubTopicList(const HelpWriterContext &context, } TextWriter &file = context.outputFile(); TextTableFormatter formatter; - formatter.addColumn(NULL, maxNameLength + 1, false); - formatter.addColumn(NULL, 72 - maxNameLength, true); + formatter.addColumn(nullptr, maxNameLength + 1, false); + formatter.addColumn(nullptr, 72 - maxNameLength, true); formatter.setFirstColumnIndent(4); file.writeLine(title); for (topic = impl_->subTopicMap_.begin(); topic != impl_->subTopicMap_.end(); ++topic) diff --git a/src/gromacs/onlinehelp/helpwritercontext.cpp b/src/gromacs/onlinehelp/helpwritercontext.cpp index 5e7e3a7d9c..dcc655e3d2 100644 --- a/src/gromacs/onlinehelp/helpwritercontext.cpp +++ b/src/gromacs/onlinehelp/helpwritercontext.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -457,10 +457,10 @@ class HelpWriterContext::Impl { consoleOptionsFormatter_.reset(new TextTableFormatter()); consoleOptionsFormatter_->setFirstColumnIndent(1); - consoleOptionsFormatter_->addColumn(NULL, 7, false); - consoleOptionsFormatter_->addColumn(NULL, 18, false); - consoleOptionsFormatter_->addColumn(NULL, 16, false); - consoleOptionsFormatter_->addColumn(NULL, 28, false); + consoleOptionsFormatter_->addColumn(nullptr, 7, false); + consoleOptionsFormatter_->addColumn(nullptr, 18, false); + consoleOptionsFormatter_->addColumn(nullptr, 16, false); + consoleOptionsFormatter_->addColumn(nullptr, 28, false); } return *consoleOptionsFormatter_; } @@ -540,7 +540,7 @@ class HelpWriterContext::Impl std::string HelpWriterContext::Impl::replaceLinks(const std::string &input) const { std::string result(input); - if (state_->links_ != NULL) + if (state_->links_ != nullptr) { HelpLinks::Impl::LinkList::const_iterator link; for (link = state_->links_->impl_->links_.begin(); @@ -603,7 +603,7 @@ void HelpWriterContext::Impl::processMarkup(const std::string &text, */ HelpWriterContext::HelpWriterContext(TextWriter *writer, HelpOutputFormat format) - : impl_(new Impl(Impl::StatePointer(new Impl::SharedState(writer, format, NULL)), 0)) + : impl_(new Impl(Impl::StatePointer(new Impl::SharedState(writer, format, nullptr)), 0)) { } @@ -611,7 +611,7 @@ HelpWriterContext::HelpWriterContext(TextWriter *writer, HelpOutputFormat format const HelpLinks *links) : impl_(new Impl(Impl::StatePointer(new Impl::SharedState(writer, format, links)), 0)) { - if (links != NULL) + if (links != nullptr) { GMX_RELEASE_ASSERT(links->impl_->format_ == format, "Links must have the same output format as the context"); diff --git a/src/gromacs/onlinehelp/tests/helpformat.cpp b/src/gromacs/onlinehelp/tests/helpformat.cpp index 797593e6b8..f48ffbebbf 100644 --- a/src/gromacs/onlinehelp/tests/helpformat.cpp +++ b/src/gromacs/onlinehelp/tests/helpformat.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -88,9 +88,9 @@ TEST_F(TextTableFormatterTest, HandlesBasicCase) TEST_F(TextTableFormatterTest, HandlesEmptyColumnTitles) { - formatter_.addColumn(NULL, 4, false); + formatter_.addColumn(nullptr, 4, false); formatter_.addColumn("", 4, false); - formatter_.addColumn(NULL, 14, true); + formatter_.addColumn(nullptr, 14, true); formatter_.addColumn("", 14, true); formatter_.clear(); diff --git a/src/gromacs/onlinehelp/tests/helpmanager.cpp b/src/gromacs/onlinehelp/tests/helpmanager.cpp index c9f171f9e6..19a19fce27 100644 --- a/src/gromacs/onlinehelp/tests/helpmanager.cpp +++ b/src/gromacs/onlinehelp/tests/helpmanager.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -76,7 +76,7 @@ class HelpTestBase : public gmx::test::StringTestBase }; HelpTestBase::HelpTestBase() - : rootTopic_("", NULL, "Root topic text"), + : rootTopic_("", nullptr, "Root topic text"), writer_(&helpFile_), context_(&writer_, gmx::eHelpOutputFormat_Console), manager_(rootTopic_, context_) @@ -100,10 +100,10 @@ TEST_F(HelpManagerTest, HandlesRootTopic) TEST_F(HelpManagerTest, HandlesSubTopics) { MockHelpTopic &first = - rootTopic_.addSubTopic("first", "First topic", NULL); + rootTopic_.addSubTopic("first", "First topic", nullptr); MockHelpTopic &firstSub = - first.addSubTopic("firstsub", "First subtopic", NULL); - rootTopic_.addSubTopic("second", "Second topic", NULL); + first.addSubTopic("firstsub", "First subtopic", nullptr); + rootTopic_.addSubTopic("second", "Second topic", nullptr); using ::testing::_; EXPECT_CALL(firstSub, writeHelp(_)); @@ -115,9 +115,9 @@ TEST_F(HelpManagerTest, HandlesSubTopics) TEST_F(HelpManagerTest, HandlesInvalidTopics) { MockHelpTopic &first = - rootTopic_.addSubTopic("first", "First topic", NULL); - first.addSubTopic("firstsub", "First subtopic", NULL); - rootTopic_.addSubTopic("second", "Second topic", NULL); + rootTopic_.addSubTopic("first", "First topic", nullptr); + first.addSubTopic("firstsub", "First subtopic", nullptr); + rootTopic_.addSubTopic("second", "Second topic", nullptr); ASSERT_THROW_GMX(manager_.enterTopic("unknown"), gmx::InvalidInputError); ASSERT_NO_THROW_GMX(manager_.enterTopic("first")); diff --git a/src/gromacs/onlinehelp/tests/helpwritercontext.cpp b/src/gromacs/onlinehelp/tests/helpwritercontext.cpp index d41ca87f6b..205906f435 100644 --- a/src/gromacs/onlinehelp/tests/helpwritercontext.cpp +++ b/src/gromacs/onlinehelp/tests/helpwritercontext.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015, by the GROMACS development team, led by + * Copyright (c) 2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -67,10 +67,10 @@ class HelpWriterContextTest : public gmx::test::StringTestBase gmx::HelpOutputFormat format, const char *id) { - gmx::HelpWriterContext context(NULL, format); + gmx::HelpWriterContext context(nullptr, format); std::string result = context.substituteMarkupAndWrapToString(settings_, text); - if (id == NULL) + if (id == nullptr) { switch (format) { @@ -89,8 +89,8 @@ class HelpWriterContextTest : public gmx::test::StringTestBase void testFormatting(const gmx::ConstArrayRef &text) { std::string testText = gmx::joinStrings(text, "\n"); - testFormatting(testText, gmx::eHelpOutputFormat_Console, NULL); - testFormatting(testText, gmx::eHelpOutputFormat_Rst, NULL); + testFormatting(testText, gmx::eHelpOutputFormat_Console, nullptr); + testFormatting(testText, gmx::eHelpOutputFormat_Rst, nullptr); } gmx::TextLineWrapperSettings settings_; diff --git a/src/gromacs/onlinehelp/tests/mock_helptopic.cpp b/src/gromacs/onlinehelp/tests/mock_helptopic.cpp index 3579fc7d82..49decf9b1a 100644 --- a/src/gromacs/onlinehelp/tests/mock_helptopic.cpp +++ b/src/gromacs/onlinehelp/tests/mock_helptopic.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -69,7 +69,7 @@ MockHelpTopic::addSubTopic(gmx::AbstractCompositeHelpTopic *parent, } MockHelpTopic::MockHelpTopic(const char *name, const char *title, const char *text) - : name_(name), title_(title), text_(text != NULL ? text : "") + : name_(name), title_(title), text_(text != nullptr ? text : "") { if (!isNullOrEmpty(text)) { diff --git a/src/gromacs/options/abstractoption.cpp b/src/gromacs/options/abstractoption.cpp index 1439837fde..6b8c75bfec 100644 --- a/src/gromacs/options/abstractoption.cpp +++ b/src/gromacs/options/abstractoption.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -72,15 +72,15 @@ AbstractOptionStorage::AbstractOptionStorage(const AbstractOption &settings, GMX_THROW(APIError("Inconsistent value counts for vector values")); } - if (settings.name_ != NULL) + if (settings.name_ != nullptr) { name_ = settings.name_; } - if (settings.descr_ != NULL) + if (settings.descr_ != nullptr) { descr_ = settings.descr_; } - if (storeIsSet_ != NULL) + if (storeIsSet_ != nullptr) { *storeIsSet_ = false; } @@ -93,7 +93,7 @@ AbstractOptionStorage::~AbstractOptionStorage() bool AbstractOptionStorage::isBoolean() const { - return dynamic_cast(this) != NULL; + return dynamic_cast(this) != nullptr; } void AbstractOptionStorage::startSource() @@ -134,7 +134,7 @@ void AbstractOptionStorage::appendValue(const Variant &value) void AbstractOptionStorage::markAsSet() { setFlag(efOption_Set); - if (storeIsSet_ != NULL) + if (storeIsSet_ != nullptr) { *storeIsSet_ = true; } diff --git a/src/gromacs/options/abstractoption.h b/src/gromacs/options/abstractoption.h index d3f8050b6f..575cd6efad 100644 --- a/src/gromacs/options/abstractoption.h +++ b/src/gromacs/options/abstractoption.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -102,7 +102,7 @@ class AbstractOption //! Initializes the name and default values for an option. explicit AbstractOption(const char *name) : minValueCount_(1), maxValueCount_(1), - name_(name), descr_(NULL), storeIsSet_(NULL) + name_(name), descr_(nullptr), storeIsSet_(nullptr) { } /*! \brief @@ -360,8 +360,8 @@ class OptionTemplate : public AbstractOption //! Initializes the name and default values for an option. explicit OptionTemplate(const char *name) : AbstractOption(name), - defaultValue_(NULL), defaultValueIfSet_(NULL), store_(NULL), - countptr_(NULL), storeVector_(NULL) + defaultValue_(nullptr), defaultValueIfSet_(nullptr), store_(nullptr), + countptr_(nullptr), storeVector_(nullptr) { } /*! \brief @@ -448,7 +448,7 @@ class OptionInfo template bool isType() const { - return toType() != NULL; + return toType() != nullptr; } /*! \brief * Convert the info object to a particular type if the type is correct. diff --git a/src/gromacs/options/basicoptions.cpp b/src/gromacs/options/basicoptions.cpp index 4e2d83eb8c..86022b3d75 100644 --- a/src/gromacs/options/basicoptions.cpp +++ b/src/gromacs/options/basicoptions.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -445,24 +445,24 @@ FloatOption::createStorage(const OptionManagerContainer & /*managers*/) const StringOptionStorage::StringOptionStorage(const StringOption &settings) : MyBase(settings), info_(this) { - if (settings.defaultEnumIndex_ >= 0 && settings.enumValues_ == NULL) + if (settings.defaultEnumIndex_ >= 0 && settings.enumValues_ == nullptr) { GMX_THROW(APIError("Cannot set default enum index without enum values")); } - if (settings.enumValues_ != NULL) + if (settings.enumValues_ != nullptr) { int count = settings.enumValuesCount_; if (count < 0) { count = 0; - while (settings.enumValues_[count] != NULL) + while (settings.enumValues_[count] != nullptr) { ++count; } } for (int i = 0; i < count; ++i) { - if (settings.enumValues_[i] == NULL) + if (settings.enumValues_[i] == nullptr) { GMX_THROW(APIError("Enumeration value cannot be NULL")); } @@ -475,7 +475,7 @@ StringOptionStorage::StringOptionStorage(const StringOption &settings) GMX_THROW(APIError("Default enumeration index is out of range")); } const std::string *defaultValue = settings.defaultValue(); - if (defaultValue != NULL && *defaultValue != allowed_[settings.defaultEnumIndex_]) + if (defaultValue != nullptr && *defaultValue != allowed_[settings.defaultEnumIndex_]) { GMX_THROW(APIError("Conflicting default values")); } @@ -558,7 +558,7 @@ EnumOptionStorage::EnumOptionStorage(const AbstractOption &settings, StorePointer store) : MyBase(settings, std::move(store)), info_(this) { - if (enumValues == NULL) + if (enumValues == nullptr) { GMX_THROW(APIError("Allowed values must be provided to EnumOption")); } @@ -566,14 +566,14 @@ EnumOptionStorage::EnumOptionStorage(const AbstractOption &settings, if (count < 0) { count = 0; - while (enumValues[count] != NULL) + while (enumValues[count] != nullptr) { ++count; } } for (int i = 0; i < count; ++i) { - if (enumValues[i] == NULL) + if (enumValues[i] == nullptr) { GMX_THROW(APIError("Enumeration value cannot be NULL")); } diff --git a/src/gromacs/options/basicoptions.h b/src/gromacs/options/basicoptions.h index 0976f2bcb4..9b96025ad3 100644 --- a/src/gromacs/options/basicoptions.h +++ b/src/gromacs/options/basicoptions.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -298,7 +298,7 @@ class StringOption : public OptionTemplate //! Initializes an option with the given name. explicit StringOption(const char *name) - : MyBase(name), enumValues_(NULL), enumValuesCount_(0), + : MyBase(name), enumValues_(nullptr), enumValuesCount_(0), defaultEnumIndex_(-1) { } @@ -515,7 +515,7 @@ class EnumOption : public OptionTemplate > //! Initializes an option with the given name. explicit EnumOption(const char *name) - : MyBase(name), enumValues_(NULL), enumValuesCount_(0) + : MyBase(name), enumValues_(nullptr), enumValuesCount_(0) { } @@ -564,7 +564,7 @@ class EnumOption : public OptionTemplate > //! Helper function to convert default values for storate initialization. static int convertToInt(const EnumType *defaultValue) { - return defaultValue != NULL ? static_cast(*defaultValue) : -1; + return defaultValue != nullptr ? static_cast(*defaultValue) : -1; } //! Creates a EnumOptionStorage object. diff --git a/src/gromacs/options/filenameoption.cpp b/src/gromacs/options/filenameoption.cpp index 746ea5d2f8..e1e431a88c 100644 --- a/src/gromacs/options/filenameoption.cpp +++ b/src/gromacs/options/filenameoption.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -141,7 +141,7 @@ class FileTypeHandler }; FileTypeHandler::FileTypeHandler(int fileType) - : fileType_(fileType), extensionCount_(0), genericTypes_(NULL) + : fileType_(fileType), extensionCount_(0), genericTypes_(nullptr) { if (fileType_ >= 0) { @@ -166,7 +166,7 @@ int FileTypeHandler::extensionCount() const const char *FileTypeHandler::extension(int i) const { GMX_ASSERT(i >= 0 && i < extensionCount_, "Invalid extension index"); - if (genericTypes_ != NULL) + if (genericTypes_ != nullptr) { return ftp2ext_with_dot(genericTypes_[i]); } @@ -176,7 +176,7 @@ const char *FileTypeHandler::extension(int i) const bool FileTypeHandler::isValidType(int fileType) const { - if (genericTypes_ != NULL) + if (genericTypes_ != nullptr) { for (int i = 0; i < extensionCount(); ++i) { @@ -240,7 +240,7 @@ FileNameOptionStorage::FileNameOptionStorage(const FileNameOption &settings, { defaultExtension_ = typeHandler.extension(0); } - if (settings.defaultBasename_ != NULL) + if (settings.defaultBasename_ != nullptr) { std::string defaultValue(settings.defaultBasename_); int type = fn2ftp(settings.defaultBasename_); @@ -319,7 +319,7 @@ void FileNameOptionStorage::initConverter(ConverterType * /*converter*/) std::string FileNameOptionStorage::processValue(const std::string &value) const { - if (manager_ != NULL) + if (manager_ != nullptr) { std::string processedValue = manager_->completeFileName(value, info_); if (!processedValue.empty()) @@ -377,7 +377,7 @@ std::string FileNameOptionStorage::processValue(const std::string &value) const void FileNameOptionStorage::processAll() { - if (manager_ != NULL && hasFlag(efOption_HasDefaultValue)) + if (manager_ != nullptr && hasFlag(efOption_HasDefaultValue)) { ArrayRef valueList = values(); GMX_RELEASE_ASSERT(valueList.size() == 1, diff --git a/src/gromacs/options/filenameoption.h b/src/gromacs/options/filenameoption.h index 478147ef97..b0a60ae547 100644 --- a/src/gromacs/options/filenameoption.h +++ b/src/gromacs/options/filenameoption.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -74,7 +74,7 @@ class FileNameOption : public OptionTemplate //! Initializes an option with the given name. explicit FileNameOption(const char *name) : MyBase(name), optionType_(eftUnknown), legacyType_(-1), - defaultBasename_(NULL), defaultType_(-1), + defaultBasename_(nullptr), defaultType_(-1), bLegacyOptionalBehavior_(false), bRead_(false), bWrite_(false), bLibrary_(false), bAllowMissing_(false) diff --git a/src/gromacs/options/optionmanagercontainer.h b/src/gromacs/options/optionmanagercontainer.h index cfecedaa58..b700f481f1 100644 --- a/src/gromacs/options/optionmanagercontainer.h +++ b/src/gromacs/options/optionmanagercontainer.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -96,13 +96,13 @@ class OptionManagerContainer template ManagerType *get() const { - ManagerType *result = NULL; + ManagerType *result = nullptr; for (ListType::const_iterator i = list_.begin(); i != list_.end(); ++i) { ManagerType *curr = dynamic_cast(*i); - if (curr != NULL) + if (curr != nullptr) { - GMX_RELEASE_ASSERT(result == NULL, + GMX_RELEASE_ASSERT(result == nullptr, "More than one applicable option manager is set"); result = curr; } diff --git a/src/gromacs/options/options.cpp b/src/gromacs/options/options.cpp index 4fdf0efd34..f063820c22 100644 --- a/src/gromacs/options/options.cpp +++ b/src/gromacs/options/options.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -111,7 +111,7 @@ OptionSectionImpl::addSectionImpl(const AbstractOptionSection §ion) { const char *name = section.name_; // Make sure that there are no duplicate sections. - GMX_RELEASE_ASSERT(findSection(name) == NULL, "Duplicate subsection name"); + GMX_RELEASE_ASSERT(findSection(name) == nullptr, "Duplicate subsection name"); std::unique_ptr storage(section.createStorage()); subsections_.push_back(SectionPointer(new OptionSectionImpl(managers_, std::move(storage), name))); return subsections_.back().get(); diff --git a/src/gromacs/options/optionsassigner.cpp b/src/gromacs/options/optionsassigner.cpp index 7763f25961..45cd89a555 100644 --- a/src/gromacs/options/optionsassigner.cpp +++ b/src/gromacs/options/optionsassigner.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -115,7 +115,7 @@ class OptionsAssigner::Impl OptionsAssigner::Impl::Impl(Options *options) : options_(*options), bAcceptBooleanNoPrefix_(false), - currentOption_(NULL), currentValueCount_(0), reverseBoolean_(false) + currentOption_(nullptr), currentValueCount_(0), reverseBoolean_(false) { sectionStack_.push_back(&options_.impl_->rootSection_); } @@ -123,22 +123,22 @@ OptionsAssigner::Impl::Impl(Options *options) AbstractOptionStorage * OptionsAssigner::Impl::findOption(const char *name) { - GMX_RELEASE_ASSERT(currentOption_ == NULL, + GMX_RELEASE_ASSERT(currentOption_ == nullptr, "Cannot search for another option while processing one"); const Section §ion = currentSection(); AbstractOptionStorage *option = section.findOption(name); - if (option == NULL && bAcceptBooleanNoPrefix_) + if (option == nullptr && bAcceptBooleanNoPrefix_) { if (name[0] == 'n' && name[1] == 'o') { option = section.findOption(name + 2); - if (option != NULL && option->isBoolean()) + if (option != nullptr && option->isBoolean()) { reverseBoolean_ = true; } else { - option = NULL; + option = nullptr; } } } @@ -171,7 +171,7 @@ void OptionsAssigner::start() void OptionsAssigner::startSection(const char *name) { Impl::Section *section = impl_->currentSection().findSection(name); - if (section == NULL) + if (section == nullptr) { GMX_THROW(InvalidInputError("Unknown subsection")); } @@ -189,9 +189,9 @@ void OptionsAssigner::startOption(const char *name) bool OptionsAssigner::tryStartOption(const char *name) { - GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called"); + GMX_RELEASE_ASSERT(impl_->currentOption_ == nullptr, "finishOption() not called"); AbstractOptionStorage *option = impl_->findOption(name); - if (option == NULL) + if (option == nullptr) { return false; } @@ -209,7 +209,7 @@ void OptionsAssigner::appendValue(const std::string &value) void OptionsAssigner::appendValue(const Variant &value) { AbstractOptionStorage *option = impl_->currentOption_; - GMX_RELEASE_ASSERT(option != NULL, "startOption() not called"); + GMX_RELEASE_ASSERT(option != nullptr, "startOption() not called"); ++impl_->currentValueCount_; option->appendValue(value); } @@ -217,7 +217,7 @@ void OptionsAssigner::appendValue(const Variant &value) void OptionsAssigner::finishOption() { AbstractOptionStorage *option = impl_->currentOption_; - GMX_RELEASE_ASSERT(option != NULL, "startOption() not called"); + GMX_RELEASE_ASSERT(option != nullptr, "startOption() not called"); bool bBoolReverseValue = false; if (option->isBoolean()) { @@ -231,7 +231,7 @@ void OptionsAssigner::finishOption() bBoolReverseValue = true; } } - impl_->currentOption_ = NULL; + impl_->currentOption_ = nullptr; impl_->reverseBoolean_ = false; option->finishSet(); if (bBoolReverseValue) @@ -251,7 +251,7 @@ void OptionsAssigner::finishSection() void OptionsAssigner::finish() { - GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called"); + GMX_RELEASE_ASSERT(impl_->currentOption_ == nullptr, "finishOption() not called"); GMX_RELEASE_ASSERT(!impl_->inSection(), "finishSection() not called"); } diff --git a/src/gromacs/options/optionstoragetemplate.h b/src/gromacs/options/optionstoragetemplate.h index 6ccc291515..2dae1aa9f4 100644 --- a/src/gromacs/options/optionstoragetemplate.h +++ b/src/gromacs/options/optionstoragetemplate.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -395,19 +395,19 @@ OptionStorageTemplate::OptionStorageTemplate(const OptionTemplate &sett settings.maxValueCount_ : settings.minValueCount_))) { if (hasFlag(efOption_NoDefaultValue) - && (settings.defaultValue_ != NULL - || settings.defaultValueIfSet_ != NULL)) + && (settings.defaultValue_ != nullptr + || settings.defaultValueIfSet_ != nullptr)) { GMX_THROW(APIError("Option does not support default value, but one is set")); } if (!hasFlag(efOption_NoDefaultValue)) { setFlag(efOption_HasDefaultValue); - if (settings.defaultValue_ != NULL) + if (settings.defaultValue_ != nullptr) { setDefaultValue(*settings.defaultValue_); } - if (settings.defaultValueIfSet_ != NULL) + if (settings.defaultValueIfSet_ != nullptr) { setDefaultValueIfSet(*settings.defaultValueIfSet_); } @@ -492,7 +492,7 @@ std::vector OptionStorageTemplate::defaultValuesAsStrings() cons if (result.empty() || (result.size() == 1 && result[0].empty())) { result.clear(); - if (defaultValueIfSet_.get() != NULL) + if (defaultValueIfSet_.get() != nullptr) { result.push_back(formatSingleValue(*defaultValueIfSet_)); } @@ -512,7 +512,7 @@ template void OptionStorageTemplate::processSet() { processSetValues(&setValues_); - if (setValues_.empty() && defaultValueIfSet_.get() != NULL) + if (setValues_.empty() && defaultValueIfSet_.get() != nullptr) { addValue(*defaultValueIfSet_); setFlag(efOption_HasDefaultValue); diff --git a/src/gromacs/options/optionsvisitor.h b/src/gromacs/options/optionsvisitor.h index e14856be77..0f1adf33df 100644 --- a/src/gromacs/options/optionsvisitor.h +++ b/src/gromacs/options/optionsvisitor.h @@ -214,7 +214,7 @@ class OptionsModifyingTypeVisitor : public OptionsModifyingVisitor virtual void visitOption(OptionInfo *option) { InfoType *subtype = option->toType(); - if (subtype != NULL) + if (subtype != nullptr) { visitOptionType(subtype); } diff --git a/src/gromacs/options/tests/optionsassigner.cpp b/src/gromacs/options/tests/optionsassigner.cpp index e13a17ecdb..e8de95d92f 100644 --- a/src/gromacs/options/tests/optionsassigner.cpp +++ b/src/gromacs/options/tests/optionsassigner.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -768,7 +768,7 @@ TEST(OptionsAssignerStringTest, HandlesEnumValueFromNullTerminatedArray) { gmx::Options options; std::string value; - const char * const allowed[] = { "none", "test", "value", NULL }; + const char * const allowed[] = { "none", "test", "value", nullptr }; using gmx::StringOption; ASSERT_NO_THROW(options.addOption( StringOption("p").store(&value) diff --git a/src/gromacs/options/timeunitmanager.cpp b/src/gromacs/options/timeunitmanager.cpp index 8136f80681..4a4e9af6f5 100644 --- a/src/gromacs/options/timeunitmanager.cpp +++ b/src/gromacs/options/timeunitmanager.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -123,7 +123,7 @@ double TimeUnitManager::inverseTimeScaleFactor() const */ TimeUnitBehavior::TimeUnitBehavior() - : timeUnit_(TimeUnit_Default), timeUnitStore_(NULL) + : timeUnit_(TimeUnit_Default), timeUnitStore_(nullptr) { } @@ -132,7 +132,7 @@ void TimeUnitBehavior::setTimeUnit(TimeUnit timeUnit) GMX_RELEASE_ASSERT(timeUnit >= 0 && timeUnit <= TimeUnit_s, "Invalid time unit"); timeUnit_ = timeUnit; - if (timeUnitStore_ != NULL) + if (timeUnitStore_ != nullptr) { *timeUnitStore_ = timeUnit; } @@ -147,7 +147,7 @@ void TimeUnitBehavior::setTimeUnitStore(TimeUnit *store) void TimeUnitBehavior::setTimeUnitFromEnvironment() { const char *const value = std::getenv("GMXTIMEUNIT"); - if (value != NULL) + if (value != nullptr) { ConstArrayRef timeUnits(g_timeUnits); ConstArrayRef::const_iterator i = @@ -216,7 +216,7 @@ void TimeUnitBehavior::optionsFinishing(Options *options) double factor = TimeUnitManager(timeUnit()).timeScaleFactor(); TimeOptionScaler(factor).visitSection(&options->rootSection()); TimeOptionScaler(factor).visitSection(&options->rootSection()); - if (timeUnitStore_ != NULL) + if (timeUnitStore_ != nullptr) { *timeUnitStore_ = static_cast(timeUnit_); } diff --git a/src/gromacs/pbcutil/boxutilities.cpp b/src/gromacs/pbcutil/boxutilities.cpp index b184267a7a..fd3c858611 100644 --- a/src/gromacs/pbcutil/boxutilities.cpp +++ b/src/gromacs/pbcutil/boxutilities.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -100,7 +100,7 @@ void preserve_box_shape(const t_inputrec *ir, matrix box_rel, matrix b) void set_box_rel(const t_inputrec *ir, t_state *state) { /* Make sure the box obeys the restrictions before we fix the ratios */ - correct_box(NULL, 0, state->box, NULL); + correct_box(nullptr, 0, state->box, nullptr); clear_mat(state->box_rel); diff --git a/src/gromacs/pbcutil/mshift.cpp b/src/gromacs/pbcutil/mshift.cpp index d551166a29..236848fcdc 100644 --- a/src/gromacs/pbcutil/mshift.cpp +++ b/src/gromacs/pbcutil/mshift.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -120,7 +120,7 @@ static void mk_igraph(t_graph *g, int ftype, const t_ilist *il, add_gbond(g, ia[1], ia[2]); add_gbond(g, ia[1], ia[3]); } - else if (part == NULL) + else if (part == nullptr) { /* Simply add this bond */ for (j = 1; j < np; j++) @@ -412,7 +412,7 @@ void mk_graph_ilist(FILE *fplog, { if (interaction_function[i].flags & IF_CHEMBOND) { - mk_igraph(g, i, &(ilist[i]), at_start, at_end, NULL); + mk_igraph(g, i, &(ilist[i]), at_start, at_end, nullptr); } } @@ -442,10 +442,10 @@ void mk_graph_ilist(FILE *fplog, else { /* This is a special thing used in splitter.c to generate shake-blocks */ - mk_igraph(g, F_CONSTR, &(ilist[F_CONSTR]), at_start, at_end, NULL); + mk_igraph(g, F_CONSTR, &(ilist[F_CONSTR]), at_start, at_end, nullptr); if (bSettle) { - mk_igraph(g, F_SETTLE, &(ilist[F_SETTLE]), at_start, at_end, NULL); + mk_igraph(g, F_SETTLE, &(ilist[F_SETTLE]), at_start, at_end, nullptr); } } g->nbound = 0; @@ -459,7 +459,7 @@ void mk_graph_ilist(FILE *fplog, } g->negc = 0; - g->egc = NULL; + g->egc = nullptr; sfree(nbond); diff --git a/src/gromacs/pbcutil/pbc-simd.cpp b/src/gromacs/pbcutil/pbc-simd.cpp index c56fa0f8c8..fb9addd565 100644 --- a/src/gromacs/pbcutil/pbc-simd.cpp +++ b/src/gromacs/pbcutil/pbc-simd.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -54,7 +54,7 @@ void set_pbc_simd(const t_pbc gmx_unused *pbc, real gmx_unused *pbc_simd) { #if GMX_SIMD_HAVE_REAL - if (pbc != NULL && pbc->ePBC != epbcNONE) + if (pbc != nullptr && pbc->ePBC != epbcNONE) { rvec inv_box_diag = {0, 0, 0}; diff --git a/src/gromacs/pbcutil/pbc.cpp b/src/gromacs/pbcutil/pbc.cpp index a793b2ba7a..e06e9ea174 100644 --- a/src/gromacs/pbcutil/pbc.cpp +++ b/src/gromacs/pbcutil/pbc.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -64,7 +64,7 @@ const char *epbc_names[epbcNR+1] = { - "xyz", "no", "xy", "screw", NULL + "xyz", "no", "xy", "screw", nullptr }; /* Skip 0 so we have more chance of detecting if we forgot to call set_pbc. */ @@ -140,7 +140,7 @@ const char *check_box(int ePBC, const matrix box) if (ePBC == epbcNONE) { - return NULL; + return nullptr; } if ((box[XX][YY] != 0) || (box[XX][ZZ] != 0) || (box[YY][ZZ] != 0)) @@ -160,7 +160,7 @@ const char *check_box(int ePBC, const matrix box) } else { - ptr = NULL; + ptr = nullptr; } return ptr; @@ -390,7 +390,7 @@ static void low_set_pbc(t_pbc *pbc, int ePBC, } else { - if (ePBC == epbcSCREW && NULL != dd_pbc) + if (ePBC == epbcSCREW && nullptr != dd_pbc) { /* This combinated should never appear here */ gmx_incons("low_set_pbc called with screw pbc and dd_nc != NULL"); @@ -612,7 +612,7 @@ void set_pbc(t_pbc *pbc, int ePBC, const matrix box) ePBC = guess_ePBC(box); } - low_set_pbc(pbc, ePBC, NULL, box); + low_set_pbc(pbc, ePBC, nullptr, box); } t_pbc *set_pbc_dd(t_pbc *pbc, int ePBC, @@ -623,12 +623,12 @@ t_pbc *set_pbc_dd(t_pbc *pbc, int ePBC, { pbc->ePBC = ePBC; - return NULL; + return nullptr; } if (nullptr == domdecCells) { - low_set_pbc(pbc, ePBC, NULL, box); + low_set_pbc(pbc, ePBC, nullptr, box); } else { @@ -661,7 +661,7 @@ t_pbc *set_pbc_dd(t_pbc *pbc, int ePBC, } } - return (pbc->ePBC != epbcNONE ? pbc : NULL); + return (pbc->ePBC != epbcNONE ? pbc : nullptr); } void pbc_dx(const t_pbc *pbc, const rvec x1, const rvec x2, rvec dx) diff --git a/src/gromacs/pbcutil/rmpbc.cpp b/src/gromacs/pbcutil/rmpbc.cpp index 0a8df5247c..baa8c0e197 100644 --- a/src/gromacs/pbcutil/rmpbc.cpp +++ b/src/gromacs/pbcutil/rmpbc.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -73,14 +73,14 @@ static t_graph *gmx_rmpbc_get_graph(gmx_rmpbc_t gpbc, int ePBC, int natoms) rmpbc_graph_t *gr; if (ePBC == epbcNONE - || NULL == gpbc - || NULL == gpbc->idef + || nullptr == gpbc + || nullptr == gpbc->idef || gpbc->idef->ntypes <= 0) { - return NULL; + return nullptr; } - gr = NULL; + gr = nullptr; for (i = 0; i < gpbc->ngraph; i++) { if (natoms == gpbc->graph[i].natoms) @@ -88,7 +88,7 @@ static t_graph *gmx_rmpbc_get_graph(gmx_rmpbc_t gpbc, int ePBC, int natoms) gr = &gpbc->graph[i]; } } - if (gr == NULL) + if (gr == nullptr) { /* We'd like to check with the number of atoms in the topology, * but we don't have that available. @@ -103,7 +103,7 @@ static t_graph *gmx_rmpbc_get_graph(gmx_rmpbc_t gpbc, int ePBC, int natoms) srenew(gpbc->graph, gpbc->ngraph); gr = &gpbc->graph[gpbc->ngraph-1]; gr->natoms = natoms; - gr->gr = mk_graph(NULL, gpbc->idef, 0, natoms, FALSE, FALSE); + gr->gr = mk_graph(nullptr, gpbc->idef, 0, natoms, FALSE, FALSE); } return gr->gr; @@ -140,14 +140,14 @@ void gmx_rmpbc_done(gmx_rmpbc_t gpbc) { int i; - if (NULL != gpbc) + if (nullptr != gpbc) { for (i = 0; i < gpbc->ngraph; i++) { done_graph(gpbc->graph[i].gr); sfree(gpbc->graph[i].gr); } - if (gpbc->graph != NULL) + if (gpbc->graph != nullptr) { sfree(gpbc->graph); } @@ -157,7 +157,7 @@ void gmx_rmpbc_done(gmx_rmpbc_t gpbc) static int gmx_rmpbc_ePBC(gmx_rmpbc_t gpbc, const matrix box) { - if (NULL != gpbc && gpbc->ePBC >= 0) + if (nullptr != gpbc && gpbc->ePBC >= 0) { return gpbc->ePBC; } @@ -174,7 +174,7 @@ void gmx_rmpbc(gmx_rmpbc_t gpbc, int natoms, const matrix box, rvec x[]) ePBC = gmx_rmpbc_ePBC(gpbc, box); gr = gmx_rmpbc_get_graph(gpbc, ePBC, natoms); - if (gr != NULL) + if (gr != nullptr) { mk_mshift(stdout, gr, ePBC, box, x); shift_self(gr, box, x); @@ -189,7 +189,7 @@ void gmx_rmpbc_copy(gmx_rmpbc_t gpbc, int natoms, const matrix box, rvec x[], rv ePBC = gmx_rmpbc_ePBC(gpbc, box); gr = gmx_rmpbc_get_graph(gpbc, ePBC, natoms); - if (gr != NULL) + if (gr != nullptr) { mk_mshift(stdout, gr, ePBC, box, x); shift_x(gr, box, x, x_s); @@ -212,7 +212,7 @@ void gmx_rmpbc_trxfr(gmx_rmpbc_t gpbc, t_trxframe *fr) { ePBC = gmx_rmpbc_ePBC(gpbc, fr->box); gr = gmx_rmpbc_get_graph(gpbc, ePBC, fr->natoms); - if (gr != NULL) + if (gr != nullptr) { mk_mshift(stdout, gr, ePBC, fr->box, fr->x); shift_self(gr, fr->box, fr->x); diff --git a/src/gromacs/pulling/pull.cpp b/src/gromacs/pulling/pull.cpp index de42a26d77..d430f8a609 100644 --- a/src/gromacs/pulling/pull.cpp +++ b/src/gromacs/pulling/pull.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -1327,7 +1327,7 @@ static void do_constraint(struct pull_t *pull, t_pbc *pbc, pcrd->f_scal = dr_tot[c]/((pull->group[pcrd->params.group[0]].invtm + pull->group[pcrd->params.group[1]].invtm)*dt*dt); - if (vir != NULL && pcrd->params.eGeom != epullgDIRPBC && bMaster) + if (vir != nullptr && pcrd->params.eGeom != epullgDIRPBC && bMaster) { double f_invr; @@ -1365,7 +1365,7 @@ static void add_virial_coord_dr(tensor vir, const dvec dr, const dvec f) /* Adds the pull contribution to the virial */ static void add_virial_coord(tensor vir, const pull_coord_work_t *pcrd) { - if (vir != NULL && pcrd->params.eGeom != epullgDIRPBC) + if (vir != nullptr && pcrd->params.eGeom != epullgDIRPBC) { /* Add the pull contribution for each distance vector to the virial. */ add_virial_coord_dr(vir, pcrd->dr01, pcrd->f01); @@ -1564,8 +1564,8 @@ void register_external_pull_potential(struct pull_t *pull, int coord_index, const char *provider) { - GMX_RELEASE_ASSERT(pull != NULL, "register_external_pull_potential called before init_pull"); - GMX_RELEASE_ASSERT(provider != NULL, "register_external_pull_potential called with NULL as provider name"); + GMX_RELEASE_ASSERT(pull != nullptr, "register_external_pull_potential called before init_pull"); + GMX_RELEASE_ASSERT(provider != nullptr, "register_external_pull_potential called with NULL as provider name"); if (coord_index < 0 || coord_index > pull->ncoord - 1) { @@ -1581,7 +1581,7 @@ void register_external_pull_potential(struct pull_t *pull, provider, coord_index + 1, epull_names[pcrd->params.eType], epull_names[epullEXTERNAL]); } - GMX_RELEASE_ASSERT(pcrd->params.externalPotentialProvider != NULL, "The external potential provider string for a pull coordinate is NULL"); + GMX_RELEASE_ASSERT(pcrd->params.externalPotentialProvider != nullptr, "The external potential provider string for a pull coordinate is NULL"); if (gmx_strcasecmp(provider, pcrd->params.externalPotentialProvider) != 0) { @@ -1702,7 +1702,7 @@ real pull_potential(struct pull_t *pull, t_mdatoms *md, t_pbc *pbc, { real dVdl = 0; - pull_calc_coms(cr, pull, md, pbc, t, x, NULL); + pull_calc_coms(cr, pull, md, pbc, t, x, nullptr); for (int c = 0; c < pull->ncoord; c++) { @@ -1714,7 +1714,7 @@ real pull_potential(struct pull_t *pull, t_mdatoms *md, t_pbc *pbc, } do_pull_pot_coord(pull, c, pbc, t, lambda, - &V, MASTER(cr) ? vir : NULL, &dVdl); + &V, MASTER(cr) ? vir : nullptr, &dVdl); /* Distribute the force over the atoms in the pulled groups */ apply_forces_coord(pull, c, md, f); @@ -1771,13 +1771,13 @@ static void make_local_pull_group(gmx_ga2la_t *ga2la, { pg->nalloc_loc = over_alloc_dd(pg->nat_loc+1); srenew(pg->ind_loc, pg->nalloc_loc); - if (pg->epgrppbc == epgrppbcCOS || pg->params.weight != NULL) + if (pg->epgrppbc == epgrppbcCOS || pg->params.weight != nullptr) { srenew(pg->weight_loc, pg->nalloc_loc); } } pg->ind_loc[pg->nat_loc] = ii; - if (pg->params.weight != NULL) + if (pg->params.weight != nullptr) { pg->weight_loc[pg->nat_loc] = pg->params.weight[i]; } @@ -1804,13 +1804,13 @@ void dd_make_local_pull_groups(t_commrec *cr, struct pull_t *pull, t_mdatoms *md } else { - ga2la = NULL; + ga2la = nullptr; } /* We always make the master node participate, such that it can do i/o * and to simplify MC type extensions people might have. */ - bMustParticipate = (comm->bParticipateAll || dd == NULL || DDMASTER(dd)); + bMustParticipate = (comm->bParticipateAll || dd == nullptr || DDMASTER(dd)); for (g = 0; g < pull->ngroup; g++) { @@ -1852,7 +1852,7 @@ void dd_make_local_pull_groups(t_commrec *cr, struct pull_t *pull, t_mdatoms *md (comm->bParticipate && comm->must_count >= comm->setup_count - history_count); - if (debug && dd != NULL) + if (debug && dd != nullptr) { fprintf(debug, "Our DD rank (%3d) pull #atoms>0 or master: %d, will be part %d\n", dd->rank, bMustParticipate, bWillParticipate); @@ -1933,8 +1933,8 @@ static void init_pull_group_index(FILE *fplog, t_commrec *cr, { pg->nat_loc = 0; pg->nalloc_loc = 0; - pg->ind_loc = NULL; - pg->weight_loc = NULL; + pg->ind_loc = nullptr; + pg->weight_loc = nullptr; } else { @@ -2007,7 +2007,7 @@ static void init_pull_group_index(FILE *fplog, t_commrec *cr, } else { - if (groups->grpnr[egcTC] == NULL) + if (groups->grpnr[egcTC] == nullptr) { mbd = ir->delta_t/ir->opts.tau_t[0]; } @@ -2099,8 +2099,8 @@ init_pull(FILE *fplog, const pull_params_t *pull_params, const t_inputrec *ir, /* Copy the pull parameters */ pull->params = *pull_params; /* Avoid pointer copies */ - pull->params.group = NULL; - pull->params.coord = NULL; + pull->params.group = nullptr; + pull->params.coord = nullptr; pull->ncoord = pull_params->ncoord; pull->ngroup = pull_params->ngroup; @@ -2389,7 +2389,7 @@ init_pull(FILE *fplog, const pull_params_t *pull_params, const t_inputrec *ir, } else { - if (pgrp->params.weight != NULL) + if (pgrp->params.weight != nullptr) { gmx_fatal(FARGS, "Pull groups can not have relative weights and cosine weighting at same time"); } @@ -2446,9 +2446,9 @@ init_pull(FILE *fplog, const pull_params_t *pull_params, const t_inputrec *ir, #if GMX_MPI /* Use a sub-communicator when we have more than 32 ranks */ - comm->bParticipateAll = (cr == NULL || !DOMAINDECOMP(cr) || + comm->bParticipateAll = (cr == nullptr || !DOMAINDECOMP(cr) || cr->dd->nnodes <= 32 || - getenv("GMX_PULL_PARTICIPATE_ALL") != NULL); + getenv("GMX_PULL_PARTICIPATE_ALL") != nullptr); /* This sub-commicator is not used with comm->bParticipateAll, * so we can always initialize it to NULL. */ @@ -2462,21 +2462,21 @@ init_pull(FILE *fplog, const pull_params_t *pull_params, const t_inputrec *ir, comm->setup_count = 0; comm->must_count = 0; - if (!comm->bParticipateAll && fplog != NULL) + if (!comm->bParticipateAll && fplog != nullptr) { fprintf(fplog, "Will use a sub-communicator for pull communication\n"); } - comm->rbuf = NULL; - comm->dbuf = NULL; - comm->dbuf_cyl = NULL; + comm->rbuf = nullptr; + comm->dbuf = nullptr; + comm->dbuf_cyl = nullptr; /* We still need to initialize the PBC reference coordinates */ pull->bSetPBCatoms = TRUE; /* Only do I/O when we are doing dynamics and if we are the MASTER */ - pull->out_x = NULL; - pull->out_f = NULL; + pull->out_x = nullptr; + pull->out_f = nullptr; if (bOutFile) { /* Check for px and pf filename collision, if we are writing diff --git a/src/gromacs/pulling/pull_rotation.cpp b/src/gromacs/pulling/pull_rotation.cpp index 7ebe0db0fb..8d8b685739 100644 --- a/src/gromacs/pulling/pull_rotation.cpp +++ b/src/gromacs/pulling/pull_rotation.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -266,7 +266,7 @@ static gmx_bool HavePotFitGroups(t_rot *rot) static double** allocate_square_matrix(int dim) { int i; - double** mat = NULL; + double** mat = nullptr; snew(mat, dim); @@ -665,7 +665,7 @@ static void get_slab_centers( } /* END of loop over slabs */ /* Output on the master */ - if ( (NULL != out_slabs) && bOutStep) + if ( (nullptr != out_slabs) && bOutStep) { fprintf(out_slabs, "%12.3e%6d", time, g); for (j = erg->slab_first; j <= erg->slab_last; j++) @@ -861,7 +861,7 @@ static FILE *open_rot_out(const char *fn, t_rot *rot, const gmx_output_env_t *oe char buf[50], buf2[75]; gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */ gmx_bool bFlex; - char *LegendStr = NULL; + char *LegendStr = nullptr; if (rot->enfrot->Flags & MD_APPENDFILES) @@ -1188,7 +1188,7 @@ static void align_with_z( int i, j, k; rvec zet = {0.0, 0.0, 1.0}; rvec rot_axis = {0.0, 0.0, 0.0}; - rvec *rotated_str = NULL; + rvec *rotated_str = nullptr; real ooanorm; real angle; matrix rotmat; @@ -1287,8 +1287,8 @@ static real opt_angle_analytic( rvec axis) { int i, j, k; - rvec *ref_s_1 = NULL; - rvec *act_s_1 = NULL; + rvec *ref_s_1 = nullptr; + rvec *act_s_1 = nullptr; rvec shift; double **Rmat, **RtR, **eigvec; double eigval[3]; @@ -1331,7 +1331,7 @@ static real opt_angle_analytic( } /* Weight positions with sqrt(weight) */ - if (NULL != weight) + if (nullptr != weight) { weigh_coords(ref_s_1, weight, natoms); weigh_coords(act_s_1, weight, natoms); @@ -1454,7 +1454,7 @@ static real opt_angle_analytic( static real flex_fit_angle(t_rotgrp *rotg) { int i; - rvec *fitcoords = NULL; + rvec *fitcoords = nullptr; rvec center; /* Center of positions passed to the fit routine */ real fitangle; /* Angle of the rotation group derived by fitting */ rvec coord; @@ -3283,7 +3283,7 @@ static void allocate_slabs( /* Remember how many we allocated */ erg->nslabs_alloc = nslabs; - if ( (NULL != fplog) && bVerbose) + if ( (nullptr != fplog) && bVerbose) { fprintf(fplog, "%s allocating memory to store data for %d slabs (rotation group %d).\n", RotStr, nslabs, g); @@ -3445,7 +3445,7 @@ static void init_rot_group(FILE *fplog, t_commrec *cr, int g, t_rotgrp *rotg, } else { - erg->PotAngleFit = NULL; + erg->PotAngleFit = nullptr; } /* xc_ref_ind needs to be set to identity in the serial case */ @@ -3662,10 +3662,10 @@ extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[ t_rot *rot; t_rotgrp *rotg; int g; - int nat_max = 0; /* Size of biggest rotation group */ - gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */ - gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */ - rvec *x_pbc = NULL; /* Space for the pbc-correct atom positions */ + int nat_max = 0; /* Size of biggest rotation group */ + gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */ + gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */ + rvec *x_pbc = nullptr; /* Space for the pbc-correct atom positions */ if (MASTER(cr) && bVerbose) @@ -3696,7 +3696,7 @@ extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[ /* Output every step for reruns */ if (er->Flags & MD_RERUN) { - if (NULL != fplog) + if (nullptr != fplog) { fprintf(fplog, "%s rerun - will write rotation output every available step.\n", RotStr); } @@ -3704,7 +3704,7 @@ extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[ rot->nstsout = 1; } - er->out_slabs = NULL; + er->out_slabs = nullptr; if (MASTER(cr) && HaveFlexibleGroups(rot) ) { er->out_slabs = open_slab_out(opt2fn("-rs", nfile, fnm), rot); @@ -3716,7 +3716,7 @@ extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[ * When ir->bContinuation=TRUE this has already been done, but ok. */ snew(x_pbc, mtop->natoms); copy_rvecn(x, x_pbc, 0, mtop->natoms); - do_pbc_first_mtop(NULL, ir->ePBC, box, mtop, x_pbc); + do_pbc_first_mtop(nullptr, ir->ePBC, box, mtop, x_pbc); /* All molecules will be whole now, but not necessarily in the home box. * Additionally, if a rotation group consists of more than one molecule * (e.g. two strands of DNA), each one of them can end up in a different @@ -3727,7 +3727,7 @@ extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[ { rotg = &rot->grp[g]; - if (NULL != fplog) + if (nullptr != fplog) { fprintf(fplog, "%s group %d type '%s'\n", RotStr, g, erotg_names[rotg->eType]); } @@ -3744,7 +3744,7 @@ extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[ { erg->nat_loc = 0; erg->nalloc_loc = 0; - erg->ind_loc = NULL; + erg->ind_loc = nullptr; } else { @@ -3773,14 +3773,14 @@ extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[ else { er->mpi_bufsize = 0; - er->mpi_inbuf = NULL; - er->mpi_outbuf = NULL; + er->mpi_inbuf = nullptr; + er->mpi_outbuf = nullptr; } /* Only do I/O on the MASTER */ - er->out_angles = NULL; - er->out_rot = NULL; - er->out_torque = NULL; + er->out_angles = nullptr; + er->out_rot = nullptr; + er->out_torque = nullptr; if (MASTER(cr)) { er->out_rot = open_rot_out(opt2fn("-ro", nfile, fnm), rot, oenv); @@ -3896,11 +3896,11 @@ extern void do_rotation( t_rotgrp *rotg; gmx_bool outstep_slab, outstep_rot; gmx_bool bColl; - gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */ - gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */ + gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */ + gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */ rvec transvec; - t_gmx_potfit *fit = NULL; /* For fit type 'potential' determine the fit - angle via the potential minimum */ + t_gmx_potfit *fit = nullptr; /* For fit type 'potential' determine the fit + angle via the potential minimum */ /* Enforced rotation cycle counting: */ gmx_cycles_t cycles_comp; /* Cycles for the enf. rotation computation diff --git a/src/gromacs/pulling/pullutil.cpp b/src/gromacs/pulling/pullutil.cpp index 661b5a4d88..0c62ff647f 100644 --- a/src/gromacs/pulling/pullutil.cpp +++ b/src/gromacs/pulling/pullutil.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -65,7 +65,7 @@ static void pull_reduce_real(t_commrec *cr, int n, real *data) { - if (cr != NULL && PAR(cr)) + if (cr != nullptr && PAR(cr)) { if (comm->bParticipateAll) { @@ -105,7 +105,7 @@ static void pull_reduce_double(t_commrec *cr, int n, double *data) { - if (cr != NULL && PAR(cr)) + if (cr != nullptr && PAR(cr)) { if (comm->bParticipateAll) { @@ -146,7 +146,7 @@ static void pull_set_pbcatom(t_commrec *cr, pull_group_work_t *pgrp, { int a; - if (cr != NULL && DOMAINDECOMP(cr)) + if (cr != nullptr && DOMAINDECOMP(cr)) { if (ga2la_get_home(cr->dd->ga2la, pgrp->params.pbcatom, &a)) { @@ -202,11 +202,11 @@ static void make_cyl_refgrps(t_commrec *cr, struct pull_t *pull, t_mdatoms *md, rvec g_x, dx, dir; double inv_cyl_r2; pull_comm_t *comm; - gmx_ga2la_t *ga2la = NULL; + gmx_ga2la_t *ga2la = nullptr; comm = &pull->comm; - if (comm->dbuf_cyl == NULL) + if (comm->dbuf_cyl == nullptr) { snew(comm->dbuf_cyl, pull->ncoord*stride); } @@ -346,7 +346,7 @@ static void make_cyl_refgrps(t_commrec *cr, struct pull_t *pull, t_mdatoms *md, comm->dbuf_cyl[c*stride+8] = radf_fac1[ZZ]; } - if (cr != NULL && PAR(cr)) + if (cr != nullptr && PAR(cr)) { /* Sum the contributions over the ranks */ pull_reduce_double(cr, comm, pull->ncoord*stride, comm->dbuf_cyl); @@ -439,7 +439,7 @@ static void sum_com_part(const pull_group_work_t *pgrp, { int ii = pgrp->ind_loc[i]; real wm; - if (pgrp->weight_loc == NULL) + if (pgrp->weight_loc == nullptr) { wm = mass[ii]; sum_wm += wm; @@ -530,7 +530,7 @@ static void sum_com_part_cosweight(const pull_group_work_t *pgrp, sum_csm += static_cast(cw*sw*m); sum_ssm += static_cast(sw*sw*m); - if (xp != NULL) + if (xp != nullptr) { real cw = std::cos(xp[ii][cosdim]*twopi_box); real sw = std::sin(xp[ii][cosdim]*twopi_box); @@ -559,11 +559,11 @@ void pull_calc_coms(t_commrec *cr, comm = &pull->comm; - if (comm->rbuf == NULL) + if (comm->rbuf == nullptr) { snew(comm->rbuf, pull->ngroup); } - if (comm->dbuf == NULL) + if (comm->dbuf == nullptr) { snew(comm->dbuf, 3*pull->ngroup); } @@ -572,7 +572,7 @@ void pull_calc_coms(t_commrec *cr, { pull_set_pbcatoms(cr, pull, x, comm->rbuf); - if (cr != NULL && DOMAINDECOMP(cr)) + if (cr != nullptr && DOMAINDECOMP(cr)) { /* We can keep these PBC reference coordinates fixed for nstlist * steps, since atoms won't jump over PBC. @@ -672,7 +672,7 @@ void pull_calc_coms(t_commrec *cr, } } - if (pgrp->weight_loc == NULL) + if (pgrp->weight_loc == nullptr) { sum_com->sum_wwm = sum_com->sum_wm; } diff --git a/src/gromacs/selection/compiler.cpp b/src/gromacs/selection/compiler.cpp index a35ac378a0..0d7833bcbb 100644 --- a/src/gromacs/selection/compiler.cpp +++ b/src/gromacs/selection/compiler.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -466,7 +466,7 @@ void SelectionTreeElement::freeCompilerData() } sfree(cdata); } - cdata = NULL; + cdata = nullptr; } } // namespace gmx @@ -628,7 +628,7 @@ init_pos_keyword_defaults(SelectionTreeElement *root, * reference positions use the whole residue/molecule. */ if (root->type == SEL_EXPRESSION) { - bool bSelection = (sel != NULL); + bool bSelection = (sel != nullptr); int flags = bSelection ? POS_COMPLMAX : POS_COMPLWHOLE; if (bSelection) { @@ -652,7 +652,7 @@ init_pos_keyword_defaults(SelectionTreeElement *root, if (root->type != SEL_ROOT && root->type != SEL_MODIFIER && root->type != SEL_SUBEXPRREF && root->type != SEL_SUBEXPR) { - sel = NULL; + sel = nullptr; } /* Recurse into children */ SelectionTreeElementPointer child = root->child; @@ -1247,7 +1247,7 @@ init_item_evaloutput(const SelectionTreeElementPointer &sel) { sel->evaluate = &_gmx_sel_evaluate_subexpr_staticeval; sel->cdata->evaluate = sel->evaluate; - sel->child->mempool = NULL; + sel->child->mempool = nullptr; sel->flags &= ~(SEL_ALLOCVAL | SEL_ALLOCDATA); if (sel->v.type == GROUP_VALUE || sel->v.type == POS_VALUE) { @@ -1620,7 +1620,7 @@ initialize_evalgrps(gmx_ana_selcollection_t *sc) if (root->child->type != SEL_SUBEXPR || (root->child->v.type != GROUP_VALUE && !(root->flags & SEL_ATOMVAL))) { - gmx_ana_index_set(&root->u.cgrp, -1, 0, 0); + gmx_ana_index_set(&root->u.cgrp, -1, nullptr, 0); } else if (root->child->cdata->flags & SEL_CDATA_FULLEVAL) { @@ -1746,8 +1746,8 @@ make_static(const SelectionTreeElementPointer &sel) sel->freeExpressionData(); /* Make the item static */ sel->type = SEL_CONST; - sel->evaluate = NULL; - sel->cdata->evaluate = NULL; + sel->evaluate = nullptr; + sel->cdata->evaluate = nullptr; /* Set the group value. * freeExpressionData() frees the cgrp group, so we can just override it. * */ @@ -1885,7 +1885,7 @@ init_method(const SelectionTreeElementPointer &sel, const gmx_mtop_t *top, int i sel->flags |= SEL_ALLOCDATA; for (i = 0; i < isize; ++i) { - if (sel->v.u.s[i] == NULL) + if (sel->v.u.s[i] == nullptr) { snew(sel->v.u.s[i], 2); } @@ -1932,7 +1932,7 @@ evaluate_boolean_static_part(gmx_sel_evaluate_t *data, child.reset(new SelectionTreeElement(SEL_CONST, SelectionLocation::createEmpty())); child->flags = SEL_FLAGSSET | SEL_SINGLEVAL | SEL_ALLOCVAL | SEL_ALLOCDATA; _gmx_selelem_set_vtype(child, GROUP_VALUE); - child->evaluate = NULL; + child->evaluate = nullptr; _gmx_selvalue_reserve(&child->v, 1); gmx_ana_index_copy(child->v.u.g, sel->v.u.g, true); init_item_compilerdata(child); @@ -1954,12 +1954,12 @@ evaluate_boolean_static_part(gmx_sel_evaluate_t *data, * If we reach here with a NOT expression, the NOT expression * is also static, and will be made a constant later, so don't waste * time copying the group. */ - child->evaluate = NULL; + child->evaluate = nullptr; if (sel->u.boolt == BOOL_NOT || ((sel->cdata->flags & SEL_CDATA_STATICEVAL) && sel->u.boolt == BOOL_OR)) { - child->cdata->evaluate = NULL; + child->cdata->evaluate = nullptr; } else { @@ -2381,10 +2381,10 @@ init_root_item(const SelectionTreeElementPointer &root, || ((root->child->cdata->flags & SEL_CDATA_SIMPLESUBEXPR) && !(root->child->cdata->flags & SEL_CDATA_FULLEVAL)))) { - root->evaluate = NULL; + root->evaluate = nullptr; if (root->cdata) { - root->cdata->evaluate = NULL; + root->cdata->evaluate = nullptr; } } @@ -2396,7 +2396,7 @@ init_root_item(const SelectionTreeElementPointer &root, if ((expr->flags & SEL_VARNUMVAL) || ((expr->flags & SEL_SINGLEVAL) && expr->v.type != GROUP_VALUE)) { - gmx_ana_index_set(&root->u.cgrp, -1, NULL, 0); + gmx_ana_index_set(&root->u.cgrp, -1, nullptr, 0); } else if (expr->cdata->gmax->isize == gall->isize) { @@ -2410,7 +2410,7 @@ init_root_item(const SelectionTreeElementPointer &root, /* For selections, store the maximum group for * gmx_ana_selcollection_evaluate_fin() as the value of the root * element (unused otherwise). */ - if (expr->type != SEL_SUBEXPR && expr->v.u.p->m.mapb.a != NULL) + if (expr->type != SEL_SUBEXPR && expr->v.u.p->m.mapb.a != nullptr) { SelectionTreeElementPointer child = expr; @@ -2539,7 +2539,7 @@ postprocess_item_subexpressions(const SelectionTreeElementPointer &sel) sel->cdata->evaluate = sel->evaluate; sel->child->freeValues(); - sel->child->mempool = NULL; + sel->child->mempool = nullptr; _gmx_selvalue_setstore(&sel->child->v, sel->v.u.ptr); sel->child->flags &= ~(SEL_ALLOCVAL | SEL_ALLOCDATA); } @@ -2579,8 +2579,8 @@ postprocess_item_subexpressions(const SelectionTreeElementPointer &sel) && (sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR) && (sel->cdata->flags & SEL_CDATA_STATICMULTIEVALSUBEXPR)) { - sel->evaluate = NULL; - sel->cdata->evaluate = NULL; + sel->evaluate = nullptr; + sel->cdata->evaluate = nullptr; } } @@ -2721,7 +2721,7 @@ SelectionCompiler::compile(SelectionCollection *coll) sc->mempool = _gmx_sel_mempool_create(); _gmx_sel_evaluate_init(&evaldata, sc->mempool, &sc->gall, - sc->top, NULL, NULL); + sc->top, nullptr, nullptr); /* Clear the symbol table because it is not possible to parse anything * after compilation, and variable references in the symbol table can @@ -2818,7 +2818,7 @@ SelectionCompiler::compile(SelectionCollection *coll) mark_subexpr_dynamic(item->child, true); } set_evaluation_function(item, &analyze_static); - item->evaluate(&evaldata, item, NULL); + item->evaluate(&evaldata, item, nullptr); item = item->next; } diff --git a/src/gromacs/selection/evaluate.cpp b/src/gromacs/selection/evaluate.cpp index 70e5fd1ddd..05a5d38537 100644 --- a/src/gromacs/selection/evaluate.cpp +++ b/src/gromacs/selection/evaluate.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -152,13 +152,13 @@ class MempoolGroupReserver * \param mp Memory pool from which to reserve memory. */ explicit MempoolGroupReserver(gmx_sel_mempool_t *mp) - : mp_(mp), g_(NULL) + : mp_(mp), g_(nullptr) { } //! Frees any memory allocated using this reserver. ~MempoolGroupReserver() { - if (g_ != NULL) + if (g_ != nullptr) { _gmx_sel_mempool_free_group(mp_, g_); } @@ -175,7 +175,7 @@ class MempoolGroupReserver */ void reserve(gmx_ana_index_t *g, int count) { - GMX_RELEASE_ASSERT(g_ == NULL, "Can only reserve one element with one instance"); + GMX_RELEASE_ASSERT(g_ == nullptr, "Can only reserve one element with one instance"); _gmx_sel_mempool_alloc_group(mp_, g, count); g_ = g; } @@ -198,7 +198,7 @@ class SelelemTemporaryValueAssigner public: //! Constructs an assigner without an initial assignment. SelelemTemporaryValueAssigner() - : old_ptr_(NULL), old_nalloc_(0) + : old_ptr_(nullptr), old_nalloc_(0) { } /*! \brief @@ -445,7 +445,7 @@ SelectionEvaluator::evaluate(SelectionCollection *coll, { /* Clear the evaluation group of subexpressions */ if (sel->child && sel->child->type == SEL_SUBEXPR - && sel->child->evaluate != NULL) + && sel->child->evaluate != nullptr) { sel->child->u.cgrp.isize = 0; /* Not strictly necessary, because the value will be overwritten @@ -461,7 +461,7 @@ SelectionEvaluator::evaluate(SelectionCollection *coll, } if (sel->evaluate) { - sel->evaluate(&data, sel, NULL); + sel->evaluate(&data, sel, nullptr); } sel = sel->next; } @@ -530,7 +530,7 @@ _gmx_sel_evaluate_root(gmx_sel_evaluate_t *data, } sel->child->evaluate(data, sel->child, - sel->u.cgrp.isize < 0 ? NULL : &sel->u.cgrp); + sel->u.cgrp.isize < 0 ? nullptr : &sel->u.cgrp); } void @@ -796,7 +796,7 @@ _gmx_sel_evaluate_subexprref(gmx_sel_evaluate_t *data, { int i, j; - if (g != NULL && sel->child->evaluate != NULL) + if (g != nullptr && sel->child->evaluate != nullptr) { sel->child->evaluate(data, sel->child, g); } @@ -931,7 +931,7 @@ _gmx_sel_evaluate_method_params(gmx_sel_evaluate_t *data, else { child->flags |= SEL_EVALFRAME; - child->evaluate(data, child, NULL); + child->evaluate(data, child, nullptr); } } child = child->next; @@ -1023,7 +1023,7 @@ _gmx_sel_evaluate_modifier(gmx_sel_evaluate_t *data, { GMX_THROW(gmx::NotImplementedError("Non-position valued modifiers not implemented")); } - sel->u.expr.method->pupdate(context, NULL, &sel->v, sel->u.expr.mdata); + sel->u.expr.method->pupdate(context, nullptr, &sel->v, sel->u.expr.mdata); } diff --git a/src/gromacs/selection/indexutil.cpp b/src/gromacs/selection/indexutil.cpp index 210d52d97b..d264b47bb6 100644 --- a/src/gromacs/selection/indexutil.cpp +++ b/src/gromacs/selection/indexutil.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -71,7 +71,7 @@ struct gmx_ana_indexgrps_t { //! Initializes an empty set of groups. - explicit gmx_ana_indexgrps_t(int nr) : nr(nr), g(NULL) + explicit gmx_ana_indexgrps_t(int nr) : nr(nr), g(nullptr) { names.reserve(nr); snew(g, nr); @@ -110,8 +110,8 @@ void gmx_ana_indexgrps_init(gmx_ana_indexgrps_t **g, gmx_mtop_t *top, const char *fnm) { - t_blocka *block = NULL; - char **names = NULL; + t_blocka *block = nullptr; + char **names = nullptr; if (fnm) { @@ -201,7 +201,7 @@ gmx_ana_indexgrps_get_grp(gmx_ana_indexgrps_t *g, int n) { if (n < 0 || n >= g->nr) { - return NULL; + return nullptr; } return &g->g[n]; } @@ -224,7 +224,7 @@ gmx_ana_indexgrps_extract(gmx_ana_index_t *dest, std::string *destName, return false; } - if (destName != NULL) + if (destName != nullptr) { *destName = src->names[n]; } @@ -324,7 +324,7 @@ void gmx_ana_index_clear(gmx_ana_index_t *g) { g->isize = 0; - g->index = NULL; + g->index = nullptr; g->nalloc_index = 0; } @@ -859,14 +859,14 @@ gmx_ana_index_make_block(t_blocka *t, const gmx_mtop_t *top, gmx_ana_index_t *g, t->index[0] = 0; t->index[1] = 0; t->nra = 0; - t->a = NULL; + t->a = nullptr; t->nalloc_a = 0; return; } // TODO: Check callers and either check these there as well, or turn these // into exceptions. - GMX_RELEASE_ASSERT(top != NULL || (type != INDEX_RES && type != INDEX_MOL), + GMX_RELEASE_ASSERT(top != nullptr || (type != INDEX_RES && type != INDEX_MOL), "Topology must be provided for residue or molecule blocks"); GMX_RELEASE_ASSERT(!(type == INDEX_MOL && top->mols.nr == 0), "Molecule information must be present for molecule blocks"); @@ -1168,19 +1168,19 @@ void gmx_ana_indexmap_clear(gmx_ana_indexmap_t *m) { m->type = INDEX_UNKNOWN; - m->refid = NULL; - m->mapid = NULL; + m->refid = nullptr; + m->mapid = nullptr; m->mapb.nr = 0; - m->mapb.index = NULL; + m->mapb.index = nullptr; m->mapb.nalloc_index = 0; m->mapb.nra = 0; - m->mapb.a = NULL; + m->mapb.a = nullptr; m->mapb.nalloc_a = 0; - m->orgid = NULL; + m->orgid = nullptr; m->b.nr = 0; - m->b.index = NULL; + m->b.index = nullptr; m->b.nra = 0; - m->b.a = NULL; + m->b.a = nullptr; m->b.nalloc_index = 0; m->b.nalloc_a = 0; m->bStatic = true; @@ -1255,7 +1255,7 @@ gmx_ana_indexmap_init_orgid_group(gmx_ana_indexmap_t *m, const gmx_mtop_t *top, GMX_RELEASE_ASSERT(m->bStatic, "Changing original IDs is not supported after starting " "to use the mapping"); - GMX_RELEASE_ASSERT(top != NULL || (type != INDEX_RES && type != INDEX_MOL), + GMX_RELEASE_ASSERT(top != nullptr || (type != INDEX_RES && type != INDEX_MOL), "Topology must be provided for residue or molecule blocks"); GMX_RELEASE_ASSERT(!(type == INDEX_MOL && top->mols.nr == 0), "Molecule information must be present for molecule blocks"); diff --git a/src/gromacs/selection/mempool.cpp b/src/gromacs/selection/mempool.cpp index 675932440f..20134991fb 100644 --- a/src/gromacs/selection/mempool.cpp +++ b/src/gromacs/selection/mempool.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2014, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2014,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -100,10 +100,10 @@ _gmx_sel_mempool_create() snew(mp, 1); mp->currsize = 0; mp->freesize = 0; - mp->buffer = NULL; - mp->freeptr = NULL; + mp->buffer = nullptr; + mp->freeptr = nullptr; mp->nblocks = 0; - mp->blockstack = NULL; + mp->blockstack = nullptr; mp->blockstack_nalloc = 0; mp->maxsize = 0; return mp; @@ -129,7 +129,7 @@ _gmx_sel_mempool_destroy(gmx_sel_mempool_t *mp) void * _gmx_sel_mempool_alloc(gmx_sel_mempool_t *mp, size_t size) { - void *ptr = NULL; + void *ptr = nullptr; size_t size_walign; size_walign = ((size + ALIGN_STEP - 1) / ALIGN_STEP) * ALIGN_STEP; @@ -175,7 +175,7 @@ _gmx_sel_mempool_free(gmx_sel_mempool_t *mp, void *ptr) { int size; - if (ptr == NULL) + if (ptr == nullptr) { return; } @@ -226,5 +226,5 @@ void _gmx_sel_mempool_free_group(gmx_sel_mempool_t *mp, gmx_ana_index_t *g) { _gmx_sel_mempool_free(mp, g->index); - g->index = NULL; + g->index = nullptr; } diff --git a/src/gromacs/selection/nbsearch.cpp b/src/gromacs/selection/nbsearch.cpp index ac0b921e44..9dcfa19d20 100644 --- a/src/gromacs/selection/nbsearch.cpp +++ b/src/gromacs/selection/nbsearch.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -323,11 +323,11 @@ class AnalysisNeighborhoodPairSearchImpl : search_(search) { testPosCount_ = 0; - testPositions_ = NULL; - testExclusionIds_ = NULL; - testIndices_ = NULL; + testPositions_ = nullptr; + testExclusionIds_ = nullptr; + testIndices_ = nullptr; nexcl_ = 0; - excl_ = NULL; + excl_ = nullptr; clear_rvec(xtest_); clear_rvec(testcell_); clear_ivec(currCell_); @@ -408,9 +408,9 @@ AnalysisNeighborhoodSearchImpl::AnalysisNeighborhoodSearchImpl(real cutoff) } bXY_ = false; nref_ = 0; - xref_ = NULL; - refExclusionIds_ = NULL; - refIndices_ = NULL; + xref_ = nullptr; + refExclusionIds_ = nullptr; + refIndices_ = nullptr; std::memset(&pbc_, 0, sizeof(pbc_)); bGrid_ = false; @@ -884,7 +884,7 @@ void AnalysisNeighborhoodSearchImpl::init( GMX_RELEASE_ASSERT(positions.index_ == -1, "Individual indexed positions not supported as reference"); bXY_ = bXY; - if (bXY_ && pbc != NULL && pbc->ePBC != epbcNONE) + if (bXY_ && pbc != nullptr && pbc->ePBC != epbcNONE) { if (pbc->ePBC != epbcXY && pbc->ePBC != epbcXYZ) { @@ -905,7 +905,7 @@ void AnalysisNeighborhoodSearchImpl::init( clear_rvec(box[ZZ]); set_pbc(&pbc_, epbcXY, box); } - else if (pbc != NULL) + else if (pbc != nullptr) { pbc_ = *pbc; } @@ -932,13 +932,13 @@ void AnalysisNeighborhoodSearchImpl::init( for (int i = 0; i < nref_; ++i) { - const int ii = (refIndices_ != NULL) ? refIndices_[i] : i; + const int ii = (refIndices_ != nullptr) ? refIndices_[i] : i; rvec refcell; mapPointToGridCell(positions.x_[ii], refcell, xrefAlloc_[i]); addToGridCell(refcell, i); } } - else if (refIndices_ != NULL) + else if (refIndices_ != nullptr) { xrefAlloc_.resize(nref_); xref_ = as_rvec_array(xrefAlloc_.data()); @@ -952,12 +952,12 @@ void AnalysisNeighborhoodSearchImpl::init( xref_ = positions.x_; } excls_ = excls; - refExclusionIds_ = NULL; - if (excls != NULL) + refExclusionIds_ = nullptr; + if (excls != nullptr) { // TODO: Check that the IDs are ascending, or remove the limitation. refExclusionIds_ = positions.exclusionIds_; - GMX_RELEASE_ASSERT(refExclusionIds_ != NULL, + GMX_RELEASE_ASSERT(refExclusionIds_ != nullptr, "Exclusion IDs must be set for reference positions " "when exclusions are enabled"); } @@ -973,7 +973,7 @@ void AnalysisNeighborhoodPairSearchImpl::reset(int testIndex) if (testIndex_ >= 0 && testIndex_ < testPosCount_) { const int index = - (testIndices_ != NULL ? testIndices_[testIndex] : testIndex); + (testIndices_ != nullptr ? testIndices_[testIndex] : testIndex); if (search_.bGrid_) { search_.mapPointToGridCell(testPositions_[index], testcell_, xtest_); @@ -985,7 +985,7 @@ void AnalysisNeighborhoodPairSearchImpl::reset(int testIndex) { copy_rvec(testPositions_[index], xtest_); } - if (search_.excls_ != NULL) + if (search_.excls_ != nullptr) { const int exclIndex = testExclusionIds_[index]; if (exclIndex < search_.excls_->nr) @@ -997,7 +997,7 @@ void AnalysisNeighborhoodPairSearchImpl::reset(int testIndex) else { nexcl_ = 0; - excl_ = NULL; + excl_ = nullptr; } } } @@ -1022,7 +1022,7 @@ bool AnalysisNeighborhoodPairSearchImpl::isExcluded(int j) if (exclind_ < nexcl_) { const int index = - (search_.refIndices_ != NULL ? search_.refIndices_[j] : j); + (search_.refIndices_ != nullptr ? search_.refIndices_[j] : j); const int refId = search_.refExclusionIds_[index]; while (exclind_ < nexcl_ && excl_[exclind_] < refId) { @@ -1044,7 +1044,7 @@ void AnalysisNeighborhoodPairSearchImpl::startSearch( testPositions_ = positions.x_; testExclusionIds_ = positions.exclusionIds_; testIndices_ = positions.indices_; - GMX_RELEASE_ASSERT(search_.excls_ == NULL || testExclusionIds_ != NULL, + GMX_RELEASE_ASSERT(search_.excls_ == nullptr || testExclusionIds_ != nullptr, "Exclusion IDs must be set when exclusions are enabled"); if (positions.index_ < 0) { @@ -1238,7 +1238,7 @@ class AnalysisNeighborhood::Impl typedef std::vector SearchList; Impl() - : cutoff_(0), excls_(NULL), mode_(eSearchMode_Automatic), bXY_(false) + : cutoff_(0), excls_(nullptr), mode_(eSearchMode_Automatic), bXY_(false) { } ~Impl() diff --git a/src/gromacs/selection/nbsearch.h b/src/gromacs/selection/nbsearch.h index cbd3fdc268..8a4c3a29db 100644 --- a/src/gromacs/selection/nbsearch.h +++ b/src/gromacs/selection/nbsearch.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -109,14 +109,14 @@ class AnalysisNeighborhoodPositions * to methods that accept positions. */ AnalysisNeighborhoodPositions(const rvec &x) - : count_(1), index_(-1), x_(&x), exclusionIds_(NULL), indices_(NULL) + : count_(1), index_(-1), x_(&x), exclusionIds_(nullptr), indices_(nullptr) { } /*! \brief * Initializes positions from an array of position vectors. */ AnalysisNeighborhoodPositions(const rvec x[], int count) - : count_(count), index_(-1), x_(x), exclusionIds_(NULL), indices_(NULL) + : count_(count), index_(-1), x_(x), exclusionIds_(nullptr), indices_(nullptr) { } /*! \brief @@ -124,7 +124,7 @@ class AnalysisNeighborhoodPositions */ AnalysisNeighborhoodPositions(const std::vector &x) : count_(x.size()), index_(-1), x_(as_rvec_array(x.data())), - exclusionIds_(NULL), indices_(NULL) + exclusionIds_(nullptr), indices_(nullptr) { } diff --git a/src/gromacs/selection/params.cpp b/src/gromacs/selection/params.cpp index b2a8ff61f2..4e69009cbe 100644 --- a/src/gromacs/selection/params.cpp +++ b/src/gromacs/selection/params.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -78,18 +78,18 @@ gmx_ana_selparam_find(const char *name, int nparam, gmx_ana_selparam_t *param) if (nparam == 0) { - return NULL; + return nullptr; } /* Find the first non-null parameter */ i = 0; - while (i < nparam && param[i].name == NULL) + while (i < nparam && param[i].name == nullptr) { ++i; } /* Process the special case of a NULL parameter */ - if (name == NULL) + if (name == nullptr) { - return (i == 0) ? NULL : ¶m[i-1]; + return (i == 0) ? nullptr : ¶m[i-1]; } for (; i < nparam; ++i) { @@ -105,7 +105,7 @@ gmx_ana_selparam_find(const char *name, int nparam, gmx_ana_selparam_t *param) return ¶m[i]; } } - return NULL; + return nullptr; } /*! \brief @@ -133,7 +133,7 @@ convert_value(SelectionParserValue *value, e_selvalue_t type, try { SelectionTreeElementPointer expr = - _gmx_sel_init_position(value->expr, NULL, scanner); + _gmx_sel_init_position(value->expr, nullptr, scanner); *value = SelectionParserValue::createExpr(expr); } catch (UserInputError &ex) @@ -309,8 +309,8 @@ parse_values_range(const SelectionParserValueList &values, param->flags &= ~SPAR_DYNAMIC; GMX_RELEASE_ASSERT(param->val.type == INT_VALUE || param->val.type == REAL_VALUE, "Invalid range parameter type"); - int *idata = NULL; - real *rdata = NULL; + int *idata = nullptr; + real *rdata = nullptr; sfree_guard dataGuard; if (param->val.type == INT_VALUE) { @@ -451,7 +451,7 @@ parse_values_range(const SelectionParserValueList &values, { *param->nvalptr = param->val.nr; } - param->nvalptr = NULL; + param->nvalptr = nullptr; } /*! \brief @@ -499,7 +499,7 @@ parse_values_varnum(const SelectionParserValueList &values, if (param->val.type == POS_VALUE) { gmx_ana_pos_reserve(param->val.u.p, valueCount, 0); - gmx_ana_indexmap_init(¶m->val.u.p->m, NULL, NULL, INDEX_UNKNOWN); + gmx_ana_indexmap_init(¶m->val.u.p->m, nullptr, nullptr, INDEX_UNKNOWN); gmx_ana_pos_set_nr(param->val.u.p, valueCount); } else @@ -586,7 +586,7 @@ parse_values_varnum(const SelectionParserValueList &values, { *param->nvalptr = param->val.nr; } - param->nvalptr = NULL; + param->nvalptr = nullptr; } /*! \brief @@ -685,7 +685,7 @@ parse_values_varnum_expr(const SelectionParserValueList &values, { *param->nvalptr = param->val.nr; } - param->nvalptr = NULL; + param->nvalptr = nullptr; return; } @@ -795,7 +795,7 @@ parse_values_std(const SelectionParserValueList &values, { *param->nvalptr = 1; } - param->nvalptr = NULL; + param->nvalptr = nullptr; if (param->val.type == INT_VALUE || param->val.type == REAL_VALUE || param->val.type == STR_VALUE) { @@ -914,7 +914,7 @@ parse_values_std(const SelectionParserValueList &values, { *param->nvalptr = param->val.nr; } - param->nvalptr = NULL; + param->nvalptr = nullptr; } /*! \brief @@ -998,7 +998,7 @@ parse_values_enum(const SelectionParserValueList &values, const std::string &svalue = value.stringValue(); int i = 1; int match = 0; - while (param->val.u.s[i] != NULL) + while (param->val.u.s[i] != nullptr) { if (startsWith(param->val.u.s[i], svalue)) { @@ -1088,19 +1088,19 @@ _gmx_sel_parse_params(const gmx::SelectionParserParameterList &pparams, if (params[i].val.type != POS_VALUE && (params[i].flags & (SPAR_VARNUM | SPAR_ATOMVAL))) { - GMX_RELEASE_ASSERT(params[i].val.u.ptr == NULL, + GMX_RELEASE_ASSERT(params[i].val.u.ptr == nullptr, "value pointer is not NULL " "although it should be for SPAR_VARNUM " "and SPAR_ATOMVAL parameters"); GMX_RELEASE_ASSERT(!((params[i].flags & SPAR_VARNUM) && (params[i].flags & SPAR_DYNAMIC)) - || params[i].nvalptr != NULL, + || params[i].nvalptr != nullptr, "nvalptr is NULL but both " "SPAR_VARNUM and SPAR_DYNAMIC are specified"); } else { - GMX_RELEASE_ASSERT(params[i].val.u.ptr != NULL, + GMX_RELEASE_ASSERT(params[i].val.u.ptr != nullptr, "value pointer is NULL"); } } @@ -1112,19 +1112,19 @@ _gmx_sel_parse_params(const gmx::SelectionParserParameterList &pparams, try { // Always assigned afterwards, but cppcheck does not see that. - gmx_ana_selparam_t *oparam = NULL; + gmx_ana_selparam_t *oparam = nullptr; /* Find the parameter and make some checks */ if (!pparam->name().empty()) { nullParamIndex = -1; oparam = gmx_ana_selparam_find(pparam->name().c_str(), nparam, params); - GMX_RELEASE_ASSERT(oparam != NULL, "Inconsistent selection parameter"); + GMX_RELEASE_ASSERT(oparam != nullptr, "Inconsistent selection parameter"); } else if (nullParamIndex >= 0) { oparam = ¶ms[nullParamIndex]; - if (oparam->name != NULL) + if (oparam->name != nullptr) { std::string text(_gmx_sel_lexer_get_text(scanner, pparam->location())); std::string message @@ -1210,7 +1210,7 @@ _gmx_sel_parse_params(const gmx::SelectionParserParameterList &pparams, if (!(params[i].flags & SPAR_OPTIONAL) && !(params[i].flags & SPAR_SET)) { std::string message; - if (params[i].name == NULL) + if (params[i].name == nullptr) { message = formatString("'%s' should be followed by a value/expression", root->name().c_str()); diff --git a/src/gromacs/selection/parser_internal.h b/src/gromacs/selection/parser_internal.h index f351d78763..ee2fc57029 100644 --- a/src/gromacs/selection/parser_internal.h +++ b/src/gromacs/selection/parser_internal.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -167,7 +167,7 @@ yyerror(YYLTYPE *location, yyscan_t scanner, char const *s) template static ValueType get(ValueType *src) { - GMX_RELEASE_ASSERT(src != NULL, "Semantic value pointers should be non-NULL"); + GMX_RELEASE_ASSERT(src != nullptr, "Semantic value pointers should be non-NULL"); const std::unique_ptr srcGuard(src); return ValueType(std::move(*src)); } diff --git a/src/gromacs/selection/parsetree.cpp b/src/gromacs/selection/parsetree.cpp index 4ca2010fe7..2db9ae1035 100644 --- a/src/gromacs/selection/parsetree.cpp +++ b/src/gromacs/selection/parsetree.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -282,10 +282,10 @@ _gmx_selparser_handle_exception(yyscan_t scanner, std::exception *ex) bool canContinue = false; gmx::GromacsException *gromacsException = dynamic_cast(ex); - if (gromacsException != NULL) + if (gromacsException != nullptr) { gromacsException->prependContext(formatCurrentErrorContext(scanner)); - canContinue = (dynamic_cast(ex) != NULL); + canContinue = (dynamic_cast(ex) != nullptr); } _gmx_sel_lexer_set_exception(scanner, std::current_exception()); return canContinue; @@ -312,7 +312,7 @@ _gmx_selparser_handle_error(yyscan_t scanner) ex.prependContext(context); gmx::TextWriter *statusWriter = _gmx_sel_lexer_get_status_writer(scanner); - if (statusWriter != NULL) + if (statusWriter != nullptr) { gmx::formatExceptionMessageToWriter(statusWriter, ex); return true; @@ -357,7 +357,7 @@ SelectionParserParameter::SelectionParserParameter( const char *name, SelectionParserValueListPointer values, const SelectionLocation &location) - : name_(name != NULL ? name : ""), location_(location), + : name_(name != nullptr ? name : ""), location_(location), values_(values ? std::move(values) : SelectionParserValueListPointer(new SelectionParserValueList)) { @@ -515,19 +515,19 @@ _gmx_selelem_init_method_params(const gmx::SelectionTreeElementPointer &sel, for (i = 0; i < nparams; ++i) { param[i].flags &= ~SPAR_SET; - _gmx_selvalue_setstore(¶m[i].val, NULL); + _gmx_selvalue_setstore(¶m[i].val, nullptr); if (param[i].flags & SPAR_VARNUM) { param[i].val.nr = -1; } /* Duplicate the enum value array if it is given statically */ - if ((param[i].flags & SPAR_ENUMVAL) && orgparam[i].val.u.ptr != NULL) + if ((param[i].flags & SPAR_ENUMVAL) && orgparam[i].val.u.ptr != nullptr) { int n; /* Count the values */ n = 1; - while (orgparam[i].val.u.s[n] != NULL) + while (orgparam[i].val.u.s[n] != nullptr) { ++n; } @@ -536,7 +536,7 @@ _gmx_selelem_init_method_params(const gmx::SelectionTreeElementPointer &sel, (n+1)*sizeof(param[i].val.u.s[0])); } } - mdata = NULL; + mdata = nullptr; if (sel->u.expr.method->init_data) { mdata = sel->u.expr.method->init_data(nparams, param); @@ -731,9 +731,9 @@ init_keyword_internal(gmx_ana_selmethod_t *method, } SelectionParserParameterList params; params.push_back( - SelectionParserParameter::createFromExpression(NULL, child)); + SelectionParserParameter::createFromExpression(nullptr, child)); params.push_back( - SelectionParserParameter::create(NULL, std::move(args), location)); + SelectionParserParameter::create(nullptr, std::move(args), location)); _gmx_sel_parse_params(params, root->u.expr.method->nparams, root->u.expr.method->param, root, scanner); } @@ -877,7 +877,7 @@ _gmx_sel_init_modifier(gmx_ana_selmethod_t *method, else { params->push_front( - SelectionParserParameter::createFromExpression(NULL, sel)); + SelectionParserParameter::createFromExpression(nullptr, sel)); root = modifier; } /* Process the parameters */ @@ -907,7 +907,7 @@ _gmx_sel_init_position(const gmx::SelectionTreeElementPointer &expr, _gmx_selelem_set_kwpos_type(root.get(), type); /* Create the parameters for the parameter parser. */ SelectionParserParameterList params; - params.push_back(SelectionParserParameter::createFromExpression(NULL, expr)); + params.push_back(SelectionParserParameter::createFromExpression(nullptr, expr)); /* Parse the parameters. */ _gmx_sel_parse_params(params, root->u.expr.method->nparams, root->u.expr.method->param, root, scanner); @@ -979,7 +979,7 @@ _gmx_sel_init_group_by_id(int id, yyscan_t scanner) SEL_GROUPREF, _gmx_sel_lexer_get_current_location(scanner))); _gmx_selelem_set_vtype(sel, GROUP_VALUE); sel->setName(gmx::formatString("group %d", id)); - sel->u.gref.name = NULL; + sel->u.gref.name = nullptr; sel->u.gref.id = id; if (_gmx_sel_lexer_has_groups_set(scanner)) @@ -1064,7 +1064,7 @@ _gmx_sel_init_selection(const char *name, /* Print out some information if the parser is interactive */ gmx::TextWriter *statusWriter = _gmx_sel_lexer_get_status_writer(scanner); - if (statusWriter != NULL) + if (statusWriter != nullptr) { const std::string message = gmx::formatString("Selection '%s' parsed", @@ -1134,7 +1134,7 @@ _gmx_sel_assign_variable(const char *name, sc->varstrs[sc->nvars] = gmx_strdup(pselstr); ++sc->nvars; gmx::TextWriter *statusWriter = _gmx_sel_lexer_get_status_writer(scanner); - if (statusWriter != NULL) + if (statusWriter != nullptr) { const std::string message = gmx::formatString("Variable '%s' parsed", pselstr); diff --git a/src/gromacs/selection/poscalc.cpp b/src/gromacs/selection/poscalc.cpp index 68ad13a2ac..6617cd7859 100644 --- a/src/gromacs/selection/poscalc.cpp +++ b/src/gromacs/selection/poscalc.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -244,7 +244,7 @@ const char * const gmx::PositionCalculationCollection::typeEnumValues[] = { "part_mol_com", "part_mol_cog", "dyn_res_com", "dyn_res_cog", "dyn_mol_com", "dyn_mol_cog", - NULL, + nullptr, }; /*! \brief @@ -371,7 +371,7 @@ PositionCalculationCollection::requiredTopologyInfoForType(const char *post, */ PositionCalculationCollection::Impl::Impl() - : top_(NULL), first_(NULL), last_(NULL), bInit_(false) + : top_(nullptr), first_(nullptr), last_(nullptr), bInit_(false) { } @@ -379,7 +379,7 @@ PositionCalculationCollection::Impl::~Impl() { // Loop backwards, because there can be internal references in that are // correctly handled by this direction. - while (last_ != NULL) + while (last_ != nullptr) { GMX_ASSERT(last_->refcount == 1, "Dangling references to position calculations"); @@ -392,11 +392,11 @@ PositionCalculationCollection::Impl::insertCalculation(gmx_ana_poscalc_t *pc, gmx_ana_poscalc_t *before) { GMX_RELEASE_ASSERT(pc->coll == this, "Inconsistent collections"); - if (before == NULL) + if (before == nullptr) { - pc->next = NULL; + pc->next = nullptr; pc->prev = last_; - if (last_ != NULL) + if (last_ != nullptr) { last_->next = pc; } @@ -412,7 +412,7 @@ PositionCalculationCollection::Impl::insertCalculation(gmx_ana_poscalc_t *pc, } before->prev = pc; } - if (pc->prev == NULL) + if (pc->prev == nullptr) { first_ = pc; } @@ -422,7 +422,7 @@ void PositionCalculationCollection::Impl::removeCalculation(gmx_ana_poscalc_t *pc) { GMX_RELEASE_ASSERT(pc->coll == this, "Inconsistent collections"); - if (pc->prev != NULL) + if (pc->prev != nullptr) { pc->prev->next = pc->next; } @@ -430,7 +430,7 @@ PositionCalculationCollection::Impl::removeCalculation(gmx_ana_poscalc_t *pc) { first_ = pc->next; } - if (pc->next != NULL) + if (pc->next != nullptr) { pc->next->prev = pc->prev; } @@ -438,7 +438,7 @@ PositionCalculationCollection::Impl::removeCalculation(gmx_ana_poscalc_t *pc) { last_ = pc->prev; } - pc->prev = pc->next = NULL; + pc->prev = pc->next = nullptr; } gmx_ana_poscalc_t * @@ -452,7 +452,7 @@ PositionCalculationCollection::Impl::createCalculation(e_poscalc_t type, int fla gmx_ana_poscalc_set_flags(pc, flags); pc->refcount = 1; pc->coll = this; - insertCalculation(pc, NULL); + insertCalculation(pc, nullptr); return pc; } @@ -1224,7 +1224,7 @@ gmx_ana_poscalc_update(gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p, } if (pc->sbase) { - gmx_ana_poscalc_update(pc->sbase, NULL, NULL, fr, pbc); + gmx_ana_poscalc_update(pc->sbase, nullptr, nullptr, fr, pbc); } if (!p) { diff --git a/src/gromacs/selection/position.cpp b/src/gromacs/selection/position.cpp index 1315d94aae..0e0499c98d 100644 --- a/src/gromacs/selection/position.cpp +++ b/src/gromacs/selection/position.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -52,9 +52,9 @@ gmx_ana_pos_t::gmx_ana_pos_t() { - x = NULL; - v = NULL; - f = NULL; + x = nullptr; + v = nullptr; + f = nullptr; gmx_ana_indexmap_clear(&m); nalloc_x = 0; } @@ -183,7 +183,7 @@ gmx_ana_pos_init_const(gmx_ana_pos_t *pos, const rvec x) copy_rvec(x, pos->x[0]); clear_rvec(pos->v[0]); clear_rvec(pos->f[0]); - gmx_ana_indexmap_init(&pos->m, NULL, NULL, INDEX_UNKNOWN); + gmx_ana_indexmap_init(&pos->m, nullptr, nullptr, INDEX_UNKNOWN); } /*! diff --git a/src/gromacs/selection/scanner_internal.cpp b/src/gromacs/selection/scanner_internal.cpp index da23df0453..5ff51acdf4 100644 --- a/src/gromacs/selection/scanner_internal.cpp +++ b/src/gromacs/selection/scanner_internal.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -89,7 +89,7 @@ init_param_token(YYSTYPE *yylval, gmx_ana_selparam_t *param, bool bBoolNo) { if (bBoolNo) { - GMX_RELEASE_ASSERT(param->name != NULL, + GMX_RELEASE_ASSERT(param->name != nullptr, "bBoolNo should only be set for a parameters with a name"); snew(yylval->str, strlen(param->name) + 3); yylval->str[0] = 'n'; @@ -98,7 +98,7 @@ init_param_token(YYSTYPE *yylval, gmx_ana_selparam_t *param, bool bBoolNo) } else { - yylval->str = param->name ? gmx_strdup(param->name) : NULL; + yylval->str = param->name ? gmx_strdup(param->name) : nullptr; } return PARAM; } @@ -117,7 +117,7 @@ init_method_token(YYSTYPE *yylval, YYLTYPE *yylloc, if (!bPosMod && method->type != POS_VALUE) { state->nextMethodSymbol = symbol; - _gmx_sel_lexer_add_token(yylloc, NULL, 0, state); + _gmx_sel_lexer_add_token(yylloc, nullptr, 0, state); return EMPTY_POSMOD; } _gmx_sel_lexer_add_token(yylloc, symbol->name().c_str(), -1, state); @@ -144,14 +144,14 @@ init_method_token(YYSTYPE *yylval, YYLTYPE *yylloc, { /* Remove all methods from the stack */ state->msp = -1; - if (method->param[1].name == NULL) + if (method->param[1].name == nullptr) { state->nextparam = &method->param[1]; } } else { - if (method->param[0].name == NULL) + if (method->param[0].name == nullptr) { state->nextparam = &method->param[0]; } @@ -193,10 +193,10 @@ _gmx_sel_lexer_process_pending(YYSTYPE *yylval, YYLTYPE *yylloc, if (state->neom > 0) { --state->neom; - _gmx_sel_lexer_add_token(yylloc, NULL, 0, state); + _gmx_sel_lexer_add_token(yylloc, nullptr, 0, state); return END_OF_METHOD; } - state->nextparam = NULL; + state->nextparam = nullptr; state->bBoolNo = false; _gmx_sel_lexer_add_token(yylloc, param->name, -1, state); return init_param_token(yylval, param, bBoolNo); @@ -208,7 +208,7 @@ _gmx_sel_lexer_process_pending(YYSTYPE *yylval, YYLTYPE *yylloc, if (state->nextMethodSymbol) { const gmx::SelectionParserSymbol *symbol = state->nextMethodSymbol; - state->nextMethodSymbol = NULL; + state->nextMethodSymbol = nullptr; return init_method_token(yylval, yylloc, symbol, true, state); } return 0; @@ -222,7 +222,7 @@ _gmx_sel_lexer_process_identifier(YYSTYPE *yylval, YYLTYPE *yylloc, /* Check if the identifier matches with a parameter name */ if (state->msp >= 0) { - gmx_ana_selparam_t *param = NULL; + gmx_ana_selparam_t *param = nullptr; bool bBoolNo = false; int sp = state->msp; while (!param && sp >= 0) @@ -231,7 +231,7 @@ _gmx_sel_lexer_process_identifier(YYSTYPE *yylval, YYLTYPE *yylloc, for (i = 0; i < state->mstack[sp]->nparams; ++i) { /* Skip NULL parameters and too long parameters */ - if (state->mstack[sp]->param[i].name == NULL + if (state->mstack[sp]->param[i].name == nullptr || strlen(state->mstack[sp]->param[i].name) > yyleng) { continue; @@ -400,8 +400,8 @@ _gmx_sel_init_lexer(yyscan_t *scannerp, struct gmx_ana_selcollection_t *sc, state->mstack_alloc = 20; state->msp = -1; state->neom = 0; - state->nextparam = NULL; - state->nextMethodSymbol = NULL; + state->nextparam = nullptr; + state->nextMethodSymbol = nullptr; state->prev_pos_kw = 0; state->bBoolNo = false; state->bMatchOf = false; diff --git a/src/gromacs/selection/selection.cpp b/src/gromacs/selection/selection.cpp index d1ec9e623c..3032cf58ae 100644 --- a/src/gromacs/selection/selection.cpp +++ b/src/gromacs/selection/selection.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -209,7 +209,7 @@ SelectionData::initializeMassesAndCharges(const gmx_mtop_t *top) "Should not be called more than once"); posMass_.reserve(posCount()); posCharge_.reserve(posCount()); - if (top == NULL) + if (top == nullptr) { posMass_.resize(posCount(), 1.0); posCharge_.resize(posCount(), 0.0); @@ -224,7 +224,7 @@ SelectionData::initializeMassesAndCharges(const gmx_mtop_t *top) void SelectionData::refreshMassesAndCharges(const gmx_mtop_t *top) { - if (top != NULL && isDynamic() && !hasFlag(efSelection_DynamicMask)) + if (top != nullptr && isDynamic() && !hasFlag(efSelection_DynamicMask)) { computeMassesAndCharges(top, rawPositions_, &posMass_, &posCharge_); } diff --git a/src/gromacs/selection/selection.h b/src/gromacs/selection/selection.h index 1b9df4157d..3ff3dadeff 100644 --- a/src/gromacs/selection/selection.h +++ b/src/gromacs/selection/selection.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -294,7 +294,7 @@ class Selection * assigned results in undefined behavior. * isValid() returns `false` for the selection until it is initialized. */ - Selection() : sel_(NULL) {} + Selection() : sel_(nullptr) {} /*! \brief * Creates a new selection object. * @@ -305,7 +305,7 @@ class Selection explicit Selection(internal::SelectionData *sel) : sel_(sel) {} //! Returns whether the selection object is initialized. - bool isValid() const { return sel_ != NULL; } + bool isValid() const { return sel_ != nullptr; } //! Returns whether two selection objects wrap the same selection. bool operator==(const Selection &other) const @@ -352,7 +352,7 @@ class Selection return constArrayRefFromArray(data().rawPositions_.x, posCount()); } //! Returns whether velocities are available for this selection. - bool hasVelocities() const { return data().rawPositions_.v != NULL; } + bool hasVelocities() const { return data().rawPositions_.v != nullptr; } /*! \brief * Returns velocities for this selection as a continuous array. * @@ -364,7 +364,7 @@ class Selection return constArrayRefFromArray(data().rawPositions_.v, posCount()); } //! Returns whether forces are available for this selection. - bool hasForces() const { return sel_->rawPositions_.f != NULL; } + bool hasForces() const { return sel_->rawPositions_.f != nullptr; } /*! \brief * Returns forces for this selection as a continuous array. * @@ -691,7 +691,7 @@ class SelectionPosition ConstArrayRef atomIndices() const { const int *atoms = sel_->rawPositions_.m.mapb.a; - if (atoms == NULL) + if (atoms == nullptr) { return ConstArrayRef(); } diff --git a/src/gromacs/selection/selectioncollection.cpp b/src/gromacs/selection/selectioncollection.cpp index ccb1e98dd3..7b9b17073d 100644 --- a/src/gromacs/selection/selectioncollection.cpp +++ b/src/gromacs/selection/selectioncollection.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -84,13 +84,13 @@ namespace gmx */ SelectionCollection::Impl::Impl() - : debugLevel_(0), bExternalGroupsSet_(false), grps_(NULL) + : debugLevel_(0), bExternalGroupsSet_(false), grps_(nullptr) { sc_.nvars = 0; - sc_.varstrs = NULL; - sc_.top = NULL; + sc_.varstrs = nullptr; + sc_.top = nullptr; gmx_ana_index_clear(&sc_.gall); - sc_.mempool = NULL; + sc_.mempool = nullptr; sc_.symtab.reset(new SelectionParserSymbolTable); gmx_ana_index_clear(&requiredAtoms_); gmx_ana_selmethod_register_defaults(sc_.symtab.get()); @@ -141,7 +141,7 @@ namespace bool promptLine(TextInputStream *inputStream, TextWriter *statusWriter, std::string *line) { - if (statusWriter != NULL) + if (statusWriter != nullptr) { statusWriter->writeString("> "); } @@ -152,7 +152,7 @@ bool promptLine(TextInputStream *inputStream, TextWriter *statusWriter, while (endsWith(*line, "\\\n")) { line->resize(line->length() - 2); - if (statusWriter != NULL) + if (statusWriter != nullptr) { statusWriter->writeString("... "); } @@ -166,7 +166,7 @@ bool promptLine(TextInputStream *inputStream, TextWriter *statusWriter, { line->resize(line->length() - 1); } - else if (statusWriter != NULL) + else if (statusWriter != nullptr) { statusWriter->writeLine(); } @@ -223,7 +223,7 @@ void printCurrentStatus(TextWriter *writer, gmx_ana_selcollection_t *sc, gmx_ana_indexgrps_t *grps, size_t firstSelection, int maxCount, const std::string &context, bool bFirst) { - if (grps != NULL) + if (grps != nullptr) { writer->writeLine("Available static index groups:"); gmx_ana_indexgrps_print(writer, grps, 0); @@ -284,7 +284,7 @@ void printCurrentStatus(TextWriter *writer, gmx_ana_selcollection_t *sc, void printHelp(TextWriter *writer, gmx_ana_selcollection_t *sc, const std::string &line) { - if (sc->rootHelp.get() == NULL) + if (sc->rootHelp.get() == nullptr) { sc->rootHelp = createSelectionHelpTopic(); } @@ -341,7 +341,7 @@ SelectionList runParser(yyscan_t scanner, TextInputStream *inputStream, if (bInteractive) { TextWriter *statusWriter = _gmx_sel_lexer_get_status_writer(scanner); - if (statusWriter != NULL) + if (statusWriter != nullptr) { printCurrentStatus(statusWriter, sc, grps, oldCount, maxnr, context, true); } @@ -349,7 +349,7 @@ SelectionList runParser(yyscan_t scanner, TextInputStream *inputStream, int status; while (promptLine(inputStream, statusWriter, &line)) { - if (statusWriter != NULL) + if (statusWriter != nullptr) { line = stripString(line); if (line.empty()) @@ -376,7 +376,7 @@ SelectionList runParser(yyscan_t scanner, TextInputStream *inputStream, } { YYLTYPE location; - status = _gmx_sel_yypush_parse(parserState.get(), 0, NULL, + status = _gmx_sel_yypush_parse(parserState.get(), 0, nullptr, &location, scanner); } // TODO: Remove added selections from the collection if parsing failed? @@ -454,7 +454,7 @@ void checkExternalGroups(const SelectionTreeElementPointer &root, void checkTopologyProperties(const gmx_mtop_t *top, const SelectionTopologyProperties &props) { - if (top == NULL) + if (top == nullptr) { if (props.hasAny()) { @@ -583,7 +583,7 @@ SelectionCollection::initOptions(IOptionsContainer *options, void SelectionCollection::setReferencePosType(const char *type) { - GMX_RELEASE_ASSERT(type != NULL, "Cannot assign NULL position type"); + GMX_RELEASE_ASSERT(type != nullptr, "Cannot assign NULL position type"); // Check that the type is valid, throw if it is not. e_poscalc_t dummytype; int dummyflags; @@ -595,7 +595,7 @@ SelectionCollection::setReferencePosType(const char *type) void SelectionCollection::setOutputPosType(const char *type) { - GMX_RELEASE_ASSERT(type != NULL, "Cannot assign NULL position type"); + GMX_RELEASE_ASSERT(type != nullptr, "Cannot assign NULL position type"); // Check that the type is valid, throw if it is not. e_poscalc_t dummytype; int dummyflags; @@ -614,7 +614,7 @@ SelectionCollection::setDebugLevel(int debugLevel) void SelectionCollection::setTopology(gmx_mtop_t *top, int natoms) { - GMX_RELEASE_ASSERT(natoms > 0 || top != NULL, + GMX_RELEASE_ASSERT(natoms > 0 || top != nullptr, "The number of atoms must be given if there is no topology"); checkTopologyProperties(top, requiredTopologyProperties()); // Get the number of atoms from the topology if it is not given. @@ -647,7 +647,7 @@ SelectionCollection::setTopology(gmx_mtop_t *top, int natoms) void SelectionCollection::setIndexGroups(gmx_ana_indexgrps_t *grps) { - GMX_RELEASE_ASSERT(grps == NULL || !impl_->bExternalGroupsSet_, + GMX_RELEASE_ASSERT(grps == nullptr || !impl_->bExternalGroupsSet_, "Can only set external groups once or clear them afterwards"); impl_->grps_ = grps; impl_->bExternalGroupsSet_ = true; @@ -712,7 +712,7 @@ SelectionCollection::parseFromStdin(int count, bool bInteractive, const std::string &context) { return parseInteractive(count, &StandardInputStream::instance(), - bInteractive ? &TextOutputFile::standardError() : NULL, + bInteractive ? &TextOutputFile::standardError() : nullptr, context); } @@ -723,7 +723,7 @@ namespace std::unique_ptr initStatusWriter(TextOutputStream *statusStream) { std::unique_ptr statusWriter; - if (statusStream != NULL) + if (statusStream != nullptr) { statusWriter.reset(new TextWriter(statusStream)); statusWriter->wrapperSettings().setLineLength(78); @@ -758,11 +758,11 @@ SelectionCollection::parseFromFile(const std::string &filename) yyscan_t scanner; TextInputFile file(filename); // TODO: Exception-safe way of using the lexer. - _gmx_sel_init_lexer(&scanner, &impl_->sc_, NULL, -1, + _gmx_sel_init_lexer(&scanner, &impl_->sc_, nullptr, -1, impl_->bExternalGroupsSet_, impl_->grps_); _gmx_sel_set_lex_input_file(scanner, file.handle()); - return runParser(scanner, NULL, false, -1, std::string()); + return runParser(scanner, nullptr, false, -1, std::string()); } catch (GromacsException &ex) { @@ -779,11 +779,11 @@ SelectionCollection::parseFromString(const std::string &str) { yyscan_t scanner; - _gmx_sel_init_lexer(&scanner, &impl_->sc_, NULL, -1, + _gmx_sel_init_lexer(&scanner, &impl_->sc_, nullptr, -1, impl_->bExternalGroupsSet_, impl_->grps_); _gmx_sel_set_lex_input_str(scanner, str.c_str()); - return runParser(scanner, NULL, false, -1, std::string()); + return runParser(scanner, nullptr, false, -1, std::string()); } @@ -793,7 +793,7 @@ SelectionCollection::compile() checkTopologyProperties(impl_->sc_.top, requiredTopologyProperties()); if (!impl_->bExternalGroupsSet_) { - setIndexGroups(NULL); + setIndexGroups(nullptr); } if (impl_->debugLevel_ >= 1) { diff --git a/src/gromacs/selection/selectionoption.cpp b/src/gromacs/selection/selectionoption.cpp index 1343907baa..b9ccda569b 100644 --- a/src/gromacs/selection/selectionoption.cpp +++ b/src/gromacs/selection/selectionoption.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -70,7 +70,7 @@ SelectionOptionStorage::SelectionOptionStorage(const SelectionOption &settings, info_(this), manager_(*manager), defaultText_(settings.defaultText_), selectionFlags_(settings.selectionFlags_) { - GMX_RELEASE_ASSERT(manager != NULL, + GMX_RELEASE_ASSERT(manager != nullptr, "SelectionOptionManager must be added before SelectionOption"); GMX_RELEASE_ASSERT(!hasFlag(efOption_MultipleTimes), "allowMultiple() is not supported for selection options"); @@ -278,7 +278,7 @@ SelectionFileOptionStorage::SelectionFileOptionStorage( | efOption_DontCheckMinimumCount), info_(this), manager_(*manager), bValueParsed_(false) { - GMX_RELEASE_ASSERT(manager != NULL, + GMX_RELEASE_ASSERT(manager != nullptr, "SelectionOptionManager must be added before SelectionFileOption"); } diff --git a/src/gromacs/selection/selectionoptionbehavior.cpp b/src/gromacs/selection/selectionoptionbehavior.cpp index 8de8667f1b..f188638646 100644 --- a/src/gromacs/selection/selectionoptionbehavior.cpp +++ b/src/gromacs/selection/selectionoptionbehavior.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -80,12 +80,12 @@ class SelectionOptionBehavior::Impl Impl(SelectionCollection *selections, ITopologyProvider *topologyProvider) : selections_(*selections), topologyProvider_(*topologyProvider), - manager_(selections), grps_(NULL) + manager_(selections), grps_(nullptr) { } ~Impl() { - if (grps_ != NULL) + if (grps_ != nullptr) { gmx_ana_indexgrps_free(grps_); } @@ -109,27 +109,27 @@ class SelectionOptionBehavior::Impl " %s\n(with -n), but it was not used by any selection.\n", ndxfile_.c_str()); } - selections_.setIndexGroups(NULL); + selections_.setIndexGroups(nullptr); return; } if (ndxfile_.empty()) { gmx_mtop_t *top = topologyProvider_.getTopology(false); - gmx_ana_indexgrps_init(&grps_, top, NULL); + gmx_ana_indexgrps_init(&grps_, top, nullptr); } else { - gmx_ana_indexgrps_init(&grps_, NULL, ndxfile_.c_str()); + gmx_ana_indexgrps_init(&grps_, nullptr, ndxfile_.c_str()); } selections_.setIndexGroups(grps_); } void doneIndexGroups() { - if (grps_ != NULL) + if (grps_ != nullptr) { - selections_.setIndexGroups(NULL); + selections_.setIndexGroups(nullptr); gmx_ana_indexgrps_free(grps_); - grps_ = NULL; + grps_ = nullptr; } } @@ -138,7 +138,7 @@ class SelectionOptionBehavior::Impl const bool topRequired = selections_.requiredTopologyProperties().needsTopology; gmx_mtop_t *top = topologyProvider_.getTopology(topRequired); int natoms = -1; - if (top == NULL) + if (top == nullptr) { natoms = topologyProvider_.getAtomCount(); } diff --git a/src/gromacs/selection/selelem.cpp b/src/gromacs/selection/selelem.cpp index 2c81620370..43553d4bc9 100644 --- a/src/gromacs/selection/selelem.cpp +++ b/src/gromacs/selection/selelem.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -69,7 +69,7 @@ const char * _gmx_selelem_type_str(const gmx::SelectionTreeElement &sel) { - const char *p = NULL; + const char *p = nullptr; switch (sel.type) { case SEL_CONST: p = "CONST"; break; @@ -97,7 +97,7 @@ _gmx_selelem_type_str(const gmx::SelectionTreeElement &sel) const char * _gmx_sel_value_type_str(const gmx_ana_selvalue_t *val) { - const char *p = NULL; + const char *p = nullptr; switch (val->type) { case NO_VALUE: p = "NONE"; break; @@ -116,7 +116,7 @@ _gmx_sel_value_type_str(const gmx_ana_selvalue_t *val) const char * _gmx_selelem_boolean_type_str(const gmx::SelectionTreeElement &sel) { - const char *p = NULL; + const char *p = nullptr; switch (sel.u.boolt) { case BOOL_NOT: p = "NOT"; break; @@ -151,9 +151,9 @@ SelectionTreeElement::SelectionTreeElement(e_selelem_t type, } _gmx_selvalue_clear(&this->v); std::memset(&this->u, 0, sizeof(this->u)); - this->evaluate = NULL; - this->mempool = NULL; - this->cdata = NULL; + this->evaluate = nullptr; + this->mempool = nullptr; + this->cdata = nullptr; } SelectionTreeElement::~SelectionTreeElement() @@ -200,7 +200,7 @@ void SelectionTreeElement::freeValues() } } _gmx_selvalue_free(&v); - if (type == SEL_SUBEXPRREF && u.param != NULL) + if (type == SEL_SUBEXPRREF && u.param != nullptr) { // TODO: This is now called from two different locations. // It is likely that one of them is unnecessary, but that requires @@ -215,22 +215,22 @@ SelectionTreeElement::freeExpressionData() if (type == SEL_EXPRESSION || type == SEL_MODIFIER) { _gmx_selelem_free_method(u.expr.method, u.expr.mdata); - u.expr.mdata = NULL; - u.expr.method = NULL; + u.expr.mdata = nullptr; + u.expr.method = nullptr; /* Free position data */ delete u.expr.pos; - u.expr.pos = NULL; + u.expr.pos = nullptr; /* Free position calculation data */ if (u.expr.pc) { gmx_ana_poscalc_free(u.expr.pc); - u.expr.pc = NULL; + u.expr.pc = nullptr; } } if (type == SEL_ARITHMETIC) { sfree(u.arith.opstr); - u.arith.opstr = NULL; + u.arith.opstr = nullptr; } if (type == SEL_SUBEXPR || type == SEL_ROOT || (type == SEL_CONST && v.type == GROUP_VALUE)) @@ -281,7 +281,7 @@ void SelectionTreeElement::mempoolRelease() case INT_VALUE: case REAL_VALUE: _gmx_sel_mempool_free(mempool, v.u.ptr); - _gmx_selvalue_setstore(&v, NULL); + _gmx_selvalue_setstore(&v, nullptr); break; case GROUP_VALUE: @@ -425,7 +425,7 @@ void SelectionTreeElement::resolveIndexGroupReference( { GMX_RELEASE_ASSERT(type == SEL_GROUPREF, "Should only be called for index group reference elements"); - if (grps == NULL) + if (grps == nullptr) { std::string message = formatString( "Cannot match '%s', because index groups are not available.", @@ -435,7 +435,7 @@ void SelectionTreeElement::resolveIndexGroupReference( gmx_ana_index_t foundGroup; std::string foundName; - if (u.gref.name != NULL) + if (u.gref.name != nullptr) { if (!gmx_ana_indexgrps_find(&foundGroup, &foundName, grps, u.gref.name)) { @@ -518,7 +518,7 @@ _gmx_selelem_set_vtype(const gmx::SelectionTreeElementPointer &sel, void _gmx_selelem_free_param(gmx_ana_selparam_t *param) { - if (param->val.u.ptr != NULL) + if (param->val.u.ptr != nullptr) { if (param->val.type == GROUP_VALUE) { @@ -534,7 +534,7 @@ _gmx_selelem_free_param(gmx_ana_selparam_t *param) void _gmx_selelem_free_method(gmx_ana_selmethod_t *method, void *mdata) { - sel_freefunc free_func = NULL; + sel_freefunc free_func = nullptr; /* Save the pointer to the free function. */ if (method && method->free) @@ -670,7 +670,7 @@ _gmx_selelem_print_tree(FILE *fp, const gmx::SelectionTreeElement &sel, if ((sel.type == SEL_CONST && sel.v.type == GROUP_VALUE) || sel.type == SEL_ROOT) { const gmx_ana_index_t *g = sel.v.u.g; - if (!g || g->isize == 0 || sel.evaluate != NULL) + if (!g || g->isize == 0 || sel.evaluate != nullptr) { g = &sel.u.cgrp; } @@ -703,10 +703,10 @@ _gmx_selelem_print_tree(FILE *fp, const gmx::SelectionTreeElement &sel, fprintf(fp, "\n"); } } - else if (sel.type == SEL_SUBEXPRREF && sel.u.param != NULL) + else if (sel.type == SEL_SUBEXPRREF && sel.u.param != nullptr) { fprintf(fp, "%*c param", level*2+1, ' '); - if (sel.u.param->name != NULL) + if (sel.u.param->name != nullptr) { fprintf(fp, " \"%s\"", sel.u.param->name); } diff --git a/src/gromacs/selection/selelem.h b/src/gromacs/selection/selelem.h index d6b63ed6b5..f2f218744c 100644 --- a/src/gromacs/selection/selelem.h +++ b/src/gromacs/selection/selelem.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -341,7 +341,7 @@ class SelectionTreeElement * \param[in] name Name to set (can be NULL). * \throws std::bad_alloc if out of memory. */ - void setName(const char *name) { name_ = (name != NULL ? name : ""); } + void setName(const char *name) { name_ = (name != nullptr ? name : ""); } //! \copydoc setName(const char *) void setName(const std::string &name) { name_ = name; } /*! \brief diff --git a/src/gromacs/selection/selhelp.cpp b/src/gromacs/selection/selhelp.cpp index 14220e28c2..d807f042f4 100644 --- a/src/gromacs/selection/selhelp.cpp +++ b/src/gromacs/selection/selhelp.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -647,7 +647,7 @@ KeywordsHelpTopic::KeywordsHelpTopic() const std::string &symname = symbol->name(); const gmx_ana_selmethod_t *method = symbol->methodValue(); methods_.push_back(std::make_pair(std::string(symname), method)); - if (method->help.nlhelp > 0 && method->help.help != NULL) + if (method->help.nlhelp > 0 && method->help.help != nullptr) { addSubTopic(HelpTopicPointer( new KeywordDetailsHelpTopic(symname, *method))); @@ -675,7 +675,7 @@ void KeywordsHelpTopic::writeHelp(const HelpWriterContext &context) const writeKeywordListStart(context, "Additional keywords that directly select atoms:"); printKeywordList(context, GROUP_VALUE, false); - writeKeywordListEnd(context, NULL); + writeKeywordListEnd(context, nullptr); writeKeywordListStart(context, "Keywords that directly evaluate to positions:"); printKeywordList(context, POS_VALUE, false); @@ -684,7 +684,7 @@ void KeywordsHelpTopic::writeHelp(const HelpWriterContext &context) const writeKeywordListStart(context, "Additional keywords:"); printKeywordList(context, POS_VALUE, true); printKeywordList(context, NO_VALUE, true); - writeKeywordListEnd(context, NULL); + writeKeywordListEnd(context, nullptr); writeKeywordSubTopics(context); } @@ -732,11 +732,11 @@ void KeywordsHelpTopic::printKeywordList(const HelpWriterContext &context, = (method.flags & SMETH_MODIFIER) != 0; if (method.type == type && bModifiers == bIsModifier) { - const bool bHasHelp = (method.help.nlhelp > 0 && method.help.help != NULL); + const bool bHasHelp = (method.help.nlhelp > 0 && method.help.help != nullptr); const bool bPrintHelpMark = bHasHelp && context.outputFormat() == eHelpOutputFormat_Console; file.writeString(formatString(" %c ", bPrintHelpMark ? '+' : ' ')); - if (method.help.syntax != NULL) + if (method.help.syntax != nullptr) { file.writeLine(method.help.syntax); } @@ -765,14 +765,14 @@ void KeywordsHelpTopic::writeKeywordSubTopics(const HelpWriterContext &context) { const gmx_ana_selmethod_t &method = *iter->second; const bool bHasHelp - = (method.help.nlhelp > 0 && method.help.help != NULL); + = (method.help.nlhelp > 0 && method.help.help != nullptr); if (!bHasHelp || usedSymbols.count(iter->first) > 0) { continue; } std::string title; - if (method.help.helpTitle != NULL) + if (method.help.helpTitle != nullptr) { title = method.help.helpTitle; title.append(" - "); @@ -790,7 +790,7 @@ void KeywordsHelpTopic::writeKeywordSubTopics(const HelpWriterContext &context) } const IHelpTopic *subTopic = findSubTopic(iter->first.c_str()); - GMX_RELEASE_ASSERT(subTopic != NULL, "Keyword subtopic no longer exists"); + GMX_RELEASE_ASSERT(subTopic != nullptr, "Keyword subtopic no longer exists"); HelpWriterContext subContext(context); subContext.enterSubSection(title); subTopic->writeHelp(subContext); diff --git a/src/gromacs/selection/selmethod.cpp b/src/gromacs/selection/selmethod.cpp index e494b8b298..3df5be8d72 100644 --- a/src/gromacs/selection/selmethod.cpp +++ b/src/gromacs/selection/selmethod.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -127,49 +127,49 @@ typedef struct { /** Array of selection methods defined in the library. */ static const t_register_method smtable_def[] = { - {NULL, &sm_cog}, - {NULL, &sm_com}, + {nullptr, &sm_cog}, + {nullptr, &sm_com}, - {NULL, &sm_all}, - {NULL, &sm_none}, - {NULL, &sm_atomnr}, - {NULL, &sm_resnr}, + {nullptr, &sm_all}, + {nullptr, &sm_none}, + {nullptr, &sm_atomnr}, + {nullptr, &sm_resnr}, {"resid", &sm_resnr}, - {NULL, &sm_resindex}, + {nullptr, &sm_resindex}, {"residue", &sm_resindex}, - {NULL, &sm_molindex}, + {nullptr, &sm_molindex}, {"mol", &sm_molindex}, {"molecule", &sm_molindex}, - {NULL, &sm_atomname}, + {nullptr, &sm_atomname}, {"name", &sm_atomname}, - {NULL, &sm_pdbatomname}, + {nullptr, &sm_pdbatomname}, {"pdbname", &sm_pdbatomname}, - {NULL, &sm_atomtype}, + {nullptr, &sm_atomtype}, {"type", &sm_atomtype}, - {NULL, &sm_resname}, - {NULL, &sm_insertcode}, - {NULL, &sm_chain}, - {NULL, &sm_mass}, - {NULL, &sm_charge}, - {NULL, &sm_altloc}, - {NULL, &sm_occupancy}, - {NULL, &sm_betafactor}, + {nullptr, &sm_resname}, + {nullptr, &sm_insertcode}, + {nullptr, &sm_chain}, + {nullptr, &sm_mass}, + {nullptr, &sm_charge}, + {nullptr, &sm_altloc}, + {nullptr, &sm_occupancy}, + {nullptr, &sm_betafactor}, {"beta", &sm_betafactor}, - {NULL, &sm_x}, - {NULL, &sm_y}, - {NULL, &sm_z}, + {nullptr, &sm_x}, + {nullptr, &sm_y}, + {nullptr, &sm_z}, - {NULL, &sm_distance}, + {nullptr, &sm_distance}, {"dist", &sm_distance}, - {NULL, &sm_mindistance}, + {nullptr, &sm_mindistance}, {"mindist", &sm_mindistance}, - {NULL, &sm_within}, - {NULL, &sm_insolidangle}, - {NULL, &sm_same}, + {nullptr, &sm_within}, + {nullptr, &sm_insolidangle}, + {nullptr, &sm_same}, - {NULL, &sm_merge}, - {NULL, &sm_plus}, - {NULL, &sm_permute}, + {nullptr, &sm_merge}, + {nullptr, &sm_plus}, + {nullptr, &sm_permute}, }; /*! \brief @@ -248,7 +248,7 @@ check_params(FILE *fp, const char *name, int nparams, gmx_ana_selparam_t param[] for (i = 0; i < nparams; ++i) { /* Check that there is at most one NULL name, in the beginning */ - if (param[i].name == NULL && i > 0) + if (param[i].name == nullptr && i > 0) { report_error(fp, name, "error: NULL parameter should be the first one"); bOk = false; @@ -257,7 +257,7 @@ check_params(FILE *fp, const char *name, int nparams, gmx_ana_selparam_t param[] /* Check for duplicates */ for (j = 0; j < i; ++j) { - if (param[j].name == NULL) + if (param[j].name == nullptr) { continue; } @@ -356,16 +356,16 @@ check_params(FILE *fp, const char *name, int nparams, gmx_ana_selparam_t param[] } } /* Check that the value pointer is NULL */ - if (param[i].nvalptr != NULL) + if (param[i].nvalptr != nullptr) { report_param_error(fp, name, param[i].name, "warning: nvalptr is set"); } - if (param[i].val.u.ptr != NULL && !(param[i].flags & SPAR_ENUMVAL)) + if (param[i].val.u.ptr != nullptr && !(param[i].flags & SPAR_ENUMVAL)) { report_param_error(fp, name, param[i].name, "warning: value pointer is set"); } /* Check that the name contains only valid characters */ - if (param[i].name == NULL) + if (param[i].name == nullptr) { continue; } @@ -461,7 +461,7 @@ check_callbacks(FILE *fp, gmx_ana_selmethod_t *method) if (method->pupdate && !(method->flags & SMETH_DYNAMIC)) { report_error(fp, method->name, "warning: pupdate not used because the method is static"); - method->pupdate = NULL; + method->pupdate = nullptr; } } /* Check that there is an evaluation function */ @@ -687,7 +687,7 @@ gmx_ana_selmethod_register_defaults(gmx::SelectionParserSymbolTable *symtab) { gmx_ana_selmethod_t *method = smtable_def[i].method; - if (smtable_def[i].name == NULL) + if (smtable_def[i].name == nullptr) { rc = gmx_ana_selmethod_register(symtab, method->name, method); } diff --git a/src/gromacs/selection/selvalue.cpp b/src/gromacs/selection/selvalue.cpp index 80e1cfea57..9bd049969f 100644 --- a/src/gromacs/selection/selvalue.cpp +++ b/src/gromacs/selection/selvalue.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2012,2013,2014, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2012,2013,2014,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -52,7 +52,7 @@ void _gmx_selvalue_clear(gmx_ana_selvalue_t *val) { val->nr = 0; - val->u.ptr = NULL; + val->u.ptr = nullptr; val->nalloc = 0; } @@ -71,7 +71,7 @@ _gmx_selvalue_free(gmx_ana_selvalue_t *val) } } // TODO: It causes a memory leak somewhere if val->nr is assigned zero here... - val->u.ptr = NULL; + val->u.ptr = nullptr; val->nalloc = 0; } @@ -95,11 +95,11 @@ _gmx_selvalue_reserve(gmx_ana_selvalue_t *val, int n) srenew(val->u.s, n); for (i = val->nalloc; i < n; ++i) { - val->u.s[i] = NULL; + val->u.s[i] = nullptr; } break; case POS_VALUE: - GMX_RELEASE_ASSERT(val->u.ptr == NULL, + GMX_RELEASE_ASSERT(val->u.ptr == nullptr, "Reallocation of position values not supported"); val->u.p = new gmx_ana_pos_t[n]; break; @@ -121,7 +121,7 @@ _gmx_selvalue_getstore_and_release(gmx_ana_selvalue_t *val, void **ptr, int *nal { *ptr = val->u.ptr; *nalloc = val->nalloc; - val->u.ptr = NULL; + val->u.ptr = nullptr; val->nalloc = 0; } diff --git a/src/gromacs/selection/sm_compare.cpp b/src/gromacs/selection/sm_compare.cpp index c92a940e02..03762e4929 100644 --- a/src/gromacs/selection/sm_compare.cpp +++ b/src/gromacs/selection/sm_compare.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -142,14 +142,14 @@ evaluate_compare(const gmx::SelMethodEvalContext &context, /** Parameters for comparison expression evaluation. */ static gmx_ana_selparam_t smparams_compare[] = { - {"int1", {INT_VALUE, -1, {NULL}}, NULL, + {"int1", {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_OPTIONAL | SPAR_DYNAMIC | SPAR_ATOMVAL}, - {"real1", {REAL_VALUE, -1, {NULL}}, NULL, + {"real1", {REAL_VALUE, -1, {nullptr}}, nullptr, SPAR_OPTIONAL | SPAR_DYNAMIC | SPAR_ATOMVAL}, - {"op", {STR_VALUE, 1, {NULL}}, NULL, 0}, - {"int2", {INT_VALUE, -1, {NULL}}, NULL, + {"op", {STR_VALUE, 1, {nullptr}}, nullptr, 0}, + {"int2", {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_OPTIONAL | SPAR_DYNAMIC | SPAR_ATOMVAL}, - {"real2", {REAL_VALUE, -1, {NULL}}, NULL, + {"real2", {REAL_VALUE, -1, {nullptr}}, nullptr, SPAR_OPTIONAL | SPAR_DYNAMIC | SPAR_ATOMVAL}, }; @@ -158,14 +158,14 @@ gmx_ana_selmethod_t sm_compare = { "cmp", GROUP_VALUE, SMETH_SINGLEVAL, asize(smparams_compare), smparams_compare, &init_data_compare, - NULL, + nullptr, &init_compare, - NULL, + nullptr, &free_data_compare, - NULL, + nullptr, &evaluate_compare, - NULL, - {NULL, NULL, 0, NULL}, + nullptr, + {nullptr, nullptr, 0, nullptr}, }; /*! \brief @@ -206,7 +206,7 @@ comparison_type(char *str) static const char * comparison_type_str(e_comparison_t cmpt) { - const char *p = NULL; + const char *p = nullptr; switch (cmpt) { case CMP_INVALID: p = "INVALID"; break; @@ -330,8 +330,8 @@ init_comparison_value(t_compare_value *val, gmx_ana_selparam_t param[2]) else { n = 0; - val->i = NULL; - val->r = NULL; + val->i = nullptr; + val->r = nullptr; } return n; } @@ -458,9 +458,9 @@ init_compare(const gmx_mtop_t * /* top */, int /* npar */, gmx_ana_selparam_t *p /* Reverse the sides to place the integer on the right */ int flags; d->left.r = d->right.r; - d->right.r = NULL; + d->right.r = nullptr; d->right.i = d->left.i; - d->left.i = NULL; + d->left.i = nullptr; flags = d->left.flags; d->left.flags = d->right.flags; d->right.flags = flags; diff --git a/src/gromacs/selection/sm_distance.cpp b/src/gromacs/selection/sm_distance.cpp index 738657c92f..5cf559d6ae 100644 --- a/src/gromacs/selection/sm_distance.cpp +++ b/src/gromacs/selection/sm_distance.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -135,20 +135,20 @@ evaluate_within(const gmx::SelMethodEvalContext & /*context*/, /** Parameters for the \p distance selection method. */ static gmx_ana_selparam_t smparams_distance[] = { - {"cutoff", {REAL_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL}, - {"from", {POS_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC}, + {"cutoff", {REAL_VALUE, 1, {nullptr}}, nullptr, SPAR_OPTIONAL}, + {"from", {POS_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC}, }; /** Parameters for the \p mindistance selection method. */ static gmx_ana_selparam_t smparams_mindistance[] = { - {"cutoff", {REAL_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL}, - {"from", {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM}, + {"cutoff", {REAL_VALUE, 1, {nullptr}}, nullptr, SPAR_OPTIONAL}, + {"from", {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM}, }; /** Parameters for the \p within selection method. */ static gmx_ana_selparam_t smparams_within[] = { - {NULL, {REAL_VALUE, 1, {NULL}}, NULL, 0}, - {"of", {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM}, + {nullptr, {REAL_VALUE, 1, {nullptr}}, nullptr, 0}, + {"of", {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM}, }; //! Help title for distance selection methods. @@ -179,12 +179,12 @@ gmx_ana_selmethod_t sm_distance = { "distance", REAL_VALUE, SMETH_DYNAMIC, asize(smparams_distance), smparams_distance, &init_data_common, - NULL, + nullptr, &init_common, - NULL, + nullptr, &free_data_common, &init_frame_common, - NULL, + nullptr, &evaluate_distance, {"distance from POS [cutoff REAL]", helptitle_distance, asize(help_distance), help_distance}, @@ -195,12 +195,12 @@ gmx_ana_selmethod_t sm_mindistance = { "mindistance", REAL_VALUE, SMETH_DYNAMIC, asize(smparams_mindistance), smparams_mindistance, &init_data_common, - NULL, + nullptr, &init_common, - NULL, + nullptr, &free_data_common, &init_frame_common, - NULL, + nullptr, &evaluate_distance, {"mindistance from POS_EXPR [cutoff REAL]", helptitle_distance, asize(help_distance), help_distance}, @@ -211,12 +211,12 @@ gmx_ana_selmethod_t sm_within = { "within", GROUP_VALUE, SMETH_DYNAMIC, asize(smparams_within), smparams_within, &init_data_common, - NULL, + nullptr, &init_common, - NULL, + nullptr, &free_data_common, &init_frame_common, - NULL, + nullptr, &evaluate_within, {"within REAL of POS_EXPR", helptitle_distance, asize(help_distance), help_distance}, diff --git a/src/gromacs/selection/sm_insolidangle.cpp b/src/gromacs/selection/sm_insolidangle.cpp index 3bb50305f3..d9c23c5dab 100644 --- a/src/gromacs/selection/sm_insolidangle.cpp +++ b/src/gromacs/selection/sm_insolidangle.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -327,9 +327,9 @@ is_surface_covered(t_methoddata_insolidangle *surf, rvec x); /** Parameters for the \p insolidangle selection method. */ static gmx_ana_selparam_t smparams_insolidangle[] = { - {"center", {POS_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC}, - {"span", {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM}, - {"cutoff", {REAL_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL}, + {"center", {POS_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC}, + {"span", {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM}, + {"cutoff", {REAL_VALUE, 1, {nullptr}}, nullptr, SPAR_OPTIONAL}, }; /** Help text for the \p insolidangle selection method. */ @@ -356,12 +356,12 @@ gmx_ana_selmethod_t sm_insolidangle = { "insolidangle", GROUP_VALUE, SMETH_DYNAMIC, asize(smparams_insolidangle), smparams_insolidangle, &init_data_insolidangle, - NULL, + nullptr, &init_insolidangle, - NULL, + nullptr, &free_data_insolidangle, &init_frame_insolidangle, - NULL, + nullptr, &evaluate_insolidangle, {"insolidangle center POS span POS_EXPR [cutoff REAL]", "Selecting atoms in a solid angle", @@ -387,13 +387,13 @@ init_data_insolidangle(int /* npar */, gmx_ana_selparam_t *param) // cppcheck-suppress uninitdata data->tbinsize = 0.0; // cppcheck-suppress uninitdata - data->tbin = NULL; + data->tbin = nullptr; // cppcheck-suppress uninitdata data->maxbins = 0; // cppcheck-suppress uninitdata data->nbins = 0; // cppcheck-suppress uninitdata - data->bin = NULL; + data->bin = nullptr; param[0].val.u.p = &data->center; param[1].val.u.p = &data->span; @@ -746,7 +746,7 @@ free_surface_points(t_methoddata_insolidangle *surf) sfree(surf->bin[i].x); } surf->bin[i].n_alloc = 0; - surf->bin[i].x = NULL; + surf->bin[i].x = nullptr; } } diff --git a/src/gromacs/selection/sm_keywords.cpp b/src/gromacs/selection/sm_keywords.cpp index e675249a4c..3e020fb4bc 100644 --- a/src/gromacs/selection/sm_keywords.cpp +++ b/src/gromacs/selection/sm_keywords.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -274,20 +274,20 @@ struct t_methoddata_kwstr /** Parameters for integer keyword evaluation. */ static gmx_ana_selparam_t smparams_keyword_int[] = { - {NULL, {INT_VALUE, -1, {NULL}}, NULL, SPAR_ATOMVAL}, - {NULL, {INT_VALUE, -1, {NULL}}, NULL, SPAR_RANGES | SPAR_VARNUM}, + {nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_ATOMVAL}, + {nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_RANGES | SPAR_VARNUM}, }; /** Parameters for real keyword evaluation. */ static gmx_ana_selparam_t smparams_keyword_real[] = { - {NULL, {REAL_VALUE, -1, {NULL}}, NULL, SPAR_ATOMVAL | SPAR_DYNAMIC}, - {NULL, {REAL_VALUE, -1, {NULL}}, NULL, SPAR_RANGES | SPAR_VARNUM}, + {nullptr, {REAL_VALUE, -1, {nullptr}}, nullptr, SPAR_ATOMVAL | SPAR_DYNAMIC}, + {nullptr, {REAL_VALUE, -1, {nullptr}}, nullptr, SPAR_RANGES | SPAR_VARNUM}, }; /** Parameters for string keyword evaluation. */ static gmx_ana_selparam_t smparams_keyword_str[] = { - {NULL, {STR_VALUE, -1, {NULL}}, NULL, SPAR_ATOMVAL}, - {NULL, {STR_VALUE, -1, {NULL}}, NULL, SPAR_VARNUM}, + {nullptr, {STR_VALUE, -1, {nullptr}}, nullptr, SPAR_ATOMVAL}, + {nullptr, {STR_VALUE, -1, {nullptr}}, nullptr, SPAR_VARNUM}, }; /** Selection method data for integer keyword evaluation. */ @@ -295,14 +295,14 @@ gmx_ana_selmethod_t sm_keyword_int = { "kw_int", GROUP_VALUE, SMETH_SINGLEVAL, asize(smparams_keyword_int), smparams_keyword_int, &init_data_kwint, - NULL, + nullptr, &init_kwint, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_keyword_int, - NULL, - {NULL, NULL, 0, NULL}, + nullptr, + {nullptr, nullptr, 0, nullptr}, }; /** Selection method data for real keyword evaluation. */ @@ -310,14 +310,14 @@ gmx_ana_selmethod_t sm_keyword_real = { "kw_real", GROUP_VALUE, SMETH_SINGLEVAL, asize(smparams_keyword_real), smparams_keyword_real, &init_data_kwreal, - NULL, + nullptr, &init_kwreal, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_keyword_real, - NULL, - {NULL, NULL, 0, NULL}, + nullptr, + {nullptr, nullptr, 0, nullptr}, }; /** Selection method data for string keyword evaluation. */ @@ -325,14 +325,14 @@ gmx_ana_selmethod_t sm_keyword_str = { "kw_str", GROUP_VALUE, SMETH_SINGLEVAL, asize(smparams_keyword_str), smparams_keyword_str, &init_data_kwstr, - NULL, + nullptr, &init_kwstr, - NULL, + nullptr, &free_data_kwstr, - NULL, + nullptr, &evaluate_keyword_str, - NULL, - {NULL, NULL, 0, NULL}, + nullptr, + {nullptr, nullptr, 0, nullptr}, }; /*! \brief @@ -419,11 +419,11 @@ struct t_methoddata_kweval /** Parameters for keyword evaluation in an arbitrary group. */ static gmx_ana_selparam_t smparams_kweval_group[] = { - {NULL, {GROUP_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC}, + {nullptr, {GROUP_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC}, }; /** Parameters for keyword evaluation from positions. */ static gmx_ana_selparam_t smparams_kweval_pos[] = { - {NULL, {POS_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC}, + {nullptr, {POS_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC}, }; @@ -678,7 +678,7 @@ init_kweval(const gmx_mtop_t *top, int /* npar */, gmx_ana_selparam_t * /* param { t_methoddata_kweval *d = static_cast(data); - d->kwmethod->init(top, 0, NULL, d->kwmdata); + d->kwmethod->init(top, 0, nullptr, d->kwmdata); } static void @@ -771,14 +771,14 @@ init_evaluator_group(gmx_ana_selmethod_t *method, sel->u.expr.method->name = data->kwmethod->name; sel->u.expr.method->type = data->kwmethod->type; sel->u.expr.method->flags = data->kwmethod->flags | SMETH_VARNUMVAL; - sel->u.expr.method->init_data = NULL; - sel->u.expr.method->set_poscoll = NULL; - sel->u.expr.method->init = method->init ? &init_kweval : NULL; + sel->u.expr.method->init_data = nullptr; + sel->u.expr.method->set_poscoll = nullptr; + sel->u.expr.method->init = method->init ? &init_kweval : nullptr; sel->u.expr.method->outinit = &init_output_kweval; sel->u.expr.method->free = &free_data_kweval; - sel->u.expr.method->init_frame = method->init_frame ? &init_frame_kweval : NULL; + sel->u.expr.method->init_frame = method->init_frame ? &init_frame_kweval : nullptr; sel->u.expr.method->update = &evaluate_kweval; - sel->u.expr.method->pupdate = NULL; + sel->u.expr.method->pupdate = nullptr; sel->u.expr.method->nparams = asize(smparams_kweval_group); sel->u.expr.method->param = smparams_kweval_group; _gmx_selelem_init_method_params(sel, scanner); @@ -808,7 +808,7 @@ init_evaluator_pos(gmx_ana_selmethod_t *method, void *scanner) { if ((method->flags & (SMETH_SINGLEVAL | SMETH_VARNUMVAL)) - || method->outinit || method->pupdate == NULL) + || method->outinit || method->pupdate == nullptr) { std::string message = gmx::formatString("Keyword '%s' cannot be evaluated in this context", @@ -828,14 +828,14 @@ init_evaluator_pos(gmx_ana_selmethod_t *method, sel->u.expr.method->name = data->kwmethod->name; sel->u.expr.method->type = data->kwmethod->type; sel->u.expr.method->flags = data->kwmethod->flags | SMETH_SINGLEVAL; - sel->u.expr.method->init_data = NULL; - sel->u.expr.method->set_poscoll = NULL; - sel->u.expr.method->init = method->init ? &init_kweval : NULL; - sel->u.expr.method->outinit = NULL; + sel->u.expr.method->init_data = nullptr; + sel->u.expr.method->set_poscoll = nullptr; + sel->u.expr.method->init = method->init ? &init_kweval : nullptr; + sel->u.expr.method->outinit = nullptr; sel->u.expr.method->free = &free_data_kweval; - sel->u.expr.method->init_frame = method->init_frame ? &init_frame_kweval : NULL; + sel->u.expr.method->init_frame = method->init_frame ? &init_frame_kweval : nullptr; sel->u.expr.method->update = &evaluate_kweval_pos; - sel->u.expr.method->pupdate = NULL; + sel->u.expr.method->pupdate = nullptr; sel->u.expr.method->nparams = asize(smparams_kweval_pos); sel->u.expr.method->param = smparams_kweval_pos; _gmx_selelem_init_method_params(sel, scanner); @@ -855,7 +855,7 @@ _gmx_sel_init_keyword_evaluator(gmx_ana_selmethod_t *method, { gmx::SelectionParserParameterList params; params.push_back( - gmx::SelectionParserParameter::createFromExpression(NULL, child)); + gmx::SelectionParserParameter::createFromExpression(nullptr, child)); if (child->v.type == GROUP_VALUE) { return init_evaluator_group(method, params, scanner); diff --git a/src/gromacs/selection/sm_merge.cpp b/src/gromacs/selection/sm_merge.cpp index 309de2f09f..db45053752 100644 --- a/src/gromacs/selection/sm_merge.cpp +++ b/src/gromacs/selection/sm_merge.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -111,9 +111,9 @@ evaluate_plus(const gmx::SelMethodEvalContext &context, /** Parameters for the merging selection modifiers. */ static gmx_ana_selparam_t smparams_merge[] = { - {NULL, {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM}, - {NULL, {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM}, - {"stride", {INT_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL}, + {nullptr, {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM}, + {nullptr, {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM}, + {"stride", {INT_VALUE, 1, {nullptr}}, nullptr, SPAR_OPTIONAL}, }; //! Help title for the merging selection modifiers. @@ -149,12 +149,12 @@ gmx_ana_selmethod_t sm_merge = { "merge", POS_VALUE, SMETH_MODIFIER, asize(smparams_merge), smparams_merge, &init_data_merge, - NULL, + nullptr, &init_merge, &init_output_merge, &free_data_merge, - NULL, - NULL, + nullptr, + nullptr, &evaluate_merge, {"merge POSEXPR", helptitle_merge, asize(help_merge), help_merge}, }; @@ -164,12 +164,12 @@ gmx_ana_selmethod_t sm_plus = { "plus", POS_VALUE, SMETH_MODIFIER, asize(smparams_merge)-1, smparams_merge, &init_data_merge, - NULL, + nullptr, &init_merge, &init_output_plus, &free_data_merge, - NULL, - NULL, + nullptr, + nullptr, &evaluate_plus, {"plus POSEXPR", helptitle_merge, asize(help_merge), help_merge}, }; @@ -240,7 +240,7 @@ init_output_common(const gmx_mtop_t *top, gmx_ana_selvalue_t *out, void *data) } gmx_ana_pos_reserve_for_append(out->u.p, d->p1.count() + d->p2.count(), d->p1.m.b.nra + d->p2.m.b.nra, - d->p1.v != NULL, d->p1.f != NULL); + d->p1.v != nullptr, d->p1.f != nullptr); gmx_ana_pos_empty_init(out->u.p); } diff --git a/src/gromacs/selection/sm_permute.cpp b/src/gromacs/selection/sm_permute.cpp index b55c4048ba..9328c7b96f 100644 --- a/src/gromacs/selection/sm_permute.cpp +++ b/src/gromacs/selection/sm_permute.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -117,8 +117,8 @@ evaluate_permute(const gmx::SelMethodEvalContext &context, /** Parameters for the \p permute selection modifier. */ static gmx_ana_selparam_t smparams_permute[] = { - {NULL, {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM}, - {NULL, {INT_VALUE, -1, {NULL}}, NULL, SPAR_VARNUM}, + {nullptr, {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM}, + {nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_VARNUM}, }; /** Help text for the \p permute selection modifier. */ @@ -145,12 +145,12 @@ gmx_ana_selmethod_t sm_permute = { "permute", POS_VALUE, SMETH_MODIFIER, asize(smparams_permute), smparams_permute, &init_data_permute, - NULL, + nullptr, &init_permute, &init_output_permute, &free_data_permute, - NULL, - NULL, + nullptr, + nullptr, &evaluate_permute, {"POSEXPR permute P1 ... PN", "Permuting selections", asize(help_permute), help_permute}, @@ -161,8 +161,8 @@ init_data_permute(int /* npar */, gmx_ana_selparam_t *param) { t_methoddata_permute *data = new t_methoddata_permute(); data->n = 0; - data->perm = NULL; - data->rperm = NULL; + data->perm = nullptr; + data->rperm = nullptr; param[0].val.u.p = &data->p; return data; } @@ -208,7 +208,7 @@ init_output_permute(const gmx_mtop_t * /* top */, gmx_ana_selvalue_t *out, void out->u.p->m.type = d->p.m.type; gmx_ana_pos_reserve_for_append(out->u.p, d->p.count(), d->p.m.b.nra, - d->p.v != NULL, d->p.f != NULL); + d->p.v != nullptr, d->p.f != nullptr); gmx_ana_pos_empty_init(out->u.p); for (i = 0; i < d->p.count(); i += d->n) { diff --git a/src/gromacs/selection/sm_position.cpp b/src/gromacs/selection/sm_position.cpp index 1b22204c83..d1b1f457b1 100644 --- a/src/gromacs/selection/sm_position.cpp +++ b/src/gromacs/selection/sm_position.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -133,13 +133,13 @@ evaluate_pos(const gmx::SelMethodEvalContext &context, /** Parameters for position keyword evaluation. */ static gmx_ana_selparam_t smparams_keyword_pos[] = { - {NULL, {GROUP_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC}, + {nullptr, {GROUP_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC}, }; /** Parameters for the \p cog and \p com selection methods. */ static gmx_ana_selparam_t smparams_com[] = { - {"of", {GROUP_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC}, - {"pbc", {NO_VALUE, 0, {NULL}}, NULL, 0}, + {"of", {GROUP_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC}, + {"pbc", {NO_VALUE, 0, {nullptr}}, nullptr, 0}, }; /** Selection method data for position keyword evaluation. */ @@ -151,10 +151,10 @@ gmx_ana_selmethod_t sm_keyword_pos = { &init_kwpos, &init_output_pos, &free_data_pos, - NULL, + nullptr, &evaluate_pos, - NULL, - {NULL, NULL, 0, NULL}, + nullptr, + {nullptr, nullptr, 0, nullptr}, }; /** Selection method data for the \p cog method. */ @@ -166,10 +166,10 @@ gmx_ana_selmethod_t sm_cog = { &init_cog, &init_output_pos, &free_data_pos, - NULL, + nullptr, &evaluate_pos, - NULL, - {"cog of ATOM_EXPR [pbc]", NULL, 0, NULL}, + nullptr, + {"cog of ATOM_EXPR [pbc]", nullptr, 0, nullptr}, }; /** Selection method data for the \p com method. */ @@ -181,10 +181,10 @@ gmx_ana_selmethod_t sm_com = { &init_com, &init_output_pos, &free_data_pos, - NULL, + nullptr, &evaluate_pos, - NULL, - {"com of ATOM_EXPR [pbc]", NULL, 0, NULL}, + nullptr, + {"com of ATOM_EXPR [pbc]", nullptr, 0, nullptr}, }; /*! @@ -209,9 +209,9 @@ init_data_pos(int npar, gmx_ana_selparam_t *param) { param[1].val.u.b = &data->bPBC; } - data->pc = NULL; + data->pc = nullptr; data->bPBC = false; - data->type = NULL; + data->type = nullptr; data->flags = -1; return data; } @@ -236,7 +236,7 @@ _gmx_selelem_is_default_kwpos(const gmx::SelectionTreeElement &sel) } t_methoddata_pos *d = static_cast(sel.u.expr.mdata); - return d->type == NULL; + return d->type == nullptr; } /*! \brief diff --git a/src/gromacs/selection/sm_same.cpp b/src/gromacs/selection/sm_same.cpp index f475efd72d..9f8e2c8d72 100644 --- a/src/gromacs/selection/sm_same.cpp +++ b/src/gromacs/selection/sm_same.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -156,14 +156,14 @@ evaluate_same_str(const gmx::SelMethodEvalContext &context, /** Parameters for the \p same selection method. */ static gmx_ana_selparam_t smparams_same_int[] = { - {NULL, {INT_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_ATOMVAL}, - {"as", {INT_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM}, + {nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_ATOMVAL}, + {"as", {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM}, }; /** Parameters for the \p same selection method. */ static gmx_ana_selparam_t smparams_same_str[] = { - {NULL, {STR_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_ATOMVAL}, - {"as", {STR_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM}, + {nullptr, {STR_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_ATOMVAL}, + {"as", {STR_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM}, }; /** Help text for the \p same selection method. */ @@ -183,13 +183,13 @@ gmx_ana_selmethod_t sm_same = { "same", GROUP_VALUE, 0, asize(smparams_same_int), smparams_same_int, &init_data_same, - NULL, + nullptr, &init_same, - NULL, + nullptr, &free_data_same, &init_frame_same_int, &evaluate_same_int, - NULL, + nullptr, {"same KEYWORD as ATOM_EXPR", "Extending selections", asize(help_same), help_same}, }; @@ -205,14 +205,14 @@ static gmx_ana_selmethod_t sm_same_str = { "same", GROUP_VALUE, SMETH_SINGLEVAL, asize(smparams_same_str), smparams_same_str, &init_data_same, - NULL, + nullptr, &init_same, - NULL, + nullptr, &free_data_same, &init_frame_same_str, &evaluate_same_str, - NULL, - {NULL, NULL, 0, NULL}, + nullptr, + {nullptr, nullptr, 0, nullptr}, }; static void * @@ -221,7 +221,7 @@ init_data_same(int /* npar */, gmx_ana_selparam_t *param) t_methoddata_same *data; snew(data, 1); - data->as_s_sorted = NULL; + data->as_s_sorted = nullptr; param[1].nvalptr = &data->nas; return data; } @@ -519,7 +519,7 @@ evaluate_same_str(const gmx::SelMethodEvalContext & /*context*/, ptr = bsearch(&d->val.s[j], d->as_s_sorted, d->nas, sizeof(d->as_s_sorted[0]), &cmp_str); /* Check whether the value was found in the as list. */ - if (ptr == NULL) + if (ptr == nullptr) { /* If not, skip all atoms with the same value. */ const char *tmpval = d->val.s[j]; diff --git a/src/gromacs/selection/sm_simple.cpp b/src/gromacs/selection/sm_simple.cpp index 60910d1cbe..259e395fe6 100644 --- a/src/gromacs/selection/sm_simple.cpp +++ b/src/gromacs/selection/sm_simple.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -230,284 +230,284 @@ static const char *const help_resindex[] = { /** Selection method data for \p all selection keyword. */ gmx_ana_selmethod_t sm_all = { "all", GROUP_VALUE, 0, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_all, - NULL, + nullptr, }; /** Selection method data for \p none selection keyword. */ gmx_ana_selmethod_t sm_none = { "none", GROUP_VALUE, 0, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_none, - NULL, + nullptr, }; /** Selection method data for \p atomnr selection keyword. */ gmx_ana_selmethod_t sm_atomnr = { "atomnr", INT_VALUE, 0, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_atomnr, - NULL, + nullptr, }; /** Selection method data for \p resnr selection keyword. */ gmx_ana_selmethod_t sm_resnr = { "resnr", INT_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_resnr, - NULL, - {NULL, helptitle_resindex, asize(help_resindex), help_resindex} + nullptr, + {nullptr, helptitle_resindex, asize(help_resindex), help_resindex} }; /** Selection method data for \p resindex selection keyword. */ gmx_ana_selmethod_t sm_resindex = { "resindex", INT_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_resindex, - NULL, - {NULL, helptitle_resindex, asize(help_resindex), help_resindex} + nullptr, + {nullptr, helptitle_resindex, asize(help_resindex), help_resindex} }; /** Selection method data for \p molindex selection keyword. */ gmx_ana_selmethod_t sm_molindex = { "molindex", INT_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, &check_molecules, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_molindex, - NULL, + nullptr, }; /** Selection method data for \p atomname selection keyword. */ gmx_ana_selmethod_t sm_atomname = { "atomname", STR_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_atomname, - NULL, - {NULL, helptitle_atomname, asize(help_atomname), help_atomname} + nullptr, + {nullptr, helptitle_atomname, asize(help_atomname), help_atomname} }; /** Selection method data for \p pdbatomname selection keyword. */ gmx_ana_selmethod_t sm_pdbatomname = { "pdbatomname", STR_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, &check_pdbinfo, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_pdbatomname, - NULL, - {NULL, helptitle_atomname, asize(help_atomname), help_atomname} + nullptr, + {nullptr, helptitle_atomname, asize(help_atomname), help_atomname} }; /** Selection method data for \p atomtype selection keyword. */ gmx_ana_selmethod_t sm_atomtype = { "atomtype", STR_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, &check_atomtype, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_atomtype, - NULL, + nullptr, }; /** Selection method data for \p resname selection keyword. */ gmx_ana_selmethod_t sm_resname = { "resname", STR_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_resname, - NULL, + nullptr, }; /** Selection method data for \p chain selection keyword. */ gmx_ana_selmethod_t sm_insertcode = { "insertcode", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_insertcode, - NULL, + nullptr, }; /** Selection method data for \p chain selection keyword. */ gmx_ana_selmethod_t sm_chain = { "chain", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_chain, - NULL, + nullptr, }; /** Selection method data for \p mass selection keyword. */ gmx_ana_selmethod_t sm_mass = { "mass", REAL_VALUE, SMETH_REQMASS, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_mass, - NULL, + nullptr, }; /** Selection method data for \p charge selection keyword. */ gmx_ana_selmethod_t sm_charge = { "charge", REAL_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, &check_charge, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_charge, - NULL, + nullptr, }; /** Selection method data for \p chain selection keyword. */ gmx_ana_selmethod_t sm_altloc = { "altloc", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL, - 0, NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, &check_pdbinfo, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_altloc, - NULL, + nullptr, }; /** Selection method data for \p occupancy selection keyword. */ gmx_ana_selmethod_t sm_occupancy = { "occupancy", REAL_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, &check_pdbinfo, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_occupancy, - NULL, + nullptr, }; /** Selection method data for \p betafactor selection keyword. */ gmx_ana_selmethod_t sm_betafactor = { "betafactor", REAL_VALUE, SMETH_REQTOP, - 0, NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, &check_pdbinfo, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, &evaluate_betafactor, - NULL, + nullptr, }; /** Selection method data for \p x selection keyword. */ gmx_ana_selmethod_t sm_x = { "x", REAL_VALUE, SMETH_DYNAMIC, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_x, }; /** Selection method data for \p y selection keyword. */ gmx_ana_selmethod_t sm_y = { "y", REAL_VALUE, SMETH_DYNAMIC, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_y, }; /** Selection method data for \p z selection keyword. */ gmx_ana_selmethod_t sm_z = { "z", REAL_VALUE, SMETH_DYNAMIC, - 0, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + 0, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, &evaluate_z, }; @@ -601,7 +601,7 @@ check_molecules(const gmx_mtop_t *top, int /* npar */, gmx_ana_selparam_t * /* p { bool bOk; - bOk = (top != NULL && top->mols.nr > 0); + bOk = (top != nullptr && top->mols.nr > 0); if (!bOk) { GMX_THROW(gmx::InconsistentInputError("Molecule information not available in topology")); diff --git a/src/gromacs/selection/symrec.cpp b/src/gromacs/selection/symrec.cpp index 34f63ae9b1..1cbc5df479 100644 --- a/src/gromacs/selection/symrec.cpp +++ b/src/gromacs/selection/symrec.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -81,7 +81,7 @@ class SelectionParserSymbol::Impl * \a var_ members as appropriate. */ Impl(SymbolType type, const char *name) - : name_(name), type_(type), meth_(NULL) + : name_(name), type_(type), meth_(nullptr) { } @@ -204,7 +204,7 @@ SelectionParserSymbolTable::Impl::addPositionSymbols() { const char *const *postypes = gmx::PositionCalculationCollection::typeEnumValues; - for (int i = 0; postypes[i] != NULL; ++i) + for (int i = 0; postypes[i] != nullptr; ++i) { SymbolPointer sym(new SelectionParserSymbol( new SelectionParserSymbol::Impl( @@ -320,13 +320,13 @@ SelectionParserSymbolTable::findSymbol(const std::string &name) const Impl::SymbolMap::const_iterator sym = impl_->symbols_.lower_bound(name); if (sym == impl_->symbols_.end()) { - return NULL; + return nullptr; } if (sym->second->name() == name) { return sym->second.get(); } - return NULL; + return nullptr; } SelectionParserSymbolIterator diff --git a/src/gromacs/selection/tests/indexutil.cpp b/src/gromacs/selection/tests/indexutil.cpp index 70bb817208..a2d43aca86 100644 --- a/src/gromacs/selection/tests/indexutil.cpp +++ b/src/gromacs/selection/tests/indexutil.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -103,10 +103,10 @@ class IndexBlockTest : public ::testing::Test IndexBlockTest::IndexBlockTest() { blocka_.nr = 0; - blocka_.index = NULL; + blocka_.index = nullptr; blocka_.nalloc_index = 0; blocka_.nra = 0; - blocka_.a = NULL; + blocka_.a = nullptr; blocka_.nalloc_a = 0; gmx_ana_index_clear(&g_); } @@ -131,7 +131,7 @@ void IndexBlockTest::checkBlocka() for (int i = 0; i < blocka_.nr; ++i) { gmx::test::TestReferenceChecker blockCompound( - compound.checkCompound("Block", NULL)); + compound.checkCompound("Block", nullptr)); blockCompound.checkSequence(&blocka_.a[blocka_.index[i]], &blocka_.a[blocka_.index[i+1]], "Atoms"); @@ -144,10 +144,10 @@ void IndexBlockTest::checkBlocka() TEST_F(IndexBlockTest, CreatesUnknownBlock) { - gmx_ana_index_make_block(&blocka_, NULL, NULL, INDEX_UNKNOWN, false); + gmx_ana_index_make_block(&blocka_, nullptr, nullptr, INDEX_UNKNOWN, false); checkBlocka(); done_blocka(&blocka_); - gmx_ana_index_make_block(&blocka_, NULL, NULL, INDEX_UNKNOWN, false); + gmx_ana_index_make_block(&blocka_, nullptr, nullptr, INDEX_UNKNOWN, false); checkBlocka(); } @@ -155,10 +155,10 @@ TEST_F(IndexBlockTest, CreatesAtomBlock) { const int group[] = { 0, 1, 3, 4, 6 }; setGroup(group); - gmx_ana_index_make_block(&blocka_, NULL, &g_, INDEX_ATOM, false); + gmx_ana_index_make_block(&blocka_, nullptr, &g_, INDEX_ATOM, false); checkBlocka(); done_blocka(&blocka_); - gmx_ana_index_make_block(&blocka_, NULL, &g_, INDEX_ATOM, true); + gmx_ana_index_make_block(&blocka_, nullptr, &g_, INDEX_ATOM, true); checkBlocka(); } @@ -210,10 +210,10 @@ TEST_F(IndexBlockTest, CreatesSingleBlock) { const int group[] = { 0, 1, 3, 4, 6 }; setGroup(group); - gmx_ana_index_make_block(&blocka_, NULL, &g_, INDEX_ALL, false); + gmx_ana_index_make_block(&blocka_, nullptr, &g_, INDEX_ALL, false); checkBlocka(); done_blocka(&blocka_); - gmx_ana_index_make_block(&blocka_, NULL, &g_, INDEX_ALL, true); + gmx_ana_index_make_block(&blocka_, nullptr, &g_, INDEX_ALL, true); checkBlocka(); } @@ -284,9 +284,9 @@ TEST_F(IndexBlockTest, ChecksGroupForCompleteElementsTrivial) { const int group[] = { 0, 1, 2 }; setGroup(group); - EXPECT_TRUE(gmx_ana_index_has_complete_elems(&g_, INDEX_ATOM, NULL)); - EXPECT_FALSE(gmx_ana_index_has_complete_elems(&g_, INDEX_ALL, NULL)); - EXPECT_FALSE(gmx_ana_index_has_complete_elems(&g_, INDEX_UNKNOWN, NULL)); + EXPECT_TRUE(gmx_ana_index_has_complete_elems(&g_, INDEX_ATOM, nullptr)); + EXPECT_FALSE(gmx_ana_index_has_complete_elems(&g_, INDEX_ALL, nullptr)); + EXPECT_FALSE(gmx_ana_index_has_complete_elems(&g_, INDEX_UNKNOWN, nullptr)); } TEST_F(IndexBlockTest, ChecksGroupForCompleteResiduesPositive) @@ -426,7 +426,7 @@ void IndexMapTest::testUpdate(int atomCount, const int atoms[], bool bMaskOnly, g.isize = atomCount; g.index = const_cast(atoms); gmx_ana_indexmap_update(&map_, &g, bMaskOnly); - if (name == NULL) + if (name == nullptr) { name = "Updated"; } @@ -464,7 +464,7 @@ void IndexMapTest::checkMapping(int atomCount, const int atoms[], for (int i = 0; i < map_.mapb.nr; ++i) { gmx::test::TestReferenceChecker blockCompound( - compound.checkCompound("Block", NULL)); + compound.checkCompound("Block", nullptr)); blockCompound.checkSequence(&atoms[map_.mapb.index[i]], &atoms[map_.mapb.index[i+1]], "Atoms"); @@ -540,7 +540,7 @@ TEST_F(IndexMapTest, MapsSingleBlock) const int maxGroup[] = { 0, 1, 2, 3 }; const int evalGroup[] = { 0, 2 }; testInit(maxGroup, INDEX_ALL); - testUpdate(evalGroup, false, NULL); + testUpdate(evalGroup, false, nullptr); } TEST_F(IndexMapTest, MapsResidueBlocks) @@ -552,7 +552,7 @@ TEST_F(IndexMapTest, MapsResidueBlocks) topManager_.initAtoms(18); topManager_.initUniformResidues(3); testInit(maxGroup, INDEX_RES); - testUpdate(evalGroup, false, NULL); + testUpdate(evalGroup, false, nullptr); } TEST_F(IndexMapTest, MapsResidueBlocksWithMask) @@ -564,7 +564,7 @@ TEST_F(IndexMapTest, MapsResidueBlocksWithMask) topManager_.initAtoms(18); topManager_.initUniformResidues(3); testInit(maxGroup, INDEX_RES); - testUpdate(evalGroup, true, NULL); + testUpdate(evalGroup, true, nullptr); } TEST_F(IndexMapTest, HandlesMultipleRequests) diff --git a/src/gromacs/selection/tests/nbsearch.cpp b/src/gromacs/selection/tests/nbsearch.cpp index 240f282ead..af445d88c3 100644 --- a/src/gromacs/selection/tests/nbsearch.cpp +++ b/src/gromacs/selection/tests/nbsearch.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -274,7 +274,7 @@ void NeighborhoodSearchTestData::computeReferencesInternal(t_pbc *pbc, bool bXY) for (int j = 0; j < refPosCount_; ++j) { rvec dx; - if (pbc != NULL) + if (pbc != nullptr) { pbc_dx(pbc, i->x, refPos_[j], dx); } @@ -372,9 +372,9 @@ ExclusionsHelper::ExclusionsHelper(int refPosCount, int testPosCount) exclusionIds_.begin()); excls_.nr = 0; - excls_.index = NULL; + excls_.index = nullptr; excls_.nra = 0; - excls_.a = NULL; + excls_.a = nullptr; excls_.nalloc_index = 0; excls_.nalloc_a = 0; } @@ -518,7 +518,7 @@ void NeighborhoodSearchTest::testPairSearch( gmx::AnalysisNeighborhoodSearch *search, const NeighborhoodSearchTestData &data) { - testPairSearchFull(search, data, data.testPositions(), NULL, + testPairSearchFull(search, data, data.testPositions(), nullptr, gmx::EmptyArrayRef(), gmx::EmptyArrayRef()); } @@ -532,7 +532,7 @@ void NeighborhoodSearchTest::testPairSearchIndexed( gmx::AnalysisNeighborhoodSearch search = nb->initSearch(&data.pbc_, data.refPositions().indexed(refIndices)); - testPairSearchFull(&search, data, data.testPositions(), NULL, + testPairSearchFull(&search, data, data.testPositions(), nullptr, refIndices, testIndices); } @@ -591,7 +591,7 @@ void NeighborhoodSearchTest::testPairSearchFull( } remainingTestPositions.erase(testIndex); refPairs = data.testPositions_[testIndex].refPairs; - if (excls != NULL) + if (excls != nullptr) { ExclusionsHelper::markExcludedPairs(&refPairs, testIndex, excls); } @@ -742,7 +742,7 @@ class TrivialNoPBCTestData { data_.generateRandomRefPositions(10); data_.generateRandomTestPositions(5); - data_.computeReferences(NULL); + data_.computeReferences(nullptr); } private: @@ -875,7 +875,7 @@ class RandomBoxNoPBCData data_.generateRandomRefPositions(1000); data_.generateRandomTestPositions(100); set_pbc(&data_.pbc_, epbcNONE, data_.box_); - data_.computeReferences(NULL); + data_.computeReferences(nullptr); } private: @@ -1059,7 +1059,7 @@ TEST_F(NeighborhoodSearchTest, HandlesNullPBC) nb_.setCutoff(data.cutoff_); gmx::AnalysisNeighborhoodSearch search = - nb_.initSearch(NULL, data.refPositions()); + nb_.initSearch(nullptr, data.refPositions()); ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode()); testIsWithin(&search, data); diff --git a/src/gromacs/selection/tests/poscalc.cpp b/src/gromacs/selection/tests/poscalc.cpp index 4b28450eea..00e22a5acc 100644 --- a/src/gromacs/selection/tests/poscalc.cpp +++ b/src/gromacs/selection/tests/poscalc.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -209,7 +209,7 @@ PositionCalculationTest::initPositions(gmx_ana_poscalc_t *pc, const char *name) void PositionCalculationTest::checkInitialized() { gmx::test::TestReferenceChecker compound( - checker_.checkCompound("InitializedPositions", NULL)); + checker_.checkCompound("InitializedPositions", nullptr)); PositionTestList::const_iterator pi; for (pi = posList_.begin(); pi != posList_.end(); ++pi) { @@ -224,7 +224,7 @@ void PositionCalculationTest::updateAndCheck( gmx_ana_index_t g; g.isize = atoms.size(); g.index = const_cast(atoms.data()); - gmx_ana_poscalc_update(pc, p, &g, topManager_.frame(), NULL); + gmx_ana_poscalc_update(pc, p, &g, topManager_.frame(), nullptr); checkPositions(checker, name, p, true); } @@ -248,7 +248,7 @@ void PositionCalculationTest::testSingleStatic( != gmx::PositionCalculationCollection::RequiredTopologyInfo::None; EXPECT_EQ(bExpectTop, requiresTopology); setMaximumGroup(pc, atoms); - gmx_ana_pos_t *p = initPositions(pc, NULL); + gmx_ana_pos_t *p = initPositions(pc, nullptr); checkInitialized(); { generateCoordinates(); @@ -260,7 +260,7 @@ void PositionCalculationTest::testSingleStatic( pcc_.initFrame(frame); gmx::test::TestReferenceChecker frameCompound( checker_.checkCompound("EvaluatedPositions", "Frame0")); - updateAndCheck(pc, p, atoms, &frameCompound, NULL); + updateAndCheck(pc, p, atoms, &frameCompound, nullptr); } } @@ -276,7 +276,7 @@ void PositionCalculationTest::testSingleDynamic( != gmx::PositionCalculationCollection::RequiredTopologyInfo::None; EXPECT_EQ(bExpectTop, requiresTopology); setMaximumGroup(pc, initAtoms); - gmx_ana_pos_t *p = initPositions(pc, NULL); + gmx_ana_pos_t *p = initPositions(pc, nullptr); checkInitialized(); { generateCoordinates(); @@ -288,7 +288,7 @@ void PositionCalculationTest::testSingleDynamic( pcc_.initFrame(topManager_.frame()); gmx::test::TestReferenceChecker frameCompound( checker_.checkCompound("EvaluatedPositions", "Frame0")); - updateAndCheck(pc, p, evalAtoms, &frameCompound, NULL); + updateAndCheck(pc, p, evalAtoms, &frameCompound, nullptr); } } @@ -334,7 +334,7 @@ void PositionCalculationTest::checkPositions( for (int i = 0; i < p->count(); ++i) { gmx::test::TestReferenceChecker posCompound( - compound.checkCompound("Position", NULL)); + compound.checkCompound("Position", nullptr)); posCompound.checkSequence(&p->m.mapb.a[p->m.mapb.index[i]], &p->m.mapb.a[p->m.mapb.index[i+1]], "Atoms"); @@ -343,11 +343,11 @@ void PositionCalculationTest::checkPositions( { posCompound.checkVector(p->x[i], "Coordinates"); } - if (bCoordinates && p->v != NULL) + if (bCoordinates && p->v != nullptr) { posCompound.checkVector(p->v[i], "Velocity"); } - if (bCoordinates && p->f != NULL) + if (bCoordinates && p->f != nullptr) { posCompound.checkVector(p->f[i], "Force"); } diff --git a/src/gromacs/selection/tests/selectioncollection.cpp b/src/gromacs/selection/tests/selectioncollection.cpp index c8c3a75c4a..356f2e7beb 100644 --- a/src/gromacs/selection/tests/selectioncollection.cpp +++ b/src/gromacs/selection/tests/selectioncollection.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -82,7 +82,7 @@ class SelectionCollectionTest : public ::testing::Test void setAtomCount(int natoms) { - ASSERT_NO_THROW_GMX(sc_.setTopology(NULL, natoms)); + ASSERT_NO_THROW_GMX(sc_.setTopology(nullptr, natoms)); } void loadTopology(const char *filename); void setTopology(); @@ -107,7 +107,7 @@ GMX_TEST_OPTIONS(SelectionCollectionTestOptions, options) #endif SelectionCollectionTest::SelectionCollectionTest() - : grps_(NULL) + : grps_(nullptr) { topManager_.requestFrame(); sc_.setDebugLevel(s_debugLevel); @@ -117,7 +117,7 @@ SelectionCollectionTest::SelectionCollectionTest() SelectionCollectionTest::~SelectionCollectionTest() { - if (grps_ != NULL) + if (grps_ != nullptr) { gmx_ana_indexgrps_free(grps_); } @@ -139,11 +139,11 @@ SelectionCollectionTest::setTopology() void SelectionCollectionTest::loadIndexGroups(const char *filename) { - GMX_RELEASE_ASSERT(grps_ == NULL, + GMX_RELEASE_ASSERT(grps_ == nullptr, "External groups can only be loaded once"); std::string fullpath = gmx::test::TestFileManager::getInputFilePath(filename); - gmx_ana_indexgrps_init(&grps_, NULL, fullpath.c_str()); + gmx_ana_indexgrps_init(&grps_, nullptr, fullpath.c_str()); sc_.setIndexGroups(grps_); } @@ -175,7 +175,7 @@ void SelectionCollectionInteractiveTest::runTest( // TODO: Check something about the returned selections as well. ASSERT_NO_THROW_GMX(sc_.parseInteractive( count, &helper_.inputStream(), - bInteractive ? &helper_.outputStream() : NULL, + bInteractive ? &helper_.outputStream() : nullptr, "for test context")); helper_.checkSession(); } @@ -253,7 +253,7 @@ SelectionCollectionDataTest::checkSelection( checker->checkSequenceCompound("Positions", sel.posCount())); for (int i = 0; i < sel.posCount(); ++i) { - TestReferenceChecker poscompound(compound.checkCompound("Position", NULL)); + TestReferenceChecker poscompound(compound.checkCompound("Position", nullptr)); const gmx::SelectionPosition &p = sel.position(i); if (flags.test(efTestPositionAtoms)) { @@ -365,7 +365,7 @@ SelectionCollectionDataTest::runEvaluate() using gmx::test::TestReferenceChecker; ++framenr_; - ASSERT_NO_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL)); + ASSERT_NO_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr)); std::string frame = gmx::formatString("Frame%d", framenr_); TestReferenceChecker compound( checker_.checkCompound("EvaluatedSelections", frame.c_str())); @@ -534,7 +534,7 @@ TEST_F(SelectionCollectionTest, HandlesMissingMethodParamValue3) TEST_F(SelectionCollectionTest, HandlesUnknownGroupReferenceParser1) { - ASSERT_NO_THROW_GMX(sc_.setIndexGroups(NULL)); + ASSERT_NO_THROW_GMX(sc_.setIndexGroups(nullptr)); EXPECT_THROW_GMX(sc_.parseFromString("group \"foo\""), gmx::InconsistentInputError); EXPECT_THROW_GMX(sc_.parseFromString("4"), gmx::InconsistentInputError); } @@ -550,7 +550,7 @@ TEST_F(SelectionCollectionTest, HandlesUnknownGroupReferenceDelayed1) { ASSERT_NO_THROW_GMX(sc_.parseFromString("group \"foo\"")); ASSERT_NO_FATAL_FAILURE(setAtomCount(10)); - EXPECT_THROW_GMX(sc_.setIndexGroups(NULL), gmx::InconsistentInputError); + EXPECT_THROW_GMX(sc_.setIndexGroups(nullptr), gmx::InconsistentInputError); EXPECT_THROW_GMX(sc_.compile(), gmx::APIError); } @@ -586,7 +586,7 @@ TEST_F(SelectionCollectionTest, HandlesUnsortedGroupReferenceDelayed) TEST_F(SelectionCollectionTest, HandlesOutOfRangeAtomIndexInGroup) { - ASSERT_NO_THROW_GMX(sc_.setTopology(NULL, 5)); + ASSERT_NO_THROW_GMX(sc_.setTopology(nullptr, 5)); ASSERT_NO_THROW_GMX(loadIndexGroups("simple.ndx")); EXPECT_THROW_GMX(sc_.parseFromString("group \"GrpB\""), gmx::InconsistentInputError); } @@ -595,12 +595,12 @@ TEST_F(SelectionCollectionTest, HandlesOutOfRangeAtomIndexInGroupDelayed) { ASSERT_NO_THROW_GMX(loadIndexGroups("simple.ndx")); ASSERT_NO_THROW_GMX(sc_.parseFromString("group \"GrpB\"")); - EXPECT_THROW_GMX(sc_.setTopology(NULL, 5), gmx::InconsistentInputError); + EXPECT_THROW_GMX(sc_.setTopology(nullptr, 5), gmx::InconsistentInputError); } TEST_F(SelectionCollectionTest, HandlesOutOfRangeAtomIndexInGroupDelayed2) { - ASSERT_NO_THROW_GMX(sc_.setTopology(NULL, 5)); + ASSERT_NO_THROW_GMX(sc_.setTopology(nullptr, 5)); ASSERT_NO_THROW_GMX(sc_.parseFromString("group \"GrpB\"")); EXPECT_THROW_GMX(loadIndexGroups("simple.ndx"), gmx::InconsistentInputError); } @@ -645,7 +645,7 @@ TEST_F(SelectionCollectionTest, RecoversFromInvalidPermutation3) ASSERT_NO_THROW_GMX(sc_.parseFromString("x < 1.5 permute 3 2 1")); ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro")); ASSERT_NO_THROW_GMX(sc_.compile()); - EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError); + EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError); } TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets) @@ -654,7 +654,7 @@ TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets) ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro")); ASSERT_NO_THROW_GMX(sc_.compile()); topManager_.frame()->natoms = 8; - EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError); + EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError); } TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets2) @@ -664,7 +664,7 @@ TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets2) ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro")); ASSERT_NO_THROW_GMX(sc_.compile()); topManager_.initFrameIndices(index); - EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError); + EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError); } TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets3) @@ -675,7 +675,7 @@ TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets3) ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro")); ASSERT_NO_THROW_GMX(sc_.compile()); topManager_.initFrameIndices(index); - EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError); + EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError); } TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets4) @@ -684,7 +684,7 @@ TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets4) ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro")); ASSERT_NO_THROW_GMX(sc_.compile()); topManager_.frame()->natoms = 10; - EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError); + EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError); } // TODO: Tests for more evaluation errors diff --git a/src/gromacs/selection/tests/selectionoption.cpp b/src/gromacs/selection/tests/selectionoption.cpp index d6d6e7053f..f230af5a69 100644 --- a/src/gromacs/selection/tests/selectionoption.cpp +++ b/src/gromacs/selection/tests/selectionoption.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -263,7 +263,7 @@ TEST_F(SelectionOptionTest, HandlesDefaultSelectionText) ASSERT_TRUE(sel.isValid()); - EXPECT_NO_THROW_GMX(sc_.setTopology(NULL, 10)); + EXPECT_NO_THROW_GMX(sc_.setTopology(nullptr, 10)); EXPECT_NO_THROW_GMX(sc_.compile()); EXPECT_STREQ("all", sel.selectionText()); diff --git a/src/gromacs/selection/tests/toputils.cpp b/src/gromacs/selection/tests/toputils.cpp index 4de0421cbc..975ce6e331 100644 --- a/src/gromacs/selection/tests/toputils.cpp +++ b/src/gromacs/selection/tests/toputils.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -96,9 +96,9 @@ TopologyManager::~TopologyManager() void TopologyManager::requestFrame() { - GMX_RELEASE_ASSERT(mtop_ == NULL, + GMX_RELEASE_ASSERT(mtop_ == nullptr, "Frame must be requested before initializing topology"); - if (frame_ == NULL) + if (frame_ == nullptr) { snew(frame_, 1); } @@ -106,7 +106,7 @@ void TopologyManager::requestFrame() void TopologyManager::requestVelocities() { - GMX_RELEASE_ASSERT(frame_ != NULL, + GMX_RELEASE_ASSERT(frame_ != nullptr, "Velocities requested before requesting a frame"); frame_->bV = TRUE; if (frame_->natoms > 0) @@ -117,7 +117,7 @@ void TopologyManager::requestVelocities() void TopologyManager::requestForces() { - GMX_RELEASE_ASSERT(frame_ != NULL, + GMX_RELEASE_ASSERT(frame_ != nullptr, "Forces requested before requesting a frame"); frame_->bF = TRUE; if (frame_->natoms > 0) @@ -130,17 +130,17 @@ void TopologyManager::loadTopology(const char *filename) { bool fullTopology; int ePBC; - rvec *xtop = NULL; + rvec *xtop = nullptr; matrix box; GMX_RELEASE_ASSERT(mtop_ == nullptr, "Topology initialized more than once"); snew(mtop_, 1); readConfAndTopology( gmx::test::TestFileManager::getInputFilePath(filename).c_str(), - &fullTopology, mtop_, &ePBC, frame_ != NULL ? &xtop : NULL, - NULL, box); + &fullTopology, mtop_, &ePBC, frame_ != nullptr ? &xtop : nullptr, + nullptr, box); - if (frame_ != NULL) + if (frame_ != nullptr) { frame_->natoms = mtop_->natoms; frame_->bX = TRUE; @@ -155,7 +155,7 @@ void TopologyManager::loadTopology(const char *filename) void TopologyManager::initAtoms(int count) { - GMX_RELEASE_ASSERT(mtop_ == NULL, "Topology initialized more than once"); + GMX_RELEASE_ASSERT(mtop_ == nullptr, "Topology initialized more than once"); snew(mtop_, 1); mtop_->nmoltype = 1; snew(mtop_->moltype, 1); @@ -175,7 +175,7 @@ void TopologyManager::initAtoms(int count) atoms.atom[i].m = (i % 3 == 0 ? 2.0 : 1.0); } atoms.haveMass = TRUE; - if (frame_ != NULL) + if (frame_ != nullptr) { frame_->natoms = count; frame_->bX = TRUE; @@ -215,7 +215,7 @@ void TopologyManager::initAtomTypes(const ConstArrayRef &types) void TopologyManager::initUniformResidues(int residueSize) { - GMX_RELEASE_ASSERT(mtop_ != NULL, "Topology not initialized"); + GMX_RELEASE_ASSERT(mtop_ != nullptr, "Topology not initialized"); t_atoms &atoms = this->atoms(); int residueIndex = -1; for (int i = 0; i < atoms.nr; ++i) @@ -230,7 +230,7 @@ void TopologyManager::initUniformResidues(int residueSize) void TopologyManager::initUniformMolecules(int moleculeSize) { - GMX_RELEASE_ASSERT(mtop_ != NULL, "Topology not initialized"); + GMX_RELEASE_ASSERT(mtop_ != nullptr, "Topology not initialized"); int index = 0; mtop_->mols.nalloc_index = (mtop_->natoms + moleculeSize - 1) / moleculeSize + 1; srenew(mtop_->mols.index, mtop_->mols.nalloc_index); diff --git a/src/gromacs/statistics/statistics.cpp b/src/gromacs/statistics/statistics.cpp index 44214e9b92..2e9fbc1b80 100644 --- a/src/gromacs/statistics/statistics.cpp +++ b/src/gromacs/statistics/statistics.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -143,19 +143,19 @@ int gmx_stats_get_point(gmx_stats_t gstats, real *x, real *y, outlier = (r > rmsd*level); if (outlier) { - if (NULL != x) + if (nullptr != x) { *x = stats->x[stats->np_c]; } - if (NULL != y) + if (nullptr != y) { *y = stats->y[stats->np_c]; } - if (NULL != dx) + if (nullptr != dx) { *dx = stats->dx[stats->np_c]; } - if (NULL != dy) + if (nullptr != dy) { *dy = stats->dy[stats->np_c]; } @@ -180,8 +180,8 @@ int gmx_stats_add_points(gmx_stats_t gstats, int n, real *x, real *y, { int ok; if ((ok = gmx_stats_add_point(gstats, x[i], y[i], - (NULL != dx) ? dx[i] : 0, - (NULL != dy) ? dy[i] : 0)) != estatsOK) + (nullptr != dx) ? dx[i] : 0, + (nullptr != dy) ? dy[i] : 0)) != estatsOK) { return ok; } @@ -329,27 +329,27 @@ int gmx_stats_get_ab(gmx_stats_t gstats, int weight, { return ok; } - if (NULL != a) + if (nullptr != a) { *a = stats->a; } - if (NULL != b) + if (nullptr != b) { *b = stats->b; } - if (NULL != da) + if (nullptr != da) { *da = stats->sigma_a; } - if (NULL != db) + if (nullptr != db) { *db = stats->sigma_b; } - if (NULL != chi2) + if (nullptr != chi2) { *chi2 = stats->chi2; } - if (NULL != Rfit) + if (nullptr != Rfit) { *Rfit = stats->Rfit; } @@ -367,19 +367,19 @@ int gmx_stats_get_a(gmx_stats_t gstats, int weight, real *a, real *da, { return ok; } - if (NULL != a) + if (nullptr != a) { *a = stats->aa; } - if (NULL != da) + if (nullptr != da) { *da = stats->sigma_aa; } - if (NULL != chi2) + if (nullptr != chi2) { *chi2 = stats->chi2aa; } - if (NULL != Rfit) + if (nullptr != Rfit) { *Rfit = stats->Rfitaa; } @@ -412,15 +412,15 @@ int gmx_stats_get_ase(gmx_stats_t gstats, real *aver, real *sigma, real *error) return ok; } - if (NULL != aver) + if (nullptr != aver) { *aver = stats->aver; } - if (NULL != sigma) + if (nullptr != sigma) { *sigma = stats->sigma_aver; } - if (NULL != error) + if (nullptr != error) { *error = stats->error; } @@ -674,7 +674,7 @@ int lsq_y_ax(int n, real x[], real y[], real *a) int ok; real da, chi2, Rfit; - gmx_stats_add_points(lsq, n, x, y, 0, 0); + gmx_stats_add_points(lsq, n, x, y, nullptr, nullptr); ok = gmx_stats_get_a(lsq, elsqWEIGHT_NONE, a, &da, &chi2, &Rfit); gmx_stats_free(lsq); @@ -691,11 +691,11 @@ static int low_lsq_y_ax_b(int n, real *xr, double *xd, real yr[], { double pt; - if (xd != NULL) + if (xd != nullptr) { pt = xd[i]; } - else if (xr != NULL) + else if (xr != nullptr) { pt = xr[i]; } @@ -710,7 +710,7 @@ static int low_lsq_y_ax_b(int n, real *xr, double *xd, real yr[], return ok; } } - ok = gmx_stats_get_ab(lsq, elsqWEIGHT_NONE, a, b, NULL, NULL, chi2, r); + ok = gmx_stats_get_ab(lsq, elsqWEIGHT_NONE, a, b, nullptr, nullptr, chi2, r); gmx_stats_free(lsq); return ok; @@ -718,13 +718,13 @@ static int low_lsq_y_ax_b(int n, real *xr, double *xd, real yr[], int lsq_y_ax_b(int n, real x[], real y[], real *a, real *b, real *r, real *chi2) { - return low_lsq_y_ax_b(n, x, NULL, y, a, b, r, chi2); + return low_lsq_y_ax_b(n, x, nullptr, y, a, b, r, chi2); } int lsq_y_ax_b_xdouble(int n, double x[], real y[], real *a, real *b, real *r, real *chi2) { - return low_lsq_y_ax_b(n, NULL, x, y, a, b, r, chi2); + return low_lsq_y_ax_b(n, nullptr, x, y, a, b, r, chi2); } int lsq_y_ax_b_error(int n, real x[], real y[], real dy[], diff --git a/src/gromacs/swap/swapcoords.cpp b/src/gromacs/swap/swapcoords.cpp index e1a035e957..2b8c903f1a 100644 --- a/src/gromacs/swap/swapcoords.cpp +++ b/src/gromacs/swap/swapcoords.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -73,8 +73,8 @@ static const char *SwS = {"SWAP:"}; /**< For output that comes from the swap module */ static const char *SwSEmpty = {" "}; /**< Placeholder for multi-line output */ static const char* CompStr[eCompNR] = {"A", "B" }; /**< Compartment name */ -static const char *SwapStr[eSwapTypesNR+1] = { "", "X-", "Y-", "Z-", NULL}; /**< Name for the swap types. */ -static const char *DimStr[DIM+1] = { "X", "Y", "Z", NULL}; /**< Name for the swap dimension. */ +static const char *SwapStr[eSwapTypesNR+1] = { "", "X-", "Y-", "Z-", nullptr}; /**< Name for the swap types. */ +static const char *DimStr[DIM+1] = { "X", "Y", "Z", nullptr}; /**< Name for the swap dimension. */ /** Keep track of through which channel the ions have passed */ enum eChannelHistory { @@ -312,7 +312,7 @@ static void get_molecule_center( rvec_add(reference, dx, correctPBCimage); /* Take weight into account */ - if (NULL == weights) + if (nullptr == weights) { wi = 1.0; } @@ -701,7 +701,7 @@ static void sortMoleculesIntoCompartments( add_to_list(iAtom, &g->comp[comp], dist); /* Master also checks for ion groups through which channel each ion has passed */ - if (MASTER(cr) && (g->comp_now != NULL) && !bIsSolvent) + if (MASTER(cr) && (g->comp_now != nullptr) && !bIsSolvent) { int globalAtomNr = g->ind[iAtom] + 1; /* PDB index starts at 1 ... */ detect_flux_per_channel(g, globalAtomNr, comp, g->xc[iAtom], @@ -737,7 +737,7 @@ static void sortMoleculesIntoCompartments( } } - if (bIsSolvent && NULL != fpout) + if (bIsSolvent && nullptr != fpout) { fprintf(fpout, "# Solv. molecules in comp.%s: %d comp.%s: %d\n", CompStr[eCompA], g->comp[eCompA].nMol, @@ -924,10 +924,10 @@ static void bc_initial_concentrations( /*! \brief Ensure that each atom belongs to at most one of the swap groups. */ static void check_swap_groups(t_swap *s, int nat, gmx_bool bVerbose) { - int *nGroup = NULL; /* This array counts for each atom in the MD system to - how many swap groups it belongs (should be 0 or 1!) */ + int *nGroup = nullptr; /* This array counts for each atom in the MD system to + how many swap groups it belongs (should be 0 or 1!) */ int ind = -1; - int nMultiple = 0; /* Number of atoms belonging to multiple groups */ + int nMultiple = 0; /* Number of atoms belonging to multiple groups */ if (bVerbose) @@ -984,7 +984,7 @@ static int get_group_apm_check( /* Determine the number of solvent atoms per solvent molecule from the * first solvent atom: */ int molb = 0; - mtopGetMolblockIndex(mtop, ind[0], &molb, NULL, NULL); + mtopGetMolblockIndex(mtop, ind[0], &molb, nullptr, nullptr); int apm = mtop->molblock[molb].natoms_mol; if (bVerbose) @@ -996,7 +996,7 @@ static int get_group_apm_check( /* Check whether this is also true for all other solvent atoms */ for (int i = 1; i < nat; i++) { - mtopGetMolblockIndex(mtop, ind[i], &molb, NULL, NULL); + mtopGetMolblockIndex(mtop, ind[i], &molb, nullptr, nullptr); if (apm != mtop->molblock[molb].natoms_mol) { gmx_fatal(FARGS, "Not all molecules of swap group %d consist of %d atoms.", @@ -1046,9 +1046,9 @@ static void print_ionlist_legend(t_inputrec *ir, } // Center of split groups - snprintf(buf, STRLEN, "%scenter of %s of split group 0", SwapStr[ir->eSwapCoords], (NULL != s->group[eGrpSplit0].m) ? "mass" : "geometry"); + snprintf(buf, STRLEN, "%scenter of %s of split group 0", SwapStr[ir->eSwapCoords], (nullptr != s->group[eGrpSplit0].m) ? "mass" : "geometry"); legend[count++] = gmx_strdup(buf); - snprintf(buf, STRLEN, "%scenter of %s of split group 1", SwapStr[ir->eSwapCoords], (NULL != s->group[eGrpSplit1].m) ? "mass" : "geometry"); + snprintf(buf, STRLEN, "%scenter of %s of split group 1", SwapStr[ir->eSwapCoords], (nullptr != s->group[eGrpSplit1].m) ? "mass" : "geometry"); legend[count++] = gmx_strdup(buf); // Ion flux for each channel and ion type @@ -1105,9 +1105,9 @@ static void detect_flux_per_channel_init( /* All these flux detection routines run on the master only */ if (!MASTER(cr)) { - g->comp_now = NULL; - g->comp_from = NULL; - g->channel_label = NULL; + g->comp_now = nullptr; + g->comp_from = nullptr; + g->channel_label = nullptr; return; } @@ -1204,13 +1204,13 @@ static void outputStartStructureIfWanted(gmx_mtop_t *mtop, rvec *x, int ePBC, ma { char *env = getenv("GMX_COMPELDUMP"); - if (env != NULL) + if (env != nullptr) { fprintf(stderr, "\n%s Found env.var. GMX_COMPELDUMP, will output CompEL starting structure made whole.\n" "%s In case of multimeric channels, please check whether they have the correct PBC representation.\n", SwS, SwSEmpty); - write_sto_conf_mtop("CompELAssumedWholeConfiguration.pdb", *mtop->name, mtop, x, NULL, ePBC, box); + write_sto_conf_mtop("CompELAssumedWholeConfiguration.pdb", *mtop->name, mtop, x, nullptr, ePBC, box); } } @@ -1233,7 +1233,7 @@ static void init_swapstate( matrix box, int ePBC) { - rvec *x_pbc = NULL; /* positions of the whole MD system with molecules made whole */ + rvec *x_pbc = nullptr; /* positions of the whole MD system with molecules made whole */ t_swapgrp *g; t_swap *s; @@ -1277,7 +1277,7 @@ static void init_swapstate( copy_rvecn(x, x_pbc, 0, mtop->natoms); /* This can only make individual molecules whole, not multimers */ - do_pbc_mtop(NULL, ePBC, box, mtop, x_pbc); + do_pbc_mtop(nullptr, ePBC, box, mtop, x_pbc); /* Output the starting structure? */ outputStartStructureIfWanted(mtop, x_pbc, ePBC, box); @@ -1394,8 +1394,8 @@ void convertOldToNewGroupFormat( */ int nAnions = 0; int nCations = 0; - int *indAnions = NULL; - int *indCations = NULL; + int *indAnions = nullptr; + int *indCations = nullptr; snew(indAnions, g->nat); snew(indCations, g->nat); @@ -1556,7 +1556,7 @@ void init_swapcoords( } } - if (*swapstatePtr == NULL) + if (*swapstatePtr == nullptr) { snew(*swapstatePtr, 1); } @@ -1709,7 +1709,7 @@ void init_swapcoords( } else { - s->fpout = NULL; + s->fpout = nullptr; } /* Prepare for parallel or serial run */ @@ -1720,7 +1720,7 @@ void init_swapcoords( g = &(s->group[ig]); g->nat_loc = 0; g->nalloc_loc = 0; - g->ind_loc = NULL; + g->ind_loc = nullptr; } } else @@ -2030,8 +2030,8 @@ gmx_bool do_swapcoords( for (ig = eSwapFixedGrpNR; ig < s->ngrp; ig++) { g = &(s->group[ig]); - communicate_group_positions(cr, g->xc, NULL, NULL, FALSE, - x, g->nat, g->nat_loc, g->ind_loc, g->c_ind_loc, NULL, NULL); + communicate_group_positions(cr, g->xc, nullptr, nullptr, FALSE, + x, g->nat, g->nat_loc, g->ind_loc, g->c_ind_loc, nullptr, nullptr); /* Determine how many ions of this type each compartment contains */ sortMoleculesIntoCompartments(g, cr, sc, box, step, s->fpout, bRerun, FALSE); @@ -2057,8 +2057,8 @@ gmx_bool do_swapcoords( /* Since we here know that we have to perform ion/water position exchanges, * we now assemble the solvent positions */ g = &(s->group[eGrpSolvent]); - communicate_group_positions(cr, g->xc, NULL, NULL, FALSE, - x, g->nat, g->nat_loc, g->ind_loc, g->c_ind_loc, NULL, NULL); + communicate_group_positions(cr, g->xc, nullptr, nullptr, FALSE, + x, g->nat, g->nat_loc, g->ind_loc, g->c_ind_loc, nullptr, nullptr); /* Determine how many molecules of solvent each compartment contains */ sortMoleculesIntoCompartments(g, cr, sc, box, step, s->fpout, bRerun, TRUE); @@ -2144,7 +2144,7 @@ gmx_bool do_swapcoords( } } - if (s->fpout != NULL) + if (s->fpout != nullptr) { print_ionlist(s, t, " # after swap"); } diff --git a/src/gromacs/tables/forcetable.cpp b/src/gromacs/tables/forcetable.cpp index 2b52c178a3..6fb0ad04de 100644 --- a/src/gromacs/tables/forcetable.cpp +++ b/src/gromacs/tables/forcetable.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -211,7 +211,7 @@ void table_spline3_fill_ewald_lr(real *table_f, vi = v_inrange - dc*(i - i_inrange)*dx; } - if (table_v != NULL) + if (table_v != nullptr) { table_v[i] = vi; } @@ -281,7 +281,7 @@ void table_spline3_fill_ewald_lr(real *table_f, /* Currently the last value only contains half the force: double it */ table_f[0] *= 2; - if (table_v != NULL && table_fdv0 != NULL) + if (table_v != nullptr && table_fdv0 != nullptr) { /* Copy to FDV0 table too. Allocation occurs in forcerec.c, * init_ewald_f_table(). @@ -609,7 +609,7 @@ static void read_tables(FILE *fp, const char *fn, { char *libfn; char buf[STRLEN]; - double **yy = NULL, start, end, dx0, dx1, ssd, vm, vp, f, numf; + double **yy = nullptr, start, end, dx0, dx1, ssd, vm, vp, f, numf; int k, i, nx, nx0 = 0, ny, nny, ns; gmx_bool bAllZero, bZeroV, bZeroF; double tabscale; @@ -1573,9 +1573,9 @@ t_forcetable *makeDispersionCorrectionTable(FILE *fp, t_forcerec *fr, real rtab, const char *tabfn) { - t_forcetable *dispersionCorrectionTable = NULL; + t_forcetable *dispersionCorrectionTable = nullptr; - if (tabfn == NULL) + if (tabfn == nullptr) { if (debug) { diff --git a/src/gromacs/timing/cyclecounter.cpp b/src/gromacs/timing/cyclecounter.cpp index bd776b8b22..4675769974 100644 --- a/src/gromacs/timing/cyclecounter.cpp +++ b/src/gromacs/timing/cyclecounter.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2006 David van der Spoel, Erik Lindahl, Berk Hess, University of Groningen. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -105,8 +105,8 @@ gmx_cycles_calibrate(double sampletime) * * We call gettimeofday an extra time at the start to avoid cache misses. */ - gettimeofday(&t1, NULL); - gettimeofday(&t1, NULL); + gettimeofday(&t1, nullptr); + gettimeofday(&t1, nullptr); c1 = gmx_cycles_read(); do @@ -120,7 +120,7 @@ gmx_cycles_calibrate(double sampletime) d = d/(1.0+static_cast(i)); } /* Read the time again */ - gettimeofday(&t2, NULL); + gettimeofday(&t2, nullptr); c2 = gmx_cycles_read(); timediff = static_cast(t2.tv_sec-t1.tv_sec)+(t2.tv_usec-t1.tv_usec)*1e-6; } diff --git a/src/gromacs/timing/wallcycle.cpp b/src/gromacs/timing/wallcycle.cpp index 7b9ab440a2..57fe28bfb3 100644 --- a/src/gromacs/timing/wallcycle.cpp +++ b/src/gromacs/timing/wallcycle.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -138,20 +138,20 @@ gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, t_commrec gmx_unused if (!wallcycle_have_counter()) { - return NULL; + return nullptr; } snew(wc, 1); wc->haveInvalidCount = FALSE; wc->wc_barrier = FALSE; - wc->wcc_all = NULL; + wc->wcc_all = nullptr; wc->wc_depth = 0; wc->ewc_prev = -1; wc->reset_counters = resetstep; #if GMX_MPI - if (PAR(cr) && getenv("GMX_CYCLE_BARRIER") != NULL) + if (PAR(cr) && getenv("GMX_CYCLE_BARRIER") != nullptr) { if (fplog) { @@ -163,7 +163,7 @@ gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, t_commrec gmx_unused #endif snew(wc->wcc, ewcNR); - if (getenv("GMX_CYCLE_ALL") != NULL) + if (getenv("GMX_CYCLE_ALL") != nullptr) { if (fplog) { @@ -186,20 +186,20 @@ gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, t_commrec gmx_unused void wallcycle_destroy(gmx_wallcycle_t wc) { - if (wc == NULL) + if (wc == nullptr) { return; } - if (wc->wcc != NULL) + if (wc->wcc != nullptr) { sfree(wc->wcc); } - if (wc->wcc_all != NULL) + if (wc->wcc_all != nullptr) { sfree(wc->wcc_all); } - if (wc->wcsc != NULL) + if (wc->wcsc != nullptr) { sfree(wc->wcsc); } @@ -255,7 +255,7 @@ void wallcycle_start(gmx_wallcycle_t wc, int ewc) { gmx_cycles_t cycle; - if (wc == NULL) + if (wc == nullptr) { return; } @@ -273,7 +273,7 @@ void wallcycle_start(gmx_wallcycle_t wc, int ewc) cycle = gmx_cycles_read(); wc->wcc[ewc].start = cycle; - if (wc->wcc_all != NULL) + if (wc->wcc_all != nullptr) { wc->wc_depth++; if (ewc == ewcRUN) @@ -289,7 +289,7 @@ void wallcycle_start(gmx_wallcycle_t wc, int ewc) void wallcycle_start_nocount(gmx_wallcycle_t wc, int ewc) { - if (wc == NULL) + if (wc == nullptr) { return; } @@ -302,7 +302,7 @@ double wallcycle_stop(gmx_wallcycle_t wc, int ewc) { gmx_cycles_t cycle, last; - if (wc == NULL) + if (wc == nullptr) { return 0; } @@ -364,7 +364,7 @@ void wallcycle_reset_all(gmx_wallcycle_t wc) { int i; - if (wc == NULL) + if (wc == nullptr) { return; } @@ -423,7 +423,7 @@ static void subtract_cycles(wallcc_t *wcc, int ewc_main, int ewc_sub) void wallcycle_scale_by_num_threads(gmx_wallcycle_t wc, bool isPmeRank, int nthreads_pp, int nthreads_pme) { - if (wc == NULL) + if (wc == nullptr) { return; } @@ -487,7 +487,7 @@ WallcycleCounts wallcycle_sum(t_commrec *cr, gmx_wallcycle_t wc) int i; int nsum; - if (wc == NULL) + if (wc == nullptr) { /* Default construction of std::array of non-class T can leave the values indeterminate, just like a C array, and icc @@ -569,7 +569,7 @@ WallcycleCounts wallcycle_sum(t_commrec *cr, gmx_wallcycle_t wc) MPI_Allreduce(cycles, cycles_sum.data(), nsum, MPI_DOUBLE, MPI_SUM, cr->mpi_comm_mysim); - if (wc->wcc_all != NULL) + if (wc->wcc_all != nullptr) { double *buf_all, *cyc_all; @@ -721,7 +721,7 @@ void wallcycle_print(FILE *fplog, const gmx::MDLogger &mdlog, int nnodes, int np char buf[STRLEN]; const char *hline = "-----------------------------------------------------------------------------"; - if (wc == NULL) + if (wc == nullptr) { return; } @@ -809,7 +809,7 @@ void wallcycle_print(FILE *fplog, const gmx::MDLogger &mdlog, int nnodes, int np tot_for_pp += cyc_sum[i]; } } - if (wc->wcc_all != NULL) + if (wc->wcc_all != nullptr) { for (i = 0; i < ewcNR; i++) { @@ -1015,7 +1015,7 @@ void wallcycle_print(FILE *fplog, const gmx::MDLogger &mdlog, int nnodes, int np extern gmx_int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc) { - if (wc == NULL) + if (wc == nullptr) { return -1; } @@ -1025,7 +1025,7 @@ extern gmx_int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc) extern void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_int64_t reset_counters) { - if (wc == NULL) + if (wc == nullptr) { return; } @@ -1035,7 +1035,7 @@ extern void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_int64_t reset_coun void wallcycle_sub_start(gmx_wallcycle_t wc, int ewcs) { - if (useCycleSubcounters && wc != NULL) + if (useCycleSubcounters && wc != nullptr) { wc->wcsc[ewcs].start = gmx_cycles_read(); } @@ -1043,7 +1043,7 @@ void wallcycle_sub_start(gmx_wallcycle_t wc, int ewcs) void wallcycle_sub_start_nocount(gmx_wallcycle_t wc, int ewcs) { - if (useCycleSubcounters && wc != NULL) + if (useCycleSubcounters && wc != nullptr) { wallcycle_sub_start(wc, ewcs); wc->wcsc[ewcs].n--; @@ -1052,7 +1052,7 @@ void wallcycle_sub_start_nocount(gmx_wallcycle_t wc, int ewcs) void wallcycle_sub_stop(gmx_wallcycle_t wc, int ewcs) { - if (useCycleSubcounters && wc != NULL) + if (useCycleSubcounters && wc != nullptr) { wc->wcsc[ewcs].c += gmx_cycles_read() - wc->wcsc[ewcs].start; wc->wcsc[ewcs].n++; diff --git a/src/gromacs/tools/check.cpp b/src/gromacs/tools/check.cpp index d2fbd69984..68a79f2342 100644 --- a/src/gromacs/tools/check.cpp +++ b/src/gromacs/tools/check.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -134,7 +134,7 @@ static void comp_tpx(const char *fn1, const char *fn2, * but it might be useful to keep t_topology comparison as an option. */ top[0] = gmx_mtop_t_to_t_topology(&mtop[0], true); - cmp_top(stdout, &top[0], NULL, ftol, abstol); + cmp_top(stdout, &top[0], nullptr, ftol, abstol); } } } @@ -386,7 +386,7 @@ void chk_trj(const gmx_output_env_t *oenv, const char *fn, const char *tpr, real gmx_bool bShowTimestep = TRUE, newline = FALSE; t_trxstatus *status; gmx_mtop_t mtop; - gmx_localtop_t *top = NULL; + gmx_localtop_t *top = nullptr; t_state state; t_inputrec *ir; @@ -751,7 +751,7 @@ void chk_enx(const char *fn) { int nre, fnr; ener_file_t in; - gmx_enxnm_t *enm = NULL; + gmx_enxnm_t *enm = nullptr; t_enxframe *fr; gmx_bool bShowTStep; gmx_bool timeSet; @@ -840,18 +840,18 @@ int gmx_check(int argc, char *argv[]) "consisting of a rough outline for a methods section for a paper." }; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffOPTRD }, - { efTRX, "-f2", NULL, ffOPTRD }, + { efTRX, "-f", nullptr, ffOPTRD }, + { efTRX, "-f2", nullptr, ffOPTRD }, { efTPR, "-s1", "top1", ffOPTRD }, { efTPR, "-s2", "top2", ffOPTRD }, - { efTPS, "-c", NULL, ffOPTRD }, - { efEDR, "-e", NULL, ffOPTRD }, + { efTPS, "-c", nullptr, ffOPTRD }, + { efEDR, "-e", nullptr, ffOPTRD }, { efEDR, "-e2", "ener2", ffOPTRD }, - { efNDX, "-n", NULL, ffOPTRD }, - { efTEX, "-m", NULL, ffOPTWR } + { efNDX, "-n", nullptr, ffOPTRD }, + { efTEX, "-m", nullptr, ffOPTWR } }; #define NFILE asize(fnm) - const char *fn1 = NULL, *fn2 = NULL, *tex = NULL; + const char *fn1 = nullptr, *fn2 = nullptr, *tex = nullptr; gmx_output_env_t *oenv; static real vdw_fac = 0.8; @@ -861,7 +861,7 @@ int gmx_check(int argc, char *argv[]) static real ftol = 0.001; static real abstol = 0.001; static gmx_bool bCompAB = FALSE; - static char *lastener = NULL; + static char *lastener = nullptr; static t_pargs pa[] = { { "-vdwfac", FALSE, etREAL, {&vdw_fac}, "Fraction of sum of VdW radii used as warning cutoff" }, @@ -882,7 +882,7 @@ int gmx_check(int argc, char *argv[]) }; if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { return 0; } @@ -909,11 +909,11 @@ int gmx_check(int argc, char *argv[]) { if (bCompAB) { - if (fn1 == NULL) + if (fn1 == nullptr) { gmx_fatal(FARGS, "With -ab you need to set the -s1 option"); } - fn2 = NULL; + fn2 = nullptr; } comp_tpx(fn1, fn2, bRMSD, ftol, abstol); } diff --git a/src/gromacs/tools/convert_tpr.cpp b/src/gromacs/tools/convert_tpr.cpp index a81324d405..a2764f506b 100644 --- a/src/gromacs/tools/convert_tpr.cpp +++ b/src/gromacs/tools/convert_tpr.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -354,12 +354,12 @@ int gmx_convert_tpr(int argc, char *argv[]) t_state state; int gnx; char *grpname; - int *index = NULL; + int *index = nullptr; char buf[200], buf2[200]; gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD }, { efTPR, "-o", "tprout", ffWRITE } }; #define NFILE asize(fnm) @@ -381,7 +381,7 @@ int gmx_convert_tpr(int argc, char *argv[]) /* Parse the command line */ if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { return 0; } diff --git a/src/gromacs/tools/dump.cpp b/src/gromacs/tools/dump.cpp index 0c421ffd83..0979763b0a 100644 --- a/src/gromacs/tools/dump.cpp +++ b/src/gromacs/tools/dump.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -94,12 +94,12 @@ static void list_tpx(const char *fn, read_tpx_state(fn, ir, &state, - tpx.bTop ? &mtop : NULL); + tpx.bTop ? &mtop : nullptr); if (mdpfn && tpx.bIr) { gp = gmx_fio_fopen(mdpfn, "w"); - pr_inputrec(gp, 0, NULL, ir, TRUE); + pr_inputrec(gp, 0, nullptr, ir, TRUE); gmx_fio_fclose(gp); } @@ -127,18 +127,18 @@ static void list_tpx(const char *fn, pr_top(stdout, indent, "topology", &(top), bShowNumbers, bShowParameters); } - pr_rvecs(stdout, indent, "box", tpx.bBox ? state.box : NULL, DIM); - pr_rvecs(stdout, indent, "box_rel", tpx.bBox ? state.box_rel : NULL, DIM); - pr_rvecs(stdout, indent, "boxv", tpx.bBox ? state.boxv : NULL, DIM); - pr_rvecs(stdout, indent, "pres_prev", tpx.bBox ? state.pres_prev : NULL, DIM); - pr_rvecs(stdout, indent, "svir_prev", tpx.bBox ? state.svir_prev : NULL, DIM); - pr_rvecs(stdout, indent, "fvir_prev", tpx.bBox ? state.fvir_prev : NULL, DIM); + pr_rvecs(stdout, indent, "box", tpx.bBox ? state.box : nullptr, DIM); + pr_rvecs(stdout, indent, "box_rel", tpx.bBox ? state.box_rel : nullptr, DIM); + pr_rvecs(stdout, indent, "boxv", tpx.bBox ? state.boxv : nullptr, DIM); + pr_rvecs(stdout, indent, "pres_prev", tpx.bBox ? state.pres_prev : nullptr, DIM); + pr_rvecs(stdout, indent, "svir_prev", tpx.bBox ? state.svir_prev : nullptr, DIM); + pr_rvecs(stdout, indent, "fvir_prev", tpx.bBox ? state.fvir_prev : nullptr, DIM); /* leave nosehoover_xi in for now to match the tpr version */ pr_doubles(stdout, indent, "nosehoover_xi", state.nosehoover_xi.data(), state.ngtc); /*pr_doubles(stdout,indent,"nosehoover_vxi",state.nosehoover_vxi,state.ngtc);*/ /*pr_doubles(stdout,indent,"therm_integral",state.therm_integral,state.ngtc);*/ - pr_rvecs(stdout, indent, "x", tpx.bX ? as_rvec_array(state.x.data()) : NULL, state.natoms); - pr_rvecs(stdout, indent, "v", tpx.bV ? as_rvec_array(state.v.data()) : NULL, state.natoms); + pr_rvecs(stdout, indent, "x", tpx.bX ? as_rvec_array(state.x.data()) : nullptr, state.natoms); + pr_rvecs(stdout, indent, "v", tpx.bV ? as_rvec_array(state.v.data()) : nullptr, state.natoms); } groups = &mtop.groups; @@ -179,7 +179,7 @@ static void list_top(const char *fn) #define BUFLEN 256 char buf[BUFLEN]; gmx_cpp_t handle; - char *cppopts[] = { NULL }; + char *cppopts[] = { nullptr }; status = cpp_open_file(fn, &handle, cppopts); if (status != 0) @@ -229,10 +229,10 @@ static void list_trr(const char *fn) snew(v, trrheader.natoms); snew(f, trrheader.natoms); if (gmx_trr_read_frame_data(fpread, &trrheader, - trrheader.box_size ? box : NULL, - trrheader.x_size ? x : NULL, - trrheader.v_size ? v : NULL, - trrheader.f_size ? f : NULL)) + trrheader.box_size ? box : nullptr, + trrheader.x_size ? x : nullptr, + trrheader.v_size ? v : nullptr, + trrheader.f_size ? f : nullptr)) { sprintf(buf, "%s frame %d", fn, nframe); indent = 0; @@ -350,16 +350,16 @@ static void list_tng(const char gmx_unused *fn) #ifdef GMX_USE_TNG tng_trajectory_t tng; gmx_int64_t nframe = 0; - gmx_int64_t i, *block_ids = NULL, step, ndatablocks; + gmx_int64_t i, *block_ids = nullptr, step, ndatablocks; gmx_bool bOK; - real *values = NULL; + real *values = nullptr; gmx_tng_open(fn, 'r', &tng); gmx_print_tng_molecule_system(tng, stdout); bOK = gmx_get_tng_data_block_types_of_next_frame(tng, -1, 0, - NULL, + nullptr, &step, &ndatablocks, &block_ids); do @@ -392,7 +392,7 @@ static void list_tng(const char gmx_unused *fn) } while (gmx_get_tng_data_block_types_of_next_frame(tng, step, 0, - NULL, + nullptr, &step, &ndatablocks, &block_ids)); @@ -429,7 +429,7 @@ void list_ene(const char *fn) { ener_file_t in; gmx_bool bCont; - gmx_enxnm_t *enm = NULL; + gmx_enxnm_t *enm = nullptr; t_enxframe *fr; int i, j, nre, b; char buf[22]; @@ -557,12 +557,12 @@ void list_ene(const char *fn) static void list_mtx(const char *fn) { int nrow, ncol, i, j, k; - real *full = NULL, value; - gmx_sparsematrix_t * sparse = NULL; + real *full = nullptr, value; + gmx_sparsematrix_t * sparse = nullptr; gmx_mtxio_read(fn, &nrow, &ncol, &full, &sparse); - if (full == NULL) + if (full == nullptr) { snew(full, nrow*ncol); for (i = 0; i < nrow*ncol; i++) @@ -613,13 +613,13 @@ int gmx_dump(int argc, char *argv[]) "Position restraint output from -sys -s is broken" }; t_filenm fnm[] = { - { efTPR, "-s", NULL, ffOPTRD }, - { efTRX, "-f", NULL, ffOPTRD }, - { efEDR, "-e", NULL, ffOPTRD }, - { efCPT, NULL, NULL, ffOPTRD }, - { efTOP, "-p", NULL, ffOPTRD }, + { efTPR, "-s", nullptr, ffOPTRD }, + { efTRX, "-f", nullptr, ffOPTRD }, + { efEDR, "-e", nullptr, ffOPTRD }, + { efCPT, nullptr, nullptr, ffOPTRD }, + { efTOP, "-p", nullptr, ffOPTRD }, { efMTX, "-mtx", "hessian", ffOPTRD }, - { efMDP, "-om", NULL, ffOPTWR } + { efMDP, "-om", nullptr, ffOPTWR } }; #define NFILE asize(fnm) diff --git a/src/gromacs/topology/atomprop.cpp b/src/gromacs/topology/atomprop.cpp index 0fda312f0d..693d7d8bb5 100644 --- a/src/gromacs/topology/atomprop.cpp +++ b/src/gromacs/topology/atomprop.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -178,8 +178,8 @@ static void add_prop(aprop_t *ap, gmx_residuetype_t *restype, srenew(ap->bAvail, ap->maxprop); for (i = ap->nprop; (i < ap->maxprop); i++) { - ap->atomnm[i] = NULL; - ap->resnm[i] = NULL; + ap->atomnm[i] = nullptr; + ap->resnm[i] = nullptr; ap->value[i] = 0; ap->bAvail[i] = FALSE; } @@ -317,7 +317,7 @@ void gmx_atomprop_destroy(gmx_atomprop_t aps) gmx_atomprop *ap = (gmx_atomprop*) aps; int p; - if (aps == NULL) + if (aps == nullptr) { printf("\nWARNING: gmx_atomprop_destroy called with a NULL pointer\n\n"); return; @@ -335,7 +335,7 @@ void gmx_atomprop_destroy(gmx_atomprop_t aps) static void vdw_warning(FILE *fp) { - if (NULL != fp) + if (nullptr != fp) { fprintf(fp, "NOTE: From version 5.0 %s uses the Van der Waals radii\n", gmx::getProgramContext().displayName()); @@ -414,7 +414,7 @@ char *gmx_atomprop_element(gmx_atomprop_t aps, int atomnumber) return ap->prop[epropElement].atomnm[i]; } } - return NULL; + return nullptr; } int gmx_atomprop_atomnumber(gmx_atomprop_t aps, const char *elem) diff --git a/src/gromacs/topology/atoms.cpp b/src/gromacs/topology/atoms.cpp index c23339aed6..72b504596a 100644 --- a/src/gromacs/topology/atoms.cpp +++ b/src/gromacs/topology/atoms.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -51,19 +51,19 @@ #include "gromacs/utility/txtdump.h" const char *ptype_str[eptNR+1] = { - "Atom", "Nucleus", "Shell", "Bond", "VSite", NULL + "Atom", "Nucleus", "Shell", "Bond", "VSite", nullptr }; void init_atom(t_atoms *at) { at->nr = 0; at->nres = 0; - at->atom = NULL; - at->resinfo = NULL; - at->atomname = NULL; - at->atomtype = NULL; - at->atomtypeB = NULL; - at->pdbinfo = NULL; + at->atom = nullptr; + at->resinfo = nullptr; + at->atomname = nullptr; + at->atomtype = nullptr; + at->atomtypeB = nullptr; + at->pdbinfo = nullptr; at->haveMass = FALSE; at->haveCharge = FALSE; at->haveType = FALSE; @@ -74,11 +74,11 @@ void init_atom(t_atoms *at) void init_atomtypes(t_atomtypes *at) { at->nr = 0; - at->radius = NULL; - at->vol = NULL; - at->atomnumber = NULL; - at->gb_radius = NULL; - at->S_hct = NULL; + at->radius = nullptr; + at->vol = nullptr; + at->atomnumber = nullptr; + at->gb_radius = nullptr; + at->S_hct = nullptr; } void done_atom(t_atoms *at) @@ -111,33 +111,33 @@ void add_t_atoms(t_atoms *atoms, int natom_extra, int nres_extra) { srenew(atoms->atomname, atoms->nr+natom_extra); srenew(atoms->atom, atoms->nr+natom_extra); - if (NULL != atoms->pdbinfo) + if (nullptr != atoms->pdbinfo) { srenew(atoms->pdbinfo, atoms->nr+natom_extra); } - if (NULL != atoms->atomtype) + if (nullptr != atoms->atomtype) { srenew(atoms->atomtype, atoms->nr+natom_extra); } - if (NULL != atoms->atomtypeB) + if (nullptr != atoms->atomtypeB) { srenew(atoms->atomtypeB, atoms->nr+natom_extra); } for (i = atoms->nr; (i < atoms->nr+natom_extra); i++) { - atoms->atomname[i] = NULL; + atoms->atomname[i] = nullptr; memset(&atoms->atom[i], 0, sizeof(atoms->atom[i])); - if (NULL != atoms->pdbinfo) + if (nullptr != atoms->pdbinfo) { std::memset(&atoms->pdbinfo[i], 0, sizeof(atoms->pdbinfo[i])); } - if (NULL != atoms->atomtype) + if (nullptr != atoms->atomtype) { - atoms->atomtype[i] = NULL; + atoms->atomtype[i] = nullptr; } - if (NULL != atoms->atomtypeB) + if (nullptr != atoms->atomtypeB) { - atoms->atomtypeB[i] = NULL; + atoms->atomtypeB[i] = nullptr; } } atoms->nr += natom_extra; @@ -158,8 +158,8 @@ void init_t_atoms(t_atoms *atoms, int natoms, gmx_bool bPdbinfo) atoms->nr = natoms; atoms->nres = 0; snew(atoms->atomname, natoms); - atoms->atomtype = NULL; - atoms->atomtypeB = NULL; + atoms->atomtype = nullptr; + atoms->atomtypeB = nullptr; snew(atoms->resinfo, natoms); snew(atoms->atom, natoms); atoms->haveMass = FALSE; @@ -173,7 +173,7 @@ void init_t_atoms(t_atoms *atoms, int natoms, gmx_bool bPdbinfo) } else { - atoms->pdbinfo = NULL; + atoms->pdbinfo = nullptr; } } @@ -195,36 +195,36 @@ t_atoms *copy_t_atoms(const t_atoms *src) int i; snew(dst, 1); - init_t_atoms(dst, src->nr, (NULL != src->pdbinfo)); + init_t_atoms(dst, src->nr, (nullptr != src->pdbinfo)); dst->nr = src->nr; - if (NULL != src->atomname) + if (nullptr != src->atomname) { snew(dst->atomname, src->nr); } - if (NULL != src->atomtype) + if (nullptr != src->atomtype) { snew(dst->atomtype, src->nr); } - if (NULL != src->atomtypeB) + if (nullptr != src->atomtypeB) { snew(dst->atomtypeB, src->nr); } for (i = 0; (i < src->nr); i++) { dst->atom[i] = src->atom[i]; - if (NULL != src->pdbinfo) + if (nullptr != src->pdbinfo) { dst->pdbinfo[i] = src->pdbinfo[i]; } - if (NULL != src->atomname) + if (nullptr != src->atomname) { dst->atomname[i] = src->atomname[i]; } - if (NULL != src->atomtype) + if (nullptr != src->atomtype) { dst->atomtype[i] = src->atomtype[i]; } - if (NULL != src->atomtypeB) + if (nullptr != src->atomtypeB) { dst->atomtypeB[i] = src->atomtypeB[i]; } @@ -245,7 +245,7 @@ void t_atoms_set_resinfo(t_atoms *atoms, int atom_ind, t_symtab *symtab, ri = &atoms->resinfo[atoms->atom[atom_ind].resind]; ri->name = put_symtab(symtab, resname); - ri->rtp = NULL; + ri->rtp = nullptr; ri->nr = resnr; ri->ic = ic; ri->chainnum = chainnum; @@ -380,7 +380,7 @@ void cmp_atoms(FILE *fp, const t_atoms *a1, const t_atoms *a2, real ftol, real a { for (i = 0; (i < a1->nr); i++) { - cmp_atom(fp, i, &(a1->atom[i]), NULL, ftol, abstol); + cmp_atom(fp, i, &(a1->atom[i]), nullptr, ftol, abstol); } } } diff --git a/src/gromacs/topology/atomsbuilder.cpp b/src/gromacs/topology/atomsbuilder.cpp index 4d7f771188..281c6666c1 100644 --- a/src/gromacs/topology/atomsbuilder.cpp +++ b/src/gromacs/topology/atomsbuilder.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -74,7 +74,7 @@ AtomsBuilder::~AtomsBuilder() char **AtomsBuilder::symtabString(char **source) { - if (symtab_ != NULL) + if (symtab_ != nullptr) { return put_symtab(symtab_, *source); } @@ -268,7 +268,7 @@ void AtomsRemover::removeMarkedElements(std::vector *container) const void AtomsRemover::removeMarkedAtoms(t_atoms *atoms) const { const int originalAtomCount = atoms->nr; - AtomsBuilder builder(atoms, NULL); + AtomsBuilder builder(atoms, nullptr); if (atoms->nr > 0) { builder.setNextResidueNumber(atoms->resinfo[0].nr); diff --git a/src/gromacs/topology/block.cpp b/src/gromacs/topology/block.cpp index 0d09f5e4de..73c7e47cbb 100644 --- a/src/gromacs/topology/block.cpp +++ b/src/gromacs/topology/block.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -61,7 +61,7 @@ void init_blocka(t_blocka *block) snew(block->index, block->nalloc_index); block->index[0] = 0; block->nalloc_a = 0; - block->a = NULL; + block->a = nullptr; } t_blocka *new_blocka(void) @@ -87,8 +87,8 @@ void done_blocka(t_blocka *block) block->nra = 0; sfree(block->index); sfree(block->a); - block->index = NULL; - block->a = NULL; + block->index = nullptr; + block->a = nullptr; block->nalloc_index = 0; block->nalloc_a = 0; } diff --git a/src/gromacs/topology/index.cpp b/src/gromacs/topology/index.cpp index ace7395591..4d148ce2cb 100644 --- a/src/gromacs/topology/index.cpp +++ b/src/gromacs/topology/index.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -229,8 +229,8 @@ typedef struct { static void analyse_other(const char ** restype, const t_atoms *atoms, t_blocka *gb, char ***gn, gmx_bool bASK, gmx_bool bVerb) { - restp_t *restp = NULL; - char **attp = NULL; + restp_t *restp = nullptr; + char **attp = nullptr; char *rname, *aname; int *aid, *aaid; int i, j, k, l, resind, naid, naaid, natp, nrestp = 0; @@ -331,7 +331,7 @@ static void analyse_other(const char ** restype, const t_atoms *atoms, } } sfree(attp); - attp = NULL; + attp = nullptr; } } sfree(aid); @@ -388,7 +388,7 @@ static void analyse_prot(const char ** restype, const t_atoms *atoms, }; static const t_gmx_help_make_index_group constructing_data[] = - {{ NULL, 0, "Protein", TRUE, -1, -1}, + {{ nullptr, 0, "Protein", TRUE, -1, -1}, { pnoh, asize(pnoh), "Protein-H", TRUE, 0, -1}, { calpha, asize(calpha), "C-alpha", FALSE, -1, -1}, { bb, asize(bb), "Backbone", FALSE, -1, -1}, @@ -569,7 +569,7 @@ static void analyse_prot(const char ** restype, const t_atoms *atoms, void analyse(const t_atoms *atoms, t_blocka *gb, char ***gn, gmx_bool bASK, gmx_bool bVerb) { - gmx_residuetype_t*rt = NULL; + gmx_residuetype_t*rt = nullptr; char *resnm; int *aid; const char ** restype; @@ -600,7 +600,7 @@ void analyse(const t_atoms *atoms, t_blocka *gb, char ***gn, gmx_bool bASK, gmx_ snew(restype, atoms->nres); ntypes = 0; - p_typename = NULL; + p_typename = nullptr; if (atoms->nres > 0) { int i = 0; @@ -765,10 +765,10 @@ t_blocka *init_index(const char *gfile, char ***grpname) in = gmx_ffopen(gfile, "r"); snew(b, 1); b->nr = 0; - b->index = NULL; + b->index = nullptr; b->nra = 0; - b->a = NULL; - *grpname = NULL; + b->a = nullptr; + *grpname = nullptr; maxentries = 0; while (get_a_line(in, line, STRLEN)) { @@ -800,7 +800,7 @@ t_blocka *init_index(const char *gfile, char ***grpname) srenew(b->a, maxentries); } assert(b->a != NULL); // for clang analyzer - b->a[i] = strtol(str, NULL, 10)-1; + b->a[i] = strtol(str, nullptr, 10)-1; b->index[b->nr]++; (b->nra)++; pt = strstr(pt, str)+strlen(str); @@ -888,7 +888,7 @@ int find_group(const char *s, int ngrps, char **grpname) strcpy(string, grpname[i]); upstring(string); minstring(string); - if (strstr(string, key) != NULL) + if (strstr(string, key) != nullptr) { if (aa != -1) { @@ -1020,12 +1020,12 @@ void get_index(const t_atoms *atoms, const char *fnm, int ngrps, int isize[], int *index[], char *grpnames[]) { char ***gnames; - t_blocka *grps = NULL; + t_blocka *grps = nullptr; int *grpnr; snew(grpnr, ngrps); snew(gnames, 1); - if (fnm != NULL) + if (fnm != nullptr) { grps = init_index(fnm, gnames); } diff --git a/src/gromacs/topology/mtop_lookup.h b/src/gromacs/topology/mtop_lookup.h index 6a8b69fe47..1d892ab179 100644 --- a/src/gromacs/topology/mtop_lookup.h +++ b/src/gromacs/topology/mtop_lookup.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016, by the GROMACS development team, led by + * Copyright (c) 2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -129,7 +129,7 @@ mtopGetAtomParameters(const gmx_mtop_t *mtop, { int atomIndexInMolecule; mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock, - NULL, &atomIndexInMolecule); + nullptr, &atomIndexInMolecule); const gmx_moltype_t &moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type]; return moltype.atoms.atom[atomIndexInMolecule]; } @@ -236,7 +236,7 @@ mtopGetResidueInfo(const gmx_mtop_t *mtop, { int atomIndexInMolecule; mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock, - NULL, &atomIndexInMolecule); + nullptr, &atomIndexInMolecule); const gmx_moltype_t &moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type]; const int resind = moltype.atoms.atom[atomIndexInMolecule].resind; return moltype.atoms.resinfo[resind]; @@ -261,7 +261,7 @@ mtopGetAtomPdbInfo(const gmx_mtop_t *mtop, { int atomIndexInMolecule; mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock, - NULL, &atomIndexInMolecule); + nullptr, &atomIndexInMolecule); const gmx_moltype_t &moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type]; GMX_ASSERT(moltype.atoms.havePdbInfo, "PDB information not present when requested"); return moltype.atoms.pdbinfo[atomIndexInMolecule]; diff --git a/src/gromacs/topology/mtop_util.cpp b/src/gromacs/topology/mtop_util.cpp index 9df6422644..52b1305bd3 100644 --- a/src/gromacs/topology/mtop_util.cpp +++ b/src/gromacs/topology/mtop_util.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2008,2009,2010,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2008,2009,2010,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -121,7 +121,7 @@ void gmx_mtop_finalize(gmx_mtop_t *mtop) } env = getenv("GMX_MAXRESRENUM"); - if (env != NULL) + if (env != nullptr) { sscanf(env, "%d", &mtop->maxres_renum); } @@ -251,7 +251,7 @@ static void gmx_mtop_atomloop_all_destroy(gmx_mtop_atomloop_all_t aloop) gmx_bool gmx_mtop_atomloop_all_next(gmx_mtop_atomloop_all_t aloop, int *at_global, const t_atom **atom) { - if (aloop == NULL) + if (aloop == nullptr) { gmx_incons("gmx_mtop_atomloop_all_next called without calling gmx_mtop_atomloop_all_init"); } @@ -340,7 +340,7 @@ static void gmx_mtop_atomloop_block_destroy(gmx_mtop_atomloop_block_t aloop) gmx_bool gmx_mtop_atomloop_block_next(gmx_mtop_atomloop_block_t aloop, const t_atom **atom, int *nmol) { - if (aloop == NULL) + if (aloop == nullptr) { gmx_incons("gmx_mtop_atomloop_all_next called without calling gmx_mtop_atomloop_all_init"); } @@ -392,7 +392,7 @@ static void gmx_mtop_ilistloop_destroy(gmx_mtop_ilistloop_t iloop) gmx_bool gmx_mtop_ilistloop_next(gmx_mtop_ilistloop_t iloop, t_ilist **ilist_mol, int *nmol) { - if (iloop == NULL) + if (iloop == nullptr) { gmx_incons("gmx_mtop_ilistloop_next called without calling gmx_mtop_ilistloop_init"); } @@ -451,7 +451,7 @@ gmx_bool gmx_mtop_ilistloop_all_next(gmx_mtop_ilistloop_all_t iloop, t_ilist **ilist_mol, int *atnr_offset) { - if (iloop == NULL) + if (iloop == nullptr) { gmx_incons("gmx_mtop_ilistloop_all_next called without calling gmx_mtop_ilistloop_all_init"); } @@ -857,9 +857,9 @@ static void gen_local_top(const gmx_mtop_t *mtop, idef->atnr = ffp->atnr; idef->functype = ffp->functype; idef->iparams = ffp->iparams; - idef->iparams_posres = NULL; + idef->iparams_posres = nullptr; idef->iparams_posres_nalloc = 0; - idef->iparams_fbposres = NULL; + idef->iparams_fbposres = nullptr; idef->iparams_fbposres_nalloc = 0; idef->fudgeQQ = ffp->fudgeQQ; idef->cmap_grid = ffp->cmap_grid; @@ -871,7 +871,7 @@ static void gen_local_top(const gmx_mtop_t *mtop, { idef->il[ftype].nr = 0; idef->il[ftype].nalloc = 0; - idef->il[ftype].iatoms = NULL; + idef->il[ftype].iatoms = nullptr; } natoms = 0; diff --git a/src/gromacs/topology/residuetypes.cpp b/src/gromacs/topology/residuetypes.cpp index 50485b318f..b7d189f4cc 100644 --- a/src/gromacs/topology/residuetypes.cpp +++ b/src/gromacs/topology/residuetypes.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -66,8 +66,8 @@ gmx_residuetype_init(gmx_residuetype_t **prt) *prt = rt; rt->n = 0; - rt->resname = NULL; - rt->restype = NULL; + rt->resname = nullptr; + rt->restype = nullptr; db = libopen("residuetypes.dat"); @@ -158,7 +158,7 @@ gmx_residuetype_get_alltypes(gmx_residuetype_t *rt, int * ntypes) { int n = 0; - const char **my_typename = NULL; + const char **my_typename = nullptr; if (rt->n > 0) { @@ -280,6 +280,6 @@ gmx_residuetype_get_name(gmx_residuetype_t *rt, int index) } else { - return NULL; + return nullptr; } } diff --git a/src/gromacs/topology/symtab.cpp b/src/gromacs/topology/symtab.cpp index 5d3c5c30c5..55d3a59d47 100644 --- a/src/gromacs/topology/symtab.cpp +++ b/src/gromacs/topology/symtab.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -100,7 +100,7 @@ int lookup_symtab(t_symtab *symtab, char **name) base = 0; symbuf = symtab->symbuf; - while (symbuf != NULL) + while (symbuf != nullptr) { const int index = name-symbuf->buf; if ( ( index >= 0 ) && ( index < symbuf->bufsize ) ) @@ -122,7 +122,7 @@ char **get_symtab_handle(t_symtab *symtab, int name) t_symbuf *symbuf; symbuf = symtab->symbuf; - while (symbuf != NULL) + while (symbuf != nullptr) { if (name < symbuf->bufsize) { @@ -135,7 +135,7 @@ char **get_symtab_handle(t_symtab *symtab, int name) } } gmx_fatal(FARGS, "symtab get_symtab_handle %d not found", name); - return NULL; + return nullptr; } static t_symbuf *new_symbuf(void) @@ -145,7 +145,7 @@ static t_symbuf *new_symbuf(void) snew(symbuf, 1); symbuf->bufsize = TABLESIZE; snew(symbuf->buf, symbuf->bufsize); - symbuf->next = NULL; + symbuf->next = nullptr; return symbuf; } @@ -156,7 +156,7 @@ static char **enter_buf(t_symtab *symtab, char *name) t_symbuf *symbuf; gmx_bool bCont; - if (symtab->symbuf == NULL) + if (symtab->symbuf == nullptr) { symtab->symbuf = new_symbuf(); } @@ -166,7 +166,7 @@ static char **enter_buf(t_symtab *symtab, char *name) { for (i = 0; (i < symbuf->bufsize); i++) { - if (symbuf->buf[i] == NULL) + if (symbuf->buf[i] == nullptr) { symtab->nr++; symbuf->buf[i] = gmx_strdup(name); @@ -177,7 +177,7 @@ static char **enter_buf(t_symtab *symtab, char *name) return &(symbuf->buf[i]); } } - if (symbuf->next != NULL) + if (symbuf->next != nullptr) { symbuf = symbuf->next; bCont = TRUE; @@ -207,7 +207,7 @@ char **put_symtab(t_symtab *symtab, const char *name) void open_symtab(t_symtab *symtab) { symtab->nr = 0; - symtab->symbuf = NULL; + symtab->symbuf = nullptr; } void close_symtab(t_symtab gmx_unused *symtab) @@ -221,7 +221,7 @@ void done_symtab(t_symtab *symtab) close_symtab(symtab); symbuf = symtab->symbuf; - while (symbuf != NULL) + while (symbuf != nullptr) { for (i = 0; (i < symbuf->bufsize) && (i < symtab->nr); i++) { @@ -233,7 +233,7 @@ void done_symtab(t_symtab *symtab) symbuf = symbuf->next; sfree(freeptr); } - symtab->symbuf = NULL; + symtab->symbuf = nullptr; if (symtab->nr != 0) { gmx_incons("Freeing symbol table (symtab) structure"); @@ -246,14 +246,14 @@ void free_symtab(t_symtab *symtab) close_symtab(symtab); symbuf = symtab->symbuf; - while (symbuf != NULL) + while (symbuf != nullptr) { symtab->nr -= std::min(symbuf->bufsize, symtab->nr); freeptr = symbuf; symbuf = symbuf->next; sfree(freeptr); } - symtab->symbuf = NULL; + symtab->symbuf = nullptr; if (symtab->nr != 0) { gmx_incons("Freeing symbol table (symtab) structure"); @@ -271,7 +271,7 @@ void pr_symtab(FILE *fp, int indent, const char *title, t_symtab *symtab) i = 0; nr = symtab->nr; symbuf = symtab->symbuf; - while (symbuf != NULL) + while (symbuf != nullptr) { for (j = 0; (j < symbuf->bufsize) && (j < nr); j++) { diff --git a/src/gromacs/topology/topology.cpp b/src/gromacs/topology/topology.cpp index f113900e13..29e0475339 100644 --- a/src/gromacs/topology/topology.cpp +++ b/src/gromacs/topology/topology.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -54,29 +54,29 @@ const char *gtypes[egcNR+1] = { "T-Coupling", "Energy Mon.", "Acceleration", "Freeze", - "User1", "User2", "VCM", "Compressed X", "Or. Res. Fit", "QMMM", NULL + "User1", "User2", "VCM", "Compressed X", "Or. Res. Fit", "QMMM", nullptr }; static void init_groups(gmx_groups_t *groups) { groups->ngrpname = 0; - groups->grpname = NULL; + groups->grpname = nullptr; for (int g = 0; g < egcNR; g++) { - groups->grps[g].nm_ind = NULL; + groups->grps[g].nm_ind = nullptr; groups->ngrpnr[g] = 0; - groups->grpnr[g] = NULL; + groups->grpnr[g] = nullptr; } } void init_mtop(gmx_mtop_t *mtop) { - mtop->name = NULL; + mtop->name = nullptr; mtop->nmoltype = 0; - mtop->moltype = NULL; + mtop->moltype = nullptr; mtop->nmolblock = 0; - mtop->molblock = NULL; + mtop->molblock = nullptr; mtop->maxres_renum = 0; mtop->maxresnr = -1; init_groups(&mtop->groups); @@ -86,7 +86,7 @@ void init_mtop(gmx_mtop_t *mtop) void init_top(t_topology *top) { - top->name = NULL; + top->name = nullptr; init_atom(&(top->atoms)); init_atomtypes(&(top->atomtypes)); init_block(&top->cgs); @@ -129,15 +129,15 @@ void done_gmx_groups_t(gmx_groups_t *g) for (i = 0; (i < egcNR); i++) { - if (NULL != g->grps[i].nm_ind) + if (nullptr != g->grps[i].nm_ind) { sfree(g->grps[i].nm_ind); - g->grps[i].nm_ind = NULL; + g->grps[i].nm_ind = nullptr; } - if (NULL != g->grpnr[i]) + if (nullptr != g->grpnr[i]) { sfree(g->grpnr[i]); - g->grpnr[i] = NULL; + g->grpnr[i] = nullptr; } } /* The contents of this array is in symtab, don't free it here */ @@ -173,7 +173,7 @@ void done_top(t_topology *top) for (int f = 0; f < F_NRE; ++f) { sfree(top->idef.il[f].iatoms); - top->idef.il[f].iatoms = NULL; + top->idef.il[f].iatoms = nullptr; top->idef.il[f].nalloc = 0; } @@ -197,7 +197,7 @@ void done_top_mtop(t_topology *top, gmx_mtop_t *mtop) for (int f = 0; f < F_NRE; ++f) { sfree(top->idef.il[f].iatoms); - top->idef.il[f].iatoms = NULL; + top->idef.il[f].iatoms = nullptr; top->idef.il[f].nalloc = 0; } done_atom(&top->atoms); @@ -583,8 +583,8 @@ void cmp_top(FILE *fp, const t_topology *t1, const t_topology *t2, real ftol, re } else { - cmp_idef(fp, &(t1->idef), NULL, ftol, abstol); - cmp_atoms(fp, &(t1->atoms), NULL, ftol, abstol); + cmp_idef(fp, &(t1->idef), nullptr, ftol, abstol); + cmp_atoms(fp, &(t1->atoms), nullptr, ftol, abstol); } } @@ -612,7 +612,7 @@ void cmp_groups(FILE *fp, const gmx_groups_t *g0, const gmx_groups_t *g1, } cmp_int(fp, "ngrpnr", i, g0->ngrpnr[i], g1->ngrpnr[i]); if (g0->ngrpnr[i] == g1->ngrpnr[i] && natoms0 == natoms1 && - (g0->grpnr[i] != NULL || g1->grpnr[i] != NULL)) + (g0->grpnr[i] != nullptr || g1->grpnr[i] != nullptr)) { for (j = 0; j < natoms0; j++) { diff --git a/src/gromacs/topology/topsort.cpp b/src/gromacs/topology/topsort.cpp index de8e9850a0..4c3a7e80ce 100644 --- a/src/gromacs/topology/topsort.cpp +++ b/src/gromacs/topology/topsort.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -209,13 +209,13 @@ void gmx_sort_ilist_fe(t_idef *idef, const real *qA, const real *qB) t_iatom *iabuf; int iabuf_nalloc; - if (qB == NULL) + if (qB == nullptr) { qB = qA; } iabuf_nalloc = 0; - iabuf = NULL; + iabuf = nullptr; iparams = idef->iparams; diff --git a/src/gromacs/trajectoryanalysis/analysismodule.cpp b/src/gromacs/trajectoryanalysis/analysismodule.cpp index 11b2fc2b14..716368b974 100644 --- a/src/gromacs/trajectoryanalysis/analysismodule.cpp +++ b/src/gromacs/trajectoryanalysis/analysismodule.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -345,7 +345,7 @@ AbstractAnalysisData &TrajectoryAnalysisModule::datasetFromName(const char *name void TrajectoryAnalysisModule::registerBasicDataset(AbstractAnalysisData *data, const char *name) { - GMX_RELEASE_ASSERT(data != NULL, "Attempting to register NULL data"); + GMX_RELEASE_ASSERT(data != nullptr, "Attempting to register NULL data"); // TODO: Strong exception safety should be possible to implement. GMX_RELEASE_ASSERT(impl_->datasets_.find(name) == impl_->datasets_.end(), "Duplicate data set name registered"); diff --git a/src/gromacs/trajectoryanalysis/analysissettings.cpp b/src/gromacs/trajectoryanalysis/analysissettings.cpp index 98759771d4..4b1e935be6 100644 --- a/src/gromacs/trajectoryanalysis/analysissettings.cpp +++ b/src/gromacs/trajectoryanalysis/analysissettings.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -186,7 +186,7 @@ TrajectoryAnalysisSettings::setHelpText(const ConstArrayRef &help) */ TopologyInformation::TopologyInformation() - : mtop_(NULL), top_(NULL), bTop_(false), xtop_(NULL), ePBC_(-1) + : mtop_(nullptr), top_(nullptr), bTop_(false), xtop_(nullptr), ePBC_(-1) { clear_mat(boxtop_); } @@ -223,7 +223,7 @@ TopologyInformation::getTopologyConf(rvec **x, matrix box) const { if (!xtop_) { - *x = NULL; + *x = nullptr; GMX_THROW(APIError("Topology coordinates requested without setting efUseTopX")); } *x = xtop_; diff --git a/src/gromacs/trajectoryanalysis/analysissettings.h b/src/gromacs/trajectoryanalysis/analysissettings.h index 0873d8a5a6..f886d0b879 100644 --- a/src/gromacs/trajectoryanalysis/analysissettings.h +++ b/src/gromacs/trajectoryanalysis/analysissettings.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -254,7 +254,7 @@ class TopologyInformation { public: //! Returns true if a topology file was loaded. - bool hasTopology() const { return mtop_ != NULL; } + bool hasTopology() const { return mtop_ != nullptr; } //! Returns true if a full topology file was loaded. bool hasFullTopology() const { return bTop_; } //! Returns the loaded topology, or NULL if not loaded. diff --git a/src/gromacs/trajectoryanalysis/cmdlinerunner.cpp b/src/gromacs/trajectoryanalysis/cmdlinerunner.cpp index 71992a21f2..77c348ce58 100644 --- a/src/gromacs/trajectoryanalysis/cmdlinerunner.cpp +++ b/src/gromacs/trajectoryanalysis/cmdlinerunner.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -128,7 +128,7 @@ int RunnerModule::run() module_->initAfterFirstFrame(settings_, common_.frame()); t_pbc pbc; - t_pbc *ppbc = settings_.hasPBC() ? &pbc : NULL; + t_pbc *ppbc = settings_.hasPBC() ? &pbc : nullptr; int nframes = 0; AnalysisDataParallelOptions dataOptions; @@ -138,7 +138,7 @@ int RunnerModule::run() { common_.initFrame(); t_trxframe &frame = common_.frame(); - if (ppbc != NULL) + if (ppbc != nullptr) { set_pbc(ppbc, topology.ePBC(), frame.box); } @@ -151,7 +151,7 @@ int RunnerModule::run() } while (common_.readNextFrame()); module_->finishFrames(pdata.get()); - if (pdata.get() != NULL) + if (pdata.get() != nullptr) { pdata->finish(); } @@ -191,7 +191,7 @@ TrajectoryAnalysisCommandLineRunner::runAsMain( { return createModule(factory()); }; - return ICommandLineOptionsModule::runAsMain(argc, argv, NULL, NULL, runnerFactory); + return ICommandLineOptionsModule::runAsMain(argc, argv, nullptr, nullptr, runnerFactory); } // static diff --git a/src/gromacs/trajectoryanalysis/modules/angle.cpp b/src/gromacs/trajectoryanalysis/modules/angle.cpp index 4304efd0a7..058e5329c6 100644 --- a/src/gromacs/trajectoryanalysis/modules/angle.cpp +++ b/src/gromacs/trajectoryanalysis/modules/angle.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -314,7 +314,7 @@ class Angle : public TrajectoryAnalysisModule }; Angle::Angle() - : sel1info_(NULL), sel2info_(NULL), + : sel1info_(nullptr), sel2info_(nullptr), g1type_(Group1Type_Angle), g2type_(Group2Type_None), binWidth_(1.0), natoms1_(0), natoms2_(0) { diff --git a/src/gromacs/trajectoryanalysis/modules/distance.cpp b/src/gromacs/trajectoryanalysis/modules/distance.cpp index a3988d03e3..c766073734 100644 --- a/src/gromacs/trajectoryanalysis/modules/distance.cpp +++ b/src/gromacs/trajectoryanalysis/modules/distance.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -334,7 +334,7 @@ Distance::analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc, const SelectionPosition &p1 = sel[g].position(i); const SelectionPosition &p2 = sel[g].position(i+1); rvec dx; - if (pbc != NULL) + if (pbc != nullptr) { pbc_dx(pbc, p2.x(), p1.x(), dx); } diff --git a/src/gromacs/trajectoryanalysis/modules/freevolume.cpp b/src/gromacs/trajectoryanalysis/modules/freevolume.cpp index f639d3f643..faa8078eec 100644 --- a/src/gromacs/trajectoryanalysis/modules/freevolume.cpp +++ b/src/gromacs/trajectoryanalysis/modules/freevolume.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -317,7 +317,7 @@ FreeVolume::analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc, const Selection &sel = pdata->parallelSelection(sel_); gmx::UniformRealDistribution dist; - GMX_RELEASE_ASSERT(NULL != pbc, "You have no periodic boundary conditions"); + GMX_RELEASE_ASSERT(nullptr != pbc, "You have no periodic boundary conditions"); // Analysis framework magic dh.startFrame(frnr, fr.time); diff --git a/src/gromacs/trajectoryanalysis/modules/sasa.cpp b/src/gromacs/trajectoryanalysis/modules/sasa.cpp index eaff4344dc..de7116cac6 100644 --- a/src/gromacs/trajectoryanalysis/modules/sasa.cpp +++ b/src/gromacs/trajectoryanalysis/modules/sasa.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2006, The GROMACS development team. - * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -217,7 +217,7 @@ void connolly_plot(const char *fn, int ndots, real dots[], rvec x[], t_atoms *at srenew(atoms->resinfo, r0+1); atoms->atom[i0].resind = r0; t_atoms_set_resinfo(atoms, i0, symtab, resnm, r0+1, ' ', 0, ' '); - if (atoms->pdbinfo != NULL) + if (atoms->pdbinfo != nullptr) { srenew(atoms->pdbinfo, atoms->nr+ndots); } @@ -234,7 +234,7 @@ void connolly_plot(const char *fn, int ndots, real dots[], rvec x[], t_atoms *at xnew[ii0][XX] = dots[k++]; xnew[ii0][YY] = dots[k++]; xnew[ii0][ZZ] = dots[k++]; - if (atoms->pdbinfo != NULL) + if (atoms->pdbinfo != nullptr) { atoms->pdbinfo[ii0].type = epdbATOM; atoms->pdbinfo[ii0].atomnr = ii0; @@ -244,7 +244,7 @@ void connolly_plot(const char *fn, int ndots, real dots[], rvec x[], t_atoms *at } atoms->nr = i0+ndots; atoms->nres = r0+1; - write_sto_conf(fn, title, atoms, xnew, NULL, ePBC, const_cast(box)); + write_sto_conf(fn, title, atoms, xnew, nullptr, ePBC, const_cast(box)); atoms->nres = r0; atoms->nr = i0; } @@ -268,7 +268,7 @@ void connolly_plot(const char *fn, int ndots, real dots[], rvec x[], t_atoms *at aaa.pdbinfo[ii0].occup = 0.0; } aaa.nr = ndots; - write_sto_conf(fn, title, &aaa, xnew, NULL, ePBC, const_cast(box)); + write_sto_conf(fn, title, &aaa, xnew, nullptr, ePBC, const_cast(box)); do_conect(fn, ndots, xnew); done_atom(&aaa); } @@ -394,7 +394,7 @@ class Sasa : public TrajectoryAnalysisModule }; Sasa::Sasa() - : solsize_(0.14), ndots_(24), dgsDefault_(0), bIncludeSolute_(true), top_(NULL) + : solsize_(0.14), ndots_(24), dgsDefault_(0), bIncludeSolute_(true), top_(nullptr) { //minarea_ = 0.5; registerAnalysisDataset(&area_, "area"); @@ -924,7 +924,7 @@ Sasa::analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc, // surfacedots contains nsurfacedots entries, and contains the actual // points. real totarea, totvolume; - real *area = NULL, *surfacedots = NULL; + real *area = nullptr, *surfacedots = nullptr; int nsurfacedots; calculator_.calculate(surfaceSel.coordinates().data(), pbc, frameData.index_.size(), frameData.index_.data(), flag, @@ -932,7 +932,7 @@ Sasa::analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc, &surfacedots, &nsurfacedots); // Unpack the atomwise areas into the frameData.atomAreas_ array for easier // indexing in the case of dynamic surfaceSel. - if (area != NULL) + if (area != nullptr) { if (surfaceSel.isDynamic()) { diff --git a/src/gromacs/trajectoryanalysis/modules/select.cpp b/src/gromacs/trajectoryanalysis/modules/select.cpp index f84fc44e49..3137b8ddac 100644 --- a/src/gromacs/trajectoryanalysis/modules/select.cpp +++ b/src/gromacs/trajectoryanalysis/modules/select.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -137,7 +137,7 @@ class IndexFileWriterModule : public AnalysisDataModuleSerial */ IndexFileWriterModule::IndexFileWriterModule() - : fp_(NULL), currentGroup_(-1), currentSize_(0), bAnyWritten_(false) + : fp_(nullptr), currentGroup_(-1), currentSize_(0), bAnyWritten_(false) { } @@ -150,10 +150,10 @@ IndexFileWriterModule::~IndexFileWriterModule() void IndexFileWriterModule::closeFile() { - if (fp_ != NULL) + if (fp_ != nullptr) { gmx_fio_fclose(fp_); - fp_ = NULL; + fp_ = nullptr; } } @@ -197,7 +197,7 @@ void IndexFileWriterModule::frameStarted(const AnalysisDataFrameHeader & /*heade void IndexFileWriterModule::pointsAdded(const AnalysisDataPointSetRef &points) { - if (fp_ == NULL) + if (fp_ == nullptr) { return; } @@ -245,7 +245,7 @@ void IndexFileWriterModule::frameFinished(const AnalysisDataFrameHeader & /*head void IndexFileWriterModule::dataFinished() { - if (fp_ != NULL) + if (fp_ != nullptr) { std::fprintf(fp_, "\n"); } @@ -322,7 +322,7 @@ class Select : public TrajectoryAnalysisModule Select::Select() : bTotNorm_(false), bFracNorm_(false), bResInd_(false), bCumulativeLifetimes_(true), resNumberType_(ResidueNumbering_ByNumber), - pdbAtoms_(PdbAtomsSelection_All), top_(NULL), + pdbAtoms_(PdbAtomsSelection_All), top_(nullptr), occupancyModule_(new AnalysisDataAverageModule()), lifetimeModule_(new AnalysisDataLifetimeModule()) { @@ -723,7 +723,7 @@ Select::writeOutput() case PdbAtomsSelection_All: { t_trxstatus *status = open_trx(fnPDB_.c_str(), "w"); - write_trxframe(status, &fr, NULL); + write_trxframe(status, &fr, nullptr); close_trx(status); break; } @@ -739,7 +739,7 @@ Select::writeOutput() atomIndicesSet.end()); t_trxstatus *status = open_trx(fnPDB_.c_str(), "w"); write_trxframe_indexed(status, &fr, allAtomIndices.size(), - allAtomIndices.data(), NULL); + allAtomIndices.data(), nullptr); close_trx(status); break; } @@ -754,7 +754,7 @@ Select::writeOutput() } } t_trxstatus *status = open_trx(fnPDB_.c_str(), "w"); - write_trxframe_indexed(status, &fr, indices.size(), indices.data(), NULL); + write_trxframe_indexed(status, &fr, indices.size(), indices.data(), nullptr); close_trx(status); break; } diff --git a/src/gromacs/trajectoryanalysis/modules/surfacearea.cpp b/src/gromacs/trajectoryanalysis/modules/surfacearea.cpp index 00aa76f12f..a380108268 100644 --- a/src/gromacs/trajectoryanalysis/modules/surfacearea.cpp +++ b/src/gromacs/trajectoryanalysis/modules/surfacearea.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2007, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -574,7 +574,7 @@ nsc_dclm_pbc(const rvec *coords, const ConstArrayRef &radius, int nat, return; } real area = 0.0, vol = 0.0; - real *dots = NULL, *atom_area = NULL; + real *dots = nullptr, *atom_area = nullptr; int lfnr = 0, maxdots = 0; if (mode & FLAG_VOLUME) { @@ -806,7 +806,7 @@ void SurfaceAreaCalculator::calculate( { flags |= impl_->flags_; *area = 0; - if (volume == NULL) + if (volume == nullptr) { flags &= ~FLAG_VOLUME; } @@ -814,23 +814,23 @@ void SurfaceAreaCalculator::calculate( { *volume = 0; } - if (at_area == NULL) + if (at_area == nullptr) { flags &= ~FLAG_ATOM_AREA; } else { - *at_area = NULL; + *at_area = nullptr; } - if (lidots == NULL) + if (lidots == nullptr) { flags &= ~FLAG_DOTS; } else { - *lidots = NULL; + *lidots = nullptr; } - if (n_dots == NULL) + if (n_dots == nullptr) { flags &= ~FLAG_DOTS; } diff --git a/src/gromacs/trajectoryanalysis/runnercommon.cpp b/src/gromacs/trajectoryanalysis/runnercommon.cpp index e146c5e2d6..38c74f1f96 100644 --- a/src/gromacs/trajectoryanalysis/runnercommon.cpp +++ b/src/gromacs/trajectoryanalysis/runnercommon.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -140,7 +140,7 @@ TrajectoryAnalysisRunnerCommon::Impl::Impl(TrajectoryAnalysisSettings *settings) : settings_(*settings), startTime_(0.0), endTime_(0.0), deltaTime_(0.0), bStartTimeSet_(false), bEndTimeSet_(false), bDeltaTimeSet_(false), - bTrajOpen_(false), fr(NULL), gpbc_(NULL), status_(NULL), oenv_(NULL) + bTrajOpen_(false), fr(nullptr), gpbc_(nullptr), status_(nullptr), oenv_(nullptr) { } @@ -182,7 +182,7 @@ TrajectoryAnalysisRunnerCommon::Impl::initTopology(bool required) { snew(topInfo_.mtop_, 1); readConfAndTopology(topfile_.c_str(), &topInfo_.bTop_, topInfo_.mtop_, - &topInfo_.ePBC_, &topInfo_.xtop_, NULL, + &topInfo_.ePBC_, &topInfo_.xtop_, nullptr, topInfo_.boxtop_); // TODO: Only load this here if the tool actually needs it; selections // take care of themselves. @@ -199,7 +199,7 @@ TrajectoryAnalysisRunnerCommon::Impl::initTopology(bool required) && !settings_.hasFlag(TrajectoryAnalysisSettings::efUseTopX)) { sfree(topInfo_.xtop_); - topInfo_.xtop_ = NULL; + topInfo_.xtop_ = nullptr; } } } @@ -208,7 +208,7 @@ void TrajectoryAnalysisRunnerCommon::Impl::initFirstFrame() { // Return if we have already initialized the trajectory. - if (fr != NULL) + if (fr != nullptr) { return; } @@ -302,10 +302,10 @@ TrajectoryAnalysisRunnerCommon::Impl::finishTrajectory() close_trx(status_); bTrajOpen_ = false; } - if (gpbc_ != NULL) + if (gpbc_ != nullptr) { gmx_rmpbc_done(gpbc_); - gpbc_ = NULL; + gpbc_ = nullptr; } } @@ -464,7 +464,7 @@ TrajectoryAnalysisRunnerCommon::readNextFrame() void TrajectoryAnalysisRunnerCommon::initFrame() { - if (impl_->gpbc_ != NULL) + if (impl_->gpbc_ != nullptr) { gmx_rmpbc_trxfr(impl_->gpbc_, impl_->fr); } @@ -488,7 +488,7 @@ TrajectoryAnalysisRunnerCommon::topologyInformation() const t_trxframe & TrajectoryAnalysisRunnerCommon::frame() const { - GMX_RELEASE_ASSERT(impl_->fr != NULL, "Frame not available when accessed"); + GMX_RELEASE_ASSERT(impl_->fr != nullptr, "Frame not available when accessed"); return *impl_->fr; } diff --git a/src/gromacs/trajectoryanalysis/tests/moduletest.cpp b/src/gromacs/trajectoryanalysis/tests/moduletest.cpp index eccd685fe7..d80e1b74ca 100644 --- a/src/gromacs/trajectoryanalysis/tests/moduletest.cpp +++ b/src/gromacs/trajectoryanalysis/tests/moduletest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -109,7 +109,7 @@ AbstractTrajectoryAnalysisModuleTestFixture::Impl::module() void AbstractTrajectoryAnalysisModuleTestFixture::Impl::ensureModuleCreated() { - if (module_.get() == NULL) + if (module_.get() == nullptr) { module_ = parent_.createModule(); const std::vector &datasetNames(module_->datasetNames()); diff --git a/src/gromacs/trajectoryanalysis/tests/surfacearea.cpp b/src/gromacs/trajectoryanalysis/tests/surfacearea.cpp index f7607f6264..cdc64442bc 100644 --- a/src/gromacs/trajectoryanalysis/tests/surfacearea.cpp +++ b/src/gromacs/trajectoryanalysis/tests/surfacearea.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -71,7 +71,7 @@ class SurfaceAreaTest : public ::testing::Test public: SurfaceAreaTest() : rng_(12345), area_(0.0), volume_(0.0), - atomArea_(NULL), dotCount_(0), dots_(NULL) + atomArea_(nullptr), dotCount_(0), dots_(nullptr) { clear_mat(box_); } @@ -142,10 +142,10 @@ class SurfaceAreaTest : public ::testing::Test { volume_ = 0.0; sfree(atomArea_); - atomArea_ = NULL; + atomArea_ = nullptr; dotCount_ = 0; sfree(dots_); - dots_ = NULL; + dots_ = nullptr; t_pbc pbc; if (bPBC) { @@ -156,7 +156,7 @@ class SurfaceAreaTest : public ::testing::Test gmx::SurfaceAreaCalculator calculator; calculator.setDotCount(ndots); calculator.setRadii(radius_); - calculator.calculate(as_rvec_array(x_.data()), bPBC ? &pbc : NULL, + calculator.calculate(as_rvec_array(x_.data()), bPBC ? &pbc : nullptr, index_.size(), index_.data(), flags, &area_, &volume_, &atomArea_, &dots_, &dotCount_); @@ -176,11 +176,11 @@ class SurfaceAreaTest : public ::testing::Test { compound.checkReal(volume_, "Volume"); } - if (atomArea_ != NULL) + if (atomArea_ != nullptr) { compound.checkSequenceArray(index_.size(), atomArea_, "AtomArea"); } - if (dots_ != NULL) + if (dots_ != nullptr) { if (checkDotCoordinates) { diff --git a/src/gromacs/utility/alignedallocator.h b/src/gromacs/utility/alignedallocator.h index 56d1b2e674..a86df70fb1 100644 --- a/src/gromacs/utility/alignedallocator.h +++ b/src/gromacs/utility/alignedallocator.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -180,7 +180,7 @@ class AlignedAllocator * \throws std::bad_alloc if the allocation fails. */ pointer - allocate(std::size_t n, typename std::allocator::const_pointer gmx_unused hint = 0) + allocate(std::size_t n, typename std::allocator::const_pointer gmx_unused hint = nullptr) { void *p = internal::alignedMalloc(n*sizeof(T)); diff --git a/src/gromacs/utility/arrayref.h b/src/gromacs/utility/arrayref.h index 0538fb8f57..2084f75102 100644 --- a/src/gromacs/utility/arrayref.h +++ b/src/gromacs/utility/arrayref.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -167,7 +167,7 @@ class ArrayRef fromVector(typename std::vector::iterator begin, typename std::vector::iterator end) { - value_type *p_begin = (begin != end) ? &*begin : NULL; + value_type *p_begin = (begin != end) ? &*begin : nullptr; value_type *p_end = p_begin + (end-begin); return ArrayRef(p_begin, p_end); } @@ -183,7 +183,7 @@ class ArrayRef * used to initialize any ArrayRef, without specifying the template * type. It is not explicit to enable that usage. */ - ArrayRef(const EmptyArrayRef &) : begin_(NULL), end_(NULL) {} + ArrayRef(const EmptyArrayRef &) : begin_(nullptr), end_(nullptr) {} /*! \brief * Constructs a reference to a particular range. * @@ -212,8 +212,8 @@ class ArrayRef * std::vector to a method that takes ArrayRef. */ ArrayRef(std::vector &v) - : begin_((!v.empty()) ? &v[0] : NULL), - end_((!v.empty()) ? &v[0] + v.size() : NULL) + : begin_((!v.empty()) ? &v[0] : nullptr), + end_((!v.empty()) ? &v[0] + v.size() : nullptr) { } /*! \brief @@ -408,7 +408,7 @@ class ConstArrayRef fromVector(typename std::vector::const_iterator begin, typename std::vector::const_iterator end) { - const value_type *p_begin = (begin != end) ? &*begin : NULL; + const value_type *p_begin = (begin != end) ? &*begin : nullptr; const value_type *p_end = p_begin + (end-begin); return ConstArrayRef(p_begin, p_end); } @@ -416,7 +416,7 @@ class ConstArrayRef /*! \brief * Constructs an empty reference. */ - ConstArrayRef() : begin_(NULL), end_(NULL) {} + ConstArrayRef() : begin_(nullptr), end_(nullptr) {} /*! \brief * Constructs an empty reference. * @@ -424,7 +424,7 @@ class ConstArrayRef * used to initialize any Const ArrayRef, without specifying the * template type. It is not explicit to enable that usage. */ - ConstArrayRef(const EmptyArrayRef &) : begin_(NULL), end_(NULL) {} + ConstArrayRef(const EmptyArrayRef &) : begin_(nullptr), end_(nullptr) {} /*! \brief * Constructs a const reference from a non-const reference. */ @@ -457,8 +457,8 @@ class ConstArrayRef * std::vector to a method that takes ConstArrayRef. */ ConstArrayRef(const std::vector &v) - : begin_((!v.empty()) ? &v[0] : NULL), - end_((!v.empty()) ? &v[0] + v.size() : NULL) + : begin_((!v.empty()) ? &v[0] : nullptr), + end_((!v.empty()) ? &v[0] + v.size() : nullptr) { } /*! \brief diff --git a/src/gromacs/utility/coolstuff.cpp b/src/gromacs/utility/coolstuff.cpp index 61986b561b..b53ced9680 100644 --- a/src/gromacs/utility/coolstuff.cpp +++ b/src/gromacs/utility/coolstuff.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -65,7 +65,7 @@ bool beCool(void) * a mutex for locking the variable... */ #if GMX_COOL_QUOTES - return (getenv("GMX_NO_QUOTES") == NULL); + return (getenv("GMX_NO_QUOTES") == nullptr); #else /*be uncool*/ return false; diff --git a/src/gromacs/utility/cstringutil.cpp b/src/gromacs/utility/cstringutil.cpp index c9b906d073..d28c4820a0 100644 --- a/src/gromacs/utility/cstringutil.cpp +++ b/src/gromacs/utility/cstringutil.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -79,11 +79,11 @@ int continuing(char *s) char *fgets2(char *line, int n, FILE *stream) { char *c; - if (fgets(line, n, stream) == NULL) + if (fgets(line, n, stream) == nullptr) { - return NULL; + return nullptr; } - if ((c = strchr(line, '\n')) != NULL) + if ((c = strchr(line, '\n')) != nullptr) { *c = '\0'; } @@ -98,7 +98,7 @@ char *fgets2(char *line, int n, FILE *stream) gmx_fatal(FARGS, "An input file contains a line longer than %d characters, while the buffer passed to fgets2 has size %d. The line starts with: '%20.20s'", n, n, line); } } - if ((c = strchr(line, '\r')) != NULL) + if ((c = strchr(line, '\r')) != nullptr) { *c = '\0'; } @@ -116,7 +116,7 @@ void strip_comment (char *line) } /* search for a comment mark and replace it by a zero */ - if ((c = strchr(line, COMMENTSIGN)) != NULL) + if ((c = strchr(line, COMMENTSIGN)) != nullptr) { (*c) = 0; } @@ -136,7 +136,7 @@ void ltrim (char *str) { int i, c; - if (NULL == str) + if (nullptr == str) { return; } @@ -160,7 +160,7 @@ void rtrim (char *str) { int nul; - if (NULL == str) + if (nullptr == str) { return; } @@ -440,7 +440,7 @@ char *wrap_lines(const char *buf, int line_width, int indent, gmx_bool bIndentFi * the current line (where it also won't fit, but looks better) */ - b2 = NULL; + b2 = nullptr; b2len = strlen(buf)+1+indent; snew(b2, b2len); i0 = i2 = 0; @@ -544,14 +544,14 @@ char *gmx_step_str(gmx_int64_t i, char *buf) void parse_digits_from_string(const char *digitstring, int *ndigits, int **digitlist) { /* TODO use std::string, once gmx_gpu_opt_t is ready for it */ - if (NULL == digitstring) + if (nullptr == digitstring) { *ndigits = 0; - *digitlist = NULL; + *digitlist = nullptr; return; } - if (strstr(digitstring, ",") != NULL) + if (strstr(digitstring, ",") != nullptr) { parse_digits_from_csv_string(digitstring, ndigits, digitlist); } @@ -565,10 +565,10 @@ void parse_digits_from_plain_string(const char *digitstring, int *ndigits, int * { int i; - if (NULL == digitstring) + if (nullptr == digitstring) { *ndigits = 0; - *digitlist = NULL; + *digitlist = nullptr; return; } @@ -589,10 +589,10 @@ void parse_digits_from_plain_string(const char *digitstring, int *ndigits, int * void parse_digits_from_csv_string(const char *digitstring, int *ndigits, int **digitlist) { - if (NULL == digitstring) + if (nullptr == digitstring) { *ndigits = 0; - *digitlist = NULL; + *digitlist = nullptr; return; } @@ -606,7 +606,7 @@ void parse_digits_from_csv_string(const char *digitstring, int *ndigits, int **d gmx_fatal(FARGS, "Invalid token in digit-only string: \"%s\"\n", token.c_str()); } - int number = static_cast(str_to_int64_t(token.c_str(), NULL)); + int number = static_cast(str_to_int64_t(token.c_str(), nullptr)); digits.push_back(number); } diff --git a/src/gromacs/utility/datafilefinder.cpp b/src/gromacs/utility/datafilefinder.cpp index 598997ed33..96eec7f501 100644 --- a/src/gromacs/utility/datafilefinder.cpp +++ b/src/gromacs/utility/datafilefinder.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -68,7 +68,7 @@ class DataFileFinder::Impl public: static std::string getDefaultPath(); - Impl() : envName_(NULL), bEnvIsSet_(false) {} + Impl() : envName_(nullptr), bEnvIsSet_(false) {} const char *envName_; bool bEnvIsSet_; @@ -125,7 +125,7 @@ FILE *DataFileFinder::openFile(const DataFileOptions &options) const std::string filename = findFile(options); if (filename.empty()) { - return NULL; + return nullptr; } #if 0 if (debug) @@ -201,7 +201,7 @@ std::string DataFileFinder::findFile(const DataFileOptions &options) const message.append(defaultPath); message.append(" (default)"); } - if (!bEnvIsSet && envName != NULL) + if (!bEnvIsSet && envName != nullptr) { message.append( formatString("\nYou can set additional directories to search " diff --git a/src/gromacs/utility/directoryenumerator.cpp b/src/gromacs/utility/directoryenumerator.cpp index 8ec23c6d89..230f456be8 100644 --- a/src/gromacs/utility/directoryenumerator.cpp +++ b/src/gromacs/utility/directoryenumerator.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -163,7 +163,7 @@ class DirectoryEnumerator::Impl { errno = 0; DIR *handle = opendir(dirname); - if (handle == NULL) + if (handle == nullptr) { if (bThrow) { @@ -173,7 +173,7 @@ class DirectoryEnumerator::Impl dirname); GMX_THROW_WITH_ERRNO(FileIOError(message), "opendir", code); } - return NULL; + return nullptr; } return new Impl(handle); } @@ -187,7 +187,7 @@ class DirectoryEnumerator::Impl { errno = 0; dirent *p = readdir(dirent_handle); - if (p == NULL) + if (p == nullptr) { if (errno == 0) { @@ -266,7 +266,7 @@ DirectoryEnumerator::enumerateFilesWithExtension( DirectoryEnumerator::DirectoryEnumerator(const char *dirname, bool bThrow) : impl_(nullptr) { - GMX_RELEASE_ASSERT(dirname != NULL && dirname[0] != '\0', + GMX_RELEASE_ASSERT(dirname != nullptr && dirname[0] != '\0', "Attempted to open empty/null directory path"); impl_.reset(Impl::init(dirname, bThrow)); } diff --git a/src/gromacs/utility/errorformat.cpp b/src/gromacs/utility/errorformat.cpp index 2c8b21fb2b..1fc9d8b9cb 100644 --- a/src/gromacs/utility/errorformat.cpp +++ b/src/gromacs/utility/errorformat.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -76,12 +76,12 @@ void printFatalErrorHeader(FILE *fp, const char *title, std::fprintf(fp, "\n-------------------------------------------------------\n"); std::fprintf(fp, "Program: %s, version %s\n", programName, gmx_version()); - if (file != NULL) + if (file != nullptr) { std::fprintf(fp, "Source file: %s (line %d)\n", Path::stripSourcePrefix(file), line); } - if (func != NULL) + if (func != nullptr) { std::fprintf(fp, "Function: %s\n", func); } diff --git a/src/gromacs/utility/exceptions.cpp b/src/gromacs/utility/exceptions.cpp index ed4a3fe147..a90da61fbf 100644 --- a/src/gromacs/utility/exceptions.cpp +++ b/src/gromacs/utility/exceptions.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -191,7 +191,7 @@ GromacsException::GromacsException(const ExceptionInitializer &details) const char *GromacsException::what() const noexcept { const ErrorMessage *msg = getInfo(); - if (msg == NULL) + if (msg == nullptr) { return "No reason provided"; } @@ -205,7 +205,7 @@ const char *GromacsException::what() const noexcept void GromacsException::prependContext(const std::string &context) { const ErrorMessage *msg = getInfo(); - GMX_RELEASE_ASSERT(msg != NULL, "Message should always be set"); + GMX_RELEASE_ASSERT(msg != nullptr, "Message should always be set"); setInfo(ExceptionInfoMessage(msg->prependContext(context))); } @@ -339,7 +339,7 @@ class MessageWriterFileNoThrow : public IMessageWriter { std::fprintf(fp_, "%*sReason: %s\n", indent, "", std::strerror(errorNumber)); - if (funcName != NULL) + if (funcName != nullptr) { std::fprintf(fp_, "%*s(call to %s() returned error code %d)\n", indent, "", funcName, errorNumber); @@ -371,7 +371,7 @@ class MessageWriterTextWriter : public IMessageWriter { writer_->wrapperSettings().setIndent(indent); writer_->writeLine(formatString("Reason: %s", std::strerror(errorNumber))); - if (funcName != NULL) + if (funcName != nullptr) { writer_->writeLine( formatString("(call to %s() returned error code %d)", @@ -411,7 +411,7 @@ class MessageWriterString : public IMessageWriter { writeLine(formatString("Reason: %s", std::strerror(errorNumber)).c_str(), indent); - if (funcName != NULL) + if (funcName != nullptr) { writeLine(formatString("(call to %s() returned error code %d)", funcName, errorNumber).c_str(), @@ -439,7 +439,7 @@ void formatExceptionMessageInternal(IMessageWriter *writer, const std::exception &ex, int indent) { const GromacsException *gmxEx = dynamic_cast(&ex); - if (gmxEx != NULL) + if (gmxEx != nullptr) { // TODO: Add an option to print location information for the tests @@ -453,15 +453,15 @@ void formatExceptionMessageInternal(IMessageWriter *writer, bool bAnythingWritten = false; // TODO: Remove duplicate context if present in multiple nested exceptions. const ErrorMessage *msg = gmxEx->getInfo(); - if (msg != NULL) + if (msg != nullptr) { - while (msg != NULL && msg->isContext()) + while (msg != nullptr && msg->isContext()) { writer->writeLine(msg->text().c_str(), indent*2); ++indent; msg = &msg->child(); } - if (msg != NULL && !msg->text().empty()) + if (msg != nullptr && !msg->text().empty()) { writer->writeLine(msg->text().c_str(), indent*2); bAnythingWritten = true; @@ -474,19 +474,19 @@ void formatExceptionMessageInternal(IMessageWriter *writer, } const int *errorNumber = gmxEx->getInfo(); - if (errorNumber != NULL && *errorNumber != 0) + if (errorNumber != nullptr && *errorNumber != 0) { const char * const *funcName = gmxEx->getInfo(); writer->writeErrNoInfo(*errorNumber, - funcName != NULL ? *funcName : NULL, + funcName != nullptr ? *funcName : nullptr, (indent+1)*2); bAnythingWritten = true; } const internal::NestedExceptionList *nested = gmxEx->getInfo(); - if (nested != NULL) + if (nested != nullptr) { internal::NestedExceptionList::const_iterator ni; for (ni = nested->begin(); ni != nested->end(); ++ni) @@ -519,24 +519,24 @@ void printFatalErrorMessage(FILE *fp, const std::exception &ex) bool bPrintType = false; const GromacsException *gmxEx = dynamic_cast(&ex); // TODO: Treat more of the standard exceptions - if (gmxEx != NULL) + if (gmxEx != nullptr) { title = getErrorCodeString(gmxEx->errorCode()); } - else if (dynamic_cast(&ex) != NULL) + else if (dynamic_cast(&ex) != nullptr) { title = "System error in thread synchronization"; } - else if (dynamic_cast(&ex) != NULL) + else if (dynamic_cast(&ex) != nullptr) { title = "Memory allocation failed"; } - else if (dynamic_cast(&ex) != NULL) + else if (dynamic_cast(&ex) != nullptr) { title = "Standard library logic error (bug)"; bPrintType = true; } - else if (dynamic_cast(&ex) != NULL) + else if (dynamic_cast(&ex) != nullptr) { title = "Standard library runtime error (possible bug)"; bPrintType = true; diff --git a/src/gromacs/utility/fatalerror.cpp b/src/gromacs/utility/fatalerror.cpp index 1b16b1bea5..a47dd740a4 100644 --- a/src/gromacs/utility/fatalerror.cpp +++ b/src/gromacs/utility/fatalerror.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -66,10 +66,10 @@ static bool bDebug = false; static tMPI_Thread_mutex_t where_mutex = TMPI_THREAD_MUTEX_INITIALIZER; -FILE *debug = NULL; +FILE *debug = nullptr; gmx_bool gmx_debug_at = FALSE; -static FILE *log_file = NULL; +static FILE *log_file = nullptr; static tMPI_Thread_mutex_t error_mutex = TMPI_THREAD_MUTEX_INITIALIZER; void gmx_init_debug(const int dbglevel, const char *dbgfile) @@ -105,9 +105,9 @@ void _where(const char *file, int line) if (bFirst) /* we repeat the check in the locked section because things might have changed */ { - if ((temp = getenv("GMX_PRINT_DEBUG_LINES")) != NULL) + if ((temp = getenv("GMX_PRINT_DEBUG_LINES")) != nullptr) { - nskip = strtol(temp, NULL, 10); + nskip = strtol(temp, nullptr, 10); } bFirst = FALSE; } @@ -143,11 +143,11 @@ static void default_error_handler(const char *title, const char *msg, { if (log_file) { - gmx::internal::printFatalErrorHeader(log_file, title, NULL, file, line); + gmx::internal::printFatalErrorHeader(log_file, title, nullptr, file, line); gmx::internal::printFatalErrorMessageLine(log_file, msg, 0); gmx::internal::printFatalErrorFooter(log_file); } - gmx::internal::printFatalErrorHeader(stderr, title, NULL, file, line); + gmx::internal::printFatalErrorHeader(stderr, title, nullptr, file, line); gmx::internal::printFatalErrorMessageLine(stderr, msg, 0); gmx::internal::printFatalErrorFooter(stderr); } @@ -180,7 +180,7 @@ static const char *gmx_strerror(const char *key) { "range", "Range checking error" } }; - if (key == NULL) + if (key == nullptr) { return "NULL error type (should not occur)"; } @@ -196,7 +196,7 @@ static const char *gmx_strerror(const char *key) static void call_error_handler(const char *key, const char *file, int line, const char *msg) { - if (msg == NULL) + if (msg == nullptr) { msg = "Empty gmx_fatal message (bug)."; } @@ -289,7 +289,7 @@ void _range_check(int n, int n_min, int n_max, const char *warn_str, if ((n < n_min) || (n >= n_max)) { - if (warn_str != NULL) + if (warn_str != nullptr) { strcpy(buf, warn_str); strcat(buf, "\n"); diff --git a/src/gromacs/utility/filestream.cpp b/src/gromacs/utility/filestream.cpp index 5f245858a5..b24f687b27 100644 --- a/src/gromacs/utility/filestream.cpp +++ b/src/gromacs/utility/filestream.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015, by the GROMACS development team, led by + * Copyright (c) 2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -70,7 +70,7 @@ bool readLineImpl(FILE *fp, std::string *line) std::string result; char buf[bufsize]; buf[0] = '\0'; - while (std::fgets(buf, bufsize, fp) != NULL) + while (std::fgets(buf, bufsize, fp) != nullptr) { const size_t length = std::strlen(buf); result.append(buf, length); @@ -105,10 +105,10 @@ class FileStreamImpl { } FileStreamImpl(const char *filename, const char *mode) - : fp_(NULL), bClose_(true) + : fp_(nullptr), bClose_(true) { fp_ = std::fopen(filename, mode); - if (fp_ == NULL) + if (fp_ == nullptr) { GMX_THROW_WITH_ERRNO( FileIOError(formatString("Could not open file '%s'", filename)), @@ -117,7 +117,7 @@ class FileStreamImpl } ~FileStreamImpl() { - if (fp_ != NULL && bClose_) + if (fp_ != nullptr && bClose_) { if (std::fclose(fp_) != 0) { @@ -128,19 +128,19 @@ class FileStreamImpl FILE *handle() { - GMX_RELEASE_ASSERT(fp_ != NULL, + GMX_RELEASE_ASSERT(fp_ != nullptr, "Attempted to access a file object that is not open"); return fp_; } void close() { - GMX_RELEASE_ASSERT(fp_ != NULL, + GMX_RELEASE_ASSERT(fp_ != nullptr, "Attempted to close a file object that is not open"); GMX_RELEASE_ASSERT(bClose_, "Attempted to close a file object that should not be"); const bool bOk = (std::fclose(fp_) == 0); - fp_ = NULL; + fp_ = nullptr; if (!bOk) { GMX_THROW_WITH_ERRNO( @@ -192,7 +192,7 @@ StandardInputStream &StandardInputStream::instance() FILE *TextInputFile::openRawHandle(const char *filename) { FILE *fp = fopen(filename, "r"); - if (fp == NULL) + if (fp == nullptr) { GMX_THROW_WITH_ERRNO( FileIOError(formatString("Could not open file '%s'", filename)), diff --git a/src/gromacs/utility/futil.cpp b/src/gromacs/utility/futil.cpp index 0b5fe92cfe..e64440789f 100644 --- a/src/gromacs/utility/futil.cpp +++ b/src/gromacs/utility/futil.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -79,7 +79,7 @@ typedef struct t_pstack { struct t_pstack *prev; } t_pstack; -static t_pstack *pstack = NULL; +static t_pstack *pstack = nullptr; static bool bUnbuffered = false; static int s_maxBackupCount = 0; @@ -99,7 +99,7 @@ const DataFileFinder g_defaultLibFileFinder; const DataFileFinder &getLibraryFileFinder() { - if (g_libFileFinder != NULL) + if (g_libFileFinder != nullptr) { return *g_libFileFinder; } @@ -123,10 +123,10 @@ void gmx_set_max_backup_count(int count) if (count < 0) { const char *env = getenv("GMX_MAXBACKUP"); - if (env != NULL) + if (env != nullptr) { // TODO: Check that the value is converted properly. - count = strtol(env, NULL, 10); + count = strtol(env, nullptr, 10); if (count < 0) { count = 0; @@ -194,16 +194,16 @@ int gmx_ffclose(FILE *fp) tMPI_Thread_mutex_lock(&pstack_mutex); ps = pstack; - if (ps == NULL) + if (ps == nullptr) { - if (fp != NULL) + if (fp != nullptr) { ret = fclose(fp); } } else if (ps->fp == fp) { - if (fp != NULL) + if (fp != nullptr) { ret = pclose(fp); } @@ -212,13 +212,13 @@ int gmx_ffclose(FILE *fp) } else { - while ((ps->prev != NULL) && (ps->prev->fp != fp)) + while ((ps->prev != nullptr) && (ps->prev->fp != fp)) { ps = ps->prev; } - if ((ps->prev != NULL) && ps->prev->fp == fp) + if ((ps->prev != nullptr) && ps->prev->fp == fp) { - if (ps->prev->fp != NULL) + if (ps->prev->fp != nullptr) { ret = pclose(ps->prev->fp); } @@ -228,7 +228,7 @@ int gmx_ffclose(FILE *fp) } else { - if (fp != NULL) + if (fp != nullptr) { ret = fclose(fp); } @@ -246,7 +246,7 @@ void frewind(FILE *fp) tMPI_Thread_mutex_lock(&pstack_mutex); t_pstack *ps = pstack; - while (ps != NULL) + while (ps != nullptr) { if (ps->fp == fp) { @@ -317,7 +317,7 @@ static FILE *uncompress(const char *fn, const char *mode) sprintf(buf, "uncompress -c < %s", fn); fprintf(stderr, "Going to execute '%s'\n", buf); - if ((fp = popen(buf, mode)) == NULL) + if ((fp = popen(buf, mode)) == nullptr) { gmx_open(fn); } @@ -333,7 +333,7 @@ static FILE *gunzip(const char *fn, const char *mode) sprintf(buf, "gunzip -c < %s", fn); fprintf(stderr, "Going to execute '%s'\n", buf); - if ((fp = popen(buf, mode)) == NULL) + if ((fp = popen(buf, mode)) == nullptr) { gmx_open(fn); } @@ -346,12 +346,12 @@ gmx_bool gmx_fexist(const char *fname) { FILE *test; - if (fname == NULL) + if (fname == nullptr) { return FALSE; } test = fopen(fname, "r"); - if (test == NULL) + if (test == nullptr) { /*Windows doesn't allow fopen of directory - so we need to check this seperately */ #if GMX_NATIVE_WINDOWS @@ -445,14 +445,14 @@ FILE *gmx_ffopen(const char *file, const char *mode) #ifdef SKIP_FFOPS return fopen(file, mode); #else - FILE *ff = NULL; - char buf[256], *bufsize = 0, *ptr; + FILE *ff = nullptr; + char buf[256], *bufsize = nullptr, *ptr; gmx_bool bRead; int bs; - if (file == NULL) + if (file == nullptr) { - return NULL; + return nullptr; } if (mode[0] == 'w') @@ -465,7 +465,7 @@ FILE *gmx_ffopen(const char *file, const char *mode) strcpy(buf, file); if (!bRead || gmx_fexist(buf)) { - if ((ff = fopen(buf, mode)) == NULL) + if ((ff = fopen(buf, mode)) == nullptr) { gmx_file(buf); } @@ -473,7 +473,7 @@ FILE *gmx_ffopen(const char *file, const char *mode) /* Check whether we should be using buffering (default) or not * (for debugging) */ - if (bUnbuffered || ((bufsize = getenv("GMX_LOG_BUFFER")) != NULL)) + if (bUnbuffered || ((bufsize = getenv("GMX_LOG_BUFFER")) != nullptr)) { /* Check whether to use completely unbuffered */ if (bUnbuffered) @@ -482,11 +482,11 @@ FILE *gmx_ffopen(const char *file, const char *mode) } else { - bs = strtol(bufsize, NULL, 10); + bs = strtol(bufsize, nullptr, 10); } if (bs <= 0) { - setbuf(ff, NULL); + setbuf(ff, nullptr); } else { @@ -539,7 +539,7 @@ char *low_gmxlibfn(const char *file, gmx_bool bAddCWD, gmx_bool bFatal) } } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; - return NULL; + return nullptr; } FILE *low_libopen(const char *file, gmx_bool bFatal) @@ -554,7 +554,7 @@ FILE *low_libopen(const char *file, gmx_bool bFatal) return fp; } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; - return NULL; + return nullptr; } char *gmxlibfn(const char *file) @@ -610,7 +610,7 @@ void gmx_tmpnam(char *buf) FILE *gmx_fopen_temporary(char *buf) { int i, len; - FILE *fpout = NULL; + FILE *fpout = nullptr; if ((len = strlen(buf)) < 7) { @@ -642,7 +642,7 @@ FILE *gmx_fopen_temporary(char *buf) gmx_fatal(FARGS, "Error creating temporary file %s: %s", buf, strerror(errno)); } - if ((fpout = fdopen(fd, "w")) == NULL) + if ((fpout = fdopen(fd, "w")) == nullptr) { gmx_fatal(FARGS, "Cannot open temporary file %s", buf); } @@ -674,8 +674,8 @@ int gmx_file_copy(const char *oldname, const char *newname, gmx_bool copy_if_emp { /* the full copy buffer size: */ #define FILECOPY_BUFSIZE (1<<16) - FILE *in = NULL; - FILE *out = NULL; + FILE *in = nullptr; + FILE *out = nullptr; char *buf; snew(buf, FILECOPY_BUFSIZE); @@ -819,7 +819,7 @@ void gmx_getcwd(char *buffer, size_t size) #else char *pdum = getcwd(buffer, size); #endif - if (pdum == NULL) + if (pdum == nullptr) { gmx_fatal(FARGS, "Cannot get working directory. Reason: %s", strerror(errno)); diff --git a/src/gromacs/utility/gmxomp.cpp b/src/gromacs/utility/gmxomp.cpp index 1b3ceccc12..6dc2d2adaf 100644 --- a/src/gromacs/utility/gmxomp.cpp +++ b/src/gromacs/utility/gmxomp.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -98,7 +98,7 @@ gmx_bool gmx_omp_check_thread_affinity(char **message) { bool shouldSetAffinity = true; - *message = NULL; + *message = nullptr; #if GMX_OPENMP /* We assume that the affinity setting is available on all platforms * gcc supports. Even if this is not the case (e.g. Mac OS) the user @@ -112,7 +112,7 @@ gmx_bool gmx_omp_check_thread_affinity(char **message) GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; const char *const gomp_env = getenv("GOMP_CPU_AFFINITY"); - const bool bGompCpuAffinitySet = (gomp_env != NULL); + const bool bGompCpuAffinitySet = (gomp_env != nullptr); /* turn off internal pinning if GOMP_CPU_AFFINITY is set & non-empty */ if (bGompCpuAffinitySet && *gomp_env != '\0') diff --git a/src/gromacs/utility/gmxregex.cpp b/src/gromacs/utility/gmxregex.cpp index 87ccafa9b1..a15a71b6db 100644 --- a/src/gromacs/utility/gmxregex.cpp +++ b/src/gromacs/utility/gmxregex.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -88,7 +88,7 @@ class Regex::Impl bool match(const char *value) const { - int rc = regexec(®ex_, value, 0, NULL, 0); + int rc = regexec(®ex_, value, 0, nullptr, 0); if (rc != 0 && rc != REG_NOMATCH) { // TODO: Handle errors. diff --git a/src/gromacs/utility/int64_to_int.cpp b/src/gromacs/utility/int64_to_int.cpp index 2d1a595e68..8f4c8c8ee3 100644 --- a/src/gromacs/utility/int64_to_int.cpp +++ b/src/gromacs/utility/int64_to_int.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015, by the GROMACS development team, led by + * Copyright (c) 2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -46,7 +46,7 @@ int gmx_int64_to_int(gmx_int64_t step, const char *warn) i = static_cast(step); - if (warn != NULL && (static_cast(i) != step)) + if (warn != nullptr && (static_cast(i) != step)) { fprintf(stderr, "\nWARNING during %s:\n", warn); fprintf(stderr, "int64 value "); diff --git a/src/gromacs/utility/logger.h b/src/gromacs/utility/logger.h index f9f4f6d275..4f52ec6045 100644 --- a/src/gromacs/utility/logger.h +++ b/src/gromacs/utility/logger.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016, by the GROMACS development team, led by + * Copyright (c) 2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -124,7 +124,7 @@ class LogWriteHelper * Note that the return value is unintuitively `false` when the target * is active, to allow implementing ::GMX_LOG like it is now. */ - operator bool() const { return target_ == NULL; } + operator bool() const { return target_ == nullptr; } /*! \brief * Writes the entry from the given writer to the log target. @@ -159,7 +159,7 @@ class LogLevelHelper // Both of the below should be explicit, once that works in CUDA. //! Returns whether the output for this log level goes anywhere. - operator bool() const { return target_ != NULL; } + operator bool() const { return target_ != nullptr; } //! Creates a helper for ::GMX_LOG. operator LogWriteHelper() const { return LogWriteHelper(target_); } diff --git a/src/gromacs/utility/path.cpp b/src/gromacs/utility/path.cpp index c71f4fdb03..1bf323f4c2 100644 --- a/src/gromacs/utility/path.cpp +++ b/src/gromacs/utility/path.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -418,7 +418,7 @@ std::vector Path::getExecutablePaths() result.push_back(""); #endif const char *path = std::getenv("PATH"); - if (path != NULL) + if (path != nullptr) { splitPathEnvironment(path, &result); } @@ -481,12 +481,12 @@ void File::throwOnNotFound(const NotFoundInfo &info) // static bool File::exists(const char *filename, NotFoundHandler onNotFound) { - if (filename == NULL) + if (filename == nullptr) { return false; } FILE *test = std::fopen(filename, "r"); - if (test == NULL) + if (test == nullptr) { const bool wasError = (errno != ENOENT && errno != ENOTDIR); NotFoundInfo info(filename, "The file could not be opened.", @@ -512,7 +512,7 @@ bool File::exists(const char *filename, NotFoundHandler onNotFound) if (!S_ISREG(st_buf.st_mode)) { NotFoundInfo info(filename, "The file is not a regular file.", - NULL, true, 0); + nullptr, true, 0); onNotFound(info); return false; } diff --git a/src/gromacs/utility/pleasecite.cpp b/src/gromacs/utility/pleasecite.cpp index 8e6040fd54..98c12342e1 100644 --- a/src/gromacs/utility/pleasecite.cpp +++ b/src/gromacs/utility/pleasecite.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -384,7 +384,7 @@ void please_cite(FILE *fp, const char *key) char *title; #define LINE_WIDTH 79 - if (fp == NULL) + if (fp == nullptr) { return; } diff --git a/src/gromacs/utility/programcontext.cpp b/src/gromacs/utility/programcontext.cpp index 4de54036ab..7ec9df222f 100644 --- a/src/gromacs/utility/programcontext.cpp +++ b/src/gromacs/utility/programcontext.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -88,7 +88,7 @@ const DefaultProgramContext g_defaultContext; const IProgramContext &getProgramContext() { - if (g_programContext != NULL) + if (g_programContext != nullptr) { return *g_programContext; } diff --git a/src/gromacs/utility/qsort_threadsafe.cpp b/src/gromacs/utility/qsort_threadsafe.cpp index 6a63bf225f..40fc08ae62 100644 --- a/src/gromacs/utility/qsort_threadsafe.cpp +++ b/src/gromacs/utility/qsort_threadsafe.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2012,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2010,2012,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -138,7 +138,7 @@ gmx_qsort(void * base, cbase = (char *)base; - swaptype = (size_t)(cbase - (char *)0) % sizeof(int) || size % sizeof(int) ? 2 : size == sizeof(int) ? 0 : 1; + swaptype = (size_t)(cbase - (char *)nullptr) % sizeof(int) || size % sizeof(int) ? 2 : size == sizeof(int) ? 0 : 1; if (nmemb < 7) { diff --git a/src/gromacs/utility/smalloc.cpp b/src/gromacs/utility/smalloc.cpp index 2410b22149..699681faa6 100644 --- a/src/gromacs/utility/smalloc.cpp +++ b/src/gromacs/utility/smalloc.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -120,14 +120,14 @@ void *save_malloc(const char *name, const char *file, int line, size_t size) { void *p; - p = NULL; + p = nullptr; if (size == 0) { - p = NULL; + p = nullptr; } else { - if ((p = malloc(size)) == NULL) + if ((p = malloc(size)) == nullptr) { gmx_fatal(errno, __FILE__, __LINE__, "Not enough memory. Failed to malloc %" GMX_PRId64 " bytes for %s\n" @@ -147,10 +147,10 @@ void *save_calloc(const char *name, const char *file, int line, { void *p; - p = NULL; + p = nullptr; if ((nelem == 0) || (elsize == 0)) { - p = NULL; + p = nullptr; } else { @@ -176,7 +176,7 @@ void *save_calloc(const char *name, const char *file, int line, } memset(p, 0, (size_t) (nelem * elsize)); #else - if ((p = calloc((size_t)nelem, (size_t)elsize)) == NULL) + if ((p = calloc((size_t)nelem, (size_t)elsize)) == nullptr) { gmx_fatal(errno, __FILE__, __LINE__, "Not enough memory. Failed to calloc %" GMX_PRId64 @@ -198,7 +198,7 @@ void *save_realloc(const char *name, const char *file, int line, void *ptr, void *p; size_t size = nelem*elsize; - p = NULL; + p = nullptr; if (size == 0) { save_free(name, file, line, ptr); @@ -213,7 +213,7 @@ void *save_realloc(const char *name, const char *file, int line, void *ptr, size/1048576.0, name, file, line, rank); } #endif - if (ptr == NULL) + if (ptr == nullptr) { p = malloc((size_t)size); } @@ -221,7 +221,7 @@ void *save_realloc(const char *name, const char *file, int line, void *ptr, { p = realloc(ptr, (size_t)size); } - if (p == NULL) + if (p == nullptr) { gmx_fatal(errno, __FILE__, __LINE__, "Not enough memory. Failed to realloc %" GMX_PRId64 " bytes for %s, %s=%x\n" @@ -240,7 +240,7 @@ void save_free(const char gmx_unused *name, const char gmx_unused *file, int gmx #ifdef DEBUG log_action(0, name, file, line, 0, 0, ptr); #endif - if (ptr != NULL) + if (ptr != nullptr) { free(ptr); } @@ -300,7 +300,7 @@ void *save_calloc_aligned(const char *name, const char *file, int line, size_t nelem, size_t elsize, size_t alignment) { void *aligned = save_malloc_aligned(name, file, line, nelem, elsize, alignment); - if (aligned != NULL) + if (aligned != nullptr) { memset(aligned, 0, (size_t)(nelem * elsize)); } diff --git a/src/gromacs/utility/strdb.cpp b/src/gromacs/utility/strdb.cpp index 0985d3c5bb..5ea2fa3c1d 100644 --- a/src/gromacs/utility/strdb.cpp +++ b/src/gromacs/utility/strdb.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -97,13 +97,13 @@ gmx_bool get_header(char line[], char *header) std::strcpy(temp, line); dum = std::strchr(temp, '['); - if (dum == NULL) + if (dum == nullptr) { return FALSE; } dum[0] = ' '; dum = std::strchr(temp, ']'); - if (dum == NULL) + if (dum == nullptr) { gmx_fatal(FARGS, "header is not terminated on line:\n'%s'\n", line); return FALSE; @@ -141,7 +141,7 @@ static int fget_lines(FILE *in, const char *db, char ***strings) char *pret; pret = fgets(buf, STRLEN, in); - if (pret == NULL || sscanf(buf, "%d", &nstr) != 1) + if (pret == nullptr || sscanf(buf, "%d", &nstr) != 1) { gmx_warning("File is empty"); gmx_ffclose(in); diff --git a/src/gromacs/utility/stringutil.cpp b/src/gromacs/utility/stringutil.cpp index 1a1b1c1e22..9b9cc1a2a1 100644 --- a/src/gromacs/utility/stringutil.cpp +++ b/src/gromacs/utility/stringutil.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -105,7 +105,7 @@ bool endsWith(const char *str, const char *suffix) std::string stripSuffixIfPresent(const std::string &str, const char *suffix) { - if (suffix != NULL) + if (suffix != nullptr) { size_t suffixLength = std::strlen(suffix); if (suffixLength > 0 && endsWith(str, suffix)) @@ -247,7 +247,7 @@ std::string replaceInternal(const std::string &input, const char *from, const char *to, bool bWholeWords) { - GMX_RELEASE_ASSERT(from != NULL && to != NULL, + GMX_RELEASE_ASSERT(from != nullptr && to != nullptr, "Replacement strings must not be NULL"); size_t matchLength = std::strlen(from); std::string result; @@ -352,7 +352,7 @@ TextLineWrapper::findNextLine(const char *input, size_t lineStart) const { const char *nextBreakPtr = std::strpbrk(input + lineEnd, " \n"); size_t nextBreak - = (nextBreakPtr != NULL ? nextBreakPtr - input : inputLength); + = (nextBreakPtr != nullptr ? nextBreakPtr - input : inputLength); if (nextBreak > lastAllowedBreakPoint && lineEnd > lineStart) { break; diff --git a/src/gromacs/utility/stringutil.h b/src/gromacs/utility/stringutil.h index 592d517c73..56beb1cc92 100644 --- a/src/gromacs/utility/stringutil.h +++ b/src/gromacs/utility/stringutil.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -62,7 +62,7 @@ namespace gmx */ static inline bool isNullOrEmpty(const char *str) { - return str == NULL || str[0] == '\0'; + return str == nullptr || str[0] == '\0'; } /*! \brief diff --git a/src/gromacs/utility/sysinfo.cpp b/src/gromacs/utility/sysinfo.cpp index 374b3c04a4..88a26d8696 100644 --- a/src/gromacs/utility/sysinfo.cpp +++ b/src/gromacs/utility/sysinfo.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -156,7 +156,7 @@ gmx_ctime_r(const time_t *clock, char *buf, size_t len) void gmx_format_current_time(char *buf, size_t len) { - time_t clock = time(NULL); + time_t clock = time(nullptr); gmx_ctime_r(&clock, buf, len); } diff --git a/src/gromacs/utility/tests/stringutil.cpp b/src/gromacs/utility/tests/stringutil.cpp index 08a844d53b..e3c5d87ed0 100644 --- a/src/gromacs/utility/tests/stringutil.cpp +++ b/src/gromacs/utility/tests/stringutil.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -84,7 +84,7 @@ TEST(StringUtilityTest, StartsWith) TEST(StringUtilityTest, EndsWith) { EXPECT_TRUE(gmx::endsWith("foobar", "bar")); - EXPECT_TRUE(gmx::endsWith("foobar", NULL)); + EXPECT_TRUE(gmx::endsWith("foobar", nullptr)); EXPECT_TRUE(gmx::endsWith("foobar", "")); EXPECT_TRUE(gmx::endsWith("", "")); EXPECT_FALSE(gmx::endsWith("", "foobar")); @@ -96,7 +96,7 @@ TEST(StringUtilityTest, EndsWith) TEST(StringUtilityTest, StripSuffixIfPresent) { EXPECT_EQ("foo", gmx::stripSuffixIfPresent("foobar", "bar")); - EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", NULL)); + EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", nullptr)); EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", "")); EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", "bbar")); EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", "barr")); diff --git a/src/gromacs/utility/txtdump.cpp b/src/gromacs/utility/txtdump.cpp index bcb2b10d79..a978b7ad20 100644 --- a/src/gromacs/utility/txtdump.cpp +++ b/src/gromacs/utility/txtdump.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -66,7 +66,7 @@ int available(FILE *fp, const void *p, int indent, const char *title) } fprintf(fp, "%s: not available\n", title); } - return (p != NULL); + return (p != nullptr); } int pr_title(FILE *fp, int indent, const char *title) @@ -129,7 +129,7 @@ void pr_reals_of_dim(FILE *fp, int indent, const char *title, const real *vec, i const char *flong = "%15.8e"; const char *format; - if (getenv("GMX_PRINT_LONGFORMAT") != NULL) + if (getenv("GMX_PRINT_LONGFORMAT") != nullptr) { format = flong; } diff --git a/src/programs/legacymodules.cpp b/src/programs/legacymodules.cpp index 10a6f64c34..c39c2c4ae9 100644 --- a/src/programs/legacymodules.cpp +++ b/src/programs/legacymodules.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -84,7 +84,7 @@ class ObsoleteToolModule : public gmx::ICommandLineModule } virtual const char *shortDescription() const { - return NULL; + return nullptr; } virtual void init(gmx::CommandLineModuleSettings * /*settings*/) diff --git a/src/programs/mdrun/md.cpp b/src/programs/mdrun/md.cpp index 29d96431d3..63583b9055 100644 --- a/src/programs/mdrun/md.cpp +++ b/src/programs/mdrun/md.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -230,7 +230,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, unsigned long Flags, gmx_walltime_accounting_t walltime_accounting) { - gmx_mdoutf_t outf = NULL; + gmx_mdoutf_t outf = nullptr; gmx_int64_t step, step_rel; double elapsed_time; double t, t0, lam0[efptNR]; @@ -250,15 +250,15 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, t_vcm *vcm; matrix parrinellorahmanMu, M; t_trxframe rerun_fr; - gmx_repl_ex_t repl_ex = NULL; + gmx_repl_ex_t repl_ex = nullptr; int nchkpt = 1; gmx_localtop_t *top; - t_mdebin *mdebin = NULL; + t_mdebin *mdebin = nullptr; gmx_enerdata_t *enerd; PaddedRVecVector f {}; gmx_global_stat_t gstat; - gmx_update_t *upd = NULL; - t_graph *graph = NULL; + gmx_update_t *upd = nullptr; + t_graph *graph = nullptr; gmx_groups_t *groups; gmx_ekindata_t *ekind; gmx_shellfc_t *shellfc; @@ -266,7 +266,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, gmx_bool bResetCountersHalfMaxH = FALSE; gmx_bool bTemp, bPres, bTrotter; real dvdl_constr; - rvec *cbuf = NULL; + rvec *cbuf = nullptr; int cbuf_nalloc = 0; matrix lastbox; int lamnew = 0; @@ -282,7 +282,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, /* PME load balancing data for GPU kernels */ - pme_load_balancing_t *pme_loadbal = NULL; + pme_load_balancing_t *pme_loadbal = nullptr; gmx_bool bPMETune = FALSE; gmx_bool bPMETunePrinting = FALSE; @@ -444,7 +444,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, state_global, top_global, ir, state, &f, mdatoms, top, fr, vsite, constr, - nrnb, NULL, FALSE); + nrnb, nullptr, FALSE); shouldCheckNumberOfBondedInteractions = true; update_realloc(upd, state->natoms); } @@ -537,7 +537,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, if (vsite) { /* Construct the virtual sites for the initial configuration */ - construct_vsites(vsite, as_rvec_array(state->x.data()), ir->delta_t, NULL, + construct_vsites(vsite, as_rvec_array(state->x.data()), ir->delta_t, nullptr, top->idef.iparams, top->idef.il, fr->ePBC, fr->bMolPBC, cr, state->box); } @@ -577,7 +577,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, bSumEkinhOld = FALSE; compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm, - NULL, enerd, force_vir, shake_vir, total_vir, pres, mu_tot, + nullptr, enerd, force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld, cglo_flags | (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0)); @@ -593,9 +593,9 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, perhaps loses some logic?*/ compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm, - NULL, enerd, force_vir, shake_vir, total_vir, pres, mu_tot, + nullptr, enerd, force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller, state->box, - NULL, &bSumEkinhOld, + nullptr, &bSumEkinhOld, cglo_flags &~(CGLO_STOPCM | CGLO_PRESSURE)); } @@ -795,7 +795,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, { /* PME grid + cut-off optimization with GPUs or PME nodes */ pme_loadbal_do(pme_loadbal, cr, - (bVerbose && MASTER(cr)) ? stderr : NULL, + (bVerbose && MASTER(cr)) ? stderr : nullptr, fplog, mdlog, ir, fr, state, wcycle, @@ -999,7 +999,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, * the full step kinetic energy and possibly for T-coupling.*/ /* This may not be quite working correctly yet . . . . */ compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm, - wcycle, enerd, NULL, NULL, NULL, NULL, mu_tot, + wcycle, enerd, nullptr, nullptr, nullptr, nullptr, mu_tot, constr, &nullSignaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld, CGLO_GSTAT | CGLO_TEMPERATURE | CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS); @@ -1095,7 +1095,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, if (EI_VV(ir->eI) && !startingFromCheckpoint && !bRerunMD) /* ############### START FIRST UPDATE HALF-STEP FOR VV METHODS############### */ { - rvec *vbuf = NULL; + rvec *vbuf = nullptr; wallcycle_start(wcycle, ewcUPDATE); if (ir->eI == eiVV && bInitStep) @@ -1122,7 +1122,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, if (!bRerunMD || rerun_fr.bV || bForceUpdate) /* Why is rerun_fr.bV here? Unclear. */ { wallcycle_stop(wcycle, ewcUPDATE); - update_constraints(fplog, step, NULL, ir, mdatoms, + update_constraints(fplog, step, nullptr, ir, mdatoms, state, fr->bMolPBC, graph, &f, &top->idef, shake_vir, cr, nrnb, wcycle, upd, constr, @@ -1193,7 +1193,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, if (inputrecNvtTrotter(ir) && ir->eI == eiVV) { /* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */ - enerd->term[F_TEMP] = sum_ekin(&(ir->opts), ekind, NULL, (ir->eI == eiVV), FALSE); + enerd->term[F_TEMP] = sum_ekin(&(ir->opts), ekind, nullptr, (ir->eI == eiVV), FALSE); enerd->term[F_EKIN] = trace(ekind->ekin); } } @@ -1204,9 +1204,9 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, * the full step kinetic energy and possibly for T-coupling.*/ /* This may not be quite working correctly yet . . . . */ compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm, - wcycle, enerd, NULL, NULL, NULL, NULL, mu_tot, + wcycle, enerd, nullptr, nullptr, nullptr, nullptr, mu_tot, constr, &nullSignaller, state->box, - NULL, &bSumEkinhOld, + nullptr, &bSumEkinhOld, CGLO_GSTAT | CGLO_TEMPERATURE); wallcycle_start(wcycle, ewcUPDATE); } @@ -1356,7 +1356,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, /* if we have constraints, we have to remove the kinetic energy parallel to the bonds */ if (constr && bIfRandomize) { - update_constraints(fplog, step, NULL, ir, mdatoms, + update_constraints(fplog, step, nullptr, ir, mdatoms, state, fr->bMolPBC, graph, &f, &top->idef, tmp_vir, cr, nrnb, wcycle, upd, constr, @@ -1434,7 +1434,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm, wcycle, enerd, force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller, lastbox, - NULL, &bSumEkinhOld, + nullptr, &bSumEkinhOld, (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE ); wallcycle_start(wcycle, ewcUPDATE); @@ -1451,10 +1451,10 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, * to numerical errors, or are they important * physically? I'm thinking they are just errors, but not completely sure. * For now, will call without actually constraining, constr=NULL*/ - update_constraints(fplog, step, NULL, ir, mdatoms, + update_constraints(fplog, step, nullptr, ir, mdatoms, state, fr->bMolPBC, graph, &f, &top->idef, tmp_vir, - cr, nrnb, wcycle, upd, NULL, + cr, nrnb, wcycle, upd, nullptr, FALSE, bCalcVir); } if (EI_VV(ir->eI)) @@ -1486,10 +1486,10 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, unshift_self(graph, state->box, as_rvec_array(state->x.data())); } - if (vsite != NULL) + if (vsite != nullptr) { wallcycle_start(wcycle, ewcVSITECONSTR); - if (graph != NULL) + if (graph != nullptr) { shift_self(graph, state->box, as_rvec_array(state->x.data())); } @@ -1497,7 +1497,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, top->idef.iparams, top->idef.il, fr->ePBC, fr->bMolPBC, cr, state->box); - if (graph != NULL) + if (graph != nullptr) { unshift_self(graph, state->box, as_rvec_array(state->x.data())); } @@ -1600,7 +1600,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, if (fplog && do_log && bDoExpanded) { /* only needed if doing expanded ensemble */ - PrintFreeEnergyInfoToFile(fplog, ir->fepvals, ir->expandedvals, ir->bSimTemp ? ir->simtempvals : NULL, + PrintFreeEnergyInfoToFile(fplog, ir->fepvals, ir->expandedvals, ir->bSimTemp ? ir->simtempvals : nullptr, state_global->dfhist, state->fep_state, ir->nstlog, step); } if (bCalcEner) @@ -1619,7 +1619,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, gmx_bool do_dr = do_per_step(step, ir->nstdisreout); gmx_bool do_or = do_per_step(step, ir->nstorireout); - print_ebin(mdoutf_get_fp_ene(outf), do_ene, do_dr, do_or, do_log ? fplog : NULL, + print_ebin(mdoutf_get_fp_ene(outf), do_ene, do_dr, do_or, do_log ? fplog : nullptr, step, t, eprNORMAL, mdebin, fcd, groups, &(ir->opts)); @@ -1712,7 +1712,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, /* ####### END SET VARIABLES FOR NEXT ITERATION ###### */ - if ( (membed != NULL) && (!bLastStep) ) + if ( (membed != nullptr) && (!bLastStep) ) { rescale_membed(step_rel, membed, as_rvec_array(state_global->x.data())); } @@ -1767,7 +1767,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, "mdrun -resetstep.", step); } reset_all_counters(fplog, mdlog, cr, step, &step_rel, ir, wcycle, nrnb, walltime_accounting, - use_GPU(fr->nbv) ? fr->nbv : NULL); + use_GPU(fr->nbv) ? fr->nbv : nullptr); wcycle_set_reset_counters(wcycle, -1); if (!(cr->duty & DUTY_PME)) { diff --git a/src/programs/mdrun/mdrun.cpp b/src/programs/mdrun/mdrun.cpp index 1804ab4b36..2855d79eca 100644 --- a/src/programs/mdrun/mdrun.cpp +++ b/src/programs/mdrun/mdrun.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -229,11 +229,11 @@ int gmx_mdrun(int argc, char *argv[]) }; t_commrec *cr; t_filenm fnm[] = { - { efTPR, NULL, NULL, ffREAD }, - { efTRN, "-o", NULL, ffWRITE }, - { efCOMPRESSED, "-x", NULL, ffOPTWR }, - { efCPT, "-cpi", NULL, ffOPTRD | ffALLOW_MISSING }, - { efCPT, "-cpo", NULL, ffOPTWR }, + { efTPR, nullptr, nullptr, ffREAD }, + { efTRN, "-o", nullptr, ffWRITE }, + { efCOMPRESSED, "-x", nullptr, ffOPTWR }, + { efCPT, "-cpi", nullptr, ffOPTRD | ffALLOW_MISSING }, + { efCPT, "-cpo", nullptr, ffOPTWR }, { efSTO, "-c", "confout", ffWRITE }, { efEDR, "-e", "ener", ffWRITE }, { efLOG, "-g", "md", ffWRITE }, @@ -256,7 +256,7 @@ int gmx_mdrun(int argc, char *argv[]) { efLOG, "-rs", "rotslabs", ffOPTWR }, { efLOG, "-rt", "rottorque", ffOPTWR }, { efMTX, "-mtx", "nm", ffOPTWR }, - { efRND, "-multidir", NULL, ffOPTRDMULT}, + { efRND, "-multidir", nullptr, ffOPTRDMULT}, { efDAT, "-membed", "membed", ffOPTRD }, { efTOP, "-mp", "membed", ffOPTRD }, { efNDX, "-mn", "membed", ffOPTRD }, @@ -291,20 +291,20 @@ int gmx_mdrun(int argc, char *argv[]) rvec realddxyz = {0, 0, 0}; const char *ddrank_opt[ddrankorderNR+1] = - { NULL, "interleave", "pp_pme", "cartesian", NULL }; + { nullptr, "interleave", "pp_pme", "cartesian", nullptr }; const char *dddlb_opt[] = - { NULL, "auto", "no", "yes", NULL }; + { nullptr, "auto", "no", "yes", nullptr }; const char *thread_aff_opt[threadaffNR+1] = - { NULL, "auto", "on", "off", NULL }; + { nullptr, "auto", "on", "off", nullptr }; const char *nbpu_opt[] = - { NULL, "auto", "cpu", "gpu", "gpu_cpu", NULL }; + { nullptr, "auto", "cpu", "gpu", "gpu_cpu", nullptr }; real rdd = 0.0, rconstr = 0.0, dlb_scale = 0.8, pforce = -1; - char *ddcsx = NULL, *ddcsy = NULL, *ddcsz = NULL; + char *ddcsx = nullptr, *ddcsy = nullptr, *ddcsz = nullptr; real cpt_period = 15.0, max_hours = -1; gmx_bool bTryToAppendFiles = TRUE; gmx_bool bKeepAndNumCPT = FALSE; gmx_bool bResetCountersHalfWay = FALSE; - gmx_output_env_t *oenv = NULL; + gmx_output_env_t *oenv = nullptr; /* Non transparent initialization of a complex gmx_hw_opt_t struct. * But unfortunately we are not allowed to call a function here, @@ -312,7 +312,7 @@ int gmx_mdrun(int argc, char *argv[]) */ gmx_hw_opt_t hw_opt = { 0, 0, 0, 0, threadaffSEL, 0, 0, - { NULL, FALSE, 0, NULL } + { nullptr, FALSE, 0, nullptr } }; t_pargs pa[] = { @@ -421,7 +421,7 @@ int gmx_mdrun(int argc, char *argv[]) gmx_bool bDoAppendFiles, bStartFromCpt; FILE *fplog; int rc; - char **multidir = NULL; + char **multidir = nullptr; cr = init_commrec(); @@ -448,7 +448,7 @@ int gmx_mdrun(int argc, char *argv[]) */ if (!parse_common_args(&argc, argv, PCA_Flags, NFILE, fnm, asize(pa), pa, - asize(desc), desc, 0, NULL, &oenv)) + asize(desc), desc, 0, nullptr, &oenv)) { sfree(cr); return 0; @@ -535,7 +535,7 @@ int gmx_mdrun(int argc, char *argv[]) } else { - fplog = NULL; + fplog = nullptr; } ddxyz[XX] = (int)(realddxyz[XX] + 0.5); diff --git a/src/programs/mdrun/membed.cpp b/src/programs/mdrun/membed.cpp index 38f7388c74..0869b8e590 100644 --- a/src/programs/mdrun/membed.cpp +++ b/src/programs/mdrun/membed.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -726,7 +726,7 @@ static void rm_group(gmx_groups_t *groups, gmx_mtop_t *mtop, rm_t *rm_p, t_state for (i = 0; i < egcNR; i++) { - if (groups->grpnr[i] != NULL) + if (groups->grpnr[i] != nullptr) { groups->ngrpnr[i] = state->natoms; snew(new_egrp[i], state->natoms); @@ -750,7 +750,7 @@ static void rm_group(gmx_groups_t *groups, gmx_mtop_t *mtop, rm_t *rm_p, t_state { for (j = 0; j < egcNR; j++) { - if (groups->grpnr[j] != NULL) + if (groups->grpnr[j] != nullptr) { new_egrp[j][i-rm] = groups->grpnr[j][i]; } @@ -790,7 +790,7 @@ static void rm_group(gmx_groups_t *groups, gmx_mtop_t *mtop, rm_t *rm_p, t_state for (i = 0; i < egcNR; i++) { - if (groups->grpnr[i] != NULL) + if (groups->grpnr[i] != nullptr) { sfree(groups->grpnr[i]); groups->grpnr[i] = new_egrp[i]; @@ -908,7 +908,7 @@ static void top_update(const char *topfile, rm_t *rm_p, gmx_mtop_t *mtop) if (buf[0] != ';') { strcpy(buf2, buf); - if ((temp = strchr(buf2, '\n')) != NULL) + if ((temp = strchr(buf2, '\n')) != nullptr) { temp[0] = '\0'; } @@ -916,7 +916,7 @@ static void top_update(const char *topfile, rm_t *rm_p, gmx_mtop_t *mtop) if (buf2[0] == '[') { buf2[0] = ' '; - if ((temp = strchr(buf2, '\n')) != NULL) + if ((temp = strchr(buf2, '\n')) != nullptr) { temp[0] = '\0'; } @@ -1013,7 +1013,7 @@ gmx_membed_t *init_membed(FILE *fplog, int nfile, const t_filenm fnm[], gmx_mtop int i, rm_bonded_at, fr_id, fr_i = 0, tmp_id, warn = 0; int ng, j, max_lip_rm, ins_grp_id, ntype, lip_rm; real prot_area; - rvec *r_ins = NULL; + rvec *r_ins = nullptr; t_block *ins_at, *rest_at; pos_ins_t *pos_ins; mem_t *mem_p; @@ -1022,8 +1022,8 @@ gmx_membed_t *init_membed(FILE *fplog, int nfile, const t_filenm fnm[], gmx_mtop gmx_bool bExcl = FALSE; t_atoms atoms; t_pbc *pbc; - char **piecename = NULL; - gmx_membed_t *membed = NULL; + char **piecename = nullptr; + gmx_membed_t *membed = nullptr; /* input variables */ const char *membed_input; diff --git a/src/programs/mdrun/repl_ex.cpp b/src/programs/mdrun/repl_ex.cpp index 83c1e43a23..1021f43966 100644 --- a/src/programs/mdrun/repl_ex.cpp +++ b/src/programs/mdrun/repl_ex.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -162,7 +162,7 @@ gmx_repl_ex_t init_replica_exchange(FILE *fplog, fprintf(fplog, "\nInitializing Replica Exchange\n"); - if (ms == NULL || ms->nsim == 1) + if (ms == nullptr || ms->nsim == 1) { gmx_fatal(FARGS, "Nothing to exchange with only one replica, maybe you forgot to set the -multi option of mdrun?"); } @@ -620,7 +620,7 @@ static void print_ind(FILE *fplog, const char *leg, int n, int *ind, gmx_bool *b fprintf(fplog, "Repl %2s %2d", leg, ind[0]); for (i = 1; i < n; i++) { - fprintf(fplog, " %c %2d", (bEx != 0 && bEx[i]) ? 'x' : ' ', ind[i]); + fprintf(fplog, " %c %2d", (bEx != nullptr && bEx[i]) ? 'x' : ' ', ind[i]); } fprintf(fplog, "\n"); } @@ -1311,11 +1311,11 @@ void print_replica_exchange_statistics(FILE *fplog, struct gmx_repl_ex *re) re->prob[i] = re->prob_sum[i]/re->nattempt[i%2]; } } - print_ind(fplog, "", re->nrepl, re->ind, NULL); + print_ind(fplog, "", re->nrepl, re->ind, nullptr); print_prob(fplog, "", re->nrepl, re->prob); fprintf(fplog, "Repl number of exchanges:\n"); - print_ind(fplog, "", re->nrepl, re->ind, NULL); + print_ind(fplog, "", re->nrepl, re->ind, nullptr); print_count(fplog, "", re->nrepl, re->nexchange); fprintf(fplog, "Repl average number of exchanges:\n"); @@ -1330,7 +1330,7 @@ void print_replica_exchange_statistics(FILE *fplog, struct gmx_repl_ex *re) re->prob[i] = ((real)re->nexchange[i])/re->nattempt[i%2]; } } - print_ind(fplog, "", re->nrepl, re->ind, NULL); + print_ind(fplog, "", re->nrepl, re->ind, nullptr); print_prob(fplog, "", re->nrepl, re->prob); fprintf(fplog, "\n"); diff --git a/src/programs/mdrun/resource-division.cpp b/src/programs/mdrun/resource-division.cpp index 5e51e7e106..d5518a725c 100644 --- a/src/programs/mdrun/resource-division.cpp +++ b/src/programs/mdrun/resource-division.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -615,7 +615,7 @@ void check_resource_division_efficiency(const gmx_hw_info_t *hwinfo, gmx_bool bEnvSet; char buf2[256]; - bEnvSet = (getenv("OMP_NUM_THREADS") != NULL); + bEnvSet = (getenv("OMP_NUM_THREADS") != nullptr); if (bNtOmpOptionSet || bEnvSet) { @@ -670,7 +670,7 @@ static void print_hw_opt(FILE *fp, const gmx_hw_opt_t *hw_opt) hw_opt->nthreads_tmpi, hw_opt->nthreads_omp, hw_opt->nthreads_omp_pme, - hw_opt->gpu_opt.gpu_id != NULL ? hw_opt->gpu_opt.gpu_id : ""); + hw_opt->gpu_opt.gpu_id != nullptr ? hw_opt->gpu_opt.gpu_id : ""); } /* Checks we can do when we don't (yet) know the cut-off scheme */ diff --git a/src/programs/mdrun/runner.cpp b/src/programs/mdrun/runner.cpp index 38aa03d147..39b979632a 100644 --- a/src/programs/mdrun/runner.cpp +++ b/src/programs/mdrun/runner.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -187,7 +187,7 @@ static void mdrunner_start_fn(void *arg) copy pointed-to items, of course, but those are all const. */ t_commrec *cr; /* we need a local version of this */ - FILE *fplog = NULL; + FILE *fplog = nullptr; t_filenm *fnm; fnm = dup_tfn(mc.nfile, mc.fnm); @@ -289,7 +289,7 @@ static t_commrec *mdrunner_start_threads(gmx_hw_opt_t *hw_opt, mdrunner_start_fn, (void*)(mda) ); if (ret != TMPI_SUCCESS) { - return NULL; + return nullptr; } crn = reinitialize_commrec_for_this_thread(cr); @@ -364,7 +364,7 @@ static void increase_nstlist(FILE *fp, t_commrec *cr, return; } - if (fp != NULL && bGPU && ir->nstlist < nstlist_try[0]) + if (fp != nullptr && bGPU && ir->nstlist < nstlist_try[0]) { fprintf(fp, nstl_gpu, ir->nstlist); } @@ -386,7 +386,7 @@ static void increase_nstlist(FILE *fp, t_commrec *cr, { fprintf(stderr, "%s\n", nve_err); } - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "%s\n", nve_err); } @@ -405,7 +405,7 @@ static void increase_nstlist(FILE *fp, t_commrec *cr, { fprintf(stderr, "%s\n", vbd_err); } - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "%s\n", vbd_err); } @@ -447,7 +447,7 @@ static void increase_nstlist(FILE *fp, t_commrec *cr, */ nstlist_prev = ir->nstlist; ir->nstlist = nbnxnReferenceNstlist; - calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, NULL, + calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, nullptr, &rlistWithReferenceNstlist); ir->nstlist = nstlist_prev; @@ -472,7 +472,7 @@ static void increase_nstlist(FILE *fp, t_commrec *cr, } /* Set the pair-list buffer size in ir */ - calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, NULL, &rlist_new); + calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, nullptr, &rlist_new); /* Does rlist fit in the box? */ bBox = (gmx::square(rlist_new) < max_cutoff2(ir->ePBC, box)); @@ -523,7 +523,7 @@ static void increase_nstlist(FILE *fp, t_commrec *cr, if (!bBox || !bDD) { gmx_warning(!bBox ? box_err : dd_err); - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "\n%s\n", bBox ? box_err : dd_err); } @@ -538,7 +538,7 @@ static void increase_nstlist(FILE *fp, t_commrec *cr, { fprintf(stderr, "%s\n\n", buf); } - if (fp != NULL) + if (fp != nullptr) { fprintf(fp, "%s\n\n", buf); } @@ -571,11 +571,11 @@ static void prepare_verlet_scheme(FILE *fplog, */ verletbuf_get_list_setup(TRUE, bUseGPU, &ls); - calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, NULL, &rlist_new); + calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, nullptr, &rlist_new); if (rlist_new != ir->rlist) { - if (fplog != NULL) + if (fplog != nullptr) { fprintf(fplog, "\nChanging rlist from %g to %g for non-bonded %dx%d atom kernels\n\n", ir->rlist, rlist_new, @@ -681,7 +681,7 @@ static integrator_t *my_integrator(unsigned int ei) static gmx::LoggerOwner buildLogger(FILE *fplog, const t_commrec *cr) { gmx::LoggerBuilder builder; - if (fplog != NULL) + if (fplog != nullptr) { builder.addTargetFile(gmx::MDLogger::LogLevel::Info, fplog); } @@ -712,24 +712,24 @@ int mdrunner(gmx_hw_opt_t *hw_opt, gmx_ddbox_t ddbox = {0}; int npme_major, npme_minor; t_nrnb *nrnb; - gmx_mtop_t *mtop = NULL; - t_mdatoms *mdatoms = NULL; - t_forcerec *fr = NULL; - t_fcdata *fcd = NULL; + gmx_mtop_t *mtop = nullptr; + t_mdatoms *mdatoms = nullptr; + t_forcerec *fr = nullptr; + t_fcdata *fcd = nullptr; real ewaldcoeff_q = 0; real ewaldcoeff_lj = 0; - struct gmx_pme_t **pmedata = NULL; - gmx_vsite_t *vsite = NULL; + struct gmx_pme_t **pmedata = nullptr; + gmx_vsite_t *vsite = nullptr; gmx_constr_t constr; int nChargePerturbed = -1, nTypePerturbed = 0, status; gmx_wallcycle_t wcycle; - gmx_walltime_accounting_t walltime_accounting = NULL; + gmx_walltime_accounting_t walltime_accounting = nullptr; int rc; gmx_int64_t reset_counters; - gmx_edsam_t ed = NULL; + gmx_edsam_t ed = nullptr; int nthreads_pme = 1; - gmx_membed_t * membed = NULL; - gmx_hw_info_t *hwinfo = NULL; + gmx_membed_t * membed = nullptr; + gmx_hw_info_t *hwinfo = nullptr; /* The master rank decides early on bUseGPU and broadcasts this later */ gmx_bool bUseGPU = FALSE; @@ -741,7 +741,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, if (Flags & MD_APPENDFILES) { - fplog = NULL; + fplog = nullptr; } bool doMembed = opt2bSet("-membed", nfile, fnm); @@ -760,7 +760,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, gmx_print_detected_hardware(fplog, cr, mdlog, hwinfo); - if (fplog != NULL) + if (fplog != nullptr) { /* Print references after all software/hardware printing */ please_cite(fplog, "Abraham2015"); @@ -784,7 +784,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, { /* Here the master rank decides if all ranks will use GPUs */ bUseGPU = (hwinfo->gpu_info.n_dev_compatible > 0 || - getenv("GMX_EMULATE_GPU") != NULL); + getenv("GMX_EMULATE_GPU") != nullptr); /* TODO add GPU kernels for this and replace this check by: * (bUseGPU && (ir->vdwtype == evdwPME && @@ -877,7 +877,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, Flags); /* the main thread continues here with a new cr. We don't deallocate the old cr because other threads may still be reading it. */ - if (cr == NULL) + if (cr == nullptr) { gmx_comm("Failed to spawn threads"); } @@ -897,7 +897,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, gmx_bcast_sim(sizeof(bUseGPU), &bUseGPU, cr); } - if (fplog != NULL) + if (fplog != nullptr) { pr_inputrec(fplog, 0, "Input Parameters", inputrec, FALSE); fprintf(fplog, "\n"); @@ -1253,7 +1253,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, } else { - pmedata = NULL; + pmedata = nullptr; } } else @@ -1262,7 +1262,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt, /* We don't need the state */ stateInstance.reset(); - state = NULL; + state = nullptr; ewaldcoeff_q = calc_ewaldcoeff_q(inputrec->rcoulomb, inputrec->ewald_rtol); ewaldcoeff_lj = calc_ewaldcoeff_lj(inputrec->rvdw, inputrec->ewald_rtol_lj); @@ -1412,18 +1412,18 @@ int mdrunner(gmx_hw_opt_t *hw_opt, */ finish_run(fplog, mdlog, cr, inputrec, nrnb, wcycle, walltime_accounting, - fr ? fr->nbv : NULL, + fr ? fr->nbv : nullptr, EI_DYNAMICS(inputrec->eI) && !MULTISIM(cr)); // Free PME data if (pmedata) { gmx_pme_destroy(pmedata); - pmedata = NULL; + pmedata = nullptr; } /* Free GPU memory and context */ - free_gpu_resources(fr, cr, &hwinfo->gpu_info, fr ? fr->gpu_opt : NULL); + free_gpu_resources(fr, cr, &hwinfo->gpu_info, fr ? fr->gpu_opt : nullptr); if (doMembed) { diff --git a/src/programs/view/fgrid.cpp b/src/programs/view/fgrid.cpp index 08dc54edfc..13104d405c 100644 --- a/src/programs/view/fgrid.cpp +++ b/src/programs/view/fgrid.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -182,11 +182,11 @@ static t_fitem *NewFItem(void) snew(fitem, 1); fitem->nname = 0; - fitem->name = NULL; - fitem->set = NULL; - fitem->get = NULL; - fitem->def = NULL; - fitem->help = NULL; + fitem->name = nullptr; + fitem->set = nullptr; + fitem->get = nullptr; + fitem->def = nullptr; + fitem->help = nullptr; return fitem; } @@ -211,9 +211,9 @@ static t_fgroup *NewFGroup(void) t_fgroup *fgroup; snew(fgroup, 1); - fgroup->name = NULL; + fgroup->name = nullptr; fgroup->nfitem = 0; - fgroup->fitem = NULL; + fgroup->fitem = nullptr; return fgroup; } @@ -246,9 +246,9 @@ static t_fgrid *NewFGrid(void) fgrid->w = 0; fgrid->h = 0; fgrid->nfgroup = 0; - fgrid->fgroup = NULL; + fgrid->fgroup = nullptr; fgrid->nfsimple = 0; - fgrid->fsimple = NULL; + fgrid->fsimple = nullptr; return fgrid; } diff --git a/src/programs/view/filter.cpp b/src/programs/view/filter.cpp index 177e787982..3bcfd9bcd0 100644 --- a/src/programs/view/filter.cpp +++ b/src/programs/view/filter.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -57,7 +57,7 @@ t_filter *init_filter(t_atoms *atoms, const char *fn, int natom_trx) int g, i; snew(f, 1); - if (fn != NULL) + if (fn != nullptr) { f->grps = init_index(fn, &f->grpnames); } diff --git a/src/programs/view/logo.cpp b/src/programs/view/logo.cpp index 1e2bbdde59..bb397e2af6 100644 --- a/src/programs/view/logo.cpp +++ b/src/programs/view/logo.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -105,12 +105,12 @@ static bool LogoCallBack(t_x11 *x11, XEvent *event, Window /*w*/, void *data) }; #define COFFS 70 static t_mess Mess[] = { - { "GROMACS", 0, 20, NULL }, - { NULL, 16, 9, NULL }, - { "Copyright (c) 1991-2013", COFFS+ 2, 9, NULL }, - { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11, 9, NULL }, - { "& Groningen University ", COFFS+20, 9, NULL }, - { "click to dismiss", COFFS+31, 8, NULL } + { "GROMACS", 0, 20, nullptr }, + { nullptr, 16, 9, nullptr }, + { "Copyright (c) 1991-2013", COFFS+ 2, 9, nullptr }, + { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11, 9, nullptr }, + { "& Groningen University ", COFFS+20, 9, nullptr }, + { "click to dismiss", COFFS+31, 8, nullptr } }; #define NMESS asize(Mess) int i; @@ -201,7 +201,7 @@ t_logo *init_logo(t_x11 *x11, Window parent, bool bQuitOnClick) logo->bQuitOnClick = bQuitOnClick; InitWin(&logo->wd, 0, 0, 360, 270, 1, "GROMACS"); bg = LIGHTGREY; - if ((newcol = std::getenv("GMX_LOGO_COLOR")) != NULL) + if ((newcol = std::getenv("GMX_LOGO_COLOR")) != nullptr) { GetNamedColor(x11, newcol, &bg); } @@ -209,9 +209,9 @@ t_logo *init_logo(t_x11 *x11, Window parent, bool bQuitOnClick) logo->wd.x, logo->wd.y, logo->wd.width, logo->wd.height, logo->wd.bwidth, WHITE, bg); - for (i = 0, logo->bigfont = NULL; (i < NBF); i++) + for (i = 0, logo->bigfont = nullptr; (i < NBF); i++) { - if ((logo->bigfont = XLoadQueryFont(x11->disp, bfname[i])) != NULL) + if ((logo->bigfont = XLoadQueryFont(x11->disp, bfname[i])) != nullptr) { break; } @@ -224,9 +224,9 @@ t_logo *init_logo(t_x11 *x11, Window parent, bool bQuitOnClick) #ifdef DEBUG std::fprintf(stderr, "Big Logofont: %s\n", bfname[i]); #endif - for (i = 0, logo->smallfont = NULL; (i < NSF); i++) + for (i = 0, logo->smallfont = nullptr; (i < NSF); i++) { - if ((logo->smallfont = XLoadQueryFont(x11->disp, sfname[i])) != NULL) + if ((logo->smallfont = XLoadQueryFont(x11->disp, sfname[i])) != nullptr) { break; } diff --git a/src/programs/view/manager.cpp b/src/programs/view/manager.cpp index 5a99f93191..f30af45af6 100644 --- a/src/programs/view/manager.cpp +++ b/src/programs/view/manager.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -229,7 +229,7 @@ void set_file(t_x11 *x11, t_manager *man, const char *trajectory, snew(man->szLab, sh.natoms); snew(man->bHydro, sh.natoms); snew(bB, sh.natoms); - read_tpx_top(status, NULL, man->box, &man->natom, NULL, NULL, &man->top); + read_tpx_top(status, nullptr, man->box, &man->natom, nullptr, nullptr, &man->top); man->gpbc = gmx_rmpbc_init(&man->top.idef, -1, man->natom); man->natom = @@ -644,7 +644,7 @@ t_manager *init_man(t_x11 *x11, Window Parent, t_manager *man; snew(man, 1); - man->status = NULL; + man->status = nullptr; man->bPlus = true; man->bSort = true; man->oenv = oenv; @@ -661,7 +661,7 @@ t_manager *init_man(t_x11 *x11, Window Parent, man->molw = init_mw(x11, man->wd.self, 0, 0, 1, 1, WHITE, BLUE, ePBC, box); /* Title Window */ - InitWin(&(man->title), 0, 0, 1, 1, 0, NULL); + InitWin(&(man->title), 0, 0, 1, 1, 0, nullptr); man->title.self = XCreateSimpleWindow(x11->disp, man->molw->wd.self, man->title.x, man->title.y, man->title.width, man->title.height, diff --git a/src/programs/view/nleg.cpp b/src/programs/view/nleg.cpp index f31009eca2..d27b367184 100644 --- a/src/programs/view/nleg.cpp +++ b/src/programs/view/nleg.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -74,7 +74,7 @@ int search_ac(const char *type) best = 0; besti = 0; - if (NULL != type) + if (nullptr != type) { for (i = 0; (i < NAC); i++) { diff --git a/src/programs/view/nmol.cpp b/src/programs/view/nmol.cpp index f06896d2c9..fb19996a83 100644 --- a/src/programs/view/nmol.cpp +++ b/src/programs/view/nmol.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -442,7 +442,7 @@ static void draw_box(t_x11 *x11, Window w, t_3dview *view, matrix box, { 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 4 }, { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } }; - static int *edge = NULL; + static int *edge = nullptr; int i, j, k, i0, i1; rvec corner[NCUCEDGE], box_center; vec4 x4; @@ -452,7 +452,7 @@ static void draw_box(t_x11 *x11, Window w, t_3dview *view, matrix box, if (boxtype == esbTrunc) { calc_compact_unitcell_vertices(view->ecenter, box, corner); - if (edge == NULL) + if (edge == nullptr) { edge = compact_unitcell_edges(); } diff --git a/src/programs/view/popup.cpp b/src/programs/view/popup.cpp index cc8a4dc638..584d5c63c0 100644 --- a/src/programs/view/popup.cpp +++ b/src/programs/view/popup.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -190,7 +190,7 @@ t_menu *init_menu(t_x11 *x11, Window Parent, unsigned long fg, unsigned long bg, kid->m = &(ent[l]); kid->Parent = Parent; w = &(kid->wd); - InitWin(w, j*mlen, k*mht, mlen-2, mht-2, 1, NULL); + InitWin(w, j*mlen, k*mht, mlen-2, mht-2, 1, nullptr); w->self = XCreateSimpleWindow(x11->disp, m->wd.self, w->x, w->y, w->width, w->height, w->bwidth, bg, bg); diff --git a/src/programs/view/view.cpp b/src/programs/view/view.cpp index f72e7aa64c..4bf5973475 100644 --- a/src/programs/view/view.cpp +++ b/src/programs/view/view.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -134,7 +134,7 @@ static bool HandleClient(t_x11 *x11, int ID, t_gmx *gmx) case IDDOEXPORT: write_sto_conf(gmx->confout, *gmx->man->top.name, &(gmx->man->top.atoms), - gmx->man->x, NULL, gmx->man->molw->ePBC, gmx->man->box); + gmx->man->x, nullptr, gmx->man->molw->ePBC, gmx->man->box); break; case IDQUIT: show_mb(gmx, emQuit); @@ -311,7 +311,7 @@ static void init_gmx(t_x11 *x11, char *program, int nfile, t_filenm fnm[], snew(gmx->wd, 1); ePBC = read_tpx_top(ftp2fn(efTPR, nfile, fnm), - NULL, box, &natom, NULL, NULL, &top); + nullptr, box, &natom, nullptr, nullptr, &top); read_first_frame(oenv, &status, ftp2fn(efTRX, nfile, fnm), &fr, TRX_DONT_SKIP); close_trx(status); @@ -333,7 +333,7 @@ static void init_gmx(t_x11 *x11, char *program, int nfile, t_filenm fnm[], hints.min_width = 2*EWIDTH+40; hints.min_height = EHEIGHT+LDHEIGHT+LEGHEIGHT+40; XSetStandardProperties(x11->disp, gmx->wd->self, gmx->wd->text, program, - pm, NULL, 0, &hints); + pm, nullptr, 0, &hints); x11->RegisterCallback(x11, gmx->wd->self, x11->root, MainCallBack, gmx); x11->SetInputMask(x11, gmx->wd->self, @@ -396,21 +396,21 @@ int gmx_view(int argc, char *argv[]) gmx_output_env_t *oenv; t_filenm fnm[] = { - { efTRX, "-f", NULL, ffREAD }, - { efTPR, NULL, NULL, ffREAD }, - { efNDX, NULL, NULL, ffOPTRD } + { efTRX, "-f", nullptr, ffREAD }, + { efTPR, nullptr, nullptr, ffREAD }, + { efNDX, nullptr, nullptr, ffOPTRD } }; #define NFILE asize(fnm) if (parse_common_args(&argc, argv, PCA_CAN_TIME, NFILE, fnm, - 0, NULL, asize(desc), desc, asize(bugs), bugs, &oenv)) + 0, nullptr, asize(desc), desc, asize(bugs), bugs, &oenv)) { #if !GMX_X11 std::fprintf(stderr, "Compiled without X-Windows - can not run viewer.\n"); #else t_x11 *x11; - if ((x11 = GetX11(&argc, argv)) == NULL) + if ((x11 = GetX11(&argc, argv)) == nullptr) { std::fprintf(stderr, "Can't connect to X Server.\n" "Check your DISPLAY environment variable\n"); diff --git a/src/programs/view/x11.cpp b/src/programs/view/x11.cpp index 478bb5c985..fcfc76d275 100644 --- a/src/programs/view/x11.cpp +++ b/src/programs/view/x11.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -80,16 +80,16 @@ static XFontStruct *GetFont(FILE *err, Display *disp, char *name) if (name) { - bFont = ((font = XLQF(err, disp, name)) != NULL); + bFont = ((font = XLQF(err, disp, name)) != nullptr); } else { - font = NULL; + font = nullptr; } for (i = 0; (!bFont && (i < MAXNAMES)); i++) { - bFont = ((font = XLQF(err, disp, fontnames[i])) != NULL); + bFont = ((font = XLQF(err, disp, fontnames[i])) != nullptr); } if (!bFont) @@ -97,7 +97,7 @@ static XFontStruct *GetFont(FILE *err, Display *disp, char *name) fontlist = XListFonts(disp, "?", 1, &count); if (count != 0) { - bFont = ((font = XLQF(err, disp, fontlist[0])) != NULL); + bFont = ((font = XLQF(err, disp, fontlist[0])) != nullptr); } } if (!bFont) @@ -171,7 +171,7 @@ static void MainLoop(t_x11 *x11) /* Filter out expose events with non-zero count field */ if (event.xexpose.count != 0) { - curs = NULL; + curs = nullptr; } break; case ConfigureNotify: @@ -202,7 +202,7 @@ static void RegisterCallback(t_x11 *x11, Window w, Window Parent, item->cb = cb; item->mask = 0; item->data = data; - item->next = NULL; + item->next = nullptr; if (x11->wlist) { @@ -317,7 +317,7 @@ t_x11 *GetX11(int *argc, char *argv[]) char **ARGV; char *display; char *fontname; - char *title, *FG = NULL, *BG = NULL; + char *title, *FG = nullptr, *BG = nullptr; bool bVerbose = false; int i; @@ -380,7 +380,7 @@ t_x11 *GetX11(int *argc, char *argv[]) argv[i] = ARGV[i]; } *argc = ARGC; - argv[ARGC] = NULL; + argv[ARGC] = nullptr; snew(x11, 1); x11->dispname = display; @@ -389,27 +389,27 @@ t_x11 *GetX11(int *argc, char *argv[]) x11->console = stderr; } else - if ((x11->console = std::fopen("/dev/null", "w")) == NULL) + if ((x11->console = std::fopen("/dev/null", "w")) == nullptr) { x11->console = stderr; } - if ((x11->disp = XOpenDisplay(display)) == NULL) + if ((x11->disp = XOpenDisplay(display)) == nullptr) { if (bVerbose) { std::fprintf(x11->console, "Display %s invalid\n", display); } - return NULL; + return nullptr; } - if ((x11->font = GetFont(x11->console, x11->disp, fontname)) == NULL) + if ((x11->font = GetFont(x11->console, x11->disp, fontname)) == nullptr) { - return NULL; + return nullptr; } - if ((x11->gc = GetGC(x11->disp, x11->font)) == NULL) + if ((x11->gc = GetGC(x11->disp, x11->font)) == nullptr) { - return NULL; + return nullptr; } x11->root = DefaultRootWindow(x11->disp); @@ -486,7 +486,7 @@ t_x11 *GetX11(int *argc, char *argv[]) } x11->title = gmx_strdup(title); sfree(title); - x11->wlist = NULL; + x11->wlist = nullptr; x11->GetNamedColor = &GetNamedColor; x11->MainLoop = &MainLoop; x11->RegisterCallback = &RegisterCallback; diff --git a/src/programs/view/xdlg.cpp b/src/programs/view/xdlg.cpp index e52f9cb0e3..2306238207 100644 --- a/src/programs/view/xdlg.cpp +++ b/src/programs/view/xdlg.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -65,7 +65,7 @@ t_dlgitem *FindItem(t_dlg *dlg, t_id id) return dlg->dlgitem[i]; } } - return NULL; + return nullptr; } t_dlgitem *FindWin(t_dlg *dlg, Window win) @@ -79,7 +79,7 @@ t_dlgitem *FindWin(t_dlg *dlg, Window win) return dlg->dlgitem[i]; } } - return NULL; + return nullptr; } /***************************** @@ -91,7 +91,7 @@ bool QueryDlgItemSize(t_dlg *dlg, t_id id, int *w, int *h) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { *w = dlgitem->win.width; *h = dlgitem->win.height; @@ -104,7 +104,7 @@ bool QueryDlgItemPos(t_dlg *dlg, t_id id, int *x0, int *y0) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { *x0 = dlgitem->win.x; *y0 = dlgitem->win.y; @@ -117,7 +117,7 @@ int QueryDlgItemX(t_dlg *dlg, t_id id) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { return dlgitem->win.x; } @@ -128,7 +128,7 @@ int QueryDlgItemY(t_dlg *dlg, t_id id) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { return dlgitem->win.y; } @@ -139,7 +139,7 @@ int QueryDlgItemW(t_dlg *dlg, t_id id) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { return dlgitem->win.width; } @@ -150,7 +150,7 @@ int QueryDlgItemH(t_dlg *dlg, t_id id) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { return dlgitem->win.height; } @@ -164,7 +164,7 @@ bool SetDlgItemSize(t_dlg *dlg, t_id id, int w, int h) int old_w, old_h; #endif - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { #ifdef DEBUG old_w = dlgitem->win.width; @@ -213,7 +213,7 @@ bool SetDlgItemPos(t_dlg *dlg, t_id id, int x0, int y0) t_dlgitem *dlgitem; int old_x, old_y; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { old_x = dlgitem->win.x; old_y = dlgitem->win.y; @@ -259,7 +259,7 @@ bool IsCBChecked(t_dlg *dlg, t_id id) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { if (dlgitem->type == edlgCB) { @@ -291,7 +291,7 @@ int EditTextLen(t_dlg *dlg, t_id id) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { if (dlgitem->type == edlgET) { @@ -306,7 +306,7 @@ char *EditText(t_dlg *dlg, t_id id) { t_dlgitem *dlgitem; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { if (dlgitem->type == edlgET) { @@ -314,7 +314,7 @@ char *EditText(t_dlg *dlg, t_id id) } } - return NULL; + return nullptr; } /***************************** @@ -369,7 +369,7 @@ void NoHelp(t_dlg *dlg) "No help for this item" }; MessageBox(dlg->x11, dlg->wDad, "No Help", 2, lines, - MB_OK | MB_ICONSTOP | MB_APPLMODAL, NULL, NULL); + MB_OK | MB_ICONSTOP | MB_APPLMODAL, nullptr, nullptr); } void HelpDlg(t_dlg *dlg) @@ -380,7 +380,7 @@ void HelpDlg(t_dlg *dlg) "First press the OK button." }; MessageBox(dlg->x11, dlg->win.self, "Help Dialogbox", - 3, lines, MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, NULL, NULL); + 3, lines, MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, nullptr, nullptr); } void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem) @@ -388,7 +388,7 @@ void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem) char buf[80]; bool bCont = true; int i, nlines = 0; - char **lines = NULL; + char **lines = nullptr; if (!dlgitem->help) { @@ -431,7 +431,7 @@ void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem) while (bCont); MessageBox(dlg->x11, dlg->wDad, "Help", nlines, lines, - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, NULL, NULL); + MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, nullptr, nullptr); for (i = 0; (i < nlines); i++) { sfree(lines[i]); @@ -471,7 +471,7 @@ static bool DlgCB(t_x11 *x11, XEvent *event, Window w, void *data) int i, nWndProc; t_dlgitem *dlgitem; - if ((dlgitem = FindWin(dlg, w)) != NULL) + if ((dlgitem = FindWin(dlg, w)) != nullptr) { nWndProc = (dlgitem->WndProc)(x11, dlgitem, event); #ifdef DEBUG @@ -630,7 +630,7 @@ void DoCreateDlg(t_dlg *dlg) hints.y = dlg->win.y; hints.flags = PPosition; XSetStandardProperties(dlg->x11->disp, dlg->win.self, dlg->title, - dlg->title, None, NULL, 0, &hints); + dlg->title, None, nullptr, 0, &hints); } void AddDlgItem(t_dlg *dlg, t_dlgitem *item) @@ -699,7 +699,7 @@ void FreeDlgItem(t_dlg *dlg, t_id id) t_dlgitem *dlgitem; int i; - if ((dlgitem = FindItem(dlg, id)) != NULL) + if ((dlgitem = FindItem(dlg, id)) != nullptr) { dlg->x11->UnRegisterCallback(dlg->x11, dlgitem->win.self); if (dlgitem->win.self) @@ -757,7 +757,7 @@ void FreeDlg(t_dlg *dlg) { XDestroyWindow(dlg->x11->disp, dlg->win.self); } - dlg->dlgitem = NULL; + dlg->dlgitem = nullptr; } } @@ -783,7 +783,7 @@ t_dlg *CreateDlg(t_x11 *x11, Window Parent, const char *title, } else { - dlg->title = NULL; + dlg->title = nullptr; } if (w == 0) { @@ -820,14 +820,14 @@ t_dlg *CreateDlg(t_x11 *x11, Window Parent, const char *title, { y = y0; } - InitWin(&(dlg->win), x, y, w, h, bw, NULL); + InitWin(&(dlg->win), x, y, w, h, bw, nullptr); SetDlgSize(dlg, w, h, x0 || y0); dlg->wDad = Parent; dlg->fg = x11->fg; dlg->bg = x11->bg; dlg->nitem = 0; - dlg->dlgitem = NULL; + dlg->dlgitem = nullptr; DoCreateDlg(dlg); return dlg; diff --git a/src/programs/view/xdlghi.cpp b/src/programs/view/xdlghi.cpp index 3fc04abfd6..3cae52d971 100644 --- a/src/programs/view/xdlghi.cpp +++ b/src/programs/view/xdlghi.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -250,7 +250,7 @@ static t_dlgitemlist **NewDlgitemList(int w, int h) for (j = 0; (j < h); j++) { grid[i][j].nitem = 0; - grid[i][j].list = NULL; + grid[i][j].list = nullptr; } } return grid; @@ -348,7 +348,7 @@ static void AddListFGroup(t_x11 *x11, t_dlgitemlist **grid, GroupID = (*ID)++; item = &(grid[fgroup->x][fgroup->y]); AddListItem(item, CreateGroupBox(x11, fgroup->name, GroupID, - 0, NULL, 0, 0, 0, 0, 0)); + 0, nullptr, 0, 0, 0, 0, 0)); x = 2*OFFS_X; y = item->list[0]->win.y+item->list[0]->win.height; w = 0; diff --git a/src/programs/view/xdlgitem.cpp b/src/programs/view/xdlgitem.cpp index 87c5b903cb..cf75e603cd 100644 --- a/src/programs/view/xdlgitem.cpp +++ b/src/programs/view/xdlgitem.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -436,7 +436,7 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event) { return DefWndProc(x11, dlgitem, event); } - XLookupString(&(event->xkey), c, BUFSIZE, &keysym, NULL); + XLookupString(&(event->xkey), c, BUFSIZE, &keysym, nullptr); #ifdef DEBUG std::printf("Keysym: %x\n", keysym); #endif @@ -670,7 +670,7 @@ t_dlgitem *CreatePixmap(Pixmap pm, t_id id, t_dlgitem *dlgitem; dlgitem = newitem(); - InitWin(&(dlgitem->win), x0, y0, w, h, bw, NULL); + InitWin(&(dlgitem->win), x0, y0, w, h, bw, nullptr); dlgitem->ID = id; dlgitem->type = edlgPM; dlgitem->u.pixmap.pm = pm; @@ -700,7 +700,7 @@ t_dlgitem *CreateStaticText(t_x11 *x11, } w += 2*OFFS_X; } - InitWin(&(dlgitem->win), x0, y0, w, h, bw, NULL); + InitWin(&(dlgitem->win), x0, y0, w, h, bw, nullptr); dlgitem->ID = id; dlgitem->GroupID = groupid; dlgitem->type = edlgST; diff --git a/src/programs/view/xmb.cpp b/src/programs/view/xmb.cpp index 51db50c433..69f1228665 100644 --- a/src/programs/view/xmb.cpp +++ b/src/programs/view/xmb.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -56,7 +56,7 @@ #define ID_ICON -2 #define ID_TEXT -1 -static bmchar *icon_bits = NULL; +static bmchar *icon_bits = nullptr; static int icon_width = 0; static int icon_height = 0; static unsigned long icon_fg = 0; diff --git a/src/programs/view/xutil.cpp b/src/programs/view/xutil.cpp index 8bbc3b358f..2c53b3e785 100644 --- a/src/programs/view/xutil.cpp +++ b/src/programs/view/xutil.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -145,7 +145,7 @@ void TextInRect(t_x11 *x11, Drawable win, const char *s, int x, int y, int width, int height, eXPos eX, eYPos eY) { - SpecialTextInRect(x11, NULL, win, s, x, y, width, height, eX, eY); + SpecialTextInRect(x11, nullptr, win, s, x, y, width, height, eX, eY); } void TextInWin(t_x11 *x11, t_windata *win, @@ -171,7 +171,7 @@ void InitWin(t_windata *win, int x0, int y0, int w, int h, int bw, const char *t } else { - win->text = NULL; + win->text = nullptr; } #ifdef DEBUG std::printf("%s: %d x %d at %d, %d\n", text, w, h, x0, y0); @@ -255,7 +255,7 @@ typedef struct t_mpos { struct t_mpos *prev; } t_mpos; -static t_mpos *mpos = NULL; +static t_mpos *mpos = nullptr; void PushMouse(Display *disp, Window dest, int x, int y) { diff --git a/src/testutils/cmdlinetest.cpp b/src/testutils/cmdlinetest.cpp index eb05df8a9b..4cc338fe6c 100644 --- a/src/testutils/cmdlinetest.cpp +++ b/src/testutils/cmdlinetest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -94,14 +94,14 @@ CommandLine::Impl::Impl(const char *const cmdline[], size_t count) for (size_t i = 0; i < count; ++i) { char *arg = strdup(cmdline[i]); - if (arg == NULL) + if (arg == nullptr) { throw std::bad_alloc(); } args_.push_back(arg); argv_.push_back(arg); } - argv_.push_back(NULL); + argv_.push_back(nullptr); } CommandLine::Impl::~Impl() @@ -117,7 +117,7 @@ CommandLine::Impl::~Impl() */ CommandLine::CommandLine() - : impl_(new Impl(NULL, 0)) + : impl_(new Impl(nullptr, 0)) { } @@ -148,14 +148,14 @@ void CommandLine::append(const char *arg) impl_->args_.reserve(newSize); impl_->argv_.reserve(newSize + 1); char *newArg = strdup(arg); - if (newArg == NULL) + if (newArg == nullptr) { throw std::bad_alloc(); } impl_->args_.push_back(newArg); impl_->argv_.pop_back(); // Remove the trailing NULL. impl_->argv_.push_back(newArg); - impl_->argv_.push_back(NULL); + impl_->argv_.push_back(nullptr); impl_->argc_ = static_cast(newSize); } @@ -298,7 +298,7 @@ int CommandLineTestHelper::runModuleDirect( { // The name and description are not used in the tests, so they can be NULL. const std::unique_ptr wrapperModule( - ICommandLineOptionsModule::createModule(NULL, NULL, std::move(module))); + ICommandLineOptionsModule::createModule(nullptr, nullptr, std::move(module))); return runModuleDirect(wrapperModule.get(), commandLine); } diff --git a/src/testutils/integrationtests.cpp b/src/testutils/integrationtests.cpp index 9913f6053e..41582553f3 100644 --- a/src/testutils/integrationtests.cpp +++ b/src/testutils/integrationtests.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -70,7 +70,7 @@ IntegrationTestFixture::redirectStringToStdin(const char* theString) { std::string fakeStdin("fake-stdin"); gmx::TextWriter::writeFileFromString(fakeStdin, theString); - if (NULL == std::freopen(fakeStdin.c_str(), "r", stdin)) + if (nullptr == std::freopen(fakeStdin.c_str(), "r", stdin)) { GMX_THROW_WITH_ERRNO(FileIOError("Failed to redirect a string to stdin"), "freopen", diff --git a/src/testutils/refdata-impl.h b/src/testutils/refdata-impl.h index 3ac5b644c9..144668763c 100644 --- a/src/testutils/refdata-impl.h +++ b/src/testutils/refdata-impl.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -66,8 +66,8 @@ class ReferenceDataEntry } ReferenceDataEntry(const char *type, const char *id) - : type_(type), id_(id != NULL ? id : ""), isTextBlock_(false), - hasBeenChecked_(false), correspondingOutputEntry_(NULL) + : type_(type), id_(id != nullptr ? id : ""), isTextBlock_(false), + hasBeenChecked_(false), correspondingOutputEntry_(nullptr) { } @@ -84,7 +84,7 @@ class ReferenceDataEntry bool idMatches(const char *id) const { - return (id == NULL && id_.empty()) || (id != NULL && id_ == id); + return (id == nullptr && id_.empty()) || (id != nullptr && id_ == id); } ChildIterator findChild(const char *id, const ChildIterator &prev) const @@ -97,7 +97,7 @@ class ReferenceDataEntry bool wrappingSearch = true; if (child != children_.end()) { - if (id == NULL && (*child)->id().empty()) + if (id == nullptr && (*child)->id().empty()) { wrappingSearch = false; ++child; @@ -174,7 +174,7 @@ class ReferenceDataEntry } void setCorrespondingOutputEntry(ReferenceDataEntry *entry) { - GMX_RELEASE_ASSERT(correspondingOutputEntry_ == NULL, + GMX_RELEASE_ASSERT(correspondingOutputEntry_ == nullptr, "Output entry already exists"); correspondingOutputEntry_ = entry; } diff --git a/src/testutils/refdata.cpp b/src/testutils/refdata.cpp index 9a37881d87..d42f97f98d 100644 --- a/src/testutils/refdata.cpp +++ b/src/testutils/refdata.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -492,7 +492,7 @@ class TestReferenceChecker::Impl { GMX_RELEASE_ASSERT(initialized(), "Accessing uninitialized reference data checker."); - return compareRootEntry_ == NULL; + return compareRootEntry_ == nullptr; } //! Whether initialized with other means than the default constructor. @@ -567,7 +567,7 @@ const char *const TestReferenceChecker::Impl::cSequenceLengthName = "Length"; TestReferenceChecker::Impl::Impl(bool initialized) : initialized_(initialized), defaultTolerance_(defaultRealTolerance()), - compareRootEntry_(NULL), outputRootEntry_(NULL), + compareRootEntry_(nullptr), outputRootEntry_(nullptr), updateMismatchingEntries_(false), bSelfTestMode_(false), seqIndex_(-1) { } @@ -605,7 +605,7 @@ ReferenceDataEntry *TestReferenceChecker::Impl::findEntry(const char *id) lastFoundEntry_ = entry; return entry->get(); } - return NULL; + return nullptr; } ReferenceDataEntry * @@ -614,7 +614,7 @@ TestReferenceChecker::Impl::findOrCreateEntry( const IReferenceDataEntryChecker &checker) { ReferenceDataEntry *entry = findEntry(id); - if (entry == NULL && outputRootEntry_ != NULL) + if (entry == nullptr && outputRootEntry_ != nullptr) { lastFoundEntry_ = compareRootEntry_->addChild(createEntry(type, id, checker)); entry = lastFoundEntry_->get(); @@ -632,14 +632,14 @@ TestReferenceChecker::Impl::processItem(const char *type, const char *id, } std::string fullId = appendPath(id); ReferenceDataEntry *entry = findOrCreateEntry(type, id, checker); - if (entry == NULL) + if (entry == nullptr) { return ::testing::AssertionFailure() << "Reference data item " << fullId << " not found"; } entry->setChecked(); ::testing::AssertionResult result(checkEntry(*entry, fullId, type, checker)); - if (outputRootEntry_ != NULL && entry->correspondingOutputEntry() == NULL) + if (outputRootEntry_ != nullptr && entry->correspondingOutputEntry() == nullptr) { if (!updateMismatchingEntries_ || result) { @@ -768,7 +768,7 @@ void TestReferenceChecker::checkUnusedEntries() bool TestReferenceChecker::checkPresent(bool bPresent, const char *id) { - if (impl_->shouldIgnore() || impl_->outputRootEntry_ != NULL) + if (impl_->shouldIgnore() || impl_->outputRootEntry_ != nullptr) { return bPresent; } @@ -801,7 +801,7 @@ TestReferenceChecker TestReferenceChecker::checkCompound(const char *type, const std::string fullId = impl_->appendPath(id); NullChecker checker; ReferenceDataEntry *entry = impl_->findOrCreateEntry(type, id, checker); - if (entry == NULL) + if (entry == nullptr) { ADD_FAILURE() << "Reference data item " << fullId << " not found"; return TestReferenceChecker(new Impl(true)); @@ -820,7 +820,7 @@ TestReferenceChecker TestReferenceChecker::checkCompound(const char *type, const return TestReferenceChecker(new Impl(true)); } } - if (impl_->outputRootEntry_ != NULL && entry->correspondingOutputEntry() == NULL) + if (impl_->outputRootEntry_ != nullptr && entry->correspondingOutputEntry() == nullptr) { impl_->outputRootEntry_->addChild(entry->cloneToOutputEntry()); } diff --git a/src/testutils/refdata.h b/src/testutils/refdata.h index 1fd128ecdc..e1cd287fe7 100644 --- a/src/testutils/refdata.h +++ b/src/testutils/refdata.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -492,7 +492,7 @@ class TestReferenceChecker TestReferenceChecker compound(checkSequenceCompound(id, length)); for (Iterator i = begin; i != end; ++i) { - compound.checkValue(*i, NULL); + compound.checkValue(*i, nullptr); } } /*! \brief diff --git a/src/testutils/testfilemanager.cpp b/src/testutils/testfilemanager.cpp index e3841fb48c..5d55a58434 100644 --- a/src/testutils/testfilemanager.cpp +++ b/src/testutils/testfilemanager.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -112,7 +112,7 @@ class TestFileManager::Impl }; std::string TestFileManager::Impl::s_inputDirectory; -const char *TestFileManager::Impl::s_globalOutputTempDirectory = NULL; +const char *TestFileManager::Impl::s_globalOutputTempDirectory = nullptr; /** Controls whether TestFileManager should delete temporary files after the test finishes. */ static bool g_bDeleteFilesAfterTest = true; @@ -206,7 +206,7 @@ const char *TestFileManager::getInputDataDirectory() const char *TestFileManager::getGlobalOutputTempDirectory() { - GMX_RELEASE_ASSERT(Impl::s_globalOutputTempDirectory != NULL, "Global path for temporary output files from tests is not set"); + GMX_RELEASE_ASSERT(Impl::s_globalOutputTempDirectory != nullptr, "Global path for temporary output files from tests is not set"); return Impl::s_globalOutputTempDirectory; } diff --git a/src/testutils/testfileredirector.cpp b/src/testutils/testfileredirector.cpp index ef233ddf90..993b4070e7 100644 --- a/src/testutils/testfileredirector.cpp +++ b/src/testutils/testfileredirector.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -80,7 +80,7 @@ bool TestFileInputRedirector::fileExists(const char *filename, { if (existingFiles_.count(filename) == 0) { - File::NotFoundInfo info(filename, "File not present in test", NULL, false, 0); + File::NotFoundInfo info(filename, "File not present in test", nullptr, false, 0); onNotFound(info); return false; } diff --git a/src/testutils/testinit.cpp b/src/testutils/testinit.cpp index 5ade1e5a1d..751e3e5d18 100644 --- a/src/testutils/testinit.cpp +++ b/src/testutils/testinit.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -145,7 +145,7 @@ void printHelp(const Options &options) "\nYou can use the following GROMACS-specific command-line flags\n" "to control the behavior of the tests:\n\n"); TextWriter writer(&TextOutputFile::standardError()); - CommandLineHelpContext context(&writer, eHelpOutputFormat_Console, NULL, program); + CommandLineHelpContext context(&writer, eHelpOutputFormat_Console, nullptr, program); context.setModuleDisplayName(program); CommandLineHelpWriter(options).writeHelp(context); } @@ -185,14 +185,14 @@ void initTestUtils(const char *dataPath, const char *tempPath, bool usesMpi, setProgramContext(g_testContext.get()); // Use the default finder that does not respect GMXLIB, since the tests // generally can only get confused by a different set of data files. - setLibraryFileFinder(NULL); + setLibraryFileFinder(nullptr); ::testing::InitGoogleMock(argc, *argv); - if (dataPath != NULL) + if (dataPath != nullptr) { TestFileManager::setInputDataDirectory( Path::join(CMAKE_SOURCE_DIR, dataPath)); } - if (tempPath != NULL) + if (tempPath != nullptr) { TestFileManager::setGlobalOutputTempDirectory(tempPath); } @@ -256,7 +256,7 @@ void initTestUtils(const char *dataPath, const char *tempPath, bool usesMpi, void finalizeTestUtils() { - setProgramContext(NULL); + setProgramContext(nullptr); g_testContext.reset(); finalizeForCommandLine(); } diff --git a/src/testutils/tests/refdata_tests.cpp b/src/testutils/tests/refdata_tests.cpp index 52b4ba7b0b..f81272a73a 100644 --- a/src/testutils/tests/refdata_tests.cpp +++ b/src/testutils/tests/refdata_tests.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -195,7 +195,7 @@ typedef double dvec[3]; //! Helper function for HandlesSequenceOfCustomData void checkCustomVector(TestReferenceChecker *checker, const dvec &value) { - checker->checkVector(value, NULL); + checker->checkVector(value, nullptr); } TEST(ReferenceDataTest, HandlesSequenceOfCustomData) @@ -514,8 +514,8 @@ TEST(ReferenceDataTest, HandlesStringsWithTextAndWhitespace) TestReferenceChecker checker(data.rootChecker()); for (const auto &s : strings) { - checker.checkString(s, NULL); - checker.checkTextBlock(s, NULL); + checker.checkString(s, nullptr); + checker.checkTextBlock(s, nullptr); } } { @@ -523,8 +523,8 @@ TEST(ReferenceDataTest, HandlesStringsWithTextAndWhitespace) TestReferenceChecker checker(data.rootChecker()); for (const auto &s : strings) { - checker.checkString(s, NULL); - checker.checkTextBlock(s, NULL); + checker.checkString(s, nullptr); + checker.checkTextBlock(s, nullptr); } } } @@ -625,15 +625,15 @@ TEST(ReferenceDataTest, HandlesMultipleNullIds) { TestReferenceData data(gmx::test::erefdataUpdateAll); TestReferenceChecker checker(data.rootChecker()); - checker.checkString("Test", NULL); - checker.checkString("Test2", NULL); + checker.checkString("Test", nullptr); + checker.checkString("Test2", nullptr); } { TestReferenceData data(gmx::test::erefdataCompare); TestReferenceChecker checker(data.rootChecker()); - checker.checkString("Test", NULL); - checker.checkString("Test2", NULL); - EXPECT_NONFATAL_FAILURE(checker.checkString("Test", NULL), ""); + checker.checkString("Test", nullptr); + checker.checkString("Test2", nullptr); + EXPECT_NONFATAL_FAILURE(checker.checkString("Test", nullptr), ""); } } @@ -644,26 +644,26 @@ TEST(ReferenceDataTest, HandlesMultipleComparisonsAgainstNullIds) TestReferenceData data(gmx::test::erefdataUpdateAll); TestReferenceChecker checker(data.rootChecker()); checker.checkInteger(1, "int1"); - checker.checkString("Test", NULL); - checker.checkString("Test2", NULL); + checker.checkString("Test", nullptr); + checker.checkString("Test2", nullptr); checker.checkInteger(2, "int2"); - EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", NULL), ""); - checker.checkString("Test2", NULL); + EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", nullptr), ""); + checker.checkString("Test2", nullptr); } { TestReferenceData data(gmx::test::erefdataCompare); TestReferenceChecker checker(data.rootChecker()); checker.checkInteger(1, "int1"); - checker.checkString("Test", NULL); - checker.checkString("Test2", NULL); + checker.checkString("Test", nullptr); + checker.checkString("Test2", nullptr); checker.checkInteger(2, "int2"); - EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", NULL), ""); + EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", nullptr), ""); checker.checkInteger(1, "int1"); - checker.checkString("Test", NULL); - checker.checkString("Test2", NULL); - EXPECT_NONFATAL_FAILURE(checker.checkString("Test", NULL), ""); + checker.checkString("Test", nullptr); + checker.checkString("Test2", nullptr); + EXPECT_NONFATAL_FAILURE(checker.checkString("Test", nullptr), ""); checker.checkInteger(2, "int2"); - EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", NULL), ""); + EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", nullptr), ""); } } diff --git a/src/testutils/xvgtest.cpp b/src/testutils/xvgtest.cpp index 560232fd38..d1b2a3e6f0 100644 --- a/src/testutils/xvgtest.cpp +++ b/src/testutils/xvgtest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -96,7 +96,7 @@ bool isRelevantXvgCommand(const std::string &line) //! Helper function to check a single xvg value in a sequence. void checkXvgDataPoint(TestReferenceChecker *checker, const std::string &value) { - checker->checkRealFromString(value, NULL); + checker->checkRealFromString(value, nullptr); } } // namespace -- 2.22.0